securemark 0.289.5 → 0.290.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 (40) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/design.md +1 -1
  3. package/dist/index.js +118 -334
  4. package/markdown.d.ts +11 -12
  5. package/package.json +1 -1
  6. package/src/combinator/control/manipulation/surround.ts +20 -30
  7. package/src/combinator/control/monad/bind.ts +1 -0
  8. package/src/combinator/data/parser.ts +0 -1
  9. package/src/parser/api/parse.test.ts +6 -7
  10. package/src/parser/block/extension/example.test.ts +2 -2
  11. package/src/parser/block/extension/fig.test.ts +8 -8
  12. package/src/parser/block/extension/figure.test.ts +14 -14
  13. package/src/parser/block/paragraph.test.ts +4 -0
  14. package/src/parser/context.ts +5 -11
  15. package/src/parser/inline/annotation.ts +5 -5
  16. package/src/parser/inline/autolink/email.ts +11 -5
  17. package/src/parser/inline/autolink/hashtag.ts +4 -2
  18. package/src/parser/inline/autolink/url.test.ts +2 -2
  19. package/src/parser/inline/autolink/url.ts +6 -6
  20. package/src/parser/inline/bracket.test.ts +1 -0
  21. package/src/parser/inline/code.ts +2 -2
  22. package/src/parser/inline/extension/index.ts +5 -5
  23. package/src/parser/inline/extension/label.ts +1 -1
  24. package/src/parser/inline/html.test.ts +4 -4
  25. package/src/parser/inline/html.ts +14 -27
  26. package/src/parser/inline/link.test.ts +17 -17
  27. package/src/parser/inline/link.ts +42 -15
  28. package/src/parser/inline/media.test.ts +45 -46
  29. package/src/parser/inline/media.ts +49 -35
  30. package/src/parser/inline/reference.ts +15 -11
  31. package/src/parser/inline/ruby.ts +15 -12
  32. package/src/parser/inline/shortmedia.test.ts +2 -2
  33. package/src/parser/inline/template.test.ts +2 -2
  34. package/src/parser/inline/template.ts +12 -10
  35. package/src/parser/inline.test.ts +1 -0
  36. package/src/parser/source/escapable.test.ts +5 -5
  37. package/src/parser/source/escapable.ts +2 -3
  38. package/src/parser/source/unescapable.test.ts +5 -5
  39. package/src/parser/source/unescapable.ts +2 -3
  40. package/src/renderer/render/media.test.ts +3 -3
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.289.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.290.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"));
@@ -322,250 +322,6 @@ __exportStar(__webpack_require__(1311), exports);
322
322
 
323
323
  /***/ },
324
324
 
