securemark 0.249.0 → 0.251.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.249.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.251.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -360,6 +360,8 @@ const clock_1 = __webpack_require__(7681);
360
360
 
361
361
  const invlist_1 = __webpack_require__(7452);
362
362
 
363
+ const heap_1 = __webpack_require__(818);
364
+
363
365
  const assign_1 = __webpack_require__(4401);
364
366
 
365
367
  const tuple_1 = __webpack_require__(5341);
@@ -370,26 +372,21 @@ class Cache {
370
372
  capacity: 0,
371
373
  space: global_1.Infinity,
372
374
  age: global_1.Infinity,
373
- life: 10,
374
- limit: 95,
375
+ earlyExpiring: false,
376
+ limit: 950,
375
377
  capture: {
376
378
  delete: true,
377
379
  clear: true
378
380
  }
379
381
  };
380
- this.SIZE = 0; // 1041 days < 2 ** 53 / 100,000,000 / 3600 / 24.
381
- // Hit counter only for LFU.
382
-
383
- this.clock = global_1.Number.MIN_SAFE_INTEGER; // LRU access counter only for LRU.
384
-
385
- this.clockR = global_1.Number.MIN_SAFE_INTEGER;
382
+ this.overlap = 0;
383
+ this.SIZE = 0;
386
384
  this.memory = new global_1.Map();
387
385
  this.indexes = {
388
386
  LRU: new invlist_1.List(),
389
- LFU: new invlist_1.List(),
390
- // expiryとLFUのclockを消すなら消せる
391
- OVL: new invlist_1.List()
387
+ LFU: new invlist_1.List()
392
388
  };
389
+ this.expiries = new heap_1.Heap((a, b) => a.value.expiry - b.value.expiry);
393
390
  this.stats = {
394
391
  LRU: (0, tuple_1.tuple)(0, 0),
395
392
  LFU: (0, tuple_1.tuple)(0, 0),
@@ -415,7 +412,7 @@ class Cache {
415
412
  }
416
413
 
417
414
  };
418
- this.ratio = 50;
415
+ this.ratio = 500;
419
416
 
