qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/decodeGoogleEarthEnterprise...

2 lines
24 KiB
JavaScript

define(["./Check-741c5f3c","./RuntimeError-26acdd3b","./defaultValue-81eec7ed","./when-422ea0ae","./createTaskProcessorWorker"],(function(e,t,n,i,r){"use strict";function a(e,n){if(a.passThroughDataForTesting)return n;const i=e.byteLength;if(0===i||i%4!=0)throw new t.RuntimeError("The length of key must be greater than 0 and a multiple of 4.");const r=new DataView(n),o=r.getUint32(0,!0);if(1953029805===o||2917034100===o)return n;const s=new DataView(e);let f=0;const l=n.byteLength,d=l-l%8,c=i;let h,u=8;for(;f<d;)for(u=(u+8)%24,h=u;f<d&&h<c;)r.setUint32(f,r.getUint32(f,!0)^s.getUint32(h,!0),!0),r.setUint32(f+4,r.getUint32(f+4,!0)^s.getUint32(h+4,!0),!0),f+=8,h+=24;if(f<l)for(h>=c&&(u=(u+8)%24,h=u);f<l;)r.setUint8(f,r.getUint8(f)^s.getUint8(h)),f++,h++}function o(e,t){return 0!=(e&t)}a.passThroughDataForTesting=!1;const s=[1,2,4,8];function f(e,t,n,i,r,a){this._bits=e,this.cnodeVersion=t,this.imageryVersion=n,this.terrainVersion=i,this.imageryProvider=r,this.terrainProvider=a,this.ancestorHasTerrain=!1,this.terrainState=void 0}f.clone=function(e,t){return n.defined(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new f(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t},f.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()},f.prototype.hasSubtree=function(){return o(this._bits,16)},f.prototype.hasImagery=function(){return o(this._bits,64)},f.prototype.hasTerrain=function(){return o(this._bits,128)},f.prototype.hasChildren=function(){return o(this._bits,15)},f.prototype.hasChild=function(e){return o(this._bits,s[e])},f.prototype.getChildBitmask=function(){return 15&this._bits};var l=i.createCommonjsModule((function(e,t){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(e[r]=n[r])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+i),r);else for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){var t,n,i,r,a,o;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(o=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,r),r+=a.length;return o}},a={arraySet:function(e,t,n,i,r){for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,a))},t.setTyped(n)}));var d=function(e,t,n,i){for(var r=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(r=r+t[i++]|0)|0}while(--o);r%=65521,a%=65521}return r|a<<16|0};var c=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();var h=function(e,t,n,i){var r=c,a=i+n;e^=-1;for(var o=i;o<a;o++)e=e>>>8^r[255&(e^t[o])];return-1^e},u=function(e,t){var n,i,r,a,o,s,f,l,d,c,h,u,w,b,m,g,k,v,p,y,_,x,B,E,A;n=e.state,i=e.next_in,E=e.input,r=i+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),f=n.dmax,l=n.wsize,d=n.whave,c=n.wnext,h=n.window,u=n.hold,w=n.bits,b=n.lencode,m=n.distcode,g=(1<<n.lenbits)-1,k=(1<<n.distbits)-1;e:do{w<15&&(u+=E[i++]<<w,w+=8,u+=E[i++]<<w,w+=8),v=b[u&g];t:for(;;){if(u>>>=p=v>>>24,w-=p,0===(p=v>>>16&255))A[a++]=65535&v;else{if(!(16&p)){if(0==(64&p)){v=b[(65535&v)+(u&(1<<p)-1)];continue t}if(32&p){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}y=65535&v,(p&=15)&&(w<p&&(u+=E[i++]<<w,w+=8),y+=u&(1<<p)-1,u>>>=p,w-=p),w<15&&(u+=E[i++]<<w,w+=8,u+=E[i++]<<w,w+=8),v=m[u&k];n:for(;;){if(u>>>=p=v>>>24,w-=p,!(16&(p=v>>>16&255))){if(0==(64&p)){v=m[(65535&v)+(u&(1<<p)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(_=65535&v,w<(p&=15)&&(u+=E[i++]<<w,(w+=8)<p&&(u+=E[i++]<<w,w+=8)),(_+=u&(1<<p)-1)>f){e.msg="invalid distance too far back",n.mode=30;break e}if(u>>>=p,w-=p,_>(p=a-o)){if((p=_-p)>d&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(x=0,B=h,0===c){if(x+=l-p,p<y){y-=p;do{A[a++]=h[x++]}while(--p);x=a-_,B=A}}else if(c<p){if(x+=l+c-p,(p-=c)<y){y-=p;do{A[a++]=h[x++]}while(--p);if(x=0,c<y){y-=p=c;do{A[a++]=h[x++]}while(--p);x=a-_,B=A}}}else if(x+=c-p,p<y){y-=p;do{A[a++]=h[x++]}while(--p);x=a-_,B=A}for(;y>2;)A[a++]=B[x++],A[a++]=B[x++],A[a++]=B[x++],y-=3;y&&(A[a++]=B[x++],y>1&&(A[a++]=B[x++]))}else{x=a-_;do{A[a++]=A[x++],A[a++]=A[x++],A[a++]=A[x++],y-=3}while(y>2);y&&(A[a++]=A[x++],y>1&&(A[a++]=A[x++]))}break}}break}}while(i<r&&a<s);i-=y=w>>3,u&=(1<<(w-=y<<3))-1,e.next_in=i,e.next_out=a,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=a<s?s-a+257:257-(a-s),n.hold=u,n.bits=w},w=15,b=[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,0,0],m=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],g=[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,0,0],k=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],v=function(e,t,n,i,r,a,o,s){var f,d,c,h,u,v,p,y,_,x=s.bits,B=0,E=0,A=0,T=0,U=0,S=0,R=0,C=0,I=0,z=0,D=null,V=0,P=new l.Buf16(16),O=new l.Buf16(16),M=null,j=0;for(B=0;B<=w;B++)P[B]=0;for(E=0;E<i;E++)P[t[n+E]]++;for(U=x,T=w;T>=1&&0===P[T];T--);if(U>T&&(U=T),0===T)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(A=1;A<T&&0===P[A];A++);for(U<A&&(U=A),C=1,B=1;B<=w;B++)if(C<<=1,(C-=P[B])<0)return-1;if(C>0&&(0===e||1!==T))return-1;for(O[1]=0,B=1;B<w;B++)O[B+1]=O[B]+P[B];for(E=0;E<i;E++)0!==t[n+E]&&(o[O[t[n+E]]++]=E);if(0===e?(D=M=o,v=19):1===e?(D=b,V-=257,M=m,j-=257,v=256):(D=g,M=k,v=-1),z=0,E=0,B=A,u=a,S=U,R=0,c=-1,h=(I=1<<U)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=B-R,o[E]<v?(y=0,_=o[E]):o[E]>v?(y=M[j+o[E]],_=D[V+o[E]]):(y=96,_=0),f=1<<B-R,A=d=1<<S;do{r[u+(z>>R)+(d-=f)]=p<<24|y<<16|_|0}while(0!==d);for(f=1<<B-1;z&f;)f>>=1;if(0!==f?(z&=f-1,z+=f):z=0,E++,0==--P[B]){if(B===T)break;B=t[n+o[E]]}if(B>U&&(z&h)!==c){for(0===R&&(R=U),u+=A,C=1<<(S=B-R);S+R<T&&!((C-=P[S+R])<=0);)S++,C<<=1;if(I+=1<<S,1===e&&I>852||2===e&&I>592)return 1;r[c=z&h]=U<<24|S<<16|u-a|0}}return 0!==z&&(r[u+z]=B-R<<24|64<<16|0),s.bits=U,0},p=-2,y=12,_=30;function x(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function B(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new l.Buf16(320),this.work=new l.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new l.Buf32(852),t.distcode=t.distdyn=new l.Buf32(592),t.sane=1,t.back=-1,0):p}function A(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,E(e)):p}function T(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?p:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,A(e))):p}function U(e,t){var n,i;return e?(i=new B,e.state=i,i.window=null,0!==(n=T(e,t))&&(e.state=null),n):p}var S,R,C=!0;function I(e){if(C){var t;for(S=new l.Buf32(512),R=new l.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(v(1,e.lens,0,288,S,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;v(2,e.lens,0,32,R,0,e.work,{bits:5}),C=!1}e.lencode=S,e.lenbits=9,e.distcode=R,e.distbits=5}function z(e,t,n,i){var r,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new l.Buf8(a.wsize)),i>=a.wsize?(l.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((r=a.wsize-a.wnext)>i&&(r=i),l.arraySet(a.window,t,n-i,r,a.wnext),(i-=r)?(l.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}var D={inflateReset:A,inflateReset2:T,inflateResetKeep:E,inflateInit:function(e){return U(e,15)},inflateInit2:U,inflate:function(e,t){var n,i,r,a,o,s,f,c,w,b,m,g,k,B,E,A,T,U,S,R,C,D,V,P,O=0,M=new l.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return p;(n=e.state).mode===y&&(n.mode=13),o=e.next_out,r=e.output,f=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,c=n.hold,w=n.bits,b=s,m=f,D=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;w<16;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(2&n.wrap&&35615===c){n.check=0,M[0]=255&c,M[1]=c>>>8&255,n.check=h(n.check,M,2,0),c=0,w=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=_;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=_;break}if(w-=4,C=8+(15&(c>>>=4)),0===n.wbits)n.wbits=C;else if(C>n.wbits){e.msg="invalid window size",n.mode=_;break}n.dmax=1<<C,e.adler=n.check=1,n.mode=512&c?10:y,c=0,w=0;break;case 2:for(;w<16;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(n.flags=c,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=_;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=_;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(M[0]=255&c,M[1]=c>>>8&255,n.check=h(n.check,M,2,0)),c=0,w=0,n.mode=3;case 3:for(;w<32;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.head&&(n.head.time=c),512&n.flags&&(M[0]=255&c,M[1]=c>>>8&255,M[2]=c>>>16&255,M[3]=c>>>24&255,n.check=h(n.check,M,4,0)),c=0,w=0,n.mode=4;case 4:for(;w<16;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(M[0]=255&c,M[1]=c>>>8&255,n.check=h(n.check,M,2,0)),c=0,w=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(M[0]=255&c,M[1]=c>>>8&255,n.check=h(n.check,M,2,0)),c=0,w=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((g=n.length)>s&&(g=s),g&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),l.arraySet(n.head.extra,i,a,g,C)),512&n.flags&&(n.check=h(n.check,i,g,a)),s-=g,a+=g,n.length-=g),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;g=0;do{C=i[a+g++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C))}while(C&&g<s);if(512&n.flags&&(n.check=h(n.check,i,g,a)),s-=g,a+=g,C)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;g=0;do{C=i[a+g++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C))}while(C&&g<s);if(512&n.flags&&(n.check=h(n.check,i,g,a)),s-=g,a+=g,C)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;w<16;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=_;break}c=0,w=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=y;break;case 10:for(;w<32;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}e.adler=n.check=x(c),c=0,w=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=w,2;e.adler=n.check=1,n.mode=y;case y:if(5===t||6===t)break e;case 13:if(n.last){c>>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}switch(n.last=1&c,w-=1,3&(c>>>=1)){case 0:n.mode=14;break;case 1:if(I(n),n.mode=20,6===t){c>>>=2,w-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=_}c>>>=2,w-=2;break;case 14:for(c>>>=7&w,w-=7&w;w<32;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=_;break}if(n.length=65535&c,c=0,w=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(g=n.length){if(g>s&&(g=s),g>f&&(g=f),0===g)break e;l.arraySet(r,i,a,g,o),s-=g,a+=g,f-=g,o+=g,n.length-=g;break}n.mode=y;break;case 17:for(;w<14;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(n.nlen=257+(31&c),c>>>=5,w-=5,n.ndist=1+(31&c),c>>>=5,w-=5,n.ncode=4+(15&c),c>>>=4,w-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=_;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;w<3;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.lens[j[n.have++]]=7&c,c>>>=3,w-=3}for(;n.have<19;)n.lens[j[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,V={bits:n.lenbits},D=v(0,n.lens,0,19,n.lencode,0,n.work,V),n.lenbits=V.bits,D){e.msg="invalid code lengths set",n.mode=_;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;A=(O=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(T<16)c>>>=E,w-=E,n.lens[n.have++]=T;else{if(16===T){for(P=E+2;w<P;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(c>>>=E,w-=E,0===n.have){e.msg="invalid bit length repeat",n.mode=_;break}C=n.lens[n.have-1],g=3+(3&c),c>>>=2,w-=2}else if(17===T){for(P=E+3;w<P;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}w-=E,C=0,g=3+(7&(c>>>=E)),c>>>=3,w-=3}else{for(P=E+7;w<P;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}w-=E,C=0,g=11+(127&(c>>>=E)),c>>>=7,w-=7}if(n.have+g>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=_;break}for(;g--;)n.lens[n.have++]=C}}if(n.mode===_)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=_;break}if(n.lenbits=9,V={bits:n.lenbits},D=v(1,n.lens,0,n.nlen,n.lencode,0,n.work,V),n.lenbits=V.bits,D){e.msg="invalid literal/lengths set",n.mode=_;break}if(n.distbits=6,n.distcode=n.distdyn,V={bits:n.distbits},D=v(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,V),n.distbits=V.bits,D){e.msg="invalid distances set",n.mode=_;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&f>=258){e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=w,u(e,m),o=e.next_out,r=e.output,f=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,c=n.hold,w=n.bits,n.mode===y&&(n.back=-1);break}for(n.back=0;A=(O=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(A&&0==(240&A)){for(U=E,S=A,R=T;A=(O=n.lencode[R+((c&(1<<U+S)-1)>>U)])>>>16&255,T=65535&O,!(U+(E=O>>>24)<=w);){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}c>>>=U,w-=U,n.back+=U}if(c>>>=E,w-=E,n.back+=E,n.length=T,0===A){n.mode=26;break}if(32&A){n.back=-1,n.mode=y;break}if(64&A){e.msg="invalid literal/length code",n.mode=_;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(P=n.extra;w<P;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(O=n.distcode[c&(1<<n.distbits)-1])>>>16&255,T=65535&O,!((E=O>>>24)<=w);){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(0==(240&A)){for(U=E,S=A,R=T;A=(O=n.distcode[R+((c&(1<<U+S)-1)>>U)])>>>16&255,T=65535&O,!(U+(E=O>>>24)<=w);){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}c>>>=U,w-=U,n.back+=U}if(c>>>=E,w-=E,n.back+=E,64&A){e.msg="invalid distance code",n.mode=_;break}n.offset=T,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(P=n.extra;w<P;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,w-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=_;break}n.mode=25;case 25:if(0===f)break e;if(g=m-f,n.offset>g){if((g=n.offset-g)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=_;break}g>n.wnext?(g-=n.wnext,k=n.wsize-g):k=n.wnext-g,g>n.length&&(g=n.length),B=n.window}else B=r,k=o-n.offset,g=n.length;g>f&&(g=f),f-=g,n.length-=g;do{r[o++]=B[k++]}while(--g);0===n.length&&(n.mode=21);break;case 26:if(0===f)break e;r[o++]=n.length,f--,n.mode=21;break;case 27:if(n.wrap){for(;w<32;){if(0===s)break e;s--,c|=i[a++]<<w,w+=8}if(m-=f,e.total_out+=m,n.total+=m,m&&(e.adler=n.check=n.flags?h(n.check,r,m,o-m):d(n.check,r,m,o-m)),m=f,(n.flags?c:x(c))!==n.check){e.msg="incorrect data check",n.mode=_;break}c=0,w=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;w<32;){if(0===s)break e;s--,c+=i[a++]<<w,w+=8}if(c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=_;break}c=0,w=0}n.mode=29;case 29:D=1;break e;case _:D=-3;break e;case 31:return-4;default:return p}return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=w,(n.wsize||m!==e.avail_out&&n.mode<_&&(n.mode<27||4!==t))&&z(e,e.output,e.next_out,m-e.avail_out),b-=e.avail_in,m-=e.avail_out,e.total_in+=b,e.total_out+=m,n.total+=m,n.wrap&&m&&(e.adler=n.check=n.flags?h(n.check,r,m,e.next_out-m):d(n.check,r,m,e.next_out-m)),e.data_type=n.bits+(n.last?64:0)+(n.mode===y?128:0)+(20===n.mode||15===n.mode?256:0),(0===b&&0===m||4===t)&&0===D&&(D=-5),D},inflateEnd:function(e){if(!e||!e.state)return p;var t=e.state;return t.window&&(t.window=null),e.state=null,0},inflateGetHeader:function(e,t){var n;return e&&e.state?0==(2&(n=e.state).wrap)?p:(n.head=t,t.done=!1,0):p},inflateSetDictionary:function(e,t){var n,i=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?p:11===n.mode&&d(1,t,i,0)!==n.check?-3:z(e,t,i,i)?(n.mode=31,-4):(n.havedict=1,0):p},inflateInfo:"pako inflate (from Nodeca project)"},V=!0,P=!0;try{String.fromCharCode.apply(null,[0])}catch(e){V=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){P=!1}for(var O=new l.Buf8(256),M=0;M<256;M++)O[M]=M>=252?6:M>=248?5:M>=240?4:M>=224?3:M>=192?2:1;O[254]=O[254]=1;function j(e,t){if(t<65534&&(e.subarray&&P||!e.subarray&&V))return String.fromCharCode.apply(null,l.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}var H=function(e){var t,n,i,r,a,o=e.length,s=0;for(r=0;r<o;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new l.Buf8(s),a=0,r=0;a<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},N=function(e){for(var t=new l.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},L=function(e,t){var n,i,r,a,o=t||e.length,s=new Array(2*o);for(i=0,n=0;n<o;)if((r=e[n++])<128)s[i++]=r;else if((a=O[r])>4)s[i++]=65533,n+=a-1;else{for(r&=2===a?31:3===a?15:7;a>1&&n<o;)r=r<<6|63&e[n++],a--;a>1?s[i++]=65533:r<65536?s[i++]=r:(r-=65536,s[i++]=55296|r>>10&1023,s[i++]=56320|1023&r)}return j(s,i)},Y=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+O[e[n]]>t?n:t},F=0,G=2,K=4,Q=0,q=1,W=2,J=-5,X={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};var Z=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};var $=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},ee=Object.prototype.toString;function te(e){if(!(this instanceof te))return new te(e);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Z,this.strm.avail_out=0;var n=D.inflateInit2(this.strm,t.windowBits);if(n!==Q)throw new Error(X[n]);if(this.header=new $,D.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=H(t.dictionary):"[object ArrayBuffer]"===ee.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=D.inflateSetDictionary(this.strm,t.dictionary))!==Q))throw new Error(X[n])}function ne(e,t){var n=new te(t);if(n.push(e,!0),n.err)throw n.msg||X[n.err];return n.result}te.prototype.push=function(e,t){var n,i,r,a,o,s=this.strm,f=this.options.chunkSize,d=this.options.dictionary,c=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?K:F,"string"==typeof e?s.input=N(e):"[object ArrayBuffer]"===ee.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new l.Buf8(f),s.next_out=0,s.avail_out=f),(n=D.inflate(s,F))===W&&d&&(n=D.inflateSetDictionary(this.strm,d)),n===J&&!0===c&&(n=Q,c=!1),n!==q&&n!==Q)return this.onEnd(n),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&n!==q&&(0!==s.avail_in||i!==K&&i!==G)||("string"===this.options.to?(r=Y(s.output,s.next_out),a=s.next_out-r,o=L(s.output,r),s.next_out=a,s.avail_out=f-a,a&&l.arraySet(s.output,s.output,r,a,0),this.onData(o)):this.onData(l.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(c=!0)}while((s.avail_in>0||0===s.avail_out)&&n!==q);return n===q&&(i=K),i===K?(n=D.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Q):i!==G||(this.onEnd(Q),s.avail_out=0,!0)},te.prototype.onData=function(e){this.chunks.push(e)},te.prototype.onEnd=function(e){e===Q&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ie={Inflate:te,inflate:ne,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ne(e,t)},ungzip:ne};const re=Uint16Array.BYTES_PER_ELEMENT,ae=Int32Array.BYTES_PER_ELEMENT,oe=Uint32Array.BYTES_PER_ELEMENT,se={METADATA:0,TERRAIN:1,DBROOT:2};se.fromString=function(e){return"Metadata"===e?se.METADATA:"Terrain"===e?se.TERRAIN:"DbRoot"===e?se.DBROOT:void 0};const fe=1953029805,le=2917034100;return r((function(e,n){const i=se.fromString(e.type);let r=e.buffer;a(e.key,r);const o=function(e){const n=new DataView(e);let i=0;const r=n.getUint32(i,!0);if(i+=oe,r!==fe&&r!==le)throw new t.RuntimeError("Invalid magic");const a=n.getUint32(i,r===fe);i+=oe;const o=new Uint8Array(e,i),s=ie.inflate(o);if(s.length!==a)throw new t.RuntimeError("Size of packet doesn't match header");return s}(r);r=o.buffer;const s=o.length;switch(i){case se.METADATA:return function(e,n,i){const r=new DataView(e);let a=0;const o=r.getUint32(a,!0);if(a+=oe,32301!==o)throw new t.RuntimeError("Invalid magic");const s=r.getUint32(a,!0);if(a+=oe,1!==s)throw new t.RuntimeError("Invalid data type. Must be 1 for QuadTreePacket");const l=r.getUint32(a,!0);if(a+=oe,2!==l)throw new t.RuntimeError("Invalid QuadTreePacket version. Only version 2 is supported.");const d=r.getInt32(a,!0);a+=ae;const c=r.getInt32(a,!0);if(a+=ae,32!==c)throw new t.RuntimeError("Invalid instance size.");const h=r.getInt32(a,!0);a+=ae;const u=r.getInt32(a,!0);a+=ae;const w=r.getInt32(a,!0);if(a+=ae,h!==d*c+a)throw new t.RuntimeError("Invalid dataBufferOffset");if(h+u+w!==n)throw new t.RuntimeError("Invalid packet offsets");const b=[];for(let e=0;e<d;++e){const e=r.getUint8(a);++a,++a;const t=r.getUint16(a,!0);a+=re;const n=r.getUint16(a,!0);a+=re;const i=r.getUint16(a,!0);a+=re,a+=re,a+=re,a+=ae,a+=ae,a+=8;const o=r.getUint8(a++),s=r.getUint8(a++);a+=re,b.push(new f(e,t,n,i,o,s))}const m=[];let g=0;function k(e,t,n){let i=!1;if(4===n){if(t.hasSubtree())return;i=!0}for(let r=0;r<4;++r){const a=e+r.toString();if(i)m[a]=null;else if(n<4)if(t.hasChild(r)){if(g===d)return void console.log("Incorrect number of instances");const e=b[g++];m[a]=e,k(a,e,n+1)}else m[a]=null}}let v=0;const p=b[g++];""===i?++v:m[i]=p;return k(i,p,v),m}(r,s,e.quadKey);case se.TERRAIN:return function(e,n,i){const r=new DataView(e),a=function(e){for(let i=0;i<4;++i){const i=r.getUint32(e,!0);if(e+=oe,(e+=i)>n)throw new t.RuntimeError("Malformed terrain packet found.")}return e};let o=0;const s=[];for(;s.length<5;){const t=o;o=a(o);const n=e.slice(t,o);i.push(n),s.push(n)}return s}(r,s,n);case se.DBROOT:return n.push(r),{buffer:r}}}))}));