securemark 0.258.8 → 0.259.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/design.md +4 -4
  3. package/dist/index.js +138 -131
  4. package/markdown.d.ts +37 -19
  5. package/package.json +1 -1
  6. package/src/combinator/data/parser/context.ts +16 -17
  7. package/src/parser/api/bind.ts +2 -2
  8. package/src/parser/api/parse.ts +2 -2
  9. package/src/parser/block/reply/cite.test.ts +3 -1
  10. package/src/parser/block/reply/cite.ts +1 -0
  11. package/src/parser/context.ts +15 -6
  12. package/src/parser/inline/annotation.ts +3 -4
  13. package/src/parser/inline/autolink/account.ts +2 -2
  14. package/src/parser/inline/autolink/anchor.ts +2 -2
  15. package/src/parser/inline/autolink/hashnum.ts +2 -2
  16. package/src/parser/inline/autolink/hashtag.ts +2 -2
  17. package/src/parser/inline/autolink/url.ts +2 -2
  18. package/src/parser/inline/autolink.ts +1 -1
  19. package/src/parser/inline/bracket.ts +8 -8
  20. package/src/parser/inline/comment.ts +2 -2
  21. package/src/parser/inline/deletion.ts +2 -2
  22. package/src/parser/inline/emphasis.ts +2 -2
  23. package/src/parser/inline/emstrong.ts +2 -2
  24. package/src/parser/inline/extension/index.ts +3 -4
  25. package/src/parser/inline/extension/placeholder.ts +2 -2
  26. package/src/parser/inline/html.ts +2 -2
  27. package/src/parser/inline/insertion.ts +2 -2
  28. package/src/parser/inline/link.ts +70 -66
  29. package/src/parser/inline/mark.ts +2 -2
  30. package/src/parser/inline/media.ts +11 -10
  31. package/src/parser/inline/reference.ts +3 -4
  32. package/src/parser/inline/ruby.ts +2 -2
  33. package/src/parser/inline/strong.ts +2 -2
  34. package/src/parser/inline/template.ts +2 -2
  35. package/src/parser/inline.ts +0 -1
  36. package/src/parser/source/text.ts +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.258.8 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.259.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -2855,36 +2855,34 @@ function apply(parser, source, context, changes, values) {
2855
2855
  return result;
2856
2856
  }
2857
2857
 
