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,b,x,c,v,h){var k,m,y,g,p,I,E,S,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 b[0]=-1,x[0]=0,l;for(S=x[0],I=1;I<=A&&0===a[I];I++);for(E=I,S<I&&(S=I),p=A;0!==p&&0===a[p];p--);for(y=p,S>p&&(S=p),x[0]=S,P=1<<I;I<p;I++,P<<=1)if((P-=a[I])<0)return f;if((P-=a[p])<0)return f;for(a[p]+=P,d[1]=I=0,z=1,L=2;0!=--p;)d[L]=I+=a[z],L++,z++;p=0,z=0;do{0!==(I=i[e+z])&&(h[d[I]++]=p),z++}while(++p<t);for(t=d[y],d[0]=p=0,z=0,g=-1,M=-S,_[0]=0,D=0,j=0;E<=y;E++)for(k=a[E];0!=k--;){for(;E>M+S;){if(g++,M+=S,j=y-M,j=j>S?S:j,(m=1<<(I=E-M))>k+1&&(m-=k+1,L=E,I<j))for(;++I<j&&!((m<<=1)<=a[++L]);)m-=a[L];if(j=1<<I,v[0]+j>w)return f;_[g]=D=v[0],v[0]+=j,0!==g?(d[g]=p,r[0]=I,r[1]=S,I=p>>>M-S,r[2]=D-_[g-1]-I,c.set(r,3*(_[g-1]+I))):b[0]=D}for(r[1]=E-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<<E-M,I=p>>>M;I<j;I+=m)c.set(r,3*(D+I));for(I=1<<E-1;0!=(p&I);I>>>=1)p^=I;for(p^=I,U=(1<<M)-1;(p&U)!=d[g];)g--,M-=S,U=(1<<M)-1}return 0!==P&&1!=y?u:l}function e(i){var e;for(t||(t=[],n=[],a=new Int32Array(A+1),r=[],_=new Int32Array(A),d=new Int32Array(A+1)),n.length<i&&(n=[]),e=0;e<i;e++)n[e]=0;for(e=0;e<A+1;e++)a[e]=0;for(e=0;e<3;e++)r[e]=0;_.set(a.subarray(0,A),0),d.set(a.subarray(0,A+1),0)}var t,n,a,r,_,d,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==f?d.msg="oversubscribed dynamic bit lengths tree":s!=u&&0!==r[0]||(d.msg="incomplete dynamic bit lengths tree",s=f),s},s.inflate_trees_dynamic=function(a,r,_,d,s,o,x,w,c){var v;return e(288),t[0]=0,(v=i(_,0,a,257,m,y,o,d,w,t,n))!=l||0===d[0]?(v==f?c.msg="oversubscribed literal/length tree":v!=b&&(c.msg="incomplete literal/length tree",v=f),v):(e(288),v=i(_,a,r,0,g,p,x,s,w,t,n),v!=l||0===s[0]&&a>257?(v==f?c.msg="oversubscribed distance tree":v==u?(c.msg="incomplete distance tree",v=f):v!=b&&(c.msg="empty distance tree with lengths",v=f),v):l)}}function t(){function i(i,e,t,n,a,r,_,s){var o,b,u,w,c,v,h,k,m,y,g,p,A,I,E,S;h=s.next_in_index,k=s.avail_in,c=_.bitb,v=_.bitk,m=_.write,y=m<_.read?_.read-m-1:_.end-m,g=x[i],p=x[e];do{for(;v<20;)k--,c|=(255&s.read_byte(h++))<<v,v+=8;if(o=c&g,b=t,u=n,S=3*(u+o),0!==(w=b[S]))for(;;){if(c>>=b[S+1],v-=b[S+1],0!=(16&w)){for(w&=15,A=b[S+2]+(c&x[w]),c>>=w,v-=w;v<15;)k--,c|=(255&s.read_byte(h++))<<v,v+=8;for(o=c&p,b=a,u=r,S=3*(u+o),w=b[S];;){if(c>>=b[S+1],v-=b[S+1],0!=(16&w)){for(w&=15;v<w;)k--,c|=(255&s.read_byte(h++))<<v,v+=8;if(I=b[S+2]+(c&x[w]),c>>=w,v-=w,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(E<0);if(w=_.end-E,A>w){if(A-=w,m-E>0&&w>m-E)do{_.window[m++]=_.window[E++]}while(0!=--w);else _.window.set(_.window.subarray(E,E+w),m),m+=w,E+=w,w=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&w))return s.msg="invalid distance code",A=s.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,s.avail_in=k,s.total_in+=h-s.next_in_index,s.next_in_index=h,_.write=m,f;o+=b[S+2],o+=c&x[w],S=3*(u+o),w=b[S]}break}if(0!=(64&w))return 0!=(32&w)?(A=s.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,s.avail_in=k,s.total_in+=h-s.next_in_index,s.next_in_index=h,_.write=m,d):(s.msg="invalid literal/length code",A=s.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,s.avail_in=k,s.total_in+=h-s.next_in_index,s.next_in_index=h,_.write=m,f);if(o+=b[S+2],o+=c&x[w],S=3*(u+o),0===(w=b[S])){c>>=b[S+1],v-=b[S+1],_.window[m++]=b[S+2],y--;break}}else c>>=b[S+1],v-=b[S+1],_.window[m++]=b[S+2],y--}while(y>=258&&k>=10);return A=s.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,s.avail_in=k,s.total_in+=h-s.next_in_index,s.next_in_index=h,_.write=m,l}var e,t,n,a,r=this,_=0,s=0,b=0,u=0,w=0,c=0,v=0,h=0,k=0,m=0;r.init=function(i,r,_,l,d,s){e=I,v=i,h=r,n=_,k=l,a=d,m=s,t=null},r.proc=function(r,y,g){var p,A,q,B,C,F,G,H=0,J=0,K=0;for(K=y.next_in_index,B=y.
|