securemark 0.294.11 → 0.295.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/design.md +5 -5
  3. package/dist/index.js +122 -112
  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 +51 -62
  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/autolink/account.ts +1 -1
  29. package/src/parser/inline/autolink/url.ts +4 -5
  30. package/src/parser/inline/bracket.ts +27 -18
  31. package/src/parser/inline/extension/indexee.ts +1 -1
  32. package/src/parser/inline/link.ts +3 -3
  33. package/src/parser/inline/media.ts +1 -1
  34. package/src/parser/inline/reference.ts +8 -8
  35. package/src/parser/inline/ruby.ts +2 -2
  36. 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.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("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 [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, context.position - position || 1)) {
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
  }
@@ -3165,66 +3166,61 @@ 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) {
3171
+ if (length === 0) return false;
3170
3172
  const {
3171
3173
  source
3172
3174
  } = context;
3173
3175
  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
- }
3176
+ const {
3177
+ backtracks = {},
3178
+ offset = 0
3179
+ } = context;
3180
+ for (let i = 0; i < length; ++i) {
3181
+ if (position + i === source.length) break;
3182
+ if (i > 0 && source[position + i] !== source[position]) break;
3183
+ const pos = position + i + offset;
3184
+ if (backtracks[pos] & backtrack >>> commandsize) return true;
3189
3185
  }
3190
3186
  return false;
3191
3187
  }
3192
3188
  exports.isBacktrack = isBacktrack;
3193
- function setBacktrack(context, backtracks, position, length = 1) {
3189
+ function setBacktrack(context, backtrack, position, length = 1) {
3194
3190
  // バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3191
+
3192
+ if (length === 0) return;
3195
3193
  const {
3196
3194
  source
3197
3195
  } = context;
3198
3196
  if (position === source.length) return;
3199
- if (length === 0) return;
3197
+ const {
3198
+ backtracks = {},
3199
+ offset = 0
3200
+ } = context;
3201
+ for (let i = 0; i < length; ++i) {
3202
+ if (position + i === source.length) break;
3203
+ const pos = position + i + offset;
3204
+ backtracks[pos] |= backtrack >>> commandsize;
3205
+ }
3206
+ }
3207
+ exports.setBacktrack = setBacktrack;
3208
+ function reduce(backtracks) {
3209
+ let rbs = 0;
3210
+ let wbs = 0;
3200
3211
  for (const backtrack of backtracks) {
3212
+ if (backtrack & 1) {
3213
+ rbs |= backtrack;
3214
+ }
3201
3215
  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
- }
3216
+ wbs |= backtrack;
3211
3217
  }
3212
3218
  }
3219
+ return [rbs, wbs];
3213
3220
  }
3214
- exports.setBacktrack = setBacktrack;
3215
3221
  function revert(context, linebreak) {
3216
3222
  context.linebreak = linebreak;
3217
3223
  }
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
3224
 
3229
3225
  /***/ },
3230
3226
 
@@ -3249,11 +3245,10 @@ function bind(parser, f) {
3249
3245
  position
3250
3246
  } = context;
3251
3247
  if (position === source.length) return;
3252
- const res1 = parser(input);
3253
- if (res1 === undefined) return;
3248
+ const result = parser(input);
3249
+ if (result === undefined) return;
3254
3250
  context.range = context.position - position;
3255
- const res2 = f(res1, context);
3256
- return context.position > position ? res2 : undefined;
3251
+ return f(result, context);
3257
3252
  });
3258
3253
  }
3259
3254
  exports.bind = bind;
@@ -3635,7 +3630,7 @@ function state(state, positive, parser) {
3635
3630
  };
3636
3631
  }
3637
3632
  exports.state = state;
