define(["./createTaskProcessorWorker","./Check-7b2a090c","./FeatureDetection-c3b71206","./when-b60132fc","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Color-5008547b","./ComponentDatatype-c140a87d","./S3MCompressType-4145c64c","./Cartesian2-47311507","./IndexDatatype-8a5eead4","./PrimitiveType-39acab88","./RuntimeError-4a5c8994","./pako_inflate-f73548c4","./unzip-7fd7fbf8","./buildModuleUrl-3addfe33","./arrayFill-4513d7ad","./CompressedTextureBuffer-290a1ff4","./PixelFormat-d55645da","./Math-119be1a3","./WebGLConstants-4ae0db90","./BoundingRectangle-01b3e970"],(function(t,e,r,a,n,i,o,E,s,y,f,u,d,l,T,p,_,c,A,m,g,v,B){"use strict";function P(t,e,a){if("function"==typeof t.slice)return t.slice(e,a);for(var n=Array.prototype.slice.call(t,e,a),i=r.FeatureDetection.typedArrayTypes,o=i.length,E=0;E=0){r.nCompressOptions|=y.VertexCompressOption.SVC_Vertex;var A=e.GetAttribute(t,E.posUniqueID),m=M(t,e,A),g=m.data.componentsPerAttribute;r.verticesCount=m.array.length/g,r.vertCompressConstant=m.data.quantization.range/(1<3&&(r.minVerticesValue.w=v[3]),c.aPosition=_.length,_.push({index:c.aPosition,typedArray:m.array,componentsPerAttribute:g,componentDatatype:m.data.componentDatatype,offsetInBytes:m.data.byteOffset,strideInBytes:m.data.byteStride,normalize:m.data.normalized}),d){var B=r.verticesCount,P=new i.Cartesian3,U=new i.Cartesian3,L=new i.Cartographic;T=new i.Cartographic,p=new i.Cartographic;for(var b=new Float32Array(2*B),S=new Float64Array(2*B),h=0;h=0){r.nCompressOptions|=y.VertexCompressOption.SVC_Normal;var N=e.GetAttribute(t,E.normalUniqueID),R=M(t,e,N),x=R.data.quantization;r.normalRangeConstant=(1<=0){r.nCompressOptions|=y.VertexCompressOption.SVC_VertexColor;var Y=e.GetAttribute(t,E.colorUniqueID),C=M(t,e,Y);c.aColor=_.length,_.push({index:c.aColor,typedArray:new Uint8Array(C.array),componentsPerAttribute:C.data.componentsPerAttribute,componentDatatype:s.ComponentDatatype.UNSIGNED_BYTE,offsetInBytes:C.data.byteOffset,strideInBytes:4,normalize:C.data.normalized})}for(h=0;h>y,d>>y);if(I0){e.getUint16(o+r,!0),o+=Uint16Array.BYTES_PER_ELEMENT,o+=2*Uint8Array.BYTES_PER_ELEMENT;var y=E*Uint8Array.BYTES_PER_ELEMENT*4;i=P(t,o,o+y),o+=y;var f=n.vertexAttributes,u=n.attrLocation;u.aColor=f.length,f.push({index:u.aColor,typedArray:i,componentsPerAttribute:4,componentDatatype:s.ComponentDatatype.UNSIGNED_BYTE,offsetInBytes:0,strideInBytes:4,normalize:!0})}return{bytesOffset:o}}function et(t,e,r,a,n){var i=a,o=e.getUint32(i+r,!0);return i+=Uint32Array.BYTES_PER_ELEMENT,o<=0?{bytesOffset:i}:(e.getUint16(i+r,!0),i+=Uint16Array.BYTES_PER_ELEMENT,i+=2*Uint8Array.BYTES_PER_ELEMENT,{bytesOffset:i+=o*Uint8Array.BYTES_PER_ELEMENT*4})}function rt(t,e,r,a){var n=a,i=[],o=e.getUint32(n+r,!0);n+=Uint32Array.BYTES_PER_ELEMENT;for(var E=0;E0){var d=0,l=null;1===f||3===f?(d=y*Uint32Array.BYTES_PER_ELEMENT,l=t.subarray(n,n+d)):(d=y*Uint16Array.BYTES_PER_ELEMENT,l=t.subarray(n,n+d),y%2!=0&&(d+=2)),s.indicesTypedArray=l,n+=d}s.indicesCount=y,s.indexType=f,s.primitiveType=u;var T=[],p=e.getUint32(n+r,!0);n+=Uint32Array.BYTES_PER_ELEMENT;for(var _=0;_=2&&(e.getInt32(_+r,!0),_+=Int32Array.BYTES_PER_ELEMENT);var b={};b.posUniqueID=e.getInt32(_+r,!0),_+=Int32Array.BYTES_PER_ELEMENT,b.normalUniqueID=e.getInt32(_+r,!0),_+=Int32Array.BYTES_PER_ELEMENT,b.colorUniqueID=e.getInt32(_+r,!0),_+=Int32Array.BYTES_PER_ELEMENT,b.secondColorUniqueID=e.getInt32(_+r,!0),_+=Int32Array.BYTES_PER_ELEMENT;var S=e.getUint16(_+r,!0);_+=Int16Array.BYTES_PER_ELEMENT;for(var h=[],N=0;N0){var I=J(e,r,p,_),F=I.string;_=I.bytesOffset,C.materialCode=F,Y.push(C)}var D=new Object,O=e.getUint32(_+r,!0),G=P(p,_+=Int32Array.BYTES_PER_ELEMENT,_+O);x>0?U.dracoDecodeMesh(w,G,O,lt,C,b,A,T,D):U.dracoDecodePointCloud(w,G,O,lt,b),a.defined(D.min)&&a.defined(D.max)||(D=void 0),_+=O,o[v]={vertexPackage:lt,arrIndexPackage:Y,cartographicBounds:D}}else{var q;M==z?(_=(g=nt(p,e,r,_,lt,E,A,T)).bytesOffset,D=g.cartographicBounds):M==V&&(_=(g=at(p,e,r,_,lt,E,A)).bytesOffset),it(Y=(g=rt(p,e,r,_)).arrIndexPackage)&&(lt.clampRegionEdge=!0),2===Y.length&&13===Y[1].primitiveType&&Y[1].indicesCount>=3&&(q=y.S3MEdgeProcessor.createEdgeDataByIndices(lt,Y[1],s)),_=g.bytesOffset,o[v]={vertexPackage:lt,arrIndexPackage:Y,edgeGeometry:q,cartographicBounds:D}}if(a.defined(f)&&f){var H=e.getUint16(_+r,!0);if(_+=Uint16Array.BYTES_PER_ELEMENT,1===H){var W=e.getUint32(_+r,!0);_+=Uint32Array.BYTES_PER_ELEMENT;var X,j=e.getUint32(_+r,!0);_+=Uint32Array.BYTES_PER_ELEMENT,e.getFloat32(_+r,!0),_+=Float32Array.BYTES_PER_ELEMENT;var Z=new Array(W),Q=new Array(W),K=new Array(W),$=new Array(W);for(X=0;X-1e-10}function _t(t,e,r,n,i,o,E,s){var f=new DataView(t),u=new Uint8Array(t),d=f.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var l=y.getStringFromTypedArray(u,r,d);l=l.replace(/(\.s3mblock)|(\.s3mbz)|(\.s3mb)/gi,""),r+=d;var p=f.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(var _=0;_U[5]?U[4]:U[5];_={left:L,top:M,right:b,bottom:S,minHeight:h,maxHeight:R,width:(l=new X(L,S,b,M,h,R)).width,length:l.length,height:l.height};var x=new Uint32Array(g,48+P,7),Y=x[0],C=x[1],I=x[2],F=x[3];c={nFormat:Y,nSideBlockCount:C,nBlockLength:I,nLength:F,nWidth:x[4],nHeight:x[5],nDepth:x[6],imageArray:new Uint8Array(g,76+P,F*F*4)}}}var D=0,w={};w.ignoreNormal=t.ignoreNormal;var z=t.rootBatchIdMap||{},V=t.ancestorMap||{},k={},G=new DataView(r),Z=G.getFloat32(D,!0);if(D+=Float32Array.BYTES_PER_ELEMENT,Z>2.2)return{result:!1};if(s)return G.getUint32(D,!0),D+=Uint32Array.BYTES_PER_ELEMENT,_t(r,r.byteLength,D,z,V,t.isRoot,k,e),k;var Q,K=!1;if(Z>=2&&(Q=G.getUint32(D,!0),D+=Uint32Array.BYTES_PER_ELEMENT),pt(Z-1)||pt(Z-2)||Z>2.09&&Z<2.11){var $=G.getUint32(D,!0);D+=Uint32Array.BYTES_PER_ELEMENT;var tt=new Uint8Array(r,D,$);r=!0===q?function(t,e){var r=e||4*t.length,a=p.unzip._malloc(Uint8Array.BYTES_PER_ELEMENT*r),n=new Uint8Array(r);p.unzip.HEAPU8.set(n,a/Uint8Array.BYTES_PER_ELEMENT);var i,o=p.unzip._malloc(Uint8Array.BYTES_PER_ELEMENT*t.length);for(p.unzip.HEAPU8.set(t,o/Uint8Array.BYTES_PER_ELEMENT);0==(i=H(a,r,o,t.length));)W(a),r*=4,a=p.unzip._malloc(Uint8Array.BYTES_PER_ELEMENT*r),n=new Uint8Array(r),p.unzip.HEAPU8.set(n,a/Uint8Array.BYTES_PER_ELEMENT);var E=new Uint8Array(p.unzip.HEAPU8.buffer,a,i);t=null,n=null;var s=new Uint8Array(E).buffer;return W(a),W(o),s}(tt,Q):T.pako.inflate(tt).buffer,e.push(r),G=new DataView(r),D=0}else if(Z>1.199&&Z<1.201){$=G.getUint32(D,!0);D+=Uint32Array.BYTES_PER_ELEMENT,e.push(r)}else{K=!0,D=0;$=G.getInt32(D,!0);if(D+=Int32Array.BYTES_PER_ELEMENT,D+=Uint8Array.BYTES_PER_ELEMENT*$,n){G.getUint32(D,!0),D+=Uint32Array.BYTES_PER_ELEMENT;m=new Uint8Array(r,D);r=T.pako.inflate(m).buffer,e.push(r),G=new DataView(r),D=0}}var et=G.getUint32(D,!0),rt=j(G,r,D+=Uint32Array.BYTES_PER_ELEMENT),at=rt.buffer;D=rt.byteOffset;var nt={},it=ft(at,G,rt.dataViewByteOffset,nt),Et=D%4;0!==Et&&(D+=4-Et);var st=Z>2.09;if(ot((rt=j(G,r,D)).buffer,G,rt.dataViewByteOffset,w,K,e,st,Z,f,nt,d),D=rt.byteOffset,st)for(var yt=0;yty.S3MPixelFormat.BGR||A===y.S3MPixelFormat.LUMINANCE_ALPHA?new Uint8Array(T*p*4):new Uint16Array(T*p),y.DXTTextureDecode.decode(g,T,p,m,A),i.push(g.buffer),_=0):g=m,n[u]={id:u,width:T,height:p,compressType:_,nFormat:A,imageBuffer:g,mipmapLevel:l}}}(o,(rt=j(G,r,D=rt.byteOffset)).buffer,G,rt.dataViewByteOffset,gt,e),D=rt.byteOffset;var vt=G.getUint32(D,!0);D+=Uint32Array.BYTES_PER_ELEMENT;var Bt=new Uint8Array(r).subarray(D,D+vt),Pt=y.getStringFromTypedArray(Bt);D+=vt,Pt=Pt.replace(/\n\0/,"");var Ut=JSON.parse(Pt);(et&O)==O&&Tt((rt=j(G,r,D)).buffer,G,rt.dataViewByteOffset,w,Z);var Lt=it.pageLods,Mt=!0;for(yt=0;yt