1763 lines
60 KiB
JavaScript
1763 lines
60 KiB
JavaScript
// Metro module 12715 (f12716).
|
|
import * as _Module12716 from "./Module12716";
|
|
import { arraySet, Buf16, Buf8 } from "./Module12712";
|
|
import { _tr_flush_block, _tr_tally, _tr_init, _tr_align, _tr_stored_block } from "./StaticTreeDesc";
|
|
import * as _adler32 from "./adler32";
|
|
import * as _Module12719 from "./Module12719";
|
|
let c8761_2, longest_match, fill_window, DeflateState, deflateReset, deflateInit2;
|
|
const flush_block_only = function flush_block_only(a0, a1) {
|
|
_tr_flush_block(a0, a0.block_start >= 0 ? a0.block_start : -1, a0.strstart - a0.block_start, a1);
|
|
a0.block_start = a0.strstart;
|
|
const strm = a0.strm;
|
|
const state = strm.state;
|
|
let pending = state.pending;
|
|
if (pending > strm.avail_out) {
|
|
pending = strm.avail_out;
|
|
}
|
|
if (pending !== 0) {
|
|
arraySet(strm.output, state.pending_buf, state.pending_out, pending, strm.next_out);
|
|
strm.next_out = strm.next_out + pending;
|
|
state.pending_out = state.pending_out + pending;
|
|
strm.total_out = strm.total_out + pending;
|
|
strm.avail_out = strm.avail_out - pending;
|
|
state.pending = state.pending - pending;
|
|
if (state.pending === 0) {
|
|
state.pending_out = 0;
|
|
}
|
|
}
|
|
};
|
|
longest_match = function longest_match(a0, a1) {
|
|
let r101;
|
|
const { max_chain_length, strstart, prev_length } = a0;
|
|
let nice_match = a0.nice_match;
|
|
const r7 = a0.strstart > a0.w_size - 262 ? a0.strstart - (a0.w_size - 262) : 0;
|
|
const { window: window2, w_mask, prev } = a0;
|
|
const r18 = a0.strstart + 258;
|
|
const r27 = window2[strstart + prev_length - 1];
|
|
const r28 = window2[strstart + prev_length];
|
|
const r23 = a0.prev_length >= a0.good_match ? max_chain_length >> 2 : max_chain_length;
|
|
const lookahead = a0.lookahead;
|
|
const r48 = r18 - 258;
|
|
let r17 = r28;
|
|
let r16 = r27;
|
|
let r15 = prev_length;
|
|
let r14 = strstart;
|
|
let r50 = r23;
|
|
let r51 = a1;
|
|
if (nice_match > lookahead) {
|
|
nice_match = a0.lookahead;
|
|
r17 = r28;
|
|
r16 = r27;
|
|
r15 = prev_length;
|
|
r14 = strstart;
|
|
r50 = r23;
|
|
r51 = a1;
|
|
}
|
|
while (true) {
|
|
L25: {
|
|
const r32 = window2[r51 + r15];
|
|
const r31 = r17;
|
|
const r30 = r16;
|
|
const r53 = nice_match;
|
|
const r54 = r15;
|
|
const r33 = r14;
|
|
const r55 = r50;
|
|
const match_start = r51;
|
|
let r29 = r31;
|
|
let r57 = r30;
|
|
let r58 = r54;
|
|
let r59 = r33;
|
|
if (r32 === r31) {
|
|
const r61 = window2[match_start + r54 - 1];
|
|
r29 = r31;
|
|
r57 = r30;
|
|
r58 = r54;
|
|
r59 = r33;
|
|
if (r61 === r30) {
|
|
const r34 = window2[match_start];
|
|
const r62 = window2[r33];
|
|
r29 = r31;
|
|
r57 = r30;
|
|
r58 = r54;
|
|
r59 = r33;
|
|
if (r34 === r62) {
|
|
const r63 = match_start + 1;
|
|
const r35 = window2[r63];
|
|
const r65 = window2[r33 + 1];
|
|
r29 = r31;
|
|
r57 = r30;
|
|
r58 = r54;
|
|
r59 = r33;
|
|
if (r35 === r65) {
|
|
let r66 = r33 + 2;
|
|
let r67 = r63 + 1;
|
|
while (true) {
|
|
const r0 = r66 + 1;
|
|
const r36 = window2[r0];
|
|
const r68 = r67 + 1;
|
|
const r69 = window2[r68];
|
|
let r70 = r0;
|
|
if (r36 === r69) {
|
|
const r71 = r0 + 1;
|
|
const r72 = window2[r71];
|
|
const r73 = r68 + 1;
|
|
const r74 = window2[r73];
|
|
r70 = r71;
|
|
if (r72 === r74) {
|
|
const r75 = r71 + 1;
|
|
const r76 = window2[r75];
|
|
const r77 = r73 + 1;
|
|
const r78 = window2[r77];
|
|
r70 = r75;
|
|
if (r76 === r78) {
|
|
const r79 = r75 + 1;
|
|
const r80 = window2[r79];
|
|
const r81 = r77 + 1;
|
|
const r82 = window2[r81];
|
|
r70 = r79;
|
|
if (r80 === r82) {
|
|
const r83 = r79 + 1;
|
|
const r84 = window2[r83];
|
|
const r85 = r81 + 1;
|
|
const r86 = window2[r85];
|
|
r70 = r83;
|
|
if (r84 === r86) {
|
|
const r87 = r83 + 1;
|
|
const r88 = window2[r87];
|
|
const r89 = r85 + 1;
|
|
const r90 = window2[r89];
|
|
r70 = r87;
|
|
if (r88 === r90) {
|
|
const r91 = r87 + 1;
|
|
const r92 = window2[r91];
|
|
const r93 = r89 + 1;
|
|
const r94 = window2[r93];
|
|
r70 = r91;
|
|
if (r92 === r94) {
|
|
const r95 = r91 + 1;
|
|
const r96 = window2[r95];
|
|
const r97 = r93 + 1;
|
|
const r98 = window2[r97];
|
|
r70 = r95;
|
|
if (r96 === r98) {
|
|
r66 = r95;
|
|
r67 = r97;
|
|
r70 = r66;
|
|
if (r70 < r18) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const r100 = 258 - (r18 - r70);
|
|
r29 = r31;
|
|
r57 = r30;
|
|
r58 = r54;
|
|
r59 = r48;
|
|
if (!(r100 > r54)) {
|
|
break;
|
|
}
|
|
a0.match_start = match_start;
|
|
r101 = r100;
|
|
if (r101 >= r53) {
|
|
break L25;
|
|
}
|
|
const r102 = r48 + r100;
|
|
r57 = window2[r102 - 1];
|
|
r29 = window2[r102];
|
|
r58 = r100;
|
|
r59 = r48;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const r104 = prev[match_start & w_mask];
|
|
r101 = r58;
|
|
if (r104 > r7) {
|
|
r50 = r55 - 1;
|
|
r17 = r29;
|
|
r16 = r57;
|
|
nice_match = r53;
|
|
r15 = r58;
|
|
r14 = r59;
|
|
r51 = r104;
|
|
r101 = r15;
|
|
if (r50 != 0) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
if (!(r101 <= a0.lookahead)) {
|
|
r101 = a0.lookahead;
|
|
}
|
|
return r101;
|
|
}
|
|
};
|
|
fill_window = function fill_window(state) {
|
|
let r31;
|
|
const w_size = state.w_size;
|
|
while (true) {
|
|
L10: {
|
|
const r30 = state.window_size - state.lookahead - state.strstart;
|
|
const strstart = state.strstart;
|
|
const r13 = w_size + (w_size - 262);
|
|
r31 = r30;
|
|
if (strstart >= r13) {
|
|
arraySet(state.window, state.window, w_size, w_size, 0);
|
|
state.match_start = state.match_start - w_size;
|
|
state.strstart = state.strstart - w_size;
|
|
state.block_start = state.block_start - w_size;
|
|
let hash_size = state.hash_size;
|
|
let r43 = hash_size;
|
|
while (true) {
|
|
const head2 = state.head;
|
|
const r45 = r43 - 1;
|
|
const r19 = head2[r45];
|
|
const head = state.head;
|
|
const r6 = r19 >= w_size;
|
|
const r46 = hash_size;
|
|
head[r45] = r6 ? r19 - w_size : 0;
|
|
hash_size = r46 - 1;
|
|
r43 = r45;
|
|
let r47 = w_size;
|
|
let r48 = r47;
|
|
if (!hash_size) {
|
|
while (true) {
|
|
const prev = state.prev;
|
|
const r50 = r48 - 1;
|
|
const r51 = prev[r50];
|
|
const prev2 = state.prev;
|
|
const r53 = r51 >= w_size;
|
|
const r54 = r47;
|
|
prev2[r50] = r53 ? r51 - w_size : 0;
|
|
r47 = r54 - 1;
|
|
r48 = r50;
|
|
if (!r47) {
|
|
r31 = r30 + w_size;
|
|
break L10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (state.strm.avail_in !== 0) {
|
|
const { strm, window: window2 } = state;
|
|
const r62 = state.strstart + state.lookahead;
|
|
let avail_in = strm.avail_in;
|
|
if (avail_in > r31) {
|
|
avail_in = r31;
|
|
}
|
|
let r64 = 0;
|
|
if (avail_in !== 0) {
|
|
strm.avail_in = strm.avail_in - avail_in;
|
|
arraySet(window2, strm.input, strm.next_in, avail_in, r62);
|
|
if (strm.state.wrap === 1) {
|
|
strm.adler = _adler32(strm.adler, window2, avail_in, r62);
|
|
} else if (strm.state.wrap === 2) {
|
|
strm.adler = _Module12719(strm.adler, window2, avail_in, r62);
|
|
}
|
|
strm.next_in = strm.next_in + avail_in;
|
|
strm.total_in = strm.total_in + avail_in;
|
|
r64 = avail_in;
|
|
}
|
|
state.lookahead = state.lookahead + r64;
|
|
if (state.lookahead + state.insert >= 3) {
|
|
const r108 = state.strstart - state.insert;
|
|
state.ins_h = state.window[r108];
|
|
state.ins_h = (state.ins_h << state.hash_shift ^ state.window[r108 + 1]) & state.hash_mask;
|
|
if (state.insert) {
|
|
state.ins_h = (state.ins_h << state.hash_shift ^ state.window[r108 + 3 - 1]) & state.hash_mask;
|
|
state.prev[r108 & state.w_mask] = state.head[state.ins_h];
|
|
state.head[state.ins_h] = r108;
|
|
let r139 = r108 + 1;
|
|
state.insert = state.insert - 1;
|
|
while (!(state.lookahead + state.insert < 3)) {
|
|
const insert = state.insert;
|
|
const r146 = r139;
|
|
if (!insert) {
|
|
break;
|
|
}
|
|
state.ins_h = (state.ins_h << state.hash_shift ^ state.window[r146 + 3 - 1]) & state.hash_mask;
|
|
state.prev[r146 & state.w_mask] = state.head[state.ins_h];
|
|
state.head[state.ins_h] = r146;
|
|
r139 = r146 + 1;
|
|
state.insert = state.insert - 1;
|
|
}
|
|
}
|
|
}
|
|
if (state.lookahead < 262 && state.strm.avail_in !== 0) {
|
|
continue;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|
|
const deflate_fast = function deflate_fast(a0, a1) {
|
|
let r57, r132;
|
|
while (true) {
|
|
if (a0.lookahead < 262) {
|
|
fill_window(a0);
|
|
if (a0.lookahead < 262 && a1 === 0) {
|
|
return 1;
|
|
}
|
|
if (a0.lookahead === 0) {
|
|
a0.insert = a0.strstart < 2 ? a0.strstart : 2;
|
|
let r130 = 4;
|
|
if (a1 === 4) {
|
|
flush_block_only(a0, true);
|
|
if (a0.strm.avail_out === 0) {
|
|
r130 = 3;
|
|
}
|
|
r132 = r130;
|
|
} else {
|
|
const last_lit = a0.last_lit;
|
|
r132 = 2;
|
|
if (last_lit) {
|
|
flush_block_only(a0, false);
|
|
r132 = a0.strm.avail_out === 0 ? 1 : 2;
|
|
}
|
|
}
|
|
return r132;
|
|
}
|
|
}
|
|
const r23 = a0.lookahead >= 3;
|
|
let r14 = 0;
|
|
if (r23) {
|
|
a0.ins_h = (a0.ins_h << a0.hash_shift ^ a0.window[a0.strstart + 3 - 1]) & a0.hash_mask;
|
|
const prev = a0.prev;
|
|
const r35 = a0.strstart & a0.w_mask;
|
|
const r37 = a0.head[a0.ins_h];
|
|
prev[r35] = r37;
|
|
a0.head[a0.ins_h] = a0.strstart;
|
|
r14 = r37;
|
|
}
|
|
if (r14 !== 0 && a0.strstart - r14 <= a0.w_size - 262) {
|
|
a0.match_length = longest_match(a0, r14);
|
|
}
|
|
L19: {
|
|
if (a0.match_length >= 3) {
|
|
const r72 = _tr_tally(a0, a0.strstart - a0.match_start, a0.match_length - 3);
|
|
a0.lookahead = a0.lookahead - a0.match_length;
|
|
if (a0.match_length <= a0.max_lazy_match && a0.lookahead >= 3) {
|
|
a0.match_length = a0.match_length - 1;
|
|
while (true) {
|
|
a0.strstart = a0.strstart + 1;
|
|
a0.ins_h = (a0.ins_h << a0.hash_shift ^ a0.window[a0.strstart + 3 - 1]) & a0.hash_mask;
|
|
a0.prev[a0.strstart & a0.w_mask] = a0.head[a0.ins_h];
|
|
a0.head[a0.ins_h] = a0.strstart;
|
|
const match_length = a0.match_length - 1;
|
|
a0.match_length = match_length;
|
|
if (match_length == 0) {
|
|
a0.strstart = a0.strstart + 1;
|
|
r57 = r72;
|
|
break L19;
|
|
}
|
|
}
|
|
}
|
|
a0.strstart = a0.strstart + a0.match_length;
|
|
a0.match_length = 0;
|
|
a0.ins_h = a0.window[a0.strstart];
|
|
a0.ins_h = (a0.ins_h << a0.hash_shift ^ a0.window[a0.strstart + 1]) & a0.hash_mask;
|
|
r57 = r72;
|
|
} else {
|
|
r57 = _tr_tally(a0, 0, a0.window[a0.strstart]);
|
|
a0.lookahead = a0.lookahead - 1;
|
|
a0.strstart = a0.strstart + 1;
|
|
}
|
|
}
|
|
if (r57) {
|
|
flush_block_only(a0, false);
|
|
if (a0.strm.avail_out === 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const deflate_slow = function deflate_slow(a0, a1) {
|
|
let r157;
|
|
loop1: while (true) {
|
|
if (a0.lookahead < 262) {
|
|
fill_window(a0);
|
|
if (a0.lookahead < 262 && a1 === 0) {
|
|
return 1;
|
|
}
|
|
if (a0.lookahead === 0) {
|
|
if (a0.match_available) {
|
|
_tr_tally(a0, 0, a0.window[a0.strstart - 1]);
|
|
a0.match_available = 0;
|
|
}
|
|
a0.insert = a0.strstart < 2 ? a0.strstart : 2;
|
|
let r155 = 4;
|
|
if (a1 === 4) {
|
|
flush_block_only(a0, true);
|
|
if (a0.strm.avail_out === 0) {
|
|
r155 = 3;
|
|
}
|
|
r157 = r155;
|
|
} else {
|
|
const last_lit = a0.last_lit;
|
|
r157 = 2;
|
|
if (last_lit) {
|
|
flush_block_only(a0, false);
|
|
r157 = a0.strm.avail_out === 0 ? 1 : 2;
|
|
}
|
|
}
|
|
return r157;
|
|
}
|
|
}
|
|
const r28 = a0.lookahead >= 3;
|
|
let r20 = 0;
|
|
if (r28) {
|
|
a0.ins_h = (a0.ins_h << a0.hash_shift ^ a0.window[a0.strstart + 3 - 1]) & a0.hash_mask;
|
|
const prev = a0.prev;
|
|
const r40 = a0.strstart & a0.w_mask;
|
|
const r42 = a0.head[a0.ins_h];
|
|
prev[r40] = r42;
|
|
a0.head[a0.ins_h] = a0.strstart;
|
|
r20 = r42;
|
|
}
|
|
a0.prev_length = a0.match_length;
|
|
a0.prev_match = a0.match_start;
|
|
a0.match_length = 2;
|
|
if (r20 !== 0 && a0.prev_length < a0.max_lazy_match && a0.strstart - r20 <= a0.w_size - 262) {
|
|
a0.match_length = longest_match(a0, r20);
|
|
if (a0.match_length <= 5 && (a0.strategy === 1 || a0.match_length === 3 && a0.strstart - a0.match_start > 4096)) {
|
|
a0.match_length = 2;
|
|
}
|
|
}
|
|
if (a0.prev_length >= 3 && a0.match_length <= a0.prev_length) {
|
|
const r93 = a0.strstart + a0.lookahead - 3;
|
|
const r103 = _tr_tally(a0, a0.strstart - 1 - a0.prev_match, a0.prev_length - 3);
|
|
a0.lookahead = a0.lookahead - (a0.prev_length - 1);
|
|
a0.prev_length = a0.prev_length - 2;
|
|
while (true) {
|
|
const strstart = a0.strstart + 1;
|
|
a0.strstart = strstart;
|
|
if (strstart <= r93) {
|
|
a0.ins_h = (a0.ins_h << a0.hash_shift ^ a0.window[a0.strstart + 3 - 1]) & a0.hash_mask;
|
|
a0.prev[a0.strstart & a0.w_mask] = a0.head[a0.ins_h];
|
|
a0.head[a0.ins_h] = a0.strstart;
|
|
}
|
|
const prev_length = a0.prev_length - 1;
|
|
a0.prev_length = prev_length;
|
|
if (prev_length == 0) {
|
|
a0.match_available = 0;
|
|
a0.match_length = 2;
|
|
a0.strstart = a0.strstart + 1;
|
|
if (!r103) {
|
|
continue loop1;
|
|
}
|
|
flush_block_only(a0, false);
|
|
if (a0.strm.avail_out !== 0) {
|
|
continue loop1;
|
|
}
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
if (a0.match_available) {
|
|
if (_tr_tally(a0, 0, a0.window[a0.strstart - 1])) {
|
|
flush_block_only(a0, false);
|
|
}
|
|
a0.strstart = a0.strstart + 1;
|
|
a0.lookahead = a0.lookahead - 1;
|
|
if (a0.strm.avail_out === 0) {
|
|
return 1;
|
|
}
|
|
} else {
|
|
a0.match_available = 1;
|
|
a0.strstart = a0.strstart + 1;
|
|
a0.lookahead = a0.lookahead - 1;
|
|
}
|
|
}
|
|
};
|
|
const Config = function Config(a0, a1, a2, a3, a4) {
|
|
this.good_length = a0;
|
|
this.max_lazy = a1;
|
|
this.nice_length = a2;
|
|
this.max_chain = a3;
|
|
this.func = a4;
|
|
};
|
|
DeflateState = 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 = 8;
|
|
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 Buf16(1146);
|
|
this.dyn_dtree = new Buf16(122);
|
|
this.bl_tree = new Buf16(78);
|
|
const dyn_ltree = this.dyn_ltree;
|
|
let r37 = dyn_ltree.length - 1;
|
|
while (r37 >= 0) {
|
|
dyn_ltree[r37] = 0;
|
|
r37 = r37 - 1;
|
|
}
|
|
const dyn_dtree = this.dyn_dtree;
|
|
let r40 = dyn_dtree.length - 1;
|
|
while (r40 >= 0) {
|
|
dyn_dtree[r40] = 0;
|
|
r40 = r40 - 1;
|
|
}
|
|
const bl_tree = this.bl_tree;
|
|
let r43 = bl_tree.length - 1;
|
|
while (r43 >= 0) {
|
|
bl_tree[r43] = 0;
|
|
r43 = r43 - 1;
|
|
}
|
|
this.l_desc = null;
|
|
this.d_desc = null;
|
|
this.bl_desc = null;
|
|
this.bl_count = new Buf16(16);
|
|
this.heap = new Buf16(573);
|
|
const heap = this.heap;
|
|
let r63 = heap.length - 1;
|
|
while (r63 >= 0) {
|
|
heap[r63] = 0;
|
|
r63 = r63 - 1;
|
|
}
|
|
this.heap_len = 0;
|
|
this.heap_max = 0;
|
|
this.depth = new Buf16(573);
|
|
const depth = this.depth;
|
|
let r74 = depth.length - 1;
|
|
while (r74 >= 0) {
|
|
depth[r74] = 0;
|
|
r74 = r74 - 1;
|
|
}
|
|
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;
|
|
};
|
|
deflateReset = function deflateReset(a0) {
|
|
let r1;
|
|
if (a0 && a0.state) {
|
|
a0.total_out = 0;
|
|
a0.total_in = 0;
|
|
a0.data_type = 2;
|
|
const state = a0.state;
|
|
state.pending = 0;
|
|
state.pending_out = 0;
|
|
if (state.wrap < 0) {
|
|
state.wrap = -state.wrap;
|
|
}
|
|
state.status = state.wrap ? 42 : 113;
|
|
a0.adler = state.wrap === 2 ? 0 : 1;
|
|
state.last_flush = 0;
|
|
_tr_init(state);
|
|
r1 = 0;
|
|
} else {
|
|
r1 = -2;
|
|
a0.msg = _Module12716[-2];
|
|
}
|
|
if (r1 === 0) {
|
|
const state2 = a0.state;
|
|
state2.window_size = 2 * state2.w_size;
|
|
const head = state2.head;
|
|
let r35 = head.length - 1;
|
|
while (r35 >= 0) {
|
|
head[r35] = 0;
|
|
r35 = r35 - 1;
|
|
}
|
|
state2.max_lazy_match = c8761_2[state2.level].max_lazy;
|
|
state2.good_match = c8761_2[state2.level].good_length;
|
|
state2.nice_match = c8761_2[state2.level].nice_length;
|
|
state2.max_chain_length = c8761_2[state2.level].max_chain;
|
|
state2.strstart = 0;
|
|
state2.block_start = 0;
|
|
state2.lookahead = 0;
|
|
state2.insert = 0;
|
|
state2.prev_length = 2;
|
|
state2.match_length = 2;
|
|
state2.match_available = 0;
|
|
state2.ins_h = 0;
|
|
}
|
|
return r1;
|
|
};
|
|
deflateInit2 = function deflateInit2(strm, a1, method, windowBits, memLevel, strategy) {
|
|
let w_bits, wrap;
|
|
if (strm) {
|
|
const level = a1 === -1 ? 6 : a1;
|
|
if (windowBits < 0) {
|
|
w_bits = -windowBits;
|
|
wrap = 0;
|
|
} else {
|
|
const r6 = windowBits > 15;
|
|
wrap = 1;
|
|
w_bits = windowBits;
|
|
if (r6) {
|
|
w_bits = windowBits - 16;
|
|
wrap = 2;
|
|
}
|
|
}
|
|
if (!(memLevel < 1) && !(memLevel > 9) && method === 8 && !(w_bits < 8) && !(w_bits > 15) && !(level < 0) && !(level > 9) && !(strategy < 0) && !(strategy > 4)) {
|
|
if (w_bits === 8) {
|
|
w_bits = 9;
|
|
}
|
|
const state = {
|
|
__proto__: DeflateState.prototype
|
|
};
|
|
new DeflateState();
|
|
strm.state = state;
|
|
state.strm = strm;
|
|
state.wrap = wrap;
|
|
state.gzhead = null;
|
|
state.w_bits = w_bits;
|
|
state.w_size = 1 << state.w_bits;
|
|
state.w_mask = state.w_size - 1;
|
|
state.hash_bits = memLevel + 7;
|
|
state.hash_size = 1 << state.hash_bits;
|
|
state.hash_mask = state.hash_size - 1;
|
|
state.hash_shift = ~~((state.hash_bits + 3 - 1) / 3);
|
|
state.window = new Buf8(2 * state.w_size);
|
|
state.head = new Buf16(state.hash_size);
|
|
state.prev = new Buf16(state.w_size);
|
|
state.lit_bufsize = 1 << memLevel + 6;
|
|
state.pending_buf_size = 4 * state.lit_bufsize;
|
|
state.pending_buf = new Buf8(state.pending_buf_size);
|
|
state.d_buf = 1 * state.lit_bufsize;
|
|
state.l_buf = 3 * state.lit_bufsize;
|
|
state.level = level;
|
|
state.strategy = strategy;
|
|
state.method = method;
|
|
return deflateReset(strm);
|
|
}
|
|
strm.msg = _Module12716[-2];
|
|
return -2;
|
|
}
|
|
return -2;
|
|
};
|
|
const r10 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r10.good_length = 0;
|
|
r10.max_lazy = 0;
|
|
r10.nice_length = 0;
|
|
r10.max_chain = 0;
|
|
r10.func = function deflate_stored(a0, a1) {
|
|
let r44;
|
|
let r0 = a0.pending_buf_size - 5 < 65535 ? a0.pending_buf_size - 5 : 65535;
|
|
while (true) {
|
|
const lookahead = a0.lookahead;
|
|
const r15 = r0;
|
|
if (lookahead <= 1) {
|
|
fill_window(a0);
|
|
if (a0.lookahead === 0 && a1 === 0) {
|
|
return 1;
|
|
}
|
|
if (a0.lookahead === 0) {
|
|
a0.insert = 0;
|
|
let r40 = 4;
|
|
if (a1 === 4) {
|
|
flush_block_only(a0, true);
|
|
if (a0.strm.avail_out === 0) {
|
|
r40 = 3;
|
|
}
|
|
r44 = r40;
|
|
} else {
|
|
const r43 = a0.strstart > a0.block_start;
|
|
r44 = 1;
|
|
if (r43) {
|
|
flush_block_only(a0, false);
|
|
a0.strm.avail_out;
|
|
r44 = 1;
|
|
}
|
|
}
|
|
return r44;
|
|
}
|
|
}
|
|
a0.strstart = a0.strstart + a0.lookahead;
|
|
a0.lookahead = 0;
|
|
const strstart = a0.block_start + r15;
|
|
if (!(a0.strstart !== 0 && !(a0.strstart >= strstart))) {
|
|
a0.lookahead = a0.strstart - strstart;
|
|
a0.strstart = strstart;
|
|
flush_block_only(a0, false);
|
|
if (a0.strm.avail_out === 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
const r33 = a0.strstart - a0.block_start;
|
|
const r35 = a0.w_size - 262;
|
|
r0 = r15;
|
|
if (r33 >= r35) {
|
|
flush_block_only(a0, false);
|
|
const avail_out = a0.strm.avail_out;
|
|
r0 = r15;
|
|
if (avail_out === 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const r23 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r23.good_length = 4;
|
|
r23.max_lazy = 4;
|
|
r23.nice_length = 8;
|
|
r23.max_chain = 4;
|
|
r23.func = deflate_fast;
|
|
const r25 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r25.good_length = 4;
|
|
r25.max_lazy = 5;
|
|
r25.nice_length = 16;
|
|
r25.max_chain = 8;
|
|
r25.func = deflate_fast;
|
|
const r29 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r29.good_length = 4;
|
|
r29.max_lazy = 6;
|
|
r29.nice_length = 32;
|
|
r29.max_chain = 32;
|
|
r29.func = deflate_fast;
|
|
const r32 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r32.good_length = 4;
|
|
r32.max_lazy = 4;
|
|
r32.nice_length = 16;
|
|
r32.max_chain = 16;
|
|
r32.func = deflate_slow;
|
|
const r34 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r34.good_length = 8;
|
|
r34.max_lazy = 16;
|
|
r34.nice_length = 32;
|
|
r34.max_chain = 32;
|
|
r34.func = deflate_slow;
|
|
const r36 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r36.good_length = 8;
|
|
r36.max_lazy = 16;
|
|
r36.nice_length = 128;
|
|
r36.max_chain = 128;
|
|
r36.func = deflate_slow;
|
|
const r39 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r39.good_length = 8;
|
|
r39.max_lazy = 32;
|
|
r39.nice_length = 128;
|
|
r39.max_chain = 256;
|
|
r39.func = deflate_slow;
|
|
const r42 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r42.good_length = 32;
|
|
r42.max_lazy = 128;
|
|
r42.nice_length = 258;
|
|
r42.max_chain = 1024;
|
|
r42.func = deflate_slow;
|
|
const r46 = {
|
|
__proto__: Config.prototype
|
|
};
|
|
r46.good_length = 32;
|
|
r46.max_lazy = 258;
|
|
r46.nice_length = 258;
|
|
r46.max_chain = 4096;
|
|
r46.func = deflate_slow;
|
|
c8761_2 = [r10, r23, r25, r29, r32, r34, r36, r39, r42, r46];
|
|
export function deflateInit(a0, a1) {
|
|
return deflateInit2(a0, a1, 8, 15, 8, 0);
|
|
}
|
|
export { deflateInit2 };
|
|
export { deflateReset };
|
|
export function deflateResetKeep(a0) {
|
|
let r1;
|
|
if (a0 && a0.state) {
|
|
a0.total_out = 0;
|
|
a0.total_in = 0;
|
|
a0.data_type = 2;
|
|
const state = a0.state;
|
|
state.pending = 0;
|
|
state.pending_out = 0;
|
|
if (state.wrap < 0) {
|
|
state.wrap = -state.wrap;
|
|
}
|
|
state.status = state.wrap ? 42 : 113;
|
|
a0.adler = state.wrap === 2 ? 0 : 1;
|
|
state.last_flush = 0;
|
|
_tr_init(state);
|
|
r1 = 0;
|
|
} else {
|
|
r1 = -2;
|
|
a0.msg = _Module12716[-2];
|
|
}
|
|
return r1;
|
|
}
|
|
export function deflateSetHeader(a0, a1) {
|
|
let r0 = -2;
|
|
let r1 = -2;
|
|
if (a0) {
|
|
const state = a0.state;
|
|
r1 = -2;
|
|
if (state) {
|
|
if (a0.state.wrap === 2) {
|
|
a0.state.gzhead = a1;
|
|
r0 = 0;
|
|
}
|
|
r1 = r0;
|
|
}
|
|
}
|
|
return r1;
|
|
}
|
|
export function deflate(a0, a1) {
|
|
let r24, r456, r457, r544, r545, r695, r701, r746, r770, r801, r804;
|
|
if (a0 && a0.state && !(a1 > 5) && !(a1 < 0)) {
|
|
L267: {
|
|
const state = a0.state;
|
|
if (a0.output) {
|
|
if (!a0.input && a0.avail_in !== 0) {
|
|
break L267;
|
|
}
|
|
if (state.status === 666 && a1 !== 4) {
|
|
break L267;
|
|
}
|
|
state.strm = a0;
|
|
const last_flush = state.last_flush;
|
|
state.last_flush = a1;
|
|
if (state.status === 42) {
|
|
if (state.wrap === 2) {
|
|
a0.adler = 0;
|
|
const pending_buf7 = state.pending_buf;
|
|
const r108 = +state.pending;
|
|
state.pending = r108 + 1;
|
|
pending_buf7[r108] = 31;
|
|
const pending_buf8 = state.pending_buf;
|
|
const r113 = +state.pending;
|
|
state.pending = r113 + 1;
|
|
pending_buf8[r113] = 139;
|
|
const pending_buf9 = state.pending_buf;
|
|
const r118 = +state.pending;
|
|
state.pending = r118 + 1;
|
|
pending_buf9[r118] = 8;
|
|
if (state.gzhead) {
|
|
const r161 = state.gzhead.text ? 1 : 0;
|
|
const r164 = state.gzhead.hcrc ? 2 : 0;
|
|
const r167 = state.gzhead.extra ? 4 : 0;
|
|
const r170 = state.gzhead.name ? 8 : 0;
|
|
const r173 = state.gzhead.comment ? 16 : 0;
|
|
const r176 = r161 + r164 + r167 + r170;
|
|
const pending_buf17 = state.pending_buf;
|
|
const r179 = +state.pending;
|
|
state.pending = r179 + 1;
|
|
pending_buf17[r179] = r176 + r173;
|
|
const r185 = 255 & state.gzhead.time;
|
|
const pending_buf18 = state.pending_buf;
|
|
const r188 = +state.pending;
|
|
state.pending = r188 + 1;
|
|
pending_buf18[r188] = r185;
|
|
const r192 = state.gzhead.time >> 8;
|
|
const pending_buf19 = state.pending_buf;
|
|
const r195 = +state.pending;
|
|
state.pending = r195 + 1;
|
|
pending_buf19[r195] = r192 & 255;
|
|
const r201 = state.gzhead.time >> 16;
|
|
const pending_buf20 = state.pending_buf;
|
|
const r204 = +state.pending;
|
|
state.pending = r204 + 1;
|
|
pending_buf20[r204] = r201 & 255;
|
|
const r210 = state.gzhead.time >> 24;
|
|
const pending_buf21 = state.pending_buf;
|
|
const r213 = +state.pending;
|
|
state.pending = r213 + 1;
|
|
pending_buf21[r213] = r210 & 255;
|
|
const r218 = state.level !== 9 ? state.strategy >= 2 ? 4 : state.level < 2 ? 4 : 0 : 2;
|
|
const pending_buf22 = state.pending_buf;
|
|
const r225 = +state.pending;
|
|
state.pending = r225 + 1;
|
|
pending_buf22[r225] = r218;
|
|
const r229 = 255 & state.gzhead.os;
|
|
const pending_buf23 = state.pending_buf;
|
|
const r232 = +state.pending;
|
|
state.pending = r232 + 1;
|
|
pending_buf23[r232] = r229;
|
|
if (state.gzhead.extra && state.gzhead.extra.length) {
|
|
const r241 = 255 & state.gzhead.extra.length;
|
|
const pending_buf24 = state.pending_buf;
|
|
const r244 = +state.pending;
|
|
state.pending = r244 + 1;
|
|
pending_buf24[r244] = r241;
|
|
const r249 = state.gzhead.extra.length >> 8;
|
|
const pending_buf25 = state.pending_buf;
|
|
const r252 = +state.pending;
|
|
state.pending = r252 + 1;
|
|
pending_buf25[r252] = r249 & 255;
|
|
}
|
|
if (state.gzhead.hcrc) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending, 0);
|
|
}
|
|
state.gzindex = 0;
|
|
state.status = 69;
|
|
} else {
|
|
const pending_buf10 = state.pending_buf;
|
|
const r124 = +state.pending;
|
|
state.pending = r124 + 1;
|
|
pending_buf10[r124] = 0;
|
|
const pending_buf11 = state.pending_buf;
|
|
const r128 = +state.pending;
|
|
state.pending = r128 + 1;
|
|
pending_buf11[r128] = 0;
|
|
const pending_buf12 = state.pending_buf;
|
|
const r132 = +state.pending;
|
|
state.pending = r132 + 1;
|
|
pending_buf12[r132] = 0;
|
|
const pending_buf13 = state.pending_buf;
|
|
const r136 = +state.pending;
|
|
state.pending = r136 + 1;
|
|
pending_buf13[r136] = 0;
|
|
const pending_buf14 = state.pending_buf;
|
|
const r140 = +state.pending;
|
|
state.pending = r140 + 1;
|
|
pending_buf14[r140] = 0;
|
|
const r144 = state.level !== 9 ? state.strategy >= 2 ? 4 : state.level < 2 ? 4 : 0 : 2;
|
|
const pending_buf15 = state.pending_buf;
|
|
const r151 = +state.pending;
|
|
state.pending = r151 + 1;
|
|
pending_buf15[r151] = r144;
|
|
const pending_buf16 = state.pending_buf;
|
|
const r155 = +state.pending;
|
|
state.pending = r155 + 1;
|
|
pending_buf16[r155] = 3;
|
|
state.status = 113;
|
|
}
|
|
} else {
|
|
const r57 = 8 + (state.w_bits - 8 << 4) << 8 | (state.strategy >= 2 ? 0 : state.level < 2 ? 0 : state.level < 6 ? 1 : state.level === 6 ? 2 : 3) << 6;
|
|
const r59 = state.strstart !== 0 ? r57 | 32 : r57;
|
|
const r64 = r59 + (31 - r59 % 31);
|
|
state.status = 113;
|
|
const pending_buf = state.pending_buf;
|
|
const r67 = +state.pending;
|
|
state.pending = r67 + 1;
|
|
pending_buf[r67] = r64 >>> 8 & 255;
|
|
const pending_buf2 = state.pending_buf;
|
|
const r73 = +state.pending;
|
|
state.pending = r73 + 1;
|
|
pending_buf2[r73] = 255 & r64;
|
|
if (state.strstart !== 0) {
|
|
const r79 = a0.adler >>> 16;
|
|
const pending_buf3 = state.pending_buf;
|
|
const r82 = +state.pending;
|
|
state.pending = r82 + 1;
|
|
pending_buf3[r82] = r79 >>> 8 & 255;
|
|
const pending_buf4 = state.pending_buf;
|
|
const r88 = +state.pending;
|
|
state.pending = r88 + 1;
|
|
pending_buf4[r88] = 255 & r79;
|
|
const r93 = 65535 & a0.adler;
|
|
const pending_buf5 = state.pending_buf;
|
|
const r96 = +state.pending;
|
|
state.pending = r96 + 1;
|
|
pending_buf5[r96] = r93 >>> 8 & 255;
|
|
const pending_buf6 = state.pending_buf;
|
|
const r102 = +state.pending;
|
|
state.pending = r102 + 1;
|
|
pending_buf6[r102] = 255 & r93;
|
|
}
|
|
a0.adler = 1;
|
|
}
|
|
}
|
|
if (state.status === 69) {
|
|
if (state.gzhead.extra) {
|
|
L79: {
|
|
const { pending, gzindex } = state;
|
|
const r273 = 65535 & state.gzhead.extra.length;
|
|
r24 = pending;
|
|
if (gzindex < r273) {
|
|
const { pending: pending2, pending_buf_size } = state;
|
|
let r276 = pending;
|
|
if (pending2 === pending_buf_size) {
|
|
if (state.gzhead.hcrc && state.pending > pending) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - pending, pending);
|
|
}
|
|
const state2 = a0.state;
|
|
let pending3 = state2.pending;
|
|
if (pending3 > a0.avail_out) {
|
|
pending3 = a0.avail_out;
|
|
}
|
|
if (pending3 !== 0) {
|
|
arraySet(a0.output, state2.pending_buf, state2.pending_out, pending3, a0.next_out);
|
|
a0.next_out = a0.next_out + pending3;
|
|
state2.pending_out = state2.pending_out + pending3;
|
|
a0.total_out = a0.total_out + pending3;
|
|
a0.avail_out = a0.avail_out - pending3;
|
|
state2.pending = state2.pending - pending3;
|
|
if (state2.pending === 0) {
|
|
state2.pending_out = 0;
|
|
}
|
|
}
|
|
r276 = state.pending;
|
|
const { pending: pending4, pending_buf_size: pending_buf_size2 } = state;
|
|
r24 = r276;
|
|
if (pending4 === pending_buf_size2) {
|
|
break L79;
|
|
}
|
|
}
|
|
while (true) {
|
|
const r322 = 255 & state.gzhead.extra[state.gzindex];
|
|
const pending_buf26 = state.pending_buf;
|
|
const r325 = +state.pending;
|
|
state.pending = r325 + 1;
|
|
pending_buf26[r325] = r322;
|
|
state.gzindex = state.gzindex + 1;
|
|
const gzindex2 = state.gzindex;
|
|
const r333 = 65535 & state.gzhead.extra.length;
|
|
const r334 = r276;
|
|
r24 = r334;
|
|
if (!(gzindex2 < r333)) {
|
|
break;
|
|
}
|
|
const { pending: pending5, pending_buf_size: pending_buf_size3 } = state;
|
|
r276 = r334;
|
|
if (pending5 === pending_buf_size3) {
|
|
if (state.gzhead.hcrc && state.pending > r334) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r334, r334);
|
|
}
|
|
const state3 = a0.state;
|
|
let pending6 = state3.pending;
|
|
if (pending6 > a0.avail_out) {
|
|
pending6 = a0.avail_out;
|
|
}
|
|
if (pending6 !== 0) {
|
|
arraySet(a0.output, state3.pending_buf, state3.pending_out, pending6, a0.next_out);
|
|
a0.next_out = a0.next_out + pending6;
|
|
state3.pending_out = state3.pending_out + pending6;
|
|
a0.total_out = a0.total_out + pending6;
|
|
a0.avail_out = a0.avail_out - pending6;
|
|
state3.pending = state3.pending - pending6;
|
|
if (state3.pending === 0) {
|
|
state3.pending_out = 0;
|
|
}
|
|
}
|
|
r276 = state.pending;
|
|
const { pending: pending7, pending_buf_size: pending_buf_size4 } = state;
|
|
r24 = r276;
|
|
if (pending7 === pending_buf_size4) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (state.gzhead.hcrc && state.pending > r24) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r24, r24);
|
|
}
|
|
if (state.gzindex === state.gzhead.extra.length) {
|
|
state.gzindex = 0;
|
|
state.status = 73;
|
|
}
|
|
} else {
|
|
state.status = 73;
|
|
}
|
|
}
|
|
if (state.status === 73) {
|
|
if (state.gzhead.name) {
|
|
let pending8 = state.pending;
|
|
while (true) {
|
|
L103: {
|
|
const { pending: pending9, pending_buf_size: pending_buf_size5 } = state;
|
|
const r412 = pending8;
|
|
let r413 = r412;
|
|
if (pending9 === pending_buf_size5) {
|
|
if (state.gzhead.hcrc && state.pending > r412) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r412, r412);
|
|
}
|
|
const state4 = a0.state;
|
|
let pending10 = state4.pending;
|
|
if (pending10 > a0.avail_out) {
|
|
pending10 = a0.avail_out;
|
|
}
|
|
if (pending10 !== 0) {
|
|
arraySet(a0.output, state4.pending_buf, state4.pending_out, pending10, a0.next_out);
|
|
a0.next_out = a0.next_out + pending10;
|
|
state4.pending_out = state4.pending_out + pending10;
|
|
a0.total_out = a0.total_out + pending10;
|
|
a0.avail_out = a0.avail_out - pending10;
|
|
state4.pending = state4.pending - pending10;
|
|
if (state4.pending === 0) {
|
|
state4.pending_out = 0;
|
|
}
|
|
}
|
|
r413 = state.pending;
|
|
const { pending: pending11, pending_buf_size: pending_buf_size6 } = state;
|
|
r456 = 1;
|
|
r457 = r413;
|
|
if (pending11 === pending_buf_size6) {
|
|
break L103;
|
|
}
|
|
}
|
|
const r13 = state.gzindex < state.gzhead.name.length;
|
|
let r462 = 0;
|
|
if (r13) {
|
|
const name = state.gzhead.name;
|
|
const r467 = +state.gzindex;
|
|
state.gzindex = r467 + 1;
|
|
r462 = 255 & name.charCodeAt(r467);
|
|
}
|
|
const pending_buf27 = state.pending_buf;
|
|
const r472 = +state.pending;
|
|
state.pending = r472 + 1;
|
|
pending_buf27[r472] = r462;
|
|
r456 = r462;
|
|
pending8 = r413;
|
|
r457 = pending8;
|
|
if (r456 !== 0) {
|
|
continue;
|
|
}
|
|
}
|
|
if (state.gzhead.hcrc && state.pending > r457) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r457, r457);
|
|
}
|
|
if (r456 !== 0) {
|
|
break;
|
|
}
|
|
state.gzindex = 0;
|
|
state.status = 91;
|
|
break;
|
|
}
|
|
} else {
|
|
state.status = 91;
|
|
}
|
|
}
|
|
if (state.status === 91) {
|
|
if (state.gzhead.comment) {
|
|
let pending12 = state.pending;
|
|
while (true) {
|
|
L127: {
|
|
const { pending: pending13, pending_buf_size: pending_buf_size7 } = state;
|
|
const r500 = pending12;
|
|
let r501 = r500;
|
|
if (pending13 === pending_buf_size7) {
|
|
if (state.gzhead.hcrc && state.pending > r500) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r500, r500);
|
|
}
|
|
const state5 = a0.state;
|
|
let pending14 = state5.pending;
|
|
if (pending14 > a0.avail_out) {
|
|
pending14 = a0.avail_out;
|
|
}
|
|
if (pending14 !== 0) {
|
|
arraySet(a0.output, state5.pending_buf, state5.pending_out, pending14, a0.next_out);
|
|
a0.next_out = a0.next_out + pending14;
|
|
state5.pending_out = state5.pending_out + pending14;
|
|
a0.total_out = a0.total_out + pending14;
|
|
a0.avail_out = a0.avail_out - pending14;
|
|
state5.pending = state5.pending - pending14;
|
|
if (state5.pending === 0) {
|
|
state5.pending_out = 0;
|
|
}
|
|
}
|
|
r501 = state.pending;
|
|
const { pending: pending15, pending_buf_size: pending_buf_size8 } = state;
|
|
r544 = 1;
|
|
r545 = r501;
|
|
if (pending15 === pending_buf_size8) {
|
|
break L127;
|
|
}
|
|
}
|
|
const r550 = state.gzindex < state.gzhead.comment.length;
|
|
let r551 = 0;
|
|
if (r550) {
|
|
const comment = state.gzhead.comment;
|
|
const r556 = +state.gzindex;
|
|
state.gzindex = r556 + 1;
|
|
r551 = 255 & comment.charCodeAt(r556);
|
|
}
|
|
const pending_buf28 = state.pending_buf;
|
|
const r561 = +state.pending;
|
|
state.pending = r561 + 1;
|
|
pending_buf28[r561] = r551;
|
|
r544 = r551;
|
|
pending12 = r501;
|
|
r545 = pending12;
|
|
if (r544 !== 0) {
|
|
continue;
|
|
}
|
|
}
|
|
if (state.gzhead.hcrc && state.pending > r545) {
|
|
a0.adler = _Module12719(a0.adler, state.pending_buf, state.pending - r545, r545);
|
|
}
|
|
if (r544 !== 0) {
|
|
break;
|
|
}
|
|
state.status = 103;
|
|
break;
|
|
}
|
|
} else {
|
|
state.status = 103;
|
|
}
|
|
}
|
|
if (state.status === 103) {
|
|
if (state.gzhead.hcrc) {
|
|
if (state.pending + 2 > state.pending_buf_size) {
|
|
const state6 = a0.state;
|
|
let pending16 = state6.pending;
|
|
if (pending16 > a0.avail_out) {
|
|
pending16 = a0.avail_out;
|
|
}
|
|
if (pending16 !== 0) {
|
|
arraySet(a0.output, state6.pending_buf, state6.pending_out, pending16, a0.next_out);
|
|
a0.next_out = a0.next_out + pending16;
|
|
state6.pending_out = state6.pending_out + pending16;
|
|
a0.total_out = a0.total_out + pending16;
|
|
a0.avail_out = a0.avail_out - pending16;
|
|
state6.pending = state6.pending - pending16;
|
|
if (state6.pending === 0) {
|
|
state6.pending_out = 0;
|
|
}
|
|
}
|
|
}
|
|
if (state.pending + 2 <= state.pending_buf_size) {
|
|
const r618 = 255 & a0.adler;
|
|
const pending_buf29 = state.pending_buf;
|
|
const r621 = +state.pending;
|
|
state.pending = r621 + 1;
|
|
pending_buf29[r621] = r618;
|
|
const r625 = a0.adler >> 8;
|
|
const pending_buf30 = state.pending_buf;
|
|
const r628 = +state.pending;
|
|
state.pending = r628 + 1;
|
|
pending_buf30[r628] = r625 & 255;
|
|
a0.adler = 0;
|
|
state.status = 113;
|
|
}
|
|
} else {
|
|
state.status = 113;
|
|
}
|
|
}
|
|
if (state.pending !== 0) {
|
|
const state7 = a0.state;
|
|
let pending17 = state7.pending;
|
|
if (pending17 > a0.avail_out) {
|
|
pending17 = a0.avail_out;
|
|
}
|
|
if (pending17 !== 0) {
|
|
arraySet(a0.output, state7.pending_buf, state7.pending_out, pending17, a0.next_out);
|
|
a0.next_out = a0.next_out + pending17;
|
|
state7.pending_out = state7.pending_out + pending17;
|
|
a0.total_out = a0.total_out + pending17;
|
|
a0.avail_out = a0.avail_out - pending17;
|
|
state7.pending = state7.pending - pending17;
|
|
if (state7.pending === 0) {
|
|
state7.pending_out = 0;
|
|
}
|
|
}
|
|
if (a0.avail_out === 0) {
|
|
state.last_flush = -1;
|
|
return 0;
|
|
}
|
|
} else if (a0.avail_in === 0) {
|
|
if ((a1 << 1) - (a1 > 4 ? 9 : 0) <= (last_flush << 1) - (last_flush > 4 ? 9 : 0) && a1 !== 4) {
|
|
a0.msg = _Module12716[-5];
|
|
return -5;
|
|
}
|
|
}
|
|
if (state.status === 666 && a0.avail_in !== 0) {
|
|
a0.msg = _Module12716[-5];
|
|
return -5;
|
|
}
|
|
L244: {
|
|
if (a0.avail_in === 0 && state.lookahead === 0) {
|
|
if (a1 === 0) {
|
|
break L244;
|
|
}
|
|
if (state.status === 666) {
|
|
break L244;
|
|
}
|
|
}
|
|
if (state.strategy === 2) {
|
|
while (true) {
|
|
L222: {
|
|
if (state.lookahead === 0) {
|
|
fill_window(state);
|
|
if (state.lookahead === 0) {
|
|
r801 = 1;
|
|
if (a1 === 0) {
|
|
break L222;
|
|
}
|
|
state.insert = 0;
|
|
let r802 = 4;
|
|
if (a1 === 4) {
|
|
flush_block_only(state, true);
|
|
if (state.strm.avail_out === 0) {
|
|
r802 = 3;
|
|
}
|
|
r804 = r802;
|
|
} else {
|
|
const last_lit2 = state.last_lit;
|
|
r804 = 2;
|
|
if (last_lit2) {
|
|
flush_block_only(state, false);
|
|
r804 = state.strm.avail_out === 0 ? 1 : 2;
|
|
}
|
|
}
|
|
r801 = r804;
|
|
break L222;
|
|
}
|
|
}
|
|
state.match_length = 0;
|
|
const r792 = _tr_tally(state, 0, state.window[state.strstart]);
|
|
state.lookahead = state.lookahead - 1;
|
|
state.strstart = state.strstart + 1;
|
|
if (!r792) {
|
|
continue;
|
|
}
|
|
flush_block_only(state, false);
|
|
const avail_out2 = state.strm.avail_out;
|
|
r801 = 1;
|
|
if (avail_out2 !== 0) {
|
|
continue;
|
|
}
|
|
}
|
|
r695 = r801;
|
|
break;
|
|
}
|
|
} else if (state.strategy === 3) {
|
|
const window2 = state.window;
|
|
while (true) {
|
|
L205: {
|
|
if (state.lookahead <= 258) {
|
|
fill_window(state);
|
|
if (state.lookahead <= 258) {
|
|
r701 = 1;
|
|
if (a1 === 0) {
|
|
break L205;
|
|
}
|
|
}
|
|
if (state.lookahead === 0) {
|
|
state.insert = 0;
|
|
let r768 = 4;
|
|
if (a1 === 4) {
|
|
flush_block_only(state, true);
|
|
if (state.strm.avail_out === 0) {
|
|
r768 = 3;
|
|
}
|
|
r770 = r768;
|
|
} else {
|
|
const last_lit = state.last_lit;
|
|
r770 = 2;
|
|
if (last_lit) {
|
|
flush_block_only(state, false);
|
|
r770 = state.strm.avail_out === 0 ? 1 : 2;
|
|
}
|
|
}
|
|
r701 = r770;
|
|
break L205;
|
|
}
|
|
}
|
|
state.match_length = 0;
|
|
if (state.lookahead >= 3 && state.strstart > 0) {
|
|
const r706 = state.strstart - 1;
|
|
const r707 = window2[r706];
|
|
const r708 = r706 + 1;
|
|
if (r707 === window2[r708]) {
|
|
const r710 = r708 + 1;
|
|
if (r707 === window2[r710]) {
|
|
let r712 = r710 + 1;
|
|
if (r707 === window2[r712]) {
|
|
const r715 = state.strstart + 258;
|
|
while (true) {
|
|
const r0 = r712 + 1;
|
|
const r716 = window2[r0];
|
|
let r717 = r0;
|
|
if (r707 === r716) {
|
|
const r718 = r0 + 1;
|
|
const r719 = window2[r718];
|
|
r717 = r718;
|
|
if (r707 === r719) {
|
|
const r720 = r718 + 1;
|
|
const r721 = window2[r720];
|
|
r717 = r720;
|
|
if (r707 === r721) {
|
|
const r722 = r720 + 1;
|
|
const r723 = window2[r722];
|
|
r717 = r722;
|
|
if (r707 === r723) {
|
|
const r724 = r722 + 1;
|
|
const r725 = window2[r724];
|
|
r717 = r724;
|
|
if (r707 === r725) {
|
|
const r726 = r724 + 1;
|
|
const r727 = window2[r726];
|
|
r717 = r726;
|
|
if (r707 === r727) {
|
|
const r728 = r726 + 1;
|
|
const r729 = window2[r728];
|
|
r717 = r728;
|
|
if (r707 === r729) {
|
|
const r730 = r728 + 1;
|
|
const r731 = window2[r730];
|
|
r717 = r730;
|
|
if (r707 === r731) {
|
|
r712 = r730;
|
|
r717 = r712;
|
|
if (r717 < r715) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
state.match_length = 258 - (r715 - r717);
|
|
if (!(state.match_length > state.lookahead)) {
|
|
break;
|
|
}
|
|
state.match_length = state.lookahead;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (state.match_length >= 3) {
|
|
r746 = _tr_tally(state, 1, state.match_length - 3);
|
|
state.lookahead = state.lookahead - state.match_length;
|
|
state.strstart = state.strstart + state.match_length;
|
|
state.match_length = 0;
|
|
} else {
|
|
r746 = _tr_tally(state, 0, state.window[state.strstart]);
|
|
state.lookahead = state.lookahead - 1;
|
|
state.strstart = state.strstart + 1;
|
|
}
|
|
if (!r746) {
|
|
continue;
|
|
}
|
|
flush_block_only(state, false);
|
|
const avail_out = state.strm.avail_out;
|
|
r701 = 1;
|
|
if (avail_out !== 0) {
|
|
continue;
|
|
}
|
|
}
|
|
r695 = r701;
|
|
break;
|
|
}
|
|
} else {
|
|
r695 = c8761_2[state.level].func(state, a1);
|
|
}
|
|
if (!(r695 !== 3 && r695 !== 4)) {
|
|
state.status = 666;
|
|
}
|
|
if (!(r695 !== 1 && r695 !== 3)) {
|
|
if (a0.avail_out === 0) {
|
|
state.last_flush = -1;
|
|
}
|
|
return 0;
|
|
}
|
|
if (r695 === 2) {
|
|
if (a1 === 1) {
|
|
_tr_align(state);
|
|
} else if (a1 !== 5) {
|
|
_tr_stored_block(state, 0, 0, false);
|
|
if (a1 === 3) {
|
|
const head = state.head;
|
|
let r830 = head.length - 1;
|
|
while (r830 >= 0) {
|
|
head[r830] = 0;
|
|
r830 = r830 - 1;
|
|
}
|
|
if (state.lookahead === 0) {
|
|
state.strstart = 0;
|
|
state.block_start = 0;
|
|
state.insert = 0;
|
|
}
|
|
}
|
|
}
|
|
const state8 = a0.state;
|
|
let pending18 = state8.pending;
|
|
if (pending18 > a0.avail_out) {
|
|
pending18 = a0.avail_out;
|
|
}
|
|
if (pending18 !== 0) {
|
|
arraySet(a0.output, state8.pending_buf, state8.pending_out, pending18, a0.next_out);
|
|
a0.next_out = a0.next_out + pending18;
|
|
state8.pending_out = state8.pending_out + pending18;
|
|
a0.total_out = a0.total_out + pending18;
|
|
a0.avail_out = a0.avail_out - pending18;
|
|
state8.pending = state8.pending - pending18;
|
|
if (state8.pending === 0) {
|
|
state8.pending_out = 0;
|
|
}
|
|
}
|
|
if (a0.avail_out === 0) {
|
|
state.last_flush = -1;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
let r866 = 0;
|
|
if (a1 === 4) {
|
|
const r868 = state.wrap <= 0;
|
|
let r869 = 1;
|
|
let r870 = 1;
|
|
if (!r868) {
|
|
if (state.wrap === 2) {
|
|
const r905 = 255 & a0.adler;
|
|
const pending_buf35 = state.pending_buf;
|
|
const r908 = +state.pending;
|
|
state.pending = r908 + 1;
|
|
pending_buf35[r908] = r905;
|
|
const r912 = a0.adler >> 8;
|
|
const pending_buf36 = state.pending_buf;
|
|
const r915 = +state.pending;
|
|
state.pending = r915 + 1;
|
|
pending_buf36[r915] = r912 & 255;
|
|
const r920 = a0.adler >> 16;
|
|
const pending_buf37 = state.pending_buf;
|
|
const r923 = +state.pending;
|
|
state.pending = r923 + 1;
|
|
pending_buf37[r923] = r920 & 255;
|
|
const r928 = a0.adler >> 24;
|
|
const pending_buf38 = state.pending_buf;
|
|
const r931 = +state.pending;
|
|
state.pending = r931 + 1;
|
|
pending_buf38[r931] = r928 & 255;
|
|
const r935 = 255 & a0.total_in;
|
|
const pending_buf39 = state.pending_buf;
|
|
const r938 = +state.pending;
|
|
state.pending = r938 + 1;
|
|
pending_buf39[r938] = r935;
|
|
const r941 = a0.total_in >> 8;
|
|
const pending_buf40 = state.pending_buf;
|
|
const r944 = +state.pending;
|
|
state.pending = r944 + 1;
|
|
pending_buf40[r944] = r941 & 255;
|
|
const r948 = a0.total_in >> 16;
|
|
const pending_buf41 = state.pending_buf;
|
|
const r951 = +state.pending;
|
|
state.pending = r951 + 1;
|
|
pending_buf41[r951] = r948 & 255;
|
|
const r955 = a0.total_in >> 24;
|
|
const pending_buf42 = state.pending_buf;
|
|
const r958 = +state.pending;
|
|
state.pending = r958 + 1;
|
|
pending_buf42[r958] = r955 & 255;
|
|
} else {
|
|
const r875 = a0.adler >>> 16;
|
|
const pending_buf31 = state.pending_buf;
|
|
const r878 = +state.pending;
|
|
state.pending = r878 + 1;
|
|
pending_buf31[r878] = r875 >>> 8 & 255;
|
|
const pending_buf32 = state.pending_buf;
|
|
const r886 = +state.pending;
|
|
state.pending = r886 + 1;
|
|
pending_buf32[r886] = 255 & r875;
|
|
const r891 = 65535 & a0.adler;
|
|
const pending_buf33 = state.pending_buf;
|
|
const r894 = +state.pending;
|
|
state.pending = r894 + 1;
|
|
pending_buf33[r894] = r891 >>> 8 & 255;
|
|
const pending_buf34 = state.pending_buf;
|
|
const r900 = +state.pending;
|
|
state.pending = r900 + 1;
|
|
pending_buf34[r900] = 255 & r891;
|
|
}
|
|
const state9 = a0.state;
|
|
let pending19 = state9.pending;
|
|
if (pending19 > a0.avail_out) {
|
|
pending19 = a0.avail_out;
|
|
}
|
|
if (pending19 !== 0) {
|
|
arraySet(a0.output, state9.pending_buf, state9.pending_out, pending19, a0.next_out);
|
|
a0.next_out = a0.next_out + pending19;
|
|
state9.pending_out = state9.pending_out + pending19;
|
|
a0.total_out = a0.total_out + pending19;
|
|
a0.avail_out = a0.avail_out - pending19;
|
|
state9.pending = state9.pending - pending19;
|
|
if (state9.pending === 0) {
|
|
state9.pending_out = 0;
|
|
}
|
|
}
|
|
if (state.wrap > 0) {
|
|
state.wrap = -state.wrap;
|
|
}
|
|
if (state.pending !== 0) {
|
|
r869 = 0;
|
|
}
|
|
r870 = r869;
|
|
}
|
|
r866 = r870;
|
|
}
|
|
return r866;
|
|
}
|
|
}
|
|
const r1004 = a0.avail_out !== 0 ? -2 : -5;
|
|
a0.msg = _Module12716[r1004];
|
|
return r1004;
|
|
}
|
|
if (a0) {
|
|
a0.msg = _Module12716[-2];
|
|
}
|
|
return -2;
|
|
}
|
|
export function deflateEnd(a0) {
|
|
let r17;
|
|
let r1 = -2;
|
|
if (a0) {
|
|
const state = a0.state;
|
|
r1 = -2;
|
|
if (state) {
|
|
const status = a0.state.status;
|
|
if (status !== 42 && (status !== 69 && (status !== 73 && (status !== 91 && (status !== 103 && (status !== 113 && status !== 666)))))) {
|
|
a0.msg = _Module12716[-2];
|
|
r17 = -2;
|
|
} else {
|
|
a0.state = null;
|
|
r17 = 0;
|
|
if (status === 113) {
|
|
a0.msg = _Module12716[-3];
|
|
r17 = -3;
|
|
}
|
|
}
|
|
r1 = r17;
|
|
}
|
|
}
|
|
return r1;
|
|
}
|
|
export function deflateSetDictionary(a0, a1) {
|
|
let avail_in, input, next_in;
|
|
const length = a1.length;
|
|
if (a0 && a0.state) {
|
|
L20: {
|
|
const state = a0.state;
|
|
const wrap = state.wrap;
|
|
if (wrap !== 2) {
|
|
const r6 = wrap === 1;
|
|
if (r6 && state.status !== 42) {
|
|
break L20;
|
|
}
|
|
if (!state.lookahead) {
|
|
if (r6) {
|
|
a0.adler = _adler32(a0.adler, a1, length, 0);
|
|
}
|
|
state.wrap = 0;
|
|
const w_size = state.w_size;
|
|
let input2 = a1;
|
|
let avail_in2 = length;
|
|
if (avail_in2 >= w_size) {
|
|
if (wrap === 0) {
|
|
const head = state.head;
|
|
let r38 = head.length - 1;
|
|
while (r38 >= 0) {
|
|
head[r38] = 0;
|
|
r38 = r38 - 1;
|
|
}
|
|
state.strstart = 0;
|
|
state.block_start = 0;
|
|
state.insert = 0;
|
|
}
|
|
const buf8 = new Buf8(state.w_size);
|
|
arraySet(buf8, a1, length - state.w_size, state.w_size, 0);
|
|
avail_in2 = state.w_size;
|
|
input2 = buf8;
|
|
}
|
|
L19: {
|
|
avail_in = a0.avail_in;
|
|
next_in = a0.next_in;
|
|
input = a0.input;
|
|
a0.avail_in = avail_in2;
|
|
a0.next_in = 0;
|
|
a0.input = input2;
|
|
fill_window(state);
|
|
if (state.lookahead >= 3) {
|
|
loop16: while (true) {
|
|
let strstart = state.strstart;
|
|
let r0 = state.lookahead - 2;
|
|
while (true) {
|
|
state.ins_h = (state.ins_h << state.hash_shift ^ state.window[strstart + 3 - 1]) & state.hash_mask;
|
|
state.prev[strstart & state.w_mask] = state.head[state.ins_h];
|
|
state.head[state.ins_h] = strstart;
|
|
const strstart2 = strstart + 1;
|
|
r0 = r0 - 1;
|
|
strstart = strstart2;
|
|
if (!r0) {
|
|
state.strstart = strstart2;
|
|
state.lookahead = 2;
|
|
fill_window(state);
|
|
if (state.lookahead >= 3) {
|
|
continue loop16;
|
|
}
|
|
break L19;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
state.strstart = state.strstart + state.lookahead;
|
|
state.block_start = state.strstart;
|
|
state.insert = state.lookahead;
|
|
state.lookahead = 0;
|
|
state.prev_length = 2;
|
|
state.match_length = 2;
|
|
state.match_available = 0;
|
|
a0.next_in = next_in;
|
|
a0.input = input;
|
|
a0.avail_in = avail_in;
|
|
state.wrap = wrap;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
return -2;
|
|
}
|
|
return -2;
|
|
}
|
|
export const deflateInfo = "pako deflate (from Nodeca project)";
|