securemark 0.294.11 → 0.295.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 (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/design.md +5 -5
  3. package/dist/index.js +119 -119
  4. package/package.json +1 -1
  5. package/src/combinator/control/constraint/block.ts +1 -1
  6. package/src/combinator/control/constraint/contract.ts +5 -6
  7. package/src/combinator/control/constraint/line.ts +1 -2
  8. package/src/combinator/control/manipulation/convert.ts +1 -1
  9. package/src/combinator/control/manipulation/fallback.ts +1 -1
  10. package/src/combinator/control/manipulation/indent.ts +2 -2
  11. package/src/combinator/control/manipulation/lazy.ts +1 -1
  12. package/src/combinator/control/manipulation/match.ts +2 -5
  13. package/src/combinator/control/manipulation/recovery.ts +1 -1
  14. package/src/combinator/control/manipulation/reverse.ts +1 -1
  15. package/src/combinator/control/manipulation/scope.ts +3 -7
  16. package/src/combinator/control/manipulation/surround.ts +45 -56
  17. package/src/combinator/control/monad/bind.ts +7 -12
  18. package/src/combinator/control/monad/fmap.ts +4 -4
  19. package/src/combinator/data/parser/context.ts +12 -12
  20. package/src/combinator/data/parser/inits.ts +3 -6
  21. package/src/combinator/data/parser/sequence.ts +3 -6
  22. package/src/combinator/data/parser/some.ts +2 -2
  23. package/src/combinator/data/parser/subsequence.ts +1 -1
  24. package/src/combinator/data/parser/tails.ts +1 -1
  25. package/src/combinator/data/parser/union.ts +1 -1
  26. package/src/combinator/data/parser.ts +10 -9
  27. package/src/parser/context.ts +6 -6
  28. package/src/parser/inline/annotation.ts +1 -1
  29. package/src/parser/inline/autolink/account.ts +1 -1
  30. package/src/parser/inline/autolink/url.ts +4 -5
  31. package/src/parser/inline/bracket.ts +27 -18
  32. package/src/parser/inline/extension/indexee.ts +1 -1
  33. package/src/parser/inline/link.ts +3 -3
  34. package/src/parser/inline/media.ts +1 -1
  35. package/src/parser/inline/reference.ts +9 -9
  36. package/src/parser/inline/ruby.ts +2 -2
  37. package/src/parser/visibility.ts +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.294.11 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.295.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("Prism"), require("DOMPurify"));
@@ -2945,7 +2945,7 @@ function match(pattern, f) {
2945
2945
  count && (0, combinator_1.consume)(params[0].length, context);
2946
2946
  const result = f(params)(input);
2947
2947
  context.position += result && context.position === position ? params[0].length : 0;
2948
- return context.position > position ? result : undefined;
2948
+ return result;
2949
2949
  });
2950
2950
  }
2951
2951
  exports.match = match;
@@ -3111,6 +3111,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
3111
3111
  case 'object':
3112
3112
  closer = (0, combinator_1.clear)((0, combinator_1.matcher)(closer, true));
3113
3113
  }
