/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.122
 *
 * 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 Z}from"./chunk-S4UG323U.js";import{a as R}from"./chunk-5ONJK4IB.js";import{a as ae,b as v,f as _,g as se,h as le}from"./chunk-5IUXF6I3.js";import{a as e,b as ce,c as $,e as j}from"./chunk-RFPX772U.js";import{a as Q}from"./chunk-RAYRECQS.js";var we={ROUNDED:0,MITERED:1,BEVELED:2},L=Object.freeze(we),g=[new e,new e],ge=new e,pe=new e,xe=new e,Se=new e,Te=new e,Ee=new e,Be=new e,Ce=new e,ze=new e,P=new e,W=new e,I={},ee=new ce;function Ae(e,t){let n=new Array(e.length);for(let r=0;r<e.length;r++){let a=e[r];ee=t.cartesianToCartographic(a,ee),n[r]=ee.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function te(t,n,r,a){let o,l=t[0],i=t[1],c=e.angleBetween(l,i),s=Math.ceil(c/a),u=new Array(s);if(n===r){for(o=0;o<s;o++)u[o]=n;return u.push(r),u}let g=(r-n)/s;for(o=1;o<s;o++){let e=n+o*g;u[o]=e}return u[0]=n,u.push(r),u}var X=new e,Y=new e;function Oe(t,n,r,a){let o=new R(r,a),l=o.projectPointOntoPlane(e.add(r,t,X),X),i=o.projectPointOntoPlane(e.add(r,n,Y),Y),c=$.angleBetween(l,i);return i.x*l.y-i.y*l.x>=0?-c:c}var je=new e(-1,0,0),N=new v,De=new v,re=new j,Me=j.IDENTITY.clone(),ve=new e,Ne=new ae,ie=new e;function D(t,n,r,a,o,l,i,c){let s=ve,u=Ne;N=se.eastNorthUpToFixedFrame(t,o,N),s=v.multiplyByPointAsVector(N,je,s),s=e.normalize(s,s);let g=Oe(s,n,t,o);re=j.fromRotationZ(g,re),ie.z=l,N=v.multiplyTransformation(N,v.fromRotationTranslation(re,ie,De),N);let m=Me;m[0]=i;for(let t=0;t<c;t++)for(let t=0;t<r.length;t+=3)u=e.fromArray(r,t,u),u=j.multiplyByVector(m,u,u),u=v.multiplyByPoint(N,u,u),a.push(u.x,u.y,u.z);return a}var Ve=new e;function ne(t,n,r,a,o,l,i){for(let c=0;c<t.length;c+=3){a=D(e.fromArray(t,c,Ve),n,r,a,o,l[c/3],i,1)}return a}function be(e,t){let n=e.length,r=new Array(6*n),a=0,o=t.x+t.width/2,l=t.y+t.height/2,i=e[0];r[a++]=i.x-o,r[a++]=0,r[a++]=i.y-l;for(let t=1;t<n;t++){i=e[t];let n=i.x-o,c=i.y-l;r[a++]=n,r[a++]=0,r[a++]=c,r[a++]=n,r[a++]=0,r[a++]=c}return i=e[0],r[a++]=i.x-o,r[a++]=0,r[a++]=i.y-l,r}function fe(e,t){let n=e.length,r=new Array(3*n),a=0,o=t.x+t.width/2,l=t.y+t.height/2;for(let t=0;t<n;t++)r[a++]=e[t].x-o,r[a++]=0,r[a++]=e[t].y-l;return r}var me=new _,ue=new e,he=new j;function ye(t,n,r,a,o,l,i,c,s,u){let g,m,f,y=e.angleBetween(e.subtract(n,t,P),e.subtract(r,t,W)),d=a===L.BEVELED?0:Math.ceil(y/Q.toRadians(5));if(g=o?j.fromQuaternion(_.fromAxisAngle(e.negate(t,P),y/(d+1),me),he):j.fromQuaternion(_.fromAxisAngle(t,y/(d+1),me),he),n=e.clone(n,ue),d>0){let r=u?2:1;for(let a=0;a<d;a++)n=j.multiplyByVector(g,n,n),m=e.subtract(n,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(n,W),i=D(f,m,c,i,l,s,1,r)}else m=e.subtract(n,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(n,W),i=D(f,m,c,i,l,s,1,1),r=e.clone(r,ue),m=e.subtract(r,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(r,W),i=D(f,m,c,i,l,s,1,1);return i}I.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let r=t-1,a=0;a<t;r=a++){let t=e[r],o=e[a];$.equals(t,o)||n.push(o)}return n},I.angleIsGreaterThanPi=function(t,n,r,a){let o=new R(r,a),l=o.projectPointOntoPlane(e.add(r,t,X),X),i=o.projectPointOntoPlane(e.add(r,n,Y),Y);return i.x*l.y-i.y*l.x>=0};var Fe=new e,Ge=new e;I.computePositions=function(t,n,r,a,o){let l=a._ellipsoid,i=Ae(t,l),c=a._granularity,s=a._cornerType,u=o?be(n,r):fe(n,r),m=o?fe(n,r):void 0,f=r.height/2,y=r.width/2,d=t.length,w=[],h=o?[]:void 0,p=ge,E=pe,B=xe,j=Se,v=Te,S=Ee,N=Be,x=Ce,z=ze,A=t[0],b=t[1];j=l.geodeticSurfaceNormal(A,j),p=e.subtract(b,A,p),p=e.normalize(p,p),x=e.cross(j,p,x),x=e.normalize(x,x);let T,R,O=i[0],G=i[1];o&&(h=D(A,x,m,h,l,O+f,1,1)),z=e.clone(A,z),A=b,E=e.negate(p,E);for(let n=1;n<d-1;n++){let r=o?2:1;if(b=t[n+1],A.equals(b)){le("Positions are too close and are considered equivalent with rounding error.");continue}p=e.subtract(b,A,p),p=e.normalize(p,p),B=e.add(p,E,B),B=e.normalize(B,B),j=l.geodeticSurfaceNormal(A,j);let a=e.multiplyByScalar(j,e.dot(p,j),Fe);e.subtract(p,a,a),e.normalize(a,a);let m=e.multiplyByScalar(j,e.dot(E,j),Ge);if(e.subtract(E,m,m),e.normalize(m,m),Q.equalsEpsilon(Math.abs(e.dot(a,m)),1,Q.EPSILON7))w=D(z,x,u,w,l,O+f,1,1),z=A;else{B=e.cross(B,j,B),B=e.cross(j,B,B),B=e.normalize(B,B);let t=1/Math.max(.25,e.magnitude(e.cross(B,E,P))),n=I.angleIsGreaterThanPi(p,E,A,l);n?(v=e.add(A,e.multiplyByScalar(B,t*y,B),v),S=e.add(v,e.multiplyByScalar(x,y,S),S),g[0]=e.clone(z,g[0]),g[1]=e.clone(S,g[1]),T=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,x,u,w,l,T,1),x=e.cross(j,p,x),x=e.normalize(x,x),N=e.add(v,e.multiplyByScalar(x,y,N),N),s===L.ROUNDED||s===L.BEVELED?ye(v,S,N,s,n,l,w,u,G+f,o):(B=e.negate(B,B),w=D(A,B,u,w,l,G+f,t,r)),z=e.clone(N,z)):(v=e.add(A,e.multiplyByScalar(B,t*y,B),v),S=e.add(v,e.multiplyByScalar(x,-y,S),S),g[0]=e.clone(z,g[0]),g[1]=e.clone(S,g[1]),T=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,x,u,w,l,T,1),x=e.cross(j,p,x),x=e.normalize(x,x),N=e.add(v,e.multiplyByScalar(x,-y,N),N),s===L.ROUNDED||s===L.BEVELED?ye(v,S,N,s,n,l,w,u,G+f,o):w=D(A,B,u,w,l,G+f,t,r),z=e.clone(N,z)),E=e.negate(p,E)}O=G,G=i[n+1],A=b}g[0]=e.clone(z,g[0]),g[1]=e.clone(A,g[1]),T=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,x,u,w,l,T,1),o&&(h=D(A,x,m,h,l,G+f,1,1)),d=w.length;let V=o?d+h.length:d,F=new Float64Array(V);return F.set(w),o&&F.set(h,d),F};var $e=I;export{L as a,$e as b};