325
- /***/ 8663
326
- (__unused_webpack_module, exports) {
327
-
328
- "use strict";
329
-
330
-
331
- Object.defineProperty(exports, "__esModule", ({
332
- value: true
333
- }));
334
- exports.Clock = void 0;
335
- const BASE = 32;
336
- const DIGIT = Math.log2(BASE);
337
- const MASK = BASE - 1;
338
- const empty = Symbol('empty');
339
- class Clock {
340
- // Capacity is rounded up to multiples of 32.
341
- constructor(capacity,
342
- // ヒット率99%で平均100bitの走査となるためこれを極端に超えない走査数に制限
343
- limit = BASE * 10) {
344
- this.capacity = capacity;
345
- this.limit = limit;
346
- this.dict = new Map();
347
- this.keys = [];
348
- this.values = [];
349
- this.hand = 0;
350
- this.$length = 0;
351
- this.initial = 1;
352
- this.capacity = ((capacity - 1 | MASK) >>> 0) + 1;
353
- this.refs = new Int32Array(this.capacity >>> DIGIT);
354
- }
355
- get length() {
356
- return this.$length;
357
- }
358
- get size() {
359
- return this.$length;
360
- }
361
- mark(index) {
362
- const i = index >>> DIGIT;
363
- const before = this.refs[i];
364
- const after = before | 1 << (index & MASK);
365
- if (after === before) return;
366
- this.refs[i] = after;
367
- }
368
- unmark(index) {
369
- const i = index >>> DIGIT;
370
- const before = this.refs[i];
371
- const after = before & ~(1 << (index & MASK));
372
- if (after === before) return;
373
- this.refs[i] = after;
374
- }
375
- locate(hand, key, value) {
376
- const {
377
- capacity,
378
- dict,
379
- keys,
380
- values
381
- } = this;
382
- this.$length === capacity || this.initial === 0 && values[hand] !== empty ? dict.delete(keys[hand]) : ++this.$length;
383
- dict.set(key, hand);
384
- keys[hand] = key;
385
- values[hand] = value;
386
- this.hand = ++hand === capacity ? this.initial = 0 : hand;
387
- }
388
- add(key, value) {
389
- const {
390
- capacity,
391
- limit,
392
- refs
393
- } = this;
394
- for (let {
395
- hand
396
- } = this, i = hand >>> DIGIT, r = hand & MASK, c = 0;;) {
397
- const b = refs[i];
398
- if (b >>> r === ~0 >>> r && c < limit) {
399
- const d = BASE - r;
400
- c += d;
401
- hand += d;
402
- refs[i] = b & (1 << r) - 1;
403
- r = 0;
404
- if (hand < capacity) {
405
- ++i;
406
- } else {
407
- hand -= capacity;
408
- i = 0;
409
- }
410
- continue;
411
- }
412
- const l = c < limit ? search(b, r) : r;
413
- if (l !== r) {
414
- hand += l - r;
415
- refs[i] = b & ~((1 << l) - 1 >>> r << r);
416
- }
417
- this.locate(hand, key, value);
418
- return hand;
419
- }
420
- }
421
- put(key, value) {
422
- const index = this.dict.get(key);
423
- if (index === undefined) return this.add(key, value);
424
- this.values[index] = value;
425
- return index;
426
- }
427
- set(key, value) {
428
- this.put(key, value);
429
- return this;
430
- }
431
- get(key) {
432
- const index = this.dict.get(key);
433
- if (index === undefined) return;
434
- this.mark(index);
435
- return this.values[index];
436
- }
437
- has(key) {
438
- return this.dict.has(key);
439
- }
440
- delete(key) {
441
- const index = this.dict.get(key);
442
- if (index === undefined) return false;
443
- // 末尾と削除対象を交換して削除する。
444
- // 次の挿入の前に次の削除が行われると交換できないが稀なため対処しない。
445
- const {
446
- hand,
447
- dict,
448
- keys,
449
- values,
450
- refs
451
- } = this;
452
- dict.delete(key);
453
- --this.$length;
454
- const k = keys[index] = keys[hand];
455
- const v = values[index] = values[hand];
456
- keys[hand] = undefined;
457
- values[hand] = empty;
458
- if (index !== hand && v !== empty) {
459
- dict.set(k, index);
460
- (refs[hand >>> DIGIT] & 1 << (hand & MASK)) === 0 ? this.unmark(index) : this.mark(index);
461
- }
462
- this.unmark(hand);
463
- return true;
464
- }
465
- clear() {
466
- this.dict = new Map();
467
- this.keys = [];
468
- this.values = [];
469
- this.refs.fill(0);
470
- this.hand = 0;
471
- this.$length = 0;
472
- this.initial = 1;
473
- }
474
- *[Symbol.iterator]() {
475
- const {
476
- keys,
477
- values
478
- } = this;
479
- for (const index of this.dict.values()) {
480
- yield [keys[index], values[index]];
481
- }
482
- }
483
- }
484
- exports.Clock = Clock;
485
- function search(b, r) {
486
- for (let l = r;; ++l) {
487
- if ((b & 1 << l) === 0) return l;
488
- }
489
- }
490
- function bsearch(b, r) {
491
- const n = ~b >>> r << r >>> 0;
492
- const l = potision(0x05f66a47 * (n & -n) >>> 27);
493
- return l;
494
- }
495
- //const potisions = new Uint8Array([
496
- // 0, 1, 2, 26, 23, 3, 15, 27, 24, 21, 19, 4, 12, 16, 28, 6, 31, 25, 22, 14, 20, 18, 11, 5, 30, 13, 17, 10, 29, 9, 8, 7,
497
- //]);
498
- function potision(n) {
499
- switch (n) {
500
- case 0:
501
- return 0;
502
- case 1:
503
- return 1;
504
- case 2:
505
- return 2;
506
- case 3:
507
- return 26;
508
- case 4:
509
- return 23;
510
- case 5:
511
- return 3;
512
- case 6:
513
- return 15;
514
- case 7:
515
- return 27;
516
- case 8:
517
- return 24;
518
- case 9:
519
- return 21;
520
- case 10:
521
- return 19;
522
- case 11:
523
- return 4;
524
- case 12:
525
- return 12;
526
- case 13:
527
- return 16;
528
- case 14:
529
- return 28;
530
- case 15:
531
- return 6;
532
- case 16:
533
- return 31;
534
- case 17:
535
- return 25;
536
- case 18:
537
- return 22;
538
- case 19:
539
- return 14;
540
- case 20:
541
- return 20;
542
- case 21:
543
- return 18;
544
- case 22:
545
- return 11;
546
- case 23:
547
- return 5;
548
- case 24:
549
- return 30;
550
- case 25:
551
- return 13;
552
- case 26:
553
- return 17;
554
- case 27:
555
- return 10;
556
- case 28:
557
- return 29;
558
- case 29:
559
- return 9;
560
- case 30:
561
- return 8;
562
- default:
563
- return 7;
564
- }
565
- }
566
-
567
- /***/ },
568
-
569
325
  /***/ 1934