3114
+ const [blen, rbs, wbs] = reduce(backtracks);
3114
3115
  return (0, parser_1.failsafe)(input => {
3115
3116
  const {
3116
3117
  context
@@ -3128,20 +3129,20 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
3128
3129
  if (!nodesO) {
3129
3130
  return void revert(context, linebreak);
3130
3131
  }
3131
- if (isBacktrack(context, backtracks, position, context.position - position || 1)) {
3132
+ if (rbs && isBacktrack(context, rbs, position, blen)) {
3132
3133
  return void revert(context, linebreak);
3133
3134
  }
3134
3135
  const nodesM = context.position < source.length ? parser(input) : undefined;
3135
3136
  context.range = context.position - position;
3136
3137
  if (!nodesM && !optional) {
3137
- setBacktrack(context, backtracks, position);
3138
+ wbs && setBacktrack(context, wbs, position);
3138
3139
  const result = g?.([nodesO, nodesM], context);
3139
3140
  return result || void revert(context, linebreak);
3140
3141
  }
3141
3142
  const nodesC = nodesM || optional ? closer(input) : undefined;
3142
3143
  context.range = context.position - position;
3143
3144
  if (!nodesC) {
3144
- setBacktrack(context, backtracks, position);
3145
+ wbs && setBacktrack(context, wbs, position);
3145
3146
  const result = g?.([nodesO, nodesM], context);
3146
3147
  return result || void revert(context, linebreak);
3147
3148
  }
@@ -3157,74 +3158,59 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
3157
3158
  });
3158
3159
  }
3159
3160
  exports.surround = surround;
3160
- function open(opener, parser, optional, backtracks) {
3161
+ function open(opener, parser, optional, backtracks = []) {
3161
3162
  return surround(opener, parser, '', optional, backtracks);
3162
3163
  }
3163
3164
  exports.open = open;
3164
- function close(parser, closer, optional, backtracks) {
3165
+ function close(parser, closer, optional, backtracks = []) {
3165
3166
  return surround('', parser, closer, optional, backtracks);
3166
3167
  }
3167
3168
  exports.close = close;
3168
- const statesize = 2;
3169
- function isBacktrack(context, backtracks, position = context.position, length = 1) {
3169
+ const commandsize = 2;
3170
+ function isBacktrack(context, backtrack, position = context.position, length = 1) {
3170
3171
  const {
3171
- source
3172
+ backtracks = {},
3173
+ offset = 0
3172
3174
  } = context;
3173
- if (position === source.length) return false;
3174
- if (length === 0) return false;
3175
- for (const backtrack of backtracks) {
3176
- if (backtrack & 1) {
3177
- const {
3178
- backtracks = {},
3179
- offset = 0
3180
- } = context;
3181
- for (let i = 0; i < length; ++i) {
3182
- if (position + i === source.length) break;
3183
- if (source[position + i] !== source[position + 0]) break;
3184
- const pos = position + i + offset;
3185
- if (!(pos in backtracks)) continue;
3186
- if (backtracks[pos] & 1 << size(backtrack >>> statesize)) return true;
3187
- }
3188
- }
3175
+ for (let i = 0; i < length; ++i) {
3176
+ if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
3189
3177
  }
3190
3178
  return false;
3191
3179
  }
3192
3180
  exports.isBacktrack = isBacktrack;
3193
- function setBacktrack(context, backtracks, position, length = 1) {
3181
+ function setBacktrack(context, backtrack, position, length = 1) {
3194
3182
  // バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3183
+
3195
3184
  const {
3196
- source
3185
+ backtracks = {},
3186
+ offset = 0
3197
3187
  } = context;
3198
- if (position === source.length) return;
3199
- if (length === 0) return;
3188
+ for (let i = 0; i < length; ++i) {
3189
+ backtracks[position + i + offset] |= backtrack >>> commandsize;
3190
+ }
3191
+ }
3192
+ exports.setBacktrack = setBacktrack;
3193
+ function reduce(backtracks) {
3194
+ let len = 1;
3195
+ let rbs = 0;
3196
+ let wbs = 0;
3200
3197
  for (const backtrack of backtracks) {
3201
- if (backtrack & 2) {
3202
- const {
3203
- backtracks = {},
3204
- offset = 0
3205
- } = context;
3206
- for (let i = 0; i < length; ++i) {
3207
- if (position + i === source.length) break;
3208
- const pos = position + i + offset;
3209
- backtracks[pos] |= 1 << size(backtrack >>> statesize);
3210
- }
3198
+ if (backtrack >>> commandsize === 0) {
3199
+ len = backtrack;
3200
+ continue;
3201
+ }
3202
+ if (1 & backtrack) {
3203
+ rbs |= backtrack;
3204
+ }
3205
+ if (2 & backtrack) {
3206
+ wbs |= backtrack;
3211
3207
  }
3212
3208
  }
3209
+ return [len, rbs, wbs];
3213
3210
  }
3214
- exports.setBacktrack = setBacktrack;
3215
3211
  function revert(context, linebreak) {
3216
3212
  context.linebreak = linebreak;
3217
3213
  }
3218
- function size(bits) {
3219
- if (bits === 0) return 0;
3220
- let p = 0;
3221
- for (let s = 32 / 2; s > 0; s >>>= 1) {
3222
- const q = p + s;
3223
- if (bits >>> q === 0) continue;
3224
- p = q;
3225
- }
3226
- return p + 1;
3227
- }
3228
3214
 
3229
3215
  /***/ },
3230
3216
 
@@ -3249,11 +3235,10 @@ function bind(parser, f) {
3249
3235
  position
3250
3236
  } = context;
3251
3237
  if (position === source.length) return;
3252
- const res1 = parser(input);
3253
- if (res1 === undefined) return;
3238
+ const result = parser(input);
3239
+ if (result === undefined) return;
3254
3240
  context.range = context.position - position;
3255
- const res2 = f(res1, context);
3256
- return context.position > position ? res2 : undefined;
3241
+ return f(result, context);
3257
3242
  });
3258
3243
  }
3259
3244
  exports.bind = bind;
@@ -3635,7 +3620,7 @@ function state(state, positive, parser) {
3635
3620
  };
3636
3621
  }
3637
3622
  exports.state = state;
3638
- //export function constraint<P extends Parser<unknown>>(state: number, positive: boolean, parser: P): P;
3623
+ //export function constraint<P extends Parser>(state: number, positive: boolean, parser: P): P;
3639
3624
  function constraint(state, positive, parser) {
3640
3625
  if (typeof positive === 'function') {
3641
3626
  parser = positive;
@@ -3863,8 +3848,7 @@ function inits(parsers, resume) {
3863
3848
  context
3864
3849
  } = input;
3865
3850
  const {
3866
- source,
3867
- position
3851
+ source
3868
3852
  } = context;
3869
3853
  let nodes;
3870
3854
  for (let len = parsers.length, i = 0; i < len; ++i) {
@@ -3875,7 +3859,7 @@ function inits(parsers, resume) {
3875
3859
  nodes = nodes?.import(result) ?? result;
3876
3860
  if (resume?.(result) === false) break;
3877
3861
  }
3878
- return context.position > position ? nodes : undefined;
3862
+ return nodes;
3879
3863
  };
3880
3864
  }
3881
3865
  exports.inits = inits;
@@ -3899,8 +3883,7 @@ function sequence(parsers, resume) {
3899
3883
  context
3900
3884
  } = input;
3901
3885
  const {
3902
- source,
3903
- position
3886
+ source
3904
3887
  } = context;
3905
3888
  let nodes;
3906
3889
  for (let len = parsers.length, i = 0; i < len; ++i) {
@@ -3911,7 +3894,7 @@ function sequence(parsers, resume) {
3911
3894
  nodes = nodes?.import(result) ?? result;
3912
3895
  if (resume?.(result) === false) return;
3913
3896
  }
3914
- return context.position > position ? nodes : undefined;
3897
+ return nodes;
3915
3898
  };
3916
3899
  }
3917
3900
  exports.sequence = sequence;
@@ -6202,7 +6185,7 @@ const inline_1 = __webpack_require__(7973);
6202
6185
  const visibility_1 = __webpack_require__(6364);
6203
6186
  const util_1 = __webpack_require__(4992);
6204
6187
  const dom_1 = __webpack_require__(394);
6205
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6188
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6206
6189
  class: 'annotation'
6207
6190
  }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6208
6191
 
@@ -6285,9 +6268,9 @@ const source_1 = __webpack_require__(8745);
6285
6268
  const dom_1 = __webpack_require__(394);
6286
6269
  // https://example/@user must be a user page or a redirect page going there.
6287
6270
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6288
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6271
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6289
6272
  value
6290
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */])), '', false, [], ([[{
6273
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */])), '', false, [], ([[{
6291
6274
  value: host
6292
6275
  }, {
6293
6276
  value: account
@@ -6307,7 +6290,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6307
6290
  value: account
6308
6291
  }]], context) => {
6309
6292
  if (context.source[context.position] === '#') {
6310
- return void (0, combinator_1.setBacktrack)(context, [2 | 4 /* Backtrack.unescapable */], context.position - context.range);
6293
+ return void (0, combinator_1.setBacktrack)(context, 2 | 8 /* Backtrack.unescapable */, context.position - context.range);
6311
6294
  }
6312
6295
  return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6313
6296
  class: 'account'
@@ -6338,7 +6321,7 @@ const dom_1 = __webpack_require__(394);
6338
6321
  // cid: YYYY-MMDD-HHMM-SSmmm
6339
6322
  // 内部表現はUnixTimeに統一する(時系列順)
6340
6323
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
6341
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6324
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6342
6325
  value
6343
6326
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`>>${value}`)]), new parser_1.List([new parser_1.Data(`?at=${value}`)]), context), {
6344
6327
  class: 'anchor'
@@ -6363,7 +6346,7 @@ const dom_1 = __webpack_require__(394);
6363
6346
  // https://html.spec.whatwg.org/multipage/input.html
6364
6347
  exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z][_.+-]?|[@#])(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6365
6348
  value
6366
- }]) => value.length <= 254), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6349
+ }]) => value.length <= 254), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6367
6350
  value
