define(["./AxisAlignedBoundingBox-be6909d8","./Transforms-3e1dc9c2","./Matrix2-52f9f880","./defaultValue-69ee94f4","./TerrainEncoding-59543c99","./ComponentDatatype-a9820060","./OrientedBoundingBox-9a45cb70","./RuntimeError-ac440aa5","./WebMercatorProjection-6f83725a","./createTaskProcessorWorker","./_commonjsHelpers-3aae1032-15991586","./combine-0259f56f","./PixelFormat-9ceadbf3","./WebGLConstants-f63312fc","./AttributeCompression-5e4af6de","./EllipsoidTangentPlane-6299303d","./IntersectionTests-088640d2","./Plane-e5b2f6e0"],(function(t,e,n,i,o,a,r,s,c,u,h,l,d,g,m,p,f,I){"use strict";const E=Uint16Array.BYTES_PER_ELEMENT,T=Int32Array.BYTES_PER_ELEMENT,C=Uint32Array.BYTES_PER_ELEMENT,M=Float32Array.BYTES_PER_ELEMENT,x=Float64Array.BYTES_PER_ELEMENT;function N(t,e,n){n=i.defaultValue(n,a.CesiumMath);const o=t.length;for(let i=0;i0&&r.push(r[E]),s.length>0&&s.push(s[E]),n.Matrix4.multiplyByPoint(u.toENU,N,S);const P=u.minimum,w=u.maximum;n.Cartesian3.minimumByComponent(S,P,P),n.Cartesian3.maximumByComponent(S,w,w);const B=u.lastBorderPoint;if(i.defined(B)){const t=B.index;c.push(t,T-1,T,T,E,t)}u.lastBorderPoint=f}}return u((function(u,h){u.ellipsoid=n.Ellipsoid.clone(u.ellipsoid),u.rectangle=n.Rectangle.clone(u.rectangle);const l=function(u,h,l,d,g,m,p,f,I,y,R){let _,F,W,v,O,V;i.defined(d)?(_=d.west,F=d.south,W=d.east,v=d.north,O=d.width,V=d.height):(_=a.CesiumMath.toRadians(g.west),F=a.CesiumMath.toRadians(g.south),W=a.CesiumMath.toRadians(g.east),v=a.CesiumMath.toRadians(g.north),O=a.CesiumMath.toRadians(d.width),V=a.CesiumMath.toRadians(d.height));const Y=[F,v],H=[_,W],U=e.Transforms.eastNorthUpToFixedFrame(h,l),k=n.Matrix4.inverseTransformation(U,B);let L,j;I&&(L=c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(F),j=1/(c.WebMercatorProjection.geodeticLatitudeToMercatorAngle(v)-L));const D=1!==m,G=new DataView(u);let z=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY;const J=P;J.x=Number.POSITIVE_INFINITY,J.y=Number.POSITIVE_INFINITY,J.z=Number.POSITIVE_INFINITY;const K=w;K.x=Number.NEGATIVE_INFINITY,K.y=Number.NEGATIVE_INFINITY,K.z=Number.NEGATIVE_INFINITY;let Q,X,Z=0,$=0,tt=0;for(X=0;X<4;++X){let t=Z;Q=G.getUint32(t,!0),t+=C;const e=a.CesiumMath.toRadians(180*G.getFloat64(t,!0));t+=x,-1===N(H,e)&&H.push(e);const n=a.CesiumMath.toRadians(180*G.getFloat64(t,!0));t+=x,-1===N(Y,n)&&Y.push(n),t+=2*x;let i=G.getInt32(t,!0);t+=T,$+=i,i=G.getInt32(t,!0),tt+=3*i,Z+=Q+C}const et=[],nt=[],it=new Array($),ot=new Array($),at=new Array($),rt=I?new Array($):[],st=D?new Array($):[],ct=new Array(tt),ut=[],ht=[],lt=[],dt=[];let gt=0,mt=0;for(Z=0,X=0;X<4;++X){Q=G.getUint32(Z,!0),Z+=C;const t=Z,e=a.CesiumMath.toRadians(180*G.getFloat64(Z,!0));Z+=x;const i=a.CesiumMath.toRadians(180*G.getFloat64(Z,!0));Z+=x;const o=a.CesiumMath.toRadians(180*G.getFloat64(Z,!0)),r=.5*o;Z+=x;const u=a.CesiumMath.toRadians(180*G.getFloat64(Z,!0)),h=.5*u;Z+=x;const d=G.getInt32(Z,!0);Z+=T;const g=G.getInt32(Z,!0);Z+=T,Z+=T;const m=new Array(d);for(let t=0;t0&&dt.length>0){const t=ut[0].index,e=pt,n=dt[dt.length-1].index,i=it.length-1;ct.push(n,i,e,e,t,n)}$=it.length;const Tt=e.BoundingSphere.fromPoints(it);let Ct;i.defined(d)&&(Ct=r.OrientedBoundingBox.fromRectangle(d,z,q,l));const Mt=new o.EllipsoidalOccluder(l).computeHorizonCullingPointPossiblyUnderEllipsoid(h,it,z),xt=new t.AxisAlignedBoundingBox(J,K,h),Nt=new o.TerrainEncoding(h,xt,It.hMin,q,U,!1,I,D,m,p),bt=new Float32Array($*Nt.stride);let St=0;for(let t=0;t<$;++t)St=Nt.encode(bt,St,it[t],ot[t],at[t],void 0,rt[t],st[t]);const Pt=ut.map((function(t){return t.index})).reverse(),wt=ht.map((function(t){return t.index})).reverse(),Bt=lt.map((function(t){return t.index})).reverse(),At=dt.map((function(t){return t.index})).reverse();return wt.unshift(Bt[Bt.length-1]),wt.push(Pt[0]),At.unshift(Pt[Pt.length-1]),At.push(Bt[0]),{vertices:bt,indices:new Uint16Array(ct),maximumHeight:q,minimumHeight:z,encoding:Nt,boundingSphere3D:Tt,orientedBoundingBox:Ct,occludeePointInScaledSpace:Mt,vertexCountWithoutSkirts:pt,indexCountWithoutSkirts:ft,westIndicesSouthToNorth:Pt,southIndicesEastToWest:wt,eastIndicesNorthToSouth:Bt,northIndicesWestToEast:At}}(u.buffer,u.relativeToCenter,u.ellipsoid,u.rectangle,u.nativeRectangle,u.exaggeration,u.exaggerationRelativeHeight,u.skirtHeight,u.includeWebMercatorT,u.negativeAltitudeExponentBias,u.negativeElevationThreshold),d=l.vertices;h.push(d.buffer);const g=l.indices;return h.push(g.buffer),{vertices:d.buffer,indices:g.buffer,numberOfAttributes:l.encoding.stride,minimumHeight:l.minimumHeight,maximumHeight:l.maximumHeight,boundingSphere3D:l.boundingSphere3D,orientedBoundingBox:l.orientedBoundingBox,occludeePointInScaledSpace:l.occludeePointInScaledSpace,encoding:l.encoding,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,indexCountWithoutSkirts:l.indexCountWithoutSkirts,westIndicesSouthToNorth:l.westIndicesSouthToNorth,southIndicesEastToWest:l.southIndicesEastToWest,eastIndicesNorthToSouth:l.eastIndicesNorthToSouth,northIndicesWestToEast:l.northIndicesWestToEast}}))}));