570
326
  (__unused_webpack_module, exports) {
571
327
 
@@ -3177,7 +2933,7 @@ Object.defineProperty(exports, "__esModule", ({
3177
2933
  exports.setBacktrack = exports.getBacktrack = exports.close = exports.open = exports.surround = void 0;
3178
2934
  const parser_1 = __webpack_require__(605);
3179
2935
  const array_1 = __webpack_require__(6876);
3180
- function surround(opener, parser, closer, optional = false, f, g, backtracks = [], backtrackstate = 0) {
2936
+ function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
3181
2937
  switch (typeof opener) {
3182
2938
  case 'string':
3183
2939
  case 'object':
@@ -3205,16 +2961,11 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3205
2961
  if (resultS === undefined) return void revert(context, linebreak);
3206
2962
  const nodesS = (0, parser_1.eval)(resultS);
3207
2963
  const me_ = (0, parser_1.exec)(resultS);
3208
- if (getBacktrack(context, backtracks, sme_, me_)) return void revert(context, linebreak);
3209
- const {
3210
- backtrack = 0
3211
- } = context;
3212
- context.backtrack = backtrack | backtrackstate;
2964
+ if (getBacktrack(context, backtracks, sme_, sme_.length - me_.length)) return void revert(context, linebreak);
3213
2965
  const resultM = me_ !== '' ? parser({
3214
2966
  source: me_,
3215
2967
  context
3216
2968
  }) : undefined;
3217
- context.backtrack = backtrack;
3218
2969
  const nodesM = (0, parser_1.eval)(resultM);
3219
2970
  const e_ = (0, parser_1.exec)(resultM, me_);
3220
2971
  const resultE = nodesM || optional ? closer({
@@ -3223,7 +2974,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3223
2974
  }) : undefined;
3224
2975
  const nodesE = (0, parser_1.eval)(resultE);
3225
2976
  const rest = (0, parser_1.exec)(resultE, e_);
3226
- nodesE || setBacktrack(context, backtracks, sme_);
2977
+ nodesE || setBacktrack(context, backtracks, sme_.length);
3227
2978
  if (!nodesM && !optional) return void revert(context, linebreak);
3228
2979
  if (rest.length === sme_.length) return void revert(context, linebreak);
3229
2980
  context.recent = [sme_.slice(0, sme_.length - me_.length), me_.slice(0, me_.length - e_.length), e_.slice(0, e_.length - rest.length)];
@@ -3237,46 +2988,44 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3237
2988
  };
3238
2989
  }
3239
2990
  exports.surround = surround;
3240
- function open(opener, parser, optional, backtracks, backtrackstate) {
3241
- return surround(opener, parser, '', optional, undefined, undefined, backtracks, backtrackstate);
2991
+ function open(opener, parser, optional, backtracks) {
2992
+ return surround(opener, parser, '', optional, undefined, undefined, backtracks);
3242
2993
  }
3243
2994
  exports.open = open;
3244
- function close(parser, closer, optional, backtracks, backtrackstate) {
3245
- return surround('', parser, closer, optional, undefined, undefined, backtracks, backtrackstate);
2995
+ function close(parser, closer, optional, backtracks) {
2996
+ return surround('', parser, closer, optional, undefined, undefined, backtracks);
3246
2997
  }
3247
2998
  exports.close = close;
3248
2999
  const statesize = 2;
3249
- function getBacktrack(context, backtracks, sme_, me_) {
3000
+ function getBacktrack(context, backtracks, source, length) {
3250
3001
  for (const backtrack of backtracks) {
3251
3002
  if (backtrack & 1) {
3252
3003
  const {
3253
3004
  backtracks = {},
3254
- backtrack: state = 0,
3255
3005
  offset = 0
3256
3006
  } = context;
3257
- for (let i = 0, len = sme_.length - me_.length || 1; i < len; ++i) {
3258
- if (sme_[i] !== sme_[0]) break;
3259
- const pos = sme_.length - i + offset - 1;
3007
+ for (let i = 0; i < length; ++i) {
3008
+ if (source[i] !== source[0]) break;
3009
+ const pos = source.length - i + offset - 1;
3260
3010
  if (!(pos in backtracks)) continue;
3261
- const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
3262
- if (backtracks[pos] & 1 << size(backtrack >>> statesize) + shift) return true;
3011
+ if (backtracks[pos] & 1 << size(backtrack >>> statesize)) return true;
3263
3012
  }
3264
3013
  }
3265
3014
  }
3266
3015
  return false;
3267
3016
  }
3268
3017
  exports.getBacktrack = getBacktrack;
3269
- function setBacktrack(context, backtracks, sme_) {
3018
+ function setBacktrack(context, backtracks, position, length = 1) {
3270
3019
  for (const backtrack of backtracks) {
3271
3020
  if (backtrack & 2) {
3272
3021
  const {
3273
3022
  backtracks = {},
3274
- backtrack: state = 0,
3275
3023
  offset = 0
3276
3024
  } = context;
3277
- const pos = sme_.length + offset - 1;
3278
- const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
3279
- backtracks[pos] |= 1 << size(backtrack >>> statesize) + shift;
3025
+ for (let i = 0; i < length; ++i) {
3026
+ const pos = position - i + offset - 1;
3027
+ backtracks[pos] |= 1 << size(backtrack >>> statesize);
3028
+ }
3280
3029
  }
3281
3030
  }
3282
3031
  }
@@ -3358,6 +3107,7 @@ function bind(parser, f) {
3358
3107
  if (source === '') return;
3359
3108
  const res1 = parser(input);
3360
3109
  if (res1 === undefined) return;
3110
+ context.recent = [source.slice(0, source.length - (0, parser_1.exec)(res1).length)];
3361
3111
  const res2 = f((0, parser_1.eval)(res1), (0, parser_1.exec)(res1), context);
3362
3112
  if (res2 === undefined) return;
3363
3113
  return (0, parser_1.exec)(res2).length <= (0, parser_1.exec)(res1).length ? res2 : undefined;
@@ -5950,9 +5700,9 @@ const combinator_1 = __webpack_require__(3484);
5950
5700
  const inline_1 = __webpack_require__(7973);
5951
5701
  const visibility_1 = __webpack_require__(6364);
5952
5702
  const dom_1 = __webpack_require__(394);
5953
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [['\n', 9], [')', 1]])))), '))', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
5703
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], rest, context) => context.linebreak === undefined && (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
5954
5704
  class: 'annotation'
5955
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
5705
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
5956
5706
 
5957
5707
  /***/ },
5958
5708
 
@@ -6083,7 +5833,7 @@ const combinator_1 = __webpack_require__(3484);
6083
5833
  const source_1 = __webpack_require__(8745);
6084
5834
  const dom_1 = __webpack_require__(394);
6085
5835
  // https://html.spec.whatwg.org/multipage/input.html
6086
- exports.email = (0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, ({
5836
+ exports.email = (0, combinator_1.rewrite)((0, combinator_1.surround)((0, source_1.str)(/^[0-9a-z]/i), (0, combinator_1.verify)((0, source_1.str)(/^(?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255 - 1), '', false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, ({
6087
5837
  source
6088
5838
  }) => [[(0, dom_1.html)('a', {
6089
5839
  class: 'email',
@@ -6135,7 +5885,7 @@ const dom_1 = __webpack_require__(394);
6135
5885
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6136
5886
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6137
5887
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6138
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji)))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+/u.source].join('').replace(/emoji/g, exports.emoji), 'u'))), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
5888
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp([/^(?!['_])(?=(?:[0-9]{1,9})?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji)))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6139
5889
  class: 'hashtag'
6140
5890
  })]))), ({
6141
5891
  source
@@ -6157,13 +5907,13 @@ const combinator_1 = __webpack_require__(3484);
6157
5907
  const link_1 = __webpack_require__(3628);
6158
5908
  const source_1 = __webpack_require__(8745);
6159
5909
  const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|[^\x21-\x7E]|$)/;
6160
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.verify)(bracket, ns => ns.length > 0), (0, combinator_1.some)(source_1.unescsource, closer)]), undefined, [[/^[^\x21-\x7E]/, 3]])), false, [3 | 0 /* Backtrack.url */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
5910
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.verify)(bracket, ns => ns.length > 0), (0, combinator_1.some)(source_1.unescsource, closer)]), undefined, [[/^[^\x21-\x7E]/, 3]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
6161
5911
  source
6162
5912
  }) => [[source], '']]))));