6368
6351
  }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6369
6352
  class: 'email',
@@ -6388,7 +6371,7 @@ const link_1 = __webpack_require__(3628);
6388
6371
  const hashtag_1 = __webpack_require__(5764);
6389
6372
  const source_1 = __webpack_require__(8745);
6390
6373
  const dom_1 = __webpack_require__(394);
6391
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 4 /* Backtrack.unescapable */], ([, [{
6374
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 8 /* Backtrack.unescapable */], ([, [{
6392
6375
  value
6393
6376
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(value)]), context), {
6394
6377
  class: 'hashnum',
@@ -6417,7 +6400,7 @@ const dom_1 = __webpack_require__(394);
6417
6400
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6418
6401
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu')), ([{
6419
6402
  value
6420
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6403
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6421
6404
  value
6422
6405
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(`/hashtags/${value}`)]), context), {
6423
6406
  class: 'hashtag'
@@ -6440,7 +6423,7 @@ const combinator_1 = __webpack_require__(3484);
6440
6423
  const inline_1 = __webpack_require__(7973);
6441
6424
  const link_1 = __webpack_require__(3628);
6442
6425
  const source_1 = __webpack_require__(8745);
6443
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6426
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6444
6427
  context
6445
6428
  }) => new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6446
6429
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
@@ -6448,14 +6431,12 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6448
6431
  }) => {
6449
6432
  const {
6450
6433
  source,
6451
- position,
6452
- range = 0
6434
+ position
6453
6435
  } = context;
6454
- context.position -= position > 0 && source[position - 1] === '!' ? 1 : 0;
6455
- context.position += range;
6456
- return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position, context.position))]), context))]);
6457
- })), (0, source_1.str)(/[^:]+/y)])]), false));
6458
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
6436
+ context.position -= source[0] === '!' ? 1 : 0;
6437
+ return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position))]), context))]);
6438
+ })), (0, source_1.str)(/[^:]+/y)])])));
6439
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
6459
6440
 