420
417
  if (typeof capacity === 'object') {
421
418
  opts = capacity;
@@ -428,8 +425,9 @@ class Cache {
428
425
  this.capacity = this.settings.capacity;
429
426
  if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
430
427
  this.space = this.settings.space;
431
- this.life = this.capacity * this.settings.life;
432
428
  this.limit = this.settings.limit;
429
+ this.earlyExpiring = this.settings.earlyExpiring;
430
+ this.disposer = this.settings.disposer;
433
431
  }
434
432
 
435
433
  get length() {
@@ -441,43 +439,30 @@ class Cache {
441
439
  return this.SIZE;
442
440
  }
443
441
 
444
- evict(node, record, callback) {
442
+ evict(node, callback) {
445
443
  const index = node.value;
446
- callback &&= !!this.settings.disposer;
447
- record = callback ? record ?? this.memory.get(index.key) : record;
444
+ callback &&= !!this.disposer;
445
+ this.overlap -= +(index.region === 'LFU' && node.list === this.indexes.LRU);
446
+ index.enode && this.expiries.delete(index.enode);
448
447
  node.delete();
449
- node.value.overlap?.delete();
450
448
  this.memory.delete(index.key);
451
449
  this.SIZE -= index.size;
452
- callback && this.settings.disposer?.(record.value, index.key);
450
+ callback && this.disposer?.(node.value.value, index.key);
453
451
  }
454
452
 
455
453
  ensure(margin, skip) {
456
- if (skip) {
457
- // Prevent wrong disposal of `skip`.
458
- skip.value.clock = this.clock;
459
- skip.value.expiry = global_1.Infinity;
460
- }
461
-
462
454
  let size = skip?.value.size ?? 0;
463
455
  if (margin - size <= 0) return;
464
456
  const {
465
457
  LRU,
466
- LFU,
467
- OVL
458
+ LFU
468
459
  } = this.indexes;
469
460
 
470
461
  while (this.length === this.capacity || this.size + margin - size > this.space) {
471
- const lastNode = OVL.last ?? LFU.last;
472
- const lastIndex = lastNode?.value;
473
462
  let target;
474
463
 
475
464
  switch (true) {
476
- // NOTE: The following conditions must be ensured that they won't be true if `lastNode` is `skip`.
477
- // LRUの下限を5%以上確保すればわずかな性能低下と引き換えにクロックを消せる
478
- case lastIndex && lastIndex.clock < this.clock - this.life:
479
- case lastIndex && lastIndex.expiry !== global_1.Infinity && lastIndex.expiry < (0, clock_1.now)():
480
- target = lastNode.list === OVL ? lastNode.value.node : lastNode;
465
+ case (target = this.expiries.peek()) && target !== skip && target.value.expiry < (0, clock_1.now)():
481
466
  break;
482
467
 
483
468
  case LRU.length === 0:
@@ -485,14 +470,13 @@ class Cache {
485
470
  break;
486
471
  // @ts-expect-error
487
472
 
488
- case LFU.length > this.capacity * this.ratio / 100:
473
+ case LFU.length > this.capacity * this.ratio / 1000:
489
474
  target = LFU.last !== skip ? LFU.last : LFU.length >= 2 ? LFU.last.prev : skip;
490
475
 
491
476
  if (target !== skip) {
492
- if (this.ratio >= 50) break;
477
+ if (this.ratio > 500) break;
493
478
  LRU.unshiftNode(target);
494
- LRU.head.value.node = LRU.head;
495
- LRU.head.value.overlap = OVL.unshift(LRU.head.value);
479
+ ++this.overlap;
496
480
  }
497
481
 
498
482
  // fallthrough
@@ -501,35 +485,41 @@ class Cache {
501
485
  target = LRU.last !== skip ? LRU.last : LRU.length >= 2 ? LRU.last.prev : LFU.last;
502
486
  }
503
487
 
504
- this.evict(target, void 0, true);
488
+ this.evict(target, true);
505
489
  skip = skip?.list && skip;
506
490
  size = skip?.value.size ?? 0;
507
491
  }
508
492
  }
509
493
 
510
- put(key, value, size = 1, age = this.settings.age) {
511
- if (size >= 1 === false) throw new Error(`Spica: Cache: Size must be 1 or more.`);
512
- if (age >= 1 === false) throw new Error(`Spica: Cache: Age must be 1 or more.`);
513
-
494
+ put(key, value, {
495
+ size = 1,
496
+ age = this.settings.age
497
+ } = {}) {
514
498
  if (size > this.space || age <= 0) {
515
- this.settings.disposer?.(value, key);
499
+ this.disposer?.(value, key);
516
500
  return false;
517
501
  }
518
502
 
519
503
  const expiry = age === global_1.Infinity ? global_1.Infinity : (0, clock_1.now)() + age;
520
- const record = this.memory.get(key);
504
+ const node = this.memory.get(key);
521
505
 
522
- if (record) {
523
- const node = record.index;
524
- const val = record.value;
506
+ if (node) {
507
+ const val = node.value.value;
525
508
  const index = node.value;
526
509
  this.ensure(size, node);
527
- index.clock = index.region === 'LRU' ? ++this.clockR : ++this.clock;
528
- index.expiry = expiry;
529
510
  this.SIZE += size - index.size;
530
511
  index.size = size;
531
- record.value = value;
532
- this.settings.disposer?.(val, key);
512
+ index.expiry = expiry;
513
+
514
+ if (this.earlyExpiring && expiry !== global_1.Infinity) {
515
+ index.enode ? this.expiries.update(index.enode) : index.enode = this.expiries.insert(node);
516
+ } else if (index.enode) {
517
+ this.expiries.delete(index.enode);
518
+ index.enode = void 0;
519
+ }
520
+
521
+ node.value.value = value;
522
+ this.disposer?.(val, key);
533
523
  return true;
534
524
  }
535
525
 
@@ -538,51 +528,52 @@ class Cache {
538
528
  LRU
539
529
  } = this.indexes;
540
530
  this.SIZE += size;
541
- this.memory.set(key, {
542
- index: LRU.unshift({
543
- key,
544
- size,
545
- clock: ++this.clockR,
546
- expiry,
547
- region: 'LRU'
548
- }),
549
- value
550
- });
531
+ this.memory.set(key, LRU.unshift({
532
+ key,
533
+ value,
534
+ size,
535
+ expiry,
536
+ region: 'LRU'
537
+ }));
538
+
539
+ if (this.earlyExpiring && expiry !== global_1.Infinity) {
540
+ LRU.head.value.enode = this.expiries.insert(LRU.head);
541
+ }
542
+
551
543
  return false;
552
544
  }
553
545
 
554
- set(key, value, size, age) {
555
- this.put(key, value, size, age);
546
+ set(key, value, opts) {
547
+ this.put(key, value, opts);
556
548
  return this;
557
549
  }
558
550
 
559
551
  get(key) {
560
- const record = this.memory.get(key);
561
- if (!record) return;
562
- const node = record.index;
552
+ const node = this.memory.get(key);
553
+ if (!node) return;
563
554
  const expiry = node.value.expiry;
564
555
 
565
556
  if (expiry !== global_1.Infinity && expiry < (0, clock_1.now)()) {
566
- this.evict(node, record, true);
557
+ this.evict(node, true);
567
558
  return;
568
559
  } // Optimization for memoize.
569
560
 
570
561
 
571
- if (this.capacity >= 10 && node === node.list.head) return record.value;
562
+ if (this.capacity > 3 && node === node.list.head) return node.value.value;
572
563
  this.access(node);
573
564
  this.slide();
574
- return record.value;
565
+ return node.value.value;
575
566
  }
576
567
 
577
568
  has(key) {
578
569
  //assert(this.memory.has(key) === (this.indexes.LFU.has(key) || this.indexes.LRU.has(key)));
579
570
  //assert(this.memory.size === this.indexes.LFU.length + this.indexes.LRU.length);
580
- const record = this.memory.get(key);
581
- if (!record) return false;
582
- const expiry = record.index.value.expiry;
571
+ const node = this.memory.get(key);
572
+ if (!node) return false;
573
+ const expiry = node.value.expiry;
583
574
 
584
575
  if (expiry !== global_1.Infinity && expiry < (0, clock_1.now)()) {
585
- this.evict(record.index, record, true);
576
+ this.evict(node, true);
586
577
  return false;
587
578
  }
588
579
 
@@ -590,33 +581,38 @@ class Cache {
590
581
  }
591
582
 
592
583
  delete(key) {
593
- const record = this.memory.get(key);
594
- if (!record) return false;
595
- this.evict(record.index, record, this.settings.capture.delete === true);
584
+ const node = this.memory.get(key);
585
+ if (!node) return false;
586
+ this.evict(node, this.settings.capture.delete === true);
596
587
  return true;
597
588
  }
598
589
 
599
590
  clear() {
591
+ this.overlap = 0;
600
592
  this.SIZE = 0;
601
- this.ratio = 50;
593
+ this.ratio = 500;
602
594
  this.stats.clear();
603
595
  this.indexes.LRU.clear();
604
596
  this.indexes.LFU.clear();
605
- this.indexes.OVL.clear();
606
- if (!this.settings.disposer || !this.settings.capture.clear) return void this.memory.clear();
597
+ this.expiries.clear();
598
+ if (!this.disposer || !this.settings.capture.clear) return void this.memory.clear();
607
599
  const memory = this.memory;
608
600
  this.memory = new global_1.Map();
609
601
 
610
602
  for (const [key, {
611
- value
603
+ value: {
604
+ value
605
+ }
612
606
  }] of memory) {
613
- this.settings.disposer(value, key);
607
+ this.disposer(value, key);
614
608
  }
615
609
  }
616
610
 
617
611
  *[Symbol.iterator]() {
618
612
  for (const [key, {
619
- value
613
+ value: {
614
+ value
615
+ }
620
616
  }] of this.memory) {
621
617
  yield [key, value];
622
618
  }
@@ -636,25 +632,26 @@ class Cache {
636
632
  indexes
637
633
  } = this;
638
634
  const window = capacity;
639
- LRU[0] + LFU[0] === window && this.stats.slide();
640
- if ((LRU[0] + LFU[0]) * 100 % capacity || LRU[1] + LFU[1] === 0) return;
635
+ const total = LRU[0] + LFU[0];
636
+ total === window && this.stats.slide();
637
+ if (total * 1000 % capacity || !LRU[1] || !LFU[1]) return;
641
638
  const lenR = indexes.LRU.length;
642
639
  const lenF = indexes.LFU.length;
643
- const lenV = indexes.OVL.length;
644
- const r = (lenF + lenV) * 1000 / (lenR + lenF) | 0;
645
- const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * (1 + r);
646
- const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1001 - r);
647
- const rateF1 = rate(window, LFU[1], LRU[1] + LFU[1], LFU[0], LRU[0] + LFU[0], 5) * (1001 - r); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
640
+ const lenV = this.overlap;
641
+ const r = (lenF + lenV) * 1000 / (lenR + lenF || 1) | 0;
642
+ const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * r;
643
+ const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1000 - r);
644
+ const rateF1 = rate(window, LFU[1], LRU[1] + LFU[1], LFU[0], LRU[0] + LFU[0], 5) * (1000 - r); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
648
645
  // LRUの下限設定ではLRU拡大の要否を迅速に判定できないためLFUのヒット率低下の検出で代替する
649
646
 
650
647
  if (ratio > 0 && (rateR0 > rateF0 || rateF0 < rateF1 * 0.95)) {
651
- if (lenR >= capacity * (100 - ratio) / 100) {
652
- //ratio % 10 || ratio === 100 || console.debug('-', ratio, LRU, LFU);
648
+ if (lenR >= capacity * (1000 - ratio) / 1000) {
649
+ //ratio % 100 || ratio === 1000 || console.debug('-', ratio, LRU, LFU);
653
650
  --this.ratio;
654
651
  }
655
652
  } else if (ratio < limit && rateF0 > rateR0) {
656
- if (lenF >= capacity * ratio / 100) {
657
- //ratio % 10 || ratio === 0 || console.debug('+', ratio, LRU, LFU);
653
+ if (lenF >= capacity * ratio / 1000) {
654
+ //ratio % 100 || ratio === 0 || console.debug('+', ratio, LRU, LFU);
658
655
  ++this.ratio;
659
656
  }
660
657
  }
@@ -666,33 +663,17 @@ class Cache {
666
663
 
667
664
  accessLRU(node) {
668
665
  const index = node.value;
669
- const {
670
- LRU,
671
- LFU
672
- } = this.indexes;
673
- ++this.stats[index.region][0]; // Prevent LFU destruction.
674
-
675
- if (!index.overlap && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
676
- index.clock = ++this.clockR;
677
- node.moveToHead();
678
- return true;
679
- }
680
-
681
- index.clock = ++this.clock;
666
+ ++this.stats[index.region][0];
667
+ this.overlap -= +(index.region === 'LFU');
682
668
  index.region = 'LFU';
683
- index.overlap?.delete();
684
- LFU.unshiftNode(node);
669
+ this.indexes.LFU.unshiftNode(node);
685
670
  return true;
686
671
  }
687
672
 
688
673
  accessLFU(node) {
674
+ if (node.list !== this.indexes.LFU) return false;
689
675
  const index = node.value;
690
- const {
691
- LFU
692
- } = this.indexes;
693
- if (node.list !== LFU) return false;
694
676
  ++this.stats[index.region][0];
695
- index.clock = ++this.clock;
696
677
  node.moveToHead();
697
678
  return true;
698
679
  }
@@ -949,6 +930,151 @@ var global = (/* unused pure expression or super */ null && (globalThis));
949
930
 
950
931
  /***/ }),
951
932
 
933
+ /***/ 818:
934
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
935
+
936
+ "use strict";
937
+
938
+
939
+ Object.defineProperty(exports, "__esModule", ({
940
+ value: true
941
+ }));
942
+ exports.Heap = void 0;
943
+
944
+ const alias_1 = __webpack_require__(5406); // Min heap
945
+
946
+
947
+ const undefined = void 0;
948
+
949
+ class Heap {
950
+ constructor(cmp = (a, b) => a > b ? 1 : a < b ? -1 : 0, stable = false) {
951
+ this.cmp = cmp;
952
+ this.stable = stable;
953
+ this.array = [];
954
+ this.$length = 0;
955
+ }
956
+
957
+ get length() {
958
+ return this.$length;
959
+ }
960
+
961
+ insert(value, order = value) {
962
+ const array = this.array;
963
+ const node = array[this.$length] = [order, value, this.$length++];
964
+ upHeapify(array, this.cmp, this.$length);
965
+ return node;
966
+ }
967
+
968
+ replace(value, order = value) {
969
+ const array = this.array;
970
+ if (this.$length === 0) return void this.insert(value, order);
971
+ const replaced = array[0][1];
972
+ array[0] = [order, value, 0];
973
+ downHeapify(array, this.cmp, 1, this.$length, this.stable);
974
+ return replaced;
975
+ }
976
+
977
+ extract() {
978
+ if (this.$length === 0) return;
979
+ const node = this.array[0];
980
+ this.delete(node);
981
+ return node[1];
982
+ }
983
+
984
+ delete(node) {
985
+ const array = this.array;
986
+ const index = node[2];
987
+ if (array[index] !== node) throw new Error('Invalid node');
988
+ swap(array, index, --this.$length); // @ts-expect-error
989
+
990
+ array[this.$length] = undefined;
991
+ index < this.$length && this.sort(array[index]);
992
+
993
+ if (array.length >= 2 ** 16 && array.length >= this.$length * 2) {
994
+ array.splice(array.length / 2, array.length / 2);
995
+ }
996
+
997
+ return node[1];
998
+ }
999
+
1000
+ update(node, order = node[1], value = node[1]) {
1001
+ const array = this.array;
1002
+ if (array[node[2]] !== node) throw new Error('Invalid node');
1003
+ node[1] = value;
1004
+ if (this.cmp(node[0], node[0] = order) === 0) return;
1005
+ this.sort(node);
1006
+ }
1007
+
1008
+ sort(node) {
1009
+ const array = this.array;
1010
+ return upHeapify(array, this.cmp, node[2] + 1) || downHeapify(array, this.cmp, node[2] + 1, this.$length, this.stable);
1011
+ }
1012
+
1013
+ peek() {
1014
+ return this.array[0]?.[1];
1015
+ }
1016
+
1017
+ clear() {
1018
+ this.array = [];
1019
+ this.$length = 0;
1020
+ }
1021
+
1022
+ }
1023
+
1024
+ exports.Heap = Heap;
1025
+
1026
+ function upHeapify(array, cmp, index) {
1027
+ const order = array[index - 1][0];
1028
+ let changed = false;
1029
+
1030
+ while (index > 1) {
1031
+ const parent = (0, alias_1.floor)(index / 2);
1032
+ if (cmp(array[parent - 1][0], order) <= 0) break;
1033
+ swap(array, index - 1, parent - 1);
1034
+ index = parent;
1035
+ changed ||= true;
1036
+ }
1037
+
1038
+ return changed;
1039
+ }
1040
+
1041
+ function downHeapify(array, cmp, index, length, stable) {
1042
+ let changed = false;
1043
+
1044
+ while (index < length) {
1045
+ const left = index * 2;
1046
+ const right = index * 2 + 1;
1047
+ let min = index;
1048
+
1049
+ if (left <= length && (stable ? cmp(array[left - 1][0], array[min - 1][0]) <= 0 : cmp(array[left - 1][0], array[min - 1][0]) < 0)) {
1050
+ min = left;
1051
+ }
1052
+
1053
+ if (right <= length && (stable ? cmp(array[right - 1][0], array[min - 1][0]) <= 0 : cmp(array[right - 1][0], array[min - 1][0]) < 0)) {
1054
+ min = right;
1055
+ }
1056
+
1057
+ if (min === index) break;
1058
+ swap(array, index - 1, min - 1);
1059
+ index = min;
1060
+ changed ||= true;
1061
+ }
1062
+
1063
+ return changed;
1064
+ }
1065
+
1066
+ function swap(array, index1, index2) {
1067
+ if (index1 === index2) return;
1068
+ const node1 = array[index1];
1069
+ const node2 = array[index2];
1070
+ node1[2] = index2;
1071
+ node2[2] = index1;
1072
+ array[index1] = node2;
1073
+ array[index2] = node1;
1074
+ }
1075
+
1076
+ /***/ }),
1077
+
952
1078
  /***/ 7452:
953
1079
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
954
1080
 
@@ -2211,8 +2337,9 @@ const surround_1 = __webpack_require__(7130);
2211
2337
 
2212
2338
  const memoize_1 = __webpack_require__(1808);
2213
2339
 
2214
- function indent(parser, separation = false) {
2215
- return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(/^(?=(([ \t])\2*))/, (0, memoize_1.memoize)(([, indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, source => [[unline(source)], '']))), ([, indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (nodes, rest, context) => {
2340
+ function indent(opener, parser, separation = false) {
2341
+ if (typeof opener === 'function') return indent(/^([ \t])\1*/, opener, parser);
2342
+ return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, source => [[unline(source)], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (nodes, rest, context) => {
2216
2343
  const result = parser(nodes.join('\n'), context);
2217
2344
  return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : global_1.undefined;
2218
2345
  });
@@ -2266,10 +2393,9 @@ function match(pattern, f) {
2266
2393
  if (source === '') return;
2267
2394
  const param = source.match(pattern);
2268
2395
  if (!param) return;
2269
- const rest = source.slice(param[0].length);
2270
- const result = f(param)(rest, context);
2396
+ const result = f(param)(source, context);
2271
2397
  if (!result) return;
2272
- return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= rest.length ? result : global_1.undefined;
2398
+ return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result : global_1.undefined;
2273
2399
  };
2274
2400
  }
2275
2401
 
@@ -3706,8 +3832,8 @@ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_
3706
3832
  }
3707
3833
  }
3708
3834
  }, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
3709
- const term = (0, combinator_1.creator)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, dom_1.defrag)(ns))]))));
3710
- const desc = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false));
3835
+ const term = (0, combinator_1.creator)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, dom_1.defrag)(ns))]))));
3836
+ const desc = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false));
3711
3837
 