6163
5913
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!?https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
6164
5914
  source
6165
- }) => [[source], '']])])), false, [3 | 16 /* Backtrack.linebracket */]));
6166
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.url */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.url */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.url */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.url */])]));
5915
+ }) => [[source], '']])])), false, [3 | 0 /* Backtrack.autolink */]));
5916
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 0 /* Backtrack.autolink */])]));
6167
5917
 
6168
5918
  /***/ },
6169
5919
 
@@ -6215,12 +5965,12 @@ const dom_1 = __webpack_require__(394);
6215
5965
  exports.code = (0, combinator_1.validate)(({
6216
5966
  source,
6217
5967
  context
6218
- }) => source[0] === '`' && !(0, combinator_1.getBacktrack)(context, [1 | 16 /* Backtrack.linebracket */], source, source.slice(1)), (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|$|\n)/, ([whole,, body, closer]) => ({
5968
+ }) => source[0] === '`' && !(0, combinator_1.getBacktrack)(context, [1 | 8 /* Backtrack.bracket */], source, source.length - 1), (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|$|\n)/, ([whole,, body, closer]) => ({
6219
5969
  source,
6220
5970
  context
6221
5971
  }) => closer ? [[(0, dom_1.html)('code', {
6222
5972
  'data-src': whole
6223
- }, format(body))], source.slice(whole.length)] : void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.linebracket */], source), true));
5973
+ }, format(body))], source.slice(whole.length)] : void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.bracket */], source.length), true));
6224
5974
  function format(text) {
6225
5975
  return `${text[0]}${text.at(-1)}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
6226
5976
  }
@@ -6379,9 +6129,9 @@ const source_1 = __webpack_require__(8745);
6379
6129
  const visibility_1 = __webpack_require__(6364);
6380
6130
  const array_1 = __webpack_require__(6876);
6381
6131
  const dom_1 = __webpack_require__(394);
6382
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [['\n', 9], [']', 1]])))), ']', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
6132
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), ']', false, ([, ns], rest, context) => context.linebreak === undefined && (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
6383
6133
  'data-index': dataindex(ns)
6384
- }, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, [3 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), ([el]) => [(0, dom_1.define)(el, {
6134
+ }, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, [3 | 8 /* Backtrack.bracket */])), ([el]) => [(0, dom_1.define)(el, {
6385
6135
  id: el.id ? null : undefined,
6386
6136
  class: 'index',
6387
6137
  href: el.id ? `#${el.id}` : undefined
@@ -6591,7 +6341,7 @@ const source_1 = __webpack_require__(8745);
6591
6341
  const dom_1 = __webpack_require__(394);
6592
6342
  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]))/);
