20 var zip_WSIZE = 32768;
21 var zip_STORED_BLOCK = 0;
22 var zip_STATIC_TREES = 1;
23 var zip_DYN_TREES = 2;
28 var zip_INBUFSIZ = 32768;
29 var zip_INBUF_EXTRA = 64;
34 var zip_fixed_tl = null;
36 var zip_fixed_bl, fixed_bd;
50 var zip_MASK_BITS =
new Array(
52 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
53 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff);
55 var zip_cplens =
new Array(
56 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
57 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0);
59 var zip_cplext =
new Array(
60 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
61 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99);
62 var zip_cpdist =
new Array(
63 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
64 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
65 8193, 12289, 16385, 24577);
66 var zip_cpdext =
new Array(
67 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
68 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
70 var zip_border =
new Array(
71 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
74 var zip_HuftList =
function() {
79 var zip_HuftNode =
function() {
88 var zip_HuftBuild =
function(b,
111 var c =
new Array(this.BMAX+1);
119 var lx =
new Array(this.BMAX+1);
123 var r =
new zip_HuftNode();
124 var u =
new Array(this.BMAX);
125 var v =
new Array(this.N_MAX);
127 var x =
new Array(this.BMAX+1);
134 tail = this.root = null;
135 for (i = 0; i < c.length; i++)
137 for (i = 0; i < lx.length; i++)
139 for (i = 0; i < u.length; i++)
141 for (i = 0; i < v.length; i++)
143 for (i = 0; i < x.length; i++)
147 el = n > 256 ? b[256] : this.BMAX;
163 for (j = 1; j <= this.BMAX; j++)
169 for (i = this.BMAX; i != 0; i--)
177 for (y = 1 << j; j < i; j++, y <<= 1) {
178 if ((y -= c[j]) < 0) {
184 if ((y -= c[i]) < 0) {
197 x[xp++] = (j += p[pidx++]);
203 if ((j = p[pidx++]) != 0)
217 for (; k <= g; k++) {
222 while (k > w + lx[1 + h]) {
227 z = (z = g - w) > mm ? mm : z;
228 if ((f = 1 << (j = k - w)) > a + 1) {
233 if ((f <<= 1) <= c[++xp])
238 if (w + j > el && w < el)
245 for (o = 0; o < z; o++) {
246 q[o] =
new zip_HuftNode();
250 tail = this.root =
new zip_HuftList();
252 tail = tail.next =
new zip_HuftList();
263 j = (i & ((1 << w) - 1)) >> (w - lx[h]);
275 else if (p[pidx] < s) {
276 r.e = (p[pidx] < 256 ? 16 : 15);
279 r.e = e[p[pidx] - s];
280 r.n = d[p[pidx++] - s];
285 for (j = i >> w; j < z; j += f) {
293 for (j = 1 << (k - 1); (i & j) != 0; j >>= 1)
298 while ((i & ((1 << w) - 1)) != x[h]) {
309 this.status = ((y != 0 && g != 1) ? 1 : 0);
316 var zip_GET_BYTE =
function() {
317 if (zip_inflate_data.length == zip_inflate_pos)
319 return zip_inflate_data.charCodeAt(zip_inflate_pos++) & 0xff;
322 var zip_NEEDBITS =
function(n) {
323 while (zip_bit_len < n) {
324 zip_bit_buf |= zip_GET_BYTE() << zip_bit_len;
329 var zip_GETBITS =
function(n) {
330 return zip_bit_buf & zip_MASK_BITS[n];
333 var zip_DUMPBITS =
function(n) {
338 var zip_inflate_codes =
function(buff, off, size) {
351 zip_NEEDBITS(zip_bl);
352 t = zip_tl.list[zip_GETBITS(zip_bl)];
360 t = t.t[zip_GETBITS(e)];
366 zip_wp &= zip_WSIZE - 1;
367 buff[off + n++] = zip_slide[zip_wp++] = t.n;
381 zip_copy_leng = t.n + zip_GETBITS(e);
385 zip_NEEDBITS(zip_bd);
386 t = zip_td.list[zip_GETBITS(zip_bd)];
395 t = t.t[zip_GETBITS(e)];
400 zip_copy_dist = zip_wp - t.n - zip_GETBITS(e);
404 while (zip_copy_leng > 0 && n < size) {
406 zip_copy_dist &= zip_WSIZE - 1;
407 zip_wp &= zip_WSIZE - 1;
408 buff[off + n++] = zip_slide[zip_wp++] = zip_slide[zip_copy_dist++];
419 var zip_inflate_stored =
function(buff, off, size) {
432 if (n != ((~zip_bit_buf) & 0xffff))
440 while (zip_copy_leng > 0 && n < size) {
442 zip_wp &= zip_WSIZE - 1;
444 buff[off + n++] = zip_slide[zip_wp++] = zip_GETBITS(8);
448 if (zip_copy_leng == 0)
453 var zip_inflate_fixed =
function(buff, off, size) {
459 if (zip_fixed_tl == null) {
461 var l =
new Array(288);
465 for (i = 0; i < 144; i++)
475 h =
new zip_HuftBuild(l, 288, 257, zip_cplens, zip_cplext,
478 alert(
"HufBuild error: "+h.status);
481 zip_fixed_tl = h.root;
485 for (i = 0; i < 30; i++)
489 h =
new zip_HuftBuild(l, 30, 0, zip_cpdist, zip_cpdext,
493 alert(
"HufBuild error: "+h.status);
496 zip_fixed_td = h.root;
500 zip_tl = zip_fixed_tl;
501 zip_td = zip_fixed_td;
502 zip_bl = zip_fixed_bl;
503 zip_bd = zip_fixed_bd;
504 return zip_inflate_codes(buff, off, size);
507 var zip_inflate_dynamic =
function(buff, off, size) {
517 var ll =
new Array(286+30);
520 for (i = 0; i < ll.length; i++)
525 nl = 257 + zip_GETBITS(5);
528 nd = 1 + zip_GETBITS(5);
531 nb = 4 + zip_GETBITS(4);
533 if (nl > 286 || nd > 30)
537 for (j = 0; j < nb; j++) {
539 ll[zip_border[j]] = zip_GETBITS(3);
543 ll[zip_border[j]] = 0;
547 h =
new zip_HuftBuild(ll, 19, 19, null, null, zip_bl);
558 zip_NEEDBITS(zip_bl);
559 t = zip_tl.list[zip_GETBITS(zip_bl)];
567 j = 3 + zip_GETBITS(2);
573 }
else if (j == 17) {
575 j = 3 + zip_GETBITS(3);
584 j = 11 + zip_GETBITS(7);
596 h =
new zip_HuftBuild(ll, nl, 257, zip_cplens, zip_cplext, zip_bl);
607 for (i = 0; i < nd; i++)
610 h =
new zip_HuftBuild(ll, nd, 0, zip_cpdist, zip_cpdext, zip_bd);
614 if (zip_bd == 0 && nl > 257) {
626 return zip_inflate_codes(buff, off, size);
629 var zip_inflate_start =
function() {
633 if (zip_slide == null)
634 zip_slide =
new Array(2 * zip_WSIZE);
640 zip_copy_leng = zip_copy_dist = 0;
644 var zip_inflate_internal =
function(buff, off, size) {
650 if (zip_eof && zip_method == -1)
653 if (zip_copy_leng > 0) {
654 if (zip_method != zip_STORED_BLOCK) {
656 while (zip_copy_leng > 0 && n < size) {
658 zip_copy_dist &= zip_WSIZE - 1;
659 zip_wp &= zip_WSIZE - 1;
660 buff[off + n++] = zip_slide[zip_wp++] =
661 zip_slide[zip_copy_dist++];
664 while (zip_copy_leng > 0 && n < size) {
666 zip_wp &= zip_WSIZE - 1;
668 buff[off + n++] = zip_slide[zip_wp++] = zip_GETBITS(8);
671 if (zip_copy_leng == 0)
678 if (zip_method == -1) {
684 if (zip_GETBITS(1) != 0)
690 zip_method = zip_GETBITS(2);
696 switch (zip_method) {
698 i = zip_inflate_stored(buff, off + n, size - n);
703 i = zip_inflate_codes(buff, off + n, size - n);
705 i = zip_inflate_fixed(buff, off + n, size - n);
710 i = zip_inflate_codes(buff, off + n, size - n);
712 i = zip_inflate_dynamic(buff, off + n, size - n);
730 var zip_inflate =
function(str)
735 zip_inflate_data = str;
738 var buff =
new Array(1024);
740 while ((i = zip_inflate_internal(buff, 0, buff.length)) > 0) {
741 var cbuf =
new Array(i);
742 for (j = 0; j < i; j++) {
743 cbuf[j] = String.fromCharCode(buff[j]);
745 aout[aout.length] = cbuf.join(
"");
747 zip_inflate_data = null;
748 return aout.join(
"");
751 if (! window.RawInflate) RawInflate = {};
753 RawInflate.inflate = zip_inflate;