/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.140.0 * * 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 ot}from"./chunk-3BFV72N7.js";import{b as xt,c as ht,d as et}from"./chunk-II4OPXPA.js";import{a as tt}from"./chunk-TOK3PZ73.js";import{a as ft}from"./chunk-65MI2E3A.js";import{a as Y,b as v,c as gt}from"./chunk-QQJ4EFK2.js";import{a}from"./chunk-XXWWJ3QU.js";import{a as X}from"./chunk-N6SIW7ZL.js";import{b as C}from"./chunk-K35RPNUR.js";import{e as D}from"./chunk-RTRJ3LVQ.js";var st={CLOCKWISE:ft.CW,COUNTER_CLOCKWISE:ft.CCW};st.validate=function(t){return t===st.CLOCKWISE||t===st.COUNTER_CLOCKWISE};var at=Object.freeze(st);function mt(t,n,e=2){let c=n&&n.length,r=c?n[0]*e:t.length,o=wt(t,0,r,e,!0),i=[];if(!o||o.next===o.prev)return i;let s,f,u;if(c&&(o=Bt(t,n,o,e)),t.length>80*e){s=1/0,f=1/0;let h=-1/0,y=-1/0;for(let d=e;dh&&(h=S),p>y&&(y=p)}u=Math.max(h-s,y-f),u=u!==0?32767/u:0}return nt(o,i,e,s,f,u,0),i}function wt(t,n,e,c,r){let o;if(r===jt(t,n,e,c)>0)for(let i=n;i=n;i-=c)o=vt(i/c|0,t[i],t[i+1],o);return o&<(o,o.next)&&(it(o),o=o.next),o}function N(t,n){if(!t)return t;n||(n=t);let e=t,c;do if(c=!1,!e.steiner&&(lt(e,e.next)||b(e.prev,e,e.next)===0)){if(it(e),e=n=e.prev,e===e.next)break;c=!0}else e=e.next;while(c||e!==n);return n}function nt(t,n,e,c,r,o,i){if(!t)return;!i&&o&&Ht(t,c,r,o);let s=t;for(;t.prev!==t.next;){let f=t.prev,u=t.next;if(o?Pt(t,c,r,o):Ft(t)){n.push(f.i,t.i,u.i),it(t),t=u.next,s=u.next;continue}if(t=u,t===s){i?i===1?(t=Rt(N(t),n),nt(t,n,e,c,r,o,2)):i===2&&zt(t,n,e,c,r,o):nt(N(t),n,e,c,r,o,1);break}}}function Ft(t){let n=t.prev,e=t,c=t.next;if(b(n,e,c)>=0)return!1;let r=n.x,o=e.x,i=c.x,s=n.y,f=e.y,u=c.y,h=ro?r>i?r:i:o>i?o:i,S=s>f?s>u?s:u:f>u?f:u,p=c.next;for(;p!==n;){if(p.x>=h&&p.x<=d&&p.y>=y&&p.y<=S&&K(r,s,o,f,i,u,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Pt(t,n,e,c){let r=t.prev,o=t,i=t.next;if(b(r,o,i)>=0)return!1;let s=r.x,f=o.x,u=i.x,h=r.y,y=o.y,d=i.y,S=sf?s>u?s:u:f>u?f:u,L=h>y?h>d?h:d:y>d?y:d,z=pt(S,p,n,e,c),F=pt(T,L,n,e,c),l=t.prevZ,x=t.nextZ;for(;l&&l.z>=z&&x&&x.z<=F;){if(l.x>=S&&l.x<=T&&l.y>=p&&l.y<=L&&l!==r&&l!==i&&K(s,h,f,y,u,d,l.x,l.y)&&b(l.prev,l,l.next)>=0||(l=l.prevZ,x.x>=S&&x.x<=T&&x.y>=p&&x.y<=L&&x!==r&&x!==i&&K(s,h,f,y,u,d,x.x,x.y)&&b(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;l&&l.z>=z;){if(l.x>=S&&l.x<=T&&l.y>=p&&l.y<=L&&l!==r&&l!==i&&K(s,h,f,y,u,d,l.x,l.y)&&b(l.prev,l,l.next)>=0)return!1;l=l.prevZ}for(;x&&x.z<=F;){if(x.x>=S&&x.x<=T&&x.y>=p&&x.y<=L&&x!==r&&x!==i&&K(s,h,f,y,u,d,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Rt(t,n){let e=t;do{let c=e.prev,r=e.next.next;!lt(c,r)&&bt(c,e,e.next,r)&&rt(c,r)&&rt(r,c)&&(n.push(c.i,e.i,r.i),it(e),it(e.next),e=t=r),e=e.next}while(e!==t);return N(e)}function zt(t,n,e,c,r,o){let i=t;do{let s=i.next.next;for(;s!==i.prev;){if(i.i!==s.i&&Ut(i,s)){let f=St(i,s);i=N(i,i.next),f=N(f,f.next),nt(i,n,e,c,r,o,0),nt(f,n,e,c,r,o,0);return}s=s.next}i=i.next}while(i!==t)}function Bt(t,n,e,c){let r=[];for(let o=0,i=n.length;o=e.next.y&&e.next.y!==e.y){let y=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(y<=c&&y>o&&(o=y,i=e.x=e.x&&e.x>=f&&c!==e.x&&K(ri.x||e.x===i.x&&Gt(i,e)))&&(i=e,h=y)}e=e.next}while(e!==s);return i}function Gt(t,n){return b(t.prev,t,n.prev)<0&&b(n.next,t,t.next)<0}function Ht(t,n,e,c){let r=t;do r.z===0&&(r.z=pt(r.x,r.y,n,e,c)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Nt(r)}function Nt(t){let n,e=1;do{let c=t,r;t=null;let o=null;for(n=0;c;){n++;let i=c,s=0;for(let u=0;u0||f>0&&i;)s!==0&&(f===0||!i||c.z<=i.z)?(r=c,c=c.nextZ,s--):(r=i,i=i.nextZ,f--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;c=i}o.nextZ=null,e*=2}while(n>1);return t}function pt(t,n,e,c,r){return t=(t-e)*r|0,n=(n-c)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t|n<<1}function kt(t){let n=t,e=t;do(n.x=(t-i)*(o-s)&&(t-i)*(c-s)>=(e-i)*(n-s)&&(e-i)*(o-s)>=(r-i)*(c-s)}function Ut(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!_t(t,n)&&(rt(t,n)&&rt(n,t)&&Kt(t,n)&&(b(t.prev,t,n.prev)||b(t,n.prev,n))||lt(t,n)&&b(t.prev,t,t.next)>0&&b(n.prev,n,n.next)>0)}function b(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function lt(t,n){return t.x===n.x&&t.y===n.y}function bt(t,n,e,c){let r=ut(b(t,n,e)),o=ut(b(t,n,c)),i=ut(b(e,c,t)),s=ut(b(e,c,n));return!!(r!==o&&i!==s||r===0&&ct(t,e,n)||o===0&&ct(t,c,n)||i===0&&ct(e,t,c)||s===0&&ct(e,n,c))}function ct(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function ut(t){return t>0?1:t<0?-1:0}function _t(t,n){let e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&bt(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}function rt(t,n){return b(t.prev,t,t.next)<0?b(t,n,t.next)>=0&&b(t,t.prev,n)>=0:b(t,n,t.prev)<0||b(t,t.next,n)<0}function Kt(t,n){let e=t,c=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(c=!c),e=e.next;while(e!==t);return c}function St(t,n){let e=yt(t.i,t.x,t.y),c=yt(n.i,n.x,n.y),r=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,c.next=e,e.prev=c,o.next=c,c.prev=o,c}function vt(t,n,e,c){let r=yt(t,n,e);return c?(r.next=c.next,r.prev=c,c.next.prev=r,c.next=r):(r.prev=r,r.next=r),r}function it(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yt(t,n,e){return{i:t,x:n,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function jt(t,n,e,c){let r=0;for(let o=n,i=e-c;o0?at.COUNTER_CLOCKWISE:at.CLOCKWISE};B.triangulate=function(t,n){C.defined("positions",t);let e=v.packArray(t);return mt(e,n,2)};var Ot=new a,Tt=new a,Mt=new a,At=new a,Ct=new a,Et=new a,R=new a,Zt=new v,Lt=new v,Dt=new v,j=new v;B.computeSubdivision=function(t,n,e,c,r){r=r??X.RADIANS_PER_DEGREE;let o=D(c);C.typeOf.object("ellipsoid",t),C.defined("positions",n),C.defined("indices",e),C.typeOf.number.greaterThanOrEquals("indices.length",e.length,3),C.typeOf.number.equals("indices.length % 3","0",e.length%3,0),C.typeOf.number.greaterThan("granularity",r,0);let i=e.slice(0),s,f=n.length,u=new Array(f*3),h=new Array(f*2),y=0,d=0;for(s=0;s0;){let l=i.pop(),x=i.pop(),m=i.pop(),A=a.fromArray(u,m*3,Ot),E=a.fromArray(u,x*3,Tt),V=a.fromArray(u,l*3,Mt),q,J,I;o&&(q=v.fromArray(h,m*2,Zt),J=v.fromArray(h,x*2,Lt),I=v.fromArray(h,l*2,Dt));let k=a.multiplyByScalar(a.normalize(A,At),T,At),U=a.multiplyByScalar(a.normalize(E,Ct),T,Ct),W=a.multiplyByScalar(a.normalize(V,Et),T,Et),$=a.magnitudeSquared(a.subtract(k,U,R)),G=a.magnitudeSquared(a.subtract(U,W,R)),Q=a.magnitudeSquared(a.subtract(W,k,R)),H=Math.max($,G,Q),M,w,g;H>z?$===H?(M=`${Math.min(m,x)} ${Math.max(m,x)}`,s=p[M],D(s)||(w=a.add(A,E,R),a.multiplyByScalar(w,.5,w),u.push(w.x,w.y,w.z),s=u.length/3-1,p[M]=s,o&&(g=v.add(q,J,j),v.multiplyByScalar(g,.5,g),h.push(g.x,g.y))),i.push(m,s,l),i.push(s,x,l)):G===H?(M=`${Math.min(x,l)} ${Math.max(x,l)}`,s=p[M],D(s)||(w=a.add(E,V,R),a.multiplyByScalar(w,.5,w),u.push(w.x,w.y,w.z),s=u.length/3-1,p[M]=s,o&&(g=v.add(J,I,j),v.multiplyByScalar(g,.5,g),h.push(g.x,g.y))),i.push(x,s,m),i.push(s,l,m)):Q===H&&(M=`${Math.min(l,m)} ${Math.max(l,m)}`,s=p[M],D(s)||(w=a.add(V,A,R),a.multiplyByScalar(w,.5,w),u.push(w.x,w.y,w.z),s=u.length/3-1,p[M]=s,o&&(g=v.add(I,q,j),v.multiplyByScalar(g,.5,g),h.push(g.x,g.y))),i.push(l,s,x),i.push(s,m,x)):(S.push(m),S.push(x),S.push(l))}let F={attributes:{position:new et({componentDatatype:tt.DOUBLE,componentsPerAttribute:3,values:u})},indices:S,primitiveType:xt.TRIANGLES};return o&&(F.attributes.st=new et({componentDatatype:tt.FLOAT,componentsPerAttribute:2,values:h})),new ht(F)};var Jt=new Y,Qt=new Y,Xt=new Y,dt=new Y;B.computeRhumbLineSubdivision=function(t,n,e,c,r){r=r??X.RADIANS_PER_DEGREE;let o=D(c);C.typeOf.object("ellipsoid",t),C.defined("positions",n),C.defined("indices",e),C.typeOf.number.greaterThanOrEquals("indices.length",e.length,3),C.typeOf.number.equals("indices.length % 3","0",e.length%3,0),C.typeOf.number.greaterThan("granularity",r,0);let i=e.slice(0),s,f=n.length,u=new Array(f*3),h=new Array(f*2),y=0,d=0;for(s=0;s0;){let m=i.pop(),A=i.pop(),E=i.pop(),V=a.fromArray(u,E*3,Ot),q=a.fromArray(u,A*3,Tt),J=a.fromArray(u,m*3,Mt),I,k,U;o&&(I=v.fromArray(h,E*2,Zt),k=v.fromArray(h,A*2,Lt),U=v.fromArray(h,m*2,Dt));let W=t.cartesianToCartographic(V,Jt),$=t.cartesianToCartographic(q,Qt),G=t.cartesianToCartographic(J,Xt);z.setEndPoints(W,$);let Q=z.surfaceDistance;F.setEndPoints($,G);let H=F.surfaceDistance;l.setEndPoints(G,W);let M=l.surfaceDistance,w=Math.max(Q,H,M),g,P,_,Z,O;w>L?Q===w?(g=`${Math.min(E,A)} ${Math.max(E,A)}`,s=p[g],D(s)||(P=z.interpolateUsingFraction(.5,dt),_=(W.height+$.height)*.5,Z=a.fromRadians(P.longitude,P.latitude,_,t,R),u.push(Z.x,Z.y,Z.z),s=u.length/3-1,p[g]=s,o&&(O=v.add(I,k,j),v.multiplyByScalar(O,.5,O),h.push(O.x,O.y))),i.push(E,s,m),i.push(s,A,m)):H===w?(g=`${Math.min(A,m)} ${Math.max(A,m)}`,s=p[g],D(s)||(P=F.interpolateUsingFraction(.5,dt),_=($.height+G.height)*.5,Z=a.fromRadians(P.longitude,P.latitude,_,t,R),u.push(Z.x,Z.y,Z.z),s=u.length/3-1,p[g]=s,o&&(O=v.add(k,U,j),v.multiplyByScalar(O,.5,O),h.push(O.x,O.y))),i.push(A,s,E),i.push(s,m,E)):M===w&&(g=`${Math.min(m,E)} ${Math.max(m,E)}`,s=p[g],D(s)||(P=l.interpolateUsingFraction(.5,dt),_=(G.height+W.height)*.5,Z=a.fromRadians(P.longitude,P.latitude,_,t,R),u.push(Z.x,Z.y,Z.z),s=u.length/3-1,p[g]=s,o&&(O=v.add(U,I,j),v.multiplyByScalar(O,.5,O),h.push(O.x,O.y))),i.push(m,s,A),i.push(s,E,A)):(S.push(E),S.push(A),S.push(m))}let x={attributes:{position:new et({componentDatatype:tt.DOUBLE,componentsPerAttribute:3,values:u})},indices:S,primitiveType:xt.TRIANGLES};return o&&(x.attributes.st=new et({componentDatatype:tt.FLOAT,componentsPerAttribute:2,values:h})),new ht(x)};B.scaleToGeodeticHeight=function(t,n,e,c){e=e??gt.default;let r=Vt,o=qt;if(n=n??0,c=c??!0,D(t)){let i=t.length;for(let s=0;s