2858
- function syntax(syntax, precedence, cost, parser) {
2859
- return creation(cost, (source, context) => {
2858
+ function syntax(syntax, prec, cost, state, parser) {
2859
+ return creation(cost, precedence(prec, (source, context) => {
2860
2860
  if (source === '') return;
2861
2861
  const memo = context.memo ??= new memo_1.Memo();
2862
2862
  context.memorable ??= ~0;
2863
- const p = context.precedence;
2864
- context.precedence = precedence;
2865
2863
  const position = source.length;
2866
- const state = context.state ?? 0;
2867
- const cache = syntax && memo.get(position, syntax, state);
2864
+ const st0 = context.state ?? 0;
2865
+ const st1 = context.state = st0 | state;
2866
+ const cache = syntax && memo.get(position, syntax, st1);
2868
2867
  const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(source, context);
2869
2868
 
2870
- if (syntax && state & context.memorable) {
2871
- cache ?? memo.set(position, syntax, state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2869
+ if (syntax && st0 & context.memorable) {
2870
+ cache ?? memo.set(position, syntax, st1, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2872
2871
  }
2873
2872
 
2874
- if (result && !state && memo.length >= position) {
2875
- memo.clear(position);
2873
+ if (result && !st0 && memo.length >= position + 2) {
2874
+ memo.clear(position + 2);
2876
2875
  }
2877
2876
 
2878
- context.precedence = p;
2877
+ context.state = st0;
2879
2878
  return result;
2880
- });
2879
+ }));
2881
2880
  }
2882
2881
 
2883
2882
  exports.syntax = syntax;
2884
2883
 
2885
2884
  function creation(cost, parser) {
2886
2885
  if (typeof cost === 'function') return creation(1, cost);
2887
- if (cost === 0) return parser;
2888
2886
  return (source, context) => {
2889
2887
  const {
2890
2888
  resources = {
@@ -3459,8 +3457,6 @@ const header_1 = __webpack_require__(5702);
3459
3457
 
3460
3458
  const block_1 = __webpack_require__(4032);
3461
3459
 
3462
- const context_1 = __webpack_require__(6484);
3463
-
3464
3460
  const normalize_1 = __webpack_require__(185);
3465
3461
 
3466
3462
  const header_2 = __webpack_require__(7790);
@@ -3476,7 +3472,9 @@ const array_1 = __webpack_require__(8112);
3476
3472
  function bind(target, settings) {
3477
3473
  let context = { ...settings,
3478
3474
  host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3479
- memorable: context_1.backtrackable
3475
+ memorable: 118
3476
+ /* State.backtrackable */
3477
+
3480
3478
  };
3481
3479
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3482
3480
  const blocks = [];
@@ -3810,8 +3808,6 @@ const header_1 = __webpack_require__(5702);
3810
3808
 
3811
3809
  const block_1 = __webpack_require__(4032);
3812
3810
 
3813
- const context_1 = __webpack_require__(6484);
3814
-
3815
3811
  const normalize_1 = __webpack_require__(185);
3816
3812
 
3817
3813
  const header_2 = __webpack_require__(7790);
@@ -3836,7 +3832,9 @@ function parse(source, opts = {}, context) {
3836
3832
  ...(context?.resources && {
3837
3833
  resources: context.resources
3838
3834
  }),
3839
- memorable: context_1.backtrackable
3835
+ memorable: 118
3836
+ /* State.backtrackable */
3837
+
3840
3838
  };
3841
3839
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3842
3840
  const node = (0, dom_1.frag)();
@@ -5287,6 +5285,10 @@ exports.cite = (0, combinator_1.creation)((0, combinator_1.line)((0, combinator_
5287
5285
  class: 'anchor'
5288
5286
  }, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, source => [[(0, dom_1.html)('a', {
5289
5287
  class: 'anchor'
5288
+ }, source)], '']), (0, combinator_1.focus)(/^>>https?:\/\/\w\S*[^\S\n]*(?:$|\n)/, source => [[(0, dom_1.html)('a', {
5289
+ class: 'anchor',
5290
+ href: source.slice(2).trimEnd(),
5291
+ target: '_blank'
5290
5292
  }, source)], ''])])]))), ([el, quotes = '']) => [(0, dom_1.html)('span', {
5291
5293
  class: 'cite'
5292
5294
  }, (0, dom_1.defrag)([`${quotes}>`, (0, dom_1.define)(el, {
@@ -5507,30 +5509,6 @@ function format(el) {
5507
5509
 
5508
5510
  /***/ }),
5509
5511
 
5510
- /***/ 6484:
5511
- /***/ ((__unused_webpack_module, exports) => {
5512
-
5513
- "use strict";
5514
-
5515
-
5516
- Object.defineProperty(exports, "__esModule", ({
5517
- value: true
5518
- }));
5519
- exports.backtrackable = void 0;
5520
- exports.backtrackable = 0 | 64
5521
- /* State.annotation */
5522
- | 32
5523
- /* State.reference */
5524
- | 16
5525
- /* State.index */
5526
- | 4
5527
- /* State.link */
5528
- | 2
5529
- /* State.media */
5530
- ;
5531
-
5532
- /***/ }),
5533
-
5534
5512
  /***/ 5702:
5535
5513
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5536
5514
 
@@ -5701,15 +5679,15 @@ const dom_1 = __webpack_require__(3252);
5701
5679
 
5702
5680
  exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(64
5703
5681
  /* State.annotation */
5704
- , false, (0, combinator_1.state)(64
5682
+ , false, (0, combinator_1.syntax)(32
5683
+ /* Syntax.annotation */
5684
+ , 6, 1, 64
5705
5685
  /* State.annotation */
5706
5686
  | 2
5707
5687
  /* State.media */
5708
- , (0, combinator_1.syntax)(32
5709
- /* Syntax.annotation */
5710
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
5688
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
5711
5689
  delimiters: global_1.undefined
5712
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5690
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5713
5691
  class: 'annotation'
5714
5692
  }, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
5715
5693
 
@@ -5750,7 +5728,9 @@ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-
5750
5728
  /* State.autolink */
5751
5729
  , false, (0, combinator_1.syntax)(2
5752
5730
  /* Syntax.autolink */
5753
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5731
+ , 1, 1, 0
5732
+ /* State.none */
5733
+ , (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5754
5734
  (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.
5755
5735
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5756
5736
  (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.
@@ -5778,7 +5758,7 @@ const source_1 = __webpack_require__(6743);
5778
5758
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5779
5759
 
5780
5760
 
5781
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5761
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5782
5762
  class: 'account'
5783
5763
  })]));
5784
5764
 
@@ -5807,7 +5787,7 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5807
5787
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5808
5788
 
5809
5789
 
5810
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5790
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5811
5791
  class: 'anchor'
5812
5792
  })])));
5813
5793
 
@@ -5894,7 +5874,7 @@ const source_1 = __webpack_require__(6743);
5894
5874
 
5895
5875
  const dom_1 = __webpack_require__(3252);
5896
5876
 
5897
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5877
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5898
5878
  class: 'hashnum',
5899
5879
  href: null
5900
5880
  })]));
@@ -5923,7 +5903,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5923
5903
 
5924
5904
 
5925
5905
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5926
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5906
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5927
5907
  class: 'hashtag'
5928
5908
  }, el.innerText)]));