6593
6343
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6594
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 16 /* Backtrack.linebracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6344
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 8 /* Backtrack.bracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6595
6345
  class: 'label',
6596
6346
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6597
6347
  }, text)]));
@@ -6657,7 +6407,6 @@ const source_1 = __webpack_require__(8745);
6657
6407
  const visibility_1 = __webpack_require__(6364);
6658
6408
  const util_1 = __webpack_require__(4992);
6659
6409
  const memoize_1 = __webpack_require__(6925);
6660
- const clock_1 = __webpack_require__(8663);
6661
6410
  const array_1 = __webpack_require__(6876);
6662
6411
  const dom_1 = __webpack_require__(394);
6663
6412
  const tags = Object.freeze(['bdo', 'bdi']);
@@ -6668,9 +6417,11 @@ const attrspecs = {
6668
6417
  };
6669
6418
  Object.setPrototypeOf(attrspecs, null);
6670
6419
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
6671
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)(
6420
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.union)([(0, combinator_1.surround)(
6672
6421
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6673
- (0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest], undefined, [3 | 16 /* Backtrack.linebracket */]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true, undefined, undefined, [3 | 16 /* Backtrack.linebracket */]), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), true))]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new Map())), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true, undefined, undefined, [3 | 16 /* Backtrack.linebracket */]), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 3]])]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new clock_1.Clock(10000)))])));
6422
+ (0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => as[0].slice(1) === 'wbr' && bs.length === 0 ? [[(0, dom_1.html)(as[0].slice(1))], rest] : [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest], undefined, [3 | 8 /* Backtrack.bracket */]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true, undefined, undefined, [3 | 8 /* Backtrack.bracket */]), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), true))]))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
6423
+ // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6424
+ (0, source_1.str)(/^<[a-z]+(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest], undefined, [3 | 8 /* Backtrack.bracket */])])));
6674
6425
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="[^"\n]*")?(?=[^\S\n]|>)/i)]);
6675
6426
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6676
6427
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
@@ -6802,12 +6553,22 @@ const source_1 = __webpack_require__(8745);
6802
6553
  const visibility_1 = __webpack_require__(6364);