3712
3838
  function fillTrailingDescription(es) {
3713
3839
  return es.length > 0 && es[es.length - 1].tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
@@ -4002,15 +4128,15 @@ const memoize_1 = __webpack_require__(1808);
4002
4128
 
4003
4129
  const array_1 = __webpack_require__(8112);
4004
4130
 
4005
- exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]|(?=\[?\$))/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4131
+ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4006
4132
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
4007
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:figure[^\S\n]+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, indentblock_1.indentblock, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({
4133
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, indentblock_1.indentblock, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({
4008
4134
  syntax: {
4009
4135
  inline: {
4010
4136
  media: false
4011
4137
  }
4012
4138
  }
4013
- }, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline))))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', (0, array_1.unshift)([(0, dom_1.html)('span', {
4139
+ }, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', (0, array_1.unshift)([(0, dom_1.html)('span', {
4014
4140
  class: 'figindex'
4015
4141
  })], (0, dom_1.defrag)(caption))), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], _, context) => [(0, dom_1.html)('pre', {
4016
4142
  class: 'invalid',
@@ -4544,13 +4670,13 @@ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segm
4544
4670
  media: false
4545
4671
  }
4546
4672
  }
4547
- }, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.context)({
4673
+ }, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.context)({
4548
4674
  syntax: {
4549
4675
  inline: {
4550
4676
  autolink: false
4551
4677
  }
4552
4678
  }
4553
- }, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
4679
+ }, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
4554
4680
  class: 'invalid',