5929
5909
 
@@ -5947,7 +5927,7 @@ const link_1 = __webpack_require__(9628);
5947
5927
  const source_1 = __webpack_require__(6743);
5948
5928
 
5949
5929
  const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5950
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.textlink])))));
5930
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.unsafelink])))));
5951
5931
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5952
5932
 
5953
5933
  /***/ }),
@@ -5978,24 +5958,38 @@ const array_1 = __webpack_require__(8112);
5978
5958
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5979
5959
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
5980
5960
  /* Syntax.none */
5981
- , 2, 1, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5961
+ , 2, 1, 0
5962
+ /* State.none */
5963
+ , (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5982
5964
  /* Syntax.bracket */
5983
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5965
+ , 2, 1, 0
5966
+ /* State.none */
5967
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5984
5968
  class: 'paren'
5985
5969
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
5986
5970
  /* Syntax.none */
5987
- , 2, 1, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5971
+ , 2, 1, 0
5972
+ /* State.none */
5973
+ , (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5988
5974
  /* Syntax.bracket */
5989
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5975
+ , 2, 1, 0
5976
+ /* State.none */
5977
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5990
5978
  class: 'paren'
5991
5979
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.syntax)(128
5992
5980
  /* Syntax.bracket */
5993
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
5981
+ , 2, 1, 0
5982
+ /* State.none */
5983
+ , (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
5994
5984
  /* Syntax.bracket */
5995
- , 2, 1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5985
+ , 2, 1, 0
5986
+ /* State.none */
5987
+ , (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5996
5988
  (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(1
5997
5989
  /* Syntax.quote */
5998
- , 8, 1, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
5990
+ , 8, 1, 0
5991
+ /* State.none */
5992
+ , (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
5999
5993
 
6000
5994
  /***/ }),
6001
5995
 
@@ -6049,7 +6043,9 @@ const array_1 = __webpack_require__(8112);
6049
6043
 
6050
6044
  exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6051
6045
  /* Syntax.none */
6052
- , 4, 1, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6046
+ , 4, 1, 0
6047
+ /* State.none */
6048
+ , (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6053
6049
  class: 'comment'
6054
6050
  }, [(0, dom_1.html)('input', {
6055
6051
  type: 'checkbox'
@@ -6082,7 +6078,9 @@ const array_1 = __webpack_require__(8112);
6082
6078
 
6083
6079
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
6084
6080
  /* Syntax.none */
6085
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6081
+ , 1, 1, 0
6082
+ /* State.none */
6083
+ , (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6086
6084
 
6087
6085
  /***/ }),
6088
6086
 
@@ -6115,7 +6113,9 @@ const array_1 = __webpack_require__(8112);
6115
6113
 
6116
6114
  exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
6117
6115
  /* Syntax.none */
6118
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6116
+ , 1, 1, 0
6117
+ /* State.none */
6118
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6119
6119
 
6120
6120
  /***/ }),
6121
6121
 
@@ -6150,7 +6150,9 @@ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combin
6150
6150
  const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
6151
6151
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0
6152
6152
  /* Syntax.none */
6153
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6153
+ , 1, 1, 0
6154
+ /* State.none */
6155
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6154
6156
  switch (cs[0]) {
6155
6157
  case '***':
6156
6158
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -6253,23 +6255,11 @@ const dom_1 = __webpack_require__(3252);
6253
6255
 
6254
6256
  exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(16
6255
6257
  /* State.index */
6256
- , false, (0, combinator_1.state)(64
6257
- /* State.annotation */
6258
- | 32
6259
- /* State.reference */
6260
- | 16
6261
- /* State.index */
6262
- | 8
6263
- /* State.label */
6264
- | 4
6265
- /* State.link */
6266
- | 2
6267
- /* State.media */
6268
- | 1
6269
- /* State.autolink */
6270
- , (0, combinator_1.syntax)(1024
6258
+ , false, (0, combinator_1.syntax)(1024
6271
6259
  /* Syntax.index */
6272
- , 2, 1, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true))))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6260
+ , 2, 1, 127
6261
+ /* State.linkable */
6262
+ , (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6273
6263
  id: el.id ? null : global_1.undefined,
6274
6264
  class: 'index',
6275
6265
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6472,7 +6462,9 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6472
6462
 
6473
6463
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(0
6474
6464
  /* Syntax.none */
6475
- , 2, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6465
+ , 2, 1, 0
6466
+ /* State.none */
6467
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6476
6468
  class: 'invalid',
6477
6469
  'data-invalid-syntax': 'extension',
6478
6470
  'data-invalid-type': 'syntax',
@@ -6520,7 +6512,9 @@ global_1.Object.setPrototypeOf(attrspecs, null);
6520
6512
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6521
6513
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
6522
6514
  /* Syntax.none */
6523
- , 5, 1, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6515
+ , 5, 1, 0
6516
+ /* State.none */
6517
+ , (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6524
6518
  (0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6525
6519
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6526
6520
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
@@ -6637,7 +6631,9 @@ const array_1 = __webpack_require__(8112);
6637
6631
 
6638
6632
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
6639
6633
  /* Syntax.none */
6640
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6634
+ , 1, 1, 0
6635
+ /* State.none */
6636
+ , (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6641
6637
 
6642
6638
  /***/ }),
6643
6639
 
@@ -6650,7 +6646,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0,
6650
6646
  Object.defineProperty(exports, "__esModule", ({
6651
6647
  value: true
6652
6648
  }));
6653
- exports.resolve = exports.option = exports.uri = exports.textlink = exports.link = void 0;
6649
+ exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.link = void 0;
6654
6650
 
6655
6651
  const global_1 = __webpack_require__(4128);
6656
6652
 
@@ -6678,49 +6674,47 @@ const optspec = {
6678
6674
  rel: ['nofollow']
6679
6675
  };
6680
6676
  Object.setPrototypeOf(optspec, null);
6681
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.constraint)(4
6677
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.union)([medialink, textlink])));
6678
+ const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6682
6679
  /* State.link */
6683
- , false, (0, combinator_1.creation)(10, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.state)(4
6684
- /* State.link */
6685
- , (0, combinator_1.dup)((0, combinator_1.union)([(0, combinator_1.surround)('[', inline_1.media, ']'), (0, combinator_1.surround)('[', inline_1.shortmedia, ']'), (0, combinator_1.surround)('[', (0, combinator_1.state)(64
6686
- /* State.annotation */
6687
- | 32
6688
- /* State.reference */
6689
- | 16
6690
- /* State.index */
6691
- | 8
6692
- /* State.label */
6693
- | 2
6694
- /* State.media */
6695
- | 1
6696
- /* State.autolink */
6697
- , (0, combinator_1.syntax)(256
6680
+ , false, (0, combinator_1.syntax)(256
6698
6681
  /* Syntax.link */
6699
- , 2, 0, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]]))), ']', true)]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))], nodes => nodes[0][0] !== ''), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []]))), ([content, params], rest, context) => {
6700
- if (content[0] === '') return [content, rest];
6701
- if (params.length === 0) return;
6682
+ , 2, 10, 127
6683
+ /* State.linkable */
6684
+ , (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6702
6685
  if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
6703
6686
 
6704
6687
  for (let source = (0, util_1.stringify)(content); source;) {
6705
- const result = (0, autolink_1.autolink)(source, context);
6688
+ const result = (0, combinator_1.state)(1
6689
+ /* State.autolink */
6690
+ , false, autolink_1.autolink)(source, context);
6706
6691
  if (typeof (0, parser_1.eval)(result)[0] === 'object') return;
6707
6692
  source = (0, parser_1.exec)(result);
6708
6693
  }
6709
6694
 
6695
+ return parse(content, params, rest, context);
6696
+ }))));
6697
+ const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6698
+ /* State.link */
6699
+ | 2
6700
+ /* State.media */
6701
+ , false, (0, combinator_1.syntax)(256
6702
+ /* Syntax.link */
6703
+ , 2, 10, 127
6704
+ /* State.linkable */
6705
+ ^ 2
6706
+ /* State.media */
6707
+ , (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
6708
+ exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
6709
+ exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6710
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6711
+
6712
+ function parse(content, params, rest, context) {
6710
6713
  const INSECURE_URI = params.shift();
6711
6714
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6712
6715
  if (el.className === 'invalid') return [[el], rest];
6713
6716
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6714
- })));
6715
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.creation)(10, (0, combinator_1.precedence)(2, (0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])))), ([params, content = []], rest, context) => {
6716
- params.shift();
6717
- (0, visibility_1.trimNode)(content);
6718
- const INSECURE_URI = params.shift();
6719
- const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6720
- return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6721
- })));
6722
- exports.uri = (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]), ([uri]) => ['\r', uri]);
6723
- exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6717
+ }
6724
6718
 