6803
6554
  const util_1 = __webpack_require__(4992);
6804
6555
  const url_1 = __webpack_require__(1904);
6556
+ const array_1 = __webpack_require__(6876);
6805
6557
  const dom_1 = __webpack_require__(394);
6806
6558
  const optspec = {
6807
6559
  rel: ['nofollow']
6808
6560
  };
6809
6561
  Object.setPrototypeOf(optspec, null);
6810
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, [1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 128 /* Backtrack.link */]))])), ([params, content = []], rest, context) => {
6562
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []], rest, context) => context.linebreak === undefined ? [(0, array_1.push)(ns, ["\u001B" /* Command.Escape */]), rest] : undefined, undefined, [3 | 64 /* Backtrack.link */, 3 | 8 /* Backtrack.bracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 64 /* Backtrack.link */]))]), ([content, params], rest, context) => {
6563
+ if (content.at(-1) === "\u001B" /* Command.Escape */) {
6564
+ content.pop();
6565
+ if (params === undefined) {
6566
+ return void (0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.link */], context.recent.reduce((a, b) => a + b.length, 0));
6567
+ }
6568
+ } else {
6569
+ params = content;
6570
+ content = [];
6571
+ }
6811
6572
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
6812
6573
  return [[parse((0, dom_1.defrag)(content), params, context)], rest];
6813
6574
  }))))));
@@ -6818,14 +6579,21 @@ exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, s
6818
6579
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6819
6580
  function parse(content, params, context) {
6820
6581
  const INSECURE_URI = params.shift();
6821
- const uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6582
+ let uri;
6583
+ try {
6584
+ uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6585
+ } catch {}
6822
6586
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
6823
6587
  return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params));
6824
6588
  }