4555
4681
  'data-invalid-syntax': 'heading',
4556
4682
  'data-invalid-type': 'syntax',
@@ -4633,10 +4759,10 @@ const combinator_1 = __webpack_require__(2087);
4633
4759
  const codeblock_1 = __webpack_require__(1849); // 空行を含むインデントブロックはインデントの違いによるセグメント分割の境界が視認不能となるため採用しない
4634
4760
 
4635
4761
 
4636
- exports.indentblock = (0, combinator_1.block)((0, combinator_1.validate)(/^(?: |\t)/, (0, combinator_1.indent)((0, combinator_1.convert)(source => {
4762
+ exports.indentblock = (0, combinator_1.block)((0, combinator_1.indent)(/^( {4}|\t)\1*/, (0, combinator_1.convert)(source => {
4637
4763
  const fence = (source.match(/^`{3,}(?=[^\S\n]*$)/mg) ?? []).reduce((max, fence) => fence > max ? fence : max, '``') + '`';
4638
4764
  return `${fence}\n${source}\n${fence}`;
4639
- }, (0, combinator_1.union)([codeblock_1.codeblock])), true)));
4765
+ }, (0, combinator_1.union)([codeblock_1.codeblock])), true));
4640
4766
 
4641
4767
  /***/ }),
4642
4768
 