6725
6719
  function resolve(uri, host, source) {
6726
6720
  switch (true) {
@@ -6823,7 +6817,9 @@ const array_1 = __webpack_require__(8112);
6823
6817
 
6824
6818
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
6825
6819
  /* Syntax.none */
6826
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)])))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6820
+ , 1, 1, 0
6821
+ /* State.none */
6822
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)])))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6827
6823
 
6828
6824
  /***/ }),
6829
6825
 
@@ -6900,11 +6896,13 @@ const optspec = {
6900
6896
  rel: global_1.undefined
6901
6897
  };
6902
6898
  Object.setPrototypeOf(optspec, null);
6903
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.constraint)(2
6899
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(2
6904
6900
  /* State.media */
6905
6901
  , false, (0, combinator_1.syntax)(64
6906
6902
  /* Syntax.media */
6907
- , 2, 10, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))])))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6903
+ , 2, 10, 0
6904
+ /* State.none */
6905
+ , (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6908
6906
  const INSECURE_URI = params.shift();
6909
6907
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6910
6908
  let cache;
@@ -6924,11 +6922,12 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6924
6922
 
6925
6923
  if (context.state & 4
6926
6924
  /* State.link */
6927
- || cache && cache.tagName !== 'IMG') return [[el], rest];
6928
- return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6925
+ ) return [[el], rest];
6926
+ if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])('!', context);
6927
+ return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => [(0, dom_1.define)(link, {
6929
6928
  target: '_blank'
6930
6929
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6931
- })));
6930
+ }))))));
6932
6931
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
6933
6932
  const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