6460
6441
  /***/ },
6461
6442
 
@@ -6502,17 +6483,33 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6502
6483
  return d1(input);
6503
6484
  }
6504
6485
  }]));
6505
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], {
6506
- source,
6507
- position,
6508
- range = 0
6509
- }) => {
6486
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => {
6487
+ const {
6488
+ source,
6489
+ position,
6490
+ range = 0
6491
+ } = context;
6492
+ const head = position - range;
6493
+ if (context.linebreak !== 0 || source[position - 2] !== ')' || source[head + 1] !== '(') {
6494
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6495
+ }
6510
6496
  const str = source.slice(position - range + 1, position - 1);
6511
6497
  return indexA.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6512
6498
  class: 'paren'
6513
6499
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6514
- }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6515
- const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = [], cs], {
6500
+ }, ([as, bs = new parser_1.List()], context) => {
6501
+ const {
6502
+ source,
6503
+ position,
6504
+ range = 0
6505
+ } = context;
6506
+ const head = position - range;
6507
+ if (context.linebreak !== 0 || source[head + 1] !== '(') {
6508
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6509
+ }
6510
+ return as.import(bs);
6511
+ }));
6512
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = [], cs], {
6516
6513
  source,
6517
6514
  position,
6518
6515
  range = 0
@@ -6522,7 +6519,7 @@ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6522
6519
  class: 'paren'
6523
6520
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6524
6521
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6525
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6522
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6526
6523
  if (context.state & 8 /* State.link */) {
6527
6524
  const {
6528
6525
  source,
@@ -6530,18 +6527,21 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6530
6527
  range = 0
6531
6528
  } = context;
6532
6529
  const head = position - range;
6530
+ if (context.linebreak !== 0 || source[position - 2] !== ']' || source[head + 1] !== '[') {
6531
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6532
+ }
6533
6533
  if (context.linebreak !== 0) {
6534
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
6534
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */ | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
6535
6535
  } else if (source[position] !== '{') {
6536
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6536
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6537
6537
  } else {
6538
6538
  context.state ^= 8 /* State.link */;
6539
- const result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
6539
+ const result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
6540
6540
  context
6541
6541
  }) : undefined;
6542
6542
  context.position = position;
6543
6543
  if (!result) {
6544
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6544
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6545
6545
  }
6546
6546
  context.state ^= 8 /* State.link */;
6547
6547
  context.range = range;
@@ -6549,12 +6549,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6549
6549
  }