6825
6589
  function elem(INSECURE_URI, content, uri, origin) {
6826
6590
  let type;
6827
6591
  let message;
6828
- switch (uri.protocol) {
6592
+ switch (uri?.protocol) {
6593
+ case undefined:
6594
+ type = 'argument';
6595
+ message = 'Invalid URI';
6596
+ break;
6829
6597
  case 'http:':
6830
6598
  case 'https:':
6831
6599
  switch (true) {
@@ -6859,10 +6627,13 @@ function elem(INSECURE_URI, content, uri, origin) {
6859
6627
  message = 'Invalid content';
6860
6628
  }
6861
6629
  break;
6630
+ default:
6631
+ type = 'argument';
6632
+ message = 'Invalid protocol';
6862
6633
  }
6863
6634
  return (0, dom_1.html)('a', {
6864
6635
  class: 'invalid',
6865
- ...(0, util_1.invalid)('link', type ??= 'argument', message ??= 'Invalid protocol')
6636
+ ...(0, util_1.invalid)('link', type, message)
6866
6637
  }, content.length === 0 ? INSECURE_URI : content);
6867
6638
  }
6868
6639
  function resolve(uri, host, source) {
@@ -6990,17 +6761,21 @@ const optspec = {
6990
6761
  rel: undefined
6991
6762
  };
6992
6763
  Object.setPrototypeOf(optspec, null);
6993
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [['\n', 9]])), ']', true, undefined, undefined, [3 | 4 /* Backtrack.lineescbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 128 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6764
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], rest, context) => context.linebreak === undefined ? [ns, rest] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 64 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6994
6765
  const INSECURE_URI = params.shift();
6995
- const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6766
+ // altが空だとエラーが見えないため埋める。
6767
+ text ||= INSECURE_URI;
6768
+ let uri;
6769
+ try {
6770
+ uri = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6771
+ } catch {}
6996
6772
  let cache;
6997
- const el = false || (cache = context.caches?.media?.get(url.href)?.cloneNode(true)) || (0, dom_1.html)('img', {
6773
+ const el = false || uri && (cache = context.caches?.media?.get(uri.href)?.cloneNode(true)) || (0, dom_1.html)('img', {
6998
6774
  class: 'media',
6999
- 'data-src': url.source,
7000
- alt: text
6775
+ 'data-src': uri?.source
7001
6776
  });
7002
- cache?.hasAttribute('alt') && cache.setAttribute('alt', text);
7003
- if (!sanitize(el, url, text)) return [[el], rest];
6777
+ el.setAttribute('alt', text);
6778
+ if (!sanitize(el, uri, text)) return [[el], rest];
7004
6779
  (0, dom_1.define)(el, (0, html_1.attributes)('media', (0, array_1.push)([], el.classList), optspec, params));
7005
6780
  // Awaiting the generic support for attr().
7006
6781
  if (el.hasAttribute('aspect-ratio')) {
@@ -7017,36 +6792,36 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7017
6792
  });
7018
6793
  }))))));
7019
6794
  exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
7020
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */])])));
6795
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */])])));
7021
6796
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]));
7022
6797
  function sanitize(target, uri, alt) {
7023
- switch (uri.protocol) {
6798
+ let type;
6799
+ let message;
6800
+ if (!alt.includes("\u0007" /* Command.Error */)) switch (uri?.protocol) {
6801
+ case undefined:
6802
+ type = 'argument';
6803
+ message = 'Invalid URI';
6804
+ break;
7024
6805
  case 'http:':
7025
6806
  case 'https:':
7026
- if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7027
- (0, dom_1.define)(target, {
7028
- class: 'invalid',
7029
- ...(0, util_1.invalid)('media', 'argument', 'Dot-segments cannot be used in media paths; use subresource paths instead')
7030
- });
7031
- return false;
7032
- }
6807
+ if (!/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) return true;
6808
+ type = 'argument';
6809
+ message = 'Dot-segments cannot be used in media paths; use subresource paths instead';
7033
6810
  break;
7034
6811
  default:
7035
- (0, dom_1.define)(target, {
7036
- class: 'invalid',
7037
- ...(0, util_1.invalid)('media', 'argument', 'Invalid protocol')
7038
- });
7039
- return false;
7040
- }
7041
- if (alt.includes("\u0007" /* Command.Error */)) {
7042
- (0, dom_1.define)(target, {
7043
- class: 'invalid',
7044
- alt: target.getAttribute('alt')?.replace(context_1.CmdRegExp.Error, ''),
7045
- ...(0, util_1.invalid)('media', 'argument', `Cannot use invalid HTML entitiy "${alt.match(/&[0-9A-Za-z]+;/)[0]}"`)
7046
- });
7047
- return false;
6812
+ type = 'argument';
6813
+ message = 'Invalid protocol';
6814
+ } else {
6815
+ target.setAttribute('alt', alt.replace(context_1.CmdRegExp.Error, ''));
6816
+ type = 'argument';
6817
+ message = `Invalid HTML entitiy "${alt.match(/&[0-9A-Za-z]+;/)[0]}"`;
7048
6818
  }
7049
- return true;
6819
+ (0, dom_1.define)(target, {
6820
+ 'data-src': null,
6821
+ class: 'invalid',
6822
+ ...(0, util_1.invalid)('link', type, message)
6823
+ });
6824
+ return false;
7050
6825
  }
7051
6826
 
7052
6827
  /***/ },
@@ -7068,11 +6843,14 @@ const visibility_1 = __webpack_require__(6364);
7068
6843
  const dom_1 = __webpack_require__(394);
7069
6844
  const array_1 = __webpack_require__(6876);
7070
6845
  const util_1 = __webpack_require__(4992);
7071
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, ([as, bs], rest, {
7072
- state = 0
7073
- }) => state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
6846
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, ([, ns], rest, context) => context.linebreak === undefined && (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, ([as, bs], rest, context) => {
6847
+ if (rest[0] !== ']') {
6848
+ (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.bracket */], context.recent.reduce((a, b) => a + b.length, 0), 2);
6849
+ }
6850
+ return context.state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined;
6851
+ }, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */])));
7074
6852
  // Chicago-Style