3638
- //export function constraint<P extends Parser<unknown>>(state: number, positive: boolean, parser: P): P;
3633
+ //export function constraint<P extends Parser>(state: number, positive: boolean, parser: P): P;
3639
3634
  function constraint(state, positive, parser) {
3640
3635
  if (typeof positive === 'function') {
3641
3636
  parser = positive;
@@ -3863,8 +3858,7 @@ function inits(parsers, resume) {
3863
3858
  context
3864
3859
  } = input;
3865
3860
  const {
3866
- source,
3867
- position
3861
+ source
3868
3862
  } = context;
3869
3863
  let nodes;
3870
3864
  for (let len = parsers.length, i = 0; i < len; ++i) {
@@ -3875,7 +3869,7 @@ function inits(parsers, resume) {
3875
3869
  nodes = nodes?.import(result) ?? result;
3876
3870
  if (resume?.(result) === false) break;
3877
3871
  }
3878
- return context.position > position ? nodes : undefined;
3872
+ return nodes;
3879
3873
  };
3880
3874
  }
3881
3875
  exports.inits = inits;
@@ -3899,8 +3893,7 @@ function sequence(parsers, resume) {
3899
3893
  context
3900
3894
  } = input;
3901
3895
  const {
3902
- source,
3903
- position
3896
+ source
3904
3897
  } = context;
3905
3898
  let nodes;
3906
3899
  for (let len = parsers.length, i = 0; i < len; ++i) {
@@ -3911,7 +3904,7 @@ function sequence(parsers, resume) {
3911
3904
  nodes = nodes?.import(result) ?? result;
3912
3905
  if (resume?.(result) === false) return;
3913
3906
  }
3914
- return context.position > position ? nodes : undefined;
3907
+ return nodes;
3915
3908
  };
3916
3909
  }
3917
3910
  exports.sequence = sequence;
@@ -6202,7 +6195,7 @@ const inline_1 = __webpack_require__(7973);
6202
6195
  const visibility_1 = __webpack_require__(6364);
6203
6196
  const util_1 = __webpack_require__(4992);
6204
6197
  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', {
6198
+ 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 | 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
6199
  class: 'annotation'
6207
6200
  }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6208
6201
 
@@ -6285,9 +6278,9 @@ const source_1 = __webpack_require__(8745);
6285
6278
  const dom_1 = __webpack_require__(394);
6286
6279
  // https://example/@user must be a user page or a redirect page going there.
6287
6280
  // 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')), ([{
6281
+ 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
6282
  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, [], ([[{
6283
+ }]) => /^[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
6284
  value: host
6292
6285
  }, {
6293
6286
  value: account
@@ -6307,7 +6300,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6307
6300
  value: account
6308
6301
  }]], context) => {
6309
6302
  if (context.source[context.position] === '#') {
6310
- return void (0, combinator_1.setBacktrack)(context, [2 | 4 /* Backtrack.unescapable */], context.position - context.range);
6303
+ return void (0, combinator_1.setBacktrack)(context, 2 | 8 /* Backtrack.unescapable */, context.position - context.range);
6311
6304
  }
6312
6305
  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
6306
  class: 'account'
@@ -6338,7 +6331,7 @@ const dom_1 = __webpack_require__(394);
6338
6331
  // cid: YYYY-MMDD-HHMM-SSmmm
6339
6332
  // 内部表現はUnixTimeに統一する(時系列順)
6340
6333
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
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 */], ([, [{
6334
+ 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
6335
  value
6343
6336
  }]], 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
6337
  class: 'anchor'
@@ -6363,7 +6356,7 @@ const dom_1 = __webpack_require__(394);
6363
6356
  // https://html.spec.whatwg.org/multipage/input.html
6364
6357
  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
6358
  value
6366
- }]) => value.length <= 254), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6359
+ }]) => value.length <= 254), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6367
6360
  value
6368
6361
  }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6369
6362
  class: 'email',
@@ -6388,7 +6381,7 @@ const link_1 = __webpack_require__(3628);
6388
6381
  const hashtag_1 = __webpack_require__(5764);
6389
6382
  const source_1 = __webpack_require__(8745);
6390
6383
  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 */], ([, [{
6384
+ 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
6385
  value
6393
6386
  }]], 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
6387
  class: 'hashnum',
@@ -6417,7 +6410,7 @@ const dom_1 = __webpack_require__(394);
6417
6410
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6418
6411
  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
6412
  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 */], ([, [{
6413
+ }]) => /^[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
6414
  value
6422
6415
  }]], 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
6416
  class: 'hashtag'
@@ -6440,7 +6433,7 @@ const combinator_1 = __webpack_require__(3484);
6440
6433
  const inline_1 = __webpack_require__(7973);
6441
6434
  const link_1 = __webpack_require__(3628);
6442
6435
  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 */, ({
6436
+ 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
6437
  context
6445
6438
  }) => 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
6439
  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 +6441,12 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6448
6441
  }) => {
6449
6442
  const {
6450
6443
  source,
6451
- position,
6452
- range = 0
6444
+ position
6453
6445
  } = 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())]));
6446
+ context.position -= source[0] === '!' ? 1 : 0;
6447
+ 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))]);
6448
+ })), (0, source_1.str)(/[^:]+/y)])])));
6449
+ 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
6450
 