@@ -4701,6 +4827,8 @@ const inline_1 = __webpack_require__(1160);
4701
4827
 
4702
4828
  const source_1 = __webpack_require__(6743);
4703
4829
 
4830
+ const util_1 = __webpack_require__(9437);
4831
+
4704
4832
  const dom_1 = __webpack_require__(3252);
4705
4833
 
4706
4834
  const memoize_1 = __webpack_require__(1808);
@@ -4708,8 +4836,8 @@ const memoize_1 = __webpack_require__(1808);
4708
4836
  const array_1 = __webpack_require__(8112);
4709
4837
 
4710
4838
  const openers = {
4711
- '.': /^(?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
4712
- '(': /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/
4839
+ '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
4840
+ '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/
4713
4841
  };
4714
4842
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/], (0, combinator_1.context)({
4715
4843
  syntax: {
@@ -4718,9 +4846,9 @@ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
4718
4846
  }
4719
4847
  }
4720
4848
  }, exports.olist_))));
4721
- exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(new RegExp(`^(?=${openers['.'].source.replace('?:', '')})`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(new RegExp(`^(?=${openers['('].source.replace('?:', '')})`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
4849
+ exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
4722
4850
 
4723
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.trim)((0, combinator_1.subsequence)([ulist_1.checkbox, (0, combinator_1.trimStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))])), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), invalid), ns => [(0, dom_1.html)('li', {
4851
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.trim)((0, combinator_1.subsequence)([ulist_1.checkbox, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))])), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), invalid), ns => [(0, dom_1.html)('li', {
4724
4852
  'data-marker': ns[0]
4725
4853
  }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
4726
4854
 
@@ -4843,7 +4971,7 @@ const util_1 = __webpack_require__(9437);
4843
4971
 
4844
4972
  const dom_1 = __webpack_require__(3252);
4845
4973
 
4846
- exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))])));
4974
+ exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))])));
4847
4975
 
