securemark 0.261.0 → 0.262.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 (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.js +1117 -646
  3. package/markdown.d.ts +0 -11
  4. package/package.json +9 -9
  5. package/src/combinator/data/parser/context/memo.ts +1 -1
  6. package/src/combinator/data/parser/inits.ts +1 -1
  7. package/src/combinator/data/parser/sequence.ts +1 -1
  8. package/src/debug.test.ts +3 -3
  9. package/src/parser/api/bind.ts +2 -2
  10. package/src/parser/api/parse.test.ts +1 -1
  11. package/src/parser/api/parse.ts +1 -1
  12. package/src/parser/block/blockquote.test.ts +31 -31
  13. package/src/parser/block/blockquote.ts +1 -1
  14. package/src/parser/block/dlist.ts +1 -1
  15. package/src/parser/block/extension/aside.test.ts +3 -3
  16. package/src/parser/block/extension/aside.ts +1 -0
  17. package/src/parser/block/extension/example.test.ts +11 -11
  18. package/src/parser/block/extension/example.ts +1 -1
  19. package/src/parser/block/extension/fig.test.ts +5 -5
  20. package/src/parser/block/extension/figure.test.ts +2 -2
  21. package/src/parser/block/extension/figure.ts +1 -1
  22. package/src/parser/block/extension/message.ts +1 -1
  23. package/src/parser/block/extension/table.ts +1 -1
  24. package/src/parser/block/olist.ts +5 -7
  25. package/src/parser/block/reply.ts +1 -1
  26. package/src/parser/block/table.ts +8 -8
  27. package/src/parser/block/ulist.ts +1 -1
  28. package/src/parser/block.ts +1 -1
  29. package/src/parser/inline/bracket.ts +1 -1
  30. package/src/parser/inline/comment.ts +1 -1
  31. package/src/parser/inline/deletion.ts +2 -2
  32. package/src/parser/inline/emphasis.ts +3 -3
  33. package/src/parser/inline/extension/indexee.ts +9 -8
  34. package/src/parser/inline/extension/placeholder.ts +1 -1
  35. package/src/parser/inline/html.ts +1 -1
  36. package/src/parser/inline/insertion.ts +2 -2
  37. package/src/parser/inline/link.ts +1 -1
  38. package/src/parser/inline/mark.ts +2 -2
  39. package/src/parser/inline/media.ts +1 -1
  40. package/src/parser/inline/ruby.ts +1 -1
  41. package/src/parser/inline/strong.ts +3 -3
  42. package/src/parser/inline/template.ts +1 -1
  43. package/src/parser/inline.ts +0 -3
  44. package/src/parser/locale/ja.ts +1 -1
  45. package/src/parser/locale.test.ts +1 -1
  46. package/src/parser/locale.ts +5 -4
  47. package/src/parser/processor/figure.test.ts +3 -3
  48. package/src/parser/processor/figure.ts +10 -8
  49. package/src/parser/processor/footnote.test.ts +2 -2
  50. package/src/parser/processor/footnote.ts +17 -12
  51. package/src/parser/source/str.ts +4 -2
  52. package/src/parser/source/text.ts +2 -2
  53. package/src/renderer/render.ts +3 -3
  54. package/src/util/info.ts +7 -5
  55. package/src/util/quote.ts +14 -12
  56. package/src/util/toc.ts +14 -8
  57. package/src/parser/inline/escape.ts +0 -21
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.261.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.262.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"));
@@ -92,6 +92,8 @@ exports.splice = exports.pop = exports.push = exports.shift = exports.unshift =
92
92
 
93
93
  const global_1 = __webpack_require__(4128);
94
94
 
95
+ const undefined = void 0;
96
+
95
97
  function indexOf(as, a) {
96
98
  if (as.length === 0) return -1;
97
99
  return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
@@ -101,7 +103,10 @@ exports.indexOf = indexOf;
101
103
 
102
104
  function unshift(as, bs) {
103
105
  if ('length' in as) {
104
- for (let i = as.length - 1; i >= 0; --i) {
106
+ if (as.length === 1) return bs.unshift(as[0]), bs;
107
+ if (global_1.Symbol.iterator in as) return bs.unshift(...as), bs;
108
+
109
+ for (let i = as.length; i--;) {
105
110
  bs.unshift(as[i]);
106
111
  }
107
112
  } else {
@@ -115,13 +120,16 @@ exports.unshift = unshift;
115
120
 
116
121
  function shift(as, count) {
117
122
  if (count < 0) throw new Error('Unexpected negative number');
118
- return count === void 0 ? [as.shift(), as] : [splice(as, 0, count), as];
123
+ return count === undefined ? [as.shift(), as] : [splice(as, 0, count), as];
119
124
  }
120
125
 
121
126
  exports.shift = shift;
122
127
 
123
128
  function push(as, bs) {
124
129
  if ('length' in bs) {
130
+ if (bs.length === 1) return as.push(bs[0]), as;
131
+ if (global_1.Symbol.iterator in bs && bs.length > 50) return as.push(...bs), as;
132
+
125
133
  for (let i = 0, len = bs.length; i < len; ++i) {
126
134
  as.push(bs[i]);
127
135
  }
@@ -138,50 +146,39 @@ exports.push = push;
138
146
 
139
147
  function pop(as, count) {
140
148
  if (count < 0) throw new Error('Unexpected negative number');
141
- return count === void 0 ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
149
+ return count === undefined ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
142
150
  }
143
151
 
144
152
  exports.pop = pop;
145
153
 
146
- function splice(as, index, count, ...inserts) {
147
- if (count === 0 && inserts.length === 0) return [];
154
+ function splice(as, index, count, ...values) {
155
+ if (as.length === 0) return push(as, values), [];
156
+
157
+ if (index > as.length) {
158
+ index = as.length;
159
+ } else if (index < 0) {
160
+ index = -index > as.length ? 0 : as.length + index;
161
+ }
162
+
148
163
  count = count > as.length ? as.length : count;
164
+ if (count === 0 && values.length === 0) return [];
165
+ if (count === 1 && values.length === 1) return [[as[index], as[index] = values[0]][0]];
149
166
 
150
167
  switch (index) {
151
168
  case 0:
152
- switch (count) {
153
- case 0:
154
- return [[], unshift(inserts, as)][0];
155
-
156
- case 1:
157
- return as.length === 0 ? [[], unshift(inserts, as)][0] : [[as.shift()], unshift(inserts, as)][0];
158
-
159
- case void 0:
160
- if (as.length > 1 || arguments.length > 2) break;
161
- return as.length === 0 ? [] : splice(as, index, 1);
162
- }
163
-
169
+ if (count === 0) return unshift(values, as), [];
170
+ if (count === 1) return [[as.shift()], unshift(values, as)][0];
164
171
  break;
165
172
 
166
- case -1:
167
173
  case as.length - 1:
168
- switch (count) {
169
- case 1:
170
- return as.length === 0 ? [[], push(as, inserts)][0] : [[as.pop()], push(as, inserts)][0];
171
-
172
- case void 0:
173
- if (as.length > 1 || arguments.length > 2) break;
174
- return as.length === 0 ? [] : splice(as, index, 1);
175
- }
176
-
174
+ if (count === 1) return [[as.pop()], push(as, values)][0];
177
175
  break;
178
176
 
179
177
  case as.length:
180
- case global_1.Infinity:
181
- return [[], push(as, inserts)][0];
178
+ return push(as, values), [];
182
179
  }
183
180
 
184
- return arguments.length > 2 ? as.splice(index, count, ...inserts) : as.splice(index);
181
+ return arguments.length > 2 ? as.splice(index, count, ...values) : as.splice(index);
185
182
  }
186
183
 
187
184
  exports.splice = splice;
@@ -369,15 +366,14 @@ const assign_1 = __webpack_require__(4401);
369
366
  class Cache {
370
367
  constructor(capacity, opts = {}) {
371
368
  this.settings = {
372
- window: 0,
373
369
  capacity: 0,
374
- space: global_1.Infinity,
375
370
  age: global_1.Infinity,
376
371
  earlyExpiring: false,
377
372
  capture: {
378
373
  delete: true,
379
374
  clear: true
380
375
  },
376
+ window: 0,
381
377
  resolution: 1,
382
378
  offset: 0,
383
379
  block: 20,
@@ -391,7 +387,7 @@ class Cache {
391
387
  LRU: new invlist_1.List(),
392
388
  LFU: new invlist_1.List()
393
389
  };
394
- this.expiries = new heap_1.Heap((a, b) => a.value.expiry - b.value.expiry);
390
+ this.expiries = new heap_1.Heap(heap_1.Heap.min);
395
391
  this.misses = 0;
396
392
  this.sweep = 0;
397
393
  this.ratio = 500;
@@ -407,8 +403,7 @@ class Cache {
407
403
  this.capacity = settings.capacity;
408
404
  if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
409
405
  this.window = settings.window || this.capacity;
410
- if (this.window * 1000 < this.capacity) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
411
- this.space = settings.space;
406
+ if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
412
407
  this.block = settings.block;
413
408
  this.limit = settings.limit;
414
409
  this.earlyExpiring = settings.earlyExpiring;
@@ -438,13 +433,12 @@ class Cache {
438
433
 
439
434
  ensure(margin, skip) {
440
435
  let size = skip?.value.size ?? 0;
441
- if (margin - size <= 0) return true;
442
436
  const {
443
437
  LRU,
444
438
  LFU
445
439
  } = this.indexes;
446
440
 
447
- while (this.length === this.capacity || this.size + margin - size > this.space) {
441
+ while (this.size + margin - size > this.capacity) {
448
442
  let target;
449
443
 
450
444
  switch (true) {
@@ -494,7 +488,7 @@ class Cache {
494
488
  size = 1,
495
489
  age = this.settings.age
496
490
  } = {}) {
497
- if (size > this.space || age <= 0) {
491
+ if (size < 1 || this.capacity < size || age <= 0) {
498
492
  this.disposer?.(value, key);
499
493
  return false;
500
494
  }
@@ -510,7 +504,7 @@ class Cache {
510
504
  index.expiry = expiry;
511
505
 
512
506
  if (this.earlyExpiring && expiry !== global_1.Infinity) {
513
- index.enode ? this.expiries.update(index.enode) : index.enode = this.expiries.insert(node);
507
+ index.enode ? this.expiries.update(index.enode, expiry) : index.enode = this.expiries.insert(node, expiry);
514
508
  } else if (index.enode) {
515
509
  this.expiries.delete(index.enode);
516
510
  index.enode = void 0;
@@ -535,7 +529,7 @@ class Cache {
535
529
  }));
536
530
 
537
531
  if (this.earlyExpiring && expiry !== global_1.Infinity) {
538
- LRU.head.value.enode = this.expiries.insert(LRU.head);
532
+ LRU.head.value.enode = this.expiries.insert(LRU.head, expiry);
539
533
  }
540
534
 
541
535
  return false;
@@ -560,14 +554,14 @@ class Cache {
560
554
  ++this.misses;
561
555
  this.evict(node, true);
562
556
  return;
563
- } // Optimization for memoize.
557
+ }
564
558
 
559
+ this.misses &&= 0;
560
+ this.sweep &&= 0; // Optimization for memoize.
565
561
 
566
562
  if (this.capacity > 3 && node === node.list.head) return node.value.value;
567
563
  this.access(node);
568
564
  this.adjust();
569
- this.misses &&= 0;
570
- this.sweep = 0;
571
565
  return node.value.value;
572
566
  }
573
567
 
@@ -607,21 +601,35 @@ class Cache {
607
601
  const memory = this.memory;
608
602
  this.memory = new global_1.Map();
609
603
 
610
- for (const [key, {
611
- value: {
612
- value
604
+ for (const {
605
+ 0: key,
606
+ 1: {
607
+ value: {
608
+ value
609
+ }
613
610
  }
614
- }] of memory) {
611
+ } of memory) {
615
612
  this.disposer(value, key);
616
613
  }
617
614
  }
618
615
 
616
+ resize(capacity) {
617
+ if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
618
+ this.capacity = capacity;
619
+ this.window = this.settings.window || this.capacity;
620
+ if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
621
+ this.ensure(0);
622
+ }
623
+
619
624
  *[Symbol.iterator]() {
620
- for (const [key, {
621
- value: {
622
- value
625
+ for (const {
626
+ 0: key,
627
+ 1: {
628
+ value: {
629
+ value
630
+ }
623
631
  }
624
- }] of this.memory) {
632
+ } of this.memory) {
625
633
  yield [key, value];
626
634
  }
627
635
 
@@ -792,58 +800,56 @@ function rate(window, hits1, hits2, offset) {
792
800
  Object.defineProperty(exports, "__esModule", ({
793
801
  value: true
794
802
  }));
795
- exports.tick = exports.clock = exports.now = void 0;
803
+ exports.tick = exports.promise = exports.clock = exports.now = void 0;
796
804
 
797
805
  const global_1 = __webpack_require__(4128);
798
806
 
799
- const alias_1 = __webpack_require__(5406);
807
+ const queue_1 = __webpack_require__(4934);
800
808
 
801
809
  const exception_1 = __webpack_require__(7822);
802
810
 
803
- let mem;
811
+ const undefined = void 0;
812
+ let time;
804
813
  let count = 0;
805
814
 
806
- function now(nocache = false) {
807
- if (mem === void 0) {
808
- tick(() => mem = void 0);
809
- } else if (!nocache && ++count !== 100) {
810
- return mem;
815
+ function now(nocache) {
816
+ if (time === undefined) {
817
+ tick(() => time = undefined);
818
+ } else if (!nocache && count++ !== 20) {
819
+ return time;
811
820
  }
812
821
 
813
- count = 0;
814
- return mem = global_1.Date.now();
822
+ count = 1;
823
+ return time = global_1.Date.now();
815
824
  }
816
825
 
817
826
  exports.now = now;
818
- exports.clock = Promise.resolve(void 0);
819
- let queue = [];
820
- let jobs = [];
821
- let index = 0;
822
- const scheduler = Promise.resolve();
827
+ exports.clock = global_1.Promise.resolve(undefined);
828
+
829
+ function promise(cb) {
830
+ global_1.Promise.resolve().then(cb);
831
+ }
832
+
833
+ exports.promise = promise;
834
+ const queue = new queue_1.Queue();
835
+ const scheduler = global_1.Promise.resolve();
823
836
 
824
837
  function tick(cb) {
825
- index === 0 && scheduler.then(run);
826
- index++ === queue.length ? queue.push(cb) : queue[index - 1] = cb;
838
+ queue.isEmpty() && scheduler.then(run);
839
+ queue.push(cb);
827
840
  }
828
841
 
829
842
  exports.tick = tick;
830
843
 
831
844
  function run() {
832
- const count = index;
833
- [index, queue, jobs] = [0, jobs, queue];
834
-
835
- for (let i = 0; i < count; ++i) {
845
+ for (let count = queue.length; count--;) {
836
846
  try {
837
- (void 0, jobs[i])(); // Release the reference.
838
-
839
- jobs[i] = void 0;
847
+ // @ts-expect-error
848
+ (0, queue.pop())();
840
849
  } catch (reason) {
841
850
  (0, exception_1.causeAsyncException)(reason);
842
851
  }
843
- } // Gradually reduce the unused buffer space.
844
-
845
-
846
- jobs.length > 1000 && count < jobs.length * 0.5 && jobs.splice((0, alias_1.floor)(jobs.length * 0.9), jobs.length);
852
+ }
847
853
  }
848
854
 
849
855
  /***/ }),
@@ -880,62 +886,51 @@ exports.MultiMap = void 0;
880
886
 
881
887
  const global_1 = __webpack_require__(4128);
882
888
 
883
- const array_1 = __webpack_require__(8112);
889
+ const ring_1 = __webpack_require__(6395);
884
890
 
885
891
  class MultiMap {
886
892
  constructor(entries = [], memory = new global_1.Map()) {
887
893
  this.memory = memory;
888
894
 
889
- for (const [k, v] of entries) {
895
+ for (const {
896
+ 0: k,
897
+ 1: v
898
+ } of entries) {
890
899
  this.set(k, v);
891
900
  }
892
901
  }
893
902
 
894
903
  get(key) {
895
- return this.memory.get(key)?.[0];
904
+ return this.memory.get(key)?.at(0);
905
+ }
906
+
907
+ getAll(key) {
908
+ return this.memory.get(key);
896
909
  }
897
910
 
898
911
  set(key, val) {
899
- this.memory.get(key)?.push(val) ?? this.memory.set(key, [val]);
912
+ let vs = this.memory.get(key);
913
+ if (vs) return vs.push(val), this;
914
+ vs = new ring_1.Ring();
915
+ vs.push(val);
916
+ this.memory.set(key, vs);
900
917
  return this;
901
918
  }
902
919
 
903
920
  has(key, value) {
904
921
  const vs = this.memory.get(key);
905
- if (!vs || vs.length === 0) return false;
922
+ if (!vs?.length) return false;
906
923
  if (arguments.length < 2) return true;
907
-
908
- switch (value) {
909
- case vs[0]:
910
- case vs[vs.length - 1]:
911
- return true;
912
-
913
- default:
914
- return (0, array_1.indexOf)(vs, value) > -1;
915
- }
924
+ return vs.includes(value);
916
925
  }
917
926
 
918
927
  delete(key, value) {
919
928
  if (arguments.length < 2) return this.memory.delete(key);
920
929
  const vs = this.memory.get(key);
921
- if (!vs || vs.length === 0) return false;
922
-
923
- switch (value) {
924
- case vs[0]:
925
- vs.shift();
926
- break;
927
-
928
- case vs[vs.length - 1]:
929
- vs.pop();
930
- break;
931
-
932
- default:
933
- const i = (0, array_1.indexOf)(vs, value);
934
- if (i === -1) return false;
935
- (0, array_1.splice)(vs, i, 1);
936
- }
937
-
938
- vs.length === 0 && this.memory.delete(key);
930
+ if (!vs?.length) return false;
931
+ const i = vs.indexOf(value);
932
+ if (i === -1) return false;
933
+ vs.splice(i, 1);
939
934
  return true;
940
935
  }
941
936
 
@@ -944,22 +939,32 @@ class MultiMap {
944
939
  }
945
940
 
946
941
  take(key, count) {
947
- const vs = this.memory.get(key) ?? [];
948
- return count === void 0 ? (0, array_1.splice)(vs, 0, 1)[0] : (0, array_1.splice)(vs, 0, count);
942
+ const vs = this.memory.get(key);
943
+ if (count === void 0) return vs?.shift();
944
+ const acc = [];
945
+
946
+ while (vs?.length && count--) {
947
+ acc.push(vs.shift());
948
+ }
949
+
950
+ return acc;
949
951
  }
950
952
 
951
953
  ref(key) {
952
954
  let vs = this.memory.get(key);
953
955
  if (vs) return vs;
954
- vs = [];
956
+ vs = new ring_1.Ring();
955
957
  this.memory.set(key, vs);
956
958
  return vs;
957
959
  }
958
960
 
959
961
  *[Symbol.iterator]() {
960
- for (const [k, vs] of this.memory) {
962
+ for (const {
963
+ 0: k,
964
+ 1: vs
965
+ } of this.memory) {
961
966
  for (let i = 0; i < vs.length; ++i) {
962
- yield [k, vs[i]];
967
+ yield [k, vs.at(i)];
963
968
  }
964
969
  }
965
970
 
@@ -981,12 +986,12 @@ exports.MultiMap = MultiMap;
981
986
  Object.defineProperty(exports, "__esModule", ({
982
987
  value: true
983
988
  }));
984
- exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
989
+ exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0; // 100,000以上でforより大幅に低速となり実用不可
985
990
 
986
991
  function duff(count, proc) {
987
992
  if (count > 0) {
988
993
  let i = 0,
989
- m = count % 8,
994
+ m = count & 7,
990
995
  d = (count - m) / 8;
991
996
 
992
997
  while (m--) {
@@ -1005,7 +1010,7 @@ function duff(count, proc) {
1005
1010
  }
1006
1011
  } else {
1007
1012
  let i = -count,
1008
- m = i % 8,
1013
+ m = i & 7,
1009
1014
  d = (i - m) / 8;
1010
1015
 
1011
1016
  while (m--) {
@@ -1025,12 +1030,12 @@ function duff(count, proc) {
1025
1030
  }
1026
1031
  }
1027
1032
 
1028
- exports.duff = duff;
1033
+ exports.duff = duff; // 100,000以上でforより大幅に低速となり実用不可
1029
1034
 
1030
1035
  function duffbk(count, proc) {
1031
1036
  if (count > 0) {
1032
1037
  let i = 0,
1033
- m = count % 8,
1038
+ m = count & 7,
1034
1039
  d = (count - m) / 8;
1035
1040
 
1036
1041
  while (m--) {
@@ -1038,18 +1043,21 @@ function duffbk(count, proc) {
1038
1043
  }
1039
1044
 
1040
1045
  while (d--) {
1041
- if (proc(i++) === false) return;
1042
- if (proc(i++) === false) return;
1043
- if (proc(i++) === false) return;
1044
- if (proc(i++) === false) return;
1045
- if (proc(i++) === false) return;
1046
- if (proc(i++) === false) return;
1047
- if (proc(i++) === false) return;
1048
- if (proc(i++) === false) return;
1046
+ switch (false) {
1047
+ case proc(i++):
1048
+ case proc(i++):
1049
+ case proc(i++):
1050
+ case proc(i++):
1051
+ case proc(i++):
1052
+ case proc(i++):
1053
+ case proc(i++):
1054
+ case proc(i++):
1055
+ return;
1056
+ }
1049
1057
  }
1050
1058
  } else {
1051
1059
  let i = -count,
1052
- m = i % 8,
1060
+ m = i & 7,
1053
1061
  d = (i - m) / 8;
1054
1062
 
1055
1063
  while (m--) {
@@ -1057,14 +1065,17 @@ function duffbk(count, proc) {
1057
1065
  }
1058
1066
 
1059
1067
  while (d--) {
1060
- if (proc(--i) === false) return;
1061
- if (proc(--i) === false) return;
1062
- if (proc(--i) === false) return;
1063
- if (proc(--i) === false) return;
1064
- if (proc(--i) === false) return;
1065
- if (proc(--i) === false) return;
1066
- if (proc(--i) === false) return;
1067
- if (proc(--i) === false) return;
1068
+ switch (false) {
1069
+ case proc(--i):
1070
+ case proc(--i):
1071
+ case proc(--i):
1072
+ case proc(--i):
1073
+ case proc(--i):
1074
+ case proc(--i):
1075
+ case proc(--i):
1076
+ case proc(--i):
1077
+ return;
1078
+ }
1068
1079
  }
1069
1080
  }
1070
1081
  }
@@ -1074,7 +1085,7 @@ exports.duffbk = duffbk;
1074
1085
  function duffEach(array, proc) {
1075
1086
  let count = array.length;
1076
1087
  let i = 0,
1077
- m = count % 8,
1088
+ m = count & 7,
1078
1089
  d = (count - m) / 8;
1079
1090
 
1080
1091
  while (m--) {
@@ -1093,30 +1104,32 @@ function duffEach(array, proc) {
1093
1104
  }
1094
1105
  }
1095
1106
 
1096
- exports.duffEach = duffEach;
1107
+ exports.duffEach = duffEach; // ベンチマークの10,000以上で急激な速度低下が見られる場合があるがNodeListなどでの
1108
+ // 実際の使用では速度低下は見られない
1097
1109
 
1098
1110
  function duffReduce(array, proc, initial) {
1099
1111
  let count = array.length;
1100
1112
  let i = 0,
1101
- m = count % 8,
1113
+ m = count & 7,
1102
1114
  d = (count - m) / 8;
1115
+ let acc = initial;
1103
1116
 
1104
1117
  while (m--) {
1105
- initial = proc(initial, array[i], i++, array);
1118
+ acc = proc(acc, array[i], i++, array);
1106
1119
  }
1107
1120
 
1108
1121
  while (d--) {
1109
- initial = proc(initial, array[i], i++, array);
1110
- initial = proc(initial, array[i], i++, array);
1111
- initial = proc(initial, array[i], i++, array);
1112
- initial = proc(initial, array[i], i++, array);
1113
- initial = proc(initial, array[i], i++, array);
1114
- initial = proc(initial, array[i], i++, array);
1115
- initial = proc(initial, array[i], i++, array);
1116
- initial = proc(initial, array[i], i++, array);
1122
+ acc = proc(acc, array[i], i++, array);
1123
+ acc = proc(acc, array[i], i++, array);
1124
+ acc = proc(acc, array[i], i++, array);
1125
+ acc = proc(acc, array[i], i++, array);
1126
+ acc = proc(acc, array[i], i++, array);
1127
+ acc = proc(acc, array[i], i++, array);
1128
+ acc = proc(acc, array[i], i++, array);
1129
+ acc = proc(acc, array[i], i++, array);
1117
1130
  }
1118
1131
 
1119
- return initial;
1132
+ return acc;
1120
1133
  }
1121
1134
 
1122
1135
  exports.duffReduce = duffReduce;
@@ -1180,18 +1193,22 @@ var global = (/* unused pure expression or super */ null && (globalThis));
1180
1193
  Object.defineProperty(exports, "__esModule", ({
1181
1194
  value: true
1182
1195
  }));
1183
- exports.Heap = void 0;
1196
+ exports.MultiHeap = exports.Heap = void 0;
1184
1197
 
1185
- const alias_1 = __webpack_require__(5406); // Min heap
1198
+ const global_1 = __webpack_require__(4128);
1199
+
1200
+ const invlist_1 = __webpack_require__(7452);
1186
1201
 
1202
+ const memoize_1 = __webpack_require__(1808);
1187
1203
 
1188
1204
  const undefined = void 0;
1205
+ let size = 16;
1189
1206
 
1190
1207
  class Heap {
1191
- constructor(cmp = (a, b) => a > b ? 1 : a < b ? -1 : 0, stable = false) {
1208
+ constructor(cmp = Heap.max, stable = false) {
1192
1209
  this.cmp = cmp;
1193
1210
  this.stable = stable;
1194
- this.array = [];
1211
+ this.array = (0, global_1.Array)(size);
1195
1212
  this.$length = 0;
1196
1213
  }
1197
1214
 
@@ -1199,19 +1216,35 @@ class Heap {
1199
1216
  return this.$length;
1200
1217
  }
1201
1218
 
1202
- insert(value, order = value) {
1219
+ isEmpty() {
1220
+ return this.array[0] !== undefined;
1221
+ }
1222
+
1223
+ peek() {
1224
+ return this.array[0]?.[1];
1225
+ }
1226
+
1227
+ insert(value, order) {
1228
+ if (arguments.length < 2) {
1229
+ order = value;
1230
+ }
1231
+
1203
1232
  const array = this.array;
1204
1233
  const node = array[this.$length] = [order, value, this.$length++];
1205
- upHeapify(array, this.cmp, this.$length);
1234
+ upHeapify(this.cmp, array, this.$length);
1206
1235
  return node;
1207
1236
  }
1208
1237
 
1209
- replace(value, order = value) {
1210
- const array = this.array;
1238
+ replace(value, order) {
1239
+ if (arguments.length < 2) {
1240
+ order = value;
1241
+ }
1242
+
1211
1243
  if (this.$length === 0) return void this.insert(value, order);
1244
+ const array = this.array;
1212
1245
  const replaced = array[0][1];
1213
1246
  array[0] = [order, value, 0];
1214
- downHeapify(array, this.cmp, 1, this.$length, this.stable);
1247
+ downHeapify(this.cmp, array, 1, this.$length, this.stable);
1215
1248
  return replaced;
1216
1249
  }
1217
1250
 
@@ -1229,47 +1262,146 @@ class Heap {
1229
1262
  swap(array, index, --this.$length); // @ts-expect-error
1230
1263
 
1231
1264
  array[this.$length] = undefined;
1232
- index < this.$length && this.sort(array[index]);
1233
-
1234
- if (array.length >= 2 ** 16 && array.length >= this.$length * 2) {
1235
- array.splice(array.length / 2, array.length / 2);
1236
- }
1237
-
1265
+ index < this.$length && sort(this.cmp, array, index, this.$length, this.stable);
1238
1266
  return node[1];
1239
1267
  }
1240
1268
 
1241
- update(node, order = node[1], value = node[1]) {
1269
+ update(node, order, value) {
1270
+ if (arguments.length < 2) {
1271
+ order = node[0];
1272
+ }
1273
+
1242
1274
  const array = this.array;
1243
1275
  if (array[node[2]] !== node) throw new Error('Invalid node');
1244
- node[1] = value;
1276
+
1277
+ if (arguments.length > 2) {
1278
+ node[1] = value;
1279
+ }
1280
+
1245
1281
  if (this.cmp(node[0], node[0] = order) === 0) return;
1246
- this.sort(node);
1282
+ sort(this.cmp, array, node[2], this.$length, this.stable);
1247
1283
  }
1248
1284
 
1249
- sort(node) {
1250
- const array = this.array;
1251
- return upHeapify(array, this.cmp, node[2] + 1) || downHeapify(array, this.cmp, node[2] + 1, this.$length, this.stable);
1285
+ clear() {
1286
+ this.array = (0, global_1.Array)(size);
1287
+ this.$length = 0;
1288
+ }
1289
+
1290
+ }
1291
+
1292
+ exports.Heap = Heap;
1293
+
1294
+ Heap.max = (a, b) => a > b ? -1 : a < b ? 1 : 0;
1295
+
1296
+ Heap.min = (a, b) => a > b ? 1 : a < b ? -1 : 0;
1297
+
1298
+ class MultiHeap {
1299
+ constructor(cmp = MultiHeap.max, clean = true) {
1300
+ this.cmp = cmp;
1301
+ this.clean = clean;
1302
+ this.heap = new Heap(this.cmp);
1303
+ this.dict = new Map();
1304
+ this.list = (0, memoize_1.memoize)(order => {
1305
+ const list = new invlist_1.List();
1306
+ list[MultiHeap.order] = order;
1307
+ list[MultiHeap.heap] = this.heap.insert(list, order);
1308
+ return list;
1309
+ }, this.dict);
1310
+ this.$length = 0;
1311
+ }
1312
+
1313
+ get length() {
1314
+ return this.$length;
1315
+ }
1316
+
1317
+ isEmpty() {
1318
+ return this.heap.isEmpty();
1252
1319
  }
1253
1320
 
1254
1321
  peek() {
1255
- return this.array[0]?.[1];
1322
+ return this.heap.peek()?.head.value;
1323
+ }
1324
+
1325
+ insert(value, order) {
1326
+ if (arguments.length < 2) {
1327
+ order = value;
1328
+ }
1329
+
1330
+ ++this.$length;
1331
+ const list = this.list(order);
1332
+ return [order, list.push(value)];
1333
+ }
1334
+
1335
+ extract() {
1336
+ if (this.$length === 0) return;
1337
+ --this.$length;
1338
+ const list = this.heap.peek();
1339
+ const value = list.shift();
1340
+
1341
+ if (list.length === 0) {
1342
+ this.heap.extract();
1343
+ this.clean && this.dict.delete(list[MultiHeap.order]);
1344
+ }
1345
+
1346
+ return value;
1347
+ }
1348
+
1349
+ delete(node) {
1350
+ if (!node[1].list) throw new Error('Invalid node');
1351
+ const {
1352
+ 0: order,
1353
+ 1: lnode
1354
+ } = node;
1355
+ --this.$length;
1356
+
1357
+ if (lnode.list.length === 1) {
1358
+ this.heap.delete(lnode[MultiHeap.heap]);
1359
+ this.clean && this.dict.delete(order);
1360
+ }
1361
+
1362
+ return lnode.delete();
1363
+ }
1364
+
1365
+ update(node, order, value) {
1366
+ if (!node[1].list) throw new Error('Invalid node');
1367
+
1368
+ if (arguments.length < 2) {
1369
+ order = node[0];
1370
+ }
1371
+
1372
+ if (arguments.length > 2) {
1373
+ node[1].value = value;
1374
+ }
1375
+
1376
+ if (this.cmp(node[0], order) === 0) return node;
1377
+ this.delete(node);
1378
+ return this.insert(node[1].value, order);
1256
1379
  }
1257
1380
 
1258
1381
  clear() {
1259
- this.array = [];
1382
+ this.heap.clear();
1383
+ this.dict.clear();
1260
1384
  this.$length = 0;
1261
1385
  }
1262
1386
 
1263
1387
  }
1264
1388
 
1265
- exports.Heap = Heap;
1389
+ exports.MultiHeap = MultiHeap;
1390
+ MultiHeap.order = Symbol('order');
1391
+ MultiHeap.heap = Symbol('heap');
1392
+ MultiHeap.max = Heap.max;
1393
+ MultiHeap.min = Heap.min;
1266
1394
 
1267
- function upHeapify(array, cmp, index) {
1395
+ function sort(cmp, array, index, length, stable) {
1396
+ return upHeapify(cmp, array, index + 1) || downHeapify(cmp, array, index + 1, length, stable);
1397
+ }
1398
+
1399
+ function upHeapify(cmp, array, index) {
1268
1400
  const order = array[index - 1][0];
1269
1401
  let changed = false;
1270
1402
 
1271
1403
  while (index > 1) {
1272
- const parent = (0, alias_1.floor)(index / 2);
1404
+ const parent = index / 2 | 0;
1273
1405
  if (cmp(array[parent - 1][0], order) <= 0) break;
1274
1406
  swap(array, index - 1, parent - 1);
1275
1407
  index = parent;
@@ -1279,7 +1411,7 @@ function upHeapify(array, cmp, index) {
1279
1411
  return changed;
1280
1412
  }
1281
1413
 
1282
- function downHeapify(array, cmp, index, length, stable) {
1414
+ function downHeapify(cmp, array, index, length, stable) {
1283
1415
  let changed = false;
1284
1416
 
1285
1417
  while (index < length) {
@@ -1357,7 +1489,7 @@ __exportStar(__webpack_require__(2310), exports);
1357
1489
  /***/ ((__unused_webpack_module, exports) => {
1358
1490
 
1359
1491
  "use strict";
1360
- // Circular inverse list
1492
+ // Circular Inverse List
1361
1493
 
1362
1494
  var _a;
1363
1495
 
@@ -1395,10 +1527,18 @@ class List {
1395
1527
  return this.head = this.push(value);
1396
1528
  }
1397
1529
 
1530
+ push(value) {
1531
+ return new Node(this, value, this.head, this.head?.prev);
1532
+ }
1533
+
1398
1534
  unshiftNode(node) {
1399
1535
  return this.head = this.pushNode(node);
1400
1536
  }
1401
1537
 
1538
+ pushNode(node) {
1539
+ return this.insert(node, this.head);
1540
+ }
1541
+
1402
1542
  unshiftRotationally(value) {
1403
1543
  const node = this.last;
1404
1544
  if (!node) return this.unshift(value);
@@ -1407,18 +1547,6 @@ class List {
1407
1547
  return node;
1408
1548
  }
1409
1549
 
1410
- shift() {
1411
- return this.head?.delete();
1412
- }
1413
-
1414
- push(value) {
1415
- return new Node(value, this.head, this.head?.prev, this);
1416
- }
1417
-
1418
- pushNode(node) {
1419
- return this.insert(node, this.head);
1420
- }
1421
-
1422
1550
  pushRotationally(value) {
1423
1551
  const node = this.head;
1424
1552
  if (!node) return this.push(value);
@@ -1427,12 +1555,16 @@ class List {
1427
1555
  return node;
1428
1556
  }
1429
1557
 
1558
+ shift() {
1559
+ return this.head?.delete();
1560
+ }
1561
+
1430
1562
  pop() {
1431
1563
  return this.last?.delete();
1432
1564
  }
1433
1565
 
1434
1566
  insert(node, before = this.head) {
1435
- if (node.list === this) return before && node.move(before), node;
1567
+ if (node.list === this) return node.moveTo(before), node;
1436
1568
  node.delete();
1437
1569
  ++this[LENGTH];
1438
1570
  this.head ??= node; // @ts-expect-error
@@ -1457,11 +1589,11 @@ class List {
1457
1589
  exports.List = List;
1458
1590
 
1459
1591
  class Node {
1460
- constructor(value, next, prev, list = next?.list ?? new List()) {
1592
+ constructor(list, value, next, prev) {
1593
+ this.list = list;
1461
1594
  this.value = value;
1462
1595
  this.next = next;
1463
1596
  this.prev = prev;
1464
- this.list = list;
1465
1597
  ++list[LENGTH];
1466
1598
  list.head ??= this;
1467
1599
  next && prev ? next.prev = prev.next = this : this.next = this.prev = this;
@@ -1470,17 +1602,21 @@ class Node {
1470
1602
  delete() {
1471
1603
  if (!this.list) return this.value;
1472
1604
  --this.list[LENGTH];
1605
+ const {
1606
+ next,
1607
+ prev
1608
+ } = this;
1473
1609
 
1474
1610
  if (this.list.head === this) {
1475
- this.list.head = this.next === this ? undefined : this.next;
1611
+ this.list.head = next === this ? undefined : next;
1476
1612
  }
1477
1613
 
1478
- if (this.next) {
1479
- this.next.prev = this.prev;
1614
+ if (next) {
1615
+ next.prev = prev;
1480
1616
  }
1481
1617
 
1482
- if (this.prev) {
1483
- this.prev.next = this.next;
1618
+ if (prev) {
1619
+ prev.next = next;
1484
1620
  } // @ts-expect-error
1485
1621
 
1486
1622
 
@@ -1491,20 +1627,19 @@ class Node {
1491
1627
  }
1492
1628
 
1493
1629
  insertBefore(value) {
1494
- return new Node(value, this, this.prev, this.list);
1630
+ return new Node(this.list, value, this, this.prev);
1495
1631
  }
1496
1632
 
1497
1633
  insertAfter(value) {
1498
- return new Node(value, this.next, this, this.list);
1634
+ return new Node(this.list, value, this.next, this);
1499
1635
  }
1500
1636
 
1501
- move(before) {
1637
+ moveTo(before) {
1502
1638
  if (!before) return false;
1503
1639
  if (this === before) return false;
1504
1640
  if (before.list !== this.list) return before.list.insert(this, before), true;
1505
1641
  const a1 = this;
1506
1642
  const b1 = before;
1507
- if (!b1) return false;
1508
1643
  if (a1.next === b1) return false;
1509
1644
  const b0 = b1.prev;
1510
1645
  const a0 = a1.prev;
@@ -1519,12 +1654,12 @@ class Node {
1519
1654
  }
1520
1655
 
1521
1656
  moveToHead() {
1522
- this.move(this.list.head);
1657
+ this.moveTo(this.list.head);
1523
1658
  this.list.head = this;
1524
1659
  }
1525
1660
 
1526
1661
  moveToLast() {
1527
- this.move(this.list.head);
1662
+ this.moveTo(this.list.head);
1528
1663
  }
1529
1664
 
1530
1665
  swap(node) {
@@ -1533,8 +1668,8 @@ class Node {
1533
1668
  if (node1 === node2) return false;
1534
1669
  const node3 = node2.next;
1535
1670
  if (node1.list !== node2.list) throw new Error(`Spica: InvList: Cannot swap nodes across lists.`);
1536
- node2.move(node1);
1537
- node1.move(node3);
1671
+ node2.moveTo(node1);
1672
+ node1.moveTo(node3);
1538
1673
 
1539
1674
  switch (this.list.head) {
1540
1675
  case node1:
@@ -1570,12 +1705,14 @@ const alias_1 = __webpack_require__(5406);
1570
1705
 
1571
1706
  const compare_1 = __webpack_require__(5529);
1572
1707
 
1708
+ const undefined = void 0;
1709
+
1573
1710
  function memoize(f, identify = (...as) => as[0], memory) {
1574
- if (typeof identify === 'object') return memoize(f, void 0, identify);
1575
- if (memory === void 0) return memoize(f, identify, new global_1.Map());
1711
+ if (typeof identify === 'object') return memoize(f, undefined, identify);
1712
+ if (memory === undefined) return memoize(f, identify, new global_1.Map());
1576
1713
  if ((0, alias_1.isArray)(memory)) return memoize(f, identify, {
1577
1714
  has(key) {
1578
- return memory[key] !== void 0;
1715
+ return memory[key] !== undefined;
1579
1716
  },
1580
1717
 
1581
1718
  get(key) {
@@ -1596,9 +1733,9 @@ function memoize(f, identify = (...as) => as[0], memory) {
1596
1733
  return (...as) => {
1597
1734
  const b = identify(...as);
1598
1735
  let z = memory.get(b);
1599
- if (z !== void 0 || nullish && memory.has(b)) return z;
1736
+ if (z !== undefined || nullish && memory.has(b)) return z;
1600
1737
  z = f(...as);
1601
- nullish ||= z === void 0;
1738
+ nullish ||= z === undefined;
1602
1739
  memory.set(b, z);
1603
1740
  return z;
1604
1741
  };
@@ -1607,8 +1744,8 @@ function memoize(f, identify = (...as) => as[0], memory) {
1607
1744
  exports.memoize = memoize;
1608
1745
 
1609
1746
  function reduce(f, identify = (...as) => as[0]) {
1610
- let key = [];
1611
- let val = [];
1747
+ let key = {};
1748
+ let val;
1612
1749
  return (...as) => {
1613
1750
  const b = identify(...as);
1614
1751
 
@@ -1623,42 +1760,246 @@ function reduce(f, identify = (...as) => as[0]) {
1623
1760
 
1624
1761
  exports.reduce = reduce;
1625
1762
 
1626
- /***/ }),
1763
+ /***/ }),
1764
+
1765
+ /***/ 940:
1766
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1767
+
1768
+ "use strict";
1769
+
1770
+
1771
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1772
+ if (k2 === undefined) k2 = k;
1773
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1774
+
1775
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1776
+ desc = {
1777
+ enumerable: true,
1778
+ get: function () {
1779
+ return m[k];
1780
+ }
1781
+ };
1782
+ }
1783
+
1784
+ Object.defineProperty(o, k2, desc);
1785
+ } : function (o, m, k, k2) {
1786
+ if (k2 === undefined) k2 = k;
1787
+ o[k2] = m[k];
1788
+ });
1789
+
1790
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1791
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1792
+ };
1793
+
1794
+ Object.defineProperty(exports, "__esModule", ({
1795
+ value: true
1796
+ }));
1797
+
1798
+ __exportStar(__webpack_require__(5084), exports);
1799
+
1800
+ /***/ }),
1801
+
1802
+ /***/ 4934:
1803
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1804
+
1805
+ "use strict";
1806
+
1807
+
1808
+ Object.defineProperty(exports, "__esModule", ({
1809
+ value: true
1810
+ }));
1811
+ exports.PriorityQueue = exports.Queue = void 0;
1812
+
1813
+ const global_1 = __webpack_require__(4128);
1814
+
1815
+ const heap_1 = __webpack_require__(818);
1816
+
1817
+ const memoize_1 = __webpack_require__(1808);
1818
+
1819
+ const undefined = void 0;
1820
+ const size = 2048;
1821
+ const initsize = 16;
1822
+
1823
+ class Queue {
1824
+ constructor() {
1825
+ this.head = new FixedQueue(initsize);
1826
+ this.tail = this.head;
1827
+ this.count = 0;
1828
+ this.irregular = 0;
1829
+ }
1830
+
1831
+ get length() {
1832
+ return this.count === 0 ? this.head.length : this.head.length + this.tail.length + (size - 1) * (this.count - 2) + (this.irregular || size) - 1;
1833
+ }
1834
+
1835
+ isEmpty() {
1836
+ return this.head.isEmpty();
1837
+ }
1838
+
1839
+ peek(index = 0) {
1840
+ return index === 0 ? this.head.peek(0) : this.tail.peek(-1);
1841
+ }
1842
+
1843
+ push(value) {
1844
+ const tail = this.tail;
1845
+
1846
+ if (tail.isFull()) {
1847
+ if (tail.next.isEmpty()) {
1848
+ this.tail = tail.next;
1849
+ } else {
1850
+ this.tail = tail.next = new FixedQueue(size, tail.next);
1851
+ }
1852
+
1853
+ ++this.count;
1854
+
1855
+ if (tail.size !== size && tail !== this.head) {
1856
+ this.irregular = tail.size;
1857
+ }
1858
+ }
1859
+
1860
+ this.tail.push(value);
1861
+ }
1862
+
1863
+ pop() {
1864
+ const head = this.head;
1865
+ const value = head.pop();
1866
+
1867
+ if (head.isEmpty() && !head.next.isEmpty()) {
1868
+ --this.count;
1869
+ this.head = head.next;
1870
+
1871
+ if (this.head.size === this.irregular) {
1872
+ this.irregular = 0;
1873
+ }
1874
+ }
1875
+
1876
+ return value;
1877
+ }
1878
+
1879
+ clear() {
1880
+ this.head = this.tail = new FixedQueue(initsize);
1881
+ this.count = 0;
1882
+ this.irregular = 0;
1883
+ }
1884
+
1885
+ *[Symbol.iterator]() {
1886
+ while (!this.isEmpty()) {
1887
+ yield this.pop();
1888
+ }
1889
+
1890
+ return;
1891
+ }
1892
+
1893
+ }
1894
+
1895
+ exports.Queue = Queue;
1896
+
1897
+ class FixedQueue {
1898
+ constructor(size, next) {
1899
+ this.size = size;
1900
+ this.array = (0, global_1.Array)(this.size);
1901
+ this.mask = this.array.length - 1;
1902
+ this.head = 0;
1903
+ this.tail = 0;
1904
+ this.next = next ?? this;
1905
+ }
1906
+
1907
+ get length() {
1908
+ return this.tail >= this.head ? this.tail - this.head : this.array.length - this.head + this.tail;
1909
+ }
1910
+
1911
+ isEmpty() {
1912
+ return this.tail === this.head;
1913
+ }
1914
+
1915
+ isFull() {
1916
+ return (this.tail + 1 & this.mask) === this.head;
1917
+ }
1918
+
1919
+ peek(index = 0) {
1920
+ return index === 0 ? this.array[this.head] : this.array[this.tail - 1 & this.mask];
1921
+ }
1922
+
1923
+ push(value) {
1924
+ this.array[this.tail] = value;
1925
+ this.tail = this.tail + 1 & this.mask;
1926
+ }
1927
+
1928
+ pop() {
1929
+ if (this.isEmpty()) return;
1930
+ const value = this.array[this.head];
1931
+ this.array[this.head] = undefined;
1932
+ this.head = this.head + 1 & this.mask;
1933
+ return value;
1934
+ }
1935
+
1936
+ }
1937
+
1938
+ class PriorityQueue {
1939
+ constructor(cmp = PriorityQueue.max, clean = true) {
1940
+ this.clean = clean;
1941
+ this.dict = new Map();
1942
+ this.queue = (0, memoize_1.memoize)(priority => {
1943
+ const queue = new Queue();
1944
+ queue[PriorityQueue.priority] = priority;
1945
+ this.heap.insert(queue, priority);
1946
+ return queue;
1947
+ }, this.dict);
1948
+ this.$length = 0;
1949
+ this.heap = new heap_1.Heap(cmp);
1950
+ }
1951
+
1952
+ get length() {
1953
+ return this.$length;
1954
+ }
1955
+
1956
+ isEmpty() {
1957
+ return this.$length === 0;
1958
+ }
1959
+
1960
+ peek() {
1961
+ return this.heap.peek()?.peek();
1962
+ }
1627
1963
 
1628
- /***/ 940:
1629
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1964
+ push(value, priority) {
1965
+ ++this.$length;
1966
+ this.queue(priority).push(value);
1967
+ }
1630
1968
 
1631
- "use strict";
1969
+ pop() {
1970
+ if (this.$length === 0) return;
1971
+ --this.$length;
1972
+ const queue = this.heap.peek();
1973
+ const value = queue.pop();
1632
1974
 
1975
+ if (queue.isEmpty()) {
1976
+ this.heap.extract();
1977
+ this.clean && this.dict.delete(queue[PriorityQueue.priority]);
1978
+ }
1633
1979
 
1634
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1635
- if (k2 === undefined) k2 = k;
1636
- var desc = Object.getOwnPropertyDescriptor(m, k);
1980
+ return value;
1981
+ }
1637
1982
 
1638
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1639
- desc = {
1640
- enumerable: true,
1641
- get: function () {
1642
- return m[k];
1643
- }
1644
- };
1983
+ clear() {
1984
+ this.heap.clear();
1985
+ this.dict.clear();
1986
+ this.$length = 0;
1645
1987
  }
1646
1988
 
1647
- Object.defineProperty(o, k2, desc);
1648
- } : function (o, m, k, k2) {
1649
- if (k2 === undefined) k2 = k;
1650
- o[k2] = m[k];
1651
- });
1989
+ *[Symbol.iterator]() {
1990
+ while (!this.isEmpty()) {
1991
+ yield this.pop();
1992
+ }
1652
1993
 
1653
- var __exportStar = this && this.__exportStar || function (m, exports) {
1654
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1655
- };
1994
+ return;
1995
+ }
1656
1996
 
1657
- Object.defineProperty(exports, "__esModule", ({
1658
- value: true
1659
- }));
1997
+ }
1660
1998
 
1661
- __exportStar(__webpack_require__(5084), exports);
1999
+ exports.PriorityQueue = PriorityQueue;
2000
+ PriorityQueue.priority = Symbol('priority');
2001
+ PriorityQueue.max = heap_1.Heap.max;
2002
+ PriorityQueue.min = heap_1.Heap.min;
1662
2003
 
1663
2004
  /***/ }),
1664
2005
 
@@ -1695,12 +2036,14 @@ function unique(rnd, len, mem) {
1695
2036
  let limit = 5;
1696
2037
  return () => {
1697
2038
  while (true) {
1698
- for (let i = 0; i < limit; ++i) {
1699
- const r = rnd(len);
1700
- if (mem.has(r)) continue;
1701
- mem.add(r);
1702
- return r;
1703
- }
2039
+ try {
2040
+ for (let i = 0; i < limit; ++i) {
2041
+ const r = rnd(len);
2042
+ if (mem.has(r)) continue;
2043
+ mem.add(r);
2044
+ return r;
2045
+ }
2046
+ } catch {}
1704
2047
 
1705
2048
  clear && mem.clear();
1706
2049
  ++len;
@@ -1761,6 +2104,235 @@ function random(len) {
1761
2104
 
1762
2105
  /***/ }),
1763
2106
 
2107
+ /***/ 6395:
2108
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2109
+
2110
+ "use strict";
2111
+
2112
+
2113
+ Object.defineProperty(exports, "__esModule", ({
2114
+ value: true
2115
+ }));
2116
+ exports.Ring = void 0;
2117
+
2118
+ const global_1 = __webpack_require__(4128);
2119
+
2120
+ const alias_1 = __webpack_require__(5406);
2121
+
2122
+ const array_1 = __webpack_require__(8112);
2123
+
2124
+ const undefined = void 0;
2125
+ const empty = Symbol('empty');
2126
+
2127
+ const unempty = value => value === empty ? undefined : value;
2128
+
2129
+ const space = Object.freeze((0, global_1.Array)(100).fill(empty));
2130
+ let size = 16;
2131
+
2132
+ class Ring {
2133
+ constructor() {
2134
+ this.array = (0, global_1.Array)(size);
2135
+ this.head = 0;
2136
+ this.tail = 0;
2137
+ this.$length = 0;
2138
+ this.excess = 0;
2139
+ }
2140
+
2141
+ get length() {
2142
+ return this.$length;
2143
+ }
2144
+
2145
+ at(index) {
2146
+ // Inline the code for optimization.
2147
+ const array = this.array;
2148
+
2149
+ if (index >= 0) {
2150
+ if (index >= this.$length) return;
2151
+ return unempty(array[(this.head - 1 + index) % array.length]);
2152
+ } else {
2153
+ if (-index > this.$length) return;
2154
+ return this.tail + index >= 0 ? unempty(array[this.tail + index]) : unempty(array[array.length + this.tail + index]);
2155
+ }
2156
+ }
2157
+
2158
+ replace(index, value, replacer) {
2159
+ const array = this.array;
2160
+
2161
+ if (index >= 0) {
2162
+ if (index >= this.$length) throw new RangeError('Invalid index');
2163
+ index = (this.head - 1 + index) % array.length;
2164
+ } else {
2165
+ if (-index > this.$length) throw new RangeError('Invalid index');
2166
+ index = this.tail + index >= 0 ? this.tail + index : array.length + this.tail + index;
2167
+ }
2168
+
2169
+ const val = unempty(array[index]);
2170
+ array[index] = replacer ? replacer(val, value) : value;
2171
+ return val;
2172
+ }
2173
+
2174
+ push(value) {
2175
+ const array = this.array;
2176
+ let {
2177
+ head,
2178
+ tail
2179
+ } = this;
2180
+ tail = this.tail = next(head, tail, array.length);
2181
+ head = this.head ||= tail;
2182
+
2183
+ if (head === tail && this.$length !== 0) {
2184
+ (0, array_1.splice)(array, tail - 1, 0, ...space);
2185
+ head = this.head += space.length;
2186
+ }
2187
+
2188
+ array[tail - 1] = value;
2189
+ ++this.$length;
2190
+ }
2191
+
2192
+ unshift(value) {
2193
+ const array = this.array;
2194
+ let {
2195
+ head,
2196
+ tail
2197
+ } = this;
2198
+ head = this.head = prev(head, tail, array.length);
2199
+ tail = this.tail ||= head;
2200
+
2201
+ if (head === tail && this.$length !== 0) {
2202
+ (0, array_1.splice)(array, head, 0, ...space);
2203
+ head = this.head += space.length;
2204
+ }
2205
+
2206
+ array[head - 1] = value;
2207
+ ++this.$length;
2208
+ }
2209
+
2210
+ pop() {
2211
+ if (this.$length === 0) return;
2212
+ const array = this.array;
2213
+ const i = this.tail - 1;
2214
+ const value = unempty(array[i]);
2215
+ array[i] = empty;
2216
+ --this.$length === 0 ? this.head = this.tail = 0 : this.tail = this.tail === 1 ? array.length : this.tail - 1;
2217
+ return value;
2218
+ }
2219
+
2220
+ shift() {
2221
+ if (this.$length === 0) return;
2222
+ const array = this.array;
2223
+ const i = this.head - 1;
2224
+ const value = unempty(array[i]);
2225
+ array[i] = empty;
2226
+ --this.$length === 0 ? this.head = this.tail = 0 : this.head = this.head === array.length ? 1 : this.head + 1;
2227
+ return value;
2228
+ }
2229
+
2230
+ splice(index, count, ...values) {
2231
+ const array = this.array;
2232
+
2233
+ if (this.excess > 100 && array.length - this.$length > 200) {
2234
+ (0, array_1.splice)(array, 0, 100 - (0, array_1.splice)(array, this.tail, 100).length);
2235
+ this.excess -= 100;
2236
+ } else if (-this.excess > array.length * 2) {
2237
+ this.excess = array.length;
2238
+ }
2239
+
2240
+ index = index < 0 ? (0, alias_1.max)(0, this.$length + index) : index <= this.$length ? index : this.$length;
2241
+ count = (0, alias_1.min)((0, alias_1.max)(count, 0), this.$length - index);
2242
+
2243
+ if (values.length === 0) {
2244
+ if (count === 0) return [];
2245
+
2246
+ switch (index) {
2247
+ case 0:
2248
+ if (count === 1) return [this.shift()];
2249
+ break;
2250
+
2251
+ case this.$length - 1:
2252
+ if (count === 1) return [this.pop()];
2253
+ break;
2254
+
2255
+ case this.$length:
2256
+ return [];
2257
+ }
2258
+ }
2259
+
2260
+ index = (this.head || 1) - 1 + index;
2261
+ index = index > array.length ? index % array.length : index;
2262
+ this.excess += values.length - count;
2263
+ this.$length += values.length - count; // |--H>*>T--|
2264
+
2265
+ if (this.head <= this.tail) {
2266
+ this.tail += values.length - count;
2267
+ return (0, array_1.splice)(array, index, count, ...values);
2268
+ } // |*>T---H>>|
2269
+
2270
+
2271
+ if (index < this.tail) {
2272
+ this.head += values.length - count;
2273
+ this.tail += values.length - count;
2274
+ return (0, array_1.splice)(array, index, count, ...values);
2275
+ } // |>>T---H>*|
2276
+
2277
+
2278
+ const cnt = (0, alias_1.min)(count, array.length - index);
2279
+ const vs = (0, array_1.splice)(array, index, cnt, ...(0, array_1.splice)(values, 0, cnt));
2280
+ vs.push(...(0, array_1.splice)(array, 0, count - vs.length, ...values));
2281
+ return vs;
2282
+ }
2283
+
2284
+ clear() {
2285
+ this.array = (0, global_1.Array)(size);
2286
+ this.$length = this.head = this.tail = 0;
2287
+ }
2288
+
2289
+ includes(value) {
2290
+ return this.array.includes(value);
2291
+ }
2292
+
2293
+ relational(index) {
2294
+ if (index === -1) return -1;
2295
+ return index + 1 >= this.head ? index + 1 - this.head : this.array.length - this.head + index;
2296
+ }
2297
+
2298
+ indexOf(value) {
2299
+ return this.relational((0, array_1.indexOf)(this.array, value));
2300
+ }
2301
+
2302
+ findIndex(f) {
2303
+ return this.relational(this.array.findIndex(value => value !== empty && f(value)));
2304
+ }
2305
+
2306
+ find(f) {
2307
+ return unempty(this.array.find(value => value !== empty && f(value)));
2308
+ }
2309
+
2310
+ toArray() {
2311
+ return this.head <= this.tail ? this.array.slice((this.head || 1) - 1, this.tail) : this.array.slice((this.head || 1) - 1).concat(this.array.slice(0, this.tail));
2312
+ }
2313
+
2314
+ *[Symbol.iterator]() {
2315
+ for (let i = 0; i < this.$length; ++i) {
2316
+ yield this.at(i);
2317
+ }
2318
+
2319
+ return;
2320
+ }
2321
+
2322
+ }
2323
+
2324
+ exports.Ring = Ring;
2325
+
2326
+ function next(head, tail, length) {
2327
+ return tail === length && head !== 1 ? 1 : tail + 1;
2328
+ }
2329
+
2330
+ function prev(head, tail, length) {
2331
+ return head === 0 || head === 1 ? tail === length ? length + 1 : length : head - 1;
2332
+ }
2333
+
2334
+ /***/ }),
2335
+
1764
2336
  /***/ 5177:
1765
2337
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1766
2338
 
@@ -1847,84 +2419,80 @@ Object.defineProperty(exports, "ReadonlyURL", ({
1847
2419
  return format_3.ReadonlyURL;
1848
2420
  }
1849
2421
  }));
1850
- const internal = Symbol.for('spica/url::internal');
1851
2422
 
1852
2423
  class URL {
1853
2424
  constructor(source, base) {
1854
2425
  this.source = source;
1855
2426
  this.base = base;
1856
- this[internal] = {
1857
- url: new format_1.ReadonlyURL(source, base),
1858
- searchParams: void 0
1859
- };
2427
+ this.url = new format_1.ReadonlyURL(source, base);
1860
2428
  }
1861
2429
 
1862
2430
  get href() {
1863
- return this[internal].searchParams?.toString().replace(/^(?=.)/, `${this[internal].url.href.slice(0, -this[internal].url.query.length - this[internal].url.fragment.length || this[internal].url.href.length)}?`).concat(this.fragment) ?? this[internal].url.href;
2431
+ return this.params?.toString().replace(/^(?=.)/, `${this.url.href.slice(0, -this.url.query.length - this.url.fragment.length || this.url.href.length)}?`).concat(this.fragment) ?? this.url.href;
1864
2432
  }
1865
2433
 
1866
2434
  get resource() {
1867
- return this[internal].searchParams?.toString().replace(/^(?=.)/, `${this[internal].url.href.slice(0, -this[internal].url.query.length - this[internal].url.fragment.length || this[internal].url.href.length)}?`) ?? this[internal].url.resource;
2435
+ return this.params?.toString().replace(/^(?=.)/, `${this.url.href.slice(0, -this.url.query.length - this.url.fragment.length || this.url.href.length)}?`) ?? this.url.resource;
1868
2436
  }
1869
2437
 
1870
2438
  get origin() {
1871
- return this[internal].url.origin;
2439
+ return this.url.origin;
1872
2440
  }
1873
2441
 
1874
2442
  get scheme() {
1875
- return this[internal].url.protocol.slice(0, -1);
2443
+ return this.url.protocol.slice(0, -1);
1876
2444
  }
1877
2445
 
1878
2446
  get protocol() {
1879
- return this[internal].url.protocol;
2447
+ return this.url.protocol;
1880
2448
  }
1881
2449
 
1882
2450
  get username() {
1883
- return this[internal].url.username;
2451
+ return this.url.username;
1884
2452
  }
1885
2453
 
1886
2454
  get password() {
1887
- return this[internal].url.password;
2455
+ return this.url.password;
1888
2456
  }
1889
2457
 
1890
2458
  get host() {
1891
- return this[internal].url.host;
2459
+ return this.url.host;
1892
2460
  }
1893
2461
 
1894
2462
  get hostname() {
1895
- return this[internal].url.hostname;
2463
+ return this.url.hostname;
1896
2464
  }
1897
2465
 
1898
2466
  get port() {
1899
- return this[internal].url.port;
2467
+ return this.url.port;
1900
2468
  }
1901
2469
 
1902
2470
  get path() {
1903
- return this[internal].searchParams?.toString().replace(/^(?=.)/, `${this.pathname}?`) ?? this[internal].url.path;
2471
+ return this.params?.toString().replace(/^(?=.)/, `${this.pathname}?`) ?? this.url.path;
1904
2472
  }
1905
2473
 
1906
2474
  get pathname() {
1907
- return this[internal].url.pathname;
2475
+ return this.url.pathname;
1908
2476
  }
1909
2477
 
1910
2478
  get search() {
1911
- return this[internal].searchParams?.toString().replace(/^(?=.)/, '?') ?? this[internal].url.search;
2479
+ return this.params?.toString().replace(/^(?=.)/, '?') ?? this.url.search;
1912
2480
  }
1913
2481
 
1914
2482
  get query() {
1915
- return this[internal].searchParams?.toString().replace(/^(?=.)/, '?') ?? this[internal].url.query;
2483
+ return this.params?.toString().replace(/^(?=.)/, '?') ?? this.url.query;
1916
2484
  }
1917
2485
 
1918
2486
  get hash() {
1919
- return this[internal].url.hash;
2487
+ return this.url.hash;
1920
2488
  }
1921
2489
 
1922
2490
  get fragment() {
1923
- return this[internal].url.fragment;
2491
+ return this.url.fragment;
1924
2492
  }
1925
2493
 
1926
2494
  get searchParams() {
1927
- return this[internal].searchParams ??= new global_1.URLSearchParams(this.search);
2495
+ return this.params ??= new global_1.URLSearchParams(this.search);
1928
2496
  }
1929
2497
 
1930
2498
  toString() {
@@ -1973,7 +2541,6 @@ function encode(url) {
1973
2541
  }
1974
2542
 
1975
2543
  exports._encode = encode;
1976
- const internal = Symbol.for('spica/url::internal');
1977
2544
 
1978
2545
  class ReadonlyURL {
1979
2546
  constructor(source, base) {
@@ -2006,74 +2573,71 @@ class ReadonlyURL {
2006
2573
 
2007
2574
  }
2008
2575
 
2009
- this[internal] = {
2010
- share: ReadonlyURL.get(source, base),
2011
- searchParams: void 0
2012
- };
2576
+ this.share = ReadonlyURL.get(source, base);
2013
2577
  }
2014
2578
 
2015
2579
  get href() {
2016
- return this[internal].share.href ??= this[internal].share.url.href;
2580
+ return this.share.href ??= this.share.url.href;
2017
2581
  }
2018
2582
 
2019
2583
  get resource() {
2020
- return this[internal].share.resource ??= this.href.slice(0, -this.fragment.length - this.query.length || this.href.length) + this.search;
2584
+ return this.share.resource ??= this.href.slice(0, -this.fragment.length - this.query.length || this.href.length) + this.search;
2021
2585
  }
2022
2586
 
2023
2587
  get origin() {
2024
- return this[internal].share.origin ??= this[internal].share.url.origin;
2588
+ return this.share.origin ??= this.share.url.origin;
2025
2589
  }
2026
2590
 
2027
2591
  get protocol() {
2028
- return this[internal].share.protocol ??= this[internal].share.url.protocol;
2592
+ return this.share.protocol ??= this.share.url.protocol;
2029
2593
  }
2030
2594
 
2031
2595
  get username() {
2032
- return this[internal].share.username ??= this[internal].share.url.username;
2596
+ return this.share.username ??= this.share.url.username;
2033
2597
  }
2034
2598
 
2035
2599
  get password() {
2036
- return this[internal].share.password ??= this[internal].share.url.password;
2600
+ return this.share.password ??= this.share.url.password;
2037
2601
  }
2038
2602
 
2039
2603
  get host() {
2040
- return this[internal].share.host ??= this[internal].share.url.host;
2604
+ return this.share.host ??= this.share.url.host;
2041
2605
  }
2042
2606
 
2043
2607
  get hostname() {
2044
- return this[internal].share.hostname ??= this[internal].share.url.hostname;
2608
+ return this.share.hostname ??= this.share.url.hostname;
2045
2609
  }
2046
2610
 
2047
2611
  get port() {
2048
- return this[internal].share.port ??= this[internal].share.url.port;
2612
+ return this.share.port ??= this.share.url.port;
2049
2613
  }
2050
2614
 
2051
2615
  get path() {
2052
- return this[internal].share.path ??= `${this.pathname}${this.search}`;
2616
+ return this.share.path ??= `${this.pathname}${this.search}`;
2053
2617
  }
2054
2618
 
2055
2619
  get pathname() {
2056
- return this[internal].share.pathname ??= this[internal].share.url.pathname;
2620
+ return this.share.pathname ??= this.share.url.pathname;
2057
2621
  }
2058
2622
 
2059
2623
  get search() {
2060
- return this[internal].share.search ??= this[internal].share.url.search;
2624
+ return this.share.search ??= this.share.url.search;
2061
2625
  }
2062
2626
 
2063
2627
  get query() {
2064
- return this[internal].share.query ??= this.search || this.href[this.href.length - this.fragment.length - 1] === '?' && '?' || '';
2628
+ return this.share.query ??= this.search || this.href[this.href.length - this.fragment.length - 1] === '?' && '?' || '';
2065
2629
  }
2066
2630
 
2067
2631
  get hash() {
2068
- return this[internal].share.hash ??= this[internal].share.url.hash;
2632
+ return this.share.hash ??= this.share.url.hash;
2069
2633
  }
2070
2634
 
2071
2635
  get fragment() {
2072
- return this[internal].share.fragment ??= this.hash || this.href[this.href.length - 1] === '#' && '#' || '';
2636
+ return this.share.fragment ??= this.hash || this.href[this.href.length - 1] === '#' && '#' || '';
2073
2637
  }
2074
2638
 
2075
2639
  get searchParams() {
2076
- return this[internal].searchParams ??= new global_1.URLSearchParams(this.search);
2640
+ return this.params ??= new global_1.URLSearchParams(this.search);
2077
2641
  }
2078
2642
 
2079
2643
  toString() {
@@ -3309,7 +3873,7 @@ class Memo {
3309
3873
  clear(position) {
3310
3874
  const memory = this.memory;
3311
3875
 
3312
- for (let i = position, len = memory.length; i < len; ++i) {
3876
+ for (let len = memory.length, i = position; i < len; ++i) {
3313
3877
  memory.pop();
3314
3878
  } //console.log('clear', position + 1);
3315
3879
 
@@ -3347,7 +3911,7 @@ function inits(parsers, resume) {
3347
3911
  let rest = source;
3348
3912
  let nodes;
3349
3913
 
3350
- for (let i = 0, len = parsers.length; i < len; ++i) {
3914
+ for (let len = parsers.length, i = 0; i < len; ++i) {
3351
3915
  if (rest === '') break;
3352
3916
  if (context.delimiters?.match(rest, context.precedence)) break;
3353
3917
  const result = parsers[i]({
@@ -3394,7 +3958,7 @@ function sequence(parsers, resume) {
3394
3958
  let rest = source;
3395
3959
  let nodes;
3396
3960
 
3397
- for (let i = 0, len = parsers.length; i < len; ++i) {
3961
+ for (let len = parsers.length, i = 0; i < len; ++i) {
3398
3962
  if (rest === '') return;
3399
3963
  if (context.delimiters?.match(rest, context.precedence)) return;
3400
3964
  const result = parsers[i]({
@@ -3858,7 +4422,7 @@ function bind(target, settings) {
3858
4422
  function nearest(index) {
3859
4423
  let el;
3860
4424
 
3861
- for (let i = 0, len = 0; i < blocks.length; ++i) {
4425
+ for (let len = 0, i = 0; i < blocks.length; ++i) {
3862
4426
  const block = blocks[i];
3863
4427
  len += block[0].length;
3864
4428
  el = block[1][0] ?? el;
@@ -3869,7 +4433,7 @@ function bind(target, settings) {
3869
4433
  }
3870
4434
 
3871
4435
  function index(source) {
3872
- for (let i = 0, len = 0; i < blocks.length; ++i) {
4436
+ for (let len = 0, i = 0; i < blocks.length; ++i) {
3873
4437
  const block = blocks[i];
3874
4438
  if (block[1].includes(source)) return len;
3875
4439
  len += block[0].length;
@@ -4065,10 +4629,10 @@ const figure_1 = __webpack_require__(9123);
4065
4629
 
4066
4630
  const footnote_1 = __webpack_require__(7529);
4067
4631
 
4068
- const dom_1 = __webpack_require__(3252);
4069
-
4070
4632
  const url_1 = __webpack_require__(2261);
4071
4633
 
4634
+ const dom_1 = __webpack_require__(3252);
4635
+
4072
4636
  function parse(source, opts = {}, context) {
4073
4637
  if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE)) throw new Error(`Too large input over ${segment_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.`);
4074
4638
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
@@ -4207,10 +4771,10 @@ const reply_1 = __webpack_require__(9978);
4207
4771
 
4208
4772
  const paragraph_1 = __webpack_require__(6457);
4209
4773
 
4210
- const dom_1 = __webpack_require__(3252);
4211
-
4212
4774
  const random_1 = __webpack_require__(7325);
4213
4775
 
4776
+ const dom_1 = __webpack_require__(3252);
4777
+
4214
4778
  exports.block = (0, combinator_1.creation)(1, false, error((0, combinator_1.reset)({
4215
4779
  resources: {
4216
4780
  clock: 50 * 1000,
@@ -4281,7 +4845,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4281
4845
  references
4282
4846
  }
4283
4847
  }, context);
4284
- return [[(0, dom_1.html)('section', [document, references])], ''];
4848
+ return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])], ''];
4285
4849
  })))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4286
4850
 
4287
4851
  /***/ }),
@@ -4382,10 +4946,10 @@ const locale_1 = __webpack_require__(5485);
4382
4946
 
4383
4947
  const visibility_1 = __webpack_require__(7618);
4384
4948
 
4385
- const dom_1 = __webpack_require__(3252);
4386
-
4387
4949
  const array_1 = __webpack_require__(8112);
4388
4950
 
4951
+ const dom_1 = __webpack_require__(3252);
4952
+
4389
4953
  exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128
4390
4954
  /* State.annotation */
4391
4955
  | 64
@@ -4492,7 +5056,7 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
4492
5056
  return [(0, dom_1.html)('aside', {
4493
5057
  id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
4494
5058
  class: 'aside'
4495
- }, [document, references])];
5059
+ }, [document, (0, dom_1.html)('h2', 'References'), references])];
4496
5060
  })));
4497
5061
 
4498
5062
  /***/ }),
@@ -4546,7 +5110,7 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
4546
5110
  'data-type': 'markdown'
4547
5111
  }, [(0, dom_1.html)('pre', {
4548
5112
  translate: 'no'
4549
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, references])])];
5113
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])])];
4550
5114
  }
4551
5115
 
4552
5116
  case 'math':
@@ -4682,10 +5246,10 @@ const locale_1 = __webpack_require__(5485);
4682
5246
 
4683
5247
  const visibility_1 = __webpack_require__(7618);
4684
5248
 
4685
- const dom_1 = __webpack_require__(3252);
4686
-
4687
5249
  const memoize_1 = __webpack_require__(1808);
4688
5250
 
5251
+ const dom_1 = __webpack_require__(3252);
5252
+
4689
5253
  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.
4690
5254
  (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, [])));
4691
5255
  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, 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.state)(4
@@ -4834,10 +5398,10 @@ const blockquote_1 = __webpack_require__(7859);
4834
5398
 
4835
5399
  const paragraph_1 = __webpack_require__(6457);
4836
5400
 
4837
- const dom_1 = __webpack_require__(3252);
4838
-
4839
5401
  const array_1 = __webpack_require__(8112);
4840
5402
 
5403
+ const dom_1 = __webpack_require__(3252);
5404
+
4841
5405
  exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/, 300), // Bug: Type mismatch between outer and inner.
4842
5406
  ([body, overflow, closer, opener, delim, type, param], _, context) => {
4843
5407
  if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
@@ -4944,10 +5508,10 @@ const locale_1 = __webpack_require__(5485);
4944
5508
 
4945
5509
  const visibility_1 = __webpack_require__(7618);
4946
5510
 
4947
- const dom_1 = __webpack_require__(3252);
4948
-
4949
5511
  const array_1 = __webpack_require__(8112);
4950
5512
 
5513
+ const dom_1 = __webpack_require__(3252);
5514
+
4951
5515
  const opener = /^(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
4952
5516
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000))));
4953
5517
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false))), false);
@@ -5363,14 +5927,12 @@ const source_1 = __webpack_require__(6743);
5363
5927
 
5364
5928
  const visibility_1 = __webpack_require__(7618);
5365
5929
 
5366
- const dom_1 = __webpack_require__(3252);
5367
-
5368
5930
  const memoize_1 = __webpack_require__(1808);
5369
5931
 
5370
- const duff_1 = __webpack_require__(8099);
5371
-
5372
5932
  const array_1 = __webpack_require__(8112);
5373
5933
 
5934
+ const dom_1 = __webpack_require__(3252);
5935
+
5374
5936
  const openers = {
5375
5937
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
5376
5938
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
@@ -5471,19 +6033,20 @@ function format(el, type, form) {
5471
6033
  'data-type': style(type) || global_1.undefined
5472
6034
  });
5473
6035
  const marker = el.firstElementChild?.getAttribute('data-marker').match(initial(type))?.[0] ?? '';
5474
- const es = el.children;
5475
- (0, duff_1.duffbk)(es.length, i => {
6036
+
6037
+ for (let es = el.children, len = es.length, i = 0; i < len; ++i) {
5476
6038
  const el = es[i];
5477
6039
 
5478
6040
  switch (el.getAttribute('data-marker')) {
5479
6041
  case '':
5480
6042
  case marker:
5481
6043
  el.removeAttribute('data-marker');
5482
- return;
6044
+ continue;
5483
6045
  }
5484
6046
 
5485
- return false;
5486
- });
6047
+ break;
6048
+ }
6049
+
5487
6050
  return el;
5488
6051
  }
5489
6052
 
@@ -5539,9 +6102,9 @@ const locale_1 = __webpack_require__(5485);
5539
6102
 
5540
6103
  const visibility_1 = __webpack_require__(7618);
5541
6104
 
5542
- const dom_1 = __webpack_require__(3252);
5543
-
5544
6105
  const array_1 = __webpack_require__(8112);
6106
+
6107
+ const dom_1 = __webpack_require__(3252);
5545
6108
  /*
5546
6109
  必ず対象指定から始まる
5547
6110
  対象がページである場合>>.を表現方法とする
@@ -5726,12 +6289,12 @@ const source_1 = __webpack_require__(6743);
5726
6289
 
5727
6290
  const visibility_1 = __webpack_require__(7618);
5728
6291
 
5729
- const dom_1 = __webpack_require__(3252);
5730
-
5731
6292
  const duff_1 = __webpack_require__(8099);
5732
6293
 
5733
6294
  const array_1 = __webpack_require__(8112);
5734
6295
 
6296
+ const dom_1 = __webpack_require__(3252);
6297
+
5735
6298
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
5736
6299
 
5737
6300
  const row = (parser, optional) => (0, combinator_1.creation)(1, false, (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
@@ -5752,14 +6315,14 @@ function format(rows) {
5752
6315
  const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5753
6316
 
5754
6317
  for (let i = 0; i < rows.length; ++i) {
5755
- (0, duff_1.duffEach)(rows[i].children, (col, i) => {
5756
- if (i > 0 && !aligns[i]) {
5757
- aligns[i] = aligns[i - 1];
6318
+ for (let cols = rows[i].children, len = cols.length, j = 0; j < len; ++j) {
6319
+ if (j > 0 && !aligns[j]) {
6320
+ aligns[j] = aligns[j - 1];
5758
6321
  }
5759
6322
 
5760
- if (!aligns[i]) return;
5761
- col.setAttribute('align', aligns[i]);
5762
- });
6323
+ if (!aligns[j]) continue;
6324
+ cols[j].setAttribute('align', aligns[j]);
6325
+ }
5763
6326
  }
5764
6327
 
5765
6328
  return rows;
@@ -5788,10 +6351,10 @@ const inline_1 = __webpack_require__(1160);
5788
6351
 
5789
6352
  const visibility_1 = __webpack_require__(7618);
5790
6353
 
5791
- const dom_1 = __webpack_require__(3252);
5792
-
5793
6354
  const array_1 = __webpack_require__(8112);
5794
6355
 
6356
+ const dom_1 = __webpack_require__(3252);
6357
+
5795
6358
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(4
5796
6359
  /* State.media */
5797
6360
  , exports.ulist_))));
@@ -5886,8 +6449,6 @@ exports.shortmedia = exports.media = exports.indexer = exports.indexee = exports
5886
6449
 
5887
6450
  const combinator_1 = __webpack_require__(2087);
5888
6451
 
5889
- const escape_1 = __webpack_require__(2778);
5890
-
5891
6452
  const annotation_1 = __webpack_require__(2736);
5892
6453
 
5893
6454
  const reference_1 = __webpack_require__(3555);
@@ -5930,7 +6491,7 @@ const bracket_1 = __webpack_require__(5196);
5930
6491
 
5931
6492
  const source_1 = __webpack_require__(6743);
5932
6493
 
5933
- exports.inline = (0, combinator_1.union)([escape_1.escape, annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.link, media_1.media, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.shortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
6494
+ exports.inline = (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.link, media_1.media, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.shortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
5934
6495
 
5935
6496
  var indexee_1 = __webpack_require__(1269);
5936
6497
 
@@ -6283,10 +6844,10 @@ const inline_1 = __webpack_require__(1160);
6283
6844
 
6284
6845
  const source_1 = __webpack_require__(6743);
6285
6846
 
6286
- const dom_1 = __webpack_require__(3252);
6287
-
6288
6847
  const array_1 = __webpack_require__(8112);
6289
6848
 
6849
+ const dom_1 = __webpack_require__(3252);
6850
+
6290
6851
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
6291
6852
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
6292
6853
  /* Syntax.none */
@@ -6369,12 +6930,12 @@ const inline_1 = __webpack_require__(1160);
6369
6930
 
6370
6931
  const source_1 = __webpack_require__(6743);
6371
6932
 
6372
- const dom_1 = __webpack_require__(3252);
6373
-
6374
6933
  const memoize_1 = __webpack_require__(1808);
6375
6934
 
6376
6935
  const array_1 = __webpack_require__(8112);
6377
6936
 
6937
+ const dom_1 = __webpack_require__(3252);
6938
+
6378
6939
  exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6379
6940
  /* Syntax.none */
6380
6941
  , 4, 1, 0
@@ -6406,11 +6967,11 @@ const source_1 = __webpack_require__(6743);
6406
6967
 
6407
6968
  const visibility_1 = __webpack_require__(7618);
6408
6969
 
6409
- const dom_1 = __webpack_require__(3252);
6410
-
6411
6970
  const array_1 = __webpack_require__(8112);
6412
6971
 
6413
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
6972
+ const dom_1 = __webpack_require__(3252);
6973
+
6974
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~', '~'), (0, combinator_1.syntax)(0
6414
6975
  /* Syntax.none */
6415
6976
  , 1, 1, 0
6416
6977
  /* State.none */
@@ -6431,60 +6992,21 @@ exports.emphasis = void 0;
6431
6992
 
6432
6993
  const combinator_1 = __webpack_require__(2087);
6433
6994
 
6434
- const inline_1 = __webpack_require__(1160);
6435
-
6436
- const source_1 = __webpack_require__(6743);
6437
-
6438
- const visibility_1 = __webpack_require__(7618);
6439
-
6440
- const dom_1 = __webpack_require__(3252);
6441
-
6442
- const array_1 = __webpack_require__(8112);
6443
-
6444
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('_'), (0, combinator_1.syntax)(0
6445
- /* Syntax.none */
6446
- , 1, 1, 0
6447
- /* State.none */
6448
- , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('_')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '_'), exports.emphasis)])), '_')), (0, source_1.str)('_'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6449
-
6450
- /***/ }),
6451
-
6452
- /***/ 2778:
6453
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6454
-
6455
- "use strict";
6456
-
6457
-
6458
- Object.defineProperty(exports, "__esModule", ({
6459
- value: true
6460
- }));
6461
- exports.escape = void 0;
6462
-
6463
- const global_1 = __webpack_require__(4128);
6464
-
6465
- const combinator_1 = __webpack_require__(2087);
6466
-
6995
+ const inline_1 = __webpack_require__(1160);
6996
+
6467
6997
  const source_1 = __webpack_require__(6743);
6468
6998
 
6469
- const repeat = (0, source_1.str)(/^(.)\1*/);
6470
- exports.escape = (0, combinator_1.union)([({
6471
- source,
6472
- context
6473
- }) => {
6474
- switch (source[0]) {
6475
- case '+':
6476
- case '~':
6477
- case '=':
6478
- if (!source[2]) return;
6479
- return source[2] === source[0] && source[1] === source[0] ? repeat({
6480
- source,
6481
- context
6482
- }) : global_1.undefined;
6999
+ const visibility_1 = __webpack_require__(7618);
6483
7000
 
6484
- default:
6485
- return;
6486
- }
6487
- }]);
7001
+ const array_1 = __webpack_require__(8112);
7002
+
7003
+ const dom_1 = __webpack_require__(3252);
7004
+
7005
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('_', '_'), (0, combinator_1.syntax)(0
7006
+ /* Syntax.none */
7007
+ , 1, 1, 0
7008
+ /* State.none */
7009
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('_')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '_'), exports.emphasis)])))), (0, source_1.str)('_'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6488
7010
 
6489
7011
  /***/ }),
6490
7012
 
@@ -6574,7 +7096,7 @@ const combinator_1 = __webpack_require__(2087);
6574
7096
 
6575
7097
  const dom_1 = __webpack_require__(3252);
6576
7098
 
6577
- const duff_1 = __webpack_require__(8099);
7099
+ const query_1 = __webpack_require__(6120);
6578
7100
 
6579
7101
  function indexee(parser, optional) {
6580
7102
  return (0, combinator_1.fmap)(parser, ([el], _, {
@@ -6599,37 +7121,41 @@ function text(source, optional = false) {
6599
7121
  const index = indexer?.getAttribute('data-index');
6600
7122
  if (index) return index;
6601
7123
  const target = source.cloneNode(true);
6602
- (0, duff_1.duffEach)(target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), el => {
7124
+
7125
+ for (let es = (0, query_1.querySelectorAll)(target, 'code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), i = 0; i < es.length; ++i) {
7126
+ const el = es[i];
7127
+
6603
7128
  switch (el.tagName) {
6604
7129
  case 'CODE':
6605
7130
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6606
- return;
7131
+ continue;
6607
7132
 
6608
7133
  case 'RT':
6609
7134
  case 'RP':
6610
7135
  case 'UL':
6611
7136
  case 'OL':
6612
7137
  el.remove();
6613
- return;
7138
+ continue;
6614
7139
  }
6615
7140
 
6616
7141
  switch (el.className) {
6617
7142
  case 'math':
6618
7143
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6619
- return;
7144
+ continue;
6620
7145
 
6621
7146
  case 'comment':
6622
7147
  case 'checkbox':
6623
7148
  el.remove();
6624
- return;
7149
+ continue;
6625
7150
 
6626
7151
  case 'reference':
6627
7152
  el.firstChild.remove();
6628
- return;
7153
+ continue;
6629
7154
  }
6630
- }); // Better:
7155
+ } // Better:
6631
7156
  //return target.innerText;
6632
7157
 
7158
+
6633
7159
  return target.textContent;
6634
7160
  }
6635
7161
 
@@ -6739,9 +7265,9 @@ const source_1 = __webpack_require__(6743);
6739
7265
 
6740
7266
  const visibility_1 = __webpack_require__(7618);
6741
7267
 
6742
- const dom_1 = __webpack_require__(3252);
7268
+ const array_1 = __webpack_require__(8112);
6743
7269
 
6744
- const array_1 = __webpack_require__(8112); // Don't use the symbols already used: !#$%@&*+~=
7270
+ const dom_1 = __webpack_require__(3252); // Don't use the symbols already used: !#$%@&*+~=
6745
7271
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6746
7272
 
6747
7273
 
@@ -6779,14 +7305,14 @@ const source_1 = __webpack_require__(6743);
6779
7305
 
6780
7306
  const visibility_1 = __webpack_require__(7618);
6781
7307
 
6782
- const dom_1 = __webpack_require__(3252);
6783
-
6784
7308
  const memoize_1 = __webpack_require__(1808);
6785
7309
 
6786
7310
  const cache_1 = __webpack_require__(9210);
6787
7311
 
6788
7312
  const array_1 = __webpack_require__(8112);
6789
7313
 
7314
+ const dom_1 = __webpack_require__(3252);
7315
+
6790
7316
  const tags = global_1.Object.freeze(['bdo', 'bdi']);
6791
7317
  const attrspecs = {
6792
7318
  bdo: {
@@ -6912,11 +7438,11 @@ const source_1 = __webpack_require__(6743);
6912
7438
 
6913
7439
  const visibility_1 = __webpack_require__(7618);
6914
7440
 
6915
- const dom_1 = __webpack_require__(3252);
6916
-
6917
7441
  const array_1 = __webpack_require__(8112);
6918
7442
 
6919
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
7443
+ const dom_1 = __webpack_require__(3252);
7444
+
7445
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++', '+'), (0, combinator_1.syntax)(0
6920
7446
  /* Syntax.none */
6921
7447
  , 1, 1, 0
6922
7448
  /* State.none */
@@ -6953,10 +7479,10 @@ const visibility_1 = __webpack_require__(7618);
6953
7479
 
6954
7480
  const util_1 = __webpack_require__(9437);
6955
7481
 
6956
- const dom_1 = __webpack_require__(3252);
6957
-
6958
7482
  const url_1 = __webpack_require__(2261);
6959
7483
 
7484
+ const dom_1 = __webpack_require__(3252);
7485
+
6960
7486
  const optspec = {
6961
7487
  rel: ['nofollow']
6962
7488
  };
@@ -7118,11 +7644,11 @@ const source_1 = __webpack_require__(6743);
7118
7644
 
7119
7645
  const visibility_1 = __webpack_require__(7618);
7120
7646
 
7121
- const dom_1 = __webpack_require__(3252);
7122
-
7123
7647
  const array_1 = __webpack_require__(8112);
7124
7648
 
7125
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
7649
+ const dom_1 = __webpack_require__(3252);
7650
+
7651
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('==', '='), (0, combinator_1.syntax)(0
7126
7652
  /* Syntax.none */
7127
7653
  , 1, 1, 0
7128
7654
  /* State.none */
@@ -7193,12 +7719,12 @@ const htmlentity_1 = __webpack_require__(1562);
7193
7719
 
7194
7720
  const source_1 = __webpack_require__(6743);
7195
7721
 
7196
- const dom_1 = __webpack_require__(3252);
7197
-
7198
7722
  const url_1 = __webpack_require__(2261);
7199
7723
 
7200
7724
  const array_1 = __webpack_require__(8112);
7201
7725
 
7726
+ const dom_1 = __webpack_require__(3252);
7727
+
7202
7728
  const optspec = {
7203
7729
  'width': [],
7204
7730
  'height': [],
@@ -7369,10 +7895,10 @@ const source_1 = __webpack_require__(6743);
7369
7895
 
7370
7896
  const visibility_1 = __webpack_require__(7618);
7371
7897
 
7372
- const dom_1 = __webpack_require__(3252);
7373
-
7374
7898
  const array_1 = __webpack_require__(8112);
7375
7899
 
7900
+ const dom_1 = __webpack_require__(3252);
7901
+
7376
7902
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(512
7377
7903
  /* Syntax.ruby */
7378
7904
  , 2, 1, -1
@@ -7506,15 +8032,15 @@ const source_1 = __webpack_require__(6743);
7506
8032
 
7507
8033
  const visibility_1 = __webpack_require__(7618);
7508
8034
 
7509
- const dom_1 = __webpack_require__(3252);
7510
-
7511
8035
  const array_1 = __webpack_require__(8112);
7512
8036
 
7513
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
8037
+ const dom_1 = __webpack_require__(3252);
8038
+
8039
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.syntax)(0
7514
8040
  /* Syntax.none */
7515
8041
  , 1, 1, 0
7516
8042
  /* State.none */
7517
- , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), exports.strong)])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
8043
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), exports.strong)])))), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7518
8044
 
7519
8045
  /***/ }),
7520
8046
 
@@ -7535,10 +8061,10 @@ const combinator_1 = __webpack_require__(2087);
7535
8061
 
7536
8062
  const source_1 = __webpack_require__(6743);
7537
8063
 
7538
- const dom_1 = __webpack_require__(3252);
7539
-
7540
8064
  const array_1 = __webpack_require__(8112);
7541
8065
 
8066
+ const dom_1 = __webpack_require__(3252);
8067
+
7542
8068
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
7543
8069
  /* Syntax.none */
7544
8070
  , 2, 1, -1
@@ -7567,16 +8093,19 @@ const ja_1 = __webpack_require__(1499);
7567
8093
 
7568
8094
  const dom_1 = __webpack_require__(3252);
7569
8095
 
7570
- const duff_1 = __webpack_require__(8099);
8096
+ const query_1 = __webpack_require__(6120);
7571
8097
 
7572
8098
  function localize(parser) {
7573
8099
  return (0, combinator_1.fmap)(parser, ns => {
7574
8100
  if (ns.length === 0) return ns;
7575
8101
  const el = ns.length === 1 && typeof ns[0] === 'object' ? ns[0] : (0, dom_1.html)('div', ns);
7576
- (0, duff_1.duffEach)(el.querySelectorAll('.linebreak:not(:empty)'), el => {
7577
- if (!check(el)) return;
8102
+
8103
+ for (let es = (0, query_1.querySelectorAll)(el, '.linebreak:not(:empty)'), i = 0; i < es.length; ++i) {
8104
+ const el = es[i];
8105
+ if (!check(el)) continue;
7578
8106
  el.firstChild.remove();
7579
- });
8107
+ }
8108
+
7580
8109
  return ns;
7581
8110
  });
7582
8111
  }
@@ -7640,7 +8169,7 @@ Object.defineProperty(exports, "__esModule", ({
7640
8169
  exports.japanese = void 0;
7641
8170
 
7642
8171
  function japanese(char) {
7643
- return /^[\p{Ideo}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}~!?]/u.test(char);
8172
+ return /^[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?]/u.test(char);
7644
8173
  }
7645
8174
 
7646
8175
  exports.japanese = japanese;
@@ -7662,22 +8191,24 @@ const global_1 = __webpack_require__(4128);
7662
8191
 
7663
8192
  const label_1 = __webpack_require__(466);
7664
8193
 
7665
- const dom_1 = __webpack_require__(3252);
7666
-
7667
8194
  const multimap_1 = __webpack_require__(940);
7668
8195
 
7669
8196
  const array_1 = __webpack_require__(8112);
7670
8197
 
8198
+ const dom_1 = __webpack_require__(3252);
8199
+
8200
+ const query_1 = __webpack_require__(6120);
8201
+
7671
8202
  function* figure(target, footnotes, opts = {}) {
7672
- const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), footnotes?.references.querySelectorAll('a.label:not(.disabled)') ?? []).map(el => [el.getAttribute('data-label'), el]));
8203
+ const refs = new multimap_1.MultiMap((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.disabled)[data-label]'), footnotes && (0, query_1.querySelectorAll)(footnotes.references, 'a.label:not(.disabled)') || []).map(el => [el.getAttribute('data-label'), el]));
7673
8204
  const labels = new global_1.Set();
7674
8205
  const numbers = new global_1.Map();
7675
8206
  let base = '0';
7676
8207
  let bases = base.split('.');
7677
8208
  let index = bases; // Bug: Firefox
7678
- //for (let defs = target.querySelectorAll(':scope > figure[data-label], :scope > h1, :scope > h2'), i = 0, len = defs.length; i < len; ++i) {
8209
+ //for (let defs = querySelectorAll(target, ':scope > figure[data-label], :scope > h1, :scope > h2'), len = defs.length, i = 0; i < len; ++i) {
7679
8210
 
7680
- for (let defs = target.querySelectorAll('figure[data-label], h1, h2'), i = 0, len = defs.length; i < len; ++i) {
8211
+ for (let defs = (0, query_1.querySelectorAll)(target, 'figure[data-label], h1, h2'), len = defs.length, i = 0; i < len; ++i) {
7681
8212
  yield;
7682
8213
  const def = defs[i];
7683
8214
  if (def.parentNode !== target) continue;
@@ -7778,7 +8309,9 @@ function* figure(target, footnotes, opts = {}) {
7778
8309
  labels.add(label);
7779
8310
  opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
7780
8311
 
7781
- for (const ref of refs.take(label, global_1.Infinity)) {
8312
+ for (let rs = refs.take(label, global_1.Infinity), i = 0; i < rs.length; ++i) {
8313
+ const ref = rs[i];
8314
+
7782
8315
  if (ref.getAttribute('data-invalid-message') === messages.reference) {
7783
8316
  (0, dom_1.define)(ref, {
7784
8317
  class: void ref.classList.remove('invalid'),
@@ -7857,18 +8390,20 @@ const global_1 = __webpack_require__(4128);
7857
8390
 
7858
8391
  const indexee_1 = __webpack_require__(1269);
7859
8392
 
7860
- const dom_1 = __webpack_require__(3252);
7861
-
7862
8393
  const multimap_1 = __webpack_require__(940);
7863
8394
 
7864
- const duff_1 = __webpack_require__(8099);
8395
+ const dom_1 = __webpack_require__(3252);
7865
8396
 
7866
- const array_1 = __webpack_require__(8112);
8397
+ const query_1 = __webpack_require__(6120);
7867
8398
 
7868
8399
  function* footnote(target, footnotes, opts = {}, bottom = null) {
7869
8400
  // Bug: Firefox
7870
- //target.querySelectorAll(`:scope > .annotations`).forEach(el => el.remove());
7871
- (0, duff_1.duffEach)(target.querySelectorAll(`.annotations`), el => el.parentNode === target && el.remove());
8401
+ //querySelectorAll(target, `:scope > .annotations`).forEach(el => el.remove());
8402
+ for (let es = (0, query_1.querySelectorAll)(target, `.annotations`), i = 0; i < es.length; ++i) {
8403
+ const el = es[i];
8404
+ el.parentNode === target && el.remove();
8405
+ }
8406
+
7872
8407
  yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
7873
8408
  yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
7874
8409
  return;
@@ -7885,14 +8420,20 @@ function build(syntax, marker, splitter) {
7885
8420
  const defs = new global_1.Map();
7886
8421
  const buffer = new multimap_1.MultiMap();
7887
8422
  const titles = new global_1.Map(); // Bug: Firefox
7888
- //const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
8423
+ //const splitters = push([], querySelectorAll(target, `:scope > :is(${splitter ?? '_'})`));
8424
+
8425
+ const splitters = [];
8426
+
8427
+ for (let es = (0, query_1.querySelectorAll)(target, splitter ?? '_'), i = 0; i < es.length; ++i) {
8428
+ const el = es[i];
8429
+ el.parentNode === target && splitters.push(el);
8430
+ }
7889
8431
 
7890
- const splitters = (0, duff_1.duffReduce)(target.querySelectorAll(splitter ?? '_'), (acc, el) => el.parentNode === target ? (0, array_1.push)(acc, [el]) : acc, []);
7891
8432
  let count = 0;
7892
8433
  let total = 0;
7893
8434
  let style;
7894
8435
 
7895
- for (let refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`), i = 0, len = refs.length; i < len; ++i) {
8436
+ for (let refs = (0, query_1.querySelectorAll)(target, `sup.${syntax}:not(.disabled)`), len = refs.length, i = 0; i < len; ++i) {
7896
8437
  yield;
7897
8438
  const ref = refs[i];
7898
8439
 
@@ -7947,7 +8488,8 @@ function build(syntax, marker, splitter) {
7947
8488
  if (title && !blank && def.childNodes.length === 1) {
7948
8489
  def.insertBefore(content.cloneNode(true), def.lastChild);
7949
8490
 
7950
- for (const ref of buffer.take(identifier, global_1.Infinity)) {
8491
+ for (let refs = buffer.take(identifier, global_1.Infinity), i = 0; i < refs.length; ++i) {
8492
+ const ref = refs[i];
7951
8493
  if (ref.getAttribute('data-invalid-type') !== 'content') continue;
7952
8494
  (0, dom_1.define)(ref, {
7953
8495
  title,
@@ -8264,17 +8806,19 @@ const global_1 = __webpack_require__(4128);
8264
8806
 
8265
8807
  const combinator_1 = __webpack_require__(2087);
8266
8808
 
8267
- function str(pattern) {
8809
+ function str(pattern, not) {
8268
8810
  return typeof pattern === 'string' ? (0, combinator_1.creation)(1, false, ({
8269
8811
  source
8270
8812
  }) => {
8271
8813
  if (source === '') return;
8814
+ if (not && source.slice(pattern.length, pattern.length + not.length) === not) return;
8272
8815
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
8273
8816
  }) : (0, combinator_1.creation)(1, false, ({
8274
8817
  source
8275
8818
  }) => {
8276
8819
  if (source === '') return;
8277
8820
  const m = source.match(pattern);
8821
+ if (m && not && source.slice(m[0].length, m[0].length + not.length) === not) return;
8278
8822
  return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
8279
8823
  });
8280
8824
  }
@@ -8319,10 +8863,10 @@ const str_1 = __webpack_require__(2790);
8319
8863
 
8320
8864
  const dom_1 = __webpack_require__(3252);
8321
8865
 
8322
- exports.delimiter = /[\s\x00-\x7F]|\S[#>]|[\p{Ideo}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8866
+ exports.delimiter = /[\s\x00-\x7F]|\S[#>]|[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8323
8867
  exports.nonWhitespace = /[\S\n]|$/;
8324
8868
  exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
8325
- const nssb = /^[\p{Ideo}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8869
+ const nssb = /^[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8326
8870
  const repeat = (0, str_1.str)(/^(.)\1*/);
8327
8871
  exports.text = (0, combinator_1.creation)(1, false, ({
8328
8872
  source,
@@ -8769,10 +9313,10 @@ const math_1 = __webpack_require__(611);
8769
9313
 
8770
9314
  const media_1 = __webpack_require__(2233);
8771
9315
 
8772
- const query_1 = __webpack_require__(6120);
8773
-
8774
9316
  const memoize_1 = __webpack_require__(1808);
8775
9317
 
9318
+ const query_1 = __webpack_require__(6120);
9319
+
8776
9320
  const selector = 'img.media:not(.invalid):not([src])[data-src], a > :not(img).media:not(.invalid), pre.code:not(.invalid), .math:not(.invalid)';
8777
9321
  const extend = (0, memoize_1.reduce)(opts => ({
8778
9322
  code: code_1.code,
@@ -8785,8 +9329,8 @@ function render(source, opts = {}) {
8785
9329
  opts = extend(opts);
8786
9330
  const base = global_1.location.href;
8787
9331
 
8788
- for (const el of (0, query_1.querySelectorAll)(source, selector)) {
8789
- render_(base, el, opts);
9332
+ for (let es = (0, query_1.querySelectorAllWith)(source, selector), i = 0; i < es.length; ++i) {
9333
+ render_(base, es[i], opts);
8790
9334
  }
8791
9335
  }
8792
9336
 
@@ -9240,9 +9784,7 @@ exports.info = void 0;
9240
9784
 
9241
9785
  const scope_1 = __webpack_require__(5202);
9242
9786
 
9243
- const duff_1 = __webpack_require__(8099);
9244
-
9245
- const array_1 = __webpack_require__(8112);
9787
+ const query_1 = __webpack_require__(6120);
9246
9788
 
9247
9789
  function info(source) {
9248
9790
  const match = (0, scope_1.scope)(source, '.invalid');
@@ -9260,7 +9802,14 @@ function info(source) {
9260
9802
  };
9261
9803
 
9262
9804
  function find(selector) {
9263
- return (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => match(el) ? (0, array_1.push)(acc, [el]) : acc, []);
9805
+ const acc = [];
9806
+
9807
+ for (let es = (0, query_1.querySelectorAll)(source, selector), i = 0; i < es.length; ++i) {
9808
+ const el = es[i];
9809
+ match(el) && acc.push(el);
9810
+ }
9811
+
9812
+ return acc;
9264
9813
  }
9265
9814
  }
9266
9815
 
@@ -9287,7 +9836,7 @@ const cite_1 = __webpack_require__(6315);
9287
9836
 
9288
9837
  const dom_1 = __webpack_require__(3252);
9289
9838
 
9290
- const duff_1 = __webpack_require__(8099);
9839
+ const query_1 = __webpack_require__(6120);
9291
9840
 
9292
9841
  function quote(anchor, range) {
9293
9842
  if ((0, parser_1.exec)((0, cite_1.cite)({
@@ -9297,22 +9846,25 @@ function quote(anchor, range) {
9297
9846
  fit(range);
9298
9847
  const node = trim(range.cloneContents());
9299
9848
  if (!node.firstChild) return '';
9300
- (0, duff_1.duffEach)(node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), el => {
9849
+
9850
+ for (let es = (0, query_1.querySelectorAll)(node, 'code[data-src], .math[data-src], .media[data-src], rt, rp'), i = 0; i < es.length; ++i) {
9851
+ const el = es[i];
9852
+
9301
9853
  switch (true) {
9302
9854
  case el.matches('code'):
9303
9855
  case el.matches('.math'):
9304
9856
  (0, dom_1.define)(el, el.getAttribute('data-src'));
9305
- return;
9857
+ continue;
9306
9858
 
9307
9859
  case el.matches('.media'):
9308
9860
  el.replaceWith(/[\s{}]/.test(el.getAttribute('data-src')) ? `!{ ${el.getAttribute('data-src')} }` : `!{${el.getAttribute('data-src')}}`);
9309
- return;
9861
+ continue;
9310
9862
 
9311
9863
  case el.matches('rt, rp'):
9312
9864
  el.remove();
9313
- return;
9865
+ continue;
9314
9866
  }
9315
- });
9867
+ }
9316
9868
 
9317
9869
  if (range.startOffset === 0 && range.startContainer.parentElement?.matches('.cite, .quote') && (!range.startContainer.previousSibling || range.startContainer.previousSibling.nodeName === 'BR')) {
9318
9870
  node.prepend(`>${range.startContainer.parentElement.matches('.quote.invalid') ? ' ' : ''}`);
@@ -9321,26 +9873,29 @@ function quote(anchor, range) {
9321
9873
  anchor = '';
9322
9874
  }
9323
9875
 
9324
- (0, duff_1.duffEach)(node.querySelectorAll('br'), el => {
9876
+ for (let es = (0, query_1.querySelectorAll)(node, 'br'), i = 0; i < es.length; ++i) {
9877
+ const el = es[i];
9878
+
9325
9879
  if (anchor && el.nextSibling instanceof global_1.Element && el.nextSibling.matches('.cite, .quote')) {
9326
9880
  el.replaceWith(`\n>${el.nextSibling.matches('.quote.invalid') ? ' ' : ''}`);
9327
- return;
9881
+ continue;
9328
9882
  }
9329
9883
 
9330
9884
  if (anchor && el.parentElement?.closest('.cite, .quote')) {
9331
9885
  el.replaceWith(`\n>${el.parentElement.closest('.quote.invalid') ? ' ' : ''}`);
9332
- return;
9886
+ continue;
9333
9887
  }
9334
9888
 
9335
9889
  if (anchor) {
9336
9890
  el.replaceWith(`\n>>${anchor}\n> `);
9337
9891
  anchor = '';
9338
- return;
9892
+ continue;
9339
9893
  } else {
9340
9894
  el.replaceWith(`\n> `);
9341
- return;
9895
+ continue;
9342
9896
  }
9343
- });
9897
+ }
9898
+
9344
9899
  anchor && node.append(`\n>>${anchor}`);
9345
9900
  return node.textContent;
9346
9901
  }
@@ -9426,29 +9981,36 @@ exports.toc = void 0;
9426
9981
 
9427
9982
  const global_1 = __webpack_require__(4128);
9428
9983
 
9429
- const dom_1 = __webpack_require__(3252);
9984
+ const array_1 = __webpack_require__(8112);
9430
9985
 
9431
- const duff_1 = __webpack_require__(8099);
9986
+ const dom_1 = __webpack_require__(3252);
9432
9987
 
9433
- const array_1 = __webpack_require__(8112); // Bug: Firefox
9988
+ const query_1 = __webpack_require__(6120); // Bug: Firefox
9434
9989
  //const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
9435
9990
 
9436
9991
 
9437
9992
  const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
9438
9993
 
9439
9994
  function toc(source) {
9440
- const hs = (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => {
9995
+ const hs = [];
9996
+
9997
+ for (let es = (0, query_1.querySelectorAll)(source, selector), i = 0; i < es.length; ++i) {
9998
+ const el = es[i];
9999
+
9441
10000
  switch (el.tagName) {
9442
10001
  case 'ASIDE':
9443
- return (0, array_1.push)(acc, [(0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
10002
+ hs.push((0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
9444
10003
  id: el.id,
9445
10004
  class: 'aside'
9446
- }, el.firstElementChild.cloneNode(true).childNodes)]);
10005
+ }, el.firstElementChild.cloneNode(true).childNodes));
10006
+ continue;
9447
10007
 
9448
10008
  default:
9449
- return (0, array_1.push)(acc, [el]);
10009
+ hs.push(el);
10010
+ continue;
9450
10011
  }
9451
- }, []);
10012
+ }
10013
+
9452
10014
  return parse(cons(hs));
9453
10015
  }
9454
10016
 
@@ -9478,7 +10040,11 @@ function level(h) {
9478
10040
  }
9479
10041
 
9480
10042
  function unlink(h) {
9481
- (0, duff_1.duffEach)(h.getElementsByTagName('a'), el => void el.replaceWith(...el.childNodes));
10043
+ for (let es = h.getElementsByTagName('a'), len = es.length, i = 0; i < len; ++i) {
10044
+ const el = es[i];
10045
+ el.replaceWith(...el.childNodes);
10046
+ }
10047
+
9482
10048
  return h.childNodes;
9483
10049
  }
9484
10050
 
@@ -9487,7 +10053,7 @@ function unlink(h) {
9487
10053
  /***/ 3252:
9488
10054
  /***/ (function(module) {
9489
10055
 
9490
- /*! typed-dom v0.0.301 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
10056
+ /*! typed-dom v0.0.305 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9491
10057
  (function webpackUniversalModuleDefinition(root, factory) {
9492
10058
  if(true)
9493
10059
  module.exports = factory();
@@ -9505,9 +10071,9 @@ return /******/ (() => { // webpackBootstrap
9505
10071
  Object.defineProperty(exports, "__esModule", ({
9506
10072
  value: true
9507
10073
  }));
9508
- exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
10074
+ exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sqrt = exports.log = exports.tan = exports.cos = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
9509
10075
  exports[NaN] = Number.NaN, exports.isFinite = Number.isFinite, exports.isInteger = Number.isInteger, exports.isNaN = Number.isNaN, exports.isSafeInteger = Number.isSafeInteger, exports.parseFloat = Number.parseFloat, exports.parseInt = Number.parseInt;
9510
- exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign;
10076
+ exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign, exports.cos = Math.cos, exports.tan = Math.tan, exports.log = Math.log, exports.sqrt = Math.sqrt;
9511
10077
  exports.isArray = Array.isArray;
9512
10078
  exports.hasOwnProperty = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
9513
10079
  exports.isPrototypeOf = Object.prototype.isPrototypeOf.call.bind(Object.prototype.isPrototypeOf);
@@ -9539,11 +10105,11 @@ exports.equal = equal;
9539
10105
  /***/ }),
9540
10106
 
9541
10107
  /***/ 128:
9542
- /***/ ((module, __unused_webpack_exports, __nested_webpack_require_2590__) => {
10108
+ /***/ ((module, __unused_webpack_exports, __nested_webpack_require_2745__) => {
9543
10109
 
9544
10110
 
9545
10111
 
9546
- __nested_webpack_require_2590__(921);
10112
+ __nested_webpack_require_2745__(921);
9547
10113
 
9548
10114
  const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
9549
10115
  || typeof self !== 'undefined' && self || Function('return this')();
@@ -9564,7 +10130,7 @@ var global = (/* unused pure expression or super */ null && (0));
9564
10130
  /***/ }),
9565
10131
 
9566
10132
  /***/ 808:
9567
- /***/ ((__unused_webpack_module, exports, __nested_webpack_require_3077__) => {
10133
+ /***/ ((__unused_webpack_module, exports, __nested_webpack_require_3232__) => {
9568
10134
 
9569
10135
 
9570
10136
 
@@ -9573,11 +10139,11 @@ Object.defineProperty(exports, "__esModule", ({
9573
10139
  }));
9574
10140
  exports.reduce = exports.memoize = void 0;
9575
10141
 
9576
- const global_1 = __nested_webpack_require_3077__(128);
10142
+ const global_1 = __nested_webpack_require_3232__(128);
9577
10143
 
9578
- const alias_1 = __nested_webpack_require_3077__(406);
10144
+ const alias_1 = __nested_webpack_require_3232__(406);
9579
10145
 
9580
- const compare_1 = __nested_webpack_require_3077__(529);
10146
+ const compare_1 = __nested_webpack_require_3232__(529);
9581
10147
 
9582
10148
  function memoize(f, identify = (...as) => as[0], memory) {
9583
10149
  if (typeof identify === 'object') return memoize(f, void 0, identify);
@@ -9635,7 +10201,7 @@ exports.reduce = reduce;
9635
10201
  /***/ }),
9636
10202
 
9637
10203
  /***/ 521:
9638
- /***/ ((__unused_webpack_module, exports, __nested_webpack_require_4467__) => {
10204
+ /***/ ((__unused_webpack_module, exports, __nested_webpack_require_4622__) => {
9639
10205
 
9640
10206
 
9641
10207
 
@@ -9644,11 +10210,11 @@ Object.defineProperty(exports, "__esModule", ({
9644
10210
  }));
9645
10211
  exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
9646
10212
 
9647
- const global_1 = __nested_webpack_require_4467__(128);
10213
+ const global_1 = __nested_webpack_require_4622__(128);
9648
10214
 
9649
- const alias_1 = __nested_webpack_require_4467__(406);
10215
+ const alias_1 = __nested_webpack_require_4622__(406);
9650
10216
 
9651
- const memoize_1 = __nested_webpack_require_4467__(808);
10217
+ const memoize_1 = __nested_webpack_require_4622__(808);
9652
10218
 
9653
10219
  var caches;
9654
10220
 
@@ -9689,9 +10255,8 @@ function text(source) {
9689
10255
  exports.text = text;
9690
10256
 
9691
10257
  function element(context, ns) {
9692
- const cache = (0, memoize_1.memoize)(elem, (_, ns, tag) => `${ns}:${tag}`);
9693
10258
  return (tag, attrs, children) => {
9694
- const el = tag.includes('-') ? elem(context, ns, tag) : cache(context, ns, tag).cloneNode(true);
10259
+ const el = elem(context, ns, tag);
9695
10260
  return !attrs || isChildren(attrs) ? defineChildren(el, attrs ?? children) : defineChildren(defineAttrs(el, attrs), children);
9696
10261
  };
9697
10262
  }
@@ -9884,7 +10449,7 @@ exports.defrag = defrag;
9884
10449
  /******/ var __webpack_module_cache__ = {};
9885
10450
  /******/
9886
10451
  /******/ // The require function
9887
- /******/ function __nested_webpack_require_11560__(moduleId) {
10452
+ /******/ function __nested_webpack_require_11575__(moduleId) {
9888
10453
  /******/ // Check if module is in cache
9889
10454
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
9890
10455
  /******/ if (cachedModule !== undefined) {
@@ -9898,7 +10463,7 @@ exports.defrag = defrag;
9898
10463
  /******/ };
9899
10464
  /******/
9900
10465
  /******/ // Execute the module function
9901
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11560__);
10466
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11575__);
9902
10467
  /******/
9903
10468
  /******/ // Return the exports of the module
9904
10469
  /******/ return module.exports;
@@ -9909,7 +10474,7 @@ exports.defrag = defrag;
9909
10474
  /******/ // startup
9910
10475
  /******/ // Load entry module and return exports
9911
10476
  /******/ // This entry module is referenced by other modules so it can't be inlined
9912
- /******/ var __webpack_exports__ = __nested_webpack_require_11560__(521);
10477
+ /******/ var __webpack_exports__ = __nested_webpack_require_11575__(521);
9913
10478
  /******/
9914
10479
  /******/ return __webpack_exports__;
9915
10480
  /******/ })()
@@ -9921,7 +10486,7 @@ exports.defrag = defrag;
9921
10486
  /***/ 6120:
9922
10487
  /***/ (function(module) {
9923
10488
 
9924
- /*! typed-dom v0.0.301 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
10489
+ /*! typed-dom v0.0.305 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9925
10490
  (function webpackUniversalModuleDefinition(root, factory) {
9926
10491
  if(true)
9927
10492
  module.exports = factory();
@@ -9931,114 +10496,6 @@ return /******/ (() => { // webpackBootstrap
9931
10496
  /******/ "use strict";
9932
10497
  /******/ var __webpack_modules__ = ({
9933
10498
 
9934
- /***/ 112:
9935
- /***/ ((__unused_webpack_module, exports, __nested_webpack_require_645__) => {
9936
-
9937
-
9938
-
9939
- Object.defineProperty(exports, "__esModule", ({
9940
- value: true
9941
- }));
9942
- exports.splice = exports.pop = exports.push = exports.shift = exports.unshift = exports.indexOf = void 0;
9943
-
9944
- const global_1 = __nested_webpack_require_645__(128);
9945
-
9946
- function indexOf(as, a) {
9947
- if (as.length === 0) return -1;
9948
- return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
9949
- }
9950
-
9951
- exports.indexOf = indexOf;
9952
-
9953
- function unshift(as, bs) {
9954
- if ('length' in as) {
9955
- for (let i = as.length - 1; i >= 0; --i) {
9956
- bs.unshift(as[i]);
9957
- }
9958
- } else {
9959
- bs.unshift(...as);
9960
- }
9961
-
9962
- return bs;
9963
- }
9964
-
9965
- exports.unshift = unshift;
9966
-
9967
- function shift(as, count) {
9968
- if (count < 0) throw new Error('Unexpected negative number');
9969
- return count === void 0 ? [as.shift(), as] : [splice(as, 0, count), as];
9970
- }
9971
-
9972
- exports.shift = shift;
9973
-
9974
- function push(as, bs) {
9975
- if ('length' in bs) {
9976
- for (let i = 0, len = bs.length; i < len; ++i) {
9977
- as.push(bs[i]);
9978
- }
9979
- } else {
9980
- for (const b of bs) {
9981
- as.push(b);
9982
- }
9983
- }
9984
-
9985
- return as;
9986
- }
9987
-
9988
- exports.push = push;
9989
-
9990
- function pop(as, count) {
9991
- if (count < 0) throw new Error('Unexpected negative number');
9992
- return count === void 0 ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
9993
- }
9994
-
9995
- exports.pop = pop;
9996
-
9997
- function splice(as, index, count, ...inserts) {
9998
- if (count === 0 && inserts.length === 0) return [];
9999
- count = count > as.length ? as.length : count;
10000
-
10001
- switch (index) {
10002
- case 0:
10003
- switch (count) {
10004
- case 0:
10005
- return [[], unshift(inserts, as)][0];
10006
-
10007
- case 1:
10008
- return as.length === 0 ? [[], unshift(inserts, as)][0] : [[as.shift()], unshift(inserts, as)][0];
10009
-
10010
- case void 0:
10011
- if (as.length > 1 || arguments.length > 2) break;
10012
- return as.length === 0 ? [] : splice(as, index, 1);
10013
- }
10014
-
10015
- break;
10016
-
10017
- case -1:
10018
- case as.length - 1:
10019
- switch (count) {
10020
- case 1:
10021
- return as.length === 0 ? [[], push(as, inserts)][0] : [[as.pop()], push(as, inserts)][0];
10022
-
10023
- case void 0:
10024
- if (as.length > 1 || arguments.length > 2) break;
10025
- return as.length === 0 ? [] : splice(as, index, 1);
10026
- }
10027
-
10028
- break;
10029
-
10030
- case as.length:
10031
- case global_1.Infinity:
10032
- return [[], push(as, inserts)][0];
10033
- }
10034
-
10035
- return arguments.length > 2 ? as.splice(index, count, ...inserts) : as.splice(index);
10036
- }
10037
-
10038
- exports.splice = splice;
10039
-
10040
- /***/ }),
10041
-
10042
10499
  /***/ 99:
10043
10500
  /***/ ((__unused_webpack_module, exports) => {
10044
10501
 
@@ -10052,7 +10509,7 @@ exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
10052
10509
  function duff(count, proc) {
10053
10510
  if (count > 0) {
10054
10511
  let i = 0,
10055
- m = count % 8,
10512
+ m = count & 7,
10056
10513
  d = (count - m) / 8;
10057
10514
 
10058
10515
  while (m--) {
@@ -10071,7 +10528,7 @@ function duff(count, proc) {
10071
10528
  }
10072
10529
  } else {
10073
10530
  let i = -count,
10074
- m = i % 8,
10531
+ m = i & 7,
10075
10532
  d = (i - m) / 8;
10076
10533
 
10077
10534
  while (m--) {
@@ -10096,7 +10553,7 @@ exports.duff = duff;
10096
10553
  function duffbk(count, proc) {
10097
10554
  if (count > 0) {
10098
10555
  let i = 0,
10099
- m = count % 8,
10556
+ m = count & 7,
10100
10557
  d = (count - m) / 8;
10101
10558
 
10102
10559
  while (m--) {
@@ -10104,18 +10561,21 @@ function duffbk(count, proc) {
10104
10561
  }
10105
10562
 
10106
10563
  while (d--) {
10107
- if (proc(i++) === false) return;
10108
- if (proc(i++) === false) return;
10109
- if (proc(i++) === false) return;
10110
- if (proc(i++) === false) return;
10111
- if (proc(i++) === false) return;
10112
- if (proc(i++) === false) return;
10113
- if (proc(i++) === false) return;
10114
- if (proc(i++) === false) return;
10564
+ switch (false) {
10565
+ case proc(i++):
10566
+ case proc(i++):
10567
+ case proc(i++):
10568
+ case proc(i++):
10569
+ case proc(i++):
10570
+ case proc(i++):
10571
+ case proc(i++):
10572
+ case proc(i++):
10573
+ return;
10574
+ }
10115
10575
  }
10116
10576
  } else {
10117
10577
  let i = -count,
10118
- m = i % 8,
10578
+ m = i & 7,
10119
10579
  d = (i - m) / 8;
10120
10580
 
10121
10581
  while (m--) {
@@ -10123,14 +10583,17 @@ function duffbk(count, proc) {
10123
10583
  }
10124
10584
 
10125
10585
  while (d--) {
10126
- if (proc(--i) === false) return;
10127
- if (proc(--i) === false) return;
10128
- if (proc(--i) === false) return;
10129
- if (proc(--i) === false) return;
10130
- if (proc(--i) === false) return;
10131
- if (proc(--i) === false) return;
10132
- if (proc(--i) === false) return;
10133
- if (proc(--i) === false) return;
10586
+ switch (false) {
10587
+ case proc(--i):
10588
+ case proc(--i):
10589
+ case proc(--i):
10590
+ case proc(--i):
10591
+ case proc(--i):
10592
+ case proc(--i):
10593
+ case proc(--i):
10594
+ case proc(--i):
10595
+ return;
10596
+ }
10134
10597
  }
10135
10598
  }
10136
10599
  }
@@ -10140,7 +10603,7 @@ exports.duffbk = duffbk;
10140
10603
  function duffEach(array, proc) {
10141
10604
  let count = array.length;
10142
10605
  let i = 0,
10143
- m = count % 8,
10606
+ m = count & 7,
10144
10607
  d = (count - m) / 8;
10145
10608
 
10146
10609
  while (m--) {
@@ -10159,30 +10622,32 @@ function duffEach(array, proc) {
10159
10622
  }
10160
10623
  }
10161
10624
 
10162
- exports.duffEach = duffEach;
10625
+ exports.duffEach = duffEach; // ベンチマークの10,000以上で急激な速度低下が見られるがNodeListなどでの
10626
+ // 実際の使用では速度低下は見られない
10163
10627
 
10164
10628
  function duffReduce(array, proc, initial) {
10165
10629
  let count = array.length;
10166
10630
  let i = 0,
10167
- m = count % 8,
10631
+ m = count & 7,
10168
10632
  d = (count - m) / 8;
10633
+ let acc = initial;
10169
10634
 
10170
10635
  while (m--) {
10171
- initial = proc(initial, array[i], i++, array);
10636
+ acc = proc(acc, array[i], i++, array);
10172
10637
  }
10173
10638
 
10174
10639
  while (d--) {
10175
- initial = proc(initial, array[i], i++, array);
10176
- initial = proc(initial, array[i], i++, array);
10177
- initial = proc(initial, array[i], i++, array);
10178
- initial = proc(initial, array[i], i++, array);
10179
- initial = proc(initial, array[i], i++, array);
10180
- initial = proc(initial, array[i], i++, array);
10181
- initial = proc(initial, array[i], i++, array);
10182
- initial = proc(initial, array[i], i++, array);
10640
+ acc = proc(acc, array[i], i++, array);
10641
+ acc = proc(acc, array[i], i++, array);
10642
+ acc = proc(acc, array[i], i++, array);
10643
+ acc = proc(acc, array[i], i++, array);
10644
+ acc = proc(acc, array[i], i++, array);
10645
+ acc = proc(acc, array[i], i++, array);
10646
+ acc = proc(acc, array[i], i++, array);
10647
+ acc = proc(acc, array[i], i++, array);
10183
10648
  }
10184
10649
 
10185
- return initial;
10650
+ return acc;
10186
10651
  }
10187
10652
 
10188
10653
  exports.duffReduce = duffReduce;
@@ -10190,11 +10655,11 @@ exports.duffReduce = duffReduce;
10190
10655
  /***/ }),
10191
10656
 
10192
10657
  /***/ 128:
10193
- /***/ ((module, __unused_webpack_exports, __nested_webpack_require_6113__) => {
10658
+ /***/ ((module, __unused_webpack_exports, __nested_webpack_require_3560__) => {
10194
10659
 
10195
10660
 
10196
10661
 
10197
- __nested_webpack_require_6113__(921);
10662
+ __nested_webpack_require_3560__(921);
10198
10663
 
10199
10664
  const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
10200
10665
  || typeof self !== 'undefined' && self || Function('return this')();
@@ -10220,7 +10685,7 @@ var global = (/* unused pure expression or super */ null && (0));
10220
10685
  /******/ var __webpack_module_cache__ = {};
10221
10686
  /******/
10222
10687
  /******/ // The require function
10223
- /******/ function __nested_webpack_require_6765__(moduleId) {
10688
+ /******/ function __nested_webpack_require_4212__(moduleId) {
10224
10689
  /******/ // Check if module is in cache
10225
10690
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
10226
10691
  /******/ if (cachedModule !== undefined) {
@@ -10234,7 +10699,7 @@ var global = (/* unused pure expression or super */ null && (0));
10234
10699
  /******/ };
10235
10700
  /******/
10236
10701
  /******/ // Execute the module function
10237
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_6765__);
10702
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_4212__);
10238
10703
  /******/
10239
10704
  /******/ // Return the exports of the module
10240
10705
  /******/ return module.exports;
@@ -10250,26 +10715,32 @@ var exports = __webpack_exports__;
10250
10715
  Object.defineProperty(exports, "__esModule", ({
10251
10716
  value: true
10252
10717
  }));
10253
- exports.querySelectorAll = exports.querySelector = void 0;
10718
+ exports.querySelectorAll = exports.querySelectorAllWith = exports.querySelectorWith = void 0;
10254
10719
 
10255
- const duff_1 = __nested_webpack_require_6765__(99);
10720
+ const global_1 = __nested_webpack_require_4212__(128);
10256
10721
 
10257
- const array_1 = __nested_webpack_require_6765__(112);
10722
+ const duff_1 = __nested_webpack_require_4212__(99);
10258
10723
 
10259
- function querySelector(node, selector) {
10724
+ function querySelectorWith(node, selector) {
10260
10725
  return 'matches' in node && node.matches(selector) ? node : node.querySelector(selector);
10261
10726
  }
10262
10727
 
10263
- exports.querySelector = querySelector;
10728
+ exports.querySelectorWith = querySelectorWith;
10264
10729
 
10265
- function querySelectorAll(node, selector) {
10730
+ function querySelectorAllWith(node, selector) {
10266
10731
  const acc = [];
10267
10732
 
10268
10733
  if ('matches' in node && node.matches(selector)) {
10269
10734
  acc.push(node);
10270
10735
  }
10271
10736
 
10272
- return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, node) => (0, array_1.push)(acc, [node]), acc);
10737
+ return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, el) => (acc.push(el), acc), acc);
10738
+ }
10739
+
10740
+ exports.querySelectorAllWith = querySelectorAllWith;
10741
+
10742
+ function querySelectorAll(node, selector) {
10743
+ return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, el) => (acc.push(el), acc), (0, global_1.Array)());
10273
10744
  }
10274
10745
 
10275
10746
  exports.querySelectorAll = querySelectorAll;