6934
6933
 
@@ -7001,17 +7000,17 @@ const dom_1 = __webpack_require__(3252);
7001
7000
 
7002
7001
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
7003
7002
  /* State.reference */
7004
- , false, (0, combinator_1.state)(64
7003
+ , false, (0, combinator_1.syntax)(4096
7004
+ /* Syntax.reference */
7005
+ , 6, 1, 64
7005
7006
  /* State.annotation */
7006
7007
  | 32
7007
7008
  /* State.reference */
7008
7009
  | 2
7009
7010
  /* State.media */
7010
- , (0, combinator_1.syntax)(4096
7011
- /* Syntax.reference */
7012
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
7011
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
7013
7012
  delimiters: global_1.undefined
7014
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']')))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7013
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7015
7014
  const abbr = (0, combinator_1.creation)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
7016
7015
 
7017
7016
  function attributes(ns) {
@@ -7059,7 +7058,9 @@ const array_1 = __webpack_require__(8112);
7059
7058
 
7060
7059
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(0
7061
7060
  /* Syntax.none */
7062
- , 2, 1, (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7061
+ , 2, 1, 0
7062
+ /* State.none */
7063
+ , (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7063
7064
  texts[texts.length - 1] === '' && texts.pop();
7064
7065
 
7065
7066
  switch (true) {
@@ -7181,7 +7182,9 @@ const array_1 = __webpack_require__(8112);
7181
7182
 
7182
7183
  exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**'), (0, combinator_1.syntax)(0
7183
7184
  /* Syntax.none */
7184
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*')), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7185
+ , 1, 1, 0
7186
+ /* State.none */
7187
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*')), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7185
7188
 
7186
7189
  /***/ }),
7187
7190
 
@@ -7208,7 +7211,9 @@ const array_1 = __webpack_require__(8112);
7208
7211
 
7209
7212
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
7210
7213
  /* Syntax.none */
7211
- , 2, 1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7214
+ , 2, 1, 0
7215
+ /* State.none */
7216
+ , (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7212
7217
  class: 'template'
7213
7218
  }, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
7214
7219
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)])));
@@ -7986,7 +7991,9 @@ exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
7986
7991
  const repeat = (0, str_1.str)(/^(.)\1*/);
7987
7992
  exports.text = (0, combinator_1.syntax)(0
7988
7993
  /* Syntax.none */
7989
- , 1, 1, (source, context) => {
7994
+ , 1, 1, 0
7995
+ /* State.none */
7996
+ , (source, context) => {
7990
7997
  if (source === '') return;
7991
7998
  const i = source.search(exports.delimiter);
7992
7999