text: define(["./AttributeCompression-1f045b73","./Matrix2-ccd5b911","./combine-83860057","./IndexDatatype-b7d979a6","./ComponentDatatype-93750d1a","./createTaskProcessorWorker","./RuntimeError-346a3079","./when-4bbc8319","./WebGLConstants-1c8239cc"],function(B,T,V,W,z,a,e,t,r){"use strict";var q=32767,i=Math.cos(z.CesiumMath.toRadians(150)),L=new T.Cartographic,_=new T.Cartesian3;var G=new T.Cartographic,Z=new T.Cartographic;function Y(a){var e=8*a,t=3*e,r=4*e;this.startEllipsoidNormals=new Float32Array(t),this.endEllipsoidNormals=new Float32Array(t),this.startPositionAndHeights=new Float32Array(r),this.startFaceNormalAndVertexCornerIds=new Float32Array(r),this.endPositionAndHeights=new Float32Array(r),this.endFaceNormalAndHalfWidths=new Float32Array(r),this.vertexBatchIds=new Uint16Array(e),this.indices=W.IndexDatatype.createTypedArray(e,36*a),this.vec3Offset=0,this.vec4Offset=0,this.batchIdOffset=0,this.indexOffset=0,this.volumeStartIndex=0}var o=new T.Cartesian3,d=new T.Cartesian3;function H(a,e,t,r,s){var n=T.Cartesian3.subtract(t,e,d),t=T.Cartesian3.subtract(e,a,o);return T.Cartesian3.normalize(n,n),T.Cartesian3.normalize(t,t),T.Cartesian3.dot(n,t)<i&&(t=T.Cartesian3.multiplyByScalar(t,-1,o)),T.Cartesian3.add(n,t,s),T.Cartesian3.equals(s,T.Cartesian3.ZERO)&&(s=T.Cartesian3.subtract(a,e)),T.Cartesian3.cross(s,r,s),T.Cartesian3.cross(r,s,s),T.Cartesian3.normalize(s,s),s}var O=[0,2,6,0,6,4,0,1,3,0,3,2,0,4,5,0,5,1,5,3,1,5,7,3,7,5,4,7,4,6,7,6,2,7,2,3],P=O.length,D=new T.Cartesian3,S=new T.Cartesian3,M=new T.Cartesian3,R=new T.Cartesian3,U=new T.Cartesian3;Y.prototype.addVolume=function(a,e,t,r,s,n,i,o,d,c){for(var l=T.Cartesian3.add(e,d,D),f=c.geodeticSurfaceNormal(l,S),l=T.Cartesian3.add(t,d,D),h=c.geodeticSurfaceNormal(l,R),u=H(a,e,t,f,M),C=H(r,t,e,h,U),p=this.startEllipsoidNormals,m=this.endEllipsoidNormals,b=this.startPositionAndHeights,A=this.startFaceNormalAndVertexCornerIds,v=this.endPositionAndHeights,w=this.endFaceNormalAndHalfWidths,g=this.vertexBatchIds,y=this.batchIdOffset,N=this.vec3Offset,k=this.vec4Offset,I=0;I<8;I++)T.Cartesian3.pack(f,p,N),T.Cartesian3.pack(h,m,N),T.Cartesian3.pack(e,b,k),b[k+3]=s,T.Cartesian3.pack(t,v,k),v[k+3]=n,T.Cartesian3.pack(u,A,k),A[k+3]=I,T.Cartesian3.pack(C,w,k),w[k+3]=i,g[y++]=o,N+=3,k+=4;this.batchIdOffset=y,this.vec3Offset=N,this.vec4Offset=k;var x=this.indices,E=this.volumeStartIndex,F=this.indexOffset;for(I=0;I<P;I++)x[F+I]=O[I]+E;this.volumeStartIndex+=8,this.indexOffset+=P};var j=new T.Rectangle,J=new T.Ellipsoid,K=new T.Cartesian3,Q=new T.Cartesian3,X=new T.Cartesian3,$=new T.Cartesian3,aa=new T.Cartesian3;return a(function(a,e){var t=new Uint16Array(a.positions),r=new Uint16Array(a.widths),s=new Uint32Array(a.counts),n=new Uint16Array(a.batchIds),i=j,o=J,d=K,c=new Float64Array(a.packedBuffer),l=0,f=c[l++],h=c[l++];T.Rectangle.unpack(c,2,i),l+=T.Rectangle.packedLength,T.Ellipsoid.unpack(c,l,o),l+=T.Ellipsoid.packedLength,T.Cartesian3.unpack(c,l,d);var u=t.length/3,c=t.subarray(0,u),l=t.subarray(u,2*u),C=t.subarray(2*u,3*u);B.AttributeCompression.zigZagDeltaDecode(c,l,C),function(a,e,t,r){for(var s=r.length,n=a.length,i=new Uint8Array(n),o=G,d=Z,c=0,l=0;l<s;l++){for(var f=r[l],h=f,u=1;u<f;u++){var C=c+u,p=C-1;d.longitude=a[C],d.latitude=e[C],o.longitude=a[p],o.latitude=e[p],T.Cartographic.equals(d,o)&&(h--,i[p]=1)}r[l]=h,c+=f}for(var m=0,b=0;b<n;b++)1!==i[b]&&(a[m]=a[b],e[m]=e[b],t[m]=t[b],m++)}(c,l,C,s);for(var p=s.length,m=0,b=0;b<p;b++)m+=s[b]-1;var A=new Y(m),v=function(a,e,t,r,s,n,i){for(var o=a.length,d=new Float64Array(3*o),c=0;c<o;++c){var l=a[c],f=e[c],h=t[c],l=z.CesiumMath.lerp(r.west,r.east,l/q),f=z.CesiumMath.lerp(r.south,r.north,f/q),h=z.CesiumMath.lerp(s,n,h/q),h=T.Cartographic.fromRadians(l,f,h,L),h=i.cartographicToCartesian(h,_);T.Cartesian3.pack(h,d,3*c)}return d}(c,l,C,i,f,h,o),u=c.length,w=new Float32Array(3*u);for(b=0;b<u;++b)w[3*b]=v[3*b]-d.x,w[3*b+1]=v[3*b+1]-d.y,w[3*b+2]=v[3*b+2]-d.z;var g=0,y=0;for(b=0;b<p;b++){for(var N=s[b]-1,k=.5*r[b],I=n[b],x=g,E=0;E<N;E++){var F=T.Cartesian3.unpack(w,g,X),H=T.Cartesian3.unpack(w,g+3,$),O=C[y],P=C[y+1],O=z.CesiumMath.lerp(f,h,O/q),P=z.CesiumMath.lerp(f,h,P/q);y++;var D,S,M,R=Q,U=aa;0===E?(S=T.Cartesian3.unpack(w,D=x+3*N,Q),T.Cartesian3.equals(S,F)?T.Cartesian3.unpack(w,D-3,R):(M=T.Cartesian3.subtract(F,H,Q),R=T.Cartesian3.add(M,F,Q))):T.Cartesian3.unpack(w,g-3,R),E===N-1?(M=T.Cartesian3.unpack(w,x,aa),T.Cartesian3.equals(M,H)?T.Cartesian3.unpack(w,x+3,U):(M=T.Cartesian3.subtract(H,F,aa),U=T.Cartesian3.add(M,H,aa))):T.Cartesian3.unpack(w,g+6,U),A.addVolume(R,F,H,U,O,P,k,I,d,o),g+=3}g+=3,y++}return c=A.indices,e.push(A.startEllipsoidNormals.buffer),e.push(A.endEllipsoidNormals.buffer),e.push(A.startPositionAndHeights.buffer),e.push(A.startFaceNormalAndVertexCornerIds.buffer),e.push(A.endPositionAndHeights.buffer),e.push(A.endFaceNormalAndHalfWidths.buffer),e.push(A.vertexBatchIds.buffer),e.push(c.buffer),c={indexDatatype:2===c.BYTES_PER_ELEMENT?W.IndexDatatype.UNSIGNED_SHORT:W.IndexDatatype.UNSIGNED_INT,startEllipsoidNormals:A.startEllipsoidNormals.buffer,endEllipsoidNormals:A.endEllipsoidNormals.buffer,startPositionAndHeights:A.startPositionAndHeights.buffer,startFaceNormalAndVertexCornerIds:A.startFaceNormalAndVertexCornerIds.buffer,endPositionAndHeights:A.endPositionAndHeights.buffer,endFaceNormalAndHalfWidths:A.endFaceNormalAndHalfWidths.buffer,vertexBatchIds:A.vertexBatchIds.buffer,indices:c.buffer},a.keepDecodedPositions&&(a=function(a){for(var e=a.length,t=new Uint32Array(e+1),r=0,s=0;s<e;++s)t[s]=r,r+=a[s];return t[e]=r,t}(s),e.push(v.buffer,a.buffer),c=V.combine(c,{decodedPositions:v.buffer,decodedPositionOffsets:a.buffer})),c})});
  