6550
6550
  return as.import(bs).import(cs);
6551
6551
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6552
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6553
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6554
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6552
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6553
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6554
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6555
6555
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6556
6556
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6557
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6557
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6558
6558
 
6559
6559
  /***/ },
6560
6560
 
@@ -6810,7 +6810,7 @@ const source_1 = __webpack_require__(8745);
6810
6810
  const visibility_1 = __webpack_require__(6364);
6811
6811
  const util_1 = __webpack_require__(4992);
6812
6812
  const dom_1 = __webpack_require__(394);
6813
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6813
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6814
6814
  'data-index': dataindex(bs)
6815
6815
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6816
6816
  if (ns.length === 1) {
@@ -6825,7 +6825,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
6825
6825
  return ns;
6826
6826
  }
6827
6827
  })));
6828
- exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}|])/y)]), ']'), /(?=])/y, false, [3 | 8 /* Backtrack.escapable */], ([, ns], context) => {
6828
+ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}|])/y)]), ']'), /(?=])/y, false, [3 | 16 /* Backtrack.escapable */], ([, ns], context) => {
6829
6829
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6830
6830
  value
6831
6831
  }) => acc + value, ''))?.slice(7);
@@ -7030,7 +7030,7 @@ const source_1 = __webpack_require__(8745);
7030
7030
  const dom_1 = __webpack_require__(394);
7031
7031
  const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/y);
7032
7032
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
7033
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 0 /* Backtrack.common */]), body]), ([{
7033
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 4 /* Backtrack.common */]), body]), ([{
7034
7034
  value
7035
7035
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
7036
7036
  class: 'label',
@@ -7077,7 +7077,7 @@ const dom_1 = __webpack_require__(394);
7077
7077
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7078
7078
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7079
7079
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7080
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7080
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7081
7081
  class: 'invalid',
7082
7082
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7083
7083
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7191,7 +7191,7 @@ const combinator_1 = __webpack_require__(3484);
7191
7191
  const source_1 = __webpack_require__(8745);
7192
7192
  const util_1 = __webpack_require__(4992);
7193
7193
  const dom_1 = __webpack_require__(394);
7194
- exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 4 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7194
+ exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7195
7195
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7196
7196
  value
7197
7197
  }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
@@ -7280,10 +7280,10 @@ const optspec = {
7280
7280
  rel: ['nofollow']
7281
7281
  };
7282
7282
  Object.setPrototypeOf(optspec, null);
7283
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 0 /* Backtrack.common */, 3 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7283
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 4 /* Backtrack.common */ | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7284
7284
  if (context.linebreak !== 0) {
7285
7285
  const head = context.position - context.range;
7286
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7286
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7287
7287
  }
7288
7288
  return ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns;
7289
7289
  })),
@@ -7298,7 +7298,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7298
7298
  content.pop();
7299
7299
  if (params === undefined) {
7300
7300
  const head = context.position - context.range;
7301
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7301
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7302
7302
  }
7303
7303
  } else {
7304
7304
  params = content;
@@ -7463,7 +7463,7 @@ const source_1 = __webpack_require__(8745);
7463
7463
  const util_1 = __webpack_require__(4992);
7464
7464
  const dom_1 = __webpack_require__(394);
7465
7465
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7466
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 8 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 8 /* Backtrack.escapable */])]), ({
7466
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
7467
7467
  context: {
7468
7468
  source,
7469
7469
  caches: {
@@ -7509,10 +7509,10 @@ const optspec = {
7509
7509
  rel: undefined
7510
7510
  };
7511
7511
  Object.setPrototypeOf(optspec, null);
7512
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 8 /* Backtrack.escapable */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7512
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 16 /* Backtrack.escapable */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7513
7513
  if (context.linebreak !== 0) {
7514
7514
  const head = context.position - context.range;
7515
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7515
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7516
7516
  }
7517
7517
  return ns;
7518
7518
  })), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
@@ -7561,7 +7561,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7561
7561
  target: '_blank'
7562
7562
  }, [el]))]);