4848
4976
  /***/ }),
4849
4977
 
@@ -4883,7 +5011,7 @@ const array_1 = __webpack_require__(8112);
4883
5011
  */
4884
5012
 
4885
5013
 
4886
- exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
5014
+ exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
4887
5015
 
4888
5016
  /***/ }),
4889
5017
 
@@ -5100,12 +5228,14 @@ const ilist_1 = __webpack_require__(238);
5100
5228
 
5101
5229
  const inline_1 = __webpack_require__(1160);
5102
5230
 
5231
+ const source_1 = __webpack_require__(6743);
5232
+
5233
+ const util_1 = __webpack_require__(9437);
5234
+
5103
5235
  const dom_1 = __webpack_require__(3252);
5104
5236
 
5105
5237
  const array_1 = __webpack_require__(8112);
5106
5238
 
5107
- const source_1 = __webpack_require__(6743);
5108
-
5109
5239
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
5110
5240
  syntax: {
5111
5241
  inline: {
@@ -5113,7 +5243,7 @@ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
5113
5243
  }
5114
5244
  }
5115
5245
  }, exports.ulist_))));
5116
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([exports.checkbox, (0, combinator_1.trimStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))])), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5246
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([exports.checkbox, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))])), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5117
5247
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
5118
5248
  class: 'checkbox'