7075
- const abbr = (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [['\n', ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]);
6853
+ const abbr = (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [["\u001B" /* Command.Escape */, ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]);
7076
6854
  function attributes(ns) {
7077
6855
  switch (ns[0]) {
7078
6856
  case '':
@@ -7080,7 +6858,7 @@ function attributes(ns) {
7080
6858
  class: 'invalid',
7081
6859
  ...(0, util_1.invalid)('reference', 'syntax', 'Invalid abbreviation')
7082
6860
  };
7083
- case '\n':
6861
+ case "\u001B" /* Command.Escape */:
7084
6862
  const abbr = ns[1];
7085
6863
  ns[0] = ns[1] = '';
7086
6864
  return {
@@ -7139,27 +6917,30 @@ const visibility_1 = __webpack_require__(6364);
7139
6917
  const util_1 = __webpack_require__(4992);
7140
6918
  const array_1 = __webpack_require__(6876);
7141
6919
  const dom_1 = __webpack_require__(394);
7142
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/), ']', false, ([, [source]], rest, context) => {
6920
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/), ']', false, ([, [source]], rest, context) => {
7143
6921
  const ns = (0, parser_1.eval)(text({
7144
6922
  source,
7145
6923
  context
7146
6924
  }), [undefined])[0];
7147
6925
  ns && ns.at(-1) === '' && ns.pop();
7148
6926
  return ns && (0, visibility_1.isTightNodeStart)(ns) ? [ns, rest] : undefined;
7149
- }, undefined, [3 | 64 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/), ')', false, ([, [source]], rest, context) => {
6927
+ }, undefined, [3 | 32 /* Backtrack.ruby */ | 1, 64 /* Backtrack.link */, 1 | 8 /* Backtrack.bracket */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/), ')', false, ([, [source]], rest, context) => {
7150
6928
  const ns = (0, parser_1.eval)(text({
7151
6929
  source,
7152
6930
  context
7153
6931
  }), [undefined])[0];
7154
6932
  return ns && [ns, rest];
7155
- }, undefined, [3 | 64 /* Backtrack.ruby */]))]), ([texts, rubies]) => {
6933
+ }, undefined, [3 | 32 /* Backtrack.ruby */ | 1, 64 /* Backtrack.link */, 1 | 8 /* Backtrack.bracket */]))]), ([texts, rubies], rest, context) => {
6934
+ if (rubies === undefined) {
6935
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.ruby */], context.recent.reduce((a, b) => a + b.length, 0));
6936
+ }
7156
6937
  switch (true) {
7157
6938
  case rubies.length <= texts.length:
7158
- return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
6939
+ return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))], rest];
7159
6940
  case texts.length === 1 && [...texts[0]].length >= rubies.length:
7160
- return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
6941
+ return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))], rest];
7161
6942
  default:
7162
- return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))];
6943
+ return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))], rest];
7163
6944
  }
7164
6945
  }));
7165
6946
  const text = ({
@@ -7271,11 +7052,12 @@ Object.defineProperty(exports, "__esModule", ({
7271
7052
  exports.template = void 0;
7272
7053
  const combinator_1 = __webpack_require__(3484);
7273
7054
  const source_1 = __webpack_require__(8745);
7055
+ const array_1 = __webpack_require__(6876);
7274
7056
  const dom_1 = __webpack_require__(394);
7275
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}', [['\n', 9]])), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7057
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
7276
7058
  class: 'template'
7277
- }, `{{${ns.join('')}}}`)], rest], undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 4 /* Backtrack.lineescbracket */]));
7278
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (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, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */])]));
7059
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], undefined, [3 | 16 /* Backtrack.doublebracket */, 1 | 8 /* Backtrack.bracket */]));
7060
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.escbracket */])]));
7279
7061
 
7280
7062
  /***/ },
7281
7063
 
@@ -7714,6 +7496,7 @@ Object.defineProperty(exports, "__esModule", ({
7714
7496
  exports.escsource = void 0;
7715
7497
  const combinator_1 = __webpack_require__(3484);
7716
7498
  const text_1 = __webpack_require__(5655);
7499
+ const dom_1 = __webpack_require__(394);
7717
7500
  const delimiter = /[\s\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/;
7718
7501
  const escsource = ({
7719
7502
  source,
@@ -7746,7 +7529,7 @@ const escsource = ({
7746
7529
  }
7747
7530
  case '\n':
7748
7531
  context.linebreak ??= source.length;
7749
- return [[source[0]], source.slice(1)];
7532
+ return [[(0, dom_1.html)('br')], source.slice(1)];
7750
7533
  default:
7751
7534
  const b = source[0].trimStart() === '';
7752
7535
  const i = b ? source.search(text_1.nonWhitespace) : 1;
@@ -7901,6 +7684,7 @@ Object.defineProperty(exports, "__esModule", ({
7901
7684
  exports.unescsource = void 0;
7902
7685
  const combinator_1 = __webpack_require__(3484);
7903
7686
  const text_1 = __webpack_require__(5655);
7687
+ const dom_1 = __webpack_require__(394);
7904
7688
  const unescsource = ({
7905
7689
  source,
7906
7690
  context
@@ -7923,7 +7707,7 @@ const unescsource = ({
7923
7707
  return [[source.slice(1, 2)], source.slice(2)];
7924
7708
  case '\n':
7925
7709
  context.linebreak ??= source.length;
7926
- return [[source[0]], source.slice(1)];
7710
+ return [[(0, dom_1.html)('br')], source.slice(1)];
7927
7711
  default:
7928
7712
  const b = source[0].trimStart() === '';
7929
7713
  const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) || 1 : 1;