7563
7563
  }))));
7564
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List())])));
7564
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List())])));
7565
7565
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
7566
7566
  value: a
7567
7567
  }], [{
@@ -7615,7 +7615,7 @@ const source_1 = __webpack_require__(8745);
7615
7615
  const visibility_1 = __webpack_require__(6364);
7616
7616
  const util_1 = __webpack_require__(4992);
7617
7617
  const dom_1 = __webpack_require__(394);
7618
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => {
7618
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
7619
7619
  const {
7620
7620
  position,
7621
7621
  range = 0,
@@ -7625,7 +7625,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7625
7625
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
7626
7626
  } else {
7627
7627
  const head = position - range;
7628
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head, 2);
7628
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head, 2);
7629
7629
  }
7630
7630
  }, ([as, bs], context) => {
7631
7631
  if (!bs) return;
@@ -7638,9 +7638,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7638
7638
  } = context;
7639
7639
  const head = position - range;
7640
7640
  if (source[position] !== ']') {
7641
- (0, combinator_1.setBacktrack)(context, [2 | 0 /* Backtrack.common */], head, 2);
7641
+ (0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head, 2);
7642
7642
  } else if (linebreak !== 0) {
7643
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head, 2);
7643
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
7644
7644
  } else {
7645
7645
  if (state & 128 /* State.annotation */) {
7646
7646
  bs.push(new parser_1.Data(source[position]));
@@ -7648,23 +7648,23 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7648
7648
  context.position += 1;
7649
7649
  let result;
7650
7650
  if (source[context.position] !== '{') {
7651
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7651
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7652
7652
  result = new parser_1.List();
7653
7653
  } else {
7654
- result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
7654
+ result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
7655
7655
  context
7656
7656
  }) : undefined;
7657
7657
  context.range = range;
7658
7658
  if (!result) {
7659
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7659
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7660
7660
  result = new parser_1.List();
7661
7661
  }
7662
7662
  }
7663
7663
  if (context.position === source.length) {
7664
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7664
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7665
7665
  } else {
7666
7666
  const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, [], ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7667
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7667
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7668
7668
  return cs;
7669
7669
  })({
7670
7670
  context
@@ -7762,17 +7762,17 @@ const source_1 = __webpack_require__(8745);
7762
7762
  const visibility_1 = __webpack_require__(6364);
7763
7763
  const util_1 = __webpack_require__(4992);
7764
7764
  const dom_1 = __webpack_require__(394);
7765
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */], ([, ns]) => {
7765
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 4 /* Backtrack.common */, 3 | 32 /* Backtrack.ruby */], ([, ns]) => {
7766
7766
  ns && ns.last?.value === '' && ns.pop();
7767
7767
  return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7768
- })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */]))]), ([{
7768
+ })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [3 | 32 /* Backtrack.ruby */]))]), ([{
7769
7769
  value: texts
7770
7770
  }, {
7771
7771
  value: rubies = undefined
7772
7772
  } = {}], context) => {
7773
7773
  if (rubies === undefined) {
7774
7774
  const head = context.position - context.range;
7775
- return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.ruby */], head);
7775
+ return void (0, combinator_1.setBacktrack)(context, 2 | 32 /* Backtrack.ruby */, head);
7776
7776
  }
7777
7777
  switch (true) {
7778
7778
  case texts.length >= rubies.length:
@@ -7910,7 +7910,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
7910
7910
  class: 'invalid',
7911
7911
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7912
7912
  }, context.source.slice(context.position - context.range, context.position)))])));
7913
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, ([as, bs]) => bs && as.import(bs))]));
7913
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 16 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 16 /* Backtrack.escapable */], undefined, ([as, bs]) => bs && as.import(bs))]));
7914
7914
 
7915
7915
  /***/ },
7916
7916