define(["require","./createTaskProcessorWorker","./Check-3aa71481","./when-515d5295","./FeatureDetection-7fae0d5a","./PrimitiveType-b38a4004","./Cartesian2-1b9b0d8a","./Cartographic-1bbcab04","./Cartesian4-034d54d5","./Color-39e7bd91","./ComponentDatatype-d430c7f7","./getStringFromTypedArray-53c2705d","./buildModuleUrl-dba4ec07","./S3MCompressType-d847073b","./IndexDatatype-eefd5922","./RuntimeError-350acae3","./Rectangle-e170be8b","./BoundingRectangle-409afd17","./S3MPixelFormat-f1fedece","./pako_inflate-f73548c4","./arrayFill-4d3cc415","./CompressedTextureBuffer-807fafb6","./PixelFormat-b3c660aa","./Math-5e38123d","./WebGLConstants-77a84876","./Intersect-53434a77","./Event-9821f5d9","./Buffer-72562b71"],(function(t,e,r,a,n,A,o,B,E,i,C,s,y,c,u,l,f,P,d,p,L,T,D,g,F,v,I,M){"use strict";function m(t,e,A){if(r.n.defined("array",t),a.t(e)&&r.n.typeOf.number("begin",e),a.t(A)&&r.n.typeOf.number("end",A),"function"==typeof t.slice)return t.slice(e,A);for(var o=Array.prototype.slice.call(t,e,A),B=n.o.typedArrayTypes,E=B.length,i=0;i=0){a.t(u)||(r.nCompressOptions|=c.VertexCompressOption.SVC_Vertex);var D=e.GetAttribute(t,n.posUniqueID),g=h(t,e,D),F=g.data.componentsPerAttribute;r.verticesCount=g.array.length/F,r.vertCompressConstant=g.data.quantization.range/(1<3&&(r.minVerticesValue.w=v[3]);var I=r.verticesCount;if(s&&(l=new B.i,P=new B.i,d=new Float32Array(2*I),p=new Float64Array(2*I)),a.t(u)){var M=g.array,m=3===F?B.a.unpackArray(M):E.a.unpackArray(M);for(let t=0,e=m.length;t=0){r.nCompressOptions|=c.VertexCompressOption.SVC_Normal;var Y=e.GetAttribute(t,n.normalUniqueID),J=h(t,e,Y),k=J.data.quantization;r.normalRangeConstant=(1<=0){r.nCompressOptions|=c.VertexCompressOption.SVC_VertexColor;var W=e.GetAttribute(t,n.colorUniqueID),Z=h(t,e,W);T.aColor=L.length,L.push({index:T.aColor,typedArray:Z.array,componentsPerAttribute:Z.data.componentsPerAttribute,componentDatatype:Z.data.componentDatatype,offsetInBytes:Z.data.byteOffset,strideInBytes:Z.data.byteStride,normalize:Z.data.normalized})}for(V=0;V-1?Q(e):a.t(e.clampRegionEdge)?q(e):t>=k.ClampGroundPolygon&&t<=k.ClampObjectLine?j(e):t==k.ClampGroundAndObjectLineCache?q(e):z(e)},X.calcBoundingSphere=function(t,e,r){var n,A=t._fileType;return n=e.instanceIndex>-1?Q(e):a.t(e.clampRegionEdge)?q(e):A>=k.ClampGroundPolygon&&A<=k.ClampObjectLine?j(e):A==k.ClampGroundAndObjectLineCache?q(e):z(e),y.c.transform(n,r,n),n},X.calcBoundingRectangle=function(t,e){var r;return t._fileType===k.ClampGroundPolygon&&(r=function(t){var e,r,n=a.t(t.nCompressOptions)&&(t.nCompressOptions&c.VertexCompressOption.SVC_Vertex)===c.VertexCompressOption.SVC_Vertex,A=new P.n,E=t.vertexAttributes[0],i=E.componentsPerAttribute,C=1;n?(C=t.vertCompressConstant,r=new B.a(t.minVerticesValue.x,t.minVerticesValue.y,t.minVerticesValue.z),e=new Uint16Array(E.typedArray.buffer,E.typedArray.byteOffset,E.typedArray.byteLength/2)):e=new Float32Array(E.typedArray.buffer,E.typedArray.byteOffset,E.typedArray.byteLength/4);for(var s=[],y=0;y=1&&(_=l[D][F-1]),0!=F&&(d[I-6]=_.x,d[I-5]=_.y,d[I-4]=_.z,d[I-3]=_.x,d[I-2]=_.y,d[I-1]=_.z),F!=g-1&&(d[I]=_.x,d[I+1]=_.y,d[I+2]=_.z,d[I+3]=_.x,d[I+4]=_.y,d[I+5]=_.z),I=2*v+8*F,0!=F&&(L[I-4]=-1,L[I-3]=-1,L[I-2]=1,L[I-1]=-1),F!=g-1&&(L[I]=-1,L[I+1]=1,L[I+2]=1,L[I+3]=1)}T+=l[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:d,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:L,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._0x38df4a.TRIANGLES,n=0===o.indexType?new Uint16Array(o.indicesCount):new Uint32Array(o.indicesCount);for(var B=0,E=0;E96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}var A=0;for(a=0;a>i,y>>i);if(st0){e.getUint16(o+r,!0),o+=Uint16Array.BYTES_PER_ELEMENT,o+=2*Uint8Array.BYTES_PER_ELEMENT;var E=B*Uint8Array.BYTES_PER_ELEMENT*4;A=m(t,o,o+E),o+=E;var i=n.vertexAttributes,s=n.attrLocation;s.aColor=i.length,i.push({index:s.aColor,typedArray:A,componentsPerAttribute:4,componentDatatype:C.ComponentDatatype.UNSIGNED_BYTE,offsetInBytes:0,strideInBytes:4,normalize:!0})}return{bytesOffset:o}}function Yt(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 Jt(t,e,r,a,n){var A=n,o=[],B=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var E=0;E0){var c=0,u=null;1===s||3===s?(c=C*Uint32Array.BYTES_PER_ELEMENT,u=e.subarray(A,A+c)):(c=C*Uint16Array.BYTES_PER_ELEMENT,u=e.subarray(A,A+c),C%2!=0&&(c+=2)),i.indicesTypedArray=u,A+=c}i.indicesCount=C,i.indexType=s,i.primitiveType=y;var l=[],f=r.getUint32(A+a,!0);A+=Uint32Array.BYTES_PER_ELEMENT;for(var P=0;P=2&&(e.getInt32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT);var S,O={};O.posUniqueID=e.getInt32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT,O.normalUniqueID=e.getInt32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT,O.colorUniqueID=e.getInt32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT,O.secondColorUniqueID=e.getInt32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT,3===u?(S=e.getUint32(T+r,!0),T+=Int32Array.BYTES_PER_ELEMENT):(S=e.getUint16(T+r,!0),T+=Int16Array.BYTES_PER_ELEMENT);for(var h=[],R=0;R0){var Y=(J=mt(e,r,L,T)).string;T=J.bytesOffset,V.materialCode=Y,w.push(V)}3===u&&((Yt=(T+r)%4)&&(Yt=4-Yt),T+=Yt);var J,k=new Object,W=e.getUint32(T+r,!0),Z=m(L,T+=Int32Array.BYTES_PER_ELEMENT,T+W);if(H>0?N.dracoDecodeMesh(ut,Z,W,le,V,O,g,P,k,p):N.dracoDecodePointCloud(ut,Z,W,le,O),a.t(k.min)&&a.t(k.max)||(k=void 0),T+=W,3===u)(Yt=(T+r)%4)&&(Yt=4-Yt),(Yt=((T=(J=mt(e,r,L,T+=Yt)).bytesOffset)+r)%4)&&(Yt=4-Yt),T+=Yt;n[v]={vertexPackage:le,arrIndexPackage:w,cartographicBounds:k}}else if(_==dt&&3==u){var X=e.getUint32(T+r,!0);T+=Uint32Array.BYTES_PER_ELEMENT;var Q=e.getUint32(T+r,!0);T+=Uint32Array.BYTES_PER_ELEMENT,le.minVerticesValue=new E.a,le.minTexCoordValue=[new o.r,new o.r],le.texCoordCompressConstant=[new B.a,new B.a];w=[];for(var z=0;z0){var Ot=e.getInt8(T+r,!0);T+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(T+r,!0),T+=Int8Array.BYTES_PER_ELEMENT;var Nt=e.getInt8(T+r,!0);T+=Int8Array.BYTES_PER_ELEMENT,e.getInt8(T+r,!0),T+=Int8Array.BYTES_PER_ELEMENT;var ht,Rt,Gt=e.getInt32(T+r,!0);T+=Int32Array.BYTES_PER_ELEMENT,13!==Nt?(ht=new Uint8Array(e.buffer,T+r,Gt),T+=Uint8Array.BYTES_PER_ELEMENT*Gt):(ht=new Uint32Array(e.buffer,T+r,Gt),T+=Uint32Array.BYTES_PER_ELEMENT*Gt),(Yt=(T+r)%4)&&(Yt=4-Yt),T+=Yt,13!==Nt?(Rt=C.ComponentDatatype.createTypedArray(C.ComponentDatatype.UNSIGNED_BYTE,St*Uint32Array.BYTES_PER_ELEMENT),ot.decodeIndexBuffer(Rt,St,Uint32Array.BYTES_PER_ELEMENT,ht)):Rt=ht;var bt,xt=e.getInt32(T+r,!0);T+=Int32Array.BYTES_PER_ELEMENT,V.indexType=Ot,0===Ot?bt=new Uint16Array(St):1===Ot&&(bt=new Uint32Array(St)),V.indicesCount=St;var Ut=new Uint32Array(Rt.buffer,Rt.byteOffset,Rt.byteLength/4);bt.set(Ut,0),V.indicesTypedArray=bt,V.primitiveType=Nt;for(Et=0;Et0&&13!==Nt){var Ht=le.preVertexCount;V.indicesTypedArray=Ut.map((function(t){return t+Ht})),V.indexType=1}w.push(V),(Yt=(T+r)%4)&&(Yt=4-Yt),T+=Yt}}}le.nCompressOptions=X,2===w.length&&13===w[1].primitiveType&&w[1].indicesCount>=3&&(wt=c._0x5d8d50.createEdgeDataByIndices(le,w[1],s)),a.t(k.min)&&a.t(k.max)||(k=void 0),n[v]={vertexPackage:le,arrIndexPackage:w,edgeGeometry:wt,cartographicBounds:k}}else{var wt;if(_===Pt||_===ft)T=(Kt=Wt(u,L,e,r,T,le,i,g,P,p)).bytesOffset,k=Kt.cartographicBounds;else if(_===dt&&(T=(Kt=kt(L,e,r,T,le,i,g,P,p)).bytesOffset,k=Kt.cartographicBounds,3==u)){var Vt;T=(Vt=mt(e,r,L,T)).bytesOffset,le.customVertexAttribute=JSON.parse(Vt.string);var Yt;lt="aCustom"+le.customVertexAttribute.TextureCoordMatrix,gt="aCustom"+le.customVertexAttribute.VertexWeight,Ft="aCustom"+le.customVertexAttribute.VertexWeight_1;a.t(le.attrLocation[lt])&&(le.attrLocation.aTextureCoordMatrix=le.attrLocation[lt],delete le.attrLocation[lt]),a.t(le.attrLocation[gt])&&(le.attrLocation.aVertexWeight=le.attrLocation[gt],delete le.attrLocation[gt]),a.t(le.attrLocation[Ft])&&(le.attrLocation.aVertexWeight_1=le.attrLocation[Ft],delete le.attrLocation[Ft]);var Xt;for(vt=(Xt=Object.keys(le.attrLocation)).length,It=0;It=3&&(wt=c._0x5d8d50.createEdgeDataByIndices(le,w[1],s)),T=Kt.bytesOffset,a.t(k)&&a.t(k.min)&&a.t(k.max)||(k=void 0),n[v]={vertexPackage:le,arrIndexPackage:w,edgeGeometry:wt,cartographicBounds:k}}if(3!==u&&a.t(y)&&y){var zt=e.getUint16(T+r,!0);if(T+=Uint16Array.BYTES_PER_ELEMENT,1===zt){var jt=e.getUint32(T+r,!0);T+=Uint32Array.BYTES_PER_ELEMENT;var qt,$t=e.getUint32(T+r,!0);T+=Uint32Array.BYTES_PER_ELEMENT,e.getFloat32(T+r,!0),T+=Float32Array.BYTES_PER_ELEMENT;var te=new Array(jt),ae=new Array(jt),ne=new Array(jt),oe=new Array(jt);for(qt=0;qt-1e-10}function le(t,e,r,n,A,o,B,E){var i=new DataView(t),C=new Uint8Array(t),y=i.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var c=s.c(C,r,y);c=c.replace(/(\.s3mblock)|(\.s3mbz)|(\.s3mb)/gi,""),r+=y;var u=i.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;for(var l=0;l=3&&(i.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT),i.getUint32(r,!0),r+=Uint32Array.BYTES_PER_ELEMENT;var I=i.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;var M=new Uint8Array(t,r,I),m=r+I,_=p.pako.inflate(M).buffer;E.push(_),i=new DataView(_);C=new Uint8Array(_);r=0;var S=i.getUint32(r,!0),O=Mt(i,_,r+=Uint32Array.BYTES_PER_ELEMENT),N=O.buffer;r=O.byteOffset;var h=ie(v,N,i,O.dataViewByteOffset),R=r%4;0!==R&&(r+=4-R),ae((O=Mt(i,_,r)).buffer,i,O.dataViewByteOffset,F,!1,void 0,void 0,v),r=O.byteOffset,3!==v&&((O=Mt(i,_,r)).buffer,r=O.byteOffset);var G={};!function(t,e,r,n,A,o,B,E,i,C){var y=E,c=B.getUint32(y,!0);y+=Uint32Array.BYTES_PER_ELEMENT;for(var u={},l=0;lm[5]?m[4]:m[5];L={left:_,top:S,right:O,bottom:N,minHeight:h,maxHeight:R,width:(P=new It(_,N,O,S,h,R)).width,length:P.length,height:P.height};var G=new Uint32Array(F,48+M,7),b=G[0],x=G[1],U=G[2],K=G[3];T={nFormat:b,nSideBlockCount:x,nBlockLength:U,nLength:K,nWidth:G[4],nHeight:G[5],nDepth:G[6],imageArray:new Uint8Array(F,76+M,K*K*4)}}}var H=0,w={};w.ignoreNormal=e.ignoreNormal;var V=e.rootBatchIdMap||{},Y=e.ancestorMap||{},J={},k=new DataView(n),W=k.getFloat32(H,!0);if(H+=Float32Array.BYTES_PER_ELEMENT,C)return k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT,le(n,n.byteLength,H,V,Y,e.isRoot,J,r),J;var Z=!1;if(W>=3&&(k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),W>=2&&(k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),ue(W-1)||ue(W-2)||ue(W-3)||W>2.09&&W<2.11){var Q=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT;var z=new Uint8Array(n,H,Q);n=p.pako.inflate(z).buffer,r.push(n),k=new DataView(n),H=0}else if(W>1.199&&W<1.201){Q=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT,r.push(n)}else{Z=!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;g=new Uint8Array(n,H);n=p.pako.inflate(g).buffer,r.push(n),k=new DataView(n),H=0}}var j=k.getUint32(H,!0),q=Mt(k,n,H+=Uint32Array.BYTES_PER_ELEMENT),$=q.buffer;H=q.byteOffset;var tt={},et=ie(W,$,k,q.dataViewByteOffset,tt,f),rt=H%4;0!==rt&&(H+=4-rt);var at=W>2.09&&3!==W;if(ae((q=Mt(k,n,H)).buffer,k,q.dataViewByteOffset,w,Z,r,at,W,y,tt,l,e.fileType,f),H=q.byteOffset,at)for(var nt=0;ntd.S3MPixelFormat.BGR||p===d.S3MPixelFormat.LUMINANCE_ALPHA?(T=new Uint8Array(u*l*4),L=new Uint8Array(e.buffer,L.byteOffset,u*l)):(T=new Uint16Array(u*l),L=new Uint16Array(e.buffer,L.byteOffset,P/2)),c.d.decode(T,u,l,L,p),A.push(T.buffer),f=0):T=L,n[C]={id:C,width:u,height:l,compressType:f,oriCompressType:D,nFormat:p,imageBuffer:T,mipmapLevel:y}}}(E,(q=Mt(k,n,H)).buffer,k,q.dataViewByteOffset,yt,r),H=q.byteOffset;var ct=k.getUint32(H,!0);H+=Uint32Array.BYTES_PER_ELEMENT;var ut=new Uint8Array(n).subarray(H,H+ct),ft=s.c(ut);H+=ct,ft=ft.replace(/\n\0/,"");var Pt=JSON.parse(ft);(3===W&&(j=k.getUint32(H,!0),H+=Uint32Array.BYTES_PER_ELEMENT),(j<)==lt)&&ce((q=Mt(k,n,H)).buffer,k,q.dataViewByteOffset,w,W);if(1==W){var dt=et.pageLods,pt=!0;for(nt=0;nt65535?new Uint32Array(s):new Uint16Array(s),f=0;for(i=0,C=o.length;i