three.cad/dist/gunzip.min.js

1 line
12 KiB
JavaScript

(function(){"use strict";function t(t){throw t}var r=void 0,e=this;function i(t,i){var n,s=t.split("."),a=e;!(s[0]in a)&&a.execScript&&a.execScript("var "+s[0]);for(;s.length&&(n=s.shift());)s.length||i===r?a=a[n]?a[n]:a[n]={}:a[n]=i}var n,s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;for(new(s?Uint8Array:Array)(256),n=0;256>n;++n)for(var a=(a=n)>>>1;a;a>>>=1)0;function h(t,r,e){var i,n="number"==typeof r?r:r=0,s="number"==typeof e?e:t.length;for(i=-1,n=7&s;n--;++r)i=i>>>8^u[255&(i^t[r])];for(n=s>>3;n--;r+=8)i=(i=(i=(i=(i=(i=(i=(i=i>>>8^u[255&(i^t[r])])>>>8^u[255&(i^t[r+1])])>>>8^u[255&(i^t[r+2])])>>>8^u[255&(i^t[r+3])])>>>8^u[255&(i^t[r+4])])>>>8^u[255&(i^t[r+5])])>>>8^u[255&(i^t[r+6])])>>>8^u[255&(i^t[r+7])];return(4294967295^i)>>>0}var o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],u=s?new Uint32Array(o):o;function f(){}function c(t){var r,e,i,n,a,h,o,u,f,c,l=t.length,p=0,y=Number.POSITIVE_INFINITY;for(u=0;u<l;++u)t[u]>p&&(p=t[u]),t[u]<y&&(y=t[u]);for(r=1<<p,e=new(s?Uint32Array:Array)(r),i=1,n=0,a=2;i<=p;){for(u=0;u<l;++u)if(t[u]===i){for(h=0,o=n,f=0;f<i;++f)h=h<<1|1&o,o>>=1;for(c=i<<16|u,f=h;f<r;f+=a)e[f]=c;++n}++i,n<<=1,a<<=1}return[e,p,y]}f.prototype.getName=function(){return this.name},f.prototype.getData=function(){return this.data},f.prototype.G=function(){return this.H};var l,p=[];for(l=0;288>l;l++)switch(!0){case 143>=l:p.push([l+48,8]);break;case 255>=l:p.push([l-144+400,9]);break;case 279>=l:p.push([l-256+0,7]);break;case 287>=l:p.push([l-280+192,8]);break;default:t("invalid literal: "+l)}var y=function(){function r(r){switch(!0){case 3===r:return[257,r-3,0];case 4===r:return[258,r-4,0];case 5===r:return[259,r-5,0];case 6===r:return[260,r-6,0];case 7===r:return[261,r-7,0];case 8===r:return[262,r-8,0];case 9===r:return[263,r-9,0];case 10===r:return[264,r-10,0];case 12>=r:return[265,r-11,1];case 14>=r:return[266,r-13,1];case 16>=r:return[267,r-15,1];case 18>=r:return[268,r-17,1];case 22>=r:return[269,r-19,2];case 26>=r:return[270,r-23,2];case 30>=r:return[271,r-27,2];case 34>=r:return[272,r-31,2];case 42>=r:return[273,r-35,3];case 50>=r:return[274,r-43,3];case 58>=r:return[275,r-51,3];case 66>=r:return[276,r-59,3];case 82>=r:return[277,r-67,4];case 98>=r:return[278,r-83,4];case 114>=r:return[279,r-99,4];case 130>=r:return[280,r-115,4];case 162>=r:return[281,r-131,5];case 194>=r:return[282,r-163,5];case 226>=r:return[283,r-195,5];case 257>=r:return[284,r-227,5];case 258===r:return[285,r-258,0];default:t("invalid length: "+r)}}var e,i,n=[];for(e=3;258>=e;e++)i=r(e),n[e]=i[2]<<24|i[1]<<16|i[0];return n}();function b(r,e){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=s?new Uint8Array(r):r,this.o=!1,this.k=d,this.w=!1,!e&&(e={})||(e.index&&(this.c=e.index),e.bufferSize&&(this.j=e.bufferSize),e.bufferType&&(this.k=e.bufferType),e.resize&&(this.w=e.resize)),this.k){case g:this.a=32768,this.b=new(s?Uint8Array:Array)(32768+this.j+258);break;case d:this.a=0,this.b=new(s?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:t(Error("invalid inflate mode"))}}s&&new Uint32Array(y);var g=0,d=1;b.prototype.g=function(){for(;!this.o;){var e=T(this,3);switch(1&e&&(this.o=!0),e>>>=1){case 0:var i=this.input,n=this.c,a=this.b,h=this.a,o=i.length,u=r,f=a.length,l=r;switch(this.d=this.f=0,n+1>=o&&t(Error("invalid uncompressed block header: LEN")),u=i[n++]|i[n++]<<8,n+1>=o&&t(Error("invalid uncompressed block header: NLEN")),u===~(i[n++]|i[n++]<<8)&&t(Error("invalid uncompressed block header: length verify")),n+u>i.length&&t(Error("input buffer is broken")),this.k){case g:for(;h+u>a.length;){if(u-=l=f-h,s)a.set(i.subarray(n,n+l),h),h+=l,n+=l;else for(;l--;)a[h++]=i[n++];this.a=h,a=this.e(),h=this.a}break;case d:for(;h+u>a.length;)a=this.e({t:2});break;default:t(Error("invalid inflate mode"))}if(s)a.set(i.subarray(n,n+u),h),h+=u,n+=u;else for(;u--;)a[h++]=i[n++];this.c=n,this.a=h,this.b=a;break;case 1:this.l(M,j);break;case 2:var p,y,b,v,w=T(this,5)+257,A=T(this,5)+1,k=T(this,4)+4,U=new(s?Uint8Array:Array)(m.length),E=r,z=r,N=r,S=r,G=r;for(G=0;G<k;++G)U[m[G]]=T(this,3);if(!s)for(G=k,k=U.length;G<k;++G)U[m[G]]=0;for(p=c(U),E=new(s?Uint8Array:Array)(w+A),G=0,v=w+A;G<v;)switch(z=q(this,p),z){case 16:for(S=3+T(this,2);S--;)E[G++]=N;break;case 17:for(S=3+T(this,3);S--;)E[G++]=0;N=0;break;case 18:for(S=11+T(this,7);S--;)E[G++]=0;N=0;break;default:N=E[G++]=z}y=c(s?E.subarray(0,w):E.slice(0,w)),b=c(s?E.subarray(w):E.slice(w)),this.l(y,b);break;default:t(Error("unknown BTYPE: "+e))}}return this.q()};var v,w,A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],m=s?new Uint16Array(A):A,k=[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,258,258],U=s?new Uint16Array(k):k,E=[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,0,0],z=s?new Uint8Array(E):E,N=[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],S=s?new Uint16Array(N):N,G=[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],C=s?new Uint8Array(G):G,x=new(s?Uint8Array:Array)(288);for(v=0,w=x.length;v<w;++v)x[v]=143>=v?8:255>=v?9:279>=v?7:8;var D,I,M=c(x),Z=new(s?Uint8Array:Array)(30);for(D=0,I=Z.length;D<I;++D)Z[D]=5;var j=c(Z);function T(r,e){for(var i,n=r.f,s=r.d,a=r.input,h=r.c,o=a.length;s<e;)h>=o&&t(Error("input buffer is broken")),n|=a[h++]<<s,s+=8;return i=n&(1<<e)-1,r.f=n>>>e,r.d=s-e,r.c=h,i}function q(r,e){for(var i,n,s=r.f,a=r.d,h=r.input,o=r.c,u=h.length,f=e[0],c=e[1];a<c&&!(o>=u);)s|=h[o++]<<a,a+=8;return(n=(i=f[s&(1<<c)-1])>>>16)>a&&t(Error("invalid code length: "+n)),r.f=s>>n,r.d=a-n,r.c=o,65535&i}function B(t){this.input=t,this.c=0,this.m=[],this.s=!1}b.prototype.l=function(t,r){var e=this.b,i=this.a;this.r=t;for(var n,s,a,h,o=e.length-258;256!==(n=q(this,t));)if(256>n)i>=o&&(this.a=i,e=this.e(),i=this.a),e[i++]=n;else for(h=U[s=n-257],0<z[s]&&(h+=T(this,z[s])),n=q(this,r),a=S[n],0<C[n]&&(a+=T(this,C[n])),i>=o&&(this.a=i,e=this.e(),i=this.a);h--;)e[i]=e[i++-a];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},b.prototype.C=function(t,r){var e=this.b,i=this.a;this.r=t;for(var n,s,a,h,o=e.length;256!==(n=q(this,t));)if(256>n)i>=o&&(o=(e=this.e()).length),e[i++]=n;else for(h=U[s=n-257],0<z[s]&&(h+=T(this,z[s])),n=q(this,r),a=S[n],0<C[n]&&(a+=T(this,C[n])),i+h>o&&(o=(e=this.e()).length);h--;)e[i]=e[i++-a];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},b.prototype.e=function(){var t,r,e=new(s?Uint8Array:Array)(this.a-32768),i=this.a-32768,n=this.b;if(s)e.set(n.subarray(32768,e.length));else for(t=0,r=e.length;t<r;++t)e[t]=n[t+32768];if(this.i.push(e),this.n+=e.length,s)n.set(n.subarray(i,i+32768));else for(t=0;32768>t;++t)n[t]=n[i+t];return this.a=32768,n},b.prototype.D=function(t){var r,e,i,n=this.input.length/this.c+1|0,a=this.input,h=this.b;return t&&("number"==typeof t.t&&(n=t.t),"number"==typeof t.z&&(n+=t.z)),2>n?e=(i=(a.length-this.c)/this.r[2]/2*258|0)<h.length?h.length+i:h.length<<1:e=h.length*n,s?(r=new Uint8Array(e)).set(h):r=h,this.b=r},b.prototype.q=function(){var t,r,e,i,n,a=0,h=this.b,o=this.i,u=new(s?Uint8Array:Array)(this.n+(this.a-32768));if(0===o.length)return s?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);for(r=0,e=o.length;r<e;++r)for(i=0,n=(t=o[r]).length;i<n;++i)u[a++]=t[i];for(r=32768,e=this.a;r<e;++r)u[a++]=h[r];return this.i=[],this.buffer=u},b.prototype.A=function(){var t,r=this.a;return s?this.w?(t=new Uint8Array(r)).set(this.b.subarray(0,r)):t=this.b.subarray(0,r):(this.b.length>r&&(this.b.length=r),t=this.b),this.buffer=t},B.prototype.F=function(){return this.s||this.g(),this.m.slice()},B.prototype.g=function(){for(var e=this.input.length;this.c<e;){var i,n,a=new f,o=r,u=r,c=r,l=r,p=r,y=r,g=r,d=this.input,v=this.c;switch(a.u=d[v++],a.v=d[v++],(31!==a.u||139!==a.v)&&t(Error("invalid file signature:"+a.u+","+a.v)),a.p=d[v++],a.p){case 8:break;default:t(Error("unknown compression method: "+a.p))}if(a.h=d[v++],n=d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24,a.H=new Date(1e3*n),a.N=d[v++],a.M=d[v++],0<(4&a.h)&&(a.I=d[v++]|d[v++]<<8,v+=a.I),0<(8&a.h)){for(y=[],p=0;0<(l=d[v++]);)y[p++]=String.fromCharCode(l);a.name=y.join("")}if(0<(16&a.h)){for(y=[],p=0;0<(l=d[v++]);)y[p++]=String.fromCharCode(l);a.J=y.join("")}0<(2&a.h)&&(a.B=65535&h(d,0,v),a.B!==(d[v++]|d[v++]<<8)&&t(Error("invalid header crc16"))),o=d[d.length-4]|d[d.length-3]<<8|d[d.length-2]<<16|d[d.length-1]<<24,d.length-v-4-4<512*o&&(c=o),u=new b(d,{index:v,bufferSize:c}),a.data=i=u.g(),v=u.c,a.K=g=(d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24)>>>0,h(i,r,r)!==g&&t(Error("invalid CRC-32 checksum: 0x"+h(i,r,r).toString(16)+" / 0x"+g.toString(16))),a.L=o=(d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24)>>>0,(4294967295&i.length)!==o&&t(Error("invalid input size: "+(4294967295&i.length)+" / "+o)),this.m.push(a),this.c=v}this.s=!0;var w,A,m,k=this.m,U=0,E=0;for(w=0,A=k.length;w<A;++w)E+=k[w].data.length;if(s)for(m=new Uint8Array(E),w=0;w<A;++w)m.set(k[w].data,U),U+=k[w].data.length;else{for(m=[],w=0;w<A;++w)m[w]=k[w].data;m=Array.prototype.concat.apply([],m)}return m},i("Zlib.Gunzip",B),i("Zlib.Gunzip.prototype.decompress",B.prototype.g),i("Zlib.Gunzip.prototype.getMembers",B.prototype.F),i("Zlib.GunzipMember",f),i("Zlib.GunzipMember.prototype.getName",f.prototype.getName),i("Zlib.GunzipMember.prototype.getData",f.prototype.getData),i("Zlib.GunzipMember.prototype.getMtime",f.prototype.G)}).call(this);