brotli/js/decode.min.js

2 lines
151 KiB
JavaScript
Raw Normal View History

function BrotliDecodeClosure(){"use strict";function e(e){this.a=e,this.b=0}function t(e){for(var t=-1,i=16;i>0;)e>>>i!=0&&(t+=i,e>>>=i),i>>=1;return t+e}function i(e,t,i){return 16+t+2*(i<<e)}function n(e,i,n){if(e<n+(2<<i))throw"maxDistance is too small";var a=(e-n>>i)+4,o=t(a)-1,r=o-1<<1|a>>o&1;return(r-1<<i)+(1<<i)+n+16}function a(e){var t=new Int16Array(24),i=new Int16Array(24);i[0]=2;for(var n=0;n<23;++n)t[n+1]=t[n]+(1<<Pe[n]),i[n+1]=i[n]+(1<<$e[n]);for(var a=0;a<704;++a){var o=a>>>6,r=-4;o>=2&&(o-=2,r=0);var s=(170064>>>2*o&3)<<3|a>>>3&7,l=(156228>>>2*o&3)<<3|7&a,c=i[l],d=r+(c>4?3:c-2),h=4*a;e[h+0]=Pe[s]|$e[l]<<8,e[h+1]=t[s],e[h+2]=i[l],e[h+3]=d}}function o(e){var t=e.c;if(e.c=0,e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),0==H(e,1))return 16;var i=H(e,3);return 0!=i?17+i:(i=H(e,3),0!=i?1==i?0==t?-1:(e.c=1,1==H(e,1)?-1:(i=H(e,6),i<10||i>30?-1:i)):8+i:17)}function r(e,t){if(0!=e.h)throw"State MUST be uninitialized";e.j=new Int32Array(3091),e.j[0]=7,e.k=3;var i=n(2147483644,3,120);e.l=new Int8Array(i),e.m=new Int32Array(i),e.input=t,U(e),e.h=1}function s(e){if(0==e.h)throw"State MUST be initialized";11!=e.h&&(e.h=11,null!=e.input&&(ne(e.input),e.input=null))}function l(e){if(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),0!=H(e,1)){var t=H(e,3);return 0==t?1:H(e,t)+(1<<t)}return 0}function c(e){if(e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16),e.n=H(e,1),e.o=0,e.p=0,e.q=0,0==e.n||0==H(e,1)){var t=H(e,2)+4;if(7==t){if(e.q=1,0!=H(e,1))throw"Corrupted reserved bit";var i=H(e,2);if(0==i)return;for(var n=0;n<i;n++){e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var a=H(e,8);if(0==a&&n+1==i&&i>1)throw"Exuberant nibble";e.o|=a<<8*n}}else for(var n=0;n<t;n++){e.d>=16&&(e.e=e.f[e.g++]<<16|e.e>>>16,e.d-=16);var a=H(e,4);if(0==a&&n+1==t&&t>4)throw"Exuberant nibble";e.o|=a<<4*n}e.o++,0==e.n&&(e.p=H(e,1))}}function d(e,t,i){var n=e[t],a=i.e>>>i.d;n+=255&a;var o=e[n]>>16,r=65535&e[n];if(o<=8)return i.d+=o,r;n+=r;var s=(1<<o)-1;return n+=(a&s)>>>8,i.d+=(e[n]>>16)+8,65535&e[n]}function h(e,t,i){i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);var n=d(e,t,i),a=ge[n];return i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16),me[n]+(a<=16?H(i,a):R(i,a))}function f(e,t){for(var i=e[t];t>0;t--)e[t]=e[t-1];e[0]=i}function p(e,t){for(var i=new Int32Array(256),n=0;n<256;n++)i[n]=n;for(var n=0;n<t;n++){var a=255&e[n];e[n]=i[a],0!=a&&f(i,a)}}function u(e,t,i,n){var a=0,o=8,r=0,s=0,l=32768,c=new Int32Array(33),d=c.length-1;for(W(c,d,5,e,18);a<t&&l>0;){n.g>2030&&B(n),n.d>=16&&(n.e=n.f[n.g++]<<16|n.e>>>16,n.d-=16);var h=n.e>>>n.d&31;n.d+=c[h]>>16;var f=65535&c[h];if(f<16)r=0,i[a++]=f,0!=f&&(o=f,l-=32768>>f);else{var p=f-14,u=0;16==f&&(u=o),s!=u&&(r=0,s=u);var m=r;r>0&&(r-=2,r<<=p),n.d>=16&&(n.e=n.f[n.g++]<<16|n.e>>>16,n.d-=16),r+=H(n,p)+3;var g=r-m;if(a+g>t)throw"symbol + repeatDelta > numSymbols";for(var P=0;P<g;P++)i[a++]=s;0!=s&&(l-=g<<15-s)}}if(0!=l)throw"Unused space";i.fill(0,a,t)}function m(e,t){for(var i=0;i<t-1;++i)for(var n=i+1;n<t;++n)if(e[i]==e[n])throw"Duplicate simple Huffman code symbol"}function g(e,i,n,a,o){for(var r=new Int32Array(i),s=new Int32Array(4),l=1+t(e-1),c=H(o,2)+1,d=0;d<c;d++){o.d>=16&&(o.e=o.f[o.g++]<<16|o.e>>>16,o.d-=16);var h=H(o,l);if(h>=i)throw"Can't readHuffmanCode";s[d]=h}m(s,c);var f=c;switch(4==c&&(f+=H(o,1)),f){case 1:r[s[0]]=1;break;case 2:r[s[0]]=1,r[s[1]]=1;break;case 3:r[s[0]]=1,r[s[1]]=2,r[s[2]]=2;break;case 4:r[s[0]]=2,r[s[1]]=2,r[s[2]]=2,r[s[3]]=2;break;case 5:r[s[0]]=1,r[s[1]]=2,r[s[2]]=3,r[s[3]]=3}return W(n,a,8,r,i)}function P(e,t,i,n,a){for(var o=new Int32Array(e),r=new Int32Array(18),s=32,l=0,c=t;c<18&&s>0;c++){var d=ce[c];a.d>=16&&(a.e=a.f[a.g++]<<16|a.e>>>16,a.d-=16);var h=a.e>>>a.d&15;a.d+=fe[h]>>16;var f=65535&fe[h];r[d]=f,0!=f&&(s-=32>>f,l++)}if(0!=s&&1!=l)throw"Corrupted Huffman code histogram";return u(r,e,o,a),W(i,n,8,o,e)}function $(e,t,i,n,a){a.g>2030&&B(a),a.d>=16&&(a.e=a.f[a.g++]<<16|a.e>>>16,a.d-=16);var o=H(a,2);return 1==o?g(e,t,i,n,a):P(t,o,i,n,a)}function b(e,t,i){i.g>2030&&B(i);var n=l(i)+1;if(1==n)return t.fill(0,0,e),n;i.d>=16&&(i.e=i.f[i.g++]<<16|i.e>>>16,i.d-=16);var a=H(i,1),
ae(Xe),se=Xe,re}var BrotliDecode=BrotliDecodeClosure();window.ra=BrotliDecode;