5119
5249
  }, source[1].trimStart() ? '☑' : '☐')], '']);
@@ -5323,7 +5453,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5323
5453
  }
5324
5454
  },
5325
5455
  delimiters: global_1.undefined
5326
- }, (0, util_1.trimBlankInline)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5456
+ }, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5327
5457
  class: 'annotation'
5328
5458
  }, (0, dom_1.defrag)(ns))]))));
5329
5459
 
@@ -5646,7 +5776,7 @@ const dom_1 = __webpack_require__(3252);
5646
5776
 
5647
5777
  exports.code = (0, combinator_1.creator)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => rest => [[(0, dom_1.html)('code', {
5648
5778
  'data-src': whole
5649
- }, format(body))], rest])));
5779
+ }, format(body))], rest.slice(whole.length)])));
5650
5780
 
5651
5781
  function format(text) {
5652
5782
  return `${text[0]}${text[text.length - 1]}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
@@ -5677,7 +5807,7 @@ const memoize_1 = __webpack_require__(1808);
5677
5807
 
5678
5808
  const array_1 = __webpack_require__(8112);
5679
5809
 
5680
- exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^(?=\[(#+)\s)/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5810
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[%', (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5681
5811
  class: 'comment'
5682
5812
  }, [(0, dom_1.html)('input', {
5683
5813
  type: 'checkbox'
@@ -6136,13 +6266,13 @@ const attrspec = {
6136
6266
  };
6137
6267
  global_1.Object.setPrototypeOf(attrspec, null);
6138
6268
  global_1.Object.values(attrspec).forEach(o => global_1.Object.setPrototypeOf(o, null));
6139
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${tag}`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), /^\s*>/, true, ([, bs = []], rest) => [[(0, dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)]), `</${tag}>`), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, (0, dom_1.defrag)(bs), cs)], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)]), `</${tag}>`), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, (0, dom_1.defrag)(bs), cs)], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6269
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.match)(/^<(wbr)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${tag}`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), /^\s*>/, true, ([, bs = []], rest) => [[(0, dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6140
6270
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
6141
6271
 
6142
6272
  function elem(tag, as, bs, cs) {
6143
6273
  if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag <${tag}>`, as, bs, cs);
6144
6274
  const attrs = attributes('html', [], attrspec[tag], as.slice(1, -1));
6145
- return 'data-invalid-syntax' in attrs ? invalid('attribute', 'Invalid HTML attribute', as, bs, cs) : (0, dom_1.html)(tag, attrs, bs);
6275
+ return 'data-invalid-syntax' in attrs ? invalid('attribute', 'Invalid HTML attribute', as, bs, cs) : (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
6146
6276
  }
6147
6277
 
6148
6278
  function invalid(type, message, as, bs, cs) {
@@ -6302,7 +6432,7 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, co
6302
6432
  autolink: false
6303
6433
  }
6304
6434
  }
