/**
 * @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 y,b as P,d as k}from"./chunk-RFPX772U.js";import{a as L}from"./chunk-RAYRECQS.js";import{a as B}from"./chunk-6KLVDWWE.js";import{b as q}from"./chunk-6P5KAIBX.js";import{e as T}from"./chunk-4FSVUTPL.js";function Y(t){let a=t._uSquared,i=t._ellipsoid.maximumRadius,n=t._ellipsoid.minimumRadius,e=(i-n)/i,s=Math.cos(t._startHeading),h=Math.sin(t._startHeading),r=(1-e)*Math.tan(t._start.latitude),o=1/Math.sqrt(1+r*r),d=o*r,c=Math.atan2(r,s),u=o*h,l=u*u,M=1-l,_=Math.sqrt(M),g=a/4,f=g*g,p=f*g,m=f*f,q=1+g-3*f/4+5*p/4-175*m/64,v=1-g+15*f/8-35*p/8,H=1-3*g+35*f/4,P=1-5*g,O=q*c-v*Math.sin(2*c)*g/2-H*Math.sin(4*c)*f/16-P*Math.sin(6*c)*p/48-5*Math.sin(8*c)*m/512,y=t._constants;y.a=i,y.b=n,y.f=e,y.cosineHeading=s,y.sineHeading=h,y.tanU=r,y.cosineU=o,y.sineU=d,y.sigma=c,y.sineAlpha=u,y.sineSquaredAlpha=l,y.cosineSquaredAlpha=M,y.cosineAlpha=_,y.u2Over4=g,y.u4Over16=f,y.u6Over64=p,y.u8Over256=m,y.a0=q,y.a1=v,y.a2=H,y.a3=P,y.distanceRatio=O}function Z(t,a){return t*a*(4+t*(4-3*a))/16}function N(t,a,i,n,e,s,h){let r=Z(t,i);return(1-r)*t*a*(n+r*e*(h+r*s*(2*h*h-1)))}function $(t,a,i,n,e,s,h){let r,o,d,c,u,l=(a-i)/a,M=s-n,_=Math.atan((1-l)*Math.tan(e)),g=Math.atan((1-l)*Math.tan(h)),f=Math.cos(_),p=Math.sin(_),m=Math.cos(g),q=Math.sin(g),v=f*m,H=f*q,P=p*q,O=p*m,y=M,E=L.TWO_PI,S=Math.cos(y),b=Math.sin(y);do{S=Math.cos(y),b=Math.sin(y);let t,a=H-O*S;d=Math.sqrt(m*m*b*b+a*a),o=P+v*S,r=Math.atan2(d,o),0===d?(t=0,c=1):(t=v*b/d,c=1-t*t),E=y,u=o-2*P/c,isFinite(u)||(u=0),y=M+N(l,t,c,r,d,o,u)}while(Math.abs(y-E)>L.EPSILON12);let U=c*(a*a-i*i)/(i*i),A=U*(256+U*(U*(74-47*U)-128))/1024,R=u*u,T=i*(1+U*(4096+U*(U*(320-175*U)-768))/16384)*(r-A*d*(u+A*(o*(2*R-1)-A*u*(4*d*d-3)*(4*R-3)/6)/4)),j=Math.atan2(m*b,H-O*S),k=Math.atan2(f*b,H*S-O);t._distance=T,t._startHeading=j,t._endHeading=k,t._uSquared=U}var j=new y,x=new y;function V(t,a,i,n){let e=y.normalize(n.cartographicToCartesian(a,x),j),s=y.normalize(n.cartographicToCartesian(i,x),x);q.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(y.angleBetween(e,s))-Math.PI),.0125),$(t,n.maximumRadius,n.minimumRadius,a.longitude,a.latitude,i.longitude,i.latitude),t._start=P.clone(a,t._start),t._end=P.clone(i,t._end),t._start.height=0,t._end.height=0,Y(t)}function E(t,a,i){let n=B(i,k.default);this._ellipsoid=n,this._start=new P,this._end=new P,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,T(t)&&T(a)&&V(this,t,a,n)}Object.defineProperties(E.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return q.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return q.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return q.defined("distance",this._distance),this._endHeading}}}),E.prototype.setEndPoints=function(t,a){q.defined("start",t),q.defined("end",a),V(this,t,a,this._ellipsoid)},E.prototype.interpolateUsingFraction=function(t,a){return this.interpolateUsingSurfaceDistance(this._distance*t,a)},E.prototype.interpolateUsingSurfaceDistance=function(t,a){q.defined("distance",this._distance);let i=this._constants,n=i.distanceRatio+t/i.b,e=Math.cos(2*n),s=Math.cos(4*n),h=Math.cos(6*n),r=Math.sin(2*n),o=Math.sin(4*n),d=Math.sin(6*n),c=Math.sin(8*n),u=n*n,l=n*u,M=i.u8Over256,_=i.u2Over4,g=i.u6Over64,f=i.u4Over16,p=2*l*M*e/3+n*(1-_+7*f/4-15*g/4+579*M/64-(f-15*g/4+187*M/16)*e-(5*g/4-115*M/16)*s-29*M*h/16)+(_/2-f+71*g/32-85*M/16)*r+(5*f/16-5*g/4+383*M/96)*o-u*((g-11*M/2)*r+5*M*o/2)+(29*g/96-29*M/16)*d+539*M*c/1536,m=Math.asin(Math.sin(p)*i.cosineAlpha),v=Math.atan(i.a/i.b*Math.tan(m));p-=i.sigma;let H=Math.cos(2*i.sigma+p),O=Math.sin(p),y=Math.cos(p),E=i.cosineU*y,S=i.sineU*O,b=Math.atan2(O*i.sineHeading,E-S*i.cosineHeading)-N(i.f,i.sineAlpha,i.cosineSquaredAlpha,p,O,y,H);return T(a)?(a.longitude=this._start.longitude+b,a.latitude=v,a.height=0,a):new P(this._start.longitude+b,v,0)};var ct=E;export{ct as a};