/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.126
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
import{a as tt}from"./chunk-NZWLV2A4.js";import{a as At}from"./chunk-YGC52UMX.js";import{a as yt}from"./chunk-XLESIVYV.js";import{a as G}from"./chunk-WDSHVSF7.js";import{a as z}from"./chunk-HZQ2LRMY.js";import{a as at}from"./chunk-E25VRLIZ.js";import{a as ht}from"./chunk-FZEJ65E6.js";import{b as mt,c as st,d as S}from"./chunk-SPFUTSGC.js";import{a as dt,d as rt}from"./chunk-E2NX4UJ2.js";import{f as it,h as bt}from"./chunk-JBPQP6LH.js";import{a as F}from"./chunk-NLPIV6OK.js";import{a,b as _t,c as W,d as v,e as R}from"./chunk-IIT3SHXK.js";import{a as I}from"./chunk-DLCTHPIV.js";import{a as T}from"./chunk-I2ICH2LD.js";import{a as nt,b as H}from"./chunk-R6A52HT4.js";import{e as K}from"./chunk-D32DZSEC.js";var et=new a,pt=new a,xt=new a,wt=new a,w=new W,Mt=new R,Vt=new R,gt=new it,Tt=new a,Nt=new a,Et=new a,lt=new _t,Pt=new a,Ft=new W,St=new W;function Ot(t,e,i){let o=e.vertexFormat,r=e.center,n=e.semiMajorAxis,s=e.semiMinorAxis,l=e.ellipsoid,u=e.stRotation,m=i?t.length/3*2:t.length/3,c=e.shadowVolume,p=o.st?new Float32Array(2*m):void 0,f=o.normal?new Float32Array(3*m):void 0,h=o.tangent?new Float32Array(3*m):void 0,d=o.bitangent?new Float32Array(3*m):void 0,y=c?new Float32Array(3*m):void 0,A=0,x=Tt,g=Nt,_=Et,T=new dt(l),b=T.project(l.cartesianToCartographic(r,lt),Pt),I=l.scaleToGeodeticSurface(r,et);l.geodeticSurfaceNormal(I,I);let v=Mt,N=Vt;if(0!==u){let t=it.fromAxisAngle(I,u,gt);v=R.fromQuaternion(t,v),t=it.fromAxisAngle(I,-u,gt),N=R.fromQuaternion(t,N)}else v=R.clone(R.IDENTITY,v),N=R.clone(R.IDENTITY,N);let E=W.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Ft),M=W.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,St),P=t.length,j=i?P:0,O=j/3*2;for(let F=0;F<P;F+=3){let e=F+1,r=F+2,u=a.fromArray(t,F,et);if(o.st){let t=R.multiplyByVector(v,u,pt),e=T.project(l.cartesianToCartographic(t,lt),xt);a.subtract(e,b,e),w.x=(e.x+n)/(2*n),w.y=(e.y+s)/(2*s),E.x=Math.min(w.x,E.x),E.y=Math.min(w.y,E.y),M.x=Math.max(w.x,M.x),M.y=Math.max(w.y,M.y),i&&(p[A+O]=w.x,p[A+1+O]=w.y),p[A++]=w.x,p[A++]=w.y}(o.normal||o.tangent||o.bitangent||c)&&(x=l.geodeticSurfaceNormal(u,x),c&&(y[F+j]=-x.x,y[e+j]=-x.y,y[r+j]=-x.z),(o.normal||o.tangent||o.bitangent)&&((o.tangent||o.bitangent)&&(g=a.normalize(a.cross(a.UNIT_Z,x,g),g),R.multiplyByVector(N,g,g)),o.normal&&(f[F]=x.x,f[e]=x.y,f[r]=x.z,i&&(f[F+j]=-x.x,f[e+j]=-x.y,f[r+j]=-x.z)),o.tangent&&(h[F]=g.x,h[e]=g.y,h[r]=g.z,i&&(h[F+j]=-g.x,h[e+j]=-g.y,h[r+j]=-g.z)),o.bitangent&&(_=a.normalize(a.cross(x,g,_),_),d[F]=_.x,d[e]=_.y,d[r]=_.z,i&&(d[F+j]=_.x,d[e+j]=_.y,d[r+j]=_.z))))}if(o.st){P=p.length;for(let t=0;t<P;t+=2)p[t]=(p[t]-E.x)/(M.x-E.x),p[t+1]=(p[t+1]-E.y)/(M.y-E.y)}let L=new ht;if(o.position){let o=tt.raisePositionsToHeight(t,e,i);L.position=new S({componentDatatype:F.DOUBLE,componentsPerAttribute:3,values:o})}if(o.st&&(L.st=new S({componentDatatype:F.FLOAT,componentsPerAttribute:2,values:p})),o.normal&&(L.normal=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:f})),o.tangent&&(L.tangent=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:h})),o.bitangent&&(L.bitangent=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:d})),c&&(L.extrudeDirection=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:y})),i&&K(e.offsetAttribute)){let t=new Uint8Array(m);if(e.offsetAttribute===G.TOP)t=t.fill(1,0,m/2);else{let i=e.offsetAttribute===G.NONE?0:1;t=t.fill(i)}L.applyOffset=new S({componentDatatype:F.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}return L}function jt(t){let e,i,o,r,n,a=new Array(t*(t+1)*12-6),s=0;for(e=0,o=1,r=0;r<3;r++)a[s++]=o++,a[s++]=e,a[s++]=o;for(r=2;r<t+1;++r){for(o=r*(r+1)-1,e=(r-1)*r-1,a[s++]=o++,a[s++]=e,a[s++]=o,i=2*r,n=0;n<i-1;++n)a[s++]=o,a[s++]=e++,a[s++]=e,a[s++]=o++,a[s++]=e,a[s++]=o;a[s++]=o++,a[s++]=e,a[s++]=o}for(i=2*t,++o,++e,r=0;r<i-1;++r)a[s++]=o,a[s++]=e++,a[s++]=e,a[s++]=o++,a[s++]=e,a[s++]=o;for(a[s++]=o,a[s++]=e++,a[s++]=e,a[s++]=o++,a[s++]=e++,a[s++]=e,++e,r=t-1;r>1;--r){for(a[s++]=e++,a[s++]=e,a[s++]=o,i=2*r,n=0;n<i-1;++n)a[s++]=o,a[s++]=e++,a[s++]=e,a[s++]=o++,a[s++]=e,a[s++]=o;a[s++]=e++,a[s++]=e++,a[s++]=o++}for(r=0;r<3;r++)a[s++]=e++,a[s++]=e,a[s++]=o;return a}var X=new a;function Dt(t){let e=t.center;X=a.multiplyByScalar(t.ellipsoid.geodeticSurfaceNormal(e,X),t.height,X),X=a.add(e,X,X);let i=new rt(X,t.semiMajorAxis),o=tt.computeEllipsePositions(t,!0,!1),r=o.positions,n=o.numPts,s=Ot(r,t,!1),l=jt(n);return l=at.createTypedArray(r.length/3,l),{boundingSphere:i,attributes:s,indices:l}}function vt(t,e){let i=e.vertexFormat,o=e.center,r=e.semiMajorAxis,n=e.semiMinorAxis,s=e.ellipsoid,l=e.height,u=e.extrudedHeight,m=e.stRotation,c=t.length/3*2,p=new Float64Array(3*c),f=i.st?new Float32Array(2*c):void 0,h=i.normal?new Float32Array(3*c):void 0,d=i.tangent?new Float32Array(3*c):void 0,y=i.bitangent?new Float32Array(3*c):void 0,A=e.shadowVolume,x=A?new Float32Array(3*c):void 0,g=0,_=Tt,T=Nt,b=Et,I=new dt(s),v=I.project(s.cartesianToCartographic(o,lt),Pt),N=s.scaleToGeodeticSurface(o,et);s.geodeticSurfaceNormal(N,N);let E=it.fromAxisAngle(N,m,gt),M=R.fromQuaternion(E,Mt),P=W.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Ft),j=W.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,St),O=t.length,L=O/3*2;for(let F=0;F<O;F+=3){let e,o=F+1,m=F+2,c=a.fromArray(t,F,et);if(i.st){let t=R.multiplyByVector(M,c,pt),e=I.project(s.cartesianToCartographic(t,lt),xt);a.subtract(e,v,e),w.x=(e.x+r)/(2*r),w.y=(e.y+n)/(2*n),P.x=Math.min(w.x,P.x),P.y=Math.min(w.y,P.y),j.x=Math.max(w.x,j.x),j.y=Math.max(w.y,j.y),f[g+L]=w.x,f[g+1+L]=w.y,f[g++]=w.x,f[g++]=w.y}c=s.scaleToGeodeticSurface(c,c),e=a.clone(c,pt),_=s.geodeticSurfaceNormal(c,_),A&&(x[F+O]=-_.x,x[o+O]=-_.y,x[m+O]=-_.z);let N=a.multiplyByScalar(_,l,wt);if(c=a.add(c,N,c),N=a.multiplyByScalar(_,u,N),e=a.add(e,N,e),i.position&&(p[F+O]=e.x,p[o+O]=e.y,p[m+O]=e.z,p[F]=c.x,p[o]=c.y,p[m]=c.z),i.normal||i.tangent||i.bitangent){b=a.clone(_,b);let r=a.fromArray(t,(F+3)%O,wt);a.subtract(r,c,r);let n=a.subtract(e,c,xt);_=a.normalize(a.cross(n,r,_),_),i.normal&&(h[F]=_.x,h[o]=_.y,h[m]=_.z,h[F+O]=_.x,h[o+O]=_.y,h[m+O]=_.z),i.tangent&&(T=a.normalize(a.cross(b,_,T),T),d[F]=T.x,d[o]=T.y,d[m]=T.z,d[F+O]=T.x,d[F+1+O]=T.y,d[F+2+O]=T.z),i.bitangent&&(y[F]=b.x,y[o]=b.y,y[m]=b.z,y[F+O]=b.x,y[o+O]=b.y,y[m+O]=b.z)}}if(i.st){O=f.length;for(let t=0;t<O;t+=2)f[t]=(f[t]-P.x)/(j.x-P.x),f[t+1]=(f[t+1]-P.y)/(j.y-P.y)}let k=new ht;if(i.position&&(k.position=new S({componentDatatype:F.DOUBLE,componentsPerAttribute:3,values:p})),i.st&&(k.st=new S({componentDatatype:F.FLOAT,componentsPerAttribute:2,values:f})),i.normal&&(k.normal=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:h})),i.tangent&&(k.tangent=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:d})),i.bitangent&&(k.bitangent=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:y})),A&&(k.extrudeDirection=new S({componentDatatype:F.FLOAT,componentsPerAttribute:3,values:x})),K(e.offsetAttribute)){let t=new Uint8Array(c);if(e.offsetAttribute===G.TOP)t=t.fill(1,0,c/2);else{let i=e.offsetAttribute===G.NONE?0:1;t=t.fill(i)}k.applyOffset=new S({componentDatatype:F.UNSIGNED_BYTE,componentsPerAttribute:1,values:t})}return k}function zt(t){let e=t.length/3,i=at.createTypedArray(e,6*e),o=0;for(let r=0;r<e;r++){let t=r,n=r+e,a=(t+1)%e,s=a+e;i[o++]=t,i[o++]=n,i[o++]=a,i[o++]=a,i[o++]=n,i[o++]=s}return i}var ut=new rt,ft=new rt;function Bt(t){let e=t.center,i=t.ellipsoid,o=t.semiMajorAxis,r=a.multiplyByScalar(i.geodeticSurfaceNormal(e,et),t.height,et);ut.center=a.add(e,r,ut.center),ut.radius=o,r=a.multiplyByScalar(i.geodeticSurfaceNormal(e,r),t.extrudedHeight,r),ft.center=a.add(e,r,ft.center),ft.radius=o;let n=tt.computeEllipsePositions(t,!0,!0),s=n.positions,l=n.numPts,u=n.outerPositions,m=rt.union(ut,ft),c=Ot(s,t,!0),p=jt(l),f=p.length;p.length=2*f;let h=s.length/3;for(let a=0;a<f;a+=3)p[a+f]=p[a+2]+h,p[a+1+f]=p[a+1]+h,p[a+2+f]=p[a]+h;let d=at.createTypedArray(2*h/3,p),y=new st({attributes:c,indices:d,primitiveType:mt.TRIANGLES}),A=vt(u,t);p=zt(u);let x=at.createTypedArray(2*u.length/3,p),g=new st({attributes:A,indices:x,primitiveType:mt.TRIANGLES}),_=yt.combineInstances([new At({geometry:y}),new At({geometry:g})]);return{boundingSphere:m,attributes:_[0].attributes,indices:_[0].indices}}function Ct(t,e,i,o,r,n,s){let l=tt.computeEllipsePositions({center:t,semiMajorAxis:e,semiMinorAxis:i,rotation:o,granularity:r},!1,!0).outerPositions,u=l.length/3,m=new Array(u);for(let p=0;p<u;++p)m[p]=a.fromArray(l,3*p);let c=bt.fromCartesianArray(m,n,s);return c.width>I.PI&&(c.north=c.north>0?I.PI_OVER_TWO-I.EPSILON7:c.north,c.south=c.south<0?I.EPSILON7-I.PI_OVER_TWO:c.south,c.east=I.PI,c.west=-I.PI),c}function U(t){t=T(t,T.EMPTY_OBJECT);let e=t.center,i=T(t.ellipsoid,v.default),o=t.semiMajorAxis,r=t.semiMinorAxis,n=T(t.granularity,I.RADIANS_PER_DEGREE),s=T(t.vertexFormat,z.DEFAULT);if(H.defined("options.center",e),H.typeOf.number("options.semiMajorAxis",o),H.typeOf.number("options.semiMinorAxis",r),o<r)throw new nt("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(n<=0)throw new nt("granularity must be greater than zero.");let l=T(t.height,0),u=T(t.extrudedHeight,l);this._center=a.clone(e),this._semiMajorAxis=o,this._semiMinorAxis=r,this._ellipsoid=v.clone(i),this._rotation=T(t.rotation,0),this._stRotation=T(t.stRotation,0),this._height=Math.max(u,l),this._granularity=n,this._vertexFormat=z.clone(s),this._extrudedHeight=Math.min(u,l),this._shadowVolume=T(t.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=t.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}U.packedLength=a.packedLength+v.packedLength+z.packedLength+9,U.pack=function(t,e,i){return H.defined("value",t),H.defined("array",e),i=T(i,0),a.pack(t._center,e,i),i+=a.packedLength,v.pack(t._ellipsoid,e,i),i+=v.packedLength,z.pack(t._vertexFormat,e,i),i+=z.packedLength,e[i++]=t._semiMajorAxis,e[i++]=t._semiMinorAxis,e[i++]=t._rotation,e[i++]=t._stRotation,e[i++]=t._height,e[i++]=t._granularity,e[i++]=t._extrudedHeight,e[i++]=t._shadowVolume?1:0,e[i]=T(t._offsetAttribute,-1),e};var Rt=new a,It=new v,Lt=new z,Y={center:Rt,ellipsoid:It,vertexFormat:Lt,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};function kt(t){let e=-t._stRotation;if(0===e)return[0,0,0,1,1,0];let i=tt.computeEllipsePositions({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,rotation:t._rotation,granularity:t._granularity},!1,!0).outerPositions,o=i.length/3,r=new Array(o);for(let l=0;l<o;++l)r[l]=a.fromArray(i,3*l);let n=t._ellipsoid,s=t.rectangle;return st._textureCoordinateRotationPoints(r,e,n,s)}U.unpack=function(t,e,i){H.defined("array",t),e=T(e,0);let o=a.unpack(t,e,Rt);e+=a.packedLength;let r=v.unpack(t,e,It);e+=v.packedLength;let n=z.unpack(t,e,Lt);e+=z.packedLength;let s=t[e++],l=t[e++],u=t[e++],m=t[e++],c=t[e++],p=t[e++],f=t[e++],h=1===t[e++],d=t[e];return K(i)?(i._center=a.clone(o,i._center),i._ellipsoid=v.clone(r,i._ellipsoid),i._vertexFormat=z.clone(n,i._vertexFormat),i._semiMajorAxis=s,i._semiMinorAxis=l,i._rotation=u,i._stRotation=m,i._height=c,i._granularity=p,i._extrudedHeight=f,i._shadowVolume=h,i._offsetAttribute=-1===d?void 0:d,i):(Y.height=c,Y.extrudedHeight=f,Y.granularity=p,Y.stRotation=m,Y.rotation=u,Y.semiMajorAxis=s,Y.semiMinorAxis=l,Y.shadowVolume=h,Y.offsetAttribute=-1===d?void 0:d,new U(Y))},U.computeRectangle=function(t,e){t=T(t,T.EMPTY_OBJECT);let i=t.center,o=T(t.ellipsoid,v.default),r=t.semiMajorAxis,n=t.semiMinorAxis,a=T(t.granularity,I.RADIANS_PER_DEGREE),s=T(t.rotation,0);if(H.defined("options.center",i),H.typeOf.number("options.semiMajorAxis",r),H.typeOf.number("options.semiMinorAxis",n),r<n)throw new nt("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(a<=0)throw new nt("granularity must be greater than zero.");return Ct(i,r,n,s,a,o,e)},U.createGeometry=function(t){if(t._semiMajorAxis<=0||t._semiMinorAxis<=0)return;let e=t._height,i=t._extrudedHeight,o=!I.equalsEpsilon(e,i,0,I.EPSILON2);t._center=t._ellipsoid.scaleToGeodeticSurface(t._center,t._center);let r,n={center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:t._ellipsoid,rotation:t._rotation,height:e,granularity:t._granularity,vertexFormat:t._vertexFormat,stRotation:t._stRotation};if(o)n.extrudedHeight=i,n.shadowVolume=t._shadowVolume,n.offsetAttribute=t._offsetAttribute,r=Bt(n);else if(r=Dt(n),K(t._offsetAttribute)){let e=r.attributes.position.values.length,i=t._offsetAttribute===G.NONE?0:1,o=new Uint8Array(e/3).fill(i);r.attributes.applyOffset=new S({componentDatatype:F.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})}return new st({attributes:r.attributes,indices:r.indices,primitiveType:mt.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:t._offsetAttribute})},U.createShadowVolume=function(t,e,i){let o=t._granularity,r=t._ellipsoid,n=e(o,r),a=i(o,r);return new U({center:t._center,semiMajorAxis:t._semiMajorAxis,semiMinorAxis:t._semiMinorAxis,ellipsoid:r,rotation:t._rotation,stRotation:t._stRotation,granularity:o,extrudedHeight:n,height:a,vertexFormat:z.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(U.prototype,{rectangle:{get:function(){return K(this._rectangle)||(this._rectangle=Ct(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return K(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=kt(this)),this._textureCoordinateRotationPoints}}});var de=U;export{de as a};