6460
6451
  /***/ },
6461
6452
 
@@ -6502,17 +6493,33 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6502
6493
  return d1(input);
6503
6494
  }
6504
6495
  }]));
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
- }) => {
6496
+ 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) => {
6497
+ const {
6498
+ source,
6499
+ position,
6500
+ range = 0
6501
+ } = context;
6502
+ const head = position - range;
6503
+ if (context.linebreak !== 0 || source[position - 2] !== ')' || source[head + 1] !== '(') {
6504
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6505
+ }
6510
6506
  const str = source.slice(position - range + 1, position - 1);
6511
6507
  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
6508
  class: 'paren'
6513
6509
  }, (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], {
6510
+ }, ([as, bs = new parser_1.List()], context) => {
6511
+ const {
6512
+ source,
6513
+ position,
6514
+ range = 0
6515
+ } = context;
6516
+ const head = position - range;
6517
+ if (context.linebreak !== 0 || source[head + 1] !== '(') {
6518
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6519
+ }
6520
+ return as.import(bs);
6521
+ }));
6522
+ 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
6523
  source,
6517
6524
  position,
6518
6525
  range = 0
@@ -6522,7 +6529,7 @@ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6522
6529
  class: 'paren'
6523
6530
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6524
6531
  }, ([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) => {
6532
+ 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
6533
  if (context.state & 8 /* State.link */) {
6527
6534
  const {
6528
6535
  source,
@@ -6530,18 +6537,21 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6530
6537
  range = 0
6531
6538
  } = context;
6532
6539
  const head = position - range;
6540
+ if (context.linebreak !== 0 || source[position - 2] !== ']' || source[head + 1] !== '[') {
6541
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6542
+ }
6533
6543
  if (context.linebreak !== 0) {
6534
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
6544
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */ | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
6535
6545
  } else if (source[position] !== '{') {
6536
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6546
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6537
6547
  } else {
6538
6548
  context.state ^= 8 /* State.link */;
6539
- const result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
6549
+ const result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
6540
6550
  context
6541
6551
  }) : undefined;
6542
6552
  context.position = position;
6543
6553
  if (!result) {
6544
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6554
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6545
6555
  }
6546
6556
  context.state ^= 8 /* State.link */;
6547
6557
  context.range = range;
@@ -6549,12 +6559,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6549
6559
  }
6550
6560
  return as.import(bs).import(cs);
6551
6561
  }, ([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)));
6562
+ 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)));
6563
+ 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)));
6564
+ 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
6565
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6556
6566
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
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)));
6567
+ (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
6568
 
6559
6569
  /***/ },
6560
6570
 
@@ -6810,7 +6820,7 @@ const source_1 = __webpack_require__(8745);
6810
6820
  const visibility_1 = __webpack_require__(6364);
6811
6821
  const util_1 = __webpack_require__(4992);
6812
6822
  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', {
6823
+ 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
6824
  'data-index': dataindex(bs)
6815
6825
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6816
6826
  if (ns.length === 1) {
@@ -6825,7 +6835,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
6825
6835
  return ns;
6826
6836
  }
6827
6837
  })));
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) => {
6838
+ 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
6839
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6830
6840
  value
6831
6841
  }) => acc + value, ''))?.slice(7);
@@ -7030,7 +7040,7 @@ const source_1 = __webpack_require__(8745);
7030
7040
  const dom_1 = __webpack_require__(394);
7031
7041
  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
7042
  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]), ([{
7043
+ 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
7044
  value
7035
7045
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
7036
7046
  class: 'label',
@@ -7077,7 +7087,7 @@ const dom_1 = __webpack_require__(394);
7077
7087
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7078
7088
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7079
7089
  // ^は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', {
7090
+ (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
7091
  class: 'invalid',
7082
7092
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7083
7093
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7191,7 +7201,7 @@ const combinator_1 = __webpack_require__(3484);
7191
7201
  const source_1 = __webpack_require__(8745);
7192
7202
  const util_1 = __webpack_require__(4992);
7193
7203
  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 ?? ''))]));
7204
+ 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
7205
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7196
7206
  value
7197
7207
  }]) => 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 +7290,10 @@ const optspec = {
7280
7290
  rel: ['nofollow']
7281
7291
  };
7282
7292
  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) => {
7293
+ 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
7294
  if (context.linebreak !== 0) {
7285
7295
  const head = context.position - context.range;
7286
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7296
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7287
7297
  }
7288
7298
  return ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns;
7289
7299
  })),
