51 lines
24 KiB
JavaScript
51 lines
24 KiB
JavaScript
|
/**
|
||
|
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
||
|
*
|
||
|
* Copyright 2011-2017 Cesium Contributors
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
* Columbus View (Pat. Pend.)
|
||
|
*
|
||
|
* Portions licensed separately.
|
||
|
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
||
|
*/
|
||
|
/*
|
||
|
Copyright (c) 2013 Gildas Lormeau. All rights reserved.
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions are met:
|
||
|
|
||
|
1. Redistributions of source code must retain the above copyright notice,
|
||
|
this list of conditions and the following disclaimer.
|
||
|
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in
|
||
|
the documentation and/or other materials provided with the distribution.
|
||
|
|
||
|
3. The names of the authors may not be used to endorse or promote products
|
||
|
derived from this software without specific prior written permission.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
||
|
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||
|
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
|
||
|
!function(i){function e(){function i(i,e,t,n,s,o,f,u,w,v,h){var k,m,y,g,p,A,I,E,U,z,D,M,L,P,j;z=0,p=t;do a[i[e+z]]++,z++,p--;while(0!==p);if(a[0]==t)return f[0]=-1,u[0]=0,d;for(E=u[0],A=1;S>=A&&0===a[A];A++);for(I=A,A>E&&(E=A),p=S;0!==p&&0===a[p];p--);for(y=p,E>p&&(E=p),u[0]=E,P=1<<A;p>A;A++,P<<=1)if((P-=a[A])<0)return b;if((P-=a[p])<0)return b;for(a[p]+=P,l[1]=A=0,z=1,L=2;0!==--p;)l[L]=A+=a[z],L++,z++;p=0,z=0;do 0!==(A=i[e+z])&&(h[l[A]++]=p),z++;while(++p<t);for(t=l[y],l[0]=p=0,z=0,g=-1,M=-E,_[0]=0,D=0,j=0;y>=I;I++)for(k=a[I];0!==k--;){for(;I>M+E;){if(g++,M+=E,j=y-M,j=j>E?E:j,(m=1<<(A=I-M))>k+1&&(m-=k+1,L=I,j>A))for(;++A<j&&!((m<<=1)<=a[++L]);)m-=a[L];if(j=1<<A,v[0]+j>c)return b;_[g]=D=v[0],v[0]+=j,0!==g?(l[g]=p,r[0]=A,r[1]=E,A=p>>>M-E,r[2]=D-_[g-1]-A,w.set(r,3*(_[g-1]+A))):f[0]=D}for(r[1]=I-M,z>=t?r[0]=192:h[z]<n?(r[0]=h[z]<256?0:96,r[2]=h[z++]):(r[0]=o[h[z]-n]+16+64,r[2]=s[h[z++]-n]),m=1<<I-M,A=p>>>M;j>A;A+=m)w.set(r,3*(D+A));for(A=1<<I-1;0!==(p&A);A>>>=1)p^=A;for(p^=A,U=(1<<M)-1;(p&U)!=l[g];)g--,M-=E,U=(1<<M)-1}return 0!==P&&1!=y?x:d}function e(i){var e;for(t||(t=[],n=[],a=new Int32Array(S+1),r=[],_=new Int32Array(S),l=new Int32Array(S+1)),n.length<i&&(n=[]),e=0;i>e;e++)n[e]=0;for(e=0;S+1>e;e++)a[e]=0;for(e=0;3>e;e++)r[e]=0;_.set(a.subarray(0,S),0),l.set(a.subarray(0,S+1),0)}var t,n,a,r,_,l,s=this;s.inflate_trees_bits=function(a,r,_,l,d){var s;return e(19),t[0]=0,s=i(a,0,19,19,null,null,_,r,l,t,n),s==b?d.msg="oversubscribed dynamic bit lengths tree":(s==x||0===r[0])&&(d.msg="incomplete dynamic bit lengths tree",s=b),s},s.inflate_trees_dynamic=function(a,r,_,l,s,o,f,w,c){var v;return e(288),t[0]=0,v=i(_,0,a,257,p,A,o,l,w,t,n),v!=d||0===l[0]?(v==b?c.msg="oversubscribed literal/length tree":v!=u&&(c.msg="incomplete literal/length tree",v=b),v):(e(288),v=i(_,a,r,0,I,E,f,s,w,t,n),v!=d||0===s[0]&&a>257?(v==b?c.msg="oversubscribed distance tree":v==x?(c.msg="incomplete distance tree",v=b):v!=u&&(c.msg="empty distance tree with lengths",v=b),v):d)}}function t(){function i(i,e,t,n,a,r,_,l){var o,f,u,x,c,v,h,k,m,y,g,p,A,I,E,S;h=l.next_in_index,k=l.avail_in,c=_.bitb,v=_.bitk,m=_.write,y=m<_.read?_.read-m-1:_.end-m,g=w[i],p=w[e];do{for(;20>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(o=c&g,f=t,u=n,S=3*(u+o),0!==(x=f[S]))for(;;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15,A=f[S+2]+(c&w[x]),c>>=x,v-=x;15>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;for(o=c&p,f=a,u=r,S=3*(u+o),x=f[S];;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15;x>v;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(I=f[S+2]+(c&w[x]),c>>=x,v-=x,y-=A,m>=I)E=m-I,m-E>0&&2>m-E?(_.window[m++]=_.window[E++],_.window[m++]=_.window[E++],A-=2):(_.window.set(_.window.subarray(E,E+2),m),m+=2,E+=2,A-=2);else{E=m-I;do E+=_.end;while(0>E);if(x=_.end-E,A>x){if(A-=x,m-E>0&&x>m-E){do _.window[m++]=_.window[E++];while(0!==--x)}else _.window.set(_.window.subarray(E,E+x),m),m+=x,E+=x,x=0;E=0}}if(m-E>0&&A>m-E){do _.window[m++]=_.window[E++];while(0!==--A)}else _.window.set(_.window.subarray(E,E+A),m),m+=A,E+=A,A=0;break}if(0!==(64&x))return l.msg="invalid distance code",A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b;o+=f[S+2],o+=c&w[x],S=3*(u+o),x=f[S]}break}if(0!==(64&x))return 0!==(32&x)?(A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,s):(l.msg="invalid literal/length code",A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b);if(o+=f[S+2],o+=c&w[x],S=3*(u+o),0===(x=f[S])){c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--;break}}else c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--}while(y>=258&&k>=10);return A=l.avail_in-k,A=A>v>>3?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,d}var e,t,n,a,r=this,_=0,l=0,o=0,u=0,x=0,c=0,v=0,h=0,k=0,m=0;r.init=function(i,r,_,l,d,s){e=U,v=i,h=r,n=_,k=l,a=d,m=s,t=null},r.proc=function(r,y,g){var p,A,I,E,S,F,G,H=0,J=0,K=0;for(K=y.next
|