securemark 0.262.2 → 0.263.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/index.js +933 -713
- package/index.ts +0 -1
- package/karma.conf.js +1 -1
- package/package.json +11 -11
- package/src/combinator/control/constraint/block.ts +1 -2
- package/src/combinator/control/constraint/contract.ts +3 -3
- package/src/combinator/control/constraint/line.ts +1 -2
- package/src/combinator/control/manipulation/convert.ts +4 -4
- package/src/combinator/control/manipulation/indent.ts +0 -1
- package/src/combinator/control/manipulation/match.ts +1 -2
- package/src/combinator/control/manipulation/scope.ts +3 -4
- package/src/combinator/control/manipulation/surround.ts +1 -2
- package/src/combinator/control/monad/bind.ts +2 -3
- package/src/combinator/data/parser/context.ts +0 -1
- package/src/combinator/data/parser/inits.ts +1 -2
- package/src/combinator/data/parser/sequence.ts +1 -2
- package/src/combinator/data/parser/some.ts +1 -2
- package/src/combinator/data/parser/union.ts +4 -12
- package/src/parser/api/bind.ts +0 -1
- package/src/parser/api/parse.ts +0 -1
- package/src/parser/block/codeblock.ts +0 -1
- package/src/parser/block/extension/fig.test.ts +2 -1
- package/src/parser/block/extension/fig.ts +14 -2
- package/src/parser/block/extension/figure.ts +0 -1
- package/src/parser/block/extension/table.ts +0 -1
- package/src/parser/block/mathblock.ts +0 -1
- package/src/parser/block/olist.ts +0 -1
- package/src/parser/block.ts +0 -1
- package/src/parser/inline/annotation.ts +0 -1
- package/src/parser/inline/bracket.ts +0 -1
- package/src/parser/inline/extension/index.ts +0 -1
- package/src/parser/inline/extension/indexee.ts +0 -1
- package/src/parser/inline/extension/label.ts +0 -1
- package/src/parser/inline/html.ts +0 -1
- package/src/parser/inline/htmlentity.ts +0 -1
- package/src/parser/inline/link.ts +0 -1
- package/src/parser/inline/media.ts +0 -1
- package/src/parser/inline/reference.ts +0 -1
- package/src/parser/inline/ruby.ts +0 -1
- package/src/parser/inline/template.ts +0 -1
- package/src/parser/processor/figure.ts +0 -1
- package/src/parser/processor/footnote.ts +0 -1
- package/src/parser/segment.ts +0 -1
- package/src/parser/source/line.ts +0 -1
- package/src/parser/source/str.ts +0 -1
- package/src/parser/source/text.ts +0 -1
- package/src/parser/visibility.ts +0 -1
- package/src/renderer/render/math.ts +0 -1
- package/src/renderer/render/media/image.ts +0 -1
- package/src/renderer/render/media/twitter.ts +0 -1
- package/src/renderer/render/media/video.ts +0 -1
- package/src/renderer/render/media/youtube.ts +0 -1
- package/src/renderer/render.ts +0 -1
- package/src/util/quote.ts +0 -1
- package/src/util/scope.ts +0 -2
- package/src/util/toc.ts +0 -1
- package/webpack.config.js +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.263.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
|
-
module.exports = factory(require("
|
|
4
|
+
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
5
5
|
else if(typeof define === 'function' && define.amd)
|
|
6
|
-
define(["
|
|
6
|
+
define(["Prism", "DOMPurify"], factory);
|
|
7
7
|
else if(typeof exports === 'object')
|
|
8
|
-
exports["securemark"] = factory(require("
|
|
8
|
+
exports["securemark"] = factory(require("Prism"), require("DOMPurify"));
|
|
9
9
|
else
|
|
10
|
-
root["securemark"] = factory(root["
|
|
11
|
-
})(this, (
|
|
10
|
+
root["securemark"] = factory(root["Prism"], root["DOMPurify"]);
|
|
11
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__9450__, __WEBPACK_EXTERNAL_MODULE__6231__) => {
|
|
12
12
|
return /******/ (() => { // webpackBootstrap
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
@@ -45,8 +45,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
45
45
|
value: true
|
|
46
46
|
}));
|
|
47
47
|
|
|
48
|
-
__webpack_require__(4128);
|
|
49
|
-
|
|
50
48
|
__exportStar(__webpack_require__(3019), exports);
|
|
51
49
|
|
|
52
50
|
__exportStar(__webpack_require__(4613), exports);
|
|
@@ -64,8 +62,8 @@ __exportStar(__webpack_require__(256), exports);
|
|
|
64
62
|
Object.defineProperty(exports, "__esModule", ({
|
|
65
63
|
value: true
|
|
66
64
|
}));
|
|
67
|
-
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
|
|
68
|
-
exports
|
|
65
|
+
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.MIN_VALUE = exports.MIN_SAFE_INTEGER = exports.MAX_VALUE = exports.MAX_SAFE_INTEGER = void 0;
|
|
66
|
+
exports.MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER, exports.MAX_VALUE = Number.MAX_VALUE, exports.MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER, exports.MIN_VALUE = Number.MIN_VALUE, exports.isFinite = Number.isFinite, exports.isInteger = Number.isInteger, exports.isNaN = Number.isNaN, exports.isSafeInteger = Number.isSafeInteger, exports.parseFloat = Number.parseFloat, exports.parseInt = Number.parseInt;
|
|
69
67
|
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;
|
|
70
68
|
exports.isArray = Array.isArray;
|
|
71
69
|
exports.hasOwnProperty = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
|
|
@@ -80,7 +78,7 @@ exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
|
|
|
80
78
|
/***/ }),
|
|
81
79
|
|
|
82
80
|
/***/ 8112:
|
|
83
|
-
/***/ ((__unused_webpack_module, exports
|
|
81
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
84
82
|
|
|
85
83
|
"use strict";
|
|
86
84
|
|
|
@@ -90,10 +88,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
90
88
|
}));
|
|
91
89
|
exports.splice = exports.pop = exports.push = exports.shift = exports.unshift = exports.indexOf = void 0;
|
|
92
90
|
|
|
93
|
-
const global_1 = __webpack_require__(4128);
|
|
94
|
-
|
|
95
|
-
const undefined = void 0;
|
|
96
|
-
|
|
97
91
|
function indexOf(as, a) {
|
|
98
92
|
if (as.length === 0) return -1;
|
|
99
93
|
return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
|
|
@@ -104,7 +98,7 @@ exports.indexOf = indexOf;
|
|
|
104
98
|
function unshift(as, bs) {
|
|
105
99
|
if ('length' in as) {
|
|
106
100
|
if (as.length === 1) return bs.unshift(as[0]), bs;
|
|
107
|
-
if (
|
|
101
|
+
if (Symbol.iterator in as) return bs.unshift(...as), bs;
|
|
108
102
|
|
|
109
103
|
for (let i = as.length; i--;) {
|
|
110
104
|
bs.unshift(as[i]);
|
|
@@ -128,7 +122,7 @@ exports.shift = shift;
|
|
|
128
122
|
function push(as, bs) {
|
|
129
123
|
if ('length' in bs) {
|
|
130
124
|
if (bs.length === 1) return as.push(bs[0]), as;
|
|
131
|
-
if (
|
|
125
|
+
if (Symbol.iterator in bs && bs.length > 50) return as.push(...bs), as;
|
|
132
126
|
|
|
133
127
|
for (let len = bs.length, i = 0; i < len; ++i) {
|
|
134
128
|
as.push(bs[i]);
|
|
@@ -165,22 +159,23 @@ function splice(as, index, count, ...values) {
|
|
|
165
159
|
if (count === 1 && values.length === 1) return [[as[index], as[index] = values[0]][0]];
|
|
166
160
|
|
|
167
161
|
switch (index) {
|
|
162
|
+
case as.length - 1:
|
|
163
|
+
if (as.length === 0) return push(as, values), [];
|
|
164
|
+
if (count >= 1) return [[as.pop()], push(as, values)][0];
|
|
165
|
+
break;
|
|
166
|
+
|
|
168
167
|
case 0:
|
|
169
168
|
if (count === 0) return unshift(values, as), [];
|
|
170
169
|
if (count === 1) return [[as.shift()], unshift(values, as)][0];
|
|
171
170
|
break;
|
|
172
171
|
|
|
173
|
-
case as.length - 1:
|
|
174
|
-
if (count === 1) return [[as.pop()], push(as, values)][0];
|
|
175
|
-
break;
|
|
176
|
-
|
|
177
172
|
case as.length:
|
|
178
173
|
return push(as, values), [];
|
|
179
174
|
}
|
|
180
175
|
|
|
181
176
|
switch (values.length) {
|
|
182
177
|
case 0:
|
|
183
|
-
return
|
|
178
|
+
return arguments.length > 2 ? as.splice(index, count) : as.splice(index);
|
|
184
179
|
|
|
185
180
|
case 1:
|
|
186
181
|
return as.splice(index, count, values[0]);
|
|
@@ -198,7 +193,7 @@ function splice(as, index, count, ...values) {
|
|
|
198
193
|
return as.splice(index, count, values[0], values[1], values[2], values[3], values[4]);
|
|
199
194
|
|
|
200
195
|
default:
|
|
201
|
-
return
|
|
196
|
+
return as.splice(index, count, ...values);
|
|
202
197
|
}
|
|
203
198
|
}
|
|
204
199
|
|
|
@@ -217,8 +212,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
217
212
|
}));
|
|
218
213
|
exports.template = exports.inherit = exports.merge = exports.extend = exports.overwrite = exports.clone = exports.assign = void 0;
|
|
219
214
|
|
|
220
|
-
const global_1 = __webpack_require__(4128);
|
|
221
|
-
|
|
222
215
|
const alias_1 = __webpack_require__(5406);
|
|
223
216
|
|
|
224
217
|
const type_1 = __webpack_require__(5177);
|
|
@@ -342,7 +335,7 @@ function template(strategy) {
|
|
|
342
335
|
const source = sources[i];
|
|
343
336
|
if (source === target) continue;
|
|
344
337
|
if ((0, type_1.isPrimitive)(source)) continue;
|
|
345
|
-
const keys =
|
|
338
|
+
const keys = Object.keys(source);
|
|
346
339
|
|
|
347
340
|
for (let i = 0; i < keys.length; ++i) {
|
|
348
341
|
strategy(keys[i], target, source);
|
|
@@ -356,7 +349,7 @@ function template(strategy) {
|
|
|
356
349
|
exports.template = template;
|
|
357
350
|
|
|
358
351
|
function empty(source) {
|
|
359
|
-
return source instanceof
|
|
352
|
+
return source instanceof Object ? {} : (0, alias_1.ObjectCreate)(null);
|
|
360
353
|
}
|
|
361
354
|
|
|
362
355
|
/***/ }),
|
|
@@ -372,8 +365,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
372
365
|
}));
|
|
373
366
|
exports.Cache = void 0;
|
|
374
367
|
|
|
375
|
-
const global_1 = __webpack_require__(4128);
|
|
376
|
-
|
|
377
368
|
const alias_1 = __webpack_require__(5406);
|
|
378
369
|
|
|
379
370
|
const clock_1 = __webpack_require__(7681);
|
|
@@ -388,27 +379,27 @@ class Cache {
|
|
|
388
379
|
constructor(capacity, opts = {}) {
|
|
389
380
|
this.settings = {
|
|
390
381
|
capacity: 0,
|
|
391
|
-
|
|
382
|
+
window: 100,
|
|
383
|
+
age: Infinity,
|
|
392
384
|
earlyExpiring: false,
|
|
393
385
|
capture: {
|
|
394
386
|
delete: true,
|
|
395
387
|
clear: true
|
|
396
388
|
},
|
|
397
|
-
window: 0,
|
|
398
389
|
resolution: 1,
|
|
399
390
|
offset: 0,
|
|
400
|
-
|
|
391
|
+
entrance: 5,
|
|
392
|
+
threshold: 20,
|
|
401
393
|
sweep: 10,
|
|
402
|
-
|
|
394
|
+
test: false
|
|
403
395
|
};
|
|
404
396
|
this.overlap = 0;
|
|
405
397
|
this.SIZE = 0;
|
|
406
|
-
this.memory = new
|
|
398
|
+
this.memory = new Map();
|
|
407
399
|
this.indexes = {
|
|
408
400
|
LRU: new invlist_1.List(),
|
|
409
401
|
LFU: new invlist_1.List()
|
|
410
402
|
};
|
|
411
|
-
this.expiries = new heap_1.Heap(heap_1.Heap.min);
|
|
412
403
|
this.misses = 0;
|
|
413
404
|
this.sweep = 0;
|
|
414
405
|
this.ratio = 500;
|
|
@@ -421,20 +412,25 @@ class Cache {
|
|
|
421
412
|
const settings = (0, assign_1.extend)(this.settings, opts, {
|
|
422
413
|
capacity
|
|
423
414
|
});
|
|
424
|
-
this.capacity = settings.capacity;
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
this.
|
|
429
|
-
this.
|
|
415
|
+
this.capacity = capacity = settings.capacity;
|
|
416
|
+
if (capacity >>> 0 !== capacity) throw new Error(`Spica: Cache: Capacity must be integer.`);
|
|
417
|
+
if (capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
|
|
418
|
+
this.window = settings.window * this.capacity / 100 >>> 0 || this.capacity;
|
|
419
|
+
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% or more of capacity.`);
|
|
420
|
+
this.threshold = settings.threshold;
|
|
421
|
+
this.limit = 1000 - settings.entrance * 10;
|
|
430
422
|
this.age = settings.age;
|
|
431
|
-
|
|
423
|
+
|
|
424
|
+
if (settings.earlyExpiring) {
|
|
425
|
+
this.expiries = new heap_1.Heap(heap_1.Heap.min);
|
|
426
|
+
}
|
|
427
|
+
|
|
432
428
|
this.disposer = settings.disposer;
|
|
433
|
-
this.stats = new
|
|
429
|
+
this.stats = opts.resolution || opts.offset ? new StatsExperimental(this.window, settings.resolution, settings.offset) : new Stats(this.window);
|
|
430
|
+
this.test = settings.test;
|
|
434
431
|
}
|
|
435
432
|
|
|
436
433
|
get length() {
|
|
437
|
-
//assert(this.indexes.LRU.length + this.indexes.LFU.length === this.memory.size);
|
|
438
434
|
return this.indexes.LRU.length + this.indexes.LFU.length;
|
|
439
435
|
}
|
|
440
436
|
|
|
@@ -443,22 +439,21 @@ class Cache {
|
|
|
443
439
|
}
|
|
444
440
|
|
|
445
441
|
evict(node, callback) {
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
this.overlap -= +(index.region === 'LFU' && node.list === this.indexes.LRU);
|
|
442
|
+
const entry = node.value;
|
|
443
|
+
entry.region === 'LFU' && node.list === this.indexes.LRU && --this.overlap;
|
|
449
444
|
|
|
450
|
-
if (
|
|
451
|
-
this.expiries.delete(
|
|
452
|
-
|
|
445
|
+
if (entry.eid !== -1) {
|
|
446
|
+
this.expiries.delete(entry.eid);
|
|
447
|
+
entry.eid = -1;
|
|
453
448
|
}
|
|
454
449
|
|
|
455
450
|
node.delete();
|
|
456
|
-
this.memory.delete(
|
|
457
|
-
this.SIZE -=
|
|
458
|
-
callback && this.disposer?.(node.value.value,
|
|
451
|
+
this.memory.delete(entry.key);
|
|
452
|
+
this.SIZE -= entry.size;
|
|
453
|
+
callback && this.disposer?.(node.value.value, entry.key);
|
|
459
454
|
}
|
|
460
455
|
|
|
461
|
-
ensure(margin, skip) {
|
|
456
|
+
ensure(margin, skip, capture = false) {
|
|
462
457
|
let size = skip?.value.size ?? 0;
|
|
463
458
|
const {
|
|
464
459
|
LRU,
|
|
@@ -466,49 +461,47 @@ class Cache {
|
|
|
466
461
|
} = this.indexes;
|
|
467
462
|
|
|
468
463
|
while (this.size + margin - size > this.capacity) {
|
|
469
|
-
let
|
|
470
|
-
|
|
471
|
-
switch (true) {
|
|
472
|
-
case (target = this.expiries.peek()) && target !== skip && target.value.expiry < (0, clock_1.now)():
|
|
473
|
-
break;
|
|
474
|
-
|
|
475
|
-
case LRU.length === 0:
|
|
476
|
-
target = LFU.last !== skip ? LFU.last : LFU.last.prev;
|
|
477
|
-
break;
|
|
478
|
-
// @ts-expect-error
|
|
464
|
+
let victim = this.expiries?.peek();
|
|
479
465
|
|
|
480
|
-
|
|
481
|
-
|
|
466
|
+
if (victim && victim !== skip && victim.value.expiry < (0, clock_1.now)()) {} else if (LRU.length === 0) {
|
|
467
|
+
victim = LFU.last !== skip ? LFU.last : LFU.last.prev;
|
|
468
|
+
} else {
|
|
469
|
+
if (this.misses > LRU.length * this.threshold / 100) {
|
|
470
|
+
this.sweep ||= (0, alias_1.round)(LRU.length * this.settings.sweep / 100) || 1;
|
|
471
|
+
|
|
472
|
+
if (this.sweep > 0) {
|
|
473
|
+
LRU.head = LRU.head.next.next;
|
|
474
|
+
--this.sweep;
|
|
475
|
+
this.sweep ||= -(0, alias_1.round)(LRU.length * this.settings.sweep / 100) || -1;
|
|
476
|
+
} else {
|
|
477
|
+
++this.sweep;
|
|
478
|
+
}
|
|
479
|
+
} else if (LFU.length > this.capacity * this.ratio / 1000) {
|
|
480
|
+
victim = LFU.last !== skip ? LFU.last : LFU.length !== 1 ? LFU.last.prev : undefined;
|
|
482
481
|
|
|
483
|
-
if (
|
|
484
|
-
LRU.unshiftNode(
|
|
482
|
+
if (victim) {
|
|
483
|
+
LRU.unshiftNode(victim);
|
|
485
484
|
++this.overlap;
|
|
486
485
|
}
|
|
486
|
+
}
|
|
487
487
|
|
|
488
|
-
|
|
488
|
+
victim = LRU.last !== skip ? LRU.last : LRU.length !== 1 ? LRU.last.prev : undefined;
|
|
489
489
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
LRU.head = LRU.head.next.next;
|
|
496
|
-
--this.sweep;
|
|
497
|
-
this.sweep ||= -(0, alias_1.round)(LRU.length * this.settings.sweep / 100 * 99 / 100);
|
|
498
|
-
} else {
|
|
499
|
-
++this.sweep;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
490
|
+
if (capture && !skip && victim) {
|
|
491
|
+
skip = victim;
|
|
492
|
+
size = skip?.value.size ?? 0;
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
502
495
|
|
|
503
|
-
|
|
496
|
+
victim ??= LFU.last;
|
|
504
497
|
}
|
|
505
498
|
|
|
506
|
-
this.evict(
|
|
499
|
+
this.evict(victim, true);
|
|
507
500
|
skip = skip?.list && skip;
|
|
508
501
|
size = skip?.value.size ?? 0;
|
|
509
502
|
}
|
|
510
503
|
|
|
511
|
-
return
|
|
504
|
+
return skip;
|
|
512
505
|
}
|
|
513
506
|
|
|
514
507
|
put(key, value, {
|
|
@@ -520,47 +513,61 @@ class Cache {
|
|
|
520
513
|
return false;
|
|
521
514
|
}
|
|
522
515
|
|
|
523
|
-
|
|
516
|
+
const {
|
|
517
|
+
LRU
|
|
518
|
+
} = this.indexes;
|
|
519
|
+
|
|
520
|
+
if (age === Infinity) {
|
|
524
521
|
age = 0;
|
|
525
522
|
}
|
|
526
523
|
|
|
527
|
-
const expiry = age ? (0, clock_1.now)() + age :
|
|
528
|
-
|
|
524
|
+
const expiry = age ? (0, clock_1.now)() + age : Infinity;
|
|
525
|
+
let node = this.memory.get(key);
|
|
526
|
+
const match = !!node;
|
|
527
|
+
node = this.ensure(size, node, true);
|
|
528
|
+
|
|
529
|
+
if (node !== undefined) {
|
|
530
|
+
const entry = node.value;
|
|
531
|
+
const key$ = entry.key;
|
|
532
|
+
const value$ = entry.value;
|
|
529
533
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
if (this.earlyExpiring && age) {
|
|
538
|
-
index.enode ? this.expiries.update(index.enode, expiry) : index.enode = this.expiries.insert(node, expiry);
|
|
539
|
-
} else if (index.enode) {
|
|
540
|
-
this.expiries.delete(index.enode);
|
|
541
|
-
index.enode = void 0;
|
|
534
|
+
if (!match) {
|
|
535
|
+
entry.region === 'LFU' && --this.overlap;
|
|
536
|
+
this.memory.delete(key$);
|
|
537
|
+
this.memory.set(key, node);
|
|
538
|
+
entry.key = key;
|
|
539
|
+
entry.region = 'LRU';
|
|
540
|
+
LRU.head = node;
|
|
542
541
|
}
|
|
543
542
|
|
|
544
|
-
|
|
545
|
-
this.
|
|
546
|
-
|
|
543
|
+
entry.value = value;
|
|
544
|
+
this.SIZE += size - entry.size;
|
|
545
|
+
entry.size = size;
|
|
546
|
+
entry.expiry = expiry;
|
|
547
|
+
|
|
548
|
+
if (this.expiries && age) {
|
|
549
|
+
entry.eid !== -1 ? this.expiries.update(entry.eid, expiry) : entry.eid = this.expiries.insert(node, expiry);
|
|
550
|
+
} else if (entry.eid !== -1) {
|
|
551
|
+
this.expiries.delete(entry.eid);
|
|
552
|
+
entry.eid = -1;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
this.disposer?.(value$, key$);
|
|
556
|
+
return match;
|
|
547
557
|
}
|
|
548
558
|
|
|
549
|
-
this.ensure(size);
|
|
550
|
-
const {
|
|
551
|
-
LRU
|
|
552
|
-
} = this.indexes;
|
|
553
559
|
this.SIZE += size;
|
|
554
560
|
this.memory.set(key, LRU.unshift({
|
|
555
561
|
key,
|
|
556
562
|
value,
|
|
557
563
|
size,
|
|
558
564
|
expiry,
|
|
565
|
+
eid: -1,
|
|
559
566
|
region: 'LRU'
|
|
560
567
|
}));
|
|
561
568
|
|
|
562
|
-
if (this.
|
|
563
|
-
LRU.head.value.
|
|
569
|
+
if (this.expiries && age) {
|
|
570
|
+
LRU.head.value.eid = this.expiries.insert(LRU.head, expiry);
|
|
564
571
|
}
|
|
565
572
|
|
|
566
573
|
return false;
|
|
@@ -574,14 +581,15 @@ class Cache {
|
|
|
574
581
|
get(key) {
|
|
575
582
|
const node = this.memory.get(key);
|
|
576
583
|
|
|
577
|
-
if (
|
|
584
|
+
if (node === undefined) {
|
|
578
585
|
++this.misses;
|
|
579
586
|
return;
|
|
580
587
|
}
|
|
581
588
|
|
|
582
|
-
const
|
|
589
|
+
const entry = node.value;
|
|
590
|
+
const expiry = entry.expiry;
|
|
583
591
|
|
|
584
|
-
if (expiry !==
|
|
592
|
+
if (expiry !== Infinity && expiry < (0, clock_1.now)()) {
|
|
585
593
|
++this.misses;
|
|
586
594
|
this.evict(node, true);
|
|
587
595
|
return;
|
|
@@ -590,20 +598,19 @@ class Cache {
|
|
|
590
598
|
this.misses &&= 0;
|
|
591
599
|
this.sweep &&= 0; // Optimization for memoize.
|
|
592
600
|
|
|
593
|
-
if (this.
|
|
601
|
+
if (!this.test && node === node.list.head) return entry.value;
|
|
594
602
|
this.access(node);
|
|
595
603
|
this.adjust();
|
|
596
|
-
return
|
|
604
|
+
return entry.value;
|
|
597
605
|
}
|
|
598
606
|
|
|
599
607
|
has(key) {
|
|
600
|
-
//assert(this.memory.has(key) === (this.indexes.LFU.has(key) || this.indexes.LRU.has(key)));
|
|
601
|
-
//assert(this.memory.size === this.indexes.LFU.length + this.indexes.LRU.length);
|
|
602
608
|
const node = this.memory.get(key);
|
|
603
|
-
if (
|
|
604
|
-
const
|
|
609
|
+
if (node === undefined) return false;
|
|
610
|
+
const entry = node.value;
|
|
611
|
+
const expiry = entry.expiry;
|
|
605
612
|
|
|
606
|
-
if (expiry !==
|
|
613
|
+
if (expiry !== Infinity && expiry < (0, clock_1.now)()) {
|
|
607
614
|
this.evict(node, true);
|
|
608
615
|
return false;
|
|
609
616
|
}
|
|
@@ -613,7 +620,7 @@ class Cache {
|
|
|
613
620
|
|
|
614
621
|
delete(key) {
|
|
615
622
|
const node = this.memory.get(key);
|
|
616
|
-
if (
|
|
623
|
+
if (node === undefined) return false;
|
|
617
624
|
this.evict(node, this.settings.capture.delete === true);
|
|
618
625
|
return true;
|
|
619
626
|
}
|
|
@@ -627,10 +634,10 @@ class Cache {
|
|
|
627
634
|
this.stats.clear();
|
|
628
635
|
this.indexes.LRU.clear();
|
|
629
636
|
this.indexes.LFU.clear();
|
|
630
|
-
this.expiries
|
|
637
|
+
this.expiries?.clear();
|
|
631
638
|
if (!this.disposer || !this.settings.capture.clear) return void this.memory.clear();
|
|
632
639
|
const memory = this.memory;
|
|
633
|
-
this.memory = new
|
|
640
|
+
this.memory = new Map();
|
|
634
641
|
|
|
635
642
|
for (const {
|
|
636
643
|
0: key,
|
|
@@ -645,10 +652,11 @@ class Cache {
|
|
|
645
652
|
}
|
|
646
653
|
|
|
647
654
|
resize(capacity) {
|
|
648
|
-
if (
|
|
655
|
+
if (capacity >>> 0 !== capacity) throw new Error(`Spica: Cache: Capacity must be integer.`);
|
|
656
|
+
if (capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
|
|
649
657
|
this.capacity = capacity;
|
|
650
|
-
this.window = this.settings.window || this.capacity;
|
|
651
|
-
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity
|
|
658
|
+
this.window = this.settings.window * this.capacity / 100 >>> 0 || this.capacity;
|
|
659
|
+
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% or more of capacity.`);
|
|
652
660
|
this.ensure(0);
|
|
653
661
|
}
|
|
654
662
|
|
|
@@ -667,6 +675,32 @@ class Cache {
|
|
|
667
675
|
return;
|
|
668
676
|
}
|
|
669
677
|
|
|
678
|
+
access(node) {
|
|
679
|
+
const entry = node.value;
|
|
680
|
+
const {
|
|
681
|
+
region
|
|
682
|
+
} = entry;
|
|
683
|
+
const {
|
|
684
|
+
LRU,
|
|
685
|
+
LFU
|
|
686
|
+
} = this.indexes;
|
|
687
|
+
|
|
688
|
+
if (node.list === LRU) {
|
|
689
|
+
++this.stats[region][0];
|
|
690
|
+
|
|
691
|
+
if (region === 'LFU') {
|
|
692
|
+
--this.overlap;
|
|
693
|
+
} else {
|
|
694
|
+
entry.region = 'LFU';
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
LFU.unshiftNode(node);
|
|
698
|
+
} else {
|
|
699
|
+
++this.stats[region][0];
|
|
700
|
+
node.moveToHead();
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
670
704
|
adjust() {
|
|
671
705
|
const {
|
|
672
706
|
capacity,
|
|
@@ -675,13 +709,15 @@ class Cache {
|
|
|
675
709
|
stats,
|
|
676
710
|
indexes
|
|
677
711
|
} = this;
|
|
678
|
-
if (stats.subtotal() * 1000 % capacity || !stats.
|
|
712
|
+
if (stats.subtotal() * 1000 % capacity || !stats.isFull()) return;
|
|
679
713
|
const lenR = indexes.LRU.length;
|
|
680
714
|
const lenF = indexes.LFU.length;
|
|
681
715
|
const lenO = this.overlap;
|
|
682
716
|
const leverage = (lenF + lenO) * 1000 / (lenR + lenF) | 0;
|
|
683
|
-
const
|
|
684
|
-
const
|
|
717
|
+
const rateR = stats.rateLRU();
|
|
718
|
+
const rateF = 10000 - rateR;
|
|
719
|
+
const rateR0 = rateR * leverage;
|
|
720
|
+
const rateF0 = rateF * (1000 - leverage);
|
|
685
721
|
const rateF1 = stats.offset && stats.rateLFU(true) * (1000 - leverage); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
|
|
686
722
|
// LRUの下限設定ではLRU拡大の要否を迅速に判定できないためLFUのヒット率低下の検出で代替する
|
|
687
723
|
|
|
@@ -699,79 +735,56 @@ class Cache {
|
|
|
699
735
|
}
|
|
700
736
|
}
|
|
701
737
|
|
|
702
|
-
access(node) {
|
|
703
|
-
return this.accessLFU(node) || this.accessLRU(node);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
accessLRU(node) {
|
|
707
|
-
const index = node.value;
|
|
708
|
-
++this.stats[index.region][0];
|
|
709
|
-
this.overlap -= +(index.region === 'LFU');
|
|
710
|
-
index.region = 'LFU';
|
|
711
|
-
this.indexes.LFU.unshiftNode(node);
|
|
712
|
-
return true;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
accessLFU(node) {
|
|
716
|
-
if (node.list !== this.indexes.LFU) return false;
|
|
717
|
-
const index = node.value;
|
|
718
|
-
++this.stats[index.region][0];
|
|
719
|
-
node.moveToHead();
|
|
720
|
-
return true;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
738
|
}
|
|
724
739
|
|
|
725
740
|
exports.Cache = Cache;
|
|
726
741
|
|
|
727
742
|
class Stats {
|
|
728
|
-
constructor(window
|
|
743
|
+
constructor(window) {
|
|
729
744
|
this.window = window;
|
|
730
|
-
this.
|
|
731
|
-
this.
|
|
732
|
-
this.max = (0, alias_1.ceil)(this.resolution * (100 + this.offset) / 100) + 1;
|
|
745
|
+
this.offset = 0;
|
|
746
|
+
this.max = 2;
|
|
733
747
|
this.LRU = [0];
|
|
734
748
|
this.LFU = [0];
|
|
735
749
|
}
|
|
736
750
|
|
|
751
|
+
static rate(window, hits1, hits2, offset) {
|
|
752
|
+
const currTotal = hits1[0] + hits2[0];
|
|
753
|
+
const prevTotal = hits1[1] + hits2[1];
|
|
754
|
+
const currHits = hits1[0];
|
|
755
|
+
const prevHits = hits1[1];
|
|
756
|
+
const prevRate = prevHits * 100 / (prevTotal || 1);
|
|
757
|
+
const currRatio = currTotal * 100 / window - offset;
|
|
758
|
+
if (currRatio <= 0) return prevRate * 100 | 0;
|
|
759
|
+
const currRate = currHits * 100 / (currTotal || 1);
|
|
760
|
+
const prevRatio = 100 - currRatio;
|
|
761
|
+
return currRate * currRatio + prevRate * prevRatio | 0;
|
|
762
|
+
}
|
|
763
|
+
|
|
737
764
|
get length() {
|
|
738
765
|
return this.LRU.length;
|
|
739
766
|
}
|
|
740
767
|
|
|
741
|
-
|
|
768
|
+
isFull() {
|
|
742
769
|
return this.length === this.max;
|
|
743
770
|
}
|
|
744
771
|
|
|
745
772
|
rateLRU(offset = false) {
|
|
746
|
-
return rate(this.window, this.LRU, this.LFU, +offset
|
|
773
|
+
return Stats.rate(this.window, this.LRU, this.LFU, +offset & 0);
|
|
747
774
|
}
|
|
748
775
|
|
|
749
776
|
rateLFU(offset = false) {
|
|
750
|
-
return rate(this.window, this.LFU, this.LRU, +offset
|
|
777
|
+
return Stats.rate(this.window, this.LFU, this.LRU, +offset & 0);
|
|
751
778
|
}
|
|
752
779
|
|
|
753
780
|
subtotal() {
|
|
754
781
|
const {
|
|
755
782
|
LRU,
|
|
756
783
|
LFU,
|
|
757
|
-
window
|
|
758
|
-
resolution,
|
|
759
|
-
offset
|
|
784
|
+
window
|
|
760
785
|
} = this;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
if (this.length === 1) {
|
|
764
|
-
this.slide();
|
|
765
|
-
} else {
|
|
766
|
-
LRU[1] += LRU[0];
|
|
767
|
-
LFU[1] += LFU[0];
|
|
768
|
-
LRU[0] = 0;
|
|
769
|
-
LFU[0] = 0;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
const subtotal = LRU[+offset && 1] + LFU[+offset && 1] || 0;
|
|
774
|
-
subtotal >= window / resolution && this.slide();
|
|
786
|
+
const subtotal = LRU[0] + LFU[0];
|
|
787
|
+
subtotal >= window && this.slide();
|
|
775
788
|
return LRU[0] + LFU[0];
|
|
776
789
|
}
|
|
777
790
|
|
|
@@ -798,26 +811,69 @@ class Stats {
|
|
|
798
811
|
|
|
799
812
|
}
|
|
800
813
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
814
|
+
class StatsExperimental extends Stats {
|
|
815
|
+
constructor(window, resolution, offset) {
|
|
816
|
+
super(window);
|
|
817
|
+
this.resolution = resolution;
|
|
818
|
+
this.offset = offset;
|
|
819
|
+
this.max = (0, alias_1.ceil)(this.resolution * (100 + this.offset) / 100) + 1;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
static rate(window, hits1, hits2, offset) {
|
|
823
|
+
let total = 0;
|
|
824
|
+
let hits = 0;
|
|
825
|
+
let ratio = 100;
|
|
826
|
+
|
|
827
|
+
for (let len = hits1.length, i = 0; i < len; ++i) {
|
|
828
|
+
const subtotal = hits1[i] + hits2[i];
|
|
829
|
+
if (subtotal === 0) continue;
|
|
830
|
+
offset = i + 1 === len ? 0 : offset;
|
|
831
|
+
const subratio = (0, alias_1.min)(subtotal * 100 / window, ratio) - offset;
|
|
832
|
+
offset = offset && subratio < 0 ? -subratio : 0;
|
|
833
|
+
if (subratio <= 0) continue;
|
|
834
|
+
const rate = window * subratio / subtotal;
|
|
835
|
+
total += subtotal * rate;
|
|
836
|
+
hits += hits1[i] * rate;
|
|
837
|
+
ratio -= subratio;
|
|
838
|
+
if (ratio <= 0) break;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return hits * 10000 / total | 0;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
rateLRU(offset = false) {
|
|
845
|
+
return StatsExperimental.rate(this.window, this.LRU, this.LFU, +offset && this.offset);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
rateLFU(offset = false) {
|
|
849
|
+
return StatsExperimental.rate(this.window, this.LFU, this.LRU, +offset && this.offset);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
subtotal() {
|
|
853
|
+
const {
|
|
854
|
+
LRU,
|
|
855
|
+
LFU,
|
|
856
|
+
window,
|
|
857
|
+
resolution,
|
|
858
|
+
offset
|
|
859
|
+
} = this;
|
|
860
|
+
|
|
861
|
+
if (offset && LRU[0] + LFU[0] >= window * offset / 100) {
|
|
862
|
+
if (this.length === 1) {
|
|
863
|
+
this.slide();
|
|
864
|
+
} else {
|
|
865
|
+
LRU[1] += LRU[0];
|
|
866
|
+
LFU[1] += LFU[0];
|
|
867
|
+
LRU[0] = 0;
|
|
868
|
+
LFU[0] = 0;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
805
871
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
offset = i + 1 === len ? 0 : offset;
|
|
810
|
-
const subratio = (0, alias_1.min)(subtotal * 100 / window, ratio) - offset;
|
|
811
|
-
offset = offset && subratio < 0 ? -subratio : 0;
|
|
812
|
-
if (subratio <= 0) continue;
|
|
813
|
-
const rate = window * subratio / subtotal;
|
|
814
|
-
total += subtotal * rate;
|
|
815
|
-
hits += hits1[i] * rate;
|
|
816
|
-
ratio -= subratio;
|
|
817
|
-
if (ratio <= 0) break;
|
|
872
|
+
const subtotal = LRU[offset && 1] + LFU[offset && 1] || 0;
|
|
873
|
+
subtotal >= window / resolution && this.slide();
|
|
874
|
+
return LRU[0] + LFU[0];
|
|
818
875
|
}
|
|
819
876
|
|
|
820
|
-
return hits * 10000 / total | 0;
|
|
821
877
|
}
|
|
822
878
|
|
|
823
879
|
/***/ }),
|
|
@@ -831,56 +887,66 @@ function rate(window, hits1, hits2, offset) {
|
|
|
831
887
|
Object.defineProperty(exports, "__esModule", ({
|
|
832
888
|
value: true
|
|
833
889
|
}));
|
|
834
|
-
exports.
|
|
835
|
-
|
|
836
|
-
const global_1 = __webpack_require__(4128);
|
|
890
|
+
exports.clock = exports.now = void 0;
|
|
837
891
|
|
|
838
892
|
const queue_1 = __webpack_require__(4934);
|
|
839
893
|
|
|
840
894
|
const exception_1 = __webpack_require__(7822);
|
|
841
895
|
|
|
842
|
-
const undefined = void 0;
|
|
843
896
|
let time;
|
|
844
897
|
let count = 0;
|
|
845
898
|
|
|
846
899
|
function now(nocache) {
|
|
847
900
|
if (time === undefined) {
|
|
848
|
-
|
|
901
|
+
exports.clock.now(() => time = undefined);
|
|
849
902
|
} else if (!nocache && count++ !== 20) {
|
|
850
903
|
return time;
|
|
851
904
|
}
|
|
852
905
|
|
|
853
906
|
count = 1;
|
|
854
|
-
return time =
|
|
907
|
+
return time = Date.now();
|
|
855
908
|
}
|
|
856
909
|
|
|
857
910
|
exports.now = now;
|
|
858
|
-
exports.clock =
|
|
911
|
+
exports.clock = new class Clock extends Promise {
|
|
912
|
+
constructor() {
|
|
913
|
+
super(resolve => resolve(undefined)); // Promise subclass is slow.
|
|
859
914
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
915
|
+
const clock = Promise.resolve();
|
|
916
|
+
clock.next = this.next;
|
|
917
|
+
clock.now = this.now;
|
|
918
|
+
return clock;
|
|
919
|
+
}
|
|
863
920
|
|
|
864
|
-
|
|
921
|
+
next(callback) {
|
|
922
|
+
scheduled || schedule();
|
|
923
|
+
exports.clock.then(callback);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
now(callback) {
|
|
927
|
+
scheduled || schedule();
|
|
928
|
+
queue.push(callback);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
}();
|
|
865
932
|
const queue = new queue_1.Queue();
|
|
866
|
-
|
|
933
|
+
let scheduled = false;
|
|
867
934
|
|
|
868
|
-
function
|
|
869
|
-
|
|
870
|
-
|
|
935
|
+
function schedule() {
|
|
936
|
+
scheduled = true;
|
|
937
|
+
exports.clock.then(run);
|
|
871
938
|
}
|
|
872
939
|
|
|
873
|
-
exports.tick = tick;
|
|
874
|
-
|
|
875
940
|
function run() {
|
|
876
|
-
for (let
|
|
941
|
+
for (let cb; cb = queue.pop();) {
|
|
877
942
|
try {
|
|
878
|
-
|
|
879
|
-
(0, queue.pop())();
|
|
943
|
+
cb();
|
|
880
944
|
} catch (reason) {
|
|
881
945
|
(0, exception_1.causeAsyncException)(reason);
|
|
882
946
|
}
|
|
883
947
|
}
|
|
948
|
+
|
|
949
|
+
scheduled = false;
|
|
884
950
|
}
|
|
885
951
|
|
|
886
952
|
/***/ }),
|
|
@@ -1072,16 +1138,34 @@ exports.duffReduce = duffReduce;
|
|
|
1072
1138
|
Object.defineProperty(exports, "__esModule", ({
|
|
1073
1139
|
value: true
|
|
1074
1140
|
}));
|
|
1075
|
-
exports.causeAsyncException = void 0;
|
|
1141
|
+
exports.suppressAsyncException = exports.causeAsyncException = void 0;
|
|
1142
|
+
|
|
1143
|
+
const stack_1 = __webpack_require__(5352);
|
|
1076
1144
|
|
|
1077
|
-
const
|
|
1145
|
+
const stack = new stack_1.Stack();
|
|
1078
1146
|
|
|
1079
1147
|
function causeAsyncException(reason) {
|
|
1080
|
-
|
|
1148
|
+
if (stack.isEmpty()) {
|
|
1149
|
+
Promise.reject(reason);
|
|
1150
|
+
} else {
|
|
1151
|
+
stack.peek().push(reason);
|
|
1152
|
+
}
|
|
1081
1153
|
}
|
|
1082
1154
|
|
|
1083
1155
|
exports.causeAsyncException = causeAsyncException;
|
|
1084
1156
|
|
|
1157
|
+
function suppressAsyncException(test) {
|
|
1158
|
+
return done => {
|
|
1159
|
+
stack.push([]);
|
|
1160
|
+
return test(err => {
|
|
1161
|
+
stack.pop();
|
|
1162
|
+
done(err);
|
|
1163
|
+
});
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
exports.suppressAsyncException = suppressAsyncException;
|
|
1168
|
+
|
|
1085
1169
|
/***/ }),
|
|
1086
1170
|
|
|
1087
1171
|
/***/ 4128:
|
|
@@ -1092,7 +1176,7 @@ exports.causeAsyncException = causeAsyncException;
|
|
|
1092
1176
|
|
|
1093
1177
|
__webpack_require__(6921);
|
|
1094
1178
|
|
|
1095
|
-
const global =
|
|
1179
|
+
const global = false || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
|
|
1096
1180
|
|| typeof self !== 'undefined' && self || Function('return this')();
|
|
1097
1181
|
global.global = global;
|
|
1098
1182
|
module.exports = global;
|
|
@@ -1122,33 +1206,29 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1122
1206
|
}));
|
|
1123
1207
|
exports.MultiHeap = exports.Heap = void 0;
|
|
1124
1208
|
|
|
1125
|
-
const
|
|
1209
|
+
const alias_1 = __webpack_require__(5406);
|
|
1126
1210
|
|
|
1127
1211
|
const invlist_1 = __webpack_require__(7452);
|
|
1128
1212
|
|
|
1129
1213
|
const memoize_1 = __webpack_require__(1808);
|
|
1130
1214
|
|
|
1131
|
-
const undefined = void 0;
|
|
1132
|
-
let size = 16;
|
|
1133
|
-
|
|
1134
1215
|
class Heap {
|
|
1135
|
-
constructor(cmp = Heap.max,
|
|
1216
|
+
constructor(cmp = Heap.max, options) {
|
|
1136
1217
|
this.cmp = cmp;
|
|
1137
|
-
this.stable = stable;
|
|
1138
|
-
this.array =
|
|
1139
|
-
this.$length = 0;
|
|
1218
|
+
this.stable = options?.stable ?? false;
|
|
1219
|
+
this.array = new List();
|
|
1140
1220
|
}
|
|
1141
1221
|
|
|
1142
1222
|
get length() {
|
|
1143
|
-
return this
|
|
1223
|
+
return this.array.length;
|
|
1144
1224
|
}
|
|
1145
1225
|
|
|
1146
1226
|
isEmpty() {
|
|
1147
|
-
return this.array
|
|
1227
|
+
return this.array.length === 0;
|
|
1148
1228
|
}
|
|
1149
1229
|
|
|
1150
1230
|
peek() {
|
|
1151
|
-
return this.array
|
|
1231
|
+
return this.array.value(this.array.index(0));
|
|
1152
1232
|
}
|
|
1153
1233
|
|
|
1154
1234
|
insert(value, order) {
|
|
@@ -1156,10 +1236,9 @@ class Heap {
|
|
|
1156
1236
|
order = value;
|
|
1157
1237
|
}
|
|
1158
1238
|
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
return node;
|
|
1239
|
+
const index = this.array.push(value, order);
|
|
1240
|
+
upHeapify(this.cmp, this.array, this.length);
|
|
1241
|
+
return index;
|
|
1163
1242
|
}
|
|
1164
1243
|
|
|
1165
1244
|
replace(value, order) {
|
|
@@ -1167,71 +1246,240 @@ class Heap {
|
|
|
1167
1246
|
order = value;
|
|
1168
1247
|
}
|
|
1169
1248
|
|
|
1170
|
-
if (this
|
|
1171
|
-
const
|
|
1172
|
-
const
|
|
1173
|
-
array
|
|
1174
|
-
|
|
1249
|
+
if (this.length === 0) return void this.insert(value, order);
|
|
1250
|
+
const replaced = this.peek();
|
|
1251
|
+
const index = this.array.index(0);
|
|
1252
|
+
this.array.setValue(index, value);
|
|
1253
|
+
this.array.setOrder(index, order);
|
|
1254
|
+
downHeapify(this.cmp, this.array, 1, this.length, this.stable);
|
|
1175
1255
|
return replaced;
|
|
1176
1256
|
}
|
|
1177
1257
|
|
|
1178
1258
|
extract() {
|
|
1179
|
-
if (this
|
|
1180
|
-
const
|
|
1181
|
-
this.
|
|
1182
|
-
return
|
|
1259
|
+
if (this.length === 0) return;
|
|
1260
|
+
const value = this.peek();
|
|
1261
|
+
this.del(0);
|
|
1262
|
+
return value;
|
|
1183
1263
|
}
|
|
1184
1264
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1265
|
+
del(pos) {
|
|
1266
|
+
swap(this.array, pos + 1, this.length);
|
|
1267
|
+
this.array.pop();
|
|
1268
|
+
sort(this.cmp, this.array, pos + 1, this.length, this.stable);
|
|
1269
|
+
}
|
|
1190
1270
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1271
|
+
delete(index) {
|
|
1272
|
+
const value = this.array.value(index);
|
|
1273
|
+
this.del(this.array.position(index));
|
|
1274
|
+
return value;
|
|
1194
1275
|
}
|
|
1195
1276
|
|
|
1196
|
-
update(
|
|
1197
|
-
|
|
1198
|
-
|
|
1277
|
+
update(index, order, value) {
|
|
1278
|
+
const ord = this.array.order(index);
|
|
1279
|
+
|
|
1280
|
+
if (arguments.length < 3) {
|
|
1281
|
+
this.array.setOrder(index, order);
|
|
1282
|
+
} else {
|
|
1283
|
+
this.array.setOrder(index, order);
|
|
1284
|
+
this.array.setValue(index, value);
|
|
1199
1285
|
}
|
|
1200
1286
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1287
|
+
if (this.cmp(ord, order) === 0) return;
|
|
1288
|
+
sort(this.cmp, this.array, this.array.position(index) + 1, this.length, this.stable);
|
|
1289
|
+
}
|
|
1203
1290
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1291
|
+
clear() {
|
|
1292
|
+
this.array.clear();
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
exports.Heap = Heap;
|
|
1298
|
+
|
|
1299
|
+
Heap.max = (a, b) => a > b ? -1 : a < b ? 1 : 0;
|
|
1300
|
+
|
|
1301
|
+
Heap.min = (a, b) => a > b ? 1 : a < b ? -1 : 0;
|
|
1302
|
+
|
|
1303
|
+
function sort(cmp, array, index, length, stable) {
|
|
1304
|
+
if (length === 0) return false;
|
|
1305
|
+
|
|
1306
|
+
switch (index) {
|
|
1307
|
+
case 1:
|
|
1308
|
+
return false || downHeapify(cmp, array, index, length, stable);
|
|
1309
|
+
|
|
1310
|
+
case length:
|
|
1311
|
+
return upHeapify(cmp, array, index);
|
|
1312
|
+
|
|
1313
|
+
default:
|
|
1314
|
+
return upHeapify(cmp, array, index) || downHeapify(cmp, array, index, length, stable);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
function upHeapify(cmp, array, index) {
|
|
1319
|
+
const order = array.ord(index - 1);
|
|
1320
|
+
let changed = false;
|
|
1321
|
+
|
|
1322
|
+
while (index > 1) {
|
|
1323
|
+
const parent = index / 2 | 0;
|
|
1324
|
+
if (cmp(array.ord(parent - 1), order) <= 0) break;
|
|
1325
|
+
swap(array, index, parent);
|
|
1326
|
+
index = parent;
|
|
1327
|
+
changed ||= true;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return changed;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
function downHeapify(cmp, array, index, length, stable) {
|
|
1334
|
+
let changed = false;
|
|
1335
|
+
|
|
1336
|
+
while (index < length) {
|
|
1337
|
+
const left = index * 2;
|
|
1338
|
+
const right = index * 2 + 1;
|
|
1339
|
+
let min = index;
|
|
1340
|
+
|
|
1341
|
+
if (left <= length) {
|
|
1342
|
+
const result = cmp(array.ord(left - 1), array.ord(min - 1));
|
|
1343
|
+
|
|
1344
|
+
if (stable ? result <= 0 : result < 0) {
|
|
1345
|
+
min = left;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
if (right <= length) {
|
|
1350
|
+
const result = cmp(array.ord(right - 1), array.ord(min - 1));
|
|
1351
|
+
|
|
1352
|
+
if (stable ? result <= 0 : result < 0) {
|
|
1353
|
+
min = right;
|
|
1354
|
+
}
|
|
1206
1355
|
}
|
|
1207
1356
|
|
|
1208
|
-
if (
|
|
1209
|
-
|
|
1357
|
+
if (min === index) break;
|
|
1358
|
+
swap(array, index, min);
|
|
1359
|
+
index = min;
|
|
1360
|
+
changed ||= true;
|
|
1210
1361
|
}
|
|
1211
1362
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1363
|
+
return changed;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
function swap(array, index1, index2) {
|
|
1367
|
+
array.swap(index1 - 1, index2 - 1);
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
class List {
|
|
1371
|
+
constructor() {
|
|
1372
|
+
this.capacity = 4;
|
|
1373
|
+
this.orders = Array(this.capacity);
|
|
1374
|
+
this.values = Array(this.capacity);
|
|
1375
|
+
this.indexes = new Uint32Array(this.capacity);
|
|
1376
|
+
this.positions = new Uint32Array(this.capacity);
|
|
1377
|
+
this.$length = 0;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
get length() {
|
|
1381
|
+
return this.$length;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
index(pos) {
|
|
1385
|
+
return this.indexes[pos];
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
position(index) {
|
|
1389
|
+
return this.positions[index];
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
ord(pos) {
|
|
1393
|
+
return this.orders[this.indexes[pos]];
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
order(index) {
|
|
1397
|
+
return this.orders[index];
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
value(index) {
|
|
1401
|
+
return this.values[index];
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
isFull() {
|
|
1405
|
+
return this.$length === this.capacity;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
extend() {
|
|
1409
|
+
if (this.capacity === 2 ** 32) throw new Error(`Too large capacity`);
|
|
1410
|
+
const capacity = (0, alias_1.min)(this.capacity * 2, 2 ** 32);
|
|
1411
|
+
this.orders.length = capacity;
|
|
1412
|
+
this.values.length = capacity;
|
|
1413
|
+
const indexes = new Uint32Array(capacity);
|
|
1414
|
+
indexes.set(this.indexes);
|
|
1415
|
+
this.indexes = indexes;
|
|
1416
|
+
const positions = new Uint32Array(capacity);
|
|
1417
|
+
positions.set(this.positions);
|
|
1418
|
+
this.positions = positions;
|
|
1419
|
+
this.capacity = capacity;
|
|
1214
1420
|
}
|
|
1215
1421
|
|
|
1216
1422
|
clear() {
|
|
1217
|
-
this.
|
|
1423
|
+
this.orders = Array(this.capacity);
|
|
1424
|
+
this.values = Array(this.capacity);
|
|
1218
1425
|
this.$length = 0;
|
|
1219
1426
|
}
|
|
1220
1427
|
|
|
1221
|
-
|
|
1428
|
+
setValue(index, value) {
|
|
1429
|
+
this.values[index] = value;
|
|
1430
|
+
}
|
|
1222
1431
|
|
|
1223
|
-
|
|
1432
|
+
setOrder(index, order) {
|
|
1433
|
+
this.orders[index] = order;
|
|
1434
|
+
}
|
|
1224
1435
|
|
|
1225
|
-
|
|
1436
|
+
push(value, order) {
|
|
1437
|
+
this.isFull() && this.extend();
|
|
1438
|
+
const pos = this.$length++;
|
|
1439
|
+
this.indexes[pos] = pos;
|
|
1440
|
+
this.positions[pos] = pos;
|
|
1441
|
+
this.values[pos] = value;
|
|
1442
|
+
this.orders[pos] = order;
|
|
1443
|
+
return pos;
|
|
1444
|
+
}
|
|
1226
1445
|
|
|
1227
|
-
|
|
1446
|
+
pop() {
|
|
1447
|
+
if (this.$length === 0) return;
|
|
1448
|
+
const pos = this.indexes[--this.$length];
|
|
1449
|
+
this.values[pos] = undefined;
|
|
1450
|
+
this.orders[pos] = undefined;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
swap(pos1, pos2) {
|
|
1454
|
+
if (pos1 === pos2) return false;
|
|
1455
|
+
const {
|
|
1456
|
+
indexes,
|
|
1457
|
+
positions
|
|
1458
|
+
} = this;
|
|
1459
|
+
const idx1 = indexes[pos1];
|
|
1460
|
+
const idx2 = indexes[pos2];
|
|
1461
|
+
indexes[pos1] = idx2;
|
|
1462
|
+
indexes[pos2] = idx1;
|
|
1463
|
+
positions[idx1] = pos2;
|
|
1464
|
+
positions[idx2] = pos1;
|
|
1465
|
+
return true;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
*[Symbol.iterator]() {
|
|
1469
|
+
if (this.$length === 0) return;
|
|
1470
|
+
|
|
1471
|
+
for (let i = 0; i < this.$length; ++i) {
|
|
1472
|
+
const index = this.indexes[i];
|
|
1473
|
+
yield [this.orders[index], this.values[index], i];
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
}
|
|
1228
1478
|
|
|
1229
1479
|
class MultiHeap {
|
|
1230
|
-
constructor(cmp = MultiHeap.max,
|
|
1480
|
+
constructor(cmp = MultiHeap.max, options) {
|
|
1231
1481
|
this.cmp = cmp;
|
|
1232
|
-
this.
|
|
1233
|
-
this.heap = new Heap(this.cmp);
|
|
1234
|
-
this.dict = new global_1.Map();
|
|
1482
|
+
this.dict = new Map();
|
|
1235
1483
|
this.list = (0, memoize_1.memoize)(order => {
|
|
1236
1484
|
const list = new invlist_1.List();
|
|
1237
1485
|
list[MultiHeap.order] = order;
|
|
@@ -1239,6 +1487,8 @@ class MultiHeap {
|
|
|
1239
1487
|
return list;
|
|
1240
1488
|
}, this.dict);
|
|
1241
1489
|
this.$length = 0;
|
|
1490
|
+
this.clean = options?.clean ?? true;
|
|
1491
|
+
this.heap = new Heap(this.cmp);
|
|
1242
1492
|
}
|
|
1243
1493
|
|
|
1244
1494
|
get length() {
|
|
@@ -1324,60 +1574,6 @@ MultiHeap.heap = Symbol('heap');
|
|
|
1324
1574
|
MultiHeap.max = Heap.max;
|
|
1325
1575
|
MultiHeap.min = Heap.min;
|
|
1326
1576
|
|
|
1327
|
-
function sort(cmp, array, index, length, stable) {
|
|
1328
|
-
return upHeapify(cmp, array, index + 1) || downHeapify(cmp, array, index + 1, length, stable);
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
function upHeapify(cmp, array, index) {
|
|
1332
|
-
const order = array[index - 1][0];
|
|
1333
|
-
let changed = false;
|
|
1334
|
-
|
|
1335
|
-
while (index > 1) {
|
|
1336
|
-
const parent = index / 2 | 0;
|
|
1337
|
-
if (cmp(array[parent - 1][0], order) <= 0) break;
|
|
1338
|
-
swap(array, index - 1, parent - 1);
|
|
1339
|
-
index = parent;
|
|
1340
|
-
changed ||= true;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
return changed;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
function downHeapify(cmp, array, index, length, stable) {
|
|
1347
|
-
let changed = false;
|
|
1348
|
-
|
|
1349
|
-
while (index < length) {
|
|
1350
|
-
const left = index * 2;
|
|
1351
|
-
const right = index * 2 + 1;
|
|
1352
|
-
let min = index;
|
|
1353
|
-
|
|
1354
|
-
if (left <= length && (stable ? cmp(array[left - 1][0], array[min - 1][0]) <= 0 : cmp(array[left - 1][0], array[min - 1][0]) < 0)) {
|
|
1355
|
-
min = left;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
if (right <= length && (stable ? cmp(array[right - 1][0], array[min - 1][0]) <= 0 : cmp(array[right - 1][0], array[min - 1][0]) < 0)) {
|
|
1359
|
-
min = right;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
if (min === index) break;
|
|
1363
|
-
swap(array, index - 1, min - 1);
|
|
1364
|
-
index = min;
|
|
1365
|
-
changed ||= true;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
return changed;
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
function swap(array, index1, index2) {
|
|
1372
|
-
if (index1 === index2) return;
|
|
1373
|
-
const node1 = array[index1];
|
|
1374
|
-
const node2 = array[index2];
|
|
1375
|
-
node1[2] = index2;
|
|
1376
|
-
node2[2] = index1;
|
|
1377
|
-
array[index1] = node2;
|
|
1378
|
-
array[index2] = node1;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
1577
|
/***/ }),
|
|
1382
1578
|
|
|
1383
1579
|
/***/ 7452:
|
|
@@ -1427,7 +1623,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1427
1623
|
value: true
|
|
1428
1624
|
}));
|
|
1429
1625
|
exports.List = void 0;
|
|
1430
|
-
const undefined = void 0;
|
|
1431
1626
|
|
|
1432
1627
|
class List {
|
|
1433
1628
|
constructor() {
|
|
@@ -1457,7 +1652,8 @@ class List {
|
|
|
1457
1652
|
}
|
|
1458
1653
|
|
|
1459
1654
|
push(value) {
|
|
1460
|
-
|
|
1655
|
+
const head = this.head;
|
|
1656
|
+
return new Node(this, value, head, head?.prev);
|
|
1461
1657
|
}
|
|
1462
1658
|
|
|
1463
1659
|
unshiftNode(node) {
|
|
@@ -1470,7 +1666,7 @@ class List {
|
|
|
1470
1666
|
|
|
1471
1667
|
unshiftRotationally(value) {
|
|
1472
1668
|
const node = this.last;
|
|
1473
|
-
if (
|
|
1669
|
+
if (node === undefined) return this.unshift(value);
|
|
1474
1670
|
node.value = value;
|
|
1475
1671
|
this.head = node;
|
|
1476
1672
|
return node;
|
|
@@ -1478,7 +1674,7 @@ class List {
|
|
|
1478
1674
|
|
|
1479
1675
|
pushRotationally(value) {
|
|
1480
1676
|
const node = this.head;
|
|
1481
|
-
if (
|
|
1677
|
+
if (node === undefined) return this.push(value);
|
|
1482
1678
|
node.value = value;
|
|
1483
1679
|
this.head = node.next;
|
|
1484
1680
|
return node;
|
|
@@ -1493,10 +1689,12 @@ class List {
|
|
|
1493
1689
|
}
|
|
1494
1690
|
|
|
1495
1691
|
insert(node, before = this.head) {
|
|
1496
|
-
if (node.list === this) return node.
|
|
1692
|
+
if (node.list === this) return node.move(before), node;
|
|
1497
1693
|
node.delete();
|
|
1498
|
-
|
|
1499
|
-
this
|
|
1694
|
+
|
|
1695
|
+
if (this.$length++ === 0) {
|
|
1696
|
+
this.head = node;
|
|
1697
|
+
}
|
|
1500
1698
|
|
|
1501
1699
|
node.list = this;
|
|
1502
1700
|
const next = node.next = before ?? node;
|
|
@@ -1538,7 +1736,9 @@ class List {
|
|
|
1538
1736
|
}
|
|
1539
1737
|
|
|
1540
1738
|
*[Symbol.iterator]() {
|
|
1541
|
-
|
|
1739
|
+
const head = this.head;
|
|
1740
|
+
|
|
1741
|
+
for (let node = head; node;) {
|
|
1542
1742
|
yield node.value;
|
|
1543
1743
|
node = node.next;
|
|
1544
1744
|
if (node === head) return;
|
|
@@ -1555,35 +1755,40 @@ class Node {
|
|
|
1555
1755
|
this.value = value;
|
|
1556
1756
|
this.next = next;
|
|
1557
1757
|
this.prev = prev;
|
|
1558
|
-
++list.$length;
|
|
1559
1758
|
list.head ??= this;
|
|
1560
|
-
|
|
1759
|
+
|
|
1760
|
+
if (list['$length']++ === 0) {
|
|
1761
|
+
this.next = this.prev = this;
|
|
1762
|
+
} else {
|
|
1763
|
+
next.prev = prev.next = this;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
get alive() {
|
|
1768
|
+
return this.list !== undefined;
|
|
1561
1769
|
}
|
|
1562
1770
|
|
|
1563
1771
|
delete() {
|
|
1564
|
-
|
|
1565
|
-
|
|
1772
|
+
const list = this.list;
|
|
1773
|
+
if (list === undefined) return this.value;
|
|
1566
1774
|
const {
|
|
1567
1775
|
next,
|
|
1568
1776
|
prev
|
|
1569
1777
|
} = this;
|
|
1570
1778
|
|
|
1571
|
-
if (
|
|
1572
|
-
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
if (next) {
|
|
1779
|
+
if (--list['$length'] === 0) {
|
|
1780
|
+
list.head = undefined;
|
|
1781
|
+
} else {
|
|
1576
1782
|
next.prev = prev;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
if (prev) {
|
|
1580
1783
|
prev.next = next;
|
|
1581
|
-
} // @ts-expect-error
|
|
1582
1784
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1785
|
+
if (this === list.head) {
|
|
1786
|
+
list.head = next;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1585
1789
|
|
|
1586
1790
|
this.next = this.prev = undefined;
|
|
1791
|
+
this.list = undefined;
|
|
1587
1792
|
return this.value;
|
|
1588
1793
|
}
|
|
1589
1794
|
|
|
@@ -1595,8 +1800,8 @@ class Node {
|
|
|
1595
1800
|
return new Node(this.list, value, this.next, this);
|
|
1596
1801
|
}
|
|
1597
1802
|
|
|
1598
|
-
|
|
1599
|
-
if (
|
|
1803
|
+
move(before) {
|
|
1804
|
+
if (before === undefined) return false;
|
|
1600
1805
|
if (this === before) return false;
|
|
1601
1806
|
if (before.list !== this.list) return before.list.insert(this, before), true;
|
|
1602
1807
|
const a1 = this;
|
|
@@ -1615,12 +1820,12 @@ class Node {
|
|
|
1615
1820
|
}
|
|
1616
1821
|
|
|
1617
1822
|
moveToHead() {
|
|
1618
|
-
this.
|
|
1823
|
+
this.move(this.list.head);
|
|
1619
1824
|
this.list.head = this;
|
|
1620
1825
|
}
|
|
1621
1826
|
|
|
1622
1827
|
moveToLast() {
|
|
1623
|
-
this.
|
|
1828
|
+
this.move(this.list.head);
|
|
1624
1829
|
}
|
|
1625
1830
|
|
|
1626
1831
|
swap(node) {
|
|
@@ -1629,8 +1834,8 @@ class Node {
|
|
|
1629
1834
|
if (node1 === node2) return false;
|
|
1630
1835
|
const node3 = node2.next;
|
|
1631
1836
|
if (node1.list !== node2.list) throw new Error(`Spica: InvList: Cannot swap nodes across lists.`);
|
|
1632
|
-
node2.
|
|
1633
|
-
node1.
|
|
1837
|
+
node2.move(node1);
|
|
1838
|
+
node1.move(node3);
|
|
1634
1839
|
|
|
1635
1840
|
switch (this.list.head) {
|
|
1636
1841
|
case node1:
|
|
@@ -1660,17 +1865,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1660
1865
|
}));
|
|
1661
1866
|
exports.reduce = exports.memoize = void 0;
|
|
1662
1867
|
|
|
1663
|
-
const global_1 = __webpack_require__(4128);
|
|
1664
|
-
|
|
1665
1868
|
const alias_1 = __webpack_require__(5406);
|
|
1666
1869
|
|
|
1667
1870
|
const compare_1 = __webpack_require__(5529);
|
|
1668
1871
|
|
|
1669
|
-
const undefined = void 0;
|
|
1670
|
-
|
|
1671
1872
|
function memoize(f, identify = (...as) => as[0], memory) {
|
|
1672
1873
|
if (typeof identify === 'object') return memoize(f, undefined, identify);
|
|
1673
|
-
return (0, alias_1.isArray)(memory) ? memoizeArray(f, identify, memory) : memoizeObject(f, identify, memory ?? new
|
|
1874
|
+
return (0, alias_1.isArray)(memory) ? memoizeArray(f, identify, memory) : memoizeObject(f, identify, memory ?? new Map());
|
|
1674
1875
|
}
|
|
1675
1876
|
|
|
1676
1877
|
exports.memoize = memoize;
|
|
@@ -1731,13 +1932,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1731
1932
|
}));
|
|
1732
1933
|
exports.MultiQueue = exports.PriorityQueue = exports.Queue = void 0;
|
|
1733
1934
|
|
|
1734
|
-
const global_1 = __webpack_require__(4128);
|
|
1735
|
-
|
|
1736
1935
|
const heap_1 = __webpack_require__(818);
|
|
1737
1936
|
|
|
1738
1937
|
const memoize_1 = __webpack_require__(1808);
|
|
1739
1938
|
|
|
1740
|
-
const undefined = void 0;
|
|
1741
1939
|
const size = 2048;
|
|
1742
1940
|
const initsize = 16;
|
|
1743
1941
|
|
|
@@ -1818,7 +2016,7 @@ exports.Queue = Queue;
|
|
|
1818
2016
|
class FixedQueue {
|
|
1819
2017
|
constructor(size, next) {
|
|
1820
2018
|
this.size = size;
|
|
1821
|
-
this.array =
|
|
2019
|
+
this.array = Array(this.size);
|
|
1822
2020
|
this.mask = this.array.length - 1;
|
|
1823
2021
|
this.head = 0;
|
|
1824
2022
|
this.tail = 0;
|
|
@@ -1859,7 +2057,7 @@ class FixedQueue {
|
|
|
1859
2057
|
class PriorityQueue {
|
|
1860
2058
|
constructor(cmp = PriorityQueue.max, clean = true) {
|
|
1861
2059
|
this.clean = clean;
|
|
1862
|
-
this.dict = new
|
|
2060
|
+
this.dict = new Map();
|
|
1863
2061
|
this.queue = (0, memoize_1.memoize)(priority => {
|
|
1864
2062
|
const queue = new Queue();
|
|
1865
2063
|
queue[PriorityQueue.priority] = priority;
|
|
@@ -1924,7 +2122,7 @@ PriorityQueue.min = heap_1.Heap.min;
|
|
|
1924
2122
|
|
|
1925
2123
|
class MultiQueue {
|
|
1926
2124
|
constructor(entries) {
|
|
1927
|
-
this.dict = new
|
|
2125
|
+
this.dict = new Map();
|
|
1928
2126
|
if (entries) for (const {
|
|
1929
2127
|
0: k,
|
|
1930
2128
|
1: v
|
|
@@ -1958,11 +2156,11 @@ class MultiQueue {
|
|
|
1958
2156
|
}
|
|
1959
2157
|
|
|
1960
2158
|
clear() {
|
|
1961
|
-
this.dict = new
|
|
2159
|
+
this.dict = new Map();
|
|
1962
2160
|
}
|
|
1963
2161
|
|
|
1964
2162
|
take(key, count) {
|
|
1965
|
-
if (count ===
|
|
2163
|
+
if (count === undefined) return this.pop(key);
|
|
1966
2164
|
const vs = this.dict.get(key);
|
|
1967
2165
|
const acc = [];
|
|
1968
2166
|
|
|
@@ -2022,7 +2220,7 @@ exports.MultiQueue = MultiQueue;
|
|
|
2022
2220
|
/***/ }),
|
|
2023
2221
|
|
|
2024
2222
|
/***/ 7325:
|
|
2025
|
-
/***/ ((__unused_webpack_module, exports
|
|
2223
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2026
2224
|
|
|
2027
2225
|
"use strict";
|
|
2028
2226
|
|
|
@@ -2030,10 +2228,7 @@ exports.MultiQueue = MultiQueue;
|
|
|
2030
2228
|
Object.defineProperty(exports, "__esModule", ({
|
|
2031
2229
|
value: true
|
|
2032
2230
|
}));
|
|
2033
|
-
exports.unique = exports.rndAf = exports.rndAP = exports.rnd0_ = exports.rnd0Z = exports.rnd0v = exports.rnd0f = exports.rnd64 = exports.rnd62 = exports.rnd32 = exports.rnd16 = void 0;
|
|
2034
|
-
|
|
2035
|
-
const global_1 = __webpack_require__(4128);
|
|
2036
|
-
|
|
2231
|
+
exports.pcg32 = exports.xorshift = exports.unique = exports.rndAf = exports.rndAP = exports.rnd0_ = exports.rnd0Z = exports.rnd0v = exports.rnd0f = exports.rnd64 = exports.rnd62 = exports.rnd32 = exports.rnd16 = void 0;
|
|
2037
2232
|
const radixes = Object.freeze([...Array(7)].map((_, i) => 1 << i));
|
|
2038
2233
|
const masks = Object.freeze(radixes.map(radix => radix - 1));
|
|
2039
2234
|
const dict0_ = [...[...Array(36)].map((_, i) => i.toString(36)), ...[...Array(36)].map((_, i) => i.toString(36).toUpperCase()).slice(-26), '-', '_'].join('');
|
|
@@ -2051,7 +2246,7 @@ exports.rndAf = conv(exports.rnd32, dictAz);
|
|
|
2051
2246
|
|
|
2052
2247
|
function unique(rnd, len = 1, mem) {
|
|
2053
2248
|
const independence = !mem;
|
|
2054
|
-
mem ??= new
|
|
2249
|
+
mem ??= new Set();
|
|
2055
2250
|
const trials = 3;
|
|
2056
2251
|
let prefixes;
|
|
2057
2252
|
let prefix = '';
|
|
@@ -2065,7 +2260,7 @@ function unique(rnd, len = 1, mem) {
|
|
|
2065
2260
|
} catch (reason) {
|
|
2066
2261
|
// ベンチマーク程度でもSetがパンクする場合がある。
|
|
2067
2262
|
if (!independence) throw reason;
|
|
2068
|
-
prefixes ??= new
|
|
2263
|
+
prefixes ??= new Set();
|
|
2069
2264
|
prefix ||= '?';
|
|
2070
2265
|
|
|
2071
2266
|
for (let i = 0; i < trials; ++i) {
|
|
@@ -2076,7 +2271,7 @@ function unique(rnd, len = 1, mem) {
|
|
|
2076
2271
|
return random();
|
|
2077
2272
|
}
|
|
2078
2273
|
|
|
2079
|
-
prefixes = new
|
|
2274
|
+
prefixes = new Set();
|
|
2080
2275
|
prefix += '?';
|
|
2081
2276
|
return random();
|
|
2082
2277
|
}
|
|
@@ -2114,28 +2309,177 @@ function conv(rnd, dict) {
|
|
|
2114
2309
|
|
|
2115
2310
|
const buffer = new Uint16Array(512);
|
|
2116
2311
|
const digit = 16;
|
|
2117
|
-
let index =
|
|
2118
|
-
let
|
|
2312
|
+
let index = 0;
|
|
2313
|
+
let buf = 0;
|
|
2314
|
+
let offset = 0;
|
|
2119
2315
|
|
|
2120
2316
|
function random(len) {
|
|
2121
|
-
if (
|
|
2122
|
-
|
|
2123
|
-
|
|
2317
|
+
if (offset < len) {
|
|
2318
|
+
if (index === 0) {
|
|
2319
|
+
crypto.getRandomValues(buffer);
|
|
2320
|
+
index = buffer.length - 1;
|
|
2321
|
+
buf = buffer[index];
|
|
2322
|
+
offset = digit;
|
|
2323
|
+
} else {
|
|
2324
|
+
buf = buf << digit | buffer[--index];
|
|
2325
|
+
offset += digit;
|
|
2326
|
+
}
|
|
2124
2327
|
}
|
|
2125
2328
|
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2329
|
+
offset -= len;
|
|
2330
|
+
return buf >> offset & masks[len];
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
function xorshift(seed = xorshift.seed()) {
|
|
2334
|
+
return () => {
|
|
2335
|
+
let x = seed;
|
|
2336
|
+
x ^= x << 13;
|
|
2337
|
+
x ^= x >> 17;
|
|
2338
|
+
x ^= x << 5;
|
|
2339
|
+
return seed = x >>> 0;
|
|
2340
|
+
};
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
exports.xorshift = xorshift;
|
|
2344
|
+
|
|
2345
|
+
(function (xorshift) {
|
|
2346
|
+
const max = -1 >>> 0;
|
|
2347
|
+
|
|
2348
|
+
function seed() {
|
|
2349
|
+
return Math.random() * max + 1 >>> 0;
|
|
2136
2350
|
}
|
|
2351
|
+
|
|
2352
|
+
xorshift.seed = seed;
|
|
2353
|
+
|
|
2354
|
+
function random(seed) {
|
|
2355
|
+
const rnd = xorshift(seed);
|
|
2356
|
+
return () => rnd() / (max + 1);
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
xorshift.random = random;
|
|
2360
|
+
})(xorshift = exports.xorshift || (exports.xorshift = {}));
|
|
2361
|
+
|
|
2362
|
+
const uint32n = n => n & 2n ** 32n - 1n;
|
|
2363
|
+
|
|
2364
|
+
const uint64n = n => n & 2n ** 64n - 1n; // https://www.pcg-random.org/download.html
|
|
2365
|
+
// https://github.com/imneme/pcg-c/blob/master/include/pcg_variants.h
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
function pcg32(seed = pcg32.seed()) {
|
|
2369
|
+
return () => pcg32.next(seed);
|
|
2137
2370
|
}
|
|
2138
2371
|
|
|
2372
|
+
exports.pcg32 = pcg32;
|
|
2373
|
+
|
|
2374
|
+
(function (pcg32) {
|
|
2375
|
+
const MULT = 6364136223846793005n;
|
|
2376
|
+
|
|
2377
|
+
function random(seed) {
|
|
2378
|
+
const rnd = pcg32(seed);
|
|
2379
|
+
return () => rnd() / 2 ** 32;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
pcg32.random = random;
|
|
2383
|
+
|
|
2384
|
+
function seed(state = BigInt(xorshift.seed()) << 32n | BigInt(xorshift.seed()), inc = BigInt(xorshift.seed()) << 32n | BigInt(xorshift.seed())) {
|
|
2385
|
+
const seed = [0n, uint64n(inc << 1n | 1n)];
|
|
2386
|
+
seed[0] = uint64n(seed[0] * MULT + seed[1]);
|
|
2387
|
+
seed[0] = uint64n(seed[0] + state);
|
|
2388
|
+
seed[0] = uint64n(seed[0] * MULT + seed[1]);
|
|
2389
|
+
return seed;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
pcg32.seed = seed;
|
|
2393
|
+
|
|
2394
|
+
function next(seed) {
|
|
2395
|
+
const oldstate = seed[0];
|
|
2396
|
+
seed[0] = uint64n(oldstate * MULT + seed[1]);
|
|
2397
|
+
const xorshifted = uint32n((oldstate >> 18n ^ oldstate) >> 27n);
|
|
2398
|
+
const rot = oldstate >> 59n;
|
|
2399
|
+
return Number(uint32n(xorshifted >> rot | xorshifted << (-rot & 31n)));
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
pcg32.next = next;
|
|
2403
|
+
|
|
2404
|
+
function advance(seed, delta) {
|
|
2405
|
+
delta = uint64n(delta);
|
|
2406
|
+
let acc_mult = 1n;
|
|
2407
|
+
let acc_plus = 0n;
|
|
2408
|
+
let cur_mult = MULT;
|
|
2409
|
+
let cur_plus = seed[1];
|
|
2410
|
+
|
|
2411
|
+
while (delta > 0) {
|
|
2412
|
+
if (delta & 1n) {
|
|
2413
|
+
acc_mult = uint64n(acc_mult * cur_mult);
|
|
2414
|
+
acc_plus = uint64n(acc_plus * cur_mult + cur_plus);
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
cur_plus = uint64n((cur_mult + 1n) * cur_plus);
|
|
2418
|
+
cur_mult = uint64n(cur_mult * cur_mult);
|
|
2419
|
+
delta /= 2n;
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
seed[0] = uint64n(acc_mult * seed[0] + acc_plus);
|
|
2423
|
+
return seed;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
pcg32.advance = advance;
|
|
2427
|
+
})(pcg32 = exports.pcg32 || (exports.pcg32 = {}));
|
|
2428
|
+
|
|
2429
|
+
/***/ }),
|
|
2430
|
+
|
|
2431
|
+
/***/ 5352:
|
|
2432
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2433
|
+
|
|
2434
|
+
"use strict";
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2438
|
+
value: true
|
|
2439
|
+
}));
|
|
2440
|
+
exports.Stack = void 0;
|
|
2441
|
+
|
|
2442
|
+
class Stack {
|
|
2443
|
+
constructor() {
|
|
2444
|
+
this.array = [];
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
get length() {
|
|
2448
|
+
return this.array.length;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
isEmpty() {
|
|
2452
|
+
return this.length === 0;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
peek(index = 0) {
|
|
2456
|
+
return index === 0 ? this.array[this.array.length - 1] : this.array[0];
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
push(value) {
|
|
2460
|
+
this.array.push(value);
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
pop() {
|
|
2464
|
+
return this.array.pop();
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
clear() {
|
|
2468
|
+
this.array = [];
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
*[Symbol.iterator]() {
|
|
2472
|
+
while (!this.isEmpty()) {
|
|
2473
|
+
yield this.pop();
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
exports.Stack = Stack;
|
|
2482
|
+
|
|
2139
2483
|
/***/ }),
|
|
2140
2484
|
|
|
2141
2485
|
/***/ 5177:
|
|
@@ -2149,8 +2493,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2149
2493
|
}));
|
|
2150
2494
|
exports.isPrimitive = exports.is = exports.type = void 0;
|
|
2151
2495
|
|
|
2152
|
-
const global_1 = __webpack_require__(4128);
|
|
2153
|
-
|
|
2154
2496
|
const alias_1 = __webpack_require__(5406);
|
|
2155
2497
|
|
|
2156
2498
|
const ObjectPrototype = Object.prototype;
|
|
@@ -2165,7 +2507,7 @@ function type(value) {
|
|
|
2165
2507
|
|
|
2166
2508
|
case 'object':
|
|
2167
2509
|
if (value === null) return 'null';
|
|
2168
|
-
const tag = value[
|
|
2510
|
+
const tag = value[Symbol.toStringTag];
|
|
2169
2511
|
if (tag) return tag;
|
|
2170
2512
|
|
|
2171
2513
|
switch ((0, alias_1.ObjectGetPrototypeOf)(value)) {
|
|
@@ -2176,7 +2518,7 @@ function type(value) {
|
|
|
2176
2518
|
return 'Object';
|
|
2177
2519
|
|
|
2178
2520
|
default:
|
|
2179
|
-
return (0, alias_1.toString)(value).slice(8, -1);
|
|
2521
|
+
return value?.constructor?.name || (0, alias_1.toString)(value).slice(8, -1);
|
|
2180
2522
|
}
|
|
2181
2523
|
|
|
2182
2524
|
default:
|
|
@@ -2232,8 +2574,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2232
2574
|
}));
|
|
2233
2575
|
exports.URL = exports.ReadonlyURL = exports.standardize = void 0;
|
|
2234
2576
|
|
|
2235
|
-
const global_1 = __webpack_require__(4128);
|
|
2236
|
-
|
|
2237
2577
|
const format_1 = __webpack_require__(137);
|
|
2238
2578
|
|
|
2239
2579
|
var format_2 = __webpack_require__(137);
|
|
@@ -2326,7 +2666,7 @@ class URL {
|
|
|
2326
2666
|
}
|
|
2327
2667
|
|
|
2328
2668
|
get searchParams() {
|
|
2329
|
-
return this.params ??= new
|
|
2669
|
+
return this.params ??= new URLSearchParams(this.search);
|
|
2330
2670
|
}
|
|
2331
2671
|
|
|
2332
2672
|
toString() {
|
|
@@ -2354,7 +2694,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2354
2694
|
}));
|
|
2355
2695
|
exports.ReadonlyURL = exports._encode = exports.standardize = void 0;
|
|
2356
2696
|
|
|
2357
|
-
|
|
2697
|
+
__webpack_require__(4128);
|
|
2358
2698
|
|
|
2359
2699
|
const memoize_1 = __webpack_require__(1808);
|
|
2360
2700
|
|
|
@@ -2370,7 +2710,7 @@ exports.standardize = standardize;
|
|
|
2370
2710
|
|
|
2371
2711
|
function encode(url) {
|
|
2372
2712
|
return url // Percent-encoding
|
|
2373
|
-
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, str => str.length === 2 ? str : '').replace(/%(?![0-9A-F]{2})|[^%\[\]]+/ig,
|
|
2713
|
+
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, str => str.length === 2 ? str : '').replace(/%(?![0-9A-F]{2})|[^%\[\]]+/ig, encodeURI).replace(/\?[^#]+/, query => '?' + query.slice(1).replace(/%[0-9A-F]{2}|%|[^=&]+/ig, str => str[0] === '%' && str.length === 3 ? str : encodeURIComponent(str))) // Use uppercase letters within percent-encoding triplets
|
|
2374
2714
|
.replace(/%[0-9A-F]{2}/ig, str => str.toUpperCase()).replace(/#.+/, url.slice(url.indexOf('#')));
|
|
2375
2715
|
}
|
|
2376
2716
|
|
|
@@ -2384,7 +2724,7 @@ class ReadonlyURL {
|
|
|
2384
2724
|
switch (source.slice(0, source.lastIndexOf('://', 9) + 1).toLowerCase()) {
|
|
2385
2725
|
case 'http:':
|
|
2386
2726
|
case 'https:':
|
|
2387
|
-
base =
|
|
2727
|
+
base = undefined;
|
|
2388
2728
|
break;
|
|
2389
2729
|
|
|
2390
2730
|
default:
|
|
@@ -2471,7 +2811,7 @@ class ReadonlyURL {
|
|
|
2471
2811
|
}
|
|
2472
2812
|
|
|
2473
2813
|
get searchParams() {
|
|
2474
|
-
return this.params ??= new
|
|
2814
|
+
return this.params ??= new URLSearchParams(this.search);
|
|
2475
2815
|
}
|
|
2476
2816
|
|
|
2477
2817
|
toString() {
|
|
@@ -2490,7 +2830,7 @@ exports.ReadonlyURL = ReadonlyURL; // Can't freeze URL object in the Firefox ext
|
|
|
2490
2830
|
// @ts-ignore
|
|
2491
2831
|
|
|
2492
2832
|
ReadonlyURL.get = (0, memoize_1.memoize)((url, base) => ({
|
|
2493
|
-
url: new
|
|
2833
|
+
url: new __webpack_require__.g.URL(url, base)
|
|
2494
2834
|
}), (url, base = '') => `${base.indexOf('\n') > -1 ? base.replace(/\n+/g, '') : base}\n${url}`, new cache_1.Cache(10000));
|
|
2495
2835
|
|
|
2496
2836
|
/***/ }),
|
|
@@ -2589,8 +2929,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2589
2929
|
}));
|
|
2590
2930
|
exports.block = void 0;
|
|
2591
2931
|
|
|
2592
|
-
const global_1 = __webpack_require__(4128);
|
|
2593
|
-
|
|
2594
2932
|
const parser_1 = __webpack_require__(6728);
|
|
2595
2933
|
|
|
2596
2934
|
const memo_1 = __webpack_require__(1090);
|
|
@@ -2608,10 +2946,10 @@ function block(parser, separation = true) {
|
|
|
2608
2946
|
source,
|
|
2609
2947
|
context
|
|
2610
2948
|
});
|
|
2611
|
-
if (
|
|
2949
|
+
if (result === undefined) return;
|
|
2612
2950
|
const rest = (0, parser_1.exec)(result);
|
|
2613
2951
|
if (separation && !(0, line_1.isEmpty)((0, line_1.firstline)(rest))) return;
|
|
2614
|
-
return rest === '' || source[source.length - rest.length - 1] === '\n' ? result :
|
|
2952
|
+
return rest === '' || source[source.length - rest.length - 1] === '\n' ? result : undefined;
|
|
2615
2953
|
};
|
|
2616
2954
|
}
|
|
2617
2955
|
|
|
@@ -2630,7 +2968,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2630
2968
|
}));
|
|
2631
2969
|
exports.verify = exports.validate = void 0;
|
|
2632
2970
|
|
|
2633
|
-
|
|
2971
|
+
__webpack_require__(4128);
|
|
2634
2972
|
|
|
2635
2973
|
const alias_1 = __webpack_require__(5406);
|
|
2636
2974
|
|
|
@@ -2639,7 +2977,7 @@ const parser_1 = __webpack_require__(6728);
|
|
|
2639
2977
|
function validate(patterns, has, parser) {
|
|
2640
2978
|
if (typeof has === 'function') return validate(patterns, '', has);
|
|
2641
2979
|
if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, parser);
|
|
2642
|
-
const match =
|
|
2980
|
+
const match = __webpack_require__.g.eval(['source =>', patterns.map(pattern => typeof pattern === 'string' ? `|| source.slice(0, ${pattern.length}) === '${pattern}'` : `|| /${pattern.source}/${pattern.flags}.test(source)`).join('').slice(2)].join(''));
|
|
2643
2981
|
return ({
|
|
2644
2982
|
source,
|
|
2645
2983
|
context
|
|
@@ -2650,8 +2988,8 @@ function validate(patterns, has, parser) {
|
|
|
2650
2988
|
source,
|
|
2651
2989
|
context
|
|
2652
2990
|
});
|
|
2653
|
-
if (
|
|
2654
|
-
return (0, parser_1.exec)(result).length < source.length ? result :
|
|
2991
|
+
if (result === undefined) return;
|
|
2992
|
+
return (0, parser_1.exec)(result).length < source.length ? result : undefined;
|
|
2655
2993
|
};
|
|
2656
2994
|
}
|
|
2657
2995
|
|
|
@@ -2667,9 +3005,9 @@ function verify(parser, cond) {
|
|
|
2667
3005
|
source,
|
|
2668
3006
|
context
|
|
2669
3007
|
});
|
|
2670
|
-
if (
|
|
3008
|
+
if (result === undefined) return;
|
|
2671
3009
|
if (!cond((0, parser_1.eval)(result), (0, parser_1.exec)(result), context)) return;
|
|
2672
|
-
return (0, parser_1.exec)(result).length < source.length ? result :
|
|
3010
|
+
return (0, parser_1.exec)(result).length < source.length ? result : undefined;
|
|
2673
3011
|
};
|
|
2674
3012
|
}
|
|
2675
3013
|
|
|
@@ -2688,8 +3026,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2688
3026
|
}));
|
|
2689
3027
|
exports.isEmpty = exports.firstline = exports.line = void 0;
|
|
2690
3028
|
|
|
2691
|
-
const global_1 = __webpack_require__(4128);
|
|
2692
|
-
|
|
2693
3029
|
const parser_1 = __webpack_require__(6728);
|
|
2694
3030
|
|
|
2695
3031
|
const memo_1 = __webpack_require__(1090);
|
|
@@ -2709,8 +3045,8 @@ function line(parser) {
|
|
|
2709
3045
|
context
|
|
2710
3046
|
});
|
|
2711
3047
|
context.offset -= source.length - line.length;
|
|
2712
|
-
if (
|
|
2713
|
-
return isEmpty((0, parser_1.exec)(result)) ? [(0, parser_1.eval)(result), source.slice(line.length)] :
|
|
3048
|
+
if (result === undefined) return;
|
|
3049
|
+
return isEmpty((0, parser_1.exec)(result)) ? [(0, parser_1.eval)(result), source.slice(line.length)] : undefined;
|
|
2714
3050
|
};
|
|
2715
3051
|
}
|
|
2716
3052
|
|
|
@@ -2760,7 +3096,7 @@ function convert(conv, parser) {
|
|
|
2760
3096
|
context
|
|
2761
3097
|
}) => {
|
|
2762
3098
|
if (source === '') return;
|
|
2763
|
-
const src = conv(source);
|
|
3099
|
+
const src = conv(source, context);
|
|
2764
3100
|
if (src === '') return [[], ''];
|
|
2765
3101
|
context.offset ??= 0;
|
|
2766
3102
|
context.offset += source.length - src.length;
|
|
@@ -2901,8 +3237,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2901
3237
|
}));
|
|
2902
3238
|
exports.indent = void 0;
|
|
2903
3239
|
|
|
2904
|
-
const global_1 = __webpack_require__(4128);
|
|
2905
|
-
|
|
2906
3240
|
const parser_1 = __webpack_require__(6728);
|
|
2907
3241
|
|
|
2908
3242
|
const some_1 = __webpack_require__(5418);
|
|
@@ -2931,7 +3265,7 @@ function indent(opener, parser, separation = false) {
|
|
|
2931
3265
|
context
|
|
2932
3266
|
});
|
|
2933
3267
|
context.offset -= rest.length;
|
|
2934
|
-
return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] :
|
|
3268
|
+
return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : undefined;
|
|
2935
3269
|
});
|
|
2936
3270
|
}
|
|
2937
3271
|
|
|
@@ -2974,8 +3308,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2974
3308
|
}));
|
|
2975
3309
|
exports.match = void 0;
|
|
2976
3310
|
|
|
2977
|
-
const global_1 = __webpack_require__(4128);
|
|
2978
|
-
|
|
2979
3311
|
const parser_1 = __webpack_require__(6728);
|
|
2980
3312
|
|
|
2981
3313
|
function match(pattern, f) {
|
|
@@ -2990,8 +3322,8 @@ function match(pattern, f) {
|
|
|
2990
3322
|
source,
|
|
2991
3323
|
context
|
|
2992
3324
|
});
|
|
2993
|
-
if (
|
|
2994
|
-
return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result :
|
|
3325
|
+
if (result === undefined) return;
|
|
3326
|
+
return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result : undefined;
|
|
2995
3327
|
};
|
|
2996
3328
|
}
|
|
2997
3329
|
|
|
@@ -3056,8 +3388,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3056
3388
|
}));
|
|
3057
3389
|
exports.rewrite = exports.focus = void 0;
|
|
3058
3390
|
|
|
3059
|
-
const global_1 = __webpack_require__(4128);
|
|
3060
|
-
|
|
3061
3391
|
const parser_1 = __webpack_require__(6728);
|
|
3062
3392
|
|
|
3063
3393
|
function focus(scope, parser) {
|
|
@@ -3076,8 +3406,8 @@ function focus(scope, parser) {
|
|
|
3076
3406
|
context
|
|
3077
3407
|
});
|
|
3078
3408
|
context.offset -= source.length - src.length;
|
|
3079
|
-
if (
|
|
3080
|
-
return (0, parser_1.exec)(result).length < src.length ? [(0, parser_1.eval)(result), (0, parser_1.exec)(result) + source.slice(src.length)] :
|
|
3409
|
+
if (result === undefined) return;
|
|
3410
|
+
return (0, parser_1.exec)(result).length < src.length ? [(0, parser_1.eval)(result), (0, parser_1.exec)(result) + source.slice(src.length)] : undefined;
|
|
3081
3411
|
};
|
|
3082
3412
|
}
|
|
3083
3413
|
|
|
@@ -3090,13 +3420,13 @@ function rewrite(scope, parser) {
|
|
|
3090
3420
|
}) => {
|
|
3091
3421
|
if (source === '') return;
|
|
3092
3422
|
const memo = context.memo;
|
|
3093
|
-
context.memo =
|
|
3423
|
+
context.memo = undefined;
|
|
3094
3424
|
const res1 = scope({
|
|
3095
3425
|
source,
|
|
3096
3426
|
context
|
|
3097
3427
|
});
|
|
3098
3428
|
context.memo = memo;
|
|
3099
|
-
if (
|
|
3429
|
+
if (res1 === undefined || (0, parser_1.exec)(res1).length >= source.length) return;
|
|
3100
3430
|
const src = source.slice(0, source.length - (0, parser_1.exec)(res1).length);
|
|
3101
3431
|
context.offset ??= 0;
|
|
3102
3432
|
context.offset += source.length - src.length;
|
|
@@ -3105,8 +3435,8 @@ function rewrite(scope, parser) {
|
|
|
3105
3435
|
context
|
|
3106
3436
|
});
|
|
3107
3437
|
context.offset -= source.length - src.length;
|
|
3108
|
-
if (
|
|
3109
|
-
return (0, parser_1.exec)(res2).length < src.length ? [(0, parser_1.eval)(res2), (0, parser_1.exec)(res2) + (0, parser_1.exec)(res1)] :
|
|
3438
|
+
if (res2 === undefined) return;
|
|
3439
|
+
return (0, parser_1.exec)(res2).length < src.length ? [(0, parser_1.eval)(res2), (0, parser_1.exec)(res2) + (0, parser_1.exec)(res1)] : undefined;
|
|
3110
3440
|
};
|
|
3111
3441
|
}
|
|
3112
3442
|
|
|
@@ -3125,8 +3455,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3125
3455
|
}));
|
|
3126
3456
|
exports.clear = exports.close = exports.open = exports.surround = void 0;
|
|
3127
3457
|
|
|
3128
|
-
const global_1 = __webpack_require__(4128);
|
|
3129
|
-
|
|
3130
3458
|
const parser_1 = __webpack_require__(6728);
|
|
3131
3459
|
|
|
3132
3460
|
const fmap_1 = __webpack_require__(502);
|
|
@@ -3156,13 +3484,13 @@ function surround(opener, parser, closer, optional = false, f, g) {
|
|
|
3156
3484
|
source: lmr_,
|
|
3157
3485
|
context
|
|
3158
3486
|
});
|
|
3159
|
-
if (
|
|
3487
|
+
if (res1 === undefined) return;
|
|
3160
3488
|
const rl = (0, parser_1.eval)(res1);
|
|
3161
3489
|
const mr_ = (0, parser_1.exec)(res1);
|
|
3162
3490
|
const res2 = mr_ !== '' ? parser({
|
|
3163
3491
|
source: mr_,
|
|
3164
3492
|
context
|
|
3165
|
-
}) :
|
|
3493
|
+
}) : undefined;
|
|
3166
3494
|
const rm = (0, parser_1.eval)(res2);
|
|
3167
3495
|
const r_ = (0, parser_1.exec)(res2, mr_);
|
|
3168
3496
|
if (!rm && !optional) return;
|
|
@@ -3173,7 +3501,7 @@ function surround(opener, parser, closer, optional = false, f, g) {
|
|
|
3173
3501
|
const rr = (0, parser_1.eval)(res3);
|
|
3174
3502
|
const rest = (0, parser_1.exec)(res3, r_);
|
|
3175
3503
|
if (rest.length === lmr_.length) return;
|
|
3176
|
-
return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm, mr_], rest, context) :
|
|
3504
|
+
return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm, mr_], rest, context) : undefined;
|
|
3177
3505
|
};
|
|
3178
3506
|
}
|
|
3179
3507
|
|
|
@@ -3184,14 +3512,14 @@ function match(pattern) {
|
|
|
3184
3512
|
case 'string':
|
|
3185
3513
|
return ({
|
|
3186
3514
|
source
|
|
3187
|
-
}) => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] :
|
|
3515
|
+
}) => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] : undefined;
|
|
3188
3516
|
|
|
3189
3517
|
case 'object':
|
|
3190
3518
|
return ({
|
|
3191
3519
|
source
|
|
3192
3520
|
}) => {
|
|
3193
3521
|
const m = source.match(pattern);
|
|
3194
|
-
return m ? [[], source.slice(m[0].length)] :
|
|
3522
|
+
return m ? [[], source.slice(m[0].length)] : undefined;
|
|
3195
3523
|
};
|
|
3196
3524
|
}
|
|
3197
3525
|
}
|
|
@@ -3260,8 +3588,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3260
3588
|
}));
|
|
3261
3589
|
exports.bind = void 0;
|
|
3262
3590
|
|
|
3263
|
-
const global_1 = __webpack_require__(4128);
|
|
3264
|
-
|
|
3265
3591
|
const parser_1 = __webpack_require__(6728);
|
|
3266
3592
|
|
|
3267
3593
|
function bind(parser, f) {
|
|
@@ -3274,10 +3600,10 @@ function bind(parser, f) {
|
|
|
3274
3600
|
source,
|
|
3275
3601
|
context
|
|
3276
3602
|
});
|
|
3277
|
-
if (
|
|
3603
|
+
if (res1 === undefined) return;
|
|
3278
3604
|
const res2 = f((0, parser_1.eval)(res1), (0, parser_1.exec)(res1), context);
|
|
3279
|
-
if (
|
|
3280
|
-
return (0, parser_1.exec)(res2).length <= (0, parser_1.exec)(res1).length ? res2 :
|
|
3605
|
+
if (res2 === undefined) return;
|
|
3606
|
+
return (0, parser_1.exec)(res2).length <= (0, parser_1.exec)(res1).length ? res2 : undefined;
|
|
3281
3607
|
};
|
|
3282
3608
|
}
|
|
3283
3609
|
|
|
@@ -3348,8 +3674,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3348
3674
|
}));
|
|
3349
3675
|
exports.state = exports.constraint = exports.guard = exports.precedence = exports.creation = exports.syntax = exports.context = exports.reset = void 0;
|
|
3350
3676
|
|
|
3351
|
-
const global_1 = __webpack_require__(4128);
|
|
3352
|
-
|
|
3353
3677
|
const alias_1 = __webpack_require__(5406);
|
|
3354
3678
|
|
|
3355
3679
|
const parser_1 = __webpack_require__(6728);
|
|
@@ -3358,11 +3682,11 @@ const memo_1 = __webpack_require__(1090);
|
|
|
3358
3682
|
|
|
3359
3683
|
function reset(base, parser) {
|
|
3360
3684
|
if (!('memo' in base)) {
|
|
3361
|
-
base.memo =
|
|
3685
|
+
base.memo = undefined;
|
|
3362
3686
|
}
|
|
3363
3687
|
|
|
3364
|
-
const changes =
|
|
3365
|
-
const values =
|
|
3688
|
+
const changes = Object.entries(base);
|
|
3689
|
+
const values = Array(changes.length);
|
|
3366
3690
|
return ({
|
|
3367
3691
|
source,
|
|
3368
3692
|
context
|
|
@@ -3372,8 +3696,8 @@ function reset(base, parser) {
|
|
|
3372
3696
|
exports.reset = reset;
|
|
3373
3697
|
|
|
3374
3698
|
function context(base, parser) {
|
|
3375
|
-
const changes =
|
|
3376
|
-
const values =
|
|
3699
|
+
const changes = Object.entries(base);
|
|
3700
|
+
const values = Array(changes.length);
|
|
3377
3701
|
return ({
|
|
3378
3702
|
source,
|
|
3379
3703
|
context
|
|
@@ -3423,7 +3747,7 @@ function apply(parser, source, context, changes, values, reset = false) {
|
|
|
3423
3747
|
|
|
3424
3748
|
default:
|
|
3425
3749
|
context[prop] = values[i];
|
|
3426
|
-
values[i] =
|
|
3750
|
+
values[i] = undefined;
|
|
3427
3751
|
}
|
|
3428
3752
|
}
|
|
3429
3753
|
return result;
|
|
@@ -3441,7 +3765,7 @@ function syntax(syntax, prec, cost, state, parser) {
|
|
|
3441
3765
|
const stateOuter = context.state ?? 0;
|
|
3442
3766
|
const stateInner = context.state = stateOuter | state;
|
|
3443
3767
|
const cache = syntax && stateInner & memo.targets && memo.get(position, syntax, stateInner);
|
|
3444
|
-
const result = cache ? cache.length === 0 ?
|
|
3768
|
+
const result = cache ? cache.length === 0 ? undefined : [cache[0], source.slice(cache[1])] : parser({
|
|
3445
3769
|
source,
|
|
3446
3770
|
context
|
|
3447
3771
|
});
|
|
@@ -3516,7 +3840,7 @@ function guard(f, parser) {
|
|
|
3516
3840
|
}) => f(context) ? parser({
|
|
3517
3841
|
source,
|
|
3518
3842
|
context
|
|
3519
|
-
}) :
|
|
3843
|
+
}) : undefined;
|
|
3520
3844
|
}
|
|
3521
3845
|
|
|
3522
3846
|
exports.guard = guard;
|
|
@@ -3535,7 +3859,7 @@ function constraint(state, positive, parser) {
|
|
|
3535
3859
|
return s === state ? parser({
|
|
3536
3860
|
source,
|
|
3537
3861
|
context
|
|
3538
|
-
}) :
|
|
3862
|
+
}) : undefined;
|
|
3539
3863
|
};
|
|
3540
3864
|
}
|
|
3541
3865
|
|
|
@@ -3730,8 +4054,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3730
4054
|
}));
|
|
3731
4055
|
exports.inits = void 0;
|
|
3732
4056
|
|
|
3733
|
-
const global_1 = __webpack_require__(4128);
|
|
3734
|
-
|
|
3735
4057
|
const parser_1 = __webpack_require__(6728);
|
|
3736
4058
|
|
|
3737
4059
|
const array_1 = __webpack_require__(8112);
|
|
@@ -3752,13 +4074,13 @@ function inits(parsers, resume) {
|
|
|
3752
4074
|
source: rest,
|
|
3753
4075
|
context
|
|
3754
4076
|
});
|
|
3755
|
-
if (
|
|
4077
|
+
if (result === undefined) break;
|
|
3756
4078
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3757
4079
|
rest = (0, parser_1.exec)(result);
|
|
3758
4080
|
if (resume?.((0, parser_1.eval)(result), (0, parser_1.exec)(result)) === false) break;
|
|
3759
4081
|
}
|
|
3760
4082
|
|
|
3761
|
-
return nodes && rest.length < source.length ? [nodes, rest] :
|
|
4083
|
+
return nodes && rest.length < source.length ? [nodes, rest] : undefined;
|
|
3762
4084
|
};
|
|
3763
4085
|
}
|
|
3764
4086
|
|
|
@@ -3777,8 +4099,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3777
4099
|
}));
|
|
3778
4100
|
exports.sequence = void 0;
|
|
3779
4101
|
|
|
3780
|
-
const global_1 = __webpack_require__(4128);
|
|
3781
|
-
|
|
3782
4102
|
const parser_1 = __webpack_require__(6728);
|
|
3783
4103
|
|
|
3784
4104
|
const array_1 = __webpack_require__(8112);
|
|
@@ -3799,13 +4119,13 @@ function sequence(parsers, resume) {
|
|
|
3799
4119
|
source: rest,
|
|
3800
4120
|
context
|
|
3801
4121
|
});
|
|
3802
|
-
if (
|
|
4122
|
+
if (result === undefined) return;
|
|
3803
4123
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3804
4124
|
rest = (0, parser_1.exec)(result);
|
|
3805
4125
|
if (resume?.((0, parser_1.eval)(result), (0, parser_1.exec)(result)) === false) return;
|
|
3806
4126
|
}
|
|
3807
4127
|
|
|
3808
|
-
return nodes && rest.length < source.length ? [nodes, rest] :
|
|
4128
|
+
return nodes && rest.length < source.length ? [nodes, rest] : undefined;
|
|
3809
4129
|
};
|
|
3810
4130
|
}
|
|
3811
4131
|
|
|
@@ -3824,8 +4144,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3824
4144
|
}));
|
|
3825
4145
|
exports.some = void 0;
|
|
3826
4146
|
|
|
3827
|
-
const global_1 = __webpack_require__(4128);
|
|
3828
|
-
|
|
3829
4147
|
const parser_1 = __webpack_require__(6728);
|
|
3830
4148
|
|
|
3831
4149
|
const delimiter_1 = __webpack_require__(1435);
|
|
@@ -3833,7 +4151,7 @@ const delimiter_1 = __webpack_require__(1435);
|
|
|
3833
4151
|
const array_1 = __webpack_require__(8112);
|
|
3834
4152
|
|
|
3835
4153
|
function some(parser, end, delimiters = [], limit = -1) {
|
|
3836
|
-
if (typeof end === 'number') return some(parser,
|
|
4154
|
+
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3837
4155
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
3838
4156
|
const delims = delimiters.map(([delimiter, precedence]) => ({
|
|
3839
4157
|
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
@@ -3861,7 +4179,7 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3861
4179
|
source: rest,
|
|
3862
4180
|
context
|
|
3863
4181
|
});
|
|
3864
|
-
if (
|
|
4182
|
+
if (result === undefined) break;
|
|
3865
4183
|
nodes = nodes ? nodes.length < (0, parser_1.eval)(result).length ? (0, array_1.unshift)(nodes, (0, parser_1.eval)(result)) : (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3866
4184
|
rest = (0, parser_1.exec)(result);
|
|
3867
4185
|
if (limit >= 0 && source.length - rest.length > limit) break;
|
|
@@ -3871,7 +4189,7 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3871
4189
|
context.delimiters.pop(delims.length);
|
|
3872
4190
|
}
|
|
3873
4191
|
|
|
3874
|
-
return nodes && rest.length < source.length ? [nodes, rest] :
|
|
4192
|
+
return nodes && rest.length < source.length ? [nodes, rest] : undefined;
|
|
3875
4193
|
};
|
|
3876
4194
|
}
|
|
3877
4195
|
|
|
@@ -3926,7 +4244,7 @@ exports.tails = tails;
|
|
|
3926
4244
|
/***/ }),
|
|
3927
4245
|
|
|
3928
4246
|
/***/ 6366:
|
|
3929
|
-
/***/ ((__unused_webpack_module, exports
|
|
4247
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3930
4248
|
|
|
3931
4249
|
"use strict";
|
|
3932
4250
|
|
|
@@ -3936,30 +4254,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3936
4254
|
}));
|
|
3937
4255
|
exports.union = void 0;
|
|
3938
4256
|
|
|
3939
|
-
const global_1 = __webpack_require__(4128);
|
|
3940
|
-
|
|
3941
4257
|
function union(parsers) {
|
|
3942
4258
|
switch (parsers.length) {
|
|
3943
4259
|
case 0:
|
|
3944
|
-
return () =>
|
|
4260
|
+
return () => undefined;
|
|
3945
4261
|
|
|
3946
4262
|
case 1:
|
|
3947
4263
|
return parsers[0];
|
|
3948
4264
|
|
|
3949
|
-
case 2:
|
|
3950
|
-
return input => parsers[0](input) ?? parsers[1](input);
|
|
3951
|
-
|
|
3952
|
-
case 3:
|
|
3953
|
-
return input => parsers[0](input) ?? parsers[1](input) ?? parsers[2](input);
|
|
3954
|
-
|
|
3955
4265
|
default:
|
|
3956
|
-
return input => {
|
|
3957
|
-
for (let i = 0; i < parsers.length; ++i) {
|
|
3958
|
-
const parser = parsers[i];
|
|
3959
|
-
const result = parser(input);
|
|
3960
|
-
if (result) return result;
|
|
3961
|
-
}
|
|
3962
|
-
};
|
|
4266
|
+
return eval(['input =>', parsers.map((_, i) => `|| parsers[${i}](input)`).join('').slice(2)].join(''));
|
|
3963
4267
|
}
|
|
3964
4268
|
}
|
|
3965
4269
|
|
|
@@ -4088,8 +4392,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4088
4392
|
}));
|
|
4089
4393
|
exports.bind = void 0;
|
|
4090
4394
|
|
|
4091
|
-
const global_1 = __webpack_require__(4128);
|
|
4092
|
-
|
|
4093
4395
|
const parser_1 = __webpack_require__(6728);
|
|
4094
4396
|
|
|
4095
4397
|
const memo_1 = __webpack_require__(1090);
|
|
@@ -4114,7 +4416,7 @@ const array_1 = __webpack_require__(8112);
|
|
|
4114
4416
|
|
|
4115
4417
|
function bind(target, settings) {
|
|
4116
4418
|
let context = { ...settings,
|
|
4117
|
-
host: settings.host ?? new url_1.ReadonlyURL(
|
|
4419
|
+
host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4118
4420
|
memo: new memo_1.Memo({
|
|
4119
4421
|
targets: 236
|
|
4120
4422
|
/* State.backtrackers */
|
|
@@ -4139,7 +4441,7 @@ function bind(target, settings) {
|
|
|
4139
4441
|
source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1)); // Change the object identity.
|
|
4140
4442
|
|
|
4141
4443
|
context = { ...context,
|
|
4142
|
-
url: url ? new url_1.ReadonlyURL(url) :
|
|
4444
|
+
url: url ? new url_1.ReadonlyURL(url) : undefined
|
|
4143
4445
|
};
|
|
4144
4446
|
const rev = revision = Symbol();
|
|
4145
4447
|
const sourceSegments = [];
|
|
@@ -4455,8 +4757,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4455
4757
|
}));
|
|
4456
4758
|
exports.parse = void 0;
|
|
4457
4759
|
|
|
4458
|
-
const global_1 = __webpack_require__(4128);
|
|
4459
|
-
|
|
4460
4760
|
const parser_1 = __webpack_require__(6728);
|
|
4461
4761
|
|
|
4462
4762
|
const memo_1 = __webpack_require__(1090);
|
|
@@ -4484,7 +4784,7 @@ function parse(source, opts = {}, context) {
|
|
|
4484
4784
|
const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4485
4785
|
source = !context ? (0, normalize_1.normalize)(source) : source;
|
|
4486
4786
|
context = {
|
|
4487
|
-
host: opts.host ?? context?.host ?? new url_1.ReadonlyURL(
|
|
4787
|
+
host: opts.host ?? context?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4488
4788
|
url: url ? new url_1.ReadonlyURL(url) : context?.url,
|
|
4489
4789
|
id: opts.id ?? context?.id,
|
|
4490
4790
|
caches: context?.caches,
|
|
@@ -4583,8 +4883,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4583
4883
|
}));
|
|
4584
4884
|
exports.block = void 0;
|
|
4585
4885
|
|
|
4586
|
-
const global_1 = __webpack_require__(4128);
|
|
4587
|
-
|
|
4588
4886
|
const combinator_1 = __webpack_require__(2087);
|
|
4589
4887
|
|
|
4590
4888
|
const source_1 = __webpack_require__(6743);
|
|
@@ -4639,12 +4937,12 @@ function error(parser) {
|
|
|
4639
4937
|
id
|
|
4640
4938
|
}
|
|
4641
4939
|
}, reason) => [[(0, dom_1.html)('h1', {
|
|
4642
|
-
id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` :
|
|
4940
|
+
id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
|
|
4643
4941
|
class: 'error'
|
|
4644
4942
|
}, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
|
|
4645
4943
|
class: 'error',
|
|
4646
4944
|
translate: 'no'
|
|
4647
|
-
}, source.replace(/^\x07.*\n/, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') ||
|
|
4945
|
+
}, source.replace(/^\x07.*\n/, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)], '']);
|
|
4648
4946
|
}
|
|
4649
4947
|
|
|
4650
4948
|
/***/ }),
|
|
@@ -4707,8 +5005,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4707
5005
|
}));
|
|
4708
5006
|
exports.codeblock = exports.segment_ = exports.segment = void 0;
|
|
4709
5007
|
|
|
4710
|
-
const global_1 = __webpack_require__(4128);
|
|
4711
|
-
|
|
4712
5008
|
const parser_1 = __webpack_require__(6728);
|
|
4713
5009
|
|
|
4714
5010
|
const combinator_1 = __webpack_require__(2087);
|
|
@@ -4758,11 +5054,11 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0
|
|
|
4758
5054
|
}, `${opener}${body}${overflow || closer}`)];
|
|
4759
5055
|
const el = (0, dom_1.html)('pre', {
|
|
4760
5056
|
class: params.lang ? `code language-${params.lang}` : 'text',
|
|
4761
|
-
translate: params.lang ? 'no' :
|
|
4762
|
-
'data-lang': params.lang ||
|
|
4763
|
-
'data-line': params.line ||
|
|
4764
|
-
'data-path': params.path ||
|
|
4765
|
-
}, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) ||
|
|
5057
|
+
translate: params.lang ? 'no' : undefined,
|
|
5058
|
+
'data-lang': params.lang || undefined,
|
|
5059
|
+
'data-line': params.line || undefined,
|
|
5060
|
+
'data-path': params.path || undefined
|
|
5061
|
+
}, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)({
|
|
4766
5062
|
source: body.slice(0, -1),
|
|
4767
5063
|
context
|
|
4768
5064
|
}), [])));
|
|
@@ -5012,11 +5308,17 @@ const blockquote_1 = __webpack_require__(7859);
|
|
|
5012
5308
|
|
|
5013
5309
|
const placeholder_1 = __webpack_require__(5198);
|
|
5014
5310
|
|
|
5311
|
+
const inline_1 = __webpack_require__(1160);
|
|
5312
|
+
|
|
5015
5313
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /^(?=\s).*\n/)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])])));
|
|
5016
|
-
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)(source => {
|
|
5314
|
+
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
|
|
5017
5315
|
const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
5018
|
-
return
|
|
5316
|
+
return parser({
|
|
5317
|
+
source,
|
|
5318
|
+
context
|
|
5319
|
+
}) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
|
|
5019
5320
|
}, (0, combinator_1.union)([figure_1.figure])), ([el]) => el.tagName === 'FIGURE')));
|
|
5321
|
+
const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /^(?=\s).*\n/)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.shortmedia])), (0, combinator_1.some)(source_1.contentline)]);
|
|
5020
5322
|
|
|
5021
5323
|
/***/ }),
|
|
5022
5324
|
|
|
@@ -5060,8 +5362,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5060
5362
|
}));
|
|
5061
5363
|
exports.figure = exports.segment = void 0;
|
|
5062
5364
|
|
|
5063
|
-
const global_1 = __webpack_require__(4128);
|
|
5064
|
-
|
|
5065
5365
|
const combinator_1 = __webpack_require__(2087);
|
|
5066
5366
|
|
|
5067
5367
|
const source_1 = __webpack_require__(6743);
|
|
@@ -5192,7 +5492,7 @@ function attributes(label, param, content, caption) {
|
|
|
5192
5492
|
} || group === 'example' && type !== group && {
|
|
5193
5493
|
'data-invalid-type': 'label',
|
|
5194
5494
|
'data-invalid-message': '"example" label group must be used to examples'
|
|
5195
|
-
} ||
|
|
5495
|
+
} || undefined;
|
|
5196
5496
|
return {
|
|
5197
5497
|
'data-type': type,
|
|
5198
5498
|
'data-label': label,
|
|
@@ -5338,8 +5638,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5338
5638
|
}));
|
|
5339
5639
|
exports.table = exports.segment_ = exports.segment = void 0;
|
|
5340
5640
|
|
|
5341
|
-
const global_1 = __webpack_require__(4128);
|
|
5342
|
-
|
|
5343
5641
|
const alias_1 = __webpack_require__(5406);
|
|
5344
5642
|
|
|
5345
5643
|
const parser_1 = __webpack_require__(6728);
|
|
@@ -5373,7 +5671,7 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
5373
5671
|
|
|
5374
5672
|
switch (type) {
|
|
5375
5673
|
case 'grid':
|
|
5376
|
-
case
|
|
5674
|
+
case undefined:
|
|
5377
5675
|
return ((0, parser_1.eval)(parser({
|
|
5378
5676
|
source: body,
|
|
5379
5677
|
context
|
|
@@ -5401,19 +5699,19 @@ const data = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, co
|
|
|
5401
5699
|
const dataline = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)]))));
|
|
5402
5700
|
|
|
5403
5701
|
function attributes(source) {
|
|
5404
|
-
let [, rowspan =
|
|
5405
|
-
rowspan === '1' ? rowspan =
|
|
5406
|
-
colspan === '1' ? colspan =
|
|
5702
|
+
let [, rowspan = undefined, colspan = undefined, highlight = undefined] = source.match(/^.(?:(\d+)?:(\d+)?)?(!+)?$/) ?? [];
|
|
5703
|
+
rowspan === '1' ? rowspan = undefined : undefined;
|
|
5704
|
+
colspan === '1' ? colspan = undefined : undefined;
|
|
5407
5705
|
rowspan &&= `${(0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534))}`;
|
|
5408
5706
|
colspan &&= `${(0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000))}`;
|
|
5409
|
-
highlight &&= highlight.length > 0 ? `${highlight.length}` :
|
|
5707
|
+
highlight &&= highlight.length > 0 ? `${highlight.length}` : undefined;
|
|
5410
5708
|
const valid = !highlight || source[0] === '#' && +highlight <= 1 || source[0] === ':' && +highlight <= 6;
|
|
5411
5709
|
return {
|
|
5412
5710
|
class: valid ? highlight && 'highlight' : 'invalid',
|
|
5413
5711
|
rowspan,
|
|
5414
5712
|
colspan,
|
|
5415
5713
|
...(valid ? {
|
|
5416
|
-
'data-highlight-level': +highlight > 1 ? highlight :
|
|
5714
|
+
'data-highlight-level': +highlight > 1 ? highlight : undefined
|
|
5417
5715
|
} : {
|
|
5418
5716
|
'data-invalid-syntax': 'table',
|
|
5419
5717
|
'data-invalid-type': 'syntax',
|
|
@@ -5435,7 +5733,7 @@ function format(rows) {
|
|
|
5435
5733
|
ROW: for (let i = 0; i < rows.length; ++i) {
|
|
5436
5734
|
// Copy to make them retryable.
|
|
5437
5735
|
const [[[...as], [...vs] = []], ...cells] = rows[i];
|
|
5438
|
-
let isBody = target === tfoot ? false :
|
|
5736
|
+
let isBody = target === tfoot ? false : undefined;
|
|
5439
5737
|
as.length === 0 && as.push('-');
|
|
5440
5738
|
|
|
5441
5739
|
ALIGN_H: for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
|
|
@@ -5506,12 +5804,12 @@ function format(rows) {
|
|
|
5506
5804
|
let rHeadCellIdx;
|
|
5507
5805
|
|
|
5508
5806
|
for (let j = 0; j < cells.length; ++j) {
|
|
5509
|
-
const jn =
|
|
5807
|
+
const jn = BigInt(j);
|
|
5510
5808
|
const isVirtual = !!ranges[i]?.[j];
|
|
5511
|
-
const cell = isVirtual ? (0, array_1.splice)(cells, j, 0,
|
|
5809
|
+
const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j];
|
|
5512
5810
|
const isHeadCell = cell.tagName === 'TH';
|
|
5513
|
-
heads |=
|
|
5514
|
-
highlights |=
|
|
5811
|
+
heads |= BigInt(isHeadCell) << jn;
|
|
5812
|
+
highlights |= BigInt(cell.className === 'highlight') << jn;
|
|
5515
5813
|
hasDataCell ||= !isHeadCell;
|
|
5516
5814
|
|
|
5517
5815
|
if (isHeadCell && !hasDataCell) {
|
|
@@ -5536,9 +5834,9 @@ function format(rows) {
|
|
|
5536
5834
|
const colSpan = cell.colSpan;
|
|
5537
5835
|
|
|
5538
5836
|
if (colSpan > 1) {
|
|
5539
|
-
(0, array_1.splice)(cells, j + 1, 0, ...
|
|
5540
|
-
heads |= heads & 1n << jn && ~(~0n <<
|
|
5541
|
-
highlights |= highlights & 1n << jn && ~(~0n <<
|
|
5837
|
+
(0, array_1.splice)(cells, j + 1, 0, ...Array(colSpan - 1));
|
|
5838
|
+
heads |= heads & 1n << jn && ~(~0n << BigInt(colSpan)) << jn;
|
|
5839
|
+
highlights |= highlights & 1n << jn && ~(~0n << BigInt(colSpan)) << jn;
|
|
5542
5840
|
j += colSpan - 1;
|
|
5543
5841
|
}
|
|
5544
5842
|
|
|
@@ -5721,8 +6019,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5721
6019
|
}));
|
|
5722
6020
|
exports.mathblock = exports.segment_ = exports.segment = void 0;
|
|
5723
6021
|
|
|
5724
|
-
const global_1 = __webpack_require__(4128);
|
|
5725
|
-
|
|
5726
6022
|
const combinator_1 = __webpack_require__(2087);
|
|
5727
6023
|
|
|
5728
6024
|
const dom_1 = __webpack_require__(3252);
|
|
@@ -5733,7 +6029,7 @@ exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0,
|
|
|
5733
6029
|
exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), // Bug: Type mismatch between outer and inner.
|
|
5734
6030
|
([body, overflow, closer, opener, delim, param], _, {
|
|
5735
6031
|
caches: {
|
|
5736
|
-
math: cache =
|
|
6032
|
+
math: cache = undefined
|
|
5737
6033
|
} = {}
|
|
5738
6034
|
}) => [delim.length === 2 && closer && !overflow && param.trimStart() === '' ? cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
|
|
5739
6035
|
class: 'math',
|
|
@@ -5759,8 +6055,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5759
6055
|
}));
|
|
5760
6056
|
exports.invalid = exports.olist_ = exports.olist = void 0;
|
|
5761
6057
|
|
|
5762
|
-
const global_1 = __webpack_require__(4128);
|
|
5763
|
-
|
|
5764
6058
|
const combinator_1 = __webpack_require__(2087);
|
|
5765
6059
|
|
|
5766
6060
|
const ulist_1 = __webpack_require__(5425);
|
|
@@ -5789,7 +6083,7 @@ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5789
6083
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
|
|
5790
6084
|
|
|
5791
6085
|
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)(1, false, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), exports.invalid), ns => [(0, dom_1.html)('li', {
|
|
5792
|
-
'data-marker': ns[0] ||
|
|
6086
|
+
'data-marker': ns[0] || undefined
|
|
5793
6087
|
}, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
|
|
5794
6088
|
|
|
5795
6089
|
const heads = {
|
|
@@ -5874,9 +6168,9 @@ function format(el, type, form) {
|
|
|
5874
6168
|
}
|
|
5875
6169
|
|
|
5876
6170
|
(0, dom_1.define)(el, {
|
|
5877
|
-
type: type ||
|
|
5878
|
-
'data-format': form === '.' ?
|
|
5879
|
-
'data-type': style(type) ||
|
|
6171
|
+
type: type || undefined,
|
|
6172
|
+
'data-format': form === '.' ? undefined : 'paren',
|
|
6173
|
+
'data-type': style(type) || undefined
|
|
5880
6174
|
});
|
|
5881
6175
|
const marker = el.firstElementChild?.getAttribute('data-marker').match(initial(type))?.[0] ?? '';
|
|
5882
6176
|
|
|
@@ -6388,8 +6682,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6388
6682
|
}));
|
|
6389
6683
|
exports.annotation = void 0;
|
|
6390
6684
|
|
|
6391
|
-
const global_1 = __webpack_require__(4128);
|
|
6392
|
-
|
|
6393
6685
|
const combinator_1 = __webpack_require__(2087);
|
|
6394
6686
|
|
|
6395
6687
|
const inline_1 = __webpack_require__(1160);
|
|
@@ -6407,7 +6699,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((
|
|
|
6407
6699
|
| 4
|
|
6408
6700
|
/* State.media */
|
|
6409
6701
|
, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
6410
|
-
delimiters:
|
|
6702
|
+
delimiters: undefined
|
|
6411
6703
|
}, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
|
|
6412
6704
|
class: 'annotation'
|
|
6413
6705
|
}, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
|
|
@@ -6682,8 +6974,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6682
6974
|
}));
|
|
6683
6975
|
exports.bracket = void 0;
|
|
6684
6976
|
|
|
6685
|
-
const global_1 = __webpack_require__(4128);
|
|
6686
|
-
|
|
6687
6977
|
const combinator_1 = __webpack_require__(2087);
|
|
6688
6978
|
|
|
6689
6979
|
const inline_1 = __webpack_require__(1160);
|
|
@@ -6719,16 +7009,16 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, comb
|
|
|
6719
7009
|
/* Syntax.bracket */
|
|
6720
7010
|
, 2, 1, 0
|
|
6721
7011
|
/* State.none */
|
|
6722
|
-
, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true,
|
|
7012
|
+
, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
|
|
6723
7013
|
/* Syntax.bracket */
|
|
6724
7014
|
, 2, 1, 0
|
|
6725
7015
|
/* State.none */
|
|
6726
|
-
, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true,
|
|
7016
|
+
, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
|
|
6727
7017
|
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(1
|
|
6728
7018
|
/* Syntax.quote */
|
|
6729
7019
|
, 8, 1, 0
|
|
6730
7020
|
/* State.none */
|
|
6731
|
-
, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true,
|
|
7021
|
+
, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
|
|
6732
7022
|
|
|
6733
7023
|
/***/ }),
|
|
6734
7024
|
|
|
@@ -6890,8 +7180,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6890
7180
|
}));
|
|
6891
7181
|
exports.index = void 0;
|
|
6892
7182
|
|
|
6893
|
-
const global_1 = __webpack_require__(4128);
|
|
6894
|
-
|
|
6895
7183
|
const combinator_1 = __webpack_require__(2087);
|
|
6896
7184
|
|
|
6897
7185
|
const inline_1 = __webpack_require__(1160);
|
|
@@ -6913,9 +7201,9 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0
|
|
|
6913
7201
|
| 4
|
|
6914
7202
|
/* State.media */
|
|
6915
7203
|
, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
|
|
6916
|
-
id: el.id ? null :
|
|
7204
|
+
id: el.id ? null : undefined,
|
|
6917
7205
|
class: 'index',
|
|
6918
|
-
href: el.id ? `#${el.id}` :
|
|
7206
|
+
href: el.id ? `#${el.id}` : undefined
|
|
6919
7207
|
}, el.childNodes)])));
|
|
6920
7208
|
const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'))), ns => [(0, dom_1.html)('span', {
|
|
6921
7209
|
class: 'indexer',
|
|
@@ -6936,8 +7224,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6936
7224
|
}));
|
|
6937
7225
|
exports.text = exports.identity = exports.indexee = void 0;
|
|
6938
7226
|
|
|
6939
|
-
const global_1 = __webpack_require__(4128);
|
|
6940
|
-
|
|
6941
7227
|
const combinator_1 = __webpack_require__(2087);
|
|
6942
7228
|
|
|
6943
7229
|
const dom_1 = __webpack_require__(3252);
|
|
@@ -6946,7 +7232,7 @@ function indexee(parser, optional) {
|
|
|
6946
7232
|
return (0, combinator_1.fmap)(parser, ([el], _, {
|
|
6947
7233
|
id
|
|
6948
7234
|
}) => [(0, dom_1.define)(el, {
|
|
6949
|
-
id: id !== '' && identity(text(el, optional)) ||
|
|
7235
|
+
id: id !== '' && identity(text(el, optional)) || undefined
|
|
6950
7236
|
})]);
|
|
6951
7237
|
}
|
|
6952
7238
|
|
|
@@ -7047,8 +7333,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7047
7333
|
}));
|
|
7048
7334
|
exports.isFixed = exports.number = exports.label = exports.segment = void 0;
|
|
7049
7335
|
|
|
7050
|
-
const global_1 = __webpack_require__(4128);
|
|
7051
|
-
|
|
7052
7336
|
const combinator_1 = __webpack_require__(2087);
|
|
7053
7337
|
|
|
7054
7338
|
const source_1 = __webpack_require__(6743);
|
|
@@ -7079,7 +7363,7 @@ exports.isFixed = isFixed;
|
|
|
7079
7363
|
function increment(number, position) {
|
|
7080
7364
|
if (number === '0' && position > 1) return increment('1', position);
|
|
7081
7365
|
const ns = number.split('.');
|
|
7082
|
-
const ms =
|
|
7366
|
+
const ms = Array(position);
|
|
7083
7367
|
|
|
7084
7368
|
for (let i = 0; i < position; ++i) {
|
|
7085
7369
|
ms[i] = i < ns.length ? i + 1 < position ? +ns[i] : +ns[i] + 1 : i + 1 < position ? 0 : 1;
|
|
@@ -7139,8 +7423,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7139
7423
|
}));
|
|
7140
7424
|
exports.attributes = exports.attribute = exports.html = void 0;
|
|
7141
7425
|
|
|
7142
|
-
const global_1 = __webpack_require__(4128);
|
|
7143
|
-
|
|
7144
7426
|
const combinator_1 = __webpack_require__(2087);
|
|
7145
7427
|
|
|
7146
7428
|
const inline_1 = __webpack_require__(1160);
|
|
@@ -7157,14 +7439,14 @@ const array_1 = __webpack_require__(8112);
|
|
|
7157
7439
|
|
|
7158
7440
|
const dom_1 = __webpack_require__(3252);
|
|
7159
7441
|
|
|
7160
|
-
const tags =
|
|
7442
|
+
const tags = Object.freeze(['bdo', 'bdi']);
|
|
7161
7443
|
const attrspecs = {
|
|
7162
7444
|
bdo: {
|
|
7163
|
-
dir:
|
|
7445
|
+
dir: Object.freeze(['ltr', 'rtl'])
|
|
7164
7446
|
}
|
|
7165
7447
|
};
|
|
7166
|
-
|
|
7167
|
-
|
|
7448
|
+
Object.setPrototypeOf(attrspecs, null);
|
|
7449
|
+
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7168
7450
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
|
|
7169
7451
|
/* Syntax.none */
|
|
7170
7452
|
, 5, 1, 0
|
|
@@ -7174,7 +7456,7 @@ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0,
|
|
|
7174
7456
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="[^"\n]*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
7175
7457
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
7176
7458
|
|
|
7177
|
-
const TAGS =
|
|
7459
|
+
const TAGS = Object.freeze(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"]);
|
|
7178
7460
|
|
|
7179
7461
|
function elem(tag, as, bs, cs) {
|
|
7180
7462
|
if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
|
|
@@ -7194,7 +7476,7 @@ function invalid(type, message, as, bs, cs) {
|
|
|
7194
7476
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)));
|
|
7195
7477
|
}
|
|
7196
7478
|
|
|
7197
|
-
const requiredAttributes = (0, memoize_1.memoize)(spec =>
|
|
7479
|
+
const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
|
|
7198
7480
|
|
|
7199
7481
|
function attributes(syntax, classes, spec, params) {
|
|
7200
7482
|
let invalid = false;
|
|
@@ -7203,10 +7485,10 @@ function attributes(syntax, classes, spec, params) {
|
|
|
7203
7485
|
for (let i = 0; i < params.length; ++i) {
|
|
7204
7486
|
const param = params[i].trim();
|
|
7205
7487
|
const name = param.split('=', 1)[0];
|
|
7206
|
-
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') :
|
|
7488
|
+
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
|
|
7207
7489
|
invalid ||= !spec || name in attrs;
|
|
7208
7490
|
if (spec && name in spec && !spec[name]) continue;
|
|
7209
|
-
spec?.[name]?.includes(value) || value !==
|
|
7491
|
+
spec?.[name]?.includes(value) || value !== undefined && spec?.[name]?.length === 0 ? attrs[name] = value ?? '' : invalid ||= !!spec;
|
|
7210
7492
|
(0, array_1.splice)(params, i--, 1);
|
|
7211
7493
|
}
|
|
7212
7494
|
|
|
@@ -7237,8 +7519,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7237
7519
|
}));
|
|
7238
7520
|
exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
7239
7521
|
|
|
7240
|
-
const global_1 = __webpack_require__(4128);
|
|
7241
|
-
|
|
7242
7522
|
const combinator_1 = __webpack_require__(2087);
|
|
7243
7523
|
|
|
7244
7524
|
const dom_1 = __webpack_require__(3252);
|
|
@@ -7258,7 +7538,7 @@ const parse = (0, memoize_1.reduce)((el => entity => {
|
|
|
7258
7538
|
if (entity === '
') return ' ';
|
|
7259
7539
|
el.innerHTML = entity;
|
|
7260
7540
|
const text = el.textContent;
|
|
7261
|
-
return entity === text ?
|
|
7541
|
+
return entity === text ? undefined : text;
|
|
7262
7542
|
})((0, dom_1.html)('b')));
|
|
7263
7543
|
|
|
7264
7544
|
/***/ }),
|
|
@@ -7305,8 +7585,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7305
7585
|
}));
|
|
7306
7586
|
exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.link = void 0;
|
|
7307
7587
|
|
|
7308
|
-
const global_1 = __webpack_require__(4128);
|
|
7309
|
-
|
|
7310
7588
|
const parser_1 = __webpack_require__(6728);
|
|
7311
7589
|
|
|
7312
7590
|
const combinator_1 = __webpack_require__(2087);
|
|
@@ -7376,7 +7654,7 @@ function parse(content, params, rest, context) {
|
|
|
7376
7654
|
}
|
|
7377
7655
|
|
|
7378
7656
|
const INSECURE_URI = params.shift();
|
|
7379
|
-
const uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ??
|
|
7657
|
+
const uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
7380
7658
|
|
|
7381
7659
|
switch (uri.protocol) {
|
|
7382
7660
|
case 'tel:':
|
|
@@ -7392,7 +7670,7 @@ function parse(content, params, rest, context) {
|
|
|
7392
7670
|
}
|
|
7393
7671
|
}
|
|
7394
7672
|
|
|
7395
|
-
const el = elem(INSECURE_URI, content, uri, context.host?.origin ||
|
|
7673
|
+
const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
|
|
7396
7674
|
if (el.className === 'invalid') return [[el], rest];
|
|
7397
7675
|
return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
|
|
7398
7676
|
}
|
|
@@ -7413,7 +7691,7 @@ function elem(INSECURE_URI, content, uri, origin) {
|
|
|
7413
7691
|
return (0, dom_1.html)('a', {
|
|
7414
7692
|
class: content.length === 0 ? 'url' : 'link',
|
|
7415
7693
|
href: uri.source,
|
|
7416
|
-
target:
|
|
7694
|
+
target: false || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
|
|
7417
7695
|
}, content.length === 0 ? decode(INSECURE_URI) : content);
|
|
7418
7696
|
|
|
7419
7697
|
case 'tel:':
|
|
@@ -7455,7 +7733,7 @@ function decode(uri) {
|
|
|
7455
7733
|
const origin = uri.match(/^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i)?.[0] ?? '';
|
|
7456
7734
|
|
|
7457
7735
|
try {
|
|
7458
|
-
let path =
|
|
7736
|
+
let path = decodeURI(uri.slice(origin.length));
|
|
7459
7737
|
|
|
7460
7738
|
if (!origin && /^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i.test(path)) {
|
|
7461
7739
|
path = uri.slice(origin.length);
|
|
@@ -7463,7 +7741,7 @@ function decode(uri) {
|
|
|
7463
7741
|
|
|
7464
7742
|
uri = origin + path;
|
|
7465
7743
|
} finally {
|
|
7466
|
-
return uri.replace(/\s+/g,
|
|
7744
|
+
return uri.replace(/\s+/g, encodeURI);
|
|
7467
7745
|
}
|
|
7468
7746
|
}
|
|
7469
7747
|
|
|
@@ -7551,8 +7829,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7551
7829
|
}));
|
|
7552
7830
|
exports.media = void 0;
|
|
7553
7831
|
|
|
7554
|
-
const global_1 = __webpack_require__(4128);
|
|
7555
|
-
|
|
7556
7832
|
const combinator_1 = __webpack_require__(2087);
|
|
7557
7833
|
|
|
7558
7834
|
const link_1 = __webpack_require__(9628);
|
|
@@ -7573,7 +7849,7 @@ const optspec = {
|
|
|
7573
7849
|
'width': [],
|
|
7574
7850
|
'height': [],
|
|
7575
7851
|
'aspect-ratio': [],
|
|
7576
|
-
rel:
|
|
7852
|
+
rel: undefined
|
|
7577
7853
|
};
|
|
7578
7854
|
Object.setPrototypeOf(optspec, null);
|
|
7579
7855
|
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(4
|
|
@@ -7584,9 +7860,9 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
|
|
|
7584
7860
|
/* State.link */
|
|
7585
7861
|
, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
7586
7862
|
const INSECURE_URI = params.shift();
|
|
7587
|
-
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ??
|
|
7863
|
+
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
7588
7864
|
let cache;
|
|
7589
|
-
const el =
|
|
7865
|
+
const el = false || (cache = context.caches?.media?.get(url.href)?.cloneNode(true)) || (0, dom_1.html)('img', {
|
|
7590
7866
|
class: 'media',
|
|
7591
7867
|
'data-src': url.source,
|
|
7592
7868
|
alt: text
|
|
@@ -7615,7 +7891,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
|
|
|
7615
7891
|
context
|
|
7616
7892
|
});
|
|
7617
7893
|
}))))));
|
|
7618
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true,
|
|
7894
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
|
|
7619
7895
|
const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
|
|
7620
7896
|
|
|
7621
7897
|
function sanitize(target, uri, alt) {
|
|
@@ -7671,8 +7947,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7671
7947
|
}));
|
|
7672
7948
|
exports.reference = void 0;
|
|
7673
7949
|
|
|
7674
|
-
const global_1 = __webpack_require__(4128);
|
|
7675
|
-
|
|
7676
7950
|
const combinator_1 = __webpack_require__(2087);
|
|
7677
7951
|
|
|
7678
7952
|
const inline_1 = __webpack_require__(1160);
|
|
@@ -7696,7 +7970,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[['
|
|
|
7696
7970
|
| 4
|
|
7697
7971
|
/* State.media */
|
|
7698
7972
|
, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
7699
|
-
delimiters:
|
|
7973
|
+
delimiters: undefined
|
|
7700
7974
|
}, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
|
|
7701
7975
|
const abbr = (0, combinator_1.creation)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
|
|
7702
7976
|
|
|
@@ -7727,8 +8001,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7727
8001
|
}));
|
|
7728
8002
|
exports.ruby = void 0;
|
|
7729
8003
|
|
|
7730
|
-
const global_1 = __webpack_require__(4128);
|
|
7731
|
-
|
|
7732
8004
|
const parser_1 = __webpack_require__(6728);
|
|
7733
8005
|
|
|
7734
8006
|
const combinator_1 = __webpack_require__(2087);
|
|
@@ -7810,7 +8082,7 @@ const text = (0, combinator_1.creation)(1, false, ({
|
|
|
7810
8082
|
}
|
|
7811
8083
|
}
|
|
7812
8084
|
|
|
7813
|
-
return acc.join('').trimStart() ? [[acc], ''] :
|
|
8085
|
+
return acc.join('').trimStart() ? [[acc], ''] : undefined;
|
|
7814
8086
|
});
|
|
7815
8087
|
|
|
7816
8088
|
function attributes(texts, rubies) {
|
|
@@ -7899,8 +8171,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7899
8171
|
}));
|
|
7900
8172
|
exports.template = void 0;
|
|
7901
8173
|
|
|
7902
|
-
const global_1 = __webpack_require__(4128);
|
|
7903
|
-
|
|
7904
8174
|
const combinator_1 = __webpack_require__(2087);
|
|
7905
8175
|
|
|
7906
8176
|
const source_1 = __webpack_require__(6743);
|
|
@@ -7916,7 +8186,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{',
|
|
|
7916
8186
|
, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
7917
8187
|
class: 'template'
|
|
7918
8188
|
}, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
|
|
7919
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true,
|
|
8189
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)])));
|
|
7920
8190
|
|
|
7921
8191
|
/***/ }),
|
|
7922
8192
|
|
|
@@ -8029,8 +8299,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8029
8299
|
}));
|
|
8030
8300
|
exports.figure = void 0;
|
|
8031
8301
|
|
|
8032
|
-
const global_1 = __webpack_require__(4128);
|
|
8033
|
-
|
|
8034
8302
|
const label_1 = __webpack_require__(466);
|
|
8035
8303
|
|
|
8036
8304
|
const queue_1 = __webpack_require__(4934);
|
|
@@ -8043,8 +8311,8 @@ const query_1 = __webpack_require__(6120);
|
|
|
8043
8311
|
|
|
8044
8312
|
function* figure(target, footnotes, opts = {}) {
|
|
8045
8313
|
const refs = new queue_1.MultiQueue((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]));
|
|
8046
|
-
const labels = new
|
|
8047
|
-
const numbers = new
|
|
8314
|
+
const labels = new Set();
|
|
8315
|
+
const numbers = new Map();
|
|
8048
8316
|
let base = '0';
|
|
8049
8317
|
let bases = base.split('.');
|
|
8050
8318
|
let index = bases; // Bug: Firefox
|
|
@@ -8151,7 +8419,7 @@ function* figure(target, footnotes, opts = {}) {
|
|
|
8151
8419
|
labels.add(label);
|
|
8152
8420
|
opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
|
|
8153
8421
|
|
|
8154
|
-
for (let rs = refs.take(label,
|
|
8422
|
+
for (let rs = refs.take(label, Infinity), i = 0; i < rs.length; ++i) {
|
|
8155
8423
|
const ref = rs[i];
|
|
8156
8424
|
|
|
8157
8425
|
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
@@ -8228,8 +8496,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8228
8496
|
}));
|
|
8229
8497
|
exports.reference = exports.annotation = exports.footnote = void 0;
|
|
8230
8498
|
|
|
8231
|
-
const global_1 = __webpack_require__(4128);
|
|
8232
|
-
|
|
8233
8499
|
const indexee_1 = __webpack_require__(1269);
|
|
8234
8500
|
|
|
8235
8501
|
const queue_1 = __webpack_require__(4934);
|
|
@@ -8257,9 +8523,9 @@ function build(syntax, marker, splitter) {
|
|
|
8257
8523
|
// Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
|
|
8258
8524
|
// 構文ごとに各1回の処理では不可能
|
|
8259
8525
|
return function* (target, footnote, opts = {}, bottom = null) {
|
|
8260
|
-
const defs = new
|
|
8526
|
+
const defs = new Map();
|
|
8261
8527
|
const buffer = new queue_1.MultiQueue();
|
|
8262
|
-
const titles = new
|
|
8528
|
+
const titles = new Map(); // Bug: Firefox
|
|
8263
8529
|
//const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
|
|
8264
8530
|
|
|
8265
8531
|
const splitters = [];
|
|
@@ -8277,7 +8543,7 @@ function build(syntax, marker, splitter) {
|
|
|
8277
8543
|
yield;
|
|
8278
8544
|
const ref = refs[i];
|
|
8279
8545
|
|
|
8280
|
-
while (+splitters[0]?.compareDocumentPosition(ref) &
|
|
8546
|
+
while (+splitters[0]?.compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
8281
8547
|
if (defs.size > 0) {
|
|
8282
8548
|
total += defs.size;
|
|
8283
8549
|
yield* proc(defs, target.insertBefore((0, dom_1.html)('ol', {
|
|
@@ -8289,7 +8555,7 @@ function build(syntax, marker, splitter) {
|
|
|
8289
8555
|
}
|
|
8290
8556
|
|
|
8291
8557
|
const identifier = `${+!ref.querySelector('.label')}:${ref.getAttribute('data-abbr') || '_' + ref.firstElementChild.innerHTML}`;
|
|
8292
|
-
const abbr = ref.getAttribute('data-abbr') ||
|
|
8558
|
+
const abbr = ref.getAttribute('data-abbr') || undefined;
|
|
8293
8559
|
const content = (0, dom_1.frag)(ref.firstElementChild.cloneNode(true).childNodes);
|
|
8294
8560
|
style ??= abbr ? 'abbr' : 'count';
|
|
8295
8561
|
|
|
@@ -8315,20 +8581,20 @@ function build(syntax, marker, splitter) {
|
|
|
8315
8581
|
ref.lastChild?.remove();
|
|
8316
8582
|
}
|
|
8317
8583
|
|
|
8318
|
-
const title =
|
|
8584
|
+
const title = false || titles.get(identifier) || +identifier[0] && ref.title || (0, indexee_1.text)(content).trim() || content.textContent.trim() || undefined;
|
|
8319
8585
|
title ? !titles.has(identifier) && titles.set(identifier, title) : buffer.set(identifier, ref);
|
|
8320
8586
|
const blank = !!abbr && !content.firstChild;
|
|
8321
8587
|
const refIndex = ++count;
|
|
8322
|
-
const refId = opts.id !== '' ? ref.id || `${syntax}:${opts.id ? `${opts.id}:` : ''}ref:${refIndex}` :
|
|
8323
|
-
const def =
|
|
8324
|
-
id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${total + defs.size + 1}` :
|
|
8325
|
-
'data-marker': !footnote ? marker(total + defs.size + 1, abbr) :
|
|
8588
|
+
const refId = opts.id !== '' ? ref.id || `${syntax}:${opts.id ? `${opts.id}:` : ''}ref:${refIndex}` : undefined;
|
|
8589
|
+
const def = false || defs.get(identifier) || defs.set(identifier, (0, dom_1.html)('li', {
|
|
8590
|
+
id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${total + defs.size + 1}` : undefined,
|
|
8591
|
+
'data-marker': !footnote ? marker(total + defs.size + 1, abbr) : undefined
|
|
8326
8592
|
}, [content.cloneNode(true), (0, dom_1.html)('sup')])).get(identifier);
|
|
8327
8593
|
|
|
8328
8594
|
if (title && !blank && def.childNodes.length === 1) {
|
|
8329
8595
|
def.insertBefore(content.cloneNode(true), def.lastChild);
|
|
8330
8596
|
|
|
8331
|
-
for (let refs = buffer.take(identifier,
|
|
8597
|
+
for (let refs = buffer.take(identifier, Infinity), i = 0; i < refs.length; ++i) {
|
|
8332
8598
|
const ref = refs[i];
|
|
8333
8599
|
if (ref.getAttribute('data-invalid-type') !== 'content') continue;
|
|
8334
8600
|
(0, dom_1.define)(ref, {
|
|
@@ -8342,10 +8608,10 @@ function build(syntax, marker, splitter) {
|
|
|
8342
8608
|
}
|
|
8343
8609
|
|
|
8344
8610
|
const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || total + defs.size;
|
|
8345
|
-
const defId = def.id ||
|
|
8611
|
+
const defId = def.id || undefined;
|
|
8346
8612
|
(0, dom_1.define)(ref, {
|
|
8347
8613
|
id: refId,
|
|
8348
|
-
class: opts.id !== '' ?
|
|
8614
|
+
class: opts.id !== '' ? undefined : `${ref.className} disabled`,
|
|
8349
8615
|
...(title ? {
|
|
8350
8616
|
title
|
|
8351
8617
|
} : {
|
|
@@ -8360,7 +8626,7 @@ function build(syntax, marker, splitter) {
|
|
|
8360
8626
|
}, marker(defIndex, abbr)));
|
|
8361
8627
|
def.lastChild.appendChild((0, dom_1.html)('a', {
|
|
8362
8628
|
href: refId && `#${refId}`,
|
|
8363
|
-
title: abbr && !blank ? title :
|
|
8629
|
+
title: abbr && !blank ? title : undefined
|
|
8364
8630
|
}, `^${refIndex}`));
|
|
8365
8631
|
}
|
|
8366
8632
|
|
|
@@ -8424,8 +8690,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8424
8690
|
}));
|
|
8425
8691
|
exports.validate = exports.segment = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
|
|
8426
8692
|
|
|
8427
|
-
const global_1 = __webpack_require__(4128);
|
|
8428
|
-
|
|
8429
8693
|
const parser_1 = __webpack_require__(6728);
|
|
8430
8694
|
|
|
8431
8695
|
const combinator_1 = __webpack_require__(2087);
|
|
@@ -8468,7 +8732,7 @@ function* segment(source) {
|
|
|
8468
8732
|
exports.segment = segment;
|
|
8469
8733
|
|
|
8470
8734
|
function validate(source, size) {
|
|
8471
|
-
return source.length <= size / 4 || source.length <= size && new
|
|
8735
|
+
return source.length <= size / 4 || source.length <= size && new Blob([source]).size <= size;
|
|
8472
8736
|
}
|
|
8473
8737
|
|
|
8474
8738
|
exports.validate = validate;
|
|
@@ -8621,13 +8885,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8621
8885
|
}));
|
|
8622
8886
|
exports.contentline = exports.emptyline = exports.anyline = void 0;
|
|
8623
8887
|
|
|
8624
|
-
const global_1 = __webpack_require__(4128);
|
|
8625
|
-
|
|
8626
8888
|
const combinator_1 = __webpack_require__(2087);
|
|
8627
8889
|
|
|
8628
8890
|
exports.anyline = (0, combinator_1.line)(() => [[], '']);
|
|
8629
|
-
exports.emptyline = (0, combinator_1.line)(i => (0, combinator_1.isEmpty)(i.source) ? [[], ''] :
|
|
8630
|
-
exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isEmpty)(i.source) ? [[], ''] :
|
|
8891
|
+
exports.emptyline = (0, combinator_1.line)(i => (0, combinator_1.isEmpty)(i.source) ? [[], ''] : undefined);
|
|
8892
|
+
exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isEmpty)(i.source) ? [[], ''] : undefined);
|
|
8631
8893
|
|
|
8632
8894
|
/***/ }),
|
|
8633
8895
|
|
|
@@ -8642,8 +8904,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8642
8904
|
}));
|
|
8643
8905
|
exports.stropt = exports.str = void 0;
|
|
8644
8906
|
|
|
8645
|
-
const global_1 = __webpack_require__(4128);
|
|
8646
|
-
|
|
8647
8907
|
const combinator_1 = __webpack_require__(2087);
|
|
8648
8908
|
|
|
8649
8909
|
function str(pattern, not) {
|
|
@@ -8652,14 +8912,14 @@ function str(pattern, not) {
|
|
|
8652
8912
|
}) => {
|
|
8653
8913
|
if (source === '') return;
|
|
8654
8914
|
if (not && source.slice(pattern.length, pattern.length + not.length) === not) return;
|
|
8655
|
-
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] :
|
|
8915
|
+
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : undefined;
|
|
8656
8916
|
}) : (0, combinator_1.creation)(1, false, ({
|
|
8657
8917
|
source
|
|
8658
8918
|
}) => {
|
|
8659
8919
|
if (source === '') return;
|
|
8660
8920
|
const m = source.match(pattern);
|
|
8661
8921
|
if (m && not && source.slice(m[0].length, m[0].length + not.length) === not) return;
|
|
8662
|
-
return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] :
|
|
8922
|
+
return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : undefined;
|
|
8663
8923
|
});
|
|
8664
8924
|
}
|
|
8665
8925
|
|
|
@@ -8670,13 +8930,13 @@ function stropt(pattern) {
|
|
|
8670
8930
|
source
|
|
8671
8931
|
}) => {
|
|
8672
8932
|
if (source === '') return;
|
|
8673
|
-
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] :
|
|
8933
|
+
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : undefined;
|
|
8674
8934
|
}) : (0, combinator_1.creation)(1, false, ({
|
|
8675
8935
|
source
|
|
8676
8936
|
}) => {
|
|
8677
8937
|
if (source === '') return;
|
|
8678
8938
|
const m = source.match(pattern);
|
|
8679
|
-
return m ? [[m[0]], source.slice(m[0].length)] :
|
|
8939
|
+
return m ? [[m[0]], source.slice(m[0].length)] : undefined;
|
|
8680
8940
|
});
|
|
8681
8941
|
}
|
|
8682
8942
|
|
|
@@ -8695,8 +8955,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8695
8955
|
}));
|
|
8696
8956
|
exports.isAlphanumeric = exports.linebreak = exports.txt = exports.text = exports.nonAlphanumeric = exports.nonWhitespace = exports.delimiter = void 0;
|
|
8697
8957
|
|
|
8698
|
-
const global_1 = __webpack_require__(4128);
|
|
8699
|
-
|
|
8700
8958
|
const combinator_1 = __webpack_require__(2087);
|
|
8701
8959
|
|
|
8702
8960
|
const str_1 = __webpack_require__(2790);
|
|
@@ -8740,7 +8998,7 @@ exports.text = (0, combinator_1.creation)(1, false, ({
|
|
|
8740
8998
|
case '\x1B':
|
|
8741
8999
|
case '\\':
|
|
8742
9000
|
switch (source[1]) {
|
|
8743
|
-
case
|
|
9001
|
+
case undefined:
|
|
8744
9002
|
return [[], ''];
|
|
8745
9003
|
|
|
8746
9004
|
case '\n':
|
|
@@ -8870,8 +9128,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8870
9128
|
}));
|
|
8871
9129
|
exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
|
|
8872
9130
|
|
|
8873
|
-
const global_1 = __webpack_require__(4128);
|
|
8874
|
-
|
|
8875
9131
|
const parser_1 = __webpack_require__(6728);
|
|
8876
9132
|
|
|
8877
9133
|
const combinator_1 = __webpack_require__(2087);
|
|
@@ -8917,14 +9173,14 @@ function hasVisible(nodes, {
|
|
|
8917
9173
|
exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr[^\S\n]*>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
|
|
8918
9174
|
|
|
8919
9175
|
function blankWith(starting, delimiter) {
|
|
8920
|
-
if (delimiter ===
|
|
9176
|
+
if (delimiter === undefined) return blankWith('', starting);
|
|
8921
9177
|
return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr[^\S\n]*>)${starting && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
|
|
8922
9178
|
}
|
|
8923
9179
|
|
|
8924
9180
|
exports.blankWith = blankWith;
|
|
8925
9181
|
|
|
8926
9182
|
function startLoose(parser, except) {
|
|
8927
|
-
return input => isStartLoose(input, except) ? parser(input) :
|
|
9183
|
+
return input => isStartLoose(input, except) ? parser(input) : undefined;
|
|
8928
9184
|
}
|
|
8929
9185
|
|
|
8930
9186
|
exports.startLoose = startLoose;
|
|
@@ -8941,7 +9197,7 @@ const isStartLoose = (0, memoize_1.reduce)(({
|
|
|
8941
9197
|
}, except = '') => `${source}\x1E${except}`);
|
|
8942
9198
|
|
|
8943
9199
|
function startTight(parser, except) {
|
|
8944
|
-
return input => isStartTight(input, except) ? parser(input) :
|
|
9200
|
+
return input => isStartTight(input, except) ? parser(input) : undefined;
|
|
8945
9201
|
}
|
|
8946
9202
|
|
|
8947
9203
|
exports.startTight = startTight;
|
|
@@ -9019,7 +9275,7 @@ exports.isStartTightNodes = isStartTightNodes; //export function isEndTightNodes
|
|
|
9019
9275
|
function isVisible(node, strpos) {
|
|
9020
9276
|
switch (typeof node) {
|
|
9021
9277
|
case 'string':
|
|
9022
|
-
const char = node && strpos !==
|
|
9278
|
+
const char = node && strpos !== undefined ? node[strpos >= 0 ? strpos : node.length + strpos] : node;
|
|
9023
9279
|
|
|
9024
9280
|
switch (char) {
|
|
9025
9281
|
case '':
|
|
@@ -9145,8 +9401,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9145
9401
|
}));
|
|
9146
9402
|
exports.render = void 0;
|
|
9147
9403
|
|
|
9148
|
-
const global_1 = __webpack_require__(4128);
|
|
9149
|
-
|
|
9150
9404
|
const code_1 = __webpack_require__(7686);
|
|
9151
9405
|
|
|
9152
9406
|
const math_1 = __webpack_require__(611);
|
|
@@ -9167,7 +9421,7 @@ const extend = (0, memoize_1.reduce)(opts => ({
|
|
|
9167
9421
|
|
|
9168
9422
|
function render(source, opts = {}) {
|
|
9169
9423
|
opts = extend(opts);
|
|
9170
|
-
const base =
|
|
9424
|
+
const base = location.href;
|
|
9171
9425
|
|
|
9172
9426
|
for (let es = (0, query_1.querySelectorAllWith)(source, selector), i = 0; i < es.length; ++i) {
|
|
9173
9427
|
render_(base, es[i], opts);
|
|
@@ -9248,8 +9502,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9248
9502
|
}));
|
|
9249
9503
|
exports.math = void 0;
|
|
9250
9504
|
|
|
9251
|
-
const global_1 = __webpack_require__(4128);
|
|
9252
|
-
|
|
9253
9505
|
const dom_1 = __webpack_require__(3252);
|
|
9254
9506
|
|
|
9255
9507
|
function math(target, cache) {
|
|
@@ -9262,7 +9514,7 @@ function math(target, cache) {
|
|
|
9262
9514
|
|
|
9263
9515
|
exports.math = math;
|
|
9264
9516
|
|
|
9265
|
-
async function queue(target, callback = () =>
|
|
9517
|
+
async function queue(target, callback = () => undefined) {
|
|
9266
9518
|
// @ts-ignore
|
|
9267
9519
|
!MathJax.typesetPromise && (await MathJax.startup.promise); // @ts-ignore
|
|
9268
9520
|
|
|
@@ -9359,18 +9611,16 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9359
9611
|
}));
|
|
9360
9612
|
exports.image = void 0;
|
|
9361
9613
|
|
|
9362
|
-
const global_1 = __webpack_require__(4128);
|
|
9363
|
-
|
|
9364
9614
|
const dom_1 = __webpack_require__(3252);
|
|
9365
9615
|
|
|
9366
9616
|
function image(source, url, cache) {
|
|
9367
|
-
if (cache?.has(url.href)) return (0, dom_1.define)(cache.get(url.href).cloneNode(true),
|
|
9617
|
+
if (cache?.has(url.href)) return (0, dom_1.define)(cache.get(url.href).cloneNode(true), Object.fromEntries([...source.attributes].map(attr => [attr.name, attr.value])));
|
|
9368
9618
|
(0, dom_1.define)(source, {
|
|
9369
9619
|
'data-type': 'image',
|
|
9370
9620
|
src: source.getAttribute('data-src'),
|
|
9371
9621
|
loading: 'lazy'
|
|
9372
9622
|
});
|
|
9373
|
-
cache?.set(url.href, (0, dom_1.define)(source.cloneNode(true),
|
|
9623
|
+
cache?.set(url.href, (0, dom_1.define)(source.cloneNode(true), Object.fromEntries([...source.attributes].filter(attr => !['class', 'data-type', 'data-src', 'src', 'loading'].includes(attr.name)).map(attr => [attr.name, null]))));
|
|
9374
9624
|
return source;
|
|
9375
9625
|
}
|
|
9376
9626
|
|
|
@@ -9430,8 +9680,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9430
9680
|
}));
|
|
9431
9681
|
exports.twitter = void 0;
|
|
9432
9682
|
|
|
9433
|
-
const global_1 = __webpack_require__(4128);
|
|
9434
|
-
|
|
9435
9683
|
const parser_1 = __webpack_require__(3019);
|
|
9436
9684
|
|
|
9437
9685
|
const dom_1 = __webpack_require__(3252);
|
|
@@ -9457,10 +9705,10 @@ function twitter(source, url) {
|
|
|
9457
9705
|
html
|
|
9458
9706
|
}) {
|
|
9459
9707
|
el.innerHTML = dompurify_1.default.sanitize(html);
|
|
9460
|
-
if (
|
|
9708
|
+
if (window.twttr) return void window.twttr.widgets.load(el);
|
|
9461
9709
|
const id = 'twitter-wjs';
|
|
9462
|
-
if (
|
|
9463
|
-
|
|
9710
|
+
if (document.getElementById(id)) return;
|
|
9711
|
+
document.body.appendChild((0, dom_1.html)('script', {
|
|
9464
9712
|
id,
|
|
9465
9713
|
src: 'https://platform.twitter.com/widgets.js'
|
|
9466
9714
|
}));
|
|
@@ -9495,8 +9743,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9495
9743
|
}));
|
|
9496
9744
|
exports.video = void 0;
|
|
9497
9745
|
|
|
9498
|
-
const global_1 = __webpack_require__(4128);
|
|
9499
|
-
|
|
9500
9746
|
const dom_1 = __webpack_require__(3252);
|
|
9501
9747
|
|
|
9502
9748
|
const extensions = ['.webm', '.ogv'];
|
|
@@ -9506,8 +9752,8 @@ function video(source, url) {
|
|
|
9506
9752
|
return (0, dom_1.html)('video', {
|
|
9507
9753
|
src: source.getAttribute('data-src'),
|
|
9508
9754
|
'data-type': 'video',
|
|
9509
|
-
...
|
|
9510
|
-
style: source.hasAttribute('aspect-ratio') ? `aspect-ratio: ${source.getAttribute('aspect-ratio')};` :
|
|
9755
|
+
...Object.fromEntries([...source.attributes].map(attr => [attr.name, attr.value])),
|
|
9756
|
+
style: source.hasAttribute('aspect-ratio') ? `aspect-ratio: ${source.getAttribute('aspect-ratio')};` : undefined,
|
|
9511
9757
|
muted: '',
|
|
9512
9758
|
controls: ''
|
|
9513
9759
|
});
|
|
@@ -9528,8 +9774,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9528
9774
|
}));
|
|
9529
9775
|
exports.youtube = void 0;
|
|
9530
9776
|
|
|
9531
|
-
const global_1 = __webpack_require__(4128);
|
|
9532
|
-
|
|
9533
9777
|
const dom_1 = __webpack_require__(3252);
|
|
9534
9778
|
|
|
9535
9779
|
function youtube(source, url) {
|
|
@@ -9550,10 +9794,10 @@ exports.youtube = youtube;
|
|
|
9550
9794
|
function resolve(url) {
|
|
9551
9795
|
switch (url.origin) {
|
|
9552
9796
|
case 'https://www.youtube.com':
|
|
9553
|
-
return url.pathname.match(/^\/watch\/?$/) ? url.searchParams.get('v')?.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) :
|
|
9797
|
+
return url.pathname.match(/^\/watch\/?$/) ? url.searchParams.get('v')?.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) : undefined;
|
|
9554
9798
|
|
|
9555
9799
|
case 'https://youtu.be':
|
|
9556
|
-
return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) :
|
|
9800
|
+
return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : undefined;
|
|
9557
9801
|
|
|
9558
9802
|
default:
|
|
9559
9803
|
return;
|
|
@@ -9666,8 +9910,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9666
9910
|
}));
|
|
9667
9911
|
exports.quote = void 0;
|
|
9668
9912
|
|
|
9669
|
-
const global_1 = __webpack_require__(4128);
|
|
9670
|
-
|
|
9671
9913
|
const parser_1 = __webpack_require__(6728);
|
|
9672
9914
|
|
|
9673
9915
|
const cite_1 = __webpack_require__(6315);
|
|
@@ -9712,7 +9954,7 @@ function quote(anchor, range) {
|
|
|
9712
9954
|
for (let es = node.querySelectorAll('br'), len = es.length, i = 0; i < len; ++i) {
|
|
9713
9955
|
const el = es[i];
|
|
9714
9956
|
|
|
9715
|
-
if (anchor && el.nextSibling instanceof
|
|
9957
|
+
if (anchor && el.nextSibling instanceof Element && el.nextSibling.matches('.cite, .quote')) {
|
|
9716
9958
|
el.replaceWith(`\n>${el.nextSibling.matches('.quote.invalid') ? ' ' : ''}`);
|
|
9717
9959
|
continue;
|
|
9718
9960
|
}
|
|
@@ -9745,7 +9987,7 @@ function fit(range) {
|
|
|
9745
9987
|
return void range.setStart(node.parentElement.previousSibling, 0);
|
|
9746
9988
|
}
|
|
9747
9989
|
|
|
9748
|
-
if (node.nodeName === 'BR' && node.nextSibling instanceof
|
|
9990
|
+
if (node.nodeName === 'BR' && node.nextSibling instanceof Element && node.nextSibling.matches('.cite, .quote')) {
|
|
9749
9991
|
return void range.setStart(node.nextSibling.firstChild, 0);
|
|
9750
9992
|
}
|
|
9751
9993
|
|
|
@@ -9768,7 +10010,7 @@ function trim(node) {
|
|
|
9768
10010
|
/***/ }),
|
|
9769
10011
|
|
|
9770
10012
|
/***/ 5202:
|
|
9771
|
-
/***/ ((__unused_webpack_module, exports
|
|
10013
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
9772
10014
|
|
|
9773
10015
|
"use strict";
|
|
9774
10016
|
|
|
@@ -9778,11 +10020,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9778
10020
|
}));
|
|
9779
10021
|
exports.scope = void 0;
|
|
9780
10022
|
|
|
9781
|
-
const global_1 = __webpack_require__(4128);
|
|
9782
|
-
|
|
9783
10023
|
function scope(base, filter = '', bound = `${'id' in base && base.id ? `#${base.id}, ` : ''}section, article, aside, blockquote, pre, .quote, .math, .media`) {
|
|
9784
10024
|
bound += filter && `, ${filter}`;
|
|
9785
|
-
const memory = new
|
|
10025
|
+
const memory = new WeakMap();
|
|
9786
10026
|
const context = 'id' in base && base.closest(bound) || null;
|
|
9787
10027
|
return el => {
|
|
9788
10028
|
const {
|
|
@@ -9791,7 +10031,7 @@ function scope(base, filter = '', bound = `${'id' in base && base.id ? `#${base.
|
|
|
9791
10031
|
const node = memory.has(parentNode) ? parentNode : parentNode.parentNode;
|
|
9792
10032
|
let result = memory.get(node);
|
|
9793
10033
|
|
|
9794
|
-
if (result ===
|
|
10034
|
+
if (result === undefined) {
|
|
9795
10035
|
result = el.closest(bound) === context;
|
|
9796
10036
|
memory.set(node, result);
|
|
9797
10037
|
}
|
|
@@ -9815,8 +10055,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9815
10055
|
}));
|
|
9816
10056
|
exports.toc = void 0;
|
|
9817
10057
|
|
|
9818
|
-
const global_1 = __webpack_require__(4128);
|
|
9819
|
-
|
|
9820
10058
|
const array_1 = __webpack_require__(8112);
|
|
9821
10059
|
|
|
9822
10060
|
const dom_1 = __webpack_require__(3252); // Bug: Firefox
|
|
@@ -9857,7 +10095,7 @@ function parse(node, index = '') {
|
|
|
9857
10095
|
const idx = isHeading ? index === '' ? `${++i}` : `${index}.${++i}` : index === '' ? `${i}` : `${index}.${i}`;
|
|
9858
10096
|
return (0, dom_1.html)('li', (0, array_1.push)([(0, dom_1.html)('a', {
|
|
9859
10097
|
href: `#${el.id}`,
|
|
9860
|
-
'data-index': isHeading ? idx :
|
|
10098
|
+
'data-index': isHeading ? idx : undefined
|
|
9861
10099
|
}, unlink(el.cloneNode(true)))], cs.length > 0 ? [parse(cs, idx)] : []));
|
|
9862
10100
|
}));
|
|
9863
10101
|
}
|
|
@@ -9887,7 +10125,7 @@ function unlink(h) {
|
|
|
9887
10125
|
/***/ 3252:
|
|
9888
10126
|
/***/ (function(module) {
|
|
9889
10127
|
|
|
9890
|
-
/*! typed-dom v0.0.
|
|
10128
|
+
/*! typed-dom v0.0.312 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
9891
10129
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9892
10130
|
if(true)
|
|
9893
10131
|
module.exports = factory();
|
|
@@ -9938,33 +10176,8 @@ exports.equal = equal;
|
|
|
9938
10176
|
|
|
9939
10177
|
/***/ }),
|
|
9940
10178
|
|
|
9941
|
-
/***/ 128:
|
|
9942
|
-
/***/ ((module, __unused_webpack_exports, __nested_webpack_require_2745__) => {
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
__nested_webpack_require_2745__(921);
|
|
9947
|
-
|
|
9948
|
-
const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
|
|
9949
|
-
|| typeof self !== 'undefined' && self || Function('return this')();
|
|
9950
|
-
global.global = global;
|
|
9951
|
-
module.exports = global;
|
|
9952
|
-
|
|
9953
|
-
/***/ }),
|
|
9954
|
-
|
|
9955
|
-
/***/ 921:
|
|
9956
|
-
/***/ (() => {
|
|
9957
|
-
|
|
9958
|
-
// @ts-ignore
|
|
9959
|
-
|
|
9960
|
-
var globalThis; // @ts-ignore
|
|
9961
|
-
|
|
9962
|
-
var global = (/* unused pure expression or super */ null && (0));
|
|
9963
|
-
|
|
9964
|
-
/***/ }),
|
|
9965
|
-
|
|
9966
10179
|
/***/ 808:
|
|
9967
|
-
/***/ ((__unused_webpack_module, exports,
|
|
10180
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_2745__) => {
|
|
9968
10181
|
|
|
9969
10182
|
|
|
9970
10183
|
|
|
@@ -9973,17 +10186,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9973
10186
|
}));
|
|
9974
10187
|
exports.reduce = exports.memoize = void 0;
|
|
9975
10188
|
|
|
9976
|
-
const
|
|
9977
|
-
|
|
9978
|
-
const alias_1 = __nested_webpack_require_3232__(406);
|
|
9979
|
-
|
|
9980
|
-
const compare_1 = __nested_webpack_require_3232__(529);
|
|
10189
|
+
const alias_1 = __nested_webpack_require_2745__(406);
|
|
9981
10190
|
|
|
9982
|
-
const
|
|
10191
|
+
const compare_1 = __nested_webpack_require_2745__(529);
|
|
9983
10192
|
|
|
9984
10193
|
function memoize(f, identify = (...as) => as[0], memory) {
|
|
9985
10194
|
if (typeof identify === 'object') return memoize(f, undefined, identify);
|
|
9986
|
-
return (0, alias_1.isArray)(memory) ? memoizeArray(f, identify, memory) : memoizeObject(f, identify, memory ?? new
|
|
10195
|
+
return (0, alias_1.isArray)(memory) ? memoizeArray(f, identify, memory) : memoizeObject(f, identify, memory ?? new Map());
|
|
9987
10196
|
}
|
|
9988
10197
|
|
|
9989
10198
|
exports.memoize = memoize;
|
|
@@ -10034,7 +10243,7 @@ exports.reduce = reduce;
|
|
|
10034
10243
|
/***/ }),
|
|
10035
10244
|
|
|
10036
10245
|
/***/ 521:
|
|
10037
|
-
/***/ ((__unused_webpack_module, exports,
|
|
10246
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_4210__) => {
|
|
10038
10247
|
|
|
10039
10248
|
|
|
10040
10249
|
|
|
@@ -10043,25 +10252,23 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
10043
10252
|
}));
|
|
10044
10253
|
exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
|
|
10045
10254
|
|
|
10046
|
-
const
|
|
10255
|
+
const alias_1 = __nested_webpack_require_4210__(406);
|
|
10047
10256
|
|
|
10048
|
-
const
|
|
10049
|
-
|
|
10050
|
-
const memoize_1 = __nested_webpack_require_4777__(808);
|
|
10257
|
+
const memoize_1 = __nested_webpack_require_4210__(808);
|
|
10051
10258
|
|
|
10052
10259
|
var caches;
|
|
10053
10260
|
|
|
10054
10261
|
(function (caches) {
|
|
10055
10262
|
caches.shadows = new WeakMap();
|
|
10056
10263
|
caches.shadow = (0, memoize_1.memoize)((el, opts) => el.attachShadow(opts), caches.shadows);
|
|
10057
|
-
caches.fragment =
|
|
10264
|
+
caches.fragment = document.createDocumentFragment();
|
|
10058
10265
|
})(caches || (caches = {}));
|
|
10059
10266
|
|
|
10060
10267
|
function shadow(el, opts, children, factory = exports.html) {
|
|
10061
10268
|
if (typeof el === 'string') return shadow(factory(el), opts, children, factory);
|
|
10062
|
-
if (typeof opts === 'function') return shadow(el,
|
|
10063
|
-
if (typeof children === 'function') return shadow(el, opts,
|
|
10064
|
-
if (isChildren(opts)) return shadow(el,
|
|
10269
|
+
if (typeof opts === 'function') return shadow(el, undefined, children, opts);
|
|
10270
|
+
if (typeof children === 'function') return shadow(el, opts, undefined, children);
|
|
10271
|
+
if (isChildren(opts)) return shadow(el, undefined, opts, factory);
|
|
10065
10272
|
return defineChildren(!opts ? el.shadowRoot ?? caches.shadows.get(el) ?? el.attachShadow({
|
|
10066
10273
|
mode: 'open'
|
|
10067
10274
|
}) : opts.mode === 'open' ? el.shadowRoot ?? el.attachShadow(opts) : caches.shadows.get(el) ?? caches.shadow(el, opts), children);
|
|
@@ -10074,15 +10281,15 @@ function frag(children) {
|
|
|
10074
10281
|
}
|
|
10075
10282
|
|
|
10076
10283
|
exports.frag = frag;
|
|
10077
|
-
exports.html = element(
|
|
10284
|
+
exports.html = element(document, "HTML"
|
|
10078
10285
|
/* NS.HTML */
|
|
10079
10286
|
);
|
|
10080
|
-
exports.svg = element(
|
|
10287
|
+
exports.svg = element(document, "SVG"
|
|
10081
10288
|
/* NS.SVG */
|
|
10082
10289
|
);
|
|
10083
10290
|
|
|
10084
10291
|
function text(source) {
|
|
10085
|
-
return
|
|
10292
|
+
return document.createTextNode(source);
|
|
10086
10293
|
}
|
|
10087
10294
|
|
|
10088
10295
|
exports.text = text;
|
|
@@ -10147,7 +10354,7 @@ function defineAttrs(el, attrs) {
|
|
|
10147
10354
|
case 'connect':
|
|
10148
10355
|
case 'disconnect':
|
|
10149
10356
|
const prop = `on${type}`;
|
|
10150
|
-
el[prop] ??
|
|
10357
|
+
el[prop] ?? Object.defineProperty(el, prop, {
|
|
10151
10358
|
configurable: true,
|
|
10152
10359
|
enumerable: false,
|
|
10153
10360
|
writable: true,
|
|
@@ -10174,7 +10381,7 @@ function defineAttrs(el, attrs) {
|
|
|
10174
10381
|
case 'connect':
|
|
10175
10382
|
case 'disconnect':
|
|
10176
10383
|
const prop = `on${type}`;
|
|
10177
|
-
el[prop] ??
|
|
10384
|
+
el[prop] ?? Object.defineProperty(el, prop, {
|
|
10178
10385
|
configurable: true,
|
|
10179
10386
|
enumerable: false,
|
|
10180
10387
|
writable: true,
|
|
@@ -10198,7 +10405,7 @@ function defineAttrs(el, attrs) {
|
|
|
10198
10405
|
}
|
|
10199
10406
|
|
|
10200
10407
|
function defineChildren(node, children) {
|
|
10201
|
-
if (children ===
|
|
10408
|
+
if (children === undefined) return node;
|
|
10202
10409
|
|
|
10203
10410
|
if (typeof children === 'string') {
|
|
10204
10411
|
node.textContent = children;
|
|
@@ -10215,13 +10422,13 @@ function defineChildren(node, children) {
|
|
|
10215
10422
|
}
|
|
10216
10423
|
|
|
10217
10424
|
function isChildren(value) {
|
|
10218
|
-
return !!value?.[
|
|
10425
|
+
return !!value?.[Symbol.iterator];
|
|
10219
10426
|
}
|
|
10220
10427
|
|
|
10221
10428
|
exports.isChildren = isChildren;
|
|
10222
10429
|
|
|
10223
10430
|
function append(node, children) {
|
|
10224
|
-
if (children ===
|
|
10431
|
+
if (children === undefined) return node;
|
|
10225
10432
|
|
|
10226
10433
|
if (typeof children === 'string') {
|
|
10227
10434
|
node.append(children);
|
|
@@ -10237,7 +10444,7 @@ function append(node, children) {
|
|
|
10237
10444
|
exports.append = append;
|
|
10238
10445
|
|
|
10239
10446
|
function prepend(node, children) {
|
|
10240
|
-
if (children ===
|
|
10447
|
+
if (children === undefined) return node;
|
|
10241
10448
|
|
|
10242
10449
|
if (typeof children === 'string') {
|
|
10243
10450
|
node.prepend(children);
|
|
@@ -10282,7 +10489,7 @@ exports.defrag = defrag;
|
|
|
10282
10489
|
/******/ var __webpack_module_cache__ = {};
|
|
10283
10490
|
/******/
|
|
10284
10491
|
/******/ // The require function
|
|
10285
|
-
/******/ function
|
|
10492
|
+
/******/ function __nested_webpack_require_11074__(moduleId) {
|
|
10286
10493
|
/******/ // Check if module is in cache
|
|
10287
10494
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
10288
10495
|
/******/ if (cachedModule !== undefined) {
|
|
@@ -10296,7 +10503,7 @@ exports.defrag = defrag;
|
|
|
10296
10503
|
/******/ };
|
|
10297
10504
|
/******/
|
|
10298
10505
|
/******/ // Execute the module function
|
|
10299
|
-
/******/ __webpack_modules__[moduleId](module, module.exports,
|
|
10506
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11074__);
|
|
10300
10507
|
/******/
|
|
10301
10508
|
/******/ // Return the exports of the module
|
|
10302
10509
|
/******/ return module.exports;
|
|
@@ -10307,7 +10514,7 @@ exports.defrag = defrag;
|
|
|
10307
10514
|
/******/ // startup
|
|
10308
10515
|
/******/ // Load entry module and return exports
|
|
10309
10516
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
10310
|
-
/******/ var __webpack_exports__ =
|
|
10517
|
+
/******/ var __webpack_exports__ = __nested_webpack_require_11074__(521);
|
|
10311
10518
|
/******/
|
|
10312
10519
|
/******/ return __webpack_exports__;
|
|
10313
10520
|
/******/ })()
|
|
@@ -10319,7 +10526,7 @@ exports.defrag = defrag;
|
|
|
10319
10526
|
/***/ 6120:
|
|
10320
10527
|
/***/ (function(module) {
|
|
10321
10528
|
|
|
10322
|
-
/*! typed-dom v0.0.
|
|
10529
|
+
/*! typed-dom v0.0.312 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
10323
10530
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10324
10531
|
if(true)
|
|
10325
10532
|
module.exports = factory();
|
|
@@ -10423,6 +10630,19 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9450__;
|
|
|
10423
10630
|
/******/ }
|
|
10424
10631
|
/******/
|
|
10425
10632
|
/************************************************************************/
|
|
10633
|
+
/******/ /* webpack/runtime/global */
|
|
10634
|
+
/******/ (() => {
|
|
10635
|
+
/******/ __webpack_require__.g = (function() {
|
|
10636
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
10637
|
+
/******/ try {
|
|
10638
|
+
/******/ return this || new Function('return this')();
|
|
10639
|
+
/******/ } catch (e) {
|
|
10640
|
+
/******/ if (typeof window === 'object') return window;
|
|
10641
|
+
/******/ }
|
|
10642
|
+
/******/ })();
|
|
10643
|
+
/******/ })();
|
|
10644
|
+
/******/
|
|
10645
|
+
/************************************************************************/
|
|
10426
10646
|
/******/
|
|
10427
10647
|
/******/ // startup
|
|
10428
10648
|
/******/ // Load entry module and return exports
|