@@ -7298,7 +7308,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7298
7308
  content.pop();
7299
7309
  if (params === undefined) {
7300
7310
  const head = context.position - context.range;
7301
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7311
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7302
7312
  }
7303
7313
  } else {
7304
7314
  params = content;
@@ -7463,7 +7473,7 @@ const source_1 = __webpack_require__(8745);
7463
7473
  const util_1 = __webpack_require__(4992);
7464
7474
  const dom_1 = __webpack_require__(394);
7465
7475
  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 */])]), ({
7476
+ 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
7477
  context: {
7468
7478
  source,
7469
7479
  caches: {
@@ -7509,10 +7519,10 @@ const optspec = {
7509
7519
  rel: undefined
7510
7520
  };
7511
7521
  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) => {
7522
+ 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
7523
  if (context.linebreak !== 0) {
7514
7524
  const head = context.position - context.range;
7515
- return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7525
+ return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7516
7526
  }
7517
7527
  return ns;
7518
7528
  })), (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 +7571,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7561
7571
  target: '_blank'
7562
7572
  }, [el]))]);
7563
7573
  }))));
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())])));
7574
+ 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
7575
  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
7576
  value: a
7567
7577
  }], [{
@@ -7615,7 +7625,7 @@ const source_1 = __webpack_require__(8745);
7615
7625
  const visibility_1 = __webpack_require__(6364);
7616
7626
  const util_1 = __webpack_require__(4992);
7617
7627
  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) => {
7628
+ 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 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
7619
7629
  const {
7620
7630
  position,
7621
7631
  range = 0,
@@ -7625,7 +7635,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7625
7635
  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
7636
  } else {
7627
7637
  const head = position - range;
7628
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head, 2);
7638
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head, 2);
7629
7639
  }
7630
7640
  }, ([as, bs], context) => {
7631
7641
  if (!bs) return;
@@ -7638,9 +7648,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7638
7648
  } = context;
7639
7649
  const head = position - range;
7640
7650
  if (source[position] !== ']') {
7641
- (0, combinator_1.setBacktrack)(context, [2 | 0 /* Backtrack.common */], head, 2);
7651
+ (0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head, 2);
7642
7652
  } else if (linebreak !== 0) {
7643
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head, 2);
7653
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
7644
7654
  } else {
7645
7655
  if (state & 128 /* State.annotation */) {
7646
7656
  bs.push(new parser_1.Data(source[position]));
@@ -7648,23 +7658,23 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7648
7658
  context.position += 1;
7649
7659
  let result;
7650
7660
  if (source[context.position] !== '{') {
7651
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7661
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7652
7662
  result = new parser_1.List();
7653
7663
  } else {
7654
- result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
7664
+ result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
7655
7665
  context
7656
7666
  }) : undefined;
7657
7667
  context.range = range;
7658
7668
  if (!result) {
7659
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7669
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7660
7670
  result = new parser_1.List();
7661
7671
  }
7662
7672
  }
7663
7673
  if (context.position === source.length) {
7664
- (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7674
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7665
7675
  } else {
7666
7676
  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);
7677
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7668
7678
  return cs;
7669
7679
  })({
7670
7680
  context
@@ -7762,17 +7772,17 @@ const source_1 = __webpack_require__(8745);
7762
7772
  const visibility_1 = __webpack_require__(6364);
7763
7773
  const util_1 = __webpack_require__(4992);
7764
7774
  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]) => {
7775
+ 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
7776
  ns && ns.last?.value === '' && ns.pop();
7767
7777
  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 */]))]), ([{
7778
+ })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [3 | 32 /* Backtrack.ruby */]))]), ([{
7769
7779
  value: texts
7770
7780
  }, {
7771
7781
  value: rubies = undefined
7772
7782
  } = {}], context) => {
7773
7783
  if (rubies === undefined) {
7774
7784
  const head = context.position - context.range;
7775
- return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.ruby */], head);
7785
+ return void (0, combinator_1.setBacktrack)(context, 2 | 32 /* Backtrack.ruby */, head);
7776
7786
  }
7777
7787
  switch (true) {
7778
7788
  case texts.length >= rubies.length:
@@ -7910,7 +7920,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
7910
7920
  class: 'invalid',
7911
7921
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7912
7922
  }, 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))]));
7923
+ 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
7924
 
7915
7925
  /***/ },
7916
7926
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.294.11",
3
+ "version": "0.295.0",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",