6305
- }, (0, util_1.trimBlankInline)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))), ']', true)]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]))), ([params, content = []], rest, context) => {
6435
+ }, (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))), ']', true)]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]))), ([params, content = []], rest, context) => {
6306
6436
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6307
6437
  const INSECURE_URI = params.shift();
6308
6438
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
@@ -6589,8 +6719,8 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6589
6719
  }
6590
6720
  },
6591
6721
  delimiters: global_1.undefined
6592
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.focus)(/^\^[^\S\n]*/, source => [['', source], '']), (0, util_1.trimBlankInline)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), (0, dom_1.defrag)(ns))]))));
6593
- const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankInlineStart, '')]));
6722
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.focus)(/^\^[^\S\n]*/, source => [['', source], '']), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), (0, dom_1.defrag)(ns))]))));
6723
+ const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6594
6724
 
6595
6725
  function attributes(ns) {
6596
6726
  return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
@@ -7649,7 +7779,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7649
7779
  Object.defineProperty(exports, "__esModule", ({
7650
7780
  value: true
7651
7781
  }));
7652
- exports.stringify = exports.trimNodeEnd = exports.trimBlankInline = exports.isStartTightNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankInlineStart = void 0;
7782
+ exports.stringify = exports.trimNodeEnd = exports.trimBlank = exports.isStartTightNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7653
7783
 
7654
7784
  const global_1 = __webpack_require__(4128);
7655
7785
 
@@ -7667,7 +7797,7 @@ const memoize_1 = __webpack_require__(1808);
7667
7797
 
7668
7798
  const array_1 = __webpack_require__(8112);
7669
7799
 
7670
- exports.regBlankInlineStart = new RegExp(String.raw`^(?:\\?[^\S\n]|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)+`);
7800
+ exports.regBlankStart = new RegExp(String.raw`^(?:\\?[^\S\n]|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)+`);
7671
7801
 
7672
7802
  function blankWith(starting, delimiter) {
7673
7803
  if (delimiter === global_1.undefined) return blankWith('', starting);
@@ -7710,7 +7840,7 @@ function startLoose(parser, except) {
7710
7840
 
7711
7841
  exports.startLoose = startLoose;
7712
7842
  const isStartLoose = (0, memoize_1.reduce)((source, context, except) => {
7713
- return isStartTight(source.replace(exports.regBlankInlineStart, ''), context, except);
7843
+ return isStartTight(source.replace(exports.regBlankStart, ''), context, except);
7714
7844
  }, (source, _, except = '') => `${source}\x1E${except}`);
7715
7845
 
7716
7846
  function startTight(parser, except) {
@@ -7795,14 +7925,14 @@ function isVisible(node, strpos) {
7795
7925
  }
7796
7926
  }
7797
7927
 
7798
- function trimBlankInline(parser) {
7799
- return (0, combinator_1.fmap)(trimBlankInlineStart(parser), trimNodeEnd);
7928
+ function trimBlank(parser) {
7929
+ return (0, combinator_1.fmap)(trimBlankStart(parser), trimNodeEnd);
7800
7930
  }
7801
7931
 
7802
- exports.trimBlankInline = trimBlankInline;
7932
+ exports.trimBlank = trimBlank;
7803
7933
 
7804
- function trimBlankInlineStart(parser) {
7805
- return (0, combinator_1.convert)((0, memoize_1.reduce)(source => source.replace(exports.regBlankInlineStart, '')), parser);
7934
+ function trimBlankStart(parser) {
7935
+ return (0, combinator_1.convert)((0, memoize_1.reduce)(source => source.replace(exports.regBlankStart, '')), parser);
7806
7936
  } //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7807
7937
  // return trimNodeStart(trimNodeEnd(nodes));
7808
7938
  //}
@@ -8629,7 +8759,7 @@ function fix(h) {
8629
8759
  /***/ 3252:
8630
8760
  /***/ (function(module) {
8631
8761
 
8632
- /*! typed-dom v0.0.297 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8762
+ /*! typed-dom v0.0.298 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8633
8763
  (function webpackUniversalModuleDefinition(root, factory) {
8634
8764
  if(true)
8635
8765
  module.exports = factory();
@@ -9063,7 +9193,7 @@ exports.defrag = defrag;
9063
9193
  /***/ 6120:
9064
9194
  /***/ (function(module) {
9065
9195
 
9066
- /*! typed-dom v0.0.297 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9196
+ /*! typed-dom v0.0.298 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9067
9197
  (function webpackUniversalModuleDefinition(root, factory) {
9068
9198
  if(true)
9069
9199
  module.exports = factory();