define(["require","./createTaskProcessorWorker","./Check-7b2a090c","./FeatureDetection-c3b71206","./when-b60132fc","./PrimitiveType-a54dc62f","./Cartesian2-47311507","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Color-5008547b","./ComponentDatatype-c140a87d","./getStringFromTypedArray-c37342c0","./buildModuleUrl-4e1b81e7","./S3MCompressType-555475e4","./IndexDatatype-8a5eead4","./RuntimeError-4a5c8994","./BoundingRectangle-3ed8ca6d","./pako_inflate-f73548c4","./arrayFill-4513d7ad","./CompressedTextureBuffer-290a1ff4","./PixelFormat-fd637eac","./Math-119be1a3","./WebGLConstants-4ae0db90","./Event-16a2dfbf"],(function(t,e,r,a,n,A,o,i,B,E,C,s,y,l,d,f,u,P,c,p,T,L,D,g){"use strict";function F(t,e,r){if("function"==typeof t.slice)return t.slice(e,r);for(var n=Array.prototype.slice.call(t,e,r),A=a.FeatureDetection.typedArrayTypes,o=A.length,i=0;i=0){n.defined(d)||(r.nCompressOptions|=l.VertexCompressOption.SVC_Vertex);var L=e.GetAttribute(t,a.posUniqueID),D=I(t,e,L),g=D.data.componentsPerAttribute;r.verticesCount=D.array.length/g,r.vertCompressConstant=D.data.quantization.range/(1<3&&(r.minVerticesValue.w=F[3]);var M=r.verticesCount;if(s&&(f=new i.Cartographic,u=new i.Cartographic,P=new Float32Array(2*M),c=new Float64Array(2*M)),n.defined(d)){var m=D.array,v=3===g?i.Cartesian3.unpackArray(m):B.Cartesian4.unpackArray(m);for(let t=0,e=v.length;t=0){r.nCompressOptions|=l.VertexCompressOption.SVC_Normal;var w=e.GetAttribute(t,a.normalUniqueID),Y=I(t,e,w),J=Y.data.quantization;r.normalRangeConstant=(1<=0){r.nCompressOptions|=l.VertexCompressOption.SVC_VertexColor;var k=e.GetAttribute(t,a.colorUniqueID),W=I(t,e,k);T.aColor=p.length,p.push({index:T.aColor,typedArray:W.array,componentsPerAttribute:W.data.componentsPerAttribute,componentDatatype:W.data.componentDatatype,offsetInBytes:W.data.byteOffset,strideInBytes:W.data.byteStride,normalize:W.data.normalized})}for(V=0;V-1?K(e):n.defined(e.clampRegionEdge)?w(e):t>=b.ClampGroundPolygon&&t<=b.ClampObjectLine?V(e):t==b.ClampGroundAndObjectLineCache?w(e):H(e)},U.calcBoundingSphere=function(t,e,r){var a,A=t._fileType;return a=e.instanceIndex>-1?K(e):n.defined(e.clampRegionEdge)?w(e):A>=b.ClampGroundPolygon&&A<=b.ClampObjectLine?V(e):A==b.ClampGroundAndObjectLineCache?w(e):H(e),y.BoundingSphere.transform(a,r,a),a},U.calcBoundingRectangle=function(t,e){var r;return t._fileType===b.ClampGroundPolygon&&(r=function(t){var e,r,a=n.defined(t.nCompressOptions)&&(t.nCompressOptions&l.VertexCompressOption.SVC_Vertex)===l.VertexCompressOption.SVC_Vertex,A=new u.BoundingRectangle,B=t.vertexAttributes[0],E=B.componentsPerAttribute,C=1;a?(C=t.vertCompressConstant,r=new i.Cartesian3(t.minVerticesValue.x,t.minVerticesValue.y,t.minVerticesValue.z),e=new Uint16Array(B.typedArray.buffer,B.typedArray.byteOffset,B.typedArray.byteLength/2)):e=new Float32Array(B.typedArray.buffer,B.typedArray.byteOffset,B.typedArray.byteLength/4);for(var s=[],y=0;y=1&&(_=f[D][F-1]),0!=F&&(c[m-6]=_.x,c[m-5]=_.y,c[m-4]=_.z,c[m-3]=_.x,c[m-2]=_.y,c[m-1]=_.z),F!=g-1&&(c[m]=_.x,c[m+1]=_.y,c[m+2]=_.z,c[m+3]=_.x,c[m+4]=_.y,c[m+5]=_.z),m=2*M+8*F,0!=F&&(T[m-4]=-1,T[m-3]=-1,T[m-2]=1,T[m-1]=-1),F!=g-1&&(T[m]=-1,T[m+1]=1,T[m+2]=1,T[m+3]=1)}L+=f[D].length}var S={vertexAttributes:[],attrLocation:{}},O=S.vertexAttributes,N=S.attrLocation;S.instanceCount=0,S.instanceMode=0,N.aPosition=0,O.push({index:N.aPosition,typedArray:P,componentsPerAttribute:3,componentDatatype:C.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aNormal=1,O.push({index:N.aNormal,typedArray:c,componentsPerAttribute:3,componentDatatype:C.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aTexCoord0=2,O.push({index:N.aTexCoord0,typedArray:p,componentsPerAttribute:3,componentDatatype:C.ComponentDatatype.FLOAT,offsetInBytes:0,strideInBytes:3*Float32Array.BYTES_PER_ELEMENT,normalize:!1}),N.aTexCoord1=3,O.push({index:N.aTexCoord1,typedArray:T,componentsPerAttribute:2,componentDatatype:C.ComponentDatatype.BYTE,offsetInBytes:0,strideInBytes:2*Int8Array.BYTES_PER_ELEMENT,normalize:!1});for(var h=[],R=0;R65535?1:0,o.primitiveType=A.PrimitiveType.TRIANGLES,n=0===o.indexType?new Uint16Array(o.indicesCount):new Uint32Array(o.indicesCount);for(var i=0,B=0;B96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}var A=0;for(a=0;a>E,y>>E);if($0){e.getUint16(o+r,!0),o+=Uint16Array.BYTES_PER_ELEMENT,o+=2*Uint8Array.BYTES_PER_ELEMENT;var B=i*Uint8Array.BYTES_PER_ELEMENT*4;A=F(t,o,o+B),o+=B;var E=n.vertexAttributes,s=n.attrLocation;s.aColor=E.length,E.push({index:s.aColor,typedArray:A,componentsPerAttribute:4,componentDatatype:C.ComponentDatatype.UNSIGNED_BYTE,offsetInBytes:0,strideInBytes:4,normalize:!0})}return{bytesOffset:o}}function Ot(t,e,r,a,n){var A=a,o=e.getUint32(A+r,!0);return A+=Uint32Array.BYTES_PER_ELEMENT,o<=0?{bytesOffset:A}:(e.getUint16(A+r,!0),A+=Uint16Array.BYTES_PER_ELEMENT,A+=2*Uint8Array.BYTES_PER_ELEMENT,{bytesOffset:A+=o*Uint8Array.BYTES_PER_ELEMENT*4})}function Nt(t,e,r,a,n){var A=n,o=[],i=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var B=0;B0){var l=0,d=null;1===s||3===s?(l=C*Uint32Array.BYTES_PER_ELEMENT,d=e.subarray(A,A+l)):(l=C*Uint16Array.BYTES_PER_ELEMENT,d=e.subarray(A,A+l),C%2!=0&&(l+=2)),E.indicesTypedArray=d,A+=l}E.indicesCount=C,E.indexType=s,E.primitiveType=y;var f=[],u=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var P=0;P=2&&(e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT);var O,N={};N.posUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.normalUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.colorUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,N.secondColorUniqueID=e.getInt32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT,3===d?(O=e.getUint32(L+r,!0),L+=Int32Array.BYTES_PER_ELEMENT):(O=e.getUint16(L+r,!0),L+=Int16Array.BYTES_PER_ELEMENT);for(var h=[],R=0;R0){var Y=(J=ut(e,r,T,L)).string;L=J.bytesOffset,w.materialCode=Y,V.push(w)}3===d&&((zt=(L+r)%4)&&(zt=4-zt),L+=zt);var J,k=new Object,W=e.getUint32(L+r,!0),Z=F(T,L+=Int32Array.BYTES_PER_ELEMENT,L+W);if(H>0?M.dracoDecodeMesh(rt,Z,W,fe,w,N,g,P,k,p):M.dracoDecodePointCloud(rt,Z,W,fe,N),n.defined(k.min)&&n.defined(k.max)||(k=void 0),L+=W,3===d)(zt=(L+r)%4)&&(zt=4-zt),(zt=((L=(J=ut(e,r,T,L+=zt)).bytesOffset)+r)%4)&&(zt=4-zt),L+=zt;a[I]={vertexPackage:fe,arrIndexPackage:V,cartographicBounds:k}}else if(S==ot&&3==d){var Q=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT;var z=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT,fe.minVerticesValue=new B.Cartesian4,fe.minTexCoordValue=[new o.Cartesian2,new o.Cartesian2],fe.texCoordCompressConstant=[new i.Cartesian3,new i.Cartesian3];V=[];for(var j=0;j0){var Ot=e.getInt8(L+r,!0);L+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(L+r,!0),L+=Int8Array.BYTES_PER_ELEMENT;var xt=e.getInt8(L+r,!0);L+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(L+r,!0),L+=Int8Array.BYTES_PER_ELEMENT;var bt,Ut,Kt=e.getInt32(L+r,!0);L+=Int32Array.BYTES_PER_ELEMENT,13!==xt?(bt=new Uint8Array(e.buffer,L+r,Kt),L+=Uint8Array.BYTES_PER_ELEMENT*Kt):(bt=new Uint32Array(e.buffer,L+r,Kt),L+=Uint32Array.BYTES_PER_ELEMENT*Kt),(zt=(L+r)%4)&&(zt=4-zt),L+=zt,13!==xt?(Ut=C.ComponentDatatype.createTypedArray(C.ComponentDatatype.UNSIGNED_BYTE,St*Uint32Array.BYTES_PER_ELEMENT),X.decodeIndexBuffer(Ut,St,Uint32Array.BYTES_PER_ELEMENT,bt)):Ut=bt;var Ht,Vt=e.getInt32(L+r,!0);L+=Int32Array.BYTES_PER_ELEMENT,w.indexType=Ot,0===Ot?Ht=new Uint16Array(St):1===Ot&&(Ht=new Uint32Array(St)),w.indicesCount=St;var Jt=new Uint32Array(Ut.buffer,Ut.byteOffset,Ut.byteLength/4);Ht.set(Jt,0),w.indicesTypedArray=Ht,w.primitiveType=xt;for(Pt=0;Pt0&&13!==xt){var Zt=fe.preVertexCount;w.indicesTypedArray=Jt.map((function(t){return t+Zt})),w.indexType=1}V.push(w),(zt=(L+r)%4)&&(zt=4-zt),L+=zt}}}fe.nCompressOptions=Q,2===V.length&&13===V[1].primitiveType&&V[1].indicesCount>=3&&(Xt=l.S3MEdgeProcessor.createEdgeDataByIndices(fe,V[1],s)),n.defined(k.min)&&n.defined(k.max)||(k=void 0),a[I]={vertexPackage:fe,arrIndexPackage:V,edgeGeometry:Xt,cartographicBounds:k}}else{var Xt;if(S===At||S===nt)L=(kt=Rt(d,T,e,r,L,fe,E,g,P,p)).bytesOffset,k=kt.cartographicBounds;else if(S===ot&&(L=(kt=ht(T,e,r,L,fe,E,g,P,p)).bytesOffset,3==d)){var Qt;L=(Qt=ut(e,r,T,L)).bytesOffset,fe.customVertexAttribute=JSON.parse(Qt.string);var zt;gt="aCustom"+fe.customVertexAttribute.TextureCoordMatrix,Ft="aCustom"+fe.customVertexAttribute.VertexWeight,Mt="aCustom"+fe.customVertexAttribute.VertexWeight_1;n.defined(fe.attrLocation[gt])&&(fe.attrLocation.aTextureCoordMatrix=fe.attrLocation[gt],delete fe.attrLocation[gt]),n.defined(fe.attrLocation[Ft])&&(fe.attrLocation.aVertexWeight=fe.attrLocation[Ft],delete fe.attrLocation[Ft]),n.defined(fe.attrLocation[Mt])&&(fe.attrLocation.aVertexWeight_1=fe.attrLocation[Mt],delete fe.attrLocation[Mt]);var jt;for(mt=(jt=Object.keys(fe.attrLocation)).length,It=0;It=3&&(Xt=l.S3MEdgeProcessor.createEdgeDataByIndices(fe,V[1],s)),L=kt.bytesOffset,a[I]={vertexPackage:fe,arrIndexPackage:V,edgeGeometry:Xt,cartographicBounds:k}}if(3!==d&&n.defined(y)&&y){var $t=e.getUint16(L+r,!0);if(L+=Uint16Array.BYTES_PER_ELEMENT,1===$t){var te=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT;var ee,re=e.getUint32(L+r,!0);L+=Uint32Array.BYTES_PER_ELEMENT,e.getFloat32(L+r,!0),L+=Float32Array.BYTES_PER_ELEMENT;var ae=new Array(te),ne=new Array(te),Ae=new Array(te),oe=new Array(te);for(ee=0;ee-1e-10}function re(t,e,r,a,A,o,i,B){var E=new DataView(t),C=new Uint8Array(t),y=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var d=s.getStringFromTypedArray(C,r,y);d=d.replace(/(\.s3mblock)|(\.s3mbz)|(\.s3mb)/gi,""),r+=y;var f=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(var u=0;u=3&&(E.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),E.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;var m=E.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var I=new Uint8Array(t,r,m),v=r+m,_=P.pako.inflate(I).buffer;B.push(_),E=new DataView(_);C=new Uint8Array(_);r=0;var S=E.getUint32(r,!0),O=ft(E,_,r+=Uint32Array.BYTES_PER_ELEMENT),N=O.buffer;r=O.byteOffset;var h=zt(M,N,E,O.dataViewByteOffset),R=r%4;0!==R&&(r+=4-R),Jt((O=ft(E,_,r)).buffer,E,O.dataViewByteOffset,F,!1,void 0,void 0,M),r=O.byteOffset,3!==M&&((O=ft(E,_,r)).buffer,r=O.byteOffset);var G={};!function(t,e,r,a,A,o,i,B,E,C){var y=B,d=i.getUint32(y,!0);y+=Uint32Array.BYTES_PER_ELEMENT;for(var f={},u=0;uI[5]?I[4]:I[5];p={left:v,top:_,right:S,bottom:O,minHeight:N,maxHeight:h,width:(c=new dt(v,O,S,_,N,h)).width,length:c.length,height:c.height};var R=new Uint32Array(g,48+m,7),G=R[0],x=R[1],b=R[2],K=R[3];T={nFormat:G,nSideBlockCount:x,nBlockLength:b,nLength:K,nWidth:R[4],nHeight:R[5],nDepth:R[6],imageArray:new Uint8Array(g,76+m,K*K*4)}}}var H=0,V={};V.ignoreNormal=e.ignoreNormal;var w=e.rootBatchIdMap||{},Y=e.ancestorMap||{},J={},k=new DataView(a),W=k.getFloat32(H,!0);if(H+=Float32Array.BYTES_PER_ELEMENT,C)return k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT,re(a,a.byteLength,H,w,Y,e.isRoot,J,r),J;var X=!1;if(W>=3&&(k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),W>=2&&(k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),ee(W-1)||ee(W-2)||ee(W-3)||W>2.09&&W<2.11){var Q=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT;var z=new Uint8Array(a,H,Q);a=P.pako.inflate(z).buffer,r.push(a),k=new DataView(a),H=0}else if(W>1.199&&W<1.201){Q=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT,r.push(a)}else{X=!0,H=0;Q=k.getInt32(H,!0);if(H+=Int32Array.BYTES_PER_ELEMENT,H+=Uint8Array.BYTES_PER_ELEMENT*Q,o){k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT;D=new Uint8Array(a,H);a=P.pako.inflate(D).buffer,r.push(a),k=new DataView(a),H=0}}var j=k.getUint32(H,!0),q=ft(k,a,H+=Uint32Array.BYTES_PER_ELEMENT),$=q.buffer;H=q.byteOffset;var tt={},et=zt(W,$,k,q.dataViewByteOffset,tt,u),rt=H%4;0!==rt&&(H+=4-rt);var nt=W>2.09&&3!==W;if(Jt((q=ft(k,a,H)).buffer,k,q.dataViewByteOffset,V,X,r,nt,W,y,tt,f,e.fileType,u),H=q.byteOffset,nt)for(var At=0;Atl.S3MPixelFormat.BGR||c===l.S3MPixelFormat.LUMINANCE_ALPHA?new Uint8Array(d*f*4):new Uint16Array(d*f),l.DXTTextureDecode.decode(T,d,f,p,c),A.push(T.buffer),u=0):T=p,n[C]={id:C,width:d,height:f,compressType:u,oriCompressType:L,nFormat:c,imageBuffer:T,mipmapLevel:y}}}(B,(q=ft(k,a,H)).buffer,k,q.dataViewByteOffset,ct,r),H=q.byteOffset;var pt=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT;var Tt=new Uint8Array(a).subarray(H,H+pt),Lt=s.getStringFromTypedArray(Tt);H+=pt,Lt=Lt.replace(/\n\0/,"");var Dt=JSON.parse(Lt);(3===W&&(j=k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),(j&at)==at)&&te((q=ft(k,a,H)).buffer,k,q.dataViewByteOffset,V,W);if(1==W){var gt=et.pageLods,Ft=!0;for(At=0;At65535?new Uint32Array(s/2):new Uint16Array(s/2),u=0;for(E=0,C=o.length;E