Skip to content

Instantly share code, notes, and snippets.

@mePy2
Last active April 9, 2023 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mePy2/7c7e37c92c62436e75ae16fc4b1526d3 to your computer and use it in GitHub Desktop.
Save mePy2/7c7e37c92c62436e75ae16fc4b1526d3 to your computer and use it in GitHub Desktop.
var DjVu = (function () {
'use strict';
function DjVuScript() {
'use strict';
var DjVu = {
VERSION: '0.5.4',
IS_DEBUG: false,
setDebugMode: (flag) => DjVu.IS_DEBUG = flag
};
function pLimit(limit = 4) {
const queue = [];
let running = 0;
const runNext = async () => {
if (!queue.length || running >= limit) return;
const func = queue.shift();
try {
running++;
await func();
} finally {
running--;
runNext();
}
};
return func => new Promise((resolve, reject) => {
queue.push(() => func().then(resolve, reject));
runNext();
});
}
function loadFileViaXHR(url, responseType = 'arraybuffer') {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = responseType;
xhr.onload = (e) => resolve(xhr);
xhr.onerror = (e) => reject(xhr);
xhr.send();
});
}
const utf8Decoder = self.TextDecoder ? new self.TextDecoder() : {
decode(utf8array) {
const codePoints = utf8ToCodePoints(utf8array);
return String.fromCodePoint(...codePoints);
}
};
function createStringFromUtf8Array(utf8array) {
return utf8Decoder.decode(utf8array);
}
function utf8ToCodePoints(utf8array) {
var i, c;
var codePoints = [];
i = 0;
while (i < utf8array.length) {
c = utf8array[i++];
switch (c >> 4) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
codePoints.push(c);
break;
case 12: case 13:
codePoints.push(((c & 0x1F) << 6) | (utf8array[i++] & 0x3F));
break;
case 14:
codePoints.push(
((c & 0x0F) << 12) |
((utf8array[i++] & 0x3F) << 6) |
(utf8array[i++] & 0x3F)
);
break;
case 15:
codePoints.push(
((c & 0x07) << 18) |
((utf8array[i++] & 0x3F) << 12) |
((utf8array[i++] & 0x3F) << 6) |
(utf8array[i++] & 0x3F)
);
break;
}
}
return codePoints.map(codePoint => {
return codePoint > 0x10FFFF ? 120 : codePoint;
});
}
function codePointsToUtf8(codePoints) {
var utf8array = [];
codePoints.forEach(codePoint => {
if (codePoint < 0x80) {
utf8array.push(codePoint);
} else if (codePoint < 0x800) {
utf8array.push(0xC0 | (codePoint >> 6));
utf8array.push(0x80 | (codePoint & 0x3F));
} else if (codePoint < 0x10000) {
utf8array.push(0xE0 | (codePoint >> 12));
utf8array.push(0x80 | ((codePoint >> 6) & 0x3F));
utf8array.push(0x80 | (codePoint & 0x3F));
} else {
utf8array.push(0xF0 | (codePoint >> 18));
utf8array.push(0x80 | ((codePoint >> 12) & 0x3F));
utf8array.push(0x80 | ((codePoint >> 6) & 0x3F));
utf8array.push(0x80 | (codePoint & 0x3F));
}
});
return new Uint8Array(utf8array);
}
function stringToCodePoints(str) {
var codePoints = [];
for (var i = 0; i < str.length; i++) {
var code = str.codePointAt(i);
codePoints.push(code);
if (code > 65535) {
i++;
}
}
return codePoints;
}
const pageSize = 64 * 1024;
const growthLimit = 20 * 1024 * 1024 / pageSize;
class ByteStreamWriter {
constructor(length = 0) {
this.memory = new WebAssembly.Memory({ initial: Math.ceil(length / pageSize), maximum: 65536 });
this.assignBufferFromMemory();
this.offset = 0;
this.offsetMarks = {};
}
assignBufferFromMemory() {
this.buffer = this.memory.buffer;
this.viewer = new DataView(this.buffer);
}
reset() {
this.offset = 0;
this.offsetMarks = {};
}
saveOffsetMark(mark) {
this.offsetMarks[mark] = this.offset;
return this;
}
writeByte(byte) {
this.checkOffset(1);
this.viewer.setUint8(this.offset++, byte);
return this;
}
writeStr(str) {
this.writeArray(codePointsToUtf8(stringToCodePoints(str)));
return this;
}
writeInt32(val) {
this.checkOffset(4);
this.viewer.setInt32(this.offset, val);
this.offset += 4;
return this;
}
rewriteInt32(off, val) {
var xoff = off;
if (typeof (xoff) === 'string') {
xoff = this.offsetMarks[off];
this.offsetMarks[off] += 4;
}
this.viewer.setInt32(xoff, val);
}
rewriteSize(offmark) {
if (!this.offsetMarks[offmark]) throw new Error('Unexisting offset mark');
var xoff = this.offsetMarks[offmark];
this.viewer.setInt32(xoff, this.offset - xoff - 4);
}
getBuffer() {
if (this.offset === this.buffer.byteLength) {
return this.buffer;
}
return this.buffer.slice(0, this.offset);
}
checkOffset(requiredBytesNumber = 0) {
const bool = this.offset + requiredBytesNumber > this.buffer.byteLength;
if (bool) {
this._expand(requiredBytesNumber);
}
return bool;
}
_expand(requiredBytesNumber) {
this.memory.grow(Math.max(
Math.ceil(requiredBytesNumber / pageSize),
Math.min(this.memory.buffer.byteLength / pageSize, growthLimit)
));
this.assignBufferFromMemory();
}
jump(length) {
length = +length;
if (length > 0) {
this.checkOffset(length);
}
this.offset += length;
return this;
}
writeByteStream(bs) {
this.writeArray(bs.toUint8Array());
}
writeArray(arr) {
while (this.checkOffset(arr.length)) { }
new Uint8Array(this.buffer).set(arr, this.offset);
this.offset += arr.length;
}
writeBuffer(buffer) {
this.writeArray(new Uint8Array(buffer));
}
writeStrNT(str) {
this.writeStr(str);
this.writeByte(0);
}
writeInt16(val) {
this.checkOffset(2);
this.viewer.setInt16(this.offset, val);
this.offset += 2;
return this;
}
writeUint16(val) {
this.checkOffset(2);
this.viewer.setUint16(this.offset, val);
this.offset += 2;
return this;
}
writeInt24(val) {
this.writeByte((val >> 16) & 0xff)
.writeByte((val >> 8) & 0xff)
.writeByte(val & 0xff);
return this;
}
}
class ZPEncoder {
constructor(bsw) {
this.bsw = bsw || new ByteStreamWriter();
this.a = 0;
this.scount = 0;
this.byte = 0;
this.delay = 25;
this.subend = 0;
this.buffer = 0xffffff;
this.nrun = 0;
}
outbit(bit) {
if (this.delay > 0) {
if (this.delay < 0xff)
this.delay -= 1;
}
else {
this.byte = (this.byte << 1) | bit;
if (++this.scount == 8) {
this.bsw.writeByte(this.byte);
this.scount = 0;
this.byte = 0;
}
}
}
zemit(b) {
this.buffer = (this.buffer << 1) + b;
b = (this.buffer >> 24);
this.buffer = (this.buffer & 0xffffff);
switch (b) {
case 1:
this.outbit(1);
while (this.nrun-- > 0)
this.outbit(0);
this.nrun = 0;
break;
case 0xff:
this.outbit(0);
while (this.nrun-- > 0)
this.outbit(1);
this.nrun = 0;
break;
case 0:
this.nrun += 1;
break;
default:
throw new Exception('ZPEncoder::zemit() error!');
}
}
encode(bit, ctx, n) {
bit = +bit;
if (!ctx) {
return this._ptencode(bit, 0x8000 + (this.a >> 1));
}
var z = this.a + this.p[ctx[n]];
if (bit != (ctx[n] & 1)) {
var d = 0x6000 + ((z + this.a) >> 2);
if (z > d) {
z = d;
}
ctx[n] = this.dn[ctx[n]];
z = 0x10000 - z;
this.subend += z;
this.a += z;
} else if (z >= 0x8000) {
var d = 0x6000 + ((z + this.a) >> 2);
if (z > d) {
z = d;
}
if (this.a >= this.m[ctx[n]])
ctx[n] = this.up[ctx[n]];
this.a = z;
} else {
this.a = z;
return;
}
while (this.a >= 0x8000) {
this.zemit(1 - (this.subend >> 15));
this.subend = 0xffff & (this.subend << 1);
this.a = 0xffff & (this.a << 1);
}
}
IWencode(bit) {
this._ptencode(bit, 0x8000 + ((this.a + this.a + this.a) >> 3));
}
_ptencode(bit, z) {
if (bit) {
z = 0x10000 - z;
this.subend += z;
this.a += z;
} else {
this.a = z;
}
while (this.a >= 0x8000) {
this.zemit(1 - (this.subend >> 15));
this.subend = 0xffff & (this.subend << 1);
this.a = 0xffff & (this.a << 1);
}
}
eflush() {
if (this.subend > 0x8000)
this.subend = 0x10000;
else if (this.subend > 0)
this.subend = 0x8000;
while (this.buffer != 0xffffff || this.subend) {
this.zemit(1 - (this.subend >> 15));
this.subend = 0xffff & (this.subend << 1);
}
this.outbit(1);
while (this.nrun-- > 0)
this.outbit(0);
this.nrun = 0;
while (this.scount > 0)
this.outbit(1);
this.delay = 0xff;
}
}
class ZPDecoder {
constructor(bs) {
this.bs = bs;
this.a = 0x0000;
this.c = this.bs.byte();
this.c <<= 8;
var tmp = this.bs.byte();
this.c |= tmp;
this.z = 0;
this.d = 0;
this.f = Math.min(this.c, 0x7fff);
this.ffzt = new Int8Array(256);
for (var i = 0; i < 256; i++) {
this.ffzt[i] = 0;
for (var j = i; j & 0x80; j <<= 1)
this.ffzt[i] += 1;
}
this.delay = 25;
this.scount = 0;
this.buffer = 0;
this.preload();
}
preload() {
while (this.scount <= 24) {
var byte = this.bs.byte();
this.buffer = (this.buffer << 8) | byte;
this.scount += 8;
}
}
ffz(x) {
return (x >= 0xff00) ? (this.ffzt[x & 0xff] + 8) : (this.ffzt[(x >> 8) & 0xff]);
}
decode(ctx, n) {
if (!ctx) {
return this._ptdecode(0x8000 + (this.a >> 1));
}
this.b = ctx[n] & 1;
this.z = this.a + this.p[ctx[n]];
if (this.z <= this.f) {
this.a = this.z;
return this.b;
}
this.d = 0x6000 + ((this.a + this.z) >> 2);
if (this.z > this.d) {
this.z = this.d;
}
if (this.z > this.c) {
this.b = 1 - this.b;
this.z = 0x10000 - this.z;
this.a += this.z;
this.c += this.z;
ctx[n] = this.dn[ctx[n]];
var shift = this.ffz(this.a);
this.scount -= shift;
this.a = 0xffff & (this.a << shift);
this.c = 0xffff & (
(this.c << shift) | (this.buffer >> this.scount) & ((1 << shift) - 1)
);
}
else {
if (this.a >= this.m[ctx[n]]) {
ctx[n] = this.up[ctx[n]];
}
this.scount--;
this.a = 0xffff & (this.z << 1);
this.c = 0xffff & (
(this.c << 1) | ((this.buffer >> this.scount) & 1)
);
}
if (this.scount < 16)
this.preload();
this.f = Math.min(this.c, 0x7fff);
return this.b;
}
IWdecode() {
return this._ptdecode(0x8000 + ((this.a + this.a + this.a) >> 3));
}
_ptdecode(z) {
this.b = 0;
if (z > this.c) {
this.b = 1;
z = 0x10000 - z;
this.a += z;
this.c += z;
var shift = this.ffz(this.a);
this.scount -= shift;
this.a = 0xffff & (this.a << shift);
this.c = 0xffff & (
(this.c << shift) | (this.buffer >> this.scount) & ((1 << shift) - 1)
);
}
else {
this.b = 0;
this.scount--;
this.a = 0xffff & (z << 1);
this.c = 0xffff & (
(this.c << 1) | ((this.buffer >> this.scount) & 1)
);
}
if (this.scount < 16)
this.preload();
this.f = Math.min(this.c, 0x7fff);
return this.b;
}
}
ZPEncoder.prototype.p = ZPDecoder.prototype.p = Uint16Array.of(
0x8000, 0x8000, 0x8000, 0x6bbd, 0x6bbd, 0x5d45, 0x5d45, 0x51b9, 0x51b9, 0x4813,
0x4813, 0x3fd5, 0x3fd5, 0x38b1, 0x38b1, 0x3275, 0x3275, 0x2cfd, 0x2cfd, 0x2825,
0x2825, 0x23ab, 0x23ab, 0x1f87, 0x1f87, 0x1bbb, 0x1bbb, 0x1845, 0x1845, 0x1523,
0x1523, 0x1253, 0x1253, 0xfcf, 0xfcf, 0xd95, 0xd95, 0xb9d, 0xb9d, 0x9e3,
0x9e3, 0x861, 0x861, 0x711, 0x711, 0x5f1, 0x5f1, 0x4f9, 0x4f9, 0x425,
0x425, 0x371, 0x371, 0x2d9, 0x2d9, 0x259, 0x259, 0x1ed, 0x1ed, 0x193,
0x193, 0x149, 0x149, 0x10b, 0x10b, 0xd5, 0xd5, 0xa5, 0xa5, 0x7b,
0x7b, 0x57, 0x57, 0x3b, 0x3b, 0x23, 0x23, 0x13, 0x13, 0x7,
0x7, 0x1, 0x1, 0x5695, 0x24ee, 0x8000, 0xd30, 0x481a, 0x481, 0x3579,
0x17a, 0x24ef, 0x7b, 0x1978, 0x28, 0x10ca, 0xd, 0xb5d, 0x34, 0x78a,
0xa0, 0x50f, 0x117, 0x358, 0x1ea, 0x234, 0x144, 0x173, 0x234, 0xf5,
0x353, 0xa1, 0x5c5, 0x11a, 0x3cf, 0x1aa, 0x285, 0x286, 0x1ab, 0x3d3,
0x11a, 0x5c5, 0xba, 0x8ad, 0x7a, 0xccc, 0x1eb, 0x1302, 0x2e6, 0x1b81,
0x45e, 0x24ef, 0x690, 0x2865, 0x9de, 0x3987, 0xdc8, 0x2c99, 0x10ca, 0x3b5f,
0xb5d, 0x5695, 0x78a, 0x8000, 0x50f, 0x24ee, 0x358, 0xd30, 0x234, 0x481,
0x173, 0x17a, 0xf5, 0x7b, 0xa1, 0x28, 0x11a, 0xd, 0x1aa, 0x34,
0x286, 0xa0, 0x3d3, 0x117, 0x5c5, 0x1ea, 0x8ad, 0x144, 0xccc, 0x234,
0x1302, 0x353, 0x1b81, 0x5c5, 0x24ef, 0x3cf, 0x2b74, 0x285, 0x201d, 0x1ab,
0x1715, 0x11a, 0xfb7, 0xba, 0xa67, 0x1eb, 0x6e7, 0x2e6, 0x496, 0x45e,
0x30d, 0x690, 0x206, 0x9de, 0x155, 0xdc8, 0xe1, 0x2b74, 0x94, 0x201d,
0x188, 0x1715, 0x252, 0xfb7, 0x383, 0xa67, 0x547, 0x6e7, 0x7e2, 0x496,
0xbc0, 0x30d, 0x1178, 0x206, 0x19da, 0x155, 0x24ef, 0xe1, 0x320e, 0x94,
0x432a, 0x188, 0x447d, 0x252, 0x5ece, 0x383, 0x8000, 0x547, 0x481a, 0x7e2,
0x3579, 0xbc0, 0x24ef, 0x1178, 0x1978, 0x19da, 0x2865, 0x24ef, 0x3987, 0x320e,
0x2c99, 0x432a, 0x3b5f, 0x447d, 0x5695, 0x5ece, 0x8000, 0x8000, 0x5695, 0x481a, 0x481a
);
ZPEncoder.prototype.m = ZPDecoder.prototype.m = Uint16Array.of(
0x0, 0x0, 0x0, 0x10a5, 0x10a5, 0x1f28, 0x1f28, 0x2bd3, 0x2bd3, 0x36e3,
0x36e3, 0x408c, 0x408c, 0x48fd, 0x48fd, 0x505d, 0x505d, 0x56d0, 0x56d0, 0x5c71,
0x5c71, 0x615b, 0x615b, 0x65a5, 0x65a5, 0x6962, 0x6962, 0x6ca2, 0x6ca2, 0x6f74,
0x6f74, 0x71e6, 0x71e6, 0x7404, 0x7404, 0x75d6, 0x75d6, 0x7768, 0x7768, 0x78c2,
0x78c2, 0x79ea, 0x79ea, 0x7ae7, 0x7ae7, 0x7bbe, 0x7bbe, 0x7c75, 0x7c75, 0x7d0f,
0x7d0f, 0x7d91, 0x7d91, 0x7dfe, 0x7dfe, 0x7e5a, 0x7e5a, 0x7ea6, 0x7ea6, 0x7ee6,
0x7ee6, 0x7f1a, 0x7f1a, 0x7f45, 0x7f45, 0x7f6b, 0x7f6b, 0x7f8d, 0x7f8d, 0x7faa,
0x7faa, 0x7fc3, 0x7fc3, 0x7fd7, 0x7fd7, 0x7fe7, 0x7fe7, 0x7ff2, 0x7ff2, 0x7ffa,
0x7ffa, 0x7fff, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
);
ZPEncoder.prototype.up = ZPDecoder.prototype.up = Uint8Array.of(
84, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 81, 82, 9, 86, 5, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 82, 99, 76, 101,
70, 103, 66, 105, 106, 107, 66, 109, 60, 111,
56, 69, 114, 65, 116, 61, 118, 57, 120, 53,
122, 49, 124, 43, 72, 39, 60, 33, 56, 29,
52, 23, 48, 23, 42, 137, 38, 21, 140, 15,
142, 9, 144, 141, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 70, 157, 66, 81, 62, 75,
58, 69, 54, 65, 50, 167, 44, 65, 40, 59,
34, 55, 30, 175, 24, 177, 178, 179, 180, 181,
182, 183, 184, 69, 186, 59, 188, 55, 190, 51,
192, 47, 194, 41, 196, 37, 198, 199, 72, 201,
62, 203, 58, 205, 54, 207, 50, 209, 46, 211,
40, 213, 36, 215, 30, 217, 26, 219, 20, 71,
14, 61, 14, 57, 8, 53, 228, 49, 230, 45,
232, 39, 234, 35, 138, 29, 24, 25, 240, 19,
22, 13, 16, 13, 10, 7, 244, 249, 10, 89, 230
);
ZPEncoder.prototype.dn = ZPDecoder.prototype.dn = Uint8Array.of(
145, 4, 3, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 85, 226, 6, 176, 143, 138, 141,
112, 135, 104, 133, 100, 129, 98, 127, 72, 125,
102, 123, 60, 121, 110, 119, 108, 117, 54, 115,
48, 113, 134, 59, 132, 55, 130, 51, 128, 47,
126, 41, 62, 37, 66, 31, 54, 25, 50, 131,
46, 17, 40, 15, 136, 7, 32, 139, 172, 9,
170, 85, 168, 248, 166, 247, 164, 197, 162, 95,
160, 173, 158, 165, 156, 161, 60, 159, 56, 71,
52, 163, 48, 59, 42, 171, 38, 169, 32, 53,
26, 47, 174, 193, 18, 191, 222, 189, 218, 187,
216, 185, 214, 61, 212, 53, 210, 49, 208, 45,
206, 39, 204, 195, 202, 31, 200, 243, 64, 239,
56, 237, 52, 235, 48, 233, 44, 231, 38, 229,
34, 227, 28, 225, 22, 223, 16, 221, 220, 63,
8, 55, 224, 51, 2, 47, 87, 43, 246, 37,
244, 33, 238, 27, 236, 21, 16, 15, 8, 241,
242, 7, 10, 245, 2, 1, 83, 250, 2, 143, 246
);
class Bitmap {
constructor(width, height) {
var length = Math.ceil(width * height / 8);
this.height = height;
this.width = width;
this.innerArray = new Uint8Array(length);
}
getBits(i, j, bitNumber) {
if (!this.hasRow(i) || j >= this.width) {
return 0;
}
if (j < 0) {
bitNumber += j;
j = 0;
}
var tmp = i * this.width + j;
var index = tmp >> 3;
var bitIndex = tmp & 7;
var mask = 32768 >>> bitIndex;
var twoBytes = ((this.innerArray[index] << 8) | (this.innerArray[index + 1] || 0));
var existingBits = this.width - j;
var border = bitNumber < existingBits ? bitNumber : existingBits;
for (var k = 1; k < border; k++) {
mask |= 32768 >>> (bitIndex + k);
}
return (twoBytes & mask) >>> (16 - bitIndex - bitNumber);
}
get(i, j) {
if (!this.hasRow(i) || j < 0 || j >= this.width) {
return 0;
}
var tmp = i * this.width + j;
var index = tmp >> 3;
var bitIndex = tmp & 7;
var mask = 128 >> bitIndex;
return (this.innerArray[index] & mask) ? 1 : 0;
}
set(i, j) {
var tmp = i * this.width + j;
var index = tmp >> 3;
var bitIndex = tmp & 7;
var mask = 128 >> bitIndex;
this.innerArray[index] |= mask;
return;
}
hasRow(r) {
return r >= 0 && r < this.height;
}
removeEmptyEdges() {
var bottomShift = 0;
var topShift = 0;
var leftShift = 0;
var rightShift = 0;
main_cycle: for (var i = 0; i < this.height; i++) {
for (var j = 0; j < this.width; j++) {
if (this.get(i, j)) {
break main_cycle;
}
}
bottomShift++;
}
main_cycle: for (var i = this.height - 1; i >= 0; i--) {
for (var j = 0; j < this.width; j++) {
if (this.get(i, j)) {
break main_cycle;
}
}
topShift++;
}
main_cycle: for (var j = 0; j < this.width; j++) {
for (var i = 0; i < this.height; i++) {
if (this.get(i, j)) {
break main_cycle;
}
}
leftShift++;
}
main_cycle: for (var j = this.width - 1; j >= 0; j--) {
for (var i = 0; i < this.height; i++) {
if (this.get(i, j)) {
break main_cycle;
}
}
rightShift++;
}
if (topShift || bottomShift || leftShift || rightShift) {
var newWidth = this.width - leftShift - rightShift;
var newHeight = this.height - topShift - bottomShift;
var newBitMap = new Bitmap(newWidth, newHeight);
for (var i = bottomShift, p = 0; p < newHeight; p++ , i++) {
for (var j = leftShift, q = 0; q < newWidth; q++ , j++) {
if (this.get(i, j)) {
newBitMap.set(p, q);
}
}
}
return newBitMap;
}
return this;
}
}
class NumContext {
constructor() {
this.ctx = [0];
this._left = null;
this._right = null;
}
get left() {
if (!this._left) {
this._left = new NumContext();
}
return this._left;
}
get right() {
if (!this._right) {
this._right = new NumContext();
}
return this._right;
}
}
class Baseline {
constructor() {
this.arr = new Array(3);
this.fill(0);
this.index = -1;
}
add(val) {
if (++this.index === 3) {
this.index = 0;
}
this.arr[this.index] = val;
}
getVal() {
if (this.arr[0] >= this.arr[1] && this.arr[0] <= this.arr[2]
|| this.arr[0] <= this.arr[1] && this.arr[0] >= this.arr[2]) {
return this.arr[0];
}
else if (this.arr[1] >= this.arr[0] && this.arr[1] <= this.arr[2]
|| this.arr[1] <= this.arr[0] && this.arr[1] >= this.arr[2]) {
return this.arr[1];
} else {
return this.arr[2];
}
}
fill(val) {
this.arr[0] = this.arr[1] = this.arr[2] = val;
}
}
class DjVuError {
constructor(code, message, additionalData = null) {
this.code = code;
this.message = message;
if (additionalData) this.additionalData = additionalData;
}
}
class IncorrectFileFormatDjVuError extends DjVuError {
constructor() {
super(DjVuErrorCodes.INCORRECT_FILE_FORMAT, "The provided file is not a .djvu file!");
}
}
class NoSuchPageDjVuError extends DjVuError {
constructor(pageNumber) {
super(DjVuErrorCodes.NO_SUCH_PAGE, "There is no page with the number " + pageNumber + " !");
this.pageNumber = pageNumber;
}
}
class CorruptedFileDjVuError extends DjVuError {
constructor(message = "", data = null) {
super(DjVuErrorCodes.FILE_IS_CORRUPTED, "The file is corrupted! " + message, data);
}
}
class UnableToTransferDataDjVuError extends DjVuError {
constructor(tasks) {
super(DjVuErrorCodes.DATA_CANNOT_BE_TRANSFERRED,
"The data cannot be transferred from the worker to the main page! " +
"Perhaps, you requested a complex object like DjVuPage, but only simple objects can be transferred between workers."
);
this.tasks = tasks;
}
}
class IncorrectTaskDjVuError extends DjVuError {
constructor(task) {
super(DjVuErrorCodes.INCORRECT_TASK, "The task contains an incorrect sequence of functions!");
this.task = task;
}
}
class NoBaseUrlDjVuError extends DjVuError {
constructor() {
super(DjVuErrorCodes.NO_BASE_URL,
"The base URL is required for the indirect djvu to load components," +
" but no base URL was provided to the document constructor!"
);
}
}
function getErrorMessageByData(data) {
var message = '';
if (data.pageNumber) {
if (data.dependencyId) {
message = `A dependency ${data.dependencyId} for the page number ${data.pageNumber} can't be loaded!\n`;
} else {
message = `The page number ${data.pageNumber} can't be loaded!`;
}
} else if (data.dependencyId) {
message = `A dependency ${data.dependencyId} can't be loaded!\n`;
}
return message;
}
class UnsuccessfulRequestDjVuError extends DjVuError {
constructor(xhr, data = { pageNumber: null, dependencyId: null }) {
var message = getErrorMessageByData(data);
super(DjVuErrorCodes.UNSUCCESSFUL_REQUEST,
message + '\n' +
`The request to ${xhr.responseURL} wasn't successful.\n` +
`The response status is ${xhr.status}.\n` +
`The response status text is: "${xhr.statusText}".`
);
this.status = xhr.status;
this.statusText = xhr.statusText;
this.url = xhr.responseURL;
if (data.pageNumber) {
this.pageNumber = data.pageNumber;
}
if (data.dependencyId) {
this.dependencyId = data.dependencyId;
}
}
}
class NetworkDjVuError extends DjVuError {
constructor(data = { pageNumber: null, dependencyId: null, url: null }) {
super(DjVuErrorCodes.NETWORK_ERROR,
getErrorMessageByData(data) + '\n' +
"A network error occurred! Check your network connection!"
);
if (data.pageNumber) {
this.pageNumber = data.pageNumber;
}
if (data.dependencyId) {
this.dependencyId = data.dependencyId;
}
if (data.url) {
this.url = data.url;
}
}
}
const DjVuErrorCodes = Object.freeze({
FILE_IS_CORRUPTED: 'FILE_IS_CORRUPTED',
INCORRECT_FILE_FORMAT: 'INCORRECT_FILE_FORMAT',
NO_SUCH_PAGE: 'NO_SUCH_PAGE',
UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
DATA_CANNOT_BE_TRANSFERRED: 'DATA_CANNOT_BE_TRANSFERRED',
INCORRECT_TASK: 'INCORRECT_TASK',
NO_BASE_URL: 'NO_BASE_URL',
NETWORK_ERROR: 'NETWORK_ERROR',
UNSUCCESSFUL_REQUEST: 'UNSUCCESSFUL_REQUEST',
});
class IFFChunk {
constructor(bs) {
this.id = bs.readStr4();
this.length = bs.getInt32();
this.bs = bs;
}
toString() {
return this.id + " " + this.length + '\n';
}
}
class CompositeChunk extends IFFChunk {
constructor(bs) {
super(bs);
this.id += ':' + bs.readStr4();
}
toString(innerString = '') {
return super.toString() + ' ' + innerString.replace(/\n/g, '\n ') + '\n';
}
}
class ColorChunk extends IFFChunk {
constructor(bs) {
super(bs);
this.header = new ColorChunkDataHeader(bs);
}
toString() {
return this.id + " " + this.length + this.header.toString();
}
}
class INFOChunk extends IFFChunk {
constructor(bs) {
super(bs);
if (this.length < 5) {
throw new CorruptedFileDjVuError("The INFO chunk is shorter than 5 bytes!")
}
this.width = bs.getInt16();
this.height = bs.getInt16();
this.minver = bs.getInt8();
this.majver = this.length > 5 ? bs.getInt8() : 0;
if (this.length > 7) {
this.dpi = bs.getUint8();
this.dpi |= bs.getUint8() << 8;
} else {
this.dpi = 300;
}
this.gamma = this.length > 8 ? bs.getInt8() : 22;
this.flags = this.length > 9 ? bs.getInt8() : 0;
if (this.dpi < 25 || this.dpi > 6000) {
this.dpi = 300;
}
if (this.gamma < 3) {
this.gamma = 3;
}
if (this.gamma > 50) {
this.gamma = 50;
}
}
toString() {
var str = super.toString();
str += "{" + 'width:' + this.width + ', '
+ 'height:' + this.height + ', '
+ 'minver:' + this.minver + ', '
+ 'majver:' + this.majver + ', '
+ 'dpi:' + this.dpi + ', '
+ 'gamma:' + this.gamma + ', '
+ 'flags:' + this.flags + '}\n';
return str;
}
}
class ColorChunkDataHeader {
constructor(bs) {
this.serial = bs.getUint8();
this.slices = bs.getUint8();
if (!this.serial) {
this.majver = bs.getUint8();
this.grayscale = this.majver >> 7;
this.minver = bs.getUint8();
this.width = bs.getUint16();
this.height = bs.getUint16();
var byte = bs.getUint8();
this.delayInit = byte & 127;
if (!byte & 128) {
console.warn('Old image reconstruction should be applied!');
}
}
}
toString() {
return '\n' + JSON.stringify(this) + "\n";
}
}
class INCLChunk extends IFFChunk {
constructor(bs) {
super(bs);
this.ref = this.bs.readStrUTF();
}
toString() {
var str = super.toString();
str += "{Reference: " + this.ref + '}\n';
return str;
}
}
class CIDaChunk extends INCLChunk { }
class ErrorChunk {
constructor(id, e) {
this.id = id;
this.e = e;
}
toString() {
return `Error creating ${this.id}: ${this.e.toString()}\n`;
}
}
class JB2Codec extends IFFChunk {
constructor(bs) {
super(bs);
this.zp = new ZPDecoder(this.bs);
this.directBitmapCtx = new Uint8Array(1024);
this.refinementBitmapCtx = new Uint8Array(2048);
this.offsetTypeCtx = [0];
this.resetNumContexts();
}
resetNumContexts() {
this.recordTypeCtx = new NumContext();
this.imageSizeCtx = new NumContext();
this.symbolWidthCtx = new NumContext();
this.symbolHeightCtx = new NumContext();
this.inheritDictSizeCtx = new NumContext();
this.hoffCtx = new NumContext();
this.voffCtx = new NumContext();
this.shoffCtx = new NumContext();
this.svoffCtx = new NumContext();
this.symbolIndexCtx = new NumContext();
this.symbolHeightDiffCtx = new NumContext();
this.symbolWidthDiffCtx = new NumContext();
this.commentLengthCtx = new NumContext();
this.commentOctetCtx = new NumContext();
this.horizontalAbsLocationCtx = new NumContext();
this.verticalAbsLocationCtx = new NumContext();
}
decodeNum(low, high, numctx) {
var negative = false;
var cutoff;
cutoff = 0;
for (var phase = 1, range = 0xffffffff; range != 1;) {
var decision = (low >= cutoff) || ((high >= cutoff) && this.zp.decode(numctx.ctx, 0));
numctx = decision ? numctx.right : numctx.left;
switch (phase) {
case 1:
negative = !decision;
if (negative) {
var temp = - low - 1;
low = - high - 1;
high = temp;
}
phase = 2; cutoff = 1;
break;
case 2:
if (!decision) {
phase = 3;
range = (cutoff + 1) / 2;
if (range == 1)
cutoff = 0;
else
cutoff -= range / 2;
}
else {
cutoff += cutoff + 1;
}
break;
case 3:
range /= 2;
if (range != 1) {
if (!decision)
cutoff -= range / 2;
else
cutoff += range / 2;
}
else if (!decision) {
cutoff--;
}
break;
}
}
return (negative) ? (- cutoff - 1) : cutoff;
}
decodeBitmap(width, height) {
var bitmap = new Bitmap(width, height);
for (var i = height - 1; i >= 0; i--) {
for (var j = 0; j < width; j++) {
var ind = this.getCtxIndex(bitmap, i, j);
if (this.zp.decode(this.directBitmapCtx, ind)) { bitmap.set(i, j); } }
}
return bitmap;
}
getCtxIndex(bm, i, j) {
var index = 0;
var r = i + 2;
if (bm.hasRow(r)) {
index = (bm.getBits(r, j - 1, 3)) << 7;
}
r--;
if (bm.hasRow(r)) {
index |= bm.getBits(r, j - 2, 5) << 2;
}
index |= bm.getBits(i, j - 2, 2);
return index;
}
decodeBitmapRef(width, height, mbm) {
var cbm = new Bitmap(width, height);
var alignInfo = this.alignBitmaps(cbm, mbm);
for (var i = height - 1; i >= 0; i--) {
for (var j = 0; j < width; j++) {
this.zp.decode(this.refinementBitmapCtx,
this.getCtxIndexRef(cbm, mbm, alignInfo, i, j)) ? cbm.set(i, j) : 0;
}
}
return cbm;
}
getCtxIndexRef(cbm, mbm, alignInfo, i, j) {
var index = 0;
var r = i + 1;
if (cbm.hasRow(r)) {
index = cbm.getBits(r, j - 1, 3) << 8;
}
index |= cbm.get(i, j - 1) << 7;
r = i + alignInfo.rowshift + 1;
var c = j + alignInfo.colshift;
index |= mbm.hasRow(r) ? mbm.get(r, c) << 6 : 0;
r--;
if (mbm.hasRow(r)) {
index |= mbm.getBits(r, c - 1, 3) << 3;
}
r--;
if (mbm.hasRow(r)) {
index |= mbm.getBits(r, c - 1, 3);
}
return index;
}
alignBitmaps(cbm, mbm) {
var cwidth = cbm.width - 1;
var cheight = cbm.height - 1;
var crow, ccol, mrow, mcol;
crow = cheight >> 1;
ccol = cwidth >> 1;
mrow = (mbm.height - 1) >> 1;
mcol = (mbm.width - 1) >> 1;
return {
'rowshift': mrow - crow,
'colshift': mcol - ccol
};
}
decodeComment() {
var length = this.decodeNum(0, 262142, this.commentLengthCtx);
var comment = new Uint8Array(length);
for (var i = 0; i < length; comment[i++] = this.decodeNum(0, 255, this.commentOctetCtx)) { }
return comment;
}
drawBitmap(bm) {
var image = document.createElement('canvas')
.getContext('2d')
.createImageData(bm.width, bm.height);
for (var i = 0; i < bm.height; i++) {
for (var j = 0; j < bm.width; j++) {
var v = bm.get(i, j) ? 0 : 255;
var index = ((bm.height - i - 1) * bm.width + j) * 4;
image.data[index] = v;
image.data[index + 1] = v;
image.data[index + 2] = v;
image.data[index + 3] = 255;
}
}
Globals.drawImage(image);
}
}
class JB2Dict extends JB2Codec {
constructor(bs) {
super(bs);
this.dict = [];
this.isDecoded = false;
}
decode(djbz) {
if (this.isDecoded) {
return;
}
var type = this.decodeNum(0, 11, this.recordTypeCtx);
if (type == 9) {
var size = this.decodeNum(0, 262142, this.inheritDictSizeCtx);
djbz.decode();
this.dict = djbz.dict.slice(0, size);
type = this.decodeNum(0, 11, this.recordTypeCtx);
}
this.decodeNum(0, 262142, this.imageSizeCtx);
this.decodeNum(0, 262142, this.imageSizeCtx);
var flag = this.zp.decode([0], 0);
if (flag) {
throw new Error("Bad flag!!!");
}
type = this.decodeNum(0, 11, this.recordTypeCtx);
var width, widthdiff, heightdiff, symbolIndex;
var height;
var bm;
while (type !== 11) {
switch (type) {
case 2:
width = this.decodeNum(0, 262142, this.symbolWidthCtx);
height = this.decodeNum(0, 262142, this.symbolHeightCtx);
bm = this.decodeBitmap(width, height);
this.dict.push(bm);
break;
case 5:
symbolIndex = this.decodeNum(0, this.dict.length - 1, this.symbolIndexCtx);
widthdiff = this.decodeNum(-262143, 262142, this.symbolWidthDiffCtx);
heightdiff = this.decodeNum(-262143, 262142, this.symbolHeightDiffCtx);
var mbm = this.dict[symbolIndex];
var cbm = this.decodeBitmapRef(mbm.width + widthdiff, heightdiff + mbm.height, mbm);
this.dict.push(cbm.removeEmptyEdges());
break;
case 9:
console.log("RESET DICT");
this.resetNumContexts();
break;
case 10:
this.decodeComment();
break;
default:
throw new Error("Unsupported type in JB2Dict: " + type);
}
type = this.decodeNum(0, 11, this.recordTypeCtx);
if (type > 11) {
console.error("TYPE ERROR " + type);
break;
}
}
this.isDecoded = true;
}
}
class DjVuAnno extends IFFChunk { }
class DjViChunk extends CompositeChunk {
constructor(bs) {
super(bs);
this.innerChunk = null;
this.init();
}
init() {
while (!this.bs.isEmpty()) {
var id = this.bs.readStr4();
var length = this.bs.getInt32();
this.bs.jump(-8);
var chunkBs = this.bs.fork(length + 8);
this.bs.jump(8 + length + (length & 1 ? 1 : 0));
switch (id) {
case 'Djbz':
this.innerChunk = new JB2Dict(chunkBs);
break;
case 'ANTa':
case 'ANTz':
this.innerChunk = new DjVuAnno(chunkBs);
break;
default:
this.innerChunk = new IFFChunk(chunkBs);
console.error("Unsupported chunk inside the DJVI chunk: ", id);
break;
}
}
}
toString() {
return super.toString(this.innerChunk.toString());
}
}
class JB2Image extends JB2Codec {
constructor(bs) {
super(bs);
this.dict = [];
this.initialDictLength = 0;
this.blitList = [];
this.init();
}
addBlit(bitmap, x, y) {
this.blitList.push({ bitmap, x, y });
}
init() {
var type = this.decodeNum(0, 11, this.recordTypeCtx);
if (type == 9) {
this.initialDictLength = this.decodeNum(0, 262142, this.inheritDictSizeCtx);
type = this.decodeNum(0, 11, this.recordTypeCtx);
}
this.width = this.decodeNum(0, 262142, this.imageSizeCtx) || 200;
this.height = this.decodeNum(0, 262142, this.imageSizeCtx) || 200;
this.bitmap = false;
this.lastLeft = 0;
this.lastBottom = this.height - 1;
this.firstLeft = -1;
this.firstBottom = this.height - 1;
var flag = this.zp.decode([0], 0);
if (flag) {
throw new Error("Bad flag!!!");
}
this.baseline = new Baseline();
}
toString() {
var str = super.toString();
str += "{width: " + this.width + ", height: " + this.height + '}\n';
return str;
}
decode(djbz) {
if (this.initialDictLength) {
djbz.decode();
this.dict = djbz.dict.slice(0, this.initialDictLength);
}
var type = this.decodeNum(0, 11, this.recordTypeCtx);
var width;
var height, index;
var bm;
while (type !== 11 ) {
switch (type) {
case 1:
width = this.decodeNum(0, 262142, this.symbolWidthCtx);
height = this.decodeNum(0, 262142, this.symbolHeightCtx);
bm = this.decodeBitmap(width, height);
var coords = this.decodeSymbolCoords(bm.width, bm.height);
this.addBlit(bm, coords.x, coords.y);
this.dict.push(bm.removeEmptyEdges());
break;
case 2:
width = this.decodeNum(0, 262142, this.symbolWidthCtx);
height = this.decodeNum(0, 262142, this.symbolHeightCtx);
bm = this.decodeBitmap(width, height);
this.dict.push(bm.removeEmptyEdges());
break;
case 3:
width = this.decodeNum(0, 262142, this.symbolWidthCtx);
height = this.decodeNum(0, 262142, this.symbolHeightCtx);
bm = this.decodeBitmap(width, height);
var coords = this.decodeSymbolCoords(bm.width, bm.height);
this.addBlit(bm, coords.x, coords.y);
break;
case 4:
index = this.decodeNum(0, this.dict.length - 1, this.symbolIndexCtx);
var widthdiff = this.decodeNum(-262143, 262142, this.symbolWidthDiffCtx);
var heightdiff = this.decodeNum(-262143, 262142, this.symbolHeightDiffCtx);
var mbm = this.dict[index];
var cbm = this.decodeBitmapRef(mbm.width + widthdiff, heightdiff + mbm.height, mbm);
var coords = this.decodeSymbolCoords(cbm.width, cbm.height);
this.addBlit(cbm, coords.x, coords.y);
this.dict.push(cbm.removeEmptyEdges());
break;
case 5:
index = this.decodeNum(0, this.dict.length - 1, this.symbolIndexCtx);
widthdiff = this.decodeNum(-262143, 262142, this.symbolWidthDiffCtx);
heightdiff = this.decodeNum(-262143, 262142, this.symbolHeightDiffCtx);
var mbm = this.dict[index];
var cbm = this.decodeBitmapRef(mbm.width + widthdiff, heightdiff + mbm.height, mbm);
this.dict.push(cbm.removeEmptyEdges());
break;
case 6:
index = this.decodeNum(0, this.dict.length - 1, this.symbolIndexCtx);
var widthdiff = this.decodeNum(-262143, 262142, this.symbolWidthDiffCtx);
var heightdiff = this.decodeNum(-262143, 262142, this.symbolHeightDiffCtx);
var mbm = this.dict[index];
var cbm = this.decodeBitmapRef(mbm.width + widthdiff, heightdiff + mbm.height, mbm);
var coords = this.decodeSymbolCoords(cbm.width, cbm.height);
this.addBlit(cbm, coords.x, coords.y);
break;
case 7:
index = this.decodeNum(0, this.dict.length - 1, this.symbolIndexCtx);
bm = this.dict[index];
var coords = this.decodeSymbolCoords(bm.width, bm.height);
this.addBlit(bm, coords.x, coords.y);
break;
case 8:
width = this.decodeNum(0, 262142, this.symbolWidthCtx);
height = this.decodeNum(0, 262142, this.symbolHeightCtx);
bm = this.decodeBitmap(width, height);
var coords = this.decodeAbsoluteLocationCoords(bm.width, bm.height);
this.addBlit(bm, coords.x, coords.y);
break;
case 9:
console.log("RESET NUM CONTEXTS");
this.resetNumContexts();
break;
case 10:
this.decodeComment();
break;
default:
throw new Error("Unsupported type in JB2Image: " + type);
}
type = this.decodeNum(0, 11, this.recordTypeCtx);
if (type > 11) {
console.error("TYPE ERROR " + type);
break;
}
}
}
decodeAbsoluteLocationCoords(width, height) {
var left = this.decodeNum(1, this.width, this.horizontalAbsLocationCtx);
var top = this.decodeNum(1, this.height, this.verticalAbsLocationCtx);
return {
x: left,
y: top - height
}
}
decodeSymbolCoords(width, height) {
var flag = this.zp.decode(this.offsetTypeCtx, 0);
var horizontalOffsetCtx = flag ? this.hoffCtx : this.shoffCtx;
var verticalOffsetCtx = flag ? this.voffCtx : this.svoffCtx;
var horizontalOffset = this.decodeNum(-262143, 262142, horizontalOffsetCtx);
var verticalOffset = this.decodeNum(-262143, 262142, verticalOffsetCtx);
var x, y;
if (flag) {
x = this.firstLeft + horizontalOffset;
y = this.firstBottom + verticalOffset - height + 1;
this.firstLeft = x;
this.firstBottom = y;
this.baseline.fill(y);
}
else {
x = this.lastRight + horizontalOffset;
y = this.baseline.getVal() + verticalOffset;
}
this.baseline.add(y);
this.lastRight = x + width - 1;
return {
'x': x,
'y': y
};
}
copyToBitmap(bm, x, y) {
if (!this.bitmap) {
this.bitmap = new Bitmap(this.width, this.height);
}
for (var i = y, k = 0; k < bm.height; k++ , i++) {
for (var j = x, t = 0; t < bm.width; t++ , j++) {
if (bm.get(k, t)) {
this.bitmap.set(i, j);
}
}
}
}
getBitmap() {
if (!this.bitmap) {
this.blitList.forEach(blit => this.copyToBitmap(blit.bitmap, blit.x, blit.y));
}
return this.bitmap;
}
getMaskImage() {
var imageData = new ImageData(this.width, this.height);
var pixelArray = imageData.data;
var time = performance.now();
pixelArray.fill(255);
for (var blitIndex = 0; blitIndex < this.blitList.length; blitIndex++) {
var blit = this.blitList[blitIndex];
var bm = blit.bitmap;
for (var i = blit.y, k = 0; k < bm.height; k++ , i++) {
for (var j = blit.x, t = 0; t < bm.width; t++ , j++) {
if (bm.get(k, t)) {
var pixelIndex = ((this.height - i - 1) * this.width + j) * 4;
pixelArray[pixelIndex] = 0;
}
}
}
}
DjVu.IS_DEBUG && console.log("JB2Image mask image creating time = ", performance.now() - time);
return imageData;
}
getImage(palette = null, isMarkMaskPixels = false) {
if (palette && palette.getDataSize() !== this.blitList.length) {
palette = null;
}
var pixelArray = new Uint8ClampedArray(this.width * this.height * 4);
var time = performance.now();
pixelArray.fill(255);
var blackPixel = { r: 0, g: 0, b: 0 };
var alpha = isMarkMaskPixels ? 0 : 255;
for (var blitIndex = 0; blitIndex < this.blitList.length; blitIndex++) {
var blit = this.blitList[blitIndex];
var pixel = palette ? palette.getPixelByBlitIndex(blitIndex) : blackPixel;
var bm = blit.bitmap;
for (var i = blit.y, k = 0; k < bm.height; k++ , i++) {
for (var j = blit.x, t = 0; t < bm.width; t++ , j++) {
if (bm.get(k, t)) {
var pixelIndex = ((this.height - i - 1) * this.width + j) << 2;
pixelArray[pixelIndex] = pixel.r;
pixelArray[pixelIndex | 1] = pixel.g;
pixelArray[pixelIndex | 2] = pixel.b;
pixelArray[pixelIndex | 3] = alpha;
}
}
}
}
DjVu.IS_DEBUG && console.log("JB2Image creating time = ", performance.now() - time);
return new ImageData(pixelArray, this.width, this.height);
}
getImageFromBitmap() {
this.getBitmap();
var time = performance.now();
var image = new ImageData(this.width, this.height);
for (var i = 0; i < this.height; i++) {
for (var j = 0; j < this.width; j++) {
var v = this.bitmap.get(i, j) ? 0 : 255;
var index = ((this.height - i - 1) * this.width + j) * 4;
image.data[index] = v;
image.data[index + 1] = v;
image.data[index + 2] = v;
image.data[index + 3] = 255;
}
}
DjVu.IS_DEBUG && console.log("JB2Image creating time = ", performance.now() - time);
return image;
}
}
class ByteStream {
constructor(buffer, offsetx, length) {
this._buffer = buffer;
this.offsetx = offsetx || 0;
this.offset = 0;
this._length = length || buffer.byteLength;
if (this._length + offsetx > buffer.byteLength) {
this._length = buffer.byteLength - offsetx;
console.error("Incorrect length in ByteStream!");
}
this.viewer = new DataView(this._buffer, this.offsetx, this._length);
}
get length() { return this._length; }
get buffer() { return this._buffer; }
getUint8Array(length = this.remainingLength()) {
var off = this.offset;
this.offset += length;
return new Uint8Array(this._buffer, this.offsetx + off, length);
}
toUint8Array() {
return new Uint8Array(this._buffer, this.offsetx, this._length);
}
remainingLength() {
return this._length - this.offset;
}
reset() {
this.offset = 0;
}
byte() {
if (this.offset >= this._length) {
this.offset++;
return 0xff;
}
return this.viewer.getUint8(this.offset++);
}
getInt8() {
return this.viewer.getInt8(this.offset++);
}
getInt16() {
var tmp = this.viewer.getInt16(this.offset);
this.offset += 2;
return tmp;
}
getUint16() {
var tmp = this.viewer.getUint16(this.offset);
this.offset += 2;
return tmp;
}
getInt32() {
var tmp = this.viewer.getInt32(this.offset);
this.offset += 4;
return tmp;
}
getUint8() {
return this.viewer.getUint8(this.offset++);
}
getInt24() {
var uint = this.getUint24();
return (uint & 0x800000) ? (0xffffff - val + 1) * -1 : uint
}
getUint24() {
return (this.byte() << 16) | (this.byte() << 8) | this.byte();
}
jump(length) {
this.offset += length;
return this;
}
setOffset(offset) {
this.offset = offset;
}
readStr4() {
return String.fromCharCode(...this.getUint8Array(4));
}
readStrNT() {
var array = [];
var byte = this.getUint8();
while (byte) {
array.push(byte);
byte = this.getUint8();
}
return createStringFromUtf8Array(new Uint8Array(array));
}
readStrUTF(byteLength) {
return createStringFromUtf8Array(this.getUint8Array(byteLength));
}
fork(length = this.remainingLength()) {
return new ByteStream(this._buffer, this.offsetx + this.offset, length);
}
clone() {
return new ByteStream(this._buffer, this.offsetx, this._length);
}
isEmpty() {
return this.offset >= this._length;
}
}
class BZZDecoder {
constructor(zp) {
this.zp = zp;
this.maxblock = 4096;
this.FREQMAX = 4;
this.CTXIDS = 3;
this.ctx = new Uint8Array(300);
this.size = 0;
this.blocksize = 0;
this.data = null;
}
decode_raw(bits) {
var n = 1;
var m = (1 << bits);
while (n < m) {
var b = this.zp.decode();
n = (n << 1) | b;
}
return n - m;
}
decode_binary(ctxoff, bits) {
var n = 1;
var m = (1 << bits);
ctxoff--;
while (n < m) {
var b = this.zp.decode(this.ctx, ctxoff + n);
n = (n << 1) | b;
}
return n - m;
}
_decode() {
this.size = this.decode_raw(24);
if (!this.size) {
return 0;
}
if (this.size > this.maxblock * 1024) {
throw new Error("Too big block. Error");
}
if (this.blocksize < this.size) {
this.blocksize = this.size;
this.data = new Uint8Array(this.blocksize);
} else if (this.data == null) {
this.data = new Uint8Array(this.blocksize);
}
var fshift = 0;
if (this.zp.decode()) {
fshift++;
if (this.zp.decode()) {
fshift++;
}
}
var mtf = new Uint8Array(256);
for (var i = 0; i < 256; i++) {
mtf[i] = i;
}
var freq = new Array(this.FREQMAX);
for (var i = 0; i < this.FREQMAX; freq[i++] = 0);
var fadd = 4;
var mtfno = 3;
var markerpos = -1;
for (var i = 0; i < this.size; i++) {
var ctxid = this.CTXIDS - 1;
if (ctxid > mtfno) {
ctxid = mtfno;
}
var ctxoff = 0;
switch (0)
{
default:
if (this.zp.decode(this.ctx, ctxoff + ctxid) != 0) {
mtfno = 0;
this.data[i] = mtf[mtfno];
break;
}
ctxoff += this.CTXIDS;
if (this.zp.decode(this.ctx, ctxoff + ctxid) != 0) {
mtfno = 1;
this.data[i] = mtf[mtfno];
break;
}
ctxoff += this.CTXIDS;
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 2 + this.decode_binary(ctxoff + 1, 1);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 1);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 4 + this.decode_binary(ctxoff + 1, 2);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 3);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 8 + this.decode_binary(ctxoff + 1, 3);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 7);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 16 + this.decode_binary(ctxoff + 1, 4);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 15);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 32 + this.decode_binary(ctxoff + 1, 5);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 31);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 64 + this.decode_binary(ctxoff + 1, 6);
this.data[i] = mtf[mtfno];
break;
}
ctxoff += (1 + 63);
if (this.zp.decode(this.ctx, ctxoff + 0) != 0) {
mtfno = 128 + this.decode_binary(ctxoff + 1, 7);
this.data[i] = mtf[mtfno];
break;
}
mtfno = 256;
this.data[i] = 0;
markerpos = i;
continue;
}
var k;
fadd = fadd + (fadd >> fshift);
if (fadd > 0x10000000) {
fadd >>= 24;
freq[0] >>= 24;
freq[1] >>= 24;
freq[2] >>= 24;
freq[3] >>= 24;
for (k = 4; k < this.FREQMAX; k++) {
freq[k] >>= 24;
}
}
var fc = fadd;
if (mtfno < this.FREQMAX) {
fc += freq[mtfno];
}
for (k = mtfno; k >= this.FREQMAX; k--) {
mtf[k] = mtf[k - 1];
}
for (; (k > 0) && ((0xffffffff & fc) >= (0xffffffff & freq[k - 1])); k--) {
mtf[k] = mtf[k - 1];
freq[k] = freq[k - 1];
}
mtf[k] = this.data[i];
freq[k] = fc;
}
if ((markerpos < 1) || (markerpos >= this.size)) {
throw new Error("BZZ byte stream is corrupted");
}
var pos = new Uint32Array(this.size);
for (var j = 0; j < this.size; pos[j++] = 0);
var count = new Array(256);
for (var i = 0; i < 256; count[i++] = 0);
for (var i = 0; i < markerpos; i++) {
var c = this.data[i];
pos[i] = (c << 24) | (count[0xff & c] & 0xffffff);
count[0xff & c]++;
}
for (var i = markerpos + 1; i < this.size; i++) {
var c = this.data[i];
pos[i] = (c << 24) | (count[0xff & c] & 0xffffff);
count[0xff & c]++;
}
var last = 1;
for (var i = 0; i < 256; i++) {
var tmp = count[i];
count[i] = last;
last += tmp;
}
var j = 0;
last = this.size - 1;
while (last > 0) {
var n = pos[j];
var c = pos[j] >> 24;
this.data[--last] = 0xff & c;
j = count[0xff & c] + (n & 0xffffff);
}
if (j != markerpos) {
throw new Error("BZZ byte stream is corrupted");
}
return this.size;
}
getByteStream() {
var bsw, size;
while (size = this._decode()) {
if (!bsw) {
bsw = new ByteStreamWriter(size - 1);
}
var arr = new Uint8Array(this.data.buffer, 0, size - 1);
bsw.writeArray(arr);
}
this.data = null;
return new ByteStream(bsw.getBuffer());
}
static decodeByteStream(bs) {
return new BZZDecoder(new ZPDecoder(bs)).getByteStream();
}
}
class DjVuPalette extends IFFChunk {
constructor(bs) {
var time = performance.now();
super(bs);
this.pixel = { r: 0, g: 0, b: 0 };
this.version = bs.getUint8();
if (this.version & 0x7f) {
throw "Bad Djvu Pallete version!";
}
this.palleteSize = bs.getInt16();
if (this.palleteSize < 0 || this.palleteSize > 65535) {
throw "Bad Djvu Pallete size!";
}
this.colorArray = bs.getUint8Array(this.palleteSize * 3);
if (this.version & 0x80) {
this.dataSize = bs.getInt24();
if (this.dataSize < 0) {
throw "Bad Djvu Pallete data size!";
}
var bsz = BZZDecoder.decodeByteStream(bs.fork());
this.colorIndices = new Int16Array(this.dataSize);
for (var i = 0; i < this.dataSize; i++) {
var index = bsz.getInt16();
if (index < 0 || index >= this.palleteSize) {
throw "Bad Djvu Pallete index! " + index;
}
this.colorIndices[i] = index;
}
}
DjVu.IS_DEBUG && console.log('DjvuPalette time ', performance.now() - time);
}
getDataSize() {
return this.dataSize;
}
getPixelByBlitIndex(index) {
var colorIndex = this.colorIndices[index] * 3;
this.pixel.r = this.colorArray[colorIndex + 2];
this.pixel.g = this.colorArray[colorIndex + 1];
this.pixel.b = this.colorArray[colorIndex];
return this.pixel;
}
toString() {
var str = super.toString();
str += "Pallete size: " + this.palleteSize + "\n";
str += "Data size: " + this.dataSize + "\n";
return str;
}
}
class IWCodecBaseClass {
constructor() {
this.quant_lo = Uint32Array.of(
0x004000, 0x008000, 0x008000, 0x010000, 0x010000,
0x010000, 0x010000, 0x010000, 0x010000, 0x010000,
0x010000, 0x010000, 0x020000, 0x020000, 0x020000, 0x020000
);
this.quant_hi = Uint32Array.of(
0, 0x020000, 0x020000, 0x040000, 0x040000,
0x040000, 0x080000, 0x040000, 0x040000, 0x080000
);
this.bucketstate = new Uint8Array(16);
this.coeffstate = new Array(16);
var buffer = new ArrayBuffer(256);
for (var i = 0; i < 16; i++) {
this.coeffstate[i] = new Uint8Array(buffer, i << 4, 16);
}
this.bbstate = 0;
this.decodeBucketCtx = new Uint8Array(1);
this.decodeCoefCtx = new Uint8Array(80);
this.activateCoefCtx = new Uint8Array(16);
this.inreaseCoefCtx = new Uint8Array(1);
this.curband = 0;
}
getBandBuckets(band) {
return this.bandBuckets[band];
}
is_null_slice() {
if (this.curband == 0)
{
var is_null = 1;
for (var i = 0; i < 16; i++) {
var threshold = this.quant_lo[i];
this.coeffstate[0][i] = 1;
if (threshold > 0 && threshold < 0x8000) {
this.coeffstate[0][i] = 8;
is_null = 0;
}
}
return is_null;
} else
{
var threshold = this.quant_hi[this.curband];
return (!(threshold > 0 && threshold < 0x8000));
}
}
finish_code_slice() {
this.quant_hi[this.curband] = this.quant_hi[this.curband] >> 1;
if (this.curband === 0) {
for (var i = 0; i < 16; i++)
this.quant_lo[i] = this.quant_lo[i] >> 1;
}
this.curband++;
if (this.curband === 10) {
this.curband = 0;
}
}
}
IWCodecBaseClass.prototype.ZERO = 1;
IWCodecBaseClass.prototype.ACTIVE = 2;
IWCodecBaseClass.prototype.NEW = 4;
IWCodecBaseClass.prototype.UNK = 8;
IWCodecBaseClass.prototype.zigzagRow = Uint8Array.of(0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 0, 0, 16, 16, 0, 0, 16, 16, 8, 8, 24, 24, 8, 8, 24, 24, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 4, 4, 20, 20, 4, 4, 20, 20, 12, 12, 28, 28, 12, 12, 28, 28, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 2, 2, 18, 18, 2, 2, 18, 18, 10, 10, 26, 26, 10, 10, 26, 26, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 6, 6, 22, 22, 6, 6, 22, 22, 14, 14, 30, 30, 14, 14, 30, 30, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 1, 1, 17, 17, 1, 1, 17, 17, 9, 9, 25, 25, 9, 9, 25, 25, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 5, 5, 21, 21, 5, 5, 21, 21, 13, 13, 29, 29, 13, 13, 29, 29, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 3, 3, 19, 19, 3, 3, 19, 19, 11, 11, 27, 27, 11, 11, 27, 27, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31, 7, 7, 23, 23, 7, 7, 23, 23, 15, 15, 31, 31, 15, 15, 31, 31);
IWCodecBaseClass.prototype.zigzagCol = Uint8Array.of(0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 0, 16, 0, 16, 8, 24, 8, 24, 0, 16, 0, 16, 8, 24, 8, 24, 4, 20, 4, 20, 12, 28, 12, 28, 4, 20, 4, 20, 12, 28, 12, 28, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 2, 18, 2, 18, 10, 26, 10, 26, 2, 18, 2, 18, 10, 26, 10, 26, 6, 22, 6, 22, 14, 30, 14, 30, 6, 22, 6, 22, 14, 30, 14, 30, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 1, 17, 1, 17, 9, 25, 9, 25, 1, 17, 1, 17, 9, 25, 9, 25, 5, 21, 5, 21, 13, 29, 13, 29, 5, 21, 5, 21, 13, 29, 13, 29, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31, 3, 19, 3, 19, 11, 27, 11, 27, 3, 19, 3, 19, 11, 27, 11, 27, 7, 23, 7, 23, 15, 31, 15, 31, 7, 23, 7, 23, 15, 31, 15, 31);
IWCodecBaseClass.prototype.bandBuckets = [
{ from: 0, to: 0 },
{ from: 1, to: 1 },
{ from: 2, to: 2 },
{ from: 3, to: 3 },
{ from: 4, to: 7 },
{ from: 8, to: 11 },
{ from: 12, to: 15 },
{ from: 16, to: 31 },
{ from: 32, to: 47 },
{ from: 48, to: 63 }
];
function _normalize(val) {
val = (val + 32) >> 6;
if (val < -128) {
return -128;
} else if (val >= 128) {
return 127;
}
return val;
}
class LazyPixelmap {
constructor(ybytemap, cbbytemap, crbytemap) {
this.width = ybytemap.width;
this.yArray = ybytemap.array;
this.cbArray = cbbytemap ? cbbytemap.array : null;
this.crArray = crbytemap ? crbytemap.array : null;
this.writePixel = cbbytemap ? this.writeColoredPixel : this.writeGrayScalePixel;
}
writeGrayScalePixel(index, pixelArray, pixelIndex) {
const value = 127 - _normalize(this.yArray[index]);
pixelArray[pixelIndex] = value;
pixelArray[pixelIndex | 1] = value;
pixelArray[pixelIndex | 2] = value;
}
writeColoredPixel(index, pixelArray, pixelIndex) {
const y = _normalize(this.yArray[index]);
const b = _normalize(this.cbArray[index]);
const r = _normalize(this.crArray[index]);
const t2 = r + (r >> 1);
const t3 = y + 128 - (b >> 2);
pixelArray[pixelIndex] = y + 128 + t2;
pixelArray[pixelIndex | 1] = t3 - (t2 >> 1);
pixelArray[pixelIndex | 2] = t3 + (b << 1);
}
}
class LinearBytemap {
constructor(width, height) {
this.width = width;
this.array = new Int16Array(width * height);
}
get(i, j) {
return this.array[i * this.width + j];
}
set(i, j, val) {
this.array[i * this.width + j] = val;
}
sub(i, j, val) {
this.array[i * this.width + j] -= val;
}
add(i, j, val) {
this.array[i * this.width + j] += val;
}
}
class Bytemap extends Array {
constructor(width, height) {
super(height);
this.height = height;
this.width = width;
for (var i = 0; i < height; i++) {
this[i] = new Int16Array(width);
}
}
}
class Block {
constructor(buffer, offset, withBuckets = false) {
this.array = new Int16Array(buffer, offset, 1024);
if (withBuckets) {
this.buckets = new Array(64);
for (var i = 0; i < 64; i++) {
this.buckets[i] = new Int16Array(buffer, offset, 16);
offset += 32;
}
}
}
setBucketCoef(bucketNumber, index, value) {
this.array[(bucketNumber << 4) | index] = value;
}
getBucketCoef(bucketNumber, index) {
return this.array[(bucketNumber << 4) | index];
}
getCoef(n) {
return this.array[n];
}
setCoef(n, val) {
this.array[n] = val;
}
static createBlockArray(length) {
var blocks = new Array(length);
var buffer = new ArrayBuffer(length << 11);
for (var i = 0; i < length; i++) {
blocks[i] = new Block(buffer, i << 11);
}
return blocks;
}
}
class BlockMemoryManager {
constructor() {
this.buffer = null;
this.offset = 0;
this.retainedMemory = 0;
this.usedMemory = 0;
}
ensureBuffer() {
if (!this.buffer || this.offset >= this.buffer.byteLength) {
this.buffer = new ArrayBuffer(10 << 20);
this.offset = 0;
this.retainedMemory += this.buffer.byteLength;
}
return this.buffer;
}
allocateBucket() {
this.ensureBuffer();
const array = new Int16Array(this.buffer, this.offset, 16);
this.offset += 32;
this.usedMemory += 32;
return array;
}
}
class LazyBlock {
constructor(memoryManager) {
this.buckets = new Array(64);
this.mm = memoryManager;
}
setBucketCoef(bucketNumber, index, value) {
if (!this.buckets[bucketNumber]) {
this.buckets[bucketNumber] = this.mm.allocateBucket();
}
this.buckets[bucketNumber][index] = value;
}
getBucketCoef(bucketNumber, index) {
return this.buckets[bucketNumber] ? this.buckets[bucketNumber][index] : 0;
}
getCoef(n) {
return this.getBucketCoef(n >> 4, n & 15);
}
setCoef(n, val) {
return this.setBucketCoef(n >> 4, n & 15, val);
}
static createBlockArray(length) {
const mm = new BlockMemoryManager();
const blocks = new Array(length);
for (var i = 0; i < length; i++) {
blocks[i] = new LazyBlock(mm);
}
return blocks;
}
}
class IWDecoder extends IWCodecBaseClass {
constructor() {
super();
}
init(imageinfo) {
this.info = imageinfo;
var blockCount = Math.ceil(this.info.width / 32) * Math.ceil(this.info.height / 32);
this.blocks = LazyBlock.createBlockArray(blockCount);
}
decodeSlice(zp, imageinfo) {
if (!this.info) {
this.init(imageinfo);
}
this.zp = zp;
if (!this.is_null_slice()) {
this.blocks.forEach(block => {
this.preliminaryFlagComputation(block);
if (this.blockBandDecodingPass()) {
this.bucketDecodingPass(block, this.curband);
this.newlyActiveCoefficientDecodingPass(block, this.curband);
}
this.previouslyActiveCoefficientDecodingPass(block);
});
}
this.finish_code_slice();
}
previouslyActiveCoefficientDecodingPass(block) {
var boff = 0;
var step = this.quant_hi[this.curband];
var indices = this.getBandBuckets(this.curband);
for (var i = indices.from; i <= indices.to; i++, boff++) {
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & 2 ) {
if (!this.curband) {
step = this.quant_lo[j];
}
var des = 0;
var coef = block.getBucketCoef(i, j);
var absCoef = Math.abs(coef);
if (absCoef <= 3 * step) {
des = this.zp.decode(this.inreaseCoefCtx, 0);
absCoef += step >> 2;
} else {
des = this.zp.IWdecode();
}
if (des) {
absCoef += step >> 1;
} else {
absCoef += -step + (step >> 1);
}
block.setBucketCoef(i, j, coef < 0 ? -absCoef : absCoef);
}
}
}
}
newlyActiveCoefficientDecodingPass(block, band) {
var boff = 0;
var indices = this.getBandBuckets(band);
var step = this.quant_hi[this.curband];
for (var i = indices.from; i <= indices.to; i++, boff++) {
if (this.bucketstate[boff] & 4) {
var shift = 0;
if (this.bucketstate[boff] & 2) {
shift = 8;
}
var np = 0;
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & 8) {
np++;
}
}
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & 8) {
var ip = Math.min(7, np);
var des = this.zp.decode(this.activateCoefCtx, shift + ip);
if (des) {
var sign = this.zp.IWdecode() ? -1 : 1;
np = 0;
if (!this.curband) {
step = this.quant_lo[j];
}
block.setBucketCoef(i, j, sign * (step + (step >> 1) - (step >> 3)));
}
if (np) {
np--;
}
}
}
}
}
}
bucketDecodingPass(block, band) {
var indices = this.getBandBuckets(band);
var boff = 0;
for (var i = indices.from; i <= indices.to; i++, boff++) {
if (!(this.bucketstate[boff] & 8)) {
continue;
}
var n = 0;
if (band) {
var t = 4 * i;
for (var j = t; j < t + 4; j++) {
if (block.getCoef(j)) {
n++;
}
}
if (n === 4) {
n--;
}
}
if (this.bbstate & 2) {
n |= 4;
}
if (this.zp.decode(this.decodeCoefCtx, n + band * 8)) {
this.bucketstate[boff] |= 4;
}
}
}
blockBandDecodingPass() {
var indices = this.getBandBuckets(this.curband);
var bcount = indices.to - indices.from + 1;
if (bcount < 16 || (this.bbstate & 2)) {
this.bbstate |= 4 ;
} else if (this.bbstate & 8) {
if (this.zp.decode(this.decodeBucketCtx, 0)) {
this.bbstate |= 4;
}
}
return this.bbstate & 4;
}
preliminaryFlagComputation(block) {
this.bbstate = 0;
var bstatetmp = 0;
var indices = this.getBandBuckets(this.curband);
if (this.curband) {
var boff = 0;
for (var j = indices.from; j <= indices.to; j++, boff++) {
bstatetmp = 0;
for (var k = 0; k < 16; k++) {
if (block.getBucketCoef(j, k) === 0) {
this.coeffstate[boff][k] = 8;
} else {
this.coeffstate[boff][k] = 2;
}
bstatetmp |= this.coeffstate[boff][k];
}
this.bucketstate[boff] = bstatetmp;
this.bbstate |= bstatetmp;
}
} else {
for (var k = 0; k < 16; k++) {
if (this.coeffstate[0][k] !== 1) {
if (block.getBucketCoef(0, k) === 0) {
this.coeffstate[0][k] = 8;
} else {
this.coeffstate[0][k] = 2;
}
}
bstatetmp |= this.coeffstate[0][k];
}
this.bucketstate[0] = bstatetmp;
this.bbstate |= bstatetmp;
}
}
getBytemap() {
var time = performance.now();
var fullWidth = Math.ceil(this.info.width / 32) * 32;
var fullHeight = Math.ceil(this.info.height / 32) * 32;
var blockRows = Math.ceil(this.info.height / 32);
var blockCols = Math.ceil(this.info.width / 32);
var bm = new LinearBytemap(fullWidth, fullHeight);
for (var r = 0; r < blockRows; r++) {
for (var c = 0; c < blockCols; c++) {
var block = this.blocks[r * blockCols + c];
for (var i = 0; i < 1024; i++) {
bm.set(this.zigzagRow[i] + (r << 5), this.zigzagCol[i] + (c << 5), block.getCoef(i));
}
}
}
DjVu.IS_DEBUG && console.time("inverseTime");
this.inverseWaveletTransform(bm);
DjVu.IS_DEBUG && console.timeEnd("inverseTime");
DjVu.IS_DEBUG && console.log("getBytemap time = ", performance.now() - time);
return bm;
}
inverseWaveletTransform(bitmap) {
var height = this.info.height;
var width = this.info.width;
var a, c, kmax, k, i, border;
var prev3, prev1, next1, next3;
for (var s = 16, sDegree = 4; s !== 0; s >>= 1, sDegree--) {
kmax = (height - 1) >> sDegree;
border = kmax - 3;
for (i = 0; i < width; i += s) {
k = 0;
prev1 = 0; next1 = 0;
next3 = 1 > kmax ? 0 : bitmap.get(1 << sDegree, i);
for (k = 0; k <= kmax; k += 2) {
prev3 = prev1; prev1 = next1; next1 = next3;
next3 = (k + 3) > kmax ? 0 : bitmap.get((k + 3) << sDegree, i);
a = prev1 + next1;
c = prev3 + next3;
bitmap.sub(k << sDegree, i, ((a << 3) + a - c + 16) >> 5);
}
k = 1;
prev1 = bitmap.get((k - 1) << sDegree, i);
if (k + 1 <= kmax) {
next1 = bitmap.get((k + 1) << sDegree, i);
bitmap.add(k << sDegree, i, (prev1 + next1 + 1) >> 1);
} else {
bitmap.add(k << sDegree, i, prev1);
}
if (border >= 3) {
next3 = bitmap.get((k + 3) << sDegree, i);
}
for (k = 3; k <= border; k += 2) {
prev3 = prev1; prev1 = next1; next1 = next3;
next3 = bitmap.get((k + 3) << sDegree, i);
a = prev1 + next1;
bitmap.add(k << sDegree, i,
((a << 3) + a - (prev3 + next3) + 8) >> 4
);
}
for (; k <= kmax; k += 2) {
prev1 = next1; next1 = next3; next3 = 0;
if (k + 1 <= kmax) {
bitmap.add(k << sDegree, i, (prev1 + next1 + 1) >> 1);
} else {
bitmap.add(k << sDegree, i, prev1);
}
}
}
kmax = (width - 1) >> sDegree;
border = kmax - 3;
for (i = 0; i < height; i += s) {
k = 0;
prev1 = 0;
next1 = 0;
next3 = 1 > kmax ? 0 : bitmap.get(i, 1 << sDegree);
for (k = 0; k <= kmax; k += 2) {
prev3 = prev1; prev1 = next1; next1 = next3;
next3 = k + 3 > kmax ? 0 : bitmap.get(i, (k + 3) << sDegree);
a = prev1 + next1;
c = prev3 + next3;
bitmap.sub(i, k << sDegree, ((a << 3) + a - c + 16) >> 5);
}
k = 1;
prev1 = bitmap.get(i, (k - 1) << sDegree);
if (k + 1 <= kmax) {
next1 = bitmap.get(i, (k + 1) << sDegree);
bitmap.add(i, k << sDegree, (prev1 + next1 + 1) >> 1);
} else {
bitmap.add(i, k << sDegree, prev1);
}
if (border >= 3) {
next3 = bitmap.get(i, (k + 3) << sDegree);
}
for (k = 3; k <= border; k += 2) {
prev3 = prev1; prev1 = next1; next1 = next3;
next3 = bitmap.get(i, (k + 3) << sDegree);
a = prev1 + next1;
bitmap.add(i, k << sDegree,
((a << 3) + a - (prev3 + next3) + 8) >> 4
);
}
for (; k <= kmax; k += 2) {
prev1 = next1; next1 = next3; next3 = 0;
if (k + 1 <= kmax) {
bitmap.add(i, k << sDegree, (prev1 + next1 + 1) >> 1);
} else {
bitmap.add(i, k << sDegree, prev1);
}
}
}
}
}
}
class IWImage {
constructor() {
this.info = null;
this.pixelmap = null;
this.resetCodecs();
}
resetCodecs() {
this.ycodec = new IWDecoder();
this.crcodec = this.crcodec ? new IWDecoder() : null;
this.cbcodec = this.cbcodec ? new IWDecoder() : null;
this.cslice = 0;
}
decodeChunk(zp, header) {
if (!this.info) {
this.info = header;
if (!header.grayscale) {
this.crcodec = new IWDecoder();
this.cbcodec = new IWDecoder();
}
} else {
this.info.slices = header.slices;
}
for (var i = 0; i < this.info.slices; i++) {
this.cslice++;
this.ycodec.decodeSlice(zp, header);
if (this.crcodec && this.cbcodec && this.cslice > this.info.delayInit) {
this.cbcodec.decodeSlice(zp, header);
this.crcodec.decodeSlice(zp, header);
}
}
}
createPixelmap() {
var time = performance.now();
var ybitmap = this.ycodec.getBytemap();
var cbbitmap = this.cbcodec ? this.cbcodec.getBytemap() : null;
var crbitmap = this.crcodec ? this.crcodec.getBytemap() : null;
var pixelMapTime = performance.now();
this.pixelmap = new LazyPixelmap(ybitmap, cbbitmap, crbitmap);
DjVu.IS_DEBUG && console.log('Pixelmap constructor time = ', performance.now() - pixelMapTime);
DjVu.IS_DEBUG && console.log('IWImage.createPixelmap time = ', performance.now() - time);
this.resetCodecs();
}
getImage() {
const time = performance.now();
if (!this.pixelmap) this.createPixelmap();
const width = this.info.width;
const height = this.info.height;
const image = new ImageData(width, height);
const processRow = (i) => {
const rowOffset = i * this.pixelmap.width;
let pixelIndex = ((height - i - 1) * width) << 2;
for (let j = 0; j < width; j++) {
this.pixelmap.writePixel(rowOffset + j, image.data, pixelIndex);
image.data[pixelIndex | 3] = 255;
pixelIndex += 4;
}
};
for (let i = 0; i < height; i++) {
processRow(i);
}
DjVu.IS_DEBUG && console.log('IWImage.getImage time = ', performance.now() - time);
return image;
}
}
class DjVuText extends IFFChunk {
constructor(bs) {
super(bs);
this.isDecoded = false;
this.dbs = this.id === 'TXTz' ? null : this.bs;
}
decode() {
if (this.isDecoded) {
return;
}
if (!this.dbs) {
this.dbs = BZZDecoder.decodeByteStream(this.bs);
}
this.textLength = this.dbs.getInt24();
this.utf8array = this.dbs.getUint8Array(this.textLength);
this.version = this.dbs.getUint8();
if (this.version !== 1) {
console.warn("The version in " + this.id + " isn't equal to 1!");
}
this.pageZone = this.dbs.isEmpty() ? null : this.decodeZone();
this.isDecoded = true;
}
decodeZone(parent = null, prev = null) {
var type = this.dbs.getUint8();
var x = this.dbs.getUint16() - 0x8000;
var y = this.dbs.getUint16() - 0x8000;
var width = this.dbs.getUint16() - 0x8000;
var height = this.dbs.getUint16() - 0x8000;
var textStart = this.dbs.getUint16() - 0x8000;
var textLength = this.dbs.getInt24();
if (prev) {
if (type === 1 || type === 4 || type === 5 ) {
x = x + prev.x;
y = prev.y - (y + height);
} else
{
x = x + prev.x + prev.width;
y = y + prev.y;
}
textStart += prev.textStart + prev.textLength;
} else if (parent) {
x = x + parent.x;
y = parent.y + parent.height - (y + height);
textStart += parent.textStart;
}
var zone = { type, x, y, width, height, textStart, textLength };
var childrenCount = this.dbs.getInt24();
if (childrenCount) {
var children = new Array(childrenCount);
var childZone = null;
for (var i = 0; i < childrenCount; i++) {
childZone = this.decodeZone(zone, childZone);
children[i] = childZone;
}
zone.children = children;
}
return zone;
}
getText() {
this.decode();
this.text = this.text || createStringFromUtf8Array(this.utf8array);
return this.text;
}
getPageZone() {
this.decode();
return this.pageZone;
}
getNormalizedZones() {
this.decode();
if (!this.pageZone) {
return null;
}
if (this.normalizedZones) {
return this.normalizedZones;
}
this.normalizedZones = [];
var registry = {};
const process = (zone) => {
if (zone.children) {
zone.children.forEach(zone => process(zone));
} else {
var key = zone.x.toString() + zone.y + zone.width + zone.height;
var zoneText = createStringFromUtf8Array(this.utf8array.slice(zone.textStart, zone.textStart + zone.textLength));
if (registry[key]) {
registry[key].text += zoneText;
} else {
registry[key] = {
x: zone.x,
y: zone.y,
width: zone.width,
height: zone.height,
text: zoneText
};
this.normalizedZones.push(registry[key]);
}
}
};
process(this.pageZone);
return this.normalizedZones;
}
toString() {
this.decode();
var st = "Text length = " + this.textLength + "\n";
return super.toString() + st;
}
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var browser = createCommonjsModule(function (module, exports) {
(function(f){{module.exports=f();}})(function(){return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof commonjsRequire=="function"&&commonjsRequire;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r);}return n[o].exports}var i=typeof commonjsRequire=="function"&&commonjsRequire;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (Buffer){
let interlaceUtils = require("./interlace");
let pixelBppMapper = [
function () {},
function (pxData, data, pxPos, rawPos) {
if (rawPos === data.length) {
throw new Error("Ran out of data");
}
let pixel = data[rawPos];
pxData[pxPos] = pixel;
pxData[pxPos + 1] = pixel;
pxData[pxPos + 2] = pixel;
pxData[pxPos + 3] = 0xff;
},
function (pxData, data, pxPos, rawPos) {
if (rawPos + 1 >= data.length) {
throw new Error("Ran out of data");
}
let pixel = data[rawPos];
pxData[pxPos] = pixel;
pxData[pxPos + 1] = pixel;
pxData[pxPos + 2] = pixel;
pxData[pxPos + 3] = data[rawPos + 1];
},
function (pxData, data, pxPos, rawPos) {
if (rawPos + 2 >= data.length) {
throw new Error("Ran out of data");
}
pxData[pxPos] = data[rawPos];
pxData[pxPos + 1] = data[rawPos + 1];
pxData[pxPos + 2] = data[rawPos + 2];
pxData[pxPos + 3] = 0xff;
},
function (pxData, data, pxPos, rawPos) {
if (rawPos + 3 >= data.length) {
throw new Error("Ran out of data");
}
pxData[pxPos] = data[rawPos];
pxData[pxPos + 1] = data[rawPos + 1];
pxData[pxPos + 2] = data[rawPos + 2];
pxData[pxPos + 3] = data[rawPos + 3];
},
];
let pixelBppCustomMapper = [
function () {},
function (pxData, pixelData, pxPos, maxBit) {
let pixel = pixelData[0];
pxData[pxPos] = pixel;
pxData[pxPos + 1] = pixel;
pxData[pxPos + 2] = pixel;
pxData[pxPos + 3] = maxBit;
},
function (pxData, pixelData, pxPos) {
let pixel = pixelData[0];
pxData[pxPos] = pixel;
pxData[pxPos + 1] = pixel;
pxData[pxPos + 2] = pixel;
pxData[pxPos + 3] = pixelData[1];
},
function (pxData, pixelData, pxPos, maxBit) {
pxData[pxPos] = pixelData[0];
pxData[pxPos + 1] = pixelData[1];
pxData[pxPos + 2] = pixelData[2];
pxData[pxPos + 3] = maxBit;
},
function (pxData, pixelData, pxPos) {
pxData[pxPos] = pixelData[0];
pxData[pxPos + 1] = pixelData[1];
pxData[pxPos + 2] = pixelData[2];
pxData[pxPos + 3] = pixelData[3];
},
];
function bitRetriever(data, depth) {
let leftOver = [];
let i = 0;
function split() {
if (i === data.length) {
throw new Error("Ran out of data");
}
let byte = data[i];
i++;
let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1;
switch (depth) {
default:
throw new Error("unrecognised depth");
case 16:
byte2 = data[i];
i++;
leftOver.push((byte << 8) + byte2);
break;
case 4:
byte2 = byte & 0x0f;
byte1 = byte >> 4;
leftOver.push(byte1, byte2);
break;
case 2:
byte4 = byte & 3;
byte3 = (byte >> 2) & 3;
byte2 = (byte >> 4) & 3;
byte1 = (byte >> 6) & 3;
leftOver.push(byte1, byte2, byte3, byte4);
break;
case 1:
byte8 = byte & 1;
byte7 = (byte >> 1) & 1;
byte6 = (byte >> 2) & 1;
byte5 = (byte >> 3) & 1;
byte4 = (byte >> 4) & 1;
byte3 = (byte >> 5) & 1;
byte2 = (byte >> 6) & 1;
byte1 = (byte >> 7) & 1;
leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8);
break;
}
}
return {
get: function (count) {
while (leftOver.length < count) {
split();
}
let returner = leftOver.slice(0, count);
leftOver = leftOver.slice(count);
return returner;
},
resetAfterLine: function () {
leftOver.length = 0;
},
end: function () {
if (i !== data.length) {
throw new Error("extra data found");
}
},
};
}
function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) {
let imageWidth = image.width;
let imageHeight = image.height;
let imagePass = image.index;
for (let y = 0; y < imageHeight; y++) {
for (let x = 0; x < imageWidth; x++) {
let pxPos = getPxPos(x, y, imagePass);
pixelBppMapper[bpp](pxData, data, pxPos, rawPos);
rawPos += bpp;
}
}
return rawPos;
}
function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) {
let imageWidth = image.width;
let imageHeight = image.height;
let imagePass = image.index;
for (let y = 0; y < imageHeight; y++) {
for (let x = 0; x < imageWidth; x++) {
let pixelData = bits.get(bpp);
let pxPos = getPxPos(x, y, imagePass);
pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit);
}
bits.resetAfterLine();
}
}
exports.dataToBitMap = function (data, bitmapInfo) {
let width = bitmapInfo.width;
let height = bitmapInfo.height;
let depth = bitmapInfo.depth;
let bpp = bitmapInfo.bpp;
let interlace = bitmapInfo.interlace;
let bits;
if (depth !== 8) {
bits = bitRetriever(data, depth);
}
let pxData;
if (depth <= 8) {
pxData = Buffer.alloc(width * height * 4);
} else {
pxData = new Uint16Array(width * height * 4);
}
let maxBit = Math.pow(2, depth) - 1;
let rawPos = 0;
let images;
let getPxPos;
if (interlace) {
images = interlaceUtils.getImagePasses(width, height);
getPxPos = interlaceUtils.getInterlaceIterator(width, height);
} else {
let nonInterlacedPxPos = 0;
getPxPos = function () {
let returner = nonInterlacedPxPos;
nonInterlacedPxPos += 4;
return returner;
};
images = [{ width: width, height: height }];
}
for (let imageIndex = 0; imageIndex < images.length; imageIndex++) {
if (depth === 8) {
rawPos = mapImage8Bit(
images[imageIndex],
pxData,
getPxPos,
bpp,
data,
rawPos
);
} else {
mapImageCustomBit(
images[imageIndex],
pxData,
getPxPos,
bpp,
bits,
maxBit
);
}
}
if (depth === 8) {
if (rawPos !== data.length) {
throw new Error("extra data found");
}
} else {
bits.end();
}
return pxData;
};
}).call(this,require("buffer").Buffer);
},{"./interlace":11,"buffer":28}],2:[function(require,module,exports){
(function (Buffer){
let constants = require("./constants");
module.exports = function (dataIn, width, height, options) {
let outHasAlpha =
[constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(
options.colorType
) !== -1;
if (options.colorType === options.inputColorType) {
let bigEndian = (function () {
let buffer = new ArrayBuffer(2);
new DataView(buffer).setInt16(0, 256, true );
return new Int16Array(buffer)[0] !== 256;
})();
if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) {
return dataIn;
}
}
let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer);
let maxValue = 255;
let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];
if (inBpp === 4 && !options.inputHasAlpha) {
inBpp = 3;
}
let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];
if (options.bitDepth === 16) {
maxValue = 65535;
outBpp *= 2;
}
let outData = Buffer.alloc(width * height * outBpp);
let inIndex = 0;
let outIndex = 0;
let bgColor = options.bgColor || {};
if (bgColor.red === undefined) {
bgColor.red = maxValue;
}
if (bgColor.green === undefined) {
bgColor.green = maxValue;
}
if (bgColor.blue === undefined) {
bgColor.blue = maxValue;
}
function getRGBA() {
let red;
let green;
let blue;
let alpha = maxValue;
switch (options.inputColorType) {
case constants.COLORTYPE_COLOR_ALPHA:
alpha = data[inIndex + 3];
red = data[inIndex];
green = data[inIndex + 1];
blue = data[inIndex + 2];
break;
case constants.COLORTYPE_COLOR:
red = data[inIndex];
green = data[inIndex + 1];
blue = data[inIndex + 2];
break;
case constants.COLORTYPE_ALPHA:
alpha = data[inIndex + 1];
red = data[inIndex];
green = red;
blue = red;
break;
case constants.COLORTYPE_GRAYSCALE:
red = data[inIndex];
green = red;
blue = red;
break;
default:
throw new Error(
"input color type:" +
options.inputColorType +
" is not supported at present"
);
}
if (options.inputHasAlpha) {
if (!outHasAlpha) {
alpha /= maxValue;
red = Math.min(
Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0),
maxValue
);
green = Math.min(
Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0),
maxValue
);
blue = Math.min(
Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0),
maxValue
);
}
}
return { red: red, green: green, blue: blue, alpha: alpha };
}
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let rgba = getRGBA();
switch (options.colorType) {
case constants.COLORTYPE_COLOR_ALPHA:
case constants.COLORTYPE_COLOR:
if (options.bitDepth === 8) {
outData[outIndex] = rgba.red;
outData[outIndex + 1] = rgba.green;
outData[outIndex + 2] = rgba.blue;
if (outHasAlpha) {
outData[outIndex + 3] = rgba.alpha;
}
} else {
outData.writeUInt16BE(rgba.red, outIndex);
outData.writeUInt16BE(rgba.green, outIndex + 2);
outData.writeUInt16BE(rgba.blue, outIndex + 4);
if (outHasAlpha) {
outData.writeUInt16BE(rgba.alpha, outIndex + 6);
}
}
break;
case constants.COLORTYPE_ALPHA:
case constants.COLORTYPE_GRAYSCALE: {
let grayscale = (rgba.red + rgba.green + rgba.blue) / 3;
if (options.bitDepth === 8) {
outData[outIndex] = grayscale;
if (outHasAlpha) {
outData[outIndex + 1] = rgba.alpha;
}
} else {
outData.writeUInt16BE(grayscale, outIndex);
if (outHasAlpha) {
outData.writeUInt16BE(rgba.alpha, outIndex + 2);
}
}
break;
}
default:
throw new Error("unrecognised color Type " + options.colorType);
}
inIndex += inBpp;
outIndex += outBpp;
}
}
return outData;
};
}).call(this,require("buffer").Buffer);
},{"./constants":4,"buffer":28}],3:[function(require,module,exports){
(function (process,Buffer){
let util = require("util");
let Stream = require("stream");
let ChunkStream = (module.exports = function () {
Stream.call(this);
this._buffers = [];
this._buffered = 0;
this._reads = [];
this._paused = false;
this._encoding = "utf8";
this.writable = true;
});
util.inherits(ChunkStream, Stream);
ChunkStream.prototype.read = function (length, callback) {
this._reads.push({
length: Math.abs(length),
allowLess: length < 0,
func: callback,
});
process.nextTick(
function () {
this._process();
if (this._paused && this._reads && this._reads.length > 0) {
this._paused = false;
this.emit("drain");
}
}.bind(this)
);
};
ChunkStream.prototype.write = function (data, encoding) {
if (!this.writable) {
this.emit("error", new Error("Stream not writable"));
return false;
}
let dataBuffer;
if (Buffer.isBuffer(data)) {
dataBuffer = data;
} else {
dataBuffer = Buffer.from(data, encoding || this._encoding);
}
this._buffers.push(dataBuffer);
this._buffered += dataBuffer.length;
this._process();
if (this._reads && this._reads.length === 0) {
this._paused = true;
}
return this.writable && !this._paused;
};
ChunkStream.prototype.end = function (data, encoding) {
if (data) {
this.write(data, encoding);
}
this.writable = false;
if (!this._buffers) {
return;
}
if (this._buffers.length === 0) {
this._end();
} else {
this._buffers.push(null);
this._process();
}
};
ChunkStream.prototype.destroySoon = ChunkStream.prototype.end;
ChunkStream.prototype._end = function () {
if (this._reads.length > 0) {
this.emit("error", new Error("Unexpected end of input"));
}
this.destroy();
};
ChunkStream.prototype.destroy = function () {
if (!this._buffers) {
return;
}
this.writable = false;
this._reads = null;
this._buffers = null;
this.emit("close");
};
ChunkStream.prototype._processReadAllowingLess = function (read) {
this._reads.shift();
let smallerBuf = this._buffers[0];
if (smallerBuf.length > read.length) {
this._buffered -= read.length;
this._buffers[0] = smallerBuf.slice(read.length);
read.func.call(this, smallerBuf.slice(0, read.length));
} else {
this._buffered -= smallerBuf.length;
this._buffers.shift();
read.func.call(this, smallerBuf);
}
};
ChunkStream.prototype._processRead = function (read) {
this._reads.shift();
let pos = 0;
let count = 0;
let data = Buffer.alloc(read.length);
while (pos < read.length) {
let buf = this._buffers[count++];
let len = Math.min(buf.length, read.length - pos);
buf.copy(data, pos, 0, len);
pos += len;
if (len !== buf.length) {
this._buffers[--count] = buf.slice(len);
}
}
if (count > 0) {
this._buffers.splice(0, count);
}
this._buffered -= read.length;
read.func.call(this, data);
};
ChunkStream.prototype._process = function () {
try {
while (this._buffered > 0 && this._reads && this._reads.length > 0) {
let read = this._reads[0];
if (read.allowLess) {
this._processReadAllowingLess(read);
} else if (this._buffered >= read.length) {
this._processRead(read);
} else {
break;
}
}
if (this._buffers && !this.writable) {
this._end();
}
} catch (ex) {
this.emit("error", ex);
}
};
}).call(this,require('_process'),require("buffer").Buffer);
},{"_process":47,"buffer":28,"stream":63,"util":67}],4:[function(require,module,exports){
module.exports = {
PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],
TYPE_IHDR: 0x49484452,
TYPE_IEND: 0x49454e44,
TYPE_IDAT: 0x49444154,
TYPE_PLTE: 0x504c5445,
TYPE_tRNS: 0x74524e53,
TYPE_gAMA: 0x67414d41,
COLORTYPE_GRAYSCALE: 0,
COLORTYPE_PALETTE: 1,
COLORTYPE_COLOR: 2,
COLORTYPE_ALPHA: 4,
COLORTYPE_PALETTE_COLOR: 3,
COLORTYPE_COLOR_ALPHA: 6,
COLORTYPE_TO_BPP_MAP: {
0: 1,
2: 3,
3: 1,
4: 2,
6: 4,
},
GAMMA_DIVISION: 100000,
};
},{}],5:[function(require,module,exports){
let crcTable = [];
(function () {
for (let i = 0; i < 256; i++) {
let currentCrc = i;
for (let j = 0; j < 8; j++) {
if (currentCrc & 1) {
currentCrc = 0xedb88320 ^ (currentCrc >>> 1);
} else {
currentCrc = currentCrc >>> 1;
}
}
crcTable[i] = currentCrc;
}
})();
let CrcCalculator = (module.exports = function () {
this._crc = -1;
});
CrcCalculator.prototype.write = function (data) {
for (let i = 0; i < data.length; i++) {
this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8);
}
return true;
};
CrcCalculator.prototype.crc32 = function () {
return this._crc ^ -1;
};
CrcCalculator.crc32 = function (buf) {
let crc = -1;
for (let i = 0; i < buf.length; i++) {
crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
}
return crc ^ -1;
};
},{}],6:[function(require,module,exports){
(function (Buffer){
let paethPredictor = require("./paeth-predictor");
function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {
for (let x = 0; x < byteWidth; x++) {
rawData[rawPos + x] = pxData[pxPos + x];
}
}
function filterSumNone(pxData, pxPos, byteWidth) {
let sum = 0;
let length = pxPos + byteWidth;
for (let i = pxPos; i < length; i++) {
sum += Math.abs(pxData[i]);
}
return sum;
}
function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let val = pxData[pxPos + x] - left;
rawData[rawPos + x] = val;
}
}
function filterSumSub(pxData, pxPos, byteWidth, bpp) {
let sum = 0;
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let val = pxData[pxPos + x] - left;
sum += Math.abs(val);
}
return sum;
}
function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {
for (let x = 0; x < byteWidth; x++) {
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
let val = pxData[pxPos + x] - up;
rawData[rawPos + x] = val;
}
}
function filterSumUp(pxData, pxPos, byteWidth) {
let sum = 0;
let length = pxPos + byteWidth;
for (let x = pxPos; x < length; x++) {
let up = pxPos > 0 ? pxData[x - byteWidth] : 0;
let val = pxData[x] - up;
sum += Math.abs(val);
}
return sum;
}
function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
let val = pxData[pxPos + x] - ((left + up) >> 1);
rawData[rawPos + x] = val;
}
}
function filterSumAvg(pxData, pxPos, byteWidth, bpp) {
let sum = 0;
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
let val = pxData[pxPos + x] - ((left + up) >> 1);
sum += Math.abs(val);
}
return sum;
}
function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
let upleft =
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);
rawData[rawPos + x] = val;
}
}
function filterSumPaeth(pxData, pxPos, byteWidth, bpp) {
let sum = 0;
for (let x = 0; x < byteWidth; x++) {
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
let upleft =
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);
sum += Math.abs(val);
}
return sum;
}
let filters = {
0: filterNone,
1: filterSub,
2: filterUp,
3: filterAvg,
4: filterPaeth,
};
let filterSums = {
0: filterSumNone,
1: filterSumSub,
2: filterSumUp,
3: filterSumAvg,
4: filterSumPaeth,
};
module.exports = function (pxData, width, height, options, bpp) {
let filterTypes;
if (!("filterType" in options) || options.filterType === -1) {
filterTypes = [0, 1, 2, 3, 4];
} else if (typeof options.filterType === "number") {
filterTypes = [options.filterType];
} else {
throw new Error("unrecognised filter types");
}
if (options.bitDepth === 16) {
bpp *= 2;
}
let byteWidth = width * bpp;
let rawPos = 0;
let pxPos = 0;
let rawData = Buffer.alloc((byteWidth + 1) * height);
let sel = filterTypes[0];
for (let y = 0; y < height; y++) {
if (filterTypes.length > 1) {
let min = Infinity;
for (let i = 0; i < filterTypes.length; i++) {
let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp);
if (sum < min) {
sel = filterTypes[i];
min = sum;
}
}
}
rawData[rawPos] = sel;
rawPos++;
filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp);
rawPos += byteWidth;
pxPos += byteWidth;
}
return rawData;
};
}).call(this,require("buffer").Buffer);
},{"./paeth-predictor":15,"buffer":28}],7:[function(require,module,exports){
(function (Buffer){
let util = require("util");
let ChunkStream = require("./chunkstream");
let Filter = require("./filter-parse");
let FilterAsync = (module.exports = function (bitmapInfo) {
ChunkStream.call(this);
let buffers = [];
let that = this;
this._filter = new Filter(bitmapInfo, {
read: this.read.bind(this),
write: function (buffer) {
buffers.push(buffer);
},
complete: function () {
that.emit("complete", Buffer.concat(buffers));
},
});
this._filter.start();
});
util.inherits(FilterAsync, ChunkStream);
}).call(this,require("buffer").Buffer);
},{"./chunkstream":3,"./filter-parse":9,"buffer":28,"util":67}],8:[function(require,module,exports){
(function (Buffer){
let SyncReader = require("./sync-reader");
let Filter = require("./filter-parse");
exports.process = function (inBuffer, bitmapInfo) {
let outBuffers = [];
let reader = new SyncReader(inBuffer);
let filter = new Filter(bitmapInfo, {
read: reader.read.bind(reader),
write: function (bufferPart) {
outBuffers.push(bufferPart);
},
complete: function () {},
});
filter.start();
reader.process();
return Buffer.concat(outBuffers);
};
}).call(this,require("buffer").Buffer);
},{"./filter-parse":9,"./sync-reader":22,"buffer":28}],9:[function(require,module,exports){
(function (Buffer){
let interlaceUtils = require("./interlace");
let paethPredictor = require("./paeth-predictor");
function getByteWidth(width, bpp, depth) {
let byteWidth = width * bpp;
if (depth !== 8) {
byteWidth = Math.ceil(byteWidth / (8 / depth));
}
return byteWidth;
}
let Filter = (module.exports = function (bitmapInfo, dependencies) {
let width = bitmapInfo.width;
let height = bitmapInfo.height;
let interlace = bitmapInfo.interlace;
let bpp = bitmapInfo.bpp;
let depth = bitmapInfo.depth;
this.read = dependencies.read;
this.write = dependencies.write;
this.complete = dependencies.complete;
this._imageIndex = 0;
this._images = [];
if (interlace) {
let passes = interlaceUtils.getImagePasses(width, height);
for (let i = 0; i < passes.length; i++) {
this._images.push({
byteWidth: getByteWidth(passes[i].width, bpp, depth),
height: passes[i].height,
lineIndex: 0,
});
}
} else {
this._images.push({
byteWidth: getByteWidth(width, bpp, depth),
height: height,
lineIndex: 0,
});
}
if (depth === 8) {
this._xComparison = bpp;
} else if (depth === 16) {
this._xComparison = bpp * 2;
} else {
this._xComparison = 1;
}
});
Filter.prototype.start = function () {
this.read(
this._images[this._imageIndex].byteWidth + 1,
this._reverseFilterLine.bind(this)
);
};
Filter.prototype._unFilterType1 = function (
rawData,
unfilteredLine,
byteWidth
) {
let xComparison = this._xComparison;
let xBiggerThan = xComparison - 1;
for (let x = 0; x < byteWidth; x++) {
let rawByte = rawData[1 + x];
let f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
unfilteredLine[x] = rawByte + f1Left;
}
};
Filter.prototype._unFilterType2 = function (
rawData,
unfilteredLine,
byteWidth
) {
let lastLine = this._lastLine;
for (let x = 0; x < byteWidth; x++) {
let rawByte = rawData[1 + x];
let f2Up = lastLine ? lastLine[x] : 0;
unfilteredLine[x] = rawByte + f2Up;
}
};
Filter.prototype._unFilterType3 = function (
rawData,
unfilteredLine,
byteWidth
) {
let xComparison = this._xComparison;
let xBiggerThan = xComparison - 1;
let lastLine = this._lastLine;
for (let x = 0; x < byteWidth; x++) {
let rawByte = rawData[1 + x];
let f3Up = lastLine ? lastLine[x] : 0;
let f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
let f3Add = Math.floor((f3Left + f3Up) / 2);
unfilteredLine[x] = rawByte + f3Add;
}
};
Filter.prototype._unFilterType4 = function (
rawData,
unfilteredLine,
byteWidth
) {
let xComparison = this._xComparison;
let xBiggerThan = xComparison - 1;
let lastLine = this._lastLine;
for (let x = 0; x < byteWidth; x++) {
let rawByte = rawData[1 + x];
let f4Up = lastLine ? lastLine[x] : 0;
let f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
let f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0;
let f4Add = paethPredictor(f4Left, f4Up, f4UpLeft);
unfilteredLine[x] = rawByte + f4Add;
}
};
Filter.prototype._reverseFilterLine = function (rawData) {
let filter = rawData[0];
let unfilteredLine;
let currentImage = this._images[this._imageIndex];
let byteWidth = currentImage.byteWidth;
if (filter === 0) {
unfilteredLine = rawData.slice(1, byteWidth + 1);
} else {
unfilteredLine = Buffer.alloc(byteWidth);
switch (filter) {
case 1:
this._unFilterType1(rawData, unfilteredLine, byteWidth);
break;
case 2:
this._unFilterType2(rawData, unfilteredLine, byteWidth);
break;
case 3:
this._unFilterType3(rawData, unfilteredLine, byteWidth);
break;
case 4:
this._unFilterType4(rawData, unfilteredLine, byteWidth);
break;
default:
throw new Error("Unrecognised filter type - " + filter);
}
}
this.write(unfilteredLine);
currentImage.lineIndex++;
if (currentImage.lineIndex >= currentImage.height) {
this._lastLine = null;
this._imageIndex++;
currentImage = this._images[this._imageIndex];
} else {
this._lastLine = unfilteredLine;
}
if (currentImage) {
this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this));
} else {
this._lastLine = null;
this.complete();
}
};
}).call(this,require("buffer").Buffer);
},{"./interlace":11,"./paeth-predictor":15,"buffer":28}],10:[function(require,module,exports){
(function (Buffer){
function dePalette(indata, outdata, width, height, palette) {
let pxPos = 0;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let color = palette[indata[pxPos]];
if (!color) {
throw new Error("index " + indata[pxPos] + " not in palette");
}
for (let i = 0; i < 4; i++) {
outdata[pxPos + i] = color[i];
}
pxPos += 4;
}
}
}
function replaceTransparentColor(indata, outdata, width, height, transColor) {
let pxPos = 0;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let makeTrans = false;
if (transColor.length === 1) {
if (transColor[0] === indata[pxPos]) {
makeTrans = true;
}
} else if (
transColor[0] === indata[pxPos] &&
transColor[1] === indata[pxPos + 1] &&
transColor[2] === indata[pxPos + 2]
) {
makeTrans = true;
}
if (makeTrans) {
for (let i = 0; i < 4; i++) {
outdata[pxPos + i] = 0;
}
}
pxPos += 4;
}
}
}
function scaleDepth(indata, outdata, width, height, depth) {
let maxOutSample = 255;
let maxInSample = Math.pow(2, depth) - 1;
let pxPos = 0;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
for (let i = 0; i < 4; i++) {
outdata[pxPos + i] = Math.floor(
(indata[pxPos + i] * maxOutSample) / maxInSample + 0.5
);
}
pxPos += 4;
}
}
}
module.exports = function (indata, imageData) {
let depth = imageData.depth;
let width = imageData.width;
let height = imageData.height;
let colorType = imageData.colorType;
let transColor = imageData.transColor;
let palette = imageData.palette;
let outdata = indata;
if (colorType === 3) {
dePalette(indata, outdata, width, height, palette);
} else {
if (transColor) {
replaceTransparentColor(indata, outdata, width, height, transColor);
}
if (depth !== 8) {
if (depth === 16) {
outdata = Buffer.alloc(width * height * 4);
}
scaleDepth(indata, outdata, width, height, depth);
}
}
return outdata;
};
}).call(this,require("buffer").Buffer);
},{"buffer":28}],11:[function(require,module,exports){
let imagePasses = [
{
x: [0],
y: [0],
},
{
x: [4],
y: [0],
},
{
x: [0, 4],
y: [4],
},
{
x: [2, 6],
y: [0, 4],
},
{
x: [0, 2, 4, 6],
y: [2, 6],
},
{
x: [1, 3, 5, 7],
y: [0, 2, 4, 6],
},
{
x: [0, 1, 2, 3, 4, 5, 6, 7],
y: [1, 3, 5, 7],
},
];
exports.getImagePasses = function (width, height) {
let images = [];
let xLeftOver = width % 8;
let yLeftOver = height % 8;
let xRepeats = (width - xLeftOver) / 8;
let yRepeats = (height - yLeftOver) / 8;
for (let i = 0; i < imagePasses.length; i++) {
let pass = imagePasses[i];
let passWidth = xRepeats * pass.x.length;
let passHeight = yRepeats * pass.y.length;
for (let j = 0; j < pass.x.length; j++) {
if (pass.x[j] < xLeftOver) {
passWidth++;
} else {
break;
}
}
for (let j = 0; j < pass.y.length; j++) {
if (pass.y[j] < yLeftOver) {
passHeight++;
} else {
break;
}
}
if (passWidth > 0 && passHeight > 0) {
images.push({ width: passWidth, height: passHeight, index: i });
}
}
return images;
};
exports.getInterlaceIterator = function (width) {
return function (x, y, pass) {
let outerXLeftOver = x % imagePasses[pass].x.length;
let outerX =
((x - outerXLeftOver) / imagePasses[pass].x.length) * 8 +
imagePasses[pass].x[outerXLeftOver];
let outerYLeftOver = y % imagePasses[pass].y.length;
let outerY =
((y - outerYLeftOver) / imagePasses[pass].y.length) * 8 +
imagePasses[pass].y[outerYLeftOver];
return outerX * 4 + outerY * width * 4;
};
};
},{}],12:[function(require,module,exports){
(function (Buffer){
let util = require("util");
let Stream = require("stream");
let constants = require("./constants");
let Packer = require("./packer");
let PackerAsync = (module.exports = function (opt) {
Stream.call(this);
let options = opt || {};
this._packer = new Packer(options);
this._deflate = this._packer.createDeflate();
this.readable = true;
});
util.inherits(PackerAsync, Stream);
PackerAsync.prototype.pack = function (data, width, height, gamma) {
this.emit("data", Buffer.from(constants.PNG_SIGNATURE));
this.emit("data", this._packer.packIHDR(width, height));
if (gamma) {
this.emit("data", this._packer.packGAMA(gamma));
}
let filteredData = this._packer.filterData(data, width, height);
this._deflate.on("error", this.emit.bind(this, "error"));
this._deflate.on(
"data",
function (compressedData) {
this.emit("data", this._packer.packIDAT(compressedData));
}.bind(this)
);
this._deflate.on(
"end",
function () {
this.emit("data", this._packer.packIEND());
this.emit("end");
}.bind(this)
);
this._deflate.end(filteredData);
};
}).call(this,require("buffer").Buffer);
},{"./constants":4,"./packer":14,"buffer":28,"stream":63,"util":67}],13:[function(require,module,exports){
(function (Buffer){
let hasSyncZlib = true;
let zlib = require("zlib");
if (!zlib.deflateSync) {
hasSyncZlib = false;
}
let constants = require("./constants");
let Packer = require("./packer");
module.exports = function (metaData, opt) {
if (!hasSyncZlib) {
throw new Error(
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
);
}
let options = opt || {};
let packer = new Packer(options);
let chunks = [];
chunks.push(Buffer.from(constants.PNG_SIGNATURE));
chunks.push(packer.packIHDR(metaData.width, metaData.height));
if (metaData.gamma) {
chunks.push(packer.packGAMA(metaData.gamma));
}
let filteredData = packer.filterData(
metaData.data,
metaData.width,
metaData.height
);
let compressedData = zlib.deflateSync(
filteredData,
packer.getDeflateOptions()
);
filteredData = null;
if (!compressedData || !compressedData.length) {
throw new Error("bad png - invalid compressed data response");
}
chunks.push(packer.packIDAT(compressedData));
chunks.push(packer.packIEND());
return Buffer.concat(chunks);
};
}).call(this,require("buffer").Buffer);
},{"./constants":4,"./packer":14,"buffer":28,"zlib":27}],14:[function(require,module,exports){
(function (Buffer){
let constants = require("./constants");
let CrcStream = require("./crc");
let bitPacker = require("./bitpacker");
let filter = require("./filter-pack");
let zlib = require("zlib");
let Packer = (module.exports = function (options) {
this._options = options;
options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;
options.deflateLevel =
options.deflateLevel != null ? options.deflateLevel : 9;
options.deflateStrategy =
options.deflateStrategy != null ? options.deflateStrategy : 3;
options.inputHasAlpha =
options.inputHasAlpha != null ? options.inputHasAlpha : true;
options.deflateFactory = options.deflateFactory || zlib.createDeflate;
options.bitDepth = options.bitDepth || 8;
options.colorType =
typeof options.colorType === "number"
? options.colorType
: constants.COLORTYPE_COLOR_ALPHA;
options.inputColorType =
typeof options.inputColorType === "number"
? options.inputColorType
: constants.COLORTYPE_COLOR_ALPHA;
if (
[
constants.COLORTYPE_GRAYSCALE,
constants.COLORTYPE_COLOR,
constants.COLORTYPE_COLOR_ALPHA,
constants.COLORTYPE_ALPHA,
].indexOf(options.colorType) === -1
) {
throw new Error(
"option color type:" + options.colorType + " is not supported at present"
);
}
if (
[
constants.COLORTYPE_GRAYSCALE,
constants.COLORTYPE_COLOR,
constants.COLORTYPE_COLOR_ALPHA,
constants.COLORTYPE_ALPHA,
].indexOf(options.inputColorType) === -1
) {
throw new Error(
"option input color type:" +
options.inputColorType +
" is not supported at present"
);
}
if (options.bitDepth !== 8 && options.bitDepth !== 16) {
throw new Error(
"option bit depth:" + options.bitDepth + " is not supported at present"
);
}
});
Packer.prototype.getDeflateOptions = function () {
return {
chunkSize: this._options.deflateChunkSize,
level: this._options.deflateLevel,
strategy: this._options.deflateStrategy,
};
};
Packer.prototype.createDeflate = function () {
return this._options.deflateFactory(this.getDeflateOptions());
};
Packer.prototype.filterData = function (data, width, height) {
let packedData = bitPacker(data, width, height, this._options);
let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType];
let filteredData = filter(packedData, width, height, this._options, bpp);
return filteredData;
};
Packer.prototype._packChunk = function (type, data) {
let len = data ? data.length : 0;
let buf = Buffer.alloc(len + 12);
buf.writeUInt32BE(len, 0);
buf.writeUInt32BE(type, 4);
if (data) {
data.copy(buf, 8);
}
buf.writeInt32BE(
CrcStream.crc32(buf.slice(4, buf.length - 4)),
buf.length - 4
);
return buf;
};
Packer.prototype.packGAMA = function (gamma) {
let buf = Buffer.alloc(4);
buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0);
return this._packChunk(constants.TYPE_gAMA, buf);
};
Packer.prototype.packIHDR = function (width, height) {
let buf = Buffer.alloc(13);
buf.writeUInt32BE(width, 0);
buf.writeUInt32BE(height, 4);
buf[8] = this._options.bitDepth;
buf[9] = this._options.colorType;
buf[10] = 0;
buf[11] = 0;
buf[12] = 0;
return this._packChunk(constants.TYPE_IHDR, buf);
};
Packer.prototype.packIDAT = function (data) {
return this._packChunk(constants.TYPE_IDAT, data);
};
Packer.prototype.packIEND = function () {
return this._packChunk(constants.TYPE_IEND, null);
};
}).call(this,require("buffer").Buffer);
},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,"buffer":28,"zlib":27}],15:[function(require,module,exports){
module.exports = function paethPredictor(left, above, upLeft) {
let paeth = left + above - upLeft;
let pLeft = Math.abs(paeth - left);
let pAbove = Math.abs(paeth - above);
let pUpLeft = Math.abs(paeth - upLeft);
if (pLeft <= pAbove && pLeft <= pUpLeft) {
return left;
}
if (pAbove <= pUpLeft) {
return above;
}
return upLeft;
};
},{}],16:[function(require,module,exports){
let util = require("util");
let zlib = require("zlib");
let ChunkStream = require("./chunkstream");
let FilterAsync = require("./filter-parse-async");
let Parser = require("./parser");
let bitmapper = require("./bitmapper");
let formatNormaliser = require("./format-normaliser");
let ParserAsync = (module.exports = function (options) {
ChunkStream.call(this);
this._parser = new Parser(options, {
read: this.read.bind(this),
error: this._handleError.bind(this),
metadata: this._handleMetaData.bind(this),
gamma: this.emit.bind(this, "gamma"),
palette: this._handlePalette.bind(this),
transColor: this._handleTransColor.bind(this),
finished: this._finished.bind(this),
inflateData: this._inflateData.bind(this),
simpleTransparency: this._simpleTransparency.bind(this),
headersFinished: this._headersFinished.bind(this),
});
this._options = options;
this.writable = true;
this._parser.start();
});
util.inherits(ParserAsync, ChunkStream);
ParserAsync.prototype._handleError = function (err) {
this.emit("error", err);
this.writable = false;
this.destroy();
if (this._inflate && this._inflate.destroy) {
this._inflate.destroy();
}
if (this._filter) {
this._filter.destroy();
this._filter.on("error", function () {});
}
this.errord = true;
};
ParserAsync.prototype._inflateData = function (data) {
if (!this._inflate) {
if (this._bitmapInfo.interlace) {
this._inflate = zlib.createInflate();
this._inflate.on("error", this.emit.bind(this, "error"));
this._filter.on("complete", this._complete.bind(this));
this._inflate.pipe(this._filter);
} else {
let rowSize =
((this._bitmapInfo.width *
this._bitmapInfo.bpp *
this._bitmapInfo.depth +
7) >>
3) +
1;
let imageSize = rowSize * this._bitmapInfo.height;
let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);
this._inflate = zlib.createInflate({ chunkSize: chunkSize });
let leftToInflate = imageSize;
let emitError = this.emit.bind(this, "error");
this._inflate.on("error", function (err) {
if (!leftToInflate) {
return;
}
emitError(err);
});
this._filter.on("complete", this._complete.bind(this));
let filterWrite = this._filter.write.bind(this._filter);
this._inflate.on("data", function (chunk) {
if (!leftToInflate) {
return;
}
if (chunk.length > leftToInflate) {
chunk = chunk.slice(0, leftToInflate);
}
leftToInflate -= chunk.length;
filterWrite(chunk);
});
this._inflate.on("end", this._filter.end.bind(this._filter));
}
}
this._inflate.write(data);
};
ParserAsync.prototype._handleMetaData = function (metaData) {
this._metaData = metaData;
this._bitmapInfo = Object.create(metaData);
this._filter = new FilterAsync(this._bitmapInfo);
};
ParserAsync.prototype._handleTransColor = function (transColor) {
this._bitmapInfo.transColor = transColor;
};
ParserAsync.prototype._handlePalette = function (palette) {
this._bitmapInfo.palette = palette;
};
ParserAsync.prototype._simpleTransparency = function () {
this._metaData.alpha = true;
};
ParserAsync.prototype._headersFinished = function () {
this.emit("metadata", this._metaData);
};
ParserAsync.prototype._finished = function () {
if (this.errord) {
return;
}
if (!this._inflate) {
this.emit("error", "No Inflate block");
} else {
this._inflate.end();
}
};
ParserAsync.prototype._complete = function (filteredData) {
if (this.errord) {
return;
}
let normalisedBitmapData;
try {
let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo);
normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo);
bitmapData = null;
} catch (ex) {
this._handleError(ex);
return;
}
this.emit("parsed", normalisedBitmapData);
};
},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,"util":67,"zlib":27}],17:[function(require,module,exports){
(function (Buffer){
let hasSyncZlib = true;
let zlib = require("zlib");
let inflateSync = require("./sync-inflate");
if (!zlib.deflateSync) {
hasSyncZlib = false;
}
let SyncReader = require("./sync-reader");
let FilterSync = require("./filter-parse-sync");
let Parser = require("./parser");
let bitmapper = require("./bitmapper");
let formatNormaliser = require("./format-normaliser");
module.exports = function (buffer, options) {
if (!hasSyncZlib) {
throw new Error(
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
);
}
let err;
function handleError(_err_) {
err = _err_;
}
let metaData;
function handleMetaData(_metaData_) {
metaData = _metaData_;
}
function handleTransColor(transColor) {
metaData.transColor = transColor;
}
function handlePalette(palette) {
metaData.palette = palette;
}
function handleSimpleTransparency() {
metaData.alpha = true;
}
let gamma;
function handleGamma(_gamma_) {
gamma = _gamma_;
}
let inflateDataList = [];
function handleInflateData(inflatedData) {
inflateDataList.push(inflatedData);
}
let reader = new SyncReader(buffer);
let parser = new Parser(options, {
read: reader.read.bind(reader),
error: handleError,
metadata: handleMetaData,
gamma: handleGamma,
palette: handlePalette,
transColor: handleTransColor,
inflateData: handleInflateData,
simpleTransparency: handleSimpleTransparency,
});
parser.start();
reader.process();
if (err) {
throw err;
}
let inflateData = Buffer.concat(inflateDataList);
inflateDataList.length = 0;
let inflatedData;
if (metaData.interlace) {
inflatedData = zlib.inflateSync(inflateData);
} else {
let rowSize =
((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
let imageSize = rowSize * metaData.height;
inflatedData = inflateSync(inflateData, {
chunkSize: imageSize,
maxLength: imageSize,
});
}
inflateData = null;
if (!inflatedData || !inflatedData.length) {
throw new Error("bad png - invalid inflate data response");
}
let unfilteredData = FilterSync.process(inflatedData, metaData);
inflateData = null;
let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData);
unfilteredData = null;
let normalisedBitmapData = formatNormaliser(bitmapData, metaData);
metaData.data = normalisedBitmapData;
metaData.gamma = gamma || 0;
return metaData;
};
}).call(this,require("buffer").Buffer);
},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,"buffer":28,"zlib":27}],18:[function(require,module,exports){
(function (Buffer){
let constants = require("./constants");
let CrcCalculator = require("./crc");
let Parser = (module.exports = function (options, dependencies) {
this._options = options;
options.checkCRC = options.checkCRC !== false;
this._hasIHDR = false;
this._hasIEND = false;
this._emittedHeadersFinished = false;
this._palette = [];
this._colorType = 0;
this._chunks = {};
this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this);
this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this);
this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this);
this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this);
this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this);
this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this);
this.read = dependencies.read;
this.error = dependencies.error;
this.metadata = dependencies.metadata;
this.gamma = dependencies.gamma;
this.transColor = dependencies.transColor;
this.palette = dependencies.palette;
this.parsed = dependencies.parsed;
this.inflateData = dependencies.inflateData;
this.finished = dependencies.finished;
this.simpleTransparency = dependencies.simpleTransparency;
this.headersFinished = dependencies.headersFinished || function () {};
});
Parser.prototype.start = function () {
this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this));
};
Parser.prototype._parseSignature = function (data) {
let signature = constants.PNG_SIGNATURE;
for (let i = 0; i < signature.length; i++) {
if (data[i] !== signature[i]) {
this.error(new Error("Invalid file signature"));
return;
}
}
this.read(8, this._parseChunkBegin.bind(this));
};
Parser.prototype._parseChunkBegin = function (data) {
let length = data.readUInt32BE(0);
let type = data.readUInt32BE(4);
let name = "";
for (let i = 4; i < 8; i++) {
name += String.fromCharCode(data[i]);
}
let ancillary = Boolean(data[4] & 0x20);
if (!this._hasIHDR && type !== constants.TYPE_IHDR) {
this.error(new Error("Expected IHDR on beggining"));
return;
}
this._crc = new CrcCalculator();
this._crc.write(Buffer.from(name));
if (this._chunks[type]) {
return this._chunks[type](length);
}
if (!ancillary) {
this.error(new Error("Unsupported critical chunk type " + name));
return;
}
this.read(length + 4, this._skipChunk.bind(this));
};
Parser.prototype._skipChunk = function () {
this.read(8, this._parseChunkBegin.bind(this));
};
Parser.prototype._handleChunkEnd = function () {
this.read(4, this._parseChunkEnd.bind(this));
};
Parser.prototype._parseChunkEnd = function (data) {
let fileCrc = data.readInt32BE(0);
let calcCrc = this._crc.crc32();
if (this._options.checkCRC && calcCrc !== fileCrc) {
this.error(new Error("Crc error - " + fileCrc + " - " + calcCrc));
return;
}
if (!this._hasIEND) {
this.read(8, this._parseChunkBegin.bind(this));
}
};
Parser.prototype._handleIHDR = function (length) {
this.read(length, this._parseIHDR.bind(this));
};
Parser.prototype._parseIHDR = function (data) {
this._crc.write(data);
let width = data.readUInt32BE(0);
let height = data.readUInt32BE(4);
let depth = data[8];
let colorType = data[9];
let compr = data[10];
let filter = data[11];
let interlace = data[12];
if (
depth !== 8 &&
depth !== 4 &&
depth !== 2 &&
depth !== 1 &&
depth !== 16
) {
this.error(new Error("Unsupported bit depth " + depth));
return;
}
if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) {
this.error(new Error("Unsupported color type"));
return;
}
if (compr !== 0) {
this.error(new Error("Unsupported compression method"));
return;
}
if (filter !== 0) {
this.error(new Error("Unsupported filter method"));
return;
}
if (interlace !== 0 && interlace !== 1) {
this.error(new Error("Unsupported interlace method"));
return;
}
this._colorType = colorType;
let bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType];
this._hasIHDR = true;
this.metadata({
width: width,
height: height,
depth: depth,
interlace: Boolean(interlace),
palette: Boolean(colorType & constants.COLORTYPE_PALETTE),
color: Boolean(colorType & constants.COLORTYPE_COLOR),
alpha: Boolean(colorType & constants.COLORTYPE_ALPHA),
bpp: bpp,
colorType: colorType,
});
this._handleChunkEnd();
};
Parser.prototype._handlePLTE = function (length) {
this.read(length, this._parsePLTE.bind(this));
};
Parser.prototype._parsePLTE = function (data) {
this._crc.write(data);
let entries = Math.floor(data.length / 3);
for (let i = 0; i < entries; i++) {
this._palette.push([data[i * 3], data[i * 3 + 1], data[i * 3 + 2], 0xff]);
}
this.palette(this._palette);
this._handleChunkEnd();
};
Parser.prototype._handleTRNS = function (length) {
this.simpleTransparency();
this.read(length, this._parseTRNS.bind(this));
};
Parser.prototype._parseTRNS = function (data) {
this._crc.write(data);
if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) {
if (this._palette.length === 0) {
this.error(new Error("Transparency chunk must be after palette"));
return;
}
if (data.length > this._palette.length) {
this.error(new Error("More transparent colors than palette size"));
return;
}
for (let i = 0; i < data.length; i++) {
this._palette[i][3] = data[i];
}
this.palette(this._palette);
}
if (this._colorType === constants.COLORTYPE_GRAYSCALE) {
this.transColor([data.readUInt16BE(0)]);
}
if (this._colorType === constants.COLORTYPE_COLOR) {
this.transColor([
data.readUInt16BE(0),
data.readUInt16BE(2),
data.readUInt16BE(4),
]);
}
this._handleChunkEnd();
};
Parser.prototype._handleGAMA = function (length) {
this.read(length, this._parseGAMA.bind(this));
};
Parser.prototype._parseGAMA = function (data) {
this._crc.write(data);
this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION);
this._handleChunkEnd();
};
Parser.prototype._handleIDAT = function (length) {
if (!this._emittedHeadersFinished) {
this._emittedHeadersFinished = true;
this.headersFinished();
}
this.read(-length, this._parseIDAT.bind(this, length));
};
Parser.prototype._parseIDAT = function (length, data) {
this._crc.write(data);
if (
this._colorType === constants.COLORTYPE_PALETTE_COLOR &&
this._palette.length === 0
) {
throw new Error("Expected palette not found");
}
this.inflateData(data);
let leftOverLength = length - data.length;
if (leftOverLength > 0) {
this._handleIDAT(leftOverLength);
} else {
this._handleChunkEnd();
}
};
Parser.prototype._handleIEND = function (length) {
this.read(length, this._parseIEND.bind(this));
};
Parser.prototype._parseIEND = function (data) {
this._crc.write(data);
this._hasIEND = true;
this._handleChunkEnd();
if (this.finished) {
this.finished();
}
};
}).call(this,require("buffer").Buffer);
},{"./constants":4,"./crc":5,"buffer":28}],19:[function(require,module,exports){
let parse = require("./parser-sync");
let pack = require("./packer-sync");
exports.read = function (buffer, options) {
return parse(buffer, options || {});
};
exports.write = function (png, options) {
return pack(png, options);
};
},{"./packer-sync":13,"./parser-sync":17}],20:[function(require,module,exports){
(function (process,Buffer){
let util = require("util");
let Stream = require("stream");
let Parser = require("./parser-async");
let Packer = require("./packer-async");
let PNGSync = require("./png-sync");
let PNG = (exports.PNG = function (options) {
Stream.call(this);
options = options || {};
this.width = options.width | 0;
this.height = options.height | 0;
this.data =
this.width > 0 && this.height > 0
? Buffer.alloc(4 * this.width * this.height)
: null;
if (options.fill && this.data) {
this.data.fill(0);
}
this.gamma = 0;
this.readable = this.writable = true;
this._parser = new Parser(options);
this._parser.on("error", this.emit.bind(this, "error"));
this._parser.on("close", this._handleClose.bind(this));
this._parser.on("metadata", this._metadata.bind(this));
this._parser.on("gamma", this._gamma.bind(this));
this._parser.on(
"parsed",
function (data) {
this.data = data;
this.emit("parsed", data);
}.bind(this)
);
this._packer = new Packer(options);
this._packer.on("data", this.emit.bind(this, "data"));
this._packer.on("end", this.emit.bind(this, "end"));
this._parser.on("close", this._handleClose.bind(this));
this._packer.on("error", this.emit.bind(this, "error"));
});
util.inherits(PNG, Stream);
PNG.sync = PNGSync;
PNG.prototype.pack = function () {
if (!this.data || !this.data.length) {
this.emit("error", "No data provided");
return this;
}
process.nextTick(
function () {
this._packer.pack(this.data, this.width, this.height, this.gamma);
}.bind(this)
);
return this;
};
PNG.prototype.parse = function (data, callback) {
if (callback) {
let onParsed, onError;
onParsed = function (parsedData) {
this.removeListener("error", onError);
this.data = parsedData;
callback(null, this);
}.bind(this);
onError = function (err) {
this.removeListener("parsed", onParsed);
callback(err, null);
}.bind(this);
this.once("parsed", onParsed);
this.once("error", onError);
}
this.end(data);
return this;
};
PNG.prototype.write = function (data) {
this._parser.write(data);
return true;
};
PNG.prototype.end = function (data) {
this._parser.end(data);
};
PNG.prototype._metadata = function (metadata) {
this.width = metadata.width;
this.height = metadata.height;
this.emit("metadata", metadata);
};
PNG.prototype._gamma = function (gamma) {
this.gamma = gamma;
};
PNG.prototype._handleClose = function () {
if (!this._parser.writable && !this._packer.readable) {
this.emit("close");
}
};
PNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) {
srcX |= 0;
srcY |= 0;
width |= 0;
height |= 0;
deltaX |= 0;
deltaY |= 0;
if (
srcX > src.width ||
srcY > src.height ||
srcX + width > src.width ||
srcY + height > src.height
) {
throw new Error("bitblt reading outside image");
}
if (
deltaX > dst.width ||
deltaY > dst.height ||
deltaX + width > dst.width ||
deltaY + height > dst.height
) {
throw new Error("bitblt writing outside image");
}
for (let y = 0; y < height; y++) {
src.data.copy(
dst.data,
((deltaY + y) * dst.width + deltaX) << 2,
((srcY + y) * src.width + srcX) << 2,
((srcY + y) * src.width + srcX + width) << 2
);
}
};
PNG.prototype.bitblt = function (
dst,
srcX,
srcY,
width,
height,
deltaX,
deltaY
) {
PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY);
return this;
};
PNG.adjustGamma = function (src) {
if (src.gamma) {
for (let y = 0; y < src.height; y++) {
for (let x = 0; x < src.width; x++) {
let idx = (src.width * y + x) << 2;
for (let i = 0; i < 3; i++) {
let sample = src.data[idx + i] / 255;
sample = Math.pow(sample, 1 / 2.2 / src.gamma);
src.data[idx + i] = Math.round(sample * 255);
}
}
}
src.gamma = 0;
}
};
PNG.prototype.adjustGamma = function () {
PNG.adjustGamma(this);
};
}).call(this,require('_process'),require("buffer").Buffer);
},{"./packer-async":12,"./parser-async":16,"./png-sync":19,"_process":47,"buffer":28,"stream":63,"util":67}],21:[function(require,module,exports){
(function (process,Buffer){
let assert = require("assert").ok;
let zlib = require("zlib");
let util = require("util");
let kMaxLength = require("buffer").kMaxLength;
function Inflate(opts) {
if (!(this instanceof Inflate)) {
return new Inflate(opts);
}
if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) {
opts.chunkSize = zlib.Z_MIN_CHUNK;
}
zlib.Inflate.call(this, opts);
this._offset = this._offset === undefined ? this._outOffset : this._offset;
this._buffer = this._buffer || this._outBuffer;
if (opts && opts.maxLength != null) {
this._maxLength = opts.maxLength;
}
}
function createInflate(opts) {
return new Inflate(opts);
}
function _close(engine, callback) {
if (callback) {
process.nextTick(callback);
}
if (!engine._handle) {
return;
}
engine._handle.close();
engine._handle = null;
}
Inflate.prototype._processChunk = function (chunk, flushFlag, asyncCb) {
if (typeof asyncCb === "function") {
return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb);
}
let self = this;
let availInBefore = chunk && chunk.length;
let availOutBefore = this._chunkSize - this._offset;
let leftToInflate = this._maxLength;
let inOff = 0;
let buffers = [];
let nread = 0;
let error;
this.on("error", function (err) {
error = err;
});
function handleChunk(availInAfter, availOutAfter) {
if (self._hadError) {
return;
}
let have = availOutBefore - availOutAfter;
assert(have >= 0, "have should not go down");
if (have > 0) {
let out = self._buffer.slice(self._offset, self._offset + have);
self._offset += have;
if (out.length > leftToInflate) {
out = out.slice(0, leftToInflate);
}
buffers.push(out);
nread += out.length;
leftToInflate -= out.length;
if (leftToInflate === 0) {
return false;
}
}
if (availOutAfter === 0 || self._offset >= self._chunkSize) {
availOutBefore = self._chunkSize;
self._offset = 0;
self._buffer = Buffer.allocUnsafe(self._chunkSize);
}
if (availOutAfter === 0) {
inOff += availInBefore - availInAfter;
availInBefore = availInAfter;
return true;
}
return false;
}
assert(this._handle, "zlib binding closed");
let res;
do {
res = this._handle.writeSync(
flushFlag,
chunk,
inOff,
availInBefore,
this._buffer,
this._offset,
availOutBefore
);
res = res || this._writeState;
} while (!this._hadError && handleChunk(res[0], res[1]));
if (this._hadError) {
throw error;
}
if (nread >= kMaxLength) {
_close(this);
throw new RangeError(
"Cannot create final Buffer. It would be larger than 0x" +
kMaxLength.toString(16) +
" bytes"
);
}
let buf = Buffer.concat(buffers, nread);
_close(this);
return buf;
};
util.inherits(Inflate, zlib.Inflate);
function zlibBufferSync(engine, buffer) {
if (typeof buffer === "string") {
buffer = Buffer.from(buffer);
}
if (!(buffer instanceof Buffer)) {
throw new TypeError("Not a string or buffer");
}
let flushFlag = engine._finishFlushFlag;
if (flushFlag == null) {
flushFlag = zlib.Z_FINISH;
}
return engine._processChunk(buffer, flushFlag);
}
function inflateSync(buffer, opts) {
return zlibBufferSync(new Inflate(opts), buffer);
}
module.exports = exports = inflateSync;
exports.Inflate = Inflate;
exports.createInflate = createInflate;
exports.inflateSync = inflateSync;
}).call(this,require('_process'),require("buffer").Buffer);
},{"_process":47,"assert":23,"buffer":28,"util":67,"zlib":27}],22:[function(require,module,exports){
let SyncReader = (module.exports = function (buffer) {
this._buffer = buffer;
this._reads = [];
});
SyncReader.prototype.read = function (length, callback) {
this._reads.push({
length: Math.abs(length),
allowLess: length < 0,
func: callback,
});
};
SyncReader.prototype.process = function () {
while (this._reads.length > 0 && this._buffer.length) {
let read = this._reads[0];
if (
this._buffer.length &&
(this._buffer.length >= read.length || read.allowLess)
) {
this._reads.shift();
let buf = this._buffer;
this._buffer = buf.slice(read.length);
read.func.call(this, buf.slice(0, read.length));
} else {
break;
}
}
if (this._reads.length > 0) {
return new Error("There are some read requests waitng on finished stream");
}
if (this._buffer.length > 0) {
return new Error("unrecognised content at end of stream");
}
};
},{}],23:[function(require,module,exports){
(function (global){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
function compare(a, b) {
if (a === b) {
return 0;
}
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i];
y = b[i];
break;
}
}
if (x < y) {
return -1;
}
if (y < x) {
return 1;
}
return 0;
}
function isBuffer(b) {
if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
return global.Buffer.isBuffer(b);
}
return !!(b != null && b._isBuffer);
}
var util = require('util/');
var hasOwn = Object.prototype.hasOwnProperty;
var pSlice = Array.prototype.slice;
var functionsHaveNames = (function () {
return function foo() {}.name === 'foo';
}());
function pToString (obj) {
return Object.prototype.toString.call(obj);
}
function isView(arrbuf) {
if (isBuffer(arrbuf)) {
return false;
}
if (typeof global.ArrayBuffer !== 'function') {
return false;
}
if (typeof ArrayBuffer.isView === 'function') {
return ArrayBuffer.isView(arrbuf);
}
if (!arrbuf) {
return false;
}
if (arrbuf instanceof DataView) {
return true;
}
if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
return true;
}
return false;
}
var assert = module.exports = ok;
var regex = /\s*function\s+([^\(\s]*)\s*/;
function getName(func) {
if (!util.isFunction(func)) {
return;
}
if (functionsHaveNames) {
return func.name;
}
var str = func.toString();
var match = str.match(regex);
return match && match[1];
}
assert.AssertionError = function AssertionError(options) {
this.name = 'AssertionError';
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
if (options.message) {
this.message = options.message;
this.generatedMessage = false;
} else {
this.message = getMessage(this);
this.generatedMessage = true;
}
var stackStartFunction = options.stackStartFunction || fail;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, stackStartFunction);
} else {
var err = new Error();
if (err.stack) {
var out = err.stack;
var fn_name = getName(stackStartFunction);
var idx = out.indexOf('\n' + fn_name);
if (idx >= 0) {
var next_line = out.indexOf('\n', idx + 1);
out = out.substring(next_line + 1);
}
this.stack = out;
}
}
};
util.inherits(assert.AssertionError, Error);
function truncate(s, n) {
if (typeof s === 'string') {
return s.length < n ? s : s.slice(0, n);
} else {
return s;
}
}
function inspect(something) {
if (functionsHaveNames || !util.isFunction(something)) {
return util.inspect(something);
}
var rawname = getName(something);
var name = rawname ? ': ' + rawname : '';
return '[Function' + name + ']';
}
function getMessage(self) {
return truncate(inspect(self.actual), 128) + ' ' +
self.operator + ' ' +
truncate(inspect(self.expected), 128);
}
function fail(actual, expected, message, operator, stackStartFunction) {
throw new assert.AssertionError({
message: message,
actual: actual,
expected: expected,
operator: operator,
stackStartFunction: stackStartFunction
});
}
assert.fail = fail;
function ok(value, message) {
if (!value) fail(value, true, message, '==', assert.ok);
}
assert.ok = ok;
assert.equal = function equal(actual, expected, message) {
if (actual != expected) fail(actual, expected, message, '==', assert.equal);
};
assert.notEqual = function notEqual(actual, expected, message) {
if (actual == expected) {
fail(actual, expected, message, '!=', assert.notEqual);
}
};
assert.deepEqual = function deepEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, false)) {
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
}
};
assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
if (!_deepEqual(actual, expected, true)) {
fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
}
};
function _deepEqual(actual, expected, strict, memos) {
if (actual === expected) {
return true;
} else if (isBuffer(actual) && isBuffer(expected)) {
return compare(actual, expected) === 0;
} else if (util.isDate(actual) && util.isDate(expected)) {
return actual.getTime() === expected.getTime();
} else if (util.isRegExp(actual) && util.isRegExp(expected)) {
return actual.source === expected.source &&
actual.global === expected.global &&
actual.multiline === expected.multiline &&
actual.lastIndex === expected.lastIndex &&
actual.ignoreCase === expected.ignoreCase;
} else if ((actual === null || typeof actual !== 'object') &&
(expected === null || typeof expected !== 'object')) {
return strict ? actual === expected : actual == expected;
} else if (isView(actual) && isView(expected) &&
pToString(actual) === pToString(expected) &&
!(actual instanceof Float32Array ||
actual instanceof Float64Array)) {
return compare(new Uint8Array(actual.buffer),
new Uint8Array(expected.buffer)) === 0;
} else if (isBuffer(actual) !== isBuffer(expected)) {
return false;
} else {
memos = memos || {actual: [], expected: []};
var actualIndex = memos.actual.indexOf(actual);
if (actualIndex !== -1) {
if (actualIndex === memos.expected.indexOf(expected)) {
return true;
}
}
memos.actual.push(actual);
memos.expected.push(expected);
return objEquiv(actual, expected, strict, memos);
}
}
function isArguments(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
}
function objEquiv(a, b, strict, actualVisitedObjects) {
if (a === null || a === undefined || b === null || b === undefined)
return false;
if (util.isPrimitive(a) || util.isPrimitive(b))
return a === b;
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
return false;
var aIsArgs = isArguments(a);
var bIsArgs = isArguments(b);
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
return false;
if (aIsArgs) {
a = pSlice.call(a);
b = pSlice.call(b);
return _deepEqual(a, b, strict);
}
var ka = objectKeys(a);
var kb = objectKeys(b);
var key, i;
if (ka.length !== kb.length)
return false;
ka.sort();
kb.sort();
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] !== kb[i])
return false;
}
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
return false;
}
return true;
}
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
if (_deepEqual(actual, expected, false)) {
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
}
};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
if (_deepEqual(actual, expected, true)) {
fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
}
}
assert.strictEqual = function strictEqual(actual, expected, message) {
if (actual !== expected) {
fail(actual, expected, message, '===', assert.strictEqual);
}
};
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
if (actual === expected) {
fail(actual, expected, message, '!==', assert.notStrictEqual);
}
};
function expectedException(actual, expected) {
if (!actual || !expected) {
return false;
}
if (Object.prototype.toString.call(expected) == '[object RegExp]') {
return expected.test(actual);
}
try {
if (actual instanceof expected) {
return true;
}
} catch (e) {
}
if (Error.isPrototypeOf(expected)) {
return false;
}
return expected.call({}, actual) === true;
}
function _tryBlock(block) {
var error;
try {
block();
} catch (e) {
error = e;
}
return error;
}
function _throws(shouldThrow, block, expected, message) {
var actual;
if (typeof block !== 'function') {
throw new TypeError('"block" argument must be a function');
}
if (typeof expected === 'string') {
message = expected;
expected = null;
}
actual = _tryBlock(block);
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
(message ? ' ' + message : '.');
if (shouldThrow && !actual) {
fail(actual, expected, 'Missing expected exception' + message);
}
var userProvidedMessage = typeof message === 'string';
var isUnwantedException = !shouldThrow && util.isError(actual);
var isUnexpectedException = !shouldThrow && actual && !expected;
if ((isUnwantedException &&
userProvidedMessage &&
expectedException(actual, expected)) ||
isUnexpectedException) {
fail(actual, expected, 'Got unwanted exception' + message);
}
if ((shouldThrow && actual && expected &&
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
throw actual;
}
}
assert.throws = function(block, error, message) {
_throws(true, block, error, message);
};
assert.doesNotThrow = function(block, error, message) {
_throws(false, block, error, message);
};
assert.ifError = function(err) { if (err) throw err; };
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
if (hasOwn.call(obj, key)) keys.push(key);
}
return keys;
};
}).call(this,typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
},{"util/":67}],24:[function(require,module,exports){
exports.byteLength = byteLength;
exports.toByteArray = toByteArray;
exports.fromByteArray = fromByteArray;
var lookup = [];
var revLookup = [];
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
function placeHoldersCount (b64) {
var len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
}
function byteLength (b64) {
return (b64.length * 3 / 4) - placeHoldersCount(b64)
}
function toByteArray (b64) {
var i, l, tmp, placeHolders, arr;
var len = b64.length;
placeHolders = placeHoldersCount(b64);
arr = new Arr((len * 3 / 4) - placeHolders);
l = placeHolders > 0 ? len - 4 : len;
var L = 0;
for (i = 0; i < l; i += 4) {
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
arr[L++] = (tmp >> 16) & 0xFF;
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
if (placeHolders === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[L++] = tmp & 0xFF;
} else if (placeHolders === 1) {
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[L++] = (tmp >> 8) & 0xFF;
arr[L++] = tmp & 0xFF;
}
return arr
}
function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp;
var output = [];
for (var i = start; i < end; i += 3) {
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
output.push(tripletToBase64(tmp));
}
return output.join('')
}
function fromByteArray (uint8) {
var tmp;
var len = uint8.length;
var extraBytes = len % 3;
var output = '';
var parts = [];
var maxChunkLength = 16383;
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
}
if (extraBytes === 1) {
tmp = uint8[len - 1];
output += lookup[tmp >> 2];
output += lookup[(tmp << 4) & 0x3F];
output += '==';
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
output += lookup[tmp >> 10];
output += lookup[(tmp >> 4) & 0x3F];
output += lookup[(tmp << 2) & 0x3F];
output += '=';
}
parts.push(output);
return parts.join('')
}
},{}],25:[function(require,module,exports){
},{}],26:[function(require,module,exports){
(function (process,Buffer){
var assert = require('assert');
var Zstream = require('pako/lib/zlib/zstream');
var zlib_deflate = require('pako/lib/zlib/deflate.js');
var zlib_inflate = require('pako/lib/zlib/inflate.js');
var constants = require('pako/lib/zlib/constants');
for (var key in constants) {
exports[key] = constants[key];
}
exports.NONE = 0;
exports.DEFLATE = 1;
exports.INFLATE = 2;
exports.GZIP = 3;
exports.GUNZIP = 4;
exports.DEFLATERAW = 5;
exports.INFLATERAW = 6;
exports.UNZIP = 7;
var GZIP_HEADER_ID1 = 0x1f;
var GZIP_HEADER_ID2 = 0x8b;
function Zlib(mode) {
if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) {
throw new TypeError('Bad argument');
}
this.dictionary = null;
this.err = 0;
this.flush = 0;
this.init_done = false;
this.level = 0;
this.memLevel = 0;
this.mode = mode;
this.strategy = 0;
this.windowBits = 0;
this.write_in_progress = false;
this.pending_close = false;
this.gzip_id_bytes_read = 0;
}
Zlib.prototype.close = function () {
if (this.write_in_progress) {
this.pending_close = true;
return;
}
this.pending_close = false;
assert(this.init_done, 'close before init');
assert(this.mode <= exports.UNZIP);
if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
zlib_deflate.deflateEnd(this.strm);
} else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) {
zlib_inflate.inflateEnd(this.strm);
}
this.mode = exports.NONE;
this.dictionary = null;
};
Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) {
return this._write(true, flush, input, in_off, in_len, out, out_off, out_len);
};
Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) {
return this._write(false, flush, input, in_off, in_len, out, out_off, out_len);
};
Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) {
assert.equal(arguments.length, 8);
assert(this.init_done, 'write before init');
assert(this.mode !== exports.NONE, 'already finalized');
assert.equal(false, this.write_in_progress, 'write already in progress');
assert.equal(false, this.pending_close, 'close is pending');
this.write_in_progress = true;
assert.equal(false, flush === undefined, 'must provide flush value');
this.write_in_progress = true;
if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) {
throw new Error('Invalid flush value');
}
if (input == null) {
input = Buffer.alloc(0);
in_len = 0;
in_off = 0;
}
this.strm.avail_in = in_len;
this.strm.input = input;
this.strm.next_in = in_off;
this.strm.avail_out = out_len;
this.strm.output = out;
this.strm.next_out = out_off;
this.flush = flush;
if (!async) {
this._process();
if (this._checkError()) {
return this._afterSync();
}
return;
}
var self = this;
process.nextTick(function () {
self._process();
self._after();
});
return this;
};
Zlib.prototype._afterSync = function () {
var avail_out = this.strm.avail_out;
var avail_in = this.strm.avail_in;
this.write_in_progress = false;
return [avail_in, avail_out];
};
Zlib.prototype._process = function () {
var next_expected_header_byte = null;
switch (this.mode) {
case exports.DEFLATE:
case exports.GZIP:
case exports.DEFLATERAW:
this.err = zlib_deflate.deflate(this.strm, this.flush);
break;
case exports.UNZIP:
if (this.strm.avail_in > 0) {
next_expected_header_byte = this.strm.next_in;
}
switch (this.gzip_id_bytes_read) {
case 0:
if (next_expected_header_byte === null) {
break;
}
if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {
this.gzip_id_bytes_read = 1;
next_expected_header_byte++;
if (this.strm.avail_in === 1) {
break;
}
} else {
this.mode = exports.INFLATE;
break;
}
case 1:
if (next_expected_header_byte === null) {
break;
}
if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) {
this.gzip_id_bytes_read = 2;
this.mode = exports.GUNZIP;
} else {
this.mode = exports.INFLATE;
}
break;
default:
throw new Error('invalid number of gzip magic number bytes read');
}
case exports.INFLATE:
case exports.GUNZIP:
case exports.INFLATERAW:
this.err = zlib_inflate.inflate(this.strm, this.flush
);if (this.err === exports.Z_NEED_DICT && this.dictionary) {
this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary);
if (this.err === exports.Z_OK) {
this.err = zlib_inflate.inflate(this.strm, this.flush);
} else if (this.err === exports.Z_DATA_ERROR) {
this.err = exports.Z_NEED_DICT;
}
}
while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) {
this.reset();
this.err = zlib_inflate.inflate(this.strm, this.flush);
}
break;
default:
throw new Error('Unknown mode ' + this.mode);
}
};
Zlib.prototype._checkError = function () {
switch (this.err) {
case exports.Z_OK:
case exports.Z_BUF_ERROR:
if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) {
this._error('unexpected end of file');
return false;
}
break;
case exports.Z_STREAM_END:
break;
case exports.Z_NEED_DICT:
if (this.dictionary == null) {
this._error('Missing dictionary');
} else {
this._error('Bad dictionary');
}
return false;
default:
this._error('Zlib error');
return false;
}
return true;
};
Zlib.prototype._after = function () {
if (!this._checkError()) {
return;
}
var avail_out = this.strm.avail_out;
var avail_in = this.strm.avail_in;
this.write_in_progress = false;
this.callback(avail_in, avail_out);
if (this.pending_close) {
this.close();
}
};
Zlib.prototype._error = function (message) {
if (this.strm.msg) {
message = this.strm.msg;
}
this.onerror(message, this.err
);this.write_in_progress = false;
if (this.pending_close) {
this.close();
}
};
Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) {
assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])');
assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits');
assert(level >= -1 && level <= 9, 'invalid compression level');
assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel');
assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy');
this._init(level, windowBits, memLevel, strategy, dictionary);
this._setDictionary();
};
Zlib.prototype.params = function () {
throw new Error('deflateParams Not supported');
};
Zlib.prototype.reset = function () {
this._reset();
this._setDictionary();
};
Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) {
this.level = level;
this.windowBits = windowBits;
this.memLevel = memLevel;
this.strategy = strategy;
this.flush = exports.Z_NO_FLUSH;
this.err = exports.Z_OK;
if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) {
this.windowBits += 16;
}
if (this.mode === exports.UNZIP) {
this.windowBits += 32;
}
if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) {
this.windowBits = -1 * this.windowBits;
}
this.strm = new Zstream();
switch (this.mode) {
case exports.DEFLATE:
case exports.GZIP:
case exports.DEFLATERAW:
this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);
break;
case exports.INFLATE:
case exports.GUNZIP:
case exports.INFLATERAW:
case exports.UNZIP:
this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);
break;
default:
throw new Error('Unknown mode ' + this.mode);
}
if (this.err !== exports.Z_OK) {
this._error('Init error');
}
this.dictionary = dictionary;
this.write_in_progress = false;
this.init_done = true;
};
Zlib.prototype._setDictionary = function () {
if (this.dictionary == null) {
return;
}
this.err = exports.Z_OK;
switch (this.mode) {
case exports.DEFLATE:
case exports.DEFLATERAW:
this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);
break;
}
if (this.err !== exports.Z_OK) {
this._error('Failed to set dictionary');
}
};
Zlib.prototype._reset = function () {
this.err = exports.Z_OK;
switch (this.mode) {
case exports.DEFLATE:
case exports.DEFLATERAW:
case exports.GZIP:
this.err = zlib_deflate.deflateReset(this.strm);
break;
case exports.INFLATE:
case exports.INFLATERAW:
case exports.GUNZIP:
this.err = zlib_inflate.inflateReset(this.strm);
break;
}
if (this.err !== exports.Z_OK) {
this._error('Failed to reset stream');
}
};
exports.Zlib = Zlib;
}).call(this,require('_process'),require("buffer").Buffer);
},{"_process":47,"assert":23,"buffer":28,"pako/lib/zlib/constants":37,"pako/lib/zlib/deflate.js":39,"pako/lib/zlib/inflate.js":41,"pako/lib/zlib/zstream":45}],27:[function(require,module,exports){
(function (process){
var Buffer = require('buffer').Buffer;
var Transform = require('stream').Transform;
var binding = require('./binding');
var util = require('util');
var assert = require('assert').ok;
var kMaxLength = require('buffer').kMaxLength;
var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes';
binding.Z_MIN_WINDOWBITS = 8;
binding.Z_MAX_WINDOWBITS = 15;
binding.Z_DEFAULT_WINDOWBITS = 15;
binding.Z_MIN_CHUNK = 64;
binding.Z_MAX_CHUNK = Infinity;
binding.Z_DEFAULT_CHUNK = 16 * 1024;
binding.Z_MIN_MEMLEVEL = 1;
binding.Z_MAX_MEMLEVEL = 9;
binding.Z_DEFAULT_MEMLEVEL = 8;
binding.Z_MIN_LEVEL = -1;
binding.Z_MAX_LEVEL = 9;
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;
var bkeys = Object.keys(binding);
for (var bk = 0; bk < bkeys.length; bk++) {
var bkey = bkeys[bk];
if (bkey.match(/^Z/)) {
Object.defineProperty(exports, bkey, {
enumerable: true, value: binding[bkey], writable: false
});
}
}
var codes = {
Z_OK: binding.Z_OK,
Z_STREAM_END: binding.Z_STREAM_END,
Z_NEED_DICT: binding.Z_NEED_DICT,
Z_ERRNO: binding.Z_ERRNO,
Z_STREAM_ERROR: binding.Z_STREAM_ERROR,
Z_DATA_ERROR: binding.Z_DATA_ERROR,
Z_MEM_ERROR: binding.Z_MEM_ERROR,
Z_BUF_ERROR: binding.Z_BUF_ERROR,
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
};
var ckeys = Object.keys(codes);
for (var ck = 0; ck < ckeys.length; ck++) {
var ckey = ckeys[ck];
codes[codes[ckey]] = ckey;
}
Object.defineProperty(exports, 'codes', {
enumerable: true, value: Object.freeze(codes), writable: false
});
exports.Deflate = Deflate;
exports.Inflate = Inflate;
exports.Gzip = Gzip;
exports.Gunzip = Gunzip;
exports.DeflateRaw = DeflateRaw;
exports.InflateRaw = InflateRaw;
exports.Unzip = Unzip;
exports.createDeflate = function (o) {
return new Deflate(o);
};
exports.createInflate = function (o) {
return new Inflate(o);
};
exports.createDeflateRaw = function (o) {
return new DeflateRaw(o);
};
exports.createInflateRaw = function (o) {
return new InflateRaw(o);
};
exports.createGzip = function (o) {
return new Gzip(o);
};
exports.createGunzip = function (o) {
return new Gunzip(o);
};
exports.createUnzip = function (o) {
return new Unzip(o);
};
exports.deflate = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new Deflate(opts), buffer, callback);
};
exports.deflateSync = function (buffer, opts) {
return zlibBufferSync(new Deflate(opts), buffer);
};
exports.gzip = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new Gzip(opts), buffer, callback);
};
exports.gzipSync = function (buffer, opts) {
return zlibBufferSync(new Gzip(opts), buffer);
};
exports.deflateRaw = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new DeflateRaw(opts), buffer, callback);
};
exports.deflateRawSync = function (buffer, opts) {
return zlibBufferSync(new DeflateRaw(opts), buffer);
};
exports.unzip = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new Unzip(opts), buffer, callback);
};
exports.unzipSync = function (buffer, opts) {
return zlibBufferSync(new Unzip(opts), buffer);
};
exports.inflate = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new Inflate(opts), buffer, callback);
};
exports.inflateSync = function (buffer, opts) {
return zlibBufferSync(new Inflate(opts), buffer);
};
exports.gunzip = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new Gunzip(opts), buffer, callback);
};
exports.gunzipSync = function (buffer, opts) {
return zlibBufferSync(new Gunzip(opts), buffer);
};
exports.inflateRaw = function (buffer, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return zlibBuffer(new InflateRaw(opts), buffer, callback);
};
exports.inflateRawSync = function (buffer, opts) {
return zlibBufferSync(new InflateRaw(opts), buffer);
};
function zlibBuffer(engine, buffer, callback) {
var buffers = [];
var nread = 0;
engine.on('error', onError);
engine.on('end', onEnd);
engine.end(buffer);
flow();
function flow() {
var chunk;
while (null !== (chunk = engine.read())) {
buffers.push(chunk);
nread += chunk.length;
}
engine.once('readable', flow);
}
function onError(err) {
engine.removeListener('end', onEnd);
engine.removeListener('readable', flow);
callback(err);
}
function onEnd() {
var buf;
var err = null;
if (nread >= kMaxLength) {
err = new RangeError(kRangeErrorMessage);
} else {
buf = Buffer.concat(buffers, nread);
}
buffers = [];
engine.close();
callback(err, buf);
}
}
function zlibBufferSync(engine, buffer) {
if (typeof buffer === 'string') buffer = Buffer.from(buffer);
if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer');
var flushFlag = engine._finishFlushFlag;
return engine._processChunk(buffer, flushFlag);
}
function Deflate(opts) {
if (!(this instanceof Deflate)) return new Deflate(opts);
Zlib.call(this, opts, binding.DEFLATE);
}
function Inflate(opts) {
if (!(this instanceof Inflate)) return new Inflate(opts);
Zlib.call(this, opts, binding.INFLATE);
}
function Gzip(opts) {
if (!(this instanceof Gzip)) return new Gzip(opts);
Zlib.call(this, opts, binding.GZIP);
}
function Gunzip(opts) {
if (!(this instanceof Gunzip)) return new Gunzip(opts);
Zlib.call(this, opts, binding.GUNZIP);
}
function DeflateRaw(opts) {
if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
Zlib.call(this, opts, binding.DEFLATERAW);
}
function InflateRaw(opts) {
if (!(this instanceof InflateRaw)) return new InflateRaw(opts);
Zlib.call(this, opts, binding.INFLATERAW);
}
function Unzip(opts) {
if (!(this instanceof Unzip)) return new Unzip(opts);
Zlib.call(this, opts, binding.UNZIP);
}
function isValidFlushFlag(flag) {
return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;
}
function Zlib(opts, mode) {
var _this = this;
this._opts = opts = opts || {};
this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
Transform.call(this, opts);
if (opts.flush && !isValidFlushFlag(opts.flush)) {
throw new Error('Invalid flush flag: ' + opts.flush);
}
if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) {
throw new Error('Invalid flush flag: ' + opts.finishFlush);
}
this._flushFlag = opts.flush || binding.Z_NO_FLUSH;
this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH;
if (opts.chunkSize) {
if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) {
throw new Error('Invalid chunk size: ' + opts.chunkSize);
}
}
if (opts.windowBits) {
if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) {
throw new Error('Invalid windowBits: ' + opts.windowBits);
}
}
if (opts.level) {
if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) {
throw new Error('Invalid compression level: ' + opts.level);
}
}
if (opts.memLevel) {
if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) {
throw new Error('Invalid memLevel: ' + opts.memLevel);
}
}
if (opts.strategy) {
if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) {
throw new Error('Invalid strategy: ' + opts.strategy);
}
}
if (opts.dictionary) {
if (!Buffer.isBuffer(opts.dictionary)) {
throw new Error('Invalid dictionary: it should be a Buffer instance');
}
}
this._handle = new binding.Zlib(mode);
var self = this;
this._hadError = false;
this._handle.onerror = function (message, errno) {
_close(self);
self._hadError = true;
var error = new Error(message);
error.errno = errno;
error.code = exports.codes[errno];
self.emit('error', error);
};
var level = exports.Z_DEFAULT_COMPRESSION;
if (typeof opts.level === 'number') level = opts.level;
var strategy = exports.Z_DEFAULT_STRATEGY;
if (typeof opts.strategy === 'number') strategy = opts.strategy;
this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary);
this._buffer = Buffer.allocUnsafe(this._chunkSize);
this._offset = 0;
this._level = level;
this._strategy = strategy;
this.once('end', this.close);
Object.defineProperty(this, '_closed', {
get: function () {
return !_this._handle;
},
configurable: true,
enumerable: true
});
}
util.inherits(Zlib, Transform);
Zlib.prototype.params = function (level, strategy, callback) {
if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) {
throw new RangeError('Invalid compression level: ' + level);
}
if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) {
throw new TypeError('Invalid strategy: ' + strategy);
}
if (this._level !== level || this._strategy !== strategy) {
var self = this;
this.flush(binding.Z_SYNC_FLUSH, function () {
assert(self._handle, 'zlib binding closed');
self._handle.params(level, strategy);
if (!self._hadError) {
self._level = level;
self._strategy = strategy;
if (callback) callback();
}
});
} else {
process.nextTick(callback);
}
};
Zlib.prototype.reset = function () {
assert(this._handle, 'zlib binding closed');
return this._handle.reset();
};
Zlib.prototype._flush = function (callback) {
this._transform(Buffer.alloc(0), '', callback);
};
Zlib.prototype.flush = function (kind, callback) {
var _this2 = this;
var ws = this._writableState;
if (typeof kind === 'function' || kind === undefined && !callback) {
callback = kind;
kind = binding.Z_FULL_FLUSH;
}
if (ws.ended) {
if (callback) process.nextTick(callback);
} else if (ws.ending) {
if (callback) this.once('end', callback);
} else if (ws.needDrain) {
if (callback) {
this.once('drain', function () {
return _this2.flush(kind, callback);
});
}
} else {
this._flushFlag = kind;
this.write(Buffer.alloc(0), '', callback);
}
};
Zlib.prototype.close = function (callback) {
_close(this, callback);
process.nextTick(emitCloseNT, this);
};
function _close(engine, callback) {
if (callback) process.nextTick(callback);
if (!engine._handle) return;
engine._handle.close();
engine._handle = null;
}
function emitCloseNT(self) {
self.emit('close');
}
Zlib.prototype._transform = function (chunk, encoding, cb) {
var flushFlag;
var ws = this._writableState;
var ending = ws.ending || ws.ended;
var last = ending && (!chunk || ws.length === chunk.length);
if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input'));
if (!this._handle) return cb(new Error('zlib binding closed'));
if (last) flushFlag = this._finishFlushFlag;else {
flushFlag = this._flushFlag;
if (chunk.length >= ws.length) {
this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;
}
}
this._processChunk(chunk, flushFlag, cb);
};
Zlib.prototype._processChunk = function (chunk, flushFlag, cb) {
var availInBefore = chunk && chunk.length;
var availOutBefore = this._chunkSize - this._offset;
var inOff = 0;
var self = this;
var async = typeof cb === 'function';
if (!async) {
var buffers = [];
var nread = 0;
var error;
this.on('error', function (er) {
error = er;
});
assert(this._handle, 'zlib binding closed');
do {
var res = this._handle.writeSync(flushFlag, chunk,
inOff,
availInBefore,
this._buffer,
this._offset,
availOutBefore);
} while (!this._hadError && callback(res[0], res[1]));
if (this._hadError) {
throw error;
}
if (nread >= kMaxLength) {
_close(this);
throw new RangeError(kRangeErrorMessage);
}
var buf = Buffer.concat(buffers, nread);
_close(this);
return buf;
}
assert(this._handle, 'zlib binding closed');
var req = this._handle.write(flushFlag, chunk,
inOff,
availInBefore,
this._buffer,
this._offset,
availOutBefore);
req.buffer = chunk;
req.callback = callback;
function callback(availInAfter, availOutAfter) {
if (this) {
this.buffer = null;
this.callback = null;
}
if (self._hadError) return;
var have = availOutBefore - availOutAfter;
assert(have >= 0, 'have should not go down');
if (have > 0) {
var out = self._buffer.slice(self._offset, self._offset + have);
self._offset += have;
if (async) {
self.push(out);
} else {
buffers.push(out);
nread += out.length;
}
}
if (availOutAfter === 0 || self._offset >= self._chunkSize) {
availOutBefore = self._chunkSize;
self._offset = 0;
self._buffer = Buffer.allocUnsafe(self._chunkSize);
}
if (availOutAfter === 0) {
inOff += availInBefore - availInAfter;
availInBefore = availInAfter;
if (!async) return true;
var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);
newReq.callback = callback;
newReq.buffer = chunk;
return;
}
if (!async) return false;
cb();
}
};
util.inherits(Deflate, Zlib);
util.inherits(Inflate, Zlib);
util.inherits(Gzip, Zlib);
util.inherits(Gunzip, Zlib);
util.inherits(DeflateRaw, Zlib);
util.inherits(InflateRaw, Zlib);
util.inherits(Unzip, Zlib);
}).call(this,require('_process'));
},{"./binding":26,"_process":47,"assert":23,"buffer":28,"stream":63,"util":67}],28:[function(require,module,exports){
var base64 = require('base64-js');
var ieee754 = require('ieee754');
exports.Buffer = Buffer;
exports.SlowBuffer = SlowBuffer;
exports.INSPECT_MAX_BYTES = 50;
var K_MAX_LENGTH = 0x7fffffff;
exports.kMaxLength = K_MAX_LENGTH;
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
typeof console.error === 'function') {
console.error(
'This browser lacks typed array (Uint8Array) support which is required by ' +
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
);
}
function typedArraySupport () {
try {
var arr = new Uint8Array(1);
arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } };
return arr.foo() === 42
} catch (e) {
return false
}
}
Object.defineProperty(Buffer.prototype, 'parent', {
enumerable: true,
get: function () {
if (!Buffer.isBuffer(this)) return undefined
return this.buffer
}
});
Object.defineProperty(Buffer.prototype, 'offset', {
enumerable: true,
get: function () {
if (!Buffer.isBuffer(this)) return undefined
return this.byteOffset
}
});
function createBuffer (length) {
if (length > K_MAX_LENGTH) {
throw new RangeError('The value "' + length + '" is invalid for option "size"')
}
var buf = new Uint8Array(length);
buf.__proto__ = Buffer.prototype;
return buf
}
function Buffer (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new TypeError(
'The "string" argument must be of type string. Received type number'
)
}
return allocUnsafe(arg)
}
return from(arg, encodingOrOffset, length)
}
if (typeof Symbol !== 'undefined' && Symbol.species != null &&
Buffer[Symbol.species] === Buffer) {
Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: true,
enumerable: false,
writable: false
});
}
Buffer.poolSize = 8192;
function from (value, encodingOrOffset, length) {
if (typeof value === 'string') {
return fromString(value, encodingOrOffset)
}
if (ArrayBuffer.isView(value)) {
return fromArrayLike(value)
}
if (value == null) {
throw TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
if (isInstance(value, ArrayBuffer) ||
(value && isInstance(value.buffer, ArrayBuffer))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
if (typeof value === 'number') {
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
)
}
var valueOf = value.valueOf && value.valueOf();
if (valueOf != null && valueOf !== value) {
return Buffer.from(valueOf, encodingOrOffset, length)
}
var b = fromObject(value);
if (b) return b
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
typeof value[Symbol.toPrimitive] === 'function') {
return Buffer.from(
value[Symbol.toPrimitive]('string'), encodingOrOffset, length
)
}
throw new TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
Buffer.from = function (value, encodingOrOffset, length) {
return from(value, encodingOrOffset, length)
};
Buffer.prototype.__proto__ = Uint8Array.prototype;
Buffer.__proto__ = Uint8Array;
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be of type number')
} else if (size < 0) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
}
function alloc (size, fill, encoding) {
assertSize(size);
if (size <= 0) {
return createBuffer(size)
}
if (fill !== undefined) {
return typeof encoding === 'string'
? createBuffer(size).fill(fill, encoding)
: createBuffer(size).fill(fill)
}
return createBuffer(size)
}
Buffer.alloc = function (size, fill, encoding) {
return alloc(size, fill, encoding)
};
function allocUnsafe (size) {
assertSize(size);
return createBuffer(size < 0 ? 0 : checked(size) | 0)
}
Buffer.allocUnsafe = function (size) {
return allocUnsafe(size)
};
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(size)
};
function fromString (string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8';
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
var length = byteLength(string, encoding) | 0;
var buf = createBuffer(length);
var actual = buf.write(string, encoding);
if (actual !== length) {
buf = buf.slice(0, actual);
}
return buf
}
function fromArrayLike (array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0;
var buf = createBuffer(length);
for (var i = 0; i < length; i += 1) {
buf[i] = array[i] & 255;
}
return buf
}
function fromArrayBuffer (array, byteOffset, length) {
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('"offset" is outside of buffer bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('"length" is outside of buffer bounds')
}
var buf;
if (byteOffset === undefined && length === undefined) {
buf = new Uint8Array(array);
} else if (length === undefined) {
buf = new Uint8Array(array, byteOffset);
} else {
buf = new Uint8Array(array, byteOffset, length);
}
buf.__proto__ = Buffer.prototype;
return buf
}
function fromObject (obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0;
var buf = createBuffer(len);
if (buf.length === 0) {
return buf
}
obj.copy(buf, 0, 0, len);
return buf
}
if (obj.length !== undefined) {
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
return createBuffer(0)
}
return fromArrayLike(obj)
}
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data)
}
}
function checked (length) {
if (length >= K_MAX_LENGTH) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) {
length = 0;
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = function isBuffer (b) {
return b != null && b._isBuffer === true &&
b !== Buffer.prototype
};
Buffer.compare = function compare (a, b) {
if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
)
}
if (a === b) return 0
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i];
y = b[i];
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
};
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'latin1':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
};
Buffer.concat = function concat (list, length) {
if (!Array.isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
if (list.length === 0) {
return Buffer.alloc(0)
}
var i;
if (length === undefined) {
length = 0;
for (i = 0; i < list.length; ++i) {
length += list[i].length;
}
}
var buffer = Buffer.allocUnsafe(length);
var pos = 0;
for (i = 0; i < list.length; ++i) {
var buf = list[i];
if (isInstance(buf, Uint8Array)) {
buf = Buffer.from(buf);
}
if (!Buffer.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
buf.copy(buffer, pos);
pos += buf.length;
}
return buffer
};
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
'Received type ' + typeof string
)
}
var len = string.length;
var mustMatch = (arguments.length > 2 && arguments[2] === true);
if (!mustMatch && len === 0) return 0
var loweredCase = false;
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) {
return mustMatch ? -1 : utf8ToBytes(string).length
}
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
}
Buffer.byteLength = byteLength;
function slowToString (encoding, start, end) {
var loweredCase = false;
if (start === undefined || start < 0) {
start = 0;
}
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length;
}
if (end <= 0) {
return ''
}
end >>>= 0;
start >>>= 0;
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8';
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase();
loweredCase = true;
}
}
}
Buffer.prototype._isBuffer = true;
function swap (b, n, m) {
var i = b[n];
b[n] = b[m];
b[m] = i;
}
Buffer.prototype.swap16 = function swap16 () {
var len = this.length;
if (len % 2 !== 0) {
throw new RangeError('Buffer size must be a multiple of 16-bits')
}
for (var i = 0; i < len; i += 2) {
swap(this, i, i + 1);
}
return this
};
Buffer.prototype.swap32 = function swap32 () {
var len = this.length;
if (len % 4 !== 0) {
throw new RangeError('Buffer size must be a multiple of 32-bits')
}
for (var i = 0; i < len; i += 4) {
swap(this, i, i + 3);
swap(this, i + 1, i + 2);
}
return this
};
Buffer.prototype.swap64 = function swap64 () {
var len = this.length;
if (len % 8 !== 0) {
throw new RangeError('Buffer size must be a multiple of 64-bits')
}
for (var i = 0; i < len; i += 8) {
swap(this, i, i + 7);
swap(this, i + 1, i + 6);
swap(this, i + 2, i + 5);
swap(this, i + 3, i + 4);
}
return this
};
Buffer.prototype.toString = function toString () {
var length = this.length;
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
};
Buffer.prototype.toLocaleString = Buffer.prototype.toString;
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
};
Buffer.prototype.inspect = function inspect () {
var str = '';
var max = exports.INSPECT_MAX_BYTES;
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
if (this.length > max) str += ' ... ';
return '<Buffer ' + str + '>'
};
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
if (isInstance(target, Uint8Array)) {
target = Buffer.from(target, target.offset, target.byteLength);
}
if (!Buffer.isBuffer(target)) {
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. ' +
'Received type ' + (typeof target)
)
}
if (start === undefined) {
start = 0;
}
if (end === undefined) {
end = target ? target.length : 0;
}
if (thisStart === undefined) {
thisStart = 0;
}
if (thisEnd === undefined) {
thisEnd = this.length;
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError('out of range index')
}
if (thisStart >= thisEnd && start >= end) {
return 0
}
if (thisStart >= thisEnd) {
return -1
}
if (start >= end) {
return 1
}
start >>>= 0;
end >>>= 0;
thisStart >>>= 0;
thisEnd >>>= 0;
if (this === target) return 0
var x = thisEnd - thisStart;
var y = end - start;
var len = Math.min(x, y);
var thisCopy = this.slice(thisStart, thisEnd);
var targetCopy = target.slice(start, end);
for (var i = 0; i < len; ++i) {
if (thisCopy[i] !== targetCopy[i]) {
x = thisCopy[i];
y = targetCopy[i];
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
};
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
if (buffer.length === 0) return -1
if (typeof byteOffset === 'string') {
encoding = byteOffset;
byteOffset = 0;
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff;
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000;
}
byteOffset = +byteOffset;
if (numberIsNaN(byteOffset)) {
byteOffset = dir ? 0 : (buffer.length - 1);
}
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1;
} else if (byteOffset < 0) {
if (dir) byteOffset = 0;
else return -1
}
if (typeof val === 'string') {
val = Buffer.from(val, encoding);
}
if (Buffer.isBuffer(val)) {
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF;
if (typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1;
var arrLength = arr.length;
var valLength = val.length;
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase();
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2;
arrLength /= 2;
valLength /= 2;
byteOffset /= 2;
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i;
if (dir) {
var foundIndex = -1;
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i;
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex;
foundIndex = -1;
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
for (i = byteOffset; i >= 0; i--) {
var found = true;
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false;
break
}
}
if (found) return i
}
}
return -1
}
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1
};
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
};
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
};
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0;
var remaining = buf.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
}
var strLen = string.length;
if (length > strLen / 2) {
length = strLen / 2;
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16);
if (numberIsNaN(parsed)) return i
buf[offset + i] = parsed;
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
if (offset === undefined) {
encoding = 'utf8';
length = this.length;
offset = 0;
} else if (length === undefined && typeof offset === 'string') {
encoding = offset;
length = this.length;
offset = 0;
} else if (isFinite(offset)) {
offset = offset >>> 0;
if (isFinite(length)) {
length = length >>> 0;
if (encoding === undefined) encoding = 'utf8';
} else {
encoding = length;
length = undefined;
}
} else {
throw new Error(
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
var remaining = this.length - offset;
if (length === undefined || length > remaining) length = remaining;
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8';
var loweredCase = false;
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'latin1':
case 'binary':
return latin1Write(this, string, offset, length)
case 'base64':
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
};
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
};
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end);
var res = [];
var i = start;
while (i < end) {
var firstByte = buf[i];
var codePoint = null;
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1;
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint;
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte;
}
break
case 2:
secondByte = buf[i + 1];
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint;
}
}
break
case 3:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint;
}
}
break
case 4:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
fourthByte = buf[i + 3];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint;
}
}
}
}
if (codePoint === null) {
codePoint = 0xFFFD;
bytesPerSequence = 1;
} else if (codePoint > 0xFFFF) {
codePoint -= 0x10000;
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
codePoint = 0xDC00 | codePoint & 0x3FF;
}
res.push(codePoint);
i += bytesPerSequence;
}
return decodeCodePointsArray(res)
}
var MAX_ARGUMENTS_LENGTH = 0x1000;
function decodeCodePointsArray (codePoints) {
var len = codePoints.length;
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints)
}
var res = '';
var i = 0;
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
);
}
return res
}
function asciiSlice (buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F);
}
return ret
}
function latin1Slice (buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i]);
}
return ret
}
function hexSlice (buf, start, end) {
var len = buf.length;
if (!start || start < 0) start = 0;
if (!end || end < 0 || end > len) end = len;
var out = '';
for (var i = start; i < end; ++i) {
out += toHex(buf[i]);
}
return out
}
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end);
var res = '';
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
var len = this.length;
start = ~~start;
end = end === undefined ? len : ~~end;
if (start < 0) {
start += len;
if (start < 0) start = 0;
} else if (start > len) {
start = len;
}
if (end < 0) {
end += len;
if (end < 0) end = 0;
} else if (end > len) {
end = len;
}
if (end < start) end = start;
var newBuf = this.subarray(start, end);
newBuf.__proto__ = Buffer.prototype;
return newBuf
};
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var val = this[offset];
var mul = 1;
var i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul;
}
return val
};
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) {
checkOffset(offset, byteLength, this.length);
}
var val = this[offset + --byteLength];
var mul = 1;
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul;
}
return val
};
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 1, this.length);
return this[offset]
};
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
return this[offset] | (this[offset + 1] << 8)
};
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
return (this[offset] << 8) | this[offset + 1]
};
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
};
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
};
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var val = this[offset];
var mul = 1;
var i = 0;
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul;
}
mul *= 0x80;
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
return val
};
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) checkOffset(offset, byteLength, this.length);
var i = byteLength;
var mul = 1;
var val = this[offset + --i];
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul;
}
mul *= 0x80;
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
return val
};
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 1, this.length);
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
};
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
var val = this[offset] | (this[offset + 1] << 8);
return (val & 0x8000) ? val | 0xFFFF0000 : val
};
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
var val = this[offset + 1] | (this[offset] << 8);
return (val & 0x8000) ? val | 0xFFFF0000 : val
};
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
};
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
};
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return ieee754.read(this, offset, true, 23, 4)
};
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return ieee754.read(this, offset, false, 23, 4)
};
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 8, this.length);
return ieee754.read(this, offset, true, 52, 8)
};
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 8, this.length);
return ieee754.read(this, offset, false, 52, 8)
};
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
checkInt(this, value, offset, byteLength, maxBytes, 0);
}
var mul = 1;
var i = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset >>> 0;
byteLength = byteLength >>> 0;
if (!noAssert) {
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
checkInt(this, value, offset, byteLength, maxBytes, 0);
}
var i = byteLength - 1;
var mul = 1;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
this[offset] = (value & 0xff);
return offset + 1
};
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
return offset + 2
};
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
this[offset] = (value >>> 8);
this[offset + 1] = (value & 0xff);
return offset + 2
};
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
this[offset + 3] = (value >>> 24);
this[offset + 2] = (value >>> 16);
this[offset + 1] = (value >>> 8);
this[offset] = (value & 0xff);
return offset + 4
};
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
this[offset] = (value >>> 24);
this[offset + 1] = (value >>> 16);
this[offset + 2] = (value >>> 8);
this[offset + 3] = (value & 0xff);
return offset + 4
};
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
var limit = Math.pow(2, (8 * byteLength) - 1);
checkInt(this, value, offset, byteLength, limit - 1, -limit);
}
var i = 0;
var mul = 1;
var sub = 0;
this[offset] = value & 0xFF;
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
var limit = Math.pow(2, (8 * byteLength) - 1);
checkInt(this, value, offset, byteLength, limit - 1, -limit);
}
var i = byteLength - 1;
var mul = 1;
var sub = 0;
this[offset + i] = value & 0xFF;
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1;
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
}
return offset + byteLength
};
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
if (value < 0) value = 0xff + value + 1;
this[offset] = (value & 0xff);
return offset + 1
};
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
return offset + 2
};
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
this[offset] = (value >>> 8);
this[offset + 1] = (value & 0xff);
return offset + 2
};
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
this[offset] = (value & 0xff);
this[offset + 1] = (value >>> 8);
this[offset + 2] = (value >>> 16);
this[offset + 3] = (value >>> 24);
return offset + 4
};
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
if (value < 0) value = 0xffffffff + value + 1;
this[offset] = (value >>> 24);
this[offset + 1] = (value >>> 16);
this[offset + 2] = (value >>> 8);
this[offset + 3] = (value & 0xff);
return offset + 4
};
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
checkIEEE754(buf, value, offset, 4);
}
ieee754.write(buf, value, offset, littleEndian, 23, 4);
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
};
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
};
function writeDouble (buf, value, offset, littleEndian, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
checkIEEE754(buf, value, offset, 8);
}
ieee754.write(buf, value, offset, littleEndian, 52, 8);
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
};
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
};
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
if (!start) start = 0;
if (!end && end !== 0) end = this.length;
if (targetStart >= target.length) targetStart = target.length;
if (!targetStart) targetStart = 0;
if (end > 0 && end < start) end = start;
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
if (end > this.length) end = this.length;
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start;
}
var len = end - start;
if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
this.copyWithin(targetStart, start, end);
} else if (this === target && start < targetStart && targetStart < end) {
for (var i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start];
}
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, end),
targetStart
);
}
return len
};
Buffer.prototype.fill = function fill (val, start, end, encoding) {
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start;
start = 0;
end = this.length;
} else if (typeof end === 'string') {
encoding = end;
end = this.length;
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
if (val.length === 1) {
var code = val.charCodeAt(0);
if ((encoding === 'utf8' && code < 128) ||
encoding === 'latin1') {
val = code;
}
}
} else if (typeof val === 'number') {
val = val & 255;
}
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (end <= start) {
return this
}
start = start >>> 0;
end = end === undefined ? this.length : end >>> 0;
if (!val) val = 0;
var i;
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val;
}
} else {
var bytes = Buffer.isBuffer(val)
? val
: Buffer.from(val, encoding);
var len = bytes.length;
if (len === 0) {
throw new TypeError('The value "' + val +
'" is invalid for argument "value"')
}
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len];
}
}
return this
};
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
function base64clean (str) {
str = str.split('=')[0];
str = str.trim().replace(INVALID_BASE64_RE, '');
if (str.length < 2) return ''
while (str.length % 4 !== 0) {
str = str + '=';
}
return str
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
function utf8ToBytes (string, units) {
units = units || Infinity;
var codePoint;
var length = string.length;
var leadSurrogate = null;
var bytes = [];
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i);
if (codePoint > 0xD7FF && codePoint < 0xE000) {
if (!leadSurrogate) {
if (codePoint > 0xDBFF) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
} else if (i + 1 === length) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue
}
leadSurrogate = codePoint;
continue
}
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
leadSurrogate = codePoint;
continue
}
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
} else if (leadSurrogate) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
}
leadSurrogate = null;
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint);
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
);
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
byteArray.push(str.charCodeAt(i) & 0xFF);
}
return byteArray
}
function utf16leToBytes (str, units) {
var c, hi, lo;
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray
}
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i];
}
return i
}
function isInstance (obj, type) {
return obj instanceof type ||
(obj != null && obj.constructor != null && obj.constructor.name != null &&
obj.constructor.name === type.name)
}
function numberIsNaN (obj) {
return obj !== obj
}
},{"base64-js":24,"ieee754":31}],29:[function(require,module,exports){
(function (Buffer){
function isArray(arg) {
if (Array.isArray) {
return Array.isArray(arg);
}
return objectToString(arg) === '[object Array]';
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return (objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' ||
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = Buffer.isBuffer;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
}).call(this,{"isBuffer":require("../../is-buffer/index.js")});
},{"../../is-buffer/index.js":33}],30:[function(require,module,exports){
var objectCreate = Object.create || objectCreatePolyfill;
var objectKeys = Object.keys || objectKeysPolyfill;
var bind = Function.prototype.bind || functionBindPolyfill;
function EventEmitter() {
if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
this._events = objectCreate(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
var defaultMaxListeners = 10;
var hasDefineProperty;
try {
var o = {};
if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
hasDefineProperty = o.x === 0;
} catch (err) { hasDefineProperty = false; }
if (hasDefineProperty) {
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
enumerable: true,
get: function() {
return defaultMaxListeners;
},
set: function(arg) {
if (typeof arg !== 'number' || arg < 0 || arg !== arg)
throw new TypeError('"defaultMaxListeners" must be a positive number');
defaultMaxListeners = arg;
}
});
} else {
EventEmitter.defaultMaxListeners = defaultMaxListeners;
}
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || isNaN(n))
throw new TypeError('"n" argument must be a positive number');
this._maxListeners = n;
return this;
};
function $getMaxListeners(that) {
if (that._maxListeners === undefined)
return EventEmitter.defaultMaxListeners;
return that._maxListeners;
}
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
return $getMaxListeners(this);
};
function emitNone(handler, isFn, self) {
if (isFn)
handler.call(self);
else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
listeners[i].call(self);
}
}
function emitOne(handler, isFn, self, arg1) {
if (isFn)
handler.call(self, arg1);
else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
listeners[i].call(self, arg1);
}
}
function emitTwo(handler, isFn, self, arg1, arg2) {
if (isFn)
handler.call(self, arg1, arg2);
else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
listeners[i].call(self, arg1, arg2);
}
}
function emitThree(handler, isFn, self, arg1, arg2, arg3) {
if (isFn)
handler.call(self, arg1, arg2, arg3);
else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
listeners[i].call(self, arg1, arg2, arg3);
}
}
function emitMany(handler, isFn, self, args) {
if (isFn)
handler.apply(self, args);
else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
listeners[i].apply(self, args);
}
}
EventEmitter.prototype.emit = function emit(type) {
var er, handler, len, args, i, events;
var doError = (type === 'error');
events = this._events;
if (events)
doError = (doError && events.error == null);
else if (!doError)
return false;
if (doError) {
if (arguments.length > 1)
er = arguments[1];
if (er instanceof Error) {
throw er;
} else {
var err = new Error('Unhandled "error" event. (' + er + ')');
err.context = er;
throw err;
}
}
handler = events[type];
if (!handler)
return false;
var isFn = typeof handler === 'function';
len = arguments.length;
switch (len) {
case 1:
emitNone(handler, isFn, this);
break;
case 2:
emitOne(handler, isFn, this, arguments[1]);
break;
case 3:
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
break;
case 4:
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
break;
default:
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
emitMany(handler, isFn, this, args);
}
return true;
};
function _addListener(target, type, listener, prepend) {
var m;
var events;
var existing;
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
events = target._events;
if (!events) {
events = target._events = objectCreate(null);
target._eventsCount = 0;
} else {
if (events.newListener) {
target.emit('newListener', type,
listener.listener ? listener.listener : listener);
events = target._events;
}
existing = events[type];
}
if (!existing) {
existing = events[type] = listener;
++target._eventsCount;
} else {
if (typeof existing === 'function') {
existing = events[type] =
prepend ? [listener, existing] : [existing, listener];
} else {
if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
}
if (!existing.warned) {
m = $getMaxListeners(target);
if (m && m > 0 && existing.length > m) {
existing.warned = true;
var w = new Error('Possible EventEmitter memory leak detected. ' +
existing.length + ' "' + String(type) + '" listeners ' +
'added. Use emitter.setMaxListeners() to ' +
'increase limit.');
w.name = 'MaxListenersExceededWarning';
w.emitter = target;
w.type = type;
w.count = existing.length;
if (typeof console === 'object' && console.warn) {
console.warn('%s: %s', w.name, w.message);
}
}
}
}
return target;
}
EventEmitter.prototype.addListener = function addListener(type, listener) {
return _addListener(this, type, listener, false);
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.prependListener =
function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
function onceWrapper() {
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
switch (arguments.length) {
case 0:
return this.listener.call(this.target);
case 1:
return this.listener.call(this.target, arguments[0]);
case 2:
return this.listener.call(this.target, arguments[0], arguments[1]);
case 3:
return this.listener.call(this.target, arguments[0], arguments[1],
arguments[2]);
default:
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i)
args[i] = arguments[i];
this.listener.apply(this.target, args);
}
}
}
function _onceWrap(target, type, listener) {
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
var wrapped = bind.call(onceWrapper, state);
wrapped.listener = listener;
state.wrapFn = wrapped;
return wrapped;
}
EventEmitter.prototype.once = function once(type, listener) {
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
this.on(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter.prototype.prependOnceListener =
function prependOnceListener(type, listener) {
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter.prototype.removeListener =
function removeListener(type, listener) {
var list, events, position, i, originalListener;
if (typeof listener !== 'function')
throw new TypeError('"listener" argument must be a function');
events = this._events;
if (!events)
return this;
list = events[type];
if (!list)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = objectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
position = -1;
for (i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else
spliceOne(list, position);
if (list.length === 1)
events[type] = list[0];
if (events.removeListener)
this.emit('removeListener', type, originalListener || listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners =
function removeAllListeners(type) {
var listeners, events, i;
events = this._events;
if (!events)
return this;
if (!events.removeListener) {
if (arguments.length === 0) {
this._events = objectCreate(null);
this._eventsCount = 0;
} else if (events[type]) {
if (--this._eventsCount === 0)
this._events = objectCreate(null);
else
delete events[type];
}
return this;
}
if (arguments.length === 0) {
var keys = objectKeys(events);
var key;
for (i = 0; i < keys.length; ++i) {
key = keys[i];
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = objectCreate(null);
this._eventsCount = 0;
return this;
}
listeners = events[type];
if (typeof listeners === 'function') {
this.removeListener(type, listeners);
} else if (listeners) {
for (i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
};
function _listeners(target, type, unwrap) {
var events = target._events;
if (!events)
return [];
var evlistener = events[type];
if (!evlistener)
return [];
if (typeof evlistener === 'function')
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter.prototype.listeners = function listeners(type) {
return _listeners(this, type, true);
};
EventEmitter.prototype.rawListeners = function rawListeners(type) {
return _listeners(this, type, false);
};
EventEmitter.listenerCount = function(emitter, type) {
if (typeof emitter.listenerCount === 'function') {
return emitter.listenerCount(type);
} else {
return listenerCount.call(emitter, type);
}
};
EventEmitter.prototype.listenerCount = listenerCount;
function listenerCount(type) {
var events = this._events;
if (events) {
var evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener) {
return evlistener.length;
}
}
return 0;
}
EventEmitter.prototype.eventNames = function eventNames() {
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
};
function spliceOne(list, index) {
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
list[i] = list[k];
list.pop();
}
function arrayClone(arr, n) {
var copy = new Array(n);
for (var i = 0; i < n; ++i)
copy[i] = arr[i];
return copy;
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
function objectCreatePolyfill(proto) {
var F = function() {};
F.prototype = proto;
return new F;
}
function objectKeysPolyfill(obj) {
for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) ;
return k;
}
function functionBindPolyfill(context) {
var fn = this;
return function () {
return fn.apply(context, arguments);
};
}
},{}],31:[function(require,module,exports){
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var nBits = -7;
var i = isLE ? (nBytes - 1) : 0;
var d = isLE ? -1 : 1;
var s = buffer[offset + i];
i += d;
e = s & ((1 << (-nBits)) - 1);
s >>= (-nBits);
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1);
e >>= (-nBits);
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
};
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
var i = isLE ? 0 : (nBytes - 1);
var d = isLE ? 1 : -1;
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128;
};
},{}],32:[function(require,module,exports){
if (typeof Object.create === 'function') {
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
var TempCtor = function () {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
};
}
},{}],33:[function(require,module,exports){
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
module.exports = function (obj) {
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
};
function isBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}
},{}],34:[function(require,module,exports){
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
},{}],35:[function(require,module,exports){
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
(typeof Uint16Array !== 'undefined') &&
(typeof Int32Array !== 'undefined');
function _has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
exports.assign = function (obj ) {
var sources = Array.prototype.slice.call(arguments, 1);
while (sources.length) {
var source = sources.shift();
if (!source) { continue; }
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
for (var p in source) {
if (_has(source, p)) {
obj[p] = source[p];
}
}
}
return obj;
};
exports.shrinkBuf = function (buf, size) {
if (buf.length === size) { return buf; }
if (buf.subarray) { return buf.subarray(0, size); }
buf.length = size;
return buf;
};
var fnTyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
if (src.subarray && dest.subarray) {
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
return;
}
for (var i = 0; i < len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
flattenChunks: function (chunks) {
var i, l, len, pos, chunk, result;
len = 0;
for (i = 0, l = chunks.length; i < l; i++) {
len += chunks[i].length;
}
result = new Uint8Array(len);
pos = 0;
for (i = 0, l = chunks.length; i < l; i++) {
chunk = chunks[i];
result.set(chunk, pos);
pos += chunk.length;
}
return result;
}
};
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for (var i = 0; i < len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
flattenChunks: function (chunks) {
return [].concat.apply([], chunks);
}
};
exports.setTyped = function (on) {
if (on) {
exports.Buf8 = Uint8Array;
exports.Buf16 = Uint16Array;
exports.Buf32 = Int32Array;
exports.assign(exports, fnTyped);
} else {
exports.Buf8 = Array;
exports.Buf16 = Array;
exports.Buf32 = Array;
exports.assign(exports, fnUntyped);
}
};
exports.setTyped(TYPED_OK);
},{}],36:[function(require,module,exports){
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
n = len > 2000 ? 2000 : len;
len -= n;
do {
s1 = (s1 + buf[pos++]) |0;
s2 = (s2 + s1) |0;
} while (--n);
s1 %= 65521;
s2 %= 65521;
}
return (s1 | (s2 << 16)) |0;
}
module.exports = adler32;
},{}],37:[function(require,module,exports){
module.exports = {
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_TREES: 6,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_BUF_ERROR: -5,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
Z_BINARY: 0,
Z_TEXT: 1,
Z_UNKNOWN: 2,
Z_DEFLATED: 8
};
},{}],38:[function(require,module,exports){
function makeTable() {
var c, table = [];
for (var n = 0; n < 256; n++) {
c = n;
for (var k = 0; k < 8; k++) {
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
}
return table;
}
var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable,
end = pos + len;
crc ^= -1;
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
return (crc ^ (-1));
}
module.exports = crc32;
},{}],39:[function(require,module,exports){
var utils = require('../utils/common');
var trees = require('./trees');
var adler32 = require('./adler32');
var crc32 = require('./crc32');
var msg = require('./messages');
var Z_NO_FLUSH = 0;
var Z_PARTIAL_FLUSH = 1;
var Z_FULL_FLUSH = 3;
var Z_FINISH = 4;
var Z_BLOCK = 5;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_STREAM_ERROR = -2;
var Z_DATA_ERROR = -3;
var Z_BUF_ERROR = -5;
var Z_DEFAULT_COMPRESSION = -1;
var Z_FILTERED = 1;
var Z_HUFFMAN_ONLY = 2;
var Z_RLE = 3;
var Z_FIXED = 4;
var Z_DEFAULT_STRATEGY = 0;
var Z_UNKNOWN = 2;
var Z_DEFLATED = 8;
var MAX_MEM_LEVEL = 9;
var MAX_WBITS = 15;
var DEF_MEM_LEVEL = 8;
var LENGTH_CODES = 29;
var LITERALS = 256;
var L_CODES = LITERALS + 1 + LENGTH_CODES;
var D_CODES = 30;
var BL_CODES = 19;
var HEAP_SIZE = 2 * L_CODES + 1;
var MAX_BITS = 15;
var MIN_MATCH = 3;
var MAX_MATCH = 258;
var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
var PRESET_DICT = 0x20;
var INIT_STATE = 42;
var EXTRA_STATE = 69;
var NAME_STATE = 73;
var COMMENT_STATE = 91;
var HCRC_STATE = 103;
var BUSY_STATE = 113;
var FINISH_STATE = 666;
var BS_NEED_MORE = 1;
var BS_BLOCK_DONE = 2;
var BS_FINISH_STARTED = 3;
var BS_FINISH_DONE = 4;
var OS_CODE = 0x03;
function err(strm, errorCode) {
strm.msg = msg[errorCode];
return errorCode;
}
function rank(f) {
return ((f) << 1) - ((f) > 4 ? 9 : 0);
}
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
function flush_pending(strm) {
var s = strm.state;
var len = s.pending;
if (len > strm.avail_out) {
len = strm.avail_out;
}
if (len === 0) { return; }
utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
strm.next_out += len;
s.pending_out += len;
strm.total_out += len;
strm.avail_out -= len;
s.pending -= len;
if (s.pending === 0) {
s.pending_out = 0;
}
}
function flush_block_only(s, last) {
trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
s.block_start = s.strstart;
flush_pending(s.strm);
}
function put_byte(s, b) {
s.pending_buf[s.pending++] = b;
}
function putShortMSB(s, b) {
s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
s.pending_buf[s.pending++] = b & 0xff;
}
function read_buf(strm, buf, start, size) {
var len = strm.avail_in;
if (len > size) { len = size; }
if (len === 0) { return 0; }
strm.avail_in -= len;
utils.arraySet(buf, strm.input, strm.next_in, len, start);
if (strm.state.wrap === 1) {
strm.adler = adler32(strm.adler, buf, len, start);
}
else if (strm.state.wrap === 2) {
strm.adler = crc32(strm.adler, buf, len, start);
}
strm.next_in += len;
strm.total_in += len;
return len;
}
function longest_match(s, cur_match) {
var chain_length = s.max_chain_length;
var scan = s.strstart;
var match;
var len;
var best_len = s.prev_length;
var nice_match = s.nice_match;
var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0;
var _win = s.window;
var wmask = s.w_mask;
var prev = s.prev;
var strend = s.strstart + MAX_MATCH;
var scan_end1 = _win[scan + best_len - 1];
var scan_end = _win[scan + best_len];
if (s.prev_length >= s.good_match) {
chain_length >>= 2;
}
if (nice_match > s.lookahead) { nice_match = s.lookahead; }
do {
match = cur_match;
if (_win[match + best_len] !== scan_end ||
_win[match + best_len - 1] !== scan_end1 ||
_win[match] !== _win[scan] ||
_win[++match] !== _win[scan + 1]) {
continue;
}
scan += 2;
match++;
do {
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
scan < strend);
len = MAX_MATCH - (strend - scan);
scan = strend - MAX_MATCH;
if (len > best_len) {
s.match_start = cur_match;
best_len = len;
if (len >= nice_match) {
break;
}
scan_end1 = _win[scan + best_len - 1];
scan_end = _win[scan + best_len];
}
} while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
if (best_len <= s.lookahead) {
return best_len;
}
return s.lookahead;
}
function fill_window(s) {
var _w_size = s.w_size;
var p, n, m, more, str;
do {
more = s.window_size - s.lookahead - s.strstart;
if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
utils.arraySet(s.window, s.window, _w_size, _w_size, 0);
s.match_start -= _w_size;
s.strstart -= _w_size;
s.block_start -= _w_size;
n = s.hash_size;
p = n;
do {
m = s.head[--p];
s.head[p] = (m >= _w_size ? m - _w_size : 0);
} while (--n);
n = _w_size;
p = n;
do {
m = s.prev[--p];
s.prev[p] = (m >= _w_size ? m - _w_size : 0);
} while (--n);
more += _w_size;
}
if (s.strm.avail_in === 0) {
break;
}
n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
s.lookahead += n;
if (s.lookahead + s.insert >= MIN_MATCH) {
str = s.strstart - s.insert;
s.ins_h = s.window[str];
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
while (s.insert) {
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
s.prev[str & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = str;
str++;
s.insert--;
if (s.lookahead + s.insert < MIN_MATCH) {
break;
}
}
}
} while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
}
function deflate_stored(s, flush) {
var max_block_size = 0xffff;
if (max_block_size > s.pending_buf_size - 5) {
max_block_size = s.pending_buf_size - 5;
}
for (;;) {
if (s.lookahead <= 1) {
fill_window(s);
if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
return BS_NEED_MORE;
}
if (s.lookahead === 0) {
break;
}
}
s.strstart += s.lookahead;
s.lookahead = 0;
var max_start = s.block_start + max_block_size;
if (s.strstart === 0 || s.strstart >= max_start) {
s.lookahead = s.strstart - max_start;
s.strstart = max_start;
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
}
s.insert = 0;
if (flush === Z_FINISH) {
flush_block_only(s, true);
if (s.strm.avail_out === 0) {
return BS_FINISH_STARTED;
}
return BS_FINISH_DONE;
}
if (s.strstart > s.block_start) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
return BS_NEED_MORE;
}
function deflate_fast(s, flush) {
var hash_head;
var bflush;
for (;;) {
if (s.lookahead < MIN_LOOKAHEAD) {
fill_window(s);
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
return BS_NEED_MORE;
}
if (s.lookahead === 0) {
break;
}
}
hash_head = 0;
if (s.lookahead >= MIN_MATCH) {
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
if (hash_head !== 0 && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
s.match_length = longest_match(s, hash_head);
}
if (s.match_length >= MIN_MATCH) {
bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
s.lookahead -= s.match_length;
if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {
s.match_length--;
do {
s.strstart++;
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
} while (--s.match_length !== 0);
s.strstart++;
} else
{
s.strstart += s.match_length;
s.match_length = 0;
s.ins_h = s.window[s.strstart];
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
}
} else {
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
s.lookahead--;
s.strstart++;
}
if (bflush) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
}
s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
if (flush === Z_FINISH) {
flush_block_only(s, true);
if (s.strm.avail_out === 0) {
return BS_FINISH_STARTED;
}
return BS_FINISH_DONE;
}
if (s.last_lit) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
return BS_BLOCK_DONE;
}
function deflate_slow(s, flush) {
var hash_head;
var bflush;
var max_insert;
for (;;) {
if (s.lookahead < MIN_LOOKAHEAD) {
fill_window(s);
if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
return BS_NEED_MORE;
}
if (s.lookahead === 0) { break; }
}
hash_head = 0;
if (s.lookahead >= MIN_MATCH) {
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
s.prev_length = s.match_length;
s.prev_match = s.match_start;
s.match_length = MIN_MATCH - 1;
if (hash_head !== 0 && s.prev_length < s.max_lazy_match &&
s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)) {
s.match_length = longest_match(s, hash_head);
if (s.match_length <= 5 &&
(s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096))) {
s.match_length = MIN_MATCH - 1;
}
}
if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
max_insert = s.strstart + s.lookahead - MIN_MATCH;
bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
s.lookahead -= s.prev_length - 1;
s.prev_length -= 2;
do {
if (++s.strstart <= max_insert) {
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
} while (--s.prev_length !== 0);
s.match_available = 0;
s.match_length = MIN_MATCH - 1;
s.strstart++;
if (bflush) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
} else if (s.match_available) {
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
if (bflush) {
flush_block_only(s, false);
}
s.strstart++;
s.lookahead--;
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
} else {
s.match_available = 1;
s.strstart++;
s.lookahead--;
}
}
if (s.match_available) {
bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
s.match_available = 0;
}
s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
if (flush === Z_FINISH) {
flush_block_only(s, true);
if (s.strm.avail_out === 0) {
return BS_FINISH_STARTED;
}
return BS_FINISH_DONE;
}
if (s.last_lit) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
return BS_BLOCK_DONE;
}
function deflate_rle(s, flush) {
var bflush;
var prev;
var scan, strend;
var _win = s.window;
for (;;) {
if (s.lookahead <= MAX_MATCH) {
fill_window(s);
if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
return BS_NEED_MORE;
}
if (s.lookahead === 0) { break; }
}
s.match_length = 0;
if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
scan = s.strstart - 1;
prev = _win[scan];
if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
strend = s.strstart + MAX_MATCH;
do {
} while (prev === _win[++scan] && prev === _win[++scan] &&
prev === _win[++scan] && prev === _win[++scan] &&
prev === _win[++scan] && prev === _win[++scan] &&
prev === _win[++scan] && prev === _win[++scan] &&
scan < strend);
s.match_length = MAX_MATCH - (strend - scan);
if (s.match_length > s.lookahead) {
s.match_length = s.lookahead;
}
}
}
if (s.match_length >= MIN_MATCH) {
bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
s.lookahead -= s.match_length;
s.strstart += s.match_length;
s.match_length = 0;
} else {
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
s.lookahead--;
s.strstart++;
}
if (bflush) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
}
s.insert = 0;
if (flush === Z_FINISH) {
flush_block_only(s, true);
if (s.strm.avail_out === 0) {
return BS_FINISH_STARTED;
}
return BS_FINISH_DONE;
}
if (s.last_lit) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
return BS_BLOCK_DONE;
}
function deflate_huff(s, flush) {
var bflush;
for (;;) {
if (s.lookahead === 0) {
fill_window(s);
if (s.lookahead === 0) {
if (flush === Z_NO_FLUSH) {
return BS_NEED_MORE;
}
break;
}
}
s.match_length = 0;
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
s.lookahead--;
s.strstart++;
if (bflush) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
}
s.insert = 0;
if (flush === Z_FINISH) {
flush_block_only(s, true);
if (s.strm.avail_out === 0) {
return BS_FINISH_STARTED;
}
return BS_FINISH_DONE;
}
if (s.last_lit) {
flush_block_only(s, false);
if (s.strm.avail_out === 0) {
return BS_NEED_MORE;
}
}
return BS_BLOCK_DONE;
}
function Config(good_length, max_lazy, nice_length, max_chain, func) {
this.good_length = good_length;
this.max_lazy = max_lazy;
this.nice_length = nice_length;
this.max_chain = max_chain;
this.func = func;
}
var configuration_table;
configuration_table = [
new Config(0, 0, 0, 0, deflate_stored),
new Config(4, 4, 8, 4, deflate_fast),
new Config(4, 5, 16, 8, deflate_fast),
new Config(4, 6, 32, 32, deflate_fast),
new Config(4, 4, 16, 16, deflate_slow),
new Config(8, 16, 32, 32, deflate_slow),
new Config(8, 16, 128, 128, deflate_slow),
new Config(8, 32, 128, 256, deflate_slow),
new Config(32, 128, 258, 1024, deflate_slow),
new Config(32, 258, 258, 4096, deflate_slow)
];
function lm_init(s) {
s.window_size = 2 * s.w_size;
zero(s.head);
s.max_lazy_match = configuration_table[s.level].max_lazy;
s.good_match = configuration_table[s.level].good_length;
s.nice_match = configuration_table[s.level].nice_length;
s.max_chain_length = configuration_table[s.level].max_chain;
s.strstart = 0;
s.block_start = 0;
s.lookahead = 0;
s.insert = 0;
s.match_length = s.prev_length = MIN_MATCH - 1;
s.match_available = 0;
s.ins_h = 0;
}
function DeflateState() {
this.strm = null;
this.status = 0;
this.pending_buf = null;
this.pending_buf_size = 0;
this.pending_out = 0;
this.pending = 0;
this.wrap = 0;
this.gzhead = null;
this.gzindex = 0;
this.method = Z_DEFLATED;
this.last_flush = -1;
this.w_size = 0;
this.w_bits = 0;
this.w_mask = 0;
this.window = null;
this.window_size = 0;
this.prev = null;
this.head = null;
this.ins_h = 0;
this.hash_size = 0;
this.hash_bits = 0;
this.hash_mask = 0;
this.hash_shift = 0;
this.block_start = 0;
this.match_length = 0;
this.prev_match = 0;
this.match_available = 0;
this.strstart = 0;
this.match_start = 0;
this.lookahead = 0;
this.prev_length = 0;
this.max_chain_length = 0;
this.max_lazy_match = 0;
this.level = 0;
this.strategy = 0;
this.good_match = 0;
this.nice_match = 0;
this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);
this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);
this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);
zero(this.dyn_ltree);
zero(this.dyn_dtree);
zero(this.bl_tree);
this.l_desc = null;
this.d_desc = null;
this.bl_desc = null;
this.bl_count = new utils.Buf16(MAX_BITS + 1);
this.heap = new utils.Buf16(2 * L_CODES + 1);
zero(this.heap);
this.heap_len = 0;
this.heap_max = 0;
this.depth = new utils.Buf16(2 * L_CODES + 1);
zero(this.depth);
this.l_buf = 0;
this.lit_bufsize = 0;
this.last_lit = 0;
this.d_buf = 0;
this.opt_len = 0;
this.static_len = 0;
this.matches = 0;
this.insert = 0;
this.bi_buf = 0;
this.bi_valid = 0;
}
function deflateResetKeep(strm) {
var s;
if (!strm || !strm.state) {
return err(strm, Z_STREAM_ERROR);
}
strm.total_in = strm.total_out = 0;
strm.data_type = Z_UNKNOWN;
s = strm.state;
s.pending = 0;
s.pending_out = 0;
if (s.wrap < 0) {
s.wrap = -s.wrap;
}
s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
strm.adler = (s.wrap === 2) ?
0
:
1;
s.last_flush = Z_NO_FLUSH;
trees._tr_init(s);
return Z_OK;
}
function deflateReset(strm) {
var ret = deflateResetKeep(strm);
if (ret === Z_OK) {
lm_init(strm.state);
}
return ret;
}
function deflateSetHeader(strm, head) {
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
strm.state.gzhead = head;
return Z_OK;
}
function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
if (!strm) {
return Z_STREAM_ERROR;
}
var wrap = 1;
if (level === Z_DEFAULT_COMPRESSION) {
level = 6;
}
if (windowBits < 0) {
wrap = 0;
windowBits = -windowBits;
}
else if (windowBits > 15) {
wrap = 2;
windowBits -= 16;
}
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_FIXED) {
return err(strm, Z_STREAM_ERROR);
}
if (windowBits === 8) {
windowBits = 9;
}
var s = new DeflateState();
strm.state = s;
s.strm = strm;
s.wrap = wrap;
s.gzhead = null;
s.w_bits = windowBits;
s.w_size = 1 << s.w_bits;
s.w_mask = s.w_size - 1;
s.hash_bits = memLevel + 7;
s.hash_size = 1 << s.hash_bits;
s.hash_mask = s.hash_size - 1;
s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
s.window = new utils.Buf8(s.w_size * 2);
s.head = new utils.Buf16(s.hash_size);
s.prev = new utils.Buf16(s.w_size);
s.lit_bufsize = 1 << (memLevel + 6);
s.pending_buf_size = s.lit_bufsize * 4;
s.pending_buf = new utils.Buf8(s.pending_buf_size);
s.d_buf = 1 * s.lit_bufsize;
s.l_buf = (1 + 2) * s.lit_bufsize;
s.level = level;
s.strategy = strategy;
s.method = method;
return deflateReset(strm);
}
function deflateInit(strm, level) {
return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
}
function deflate(strm, flush) {
var old_flush, s;
var beg, val;
if (!strm || !strm.state ||
flush > Z_BLOCK || flush < 0) {
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
}
s = strm.state;
if (!strm.output ||
(!strm.input && strm.avail_in !== 0) ||
(s.status === FINISH_STATE && flush !== Z_FINISH)) {
return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
}
s.strm = strm;
old_flush = s.last_flush;
s.last_flush = flush;
if (s.status === INIT_STATE) {
if (s.wrap === 2) {
strm.adler = 0;
put_byte(s, 31);
put_byte(s, 139);
put_byte(s, 8);
if (!s.gzhead) {
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, s.level === 9 ? 2 :
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
4 : 0));
put_byte(s, OS_CODE);
s.status = BUSY_STATE;
}
else {
put_byte(s, (s.gzhead.text ? 1 : 0) +
(s.gzhead.hcrc ? 2 : 0) +
(!s.gzhead.extra ? 0 : 4) +
(!s.gzhead.name ? 0 : 8) +
(!s.gzhead.comment ? 0 : 16)
);
put_byte(s, s.gzhead.time & 0xff);
put_byte(s, (s.gzhead.time >> 8) & 0xff);
put_byte(s, (s.gzhead.time >> 16) & 0xff);
put_byte(s, (s.gzhead.time >> 24) & 0xff);
put_byte(s, s.level === 9 ? 2 :
(s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
4 : 0));
put_byte(s, s.gzhead.os & 0xff);
if (s.gzhead.extra && s.gzhead.extra.length) {
put_byte(s, s.gzhead.extra.length & 0xff);
put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
}
if (s.gzhead.hcrc) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);
}
s.gzindex = 0;
s.status = EXTRA_STATE;
}
}
else
{
var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
var level_flags = -1;
if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
level_flags = 0;
} else if (s.level < 6) {
level_flags = 1;
} else if (s.level === 6) {
level_flags = 2;
} else {
level_flags = 3;
}
header |= (level_flags << 6);
if (s.strstart !== 0) { header |= PRESET_DICT; }
header += 31 - (header % 31);
s.status = BUSY_STATE;
putShortMSB(s, header);
if (s.strstart !== 0) {
putShortMSB(s, strm.adler >>> 16);
putShortMSB(s, strm.adler & 0xffff);
}
strm.adler = 1;
}
}
if (s.status === EXTRA_STATE) {
if (s.gzhead.extra) {
beg = s.pending;
while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
if (s.pending === s.pending_buf_size) {
break;
}
}
put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
s.gzindex++;
}
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (s.gzindex === s.gzhead.extra.length) {
s.gzindex = 0;
s.status = NAME_STATE;
}
}
else {
s.status = NAME_STATE;
}
}
if (s.status === NAME_STATE) {
if (s.gzhead.name) {
beg = s.pending;
do {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
if (s.pending === s.pending_buf_size) {
val = 1;
break;
}
}
if (s.gzindex < s.gzhead.name.length) {
val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
} else {
val = 0;
}
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
s.gzindex = 0;
s.status = COMMENT_STATE;
}
}
else {
s.status = COMMENT_STATE;
}
}
if (s.status === COMMENT_STATE) {
if (s.gzhead.comment) {
beg = s.pending;
do {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
if (s.pending === s.pending_buf_size) {
val = 1;
break;
}
}
if (s.gzindex < s.gzhead.comment.length) {
val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
} else {
val = 0;
}
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
s.status = HCRC_STATE;
}
}
else {
s.status = HCRC_STATE;
}
}
if (s.status === HCRC_STATE) {
if (s.gzhead.hcrc) {
if (s.pending + 2 > s.pending_buf_size) {
flush_pending(strm);
}
if (s.pending + 2 <= s.pending_buf_size) {
put_byte(s, strm.adler & 0xff);
put_byte(s, (strm.adler >> 8) & 0xff);
strm.adler = 0;
s.status = BUSY_STATE;
}
}
else {
s.status = BUSY_STATE;
}
}
if (s.pending !== 0) {
flush_pending(strm);
if (strm.avail_out === 0) {
s.last_flush = -1;
return Z_OK;
}
} else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
flush !== Z_FINISH) {
return err(strm, Z_BUF_ERROR);
}
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
return err(strm, Z_BUF_ERROR);
}
if (strm.avail_in !== 0 || s.lookahead !== 0 ||
(flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
(s.strategy === Z_RLE ? deflate_rle(s, flush) :
configuration_table[s.level].func(s, flush));
if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
s.status = FINISH_STATE;
}
if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
if (strm.avail_out === 0) {
s.last_flush = -1;
}
return Z_OK;
}
if (bstate === BS_BLOCK_DONE) {
if (flush === Z_PARTIAL_FLUSH) {
trees._tr_align(s);
}
else if (flush !== Z_BLOCK) {
trees._tr_stored_block(s, 0, 0, false);
if (flush === Z_FULL_FLUSH) {
zero(s.head);
if (s.lookahead === 0) {
s.strstart = 0;
s.block_start = 0;
s.insert = 0;
}
}
}
flush_pending(strm);
if (strm.avail_out === 0) {
s.last_flush = -1;
return Z_OK;
}
}
}
if (flush !== Z_FINISH) { return Z_OK; }
if (s.wrap <= 0) { return Z_STREAM_END; }
if (s.wrap === 2) {
put_byte(s, strm.adler & 0xff);
put_byte(s, (strm.adler >> 8) & 0xff);
put_byte(s, (strm.adler >> 16) & 0xff);
put_byte(s, (strm.adler >> 24) & 0xff);
put_byte(s, strm.total_in & 0xff);
put_byte(s, (strm.total_in >> 8) & 0xff);
put_byte(s, (strm.total_in >> 16) & 0xff);
put_byte(s, (strm.total_in >> 24) & 0xff);
}
else
{
putShortMSB(s, strm.adler >>> 16);
putShortMSB(s, strm.adler & 0xffff);
}
flush_pending(strm);
if (s.wrap > 0) { s.wrap = -s.wrap; }
return s.pending !== 0 ? Z_OK : Z_STREAM_END;
}
function deflateEnd(strm) {
var status;
if (!strm || !strm.state) {
return Z_STREAM_ERROR;
}
status = strm.state.status;
if (status !== INIT_STATE &&
status !== EXTRA_STATE &&
status !== NAME_STATE &&
status !== COMMENT_STATE &&
status !== HCRC_STATE &&
status !== BUSY_STATE &&
status !== FINISH_STATE
) {
return err(strm, Z_STREAM_ERROR);
}
strm.state = null;
return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
}
function deflateSetDictionary(strm, dictionary) {
var dictLength = dictionary.length;
var s;
var str, n;
var wrap;
var avail;
var next;
var input;
var tmpDict;
if (!strm || !strm.state) {
return Z_STREAM_ERROR;
}
s = strm.state;
wrap = s.wrap;
if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
return Z_STREAM_ERROR;
}
if (wrap === 1) {
strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
}
s.wrap = 0;
if (dictLength >= s.w_size) {
if (wrap === 0) {
zero(s.head);
s.strstart = 0;
s.block_start = 0;
s.insert = 0;
}
tmpDict = new utils.Buf8(s.w_size);
utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
dictionary = tmpDict;
dictLength = s.w_size;
}
avail = strm.avail_in;
next = strm.next_in;
input = strm.input;
strm.avail_in = dictLength;
strm.next_in = 0;
strm.input = dictionary;
fill_window(s);
while (s.lookahead >= MIN_MATCH) {
str = s.strstart;
n = s.lookahead - (MIN_MATCH - 1);
do {
s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
s.prev[str & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = str;
str++;
} while (--n);
s.strstart = str;
s.lookahead = MIN_MATCH - 1;
fill_window(s);
}
s.strstart += s.lookahead;
s.block_start = s.strstart;
s.insert = s.lookahead;
s.lookahead = 0;
s.match_length = s.prev_length = MIN_MATCH - 1;
s.match_available = 0;
strm.next_in = next;
strm.input = input;
strm.avail_in = avail;
s.wrap = wrap;
return Z_OK;
}
exports.deflateInit = deflateInit;
exports.deflateInit2 = deflateInit2;
exports.deflateReset = deflateReset;
exports.deflateResetKeep = deflateResetKeep;
exports.deflateSetHeader = deflateSetHeader;
exports.deflate = deflate;
exports.deflateEnd = deflateEnd;
exports.deflateSetDictionary = deflateSetDictionary;
exports.deflateInfo = 'pako deflate (from Nodeca project)';
},{"../utils/common":35,"./adler32":36,"./crc32":38,"./messages":43,"./trees":44}],40:[function(require,module,exports){
var BAD = 30;
var TYPE = 12;
module.exports = function inflate_fast(strm, start) {
var state;
var _in;
var last;
var _out;
var beg;
var end;
var dmax;
var wsize;
var whave;
var wnext;
var s_window;
var hold;
var bits;
var lcode;
var dcode;
var lmask;
var dmask;
var here;
var op;
var len;
var dist;
var from;
var from_source;
var input, output;
state = strm.state;
_in = strm.next_in;
input = strm.input;
last = _in + (strm.avail_in - 5);
_out = strm.next_out;
output = strm.output;
beg = _out - (start - strm.avail_out);
end = _out + (strm.avail_out - 257);
dmax = state.dmax;
wsize = state.wsize;
whave = state.whave;
wnext = state.wnext;
s_window = state.window;
hold = state.hold;
bits = state.bits;
lcode = state.lencode;
dcode = state.distcode;
lmask = (1 << state.lenbits) - 1;
dmask = (1 << state.distbits) - 1;
top:
do {
if (bits < 15) {
hold += input[_in++] << bits;
bits += 8;
hold += input[_in++] << bits;
bits += 8;
}
here = lcode[hold & lmask];
dolen:
for (;;) {
op = here >>> 24;
hold >>>= op;
bits -= op;
op = (here >>> 16) & 0xff;
if (op === 0) {
output[_out++] = here & 0xffff;
}
else if (op & 16) {
len = here & 0xffff;
op &= 15;
if (op) {
if (bits < op) {
hold += input[_in++] << bits;
bits += 8;
}
len += hold & ((1 << op) - 1);
hold >>>= op;
bits -= op;
}
if (bits < 15) {
hold += input[_in++] << bits;
bits += 8;
hold += input[_in++] << bits;
bits += 8;
}
here = dcode[hold & dmask];
dodist:
for (;;) {
op = here >>> 24;
hold >>>= op;
bits -= op;
op = (here >>> 16) & 0xff;
if (op & 16) {
dist = here & 0xffff;
op &= 15;
if (bits < op) {
hold += input[_in++] << bits;
bits += 8;
if (bits < op) {
hold += input[_in++] << bits;
bits += 8;
}
}
dist += hold & ((1 << op) - 1);
if (dist > dmax) {
strm.msg = 'invalid distance too far back';
state.mode = BAD;
break top;
}
hold >>>= op;
bits -= op;
op = _out - beg;
if (dist > op) {
op = dist - op;
if (op > whave) {
if (state.sane) {
strm.msg = 'invalid distance too far back';
state.mode = BAD;
break top;
}
}
from = 0;
from_source = s_window;
if (wnext === 0) {
from += wsize - op;
if (op < len) {
len -= op;
do {
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist;
from_source = output;
}
}
else if (wnext < op) {
from += wsize + wnext - op;
op -= wnext;
if (op < len) {
len -= op;
do {
output[_out++] = s_window[from++];
} while (--op);
from = 0;
if (wnext < len) {
op = wnext;
len -= op;
do {
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist;
from_source = output;
}
}
}
else {
from += wnext - op;
if (op < len) {
len -= op;
do {
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist;
from_source = output;
}
}
while (len > 2) {
output[_out++] = from_source[from++];
output[_out++] = from_source[from++];
output[_out++] = from_source[from++];
len -= 3;
}
if (len) {
output[_out++] = from_source[from++];
if (len > 1) {
output[_out++] = from_source[from++];
}
}
}
else {
from = _out - dist;
do {
output[_out++] = output[from++];
output[_out++] = output[from++];
output[_out++] = output[from++];
len -= 3;
} while (len > 2);
if (len) {
output[_out++] = output[from++];
if (len > 1) {
output[_out++] = output[from++];
}
}
}
}
else if ((op & 64) === 0) {
here = dcode[(here & 0xffff) + (hold & ((1 << op) - 1))];
continue dodist;
}
else {
strm.msg = 'invalid distance code';
state.mode = BAD;
break top;
}
break;
}
}
else if ((op & 64) === 0) {
here = lcode[(here & 0xffff) + (hold & ((1 << op) - 1))];
continue dolen;
}
else if (op & 32) {
state.mode = TYPE;
break top;
}
else {
strm.msg = 'invalid literal/length code';
state.mode = BAD;
break top;
}
break;
}
} while (_in < last && _out < end);
len = bits >> 3;
_in -= len;
bits -= len << 3;
hold &= (1 << bits) - 1;
strm.next_in = _in;
strm.next_out = _out;
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
state.hold = hold;
state.bits = bits;
return;
};
},{}],41:[function(require,module,exports){
var utils = require('../utils/common');
var adler32 = require('./adler32');
var crc32 = require('./crc32');
var inflate_fast = require('./inffast');
var inflate_table = require('./inftrees');
var CODES = 0;
var LENS = 1;
var DISTS = 2;
var Z_FINISH = 4;
var Z_BLOCK = 5;
var Z_TREES = 6;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_NEED_DICT = 2;
var Z_STREAM_ERROR = -2;
var Z_DATA_ERROR = -3;
var Z_MEM_ERROR = -4;
var Z_BUF_ERROR = -5;
var Z_DEFLATED = 8;
var HEAD = 1;
var FLAGS = 2;
var TIME = 3;
var OS = 4;
var EXLEN = 5;
var EXTRA = 6;
var NAME = 7;
var COMMENT = 8;
var HCRC = 9;
var DICTID = 10;
var DICT = 11;
var TYPE = 12;
var TYPEDO = 13;
var STORED = 14;
var COPY_ = 15;
var COPY = 16;
var TABLE = 17;
var LENLENS = 18;
var CODELENS = 19;
var LEN_ = 20;
var LEN = 21;
var LENEXT = 22;
var DIST = 23;
var DISTEXT = 24;
var MATCH = 25;
var LIT = 26;
var CHECK = 27;
var LENGTH = 28;
var DONE = 29;
var BAD = 30;
var MEM = 31;
var SYNC = 32;
var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
var MAX_WBITS = 15;
var DEF_WBITS = MAX_WBITS;
function zswap32(q) {
return (((q >>> 24) & 0xff) +
((q >>> 8) & 0xff00) +
((q & 0xff00) << 8) +
((q & 0xff) << 24));
}
function InflateState() {
this.mode = 0;
this.last = false;
this.wrap = 0;
this.havedict = false;
this.flags = 0;
this.dmax = 0;
this.check = 0;
this.total = 0;
this.head = null;
this.wbits = 0;
this.wsize = 0;
this.whave = 0;
this.wnext = 0;
this.window = null;
this.hold = 0;
this.bits = 0;
this.length = 0;
this.offset = 0;
this.extra = 0;
this.lencode = null;
this.distcode = null;
this.lenbits = 0;
this.distbits = 0;
this.ncode = 0;
this.nlen = 0;
this.ndist = 0;
this.have = 0;
this.next = null;
this.lens = new utils.Buf16(320);
this.work = new utils.Buf16(288);
this.lendyn = null;
this.distdyn = null;
this.sane = 0;
this.back = 0;
this.was = 0;
}
function inflateResetKeep(strm) {
var state;
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
state = strm.state;
strm.total_in = strm.total_out = state.total = 0;
strm.msg = '';
if (state.wrap) {
strm.adler = state.wrap & 1;
}
state.mode = HEAD;
state.last = 0;
state.havedict = 0;
state.dmax = 32768;
state.head = null;
state.hold = 0;
state.bits = 0;
state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
state.sane = 1;
state.back = -1;
return Z_OK;
}
function inflateReset(strm) {
var state;
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
state = strm.state;
state.wsize = 0;
state.whave = 0;
state.wnext = 0;
return inflateResetKeep(strm);
}
function inflateReset2(strm, windowBits) {
var wrap;
var state;
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
state = strm.state;
if (windowBits < 0) {
wrap = 0;
windowBits = -windowBits;
}
else {
wrap = (windowBits >> 4) + 1;
if (windowBits < 48) {
windowBits &= 15;
}
}
if (windowBits && (windowBits < 8 || windowBits > 15)) {
return Z_STREAM_ERROR;
}
if (state.window !== null && state.wbits !== windowBits) {
state.window = null;
}
state.wrap = wrap;
state.wbits = windowBits;
return inflateReset(strm);
}
function inflateInit2(strm, windowBits) {
var ret;
var state;
if (!strm) { return Z_STREAM_ERROR; }
state = new InflateState();
strm.state = state;
state.window = null;
ret = inflateReset2(strm, windowBits);
if (ret !== Z_OK) {
strm.state = null;
}
return ret;
}
function inflateInit(strm) {
return inflateInit2(strm, DEF_WBITS);
}
var virgin = true;
var lenfix, distfix;
function fixedtables(state) {
if (virgin) {
var sym;
lenfix = new utils.Buf32(512);
distfix = new utils.Buf32(32);
sym = 0;
while (sym < 144) { state.lens[sym++] = 8; }
while (sym < 256) { state.lens[sym++] = 9; }
while (sym < 280) { state.lens[sym++] = 7; }
while (sym < 288) { state.lens[sym++] = 8; }
inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
sym = 0;
while (sym < 32) { state.lens[sym++] = 5; }
inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
virgin = false;
}
state.lencode = lenfix;
state.lenbits = 9;
state.distcode = distfix;
state.distbits = 5;
}
function updatewindow(strm, src, end, copy) {
var dist;
var state = strm.state;
if (state.window === null) {
state.wsize = 1 << state.wbits;
state.wnext = 0;
state.whave = 0;
state.window = new utils.Buf8(state.wsize);
}
if (copy >= state.wsize) {
utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
state.wnext = 0;
state.whave = state.wsize;
}
else {
dist = state.wsize - state.wnext;
if (dist > copy) {
dist = copy;
}
utils.arraySet(state.window, src, end - copy, dist, state.wnext);
copy -= dist;
if (copy) {
utils.arraySet(state.window, src, end - copy, copy, 0);
state.wnext = copy;
state.whave = state.wsize;
}
else {
state.wnext += dist;
if (state.wnext === state.wsize) { state.wnext = 0; }
if (state.whave < state.wsize) { state.whave += dist; }
}
}
return 0;
}
function inflate(strm, flush) {
var state;
var input, output;
var next;
var put;
var have, left;
var hold;
var bits;
var _in, _out;
var copy;
var from;
var from_source;
var here = 0;
var here_bits, here_op, here_val;
var last_bits, last_op, last_val;
var len;
var ret;
var hbuf = new utils.Buf8(4);
var opts;
var n;
var order =
[ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
if (!strm || !strm.state || !strm.output ||
(!strm.input && strm.avail_in !== 0)) {
return Z_STREAM_ERROR;
}
state = strm.state;
if (state.mode === TYPE) { state.mode = TYPEDO; }
put = strm.next_out;
output = strm.output;
left = strm.avail_out;
next = strm.next_in;
input = strm.input;
have = strm.avail_in;
hold = state.hold;
bits = state.bits;
_in = have;
_out = left;
ret = Z_OK;
inf_leave:
for (;;) {
switch (state.mode) {
case HEAD:
if (state.wrap === 0) {
state.mode = TYPEDO;
break;
}
while (bits < 16) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if ((state.wrap & 2) && hold === 0x8b1f) {
state.check = 0;
hbuf[0] = hold & 0xff;
hbuf[1] = (hold >>> 8) & 0xff;
state.check = crc32(state.check, hbuf, 2, 0);
hold = 0;
bits = 0;
state.mode = FLAGS;
break;
}
state.flags = 0;
if (state.head) {
state.head.done = false;
}
if (!(state.wrap & 1) ||
(((hold & 0xff) << 8) + (hold >> 8)) % 31) {
strm.msg = 'incorrect header check';
state.mode = BAD;
break;
}
if ((hold & 0x0f) !== Z_DEFLATED) {
strm.msg = 'unknown compression method';
state.mode = BAD;
break;
}
hold >>>= 4;
bits -= 4;
len = (hold & 0x0f) + 8;
if (state.wbits === 0) {
state.wbits = len;
}
else if (len > state.wbits) {
strm.msg = 'invalid window size';
state.mode = BAD;
break;
}
state.dmax = 1 << len;
strm.adler = state.check = 1;
state.mode = hold & 0x200 ? DICTID : TYPE;
hold = 0;
bits = 0;
break;
case FLAGS:
while (bits < 16) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.flags = hold;
if ((state.flags & 0xff) !== Z_DEFLATED) {
strm.msg = 'unknown compression method';
state.mode = BAD;
break;
}
if (state.flags & 0xe000) {
strm.msg = 'unknown header flags set';
state.mode = BAD;
break;
}
if (state.head) {
state.head.text = ((hold >> 8) & 1);
}
if (state.flags & 0x0200) {
hbuf[0] = hold & 0xff;
hbuf[1] = (hold >>> 8) & 0xff;
state.check = crc32(state.check, hbuf, 2, 0);
}
hold = 0;
bits = 0;
state.mode = TIME;
case TIME:
while (bits < 32) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (state.head) {
state.head.time = hold;
}
if (state.flags & 0x0200) {
hbuf[0] = hold & 0xff;
hbuf[1] = (hold >>> 8) & 0xff;
hbuf[2] = (hold >>> 16) & 0xff;
hbuf[3] = (hold >>> 24) & 0xff;
state.check = crc32(state.check, hbuf, 4, 0);
}
hold = 0;
bits = 0;
state.mode = OS;
case OS:
while (bits < 16) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (state.head) {
state.head.xflags = (hold & 0xff);
state.head.os = (hold >> 8);
}
if (state.flags & 0x0200) {
hbuf[0] = hold & 0xff;
hbuf[1] = (hold >>> 8) & 0xff;
state.check = crc32(state.check, hbuf, 2, 0);
}
hold = 0;
bits = 0;
state.mode = EXLEN;
case EXLEN:
if (state.flags & 0x0400) {
while (bits < 16) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.length = hold;
if (state.head) {
state.head.extra_len = hold;
}
if (state.flags & 0x0200) {
hbuf[0] = hold & 0xff;
hbuf[1] = (hold >>> 8) & 0xff;
state.check = crc32(state.check, hbuf, 2, 0);
}
hold = 0;
bits = 0;
}
else if (state.head) {
state.head.extra = null;
}
state.mode = EXTRA;
case EXTRA:
if (state.flags & 0x0400) {
copy = state.length;
if (copy > have) { copy = have; }
if (copy) {
if (state.head) {
len = state.head.extra_len - state.length;
if (!state.head.extra) {
state.head.extra = new Array(state.head.extra_len);
}
utils.arraySet(
state.head.extra,
input,
next,
copy,
len
);
}
if (state.flags & 0x0200) {
state.check = crc32(state.check, input, copy, next);
}
have -= copy;
next += copy;
state.length -= copy;
}
if (state.length) { break inf_leave; }
}
state.length = 0;
state.mode = NAME;
case NAME:
if (state.flags & 0x0800) {
if (have === 0) { break inf_leave; }
copy = 0;
do {
len = input[next + copy++];
if (state.head && len &&
(state.length < 65536 )) {
state.head.name += String.fromCharCode(len);
}
} while (len && copy < have);
if (state.flags & 0x0200) {
state.check = crc32(state.check, input, copy, next);
}
have -= copy;
next += copy;
if (len) { break inf_leave; }
}
else if (state.head) {
state.head.name = null;
}
state.length = 0;
state.mode = COMMENT;
case COMMENT:
if (state.flags & 0x1000) {
if (have === 0) { break inf_leave; }
copy = 0;
do {
len = input[next + copy++];
if (state.head && len &&
(state.length < 65536 )) {
state.head.comment += String.fromCharCode(len);
}
} while (len && copy < have);
if (state.flags & 0x0200) {
state.check = crc32(state.check, input, copy, next);
}
have -= copy;
next += copy;
if (len) { break inf_leave; }
}
else if (state.head) {
state.head.comment = null;
}
state.mode = HCRC;
case HCRC:
if (state.flags & 0x0200) {
while (bits < 16) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (hold !== (state.check & 0xffff)) {
strm.msg = 'header crc mismatch';
state.mode = BAD;
break;
}
hold = 0;
bits = 0;
}
if (state.head) {
state.head.hcrc = ((state.flags >> 9) & 1);
state.head.done = true;
}
strm.adler = state.check = 0;
state.mode = TYPE;
break;
case DICTID:
while (bits < 32) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
strm.adler = state.check = zswap32(hold);
hold = 0;
bits = 0;
state.mode = DICT;
case DICT:
if (state.havedict === 0) {
strm.next_out = put;
strm.avail_out = left;
strm.next_in = next;
strm.avail_in = have;
state.hold = hold;
state.bits = bits;
return Z_NEED_DICT;
}
strm.adler = state.check = 1;
state.mode = TYPE;
case TYPE:
if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
case TYPEDO:
if (state.last) {
hold >>>= bits & 7;
bits -= bits & 7;
state.mode = CHECK;
break;
}
while (bits < 3) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.last = (hold & 0x01);
hold >>>= 1;
bits -= 1;
switch ((hold & 0x03)) {
case 0:
state.mode = STORED;
break;
case 1:
fixedtables(state);
state.mode = LEN_;
if (flush === Z_TREES) {
hold >>>= 2;
bits -= 2;
break inf_leave;
}
break;
case 2:
state.mode = TABLE;
break;
case 3:
strm.msg = 'invalid block type';
state.mode = BAD;
}
hold >>>= 2;
bits -= 2;
break;
case STORED:
hold >>>= bits & 7;
bits -= bits & 7;
while (bits < 32) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
strm.msg = 'invalid stored block lengths';
state.mode = BAD;
break;
}
state.length = hold & 0xffff;
hold = 0;
bits = 0;
state.mode = COPY_;
if (flush === Z_TREES) { break inf_leave; }
case COPY_:
state.mode = COPY;
case COPY:
copy = state.length;
if (copy) {
if (copy > have) { copy = have; }
if (copy > left) { copy = left; }
if (copy === 0) { break inf_leave; }
utils.arraySet(output, input, next, copy, put);
have -= copy;
next += copy;
left -= copy;
put += copy;
state.length -= copy;
break;
}
state.mode = TYPE;
break;
case TABLE:
while (bits < 14) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.nlen = (hold & 0x1f) + 257;
hold >>>= 5;
bits -= 5;
state.ndist = (hold & 0x1f) + 1;
hold >>>= 5;
bits -= 5;
state.ncode = (hold & 0x0f) + 4;
hold >>>= 4;
bits -= 4;
if (state.nlen > 286 || state.ndist > 30) {
strm.msg = 'too many length or distance symbols';
state.mode = BAD;
break;
}
state.have = 0;
state.mode = LENLENS;
case LENLENS:
while (state.have < state.ncode) {
while (bits < 3) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.lens[order[state.have++]] = (hold & 0x07);
hold >>>= 3;
bits -= 3;
}
while (state.have < 19) {
state.lens[order[state.have++]] = 0;
}
state.lencode = state.lendyn;
state.lenbits = 7;
opts = { bits: state.lenbits };
ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
state.lenbits = opts.bits;
if (ret) {
strm.msg = 'invalid code lengths set';
state.mode = BAD;
break;
}
state.have = 0;
state.mode = CODELENS;
case CODELENS:
while (state.have < state.nlen + state.ndist) {
for (;;) {
here = state.lencode[hold & ((1 << state.lenbits) - 1)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 0xff;
here_val = here & 0xffff;
if ((here_bits) <= bits) { break; }
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (here_val < 16) {
hold >>>= here_bits;
bits -= here_bits;
state.lens[state.have++] = here_val;
}
else {
if (here_val === 16) {
n = here_bits + 2;
while (bits < n) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
hold >>>= here_bits;
bits -= here_bits;
if (state.have === 0) {
strm.msg = 'invalid bit length repeat';
state.mode = BAD;
break;
}
len = state.lens[state.have - 1];
copy = 3 + (hold & 0x03);
hold >>>= 2;
bits -= 2;
}
else if (here_val === 17) {
n = here_bits + 3;
while (bits < n) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
hold >>>= here_bits;
bits -= here_bits;
len = 0;
copy = 3 + (hold & 0x07);
hold >>>= 3;
bits -= 3;
}
else {
n = here_bits + 7;
while (bits < n) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
hold >>>= here_bits;
bits -= here_bits;
len = 0;
copy = 11 + (hold & 0x7f);
hold >>>= 7;
bits -= 7;
}
if (state.have + copy > state.nlen + state.ndist) {
strm.msg = 'invalid bit length repeat';
state.mode = BAD;
break;
}
while (copy--) {
state.lens[state.have++] = len;
}
}
}
if (state.mode === BAD) { break; }
if (state.lens[256] === 0) {
strm.msg = 'invalid code -- missing end-of-block';
state.mode = BAD;
break;
}
state.lenbits = 9;
opts = { bits: state.lenbits };
ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
state.lenbits = opts.bits;
if (ret) {
strm.msg = 'invalid literal/lengths set';
state.mode = BAD;
break;
}
state.distbits = 6;
state.distcode = state.distdyn;
opts = { bits: state.distbits };
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
state.distbits = opts.bits;
if (ret) {
strm.msg = 'invalid distances set';
state.mode = BAD;
break;
}
state.mode = LEN_;
if (flush === Z_TREES) { break inf_leave; }
case LEN_:
state.mode = LEN;
case LEN:
if (have >= 6 && left >= 258) {
strm.next_out = put;
strm.avail_out = left;
strm.next_in = next;
strm.avail_in = have;
state.hold = hold;
state.bits = bits;
inflate_fast(strm, _out);
put = strm.next_out;
output = strm.output;
left = strm.avail_out;
next = strm.next_in;
input = strm.input;
have = strm.avail_in;
hold = state.hold;
bits = state.bits;
if (state.mode === TYPE) {
state.back = -1;
}
break;
}
state.back = 0;
for (;;) {
here = state.lencode[hold & ((1 << state.lenbits) - 1)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 0xff;
here_val = here & 0xffff;
if (here_bits <= bits) { break; }
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (here_op && (here_op & 0xf0) === 0) {
last_bits = here_bits;
last_op = here_op;
last_val = here_val;
for (;;) {
here = state.lencode[last_val +
((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 0xff;
here_val = here & 0xffff;
if ((last_bits + here_bits) <= bits) { break; }
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
hold >>>= last_bits;
bits -= last_bits;
state.back += last_bits;
}
hold >>>= here_bits;
bits -= here_bits;
state.back += here_bits;
state.length = here_val;
if (here_op === 0) {
state.mode = LIT;
break;
}
if (here_op & 32) {
state.back = -1;
state.mode = TYPE;
break;
}
if (here_op & 64) {
strm.msg = 'invalid literal/length code';
state.mode = BAD;
break;
}
state.extra = here_op & 15;
state.mode = LENEXT;
case LENEXT:
if (state.extra) {
n = state.extra;
while (bits < n) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.length += hold & ((1 << state.extra) - 1);
hold >>>= state.extra;
bits -= state.extra;
state.back += state.extra;
}
state.was = state.length;
state.mode = DIST;
case DIST:
for (;;) {
here = state.distcode[hold & ((1 << state.distbits) - 1)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 0xff;
here_val = here & 0xffff;
if ((here_bits) <= bits) { break; }
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if ((here_op & 0xf0) === 0) {
last_bits = here_bits;
last_op = here_op;
last_val = here_val;
for (;;) {
here = state.distcode[last_val +
((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 0xff;
here_val = here & 0xffff;
if ((last_bits + here_bits) <= bits) { break; }
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
hold >>>= last_bits;
bits -= last_bits;
state.back += last_bits;
}
hold >>>= here_bits;
bits -= here_bits;
state.back += here_bits;
if (here_op & 64) {
strm.msg = 'invalid distance code';
state.mode = BAD;
break;
}
state.offset = here_val;
state.extra = (here_op) & 15;
state.mode = DISTEXT;
case DISTEXT:
if (state.extra) {
n = state.extra;
while (bits < n) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
state.offset += hold & ((1 << state.extra) - 1);
hold >>>= state.extra;
bits -= state.extra;
state.back += state.extra;
}
if (state.offset > state.dmax) {
strm.msg = 'invalid distance too far back';
state.mode = BAD;
break;
}
state.mode = MATCH;
case MATCH:
if (left === 0) { break inf_leave; }
copy = _out - left;
if (state.offset > copy) {
copy = state.offset - copy;
if (copy > state.whave) {
if (state.sane) {
strm.msg = 'invalid distance too far back';
state.mode = BAD;
break;
}
}
if (copy > state.wnext) {
copy -= state.wnext;
from = state.wsize - copy;
}
else {
from = state.wnext - copy;
}
if (copy > state.length) { copy = state.length; }
from_source = state.window;
}
else {
from_source = output;
from = put - state.offset;
copy = state.length;
}
if (copy > left) { copy = left; }
left -= copy;
state.length -= copy;
do {
output[put++] = from_source[from++];
} while (--copy);
if (state.length === 0) { state.mode = LEN; }
break;
case LIT:
if (left === 0) { break inf_leave; }
output[put++] = state.length;
left--;
state.mode = LEN;
break;
case CHECK:
if (state.wrap) {
while (bits < 32) {
if (have === 0) { break inf_leave; }
have--;
hold |= input[next++] << bits;
bits += 8;
}
_out -= left;
strm.total_out += _out;
state.total += _out;
if (_out) {
strm.adler = state.check =
(state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
}
_out = left;
if ((state.flags ? hold : zswap32(hold)) !== state.check) {
strm.msg = 'incorrect data check';
state.mode = BAD;
break;
}
hold = 0;
bits = 0;
}
state.mode = LENGTH;
case LENGTH:
if (state.wrap && state.flags) {
while (bits < 32) {
if (have === 0) { break inf_leave; }
have--;
hold += input[next++] << bits;
bits += 8;
}
if (hold !== (state.total & 0xffffffff)) {
strm.msg = 'incorrect length check';
state.mode = BAD;
break;
}
hold = 0;
bits = 0;
}
state.mode = DONE;
case DONE:
ret = Z_STREAM_END;
break inf_leave;
case BAD:
ret = Z_DATA_ERROR;
break inf_leave;
case MEM:
return Z_MEM_ERROR;
case SYNC:
default:
return Z_STREAM_ERROR;
}
}
strm.next_out = put;
strm.avail_out = left;
strm.next_in = next;
strm.avail_in = have;
state.hold = hold;
state.bits = bits;
if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
(state.mode < CHECK || flush !== Z_FINISH))) {
if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;
}
_in -= strm.avail_in;
_out -= strm.avail_out;
strm.total_in += _in;
strm.total_out += _out;
state.total += _out;
if (state.wrap && _out) {
strm.adler = state.check =
(state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
}
strm.data_type = state.bits + (state.last ? 64 : 0) +
(state.mode === TYPE ? 128 : 0) +
(state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
ret = Z_BUF_ERROR;
}
return ret;
}
function inflateEnd(strm) {
if (!strm || !strm.state ) {
return Z_STREAM_ERROR;
}
var state = strm.state;
if (state.window) {
state.window = null;
}
strm.state = null;
return Z_OK;
}
function inflateGetHeader(strm, head) {
var state;
if (!strm || !strm.state) { return Z_STREAM_ERROR; }
state = strm.state;
if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
state.head = head;
head.done = false;
return Z_OK;
}
function inflateSetDictionary(strm, dictionary) {
var dictLength = dictionary.length;
var state;
var dictid;
var ret;
if (!strm || !strm.state ) { return Z_STREAM_ERROR; }
state = strm.state;
if (state.wrap !== 0 && state.mode !== DICT) {
return Z_STREAM_ERROR;
}
if (state.mode === DICT) {
dictid = 1;
dictid = adler32(dictid, dictionary, dictLength, 0);
if (dictid !== state.check) {
return Z_DATA_ERROR;
}
}
ret = updatewindow(strm, dictionary, dictLength, dictLength);
if (ret) {
state.mode = MEM;
return Z_MEM_ERROR;
}
state.havedict = 1;
return Z_OK;
}
exports.inflateReset = inflateReset;
exports.inflateReset2 = inflateReset2;
exports.inflateResetKeep = inflateResetKeep;
exports.inflateInit = inflateInit;
exports.inflateInit2 = inflateInit2;
exports.inflate = inflate;
exports.inflateEnd = inflateEnd;
exports.inflateGetHeader = inflateGetHeader;
exports.inflateSetDictionary = inflateSetDictionary;
exports.inflateInfo = 'pako inflate (from Nodeca project)';
},{"../utils/common":35,"./adler32":36,"./crc32":38,"./inffast":40,"./inftrees":42}],42:[function(require,module,exports){
var utils = require('../utils/common');
var MAXBITS = 15;
var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
var CODES = 0;
var LENS = 1;
var DISTS = 2;
var lbase = [
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
];
var lext = [
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
];
var dbase = [
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577, 0, 0
];
var dext = [
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
28, 28, 29, 29, 64, 64
];
module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
{
var bits = opts.bits;
var len = 0;
var sym = 0;
var min = 0, max = 0;
var root = 0;
var curr = 0;
var drop = 0;
var left = 0;
var used = 0;
var huff = 0;
var incr;
var fill;
var low;
var mask;
var next;
var base = null;
var base_index = 0;
var end;
var count = new utils.Buf16(MAXBITS + 1);
var offs = new utils.Buf16(MAXBITS + 1);
var extra = null;
var extra_index = 0;
var here_bits, here_op, here_val;
for (len = 0; len <= MAXBITS; len++) {
count[len] = 0;
}
for (sym = 0; sym < codes; sym++) {
count[lens[lens_index + sym]]++;
}
root = bits;
for (max = MAXBITS; max >= 1; max--) {
if (count[max] !== 0) { break; }
}
if (root > max) {
root = max;
}
if (max === 0) {
table[table_index++] = (1 << 24) | (64 << 16) | 0;
table[table_index++] = (1 << 24) | (64 << 16) | 0;
opts.bits = 1;
return 0;
}
for (min = 1; min < max; min++) {
if (count[min] !== 0) { break; }
}
if (root < min) {
root = min;
}
left = 1;
for (len = 1; len <= MAXBITS; len++) {
left <<= 1;
left -= count[len];
if (left < 0) {
return -1;
}
}
if (left > 0 && (type === CODES || max !== 1)) {
return -1;
}
offs[1] = 0;
for (len = 1; len < MAXBITS; len++) {
offs[len + 1] = offs[len] + count[len];
}
for (sym = 0; sym < codes; sym++) {
if (lens[lens_index + sym] !== 0) {
work[offs[lens[lens_index + sym]]++] = sym;
}
}
if (type === CODES) {
base = extra = work;
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else {
base = dbase;
extra = dext;
end = -1;
}
huff = 0;
sym = 0;
len = min;
next = table_index;
curr = root;
drop = 0;
low = -1;
used = 1 << root;
mask = used - 1;
if ((type === LENS && used > ENOUGH_LENS) ||
(type === DISTS && used > ENOUGH_DISTS)) {
return 1;
}
for (;;) {
here_bits = len - drop;
if (work[sym] < end) {
here_op = 0;
here_val = work[sym];
}
else if (work[sym] > end) {
here_op = extra[extra_index + work[sym]];
here_val = base[base_index + work[sym]];
}
else {
here_op = 32 + 64;
here_val = 0;
}
incr = 1 << (len - drop);
fill = 1 << curr;
min = fill;
do {
fill -= incr;
table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
} while (fill !== 0);
incr = 1 << (len - 1);
while (huff & incr) {
incr >>= 1;
}
if (incr !== 0) {
huff &= incr - 1;
huff += incr;
} else {
huff = 0;
}
sym++;
if (--count[len] === 0) {
if (len === max) { break; }
len = lens[lens_index + work[sym]];
}
if (len > root && (huff & mask) !== low) {
if (drop === 0) {
drop = root;
}
next += min;
curr = len - drop;
left = 1 << curr;
while (curr + drop < max) {
left -= count[curr + drop];
if (left <= 0) { break; }
curr++;
left <<= 1;
}
used += 1 << curr;
if ((type === LENS && used > ENOUGH_LENS) ||
(type === DISTS && used > ENOUGH_DISTS)) {
return 1;
}
low = huff & mask;
table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
}
}
if (huff !== 0) {
table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
}
opts.bits = root;
return 0;
};
},{"../utils/common":35}],43:[function(require,module,exports){
module.exports = {
2: 'need dictionary',
1: 'stream end',
0: '',
'-1': 'file error',
'-2': 'stream error',
'-3': 'data error',
'-4': 'insufficient memory',
'-5': 'buffer error',
'-6': 'incompatible version'
};
},{}],44:[function(require,module,exports){
var utils = require('../utils/common');
var Z_FIXED = 4;
var Z_BINARY = 0;
var Z_TEXT = 1;
var Z_UNKNOWN = 2;
function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
var STORED_BLOCK = 0;
var STATIC_TREES = 1;
var DYN_TREES = 2;
var MIN_MATCH = 3;
var MAX_MATCH = 258;
var LENGTH_CODES = 29;
var LITERALS = 256;
var L_CODES = LITERALS + 1 + LENGTH_CODES;
var D_CODES = 30;
var BL_CODES = 19;
var HEAP_SIZE = 2 * L_CODES + 1;
var MAX_BITS = 15;
var Buf_size = 16;
var MAX_BL_BITS = 7;
var END_BLOCK = 256;
var REP_3_6 = 16;
var REPZ_3_10 = 17;
var REPZ_11_138 = 18;
var extra_lbits =
[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];
var extra_dbits =
[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];
var extra_blbits =
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];
var bl_order =
[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
var DIST_CODE_LEN = 512;
var static_ltree = new Array((L_CODES + 2) * 2);
zero(static_ltree);
var static_dtree = new Array(D_CODES * 2);
zero(static_dtree);
var _dist_code = new Array(DIST_CODE_LEN);
zero(_dist_code);
var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);
zero(_length_code);
var base_length = new Array(LENGTH_CODES);
zero(base_length);
var base_dist = new Array(D_CODES);
zero(base_dist);
function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
this.static_tree = static_tree;
this.extra_bits = extra_bits;
this.extra_base = extra_base;
this.elems = elems;
this.max_length = max_length;
this.has_stree = static_tree && static_tree.length;
}
var static_l_desc;
var static_d_desc;
var static_bl_desc;
function TreeDesc(dyn_tree, stat_desc) {
this.dyn_tree = dyn_tree;
this.max_code = 0;
this.stat_desc = stat_desc;
}
function d_code(dist) {
return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
}
function put_short(s, w) {
s.pending_buf[s.pending++] = (w) & 0xff;
s.pending_buf[s.pending++] = (w >>> 8) & 0xff;
}
function send_bits(s, value, length) {
if (s.bi_valid > (Buf_size - length)) {
s.bi_buf |= (value << s.bi_valid) & 0xffff;
put_short(s, s.bi_buf);
s.bi_buf = value >> (Buf_size - s.bi_valid);
s.bi_valid += length - Buf_size;
} else {
s.bi_buf |= (value << s.bi_valid) & 0xffff;
s.bi_valid += length;
}
}
function send_code(s, c, tree) {
send_bits(s, tree[c * 2], tree[c * 2 + 1]);
}
function bi_reverse(code, len) {
var res = 0;
do {
res |= code & 1;
code >>>= 1;
res <<= 1;
} while (--len > 0);
return res >>> 1;
}
function bi_flush(s) {
if (s.bi_valid === 16) {
put_short(s, s.bi_buf);
s.bi_buf = 0;
s.bi_valid = 0;
} else if (s.bi_valid >= 8) {
s.pending_buf[s.pending++] = s.bi_buf & 0xff;
s.bi_buf >>= 8;
s.bi_valid -= 8;
}
}
function gen_bitlen(s, desc)
{
var tree = desc.dyn_tree;
var max_code = desc.max_code;
var stree = desc.stat_desc.static_tree;
var has_stree = desc.stat_desc.has_stree;
var extra = desc.stat_desc.extra_bits;
var base = desc.stat_desc.extra_base;
var max_length = desc.stat_desc.max_length;
var h;
var n, m;
var bits;
var xbits;
var f;
var overflow = 0;
for (bits = 0; bits <= MAX_BITS; bits++) {
s.bl_count[bits] = 0;
}
tree[s.heap[s.heap_max] * 2 + 1] = 0;
for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {
n = s.heap[h];
bits = tree[tree[n * 2 + 1] * 2 + 1] + 1;
if (bits > max_length) {
bits = max_length;
overflow++;
}
tree[n * 2 + 1] = bits;
if (n > max_code) { continue; }
s.bl_count[bits]++;
xbits = 0;
if (n >= base) {
xbits = extra[n - base];
}
f = tree[n * 2];
s.opt_len += f * (bits + xbits);
if (has_stree) {
s.static_len += f * (stree[n * 2 + 1] + xbits);
}
}
if (overflow === 0) { return; }
do {
bits = max_length - 1;
while (s.bl_count[bits] === 0) { bits--; }
s.bl_count[bits]--;
s.bl_count[bits + 1] += 2;
s.bl_count[max_length]--;
overflow -= 2;
} while (overflow > 0);
for (bits = max_length; bits !== 0; bits--) {
n = s.bl_count[bits];
while (n !== 0) {
m = s.heap[--h];
if (m > max_code) { continue; }
if (tree[m * 2 + 1] !== bits) {
s.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];
tree[m * 2 + 1] = bits;
}
n--;
}
}
}
function gen_codes(tree, max_code, bl_count)
{
var next_code = new Array(MAX_BITS + 1);
var code = 0;
var bits;
var n;
for (bits = 1; bits <= MAX_BITS; bits++) {
next_code[bits] = code = (code + bl_count[bits - 1]) << 1;
}
for (n = 0; n <= max_code; n++) {
var len = tree[n * 2 + 1];
if (len === 0) { continue; }
tree[n * 2] = bi_reverse(next_code[len]++, len);
}
}
function tr_static_init() {
var n;
var bits;
var length;
var code;
var dist;
var bl_count = new Array(MAX_BITS + 1);
length = 0;
for (code = 0; code < LENGTH_CODES - 1; code++) {
base_length[code] = length;
for (n = 0; n < (1 << extra_lbits[code]); n++) {
_length_code[length++] = code;
}
}
_length_code[length - 1] = code;
dist = 0;
for (code = 0; code < 16; code++) {
base_dist[code] = dist;
for (n = 0; n < (1 << extra_dbits[code]); n++) {
_dist_code[dist++] = code;
}
}
dist >>= 7;
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
_dist_code[256 + dist++] = code;
}
}
for (bits = 0; bits <= MAX_BITS; bits++) {
bl_count[bits] = 0;
}
n = 0;
while (n <= 143) {
static_ltree[n * 2 + 1] = 8;
n++;
bl_count[8]++;
}
while (n <= 255) {
static_ltree[n * 2 + 1] = 9;
n++;
bl_count[9]++;
}
while (n <= 279) {
static_ltree[n * 2 + 1] = 7;
n++;
bl_count[7]++;
}
while (n <= 287) {
static_ltree[n * 2 + 1] = 8;
n++;
bl_count[8]++;
}
gen_codes(static_ltree, L_CODES + 1, bl_count);
for (n = 0; n < D_CODES; n++) {
static_dtree[n * 2 + 1] = 5;
static_dtree[n * 2] = bi_reverse(n, 5);
}
static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
}
function init_block(s) {
var n;
for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2] = 0; }
for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2] = 0; }
for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2] = 0; }
s.dyn_ltree[END_BLOCK * 2] = 1;
s.opt_len = s.static_len = 0;
s.last_lit = s.matches = 0;
}
function bi_windup(s)
{
if (s.bi_valid > 8) {
put_short(s, s.bi_buf);
} else if (s.bi_valid > 0) {
s.pending_buf[s.pending++] = s.bi_buf;
}
s.bi_buf = 0;
s.bi_valid = 0;
}
function copy_block(s, buf, len, header)
{
bi_windup(s);
if (header) {
put_short(s, len);
put_short(s, ~len);
}
utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);
s.pending += len;
}
function smaller(tree, n, m, depth) {
var _n2 = n * 2;
var _m2 = m * 2;
return (tree[_n2] < tree[_m2] ||
(tree[_n2] === tree[_m2] && depth[n] <= depth[m]));
}
function pqdownheap(s, tree, k)
{
var v = s.heap[k];
var j = k << 1;
while (j <= s.heap_len) {
if (j < s.heap_len &&
smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
j++;
}
if (smaller(tree, v, s.heap[j], s.depth)) { break; }
s.heap[k] = s.heap[j];
k = j;
j <<= 1;
}
s.heap[k] = v;
}
function compress_block(s, ltree, dtree)
{
var dist;
var lc;
var lx = 0;
var code;
var extra;
if (s.last_lit !== 0) {
do {
dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);
lc = s.pending_buf[s.l_buf + lx];
lx++;
if (dist === 0) {
send_code(s, lc, ltree);
} else {
code = _length_code[lc];
send_code(s, code + LITERALS + 1, ltree);
extra = extra_lbits[code];
if (extra !== 0) {
lc -= base_length[code];
send_bits(s, lc, extra);
}
dist--;
code = d_code(dist);
send_code(s, code, dtree);
extra = extra_dbits[code];
if (extra !== 0) {
dist -= base_dist[code];
send_bits(s, dist, extra);
}
}
} while (lx < s.last_lit);
}
send_code(s, END_BLOCK, ltree);
}
function build_tree(s, desc)
{
var tree = desc.dyn_tree;
var stree = desc.stat_desc.static_tree;
var has_stree = desc.stat_desc.has_stree;
var elems = desc.stat_desc.elems;
var n, m;
var max_code = -1;
var node;
s.heap_len = 0;
s.heap_max = HEAP_SIZE;
for (n = 0; n < elems; n++) {
if (tree[n * 2] !== 0) {
s.heap[++s.heap_len] = max_code = n;
s.depth[n] = 0;
} else {
tree[n * 2 + 1] = 0;
}
}
while (s.heap_len < 2) {
node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);
tree[node * 2] = 1;
s.depth[node] = 0;
s.opt_len--;
if (has_stree) {
s.static_len -= stree[node * 2 + 1];
}
}
desc.max_code = max_code;
for (n = (s.heap_len >> 1); n >= 1; n--) { pqdownheap(s, tree, n); }
node = elems;
do {
n = s.heap[1];
s.heap[1] = s.heap[s.heap_len--];
pqdownheap(s, tree, 1);
m = s.heap[1];
s.heap[--s.heap_max] = n;
s.heap[--s.heap_max] = m;
tree[node * 2] = tree[n * 2] + tree[m * 2];
s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
tree[n * 2 + 1] = tree[m * 2 + 1] = node;
s.heap[1] = node++;
pqdownheap(s, tree, 1);
} while (s.heap_len >= 2);
s.heap[--s.heap_max] = s.heap[1];
gen_bitlen(s, desc);
gen_codes(tree, max_code, s.bl_count);
}
function scan_tree(s, tree, max_code)
{
var n;
var prevlen = -1;
var curlen;
var nextlen = tree[0 * 2 + 1];
var count = 0;
var max_count = 7;
var min_count = 4;
if (nextlen === 0) {
max_count = 138;
min_count = 3;
}
tree[(max_code + 1) * 2 + 1] = 0xffff;
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[(n + 1) * 2 + 1];
if (++count < max_count && curlen === nextlen) {
continue;
} else if (count < min_count) {
s.bl_tree[curlen * 2] += count;
} else if (curlen !== 0) {
if (curlen !== prevlen) { s.bl_tree[curlen * 2]++; }
s.bl_tree[REP_3_6 * 2]++;
} else if (count <= 10) {
s.bl_tree[REPZ_3_10 * 2]++;
} else {
s.bl_tree[REPZ_11_138 * 2]++;
}
count = 0;
prevlen = curlen;
if (nextlen === 0) {
max_count = 138;
min_count = 3;
} else if (curlen === nextlen) {
max_count = 6;
min_count = 3;
} else {
max_count = 7;
min_count = 4;
}
}
}
function send_tree(s, tree, max_code)
{
var n;
var prevlen = -1;
var curlen;
var nextlen = tree[0 * 2 + 1];
var count = 0;
var max_count = 7;
var min_count = 4;
if (nextlen === 0) {
max_count = 138;
min_count = 3;
}
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[(n + 1) * 2 + 1];
if (++count < max_count && curlen === nextlen) {
continue;
} else if (count < min_count) {
do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);
} else if (curlen !== 0) {
if (curlen !== prevlen) {
send_code(s, curlen, s.bl_tree);
count--;
}
send_code(s, REP_3_6, s.bl_tree);
send_bits(s, count - 3, 2);
} else if (count <= 10) {
send_code(s, REPZ_3_10, s.bl_tree);
send_bits(s, count - 3, 3);
} else {
send_code(s, REPZ_11_138, s.bl_tree);
send_bits(s, count - 11, 7);
}
count = 0;
prevlen = curlen;
if (nextlen === 0) {
max_count = 138;
min_count = 3;
} else if (curlen === nextlen) {
max_count = 6;
min_count = 3;
} else {
max_count = 7;
min_count = 4;
}
}
}
function build_bl_tree(s) {
var max_blindex;
scan_tree(s, s.dyn_ltree, s.l_desc.max_code);
scan_tree(s, s.dyn_dtree, s.d_desc.max_code);
build_tree(s, s.bl_desc);
for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) {
break;
}
}
s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
return max_blindex;
}
function send_all_trees(s, lcodes, dcodes, blcodes)
{
var rank;
send_bits(s, lcodes - 257, 5);
send_bits(s, dcodes - 1, 5);
send_bits(s, blcodes - 4, 4);
for (rank = 0; rank < blcodes; rank++) {
send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], 3);
}
send_tree(s, s.dyn_ltree, lcodes - 1);
send_tree(s, s.dyn_dtree, dcodes - 1);
}
function detect_data_type(s) {
var black_mask = 0xf3ffc07f;
var n;
for (n = 0; n <= 31; n++, black_mask >>>= 1) {
if ((black_mask & 1) && (s.dyn_ltree[n * 2] !== 0)) {
return Z_BINARY;
}
}
if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 ||
s.dyn_ltree[13 * 2] !== 0) {
return Z_TEXT;
}
for (n = 32; n < LITERALS; n++) {
if (s.dyn_ltree[n * 2] !== 0) {
return Z_TEXT;
}
}
return Z_BINARY;
}
var static_init_done = false;
function _tr_init(s)
{
if (!static_init_done) {
tr_static_init();
static_init_done = true;
}
s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);
s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);
s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);
s.bi_buf = 0;
s.bi_valid = 0;
init_block(s);
}
function _tr_stored_block(s, buf, stored_len, last)
{
send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);
copy_block(s, buf, stored_len, true);
}
function _tr_align(s) {
send_bits(s, STATIC_TREES << 1, 3);
send_code(s, END_BLOCK, static_ltree);
bi_flush(s);
}
function _tr_flush_block(s, buf, stored_len, last)
{
var opt_lenb, static_lenb;
var max_blindex = 0;
if (s.level > 0) {
if (s.strm.data_type === Z_UNKNOWN) {
s.strm.data_type = detect_data_type(s);
}
build_tree(s, s.l_desc);
build_tree(s, s.d_desc);
max_blindex = build_bl_tree(s);
opt_lenb = (s.opt_len + 3 + 7) >>> 3;
static_lenb = (s.static_len + 3 + 7) >>> 3;
if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }
} else {
opt_lenb = static_lenb = stored_len + 5;
}
if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {
_tr_stored_block(s, buf, stored_len, last);
} else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {
send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);
compress_block(s, static_ltree, static_dtree);
} else {
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
compress_block(s, s.dyn_ltree, s.dyn_dtree);
}
init_block(s);
if (last) {
bi_windup(s);
}
}
function _tr_tally(s, dist, lc)
{
s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;
s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;
s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;
s.last_lit++;
if (dist === 0) {
s.dyn_ltree[lc * 2]++;
} else {
s.matches++;
dist--;
s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]++;
s.dyn_dtree[d_code(dist) * 2]++;
}
return (s.last_lit === s.lit_bufsize - 1);
}
exports._tr_init = _tr_init;
exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
},{"../utils/common":35}],45:[function(require,module,exports){
function ZStream() {
this.input = null;
this.next_in = 0;
this.avail_in = 0;
this.total_in = 0;
this.output = null;
this.next_out = 0;
this.avail_out = 0;
this.total_out = 0;
this.msg = '';
this.state = null;
this.data_type = 2;
this.adler = 0;
}
module.exports = ZStream;
},{}],46:[function(require,module,exports){
(function (process){
if (!process.version ||
process.version.indexOf('v0.') === 0 ||
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
module.exports = nextTick;
} else {
module.exports = process.nextTick;
}
function nextTick(fn, arg1, arg2, arg3) {
if (typeof fn !== 'function') {
throw new TypeError('"callback" argument must be a function');
}
var len = arguments.length;
var args, i;
switch (len) {
case 0:
case 1:
return process.nextTick(fn);
case 2:
return process.nextTick(function afterTickOne() {
fn.call(null, arg1);
});
case 3:
return process.nextTick(function afterTickTwo() {
fn.call(null, arg1, arg2);
});
case 4:
return process.nextTick(function afterTickThree() {
fn.call(null, arg1, arg2, arg3);
});
default:
args = new Array(len - 1);
i = 0;
while (i < args.length) {
args[i++] = arguments[i];
}
return process.nextTick(function afterTick() {
fn.apply(null, args);
});
}
}
}).call(this,require('_process'));
},{"_process":47}],47:[function(require,module,exports){
var process = module.exports = {};
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ());
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
return setTimeout(fun, 0);
}
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
return cachedSetTimeout(fun, 0);
} catch(e){
try {
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
return clearTimeout(marker);
}
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
return cachedClearTimeout(marker);
} catch (e){
try {
return cachedClearTimeout.call(null, marker);
} catch (e){
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = '';
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] };
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],48:[function(require,module,exports){
module.exports = require('./lib/_stream_duplex.js');
},{"./lib/_stream_duplex.js":49}],49:[function(require,module,exports){
var processNextTick = require('process-nextick-args');
var objectKeys = Object.keys || function (obj) {
var keys = [];
for (var key in obj) {
keys.push(key);
}return keys;
};
module.exports = Duplex;
var util = require('core-util-is');
util.inherits = require('inherits');
var Readable = require('./_stream_readable');
var Writable = require('./_stream_writable');
util.inherits(Duplex, Readable);
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
function Duplex(options) {
if (!(this instanceof Duplex)) return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
if (options && options.readable === false) this.readable = false;
if (options && options.writable === false) this.writable = false;
this.allowHalfOpen = true;
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
this.once('end', onend);
}
function onend() {
if (this.allowHalfOpen || this._writableState.ended) return;
processNextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
Object.defineProperty(Duplex.prototype, 'destroyed', {
get: function () {
if (this._readableState === undefined || this._writableState === undefined) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function (value) {
if (this._readableState === undefined || this._writableState === undefined) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
Duplex.prototype._destroy = function (err, cb) {
this.push(null);
this.end();
processNextTick(cb, err);
};
},{"./_stream_readable":51,"./_stream_writable":53,"core-util-is":29,"inherits":32,"process-nextick-args":46}],50:[function(require,module,exports){
module.exports = PassThrough;
var Transform = require('./_stream_transform');
var util = require('core-util-is');
util.inherits = require('inherits');
util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough)) return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function (chunk, encoding, cb) {
cb(null, chunk);
};
},{"./_stream_transform":52,"core-util-is":29,"inherits":32}],51:[function(require,module,exports){
(function (process,global){
var processNextTick = require('process-nextick-args');
module.exports = Readable;
var isArray = require('isarray');
var Duplex;
Readable.ReadableState = ReadableState;
require('events').EventEmitter;
var EElistenerCount = function (emitter, type) {
return emitter.listeners(type).length;
};
var Stream = require('./internal/streams/stream');
var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
var util = require('core-util-is');
util.inherits = require('inherits');
var debugUtil = require('util');
var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog('stream');
} else {
debug = function () {};
}
var BufferList = require('./internal/streams/BufferList');
var destroyImpl = require('./internal/streams/destroy');
var StringDecoder;
util.inherits(Readable, Stream);
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === 'function') {
return emitter.prependListener(event, fn);
} else {
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
}
}
function ReadableState(options, stream) {
Duplex = Duplex || require('./_stream_duplex');
options = options || {};
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
var hwm = options.highWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || 'utf8';
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require('./_stream_duplex');
if (!(this instanceof Readable)) return new Readable(options);
this._readableState = new ReadableState(options, this);
this.readable = true;
if (options) {
if (typeof options.read === 'function') this._read = options.read;
if (typeof options.destroy === 'function') this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, 'destroyed', {
get: function () {
if (this._readableState === undefined) {
return false;
}
return this._readableState.destroyed;
},
set: function (value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function (err, cb) {
this.push(null);
cb(err);
};
Readable.prototype.push = function (chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
if (!state.objectMode) {
if (typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = Buffer.from(chunk, encoding);
encoding = '';
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function (chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
var state = stream._readableState;
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck) er = chunkInvalid(state, chunk);
if (er) {
stream.emit('error', er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
} else if (state.ended) {
stream.emit('error', new Error('stream.push() after EOF'));
} else {
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
}
}
} else if (!addToFront) {
state.reading = false;
}
}
return needMoreData(state);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
stream.emit('data', chunk);
stream.read(0);
} else {
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
if (state.needReadable) emitReadable(stream);
}
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
return er;
}
function needMoreData(state) {
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
}
Readable.prototype.isPaused = function () {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function (enc) {
if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
this._readableState.encoding = enc;
return this;
};
var MAX_HWM = 0x800000;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended) return 0;
if (state.objectMode) return 1;
if (n !== n) {
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
}
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
if (n <= state.length) return n;
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
}
Readable.prototype.read = function (n) {
debug('read', n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
if (n !== 0) state.emittedReadable = false;
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug('read: emitReadable', state.length, state.ended);
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
if (n === 0 && state.ended) {
if (state.length === 0) endReadable(this);
return null;
}
var doRead = state.needReadable;
debug('need readable', doRead);
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug('length less than watermark', doRead);
}
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
} else if (doRead) {
debug('do read');
state.reading = true;
state.sync = true;
if (state.length === 0) state.needReadable = true;
this._read(state.highWaterMark);
state.sync = false;
if (!state.reading) n = howMuchToRead(nOrig, state);
}
var ret;
if (n > 0) ret = fromList(n, state);else ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
} else {
state.length -= n;
}
if (state.length === 0) {
if (!state.ended) state.needReadable = true;
if (nOrig !== n && state.ended) endReadable(this);
}
if (ret !== null) this.emit('data', ret);
return ret;
};
function onEofChunk(stream, state) {
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
emitReadable(stream);
}
function emitReadable(stream) {
var state = stream._readableState;
state.needReadable = false;
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
}
}
function emitReadable_(stream) {
debug('emit readable');
stream.emit('readable');
flow(stream);
}
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
processNextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
var len = state.length;
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
debug('maybeReadMore read 0');
stream.read(0);
if (len === state.length)
break;else len = state.length;
}
state.readingMore = false;
}
Readable.prototype._read = function (n) {
this.emit('error', new Error('_read() is not implemented'));
};
Readable.prototype.pipe = function (dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onunpipe(readable, unpipeInfo) {
debug('onunpipe');
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug('onend');
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on('drain', ondrain);
var cleanedUp = false;
function cleanup() {
debug('cleanup');
dest.removeListener('close', onclose);
dest.removeListener('finish', onfinish);
dest.removeListener('drain', ondrain);
dest.removeListener('error', onerror);
dest.removeListener('unpipe', onunpipe);
src.removeListener('end', onend);
src.removeListener('end', unpipe);
src.removeListener('data', ondata);
cleanedUp = true;
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
var increasedAwaitDrain = false;
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
increasedAwaitDrain = false;
var ret = dest.write(chunk);
if (false === ret && !increasedAwaitDrain) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug('false write response, pause', src._readableState.awaitDrain);
src._readableState.awaitDrain++;
increasedAwaitDrain = true;
}
src.pause();
}
}
function onerror(er) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
}
prependListener(dest, 'error', onerror);
function onclose() {
dest.removeListener('finish', onfinish);
unpipe();
}
dest.once('close', onclose);
function onfinish() {
debug('onfinish');
dest.removeListener('close', onclose);
unpipe();
}
dest.once('finish', onfinish);
function unpipe() {
debug('unpipe');
src.unpipe(dest);
}
dest.emit('pipe', src);
if (!state.flowing) {
debug('pipe resume');
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function () {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
if (state.awaitDrain) state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
state.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function (dest) {
var state = this._readableState;
var unpipeInfo = { hasUnpiped: false };
if (state.pipesCount === 0) return this;
if (state.pipesCount === 1) {
if (dest && dest !== state.pipes) return this;
if (!dest) dest = state.pipes;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest) dest.emit('unpipe', this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
for (var i = 0; i < len; i++) {
dests[i].emit('unpipe', this, unpipeInfo);
}return this;
}
var index = indexOf(state.pipes, dest);
if (index === -1) return this;
state.pipes.splice(index, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1) state.pipes = state.pipes[0];
dest.emit('unpipe', this, unpipeInfo);
return this;
};
Readable.prototype.on = function (ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
if (ev === 'data') {
if (this._readableState.flowing !== false) this.resume();
} else if (ev === 'readable') {
var state = this._readableState;
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
state.emittedReadable = false;
if (!state.reading) {
processNextTick(nReadingNextTick, this);
} else if (state.length) {
emitReadable(this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
}
Readable.prototype.resume = function () {
var state = this._readableState;
if (!state.flowing) {
debug('resume');
state.flowing = true;
resume(this, state);
}
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
processNextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
if (!state.reading) {
debug('resume read 0');
stream.read(0);
}
state.resumeScheduled = false;
state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
if (state.flowing && !state.reading) stream.read(0);
}
Readable.prototype.pause = function () {
debug('call pause flowing=%j', this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug('pause');
this._readableState.flowing = false;
this.emit('pause');
}
return this;
};
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
while (state.flowing && stream.read() !== null) {}
}
Readable.prototype.wrap = function (stream) {
var state = this._readableState;
var paused = false;
var self = this;
stream.on('end', function () {
debug('wrapped end');
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length) self.push(chunk);
}
self.push(null);
});
stream.on('data', function (chunk) {
debug('wrapped data');
if (state.decoder) chunk = state.decoder.write(chunk);
if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
var ret = self.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === undefined && typeof stream[i] === 'function') {
this[i] = function (method) {
return function () {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n]));
}
self._read = function (n) {
debug('wrapped _read', n);
if (paused) {
paused = false;
stream.resume();
}
};
return self;
};
Readable._fromList = fromList;
function fromList(n, state) {
if (state.length === 0) return null;
var ret;
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
ret = fromListPartial(n, state.buffer, state.decoder);
}
return ret;
}
function fromListPartial(n, list, hasStrings) {
var ret;
if (n < list.head.data.length) {
ret = list.head.data.slice(0, n);
list.head.data = list.head.data.slice(n);
} else if (n === list.head.data.length) {
ret = list.shift();
} else {
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
}
return ret;
}
function copyFromBufferString(n, list) {
var p = list.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length) ret += str;else ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next) list.head = p.next;else list.head = list.tail = null;
} else {
list.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function copyFromBuffer(n, list) {
var ret = Buffer.allocUnsafe(n);
var p = list.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next) list.head = p.next;else list.head = list.tail = null;
} else {
list.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
processNextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
}).call(this,require('_process'),typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
},{"./_stream_duplex":49,"./internal/streams/BufferList":54,"./internal/streams/destroy":55,"./internal/streams/stream":56,"_process":47,"core-util-is":29,"events":30,"inherits":32,"isarray":34,"process-nextick-args":46,"safe-buffer":62,"string_decoder/":57,"util":25}],52:[function(require,module,exports){
module.exports = Transform;
var Duplex = require('./_stream_duplex');
var util = require('core-util-is');
util.inherits = require('inherits');
util.inherits(Transform, Duplex);
function TransformState(stream) {
this.afterTransform = function (er, data) {
return afterTransform(stream, er, data);
};
this.needTransform = false;
this.transforming = false;
this.writecb = null;
this.writechunk = null;
this.writeencoding = null;
}
function afterTransform(stream, er, data) {
var ts = stream._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb) {
return stream.emit('error', new Error('write callback called multiple times'));
}
ts.writechunk = null;
ts.writecb = null;
if (data !== null && data !== undefined) stream.push(data);
cb(er);
var rs = stream._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
stream._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform)) return new Transform(options);
Duplex.call(this, options);
this._transformState = new TransformState(this);
var stream = this;
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === 'function') this._transform = options.transform;
if (typeof options.flush === 'function') this._flush = options.flush;
}
this.once('prefinish', function () {
if (typeof this._flush === 'function') this._flush(function (er, data) {
done(stream, er, data);
});else done(stream);
});
}
Transform.prototype.push = function (chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function (chunk, encoding, cb) {
throw new Error('_transform() is not implemented');
};
Transform.prototype._write = function (chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function (n) {
var ts = this._transformState;
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function (err, cb) {
var _this = this;
Duplex.prototype._destroy.call(this, err, function (err2) {
cb(err2);
_this.emit('close');
});
};
function done(stream, er, data) {
if (er) return stream.emit('error', er);
if (data !== null && data !== undefined) stream.push(data);
var ws = stream._writableState;
var ts = stream._transformState;
if (ws.length) throw new Error('Calling transform done when ws.length != 0');
if (ts.transforming) throw new Error('Calling transform done when still transforming');
return stream.push(null);
}
},{"./_stream_duplex":49,"core-util-is":29,"inherits":32}],53:[function(require,module,exports){
(function (process,global){
var processNextTick = require('process-nextick-args');
module.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function () {
onCorkedFinish(_this, state);
};
}
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
var Duplex;
Writable.WritableState = WritableState;
var util = require('core-util-is');
util.inherits = require('inherits');
var internalUtil = {
deprecate: require('util-deprecate')
};
var Stream = require('./internal/streams/stream');
var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require('./internal/streams/destroy');
util.inherits(Writable, Stream);
function nop() {}
function WritableState(options, stream) {
Duplex = Duplex || require('./_stream_duplex');
options = options || {};
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
var hwm = options.highWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || 'utf8';
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function (er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function () {
try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: internalUtil.deprecate(function () {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
});
} catch (_) {}
})();
var realHasInstance;
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function (object) {
if (realHasInstance.call(this, object)) return true;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function (object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require('./_stream_duplex');
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
}
this._writableState = new WritableState(options, this);
this.writable = true;
if (options) {
if (typeof options.write === 'function') this._write = options.write;
if (typeof options.writev === 'function') this._writev = options.writev;
if (typeof options.destroy === 'function') this._destroy = options.destroy;
if (typeof options.final === 'function') this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function () {
this.emit('error', new Error('Cannot pipe, not readable'));
};
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
stream.emit('error', er);
processNextTick(cb, er);
}
function validChunk(stream, state, chunk, cb) {
var valid = true;
var er = false;
if (chunk === null) {
er = new TypeError('May not write null values to stream');
} else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
if (er) {
stream.emit('error', er);
processNextTick(cb, er);
valid = false;
}
return valid;
}
Writable.prototype.write = function (chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = _isUint8Array(chunk) && !state.objectMode;
if (isBuf && !Buffer.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
if (typeof cb !== 'function') cb = nop;
if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function () {
var state = this._writableState;
state.corked++;
};
Writable.prototype.uncork = function () {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding);
}
return chunk;
}
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = 'buffer';
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
if (!ret) state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk: chunk,
encoding: encoding,
isBuf: isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
processNextTick(cb, er);
processNextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
onwriteStateUpdate(state);
if (er) onwriteError(stream, state, sync, er, cb);else {
var finished = needFinish(state);
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
asyncWrite(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished) onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit('drain');
}
}
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf) allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
if (state.writing) {
break;
}
}
if (entry === null) state.lastBufferedRequest = null;
}
state.bufferedRequestCount = 0;
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function (chunk, encoding, cb) {
cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;
Writable.prototype.end = function (chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
if (state.corked) {
state.corked = 1;
this.uncork();
}
if (!state.ending && !state.finished) endWritable(this, state, cb);
};
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function (err) {
state.pendingcb--;
if (err) {
stream.emit('error', err);
}
state.prefinished = true;
stream.emit('prefinish');
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === 'function') {
state.pendingcb++;
state.finalCalled = true;
processNextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit('prefinish');
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit('finish');
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished) processNextTick(cb);else stream.once('finish', cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
if (state.corkedRequestsFree) {
state.corkedRequestsFree.next = corkReq;
} else {
state.corkedRequestsFree = corkReq;
}
}
Object.defineProperty(Writable.prototype, 'destroyed', {
get: function () {
if (this._writableState === undefined) {
return false;
}
return this._writableState.destroyed;
},
set: function (value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function (err, cb) {
this.end();
cb(err);
};
}).call(this,require('_process'),typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
},{"./_stream_duplex":49,"./internal/streams/destroy":55,"./internal/streams/stream":56,"_process":47,"core-util-is":29,"inherits":32,"process-nextick-args":46,"safe-buffer":62,"util-deprecate":64}],54:[function(require,module,exports){
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Buffer = require('safe-buffer').Buffer;
function copyBuffer(src, target, offset) {
src.copy(target, offset);
}
module.exports = function () {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
BufferList.prototype.push = function push(v) {
var entry = { data: v, next: null };
if (this.length > 0) this.tail.next = entry;else this.head = entry;
this.tail = entry;
++this.length;
};
BufferList.prototype.unshift = function unshift(v) {
var entry = { data: v, next: this.head };
if (this.length === 0) this.tail = entry;
this.head = entry;
++this.length;
};
BufferList.prototype.shift = function shift() {
if (this.length === 0) return;
var ret = this.head.data;
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
--this.length;
return ret;
};
BufferList.prototype.clear = function clear() {
this.head = this.tail = null;
this.length = 0;
};
BufferList.prototype.join = function join(s) {
if (this.length === 0) return '';
var p = this.head;
var ret = '' + p.data;
while (p = p.next) {
ret += s + p.data;
}return ret;
};
BufferList.prototype.concat = function concat(n) {
if (this.length === 0) return Buffer.alloc(0);
if (this.length === 1) return this.head.data;
var ret = Buffer.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
};
return BufferList;
}();
},{"safe-buffer":62}],55:[function(require,module,exports){
var processNextTick = require('process-nextick-args');
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
processNextTick(emitErrorNT, this, err);
}
return;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function (err) {
if (!cb && err) {
processNextTick(emitErrorNT, _this, err);
if (_this._writableState) {
_this._writableState.errorEmitted = true;
}
} else if (cb) {
cb(err);
}
});
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self, err) {
self.emit('error', err);
}
module.exports = {
destroy: destroy,
undestroy: undestroy
};
},{"process-nextick-args":46}],56:[function(require,module,exports){
module.exports = require('events').EventEmitter;
},{"events":30}],57:[function(require,module,exports){
var Buffer = require('safe-buffer').Buffer;
var isEncoding = Buffer.isEncoding || function (encoding) {
encoding = '' + encoding;
switch (encoding && encoding.toLowerCase()) {
case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc) return 'utf8';
var retried;
while (true) {
switch (enc) {
case 'utf8':
case 'utf-8':
return 'utf8';
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return 'utf16le';
case 'latin1':
case 'binary':
return 'latin1';
case 'base64':
case 'ascii':
case 'hex':
return enc;
default:
if (retried) return;
enc = ('' + enc).toLowerCase();
retried = true;
}
}
}function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
return nenc || enc;
}
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case 'utf16le':
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case 'utf8':
this.fillLast = utf8FillLast;
nb = 4;
break;
case 'base64':
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer.allocUnsafe(nb);
}
StringDecoder.prototype.write = function (buf) {
if (buf.length === 0) return '';
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === undefined) return '';
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
return r || '';
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function (buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
return -1;
}
function utf8CheckIncomplete(self, buf, i) {
var j = buf.length - 1;
if (j < i) return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) self.lastNeed = nb - 1;
return nb;
}
if (--j < i) return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) self.lastNeed = nb - 2;
return nb;
}
if (--j < i) return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self, buf, p) {
if ((buf[0] & 0xC0) !== 0x80) {
self.lastNeed = 0;
return '\ufffd'.repeat(p);
}
if (self.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 0xC0) !== 0x80) {
self.lastNeed = 1;
return '\ufffd'.repeat(p + 1);
}
if (self.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 0xC0) !== 0x80) {
self.lastNeed = 2;
return '\ufffd'.repeat(p + 2);
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf, p);
if (r !== undefined) return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed) return buf.toString('utf8', i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString('utf8', i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed);
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString('utf16le', i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 0xD800 && c <= 0xDBFF) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString('utf16le', i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString('utf16le', 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0) return buf.toString('base64', i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString('base64', i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : '';
if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : '';
}
},{"safe-buffer":62}],58:[function(require,module,exports){
module.exports = require('./readable').PassThrough;
},{"./readable":59}],59:[function(require,module,exports){
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = exports;
exports.Readable = exports;
exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
},{"./lib/_stream_duplex.js":49,"./lib/_stream_passthrough.js":50,"./lib/_stream_readable.js":51,"./lib/_stream_transform.js":52,"./lib/_stream_writable.js":53}],60:[function(require,module,exports){
module.exports = require('./readable').Transform;
},{"./readable":59}],61:[function(require,module,exports){
module.exports = require('./lib/_stream_writable.js');
},{"./lib/_stream_writable.js":53}],62:[function(require,module,exports){
var buffer = require('buffer');
var Buffer = buffer.Buffer;
function copyProps (src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer (arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length)
}
copyProps(Buffer, SafeBuffer);
SafeBuffer.from = function (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
throw new TypeError('Argument must not be a number')
}
return Buffer(arg, encodingOrOffset, length)
};
SafeBuffer.alloc = function (size, fill, encoding) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
var buf = Buffer(size);
if (fill !== undefined) {
if (typeof encoding === 'string') {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf
};
SafeBuffer.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return Buffer(size)
};
SafeBuffer.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return buffer.SlowBuffer(size)
};
},{"buffer":28}],63:[function(require,module,exports){
module.exports = Stream;
var EE = require('events').EventEmitter;
var inherits = require('inherits');
inherits(Stream, EE);
Stream.Readable = require('readable-stream/readable.js');
Stream.Writable = require('readable-stream/writable.js');
Stream.Duplex = require('readable-stream/duplex.js');
Stream.Transform = require('readable-stream/transform.js');
Stream.PassThrough = require('readable-stream/passthrough.js');
Stream.Stream = Stream;
function Stream() {
EE.call(this);
}
Stream.prototype.pipe = function(dest, options) {
var source = this;
function ondata(chunk) {
if (dest.writable) {
if (false === dest.write(chunk) && source.pause) {
source.pause();
}
}
}
source.on('data', ondata);
function ondrain() {
if (source.readable && source.resume) {
source.resume();
}
}
dest.on('drain', ondrain);
if (!dest._isStdio && (!options || options.end !== false)) {
source.on('end', onend);
source.on('close', onclose);
}
var didOnEnd = false;
function onend() {
if (didOnEnd) return;
didOnEnd = true;
dest.end();
}
function onclose() {
if (didOnEnd) return;
didOnEnd = true;
if (typeof dest.destroy === 'function') dest.destroy();
}
function onerror(er) {
cleanup();
if (EE.listenerCount(this, 'error') === 0) {
throw er;
}
}
source.on('error', onerror);
dest.on('error', onerror);
function cleanup() {
source.removeListener('data', ondata);
dest.removeListener('drain', ondrain);
source.removeListener('end', onend);
source.removeListener('close', onclose);
source.removeListener('error', onerror);
dest.removeListener('error', onerror);
source.removeListener('end', cleanup);
source.removeListener('close', cleanup);
dest.removeListener('close', cleanup);
}
source.on('end', cleanup);
source.on('close', cleanup);
dest.on('close', cleanup);
dest.emit('pipe', source);
return dest;
};
},{"events":30,"inherits":32,"readable-stream/duplex.js":48,"readable-stream/passthrough.js":58,"readable-stream/readable.js":59,"readable-stream/transform.js":60,"readable-stream/writable.js":61}],64:[function(require,module,exports){
(function (global){
module.exports = deprecate;
function deprecate (fn, msg) {
if (config('noDeprecation')) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (config('throwDeprecation')) {
throw new Error(msg);
} else if (config('traceDeprecation')) {
console.trace(msg);
} else {
console.warn(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
}
function config (name) {
try {
if (!global.localStorage) return false;
} catch (_) {
return false;
}
var val = global.localStorage[name];
if (null == val) return false;
return String(val).toLowerCase() === 'true';
}
}).call(this,typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
},{}],65:[function(require,module,exports){
arguments[4][32][0].apply(exports,arguments);
},{"dup":32}],66:[function(require,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
};
},{}],67:[function(require,module,exports){
(function (process,global){
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
exports.deprecate = function(fn, msg) {
if (isUndefined(global.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
if (process.noDeprecation === true) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
function inspect(obj, opts) {
var ctx = {
seen: [],
stylize: stylizeNoColor
};
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
ctx.showHidden = opts;
} else if (opts) {
exports._extend(ctx, opts);
}
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
value.inspect !== exports.inspect &&
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var length = output.reduce(function(prev, cur) {
if (cur.indexOf('\n') >= 0) ;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' ||
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = require('./support/isBuffer');
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
exports.inherits = require('inherits');
exports._extend = function(origin, add) {
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
}).call(this,require('_process'),typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
},{"./support/isBuffer":66,"_process":47,"inherits":65}]},{},[20])(20)
});
});
const offscreenCanvas = self.OffscreenCanvas ? new OffscreenCanvas(0, 0) : null;
const ctx = offscreenCanvas ? offscreenCanvas.getContext('2d') : null;
async function createBlobFromImageData(imageData) {
if (!offscreenCanvas) {
return null;
}
offscreenCanvas.width = imageData.width;
offscreenCanvas.height = imageData.height;
ctx.putImageData(imageData, 0, 0);
const blob = await offscreenCanvas.convertToBlob();
offscreenCanvas.width = 0;
offscreenCanvas.height = 0;
return blob;
}
class DjVuPage extends CompositeChunk {
constructor(bs, getINCLChunkCallback) {
super(bs);
this.getINCLChunkCallback = getINCLChunkCallback;
this.reset();
}
reset() {
this.bs.setOffset(12);
this.djbz = null;
this.bg44arr = new Array();
this.fg44 = null;
this.bgimage = null;
this.fgimage = null;
this.sjbz = null;
this.fgbz = null;
this.text = null;
this.decoded = false;
this.isBackgroundCompletelyDecoded = false;
this.isFirstBgChunkDecoded = false;
this.info = null;
this.iffchunks = [];
this.dependencies = null;
}
getDpi() {
if (this.info) {
return this.info.dpi;
} else {
return this.init().info.dpi;
}
}
getHeight() {
return this.info ? this.info.height : this.init().info.height;
}
getWidth() {
return this.info ? this.info.width : this.init().info.width;
}
async createPngObjectUrl() {
var time = performance.now();
var imageData = this.getImageData();
var imageBlob = await createBlobFromImageData(imageData);
if (!imageBlob) {
const pngImage = browser.PNG.sync.write(this.getImageData());
imageBlob = new Blob([pngImage.buffer]);
}
DjVu.IS_DEBUG && console.log("Png creation time = ", performance.now() - time);
var url = URL.createObjectURL(imageBlob);
return {
url: url,
byteLength: imageBlob.size,
width: this.getWidth(),
height: this.getHeight(),
dpi: this.getDpi(),
};
}
getDependencies() {
if (this.info || this.dependencies) {
return this.dependencies;
}
this.dependencies = [];
var bs = this.bs.fork();
while (!bs.isEmpty()) {
var chunk;
var id = bs.readStr4();
var length = bs.getInt32();
bs.jump(-8);
var chunkBs = bs.fork(length + 8);
bs.jump(8 + length + (length & 1 ? 1 : 0));
if (id === "INCL") {
chunk = new INCLChunk(chunkBs);
this.dependencies.push(chunk.ref);
}
}
return this.dependencies;
}
init() {
if (this.info) {
return this;
}
this.dependencies = [];
var id = this.bs.readStr4();
if (id !== 'INFO') {
throw new CorruptedFileDjVuError("The very first chunk must be INFO chunk, but we got " + id + '!')
}
var length = this.bs.getInt32();
this.bs.jump(-8);
this.info = new INFOChunk(this.bs.fork(length + 8));
this.bs.jump(8 + length + (this.info.length & 1));
this.iffchunks.push(this.info);
while (!this.bs.isEmpty()) {
var chunk;
var id = this.bs.readStr4();
var length = this.bs.getInt32();
this.bs.jump(-8);
var chunkBs = this.bs.fork(length + 8);
this.bs.jump(8 + length + (length & 1));
if (!length) {
chunk = new IFFChunk(chunkBs);
} else if (id == "FG44") {
chunk = this.fg44 = new ColorChunk(chunkBs);
} else if (id == "BG44") {
this.bg44arr.push(chunk = new ColorChunk(chunkBs));
} else if (id == 'Sjbz') {
chunk = this.sjbz = new JB2Image(chunkBs);
} else if (id === "INCL") {
chunk = this.incl = new INCLChunk(chunkBs);
var inclChunk = this.getINCLChunkCallback(this.incl.ref);
if (inclChunk) {
inclChunk.id === "Djbz" ? this.djbz = inclChunk : this.iffchunks.push(inclChunk);
}
this.dependencies.push(chunk.ref);
} else if (id === "CIDa") {
try {
chunk = new CIDaChunk(chunkBs);
} catch (e) {
chunk = new ErrorChunk('CIDa', e);
}
} else if (id === 'Djbz') {
chunk = this.djbz = new JB2Dict(chunkBs);
} else if (id === 'FGbz') {
chunk = this.fgbz = new DjVuPalette(chunkBs);
} else if (id === 'TXTa' || id === 'TXTz') {
chunk = this.text = new DjVuText(chunkBs);
} else {
chunk = new IFFChunk(chunkBs);
}
this.iffchunks.push(chunk);
}
return this;
}
getRotation() {
switch (this.info.flags) {
case 5: return 90;
case 2: return 180;
case 6: return 270;
default: return 0;
}
}
rotateIfRequired(imageData) {
if (this.info.flags === 5 || this.info.flags === 6) {
var newImageData = new ImageData(this.info.height, this.info.width);
var newPixelArray = new Uint32Array(newImageData.data.buffer);
var oldPixelArray = new Uint32Array(imageData.data.buffer);
var height = this.info.height;
var width = this.info.width;
if (this.info.flags === 6) {
for (var i = 0; i < width; i++) {
var rowOffset = (width - i - 1) * height;
var to = height + rowOffset;
for (var newIndex = rowOffset, oldIndex = i; newIndex < to; newIndex++, oldIndex += width) {
newPixelArray[newIndex] = oldPixelArray[oldIndex];
}
}
} else {
for (var i = 0; i < width; i++) {
var rowOffset = i * height;
var from = height + rowOffset - 1;
for (var newIndex = from, oldIndex = i; newIndex >= rowOffset; newIndex--, oldIndex += width) {
newPixelArray[newIndex] = oldPixelArray[oldIndex];
}
}
}
return newImageData;
}
if (this.info.flags === 2) {
new Uint32Array(imageData.data.buffer).reverse();
return imageData;
}
return imageData;
}
getImageData(rotate = true) {
const image = this._getImageData();
const rotatedImage = rotate ? this.rotateIfRequired(image) : image;
if (image.width * image.height > 10000000) {
this.reset();
}
return rotatedImage;
}
_getImageData() {
this.decode();
var time = performance.now();
if (!this.sjbz) {
if (this.bgimage) {
return this.bgimage.getImage();
}
else if (this.fgimage) {
return this.fgimage.getImage();
} else {
var emptyImage = new ImageData(this.info.width, this.info.height);
emptyImage.data.fill(255);
return emptyImage;
}
}
if (!this.bgimage && !this.fgimage) {
return this.sjbz.getImage(this.fgbz);
}
var fgscale, bgscale, fgpixelmap, bgpixelmap;
function fakePixelMap(r, g, b) {
return {
writePixel(index, pixelArray, pixelIndex) {
pixelArray[pixelIndex] = r;
pixelArray[pixelIndex | 1] = g;
pixelArray[pixelIndex | 2] = b;
}
}
}
if (this.bgimage) {
bgscale = Math.round(this.info.width / this.bgimage.info.width);
bgpixelmap = this.bgimage.pixelmap;
} else {
bgscale = 1;
bgpixelmap = fakePixelMap(255, 255, 255);
}
if (this.fgimage) {
fgscale = Math.round(this.info.width / this.fgimage.info.width);
fgpixelmap = this.fgimage.pixelmap;
} else {
fgscale = 1;
fgpixelmap = fakePixelMap(0, 0, 0);
}
var image;
if (!this.fgbz) {
image = this.createImageFromMaskImageAndPixelMaps(
this.sjbz.getMaskImage(),
fgpixelmap,
bgpixelmap,
fgscale,
bgscale
);
} else {
image = this.createImageFromMaskImageAndBackgroundPixelMap(
this.sjbz.getImage(this.fgbz, true),
bgpixelmap,
bgscale
);
}
DjVu.IS_DEBUG && console.log("DataImage creating time = ", performance.now() - time);
return image;
}
createImageFromMaskImageAndPixelMaps(maskImage, fgpixelmap, bgpixelmap, fgscale, bgscale) {
var image = maskImage;
var pixelArray = image.data;
var rowIndexOffset = ((this.info.height - 1) * this.info.width) << 2;
var width4 = this.info.width << 2;
for (var i = 0; i < this.info.height; i++) {
var bis = i / bgscale >> 0;
var fis = i / fgscale >> 0;
var bgIndexOffset = bgpixelmap.width * bis;
var fgIndexOffset = fgpixelmap.width * fis;
var index = rowIndexOffset;
for (var j = 0; j < this.info.width; j++) {
if (pixelArray[index]) {
bgpixelmap.writePixel(bgIndexOffset + (j / bgscale >> 0), pixelArray, index);
} else {
fgpixelmap.writePixel(fgIndexOffset + (j / fgscale >> 0), pixelArray, index);
}
index += 4;
}
rowIndexOffset -= width4;
}
return image;
}
createImageFromMaskImageAndBackgroundPixelMap(coloredMaskImage, bgpixelmap, bgscale) {
var pixelArray = coloredMaskImage.data;
var rowOffset = (this.info.height - 1) * this.info.width << 2;
var width4 = this.info.width << 2;
for (var i = 0; i < this.info.height; i++) {
var bgRowOffset = (i / bgscale >> 0) * bgpixelmap.width;
var index = rowOffset;
for (var j = 0; j < this.info.width; j++) {
if (pixelArray[index | 3]) {
bgpixelmap.writePixel(bgRowOffset + (j / bgscale >> 0), pixelArray, index);
} else {
pixelArray[index | 3] = 255;
}
index += 4;
}
rowOffset -= width4;
}
return coloredMaskImage;
}
decodeForeground() {
if (this.fg44) {
this.fgimage = new IWImage();
var zp = new ZPDecoder(this.fg44.bs);
this.fgimage.decodeChunk(zp, this.fg44.header);
var pixelMapTime = performance.now();
this.fgimage.createPixelmap();
DjVu.IS_DEBUG && console.log("Foreground pixelmap creating time = ", performance.now() - pixelMapTime);
}
}
decodeBackground(isOnlyFirstChunk = false) {
if (this.isBackgroundCompletelyDecoded || this.isFirstBgChunkDecoded && isOnlyFirstChunk) {
return;
}
if (this.bg44arr.length) {
this.bgimage = this.bgimage || new IWImage();
var to = isOnlyFirstChunk ? 1 : this.bg44arr.length;
var from = this.isFirstBgChunkDecoded ? 1 : 0;
for (var i = from; i < to; i++) {
var chunk = this.bg44arr[i];
var zp = new ZPDecoder(chunk.bs);
var time = performance.now();
this.bgimage.decodeChunk(zp, chunk.header);
DjVu.IS_DEBUG && console.log("Background chunk decoding time = ", performance.now() - time);
}
var pixelMapTime = performance.now();
this.bgimage.createPixelmap();
DjVu.IS_DEBUG && console.log("Background pixelmap creating time = ", performance.now() - pixelMapTime);
if (isOnlyFirstChunk) {
this.isFirstBgChunkDecoded = true;
} else {
this.isBackgroundCompletelyDecoded = true;
}
}
}
decode() {
if (this.decoded) {
this.decodeBackground();
return this;
}
this.init();
var time = performance.now();
this.sjbz ? this.sjbz.decode(this.djbz) : 0;
DjVu.IS_DEBUG && console.log("Mask decoding time = ", performance.now() - time);
time = performance.now();
this.decodeForeground();
DjVu.IS_DEBUG && console.log("Foreground decoding time = ", performance.now() - time);
time = performance.now();
this.decodeBackground();
DjVu.IS_DEBUG && console.log("Background decoding time = ", performance.now() - time);
this.decoded = true;
return this;
}
getBackgroundImageData() {
this.decode();
if (this.bg44arr.length) {
this.bg44arr.forEach((chunk) => {
var zp = new ZPDecoder(chunk.bs);
this.bgimage.decodeChunk(zp, chunk.header);
}
);
return this.bgimage.getImage();
} else {
return null;
}
}
getForegroundImageData() {
this.decode();
if (this.fg44) {
this.fgimage = new IWImage();
var zp = new ZPDecoder(this.fg44.bs);
this.fgimage.decodeChunk(zp, this.fg44.header);
return this.fgimage.getImage();
} else {
return null;
}
}
getMaskImageData() {
this.decode();
return this.sjbz && this.sjbz.getImage(this.fgbz);
}
getText() {
this.init();
return this.text ? this.text.getText() : "";
}
getPageTextZone() {
this.init();
return this.text ? this.text.getPageZone() : null;
}
getNormalizedTextZones() {
this.init();
return this.text ? this.text.getNormalizedZones() : null;
}
toString() {
this.init();
var str = this.iffchunks.reduce((str, chunk) => str + chunk.toString(), '');
return super.toString(str);
}
}
class DIRMChunk extends IFFChunk {
constructor(bs) {
super(bs);
this.dflags = bs.byte();
this.isBundled = this.dflags >> 7;
this.nfiles = bs.getInt16();
if (this.isBundled) {
this.offsets = new Int32Array(this.nfiles);
for (var i = 0; i < this.nfiles; i++) {
this.offsets[i] = bs.getInt32();
}
}
this.sizes = new Uint32Array(this.nfiles);
this.flags = new Uint8Array(this.nfiles);
this.ids = new Array(this.nfiles);
this.names = new Array(this.nfiles);
this.titles = new Array(this.nfiles);
var bsz = BZZDecoder.decodeByteStream(bs.fork());
for (var i = 0; i < this.nfiles; i++) {
this.sizes[i] = bsz.getUint24();
}
for (var i = 0; i < this.nfiles; i++) {
this.flags[i] = bsz.byte();
}
this.pagesIds = [];
this.idToNameRegistry = {};
for (var i = 0; i < this.nfiles && !bsz.isEmpty(); i++) {
this.ids[i] = bsz.readStrNT();
this.names[i] = this.flags[i] & 128 ? bsz.readStrNT() : this.ids[i];
this.titles[i] = this.flags[i] & 64 ? bsz.readStrNT() : this.ids[i];
if (this.isPageIndex(i)) {
this.pagesIds.push(this.ids[i]);
}
this.idToNameRegistry[this.ids[i]] = this.names[i];
}
}
isPageIndex(i) {
return (this.flags[i] & 63) === 1;
}
isThumbnailIndex(i) {
return (this.flags[i] & 63) === 2;
}
getPageNameByItsNumber(number) {
return this.getComponentNameByItsId(this.pagesIds[number - 1]);
}
getPageNumberByItsId(id) {
const index = this.pagesIds.indexOf(id);
return index === -1 ? null : (index + 1);
}
getComponentNameByItsId(id) {
return this.idToNameRegistry[id];
}
getPagesQuantity() {
return this.pagesIds.length;
}
getFilesQuantity() {
return this.nfiles;
}
getMetadataStringByIndex(i) {
return (
`[id: "${this.ids[i]}", flag: ${this.flags[i]}, ` +
`offset: ${this.offsets ? this.offsets[i] : 'indirect'}, size: ${this.sizes[i]}]\n`
);
}
toString() {
var str = super.toString();
str += (this.isBundled ? 'Bundled' : 'Indirect') + '\n';
str += "FilesCount: " + this.nfiles + '\n';
return str + '\n';
}
}
class NAVMChunk extends IFFChunk {
constructor(bs) {
super(bs);
this.isDecoded = false;
this.contents = [];
this.decodedBookmarkCounter = 0;
}
getContents() {
this.decode();
return this.contents;
}
decode() {
if (this.isDecoded) {
return;
}
var dbs = BZZDecoder.decodeByteStream(this.bs);
var bookmarksCount = dbs.getUint16();
while (this.decodedBookmarkCounter < bookmarksCount) {
this.contents.push(this.decodeBookmark(dbs));
}
this.isDecoded = true;
}
decodeBookmark(bs) {
var childrenCount = bs.getUint8();
var descriptionLength = bs.getInt24();
var description = descriptionLength ? bs.readStrUTF(descriptionLength) : '';
var urlLength = bs.getInt24();
var url = urlLength ? bs.readStrUTF(urlLength) : '';
this.decodedBookmarkCounter++;
var bookmark = { description, url };
if (childrenCount) {
var children = new Array(childrenCount);
for (var i = 0; i < childrenCount; i++) {
children[i] = this.decodeBookmark(bs);
}
bookmark.children = children;
}
return bookmark;
}
toString() {
this.decode();
var indent = ' ';
function stringifyBookmark(bookmark, indentSize = 0) {
var str = indent.repeat(indentSize) + `${bookmark.description} (${bookmark.url})\n`;
if (bookmark.children) {
str = bookmark.children.reduce((str, bookmark) => str + stringifyBookmark(bookmark, indentSize + 1), str);
}
return str;
}
var str = this.contents.reduce((str, bookmark) => str + stringifyBookmark(bookmark), super.toString());
return str + '\n';
}
}
class BZZEncoder {
constructor(zp) {
this.zp = zp || new ZPEncoder();
this.FREQMAX = 4;
this.CTXIDS = 3;
this.ctx = new Uint8Array(300);
this.size = 0;
this.blocksize = 0;
this.FREQS0 = 100000;
this.FREQS1 = 1000000;
}
blocksort(arr) {
var length = arr.length;
var offs = new Array(arr.length);
for (var i = 0; i < length; offs[i] = i++) { }
offs.sort((a, b) => {
for (var i = 0; i < length; i++) {
if (a === this.markerpos) {
return -1;
}
else if (b === this.markerpos) {
return 1;
}
var res = arr[a % length] - arr[b % length];
if (res) {
return res;
}
a++;
b++;
}
return 0;
});
var narr = new Uint8Array(length);
for (var i = 0; i < length; i++) {
var pos = offs[i] - 1;
if (pos >= 0) {
narr[i] = arr[pos];
}
else {
narr[i] = 0;
this.markerpos = i;
}
}
return narr;
}
encode_raw(bits, x) {
var n = 1;
var m = (1 << bits);
while (n < m) {
x = (x & (m - 1)) << 1;
var b = (x >> bits);
this.zp.encode(b);
n = (n << 1) | b;
}
}
encode_binary(cxtoff, bits, x) {
var n = 1;
var m = (1 << bits);
cxtoff--;
while (n < m) {
x = (x & (m - 1)) << 1;
var b = (x >> bits);
this.zp.encode(b, this.ctx, cxtoff + n);
n = (n << 1) | b;
}
}
encode(buffer) {
var data = new Uint8Array(buffer);
var size = data.length;
var markerpos = size - 1;
this.markerpos = markerpos;
data = this.blocksort(data);
markerpos = this.markerpos;
this.encode_raw(24, size);
var fshift = 0;
if (size < this.FREQS0) {
fshift = 0;
this.zp.encode(0);
}
else if (size < this.FREQS1) {
fshift = 1;
this.zp.encode(1);
this.zp.encode(0);
}
else {
fshift = 2;
this.zp.encode(1);
this.zp.encode(1);
}
var mtf = new Uint8Array(256);
var rmtf = new Uint8Array(256);
var freq = new Uint32Array(this.FREQMAX);
var m = 0;
for (m = 0; m < 256; m++)
mtf[m] = m;
for (m = 0; m < 256; m++)
rmtf[mtf[m]] = m;
var fadd = 4;
for (m = 0; m < this.FREQMAX; m++)
freq[m] = 0;
var i;
var mtfno = 3;
for (i = 0; i < size; i++) {
var c = data[i];
var ctxid = this.CTXIDS - 1;
if (ctxid > mtfno)
ctxid = mtfno;
mtfno = rmtf[c];
if (i == markerpos)
mtfno = 256;
var b;
var ctxoff = 0;
switch (0)
{
default:
b = (mtfno == 0);
this.zp.encode(b, this.ctx, ctxoff + ctxid);
if (b)
break;
ctxoff += this.CTXIDS;
b = (mtfno == 1);
this.zp.encode(b, this.ctx, ctxoff + ctxid);
if (b)
break;
ctxoff += this.CTXIDS;
b = (mtfno < 4);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 1, mtfno - 2);
break;
}
ctxoff += 1 + 1;
b = (mtfno < 8);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 2, mtfno - 4);
break;
}
ctxoff += 1 + 3;
b = (mtfno < 16);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 3, mtfno - 8);
break;
}
ctxoff += 1 + 7;
b = (mtfno < 32);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 4, mtfno - 16);
break;
}
ctxoff += 1 + 15;
b = (mtfno < 64);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 5, mtfno - 32);
break;
}
ctxoff += 1 + 31;
b = (mtfno < 128);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 6, mtfno - 64);
break;
}
ctxoff += 1 + 63;
b = (mtfno < 256);
this.zp.encode(b, this.ctx, ctxoff);
if (b) {
this.encode_binary(ctxoff + 1, 7, mtfno - 128);
break;
}
continue;
}
fadd = fadd + (fadd >> fshift);
if (fadd > 0x10000000) {
fadd = fadd >> 24;
freq[0] >>= 24;
freq[1] >>= 24;
freq[2] >>= 24;
freq[3] >>= 24;
for (var k = 4; k < this.FREQMAX; k++)
freq[k] = freq[k] >> 24;
}
var fc = fadd;
if (mtfno < this.FREQMAX)
fc += freq[mtfno];
var k;
for (k = mtfno; k >= this.FREQMAX; k--) {
mtf[k] = mtf[k - 1];
rmtf[mtf[k]] = k;
}
for (; k > 0 && fc >= freq[k - 1]; k--) {
mtf[k] = mtf[k - 1];
freq[k] = freq[k - 1];
rmtf[mtf[k]] = k;
}
mtf[k] = c;
freq[k] = fc;
rmtf[mtf[k]] = k;
}
this.encode_raw(24, 0);
this.zp.eflush();
return 0;
}
}
class DjVuWriter {
constructor(length) {
this.bsw = new ByteStreamWriter(length || 1024 * 1024);
}
startDJVM() {
this.bsw.writeStr('AT&T').writeStr('FORM').saveOffsetMark('fileSize')
.jump(4).writeStr('DJVM');
}
writeDirmChunk(dirm) {
this.dirm = dirm;
this.bsw.writeStr('DIRM').saveOffsetMark('DIRMsize').jump(4);
this.dirm.offsets = [];
this.bsw.writeByte(dirm.dflags)
.writeInt16(dirm.flags.length)
.saveOffsetMark('DIRMoffsets')
.jump(4 * dirm.flags.length);
var tmpBS = new ByteStreamWriter();
for (var i = 0; i < dirm.sizes.length; i++) {
tmpBS.writeInt24(dirm.sizes[i]);
}
for (var i = 0; i < dirm.flags.length; i++) {
tmpBS.writeByte(dirm.flags[i]);
}
for (var i = 0; i < dirm.ids.length; i++) {
tmpBS.writeStrNT(dirm.ids[i]);
if (dirm.flags[i] & 128) {
tmpBS.writeStrNT(dirm.names[i]);
}
if (dirm.flags[i] & 64) {
tmpBS.writeStrNT(dirm.titles[i]);
}
}
tmpBS.writeByte(0);
var tmpBuffer = tmpBS.getBuffer();
var bzzBS = new ByteStreamWriter();
var zp = new ZPEncoder(bzzBS);
var bzz = new BZZEncoder(zp);
bzz.encode(tmpBuffer);
var encodedBuffer = bzzBS.getBuffer();
this.bsw.writeBuffer(encodedBuffer);
this.bsw.rewriteSize('DIRMsize');
}
get offset() {
return this.bsw.offset;
}
writeByte(byte) {
this.bsw.writeByte(byte);
return this;
}
writeStr(str) {
this.bsw.writeStr(str);
return this;
}
writeInt32(val) {
this.bsw.writeInt32(val);
return this;
}
writeFormChunkBS(bs) {
if (this.bsw.offset & 1) {
this.bsw.writeByte(0);
}
var off = this.bsw.offset;
this.dirm.offsets.push(off);
this.bsw.writeByteStream(bs);
}
writeFormChunkBuffer(buffer) {
if (this.bsw.offset & 1) {
this.bsw.writeByte(0);
}
var off = this.bsw.offset;
this.dirm.offsets.push(off);
this.bsw.writeBuffer(buffer);
}
writeChunk(chunk) {
if (this.bsw.offset & 1) {
this.bsw.writeByte(0);
}
this.bsw.writeByteStream(chunk.bs);
}
getBuffer() {
this.bsw.rewriteSize('fileSize');
if (this.dirm.offsets.length !== (this.dirm.flags.length)) {
throw new Error("Записаны не все страницы и словари !!!");
}
for (var i = 0; i < this.dirm.offsets.length; i++) {
this.bsw.rewriteInt32('DIRMoffsets', this.dirm.offsets[i]);
}
return this.bsw.getBuffer();
}
}
class ThumChunk extends CompositeChunk { }
async function loadByteStream(url, errorData = {}) {
let xhr;
try {
xhr = await loadFileViaXHR(url);
} catch (e) {
throw new NetworkDjVuError({ url: url, ...errorData });
}
if (xhr.status && xhr.status !== 200) {
throw new UnsuccessfulRequestDjVuError(xhr, { ...errorData });
}
return new ByteStream(xhr.response);
}
function checkAndCropByteStream(bs, compositeChunkId = null, errorData = null) {
if (bs.readStr4() !== 'AT&T') {
throw new CorruptedFileDjVuError(`The byte stream isn't a djvu file.`, errorData);
}
if (!compositeChunkId) {
return bs.fork();
}
let chunkId = bs.readStr4();
const length = bs.getInt32();
chunkId += bs.readStr4();
if (chunkId !== compositeChunkId) {
throw new CorruptedFileDjVuError(
`Unexpected chunk id. Expected "${compositeChunkId}", but got "${chunkId}"`,
errorData
);
}
return bs.jump(-12).fork(length + 8);
}
async function loadPage(number, url) {
const errorData = { pageNumber: number };
return checkAndCropByteStream(await loadByteStream(url, errorData), null, errorData);
}
async function loadPageDependency(id, name, baseUrl, pageNumber = null) {
const errorData = { pageNumber: pageNumber, dependencyId: id };
return checkAndCropByteStream(await loadByteStream(baseUrl + name, errorData), 'FORMDJVI', errorData);
}
async function loadThumbnail(url, id = null) {
const errorData = { thumbnailId: id };
return checkAndCropByteStream(await loadByteStream(url, errorData), 'FORMTHUM', errorData);
}
async function bundle(progressCallback = () => { }) {
const djvuWriter = new DjVuWriter();
djvuWriter.startDJVM();
const dirm = {
dflags: this.dirm.dflags | 128,
flags: [],
names: [],
titles: [],
sizes: [],
ids: [],
};
const chunkByteStreams = [];
const filesQuantity = this.dirm.getFilesQuantity();
const totalOperations = filesQuantity + 3;
let pageNumber = 0;
const limit = pLimit(4);
let downloadedNumber = 0;
const promises = [];
for (let i = 0; i < filesQuantity; i++) {
promises.push(limit(async () => {
let bs;
if (this.dirm.isPageIndex(i)) {
pageNumber++;
bs = await loadPage(pageNumber, this._getUrlByPageNumber(pageNumber));
} else if (this.dirm.isThumbnailIndex(i)) {
bs = await loadThumbnail(
this.baseUrl + this.dirm.getComponentNameByItsId(this.dirm.ids[i]),
this.dirm.ids[i]
);
} else {
bs = await loadPageDependency(
this.dirm.ids[i],
this.dirm.getComponentNameByItsId(this.dirm.ids[i]),
this.baseUrl,
);
}
downloadedNumber++;
progressCallback(downloadedNumber / totalOperations);
return {
flags: this.dirm.flags[i],
id: this.dirm.ids[i],
name: this.dirm.names[i],
title: this.dirm.titles[i],
bs: bs,
};
}));
}
for (const data of await Promise.all(promises)) {
dirm.flags.push(data.flags);
dirm.ids.push(data.id);
dirm.names.push(data.names);
dirm.titles.push(data.title);
dirm.sizes.push(data.bs.length);
chunkByteStreams.push(data.bs);
}
djvuWriter.writeDirmChunk(dirm);
if (this.navm) {
djvuWriter.writeChunk(this.navm);
}
progressCallback((totalOperations - 2) / totalOperations);
for (let i = 0; i < chunkByteStreams.length; i++) {
djvuWriter.writeFormChunkBS(chunkByteStreams[i]);
chunkByteStreams[i] = null;
}
progressCallback((totalOperations - 1) / totalOperations);
const newBuffer = djvuWriter.getBuffer();
progressCallback(1);
return new this.constructor(newBuffer);
}
const MEMORY_LIMIT = 50 * 1024 * 1024;
class DjVuDocument {
constructor(arraybuffer, { baseUrl = null, memoryLimit = MEMORY_LIMIT } = {}) {
this.buffer = arraybuffer;
this.baseUrl = baseUrl && baseUrl.trim();
if (typeof this.baseUrl === 'string') {
if (this.baseUrl[this.baseUrl.length - 1] !== '/') {
this.baseUrl += '/';
}
if (!/^[A-Za-z]+:\/\//.test(this.baseUrl)) {
this.baseUrl = location.origin && (new URL(this.baseUrl, location.origin).href);
}
}
this.memoryLimit = memoryLimit;
this.djvi = {};
this.getINCLChunkCallback = id => this.djvi[id].innerChunk;
this.bs = new ByteStream(arraybuffer);
this.formatID = this.bs.readStr4();
if (this.formatID !== 'AT&T') {
throw new IncorrectFileFormatDjVuError();
}
this.id = this.bs.readStr4();
this.length = this.bs.getInt32();
this.id += this.bs.readStr4();
if (this.id === 'FORMDJVM') {
this._initMultiPageDocument();
} else if (this.id === 'FORMDJVU') {
this.bs.jump(-12);
this.pages = [new DjVuPage(this.bs.fork(this.length + 8), this.getINCLChunkCallback)];
} else {
throw new CorruptedFileDjVuError(
`The id of the first chunk of the document should be either FORMDJVM or FORMDJVU, but there is ${this.id}`
);
}
}
_initMultiPageDocument() {
this._readMetaDataChunk();
this._readContentsChunkIfExists();
this.pages = [];
this.thumbs = [];
if (this.dirm.isBundled) {
this._parseComponents();
} else {
this.pages = new Array(this.dirm.getPagesQuantity());
this.memoryUsage = this.bs.buffer.byteLength;
this.loadedPageNumbers = [];
}
}
_readMetaDataChunk() {
var id = this.bs.readStr4();
if (id !== 'DIRM') {
throw new CorruptedFileDjVuError("The DIRM chunk must be the first but there is " + id + " instead!");
}
var length = this.bs.getInt32();
this.bs.jump(-8);
this.dirm = new DIRMChunk(this.bs.fork(length + 8));
this.bs.jump(8 + length + (length & 1 ? 1 : 0));
}
_readContentsChunkIfExists() {
this.navm = null;
if (this.bs.remainingLength() > 8) {
var id = this.bs.readStr4();
var length = this.bs.getInt32();
this.bs.jump(-8);
if (id === 'NAVM') {
this.navm = new NAVMChunk(this.bs.fork(length + 8));
}
}
}
_parseComponents() {
this.dirmOrderedChunks = new Array(this.dirm.getFilesQuantity());
for (var i = 0; i < this.dirm.offsets.length; i++) {
this.bs.setOffset(this.dirm.offsets[i]);
var id = this.bs.readStr4();
var length = this.bs.getInt32();
id += this.bs.readStr4();
this.bs.jump(-12);
switch (id) {
case "FORMDJVU":
this.pages.push(this.dirmOrderedChunks[i] = new DjVuPage(
this.bs.fork(length + 8),
this.getINCLChunkCallback
));
break;
case "FORMDJVI":
this.dirmOrderedChunks[i] = this.djvi[this.dirm.ids[i]] = new DjViChunk(this.bs.fork(length + 8));
break;
case "FORMTHUM":
this.thumbs.push(this.dirmOrderedChunks[i] = new ThumChunk(this.bs.fork(length + 8)));
break;
default:
console.error("Incorrect chunk ID: ", id);
}
}
}
getPagesSizes() {
var sizes = this.pages.map(page => {
return {
width: page.getWidth(),
height: page.getHeight(),
dpi: page.getDpi(),
};
});
this.pages.forEach(page => page.reset());
return sizes;
}
isBundled() {
return this.dirm ? this.dirm.isBundled : true;
}
getPagesQuantity() {
return this.dirm ? this.dirm.getPagesQuantity() : 1;
}
getContents() {
return this.navm ? this.navm.getContents() : null;
}
getMemoryUsage() {
return this.memoryUsage;
}
getMemoryLimit() {
return this.memoryLimit;
}
setMemoryLimit(limit = MEMORY_LIMIT) {
this.memoryLimit = limit;
}
getPageNumberByUrl(url) {
if (url[0] !== '#') {
return null;
}
const ref = url.slice(1);
let pageNumber = this.dirm.getPageNumberByItsId(ref);
if (!pageNumber) {
const num = Math.round(Number(ref));
if (num >= 1 && num <= this.pages.length) {
pageNumber = num;
}
}
return pageNumber || null;
}
releaseMemoryIfRequired(preservedDependencies = null) {
if (this.memoryUsage <= this.memoryLimit) {
return;
}
while (this.memoryUsage > this.memoryLimit && this.loadedPageNumbers.length) {
var number = this.loadedPageNumbers.shift();
this.memoryUsage -= this.pages[number].bs.buffer.byteLength;
this.pages[number] = null;
}
if (this.memoryUsage > this.memoryLimit && !this.loadedPageNumbers.length) {
this.resetLastRequestedPage();
var newDjVi = {};
if (preservedDependencies) {
preservedDependencies.forEach(id => {
newDjVi[id] = this.djvi[id];
this.memoryUsage += newDjVi[id].bs.buffer.byteLength;
});
}
Object.keys(this.djvi).forEach(key => {
this.memoryUsage -= this.djvi[key].bs.buffer.byteLength;
});
this.djvi = newDjVi;
}
}
_getUrlByPageNumber(number) {
return this.baseUrl + this.dirm.getPageNameByItsNumber(number);
}
async getPage(number) {
var page = this.pages[number - 1];
if (this.lastRequestedPage && this.lastRequestedPage !== page) {
this.lastRequestedPage.reset();
}
this.lastRequestedPage = page;
if (!page) {
if (number < 1 || number > this.pages.length || this.isBundled()) {
throw new NoSuchPageDjVuError(number);
} else {
if (this.baseUrl === null) {
throw new NoBaseUrlDjVuError();
}
const bs = await loadPage(
number,
this._getUrlByPageNumber(number)
);
const page = new DjVuPage(bs, this.getINCLChunkCallback);
this.memoryUsage += bs.buffer.byteLength;
await this._loadDependencies(page.getDependencies(), number);
this.releaseMemoryIfRequired(page.getDependencies());
this.pages[number - 1] = page;
this.loadedPageNumbers.push(number - 1);
this.lastRequestedPage = page;
}
} else if (!this.isOnePageDependenciesLoaded && this.id === "FORMDJVU") {
var dependencies = page.getDependencies();
if (dependencies.length) {
await this._loadDependencies(dependencies, 1);
}
this.isOnePageDependenciesLoaded = true;
}
return this.lastRequestedPage;
}
async _loadDependencies(dependencies, pageNumber = null) {
var unloadedDependencies = dependencies.filter(id => !this.djvi[id]);
if (!unloadedDependencies.length) {
return;
}
await Promise.all(unloadedDependencies.map(async id => {
const bs = await loadPageDependency(
id,
this.dirm ? this.dirm.getComponentNameByItsId(id) : id,
this.baseUrl,
pageNumber
);
this.djvi[id] = new DjViChunk(bs);
this.memoryUsage += bs.buffer.byteLength;
}));
}
getPageUnsafe(number) {
return this.pages[number - 1];
}
resetLastRequestedPage() {
this.lastRequestedPage && this.lastRequestedPage.reset();
this.lastRequestedPage = null;
}
countFiles() {
var count = 0;
var bs = this.bs.clone();
bs.jump(16);
while (!bs.isEmpty()) {
var id = bs.readStr4();
var length = bs.getInt32();
bs.jump(length + (length & 1 ? 1 : 0));
if (id === 'FORM') {
count++;
}
}
return count;
}
toString(html) {
var str = this.formatID + '\n';
if (this.dirm) {
str += this.id + " " + this.length + '\n\n';
str += this.dirm.toString();
str += this.navm ? this.navm.toString() : '';
if (this.isBundled()) {
this.dirmOrderedChunks.forEach((chunk, i) => {
str += this.dirm.getMetadataStringByIndex(i) + chunk.toString();
});
} else {
for (let i = 0; i < this.dirm.getFilesQuantity(); i++) {
str += this.dirm.getMetadataStringByIndex(i);
}
}
} else {
str += this.pages[0].toString();
}
return html ? str.replace(/\n/g, '<br>').replace(/\s/g, '&nbsp;') : str;
}
createObjectURL() {
var blob = new Blob([this.bs.buffer]);
var url = URL.createObjectURL(blob);
return url;
}
slice(from = 1, to = this.pages.length) {
const djvuWriter = new DjVuWriter();
djvuWriter.startDJVM();
const dirm = {
dflags: this.dirm.dflags,
flags: [],
names: [],
titles: [],
sizes: [],
ids: [],
};
const chunkByteStreams = [];
const totalPageCount = to - from + 1;
const dependencies = {};
const filesQuantity = this.dirm.getFilesQuantity();
for (
let i = 0, pageIndex = 0, addedPageCount = 0;
i < filesQuantity && addedPageCount < totalPageCount;
i++
) {
const isPage = (this.dirm.flags[i] & 63) === 1;
if (!isPage) continue;
pageIndex++;
if (pageIndex < from) continue;
addedPageCount++;
const pageByteStream = new ByteStream(this.buffer, this.dirm.offsets[i], this.dirm.sizes[i]);
const deps = new DjVuPage(pageByteStream).getDependencies();
for (const dependencyId of deps) {
dependencies[dependencyId] = 1;
}
}
for (
let i = 0, pageIndex = 0, addedPageCount = 0;
i < filesQuantity && addedPageCount < totalPageCount;
i++
) {
const isPage = (this.dirm.flags[i] & 63) === 1;
if (isPage) {
pageIndex++;
if (pageIndex < from) continue;
addedPageCount++;
}
if ((this.dirm.ids[i] in dependencies) || isPage) {
dirm.flags.push(this.dirm.flags[i]);
dirm.sizes.push(this.dirm.sizes[i]);
dirm.ids.push(this.dirm.ids[i]);
dirm.names.push(this.dirm.names[i]);
dirm.titles.push(this.dirm.titles[i]);
chunkByteStreams.push(
new ByteStream(this.buffer, this.dirm.offsets[i], this.dirm.sizes[i])
);
}
}
djvuWriter.writeDirmChunk(dirm);
if (this.navm) {
djvuWriter.writeChunk(this.navm);
}
for (const chunkByteStream of chunkByteStreams) {
djvuWriter.writeFormChunkBS(chunkByteStream);
}
const newBuffer = djvuWriter.getBuffer();
DjVu.IS_DEBUG && console.log("New Buffer size = ", newBuffer.byteLength);
return new DjVuDocument(newBuffer);
}
static concat(doc1, doc2) {
var dirm = {};
var length = doc1.pages.length + doc2.pages.length;
dirm.dflags = 129;
dirm.flags = [];
dirm.sizes = [];
dirm.ids = [];
var pages = [];
var idset = new Set();
if (!doc1.dirm) {
dirm.flags.push(1);
dirm.sizes.push(doc1.pages[0].bs.length);
dirm.ids.push('single');
idset.add('single');
pages.push(doc1.pages[0]);
}
else {
for (var i = 0; i < doc1.pages.length; i++) {
dirm.flags.push(doc1.dirm.flags[i]);
dirm.sizes.push(doc1.dirm.sizes[i]);
dirm.ids.push(doc1.dirm.ids[i]);
idset.add(doc1.dirm.ids[i]);
pages.push(doc1.pages[i]);
}
}
if (!doc2.dirm) {
dirm.flags.push(1);
dirm.sizes.push(doc2.pages[0].bs.length);
var newid = 'single2';
var tmp = 0;
while (idset.has(newid)) {
newid = 'single2' + tmp.toString();
tmp++;
}
dirm.ids.push(newid);
pages.push(doc2.pages[0]);
}
else {
for (var i = 0; i < doc2.pages.length; i++) {
dirm.flags.push(doc2.dirm.flags[i]);
dirm.sizes.push(doc2.dirm.sizes[i]);
var newid = doc2.dirm.ids[i];
var tmp = 0;
while (idset.has(newid)) {
newid = doc2.dirm.ids[i] + tmp.toString();
tmp++;
}
dirm.ids.push(newid);
idset.add(newid);
pages.push(doc2.pages[i]);
}
}
var dw = new DjVuWriter();
dw.startDJVM();
dw.writeDirmChunk(dirm);
for (var i = 0; i < length; i++) {
dw.writeFormChunkBS(pages[i].bs);
}
return new DjVuDocument(dw.getBuffer());
}
}
Object.assign(DjVuDocument.prototype, {
bundle,
});
function getLinkToTheWholeLibrary() {
if (!getLinkToTheWholeLibrary.url) {
getLinkToTheWholeLibrary.url = URL.createObjectURL(new Blob(
["(" + DjVuScript.toString() + ")();"],
{ type: 'application/javascript' }
));
}
return getLinkToTheWholeLibrary.url;
}
class DjVuWorker {
constructor(path = getLinkToTheWholeLibrary()) {
this.path = path;
this.reset();
}
reset() {
this.terminate();
this.worker = new Worker(this.path);
this.worker.onmessage = (e) => this.messageHandler(e);
this.worker.onerror = (e) => this.errorHandler(e);
this.promiseCallbacks = null;
this.currentPromise = null;
this.promiseMap = new Map();
this.isWorking = false;
this.commandCounter = 0;
this.currentCommandId = null;
this.hyperCallbacks = {};
this.hyperCallbackCounter = 0;
}
registerHyperCallback(func) {
const id = this.hyperCallbackCounter++;
this.hyperCallbacks[id] = func;
return { hyperCallback: true, id: id };
}
unregisterHyperCallback(id) {
delete this.hyperCallbacks[id];
}
terminate() {
this.worker && this.worker.terminate();
}
get doc() {
return DjVuWorkerTask.instance(this);
}
errorHandler(event) {
console.error("DjVu.js Worker error!", event);
}
cancelTask(promise) {
if (!this.promiseMap.delete(promise)) {
if (this.currentPromise === promise) {
this.dropCurrentTask();
}
}
}
dropCurrentTask() {
this.currentPromise = null;
this.promiseCallbacks = null;
this.currentCommandId = null;
}
emptyTaskQueue() {
this.promiseMap.clear();
}
cancelAllTasks() {
this.emptyTaskQueue();
this.dropCurrentTask();
}
createNewPromise(commandObj, transferList = undefined) {
var callbacks;
var promise = new Promise((resolve, reject) => {
callbacks = { resolve, reject };
});
this.promiseMap.set(promise, { callbacks, commandObj, transferList });
this.runNextTask();
return promise;
}
prepareCommandObject(commandObj) {
if (!(commandObj.data instanceof Array)) return commandObj;
const hyperCallbackIds = [];
for (const { args: argsList } of commandObj.data) {
for (const args of argsList) {
for (let i = 0; i < args.length; i++) {
if (typeof args[i] === 'function') {
const hyperCallback = this.registerHyperCallback(args[i]);
args[i] = hyperCallback;
hyperCallbackIds.push(hyperCallback.id);
}
}
}
}
if (hyperCallbackIds.length) {
commandObj.sendBackData = {
...commandObj.sendBackData,
hyperCallbackIds
};
}
return commandObj;
}
runNextTask() {
if (this.isWorking) {
return;
}
var next = this.promiseMap.entries().next().value;
if (next) {
const [promise, { callbacks, commandObj, transferList }] = next;
this.promiseCallbacks = callbacks;
this.currentPromise = promise;
this.currentCommandId = this.commandCounter++;
commandObj.sendBackData = {
commandId: this.currentCommandId,
};
this.worker.postMessage(this.prepareCommandObject(commandObj), transferList);
this.isWorking = true;
this.promiseMap.delete(promise);
} else {
this.dropCurrentTask();
}
}
isTaskInProcess(promise) {
return this.currentPromise === promise;
}
isTaskInQueue(promise) {
return this.promiseMap.has(promise) || this.isTaskInProcess(promise);
}
processAction(obj) {
switch (obj.action) {
case 'Process':
this.onprocess ? this.onprocess(obj.percent) : 0;
break;
case 'hyperCallback':
if (this.hyperCallbacks[obj.id]) this.hyperCallbacks[obj.id](...obj.args);
break;
}
}
messageHandler({ data: obj }) {
if (obj.action) return this.processAction(obj);
this.isWorking = false;
const callbacks = this.promiseCallbacks;
const commandId = obj.sendBackData && obj.sendBackData.commandId;
if (commandId === this.currentCommandId || this.currentCommandId === null) {
this.runNextTask();
} else {
if (obj === "unhandledrejection" || obj === "error") {
console.warn("DjVu.js: " + obj + " occurred in the worker!");
this.runNextTask();
} else {
console.warn('DjVu.js: Something strange came from the worker.', obj);
}
return;
}
if (!callbacks) return;
const { resolve, reject } = callbacks;
switch (obj.command) {
case 'Error':
reject(obj.error);
break;
case 'createDocument':
case 'startMultiPageDocument':
case 'addPageToDocument':
resolve();
break;
case 'createDocumentFromPictures':
case 'endMultiPageDocument':
resolve(obj.buffer);
break;
case 'run':
var restoredResult = !obj.result ? obj.result :
obj.result.length && obj.result.map ? obj.result.map(result => this.restoreValueAfterTransfer(result)) :
this.restoreValueAfterTransfer(obj.result);
resolve(restoredResult);
break;
default:
console.error("Unexpected message from DjVuWorker: ", obj);
}
if (obj.sendBackData && obj.sendBackData.hyperCallbackIds) {
obj.sendBackData.hyperCallbackIds.forEach(id => this.unregisterHyperCallback(id));
}
}
restoreValueAfterTransfer(value) {
if (value) {
if (value.width && value.height && value.buffer) {
return new ImageData(new Uint8ClampedArray(value.buffer), value.width, value.height);
}
}
return value;
}
run(...tasks) {
const data = tasks.map(task => task._);
return this.createNewPromise({
command: 'run',
data: data,
});
}
revokeObjectURL(url) {
this.worker.postMessage({
action: this.revokeObjectURL.name,
url: url,
});
}
startMultiPageDocument(slicenumber, delayInit, grayscale) {
return this.createNewPromise({
command: 'startMultiPageDocument',
slicenumber: slicenumber,
delayInit: delayInit,
grayscale: grayscale
});
}
addPageToDocument(imageData) {
var simpleImage = {
buffer: imageData.data.buffer,
width: imageData.width,
height: imageData.height
};
return this.createNewPromise({
command: 'addPageToDocument',
simpleImage: simpleImage
}, [simpleImage.buffer]);
}
endMultiPageDocument() {
return this.createNewPromise({ command: 'endMultiPageDocument' });
}
createDocument(buffer, options) {
return this.createNewPromise({ command: 'createDocument', buffer: buffer, options: options }, [buffer]);
}
createDocumentFromPictures(imageArray, slicenumber, delayInit, grayscale) {
var simpleImages = new Array(imageArray.length);
var buffers = new Array(imageArray.length);
for (var i = 0; i < imageArray.length; i++) {
simpleImages[i] = {
buffer: imageArray[i].data.buffer,
width: imageArray[i].width,
height: imageArray[i].height
};
buffers[i] = imageArray[i].data.buffer;
}
return this.createNewPromise({
command: 'createDocumentFromPictures',
images: simpleImages,
slicenumber: slicenumber,
delayInit: delayInit,
grayscale: grayscale
}, buffers);
}
}
class DjVuWorkerTask {
static instance(worker, funcs = [], args = []) {
var proxy = new Proxy(DjVuWorkerTask.emptyFunc, {
get: (target, key) => {
switch (key) {
case '_':
return { funcs, args };
case 'run':
return () => worker.run(proxy);
default:
return DjVuWorkerTask.instance(worker, [...funcs, key], args);
}
},
apply: (target, that, _args) => {
return DjVuWorkerTask.instance(worker, funcs, [...args, _args]);
}
});
return proxy;
}
static emptyFunc() { }
}
class IWEncoder extends IWCodecBaseClass {
constructor(bytemap) {
super();
this.width = bytemap.width;
this.height = bytemap.height;
this.inverseWaveletTransform(bytemap);
this.createBlocks(bytemap);
}
inverseWaveletTransform(bytemap) {
for (var scale = 1; scale < 32; scale <<= 1) {
this.filter_fh(scale, bytemap);
this.filter_fv(scale, bytemap);
}
return bytemap;
}
filter_fv(s, bitmap) {
var kmax = Math.floor((bitmap.height - 1) / s);
for (var i = 0; i < bitmap.width; i += s) {
for (var k = 1; k <= kmax; k += 2) {
if ((k - 3 >= 0) && (k + 3 <= kmax)) {
bitmap[k * s][i] -= (9 * (bitmap[(k - 1) * s][i] + bitmap[(k + 1) * s][i]) - (bitmap[(k - 3) * s][i] + bitmap[(k + 3) * s][i]) + 8) >> 4;
} else if (k + 1 <= kmax) {
bitmap[k * s][i] -= (bitmap[(k - 1) * s][i] + bitmap[(k + 1) * s][i] + 1) >> 1;
} else {
bitmap[k * s][i] -= bitmap[(k - 1) * s][i];
}
}
for (var k = 0; k <= kmax; k += 2) {
var a, b, c, d;
if (k - 1 < 0) {
a = 0;
} else {
a = bitmap[(k - 1) * s][i];
}
if (k - 3 < 0) {
c = 0;
} else {
c = bitmap[(k - 3) * s][i];
}
if (k + 1 > kmax) {
b = 0;
} else {
b = bitmap[(k + 1) * s][i];
}
if (k + 3 > kmax) {
d = 0;
} else {
d = bitmap[(k + 3) * s][i];
}
bitmap[k * s][i] += (9 * (a + b) - (c + d) + 16) >> 5;
}
}
}
filter_fh(s, bitmap) {
var kmax = Math.floor((bitmap.width - 1) / s);
for (var i = 0; i < bitmap.height; i += s) {
for (var k = 1; k <= kmax; k += 2) {
if ((k - 3 >= 0) && (k + 3 <= kmax)) {
bitmap[i][k * s] -= (9 * (bitmap[i][(k - 1) * s] + bitmap[i][(k + 1) * s]) - (bitmap[i][(k - 3) * s] + bitmap[i][(k + 3) * s]) + 8) >> 4;
} else if (k + 1 <= kmax) {
bitmap[i][k * s] -= (bitmap[i][(k - 1) * s] + bitmap[i][(k + 1) * s] + 1) >> 1;
} else {
bitmap[i][k * s] -= bitmap[i][(k - 1) * s];
}
}
for (var k = 0; k <= kmax; k += 2) {
var a, b, c, d;
if (k - 1 < 0) {
a = 0;
} else {
a = bitmap[i][(k - 1) * s];
}
if (k - 3 < 0) {
c = 0;
} else {
c = bitmap[i][(k - 3) * s];
}
if (k + 1 > kmax) {
b = 0;
} else {
b = bitmap[i][(k + 1) * s];
}
if (k + 3 > kmax) {
d = 0;
} else {
d = bitmap[i][(k + 3) * s];
}
bitmap[i][k * s] += (9 * (a + b) - (c + d) + 16) >> 5;
}
}
}
createBlocks(bitmap) {
var blockRows = Math.ceil(this.height / 32);
var blockCols = Math.ceil(this.width / 32);
var length = blockRows * blockCols;
var buffer = new ArrayBuffer(length << 11);
this.blocks = [];
for (var r = 0; r < blockRows; r++) {
for (var c = 0; c < blockCols; c++) {
var block = new Block(buffer, (r * blockCols + c) << 11, true);
for (var i = 0; i < 1024; i++) {
var val = 0;
if (bitmap[this.zigzagRow[i] + 32 * r]) {
val = bitmap[this.zigzagRow[i] + 32 * r][this.zigzagCol[i] + 32 * c];
val = val || 0;
}
block.setCoef(i, val);
}
this.blocks.push(block);
}
}
buffer = new ArrayBuffer(length << 11);
this.eblocks = new Array(length);
for (var i = 0; i < length; i++) {
this.eblocks[i] = new Block(buffer, i << 11, true);
}
}
encodeSlice(zp) {
this.zp = zp;
if (!this.is_null_slice()) {
for (var i = 0; i < this.blocks.length; i++) {
var block = this.blocks[i];
var eblock = this.eblocks[i];
this.preliminaryFlagComputation(block, eblock);
if (this.blockBandEncodingPass()) {
this.bucketEncodingPass(eblock);
this.newlyActiveCoefficientEncodingPass(block, eblock);
}
this.previouslyActiveCoefficientEncodingPass(block, eblock);
}
}
return this.finish_code_slice();
}
previouslyActiveCoefficientEncodingPass(block, eblock) {
var boff = 0;
var step = this.quant_hi[this.curband];
var indices = this.getBandBuckets(this.curband);
for (var i = indices.from; i <= indices.to; i++ ,
boff++) {
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & this.ACTIVE) {
if (!this.curband) {
step = this.quant_lo[j];
}
var coef = Math.abs(block.buckets[i][j]);
var ecoef = eblock.buckets[i][j];
var pix = coef >= ecoef ? 1 : 0;
if (ecoef <= 3 * step) {
this.zp.encode(pix, this.inreaseCoefCtx, 0);
} else {
this.zp.IWencode(pix);
}
eblock.buckets[i][j] = ecoef - (pix ? 0 : step) + (step >> 1);
}
}
}
}
newlyActiveCoefficientEncodingPass(block, eblock) {
var boff = 0;
var indices = this.getBandBuckets(this.curband);
var step = this.quant_hi[this.curband];
for (var i = indices.from; i <= indices.to; i++ ,
boff++) {
if (this.bucketstate[boff] & this.NEW) {
var shift = 0;
if (this.bucketstate[boff] & this.ACTIVE) {
shift = 8;
}
var bucket = block.buckets[i];
var ebucket = eblock.buckets[i];
var np = 0;
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & this.UNK) {
np++;
}
}
for (var j = 0; j < 16; j++) {
if (this.coeffstate[boff][j] & this.UNK) {
var ip = Math.min(7, np);
this.zp.encode((this.coeffstate[boff][j] & this.NEW) ? 1 : 0, this.activateCoefCtx, shift + ip);
if (this.coeffstate[boff][j] & this.NEW) {
this.zp.IWencode((bucket[j] < 0) ? 1 : 0);
np = 0;
if (!this.curband) {
step = this.quant_lo[j];
}
ebucket[j] = (step + (step >> 1) - (step >> 3));
ebucket[j] = (step + (step >> 1));
}
if (np) {
np--;
}
}
}
}
}
}
bucketEncodingPass(eblock) {
var indices = this.getBandBuckets(this.curband);
var boff = 0;
for (var i = indices.from; i <= indices.to; i++ ,
boff++) {
if (!(this.bucketstate[boff] & this.UNK)) {
continue;
}
var n = 0;
if (this.curband) {
var t = 4 * i;
for (var j = t; j < t + 4; j++) {
if (eblock.getCoef(j)) {
n++;
}
}
if (n === 4) {
n--;
}
}
if (this.bbstate & this.ACTIVE) {
n |= 4;
}
this.zp.encode((this.bucketstate[boff] & this.NEW) ? 1 : 0, this.decodeCoefCtx, n + this.curband * 8);
}
}
blockBandEncodingPass() {
var indices = this.getBandBuckets(this.curband);
var bcount = indices.to - indices.from + 1;
if (bcount < 16 || (this.bbstate & this.ACTIVE)) {
this.bbstate |= this.NEW;
} else if (this.bbstate & this.UNK) {
this.zp.encode(this.bbstate & this.NEW ? 1 : 0, this.decodeBucketCtx, 0);
}
return this.bbstate & this.NEW;
}
preliminaryFlagComputation(block, eblock) {
this.bbstate = 0;
var bstatetmp = 0;
var indices = this.getBandBuckets(this.curband);
var step = this.quant_hi[this.curband];
if (this.curband) {
var boff = 0;
for (var j = indices.from; j <= indices.to; j++ , boff++) {
bstatetmp = 0;
var bucket = block.buckets[j];
var ebucket = eblock.buckets[j];
for (var k = 0; k < bucket.length; k++) {
if (ebucket[k]) {
this.coeffstate[boff][k] = this.ACTIVE;
} else if (bucket[k] >= step || bucket[k] <= -step) {
this.coeffstate[boff][k] = this.UNK | this.NEW;
} else {
this.coeffstate[boff][k] = this.UNK;
}
bstatetmp |= this.coeffstate[boff][k];
}
this.bucketstate[boff] = bstatetmp;
this.bbstate |= bstatetmp;
}
} else {
var bucket = block.buckets[0];
var ebucket = eblock.buckets[0];
for (var k = 0; k < bucket.length; k++) {
step = this.quant_lo[k];
if (this.coeffstate[0][k] !== this.ZERO) {
if (ebucket[k]) {
this.coeffstate[0][k] = this.ACTIVE;
} else if (bucket[k] >= step || bucket[k] <= -step) {
this.coeffstate[0][k] = this.UNK | this.NEW;
} else {
this.coeffstate[0][k] = this.UNK;
}
}
bstatetmp |= this.coeffstate[0][k];
}
this.bucketstate[0] = bstatetmp;
this.bbstate |= bstatetmp;
}
}
}
class IWImageWriter {
constructor(slicenumber, delayInit, grayscale) {
this.slicenumber = slicenumber || 100;
this.grayscale = grayscale || 0;
this.delayInit = (delayInit & 127) || 0;
this.onprocess = undefined;
}
get width() {
return this.imageData.width;
}
get height() {
return this.imageData.height;
}
startMultiPageDocument() {
this.dw = new DjVuWriter();
this.dw.startDJVM();
this.pageBuffers = [];
var dirm = {};
this.dirm = dirm;
dirm.offsets = [];
dirm.dflags = 129;
dirm.flags = [];
dirm.ids = [];
dirm.sizes = [];
}
addPageToDocument(imageData) {
var tbsw = new ByteStreamWriter();
this.writeImagePage(tbsw, imageData);
var buffer = tbsw.getBuffer();
this.pageBuffers.push(buffer);
this.dirm.flags.push(1);
this.dirm.ids.push('p' + this.dirm.ids.length);
this.dirm.sizes.push(buffer.byteLength);
}
endMultiPageDocument() {
this.dw.writeDirmChunk(this.dirm);
var len = this.pageBuffers.length;
for (var i = 0; i < len; i++) {
this.dw.writeFormChunkBuffer(this.pageBuffers.shift());
}
var buffer = this.dw.getBuffer();
delete this.dw;
delete this.pageBuffers;
delete this.dirm;
return buffer;
}
createMultiPageDocument(imageArray) {
var dw = new DjVuWriter();
dw.startDJVM();
var length = imageArray.length;
var pageBuffers = new Array(imageArray.length);
var dirm = {};
this.dirm = dirm;
dirm.offsets = [];
dirm.dflags = 129;
dirm.flags = new Array(imageArray.length);
dirm.ids = new Array(imageArray.length);
dirm.sizes = new Array(imageArray.length);
var tbsw = new ByteStreamWriter();
for (var i = 0; i < imageArray.length; i++) {
this.writeImagePage(tbsw, imageArray[i]);
var buffer = tbsw.getBuffer();
pageBuffers[i] = buffer;
tbsw.reset();
dirm.flags[i] = 1;
dirm.ids[i] = 'p' + i;
dirm.sizes[i] = buffer.byteLength;
this.onprocess ? this.onprocess((i + 1) / length) : 0;
}
dw.writeDirmChunk(dirm);
for (var i = 0; i < imageArray.length; i++) {
dw.writeFormChunkBuffer(pageBuffers[i]);
}
return new DjVuDocument(dw.getBuffer());
}
writeImagePage(bsw, imageData) {
bsw.writeStr('FORM').saveOffsetMark('formSize').jump(4).writeStr('DJVU');
bsw.writeStr('INFO')
.writeInt32(10)
.writeInt16(imageData.width)
.writeInt16(imageData.height)
.writeByte(24).writeByte(0)
.writeByte(100 & 0xff)
.writeByte(100 >> 8)
.writeByte(22).writeByte(1);
bsw.writeStr('BG44').saveOffsetMark('BG44Size').jump(4);
bsw.writeByte(0)
.writeByte(this.slicenumber)
.writeByte((this.grayscale << 7) | 1)
.writeByte(2)
.writeUint16(imageData.width)
.writeUint16(imageData.height)
.writeByte(this.delayInit);
var ycodec = new IWEncoder(this.RGBtoY(imageData));
var crcodec, cbcodec;
if (!this.grayscale) {
cbcodec = new IWEncoder(this.RGBtoCb(imageData));
crcodec = new IWEncoder(this.RGBtoCr(imageData));
}
var zp = new ZPEncoder(bsw);
for (var i = 0; i < this.slicenumber; i++) {
ycodec.encodeSlice(zp);
if (cbcodec && crcodec && i >= this.delayInit) {
cbcodec.encodeSlice(zp);
crcodec.encodeSlice(zp);
}
}
zp.eflush();
bsw.rewriteSize('formSize');
bsw.rewriteSize('BG44Size');
}
createOnePageDocument(imageData) {
var bsw = new ByteStreamWriter(10 * 1024);
bsw.writeStr('AT&T');
this.writeImagePage(bsw, imageData);
return new DjVuDocument(bsw.getBuffer());
}
RGBtoY(imageData) {
var rmul = new Int32Array(256);
var gmul = new Int32Array(256);
var bmul = new Int32Array(256);
var data = imageData.data;
var width = imageData.width;
var height = imageData.height;
var bytemap = new Bytemap(width, height);
if (this.grayscale) {
for (var i = 0; i < data.length; i++) {
data[i] = 255 - data[i];
}
}
for (var k = 0; k < 256; k++) {
rmul[k] = (k * 0x10000 * this.rgb_to_ycc[0][0]);
gmul[k] = (k * 0x10000 * this.rgb_to_ycc[0][1]);
bmul[k] = (k * 0x10000 * this.rgb_to_ycc[0][2]);
}
for (var i = 0; i < height; i++) {
for (var j = 0; j < width; j++) {
var index = ((height - i - 1) * width + j) << 2;
var y = rmul[data[index]] + gmul[data[index + 1]] + bmul[data[index + 2]] + 32768;
bytemap[i][j] = ((y >> 16) - 128) << this.iw_shift;
}
}
return bytemap;
}
RGBtoCb(imageData) {
var rmul = new Int32Array(256);
var gmul = new Int32Array(256);
var bmul = new Int32Array(256);
var data = imageData.data;
var width = imageData.width;
var height = imageData.height;
var bytemap = new Bytemap(width, height);
for (var k = 0; k < 256; k++) {
rmul[k] = (k * 0x10000 * this.rgb_to_ycc[2][0]);
gmul[k] = (k * 0x10000 * this.rgb_to_ycc[2][1]);
bmul[k] = (k * 0x10000 * this.rgb_to_ycc[2][2]);
}
for (var i = 0; i < height; i++) {
for (var j = 0; j < width; j++) {
var index = ((height - i - 1) * width + j) << 2;
var y = rmul[data[index]] + gmul[data[index + 1]] + bmul[data[index + 2]] + 32768;
bytemap[i][j] = Math.max(-128, Math.min(127, y >> 16)) << this.iw_shift;
}
}
return bytemap;
}
RGBtoCr(imageData) {
var rmul = new Int32Array(256);
var gmul = new Int32Array(256);
var bmul = new Int32Array(256);
var data = imageData.data;
var width = imageData.width;
var height = imageData.height;
var bytemap = new Bytemap(width, height);
for (var k = 0; k < 256; k++) {
rmul[k] = (k * 0x10000 * this.rgb_to_ycc[1][0]);
gmul[k] = (k * 0x10000 * this.rgb_to_ycc[1][1]);
bmul[k] = (k * 0x10000 * this.rgb_to_ycc[1][2]);
}
for (var i = 0; i < height; i++) {
for (var j = 0; j < width; j++) {
var index = ((height - i - 1) * width + j) << 2;
var y = rmul[data[index]] + gmul[data[index + 1]] + bmul[data[index + 2]] + 32768;
bytemap[i][j] = Math.max(-128, Math.min(127, y >> 16)) << this.iw_shift;
}
}
return bytemap;
}
}
IWImageWriter.prototype.iw_shift = 6;
IWImageWriter.prototype.rgb_to_ycc = [
[0.304348, 0.608696, 0.086956],
[0.463768, -0.405797, -0.057971],
[-0.173913, -0.347826, 0.521739]];
function initWorker() {
var djvuDocument;
var iwiw;
addEventListener("error", e => {
console.error(e);
postMessage("error");
});
addEventListener("unhandledrejection", e => {
console.error(e);
postMessage("unhandledrejection");
});
onmessage = async function ({ data: obj }) {
if (obj.action) return handlers[obj.action](obj);
try {
const { data, transferList } = await handlers[obj.command](obj) || {};
try {
postMessage({
command: obj.command,
...data,
...(obj.sendBackData ? { sendBackData: obj.sendBackData } : null),
}, transferList && transferList.length ? transferList : undefined);
} catch (e) {
throw new UnableToTransferDataDjVuError(obj.data);
}
} catch (error) {
console.error(error);
var errorObj = error instanceof DjVuError ? error : {
code: DjVuErrorCodes.UNEXPECTED_ERROR,
name: error.name,
message: error.message
};
errorObj.commandObject = obj;
postMessage({
command: 'Error',
error: errorObj,
...(obj.sendBackData ? { sendBackData: obj.sendBackData } : null),
});
}
};
function processValueBeforeTransfer(value, transferList) {
if (value instanceof ArrayBuffer) {
transferList.push(value);
return value;
}
if (value instanceof ImageData) {
transferList.push(value.data.buffer);
return {
width: value.width,
height: value.height,
buffer: value.data.buffer
};
}
if (value instanceof DjVuDocument) {
transferList.push(value.buffer);
return value.buffer;
}
return value;
}
function restoreHyperCallbacks(args) {
return args.map(arg => {
if (arg && (typeof arg === 'object') && arg.hyperCallback) {
return (...params) => postMessage({
action: 'hyperCallback',
id: arg.id,
args: params
});
}
return arg;
});
}
var handlers = {
async run(obj) {
const results = await Promise.all(obj.data.map(async task => {
var res = djvuDocument;
for (var i = 0; i < task.funcs.length; i++) {
if (typeof res[task.funcs[i]] !== 'function') {
throw new IncorrectTaskDjVuError(task);
}
res = await res[task.funcs[i]](...restoreHyperCallbacks(task.args[i]));
}
return res;
}));
var transferList = [];
var processedResults = results.map(result => processValueBeforeTransfer(result, transferList));
return {
data: {
result: processedResults.length === 1 ? processedResults[0] : processedResults
},
transferList
};
},
revokeObjectURL(obj) {
URL.revokeObjectURL(obj.url);
},
startMultiPageDocument(obj) {
iwiw = new IWImageWriter(obj.slicenumber, obj.delayInit, obj.grayscale);
iwiw.startMultiPageDocument();
},
addPageToDocument(obj) {
var imageData = new ImageData(new Uint8ClampedArray(obj.simpleImage.buffer), obj.simpleImage.width, obj.simpleImage.height);
iwiw.addPageToDocument(imageData);
},
endMultiPageDocument(obj) {
var buffer = iwiw.endMultiPageDocument();
return {
data: { buffer: buffer },
transferList: [buffer]
};
},
createDocumentFromPictures(obj) {
var sims = obj.images;
var imageArray = new Array(sims.length);
for (var i = 0; i < sims.length; i++) {
imageArray[i] = new ImageData(new Uint8ClampedArray(sims[i].buffer), sims[i].width, sims[i].height);
}
var iw = new IWImageWriter(obj.slicenumber, obj.delayInit, obj.grayscale);
iw.onprocess = (percent) => {
postMessage({ action: 'Process', percent: percent });
};
var ndoc = iw.createMultyPageDocument(imageArray);
return {
data: { buffer: ndoc.buffer },
transferList: [ndoc.buffer]
};
},
createDocument(obj) {
djvuDocument = new DjVuDocument(obj.buffer, obj.options);
},
};
}
if (!self.document) {
initWorker();
}
var index = Object.assign({}, DjVu, {
Worker: DjVuWorker,
Document: DjVuDocument,
ErrorCodes: DjVuErrorCodes
});
return index;
}
return Object.assign(DjVuScript(), {DjVuScript});
}());
This file has been truncated, but you can view the full file.
/*! For license information please see djvu_viewer.js.LICENSE.txt */
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=38)}([function(e,t,n){"use strict";e.exports=n(31)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return Te})),n.d(t,"b",(function(){return Ne})),n.d(t,"c",(function(){return De})),n.d(t,"d",(function(){return be})),n.d(t,"f",(function(){return Le}));var r=n(9),o=n(2),i=n.n(o),a=n(14),l=n.n(a),s=n(15),u=n(16),c=n(10),d=n(4),f=n.n(d);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var h=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},m=function(e){return null!==e&&"object"==typeof e&&"[object Object]"===(e.toString?e.toString():Object.prototype.toString.call(e))&&!Object(r.typeOf)(e)},g=Object.freeze([]),v=Object.freeze({});function b(e){return"function"==typeof e}function y(e){return e.displayName||e.name||"Component"}function w(e){return e&&"string"==typeof e.styledComponentId}var S="undefined"!=typeof e&&(Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).REACT_APP_SC_ATTR||Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).SC_ATTR)||"data-styled",x="undefined"!=typeof window&&"HTMLElement"in window,O=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof e&&void 0!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).REACT_APP_SC_DISABLE_SPEEDY&&""!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).REACT_APP_SC_DISABLE_SPEEDY?"false"!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).REACT_APP_SC_DISABLE_SPEEDY&&Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof e&&void 0!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).SC_DISABLE_SPEEDY&&""!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).SC_DISABLE_SPEEDY&&("false"!==Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).SC_DISABLE_SPEEDY&&Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!1}).SC_DISABLE_SPEEDY)),_={};function j(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(n.length>0?" Args: "+n.join(", "):""))}var C=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&j(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),l=0,s=t.length;l<s;l++)this.tag.insertRule(a,t[l])&&(this.groupSizes[e]++,a++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+=this.tag.getRule(i)+"/*!sc*/\n";return t},e}(),k=new Map,E=new Map,T=1,N=function(e){if(k.has(e))return k.get(e);for(;E.has(T);)T++;var t=T++;return k.set(e,t),E.set(t,e),t},P=function(e){return E.get(e)},I=function(e,t){t>=T&&(T=t+1),k.set(e,t),E.set(t,e)},R="style["+S+'][data-styled-version="5.3.5"]',A=new RegExp("^"+S+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),D=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},L=function(e,t){for(var n=(t.textContent||"").split("/*!sc*/\n"),r=[],o=0,i=n.length;o<i;o++){var a=n[o].trim();if(a){var l=a.match(A);if(l){var s=0|parseInt(l[1],10),u=l[2];0!==s&&(I(u,s),D(e,u,l[3]),e.getTag().insertRules(s,r)),r.length=0}else r.push(a)}}},M=function(){return"undefined"!=typeof window&&void 0!==window.__webpack_nonce__?window.__webpack_nonce__:null},z=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(S))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(S,"active"),r.setAttribute("data-styled-version","5.3.5");var a=M();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},U=function(){function e(e){var t=this.element=z(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}j(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),F=function(){function e(e){var t=this.element=z(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),B=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),V=x,W={isServer:!x,useCSSOMInjection:!O},H=function(){function e(e,t,n){void 0===e&&(e=v),void 0===t&&(t={}),this.options=p({},W,{},e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&x&&V&&(V=!1,function(e){for(var t=document.querySelectorAll(R),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(S)&&(L(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return N(e)};var t=e.prototype;return t.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(p({},this.options,{},t),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(n=(t=this.options).isServer,r=t.useCSSOMInjection,o=t.target,e=n?new B(o):r?new U(o):new F(o),new C(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(N(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(N(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(N(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var i=P(o);if(void 0!==i){var a=e.names.get(i),l=t.getGroup(o);if(a&&l&&a.size){var s=S+".g"+o+'[id="'+i+'"]',u="";void 0!==a&&a.forEach((function(e){e.length>0&&(u+=e+",")})),r+=""+l+s+'{content:"'+u+'"}/*!sc*/\n'}}}return r}(this)},e}(),$=/(a)(d)/gi,G=function(e){return String.fromCharCode(e+(e>25?39:97))};function q(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=G(t%52)+n;return(G(t%52)+n).replace($,"$1-$2")}var Y=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},K=function(e){return Y(5381,e)};function Q(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(b(n)&&!w(n))return!1}return!0}var X=K("5.3.5"),Z=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&Q(e),this.componentId=t,this.baseHash=Y(X,t),this.baseStyle=n,H.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId,o=[];if(this.baseStyle&&o.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))o.push(this.staticRulesId);else{var i=ge(this.rules,e,t,n).join(""),a=q(Y(this.baseHash,i)>>>0);if(!t.hasNameForId(r,a)){var l=n(i,"."+a,void 0,r);t.insertRules(r,a,l)}o.push(a),this.staticRulesId=a}else{for(var s=this.rules.length,u=Y(this.baseHash,n.hash),c="",d=0;d<s;d++){var f=this.rules[d];if("string"==typeof f)c+=f;else if(f){var p=ge(f,e,t,n),h=Array.isArray(p)?p.join(""):p;u=Y(u,h+d),c+=h}}if(c){var m=q(u>>>0);if(!t.hasNameForId(r,m)){var g=n(c,"."+m,void 0,r);t.insertRules(r,m,g)}o.push(m)}}return o.join(" ")},e}(),J=/^\s*\/\/.*$/gm,ee=[":","[",".","#"];function te(e){var t,n,r,o,i=void 0===e?v:e,a=i.options,l=void 0===a?v:a,u=i.plugins,c=void 0===u?g:u,d=new s.a(l),f=[],p=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,l,s,u,c,d){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===u)return r+"/*|*/";break;case 3:switch(u){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),h=function(e,r,i){return 0===r&&-1!==ee.indexOf(i[n.length])||i.match(o)?e:"."+t};function m(e,i,a,l){void 0===l&&(l="&");var s=e.replace(J,""),u=i&&a?a+" "+i+" { "+s+" }":s;return t=l,n=i,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),d(a||!i?"":i,u)}return d.use([].concat(c,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,h))},p,function(e){if(-2===e){var t=f;return f=[],t}}])),m.hash=c.length?c.reduce((function(e,t){return t.name||j(15),Y(e,t.name)}),5381).toString():"",m}var ne=i.a.createContext(),re=(ne.Consumer,i.a.createContext()),oe=(re.Consumer,new H),ie=te();function ae(){return Object(o.useContext)(ne)||oe}function le(){return Object(o.useContext)(re)||ie}function se(e){var t=Object(o.useState)(e.stylisPlugins),n=t[0],r=t[1],a=ae(),s=Object(o.useMemo)((function(){var t=a;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),u=Object(o.useMemo)((function(){return te({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(o.useEffect)((function(){l()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),i.a.createElement(ne.Provider,{value:s},i.a.createElement(re.Provider,{value:u},e.children))}var ue=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ie);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return j(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=ie),this.name+e.hash},e}(),ce=/([A-Z])/,de=/([A-Z])/g,fe=/^ms-/,pe=function(e){return"-"+e.toLowerCase()};function he(e){return ce.test(e)?e.replace(de,pe).replace(fe,"-ms-"):e}var me=function(e){return null==e||!1===e||""===e};function ge(e,t,n,r){if(Array.isArray(e)){for(var o,i=[],a=0,l=e.length;a<l;a+=1)""!==(o=ge(e[a],t,n,r))&&(Array.isArray(o)?i.push.apply(i,o):i.push(o));return i}return me(e)?"":w(e)?"."+e.styledComponentId:b(e)?"function"!=typeof(s=e)||s.prototype&&s.prototype.isReactComponent||!t?e:ge(e(t),t,n,r):e instanceof ue?n?(e.inject(n,r),e.getName(r)):e:m(e)?function e(t,n){var r,o,i=[];for(var a in t)t.hasOwnProperty(a)&&!me(t[a])&&(Array.isArray(t[a])&&t[a].isCss||b(t[a])?i.push(he(a)+":",t[a],";"):m(t[a])?i.push.apply(i,e(t[a],a)):i.push(he(a)+": "+(r=a,(null==(o=t[a])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||r in u.a?String(o).trim():o+"px")+";")));return n?[n+" {"].concat(i,["}"]):i}(e):e.toString();var s}var ve=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function be(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return b(e)||m(e)?ve(ge(h(g,[e].concat(n)))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:ve(ge(h(e,n)))}new Set;var ye=function(e,t,n){return void 0===n&&(n=v),e.theme!==n.theme&&e.theme||t||n.theme},we=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Se=/(^-|-$)/g;function xe(e){return e.replace(we,"-").replace(Se,"")}var Oe=function(e){return q(K(e)>>>0)};function _e(e){return"string"==typeof e&&!0}var je=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Ce=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function ke(e,t,n){var r=e[n];je(t)&&je(r)?Ee(r,t):e[n]=t}function Ee(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];if(je(a))for(var l in a)Ce(l)&&ke(e,a[l],l)}return e}var Te=i.a.createContext();Te.Consumer;function Ne(e){var t=Object(o.useContext)(Te),n=Object(o.useMemo)((function(){return function(e,t){return e?b(e)?e(t):Array.isArray(e)||"object"!=typeof e?j(8):t?p({},t,{},e):e:j(14)}(e.theme,t)}),[e.theme,t]);return e.children?i.a.createElement(Te.Provider,{value:n},e.children):null}var Pe={};function Ie(e,t,n){var r=w(e),a=!_e(e),l=t.attrs,s=void 0===l?g:l,u=t.componentId,d=void 0===u?function(e,t){var n="string"!=typeof e?"sc":xe(e);Pe[n]=(Pe[n]||0)+1;var r=n+"-"+Oe("5.3.5"+n+Pe[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):u,h=t.displayName,m=void 0===h?function(e){return _e(e)?"styled."+e:"Styled("+y(e)+")"}(e):h,S=t.displayName&&t.componentId?xe(t.displayName)+"-"+t.componentId:t.componentId||d,x=r&&e.attrs?Array.prototype.concat(e.attrs,s).filter(Boolean):s,O=t.shouldForwardProp;r&&e.shouldForwardProp&&(O=t.shouldForwardProp?function(n,r,o){return e.shouldForwardProp(n,r,o)&&t.shouldForwardProp(n,r,o)}:e.shouldForwardProp);var _,j=new Z(n,S,r?e.componentStyle:void 0),C=j.isStatic&&0===s.length,k=function(e,t){return function(e,t,n,r){var i=e.attrs,a=e.componentStyle,l=e.defaultProps,s=e.foldedComponentIds,u=e.shouldForwardProp,d=e.styledComponentId,f=e.target,h=function(e,t,n){void 0===e&&(e=v);var r=p({},t,{theme:e}),o={};return n.forEach((function(e){var t,n,i,a=e;for(t in b(a)&&(a=a(r)),a)r[t]=o[t]="className"===t?(n=o[t],i=a[t],n&&i?n+" "+i:n||i):a[t]})),[r,o]}(ye(t,Object(o.useContext)(Te),l)||v,t,i),m=h[0],g=h[1],y=function(e,t,n,r){var o=ae(),i=le();return t?e.generateAndInjectStyles(v,o,i):e.generateAndInjectStyles(n,o,i)}(a,r,m),w=n,S=g.$as||t.$as||g.as||t.as||f,x=_e(S),O=g!==t?p({},t,{},g):t,_={};for(var j in O)"$"!==j[0]&&"as"!==j&&("forwardedAs"===j?_.as=O[j]:(u?u(j,c.a,S):!x||Object(c.a)(j))&&(_[j]=O[j]));return t.style&&g.style!==t.style&&(_.style=p({},t.style,{},g.style)),_.className=Array.prototype.concat(s,d,y!==d?y:null,t.className,g.className).filter(Boolean).join(" "),_.ref=w,Object(o.createElement)(S,_)}(_,e,t,C)};return k.displayName=m,(_=i.a.forwardRef(k)).attrs=x,_.componentStyle=j,_.displayName=m,_.shouldForwardProp=O,_.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):g,_.styledComponentId=S,_.target=r?e.target:e,_.withComponent=function(e){var r=t.componentId,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(_e(e)?e:xe(y(e)));return Ie(e,p({},o,{attrs:x,componentId:i}),n)},Object.defineProperty(_,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Ee({},e.defaultProps,t):t}}),_.toString=function(){return"."+_.styledComponentId},a&&f()(_,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),_}var Re=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return j(1,String(n));var i=function(){return t(n,o,be.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,p({},o,{},r))},i.attrs=function(r){return e(t,n,p({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(Ie,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){Re[e]=Re(e)}));var Ae=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Q(e),H.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,n,r){var o=r(ge(this.rules,t,n,r).join(""),""),i=this.componentId+e;n.insertRules(i,i,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&H.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function De(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=be.apply(void 0,[e].concat(n)),l="sc-global-"+Oe(JSON.stringify(a)),s=new Ae(a,l);function u(e){var t=ae(),n=le(),r=Object(o.useContext)(Te),i=Object(o.useRef)(t.allocateGSInstance(l)).current;return t.server&&c(i,e,t,r,n),Object(o.useLayoutEffect)((function(){if(!t.server)return c(i,e,t,r,n),function(){return s.removeStyles(i,t)}}),[i,e,t,r,n]),null}function c(e,t,n,r,o){if(s.isStatic)s.renderStyles(e,_,n,o);else{var i=p({},t,{theme:ye(t,r,u.defaultProps)});s.renderStyles(e,i,n,o)}}return i.a.memo(u)}function Le(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=be.apply(void 0,[e].concat(n)).join(""),i=Oe(o);return new ue(i,o)}!function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var n=M();return"<style "+[n&&'nonce="'+n+'"',S+'="true"','data-styled-version="5.3.5"'].filter(Boolean).join(" ")+">"+t+"</style>"},this.getStyleTags=function(){return e.sealed?j(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return j(2);var n=((t={})[S]="",t["data-styled-version"]="5.3.5",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=M();return r&&(n.nonce=r),[i.a.createElement("style",p({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new H({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?j(2):i.a.createElement(se,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return j(3)}}();t.e=Re}).call(this,n(7))},function(e,t,n){"use strict";e.exports=n(19)},,function(e,t,n){"use strict";var r=n(27),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?a:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=a;var u=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,r)}var a=c(n);d&&(a=a.concat(d(n)));for(var l=s(t),m=s(n),g=0;g<a.length;++g){var v=a[g];if(!i[v]&&(!r||!r[v])&&(!m||!m[v])&&(!l||!l[v])){var b=f(n,v);try{u(t,v,b)}catch(y){}}}}return t}},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(20)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"===typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,u=[],c=!1,d=-1;function f(){c&&s&&(c=!1,s.length?u=s.concat(u):d=-1,u.length&&p())}function p(){if(!c){var e=l(f);c=!0;for(var t=u.length;t;){for(s=u,u=[];++d<t;)s&&s[d].run();d=-1,t=u.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new h(e,t)),1!==u.length||c||l(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";e.exports=n(25)},function(e,t,n){"use strict";e.exports=n(30)},function(e,t,n){"use strict";var r=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,o=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return r.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));t.a=o},function(e,t,n){"use strict";var r=n(5);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},function(e,t,n){"use strict";e.exports=n(26)},function(e,t,n){"use strict";e.exports=n(29)},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s<i.length;s++){var u=i[s];if(!l(u))return!1;var c=e[u],d=t[u];if(!1===(o=n?n.call(r,c,d,u):void 0)||void 0===o&&c!==d)return!1}return!0}},function(e,t,n){"use strict";t.a=function(e){function t(e,r,s,u,f){for(var p,h,m,g,w,x=0,O=0,_=0,j=0,C=0,I=0,A=m=p=0,L=0,M=0,z=0,U=0,F=s.length,B=F-1,V="",W="",H="",$="";L<F;){if(h=s.charCodeAt(L),L===B&&0!==O+j+_+x&&(0!==O&&(h=47===O?10:47),j=_=x=0,F++,B++),0===O+j+_+x){if(L===B&&(0<M&&(V=V.replace(d,"")),0<V.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:V+=s.charAt(L)}h=59}switch(h){case 123:for(p=(V=V.trim()).charCodeAt(0),m=1,U=++L;L<F;){switch(h=s.charCodeAt(L)){case 123:m++;break;case 125:m--;break;case 47:switch(h=s.charCodeAt(L+1)){case 42:case 47:e:{for(A=L+1;A<B;++A)switch(s.charCodeAt(A)){case 47:if(42===h&&42===s.charCodeAt(A-1)&&L+2!==A){L=A+1;break e}break;case 10:if(47===h){L=A+1;break e}}L=A}}break;case 91:h++;case 40:h++;case 34:case 39:for(;L++<B&&s.charCodeAt(L)!==h;);}if(0===m)break;L++}switch(m=s.substring(U,L),0===p&&(p=(V=V.replace(c,"").trim()).charCodeAt(0)),p){case 64:switch(0<M&&(V=V.replace(d,"")),h=V.charCodeAt(1)){case 100:case 109:case 115:case 45:M=r;break;default:M=P}if(U=(m=t(r,M,m,h,f+1)).length,0<R&&(w=l(3,m,M=n(P,V,z),r,E,k,U,h,f,u),V=M.join(""),void 0!==w&&0===(U=(m=w.trim()).length)&&(h=0,m="")),0<U)switch(h){case 115:V=V.replace(S,a);case 100:case 109:case 45:m=V+"{"+m+"}";break;case 107:m=(V=V.replace(v,"$1 $2"))+"{"+m+"}",m=1===N||2===N&&i("@"+m,3)?"@-webkit-"+m+"@"+m:"@"+m;break;default:m=V+m,112===u&&(W+=m,m="")}else m="";break;default:m=t(r,n(r,V,z),m,u,f+1)}H+=m,m=z=M=A=p=0,V="",h=s.charCodeAt(++L);break;case 125:case 59:if(1<(U=(V=(0<M?V.replace(d,""):V).trim()).length))switch(0===A&&(p=V.charCodeAt(0),45===p||96<p&&123>p)&&(U=(V=V.replace(" ",":")).length),0<R&&void 0!==(w=l(1,V,r,e,E,k,W.length,u,f,u))&&0===(U=(V=w.trim()).length)&&(V="\0\0"),p=V.charCodeAt(0),h=V.charCodeAt(1),p){case 0:break;case 64:if(105===h||99===h){$+=V+s.charAt(L);break}default:58!==V.charCodeAt(U-1)&&(W+=o(V,p,h,V.charCodeAt(2)))}z=M=A=p=0,V="",h=s.charCodeAt(++L)}}switch(h){case 13:case 10:47===O?O=0:0===1+p&&107!==u&&0<V.length&&(M=1,V+="\0"),0<R*D&&l(0,V,r,e,E,k,W.length,u,f,u),k=1,E++;break;case 59:case 125:if(0===O+j+_+x){k++;break}default:switch(k++,g=s.charAt(L),h){case 9:case 32:if(0===j+x+O)switch(C){case 44:case 58:case 9:case 32:g="";break;default:32!==h&&(g=" ")}break;case 0:g="\\0";break;case 12:g="\\f";break;case 11:g="\\v";break;case 38:0===j+O+x&&(M=z=1,g="\f"+g);break;case 108:if(0===j+O+x+T&&0<A)switch(L-A){case 2:112===C&&58===s.charCodeAt(L-3)&&(T=C);case 8:111===I&&(T=I)}break;case 58:0===j+O+x&&(A=L);break;case 44:0===O+_+j+x&&(M=1,g+="\r");break;case 34:case 39:0===O&&(j=j===h?0:0===j?h:j);break;case 91:0===j+O+_&&x++;break;case 93:0===j+O+_&&x--;break;case 41:0===j+O+x&&_--;break;case 40:if(0===j+O+x){if(0===p)switch(2*C+3*I){case 533:break;default:p=1}_++}break;case 64:0===O+_+j+x+A+m&&(m=1);break;case 42:case 47:if(!(0<j+x+_))switch(O){case 0:switch(2*h+3*s.charCodeAt(L+1)){case 235:O=47;break;case 220:U=L,O=42}break;case 42:47===h&&42===C&&U+2!==L&&(33===s.charCodeAt(U+2)&&(W+=s.substring(U,L+1)),g="",O=0)}}0===O&&(V+=g)}I=C,C=h,L++}if(0<(U=W.length)){if(M=r,0<R&&(void 0!==(w=l(2,W,M,e,E,k,U,u,f,u))&&0===(W=w).length))return $+W+H;if(W=M.join(",")+"{"+W+"}",0!==N*T){switch(2!==N||i(W,2)||(T=0),T){case 111:W=W.replace(y,":-moz-$1")+W;break;case 112:W=W.replace(b,"::-webkit-input-$1")+W.replace(b,"::-moz-$1")+W.replace(b,":-ms-input-$1")+W}T=0}}return $+W+H}function n(e,t,n){var o=t.trim().split(m);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var l=0;for(e=0===a?"":e[0]+" ";l<i;++l)t[l]=r(e,t[l],n).trim();break;default:var s=l=0;for(t=[];l<i;++l)for(var u=0;u<a;++u)t[s++]=r(e[u]+" ",o[l],n).trim()}return t}function r(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(g,"$1"+e.trim());case 58:return e.trim()+t.replace(g,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(g,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function o(e,t,n,r){var a=e+";",l=2*t+3*n+4*r;if(944===l){e=a.indexOf(":",9)+1;var s=a.substring(e,a.length-1).trim();return s=a.substring(0,e).trim()+s+";",1===N||2===N&&i(s,1)?"-webkit-"+s+s:s}if(0===N||2===N&&!i(a,1))return a;switch(l){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(C,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(s=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+s+a;case 1005:return p.test(a)?a.replace(f,":-webkit-")+a.replace(f,":-moz-")+a:a;case 1e3:switch(t=(s=a.substring(13).trim()).indexOf("-")+1,s.charCodeAt(0)+s.charCodeAt(t)){case 226:s=a.replace(w,"tb");break;case 232:s=a.replace(w,"tb-rl");break;case 220:s=a.replace(w,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+s+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,l=(s=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|s.charCodeAt(7))){case 203:if(111>s.charCodeAt(8))break;case 115:a=a.replace(s,"-webkit-"+s)+";"+a;break;case 207:case 102:a=a.replace(s,"-webkit-"+(102<l?"inline-":"")+"box")+";"+a.replace(s,"-webkit-"+s)+";"+a.replace(s,"-ms-"+s+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return s=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+s+"-ms-flex-"+s+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(O,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(O,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===j.test(e))return 115===(s=e.substring(e.indexOf(":")+1)).charCodeAt(0)?o(e.replace("stretch","fill-available"),t,n,r).replace(":fill-available",":stretch"):a.replace(s,"-webkit-"+s)+a.replace(s,"-moz-"+s.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+r&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(h,"$1-webkit-$2")+a}return a}function i(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),A(2!==t?r:r.replace(_,"$1"),n,t)}function a(e,t){var n=o(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(x," or ($1)").substring(4):"("+t+")"}function l(e,t,n,r,o,i,a,l,s,c){for(var d,f=0,p=t;f<R;++f)switch(d=I[f].call(u,e,p,n,r,o,i,a,l,s,c)){case void 0:case!1:case!0:case null:break;default:p=d}if(p!==t)return p}function s(e){return void 0!==(e=e.prefix)&&(A=null,e?"function"!==typeof e?N=1:(N=2,A=e):N=0),s}function u(e,n){var r=e;if(33>r.charCodeAt(0)&&(r=r.trim()),r=[r],0<R){var o=l(-1,n,r,r,E,k,0,0,0,0);void 0!==o&&"string"===typeof o&&(n=o)}var i=t(P,r,n,0,0);return 0<R&&(void 0!==(o=l(-2,i,r,r,E,k,i.length,0,0,0))&&(i=o)),"",T=0,k=E=1,i}var c=/^\0+/g,d=/[\0\r\f]/g,f=/: */g,p=/zoo|gra/,h=/([,: ])(transform)/g,m=/,\r+?/g,g=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,b=/::(place)/g,y=/:(read-only)/g,w=/[svh]\w+-[tblr]{2}/,S=/\(\s*(.*)\s*\)/g,x=/([\s\S]*?);/g,O=/-self|flex-/g,_=/[^]*?(:[rp][el]a[\w-]+)[^]*/,j=/stretch|:\s*\w+\-(?:conte|avail)/,C=/([^-])(image-set\()/,k=1,E=1,T=0,N=1,P=[],I=[],R=0,A=null,D=0;return u.use=function e(t){switch(t){case void 0:case null:R=I.length=0;break;default:if("function"===typeof t)I[R++]=t;else if("object"===typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else D=0|!!t}return e},u.set=s,void 0!==e&&s(e),u}},function(e,t,n){"use strict";t.a={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t||{},o=n.type||"attachment",i=function(e,t){if(void 0===e)return;var n={};if("string"!==typeof e)throw new TypeError("filename must be a string");void 0===t&&(t=!0);if("string"!==typeof t&&"boolean"!==typeof t)throw new TypeError("fallback must be a string or boolean");if("string"===typeof t&&s.test(t))throw new TypeError("fallback must be ISO-8859-1 string");var o=r(e),i=f.test(o),l="string"!==typeof t?t&&v(o):r(t),u="string"===typeof l&&l!==o;(u||!i||a.test(o))&&(n["filename*"]=o);(i||u)&&(n.filename=u?l:o);return n}(e,n.fallback);return function(e){var t=e.parameters,n=e.type;if(!n||"string"!==typeof n||!p.test(n))throw new TypeError("invalid type");var r=String(n).toLowerCase();if(t&&"object"===typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){var l="*"===(o=i[a]).substr(-1)?S(t[o]):w(t[o]);r+="; "+o+"="+l}return r}(new x(o,i))},e.exports.parse=function(e){if(!e||"string"!==typeof e)throw new TypeError("argument string is required");var t=m.exec(e);if(!t)throw new TypeError("invalid type format");var n,r,o=t[0].length,i=t[1].toLowerCase(),a=[],l={};o=d.lastIndex=";"===t[0].substr(-1)?o-1:o;for(;t=d.exec(e);){if(t.index!==o)throw new TypeError("invalid parameter format");if(o+=t[0].length,n=t[1].toLowerCase(),r=t[2],-1!==a.indexOf(n))throw new TypeError("invalid duplicate parameter");a.push(n),n.indexOf("*")+1!==n.length?"string"!==typeof l[n]&&('"'===r[0]&&(r=r.substr(1,r.length-2).replace(u,"$1")),l[n]=r):(n=n.slice(0,-1),r=g(r),l[n]=r)}if(-1!==o&&o!==e.length)throw new TypeError("invalid parameter format");return new x(i,l)};var r=n(32).basename,o=n(33).Buffer,i=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,a=/%[0-9A-Fa-f]{2}/,l=/%([0-9A-Fa-f]{2})/g,s=/[^\x20-\x7e\xa0-\xff]/g,u=/\\([\u0000-\u007f])/g,c=/([\\"])/g,d=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,f=/^[\x20-\x7e\x80-\xff]+$/,p=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,h=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,m=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function g(e){var t=h.exec(e);if(!t)throw new TypeError("invalid extended field value");var n,r=t[1].toLowerCase(),i=t[2].replace(l,b);switch(r){case"iso-8859-1":n=v(i);break;case"utf-8":n=o.from(i,"binary").toString("utf8");break;default:throw new TypeError("unsupported charset in extended field")}return n}function v(e){return String(e).replace(s,"?")}function b(e,t){return String.fromCharCode(parseInt(t,16))}function y(e){return"%"+String(e).charCodeAt(0).toString(16).toUpperCase()}function w(e){return'"'+String(e).replace(c,"\\$1")+'"'}function S(e){var t=String(e);return"UTF-8''"+encodeURIComponent(t).replace(i,y)}function x(e,t){this.type=e,this.parameters=t}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function l(e,t,n,r,i){if("function"!==typeof n)throw new TypeError("The listener must be a function");var l=new a(n,r||e,i),s=o?o+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],l]:e._events[s].push(l):(e._events[s]=l,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function u(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,a=new Array(i);r<i;r++)a[r]=n[r].fn;return a},u.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,i,a){var l=o?o+e:e;if(!this._events[l])return!1;var s,u,c=this._events[l],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,a),!0}for(u=1,s=new Array(d-1);u<d;u++)s[u-1]=arguments[u];c.fn.apply(c.context,s)}else{var f,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!s)for(f=1,s=new Array(d-1);f<d;f++)s[f-1]=arguments[f];c[u].fn.apply(c[u].context,s)}}return!0},u.prototype.on=function(e,t,n){return l(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return l(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||s(this,i);else{for(var l=0,u=[],c=a.length;l<c;l++)(a[l].fn!==t||r&&!a[l].once||n&&a[l].context!==n)&&u.push(a[l]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=o,u.EventEmitter=u,e.exports=u},function(e,t,n){"use strict";var r=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,v={};function b(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||m}function y(){}function w(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||m}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=b.prototype;var S=w.prototype=new y;S.constructor=w,g(S,b.prototype),S.isPureReactComponent=!0;var x=Array.isArray,O=Object.prototype.hasOwnProperty,_={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,n){var o,i={},a=null,l=null;if(null!=t)for(o in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(a=""+t.key),t)O.call(t,o)&&!j.hasOwnProperty(o)&&(i[o]=t[o]);var s=arguments.length-2;if(1===s)i.children=n;else if(1<s){for(var u=Array(s),c=0;c<s;c++)u[c]=arguments[c+2];i.children=u}if(e&&e.defaultProps)for(o in s=e.defaultProps)void 0===i[o]&&(i[o]=s[o]);return{$$typeof:r,type:e,key:a,ref:l,props:i,_owner:_.current}}function k(e){return"object"===typeof e&&null!==e&&e.$$typeof===r}var E=/\/+/g;function T(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function N(e,t,n,i,a){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case r:case o:s=!0}}if(s)return a=a(s=e),e=""===i?"."+T(s,0):i,x(a)?(n="",null!=e&&(n=e.replace(E,"$&/")+"/"),N(a,t,n,"",(function(e){return e}))):null!=a&&(k(a)&&(a=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(E,"$&/")+"/")+e)),t.push(a)),1;if(s=0,i=""===i?".":i+":",x(e))for(var u=0;u<e.length;u++){var c=i+T(l=e[u],u);s+=N(l,t,n,c,a)}else if("function"===typeof(c=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e)))for(e=c.call(e),u=0;!(l=e.next()).done;)s+=N(l=l.value,t,n,c=i+T(l,u++),a);else if("object"===l)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function P(e,t,n){if(null==e)return e;var r=[],o=0;return N(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function I(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var R={current:null},A={transition:null},D={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:A,ReactCurrentOwner:_};t.Children={map:P,forEach:function(e,t,n){P(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=b,t.Fragment=i,t.Profiler=l,t.PureComponent=w,t.StrictMode=a,t.Suspense=d,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),i=e.key,a=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,l=_.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(u in t)O.call(t,u)&&!j.hasOwnProperty(u)&&(o[u]=void 0===t[u]&&void 0!==s?s[u]:t[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){s=Array(u);for(var c=0;c<u;c++)s[c]=arguments[c+2];o.children=s}return{$$typeof:r,type:e.type,key:i,ref:a,props:o,_owner:l}},t.createContext=function(e){return(e={$$typeof:u,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=k,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:I}},t.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=A.transition;A.transition={};try{e()}finally{A.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return R.current.useCallback(e,t)},t.useContext=function(e){return R.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return R.current.useDeferredValue(e)},t.useEffect=function(e,t){return R.current.useEffect(e,t)},t.useId=function(){return R.current.useId()},t.useImperativeHandle=function(e,t,n){return R.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return R.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return R.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return R.current.useMemo(e,t)},t.useReducer=function(e,t,n){return R.current.useReducer(e,t,n)},t.useRef=function(e){return R.current.useRef(e)},t.useState=function(e){return R.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return R.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return R.current.useTransition()},t.version="18.1.0"},function(e,t,n){"use strict";var r=n(2),o=n(21);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=new Set,l={};function s(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(l[e]=t,e=0;e<t.length;e++)a.add(t[e])}var c=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),d=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},h={};function m(e,t,n,r,o,i,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){g[e]=new m(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];g[t]=new m(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){g[e]=new m(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){g[e]=new m(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){g[e]=new m(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){g[e]=new m(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){g[e]=new m(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){g[e]=new m(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){g[e]=new m(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function y(e,t,n,r){var o=g.hasOwnProperty(t)?g[t]:null;(null!==o?0!==o.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!d.call(h,e)||!d.call(p,e)&&(f.test(e)?h[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!1,!1)})),g.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for("react.element"),x=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),k=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),I=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var R=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var A=Symbol.iterator;function D(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=A&&e[A]||e["@@iterator"])?e:null}var L,M=Object.assign;function z(e){if(void 0===L)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);L=t&&t[1]||""}return"\n"+L+e}var U=!1;function F(e,t){if(!e||U)return"";U=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&"string"===typeof u.stack){for(var o=u.stack.split("\n"),i=r.stack.split("\n"),a=o.length-1,l=i.length-1;1<=a&&0<=l&&o[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(o[a]!==i[l]){if(1!==a||1!==l)do{if(a--,0>--l||o[a]!==i[l]){var s="\n"+o[a].replace(" at new "," at ");return e.displayName&&s.includes("<anonymous>")&&(s=s.replace("<anonymous>",e.displayName)),s}}while(1<=a&&0<=l);break}}}finally{U=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?z(e):""}function B(e){switch(e.tag){case 5:return z(e.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return e=F(e.type,!1);case 11:return e=F(e.type.render,!1);case 1:return e=F(e.type,!0);default:return""}}function V(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case O:return"Fragment";case x:return"Portal";case j:return"Profiler";case _:return"StrictMode";case T:return"Suspense";case N:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case k:return(e.displayName||"Context")+".Consumer";case C:return(e._context.displayName||"Context")+".Provider";case E:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case P:return null!==(t=e.displayName||null)?t:V(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return V(e(t))}catch(n){}}return null}function W(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(t);case 8:return t===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t}return null}function H(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function G(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function q(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Y(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function K(e,t){var n=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Q(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=H(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function X(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function Z(e,t){X(e,t);var n=H(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,H(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function J(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&Y(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+H(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(i(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(i(92));if(te(n)){if(1<n.length)throw Error(i(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:H(n)}}function ie(e,t){var n=H(t.value),r=H(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ae(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function se(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?le(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ue,ce,de=(ce=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ue=ue||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ue.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ce(e,t)}))}:ce);function fe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},he=["Webkit","ms","Moz","O"];function me(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||pe.hasOwnProperty(e)&&pe[e]?(""+t).trim():t+"px"}function ge(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=me(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(pe).forEach((function(e){he.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pe[t]=pe[e]}))}));var ve=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function be(e,t){if(t){if(ve[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(i(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(i(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(i(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function Se(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var xe=null,Oe=null,_e=null;function je(e){if(e=vo(e)){if("function"!==typeof xe)throw Error(i(280));var t=e.stateNode;t&&(t=yo(t),xe(e.stateNode,e.type,t))}}function Ce(e){Oe?_e?_e.push(e):_e=[e]:Oe=e}function ke(){if(Oe){var e=Oe,t=_e;if(_e=Oe=null,je(e),t)for(e=0;e<t.length;e++)je(t[e])}}function Ee(e,t){return e(t)}function Te(){}var Ne=!1;function Pe(e,t,n){if(Ne)return e(t,n);Ne=!0;try{return Ee(e,t,n)}finally{Ne=!1,(null!==Oe||null!==_e)&&(Te(),ke())}}function Ie(e,t){var n=e.stateNode;if(null===n)return null;var r=yo(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw Error(i(231,t,typeof n));return n}var Re=!1;if(c)try{var Ae={};Object.defineProperty(Ae,"passive",{get:function(){Re=!0}}),window.addEventListener("test",Ae,Ae),window.removeEventListener("test",Ae,Ae)}catch(ce){Re=!1}function De(e,t,n,r,o,i,a,l,s){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var Le=!1,Me=null,ze=!1,Ue=null,Fe={onError:function(e){Le=!0,Me=e}};function Be(e,t,n,r,o,i,a,l,s){Le=!1,Me=null,De.apply(Fe,arguments)}function Ve(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function We(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function He(e){if(Ve(e)!==e)throw Error(i(188))}function $e(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ve(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var a=o.alternate;if(null===a){if(null!==(r=o.return)){n=r;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===n)return He(o),e;if(a===r)return He(o),t;a=a.sibling}throw Error(i(188))}if(n.return!==r.return)n=o,r=a;else{for(var l=!1,s=o.child;s;){if(s===n){l=!0,n=o,r=a;break}if(s===r){l=!0,r=o,n=a;break}s=s.sibling}if(!l){for(s=a.child;s;){if(s===n){l=!0,n=a,r=o;break}if(s===r){l=!0,r=a,n=o;break}s=s.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(e))?Ge(e):null}function Ge(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Ge(e);if(null!==t)return t;e=e.sibling}return null}var qe=o.unstable_scheduleCallback,Ye=o.unstable_cancelCallback,Ke=o.unstable_shouldYield,Qe=o.unstable_requestPaint,Xe=o.unstable_now,Ze=o.unstable_getCurrentPriorityLevel,Je=o.unstable_ImmediatePriority,et=o.unstable_UserBlockingPriority,tt=o.unstable_NormalPriority,nt=o.unstable_LowPriority,rt=o.unstable_IdlePriority,ot=null,it=null;var at=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(lt(e)/st|0)|0},lt=Math.log,st=Math.LN2;var ut=64,ct=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ft(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=268435455&n;if(0!==a){var l=a&~o;0!==l?r=dt(l):0!==(i&=a)&&(r=dt(i))}else 0!==(a=n&~o)?r=dt(a):0!==i&&(r=dt(i));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&o)&&((o=r&-r)>=(i=t&-t)||16===o&&0!==(4194240&i)))return t;if(0!==(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)o=1<<(n=31-at(t)),r|=e[n],t&=~o;return r}function pt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:default:return-1}}function ht(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function mt(){var e=ut;return 0===(4194240&(ut<<=1))&&(ut=64),e}function gt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-at(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-at(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var yt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var St,xt,Ot,_t,jt,Ct=!1,kt=[],Et=null,Tt=null,Nt=null,Pt=new Map,It=new Map,Rt=[],At="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Dt(e,t){switch(e){case"focusin":case"focusout":Et=null;break;case"dragenter":case"dragleave":Tt=null;break;case"mouseover":case"mouseout":Nt=null;break;case"pointerover":case"pointerout":Pt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":It.delete(t.pointerId)}}function Lt(e,t,n,r,o,i){return null===e||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},null!==t&&(null!==(t=vo(t))&&xt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==o&&-1===t.indexOf(o)&&t.push(o),e)}function Mt(e){var t=go(e.target);if(null!==t){var n=Ve(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=We(n)))return e.blockedOn=t,void jt(e.priority,(function(){Ot(n)}))}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function zt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Kt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=vo(n))&&xt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);we=r,n.target.dispatchEvent(r),we=null,t.shift()}return!0}function Ut(e,t,n){zt(e)&&n.delete(t)}function Ft(){Ct=!1,null!==Et&&zt(Et)&&(Et=null),null!==Tt&&zt(Tt)&&(Tt=null),null!==Nt&&zt(Nt)&&(Nt=null),Pt.forEach(Ut),It.forEach(Ut)}function Bt(e,t){e.blockedOn===t&&(e.blockedOn=null,Ct||(Ct=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Ft)))}function Vt(e){function t(t){return Bt(t,e)}if(0<kt.length){Bt(kt[0],e);for(var n=1;n<kt.length;n++){var r=kt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Et&&Bt(Et,e),null!==Tt&&Bt(Tt,e),null!==Nt&&Bt(Nt,e),Pt.forEach(t),It.forEach(t),n=0;n<Rt.length;n++)(r=Rt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Rt.length&&null===(n=Rt[0]).blockedOn;)Mt(n),null===n.blockedOn&&Rt.shift()}var Wt=w.ReactCurrentBatchConfig,Ht=!0;function $t(e,t,n,r){var o=yt,i=Wt.transition;Wt.transition=null;try{yt=1,qt(e,t,n,r)}finally{yt=o,Wt.transition=i}}function Gt(e,t,n,r){var o=yt,i=Wt.transition;Wt.transition=null;try{yt=4,qt(e,t,n,r)}finally{yt=o,Wt.transition=i}}function qt(e,t,n,r){if(Ht){var o=Kt(e,t,n,r);if(null===o)Br(e,t,r,Yt,n),Dt(e,r);else if(function(e,t,n,r,o){switch(t){case"focusin":return Et=Lt(Et,e,t,n,r,o),!0;case"dragenter":return Tt=Lt(Tt,e,t,n,r,o),!0;case"mouseover":return Nt=Lt(Nt,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Pt.set(i,Lt(Pt.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,It.set(i,Lt(It.get(i)||null,e,t,n,r,o)),!0}return!1}(o,e,t,n,r))r.stopPropagation();else if(Dt(e,r),4&t&&-1<At.indexOf(e)){for(;null!==o;){var i=vo(o);if(null!==i&&St(i),null===(i=Kt(e,t,n,r))&&Br(e,t,r,Yt,n),i===o)break;o=i}null!==o&&r.stopPropagation()}else Br(e,t,r,null,n)}}var Yt=null;function Kt(e,t,n,r){if(Yt=null,null!==(e=go(e=Se(r))))if(null===(t=Ve(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=We(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Qt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ze()){case Je:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Xt=null,Zt=null,Jt=null;function en(){if(Jt)return Jt;var e,t,n=Zt,r=n.length,o="value"in Xt?Xt.value:Xt.textContent,i=o.length;for(e=0;e<r&&n[e]===o[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===o[i-t];t++);return Jt=o.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,o,i){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=i,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(o):o[a]);return this.isDefaultPrevented=(null!=o.defaultPrevented?o.defaultPrevented:!1===o.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var an,ln,sn,un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cn=on(un),dn=M({},un,{view:0,detail:0}),fn=on(dn),pn=M({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_n,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==sn&&(sn&&"mousemove"===e.type?(an=e.screenX-sn.screenX,ln=e.screenY-sn.screenY):ln=an=0,sn=e),an)},movementY:function(e){return"movementY"in e?e.movementY:ln}}),hn=on(pn),mn=on(M({},pn,{dataTransfer:0})),gn=on(M({},dn,{relatedTarget:0})),vn=on(M({},un,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=on(M({},un,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),yn=on(M({},un,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function On(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=xn[e])&&!!t[e]}function _n(){return On}var jn=on(M({},dn,{key:function(e){if(e.key){var t=wn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Sn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_n,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),Cn=on(M({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=on(M({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_n})),En=on(M({},un,{propertyName:0,elapsedTime:0,pseudoElement:0})),Tn=on(M({},pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Nn=[9,13,27,32],Pn=c&&"CompositionEvent"in window,In=null;c&&"documentMode"in document&&(In=document.documentMode);var Rn=c&&"TextEvent"in window&&!In,An=c&&(!Pn||In&&8<In&&11>=In),Dn=String.fromCharCode(32),Ln=!1;function Mn(e,t){switch(e){case"keyup":return-1!==Nn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Un=!1;var Fn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Fn[e.type]:"textarea"===t}function Vn(e,t,n,r){Ce(r),0<(t=Wr(t,"onChange")).length&&(n=new cn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Wn=null,Hn=null;function $n(e){Dr(e,0)}function Gn(e){if(q(bo(e)))return e}function qn(e,t){if("change"===e)return t}var Yn=!1;if(c){var Kn;if(c){var Qn="oninput"in document;if(!Qn){var Xn=document.createElement("div");Xn.setAttribute("oninput","return;"),Qn="function"===typeof Xn.oninput}Kn=Qn}else Kn=!1;Yn=Kn&&(!document.documentMode||9<document.documentMode)}function Zn(){Wn&&(Wn.detachEvent("onpropertychange",Jn),Hn=Wn=null)}function Jn(e){if("value"===e.propertyName&&Gn(Hn)){var t=[];Vn(t,Hn,e,Se(e)),Pe($n,t)}}function er(e,t,n){"focusin"===e?(Zn(),Hn=n,(Wn=t).attachEvent("onpropertychange",Jn)):"focusout"===e&&Zn()}function tr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Gn(Hn)}function nr(e,t){if("click"===e)return Gn(t)}function rr(e,t){if("input"===e||"change"===e)return Gn(t)}var or="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function ir(e,t){if(or(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!d.call(t,o)||!or(e[o],t[o]))return!1}return!0}function ar(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function lr(e,t){var n,r=ar(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ar(r)}}function sr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?sr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ur(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Y((e=t.contentWindow).document)}return t}function cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function dr(e){var t=ur(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sr(n.ownerDocument.documentElement,n)){if(null!==r&&cr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=void 0===r.end?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=lr(n,i);var a=lr(n,r);o&&a&&(1!==e.rangeCount||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&((t=t.createRange()).setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var fr=c&&"documentMode"in document&&11>=document.documentMode,pr=null,hr=null,mr=null,gr=!1;function vr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;gr||null==pr||pr!==Y(r)||("selectionStart"in(r=pr)&&cr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},mr&&ir(mr,r)||(mr=r,0<(r=Wr(hr,"onSelect")).length&&(t=new cn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=pr)))}function br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var yr={animationend:br("Animation","AnimationEnd"),animationiteration:br("Animation","AnimationIteration"),animationstart:br("Animation","AnimationStart"),transitionend:br("Transition","TransitionEnd")},wr={},Sr={};function xr(e){if(wr[e])return wr[e];if(!yr[e])return e;var t,n=yr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Sr)return wr[e]=n[t];return e}c&&(Sr=document.createElement("div").style,"AnimationEvent"in window||(delete yr.animationend.animation,delete yr.animationiteration.animation,delete yr.animationstart.animation),"TransitionEvent"in window||delete yr.transitionend.transition);var Or=xr("animationend"),_r=xr("animationiteration"),jr=xr("animationstart"),Cr=xr("transitionend"),kr=new Map,Er="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Tr(e,t){kr.set(e,t),s(t,[e])}for(var Nr=0;Nr<Er.length;Nr++){var Pr=Er[Nr];Tr(Pr.toLowerCase(),"on"+(Pr[0].toUpperCase()+Pr.slice(1)))}Tr(Or,"onAnimationEnd"),Tr(_r,"onAnimationIteration"),Tr(jr,"onAnimationStart"),Tr("dblclick","onDoubleClick"),Tr("focusin","onFocus"),Tr("focusout","onBlur"),Tr(Cr,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ir="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Rr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ir));function Ar(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,o,a,l,s,u){if(Be.apply(this,arguments),Le){if(!Le)throw Error(i(198));var c=Me;Le=!1,Me=null,ze||(ze=!0,Ue=c)}}(r,t,void 0,e),e.currentTarget=null}function Dr(e,t){t=0!==(4&t);for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],s=l.instance,u=l.currentTarget;if(l=l.listener,s!==i&&o.isPropagationStopped())break e;Ar(o,l,u),i=s}else for(a=0;a<r.length;a++){if(s=(l=r[a]).instance,u=l.currentTarget,l=l.listener,s!==i&&o.isPropagationStopped())break e;Ar(o,l,u),i=s}}}if(ze)throw e=Ue,ze=!1,Ue=null,e}function Lr(e,t){var n=t[po];void 0===n&&(n=t[po]=new Set);var r=e+"__bubble";n.has(r)||(Fr(t,e,2,!1),n.add(r))}function Mr(e,t,n){var r=0;t&&(r|=4),Fr(n,e,r,t)}var zr="_reactListening"+Math.random().toString(36).slice(2);function Ur(e){if(!e[zr]){e[zr]=!0,a.forEach((function(t){"selectionchange"!==t&&(Rr.has(t)||Mr(t,!1,e),Mr(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[zr]||(t[zr]=!0,Mr("selectionchange",!1,t))}}function Fr(e,t,n,r){switch(Qt(t)){case 1:var o=$t;break;case 4:o=Gt;break;default:o=qt}n=o.bind(null,t,n,e),o=void 0,!Re||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(o=!0),r?void 0!==o?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):void 0!==o?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Br(e,t,n,r,o){var i=r;if(0===(1&t)&&0===(2&t)&&null!==r)e:for(;;){if(null===r)return;var a=r.tag;if(3===a||4===a){var l=r.stateNode.containerInfo;if(l===o||8===l.nodeType&&l.parentNode===o)break;if(4===a)for(a=r.return;null!==a;){var s=a.tag;if((3===s||4===s)&&((s=a.stateNode.containerInfo)===o||8===s.nodeType&&s.parentNode===o))return;a=a.return}for(;null!==l;){if(null===(a=go(l)))return;if(5===(s=a.tag)||6===s){r=i=a;continue e}l=l.parentNode}}r=r.return}Pe((function(){var r=i,o=Se(n),a=[];e:{var l=kr.get(e);if(void 0!==l){var s=cn,u=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":s=jn;break;case"focusin":u="focus",s=gn;break;case"focusout":u="blur",s=gn;break;case"beforeblur":case"afterblur":s=gn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":s=hn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":s=mn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":s=kn;break;case Or:case _r:case jr:s=vn;break;case Cr:s=En;break;case"scroll":s=fn;break;case"wheel":s=Tn;break;case"copy":case"cut":case"paste":s=bn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":s=Cn}var c=0!==(4&t),d=!c&&"scroll"===e,f=c?null!==l?l+"Capture":null:l;c=[];for(var p,h=r;null!==h;){var m=(p=h).stateNode;if(5===p.tag&&null!==m&&(p=m,null!==f&&(null!=(m=Ie(h,f))&&c.push(Vr(h,m,p)))),d)break;h=h.return}0<c.length&&(l=new s(l,u,null,n,o),a.push({event:l,listeners:c}))}}if(0===(7&t)){if(s="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||n===we||!(u=n.relatedTarget||n.fromElement)||!go(u)&&!u[fo])&&(s||l)&&(l=o.window===o?o:(l=o.ownerDocument)?l.defaultView||l.parentWindow:window,s?(s=r,null!==(u=(u=n.relatedTarget||n.toElement)?go(u):null)&&(u!==(d=Ve(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(s=null,u=r),s!==u)){if(c=hn,m="onMouseLeave",f="onMouseEnter",h="mouse","pointerout"!==e&&"pointerover"!==e||(c=Cn,m="onPointerLeave",f="onPointerEnter",h="pointer"),d=null==s?l:bo(s),p=null==u?l:bo(u),(l=new c(m,h+"leave",s,n,o)).target=d,l.relatedTarget=p,m=null,go(o)===r&&((c=new c(f,h+"enter",u,n,o)).target=p,c.relatedTarget=d,m=c),d=m,s&&u)e:{for(f=u,h=0,p=c=s;p;p=Hr(p))h++;for(p=0,m=f;m;m=Hr(m))p++;for(;0<h-p;)c=Hr(c),h--;for(;0<p-h;)f=Hr(f),p--;for(;h--;){if(c===f||null!==f&&c===f.alternate)break e;c=Hr(c),f=Hr(f)}c=null}else c=null;null!==s&&$r(a,l,s,c,!1),null!==u&&null!==d&&$r(a,d,u,c,!0)}if("select"===(s=(l=r?bo(r):window).nodeName&&l.nodeName.toLowerCase())||"input"===s&&"file"===l.type)var g=qn;else if(Bn(l))if(Yn)g=rr;else{g=tr;var v=er}else(s=l.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(g=nr);switch(g&&(g=g(e,r))?Vn(a,g,n,o):(v&&v(e,l,r),"focusout"===e&&(v=l._wrapperState)&&v.controlled&&"number"===l.type&&ee(l,"number",l.value)),v=r?bo(r):window,e){case"focusin":(Bn(v)||"true"===v.contentEditable)&&(pr=v,hr=r,mr=null);break;case"focusout":mr=hr=pr=null;break;case"mousedown":gr=!0;break;case"contextmenu":case"mouseup":case"dragend":gr=!1,vr(a,n,o);break;case"selectionchange":if(fr)break;case"keydown":case"keyup":vr(a,n,o)}var b;if(Pn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Un?Mn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(An&&"ko"!==n.locale&&(Un||"onCompositionStart"!==y?"onCompositionEnd"===y&&Un&&(b=en()):(Zt="value"in(Xt=o)?Xt.value:Xt.textContent,Un=!0)),0<(v=Wr(r,y)).length&&(y=new yn(y,e,null,n,o),a.push({event:y,listeners:v}),b?y.data=b:null!==(b=zn(n))&&(y.data=b))),(b=Rn?function(e,t){switch(e){case"compositionend":return zn(t);case"keypress":return 32!==t.which?null:(Ln=!0,Dn);case"textInput":return(e=t.data)===Dn&&Ln?null:e;default:return null}}(e,n):function(e,t){if(Un)return"compositionend"===e||!Pn&&Mn(e,t)?(e=en(),Jt=Zt=Xt=null,Un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return An&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))&&(0<(r=Wr(r,"onBeforeInput")).length&&(o=new yn("onBeforeInput","beforeinput",null,n,o),a.push({event:o,listeners:r}),o.data=b))}Dr(a,t)}))}function Vr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wr(e,t){for(var n=t+"Capture",r=[];null!==e;){var o=e,i=o.stateNode;5===o.tag&&null!==i&&(o=i,null!=(i=Ie(e,n))&&r.unshift(Vr(e,i,o)),null!=(i=Ie(e,t))&&r.push(Vr(e,i,o))),e=e.return}return r}function Hr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function $r(e,t,n,r,o){for(var i=t._reactName,a=[];null!==n&&n!==r;){var l=n,s=l.alternate,u=l.stateNode;if(null!==s&&s===r)break;5===l.tag&&null!==u&&(l=u,o?null!=(s=Ie(n,i))&&a.unshift(Vr(n,s,l)):o||null!=(s=Ie(n,i))&&a.push(Vr(n,s,l))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var Gr=/\r\n?/g,qr=/\u0000|\uFFFD/g;function Yr(e){return("string"===typeof e?e:""+e).replace(Gr,"\n").replace(qr,"")}function Kr(e,t,n){if(t=Yr(t),Yr(e)!==t&&n)throw Error(i(425))}function Qr(){}var Xr=null,Zr=null;function Jr(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var eo="function"===typeof setTimeout?setTimeout:void 0,to="function"===typeof clearTimeout?clearTimeout:void 0,no="function"===typeof Promise?Promise:void 0,ro="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof no?function(e){return no.resolve(null).then(e).catch(oo)}:eo;function oo(e){setTimeout((function(){throw e}))}function io(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0===r)return e.removeChild(o),void Vt(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=o}while(n);Vt(t)}function ao(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function lo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var so=Math.random().toString(36).slice(2),uo="__reactFiber$"+so,co="__reactProps$"+so,fo="__reactContainer$"+so,po="__reactEvents$"+so,ho="__reactListeners$"+so,mo="__reactHandles$"+so;function go(e){var t=e[uo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[fo]||n[uo]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=lo(e);null!==e;){if(n=e[uo])return n;e=lo(e)}return t}n=(e=n).parentNode}return null}function vo(e){return!(e=e[uo]||e[fo])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function bo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(i(33))}function yo(e){return e[co]||null}var wo=[],So=-1;function xo(e){return{current:e}}function Oo(e){0>So||(e.current=wo[So],wo[So]=null,So--)}function _o(e,t){So++,wo[So]=e.current,e.current=t}var jo={},Co=xo(jo),ko=xo(!1),Eo=jo;function To(e,t){var n=e.type.contextTypes;if(!n)return jo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function No(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Po(){Oo(ko),Oo(Co)}function Io(e,t,n){if(Co.current!==jo)throw Error(i(168));_o(Co,t),_o(ko,n)}function Ro(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in t))throw Error(i(108,W(e)||"Unknown",o));return M({},n,r)}function Ao(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||jo,Eo=Co.current,_o(Co,e),_o(ko,ko.current),!0}function Do(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=Ro(e,t,Eo),r.__reactInternalMemoizedMergedChildContext=e,Oo(ko),Oo(Co),_o(Co,e)):Oo(ko),_o(ko,n)}var Lo=null,Mo=!1,zo=!1;function Uo(e){null===Lo?Lo=[e]:Lo.push(e)}function Fo(){if(!zo&&null!==Lo){zo=!0;var e=0,t=yt;try{var n=Lo;for(yt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Lo=null,Mo=!1}catch(o){throw null!==Lo&&(Lo=Lo.slice(e+1)),qe(Je,Fo),o}finally{yt=t,zo=!1}}return null}var Bo=w.ReactCurrentBatchConfig;function Vo(e,t){if(e&&e.defaultProps){for(var n in t=M({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Wo=xo(null),Ho=null,$o=null,Go=null;function qo(){Go=$o=Ho=null}function Yo(e){var t=Wo.current;Oo(Wo),e._currentValue=t}function Ko(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Qo(e,t){Ho=e,Go=$o=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(bl=!0),e.firstContext=null)}function Xo(e){var t=e._currentValue;if(Go!==e)if(e={context:e,memoizedValue:t,next:null},null===$o){if(null===Ho)throw Error(i(308));$o=e,Ho.dependencies={lanes:0,firstContext:e}}else $o=$o.next=e;return t}var Zo=null,Jo=!1;function ei(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ti(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ni(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ri(e,t){var n=e.updateQueue;null!==n&&(n=n.shared,Zs(e)?(null===(e=n.interleaved)?(t.next=t,null===Zo?Zo=[n]:Zo.push(n)):(t.next=e.next,e.next=t),n.interleaved=t):(null===(e=n.pending)?t.next=t:(t.next=e.next,e.next=t),n.pending=t))}function oi(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}function ii(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var o=null,i=null;if(null!==(n=n.firstBaseUpdate)){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===i?o=i=a:i=i.next=a,n=n.next}while(null!==n);null===i?o=i=t:i=i.next=t}else o=i=t;return n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ai(e,t,n,r){var o=e.updateQueue;Jo=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,l=o.shared.pending;if(null!==l){o.shared.pending=null;var s=l,u=s.next;s.next=null,null===a?i=u:a.next=u,a=s;var c=e.alternate;null!==c&&((l=(c=c.updateQueue).lastBaseUpdate)!==a&&(null===l?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=s))}if(null!==i){var d=o.baseState;for(a=0,c=u=s=null,l=i;;){var f=l.lane,p=l.eventTime;if((r&f)===f){null!==c&&(c=c.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var h=e,m=l;switch(f=t,p=n,m.tag){case 1:if("function"===typeof(h=m.payload)){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=-65537&h.flags|128;case 0:if(null===(f="function"===typeof(h=m.payload)?h.call(p,d,f):h)||void 0===f)break e;d=M({},d,f);break e;case 2:Jo=!0}}null!==l.callback&&0!==l.lane&&(e.flags|=64,null===(f=o.effects)?o.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===c?(u=c=p,s=d):c=c.next=p,a|=f;if(null===(l=l.next)){if(null===(l=o.shared.pending))break;l=(f=l).next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}if(null===c&&(s=d),o.baseState=s,o.firstBaseUpdate=u,o.lastBaseUpdate=c,null!==(t=o.shared.interleaved)){o=t;do{a|=o.lane,o=o.next}while(o!==t)}else null===i&&(o.shared.lanes=0);Ns|=a,e.lanes=a,e.memoizedState=d}}function li(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=n,"function"!==typeof o)throw Error(i(191,o));o.call(r)}}}var si=(new r.Component).refs;function ui(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:M({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ci={isMounted:function(e){return!!(e=e._reactInternals)&&Ve(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ys(),o=Ks(e),i=ni(r,o);i.payload=t,void 0!==n&&null!==n&&(i.callback=n),ri(e,i),null!==(t=Qs(e,o,r))&&oi(t,e,o)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ys(),o=Ks(e),i=ni(r,o);i.tag=1,i.payload=t,void 0!==n&&null!==n&&(i.callback=n),ri(e,i),null!==(t=Qs(e,o,r))&&oi(t,e,o)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ys(),r=Ks(e),o=ni(n,r);o.tag=2,void 0!==t&&null!==t&&(o.callback=t),ri(e,o),null!==(t=Qs(e,r,n))&&oi(t,e,r)}};function di(e,t,n,r,o,i,a){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,a):!t.prototype||!t.prototype.isPureReactComponent||(!ir(n,r)||!ir(o,i))}function fi(e,t,n){var r=!1,o=jo,i=t.contextType;return"object"===typeof i&&null!==i?i=Xo(i):(o=No(t)?Eo:Co.current,i=(r=null!==(r=t.contextTypes)&&void 0!==r)?To(e,o):jo),t=new t(n,i),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ci,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function pi(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ci.enqueueReplaceState(t,t.state,null)}function hi(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=si,ei(e);var i=t.contextType;"object"===typeof i&&null!==i?o.context=Xo(i):(i=No(t)?Eo:Co.current,o.context=To(e,i)),o.state=e.memoizedState,"function"===typeof(i=t.getDerivedStateFromProps)&&(ui(e,t,i,n),o.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof o.getSnapshotBeforeUpdate||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||(t=o.state,"function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&ci.enqueueReplaceState(o,o.state,null),ai(e,n,o,r),o.state=e.memoizedState),"function"===typeof o.componentDidMount&&(e.flags|=4194308)}var mi=[],gi=0,vi=null,bi=0,yi=[],wi=0,Si=null,xi=1,Oi="";function _i(e,t){mi[gi++]=bi,mi[gi++]=vi,vi=e,bi=t}function ji(e,t,n){yi[wi++]=xi,yi[wi++]=Oi,yi[wi++]=Si,Si=e;var r=xi;e=Oi;var o=32-at(r)-1;r&=~(1<<o),n+=1;var i=32-at(t)+o;if(30<i){var a=o-o%5;i=(r&(1<<a)-1).toString(32),r>>=a,o-=a,xi=1<<32-at(t)+o|n<<o|r,Oi=i+e}else xi=1<<i|n<<o|r,Oi=e}function Ci(e){null!==e.return&&(_i(e,1),ji(e,1,0))}function ki(e){for(;e===vi;)vi=mi[--gi],mi[gi]=null,bi=mi[--gi],mi[gi]=null;for(;e===Si;)Si=yi[--wi],yi[wi]=null,Oi=yi[--wi],yi[wi]=null,xi=yi[--wi],yi[wi]=null}var Ei=null,Ti=null,Ni=!1,Pi=null;function Ii(e,t){var n=ku(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Ri(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,Ei=e,Ti=ao(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Ei=e,Ti=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Si?{id:xi,overflow:Oi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=ku(18,null,null,0)).stateNode=t,n.return=e,e.child=n,Ei=e,Ti=null,!0);default:return!1}}function Ai(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function Di(e){if(Ni){var t=Ti;if(t){var n=t;if(!Ri(e,t)){if(Ai(e))throw Error(i(418));t=ao(n.nextSibling);var r=Ei;t&&Ri(e,t)?Ii(r,n):(e.flags=-4097&e.flags|2,Ni=!1,Ei=e)}}else{if(Ai(e))throw Error(i(418));e.flags=-4097&e.flags|2,Ni=!1,Ei=e}}}function Li(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Ei=e}function Mi(e){if(e!==Ei)return!1;if(!Ni)return Li(e),Ni=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Jr(e.type,e.memoizedProps)),t&&(t=Ti)){if(Ai(e)){for(e=Ti;e;)e=ao(e.nextSibling);throw Error(i(418))}for(;t;)Ii(e,t),t=ao(t.nextSibling)}if(Li(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Ti=ao(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Ti=null}}else Ti=Ei?ao(e.stateNode.nextSibling):null;return!0}function zi(){Ti=Ei=null,Ni=!1}function Ui(e){null===Pi?Pi=[e]:Pi.push(e)}function Fi(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(i(309));var r=n.stateNode}if(!r)throw Error(i(147,e));var o=r,a=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===a?t.ref:((t=function(e){var t=o.refs;t===si&&(t=o.refs={}),null===e?delete t[a]:t[a]=e})._stringRef=a,t)}if("string"!==typeof e)throw Error(i(284));if(!n._owner)throw Error(i(290,e))}return e}function Bi(e,t){throw e=Object.prototype.toString.call(t),Error(i(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Vi(e){return(0,e._init)(e._payload)}function Wi(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Tu(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Ru(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function u(e,t,n,r){var i=n.type;return i===O?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===i||"object"===typeof i&&null!==i&&i.$$typeof===I&&Vi(i)===t.type)?((r=o(t,n.props)).ref=Fi(e,t,n),r.return=e,r):((r=Nu(n.type,n.key,n.props,null,e.mode,r)).ref=Fi(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Au(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,i){return null===t||7!==t.tag?((t=Pu(n,e.mode,r,i)).return=e,t):((t=o(t,n)).return=e,t)}function f(e,t,n){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Ru(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case S:return(n=Nu(t.type,t.key,t.props,null,e.mode,n)).ref=Fi(e,null,t),n.return=e,n;case x:return(t=Au(t,e.mode,n)).return=e,t;case I:return f(e,(0,t._init)(t._payload),n)}if(te(t)||D(t))return(t=Pu(t,e.mode,n,null)).return=e,t;Bi(e,t)}return null}function p(e,t,n,r){var o=null!==t?t.key:null;if("string"===typeof n&&""!==n||"number"===typeof n)return null!==o?null:s(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case S:return n.key===o?u(e,t,n,r):null;case x:return n.key===o?c(e,t,n,r):null;case I:return p(e,t,(o=n._init)(n._payload),r)}if(te(n)||D(n))return null!==o?null:d(e,t,n,r,null);Bi(e,n)}return null}function h(e,t,n,r,o){if("string"===typeof r&&""!==r||"number"===typeof r)return s(t,e=e.get(n)||null,""+r,o);if("object"===typeof r&&null!==r){switch(r.$$typeof){case S:return u(t,e=e.get(null===r.key?n:r.key)||null,r,o);case x:return c(t,e=e.get(null===r.key?n:r.key)||null,r,o);case I:return h(e,t,n,(0,r._init)(r._payload),o)}if(te(r)||D(r))return d(t,e=e.get(n)||null,r,o,null);Bi(t,r)}return null}function m(o,i,l,s){for(var u=null,c=null,d=i,m=i=0,g=null;null!==d&&m<l.length;m++){d.index>m?(g=d,d=null):g=d.sibling;var v=p(o,d,l[m],s);if(null===v){null===d&&(d=g);break}e&&d&&null===v.alternate&&t(o,d),i=a(v,i,m),null===c?u=v:c.sibling=v,c=v,d=g}if(m===l.length)return n(o,d),Ni&&_i(o,m),u;if(null===d){for(;m<l.length;m++)null!==(d=f(o,l[m],s))&&(i=a(d,i,m),null===c?u=d:c.sibling=d,c=d);return Ni&&_i(o,m),u}for(d=r(o,d);m<l.length;m++)null!==(g=h(d,o,m,l[m],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?m:g.key),i=a(g,i,m),null===c?u=g:c.sibling=g,c=g);return e&&d.forEach((function(e){return t(o,e)})),Ni&&_i(o,m),u}function g(o,l,s,u){var c=D(s);if("function"!==typeof c)throw Error(i(150));if(null==(s=c.call(s)))throw Error(i(151));for(var d=c=null,m=l,g=l=0,v=null,b=s.next();null!==m&&!b.done;g++,b=s.next()){m.index>g?(v=m,m=null):v=m.sibling;var y=p(o,m,b.value,u);if(null===y){null===m&&(m=v);break}e&&m&&null===y.alternate&&t(o,m),l=a(y,l,g),null===d?c=y:d.sibling=y,d=y,m=v}if(b.done)return n(o,m),Ni&&_i(o,g),c;if(null===m){for(;!b.done;g++,b=s.next())null!==(b=f(o,b.value,u))&&(l=a(b,l,g),null===d?c=b:d.sibling=b,d=b);return Ni&&_i(o,g),c}for(m=r(o,m);!b.done;g++,b=s.next())null!==(b=h(m,o,g,b.value,u))&&(e&&null!==b.alternate&&m.delete(null===b.key?g:b.key),l=a(b,l,g),null===d?c=b:d.sibling=b,d=b);return e&&m.forEach((function(e){return t(o,e)})),Ni&&_i(o,g),c}return function e(r,i,a,s){if("object"===typeof a&&null!==a&&a.type===O&&null===a.key&&(a=a.props.children),"object"===typeof a&&null!==a){switch(a.$$typeof){case S:e:{for(var u=a.key,c=i;null!==c;){if(c.key===u){if((u=a.type)===O){if(7===c.tag){n(r,c.sibling),(i=o(c,a.props.children)).return=r,r=i;break e}}else if(c.elementType===u||"object"===typeof u&&null!==u&&u.$$typeof===I&&Vi(u)===c.type){n(r,c.sibling),(i=o(c,a.props)).ref=Fi(r,c,a),i.return=r,r=i;break e}n(r,c);break}t(r,c),c=c.sibling}a.type===O?((i=Pu(a.props.children,r.mode,s,a.key)).return=r,r=i):((s=Nu(a.type,a.key,a.props,null,r.mode,s)).ref=Fi(r,i,a),s.return=r,r=s)}return l(r);case x:e:{for(c=a.key;null!==i;){if(i.key===c){if(4===i.tag&&i.stateNode.containerInfo===a.containerInfo&&i.stateNode.implementation===a.implementation){n(r,i.sibling),(i=o(i,a.children||[])).return=r,r=i;break e}n(r,i);break}t(r,i),i=i.sibling}(i=Au(a,r.mode,s)).return=r,r=i}return l(r);case I:return e(r,i,(c=a._init)(a._payload),s)}if(te(a))return m(r,i,a,s);if(D(a))return g(r,i,a,s);Bi(r,a)}return"string"===typeof a&&""!==a||"number"===typeof a?(a=""+a,null!==i&&6===i.tag?(n(r,i.sibling),(i=o(i,a)).return=r,r=i):(n(r,i),(i=Ru(a,r.mode,s)).return=r,r=i),l(r)):n(r,i)}}var Hi=Wi(!0),$i=Wi(!1),Gi={},qi=xo(Gi),Yi=xo(Gi),Ki=xo(Gi);function Qi(e){if(e===Gi)throw Error(i(174));return e}function Xi(e,t){switch(_o(Ki,t),_o(Yi,e),_o(qi,Gi),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:se(null,"");break;default:t=se(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Oo(qi),_o(qi,t)}function Zi(){Oo(qi),Oo(Yi),Oo(Ki)}function Ji(e){Qi(Ki.current);var t=Qi(qi.current),n=se(t,e.type);t!==n&&(_o(Yi,e),_o(qi,n))}function ea(e){Yi.current===e&&(Oo(qi),Oo(Yi))}var ta=xo(0);function na(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ra=[];function oa(){for(var e=0;e<ra.length;e++)ra[e]._workInProgressVersionPrimary=null;ra.length=0}var ia=w.ReactCurrentDispatcher,aa=w.ReactCurrentBatchConfig,la=0,sa=null,ua=null,ca=null,da=!1,fa=!1,pa=0,ha=0;function ma(){throw Error(i(321))}function ga(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!or(e[n],t[n]))return!1;return!0}function va(e,t,n,r,o,a){if(la=a,sa=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ia.current=null===e||null===e.memoizedState?el:tl,e=n(r,o),fa){a=0;do{if(fa=!1,pa=0,25<=a)throw Error(i(301));a+=1,ca=ua=null,t.updateQueue=null,ia.current=nl,e=n(r,o)}while(fa)}if(ia.current=Ja,t=null!==ua&&null!==ua.next,la=0,ca=ua=sa=null,da=!1,t)throw Error(i(300));return e}function ba(){var e=0!==pa;return pa=0,e}function ya(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ca?sa.memoizedState=ca=e:ca=ca.next=e,ca}function wa(){if(null===ua){var e=sa.alternate;e=null!==e?e.memoizedState:null}else e=ua.next;var t=null===ca?sa.memoizedState:ca.next;if(null!==t)ca=t,ua=e;else{if(null===e)throw Error(i(310));e={memoizedState:(ua=e).memoizedState,baseState:ua.baseState,baseQueue:ua.baseQueue,queue:ua.queue,next:null},null===ca?sa.memoizedState=ca=e:ca=ca.next=e}return ca}function Sa(e,t){return"function"===typeof t?t(e):t}function xa(e){var t=wa(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=ua,o=r.baseQueue,a=n.pending;if(null!==a){if(null!==o){var l=o.next;o.next=a.next,a.next=l}r.baseQueue=o=a,n.pending=null}if(null!==o){a=o.next,r=r.baseState;var s=l=null,u=null,c=a;do{var d=c.lane;if((la&d)===d)null!==u&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var f={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===u?(s=u=f,l=r):u=u.next=f,sa.lanes|=d,Ns|=d}c=c.next}while(null!==c&&c!==a);null===u?l=r:u.next=s,or(r,t.memoizedState)||(bl=!0),t.memoizedState=r,t.baseState=l,t.baseQueue=u,n.lastRenderedState=r}if(null!==(e=n.interleaved)){o=e;do{a=o.lane,sa.lanes|=a,Ns|=a,o=o.next}while(o!==e)}else null===o&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Oa(e){var t=wa(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(null!==o){n.pending=null;var l=o=o.next;do{a=e(a,l.action),l=l.next}while(l!==o);or(a,t.memoizedState)||(bl=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function _a(){}function ja(e,t){var n=sa,r=wa(),o=t(),a=!or(r.memoizedState,o);if(a&&(r.memoizedState=o,bl=!0),r=r.queue,La(Ea.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||null!==ca&&1&ca.memoizedState.tag){if(n.flags|=2048,Pa(9,ka.bind(null,n,r,o,t),void 0,null),null===Os)throw Error(i(349));0!==(30&la)||Ca(n,t,o)}return o}function Ca(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=sa.updateQueue)?(t={lastEffect:null,stores:null},sa.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function ka(e,t,n,r){t.value=n,t.getSnapshot=r,Ta(t)&&Qs(e,1,-1)}function Ea(e,t,n){return n((function(){Ta(t)&&Qs(e,1,-1)}))}function Ta(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!or(e,n)}catch(r){return!0}}function Na(e){var t=ya();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Sa,lastRenderedState:e},t.queue=e,e=e.dispatch=Ya.bind(null,sa,e),[t.memoizedState,e]}function Pa(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=sa.updateQueue)?(t={lastEffect:null,stores:null},sa.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ia(){return wa().memoizedState}function Ra(e,t,n,r){var o=ya();sa.flags|=e,o.memoizedState=Pa(1|t,n,void 0,void 0===r?null:r)}function Aa(e,t,n,r){var o=wa();r=void 0===r?null:r;var i=void 0;if(null!==ua){var a=ua.memoizedState;if(i=a.destroy,null!==r&&ga(r,a.deps))return void(o.memoizedState=Pa(t,n,i,r))}sa.flags|=e,o.memoizedState=Pa(1|t,n,i,r)}function Da(e,t){return Ra(8390656,8,e,t)}function La(e,t){return Aa(2048,8,e,t)}function Ma(e,t){return Aa(4,2,e,t)}function za(e,t){return Aa(4,4,e,t)}function Ua(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Fa(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Aa(4,4,Ua.bind(null,t,e),n)}function Ba(){}function Va(e,t){var n=wa();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ga(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Wa(e,t){var n=wa();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ga(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ha(e,t,n){return 0===(21&la)?(e.baseState&&(e.baseState=!1,bl=!0),e.memoizedState=n):(or(n,t)||(n=mt(),sa.lanes|=n,Ns|=n,e.baseState=!0),t)}function $a(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var r=aa.transition;aa.transition={};try{e(!1),t()}finally{yt=n,aa.transition=r}}function Ga(){return wa().memoizedState}function qa(e,t,n){var r=Ks(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ka(e)?Qa(t,n):(Xa(e,t,n),null!==(e=Qs(e,r,n=Ys()))&&Za(e,t,r))}function Ya(e,t,n){var r=Ks(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ka(e))Qa(t,o);else{Xa(e,t,o);var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var a=t.lastRenderedState,l=i(a,n);if(o.hasEagerState=!0,o.eagerState=l,or(l,a))return}catch(s){}null!==(e=Qs(e,r,n=Ys()))&&Za(e,t,r)}}function Ka(e){var t=e.alternate;return e===sa||null!==t&&t===sa}function Qa(e,t){fa=da=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xa(e,t,n){Zs(e)?(null===(e=t.interleaved)?(n.next=n,null===Zo?Zo=[t]:Zo.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(null===(e=t.pending)?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function Za(e,t,n){if(0!==(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}var Ja={readContext:Xo,useCallback:ma,useContext:ma,useEffect:ma,useImperativeHandle:ma,useInsertionEffect:ma,useLayoutEffect:ma,useMemo:ma,useReducer:ma,useRef:ma,useState:ma,useDebugValue:ma,useDeferredValue:ma,useTransition:ma,useMutableSource:ma,useSyncExternalStore:ma,useId:ma,unstable_isNewReconciler:!1},el={readContext:Xo,useCallback:function(e,t){return ya().memoizedState=[e,void 0===t?null:t],e},useContext:Xo,useEffect:Da,useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Ra(4194308,4,Ua.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ra(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ra(4,2,e,t)},useMemo:function(e,t){var n=ya();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ya();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=qa.bind(null,sa,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ya().memoizedState=e},useState:Na,useDebugValue:Ba,useDeferredValue:function(e){return ya().memoizedState=e},useTransition:function(){var e=Na(!1),t=e[0];return e=$a.bind(null,e[1]),ya().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=sa,o=ya();if(Ni){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===Os)throw Error(i(349));0!==(30&la)||Ca(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,Da(Ea.bind(null,r,a,e),[e]),r.flags|=2048,Pa(9,ka.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=ya(),t=Os.identifierPrefix;if(Ni){var n=Oi;t=":"+t+"R"+(n=(xi&~(1<<32-at(xi)-1)).toString(32)+n),0<(n=pa++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ha++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},tl={readContext:Xo,useCallback:Va,useContext:Xo,useEffect:La,useImperativeHandle:Fa,useInsertionEffect:Ma,useLayoutEffect:za,useMemo:Wa,useReducer:xa,useRef:Ia,useState:function(){return xa(Sa)},useDebugValue:Ba,useDeferredValue:function(e){return Ha(wa(),ua.memoizedState,e)},useTransition:function(){return[xa(Sa)[0],wa().memoizedState]},useMutableSource:_a,useSyncExternalStore:ja,useId:Ga,unstable_isNewReconciler:!1},nl={readContext:Xo,useCallback:Va,useContext:Xo,useEffect:La,useImperativeHandle:Fa,useInsertionEffect:Ma,useLayoutEffect:za,useMemo:Wa,useReducer:Oa,useRef:Ia,useState:function(){return Oa(Sa)},useDebugValue:Ba,useDeferredValue:function(e){var t=wa();return null===ua?t.memoizedState=e:Ha(t,ua.memoizedState,e)},useTransition:function(){return[Oa(Sa)[0],wa().memoizedState]},useMutableSource:_a,useSyncExternalStore:ja,useId:Ga,unstable_isNewReconciler:!1};function rl(e,t){try{var n="",r=t;do{n+=B(r),r=r.return}while(r);var o=n}catch(i){o="\nError generating stack: "+i.message+"\n"+i.stack}return{value:e,source:t,stack:o}}function ol(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}var il,al,ll,sl="function"===typeof WeakMap?WeakMap:Map;function ul(e,t,n){(n=ni(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){zs||(zs=!0,Us=r),ol(0,t)},n}function cl(e,t,n){(n=ni(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){ol(0,t)}}var i=e.stateNode;return null!==i&&"function"===typeof i.componentDidCatch&&(n.callback=function(){ol(0,t),"function"!==typeof r&&(null===Fs?Fs=new Set([this]):Fs.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function dl(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new sl;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Su.bind(null,e,t,n),t.then(e,e))}function fl(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function pl(e,t,n,r,o){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=ni(-1,1)).tag=2,ri(n,t))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}function hl(e,t){if(!Ni)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ml(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gl(e,t,n){var r=t.pendingProps;switch(ki(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ml(t),null;case 1:return No(t.type)&&Po(),ml(t),null;case 3:return r=t.stateNode,Zi(),Oo(ko),Oo(Co),oa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Mi(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==Pi&&(nu(Pi),Pi=null))),ml(t),null;case 5:ea(t);var o=Qi(Ki.current);if(n=t.type,null!==e&&null!=t.stateNode)al(e,t,n,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(i(166));return ml(t),null}if(e=Qi(qi.current),Mi(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[uo]=t,r[co]=a,e=0!==(1&t.mode),n){case"dialog":Lr("cancel",r),Lr("close",r);break;case"iframe":case"object":case"embed":Lr("load",r);break;case"video":case"audio":for(o=0;o<Ir.length;o++)Lr(Ir[o],r);break;case"source":Lr("error",r);break;case"img":case"image":case"link":Lr("error",r),Lr("load",r);break;case"details":Lr("toggle",r);break;case"input":Q(r,a),Lr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},Lr("invalid",r);break;case"textarea":oe(r,a),Lr("invalid",r)}for(var s in be(n,a),o=null,a)if(a.hasOwnProperty(s)){var u=a[s];"children"===s?"string"===typeof u?r.textContent!==u&&(!0!==a.suppressHydrationWarning&&Kr(r.textContent,u,e),o=["children",u]):"number"===typeof u&&r.textContent!==""+u&&(!0!==a.suppressHydrationWarning&&Kr(r.textContent,u,e),o=["children",""+u]):l.hasOwnProperty(s)&&null!=u&&"onScroll"===s&&Lr("scroll",r)}switch(n){case"input":G(r),J(r,a,!0);break;case"textarea":G(r),ae(r);break;case"select":case"option":break;default:"function"===typeof a.onClick&&(r.onclick=Qr)}r=o,t.updateQueue=r,null!==r&&(t.flags|=4)}else{s=9===o.nodeType?o:o.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=le(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=s.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),"select"===n&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[uo]=t,e[co]=r,il(e,t),t.stateNode=e;e:{switch(s=ye(n,r),n){case"dialog":Lr("cancel",e),Lr("close",e),o=r;break;case"iframe":case"object":case"embed":Lr("load",e),o=r;break;case"video":case"audio":for(o=0;o<Ir.length;o++)Lr(Ir[o],e);o=r;break;case"source":Lr("error",e),o=r;break;case"img":case"image":case"link":Lr("error",e),Lr("load",e),o=r;break;case"details":Lr("toggle",e),o=r;break;case"input":Q(e,r),o=K(e,r),Lr("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=M({},r,{value:void 0}),Lr("invalid",e);break;case"textarea":oe(e,r),o=re(e,r),Lr("invalid",e);break;default:o=r}for(a in be(n,o),u=o)if(u.hasOwnProperty(a)){var c=u[a];"style"===a?ge(e,c):"dangerouslySetInnerHTML"===a?null!=(c=c?c.__html:void 0)&&de(e,c):"children"===a?"string"===typeof c?("textarea"!==n||""!==c)&&fe(e,c):"number"===typeof c&&fe(e,""+c):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(l.hasOwnProperty(a)?null!=c&&"onScroll"===a&&Lr("scroll",e):null!=c&&y(e,a,c,s))}switch(n){case"input":G(e),J(e,r,!1);break;case"textarea":G(e),ae(e);break;case"option":null!=r.value&&e.setAttribute("value",""+H(r.value));break;case"select":e.multiple=!!r.multiple,null!=(a=r.value)?ne(e,!!r.multiple,a,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"===typeof o.onClick&&(e.onclick=Qr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return ml(t),null;case 6:if(e&&null!=t.stateNode)ll(0,t,e.memoizedProps,r);else{if("string"!==typeof r&&null===t.stateNode)throw Error(i(166));if(n=Qi(Ki.current),Qi(qi.current),Mi(t)){if(r=t.stateNode,n=t.memoizedProps,r[uo]=t,(a=r.nodeValue!==n)&&null!==(e=Ei))switch(e.tag){case 3:Kr(r.nodeValue,n,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Kr(r.nodeValue,n,0!==(1&e.mode))}a&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[uo]=t,t.stateNode=r}return ml(t),null;case 13:if(Oo(ta),r=t.memoizedState,Ni&&null!==Ti&&0!==(1&t.mode)&&0===(128&t.flags)){for(r=Ti;r;)r=ao(r.nextSibling);return zi(),t.flags|=98560,t}if(null!==r&&null!==r.dehydrated){if(r=Mi(t),null===e){if(!r)throw Error(i(318));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(i(317));r[uo]=t}else zi(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;return ml(t),null}return null!==Pi&&(nu(Pi),Pi=null),0!==(128&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?Mi(t):n=null!==e.memoizedState,r!==n&&r&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&ta.current)?0===Es&&(Es=3):du())),null!==t.updateQueue&&(t.flags|=4),ml(t),null);case 4:return Zi(),null===e&&Ur(t.stateNode.containerInfo),ml(t),null;case 10:return Yo(t.type._context),ml(t),null;case 17:return No(t.type)&&Po(),ml(t),null;case 19:if(Oo(ta),null===(a=t.memoizedState))return ml(t),null;if(r=0!==(128&t.flags),null===(s=a.rendering))if(r)hl(a,!1);else{if(0!==Es||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(s=na(e))){for(t.flags|=128,hl(a,!1),null!==(r=s.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(a=n).flags&=14680066,null===(s=a.alternate)?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=s.childLanes,a.lanes=s.lanes,a.child=s.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=s.memoizedProps,a.memoizedState=s.memoizedState,a.updateQueue=s.updateQueue,a.type=s.type,e=s.dependencies,a.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return _o(ta,1&ta.current|2),t.child}e=e.sibling}null!==a.tail&&Xe()>Ls&&(t.flags|=128,r=!0,hl(a,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=na(s))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),hl(a,!0),null===a.tail&&"hidden"===a.tailMode&&!s.alternate&&!Ni)return ml(t),null}else 2*Xe()-a.renderingStartTime>Ls&&1073741824!==n&&(t.flags|=128,r=!0,hl(a,!1),t.lanes=4194304);a.isBackwards?(s.sibling=t.child,t.child=s):(null!==(n=a.last)?n.sibling=s:t.child=s,a.last=s)}return null!==a.tail?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Xe(),t.sibling=null,n=ta.current,_o(ta,r?1&n|2:1&n),t):(ml(t),null);case 22:case 23:return lu(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!==(1&t.mode)?0!==(1073741824&Cs)&&(ml(t),6&t.subtreeFlags&&(t.flags|=8192)):ml(t),null;case 24:case 25:return null}throw Error(i(156,t.tag))}il=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},al=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Qi(qi.current);var i,a=null;switch(n){case"input":o=K(e,o),r=K(e,r),a=[];break;case"select":o=M({},o,{value:void 0}),r=M({},r,{value:void 0}),a=[];break;case"textarea":o=re(e,o),r=re(e,r),a=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(e.onclick=Qr)}for(c in be(n,r),n=null,o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&null!=o[c])if("style"===c){var s=o[c];for(i in s)s.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(l.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in r){var u=r[c];if(s=null!=o?o[c]:void 0,r.hasOwnProperty(c)&&u!==s&&(null!=u||null!=s))if("style"===c)if(s){for(i in s)!s.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&s[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(a||(a=[]),a.push(c,n)),n=u;else"dangerouslySetInnerHTML"===c?(u=u?u.__html:void 0,s=s?s.__html:void 0,null!=u&&s!==u&&(a=a||[]).push(c,u)):"children"===c?"string"!==typeof u&&"number"!==typeof u||(a=a||[]).push(c,""+u):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(l.hasOwnProperty(c)?(null!=u&&"onScroll"===c&&Lr("scroll",e),a||s===u||(a=[])):(a=a||[]).push(c,u))}n&&(a=a||[]).push("style",n);var c=a;(t.updateQueue=c)&&(t.flags|=4)}},ll=function(e,t,n,r){n!==r&&(t.flags|=4)};var vl=w.ReactCurrentOwner,bl=!1;function yl(e,t,n,r){t.child=null===e?$i(t,null,n,r):Hi(t,e.child,n,r)}function wl(e,t,n,r,o){n=n.render;var i=t.ref;return Qo(t,o),r=va(e,t,n,r,i,o),n=ba(),null===e||bl?(Ni&&n&&Ci(t),t.flags|=1,yl(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bl(e,t,o))}function Sl(e,t,n,r,o){if(null===e){var i=n.type;return"function"!==typeof i||Eu(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Nu(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,xl(e,t,i,r,o))}if(i=e.child,0===(e.lanes&o)){var a=i.memoizedProps;if((n=null!==(n=n.compare)?n:ir)(a,r)&&e.ref===t.ref)return Bl(e,t,o)}return t.flags|=1,(e=Tu(i,r)).ref=t.ref,e.return=t,t.child=e}function xl(e,t,n,r,o){if(null!==e){var i=e.memoizedProps;if(ir(i,r)&&e.ref===t.ref){if(bl=!1,t.pendingProps=r=i,0===(e.lanes&o))return t.lanes=e.lanes,Bl(e,t,o);0!==(131072&e.flags)&&(bl=!0)}}return jl(e,t,n,r,o)}function Ol(e,t,n){var r=t.pendingProps,o=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_o(ks,Cs),Cs|=n;else{if(0===(1073741824&n))return e=null!==i?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,_o(ks,Cs),Cs|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==i?i.baseLanes:n,_o(ks,Cs),Cs|=r}else null!==i?(r=i.baseLanes|n,t.memoizedState=null):r=n,_o(ks,Cs),Cs|=r;return yl(e,t,o,n),t.child}function _l(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function jl(e,t,n,r,o){var i=No(n)?Eo:Co.current;return i=To(t,i),Qo(t,o),n=va(e,t,n,r,i,o),r=ba(),null===e||bl?(Ni&&r&&Ci(t),t.flags|=1,yl(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bl(e,t,o))}function Cl(e,t,n,r,o){if(No(n)){var i=!0;Ao(t)}else i=!1;if(Qo(t,o),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),fi(t,n,r),hi(t,n,r,o),r=!0;else if(null===e){var a=t.stateNode,l=t.memoizedProps;a.props=l;var s=a.context,u=n.contextType;"object"===typeof u&&null!==u?u=Xo(u):u=To(t,u=No(n)?Eo:Co.current);var c=n.getDerivedStateFromProps,d="function"===typeof c||"function"===typeof a.getSnapshotBeforeUpdate;d||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(l!==r||s!==u)&&pi(t,a,r,u),Jo=!1;var f=t.memoizedState;a.state=f,ai(t,r,a,o),s=t.memoizedState,l!==r||f!==s||ko.current||Jo?("function"===typeof c&&(ui(t,n,c,r),s=t.memoizedState),(l=Jo||di(t,n,l,r,f,s,u))?(d||"function"!==typeof a.UNSAFE_componentWillMount&&"function"!==typeof a.componentWillMount||("function"===typeof a.componentWillMount&&a.componentWillMount(),"function"===typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"===typeof a.componentDidMount&&(t.flags|=4194308)):("function"===typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),a.props=r,a.state=s,a.context=u,r=l):("function"===typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ti(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Vo(t.type,l),a.props=u,d=t.pendingProps,f=a.context,"object"===typeof(s=n.contextType)&&null!==s?s=Xo(s):s=To(t,s=No(n)?Eo:Co.current);var p=n.getDerivedStateFromProps;(c="function"===typeof p||"function"===typeof a.getSnapshotBeforeUpdate)||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(l!==d||f!==s)&&pi(t,a,r,s),Jo=!1,f=t.memoizedState,a.state=f,ai(t,r,a,o);var h=t.memoizedState;l!==d||f!==h||ko.current||Jo?("function"===typeof p&&(ui(t,n,p,r),h=t.memoizedState),(u=Jo||di(t,n,u,r,f,h,s)||!1)?(c||"function"!==typeof a.UNSAFE_componentWillUpdate&&"function"!==typeof a.componentWillUpdate||("function"===typeof a.componentWillUpdate&&a.componentWillUpdate(r,h,s),"function"===typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,h,s)),"function"===typeof a.componentDidUpdate&&(t.flags|=4),"function"===typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof a.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!==typeof a.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),a.props=r,a.state=h,a.context=s,r=u):("function"!==typeof a.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!==typeof a.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return kl(e,t,n,r,i,o)}function kl(e,t,n,r,o,i){_l(e,t);var a=0!==(128&t.flags);if(!r&&!a)return o&&Do(t,n,!1),Bl(e,t,i);r=t.stateNode,vl.current=t;var l=a&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=Hi(t,e.child,null,i),t.child=Hi(t,null,l,i)):yl(e,t,l,i),t.memoizedState=r.state,o&&Do(t,n,!0),t.child}function El(e){var t=e.stateNode;t.pendingContext?Io(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Io(0,t.context,!1),Xi(e,t.containerInfo)}function Tl(e,t,n,r,o){return zi(),Ui(o),t.flags|=256,yl(e,t,n,r),t.child}var Nl={dehydrated:null,treeContext:null,retryLane:0};function Pl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Il(e,t){return{baseLanes:e.baseLanes|t,cachePool:null,transitions:e.transitions}}function Rl(e,t,n){var r,o=t.pendingProps,a=ta.current,l=!1,s=0!==(128&t.flags);if((r=s)||(r=(null===e||null!==e.memoizedState)&&0!==(2&a)),r?(l=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),_o(ta,1&a),null===e)return Di(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(a=o.children,e=o.fallback,l?(o=t.mode,l=t.child,a={mode:"hidden",children:a},0===(1&o)&&null!==l?(l.childLanes=0,l.pendingProps=a):l=Iu(a,o,0,null),e=Pu(e,o,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Pl(n),t.memoizedState=Nl,e):Al(t,a));if(null!==(a=e.memoizedState)){if(null!==(r=a.dehydrated)){if(s)return 256&t.flags?(t.flags&=-257,Ml(e,t,n,Error(i(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(l=o.fallback,a=t.mode,o=Iu({mode:"visible",children:o.children},a,0,null),(l=Pu(l,a,n,null)).flags|=2,o.return=t,l.return=t,o.sibling=l,t.child=o,0!==(1&t.mode)&&Hi(t,e.child,null,n),t.child.memoizedState=Pl(n),t.memoizedState=Nl,l);if(0===(1&t.mode))t=Ml(e,t,n,null);else if("$!"===r.data)t=Ml(e,t,n,Error(i(419)));else if(o=0!==(n&e.childLanes),bl||o){if(null!==(o=Os)){switch(n&-n){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}0!==(o=0!==(l&(o.suspendedLanes|n))?0:l)&&o!==a.retryLane&&(a.retryLane=o,Qs(e,o,-1))}du(),t=Ml(e,t,n,Error(i(421)))}else"$?"===r.data?(t.flags|=128,t.child=e.child,t=Ou.bind(null,e),r._reactRetry=t,t=null):(n=a.treeContext,Ti=ao(r.nextSibling),Ei=t,Ni=!0,Pi=null,null!==n&&(yi[wi++]=xi,yi[wi++]=Oi,yi[wi++]=Si,xi=n.id,Oi=n.overflow,Si=t),(t=Al(t,t.pendingProps.children)).flags|=4096);return t}return l?(o=Ll(e,t,o.children,o.fallback,n),l=t.child,a=e.child.memoizedState,l.memoizedState=null===a?Pl(n):Il(a,n),l.childLanes=e.childLanes&~n,t.memoizedState=Nl,o):(n=Dl(e,t,o.children,n),t.memoizedState=null,n)}return l?(o=Ll(e,t,o.children,o.fallback,n),l=t.child,a=e.child.memoizedState,l.memoizedState=null===a?Pl(n):Il(a,n),l.childLanes=e.childLanes&~n,t.memoizedState=Nl,o):(n=Dl(e,t,o.children,n),t.memoizedState=null,n)}function Al(e,t){return(t=Iu({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Dl(e,t,n,r){var o=e.child;return e=o.sibling,n=Tu(o,{mode:"visible",children:n}),0===(1&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n}function Ll(e,t,n,r,o){var i=t.mode,a=(e=e.child).sibling,l={mode:"hidden",children:n};return 0===(1&i)&&t.child!==e?((n=t.child).childLanes=0,n.pendingProps=l,t.deletions=null):(n=Tu(e,l)).subtreeFlags=14680064&e.subtreeFlags,null!==a?r=Tu(a,r):(r=Pu(r,i,o,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function Ml(e,t,n,r){return null!==r&&Ui(r),Hi(t,e.child,null,n),(e=Al(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function zl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Ko(e.return,t,n)}function Ul(e,t,n,r,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function Fl(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(yl(e,t,r.children,n),0!==(2&(r=ta.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&zl(e,n,t);else if(19===e.tag)zl(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(_o(ta,r),0===(1&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===na(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Ul(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===na(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Ul(t,!0,n,null,i);break;case"together":Ul(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ns|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Tu(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Tu(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Vl(e,t){switch(ki(t),t.tag){case 1:return No(t.type)&&Po(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Zi(),Oo(ko),Oo(Co),oa(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return ea(t),null;case 13:if(Oo(ta),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));zi()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Oo(ta),null;case 4:return Zi(),null;case 10:return Yo(t.type._context),null;case 22:case 23:return lu(),null;case 24:default:return null}}var Wl=!1,Hl=!1,$l="function"===typeof WeakSet?WeakSet:Set,Gl=null;function ql(e,t){var n=e.ref;if(null!==n)if("function"===typeof n)try{n(null)}catch(r){wu(e,t,r)}else n.current=null}function Yl(e,t,n){try{n()}catch(r){wu(e,t,r)}}var Kl=!1;function Ql(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,void 0!==i&&Yl(t,n,i)}o=o.next}while(o!==r)}}function Xl(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Zl(e){var t=e.ref;if(null!==t){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}"function"===typeof t?t(e):t.current=e}}function Jl(e){var t=e.alternate;null!==t&&(e.alternate=null,Jl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[uo],delete t[co],delete t[po],delete t[ho],delete t[mo])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function es(e){return 5===e.tag||3===e.tag||4===e.tag}function ts(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||es(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ns(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=Qr));else if(4!==r&&null!==(e=e.child))for(ns(e,t,n),e=e.sibling;null!==e;)ns(e,t,n),e=e.sibling}function rs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(rs(e,t,n),e=e.sibling;null!==e;)rs(e,t,n),e=e.sibling}var os=null,is=!1;function as(e,t,n){for(n=n.child;null!==n;)ls(e,t,n),n=n.sibling}function ls(e,t,n){if(it&&"function"===typeof it.onCommitFiberUnmount)try{it.onCommitFiberUnmount(ot,n)}catch(l){}switch(n.tag){case 5:Hl||ql(n,t);case 6:var r=os,o=is;os=null,as(e,t,n),is=o,null!==(os=r)&&(is?(e=os,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):os.removeChild(n.stateNode));break;case 18:null!==os&&(is?(e=os,n=n.stateNode,8===e.nodeType?io(e.parentNode,n):1===e.nodeType&&io(e,n),Vt(e)):io(os,n.stateNode));break;case 4:r=os,o=is,os=n.stateNode.containerInfo,is=!0,as(e,t,n),os=r,is=o;break;case 0:case 11:case 14:case 15:if(!Hl&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,void 0!==a&&(0!==(2&i)||0!==(4&i))&&Yl(n,t,a),o=o.next}while(o!==r)}as(e,t,n);break;case 1:if(!Hl&&(ql(n,t),"function"===typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){wu(n,t,l)}as(e,t,n);break;case 21:as(e,t,n);break;case 22:1&n.mode?(Hl=(r=Hl)||null!==n.memoizedState,as(e,t,n),Hl=r):as(e,t,n);break;default:as(e,t,n)}}function ss(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new $l),t.forEach((function(t){var r=_u.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function us(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r];try{var a=e,l=t,s=l;e:for(;null!==s;){switch(s.tag){case 5:os=s.stateNode,is=!1;break e;case 3:case 4:os=s.stateNode.containerInfo,is=!0;break e}s=s.return}if(null===os)throw Error(i(160));ls(a,l,o),os=null,is=!1;var u=o.alternate;null!==u&&(u.return=null),o.return=null}catch(c){wu(o,t,c)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)cs(t,e),t=t.sibling}function cs(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(us(t,e),ds(e),4&r){try{Ql(3,e,e.return),Xl(3,e)}catch(m){wu(e,e.return,m)}try{Ql(5,e,e.return)}catch(m){wu(e,e.return,m)}}break;case 1:us(t,e),ds(e),512&r&&null!==n&&ql(n,n.return);break;case 5:if(us(t,e),ds(e),512&r&&null!==n&&ql(n,n.return),32&e.flags){var o=e.stateNode;try{fe(o,"")}catch(m){wu(e,e.return,m)}}if(4&r&&null!=(o=e.stateNode)){var a=e.memoizedProps,l=null!==n?n.memoizedProps:a,s=e.type,u=e.updateQueue;if(e.updateQueue=null,null!==u)try{"input"===s&&"radio"===a.type&&null!=a.name&&X(o,a),ye(s,l);var c=ye(s,a);for(l=0;l<u.length;l+=2){var d=u[l],f=u[l+1];"style"===d?ge(o,f):"dangerouslySetInnerHTML"===d?de(o,f):"children"===d?fe(o,f):y(o,d,f,c)}switch(s){case"input":Z(o,a);break;case"textarea":ie(o,a);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!a.multiple;var h=a.value;null!=h?ne(o,!!a.multiple,h,!1):p!==!!a.multiple&&(null!=a.defaultValue?ne(o,!!a.multiple,a.defaultValue,!0):ne(o,!!a.multiple,a.multiple?[]:"",!1))}o[co]=a}catch(m){wu(e,e.return,m)}}break;case 6:if(us(t,e),ds(e),4&r){if(null===e.stateNode)throw Error(i(162));c=e.stateNode,d=e.memoizedProps;try{c.nodeValue=d}catch(m){wu(e,e.return,m)}}break;case 3:if(us(t,e),ds(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Vt(t.containerInfo)}catch(m){wu(e,e.return,m)}break;case 4:us(t,e),ds(e);break;case 13:us(t,e),ds(e),8192&(c=e.child).flags&&null!==c.memoizedState&&(null===c.alternate||null===c.alternate.memoizedState)&&(Ds=Xe()),4&r&&ss(e);break;case 22:if(c=null!==n&&null!==n.memoizedState,1&e.mode?(Hl=(d=Hl)||c,us(t,e),Hl=d):us(t,e),ds(e),8192&r){d=null!==e.memoizedState;e:for(f=null,p=e;;){if(5===p.tag){if(null===f){f=p;try{o=p.stateNode,d?"function"===typeof(a=o.style).setProperty?a.setProperty("display","none","important"):a.display="none":(s=p.stateNode,l=void 0!==(u=p.memoizedProps.style)&&null!==u&&u.hasOwnProperty("display")?u.display:null,s.style.display=me("display",l))}catch(m){wu(e,e.return,m)}}}else if(6===p.tag){if(null===f)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(m){wu(e,e.return,m)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===e)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;null===p.sibling;){if(null===p.return||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}if(d&&!c&&0!==(1&e.mode))for(Gl=e,e=e.child;null!==e;){for(c=Gl=e;null!==Gl;){switch(f=(d=Gl).child,d.tag){case 0:case 11:case 14:case 15:Ql(4,d,d.return);break;case 1:if(ql(d,d.return),"function"===typeof(a=d.stateNode).componentWillUnmount){p=d,h=d.return;try{o=p,a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(m){wu(p,h,m)}}break;case 5:ql(d,d.return);break;case 22:if(null!==d.memoizedState){ms(c);continue}}null!==f?(f.return=d,Gl=f):ms(c)}e=e.sibling}}break;case 19:us(t,e),ds(e),4&r&&ss(e);break;case 21:break;default:us(t,e),ds(e)}}function ds(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(es(n)){var r=n;break e}n=n.return}throw Error(i(160))}switch(r.tag){case 5:var o=r.stateNode;32&r.flags&&(fe(o,""),r.flags&=-33),rs(e,ts(e),o);break;case 3:case 4:var a=r.stateNode.containerInfo;ns(e,ts(e),a);break;default:throw Error(i(161))}}catch(l){wu(e,e.return,l)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function fs(e,t,n){Gl=e,ps(e,t,n)}function ps(e,t,n){for(var r=0!==(1&e.mode);null!==Gl;){var o=Gl,i=o.child;if(22===o.tag&&r){var a=null!==o.memoizedState||Wl;if(!a){var l=o.alternate,s=null!==l&&null!==l.memoizedState||Hl;l=Wl;var u=Hl;if(Wl=a,(Hl=s)&&!u)for(Gl=o;null!==Gl;)s=(a=Gl).child,22===a.tag&&null!==a.memoizedState?gs(o):null!==s?(s.return=a,Gl=s):gs(o);for(;null!==i;)Gl=i,ps(i,t,n),i=i.sibling;Gl=o,Wl=l,Hl=u}hs(e)}else 0!==(8772&o.subtreeFlags)&&null!==i?(i.return=o,Gl=i):hs(e)}}function hs(e){for(;null!==Gl;){var t=Gl;if(0!==(8772&t.flags)){var n=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Hl||Xl(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Hl)if(null===n)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Vo(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;null!==a&&li(t,a,r);break;case 3:var l=t.updateQueue;if(null!==l){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}li(t,l,n)}break;case 5:var s=t.stateNode;if(null===n&&4&t.flags){n=s;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:case 4:case 12:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var d=c.memoizedState;if(null!==d){var f=d.dehydrated;null!==f&&Vt(f)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(i(163))}Hl||512&t.flags&&Zl(t)}catch(p){wu(t,t.return,p)}}if(t===e){Gl=null;break}if(null!==(n=t.sibling)){n.return=t.return,Gl=n;break}Gl=t.return}}function ms(e){for(;null!==Gl;){var t=Gl;if(t===e){Gl=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Gl=n;break}Gl=t.return}}function gs(e){for(;null!==Gl;){var t=Gl;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Xl(4,t)}catch(s){wu(t,n,s)}break;case 1:var r=t.stateNode;if("function"===typeof r.componentDidMount){var o=t.return;try{r.componentDidMount()}catch(s){wu(t,o,s)}}var i=t.return;try{Zl(t)}catch(s){wu(t,i,s)}break;case 5:var a=t.return;try{Zl(t)}catch(s){wu(t,a,s)}}}catch(s){wu(t,t.return,s)}if(t===e){Gl=null;break}var l=t.sibling;if(null!==l){l.return=t.return,Gl=l;break}Gl=t.return}}var vs,bs=Math.ceil,ys=w.ReactCurrentDispatcher,ws=w.ReactCurrentOwner,Ss=w.ReactCurrentBatchConfig,xs=0,Os=null,_s=null,js=0,Cs=0,ks=xo(0),Es=0,Ts=null,Ns=0,Ps=0,Is=0,Rs=null,As=null,Ds=0,Ls=1/0,Ms=null,zs=!1,Us=null,Fs=null,Bs=!1,Vs=null,Ws=0,Hs=0,$s=null,Gs=-1,qs=0;function Ys(){return 0!==(6&xs)?Xe():-1!==Gs?Gs:Gs=Xe()}function Ks(e){return 0===(1&e.mode)?1:0!==(2&xs)&&0!==js?js&-js:null!==Bo.transition?(0===qs&&(qs=mt()),qs):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Qt(e.type)}function Qs(e,t,n){if(50<Hs)throw Hs=0,$s=null,Error(i(185));var r=Xs(e,t);return null===r?null:(vt(r,t,n),0!==(2&xs)&&r===Os||(r===Os&&(0===(2&xs)&&(Ps|=t),4===Es&&ru(r,js)),Js(r,n),1===t&&0===xs&&0===(1&e.mode)&&(Ls=Xe()+500,Mo&&Fo())),r)}function Xs(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function Zs(e){return(null!==Os||null!==Zo)&&0!==(1&e.mode)&&0===(2&xs)}function Js(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-at(i),l=1<<a,s=o[a];-1===s?0!==(l&n)&&0===(l&r)||(o[a]=pt(l,t)):s<=t&&(e.expiredLanes|=l),i&=~l}}(e,t);var r=ft(e,e===Os?js:0);if(0===r)null!==n&&Ye(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ye(n),1===t)0===e.tag?function(e){Mo=!0,Uo(e)}(ou.bind(null,e)):Uo(ou.bind(null,e)),ro((function(){0===xs&&Fo()})),n=null;else{switch(wt(r)){case 1:n=Je;break;case 4:n=et;break;case 16:n=tt;break;case 536870912:n=rt;break;default:n=tt}n=ju(n,eu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function eu(e,t){if(Gs=-1,qs=0,0!==(6&xs))throw Error(i(327));var n=e.callbackNode;if(bu()&&e.callbackNode!==n)return null;var r=ft(e,e===Os?js:0);if(0===r)return null;if(0!==(30&r)||0!==(r&e.expiredLanes)||t)t=fu(e,r);else{t=r;var o=xs;xs|=2;var a=cu();for(Os===e&&js===t||(Ms=null,Ls=Xe()+500,su(e,t));;)try{hu();break}catch(s){uu(e,s)}qo(),ys.current=a,xs=o,null!==_s?t=0:(Os=null,js=0,t=Es)}if(0!==t){if(2===t&&(0!==(o=ht(e))&&(r=o,t=tu(e,o))),1===t)throw n=Ts,su(e,0),ru(e,r),Js(e,Xe()),n;if(6===t)ru(e,r);else{if(o=e.current.alternate,0===(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!or(i(),o))return!1}catch(l){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(o)&&(2===(t=fu(e,r))&&(0!==(a=ht(e))&&(r=a,t=tu(e,a))),1===t))throw n=Ts,su(e,0),ru(e,r),Js(e,Xe()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(i(345));case 2:vu(e,As,Ms);break;case 3:if(ru(e,r),(130023424&r)===r&&10<(t=Ds+500-Xe())){if(0!==ft(e,0))break;if(((o=e.suspendedLanes)&r)!==r){Ys(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=eo(vu.bind(null,e,As,Ms),t);break}vu(e,As,Ms);break;case 4:if(ru(e,r),(4194240&r)===r)break;for(t=e.eventTimes,o=-1;0<r;){var l=31-at(r);a=1<<l,(l=t[l])>o&&(o=l),r&=~a}if(r=o,10<(r=(120>(r=Xe()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*bs(r/1960))-r)){e.timeoutHandle=eo(vu.bind(null,e,As,Ms),r);break}vu(e,As,Ms);break;case 5:vu(e,As,Ms);break;default:throw Error(i(329))}}}return Js(e,Xe()),e.callbackNode===n?eu.bind(null,e):null}function tu(e,t){var n=Rs;return e.current.memoizedState.isDehydrated&&(su(e,t).flags|=256),2!==(e=fu(e,t))&&(t=As,As=n,null!==t&&nu(t)),e}function nu(e){null===As?As=e:As.push.apply(As,e)}function ru(e,t){for(t&=~Is,t&=~Ps,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-at(t),r=1<<n;e[n]=-1,t&=~r}}function ou(e){if(0!==(6&xs))throw Error(i(327));bu();var t=ft(e,0);if(0===(1&t))return Js(e,Xe()),null;var n=fu(e,t);if(0!==e.tag&&2===n){var r=ht(e);0!==r&&(t=r,n=tu(e,r))}if(1===n)throw n=Ts,su(e,0),ru(e,t),Js(e,Xe()),n;if(6===n)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vu(e,As,Ms),Js(e,Xe()),null}function iu(e,t){var n=xs;xs|=1;try{return e(t)}finally{0===(xs=n)&&(Ls=Xe()+500,Mo&&Fo())}}function au(e){null!==Vs&&0===Vs.tag&&0===(6&xs)&&bu();var t=xs;xs|=1;var n=Ss.transition,r=yt;try{if(Ss.transition=null,yt=1,e)return e()}finally{yt=r,Ss.transition=n,0===(6&(xs=t))&&Fo()}}function lu(){Cs=ks.current,Oo(ks)}function su(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,to(n)),null!==_s)for(n=_s.return;null!==n;){var r=n;switch(ki(r),r.tag){case 1:null!==(r=r.type.childContextTypes)&&void 0!==r&&Po();break;case 3:Zi(),Oo(ko),Oo(Co),oa();break;case 5:ea(r);break;case 4:Zi();break;case 13:case 19:Oo(ta);break;case 10:Yo(r.type._context);break;case 22:case 23:lu()}n=n.return}if(Os=e,_s=e=Tu(e.current,null),js=Cs=t,Es=0,Ts=null,Is=Ps=Ns=0,As=Rs=null,null!==Zo){for(t=0;t<Zo.length;t++)if(null!==(r=(n=Zo[t]).interleaved)){n.interleaved=null;var o=r.next,i=n.pending;if(null!==i){var a=i.next;i.next=o,r.next=a}n.pending=r}Zo=null}return e}function uu(e,t){for(;;){var n=_s;try{if(qo(),ia.current=Ja,da){for(var r=sa.memoizedState;null!==r;){var o=r.queue;null!==o&&(o.pending=null),r=r.next}da=!1}if(la=0,ca=ua=sa=null,fa=!1,pa=0,ws.current=null,null===n||null===n.return){Es=1,Ts=t,_s=null;break}e:{var a=e,l=n.return,s=n,u=t;if(t=js,s.flags|=32768,null!==u&&"object"===typeof u&&"function"===typeof u.then){var c=u,d=s,f=d.tag;if(0===(1&d.mode)&&(0===f||11===f||15===f)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=fl(l);if(null!==h){h.flags&=-257,pl(h,l,s,0,t),1&h.mode&&dl(a,c,t),u=c;var m=(t=h).updateQueue;if(null===m){var g=new Set;g.add(u),t.updateQueue=g}else m.add(u);break e}if(0===(1&t)){dl(a,c,t),du();break e}u=Error(i(426))}else if(Ni&&1&s.mode){var v=fl(l);if(null!==v){0===(65536&v.flags)&&(v.flags|=256),pl(v,l,s,0,t),Ui(u);break e}}a=u,4!==Es&&(Es=2),null===Rs?Rs=[a]:Rs.push(a),u=rl(u,s),s=l;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,ii(s,ul(0,u,t));break e;case 1:a=u;var b=s.type,y=s.stateNode;if(0===(128&s.flags)&&("function"===typeof b.getDerivedStateFromError||null!==y&&"function"===typeof y.componentDidCatch&&(null===Fs||!Fs.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t,ii(s,cl(s,a,t));break e}}s=s.return}while(null!==s)}gu(n)}catch(w){t=w,_s===n&&null!==n&&(_s=n=n.return);continue}break}}function cu(){var e=ys.current;return ys.current=Ja,null===e?Ja:e}function du(){0!==Es&&3!==Es&&2!==Es||(Es=4),null===Os||0===(268435455&Ns)&&0===(268435455&Ps)||ru(Os,js)}function fu(e,t){var n=xs;xs|=2;var r=cu();for(Os===e&&js===t||(Ms=null,su(e,t));;)try{pu();break}catch(o){uu(e,o)}if(qo(),xs=n,ys.current=r,null!==_s)throw Error(i(261));return Os=null,js=0,Es}function pu(){for(;null!==_s;)mu(_s)}function hu(){for(;null!==_s&&!Ke();)mu(_s)}function mu(e){var t=vs(e.alternate,e,Cs);e.memoizedProps=e.pendingProps,null===t?gu(e):_s=t,ws.current=null}function gu(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(n=gl(n,t,Cs)))return void(_s=n)}else{if(null!==(n=Vl(n,t)))return n.flags&=32767,void(_s=n);if(null===e)return Es=6,void(_s=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(_s=t);_s=t=e}while(null!==t);0===Es&&(Es=5)}function vu(e,t,n){var r=yt,o=Ss.transition;try{Ss.transition=null,yt=1,function(e,t,n,r){do{bu()}while(null!==Vs);if(0!==(6&xs))throw Error(i(327));n=e.finishedWork;var o=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-at(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}(e,a),e===Os&&(_s=Os=null,js=0),0===(2064&n.subtreeFlags)&&0===(2064&n.flags)||Bs||(Bs=!0,ju(tt,(function(){return bu(),null}))),a=0!==(15990&n.flags),0!==(15990&n.subtreeFlags)||a){a=Ss.transition,Ss.transition=null;var l=yt;yt=1;var s=xs;xs|=4,ws.current=null,function(e,t){if(Xr=Ht,cr(e=ur())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch(x){n=null;break e}var l=0,s=-1,u=-1,c=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||0!==o&&3!==f.nodeType||(s=l+o),f!==a||0!==r&&3!==f.nodeType||(u=l+r),3===f.nodeType&&(l+=f.nodeValue.length),null!==(h=f.firstChild);)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++c===o&&(s=l),p===a&&++d===r&&(u=l),null!==(h=f.nextSibling))break;p=(f=p).parentNode}f=h}n=-1===s||-1===u?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zr={focusedElem:e,selectionRange:n},Ht=!1,Gl=t;null!==Gl;)if(e=(t=Gl).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Gl=e;else for(;null!==Gl;){t=Gl;try{var m=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:break;case 1:if(null!==m){var g=m.memoizedProps,v=m.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?g:Vo(t.type,g),v);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;if(1===w.nodeType)w.textContent="";else if(9===w.nodeType){var S=w.body;null!=S&&(S.textContent="")}break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(x){wu(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Gl=e;break}Gl=t.return}m=Kl,Kl=!1}(e,n),cs(n,e),dr(Zr),Ht=!!Xr,Zr=Xr=null,e.current=n,fs(n,e,o),Qe(),xs=s,yt=l,Ss.transition=a}else e.current=n;if(Bs&&(Bs=!1,Vs=e,Ws=o),0===(a=e.pendingLanes)&&(Fs=null),function(e){if(it&&"function"===typeof it.onCommitFiberRoot)try{it.onCommitFiberRoot(ot,e,void 0,128===(128&e.current.flags))}catch(t){}}(n.stateNode),Js(e,Xe()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)r(t[n]);if(zs)throw zs=!1,e=Us,Us=null,e;0!==(1&Ws)&&0!==e.tag&&bu(),0!==(1&(a=e.pendingLanes))?e===$s?Hs++:(Hs=0,$s=e):Hs=0,Fo()}(e,t,n,r)}finally{Ss.transition=o,yt=r}return null}function bu(){if(null!==Vs){var e=wt(Ws),t=Ss.transition,n=yt;try{if(Ss.transition=null,yt=16>e?16:e,null===Vs)var r=!1;else{if(e=Vs,Vs=null,Ws=0,0!==(6&xs))throw Error(i(331));var o=xs;for(xs|=4,Gl=e.current;null!==Gl;){var a=Gl,l=a.child;if(0!==(16&Gl.flags)){var s=a.deletions;if(null!==s){for(var u=0;u<s.length;u++){var c=s[u];for(Gl=c;null!==Gl;){var d=Gl;switch(d.tag){case 0:case 11:case 15:Ql(8,d,a)}var f=d.child;if(null!==f)f.return=d,Gl=f;else for(;null!==Gl;){var p=(d=Gl).sibling,h=d.return;if(Jl(d),d===c){Gl=null;break}if(null!==p){p.return=h,Gl=p;break}Gl=h}}}var m=a.alternate;if(null!==m){var g=m.child;if(null!==g){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}Gl=a}}if(0!==(2064&a.subtreeFlags)&&null!==l)l.return=a,Gl=l;else e:for(;null!==Gl;){if(0!==(2048&(a=Gl).flags))switch(a.tag){case 0:case 11:case 15:Ql(9,a,a.return)}var b=a.sibling;if(null!==b){b.return=a.return,Gl=b;break e}Gl=a.return}}var y=e.current;for(Gl=y;null!==Gl;){var w=(l=Gl).child;if(0!==(2064&l.subtreeFlags)&&null!==w)w.return=l,Gl=w;else e:for(l=y;null!==Gl;){if(0!==(2048&(s=Gl).flags))try{switch(s.tag){case 0:case 11:case 15:Xl(9,s)}}catch(x){wu(s,s.return,x)}if(s===l){Gl=null;break e}var S=s.sibling;if(null!==S){S.return=s.return,Gl=S;break e}Gl=s.return}}if(xs=o,Fo(),it&&"function"===typeof it.onPostCommitFiberRoot)try{it.onPostCommitFiberRoot(ot,e)}catch(x){}r=!0}return r}finally{yt=n,Ss.transition=t}}return!1}function yu(e,t,n){ri(e,t=ul(0,t=rl(n,t),1)),t=Ys(),null!==(e=Xs(e,1))&&(vt(e,1,t),Js(e,t))}function wu(e,t,n){if(3===e.tag)yu(e,e,n);else for(;null!==t;){if(3===t.tag){yu(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===Fs||!Fs.has(r))){ri(t,e=cl(t,e=rl(n,e),1)),e=Ys(),null!==(t=Xs(t,1))&&(vt(t,1,e),Js(t,e));break}}t=t.return}}function Su(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Ys(),e.pingedLanes|=e.suspendedLanes&n,Os===e&&(js&n)===n&&(4===Es||3===Es&&(130023424&js)===js&&500>Xe()-Ds?su(e,0):Is|=n),Js(e,t)}function xu(e,t){0===t&&(0===(1&e.mode)?t=1:(t=ct,0===(130023424&(ct<<=1))&&(ct=4194304)));var n=Ys();null!==(e=Xs(e,t))&&(vt(e,t,n),Js(e,n))}function Ou(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),xu(e,n)}function _u(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}null!==r&&r.delete(t),xu(e,n)}function ju(e,t){return qe(e,t)}function Cu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ku(e,t,n,r){return new Cu(e,t,n,r)}function Eu(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Tu(e,t){var n=e.alternate;return null===n?((n=ku(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Nu(e,t,n,r,o,a){var l=2;if(r=e,"function"===typeof e)Eu(e)&&(l=1);else if("string"===typeof e)l=5;else e:switch(e){case O:return Pu(n.children,o,a,t);case _:l=8,o|=8;break;case j:return(e=ku(12,n,t,2|o)).elementType=j,e.lanes=a,e;case T:return(e=ku(13,n,t,o)).elementType=T,e.lanes=a,e;case N:return(e=ku(19,n,t,o)).elementType=N,e.lanes=a,e;case R:return Iu(n,o,a,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case k:l=9;break e;case E:l=11;break e;case P:l=14;break e;case I:l=16,r=null;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=ku(l,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Pu(e,t,n,r){return(e=ku(7,e,r,t)).lanes=n,e}function Iu(e,t,n,r){return(e=ku(22,e,r,t)).elementType=R,e.lanes=n,e.stateNode={},e}function Ru(e,t,n){return(e=ku(6,e,null,t)).lanes=n,e}function Au(e,t,n){return(t=ku(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Du(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gt(0),this.expirationTimes=gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lu(e,t,n,r,o,i,a,l,s){return e=new Du(e,t,n,l,s),1===t?(t=1,!0===i&&(t|=8)):t=0,i=ku(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ei(i),e}function Mu(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:x,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function zu(e){if(!e)return jo;e:{if(Ve(e=e._reactInternals)!==e||1!==e.tag)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(No(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(i(171))}if(1===e.tag){var n=e.type;if(No(n))return Ro(e,n,t)}return t}function Uu(e,t,n,r,o,i,a,l,s){return(e=Lu(n,r,!0,e,0,i,0,l,s)).context=zu(null),n=e.current,(i=ni(r=Ys(),o=Ks(n))).callback=void 0!==t&&null!==t?t:null,ri(n,i),e.current.lanes=o,vt(e,o,r),Js(e,r),e}function Fu(e,t,n,r){var o=t.current,i=Ys(),a=Ks(o);return n=zu(n),null===t.context?t.context=n:t.pendingContext=n,(t=ni(i,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),ri(o,t),null!==(e=Qs(o,a,i))&&oi(e,o,a),a}function Bu(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function Vu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Wu(e,t){Vu(e,t),(e=e.alternate)&&Vu(e,t)}vs=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||ko.current)bl=!0;else{if(0===(e.lanes&n)&&0===(128&t.flags))return bl=!1,function(e,t,n){switch(t.tag){case 3:El(t),zi();break;case 5:Ji(t);break;case 1:No(t.type)&&Ao(t);break;case 4:Xi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;_o(Wo,r._currentValue),r._currentValue=o;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(_o(ta,1&ta.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Rl(e,t,n):(_o(ta,1&ta.current),null!==(e=Bl(e,t,n))?e.sibling:null);_o(ta,1&ta.current);break;case 19:if(r=0!==(n&t.childLanes),0!==(128&e.flags)){if(r)return Fl(e,t,n);t.flags|=128}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),_o(ta,ta.current),r)break;return null;case 22:case 23:return t.lanes=0,Ol(e,t,n)}return Bl(e,t,n)}(e,t,n);bl=0!==(131072&e.flags)}else bl=!1,Ni&&0!==(1048576&t.flags)&&ji(t,bi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps;var o=To(t,Co.current);Qo(t,n),o=va(null,t,r,e,o,n);var a=ba();return t.flags|=1,"object"===typeof o&&null!==o&&"function"===typeof o.render&&void 0===o.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,No(r)?(a=!0,Ao(t)):a=!1,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,ei(t),o.updater=ci,t.stateNode=o,o._reactInternals=t,hi(t,r,e,n),t=kl(null,t,r,!0,a,n)):(t.tag=0,Ni&&a&&Ci(t),yl(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,r=(o=r._init)(r._payload),t.type=r,o=t.tag=function(e){if("function"===typeof e)return Eu(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===E)return 11;if(e===P)return 14}return 2}(r),e=Vo(r,e),o){case 0:t=jl(null,t,r,e,n);break e;case 1:t=Cl(null,t,r,e,n);break e;case 11:t=wl(null,t,r,e,n);break e;case 14:t=Sl(null,t,r,Vo(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,jl(e,t,r,o=t.elementType===r?o:Vo(r,o),n);case 1:return r=t.type,o=t.pendingProps,Cl(e,t,r,o=t.elementType===r?o:Vo(r,o),n);case 3:e:{if(El(t),null===e)throw Error(i(387));r=t.pendingProps,o=(a=t.memoizedState).element,ti(e,t),ai(t,r,null,n);var l=t.memoizedState;if(r=l.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=Tl(e,t,r,n,o=Error(i(423)));break e}if(r!==o){t=Tl(e,t,r,n,o=Error(i(424)));break e}for(Ti=ao(t.stateNode.containerInfo.firstChild),Ei=t,Ni=!0,Pi=null,n=$i(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(zi(),r===o){t=Bl(e,t,n);break e}yl(e,t,r,n)}t=t.child}return t;case 5:return Ji(t),null===e&&Di(t),r=t.type,o=t.pendingProps,a=null!==e?e.memoizedProps:null,l=o.children,Jr(r,o)?l=null:null!==a&&Jr(r,a)&&(t.flags|=32),_l(e,t),yl(e,t,l,n),t.child;case 6:return null===e&&Di(t),null;case 13:return Rl(e,t,n);case 4:return Xi(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Hi(t,null,r,n):yl(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,wl(e,t,r,o=t.elementType===r?o:Vo(r,o),n);case 7:return yl(e,t,t.pendingProps,n),t.child;case 8:case 12:return yl(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,a=t.memoizedProps,l=o.value,_o(Wo,r._currentValue),r._currentValue=l,null!==a)if(or(a.value,l)){if(a.children===o.children&&!ko.current){t=Bl(e,t,n);break e}}else for(null!==(a=t.child)&&(a.return=t);null!==a;){var s=a.dependencies;if(null!==s){l=a.child;for(var u=s.firstContext;null!==u;){if(u.context===r){if(1===a.tag){(u=ni(-1,n&-n)).tag=2;var c=a.updateQueue;if(null!==c){var d=(c=c.shared).pending;null===d?u.next=u:(u.next=d.next,d.next=u),c.pending=u}}a.lanes|=n,null!==(u=a.alternate)&&(u.lanes|=n),Ko(a.return,n,t),s.lanes|=n;break}u=u.next}}else if(10===a.tag)l=a.type===t.type?null:a.child;else if(18===a.tag){if(null===(l=a.return))throw Error(i(341));l.lanes|=n,null!==(s=l.alternate)&&(s.lanes|=n),Ko(l,n,t),l=a.sibling}else l=a.child;if(null!==l)l.return=a;else for(l=a;null!==l;){if(l===t){l=null;break}if(null!==(a=l.sibling)){a.return=l.return,l=a;break}l=l.return}a=l}yl(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Qo(t,n),r=r(o=Xo(o)),t.flags|=1,yl(e,t,r,n),t.child;case 14:return o=Vo(r=t.type,t.pendingProps),Sl(e,t,r,o=Vo(r.type,o),n);case 15:return xl(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Vo(r,o),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,No(r)?(e=!0,Ao(t)):e=!1,Qo(t,n),fi(t,r,o),hi(t,r,o,n),kl(null,t,r,!0,e,n);case 19:return Fl(e,t,n);case 22:return Ol(e,t,n)}throw Error(i(156,t.tag))};var Hu="function"===typeof reportError?reportError:function(e){console.error(e)};function $u(e){this._internalRoot=e}function Gu(e){this._internalRoot=e}function qu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Yu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ku(){}function Qu(e,t,n,r,o){var i=n._reactRootContainer;if(i){var a=i;if("function"===typeof o){var l=o;o=function(){var e=Bu(a);l.call(e)}}Fu(t,a,e,o)}else a=function(e,t,n,r,o){if(o){if("function"===typeof r){var i=r;r=function(){var e=Bu(a);i.call(e)}}var a=Uu(t,r,e,0,null,!1,0,"",Ku);return e._reactRootContainer=a,e[fo]=a.current,Ur(8===e.nodeType?e.parentNode:e),au(),a}for(;o=e.lastChild;)e.removeChild(o);if("function"===typeof r){var l=r;r=function(){var e=Bu(s);l.call(e)}}var s=Lu(e,0,!1,null,0,!1,0,"",Ku);return e._reactRootContainer=s,e[fo]=s.current,Ur(8===e.nodeType?e.parentNode:e),au((function(){Fu(t,s,n,r)})),s}(n,t,e,o,r);return Bu(a)}Gu.prototype.render=$u.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(i(409));Fu(e,t,null,null)},Gu.prototype.unmount=$u.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;au((function(){Fu(null,e,null,null)})),t[fo]=null}},Gu.prototype.unstable_scheduleHydration=function(e){if(e){var t=_t();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rt.length&&0!==t&&t<Rt[n].priority;n++);Rt.splice(n,0,e),0===n&&Mt(e)}},St=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(bt(t,1|n),Js(t,Xe()),0===(6&xs)&&(Ls=Xe()+500,Fo()))}break;case 13:var r=Ys();au((function(){return Qs(e,1,r)})),Wu(e,1)}},xt=function(e){13===e.tag&&(Qs(e,134217728,Ys()),Wu(e,134217728))},Ot=function(e){if(13===e.tag){var t=Ys(),n=Ks(e);Qs(e,n,t),Wu(e,n)}},_t=function(){return yt},jt=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},xe=function(e,t,n){switch(t){case"input":if(Z(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=yo(r);if(!o)throw Error(i(90));q(r),Z(r,o)}}}break;case"textarea":ie(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Ee=iu,Te=au;var Xu={usingClientEntryPoint:!1,Events:[vo,bo,yo,Ce,ke,iu]},Zu={findFiberByHostInstance:go,bundleType:0,version:"18.1.0",rendererPackageName:"react-dom"},Ju={bundleType:Zu.bundleType,version:Zu.version,rendererPackageName:Zu.rendererPackageName,rendererConfig:Zu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=$e(e))?null:e.stateNode},findFiberByHostInstance:Zu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.1.0-next-22edb9f77-20220426"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ec=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ec.isDisabled&&ec.supportsFiber)try{ot=ec.inject(Ju),it=ec}catch(ce){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!qu(t))throw Error(i(200));return Mu(e,t,null,n)},t.createRoot=function(e,t){if(!qu(e))throw Error(i(299));var n=!1,r="",o=Hu;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=Lu(e,1,!1,null,0,n,0,r,o),e[fo]=t.current,Ur(8===e.nodeType?e.parentNode:e),new $u(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(i(188));throw e=Object.keys(e).join(","),Error(i(268,e))}return e=null===(e=$e(t))?null:e.stateNode},t.flushSync=function(e){return au(e)},t.hydrate=function(e,t,n){if(!Yu(t))throw Error(i(200));return Qu(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!qu(e))throw Error(i(405));var r=null!=n&&n.hydratedSources||null,o=!1,a="",l=Hu;if(null!==n&&void 0!==n&&(!0===n.unstable_strictMode&&(o=!0),void 0!==n.identifierPrefix&&(a=n.identifierPrefix),void 0!==n.onRecoverableError&&(l=n.onRecoverableError)),t=Uu(t,null,e,1,null!=n?n:null,o,0,a,l),e[fo]=t.current,Ur(e),r)for(e=0;e<r.length;e++)o=(o=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Gu(t)},t.render=function(e,t,n){if(!Yu(t))throw Error(i(200));return Qu(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Yu(e))throw Error(i(40));return!!e._reactRootContainer&&(au((function(){Qu(null,null,e,!1,(function(){e._reactRootContainer=null,e[fo]=null}))})),!0)},t.unstable_batchedUpdates=iu,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yu(n))throw Error(i(200));if(null==e||void 0===e._reactInternals)throw Error(i(38));return Qu(e,t,n,!1,r)},t.version="18.1.0-next-22edb9f77-20220426"},function(e,t,n){"use strict";e.exports=n(22)},function(e,t,n){"use strict";(function(e){function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function r(e){return 0===e.length?null:e[0]}function o(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],u=l+1,c=e[u];if(0>i(s,n))u<o&&0>i(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(u<o&&0>i(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var a=performance;t.unstable_now=function(){return a.now()}}else{var l=Date,s=l.now();t.unstable_now=function(){return l.now()-s}}var u=[],c=[],d=1,f=null,p=3,h=!1,m=!1,g=!1,v="function"===typeof setTimeout?setTimeout:null,b="function"===typeof clearTimeout?clearTimeout:null,y="undefined"!==typeof e?e:null;function w(e){for(var t=r(c);null!==t;){if(null===t.callback)o(c);else{if(!(t.startTime<=e))break;o(c),t.sortIndex=t.expirationTime,n(u,t)}t=r(c)}}function S(e){if(g=!1,w(e),!m)if(null!==r(u))m=!0,R(x);else{var t=r(c);null!==t&&A(S,t.startTime-e)}}function x(e,n){m=!1,g&&(g=!1,b(C),C=-1),h=!0;var i=p;try{for(w(n),f=r(u);null!==f&&(!(f.expirationTime>n)||e&&!T());){var a=f.callback;if("function"===typeof a){f.callback=null,p=f.priorityLevel;var l=a(f.expirationTime<=n);n=t.unstable_now(),"function"===typeof l?f.callback=l:f===r(u)&&o(u),w(n)}else o(u);f=r(u)}if(null!==f)var s=!0;else{var d=r(c);null!==d&&A(S,d.startTime-n),s=!1}return s}finally{f=null,p=i,h=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var O,_=!1,j=null,C=-1,k=5,E=-1;function T(){return!(t.unstable_now()-E<k)}function N(){if(null!==j){var e=t.unstable_now();E=e;var n=!0;try{n=j(!0,e)}finally{n?O():(_=!1,j=null)}}else _=!1}if("function"===typeof y)O=function(){y(N)};else if("undefined"!==typeof MessageChannel){var P=new MessageChannel,I=P.port2;P.port1.onmessage=N,O=function(){I.postMessage(null)}}else O=function(){v(N,0)};function R(e){j=e,_||(_=!0,O())}function A(e,n){C=v((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||h||(m=!0,R(x))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(u)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,o,i){var a=t.unstable_now();switch("object"===typeof i&&null!==i?i="number"===typeof(i=i.delay)&&0<i?a+i:a:i=a,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return e={id:d++,callback:o,priorityLevel:e,startTime:i,expirationTime:l=i+l,sortIndex:-1},i>a?(e.sortIndex=i,n(c,e),null===r(u)&&e===r(c)&&(g?(b(C),C=-1):g=!0,A(S,i-a))):(e.sortIndex=l,n(u,e),m||h||(m=!0,R(x))),e},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}}).call(this,n(23).setImmediate)},function(e,t,n){(function(e){var r="undefined"!==typeof e&&e||"undefined"!==typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(24),t.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(6))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o=1,i={},a=!1,l=e.document,s=Object.getPrototypeOf&&Object.getPrototypeOf(e);s=s&&s.setTimeout?s:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){c(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"===typeof n.data&&0===n.data.indexOf(t)&&c(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){c(e.data)},r=function(t){e.port2.postMessage(t)}}():l&&"onreadystatechange"in l.createElement("script")?function(){var e=l.documentElement;r=function(t){var n=l.createElement("script");n.onreadystatechange=function(){c(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(c,0,e)},s.setImmediate=function(e){"function"!==typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return i[o]=a,r(o),o++},s.clearImmediate=u}function u(e){delete i[e]}function c(e){if(a)setTimeout(c,0,e);else{var t=i[e];if(t){a=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{u(e),a=!1}}}}}("undefined"===typeof self?"undefined"===typeof e?this:e:self)}).call(this,n(6),n(7))},function(e,t,n){"use strict";var r=n(2);var o="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},i=r.useState,a=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(r){return!0}}var c="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return l((function(){o.value=n,o.getSnapshot=t,u(o)&&c({inst:o})}),[e,n,t]),a((function(){return u(o)&&c({inst:o}),e((function(){u(o)&&c({inst:o})}))}),[e]),s(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},function(e,t,n){"use strict";var r=n(2),o=n(8);var i="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},a=o.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==o&&f.hasValue){var t=f.value;if(o(t,e))return l=t}return l=e}if(t=l,i(a,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(a=e,l=n)}var a,l,s=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]}),[t,n,r,o]);var p=a(e,d[0],d[1]);return s((function(){f.hasValue=!0,f.value=p}),[p]),c(p),p}},function(e,t,n){"use strict";e.exports=n(28)},function(e,t,n){"use strict";var r="function"===typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,l=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,u=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,d=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,v=r?Symbol.for("react.lazy"):60116,b=r?Symbol.for("react.block"):60121,y=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,S=r?Symbol.for("react.scope"):60119;function x(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case d:case f:case a:case s:case l:case h:return e;default:switch(e=e&&e.$$typeof){case c:case p:case v:case g:case u:return e;default:return t}}case i:return t}}}function O(e){return x(e)===f}t.AsyncMode=d,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=u,t.Element=o,t.ForwardRef=p,t.Fragment=a,t.Lazy=v,t.Memo=g,t.Portal=i,t.Profiler=s,t.StrictMode=l,t.Suspense=h,t.isAsyncMode=function(e){return O(e)||x(e)===d},t.isConcurrentMode=O,t.isContextConsumer=function(e){return x(e)===c},t.isContextProvider=function(e){return x(e)===u},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===v},t.isMemo=function(e){return x(e)===g},t.isPortal=function(e){return x(e)===i},t.isProfiler=function(e){return x(e)===s},t.isStrictMode=function(e){return x(e)===l},t.isSuspense=function(e){return x(e)===h},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===a||e===f||e===s||e===l||e===h||e===m||"object"===typeof e&&null!==e&&(e.$$typeof===v||e.$$typeof===g||e.$$typeof===u||e.$$typeof===c||e.$$typeof===p||e.$$typeof===y||e.$$typeof===w||e.$$typeof===S||e.$$typeof===b)},t.typeOf=x},function(e,t,n){"use strict";var r,o=Symbol.for("react.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.server_context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen");function b(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case a:case s:case l:case p:case h:return e;default:switch(e=e&&e.$$typeof){case d:case c:case f:case g:case m:case u:return e;default:return t}}case i:return t}}}r=Symbol.for("react.module.reference"),t.ContextConsumer=c,t.ContextProvider=u,t.Element=o,t.ForwardRef=f,t.Fragment=a,t.Lazy=g,t.Memo=m,t.Portal=i,t.Profiler=s,t.StrictMode=l,t.Suspense=p,t.SuspenseList=h,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return b(e)===c},t.isContextProvider=function(e){return b(e)===u},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return b(e)===f},t.isFragment=function(e){return b(e)===a},t.isLazy=function(e){return b(e)===g},t.isMemo=function(e){return b(e)===m},t.isPortal=function(e){return b(e)===i},t.isProfiler=function(e){return b(e)===s},t.isStrictMode=function(e){return b(e)===l},t.isSuspense=function(e){return b(e)===p},t.isSuspenseList=function(e){return b(e)===h},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===a||e===s||e===l||e===p||e===h||e===v||"object"===typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===u||e.$$typeof===c||e.$$typeof===f||e.$$typeof===r||void 0!==e.getModuleId)},t.typeOf=b},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,a=60108,l=60114,s=60109,u=60110,c=60112,d=60113,f=60120,p=60115,h=60116,m=60121,g=60122,v=60117,b=60129,y=60131;if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;r=w("react.element"),o=w("react.portal"),i=w("react.fragment"),a=w("react.strict_mode"),l=w("react.profiler"),s=w("react.provider"),u=w("react.context"),c=w("react.forward_ref"),d=w("react.suspense"),f=w("react.suspense_list"),p=w("react.memo"),h=w("react.lazy"),m=w("react.block"),g=w("react.server.block"),v=w("react.fundamental"),b=w("react.debug_trace_mode"),y=w("react.legacy_hidden")}function S(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case l:case a:case d:case f:return e;default:switch(e=e&&e.$$typeof){case u:case c:case h:case p:case s:return e;default:return t}}case o:return t}}}var x=s,O=r,_=c,j=i,C=h,k=p,E=o,T=l,N=a,P=d;t.ContextConsumer=u,t.ContextProvider=x,t.Element=O,t.ForwardRef=_,t.Fragment=j,t.Lazy=C,t.Memo=k,t.Portal=E,t.Profiler=T,t.StrictMode=N,t.Suspense=P,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return S(e)===u},t.isContextProvider=function(e){return S(e)===s},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return S(e)===c},t.isFragment=function(e){return S(e)===i},t.isLazy=function(e){return S(e)===h},t.isMemo=function(e){return S(e)===p},t.isPortal=function(e){return S(e)===o},t.isProfiler=function(e){return S(e)===l},t.isStrictMode=function(e){return S(e)===a},t.isSuspense=function(e){return S(e)===d},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===i||e===l||e===b||e===a||e===d||e===f||e===y||"object"===typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===p||e.$$typeof===s||e.$$typeof===u||e.$$typeof===c||e.$$typeof===v||e.$$typeof===m||e[0]===g)},t.typeOf=S},function(e,t,n){"use strict";var r=n(2),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,n){var r,i={},u=null,c=null;for(r in void 0!==n&&(u=""+n),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(c=t.ref),t)a.call(t,r)&&!s.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:u,ref:c,props:i,_owner:l.current}}t.Fragment=i,t.jsx=u,t.jsxs=u},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}t.resolve=function(){for(var t="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a=i>=0?arguments[i]:e.cwd();if("string"!==typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,o="/"===a.charAt(0))}return(o?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!o).join("/"))||"."},t.normalize=function(e){var i=t.isAbsolute(e),a="/"===o(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!i).join("/"))||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!==typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var o=r(e.split("/")),i=r(n.split("/")),a=Math.min(o.length,i.length),l=a,s=0;s<a;s++)if(o[s]!==i[s]){l=s;break}var u=[];for(s=l;s<o.length;s++)u.push("..");return(u=u.concat(i.slice(l))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!==typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,o=!0,i=e.length-1;i>=1;--i)if(47===(t=e.charCodeAt(i))){if(!o){r=i;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!==typeof e&&(e+="");var t,n=0,r=-1,o=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!o){n=t+1;break}}else-1===r&&(o=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!==typeof e&&(e+="");for(var t=-1,n=0,r=-1,o=!0,i=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===r&&(o=!1,r=a+1),46===l?-1===t?t=a:1!==i&&(i=1):-1!==t&&(i=-1);else if(!o){n=a+1;break}}return-1===t||-1===r||0===i||1===i&&t===r-1&&t===n+1?"":e.slice(t,r)};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(7))},function(e,t,n){var r=n(34),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a),i(o,a),a.from=function(e,t,n){if("number"===typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},a.alloc=function(e,t,n){if("number"!==typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"===typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return o(e)},a.allocUnsafeSlow=function(e){if("number"!==typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(e){var r=n(35),o=n(36),i=n(37);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=s.prototype:(null===e&&(e=new s(t)),e.length=t),e}function s(e,t,n){if(!s.TYPED_ARRAY_SUPPORT&&!(this instanceof s))return new s(e,t,n);if("number"===typeof e){if("string"===typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"===typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);s.TYPED_ARRAY_SUPPORT?(e=t).__proto__=s.prototype:e=f(e,t);return e}(e,t,n,r):"string"===typeof t?function(e,t,n){"string"===typeof n&&""!==n||(n="utf8");if(!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|h(t,n),o=(e=l(e,r)).write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(s.isBuffer(t)){var n=0|p(t.length);return 0===(e=l(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!==typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!==typeof t.length||(r=t.length)!==r?l(e,0):f(e,t);if("Buffer"===t.type&&i(t.data))return f(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!==typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(c(t),e=l(e,t<0?0:0|p(t)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t){var n=t.length<0?0:0|p(t.length);e=l(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return E(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return j(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,o){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"===typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"===typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){var i,a=1,l=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,l/=2,s/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;i<l;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===s)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(n+s>l&&(n=l-s),i=n;i>=0;i--){for(var d=!0,f=0;f<s;f++)if(u(e,i+f)!==u(t,f)){d=!1;break}if(d)return i}return-1}function y(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a<r;++a){var l=parseInt(t.substr(2*a,2),16);if(isNaN(l))return a;e[n+a]=l}return a}function w(e,t,n,r){return W(B(t,e.length-n),e,n,r)}function S(e,t,n,r){return W(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function x(e,t,n,r){return S(e,t,n,r)}function O(e,t,n,r){return W(V(t),e,n,r)}function _(e,t,n,r){return W(function(e,t){for(var n,r,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function j(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var i,a,l,s,u=e[o],c=null,d=u>239?4:u>223?3:u>191?2:1;if(o+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128===(192&(i=e[o+1]))&&(s=(31&u)<<6|63&i)>127&&(c=s);break;case 3:i=e[o+1],a=e[o+2],128===(192&i)&&128===(192&a)&&(s=(15&u)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[o+1],a=e[o+2],l=e[o+3],128===(192&i)&&128===(192&a)&&128===(192&l)&&(s=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&l)>65535&&s<1114112&&(c=s)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=d}return function(e){var t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=k));return n}(r)}t.Buffer=s,t.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},t.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"===typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}(),t.kMaxLength=a(),s.poolSize=8192,s._augment=function(e){return e.__proto__=s.prototype,e},s.from=function(e,t,n){return u(null,e,t,n)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(e,t,n){return function(e,t,n,r){return c(t),t<=0?l(e,t):void 0!==n?"string"===typeof r?l(e,t).fill(n,r):l(e,t).fill(n):l(e,t)}(null,e,t,n)},s.allocUnsafe=function(e){return d(null,e)},s.allocUnsafeSlow=function(e){return d(null,e)},s.isBuffer=function(e){return!(null==e||!e._isBuffer)},s.compare=function(e,t){if(!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=s.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?C(this,0,e):m.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},s.prototype.compare=function(e,t,n,r,o){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),l=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),d=0;d<l;++d)if(u[d]!==c[d]){i=u[d],a=c[d];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},s.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"===typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return x(this,e,t,n);case"base64":return O(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function E(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function N(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=t;i<n;++i)o+=F(e[i]);return o}function P(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function I(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function A(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o<i;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function D(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o<i;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function L(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return i||L(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return i||L(e,0,n,8),o.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),s.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=s.prototype;else{var o=t-e;n=new s(o,void 0);for(var i=0;i<o;++i)n[i]=this[i+e]}return n},s.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r},s.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=0,a=1,l=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===l&&0!==this[t+i-1]&&(l=1),this[t+i]=(e/a>>0)-l&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=n-1,a=1,l=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===l&&0!==this[t+i+1]&&(l=1),this[t+i]=(e/a>>0)-l&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,i=r-n;if(this===e&&n<t&&t<r)for(o=i-1;o>=0;--o)e[o+t]=this[o+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},s.prototype.fill=function(e,t,n,r){if("string"===typeof e){if("string"===typeof t?(r=t,t=0,n=this.length):"string"===typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!==typeof r)throw new TypeError("encoding must be a string");if("string"===typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"===typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=s.isBuffer(e)?e:B(new s(e,r).toString()),l=a.length;for(i=0;i<n-t;++i)this[i+t]=a[i%l]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var r=e.length,o=null,i=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function W(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(6))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],l=r[1],s=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,l)),c=0,d=l>0?a-4:a;for(n=0;n<d;n+=4)t=o[e.charCodeAt(n)]<<18|o[e.charCodeAt(n+1)]<<12|o[e.charCodeAt(n+2)]<<6|o[e.charCodeAt(n+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=255&t;2===l&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,s[c++]=255&t);1===l&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=16383,l=0,s=n-o;l<s;l+=a)i.push(c(e,l,l+a>s?s:l+a));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,s=a.length;l<s;++l)r[l]=a[l],o[a.charCodeAt(l)]=l;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,n){for(var o,i,a=[],l=t;l<n;l+=3)o=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(255&e[l+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,l=8*o-r-1,s=(1<<l)-1,u=s>>1,c=-7,d=n?o-1:0,f=n?-1:1,p=e[t+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=l;c>0;i=256*i+e[t+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===i)i=1-u;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,l,s,u=8*i-o-1,c=(1<<u)-1,d=c>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+d>=1?f/s:f*Math.pow(2,1-d))*s>=2&&(a++,s/=2),a+d>=c?(l=0,a=c):a+d>=1?(l=(t*s-1)*Math.pow(2,o),a+=d):(l=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&l,p+=h,l/=256,o-=8);for(a=a<<o|l,u+=o;u>0;e[n+p]=255&a,p+=h,a/=256,u-=8);e[n+p-h]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";if(n.r(t),"object"!==typeof DjVu)throw new Error("There is no DjVu object! You have to include the DjVu.js library first!");var r=DjVu,o=n(2),i=n.n(o),a=n(11),l=n(8),s=n(12),u=n(5),c=n.n(u);let d=function(e){e()};const f=i.a.createContext(null);function p(){return Object(o.useContext)(f)}const h=()=>{throw new Error("uSES not initialized!")};let m=h;const g=(e,t)=>e===t;function v(e=f){const t=e===f?p:()=>Object(o.useContext)(e);return function(e,n=g){const{store:r,subscription:i,getServerState:a}=t(),l=m(i.addNestedSub,r.getState,a||r.getState,e,n);return Object(o.useDebugValue)(l),l}}const b=v();function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function w(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var S=n(4),x=n.n(S),O=n(13);const _=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function j(e,t,n,r,{areStatesEqual:o,areOwnPropsEqual:i,areStatePropsEqual:a}){let l,s,u,c,d,f=!1;function p(f,p){const h=!i(p,s),m=!o(f,l);return l=f,s=p,h&&m?(u=e(l,s),t.dependsOnOwnProps&&(c=t(r,s)),d=n(u,c,s),d):h?(e.dependsOnOwnProps&&(u=e(l,s)),t.dependsOnOwnProps&&(c=t(r,s)),d=n(u,c,s),d):m?function(){const t=e(l,s),r=!a(t,u);return u=t,r&&(d=n(u,c,s)),d}():d}return function(o,i){return f?p(o,i):(l=o,s=i,u=e(l,s),c=t(r,s),d=n(u,c,s),f=!0,d)}}function C(e){return function(t){const n=e(t);function r(){return n}return r.dependsOnOwnProps=!1,r}}function k(e){return e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function E(e,t){return function(t,{displayName:n}){const r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e,void 0)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=k(e);let o=r(t,n);return"function"===typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=k(o),o=r(t,n)),o},r}}function T(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function N(e,t,n){return y({},n,e,t)}function P(){const e=d;let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const I={notify(){},get:()=>[]};function R(e,t){let n,r=I;function o(){a.onStateChange&&a.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=P())}const a={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=I)},getListeners:()=>r};return a}const A=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement)?o.useLayoutEffect:o.useEffect;function D(e,t){return e===t?0!==e||0!==t||1/e===1/t:e!==e&&t!==t}function L(e,t){if(D(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(t,n[o])||!D(e[n[o]],t[n[o]]))return!1;return!0}const M=["reactReduxForwardedRef"];let z=h;const U=[null,null];function F(e,t,n,r,o,i){e.current=r,n.current=!1,o.current&&(o.current=null,i())}function B(e,t){return e===t}var V=function(e,t,n,{pure:r,areStatesEqual:a=B,areOwnPropsEqual:l=L,areStatePropsEqual:s=L,areMergedPropsEqual:u=L,forwardRef:c=!1,context:d=f}={}){const p=d,h=function(e){return e?"function"===typeof e?E(e):T(e,"mapStateToProps"):C((()=>({})))}(e),m=function(e){return e&&"object"===typeof e?C((t=>function(e,t){const n={};for(const r in e){const o=e[r];"function"===typeof o&&(n[r]=(...e)=>t(o(...e)))}return n}(e,t))):e?"function"===typeof e?E(e):T(e,"mapDispatchToProps"):C((e=>({dispatch:e})))}(t),g=function(e){return e?"function"===typeof e?function(e){return function(t,{displayName:n,areMergedPropsEqual:r}){let o,i=!1;return function(t,n,a){const l=e(t,n,a);return i?r(l,o)||(o=l):(i=!0,o=l),o}}}(e):T(e,"mergeProps"):()=>N}(n),v=Boolean(e);return e=>{const t=e.displayName||e.name||"Component",n=`Connect(${t})`,r={shouldHandleStateChanges:v,displayName:n,wrappedComponentName:t,WrappedComponent:e,initMapStateToProps:h,initMapDispatchToProps:m,initMergeProps:g,areStatesEqual:a,areStatePropsEqual:s,areOwnPropsEqual:l,areMergedPropsEqual:u};function d(t){const[n,a,l]=Object(o.useMemo)((()=>{const{reactReduxForwardedRef:e}=t,n=w(t,M);return[t.context,e,n]}),[t]),s=Object(o.useMemo)((()=>n&&n.Consumer&&Object(O.isContextConsumer)(i.a.createElement(n.Consumer,null))?n:p),[n,p]),u=Object(o.useContext)(s),c=Boolean(t.store)&&Boolean(t.store.getState)&&Boolean(t.store.dispatch),d=Boolean(u)&&Boolean(u.store);const f=c?t.store:u.store,h=d?u.getServerState:f.getState,m=Object(o.useMemo)((()=>function(e,t){let{initMapStateToProps:n,initMapDispatchToProps:r,initMergeProps:o}=t,i=w(t,_);return j(n(e,i),r(e,i),o(e,i),e,i)}(f.dispatch,r)),[f]),[g,b]=Object(o.useMemo)((()=>{if(!v)return U;const e=R(f,c?void 0:u.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[f,c,u]),S=Object(o.useMemo)((()=>c?u:y({},u,{subscription:g})),[c,u,g]),x=Object(o.useRef)(),C=Object(o.useRef)(l),k=Object(o.useRef)(),E=Object(o.useRef)(!1),T=(Object(o.useRef)(!1),Object(o.useRef)(!1)),N=Object(o.useRef)();A((()=>(T.current=!0,()=>{T.current=!1})),[]);const P=Object(o.useMemo)((()=>()=>k.current&&l===C.current?k.current:m(f.getState(),l)),[f,l]),I=Object(o.useMemo)((()=>e=>g?function(e,t,n,r,o,i,a,l,s,u,c){if(!e)return()=>{};let d=!1,f=null;const p=()=>{if(d||!l.current)return;const e=t.getState();let n,p;try{n=r(e,o.current)}catch(h){p=h,f=h}p||(f=null),n===i.current?a.current||u():(i.current=n,s.current=n,a.current=!0,c())};return n.onStateChange=p,n.trySubscribe(),p(),()=>{if(d=!0,n.tryUnsubscribe(),n.onStateChange=null,f)throw f}}(v,f,g,m,C,x,E,T,k,b,e):()=>{}),[g]);var D,L,B;let V;D=F,L=[C,x,E,l,k,b],A((()=>D(...L)),B);try{V=z(I,P,h?()=>m(h(),l):P)}catch(H){throw N.current&&(H.message+=`\nThe error may be correlated with this previous error:\n${N.current.stack}\n\n`),H}A((()=>{N.current=void 0,k.current=void 0,x.current=V}));const W=Object(o.useMemo)((()=>i.a.createElement(e,y({},V,{ref:a}))),[a,e,V]);return Object(o.useMemo)((()=>v?i.a.createElement(s.Provider,{value:S},W):W),[s,W,S])}const f=i.a.memo(d);if(f.WrappedComponent=e,f.displayName=d.displayName=n,c){const t=i.a.forwardRef((function(e,t){return i.a.createElement(f,y({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,x()(t,e)}return x()(f,e)}};var W=function({store:e,context:t,children:n,serverState:r}){const a=Object(o.useMemo)((()=>{const t=R(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0}}),[e,r]),l=Object(o.useMemo)((()=>e.getState()),[e]);A((()=>{const{subscription:t}=a;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),l!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[a,l]);const s=t||f;return i.a.createElement(s.Provider,{value:a},n)};function H(e=f){const t=e===f?p:()=>Object(o.useContext)(e);return function(){const{store:e}=t();return e}}const $=H();function G(e=f){const t=e===f?$:H(e);return function(){return t().dispatch}}const q=G();var Y,K;Y=s.useSyncExternalStoreWithSelector,m=Y,(e=>{z=e})(l.useSyncExternalStore),K=u.unstable_batchedUpdates,d=K;var Q=n(1);function X(e,t){return e===t}function Z(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function J(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"===typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}var ee=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=0,a=r.pop(),l=J(r),s=e.apply(void 0,[function(){return i++,a.apply(null,arguments)}].concat(n)),u=e((function(){for(var e=[],t=l.length,n=0;n<t;n++)e.push(l[n].apply(null,arguments));return s.apply(null,e)}));return u.resultFunc=a,u.dependencies=l,u.recomputations=function(){return i},u.resetRecomputations=function(){return i=0},u}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X,n=null,r=null;return function(){return Z(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}));function te(e){for(const t in e)null===e[t]&&(e[t]=t);return Object.freeze(e)}var ne=te({TRANSLATION_PAGE_URL:"https://github.com/RussCoder/djvujs/blob/master/TRANSLATION.md",DEFAULT_DPI:100,TEXT_CURSOR_MODE:null,GRAB_CURSOR_MODE:null,MAX_PAGE_COUNT_IN_ROW:5,TEXT_MODE:"text",CONTINUOUS_SCROLL_MODE:"continuous",SINGLE_PAGE_MODE:"single",SET_CURSOR_MODE_ACTION:null,ERROR_ACTION:null,CREATE_DOCUMENT_FROM_ARRAY_BUFFER_ACTION:null,CONTENTS_IS_GOTTEN_ACTION:null,ARRAY_BUFFER_LOADED_ACTION:null,IMAGE_DATA_RECEIVED_ACTION:null,DOCUMENT_CREATED_ACTION:null,SET_NEW_PAGE_NUMBER_ACTION:null,SET_PAGE_BY_URL_ACTION:null,TOGGLE_FULL_PAGE_VIEW_ACTION:null,PAGE_TEXT_FETCHED_ACTION:null,SET_USER_SCALE_ACTION:null,START_FILE_LOADING_ACTION:null,END_FILE_LOADING_ACTION:null,FILE_LOADING_PROGRESS_ACTION:null,SHOW_HELP_WINDOW_ACTION:null,CLOSE_HELP_WINDOW_ACTION:null,CLOSE_DOCUMENT_ACTION:null,SET_PAGE_ROTATION_ACTION:null,PAGE_ERROR_ACTION:null,PAGE_IS_LOADED_ACTION:null,PAGES_SIZES_ARE_GOTTEN:null,DROP_PAGE_ACTION:null,DROP_ALL_PAGES_ACTION:null,SET_API_CALLBACK_ACTION:null});const re=te({LOAD_DOCUMENT_BY_URL:null,CONFIGURE:null,LOAD_DOCUMENT:null,UPDATE_OPTIONS:null,SET_IMAGE_PAGE_ERROR:null,SET_TEXT_PAGE_ERROR:null,START_TO_BUNDLE:null,FINISH_TO_BUNDLE:null,CLOSE_SAVE_DIALOG:null,OPEN_SAVE_DIALOG:null,UPDATE_FILE_PROCESSING_PROGRESS:null,ERROR:null,SAVE_DOCUMENT:null,SET_UI_OPTIONS:null,TOGGLE_OPTIONS_WINDOW:null,CLOSE_ERROR_WINDOW:null,DESTROY:null,OPEN_PRINT_DIALOG:null,CLOSE_PRINT_DIALOG:null,PREPARE_PAGES_FOR_PRINTING:null,START_PRINTING:null,UPDATE_PRINT_PROGRESS:null,CLOSE_CONTENTS:null,TOGGLE_CONTENTS:null,PIN_TOOLBAR:null,UNPIN_TOOLBAR:null,UPDATE_APP_CONTEXT:null,SET_VIEW_MODE:null}),oe=Object.freeze({isFileLoading:!1,loadedBytes:0,totalBytes:0});function ie(e=oe,t){switch(t.type){case ne.START_FILE_LOADING_ACTION:return{...e,isFileLoading:!0};case ne.FILE_LOADING_PROGRESS_ACTION:return{...e,loadedBytes:t.loaded,totalBytes:t.total};case ne.END_FILE_LOADING_ACTION:case re.ERROR:return oe;default:return e}}const ae=e=>ee((e=>e.fileLoadingState),e),le={isFileLoading:ae((e=>e.isFileLoading)),loadedBytes:ae((e=>e.loadedBytes)),totalBytes:ae((e=>e.totalBytes))},se=Object.freeze({imageData:null,imageDpi:null,pageText:null,textZones:null,imagePageError:null,textPageError:null}),ue=Object.freeze({...se,cursorMode:ne.GRAB_CURSOR_MODE,currentPageNumber:1,shouldScrollToPage:!1,pageList:[],pageSizeList:[]});function ce(e=ue,t){const n=t.payload;switch(t.type){case ne.DROP_PAGE_ACTION:{const n=[...e.pageList],r=t.pageNumber-1;return n[r]&&(n[r]={width:n[r].width,height:n[r].height,dpi:n[r].dpi}),{...e,pageList:n}}case ne.DROP_ALL_PAGES_ACTION:return{...e,pageList:[...e.pageSizeList]};case ne.PAGES_SIZES_ARE_GOTTEN:return{...e,isLoading:!1,pageSizeList:t.sizes,pageList:t.sizes};case ne.PAGE_IS_LOADED_ACTION:const r=e.pageList[t.pageNumber-1];if(r&&r.url)return e;const o=[...e.pageList];return o[t.pageNumber-1]=t.pageData,{...e,pageList:o};case ne.SET_CURSOR_MODE_ACTION:return{...e,cursorMode:t.cursorMode};case ne.IMAGE_DATA_RECEIVED_ACTION:return{...e,imageData:t.imageData,imageDpi:t.imageDpi};case ne.SET_NEW_PAGE_NUMBER_ACTION:return{...e,...e.textPageError||e.imagePageError?se:null,shouldScrollToPage:t.shouldScrollToPage,currentPageNumber:t.pageNumber};case re.SET_VIEW_MODE:if(n===ne.CONTINUOUS_SCROLL_MODE)return{...e,...se};break;case ne.PAGE_TEXT_FETCHED_ACTION:return{...e,pageText:t.pageText,textZones:t.textZones};case re.SET_IMAGE_PAGE_ERROR:return{...e,imagePageError:n};case re.SET_TEXT_PAGE_ERROR:return{...e,textPageError:n}}return e}const de=e=>ee((e=>e.pageState),e),fe={cursorMode:de((e=>e.cursorMode)),pageText:de((e=>e.pageText)),imageData:de((e=>e.imageData)),imageDpi:de((e=>e.imageDpi)),textZones:de((e=>e.textZones)),currentPageNumber:de((e=>e.currentPageNumber)),shouldScrollToPage:de((e=>e.shouldScrollToPage)),imagePageError:de((e=>e.imagePageError)),textPageError:de((e=>e.textPageError)),pageList:de((e=>e.pageList)),pageSizeList:de((e=>e.pageSizeList))};var pe={en:{englishName:"English",nativeName:"English",Language:"Language","Add more":"Add more","The translation isn't complete.":"The translation isn't complete.","The following phrases are not translated:":"The following phrases are not translated:","You can improve the translation here":"You can improve the translation here","#helpButton - learn more about the app":"#helpButton - learn more about the app","#optionsButton - see the available options":"#optionsButton - see the available options","powered with":"powered with","Drag & Drop a file here or click to choose manually":"Drag & Drop a file here or click to choose manually","Paste a URL to a djvu file here":"Paste a URL to a djvu file here","Open URL":"Open URL",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Enter a valid URL (it should start with "http(s)://" | "data:")',Error:"Error","Error on page":"Error on page","Network error":"Network error","Check your network connection":"Check your network connection","Web request error":"Web request error","404 Document not found":"404 Document not found","403 Access forbidden":"403 Access forbidden","500 Internal server error":"500 Internal server error","The request failed with HTTP status #status":"The request failed with HTTP status #status","DjVu file is corrupted":"DjVu file is corrupted","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"The file doesn't comply with the DjVu format specification or it's not a whole DjVu document","Incorrect file format":"Incorrect file format","The provided file is not a DjVu document":"The provided file is not a DjVu document","Incorrect page number":"Incorrect page number","There is no page with the number #pageNumber":"There is no page with the number #pageNumber","No base URL for an indirect DjVu document":"No base URL for an indirect DjVu document","You probably opened an indirect (multi-file) DjVu document manually.":"You probably opened an indirect (multi-file) DjVu document manually.","But such multi-file documents can be only loaded by URL.":"But such multi-file documents can be only loaded by URL.","Unexpected error":"Unexpected error","Cannot print the error, look in the console":"Cannot print the error, look in the console",Options:"Options","Show options window":"Show options window","Color theme":"Color theme","Extension options":"Extension options","Open all links with .djvu at the end via the viewer":"Open all links with .djvu at the end via the viewer","All links to .djvu files will be opened by the viewer via a simple click on a link":"All links to .djvu files will be opened by the viewer via a simple click on a link","Detect .djvu files by means of http headers":"Detect .djvu files by means of http headers","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"Analyze headers of every new tab in order to process even links which do not end with the .djvu extension",Ready:"Ready",Loading:"Loading","Show help window":"Show help window","Switch full page mode":"Switch full page mode","Choose a file":"Choose a file","Close document":"Close document","Save document":"Save document",Save:"Save","Open another .djvu file":"Open another .djvu file","The application for viewing .djvu files in the browser.":"The application for viewing .djvu files in the browser.","If something doesn't work properly, feel free to write about the problem at #email.":"If something doesn't work properly, feel free to write about the problem at #email.","The official website is #website.":"The official website is #website.","The source code is available on #link.":"The source code is available on #link.",Hotkeys:"Hotkeys","save the document":"save the document","go to the previous page":"go to the previous page","go to the next page":"go to the next page",Controls:"Controls","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.","Continuous scroll view mode":"Continuous scroll view mode","Number of pages in a row":"Number of pages in a row","Number of pages in the first row":"Number of pages in the first row","Single page view mode":"Single page view mode","Text view mode":"Text view mode","Click on the number to enter it manually":"Click on the number to enter it manually","Rotate the page":"Rotate the page","You also can scale the page via Ctrl+MouseWheel":"You also can scale the page via Ctrl+MouseWheel","Text cursor mode":"Text cursor mode","Grab cursor mode":"Grab cursor mode","Table of contents":"Table of contents","Toolbar is always shown":"Toolbar is always shown","Toolbar automatically hides":"Toolbar automatically hides",Contents:"Contents","No contents provided":"No contents provided","The link points to another document. Do you want to proceed?":"The link points to another document. Do you want to proceed?","No text on this page":"No text on this page","You are trying to save an indirect (multi-file) document.":"You are trying to save an indirect (multi-file) document.","What exactly do you want to do?":"What exactly do you want to do?","Save only index file":"Save only index file","Download, bundle and save the whole document as one file":"Download, bundle and save the whole document as one file","Downloading and bundling the document":"Downloading and bundling the document","The document has been downloaded and bundled into one file successfully":"The document has been downloaded and bundled into one file successfully","Print document":"Print document","Pages must be rendered before printing.":"Pages must be rendered before printing.","It may take a while.":"It may take a while.","Select the pages you want to print.":"Select the pages you want to print.",From:"From",to:"to","Prepare pages for printing":"Prepare pages for printing","Preparing pages for printing":"Preparing pages for printing",Menu:"Menu",Document:"Document",About:"About",Print:"Print",Close:"Close","View mode":"View mode",Scale:"Scale",Rotation:"Rotation","Cursor mode":"Cursor mode","Full page mode":"Full page mode","Fullscreen mode":"Fullscreen mode"},ru:{englishName:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",Language:"\u042f\u0437\u044b\u043a","Add more":"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435","The translation isn't complete.":"\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439.","The following phrases are not translated:":"\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0440\u0430\u0437\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u044b:","You can improve the translation here":"\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0442\u0443\u0442","#helpButton - learn more about the app":"#helpButton - \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435","#optionsButton - see the available options":"#optionsButton - \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a","powered with":"\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043e \u043d\u0430","Drag & Drop a file here or click to choose manually":"\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044e\u0434\u0430 \u0444\u0430\u0439\u043b \u0438\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e","Paste a URL to a djvu file here":"\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 .djvu \u0444\u0430\u0439\u043b","Open URL":"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443",'Enter a valid URL (it should start with "http(s)://" | "data:")':'\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 (\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 "http(s)://" | "data:")',Error:"\u041e\u0448\u0438\u0431\u043a\u0430","Error on page":"\u041e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435","Network error":"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0435\u0442\u0438","Check your network connection":"\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0441\u0432\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435","Web request error":"\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0435\u0431-\u0437\u0430\u043f\u0440\u043e\u0441\u0430","404 Document not found":"404 \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d","403 Access forbidden":"403 \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d","500 Internal server error":"500 \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430","The request failed with HTTP status #status":"\u0417\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0441 HTTP-\u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c #status","DjVu file is corrupted":"DjVu-\u0444\u0430\u0439\u043b \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"\u0424\u0430\u0439\u043b \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 DjVu, \u0438\u043b\u0438 \u0436\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0435\u0441\u044c DjVu-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","Incorrect file format":"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430","The provided file is not a DjVu document":"\u0417\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f DjVu-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043c","Incorrect page number":"\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b","There is no page with the number #pageNumber":"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c #pageNumber \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442","No base URL for an indirect DjVu document":"\u041d\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430","You probably opened an indirect (multi-file) DjVu document manually.":"\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432\u044b \u043e\u0442\u043a\u0440\u044b\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 (indirect) DjVu-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.","But such multi-file documents can be only loaded by URL.":"\u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0430\u043a\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.","Unexpected error":"\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430","Cannot print the error, look in the console":"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c",Options:"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438","Show options window":"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043e\u043a\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a","Color theme":"\u0426\u0432\u0435\u0442\u043e\u0432\u0430\u044f \u0441\u0445\u0435\u043c\u0430","Extension options":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f","Open all links with .djvu at the end via the viewer":"\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0441 .djvu \u043d\u0430 \u043a\u043e\u043d\u0446\u0435 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435","All links to .djvu files will be opened by the viewer via a simple click on a link":"\u0412\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 .djvu \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u043a\u043b\u0438\u043a\u0443 \u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0435","Detect .djvu files by means of http headers":"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c .djvu \u0444\u0430\u0439\u043b\u044b \u043f\u043e http \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":'\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f ".djvu" \u0432 \u0441\u0441\u044b\u043b\u043a\u0435',Ready:"\u0413\u043e\u0442\u043e\u0432\u043e",Loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430","Show help window":"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043a\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043a\u0438","Switch full page mode":"\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c","Choose a file":"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043b","Close document":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","Save document":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442",Save:"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c","Open another .djvu file":"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 .djvu \u0444\u0430\u0439\u043b","The application for viewing .djvu files in the browser.":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 .djvu \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.","If something doesn't work properly, feel free to write about the problem at #email.":"\u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0430 #email.","The official website is #website.":"\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442 #website.","The source code is available on #link.":"\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 #link.",Hotkeys:"\u0413\u043e\u0440\u044f\u0447\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438","save the document":"\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","go to the previous page":"\u043f\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435","go to the next page":"\u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435",Controls:"\u041a\u043d\u043e\u043f\u043a\u0438","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon \u0438 #collapseIcon \u043d\u0443\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0442\u043e \u044d\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.","Continuous scroll view mode":"\u0420\u0435\u0436\u0438\u043c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0438","Number of pages in a row":"\u0427\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435","Number of pages in the first row":"\u0427\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435","Single page view mode":"\u041e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c","Text view mode":"\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0436\u0438\u043c","Click on the number to enter it manually":"\u041a\u043b\u0438\u043a\u043d\u0438\u0442\u0435 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e","Rotate the page":"\u041f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443","You also can scale the page via Ctrl+MouseWheel":"\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0447\u0435\u0440\u0435\u0437 Ctrl+\u041a\u043e\u043b\u0435\u0441\u043e \u043c\u044b\u0448\u0438","Text cursor mode":"\u041a\u0443\u0440\u0441\u043e\u0440 \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430","Grab cursor mode":"\u0420\u0435\u0436\u0438\u043c \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u044f","Table of contents":"\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435","Toolbar is always shown":"\u041f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f","Toolbar automatically hides":"\u041f\u0430\u043d\u0435\u043b\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f",Contents:"\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435","No contents provided":"\u041d\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f","The link points to another document. Do you want to proceed?":"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442. \u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?","No text on this page":"\u041d\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435","You are trying to save an indirect (multi-file) document.":"\u0412\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.","What exactly do you want to do?":"\u0427\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c?","Save only index file":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0444\u0430\u0439\u043b","Download, bundle and save the whole document as one file":"\u0421\u043a\u0430\u0447\u0430\u0442\u044c, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043e\u0434\u043d\u0438\u043c \u0444\u0430\u0439\u043b\u043e\u043c","Downloading and bundling the document":"\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","The document has been downloaded and bundled into one file successfully":"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u043d \u0438 \u0441\u043e\u0431\u0440\u0430\u043d \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 \u0444\u0430\u0439\u043b","Print document":"\u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442","Pages must be rendered before printing.":"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u044b \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0447\u0430\u0442\u044c\u044e.","It may take a while.":"\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.","Select the pages you want to print.":"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c.",From:"\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441",to:"\u043f\u043e","Prepare pages for printing":"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a \u043f\u0435\u0447\u0430\u0442\u0438","Preparing pages for printing":"\u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a \u043f\u0435\u0447\u0430\u0442\u0438",Menu:"\u041c\u0435\u043d\u044e",Document:"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442",About:"\u041e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438",Print:"\u041f\u0435\u0447\u0430\u0442\u044c",Close:"\u0417\u0430\u043a\u0440\u044b\u0442\u044c","View mode":"\u0420\u0435\u0436\u0438\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430",Scale:"\u041c\u0430\u0441\u0448\u0442\u0430\u0431",Rotation:"\u041f\u043e\u0432\u043e\u0440\u043e\u0442","Cursor mode":"\u041a\u0443\u0440\u0441\u043e\u0440","Full page mode":"\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c","Fullscreen mode":"\u041f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c"},sv:{englishName:"Swedish",nativeName:"Svenska",Language:"Spr\xe5k","Add more":"L\xe4gg till mer","The translation isn't complete.":"\xd6vers\xe4ttningen \xe4r inte klar.","The following phrases are not translated:":"F\xf6ljande meningar \xe4r inte \xf6versatta:","You can improve the translation here":"Du kan f\xf6rtydliga \xf6vers\xe4ttningen h\xe4r","#helpButton - learn more about the app":"#helpButton - l\xe4r dig mer om applikationen","#optionsButton - see the available options":"#optionsButton - Se tillg\xe4ngliga alternativ","powered with":"baserat p\xe5","Drag & Drop a file here or click to choose manually":"Dra och sl\xe4pp en fil h\xe4r eller klicka f\xf6r att v\xe4lja en manuellt","Paste a URL to a djvu file here":"Klistra in en URL till en .djvu-fil h\xe4r","Open URL":"\xd6ppna URL",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Ange en giltig URL (den ska b\xf6rja med "http (s): //")',Error:"Fel","Error on page":"Felaktigheter p\xe5 sidan","Network error":"N\xe4tverksfel","Check your network connection":"Kontrollera n\xe4tverksanslutningen","Web request error":"Fel vid webbeg\xe4rning","404 Document not found":"404 Dokument hittas inte","403 Access forbidden":"403 \xc5tkomst f\xf6rbjuden","500 Internal server error":"500 Internt serverfel","The request failed with HTTP status #status":"TBeg\xe4ran misslyckades med http-status #status","DjVu file is corrupted":"DjVu-filen \xe4r korrupt:","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"Filen \xf6verensst\xe4mmer inte med specificerat DjVu-format eller s\xe5 \xe4r dokumentet inte komplett","Incorrect file format":"Felaktigt filformat","The provided file is not a DjVu document":"Den angivna filen \xe4r inte ett DjVu-dokument","Incorrect page number":"Felaktigt sidnummer","There is no page with the number #pageNumber":"Felaktigt sidnummer #pageNumber","No base URL for an indirect DjVu document":"Ingen bas-URL f\xf6r ett indirekt DjVu-dokument","You probably opened an indirect (multi-file) DjVu document manually.":"Du \xf6ppnade troligen ett indirekt DjVu-dokument (med flera filer) manuellt.","But such multi-file documents can be only loaded by URL.":"Dokument med flera filer kan endast laddas med URL.","Unexpected error":"Ett ov\xe4ntat fel uppstod","Cannot print the error, look in the console":"Kunde inte skriva ut felet, titta i konsolen",Options:"Alternativ","Show options window":"Visa f\xf6nster med alternativ","Color theme":"F\xe4rgtema","Extension options":"F\xf6rl\xe4ngningsalternativ","Open all links with .djvu at the end via the viewer":"\xd6ppna alla l\xe4nkar med .djvu via webbl\xe4saren","All links to .djvu files will be opened by the viewer via a simple click on a link":"Alla l\xe4nkar till .djvu-filer kommer \xf6ppnas i l\xe4saren","Detect .djvu files by means of http headers":"Uppt\xe4ck .djvu-filer med hj\xe4lp av HTTP-rubriker","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":'Analysera rubriker p\xe5 alla nya flikar f\xf6r att k\xe4nna av om l\xe4nkar \xe4r av .djvu-format (\xe4ven l\xe4nkar som inte slutar med ".djvu"',Ready:"Klar",Loading:"Laddar","Show help window":"Visa hj\xe4lpsida","Switch full page mode":"\xc4ndra visningsl\xe4ge till helsida","Choose a file":"V\xe4lj en fil","Close document":"St\xe4ng dokument","Save document":"Spara dokument",Save:"Spara","Open another .djvu file":"\xd6ppna ytterligare en .djvu-fil","The application for viewing .djvu files in the browser.":"Applikation f\xf6r att se .djvu-filer i browsern.","If something doesn't work properly, feel free to write about the problem at #email.":"Om n\xe5got inte fungerar korrekt, v\xe4nligen kontakta #email.","The official website is #website.":"Den officiella webbsidan \xe4r #website.","The source code is available on #link.":"K\xe4llkoden \xe4r tillg\xe4nglig p\xe5 #link.",Hotkeys:"Tangebords-genv\xe4gar","save the document":"spara dokument","go to the previous page":"g\xe5 till f\xf6reg\xe5ende sida","go to the next page":"g\xe5 till n\xe4sta sida",Controls:"Kontroller","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"Knapparna #expandIcon och #collapseIcon anv\xe4nds f\xf6r att v\xe4cla visningsl\xe4ge till helsida och tillbaka.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"Om du anv\xe4nder till\xe4gget i browsern kommer dessa knappar inte att fungera d\xe5 visningsprogrammet hanterar hela sidan som standard.","Continuous scroll view mode":"Visningsl\xe4ge med kontinuerlig scrolling","Number of pages in a row":null,"Number of pages in the first row":null,"Single page view mode":"Visningsl\xe4ge med en sida","Text view mode":"Visningsl\xe4ge med text","Click on the number to enter it manually":"Du kan klicka p\xe5 sidnumret f\xf6r att ange det manuellt","Rotate the page":"Rotera sidan","You also can scale the page via Ctrl+MouseWheel":"Du kan ocks\xe5 skala sidan genom att anv\xe4nda Ctrl + Skrollknappen p\xe5 musen","Text cursor mode":"Visningsl\xe4ge med textmark\xf6r","Grab cursor mode":"Visningsl\xe4ge med greppbart mark\xf6rl\xe4ge","Table of contents":null,"Toolbar is always shown":null,"Toolbar automatically hides":null,Contents:"Inneh\xe5ll","No contents provided":"Inget inneh\xe5ll har givits","The link points to another document. Do you want to proceed?":"L\xe4nken vidarebefodrar till ett annat dokument. Vill du forts\xe4tta?","No text on this page":"Ingen text finns p\xe5 denna sida","You are trying to save an indirect (multi-file) document.":"Du f\xf6rs\xf6ker spara ett indirekt dokument (flera filer).","What exactly do you want to do?":"Vad vill du g\xf6ra?","Save only index file":"Spara endast index-fil","Download, bundle and save the whole document as one file":"Ladda ner, packa ihop och spara hela dokumentet som en fil","Downloading and bundling the document":"Laddar ner och packer ihop dokumentet","The document has been downloaded and bundled into one file successfully":"Dokumentet har laddats ner och packats ihop till en fil","Print document":"Skriv ut","Pages must be rendered before printing.":"Sidorna m\xe5ste renderas f\xf6re utskrift.","It may take a while.":"Det kan ta en stund.","Select the pages you want to print.":"V\xe4lj de sidor du vill skriva ut.",From:"Fr\xe5n",to:"till","Prepare pages for printing":"F\xf6rbered sidor f\xf6r utskrift","Preparing pages for printing":"F\xf6rbereder sidor f\xf6r utskrift",Menu:null,Document:null,About:null,Print:null,Close:null,"View mode":null,Scale:null,Rotation:null,"Cursor mode":null,"Full page mode":null,"Fullscreen mode":null},fr:{englishName:"French",nativeName:"Fran\xe7ais",Language:"Langue","Add more":"Ajouter une traduction","The translation isn't complete.":"La traduction n'est pas termin\xe9e.","The following phrases are not translated:":"Les assertions suivantes n'ont pas \xe9t\xe9 traduites:","You can improve the translation here":"Vous pouvez am\xe9liorer la traduction ici","#helpButton - learn more about the app":"#helpButton - \xe0 propos","#optionsButton - see the available options":"#optionsButton - options disponibles","powered with":"bas\xe9 sur","Drag & Drop a file here or click to choose manually":"Glisser-D\xe9poser ici un fichier, ou cliquer pour le slectionner manuellement","Paste a URL to a djvu file here":"Copier un lien vers un fichier .djvu","Open URL":"Ouvrir le lien",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Ins\xe9rer une URL valide (doit commencer par "http(s)://" | "data:")',Error:"Erreur","Error on page":"Erreur dans la page","Network error":"Erreur de r\xe9seau","Check your network connection":"V\xe9rifier votre connexion internet","Web request error":"Erreur de requ\xeate web","404 Document not found":"404 Document non trouv\xe9","403 Access forbidden":"403 Acc\xe8s interdit","500 Internal server error":"500 Erreur interne du serveur","The request failed with HTTP status #status":"La requ\xeate a \xe9chou\xe9e avec le statut HTTP #status","DjVu file is corrupted":"Le fichier DjVu est corrompu","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"Le fichier ne respecte pas la sp\xe9cification du format DjVu ou il s'agit d'un document DjVu incomplet","Incorrect file format":"Format de fichier incorrect","The provided file is not a DjVu document":"Le fichier fourni n'est pas un document DjVu","Incorrect page number":"Num\xe9ro de page incorrect","There is no page with the number #pageNumber":"Il n'existe pas de page avec le num\xe9ro #pageNumber","No base URL for an indirect DjVu document":"URL de base manquante du document DjVu indirect (multi-fichier)","You probably opened an indirect (multi-file) DjVu document manually.":"Vous avez probablement ouvert manuellement un document DjVu indirect (multi-fichier).","But such multi-file documents can be only loaded by URL.":"Mais de tels documents multi-fichier ne peuvent \xeatre ouvert que par URL","Unexpected error":"Erreur inconnue","Cannot print the error, look in the console":"Impossible de rapporter l'erreur, regarder dans la console.",Options:"Options","Show options window":"Afficher la fen\xeatre d'option","Color theme":"Changer de th\xe8me","Extension options":"Options de l'extension","Open all links with .djvu at the end via the viewer":"Ouvrir tous les li\u0435ns .djvu avec l'extension","All links to .djvu files will be opened by the viewer via a simple click on a link":"Tous les liens .djvu seront ouverts avec l'extension en cliquant simplement sur le lien","Detect .djvu files by means of http headers":"Identifier les fichiers .djvu par leur en-t\xeate http","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"Analyser les en-t\xeates de chaque nouvel onglet pour identifier les fichiers m\xeame sans l'extension .djvu en fin de lien",Ready:"Pr\xeat",Loading:"Chargement","Show help window":"Afficher la fen\xeatre d'aide","Switch full page mode":"Passer en mode pleine page","Choose a file":"Choisir un fichier","Close document":"Fermer le document","Save document":"Enregistrer le document",Save:"Enregistrer","Open another .djvu file":"Ouvrir un autre fichier .djvu","The application for viewing .djvu files in the browser.":"Une application pour afficher des fichiers .djvu dans le naviguateur.","If something doesn't work properly, feel free to write about the problem at #email.":"Si quelque chose ne fonctionne pas correctement, vous pouvez \xe9crire \xe0 #email.","The official website is #website.":"Le site officiel est #website.","The source code is available on #link.":"Le code source est disponible \xe0 l'adresse: #link.",Hotkeys:"Raccourcis Clavier","save the document":"enregistrer le document","go to the previous page":"page pr\xe9c\xe9dente","go to the next page":"page suivante",Controls:"Boutons","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon & #collapseIcon permettent de passer en mode pleine page et inversement.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"Si vous utilisez l'extension pour navigateur, ces boutons n'auront aucun effet, car l'application occupe d\xe9j\xe0 toute la page.","Continuous scroll view mode":"Mode d\xe9filement continu","Number of pages in a row":null,"Number of pages in the first row":null,"Single page view mode":"Mode page unique","Text view mode":"Mode texte","Click on the number to enter it manually":"Cliquer sur le nombre pour en saisir un manuellement","Rotate the page":"Faire pivoter la page","You also can scale the page via Ctrl+MouseWheel":"Vous pouvez \xe9galement ajuster la page avec Ctrl+Molette","Text cursor mode":"Curseur pour mettre le texte en surbrillance","Grab cursor mode":"D\xe9filement glisser-d\xe9poser","Table of contents":"Table des mati\xe8res","Toolbar is always shown":"Les contr\xf4les sont toujours affich\xe9s","Toolbar automatically hides":"Les contr\xf4les se masquent automatiquement",Contents:"Table des mati\xe8res","No contents provided":"Pas de sommaire","The link points to another document. Do you want to proceed?":"Le lien redirige vers un autre document. Voulez-vous continuer ?","No text on this page":"Pas de texte dans cette page","You are trying to save an indirect (multi-file) document.":"Vous essayez d'enregistrer un document multi-fichier ","What exactly do you want to do?":"Que voulez-vous faire ?","Save only index file":"Enregistrer uniquement le fichier racine","Download, bundle and save the whole document as one file":"T\xe9l\xe9charger, rassembler & sauveguarder l'ensemble du document dans un seul fichier","Downloading and bundling the document":"T\xe9l\xe9chargement & assemblage du document","The document has been downloaded and bundled into one file successfully":"Le document a \xe9t\xe9 t\xe9l\xe9charg\xe9, rassembl\xe9 & sauveguard\xe9 dans un seul fichier avec succ\xe8s","Print document":"Imprimer le document","Pages must be rendered before printing.":"Les pages doivent \xeatre rendues avant impression","It may take a while.":"Cela peut prendre un moment","Select the pages you want to print.":"S\xe9lectionner la page \xe0 imprimer",From:"De",to:"\xe0","Prepare pages for printing":"Pr\xe9parer les pages pour l'impression","Preparing pages for printing":"Pr\xe9paration des pages pour l'impression",Menu:"Menu",Document:"Document",About:"\xc0 propos",Print:"Imprimer",Close:"Fermer","View mode":"Mode de vue",Scale:"Taille",Rotation:"Rotation","Cursor mode":"Mode de curseur","Full page mode":"Page entier","Fullscreen mode":"Plein \xe9cran"},it:{englishName:"Italian",nativeName:"Italiano",Language:"Lingua","Add more":"Aggiungi traduzione","The translation isn't complete.":"La traduzione non \xe8 completa","The following phrases are not translated:":"Le seguenti frasi non sono tradotte:","You can improve the translation here":"Migliora la traduzione qui","#helpButton - learn more about the app":"#helpButton - Istruzioni all'uso dell'app","#optionsButton - see the available options":"#optionsButton - Opzioni disponibili","powered with":"Powered with","Drag & Drop a file here or click to choose manually":"Trascina e rilascia qui il file DjVu o fai clic per selezionarlo manualmente","Paste a URL to a djvu file here":"Incolla qui l'URL al file DjVu","Open URL":"Apri URL",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Inserire un URL valido (deve iniziare con "http(s)://" | "data:")',Error:"Errore","Error on page":"Errore nella pagina","Network error":"Errore di rete","Check your network connection":"Controlla la connessione di rete","Web request error":"Errore richiesta web","404 Document not found":"404 Documento non trovato","403 Access forbidden":"403 Accesso negato","500 Internal server error":"500 Errore interno del server","The request failed with HTTP status #status":"La richiesta web \xe8 fallita con stato HTTP #status","DjVu file is corrupted":"Il file DjVu \xe8 corrotto","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"Il file non \xe8 conforme alle specifiche del formato DjVu oppure \xe8 incompleto","Incorrect file format":"Formato file non corretto","The provided file is not a DjVu document":"Il file non \xe8 in formato DjVu","Incorrect page number":"Numero pagina non corretto","There is no page with the number #pageNumber":"Non esiste una pagina con il numero #pageNumber","No base URL for an indirect DjVu document":"Manca l'URL di base del documento DjVu multi-file (formato indirect)","You probably opened an indirect (multi-file) DjVu document manually.":"Si \xe8 cercato di aprire manualmente un documento DjVu multi-file (formato indirect).","But such multi-file documents can be only loaded by URL.":"Un documento DjVu multi-file (formato indirect) pu\xf2 essere aperto solo tramite URL.","Unexpected error":"Errore sconosciuto","Cannot print the error, look in the console":"Non \xe8 possibile riportare l'errore, cercare nella console",Options:"Opzioni","Show options window":"Mostra opzioni","Color theme":"Colore tema","Extension options":"Opzioni estensioni","Open all links with .djvu at the end via the viewer":"Aprire tutti i link con estensione .djvu tramite viewer","All links to .djvu files will be opened by the viewer via a simple click on a link":"Tutti i link con estensione .djvu saranno aperti nel viewer con un solo clic","Detect .djvu files by means of http headers":"Identifica un file .djvu tramite gli header http","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"\u0410nalizza gli header http di ogni nuovo tab del browser al fine di processare i link che non terminano con estensione .djvu",Ready:"Pronto",Loading:"In caricamento","Show help window":"Mostra guida","Switch full page mode":"Attiva/disattiva modalit\xe0 a piena pagina","Choose a file":"Scegli un file","Close document":"Chiudi documento","Save document":"Salva documento",Save:"Salva","Open another .djvu file":"Apri un altro file .djvu","The application for viewing .djvu files in the browser.":"Applicazione per visualizzare i file .djvu nel browser.","If something doesn't work properly, feel free to write about the problem at #email.":"In caso di malfunzionamento scrivere a #email.","The official website is #website.":"Sito web ufficiale #website.","The source code is available on #link.":"Il codice sorgente \xe8 disponibile all'indirizzo #link.",Hotkeys:"Scorciatoie da tastiera","save the document":"Salva il documento","go to the previous page":"Vai alla pagina precedente","go to the next page":"Vai alla pagina successiva",Controls:"Controlli","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon e #collapseIcon servono per attivare/disattivare la modalit\xe0 a piena pagina.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"Se si usa l'estensione per il browser questi pulsanti non hanno effetto perch\xe9 la modalit\xe0 di default \xe8 a piena pagina.","Continuous scroll view mode":"Vista a pagina continua","Number of pages in a row":null,"Number of pages in the first row":null,"Single page view mode":"Vista a pagina singola","Text view mode":"Vista testo","Click on the number to enter it manually":"Fai clic sul numero per andare alla pagina","Rotate the page":"Ruota pagina","You also can scale the page via Ctrl+MouseWheel":"Puoi ingrandire la pagina tramite ctrl + rotella mouse","Text cursor mode":"Modalit\xe0 selezione testo","Grab cursor mode":"Modalit\xe0 trascinamento pagina","Table of contents":"Indice dei contenuti","Toolbar is always shown":"Toolbar sempre visibile","Toolbar automatically hides":"Toolbar nascosta automaticamente",Contents:"Contenuti","No contents provided":"Nessun contenuto disponibile","The link points to another document. Do you want to proceed?":"Il link punta ad un altro documento. Vuoi procedere?","No text on this page":"Nessun contenuto testuale nel documento","You are trying to save an indirect (multi-file) document.":"Stai per salvare un documento DjVu multi-file (formato indirect).","What exactly do you want to do?":"Cosa vuoi fare?","Save only index file":"Salva solo indice","Download, bundle and save the whole document as one file":"Scarica, impacchetta e salva documento completo in un unico file","Downloading and bundling the document":"Scaricamento e impacchettamento in corso","The document has been downloaded and bundled into one file successfully":"Il documento \xe8 stato scaricato e impacchettato correttamente","Print document":"Stampa documento","Pages must be rendered before printing.":"Le pagine devono essere processate prima della stampa.","It may take a while.":"Potrebbe richiedere tempo","Select the pages you want to print.":"Seleziona le pagine da stampare",From:"Da",to:"a","Prepare pages for printing":"Avvia processo di stampa","Preparing pages for printing":"Sto preparando le pagine per la stampa",Menu:"Menu",Document:"Documento",About:"Info",Print:"Stampa",Close:"Chiudi","View mode":"Modalit\xe0 vista",Scale:"Scala",Rotation:"Ruota","Cursor mode":"Moldalit\xe0 cursore","Full page mode":"Modalit\xe0 a piena pagina","Fullscreen mode":"Modalit\xe0 a pieno schermo"},zh:{englishName:"Simplified Chinese",nativeName:"\u7b80\u4f53\u4e2d\u6587",Language:"\u8bed\u8a00","Add more":"\u6dfb\u52a0\u66f4\u591a","The translation isn't complete.":"\u7ffb\u8bd1\u5c1a\u672a\u5b8c\u6210\u3002","The following phrases are not translated:":"\u4ee5\u4e0b\u77ed\u8bed\u5c1a\u672a\u88ab\u7ffb\u8bd1","You can improve the translation here":"\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u5b8c\u5584\u7ffb\u8bd1","#helpButton - learn more about the app":"#helpButton - \u4e86\u89e3\u66f4\u591a","#optionsButton - see the available options":"#optionsButton - \u67e5\u770b\u6240\u6709\u9009\u9879","powered with":"\u57fa\u4e8e","Drag & Drop a file here or click to choose manually":"\u5c06\u6587\u4ef6\u62d6\u62fd\u81f3\u6b64\u5904\u6216\u8005\u5355\u51fb\u624b\u52a8\u9009\u62e9","Paste a URL to a djvu file here":"\u5728\u6b64\u5904\u7c98\u8d34djvu\u6587\u4ef6\u7684\u5730\u5740","Open URL":"\u6253\u5f00\u5730\u5740",'Enter a valid URL (it should start with "http(s)://" | "data:")':'\u8f93\u5165\u4e00\u4e2a\u6709\u6548\u7684\u5730\u5740 (\u5e94\u5f53\u4ee5 "http(s)://" | "data:" \u5f00\u5934)',Error:"\u9519\u8bef","Error on page":"\u9875\u9762\u9519\u8bef","Network error":"\u7f51\u7edc\u9519\u8bef","Check your network connection":"\u68c0\u67e5\u4f60\u7684\u7f51\u7edc\u8fde\u63a5","Web request error":"\u7f51\u7edc\u8bf7\u6c42\u9519\u8bef","404 Document not found":"404 \u6587\u4ef6\u672a\u627e\u5230","403 Access forbidden":"403 \u7981\u6b62\u8bbf\u95ee","500 Internal server error":"500 \u670d\u52a1\u5668\u5185\u90e8\u9519\u8bef","The request failed with HTTP status #status":"\u8bf7\u6c42\u5931\u8d25\uff0cHTTP\u72b6\u6001 #status","DjVu file is corrupted":"DjVu\u6587\u4ef6\u635f\u574f","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"\u6587\u4ef6\u4e0d\u6ee1\u8db3DjVu\u683c\u5f0f\u8981\u6c42\u6216\u4e0d\u5b8c\u6574","Incorrect file format":"\u6587\u4ef6\u683c\u5f0f\u9519\u8bef","The provided file is not a DjVu document":"\u63d0\u4f9b\u7684\u6587\u4ef6\u4e0d\u662f\u4e00\u4e2aDjVu\u6587\u4ef6","Incorrect page number":"\u9875\u7801\u9519\u8bef","There is no page with the number #pageNumber":"\u6ca1\u6709\u9875\u9762\u4e3a#pageNumber\u7684\u9875\u9762","No base URL for an indirect DjVu document":"\u76f8\u5bf9\u8def\u5f84\u7684DjVu\u6587\u6863\u7f3a\u5c11\u6839\u8def\u5f84","You probably opened an indirect (multi-file) DjVu document manually.":"\u4f60\u5f88\u6709\u53ef\u80fd\u624b\u52a8\u6253\u5f00\u4e86\u4e00\u4e2a\uff08\u591a\u6587\u4ef6\uff09\u76f8\u5bf9\u8def\u5f84DjVu\u6587\u6863\u3002","But such multi-file documents can be only loaded by URL.":"\u4f46\u662f\u8fd9\u79cd\u591a\u6587\u4ef6\u6587\u6863\u53ea\u80fd\u901a\u8fc7\u5b8c\u6574\u8def\u5f84\u6253\u5f00\u3002","Unexpected error":"\u672a\u77e5\u9519\u8bef","Cannot print the error, look in the console":"\u65e0\u6cd5\u6253\u5370\u9519\u8bef\uff0c\u8bf7\u67e5\u770b\u63a7\u5236\u53f0",Options:"\u9009\u9879","Show options window":"\u663e\u793a\u9009\u9879\u7a97\u53e3","Color theme":"\u989c\u8272\u4e3b\u9898","Extension options":"\u6269\u5c55\u9009\u9879","Open all links with .djvu at the end via the viewer":"\u901a\u8fc7\u9605\u8bfb\u5668\u6253\u5f00\u6240\u6709\u4ee5.djvu\u7ed3\u5c3e\u7684\u94fe\u63a5","All links to .djvu files will be opened by the viewer via a simple click on a link":"\u6240\u6709.djvu\u6587\u4ef6\u94fe\u63a5\u5c06\u4f1a\u88ab\u9605\u8bfb\u5668\u6253\u5f00","Detect .djvu files by means of http headers":"\u901a\u8fc7http\u5934\u4fe1\u606f\u68c0\u6d4b.djvu\u6587\u4ef6","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"\u5206\u6790\u6bcf\u4e00\u4e2a\u65b0\u9009\u9879\u5361\u4ee5\u5904\u7406\u4e0d\u662f\u4ee5.djvu\u7ed3\u5c3e\u7684\u94fe\u63a5",Ready:"\u5c31\u7eea",Loading:"\u52a0\u8f7d\u4e2d","Show help window":"\u663e\u793a\u5e2e\u52a9\u7a97\u53e3","Switch full page mode":"\u5207\u6362\u5168\u5c4f\u6a21\u5f0f","Choose a file":"\u9009\u62e9\u6587\u4ef6","Close document":"\u5173\u95ed\u6587\u6863","Save document":"\u4fdd\u5b58\u6587\u6863",Save:"\u4fdd\u5b58","Open another .djvu file":"\u6253\u5f00\u53e6\u4e00\u4e2a.djvu\u6587\u4ef6","The application for viewing .djvu files in the browser.":"\u8fd9\u662f\u4e00\u4e2a\u5728\u6d4f\u89c8\u5668\u4e2d\u6d4f\u89c8.djvu\u6587\u4ef6\u7684\u5e94\u7528\u3002","If something doesn't work properly, feel free to write about the problem at #email.":"\u5982\u679c\u8fd0\u884c\u6709\u95ee\u9898\uff0c\u8bf7\u5411#email\u53cd\u9988\u3002","The official website is #website.":"\u5b98\u65b9\u7f51\u7ad9\u662f#website\u3002","The source code is available on #link.":"\u6e90\u4ee3\u7801\u4f4d\u4e8e#link\u3002",Hotkeys:"\u70ed\u952e","save the document":"\u4fdd\u5b58\u6587\u6863","go to the previous page":"\u4e0a\u4e00\u9875","go to the next page":"\u4e0b\u4e00\u9875",Controls:"\u63a7\u4ef6","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon \u548c #collapseIcon \u7528\u4e8e\u5c06\u9605\u8bfb\u5668\u5728\u5168\u5c4f\u6a21\u5f0f\u548c\u6b63\u5e38\u6a21\u5f0f\u95f4\u5207\u6362\u3002","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"\u5982\u679c\u4f60\u662f\u5728\u4f7f\u7528\u6d4f\u89c8\u5668\u63d2\u4ef6\uff0c\u5219\u8fd9\u4e9b\u6309\u94ae\u5c06\u4e0d\u8d77\u4f5c\u7528\uff0c\u56e0\u4e3a\u9605\u8bfb\u5668\u4f1a\u9ed8\u8ba4\u4f7f\u7528\u6574\u4e2a\u9875\u9762\u3002","Continuous scroll view mode":"\u8fde\u7eed\u6eda\u52a8\u6a21\u5f0f","Number of pages in a row":null,"Number of pages in the first row":null,"Single page view mode":"\u5355\u9875\u6a21\u5f0f","Text view mode":"\u6587\u672c\u6a21\u5f0f","Click on the number to enter it manually":"\u70b9\u51fb\u6570\u5b57\u4ee5\u624b\u52a8\u8f93\u5165","Rotate the page":"\u65cb\u8f6c\u9875\u9762","You also can scale the page via Ctrl+MouseWheel":"\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7Ctrl+\u9f20\u6807\u6eda\u8f6e\u6765\u7f29\u653e\u9875\u9762","Text cursor mode":"\u6587\u672c\u9009\u62e9\u6a21\u5f0f","Grab cursor mode":"\u62d6\u62fd\u6a21\u5f0f","Table of contents":"\u76ee\u5f55","Toolbar is always shown":"\u5de5\u5177\u680f\u5e38\u663e\u793a","Toolbar automatically hides":"\u5de5\u5177\u680f\u81ea\u52a8\u9690\u85cf",Contents:"\u76ee\u5f55","No contents provided":"\u6ca1\u6709\u76ee\u5f55","The link points to another document. Do you want to proceed?":"\u8fd9\u4e2a\u94fe\u63a5\u6307\u5411\u53e6\u4e00\u4e2a\u6587\u6863\uff0c\u4f60\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f","No text on this page":"\u8be5\u9875\u6ca1\u6709\u6587\u672c","You are trying to save an indirect (multi-file) document.":"\u4f60\u5728\u8bd5\u56fe\u4fdd\u5b58\u76f8\u5bf9\u8def\u5f84\u7684\u591a\u6587\u4ef6\u6587\u6863\u3002","What exactly do you want to do?":"\u4f60\u5177\u4f53\u662f\u60f3\u505a\u4ec0\u4e48\uff1f","Save only index file":"\u53ea\u4fdd\u5b58\u7d22\u5f15\u6587\u4ef6","Download, bundle and save the whole document as one file":"\u4e0b\u8f7d\u6253\u5305\u5e76\u4fdd\u5b58\u6210\u4e00\u4e2a\u6587\u4ef6","Downloading and bundling the document":"\u6b63\u5728\u4e0b\u8f7d\u5e76\u6253\u5305\u6587\u4ef6","The document has been downloaded and bundled into one file successfully":"\u6587\u4ef6\u5df2\u6210\u529f\u4e0b\u8f7d\u6253\u5305\u5230\u4e00\u4e2a\u6587\u4ef6","Print document":"\u6253\u5370\u6587\u6863","Pages must be rendered before printing.":"\u6253\u5370\u524d\u9700\u6e32\u67d3\u9875\u9762\uff0c","It may take a while.":"\u53ef\u80fd\u9700\u8981\u4e00\u4f1a\u513f\u3002","Select the pages you want to print.":"\u9009\u62e9\u4f60\u60f3\u6253\u5370\u7684\u9875\u9762\u3002",From:"\u4ece",to:"\u5230","Prepare pages for printing":"\u51c6\u5907\u9875\u9762\u4ee5\u6253\u5370","Preparing pages for printing":"\u51c6\u5907\u9875\u9762\u4e2d",Menu:"\u83dc\u5355",Document:"\u6587\u6863",About:"\u5173\u4e8e",Print:"\u6253\u5370",Close:"\u5173\u95ed","View mode":"\u663e\u793a\u6a21\u5f0f",Scale:"\u7f29\u653e",Rotation:"\u65cb\u8f6c","Cursor mode":"\u5149\u6807\u6a21\u5f0f","Full page mode":"\u6574\u9875\u6a21\u5f0f","Fullscreen mode":"\u5168\u5c4f\u6a21\u5f0f"},pt:{englishName:"Portuguese",nativeName:"Portugu\xeas",Language:"Idioma","Add more":"Adicionar mais","The translation isn't complete.":"A tradu\xe7\xe3o n\xe3o est\xe1 completa.","The following phrases are not translated:":"As seguintes frases n\xe3o s\xe3o traduzidas:","You can improve the translation here":"Pode melhorar a tradu\xe7\xe3o aqui","#helpButton - learn more about the app":"#helpButton - saber mais sobre a aplica\xe7\xe3o","#optionsButton - see the available options":"#optionsButton - ver as op\xe7\xf5es dispon\xedveis","powered with":"powered by","Drag & Drop a file here or click to choose manually":"Arrastar e largar um ficheiro aqui ou clicar para escolher manualmente","Paste a URL to a djvu file here":"Colar aqui um URL a um ficheiro djvu","Open URL":"Abrir URL",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Introduza um URL v\xe1lido (deve come\xe7ar com "http(s)://" | "data:")',Error:"Erro","Error on page":"Erro na p\xe1gina","Network error":"Erro de rede","Check your network connection":"Verifique a sua liga\xe7\xe3o \xe0 rede","Web request error":"Pedido de erro na Web","404 Document not found":"404 Documento n\xe3o encontrado","403 Access forbidden":"403 Acesso proibido","500 Internal server error":"500 Erro interno do servidor","The request failed with HTTP status #status":"O pedido falhou com o status HTTP #status","DjVu file is corrupted":"O ficheiro DjVu est\xe1 corrompido","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"O ficheiro n\xe3o cumpre as especifica\xe7\xf5es do formato DjVu ou n\xe3o \xe9 um documento DjVu completo","Incorrect file format":"Formato de ficheiro incorrecto","The provided file is not a DjVu document":"O ficheiro fornecido n\xe3o \xe9 um documento DjVu","Incorrect page number":"N\xfamero de p\xe1gina incorrecto","There is no page with the number #pageNumber":"N\xe3o h\xe1 p\xe1gina com o n\xfamero #pageNumber","No base URL for an indirect DjVu document":"Sem URL base para um documento indirecto DjVu","You probably opened an indirect (multi-file) DjVu document manually.":"Provavelmente abriu manualmente um documento DjVu indirecto (multi-arquivos).","But such multi-file documents can be only loaded by URL.":"Mas tais documentos multi-arquivos s\xf3 podem ser carregados por URL.","Unexpected error":"Erro inesperado","Cannot print the error, look in the console":"N\xe3o \xe9 poss\xedvel imprimir o erro, procurar na consola",Options:"Op\xe7\xf5es","Show options window":"Mostrar janela de op\xe7\xf5es","Color theme":"Tema de cor","Extension options":"Op\xe7\xf5es de extens\xe3o","Open all links with .djvu at the end via the viewer":"Abrir todas as liga\xe7\xf5es com .djvu no final atrav\xe9s do visualizador","All links to .djvu files will be opened by the viewer via a simple click on a link":"Todos os links para ficheiros .djvu ser\xe3o abertos pelo espectador atrav\xe9s de um simples clique num link","Detect .djvu files by means of http headers":"Detectar ficheiros .djvu por meio de cabe\xe7alhos http","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"Analisar os cabe\xe7alhos de cada novo separador a fim de processar at\xe9 liga\xe7\xf5es que n\xe3o terminam com a extens\xe3o .djvu",Ready:"Preparado",Loading:"Carregando","Show help window":"Mostrar janela de ajuda","Switch full page mode":"Mudar o modo de p\xe1gina inteira","Choose a file":"Escolha um ficheiro","Close document":"Fechar documento","Save document":"Guardar documenta\xe7\xe3o",Save:"Guardar","Open another .djvu file":"Abrir outro ficheiro .djvu","The application for viewing .djvu files in the browser.":"A aplica\xe7\xe3o para visualizar ficheiros .djvu no browser.","If something doesn't work properly, feel free to write about the problem at #email.":"Se algo n\xe3o funcionar correctamente, sinta-se \xe0 vontade para escrever sobre o problema em #email.","The official website is #website.":"O site oficial \xe9 #website.","The source code is available on #link.":"O c\xf3digo fonte est\xe1 dispon\xedvel em #link.",Hotkeys:"Teclas de atalho","save the document":"guardar o documento","go to the previous page":"ir para a p\xe1gina anterior","go to the next page":"ir para a p\xe1gina seguinte",Controls:"Controles","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon e #collapseIcon devem mudar o visualizador para o modo p\xe1gina inteira e voltar.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"Se trabalhar com a extens\xe3o do navegador, estes bot\xf5es n\xe3o causar\xe3o qualquer efeito, uma vez que o visualizador leva a p\xe1gina inteira por defeito.","Continuous scroll view mode":"Modo de visualiza\xe7\xe3o scroll cont\xednuo","Number of pages in a row":null,"Number of pages in the first row":null,"Single page view mode":"Modo de visualiza\xe7\xe3o de uma p\xe1gina","Text view mode":"Modo de visualiza\xe7\xe3o de texto","Click on the number to enter it manually":"Clique no n\xfamero para o introduzir manualmente","Rotate the page":"Rodar a p\xe1gina","You also can scale the page via Ctrl+MouseWheel":"Tamb\xe9m pode escalar a p\xe1gina atrav\xe9s de Ctrl+MouseWheel","Text cursor mode":"Modo cursor de texto","Grab cursor mode":"Modo de agarrar o cursor","Table of contents":null,"Toolbar is always shown":null,"Toolbar automatically hides":null,Contents:"Conte\xfados","No contents provided":"Nenhum conte\xfado fornecido","The link points to another document. Do you want to proceed?":"A liga\xe7\xe3o aponta para outro documento. Quer prosseguir?","No text on this page":"Nenhum texto nesta p\xe1gina","You are trying to save an indirect (multi-file) document.":"Est\xe1 a tentar salvar um documento indirecto (multi-arquivo).","What exactly do you want to do?":"Que queres fazer exactamente?","Save only index file":"Guardar s\xf3 ficheiro de \xedndice","Download, bundle and save the whole document as one file":"Descarregar, agrupar e guardar o documento inteiro como um s\xf3 ficheiro","Downloading and bundling the document":"Descarregar e empacotar o documento","The document has been downloaded and bundled into one file successfully":"O documento foi descarregado e agrupado num \xfanico ficheiro com sucesso","Print document":"Imprimir documento","Pages must be rendered before printing.":"As p\xe1ginas devem ser entregues antes da impress\xe3o.","It may take a while.":"Pode demorar algum tempo.","Select the pages you want to print.":"Seleccione as p\xe1ginas que pretende imprimir.",From:"De",to:"a","Prepare pages for printing":"Preparar p\xe1ginas para impress\xe3o","Preparing pages for printing":"Preparar p\xe1ginas para impress\xe3o",Menu:null,Document:null,About:null,Print:null,Close:null,"View mode":null,Scale:null,Rotation:null,"Cursor mode":null,"Full page mode":null,"Fullscreen mode":null},es:{englishName:"Spanish",nativeName:"Castellano",Language:"Idioma","Add more":"A\xf1adir mas","The translation isn't complete.":"La traducci\xf3n est\xe1 incompleta.","The following phrases are not translated:":"Las siguientes frases no estan traduccidas:","You can improve the translation here":"Puedes mejorar la traducci\xf3n aqu\xed","#helpButton - learn more about the app":"#helpButton - saber m\xe1s sobre la aplicaci\xf3n","#optionsButton - see the available options":"#optionsButton - ver las opciones disponibles","powered with":"Powered with","Drag & Drop a file here or click to choose manually":"Arrastrar y soltar un archivo o click para elegirlo manualmente","Paste a URL to a djvu file here":"Pegar una URL al archivo djvu aqu\xed","Open URL":"Abrir URL",'Enter a valid URL (it should start with "http(s)://" | "data:")':'Introducir una URL v\xe1lida (debe comenzar con "http(s)://" | "data:")',Error:"Error","Error on page":"Error en la p\xe1gina","Network error":"Error de red","Check your network connection":"Compruebe su conexi\xf3n a la red","Web request error":"Error en la solicitud de la web","404 Document not found":"404 Documento no encontrado","403 Access forbidden":"403 Acceso prohibido","500 Internal server error":"500 Error interno del servidor","The request failed with HTTP status #status":"La solicitud ha fallado con el estado HTTP #status","DjVu file is corrupted":"El archivo DjVu esta corrupto","The file doesn't comply with the DjVu format specification or it's not a whole DjVu document":"El archivo no cumple con la especificaci\xf3n del formato DjVu o no es un documento DjVu completo","Incorrect file format":"Formato de archivo incorrecto","The provided file is not a DjVu document":"El archivo proporcionado no es un documento DjVu","Incorrect page number":"N\xfamero de p\xe1gina incorrecto","There is no page with the number #pageNumber":"No hay ninguna p\xe1gina con el n\xfamero #pageNumber","No base URL for an indirect DjVu document":"No hay URL base para un documento DjVu indirecto","You probably opened an indirect (multi-file) DjVu document manually.":"Probablemente haya abierto manualmente un documento DjVu indirecto (de varios archivos).","But such multi-file documents can be only loaded by URL.":"Pero estos documentos de varios archivos s\xf3lo pueden cargarse por URL.","Unexpected error":"Error inesperado","Cannot print the error, look in the console":"No se puede imprimir el error, mira en la consola",Options:"Opciones","Show options window":"Mostrar ventana de opciones","Color theme":"Tema de color","Extension options":"Opciones de extensi\xf3n","Open all links with .djvu at the end via the viewer":"Abrir todos los enlaces con .djvu al final a trav\xe9s del visor","All links to .djvu files will be opened by the viewer via a simple click on a link":"Todos los enlaces a archivos .djvu ser\xe1n abiertos por el visor mediante un clic simple en un enlace","Detect .djvu files by means of http headers":"Detectar archivos .djvu mediante cabeceras http","Analyze headers of every new tab in order to process even links which do not end with the .djvu extension":"Analizar las cabeceras de cada nueva pesta\xf1a para procesar incluso los enlaces que no terminan con la extensi\xf3n .djvu",Ready:"Listo",Loading:"Cargando","Show help window":"Mostrar ventana de ayuda","Switch full page mode":"Cambiar el modo de p\xe1gina completa","Choose a file":"Seleccionar archivo","Close document":"Cerrar documento","Save document":"Guardar documento",Save:"Guardar","Open another .djvu file":"Abrir otro archivo .djvu","The application for viewing .djvu files in the browser.":"La aplicaci\xf3n para ver archivos .djvu en el navegador.","If something doesn't work properly, feel free to write about the problem at #email.":"Si algo no funciona correctamente, no dudes en escribir sobre el problema en #email.","The official website is #website.":"El sitio web oficial es #website.","The source code is available on #link.":"El c\xf3digo fuente est\xe1 disponible en #link.",Hotkeys:"Atajos de teclado","save the document":"Guardar el documento","go to the previous page":"ir a la p\xe1gina anterior","go to the next page":"ir a la p\xe1gina siguiente",Controls:"Controles","#expandIcon and #collapseIcon are to switch the viewer to the full page mode and back.":"#expandIcon y #collapseIcon son para cambiar el visor al modo de p\xe1gina completa y viceversa.","If you work with the browser extension, these buttons will cause no effect, since the viewer takes the whole page by default.":"Si trabaja con la extensi\xf3n del navegador, estos botones no causar\xe1n ning\xfan efecto, ya que el visor toma toda la p\xe1gina por defecto.","Continuous scroll view mode":"Modo de scroll continuo","Number of pages in a row":"N\xfamero de p\xe1ginas por fila","Number of pages in the first row":"N\xfamero de p\xe1ginas en la primer fila","Single page view mode":"Modo de vista de una sola p\xe1gina","Text view mode":"Modo de vista de texto","Click on the number to enter it manually":"Haga clic en el n\xfamero para introducirlo manualmente","Rotate the page":"Rotar p\xe1gina","You also can scale the page via Ctrl+MouseWheel":"Tambi\xe9n puede escalar la p\xe1gina mediante Ctrl+Rueda del rat\xf3n","Text cursor mode":"Modo cursor de texto","Grab cursor mode":"Modo cursor de agarre","Table of contents":"Tabla de contenidos","Toolbar is always shown":"La barra de herramientas siempre se muestra","Toolbar automatically hides":"La barra de herramientas si oculta autom\xe1ticamente",Contents:"Contenido","No contents provided":"No se proporciona ning\xfan contenido","The link points to another document. Do you want to proceed?":"El enlace apunta a otro documento. \xbfDesea continuar?","No text on this page":"No hay texto en esta p\xe1gina","You are trying to save an indirect (multi-file) document.":"Est\xe1 intentando guardar un documento indirecto (de varios archivos)","What exactly do you want to do?":"\xbfQu\xe9 quiere hacer exactamente?","Save only index file":"Guardar s\xf3lo el archivo de \xedndice","Download, bundle and save the whole document as one file":"Descargue, agrupe y guarde todo el documento como un solo archivo","Downloading and bundling the document":"Descargando y agrupando el documento","The document has been downloaded and bundled into one file successfully":"El documento ha sido descargado y agrupado en un archivo con \xe9xito","Print document":"Imprimir documento","Pages must be rendered before printing.":"Las p\xe1ginas deben ser renderizadas antes de la impresi\xf3n.","It may take a while.":"Puede llevar un tiempo.","Select the pages you want to print.":"Seleccione las p\xe1ginas que desea imprimir.",From:"Desde",to:"hasta","Prepare pages for printing":"Preparar las p\xe1ginas para la impresi\xf3n","Preparing pages for printing":"Preparando p\xe1ginas para imprimir",Menu:"Men\xfa",Document:"Documento",About:"Acerca",Print:"Imprimir",Close:"Cerrar","View mode":"Modo de visualizaci\xf3n",Scale:"Escala",Rotation:"Rotaci\xf3n","Cursor mode":"Modo del cursor","Full page mode":"Modo de p\xe1gina completa","Fullscreen mode":"Modo de pantalla completa"}};const he=Object.freeze({documentId:0,fileName:null,userScale:1,pageRotation:0,isLoading:!1,viewMode:ne.SINGLE_PAGE_MODE,pagesQuantity:null,isFullPageView:!1,error:null,contents:null,isHelpWindowShown:!1,isOptionsWindowOpened:!1,isIndirect:!1,isContentsOpened:!1,options:{interceptHttpRequests:!0,analyzeHeaders:!1,locale:"en",theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",preferContinuousScroll:!1,pageCountInRow:1,firstRowPageCount:1},uiOptions:{hideFullPageSwitch:!1,changePageOnScroll:!0,showContentsAutomatically:!0,hideOpenAndCloseButtons:!1,hidePrintButton:!1,hideSaveButton:!1},appContext:{}});function me(e){return{...he,appContext:e.appContext,isFullPageView:e.isFullPageView,options:e.options,uiOptions:e.uiOptions}}const ge={pageCountInRow:e=>e.appContext.isMobile?1:Math.max(1,Math.min(e.options.pageCountInRow,e.pagesQuantity,ne.MAX_PAGE_COUNT_IN_ROW)),firstRowPageCount:e=>e.appContext.isMobile?1:Math.max(1,Math.min(e.options.firstRowPageCount,ge.pageCountInRow(e))),isContentsOpened:e=>e.isContentsOpened,dictionary:e=>pe[ge.options(e).locale]||pe.en,isOptionsWindowOpened:e=>e.isOptionsWindowOpened,uiOptions:e=>e.uiOptions,documentId:e=>e.documentId,userScale:e=>e.userScale,pageRotation:e=>e.pageRotation,pagesQuantity:e=>e.pagesQuantity,contents:e=>e.contents,isIndirect:e=>e.isIndirect,isHelpWindowShown:e=>e.isHelpWindowShown,fileName:e=>e.fileName,error:e=>e.error,options:e=>e.options,isFullPageView:e=>e.isFullPageView,isLoading:e=>e.isLoading,isDocumentLoaded:e=>!!e.pagesQuantity,viewMode:e=>e.isIndirect&&e.viewMode===ne.CONTINUOUS_SCROLL_MODE?ne.SINGLE_PAGE_MODE:e.viewMode},ve=Object.freeze({progress:0,buffer:null,isBundling:!1,isSaveDialogShown:!1});function be(e=ve,t){const{type:n,payload:r}=t;switch(n){case re.OPEN_SAVE_DIALOG:return{...e,isSaveDialogShown:!0};case re.START_TO_BUNDLE:return{...e,isBundling:!0};case re.UPDATE_FILE_PROCESSING_PROGRESS:return{...e,progress:r};case re.FINISH_TO_BUNDLE:return{...e,buffer:r};case re.ERROR:case re.CLOSE_SAVE_DIALOG:return ve;default:return e}}const ye=e=>ee((e=>e.fileProcessingState),e),we={isSaveDialogShown:ye((e=>e.isSaveDialogShown)),isBundling:ye((e=>e.isBundling)),resultBuffer:ye((e=>e.buffer)),fileProcessingProgress:ye((e=>e.progress))},Se=Object.freeze({isPrintDialogOpened:!1,isPreparingForPrinting:!1,printProgress:0,pagesForPrinting:null});function xe(e=Se,t){const{type:n,payload:r}=t;switch(n){case re.OPEN_PRINT_DIALOG:return{...Se,isPrintDialogOpened:!0};case re.PREPARE_PAGES_FOR_PRINTING:return{...e,isPreparingForPrinting:!0};case re.UPDATE_PRINT_PROGRESS:return{...e,printProgress:r};case re.START_PRINTING:return{...e,pagesForPrinting:r};case re.ERROR:case re.CLOSE_PRINT_DIALOG:return Se;default:return e}}const Oe=e=>ee((e=>e.printState),e),_e={isPrintDialogOpened:Oe((e=>e.isPrintDialogOpened)),isPreparingForPrinting:Oe((e=>e.isPreparingForPrinting)),printProgress:Oe((e=>e.printProgress)),pagesForPrinting:Oe((e=>e.pagesForPrinting))},je={...ge,...fe,...le,...we,..._e};var Ce=(e,t)=>(e=((e=he,t)=>{const n=t.payload;switch(t.type){case re.SET_UI_OPTIONS:return{...e,uiOptions:{...e.uiOptions,...n}};case re.UPDATE_OPTIONS:return{...e,options:{...e.options,...n}};case re.SET_VIEW_MODE:return{...e,viewMode:n,isLoading:n!==ne.TEXT_MODE&&e.isLoading};case ne.SET_PAGE_ROTATION_ACTION:return{...e,pageRotation:t.pageRotation};case re.TOGGLE_OPTIONS_WINDOW:return{...e,isOptionsWindowOpened:n};case ne.SHOW_HELP_WINDOW_ACTION:return{...e,isHelpWindowShown:!0};case ne.CLOSE_HELP_WINDOW_ACTION:return{...e,isHelpWindowShown:!1};case ne.SET_NEW_PAGE_NUMBER_ACTION:case ne.CREATE_DOCUMENT_FROM_ARRAY_BUFFER_ACTION:return{...e,isLoading:!0};case ne.IMAGE_DATA_RECEIVED_ACTION:case ne.PAGE_TEXT_FETCHED_ACTION:case ne.PAGE_ERROR_ACTION:case ne.PAGES_SIZES_ARE_GOTTEN:case re.SET_IMAGE_PAGE_ERROR:return{...e,isLoading:!1};case ne.DOCUMENT_CREATED_ACTION:return{...me(e),documentId:e.documentId+1,isLoading:!0,viewMode:e.options.preferContinuousScroll?ne.CONTINUOUS_SCROLL_MODE:he.viewMode,pagesQuantity:t.pagesQuantity,fileName:t.fileName,isIndirect:t.isIndirect};case ne.CLOSE_DOCUMENT_ACTION:return me(e);case ne.CONTENTS_IS_GOTTEN_ACTION:return{...e,contents:t.contents,isContentsOpened:e.uiOptions.showContentsAutomatically&&!e.appContext.isMobile&&!!t.contents};case ne.SET_USER_SCALE_ACTION:return{...e,userScale:t.scale};case ne.TOGGLE_FULL_PAGE_VIEW_ACTION:return{...e,isFullPageView:t.isFullPageView};case re.CLOSE_CONTENTS:return{...e,isContentsOpened:!1};case re.TOGGLE_CONTENTS:return{...e,isContentsOpened:!e.isContentsOpened};case re.ERROR:return{...e,isLoading:!1,error:n};case re.CLOSE_ERROR_WINDOW:return{...e,error:null};case re.UPDATE_APP_CONTEXT:return{...e,appContext:n};default:return e}})(e,t),{...e,fileLoadingState:ie(e.fileLoadingState,t),pageState:ce(e.pageState,t),fileProcessingState:be(e.fileProcessingState,t),printState:xe(e.printState,t)}),ke={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ee=i.a.createContext&&i.a.createContext(ke),Te=function(){return(Te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Ne=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function Pe(e){return e&&e.map((function(e,t){return i.a.createElement(e.tag,Te({key:t},e.attr),Pe(e.child))}))}function Ie(e){return function(t){return i.a.createElement(Re,Te({attr:Te({},e.attr)},t),Pe(e.child))}}function Re(e){var t=function(t){var n,r=e.attr,o=e.size,a=e.title,l=Ne(e,["attr","size","title"]),s=o||t.size||"1em";return t.className&&(n=t.className),e.className&&(n=(n?n+" ":"")+e.className),i.a.createElement("svg",Te({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,l,{className:n,style:Te(Te({color:e.color||t.color},t.style),e.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),a&&i.a.createElement("title",null,a),e.children)};return void 0!==Ee?i.a.createElement(Ee.Consumer,null,(function(e){return t(e)})):t(ke)}function Ae(e){return Ie({tag:"svg",attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M192 127.338v257.324c0 17.818-21.543 26.741-34.142 14.142L29.196 270.142c-7.81-7.81-7.81-20.474 0-28.284l128.662-128.662c12.599-12.6 34.142-3.676 34.142 14.142z"}}]})(e)}function De(e){return Ie({tag:"svg",attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"}}]})(e)}function Le(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"}}]})(e)}function Me(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M436 192H312c-13.3 0-24-10.7-24-24V44c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v84h84c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm-276-24V44c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v84H12c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24zm0 300V344c0-13.3-10.7-24-24-24H12c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-84h84c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12H312c-13.3 0-24 10.7-24 24v124c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12z"}}]})(e)}function ze(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Ue(e){return Ie({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}}]})(e)}function Fe(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function Be(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Ve(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function We(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M448 192V77.25c0-8.49-3.37-16.62-9.37-22.63L393.37 9.37c-6-6-14.14-9.37-22.63-9.37H96C78.33 0 64 14.33 64 32v160c-35.35 0-64 28.65-64 64v112c0 8.84 7.16 16 16 16h48v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h48c8.84 0 16-7.16 16-16V256c0-35.35-28.65-64-64-64zm-64 256H128v-96h256v96zm0-224H128V64h192v48c0 8.84 7.16 16 16 16h48v96zm48 72c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}function He(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function $e(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Ge(e){return Ie({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z"}}]})(e)}function qe(e){return Ie({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"}}]})(e)}function Ye(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M108 284c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h232c6.6 0 12 5.4 12 12v32c0 6.6-5.4 12-12 12H108zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}}]})(e)}function Ke(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 240v32c0 6.6-5.4 12-12 12h-88v88c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-88h-88c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h88v-88c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v88h88c6.6 0 12 5.4 12 12zm96-160v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}}]})(e)}const Qe={dropPageAction:e=>({type:ne.DROP_PAGE_ACTION,pageNumber:e}),pagesSizesAreGottenAction:e=>({type:ne.PAGES_SIZES_ARE_GOTTEN,sizes:e}),pageIsLoadedAction:(e,t)=>({type:ne.PAGE_IS_LOADED_ACTION,pageNumber:t,pageData:e}),setPageRotationAction:e=>t=>{0!==e&&90!==e&&180!==e&&270!==e||t({type:ne.SET_PAGE_ROTATION_ACTION,pageRotation:e})},closeDocumentAction:()=>({type:ne.CLOSE_DOCUMENT_ACTION}),setCursorModeAction:e=>({type:ne.SET_CURSOR_MODE_ACTION,cursorMode:e}),closeHelpWindowAction:()=>({type:ne.CLOSE_HELP_WINDOW_ACTION}),showHelpWindowAction:()=>({type:ne.SHOW_HELP_WINDOW_ACTION}),tryToSaveDocument:()=>(e,t)=>{je.isIndirect(t())?e({type:re.OPEN_SAVE_DIALOG}):e({type:re.SAVE_DOCUMENT})},startFileLoadingAction:()=>({type:ne.START_FILE_LOADING_ACTION}),endFileLoadingAction:()=>({type:ne.END_FILE_LOADING_ACTION}),goToNextPageAction:()=>(e,t)=>{const n=t();je.currentPageNumber(n)<je.pagesQuantity(n)&&e(Qe.setNewPageNumberAction(je.currentPageNumber(n)+1,!0))},goToPreviousPageAction:()=>(e,t)=>{const n=t();je.currentPageNumber(n)>1&&e(Qe.setNewPageNumberAction(je.currentPageNumber(n)-1,!0))},fileLoadingProgressAction:(e,t)=>({type:ne.FILE_LOADING_PROGRESS_ACTION,loaded:e,total:t}),errorAction:e=>(console.error(e),{type:re.ERROR,payload:e}),createDocumentFromArrayBufferAction:(e,t="***",n={})=>({type:ne.CREATE_DOCUMENT_FROM_ARRAY_BUFFER_ACTION,arrayBuffer:e,fileName:t,config:n}),setNewPageNumberAction:(e,t=!1)=>({type:ne.SET_NEW_PAGE_NUMBER_ACTION,pageNumber:e,shouldScrollToPage:t}),setPageByUrlAction:(e,t=!1)=>({type:ne.SET_PAGE_BY_URL_ACTION,url:e,closeContentsOnSuccess:t}),setUserScaleAction:e=>({type:ne.SET_USER_SCALE_ACTION,scale:e<.1?.1:e>6?6:e}),toggleFullPageViewAction:e=>t=>{const n="disable_scroll_djvujs";e?(document.querySelector("html").classList.add(n),document.body.classList.add(n)):(document.querySelector("html").classList.remove(n),document.body.classList.remove(n)),t({type:ne.TOGGLE_FULL_PAGE_VIEW_ACTION,isFullPageView:e})}};var Xe=Qe;const Ze=Object(Q.d)(["cursor:pointer;flex:0 0 auto;&:hover{transform:scale(1.1);}"]),Je=Object(Q.d)(["",";font-size:var(--button-basic-size);margin:0 0.5em;"],Ze),et=Object(Q.d)(["background:var(--background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--color);"]);var tt=n(0);const nt=Q.e.span.withConfig({displayName:"PageNumber__Root",componentId:"sc-wjuw6j-0"})(["flex:0 0 auto;min-width:4em;max-width:8em;height:90%;line-height:normal;box-sizing:border-box;white-space:nowrap;position:relative;text-align:center;display:inline-flex;align-items:center;justify-content:center;& > *{text-align:center;box-sizing:border-box;}& > input{",";position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;}"],et);class rt extends i.a.Component{constructor(e){super(e),this.startPageNumberEditing=()=>{this.setState({isEditing:!0})},this.finishPageNumberEditing=e=>{this.setState({isEditing:!1,tempValue:null});var t=+e.target.value;this.setNewPageNumber(t)},this.onKeyDown=e=>{"Enter"===e.key&&this.finishPageNumberEditing(e)},this.onChange=e=>{this.setState({tempValue:e.target.value})},this.inputRef=e=>{this.input=e},this.state={isEditing:!1,tempValue:null}}componentDidUpdate(){this.input&&setTimeout((()=>{try{this.input&&(this.input.focus(),this.input.select(),this.input=null)}catch(e){}}),10)}setNewPageNumber(e){this.props.pagesQuantity&&(e<1?e=1:e>this.props.pagesQuantity&&(e=this.props.pagesQuantity),e!==this.props.pageNumber&&this.props.setNewPageNumber(e,!0))}render(){return Object(tt.jsxs)(nt,{children:[this.state.isEditing?Object(tt.jsx)("input",{onKeyDown:this.onKeyDown,onBlur:this.finishPageNumberEditing,type:"number",min:"1",onChange:this.onChange,value:null===this.state.tempValue?this.props.pageNumber:this.state.tempValue,ref:this.inputRef}):null,Object(tt.jsx)("span",{onClick:this.startPageNumberEditing,style:this.state.isEditing?{visibility:"hidden",zIndex:-1}:null,children:this.props.pageNumber+(this.props.pagesQuantity?" / "+this.props.pagesQuantity:"")})]})}}const ot=i.a.createContext(((e,t=null)=>e)),it=({children:e})=>{const t=b(je.dictionary);return Object(tt.jsx)(ot.Provider,{value:dt(t),children:e})},at=()=>i.a.useContext(ot),lt=/[.*+\-?^${}()|[\]\\]/g,st=e=>e.replace(lt,"\\$&"),ut={};let ct=0;function dt(e){return(t,n=null)=>{const r=e[t]||pe.en[t]||t;if(pe.en[t]||(ut[t]="",clearTimeout(ct),ct=setTimeout((()=>{console.warn("\nThere are untranslated phrases (missing from the English dictionary):"),console.warn("\n"+JSON.stringify(ut,null,2).replaceAll('""','\n ""'))}),1e3)),!n)return r;const o=Object.keys(n).map(st).join("|"),a=new RegExp(`(${o})`,"g");return r.split(a).map((e=>e in n?Object(tt.jsx)(i.a.Fragment,{children:n[e]},e):e))}}const ft=Q.e.div.withConfig({displayName:"PageNumberBlock__Root",componentId:"sc-ct5egc-0"})(["margin:0 0.5em;flex:0 0 auto;display:flex;flex-wrap:nowrap;justify-content:center;align-items:center;height:100%;"]),pt=Object(Q.d)(["",";margin:0 0.1em;border-radius:100%;cursor:pointer;&:hover{transform:scale(1.1);box-shadow:0 0 1px gray;}&:active{background:#555;color:white;}"],Je);class ht extends i.a.Component{constructor(...e){super(...e),this.onInputChange=e=>{this.setNewPageNumber(+e.target.value)},this.goToNextPage=()=>{this.setNewPageNumber(this.props.pageNumber+1,!0)},this.goToPrevPage=()=>{this.setNewPageNumber(this.props.pageNumber-1,!1)}}setNewPageNumber(e,t=!0){e>=1&&e<=this.props.pagesQuantity?this.props.setNewPageNumber(e,!0):this.props.setNewPageNumber(t?1:this.props.pagesQuantity,!0)}render(){const e=this.context;return Object(tt.jsxs)(ft,{title:e("Click on the number to enter it manually"),"data-djvujs-id":"page_number_block",children:[Object(tt.jsx)(gt,{onClick:this.goToPrevPage}),Object(tt.jsx)(rt,{...this.props}),Object(tt.jsx)(vt,{onClick:this.goToNextPage})]})}}ht.contextType=ot;var mt=V((e=>({pageNumber:je.currentPageNumber(e),pagesQuantity:je.pagesQuantity(e)})),{setNewPageNumber:Xe.setNewPageNumberAction})(ht),gt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M8 256c0 137 111 248 248 248s248-111 248-248S393 8 256 8 8 119 8 256zm448 0c0 110.5-89.5 200-200 200S56 366.5 56 256 145.5 56 256 56s200 89.5 200 200zm-72-20v40c0 6.6-5.4 12-12 12H256v67c0 10.7-12.9 16-20.5 8.5l-99-99c-4.7-4.7-4.7-12.3 0-17l99-99c7.6-7.6 20.5-2.2 20.5 8.5v67h116c6.6 0 12 5.4 12 12z"}}]})(e)})).withConfig({displayName:"PageNumberBlock___StyledFaRegArrowAltCircleLeft",componentId:"sc-ct5egc-1"})(["",""],pt),vt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M504 256C504 119 393 8 256 8S8 119 8 256s111 248 248 248 248-111 248-248zm-448 0c0-110.5 89.5-200 200-200s200 89.5 200 200-89.5 200-200 200S56 366.5 56 256zm72 20v-40c0-6.6 5.4-12 12-12h116v-67c0-10.7 12.9-16 20.5-8.5l99 99c4.7 4.7 4.7 12.3 0 17l-99 99c-7.6 7.6-20.5 2.2-20.5-8.5v-67H140c-6.6 0-12-5.4-12-12z"}}]})(e)})).withConfig({displayName:"PageNumberBlock___StyledFaRegArrowAltCircleRight",componentId:"sc-ct5egc-2"})(["",""],pt);const bt=Q.e.span.withConfig({displayName:"ScaleGizmo__Root",componentId:"sc-i6aj1t-0"})(["display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:center;svg{",";font-size:calc(var(--button-basic-size) * 0.8);}input{",";display:inline-block;width:3em;margin:0 0.5em;}"],Ze,et);class yt extends i.a.Component{constructor(e){super(e),this.increaseScale=e=>{e.preventDefault();var t=Math.floor((Math.round(100*this.props.scale)+10)/10)/10;this.props.setUserScale(t)},this.decreaseScale=e=>{e.preventDefault();var t=Math.floor((Math.round(100*this.props.scale)-10)/10)/10;this.props.setUserScale(t)},this.startEditing=e=>{e.target.select()},this.finishEditing=e=>{var t=/\d+/.exec(e.target.value),n=t?+t[0]:1,r=Math.round(n)/100;this.props.setUserScale(r),e.target.blur(),this.setState({tempValue:null})},this.onKeyPress=e=>{"Enter"===e.key&&this.finishEditing(e)},this.onChange=e=>{this.setState({tempValue:e.target.value})},this.state={tempValue:null}}render(){const e=Math.round(100*this.props.scale),t=this.context;return Object(tt.jsxs)(bt,{title:t("You also can scale the page via Ctrl+MouseWheel"),"data-djvujs-id":"scale_gizmo",children:[Object(tt.jsx)(Be,{onClick:this.decreaseScale}),Object(tt.jsx)("input",{onFocus:this.startEditing,onKeyPress:this.onKeyPress,onBlur:this.finishEditing,type:"text",value:null===this.state.tempValue?e+"%":this.state.tempValue,onChange:this.onChange}),Object(tt.jsx)(Ve,{onClick:this.increaseScale})]})}}yt.contextType=ot;var wt=V((e=>({scale:je.userScale(e)})),{setUserScale:Xe.setUserScaleAction})(yt);const St=Q.e.span.withConfig({displayName:"StyledPrimitives__ControlButton",componentId:"sc-100dtlk-0"})(["",";"],Je),xt=Q.e.span.withConfig({displayName:"StyledPrimitives__ControlButtonWrapper",componentId:"sc-100dtlk-1"})(["cursor:pointer;:hover{","{transform:scale(1.1);}}"],St),Ot=Q.e.button.withConfig({displayName:"StyledPrimitives__TextButton",componentId:"sc-100dtlk-2"})(["background:inherit;color:var(--color);border:1px solid var(--color);border-radius:3px;padding:0.2em;cursor:pointer;&:hover{background:var(--alternative-background-color);}&:focus{outline:none;}"]),_t=Object(Q.f)(["0%{transform:rotate(0turn);}100%{transform:rotate(1turn);}"]),jt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(e)})).withConfig({displayName:"StyledPrimitives__Spinner",componentId:"sc-100dtlk-3"})(["animation:"," 1s infinite steps(9,end);"],_t),Ct={appWidth:890,appHeight:569,isMobile:!1},kt=Q.a,Et=()=>i.a.useContext(kt);var Tt=({AppRoot:e})=>{const t=Object(o.useRef)(null),n=function(e){const[t,n]=Object(o.useState)(Ct);return Object(o.useEffect)((()=>{if(!e.current)return;const t=new ResizeObserver((([e])=>{const t=e.contentBoxSize?e.contentBoxSize[0]||e.contentBoxSize:{inlineSize:e.contentRect.width,blockSize:e.contentRect.height};n({appWidth:t.inlineSize,appHeight:t.blockSize,isMobile:t.blockSize<569||t.inlineSize<890})}));return t.observe(e.current),()=>t.disconnect()}),[e.current,n]),t}(t),r=function(e){const[t,n]=Object(o.useState)(!1);return Object(o.useEffect)((()=>{if(!e.current)return;const t=()=>{n(document.fullscreenElement===e.current||document.webkitFullscreenElement===e.current)};e.current.addEventListener("fullscreenchange",t),e.current.addEventListener("webkitfullscreenchange",t)}),[e.current]),{isFullscreen:t,toggleFullscreen:async()=>{if(!e.current||!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)return;let n=null;t?(document.fullscreenElement||document.webkitFullscreenElement)&&(document.exitFullscreen?n=document.exitFullscreen():document.webkitExitFullscreen&&(n=e.current.webkitExitFullscreen())):e.current.requestFullscreen?n=e.current.requestFullscreen():e.current.webkitRequestFullScreen&&(n=e.current.webkitRequestFullScreen());try{await n}catch(r){console.warn("Cannot change fullscreen mode. Error: \n",r)}}}}(t),i=q(),a={...n,...r};Object(o.useEffect)((()=>{i({type:re.UPDATE_APP_CONTEXT,payload:a})}),[i,a]);const l=Object(o.useMemo)((()=>Object(tt.jsx)(e,{ref:t})),[t]);return Object(tt.jsx)(Q.b,{theme:a,children:l})};const Nt=Q.e.span.withConfig({displayName:"ViewModeButtons__ContinuousScrollButton",componentId:"sc-rdmqfy-0"})(["",";display:inline-flex;flex-direction:column;flex-wrap:nowrap;justify-content:center;overflow:hidden;max-height:100%;svg{flex:0 0 auto;}"],Je),Pt=Q.e.span.withConfig({displayName:"ViewModeButtons__ContinuousScrollButtonWrapper",componentId:"sc-rdmqfy-1"})(["height:100%;box-sizing:border-box;display:inline-flex;align-items:center;opacity:1;"]),It=Q.e.span.withConfig({displayName:"ViewModeButtons__Root",componentId:"sc-rdmqfy-2"})(["display:inline-flex;align-items:center;height:calc(var(--button-basic-size) * 1.2);& > span:not(","),","{opacity:0.5;}"],Pt,Nt),Rt=({value:e,max:t,onChange:n,title:r,style:o})=>Object(tt.jsxs)(Dt,{title:r,style:o,children:[Object(tt.jsx)(Ae,{"djvujs-disabled":e<2?1:null,onClick:()=>n(e-1)}),Object(tt.jsx)("span",{children:e}),Object(tt.jsx)(De,{"djvujs-disabled":e>=t?1:null,onClick:()=>n(e+1)})]});var At=V((e=>({viewMode:je.viewMode(e),isIndirect:je.isIndirect(e),pageCountInRow:je.pageCountInRow(e),firstRowPageCount:je.firstRowPageCount(e)})))((()=>{const e=q(),t=b(je.viewMode),n=b(je.isIndirect),r=b(je.pageCountInRow),o=b(je.firstRowPageCount),i=t===ne.CONTINUOUS_SCROLL_MODE,a=at(),{isMobile:l}=Et();return Object(tt.jsxs)(It,{"data-djvujs-id":"view_mode_buttons",children:[Object(tt.jsx)("span",{title:a("Text view mode"),style:t===ne.TEXT_MODE?{opacity:1}:null,children:Object(tt.jsx)(St,{as:Ge,onClick:()=>{e({type:re.SET_VIEW_MODE,payload:ne.TEXT_MODE})}})}),Object(tt.jsx)("span",{title:a("Single page view mode"),style:t===ne.SINGLE_PAGE_MODE?{opacity:1}:null,children:Object(tt.jsx)(St,{as:qe,onClick:()=>{e({type:re.SET_VIEW_MODE,payload:ne.SINGLE_PAGE_MODE})}})}),n?null:Object(tt.jsxs)(Pt,{children:[Object(tt.jsxs)(Nt,{style:i?{opacity:1}:null,title:a("Continuous scroll view mode"),onClick:()=>{e({type:re.SET_VIEW_MODE,payload:ne.CONTINUOUS_SCROLL_MODE})},children:[Object(tt.jsx)(qe,{}),Object(tt.jsx)(qe,{})]}),l?null:Object(tt.jsxs)(tt.Fragment,{children:[Object(tt.jsx)(Rt,{style:i?null:{visibility:"hidden"},title:a("Number of pages in a row"),max:ne.MAX_PAGE_COUNT_IN_ROW,value:r,onChange:t=>e({type:re.UPDATE_OPTIONS,payload:{pageCountInRow:t,firstRowPageCount:Math.min(o===r?t:o,t)}})}),Object(tt.jsx)(Rt,{style:i?null:{visibility:"hidden"},title:a("Number of pages in the first row"),max:Math.min(ne.MAX_PAGE_COUNT_IN_ROW,r),value:o,onChange:t=>e({type:re.UPDATE_OPTIONS,payload:{firstRowPageCount:t}})})]})]})]})})),Dt=Object(Q.e)("span").withConfig({displayName:"ViewModeButtons___StyledSpan",componentId:"sc-rdmqfy-3"})(["display:inline-flex;align-items:center;svg{font-size:2em;cursor:pointer;&[djvujs-disabled]{opacity:0.5;cursor:not-allowed;pointer-events:none;}&:hover{transform:scale(1.1);}}"]);const Lt=Q.e.div.withConfig({displayName:"CursorModeButtonGroup__Root",componentId:"sc-1lsg007-0"})(["white-space:nowrap;padding:0 0.1em;span{opacity:0.5;display:inline-block;&.active{opacity:1;}}"]);var Mt=()=>{const e=b(je.cursorMode),t=q(),n=at();return Object(tt.jsxs)(Lt,{"data-djvujs-id":"cursor_mode_buttons",children:[Object(tt.jsx)("span",{title:n("Text cursor mode"),className:e===ne.TEXT_CURSOR_MODE?"active":null,children:Object(tt.jsx)(zt,{onClick:()=>t(Xe.setCursorModeAction(ne.TEXT_CURSOR_MODE))})}),Object(tt.jsx)("span",{title:n("Grab cursor mode"),className:e===ne.GRAB_CURSOR_MODE?"active":null,children:Object(tt.jsx)(Ut,{onClick:()=>t(Xe.setCursorModeAction(ne.GRAB_CURSOR_MODE))})})]})},zt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M256 52.048V12.065C256 5.496 250.726.148 244.158.066 211.621-.344 166.469.011 128 37.959 90.266.736 46.979-.114 11.913.114 5.318.157 0 5.519 0 12.114v39.645c0 6.687 5.458 12.078 12.145 11.998C38.111 63.447 96 67.243 96 112.182V224H60c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h36v112c0 44.932-56.075 48.031-83.95 47.959C5.404 447.942 0 453.306 0 459.952v39.983c0 6.569 5.274 11.917 11.842 11.999 32.537.409 77.689.054 116.158-37.894 37.734 37.223 81.021 38.073 116.087 37.845 6.595-.043 11.913-5.405 11.913-12V460.24c0-6.687-5.458-12.078-12.145-11.998C217.889 448.553 160 444.939 160 400V288h36c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-36V112.182c0-44.932 56.075-48.213 83.95-48.142 6.646.018 12.05-5.346 12.05-11.992z"}}]})(e)})).withConfig({displayName:"CursorModeButtonGroup___StyledFaICursor",componentId:"sc-1lsg007-1"})(["",""],Je),Ut=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M372.57 112.641v-10.825c0-43.612-40.52-76.691-83.039-65.546-25.629-49.5-94.09-47.45-117.982.747C130.269 26.456 89.144 57.945 89.144 102v126.13c-19.953-7.427-43.308-5.068-62.083 8.871-29.355 21.796-35.794 63.333-14.55 93.153L132.48 498.569a32 32 0 0 0 26.062 13.432h222.897c14.904 0 27.835-10.289 31.182-24.813l30.184-130.958A203.637 203.637 0 0 0 448 310.564V179c0-40.62-35.523-71.992-75.43-66.359zm27.427 197.922c0 11.731-1.334 23.469-3.965 34.886L368.707 464h-201.92L51.591 302.303c-14.439-20.27 15.023-42.776 29.394-22.605l27.128 38.079c8.995 12.626 29.031 6.287 29.031-9.283V102c0-25.645 36.571-24.81 36.571.691V256c0 8.837 7.163 16 16 16h6.856c8.837 0 16-7.163 16-16V67c0-25.663 36.571-24.81 36.571.691V256c0 8.837 7.163 16 16 16h6.856c8.837 0 16-7.163 16-16V101.125c0-25.672 36.57-24.81 36.57.691V256c0 8.837 7.163 16 16 16h6.857c8.837 0 16-7.163 16-16v-76.309c0-26.242 36.57-25.64 36.57-.691v131.563z"}}]})(e)})).withConfig({displayName:"CursorModeButtonGroup___StyledFaRegHandPaper",componentId:"sc-1lsg007-2"})(["",""],Je);const Ft=Q.e.span.withConfig({displayName:"RotationControl__Root",componentId:"sc-1e5b0xb-0"})(["display:inline-flex;align-items:center;cursor:pointer;margin:0 0.5em;text-align:center;svg{font-size:calc(var(--button-basic-size) * 0.7);}svg:first-child{&:hover{transform:scale(1.1);}}svg:last-child{transform:scale(-1,1);&:hover{transform:scale(-1.1,1.1);}}"]);var Bt=()=>{const e=q(),t=b(je.pageRotation),n=at();return Object(tt.jsxs)(Ft,{"data-djvujs-id":"rotation_control",title:n("Rotate the page"),children:[Object(tt.jsx)(He,{onClick:()=>{e(Xe.setPageRotationAction(t?t-90:270))}}),Object(tt.jsxs)(Vt,{children:[t,"\xb0"]}),Object(tt.jsx)(He,{onClick:()=>{e(Xe.setPageRotationAction(270===t?0:t+90))}})]})},Vt=Object(Q.e)("span").withConfig({displayName:"RotationControl___StyledSpan",componentId:"sc-1e5b0xb-1"})(["width:2.5em;"]);function Wt(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z"}},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M256 176v160m80-80H176"}}]})(e)}function Ht(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M224 184h128m-128 72h128m-128 71h128"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M448 258c0-106-86-192-192-192S64 152 64 258s86 192 192 192 192-86 192-192z"}},{tag:"circle",attr:{cx:"168",cy:"184",r:"8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32"}},{tag:"circle",attr:{cx:"168",cy:"257",r:"8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32"}},{tag:"circle",attr:{cx:"168",cy:"328",r:"8",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32"}}]})(e)}function $t(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm-64 287.5a16 16 0 01-16 16h-16a16 16 0 01-16-16v-16a16 16 0 0116-16h16a16 16 0 0116 16zm0-71a16 16 0 01-16 16h-16a16 16 0 01-16-16v-16a16 16 0 0116-16h16a16 16 0 0116 16zm0-72a16 16 0 01-16 16h-16a16 16 0 01-16-16v-16a16 16 0 0116-16h16a16 16 0 0116 16zm176 151H212.67v-32H368zm0-71H212.67v-32H368zm0-72H212.67v-32H368z"}}]})(e)}const Gt=Q.e.svg.withConfig({displayName:"ContentsButton__Root",componentId:"sc-ghsm65-0"})(["",";font-size:2em;flex:0 0 auto;"],Ze);var qt=()=>{const e=q(),t=b(je.isContentsOpened),n=at();return Object(tt.jsx)(Gt,{as:t?$t:Ht,onClick:()=>e({type:re.TOGGLE_CONTENTS}),"data-djvujs-id":"contents_button",title:n("Table of contents")})};var Yt=()=>{const{hideFullPageSwitch:e}=b(je.uiOptions),t=b(je.isFullPageView),n=q(),r=at();return e?null:Object(tt.jsx)("div",{title:r("Switch full page mode"),"data-djvujs-class":"full_page_button",children:Object(tt.jsx)(St,{as:t?Me:Fe,onClick:()=>console.log("toggle Fullscreen clicked")||n(Xe.toggleFullPageViewAction(!t))})})};function Kt(e){return Ie({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"7 13 12 18 17 13"}},{tag:"polyline",attr:{points:"7 6 12 11 17 6"}}]})(e)}const Qt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"}}]})(e)})).withConfig({displayName:"MenuButton__Root",componentId:"sc-ip1cpf-0"})(["",";font-size:2em;color:var(--highlight-color);margin-left:",";"],Ze,(e=>e.theme.isMobile?0:"1em"));var Xt=({onClick:e})=>Object(tt.jsx)(Qt,{onClick:e,"data-djvujs-id":"menu_button"});const Zt=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.729 4.271c-.389-.391-1.021-.393-1.414-.004-.104.104-.176.227-.225.355-.832 1.736-1.748 2.715-2.904 3.293-1.297.64-2.786 1.085-5.186 1.085-.13 0-.26.025-.382.076-.245.102-.439.297-.541.541-.101.244-.101.52 0 .764.051.123.124.234.217.326l3.243 3.243-4.537 6.05 6.05-4.537 3.242 3.242c.092.094.203.166.326.217.122.051.252.078.382.078s.26-.027.382-.078c.245-.102.44-.295.541-.541.051-.121.077-.252.077-.381 0-2.4.444-3.889 1.083-5.166.577-1.156 1.556-2.072 3.293-2.904.129-.049.251-.121.354-.225.389-.393.387-1.025-.004-1.414l-3.997-4.02z"}}]})(e)})).withConfig({displayName:"PinButton__Root",componentId:"sc-wfvhy2-0"})(["font-size:calc(var(--button-basic-size) * 1.2);margin-right:1em;cursor:pointer;",";:hover{transform:scale(1.1) ",";}"],(e=>e.$pinned?"":"transform: rotate(45deg)"),(e=>e.$pinned?"":"rotate(45deg)"));var Jt=({isPinned:e,onClick:t})=>{const n=at();return Object(tt.jsx)(Zt,{$pinned:e,onClick:t,"data-djvujs-id":"pin_button",title:n(e?"Toolbar is always shown":"Toolbar automatically hides")})},en=({onClick:e,className:t=null})=>Object(tt.jsx)(tn,{className:t,onClick:e,"data-djvujs-class":"close_button"}),tn=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"}}]})(e)})).withConfig({displayName:"CloseButton___StyledFaRegTimesCircle",componentId:"sc-6thp0n-0"})(["",""],Ze);const nn=Object(Q.e)($e).withConfig({displayName:"FileBlock__FileIcon",componentId:"sc-15tzw9c-0"})(["flex:0 0 auto;"]),rn=Q.e.span.withConfig({displayName:"FileBlock__FileName",componentId:"sc-15tzw9c-1"})(["overflow:hidden;flex:0 1 auto;max-width:20em;text-align:left;text-overflow:ellipsis;margin:0 0.5em;"]),on=Q.e.div.withConfig({displayName:"FileBlock__Root",componentId:"sc-15tzw9c-2"})(["flex:0 1 auto;cursor:pointer;display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start;white-space:nowrap;overflow:hidden;&:hover{","{transform:scale(1.1)}}"],nn);class an extends i.a.Component{constructor(...e){super(...e),this.onChange=e=>{if(!e.target.files.length)return;const t=e.target.files[0];var n=new FileReader;n.readAsArrayBuffer(t),n.onload=()=>{this.props.createNewDocument(n.result,t.name)}},this.onClick=e=>{this.input&&this.input.click()}}render(){const e=this.context;return Object(tt.jsxs)(on,{className:"file_block",onClick:this.onClick,title:e("Open another .djvu file"),children:[Object(tt.jsx)(nn,{}),Object(tt.jsx)(rn,{children:null==this.props.fileName?e("Choose a file"):this.props.fileName||""}),Object(tt.jsx)("input",{style:{display:"none"},type:"file",onChange:this.onChange,accept:".djvu, .djv",ref:e=>this.input=e})]})}}an.contextType=ot;var ln=V(null,{createNewDocument:Xe.createDocumentFromArrayBufferAction})(an);var sn=({withLabel:e=!1,onClick:t=(()=>{})})=>{const n=q(),r=at();return Object(tt.jsxs)(xt,{title:r("Show options window"),"data-djvujs-class":"options_button",onClick:()=>{n({type:re.TOGGLE_OPTIONS_WINDOW,payload:!0}),t()},children:[Object(tt.jsx)(St,{as:Le}),e?Object(tt.jsx)("span",{children:r("Options")}):null]})};var un=({withLabel:e=null,onClick:t=(()=>{})})=>{const n=q(),r=at();return Object(tt.jsxs)(xt,{title:r("Show help window"),"data-djvujs-class":"help_button",onClick:()=>{n(Xe.showHelpWindowAction()),t()},children:[Object(tt.jsx)(cn,{}),e?Object(tt.jsx)("span",{children:r("About")}):null]})},cn=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm107.244-255.2c0 67.052-72.421 68.084-72.421 92.863V300c0 6.627-5.373 12-12 12h-45.647c-6.627 0-12-5.373-12-12v-8.659c0-35.745 27.1-50.034 47.579-61.516 17.561-9.845 28.324-16.541 28.324-29.579 0-17.246-21.999-28.693-39.784-28.693-23.189 0-33.894 10.977-48.942 29.969-4.057 5.12-11.46 6.071-16.666 2.124l-27.824-21.098c-5.107-3.872-6.251-11.066-2.644-16.363C184.846 131.491 214.94 112 261.794 112c49.071 0 101.45 38.304 101.45 88.8zM298 368c0 23.159-18.841 42-42 42s-42-18.841-42-42 18.841-42 42-42 42 18.841 42 42z"}}]})(e)})).withConfig({displayName:"HelpButton___StyledFaRegQuestionCircle",componentId:"sc-xkbnif-0"})(["",""],Je);const dn=Object(Q.d)(["z-index:4;position:absolute;top:0;left:0;width:100%;height:100%;"]),fn=Q.e.div.withConfig({displayName:"ModalWindow__ModalWindowRoot",componentId:"sc-1qa1mzi-0"})(["color:var(--color);box-shadow:0 0 2px var(--color);background:var(--modal-window-background-color);border-radius:0.5em;font-size:1.5em;position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);max-width:90%;max-height:90%;width:max-content;height:max-content;z-index:2;padding:0;overflow:hidden;display:flex;flex-direction:column;--closeButtonBlockHeight:28px;",";",";"],(e=>e.$fixedSize?`\n height: ${e.theme.isMobile?90:80}%;\n width: ${e.theme.isMobile?90:80}%;\n `:""),(e=>e.$error?"\n background: rgb(255, 209, 212);\n color: black;\n ":"")),pn=Q.e.div.withConfig({displayName:"ModalWindow__ContentWrapper",componentId:"sc-1qa1mzi-1"})(["overflow:auto;padding-bottom:var(--closeButtonBlockHeight);"]),hn=Q.e.div.withConfig({displayName:"ModalWindow__DarkLayer",componentId:"sc-1qa1mzi-2"})(["position:absolute;top:0;left:0;width:100%;height:100%;background:var(--alternative-background-color);backdrop-filter:blur(2px);opacity:0.8;z-index:1;"]);class mn extends i.a.Component{render(){const{onClose:e,isError:t,isFixedSize:n,className:r="",usePortal:o=!1}=this.props,i=Object(tt.jsxs)(gn,{"data-djvujs-class":"modal_window",children:[Object(tt.jsx)(hn,{onClick:e,"data-djvujs-class":"dark_layer"}),Object(tt.jsxs)(fn,{className:r,$error:t,$fixedSize:n,children:[Object(tt.jsx)(vn,{onClick:e}),Object(tt.jsx)(pn,{children:this.props.children})]})]});if(o){const e=document.getElementById("djvujs-modal-windows-container");return e?c.a.createPortal(i,e):i}return i}}var gn=Object(Q.e)("div").withConfig({displayName:"ModalWindow___StyledDiv",componentId:"sc-1qa1mzi-3"})(["",""],dn),vn=Object(Q.e)(en).withConfig({displayName:"ModalWindow___StyledCloseButton",componentId:"sc-1qa1mzi-4"})(["height:var(--closeButtonBlockHeight);margin-left:auto;margin-right:0.25em;"]);const bn=Q.e.div.withConfig({displayName:"SaveNotification",componentId:"sc-4dsxol-0"})(["padding:1em;"]),yn=Q.e.div.withConfig({displayName:"SaveNotification__ButtonBlock",componentId:"sc-4dsxol-1"})(["margin-top:1em;display:flex;justify-content:space-around;","{font-size:0.8em;}"],Ot);var wn=({onSave:e=(()=>{}),onClose:t=(()=>{})})=>{const{onSaveNotification:n}=b(je.uiOptions);return Object(tt.jsx)(mn,{onClose:()=>{n.yesButton||n.noButton||e(),t()},usePortal:!0,children:Object(tt.jsxs)(bn,{children:[Object(tt.jsx)("div",{children:n.text}),Object(tt.jsxs)(yn,{children:[n.yesButton?Object(tt.jsx)(Ot,{onClick:()=>{t(),e()},children:n.yesButton}):null,n.noButton?Object(tt.jsx)(Ot,{onClick:t,children:n.noButton}):null]})]})})},Sn=({withLabel:e=!1,onClick:t=(()=>{})})=>{const n=at(),r=q(),[o,a]=i.a.useState(!1),{onSaveNotification:l}=b(je.uiOptions),s=()=>r(Xe.tryToSaveDocument());return Object(tt.jsxs)(tt.Fragment,{children:[Object(tt.jsxs)(xt,{title:n("Save document"),onClick:()=>{l&&l.text?a(!0):s(),t()},children:[Object(tt.jsx)(St,{as:ze}),e?Object(tt.jsx)("span",{children:n("Save")}):null]}),o?Object(tt.jsx)(wn,{onSave:s,onClose:()=>a(!1)}):null]})};const xn=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"rect",attr:{width:"448",height:"320",x:"32",y:"64",fill:"none",strokeLinejoin:"round",strokeWidth:"32",rx:"32",ry:"32"}},{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M304 448l-8-64h-80l-8 64h96z"}},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 448H144"}},{tag:"path",attr:{d:"M32 304v48a32.09 32.09 0 0032 32h384a32.09 32.09 0 0032-32v-48zm224 64a16 16 0 1116-16 16 16 0 01-16 16z"}}]})(e)})).withConfig({displayName:"FullscreenButton",componentId:"sc-13s7s3c-0"})(["",";font-size:1.1em;color:",";"],Ze,(e=>e.$active?"var(--highlight-color)":"inherit"));var On=({className:e=null})=>{const{isFullscreen:t,toggleFullscreen:n}=Et(),r=at();return Object(tt.jsx)(xn,{className:e,"data-djvujs-class":"fullscreen_button",title:r("Fullscreen mode"),$active:t,onClick:n})};const _n=Q.e.div.withConfig({displayName:"Menu__Root",componentId:"sc-rs4ngp-0"})(["font-size:16px;--button-basic-size:1em;position:absolute;bottom:calc(100% + var(--app-padding));right:0;z-index:1;min-height:min(15em,","px);max-height:","px;width:fit-content;max-width:90%;background:var(--background-color);border:1px solid var(--border-color);border-radius:5px 0 5px 0;padding:0.5em;overflow:hidden;display:flex;flex-direction:column;",";transition:transform 0.5s;"],(e=>.7*e.theme.appHeight),(e=>.7*e.theme.appHeight),(e=>e.$opened?"transform: translateX(0);":"transform: translateX(calc(100% + var(--app-padding) * 2));")),jn=Q.e.div.withConfig({displayName:"Menu__MenuWrapper",componentId:"sc-rs4ngp-1"})(["display:flex;flex-direction:column;& > *{margin-bottom:1em;}"]),Cn=Q.e.div.withConfig({displayName:"Menu__Header",componentId:"sc-rs4ngp-2"})(["display:flex;align-items:center;border-bottom:1px solid var(--border-color);padding-bottom:0.5em;margin-bottom:0.5em;font-size:1.5em;svg{margin-left:auto;}span{margin-right:1em;}"]),kn=Q.e.div.withConfig({displayName:"Menu__DocumentWrapper",componentId:"sc-rs4ngp-3"})(["border-bottom:1px solid var(--border-color);margin-bottom:1em;padding-bottom:0.5em;padding-left:0.5em;& > div:first-child{margin-bottom:1em;}"]),En=Object(Q.d)(["flex-direction:column;padding-left:1em;align-items:flex-start;border-bottom:1px dashed var(--border-color);margin-bottom:1em;& > *{margin-bottom:0.5em;}"]),Tn=Q.e.div.withConfig({displayName:"Menu__DocumentControls",componentId:"sc-rs4ngp-4"})(["display:flex;flex-wrap:wrap;align-items:center;margin-top:1em;",";"],(e=>e.theme.isMobile?En:"")),Nn=Object(Q.d)(["cursor:pointer;:hover{& svg{transform:scale(1.1);}}"]),Pn=Q.e.div.withConfig({displayName:"Menu__DocumentControl",componentId:"sc-rs4ngp-5"})(["",";margin-right:1.5em;white-space:nowrap;display:flex;align-items:center;","{margin-left:0;}"],Nn,St),In=Q.e.div.withConfig({displayName:"Menu__MobileControl",componentId:"sc-rs4ngp-6"})(["display:flex;align-items:center;margin-bottom:1em;& > span:first-child{margin-right:1em;}"]),Rn=Q.e.div.withConfig({displayName:"Menu__Content",componentId:"sc-rs4ngp-7"})(["overflow:auto;"]);var An=({isOpened:e,onClose:t})=>{const n=q(),r=at(),o=b(je.fileName),{hideOpenAndCloseButtons:i,hidePrintButton:a,hideSaveButton:l}=b(je.uiOptions),{isMobile:s}=Et(),u=t;return Object(tt.jsxs)(_n,{$opened:e,"data-djvujs-id":"menu",children:[Object(tt.jsxs)(Cn,{children:[Object(tt.jsx)("span",{children:r("Menu")}),Object(tt.jsx)(en,{onClick:u})]}),Object(tt.jsxs)(Rn,{children:[Object(tt.jsxs)(kn,{children:[Object(tt.jsxs)("div",{children:[r("Document"),":"]}),i?o?Object(tt.jsx)("span",{children:o}):null:Object(tt.jsx)(ln,{fileName:o||""}),Object(tt.jsxs)(Tn,{children:[a?null:Object(tt.jsxs)(Pn,{onClick:()=>{n({type:re.OPEN_PRINT_DIALOG}),u()},title:r("Print document"),children:[Object(tt.jsx)(St,{as:We}),Object(tt.jsx)("span",{children:r("Print")})]}),l?null:Object(tt.jsx)(Pn,{onClick:u,children:Object(tt.jsx)(Sn,{onClick:u,withLabel:!0})}),i?null:Object(tt.jsxs)(Pn,{onClick:()=>n(Xe.closeDocumentAction()),children:[Object(tt.jsx)(Dn,{as:en}),Object(tt.jsx)("span",{children:r("Close")})]})]}),s?Object(tt.jsxs)(tt.Fragment,{children:[Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("View mode"),":"]}),Object(tt.jsx)(At,{})]}),Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("Scale"),":"]}),Object(tt.jsx)(wt,{})]}),Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("Rotation"),":"]}),Object(tt.jsx)(Bt,{})]}),Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("Cursor mode"),":"]}),Object(tt.jsx)(Mt,{})]})]}):null]}),Object(tt.jsxs)(jn,{children:[Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("Full page mode"),":"]}),Object(tt.jsx)(Yt,{})]}),document.fullscreenEnabled||document.webkitFullscreenEnabled?Object(tt.jsxs)(In,{children:[Object(tt.jsxs)("span",{children:[r("Fullscreen mode"),":"]}),Object(tt.jsx)(On,{})]}):null,Object(tt.jsx)(sn,{onClick:u,withLabel:!0}),Object(tt.jsx)(un,{onClick:u,withLabel:!0})]})]})]})},Dn=Object(Q.e)(St).withConfig({displayName:"Menu___StyledControlButton",componentId:"sc-rs4ngp-8"})(["font-size:1em;"]);const Ln=Object(Q.d)(["bottom:calc(100% + var(--app-padding));right:0;transform:rotate(180deg);transition:transform 1s,bottom 0.5s,right 0.5s 0.5s;"]),Mn=Q.e.div.withConfig({displayName:"HideButton__Root",componentId:"sc-16k0k0x-0"})(["--size:28px;width:var(--size);height:var(--size);font-size:calc(var(--size) * 0.7);position:absolute;z-index:1;background:var(--background-color);border-radius:100px;border:1px solid var(--color);cursor:pointer;display:flex;justify-content:center;align-items:center;transition:transform 1s,bottom 0.5s 0.5s,right 0.5s;right:0;bottom:calc(100% + var(--app-padding));",";",";"],(e=>e.theme.appWidth>400?"\n right: 25%;\n bottom: 50%;\n transform: translateX(50%) translateY(50%);\n ":""),(e=>e.$hidden?Ln:""));var zn=({isToolbarHidden:e,onClick:t})=>Object(tt.jsx)(Mn,{$hidden:e,onClick:t,"data-djvujs-id":"hide_button",children:Object(tt.jsx)(Kt,{})});const Un="42px",Fn=Object(Q.d)(["font-size:16px;& > *{margin-right:0;margin-left:0;}"]),Bn=Q.e.div.withConfig({displayName:"Toolbar__Root",componentId:"sc-xmrcl3-0"})(["position:relative;flex:0 0 auto;border:1px solid var(--border-color);border-radius:0 7px 0 7px;padding:7px 4px;display:flex;flex-wrap:nowrap;justify-content:space-between;align-items:center;height:",";box-sizing:border-box;align-self:stretch;margin-top:var(--app-padding);z-index:2;font-size:14px;--button-basic-size:1.5em;margin-bottom:0;transition:margin-bottom 0.5s;",";",";"],Un,(e=>e.$hidden?"margin-bottom: calc(-42px - var(--app-padding) - 1px)":""),(e=>e.$mobile?Fn:"")),Vn=Q.e.div.withConfig({displayName:"Toolbar__CentralPanel",componentId:"sc-xmrcl3-1"})(["height:100%;max-width:45em;margin:0 auto;display:flex;align-items:center;justify-content:center;& > *{margin:0 0.8em;}"]),Wn=Q.e.div.withConfig({displayName:"Toolbar__RightPanel",componentId:"sc-xmrcl3-2"})(["height:100%;display:flex;align-items:center;"]),Hn=Q.e.div.withConfig({displayName:"Toolbar__InvisibleLayer",componentId:"sc-xmrcl3-3"})(["position:absolute;bottom:0;height:calc("," + var(--app-padding) * 2);width:100%;z-index:1;"],Un);var $n=()=>{const[e,t]=i.a.useState(!0),[n,r]=i.a.useState(!1),[o,a]=i.a.useState(!1),[l,s]=i.a.useState(!1),u=i.a.useCallback((()=>r(!1)),[r]),c=i.a.useCallback((()=>r(!0)),[r]),d=i.a.useCallback((()=>{t(!e)}),[e,t]),{isMobile:f}=Et(),p=f||e,h=o&&f||n&&!p;return Object(tt.jsxs)(tt.Fragment,{children:[p?null:Object(tt.jsx)(Hn,{onMouseEnter:u,onMouseLeave:c}),Object(tt.jsxs)(Bn,{$hidden:h,onMouseEnter:p?null:u,onMouseLeave:p?null:c,"data-djvujs-id":"toolbar",$mobile:f,children:[Object(tt.jsx)(qt,{}),Object(tt.jsxs)(Vn,{children:[f?null:Object(tt.jsx)(At,{}),f?null:Object(tt.jsx)(Mt,{}),Object(tt.jsx)(mt,{}),f?null:Object(tt.jsx)(wt,{}),f?null:Object(tt.jsx)(Bt,{})]}),Object(tt.jsxs)(Wn,{"data-djvujs-class":"right_panel",children:[f?null:Object(tt.jsx)(Jt,{isPinned:e,onClick:d}),f?null:Object(tt.jsx)(Yt,{}),f?Object(tt.jsx)(zn,{onClick:()=>a(!o),isToolbarHidden:h}):null,Object(tt.jsx)(Xt,{onClick:()=>s(!l)})]}),Object(tt.jsx)(An,{isOpened:l&&!h,onClose:()=>s(!1)})]})]})};const Gn=Object(Q.e)($e).withConfig({displayName:"FileZone__FileIcon",componentId:"sc-hxwsg2-0"})(["font-size:1.5em;"]),qn=Object(Q.f)(["from{transform:rotateY(0deg)}25%{transform:rotateY(5deg)}75%{transform:rotateY(-5deg)}to{transform:rotateY(0deg)}"]),Yn=Object(Q.d)(["animation:"," 1s infinite linear;opacity:0.8;border-color:var(--highlight-color);"],qn),Kn=Q.e.div.withConfig({displayName:"FileZone__Root",componentId:"sc-hxwsg2-1"})(["border:0.1em dashed var(--border-color);background:var(--alternative-background-color);padding:0.5em;max-width:20em;min-height:5em;margin:auto;border-radius:0.5em;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;&:hover{","{transform:scale(1.1);}}",";"],Gn,(e=>e.$dragOver?Yn:""));class Qn extends i.a.Component{constructor(...e){super(...e),this.state={isDragOver:!1},this.onChange=e=>{e.target.files.length&&this.processFile(e.target.files[0])},this.onClick=e=>{this.input&&this.input.click()},this.checkDrag=e=>{1===e.dataTransfer.items.length&&"file"===e.dataTransfer.items[0].kind&&(e.preventDefault(),this.setState({isDragOver:!0}))},this.onDragLeave=e=>{this.setState({isDragOver:!1})},this.onDrop=e=>{this.setState({isDragOver:!1}),"file"===e.dataTransfer.items[0].kind&&(e.preventDefault(),this.processFile(e.dataTransfer.items[0].getAsFile()))}}processFile(e){var t=new FileReader;t.readAsArrayBuffer(e),t.onload=()=>{this.props.createNewDocument(t.result,e.name)}}render(){const e=this.context;return Object(tt.jsxs)(Kn,{$dragOver:this.state.isDragOver,onClick:this.onClick,title:e("Open another .djvu file"),onDragEnter:this.checkDrag,onDragOver:this.checkDrag,onDragLeave:this.onDragLeave,onDrop:this.onDrop,children:[Object(tt.jsx)(Gn,{}),Object(tt.jsx)("span",{children:e("Drag & Drop a file here or click to choose manually")}),Object(tt.jsx)("input",{style:{display:"none"},type:"file",onChange:this.onChange,accept:".djvu, .djv",ref:e=>this.input=e})]})}}Qn.contextType=ot;var Xn=V(null,{createNewDocument:Xe.createDocumentFromArrayBufferAction})(Qn);const Zn=!!(document.querySelector("input#djvu_js_extension_main_page")&&window.chrome&&window.chrome.runtime&&window.chrome.runtime.id),Jn=/Firefox/.test(navigator.userAgent),er=e=>/\.(djv|djvu)$/.test(e)?e:e+".djvu",tr=Q.e.form.withConfig({displayName:"LinkBlock__LinkBlockRoot",componentId:"sc-1ry5hlr-0"})(["max-width:20em;display:flex;justify-content:center;margin:1em auto;input{",";flex:1 1 auto;height:2em;font-style:italic;}button{color:var(--color);margin-left:1em;border-radius:0.5em;background:none;border:1px solid var(--border-color);cursor:pointer;&:hover{background:var(--alternative-background-color);}}"],et);var nr=()=>{const[e,t]=i.a.useState(""),n=q(),r=at();return Object(tt.jsxs)(tr,{onSubmit:t=>{t.preventDefault();const o=e.trim();/((^https?:\/\/)|(^data:)).+/.test(o)?n({type:re.LOAD_DOCUMENT_BY_URL,url:o}):alert(r('Enter a valid URL (it should start with "http(s)://" | "data:")'))},children:[Object(tt.jsx)("input",{value:e,placeholder:r("Paste a URL to a djvu file here"),onChange:e=>t(e.target.value)}),Object(tt.jsx)("button",{type:"submit",children:r("Open URL")})]})};const rr=Q.e.div.withConfig({displayName:"IncompleteTranslationWindow__Root",componentId:"sc-i21ms0-0"})(["font-size:18px;min-width:20em;text-align:left;padding:1em;color:var(--color);"]),or=Q.e.ul.withConfig({displayName:"IncompleteTranslationWindow__NotTranslatedList",componentId:"sc-i21ms0-1"})(["max-height:15em;overflow:auto;padding:1em 2em;font-style:italic;"]);var ir=({onClose:e,missedPhrases:t})=>{const n=at();return Object(tt.jsx)(mn,{onClose:t=>{t.stopPropagation(),e()},usePortal:!0,children:Object(tt.jsxs)(rr,{children:[Object(tt.jsxs)("div",{children:[Object(tt.jsxs)("strong",{children:[n("The translation isn't complete.")," "]}),n("The following phrases are not translated:")]}),Object(tt.jsx)(or,{children:t.map(((e,t)=>Object(tt.jsx)("li",{children:e},t)))}),Object(tt.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:ne.TRANSLATION_PAGE_URL,children:n("You can improve the translation here")})]})})};const ar=Q.e.span.withConfig({displayName:"LanguageWarningSign__Warning",componentId:"sc-xp2qj5-0"})(["color:var(--color);cursor:pointer;margin-right:0.5em;display:inline-flex;align-items:center;:hover{color:var(--highlight-color);}svg{margin-left:0.5em;font-size:0.8em;}"]);var lr=({languageCode:e})=>{const t=pe[e],n=Object.keys(pe.en).filter((e=>null==t[e]));let[r,o]=i.a.useState(!1);return n.length?Object(tt.jsxs)(tt.Fragment,{children:[Object(tt.jsx)(ar,{onClick:e=>{e.stopPropagation(),o(!0)},children:Object(tt.jsx)(Ue,{})}),r?Object(tt.jsx)(ir,{missedPhrases:n,onClose:()=>o(!1)}):null]}):null},sr=({className:e})=>{const t=at();return Object(tt.jsx)(ur,{className:e,href:ne.TRANSLATION_PAGE_URL,target:"_blank",rel:"noopener noreferrer",title:t("Add more"),children:Object(tt.jsx)(Wt,{})})},ur=Object(Q.e)("a").withConfig({displayName:"AddLanguageButton___StyledA",componentId:"sc-hje2ri-0"})(["color:var(--color) !important;display:inline-block;height:1em;width:1em;:hover{transform:scale(1.2);}"]);const cr=Q.e.div.withConfig({displayName:"LanguagePanel__LanguagePanelRoot",componentId:"sc-ldbzd3-0"})(["display:flex;font-size:20px;margin-top:0.5em;align-items:flex-end;justify-content:center;flex-wrap:wrap;padding:0 0.5em;"]),dr=Object(Q.d)(["border-bottom:3px solid var(--highlight-color);color:var(--highlight-color);cursor:default;padding-top:0;"]),fr=Q.e.div.withConfig({displayName:"LanguagePanel__LanguageItem",componentId:"sc-ldbzd3-1"})(["margin-left:0.5em;margin-bottom:0.2em;cursor:pointer;white-space:nowrap;padding-top:2px;border-bottom:1px solid transparent;vertical-align:top;",";"],(e=>e.$selected?dr:"\n :hover {\n border-color: var(--color);\n }\n ")),pr=()=>{const{locale:e}=b(je.options),t=q();return Object(tt.jsxs)(cr,{children:[Object.entries(pe).map((([n,r])=>Object(tt.jsxs)(fr,{$selected:e===n,"data-djvujs-class":"language_name "+(e===n?"selected":""),onClick:()=>t({type:re.UPDATE_OPTIONS,payload:{locale:n}}),children:[r.nativeName,Object(tt.jsx)(lr,{languageCode:n})]},n))),Object(tt.jsx)(hr,{})]})};var hr=Object(Q.e)(sr).withConfig({displayName:"LanguagePanel___StyledAddLanguageButton",componentId:"sc-ldbzd3-2"})(["font-size:1.5em;align-self:center;"]);const mr=Q.e.span.withConfig({displayName:"ThemeSwitcher__Root",componentId:"sc-b41jlv-0"})(["margin-top:1.5em;svg{margin:0 0.5em;cursor:pointer;}"]),gr=Object(Q.d)(["transform:scale(1.5);color:var(--highlight-color);"]);var vr=()=>{const{theme:e}=b(je.options),t=q(),n=e=>()=>t({type:re.UPDATE_OPTIONS,payload:{theme:e}});return Object(tt.jsxs)(mr,{children:[Object(tt.jsx)(br,{onClick:n("light"),"data-djvujs-id":"light_theme_button","data-djvujs-class":"light"===e?"active":null,$_css:"light"===e?gr:null}),Object(tt.jsx)(yr,{onClick:n("dark"),"data-djvujs-id":"dark_theme_button","data-djvujs-class":"dark"===e?"active":null,$_css2:"dark"===e?gr:null})]})},br=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M494.2 221.9l-59.8-40.5 13.7-71c2.6-13.2-1.6-26.8-11.1-36.4-9.6-9.5-23.2-13.7-36.2-11.1l-70.9 13.7-40.4-59.9c-15.1-22.3-51.9-22.3-67 0l-40.4 59.9-70.8-13.7C98 60.4 84.5 64.5 75 74.1c-9.5 9.6-13.7 23.1-11.1 36.3l13.7 71-59.8 40.5C6.6 229.5 0 242 0 255.5s6.7 26 17.8 33.5l59.8 40.5-13.7 71c-2.6 13.2 1.6 26.8 11.1 36.3 9.5 9.5 22.9 13.7 36.3 11.1l70.8-13.7 40.4 59.9C230 505.3 242.6 512 256 512s26-6.7 33.5-17.8l40.4-59.9 70.9 13.7c13.4 2.7 26.8-1.6 36.3-11.1 9.5-9.5 13.6-23.1 11.1-36.3l-13.7-71 59.8-40.5c11.1-7.5 17.8-20.1 17.8-33.5-.1-13.6-6.7-26.1-17.9-33.7zm-112.9 85.6l17.6 91.2-91-17.6L256 458l-51.9-77-90.9 17.6 17.6-91.2-76.8-52 76.8-52-17.6-91.2 91 17.6L256 53l51.9 76.9 91-17.6-17.6 91.1 76.8 52-76.8 52.1zM256 152c-57.3 0-104 46.7-104 104s46.7 104 104 104 104-46.7 104-104-46.7-104-104-104zm0 160c-30.9 0-56-25.1-56-56s25.1-56 56-56 56 25.1 56 56-25.1 56-56 56z"}}]})(e)})).withConfig({displayName:"ThemeSwitcher___StyledFaRegSun",componentId:"sc-b41jlv-1"})(["",""],(e=>e.$_css)),yr=Object(Q.e)((function(e){return Ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M279.135 512c78.756 0 150.982-35.804 198.844-94.775 28.27-34.831-2.558-85.722-46.249-77.401-82.348 15.683-158.272-47.268-158.272-130.792 0-48.424 26.06-92.292 67.434-115.836 38.745-22.05 28.999-80.788-15.022-88.919A257.936 257.936 0 0 0 279.135 0c-141.36 0-256 114.575-256 256 0 141.36 114.576 256 256 256zm0-464c12.985 0 25.689 1.201 38.016 3.478-54.76 31.163-91.693 90.042-91.693 157.554 0 113.848 103.641 199.2 215.252 177.944C402.574 433.964 344.366 464 279.135 464c-114.875 0-208-93.125-208-208s93.125-208 208-208z"}}]})(e)})).withConfig({displayName:"ThemeSwitcher___StyledFaRegMoon",componentId:"sc-b41jlv-2"})(["",""],(e=>e.$_css2));const wr=Q.e.select.withConfig({displayName:"LanguageSelector__Select",componentId:"sc-1vy9jvp-0"})(["font-size:1em;margin-right:0.5em;padding-right:0.5em;",";"],et),Sr=Q.e.div.withConfig({displayName:"LanguageSelector__Root",componentId:"sc-1vy9jvp-1"})(["display:flex;flex-wrap:wrap;align-items:center;"]);var xr=()=>{const{locale:e}=b(je.options),t=q(),n=at();return Object(tt.jsxs)(Sr,{children:[Object(tt.jsxs)("span",{style:{marginRight:"0.5em"},children:[n("Language"),":"]}),Object(tt.jsx)(wr,{value:e,onChange:e=>t({type:re.UPDATE_OPTIONS,payload:{locale:e.target.value}}),children:Object.entries(pe).map((([e,t])=>Object(tt.jsx)("option",{value:e,children:t.nativeName},e)))}),Object(tt.jsx)(lr,{languageCode:e}),Object(tt.jsx)(Or,{})]})},Or=Object(Q.e)(sr).withConfig({displayName:"LanguageSelector___StyledAddLanguageButton",componentId:"sc-1vy9jvp-2"})(["font-size:1.2em"]);const _r=Q.e.div.withConfig({displayName:"InitialScreen__Root",componentId:"sc-1tb5ujx-0"})(["font-size:","em;text-align:center;flex:1 1 auto;width:100%;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;"],(e=>e.theme.isMobile?1.5:2)),jr=Q.e.div.withConfig({displayName:"InitialScreen__InfoBlock",componentId:"sc-1tb5ujx-1"})(["width:max-content;margin:0 auto 1em auto;text-align:left;font-size:0.8em;svg{font-size:1.5em;}div{display:flex;align-items:center;margin-bottom:0.25em;}"]),Cr=Q.e.div.withConfig({displayName:"InitialScreen__Footer",componentId:"sc-1tb5ujx-2"})(["width:100%;display:flex;justify-content:flex-end;contain:layout;& > *{margin-left:0.5em;}"]);var kr=()=>{const e=at(),{isMobile:t}=Et();return Object(tt.jsxs)(_r,{children:[t?Object(tt.jsx)(xr,{}):Object(tt.jsx)(pr,{}),Object(tt.jsx)(vr,{}),Object(tt.jsxs)(Er,{children:[Object(tt.jsx)(Tr,{children:`DjVu.js Viewer v.${r.Viewer.VERSION}`}),Object(tt.jsx)(Nr,{children:`(${e("powered with")} DjVu.js v.${r.VERSION})`}),Object(tt.jsxs)(jr,{children:[Object(tt.jsx)("div",{children:e("#optionsButton - see the available options",{"#optionsButton":Object(tt.jsx)(sn,{})})}),Object(tt.jsx)("div",{children:e("#helpButton - learn more about the app",{"#helpButton":Object(tt.jsx)(un,{})})})]}),Zn?Object(tt.jsx)(nr,{}):null,Object(tt.jsx)(Xn,{})]}),Object(tt.jsxs)(Cr,{children:[document.fullscreenEnabled||document.webkitFullscreenEnabled?Object(tt.jsx)(Pr,{}):null,Object(tt.jsx)(Yt,{})]})]})},Er=Object(Q.e)("div").withConfig({displayName:"InitialScreen___StyledDiv",componentId:"sc-1tb5ujx-3"})(["margin:auto;"]),Tr=Object(Q.e)("div").withConfig({displayName:"InitialScreen___StyledDiv2",componentId:"sc-1tb5ujx-4"})(["text-align:center;font-size:2em"]),Nr=Object(Q.e)("div").withConfig({displayName:"InitialScreen_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment