/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.129
 *
 * 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.
 */

var xSe=Object.create;var TU=Object.defineProperty;var TSe=Object.getOwnPropertyDescriptor;var ASe=Object.getOwnPropertyNames;var CSe=Object.getPrototypeOf,ESe=Object.prototype.hasOwnProperty;var SSe=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uJ=(e,t)=>{for(var n in t)TU(e,n,{get:t[n],enumerable:!0})},fJ=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ASe(t))!ESe.call(e,o)&&o!==n&&TU(e,o,{get:()=>t[o],enumerable:!(i=TSe(t,o))||i.enumerable});return e};var Zo=(e,t,n)=>(n=e!=null?xSe(CSe(e)):{},fJ(t||!e||!e.__esModule?TU(n,"default",{value:e,enumerable:!0}):n,e)),nm=e=>fJ(TU({},"__esModule",{value:!0}),e);var AU=Xn((pDt,dJ)=>{var Tp=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};Tp.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};Tp.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[i]+i,this.mt[n]>>>=0,n++,i++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648};Tp.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[e&1];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0};Tp.prototype.random_int31=function(){return this.random_int()>>>1};Tp.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Tp.prototype.random=function(){return this.random_int()*(1/4294967296)};Tp.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Tp.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};dJ.exports=Tp});var BJ=Xn((JA,eC)=>{/*! https://mths.be/punycode v1.4.0 by @mathias */(function(e){var t=typeof JA=="object"&&JA&&!JA.nodeType&&JA,n=typeof eC=="object"&&eC&&!eC.nodeType&&eC,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(e=i);var o,r=2147483647,s=36,a=1,l=26,u=38,f=700,h=72,p=128,g="-",m=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=s-a,C=Math.floor,S=String.fromCharCode,v;function P(V){throw new RangeError(x[V])}function M(V,j){for(var U=V.length,q=[];U--;)q[U]=j(V[U]);return q}function R(V,j){var U=V.split("@"),q="";U.length>1&&(q=U[0]+"@",V=U[1]),V=V.replace(b,".");var Y=V.split("."),te=M(Y,j).join(".");return q+te}function L(V){for(var j=[],U=0,q=V.length,Y,te;U<q;)Y=V.charCodeAt(U++),Y>=55296&&Y<=56319&&U<q?(te=V.charCodeAt(U++),(te&64512)==56320?j.push(((Y&1023)<<10)+(te&1023)+65536):(j.push(Y),U--)):j.push(Y);return j}function F(V){return M(V,function(j){var U="";return j>65535&&(j-=65536,U+=S(j>>>10&1023|55296),j=56320|j&1023),U+=S(j),U}).join("")}function _(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:s}function w(V,j){return V+22+75*(V<26)-((j!=0)<<5)}function D(V,j,U){var q=0;for(V=U?C(V/f):V>>1,V+=C(V/j);V>A*l>>1;q+=s)V=C(V/A);return C(q+(A+1)*V/(V+u))}function I(V){var j=[],U=V.length,q,Y=0,te=p,K=h,Z,ee,me,Te,ue,ye,Ae,Pe,Ee;for(Z=V.lastIndexOf(g),Z<0&&(Z=0),ee=0;ee<Z;++ee)V.charCodeAt(ee)>=128&&P("not-basic"),j.push(V.charCodeAt(ee));for(me=Z>0?Z+1:0;me<U;){for(Te=Y,ue=1,ye=s;me>=U&&P("invalid-input"),Ae=_(V.charCodeAt(me++)),(Ae>=s||Ae>C((r-Y)/ue))&&P("overflow"),Y+=Ae*ue,Pe=ye<=K?a:ye>=K+l?l:ye-K,!(Ae<Pe);ye+=s)Ee=s-Pe,ue>C(r/Ee)&&P("overflow"),ue*=Ee;q=j.length+1,K=D(Y-Te,q,Te==0),C(Y/q)>r-te&&P("overflow"),te+=C(Y/q),Y%=q,j.splice(Y++,0,te)}return F(j)}function N(V){var j,U,q,Y,te,K,Z,ee,me,Te,ue,ye=[],Ae,Pe,Ee,ze;for(V=L(V),Ae=V.length,j=p,U=0,te=h,K=0;K<Ae;++K)ue=V[K],ue<128&&ye.push(S(ue));for(q=Y=ye.length,Y&&ye.push(g);q<Ae;){for(Z=r,K=0;K<Ae;++K)ue=V[K],ue>=j&&ue<Z&&(Z=ue);for(Pe=q+1,Z-j>C((r-U)/Pe)&&P("overflow"),U+=(Z-j)*Pe,j=Z,K=0;K<Ae;++K)if(ue=V[K],ue<j&&++U>r&&P("overflow"),ue==j){for(ee=U,me=s;Te=me<=te?a:me>=te+l?l:me-te,!(ee<Te);me+=s)ze=ee-Te,Ee=s-Te,ye.push(S(w(Te+ze%Ee,0))),ee=C(ze/Ee);ye.push(S(w(ee,0))),te=D(U,Pe,q==Y),U=0,++q}++U,++j}return ye.join("")}function k(V){return R(V,function(j){return m.test(j)?I(j.slice(4).toLowerCase()):j})}function z(V){return R(V,function(j){return y.test(j)?"xn--"+N(j):j})}if(o={version:"1.3.2",ucs2:{decode:L,encode:F},decode:I,encode:N,toASCII:z,toUnicode:k},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return o});else if(t&&n)if(eC.exports==t)n.exports=o;else for(v in o)o.hasOwnProperty(v)&&(t[v]=o[v]);else e.punycode=o})(JA)});var UJ=Xn((kJ,jU)=>{/*!
 * URI.js - Mutating URLs
 * IPv6 Support
 *
 * Version: 1.19.11
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */(function(e,t){"use strict";typeof jU=="object"&&jU.exports?jU.exports=t():typeof define=="function"&&define.amd?define(t):e.IPv6=t(e)})(kJ,function(e){"use strict";var t=e&&e.IPv6;function n(o){var r=o.toLowerCase(),s=r.split(":"),a=s.length,l=8;s[0]===""&&s[1]===""&&s[2]===""?(s.shift(),s.shift()):s[0]===""&&s[1]===""?s.shift():s[a-1]===""&&s[a-2]===""&&s.pop(),a=s.length,s[a-1].indexOf(".")!==-1&&(l=7);var u;for(u=0;u<a&&s[u]!=="";u++);if(u<l)for(s.splice(u,1,"0000");s.length<l;)s.splice(u,0,"0000");for(var f,h=0;h<l;h++){f=s[h].split("");for(var p=0;p<3&&(f[0]==="0"&&f.length>1);p++)f.splice(0,1);s[h]=f.join("")}var g=-1,m=0,y=0,b=-1,x=!1;for(h=0;h<l;h++)x?s[h]==="0"?y+=1:(x=!1,y>m&&(g=b,m=y)):s[h]==="0"&&(x=!0,b=h,y=1);y>m&&(g=b,m=y),m>1&&s.splice(g,m,""),a=s.length;var A="";for(s[0]===""&&(A=":"),h=0;h<a&&(A+=s[h],h!==a-1);h++)A+=":";return s[a-1]===""&&(A+=":"),A}function i(){return e.IPv6===this&&(e.IPv6=t),this}return{best:n,noConflict:i}})});var zJ=Xn((VJ,WU)=>{/*!
 * URI.js - Mutating URLs
 * Second Level Domain (SLD) Support
 *
 * Version: 1.19.11
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */(function(e,t){"use strict";typeof WU=="object"&&WU.exports?WU.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)})(VJ,function(e){"use strict";var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(i){var o=i.lastIndexOf(".");if(o<=0||o>=i.length-1)return!1;var r=i.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return!1;var s=n.list[i.slice(o+1)];return s?s.indexOf(" "+i.slice(r+1,o)+" ")>=0:!1},is:function(i){var o=i.lastIndexOf(".");if(o<=0||o>=i.length-1)return!1;var r=i.lastIndexOf(".",o-1);if(r>=0)return!1;var s=n.list[i.slice(o+1)];return s?s.indexOf(" "+i.slice(0,o)+" ")>=0:!1},get:function(i){var o=i.lastIndexOf(".");if(o<=0||o>=i.length-1)return null;var r=i.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return null;var s=n.list[i.slice(o+1)];return!s||s.indexOf(" "+i.slice(r+1,o)+" ")<0?null:i.slice(r+1)},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n})});var du=Xn((HJ,qU)=>{/*!
 * URI.js - Mutating URLs
 *
 * Version: 1.19.11
 *
 * Author: Rodney Rehm
 * Web: http://medialize.github.io/URI.js/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *
 */(function(e,t){"use strict";typeof qU=="object"&&qU.exports?qU.exports=t(BJ(),UJ(),zJ()):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(HJ,function(e,t,n,i){"use strict";var o=i&&i.URI;function r(w,D){var I=arguments.length>=1,N=arguments.length>=2;if(!(this instanceof r))return I?N?new r(w,D):new r(w):new r;if(w===void 0){if(I)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?w=location.href+"":w=""}if(w===null&&I)throw new TypeError("null is not a valid argument for URI");return this.href(w),D!==void 0?this.absoluteTo(D):this}function s(w){return/^[0-9]+$/.test(w)}r.version="1.19.11";var a=r.prototype,l=Object.prototype.hasOwnProperty;function u(w){return w.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(w){return w===void 0?"Undefined":String(Object.prototype.toString.call(w)).slice(8,-1)}function h(w){return f(w)==="Array"}function p(w,D){var I={},N,k;if(f(D)==="RegExp")I=null;else if(h(D))for(N=0,k=D.length;N<k;N++)I[D[N]]=!0;else I[D]=!0;for(N=0,k=w.length;N<k;N++){var z=I&&I[w[N]]!==void 0||!I&&D.test(w[N]);z&&(w.splice(N,1),k--,N--)}return w}function g(w,D){var I,N;if(h(D)){for(I=0,N=D.length;I<N;I++)if(!g(w,D[I]))return!1;return!0}var k=f(D);for(I=0,N=w.length;I<N;I++)if(k==="RegExp"){if(typeof w[I]=="string"&&w[I].match(D))return!0}else if(w[I]===D)return!0;return!1}function m(w,D){if(!h(w)||!h(D)||w.length!==D.length)return!1;w.sort(),D.sort();for(var I=0,N=w.length;I<N;I++)if(w[I]!==D[I])return!1;return!0}function y(w){var D=/^\/+|\/+$/g;return w.replace(D,"")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(w){if(!(!w||!w.nodeName)){var D=w.nodeName.toLowerCase();if(!(D==="input"&&w.type!=="image"))return r.domAttributes[D]}};function b(w){return escape(w)}function x(w){return encodeURIComponent(w).replace(/[!'()*]/g,b).replace(/\*/g,"%2A")}r.encode=x,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=x,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(w,D){var I=r.encode(w+"");return D===void 0&&(D=r.escapeQuerySpace),D?I.replace(/%20/g,"+"):I},r.decodeQuery=function(w,D){w+="",D===void 0&&(D=r.escapeQuerySpace);try{return r.decode(D?w.replace(/\+/g,"%20"):w)}catch{return w}};var A={encode:"encode",decode:"decode"},C,S=function(w,D){return function(I){try{return r[D](I+"").replace(r.characters[w][D].expression,function(N){return r.characters[w][D].map[N]})}catch{return I}}};for(C in A)r[C+"PathSegment"]=S("pathname",A[C]),r[C+"UrnPathSegment"]=S("urnpath",A[C]);var v=function(w,D,I){return function(N){var k;I?k=function(U){return r[D](r[I](U))}:k=r[D];for(var z=(N+"").split(w),V=0,j=z.length;V<j;V++)z[V]=k(z[V]);return z.join(w)}};r.decodePath=v("/","decodePathSegment"),r.decodeUrnPath=v(":","decodeUrnPathSegment"),r.recodePath=v("/","encodePathSegment","decode"),r.recodeUrnPath=v(":","encodeUrnPathSegment","decode"),r.encodeReserved=S("reserved","encode"),r.parse=function(w,D){var I;return D||(D={preventInvalidHostname:r.preventInvalidHostname}),w=w.replace(r.leading_whitespace_expression,""),w=w.replace(r.ascii_tab_whitespace,""),I=w.indexOf("#"),I>-1&&(D.fragment=w.substring(I+1)||null,w=w.substring(0,I)),I=w.indexOf("?"),I>-1&&(D.query=w.substring(I+1)||null,w=w.substring(0,I)),w=w.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),w=w.replace(/^[/\\]{2,}/i,"//"),w.substring(0,2)==="//"?(D.protocol=null,w=w.substring(2),w=r.parseAuthority(w,D)):(I=w.indexOf(":"),I>-1&&(D.protocol=w.substring(0,I)||null,D.protocol&&!D.protocol.match(r.protocol_expression)?D.protocol=void 0:w.substring(I+1,I+3).replace(/\\/g,"/")==="//"?(w=w.substring(I+3),w=r.parseAuthority(w,D)):(w=w.substring(I+1),D.urn=!0))),D.path=w,D},r.parseHost=function(w,D){w||(w=""),w=w.replace(/\\/g,"/");var I=w.indexOf("/"),N,k;if(I===-1&&(I=w.length),w.charAt(0)==="[")N=w.indexOf("]"),D.hostname=w.substring(1,N)||null,D.port=w.substring(N+2,I)||null,D.port==="/"&&(D.port=null);else{var z=w.indexOf(":"),V=w.indexOf("/"),j=w.indexOf(":",z+1);j!==-1&&(V===-1||j<V)?(D.hostname=w.substring(0,I)||null,D.port=null):(k=w.substring(0,I).split(":"),D.hostname=k[0]||null,D.port=k[1]||null)}return D.hostname&&w.substring(I).charAt(0)!=="/"&&(I++,w="/"+w),D.preventInvalidHostname&&r.ensureValidHostname(D.hostname,D.protocol),D.port&&r.ensureValidPort(D.port),w.substring(I)||"/"},r.parseAuthority=function(w,D){return w=r.parseUserinfo(w,D),r.parseHost(w,D)},r.parseUserinfo=function(w,D){var I=w,N=w.indexOf("\\");N!==-1&&(w=w.replace(/\\/g,"/"));var k=w.indexOf("/"),z=w.lastIndexOf("@",k>-1?k:w.length-1),V;return z>-1&&(k===-1||z<k)?(V=w.substring(0,z).split(":"),D.username=V[0]?r.decode(V[0]):null,V.shift(),D.password=V[0]?r.decode(V.join(":")):null,w=I.substring(z+1)):(D.username=null,D.password=null),w},r.parseQuery=function(w,D){if(!w)return{};if(w=w.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!w)return{};for(var I={},N=w.split("&"),k=N.length,z,V,j,U=0;U<k;U++)z=N[U].split("="),V=r.decodeQuery(z.shift(),D),j=z.length?r.decodeQuery(z.join("="),D):null,V!=="__proto__"&&(l.call(I,V)?((typeof I[V]=="string"||I[V]===null)&&(I[V]=[I[V]]),I[V].push(j)):I[V]=j);return I},r.build=function(w){var D="",I=!1;return w.protocol&&(D+=w.protocol+":"),!w.urn&&(D||w.hostname)&&(D+="//",I=!0),D+=r.buildAuthority(w)||"",typeof w.path=="string"&&(w.path.charAt(0)!=="/"&&I&&(D+="/"),D+=w.path),typeof w.query=="string"&&w.query&&(D+="?"+w.query),typeof w.fragment=="string"&&w.fragment&&(D+="#"+w.fragment),D},r.buildHost=function(w){var D="";if(w.hostname)r.ip6_expression.test(w.hostname)?D+="["+w.hostname+"]":D+=w.hostname;else return"";return w.port&&(D+=":"+w.port),D},r.buildAuthority=function(w){return r.buildUserinfo(w)+r.buildHost(w)},r.buildUserinfo=function(w){var D="";return w.username&&(D+=r.encode(w.username)),w.password&&(D+=":"+r.encode(w.password)),D&&(D+="@"),D},r.buildQuery=function(w,D,I){var N="",k,z,V,j;for(z in w)if(z!=="__proto__"&&l.call(w,z))if(h(w[z]))for(k={},V=0,j=w[z].length;V<j;V++)w[z][V]!==void 0&&k[w[z][V]+""]===void 0&&(N+="&"+r.buildQueryParameter(z,w[z][V],I),D!==!0&&(k[w[z][V]+""]=!0));else w[z]!==void 0&&(N+="&"+r.buildQueryParameter(z,w[z],I));return N.substring(1)},r.buildQueryParameter=function(w,D,I){return r.encodeQuery(w,I)+(D!==null?"="+r.encodeQuery(D,I):"")},r.addQuery=function(w,D,I){if(typeof D=="object")for(var N in D)l.call(D,N)&&r.addQuery(w,N,D[N]);else if(typeof D=="string"){if(w[D]===void 0){w[D]=I;return}else typeof w[D]=="string"&&(w[D]=[w[D]]);h(I)||(I=[I]),w[D]=(w[D]||[]).concat(I)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(w,D,I){if(typeof D=="object")for(var N in D)l.call(D,N)&&r.setQuery(w,N,D[N]);else if(typeof D=="string")w[D]=I===void 0?null:I;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(w,D,I){var N,k,z;if(h(D))for(N=0,k=D.length;N<k;N++)w[D[N]]=void 0;else if(f(D)==="RegExp")for(z in w)D.test(z)&&(w[z]=void 0);else if(typeof D=="object")for(z in D)l.call(D,z)&&r.removeQuery(w,z,D[z]);else if(typeof D=="string")I!==void 0?f(I)==="RegExp"?!h(w[D])&&I.test(w[D])?w[D]=void 0:w[D]=p(w[D],I):w[D]===String(I)&&(!h(I)||I.length===1)?w[D]=void 0:h(w[D])&&(w[D]=p(w[D],I)):w[D]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(w,D,I,N){switch(f(D)){case"String":break;case"RegExp":for(var k in w)if(l.call(w,k)&&D.test(k)&&(I===void 0||r.hasQuery(w,k,I)))return!0;return!1;case"Object":for(var z in D)if(l.call(D,z)&&!r.hasQuery(w,z,D[z]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(f(I)){case"Undefined":return D in w;case"Boolean":var V=!!(h(w[D])?w[D].length:w[D]);return I===V;case"Function":return!!I(w[D],D,w);case"Array":if(!h(w[D]))return!1;var j=N?g:m;return j(w[D],I);case"RegExp":return h(w[D])?N?g(w[D],I):!1:!!(w[D]&&w[D].match(I));case"Number":I=String(I);case"String":return h(w[D])?N?g(w[D],I):!1:w[D]===I;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var w=[],D=[],I=0,N=0;N<arguments.length;N++){var k=new r(arguments[N]);w.push(k);for(var z=k.segment(),V=0;V<z.length;V++)typeof z[V]=="string"&&D.push(z[V]),z[V]&&I++}if(!D.length||!I)return new r("");var j=new r("").segment(D);return(w[0].path()===""||w[0].path().slice(0,1)==="/")&&j.path("/"+j.path()),j.normalize()},r.commonPath=function(w,D){var I=Math.min(w.length,D.length),N;for(N=0;N<I;N++)if(w.charAt(N)!==D.charAt(N)){N--;break}return N<1?w.charAt(0)===D.charAt(0)&&w.charAt(0)==="/"?"/":"":((w.charAt(N)!=="/"||D.charAt(N)!=="/")&&(N=w.substring(0,N).lastIndexOf("/")),w.substring(0,N+1))},r.withinString=function(w,D,I){I||(I={});var N=I.start||r.findUri.start,k=I.end||r.findUri.end,z=I.trim||r.findUri.trim,V=I.parens||r.findUri.parens,j=/[a-z0-9-]=["']?$/i;for(N.lastIndex=0;;){var U=N.exec(w);if(!U)break;var q=U.index;if(I.ignoreHtml){var Y=w.slice(Math.max(q-3,0),q);if(Y&&j.test(Y))continue}for(var te=q+w.slice(q).search(k),K=w.slice(q,te),Z=-1;;){var ee=V.exec(K);if(!ee)break;var me=ee.index+ee[0].length;Z=Math.max(Z,me)}if(Z>-1?K=K.slice(0,Z)+K.slice(Z).replace(z,""):K=K.replace(z,""),!(K.length<=U[0].length)&&!(I.ignore&&I.ignore.test(K))){te=q+K.length;var Te=D(K,q,te,w);if(Te===void 0){N.lastIndex=te;continue}Te=String(Te),w=w.slice(0,q)+Te+w.slice(te),N.lastIndex=q+Te.length}}return N.lastIndex=0,w},r.ensureValidHostname=function(w,D){var I=!!w,N=!!D,k=!1;if(N&&(k=g(r.hostProtocols,D)),k&&!I)throw new TypeError("Hostname cannot be empty, if protocol is "+D);if(w&&w.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(w).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(w){if(w){var D=Number(w);if(!(s(D)&&D>0&&D<65536))throw new TypeError('Port "'+w+'" is not a valid port')}},r.noConflict=function(w){if(w){var D={URI:this.noConflict()};return i.URITemplate&&typeof i.URITemplate.noConflict=="function"&&(D.URITemplate=i.URITemplate.noConflict()),i.IPv6&&typeof i.IPv6.noConflict=="function"&&(D.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&typeof i.SecondLevelDomains.noConflict=="function"&&(D.SecondLevelDomains=i.SecondLevelDomains.noConflict()),D}else i.URI===this&&(i.URI=o);return this},a.build=function(w){return w===!0?this._deferred_build=!0:(w===void 0||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},a.clone=function(){return new r(this)},a.valueOf=a.toString=function(){return this.build(!1)._string};function P(w){return function(D,I){return D===void 0?this._parts[w]||"":(this._parts[w]=D||null,this.build(!I),this)}}function M(w,D){return function(I,N){return I===void 0?this._parts[w]||"":(I!==null&&(I=I+"",I.charAt(0)===D&&(I=I.substring(1))),this._parts[w]=I,this.build(!N),this)}}a.protocol=P("protocol"),a.username=P("username"),a.password=P("password"),a.hostname=P("hostname"),a.port=P("port"),a.query=M("query","?"),a.fragment=M("fragment","#"),a.search=function(w,D){var I=this.query(w,D);return typeof I=="string"&&I.length?"?"+I:I},a.hash=function(w,D){var I=this.fragment(w,D);return typeof I=="string"&&I.length?"#"+I:I},a.pathname=function(w,D){if(w===void 0||w===!0){var I=this._parts.path||(this._parts.hostname?"/":"");return w?(this._parts.urn?r.decodeUrnPath:r.decodePath)(I):I}else return this._parts.urn?this._parts.path=w?r.recodeUrnPath(w):"":this._parts.path=w?r.recodePath(w):"/",this.build(!D),this},a.path=a.pathname,a.href=function(w,D){var I;if(w===void 0)return this.toString();this._string="",this._parts=r._parts();var N=w instanceof r,k=typeof w=="object"&&(w.hostname||w.path||w.pathname);if(w.nodeName){var z=r.getDomAttribute(w);w=w[z]||"",k=!1}if(!N&&k&&w.pathname!==void 0&&(w=w.toString()),typeof w=="string"||w instanceof String)this._parts=r.parse(String(w),this._parts);else if(N||k){var V=N?w._parts:w;for(I in V)I!=="query"&&l.call(this._parts,I)&&(this._parts[I]=V[I]);V.query&&this.query(V.query,!1)}else throw new TypeError("invalid input");return this.build(!D),this},a.is=function(w){var D=!1,I=!1,N=!1,k=!1,z=!1,V=!1,j=!1,U=!this._parts.urn;switch(this._parts.hostname&&(U=!1,I=r.ip4_expression.test(this._parts.hostname),N=r.ip6_expression.test(this._parts.hostname),D=I||N,k=!D,z=k&&n&&n.has(this._parts.hostname),V=k&&r.idn_expression.test(this._parts.hostname),j=k&&r.punycode_expression.test(this._parts.hostname)),w.toLowerCase()){case"relative":return U;case"absolute":return!U;case"domain":case"name":return k;case"sld":return z;case"ip":return D;case"ip4":case"ipv4":case"inet4":return I;case"ip6":case"ipv6":case"inet6":return N;case"idn":return V;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return j}return null};var R=a.protocol,L=a.port,F=a.hostname;a.protocol=function(w,D){if(w&&(w=w.replace(/:(\/\/)?$/,""),!w.match(r.protocol_expression)))throw new TypeError('Protocol "'+w+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return R.call(this,w,D)},a.scheme=a.protocol,a.port=function(w,D){return this._parts.urn?w===void 0?"":this:(w!==void 0&&(w===0&&(w=null),w&&(w+="",w.charAt(0)===":"&&(w=w.substring(1)),r.ensureValidPort(w))),L.call(this,w,D))},a.hostname=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w!==void 0){var I={preventInvalidHostname:this._parts.preventInvalidHostname},N=r.parseHost(w,I);if(N!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');w=I.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(w,this._parts.protocol)}return F.call(this,w,D)},a.origin=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){var I=this.protocol(),N=this.authority();return N?(I?I+"://":"")+this.authority():""}else{var k=r(w);return this.protocol(k.protocol()).authority(k.authority()).build(!D),this}},a.host=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0)return this._parts.hostname?r.buildHost(this._parts):"";var I=r.parseHost(w,this._parts);if(I!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');return this.build(!D),this},a.authority=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0)return this._parts.hostname?r.buildAuthority(this._parts):"";var I=r.parseAuthority(w,this._parts);if(I!=="/")throw new TypeError('Hostname "'+w+'" contains characters other than [A-Z0-9.-]');return this.build(!D),this},a.userinfo=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){var I=r.buildUserinfo(this._parts);return I&&I.substring(0,I.length-1)}else return w[w.length-1]!=="@"&&(w+="@"),r.parseUserinfo(w,this._parts),this.build(!D),this},a.resource=function(w,D){var I;return w===void 0?this.path()+this.search()+this.hash():(I=r.parse(w),this._parts.path=I.path,this._parts.query=I.query,this._parts.fragment=I.fragment,this.build(!D),this)},a.subdomain=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,I)||""}else{var N=this._parts.hostname.length-this.domain().length,k=this._parts.hostname.substring(0,N),z=new RegExp("^"+u(k));if(w&&w.charAt(w.length-1)!=="."&&(w+="."),w.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return w&&r.ensureValidHostname(w,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(z,w),this.build(!D),this}},a.domain=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(typeof w=="boolean"&&(D=w,w=void 0),w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.match(/\./g);if(I&&I.length<2)return this._parts.hostname;var N=this._parts.hostname.length-this.tld(D).length-1;return N=this._parts.hostname.lastIndexOf(".",N-1)+1,this._parts.hostname.substring(N)||""}else{if(!w)throw new TypeError("cannot set domain empty");if(w.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(w,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=w;else{var k=new RegExp(u(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(k,w)}return this.build(!D),this}},a.tld=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(typeof w=="boolean"&&(D=w,w=void 0),w===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.lastIndexOf("."),N=this._parts.hostname.substring(I+1);return D!==!0&&n&&n.list[N.toLowerCase()]&&n.get(this._parts.hostname)||N}else{var k;if(w)if(w.match(/[^a-zA-Z0-9-]/))if(n&&n.is(w))k=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(k,w);else throw new TypeError('TLD "'+w+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");k=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(k,w)}else throw new TypeError("cannot set TLD empty");return this.build(!D),this}},a.directory=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0||w===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var I=this._parts.path.length-this.filename().length-1,N=this._parts.path.substring(0,I)||(this._parts.hostname?"/":"");return w?r.decodePath(N):N}else{var k=this._parts.path.length-this.filename().length,z=this._parts.path.substring(0,k),V=new RegExp("^"+u(z));return this.is("relative")||(w||(w="/"),w.charAt(0)!=="/"&&(w="/"+w)),w&&w.charAt(w.length-1)!=="/"&&(w+="/"),w=r.recodePath(w),this._parts.path=this._parts.path.replace(V,w),this.build(!D),this}},a.filename=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(typeof w!="string"){if(!this._parts.path||this._parts.path==="/")return"";var I=this._parts.path.lastIndexOf("/"),N=this._parts.path.substring(I+1);return w?r.decodePathSegment(N):N}else{var k=!1;w.charAt(0)==="/"&&(w=w.substring(1)),w.match(/\.?\//)&&(k=!0);var z=new RegExp(u(this.filename())+"$");return w=r.recodePath(w),this._parts.path=this._parts.path.replace(z,w),k?this.normalizePath(D):this.build(!D),this}},a.suffix=function(w,D){if(this._parts.urn)return w===void 0?"":this;if(w===void 0||w===!0){if(!this._parts.path||this._parts.path==="/")return"";var I=this.filename(),N=I.lastIndexOf("."),k,z;return N===-1?"":(k=I.substring(N+1),z=/^[a-z0-9%]+$/i.test(k)?k:"",w?r.decodePathSegment(z):z)}else{w.charAt(0)==="."&&(w=w.substring(1));var V=this.suffix(),j;if(V)w?j=new RegExp(u(V)+"$"):j=new RegExp(u("."+V)+"$");else{if(!w)return this;this._parts.path+="."+r.recodePath(w)}return j&&(w=r.recodePath(w),this._parts.path=this._parts.path.replace(j,w)),this.build(!D),this}},a.segment=function(w,D,I){var N=this._parts.urn?":":"/",k=this.path(),z=k.substring(0,1)==="/",V=k.split(N);if(w!==void 0&&typeof w!="number"&&(I=D,D=w,w=void 0),w!==void 0&&typeof w!="number")throw new Error('Bad segment "'+w+'", must be 0-based integer');if(z&&V.shift(),w<0&&(w=Math.max(V.length+w,0)),D===void 0)return w===void 0?V:V[w];if(w===null||V[w]===void 0)if(h(D)){V=[];for(var j=0,U=D.length;j<U;j++)!D[j].length&&(!V.length||!V[V.length-1].length)||(V.length&&!V[V.length-1].length&&V.pop(),V.push(y(D[j])))}else(D||typeof D=="string")&&(D=y(D),V[V.length-1]===""?V[V.length-1]=D:V.push(D));else D?V[w]=y(D):V.splice(w,1);return z&&V.unshift(""),this.path(V.join(N),I)},a.segmentCoded=function(w,D,I){var N,k,z;if(typeof w!="number"&&(I=D,D=w,w=void 0),D===void 0){if(N=this.segment(w,D,I),!h(N))N=N!==void 0?r.decode(N):void 0;else for(k=0,z=N.length;k<z;k++)N[k]=r.decode(N[k]);return N}if(!h(D))D=typeof D=="string"||D instanceof String?r.encode(D):D;else for(k=0,z=D.length;k<z;k++)D[k]=r.encode(D[k]);return this.segment(w,D,I)};var _=a.query;return a.query=function(w,D){if(w===!0)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof w=="function"){var I=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),N=w.call(this,I);return this._parts.query=r.buildQuery(N||I,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!D),this}else return w!==void 0&&typeof w!="string"?(this._parts.query=r.buildQuery(w,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!D),this):_.call(this,w,D)},a.setQuery=function(w,D,I){var N=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof w=="string"||w instanceof String)N[w]=D!==void 0?D:null;else if(typeof w=="object")for(var k in w)l.call(w,k)&&(N[k]=w[k]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=r.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=D),this.build(!I),this},a.addQuery=function(w,D,I){var N=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(N,w,D===void 0?null:D),this._parts.query=r.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=D),this.build(!I),this},a.removeQuery=function(w,D,I){var N=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(N,w,D),this._parts.query=r.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof w!="string"&&(I=D),this.build(!I),this},a.hasQuery=function(w,D,I){var N=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(N,w,D,I)},a.setSearch=a.setQuery,a.addSearch=a.addQuery,a.removeSearch=a.removeQuery,a.hasSearch=a.hasQuery,a.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},a.normalizeProtocol=function(w){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!w)),this},a.normalizeHostname=function(w){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!w)),this},a.normalizePort=function(w){return typeof this._parts.protocol=="string"&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!w)),this},a.normalizePath=function(w){var D=this._parts.path;if(!D)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!w),this;if(this._parts.path==="/")return this;D=r.recodePath(D);var I,N="",k,z;for(D.charAt(0)!=="/"&&(I=!0,D="/"+D),(D.slice(-3)==="/.."||D.slice(-2)==="/.")&&(D+="/"),D=D.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),I&&(N=D.substring(1).match(/^(\.\.\/)+/)||"",N&&(N=N[0]));k=D.search(/\/\.\.(\/|$)/),k!==-1;){if(k===0){D=D.substring(3);continue}z=D.substring(0,k).lastIndexOf("/"),z===-1&&(z=k),D=D.substring(0,z)+D.substring(k+3)}return I&&this.is("relative")&&(D=N+D.substring(1)),this._parts.path=D,this.build(!w),this},a.normalizePathname=a.normalizePath,a.normalizeQuery=function(w){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!w)),this},a.normalizeFragment=function(w){return this._parts.fragment||(this._parts.fragment=null,this.build(!w)),this},a.normalizeSearch=a.normalizeQuery,a.normalizeHash=a.normalizeFragment,a.iso8859=function(){var w=r.encode,D=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=w,r.decode=D}return this},a.unicode=function(){var w=r.encode,D=r.decode;r.encode=x,r.decode=unescape;try{this.normalize()}finally{r.encode=w,r.decode=D}return this},a.readable=function(){var w=this.clone();w.username("").password("").normalize();var D="";if(w._parts.protocol&&(D+=w._parts.protocol+"://"),w._parts.hostname&&(w.is("punycode")&&e?(D+=e.toUnicode(w._parts.hostname),w._parts.port&&(D+=":"+w._parts.port)):D+=w.host()),w._parts.hostname&&w._parts.path&&w._parts.path.charAt(0)!=="/"&&(D+="/"),D+=w.path(!0),w._parts.query){for(var I="",N=0,k=w._parts.query.split("&"),z=k.length;N<z;N++){var V=(k[N]||"").split("=");I+="&"+r.decodeQuery(V[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),V[1]!==void 0&&(I+="="+r.decodeQuery(V[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}D+="?"+I.substring(1)}return D+=r.decodeQuery(w.hash(),!0),D},a.absoluteTo=function(w){var D=this.clone(),I=["protocol","username","password","hostname","port"],N,k,z;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(w instanceof r||(w=new r(w)),D._parts.protocol||(D._parts.protocol=w._parts.protocol,this._parts.hostname))return D;for(k=0;z=I[k];k++)D._parts[z]=w._parts[z];return D._parts.path?(D._parts.path.substring(-2)===".."&&(D._parts.path+="/"),D.path().charAt(0)!=="/"&&(N=w.directory(),N=N||(w.path().indexOf("/")===0?"/":""),D._parts.path=(N?N+"/":"")+D._parts.path,D.normalizePath())):(D._parts.path=w._parts.path,D._parts.query||(D._parts.query=w._parts.query)),D.build(),D},a.relativeTo=function(w){var D=this.clone().normalize(),I,N,k,z,V;if(D._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(w=new r(w).normalize(),I=D._parts,N=w._parts,z=D.path(),V=w.path(),z.charAt(0)!=="/")throw new Error("URI is already relative");if(V.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(I.protocol===N.protocol&&(I.protocol=null),I.username!==N.username||I.password!==N.password||I.protocol!==null||I.username!==null||I.password!==null)return D.build();if(I.hostname===N.hostname&&I.port===N.port)I.hostname=null,I.port=null;else return D.build();if(z===V)return I.path="",D.build();if(k=r.commonPath(z,V),!k)return D.build();var j=N.path.substring(k.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return I.path=j+I.path.substring(k.length)||"./",D.build()},a.equals=function(w){var D=this.clone(),I=new r(w),N={},k={},z={},V,j,U;if(D.normalize(),I.normalize(),D.toString()===I.toString())return!0;if(V=D.query(),j=I.query(),D.query(""),I.query(""),D.toString()!==I.toString()||V.length!==j.length)return!1;N=r.parseQuery(V,this._parts.escapeQuerySpace),k=r.parseQuery(j,this._parts.escapeQuerySpace);for(U in N)if(l.call(N,U)){if(h(N[U])){if(!m(N[U],k[U]))return!1}else if(N[U]!==k[U])return!1;z[U]=!0}for(U in k)if(l.call(k,U)&&!z[U])return!1;return!0},a.preventInvalidHostname=function(w){return this._parts.preventInvalidHostname=!!w,this},a.duplicateQueryParameters=function(w){return this._parts.duplicateQueryParameters=!!w,this},a.escapeQuerySpace=function(w){return this._parts.escapeQuerySpace=!!w,this},r})});var Wre=Xn((s1,h9)=>{var JV=function(){"use strict";var e="b9H79TebbbeJq9Geueu9Geub9Gbb9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiKLdilevlevlooroowwvwbDDbelve9Weiiviebeoweuec:G:Qdkr;RiOo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbe8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbdE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UbiY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbl8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbv8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UboE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbra9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbwL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbDK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbqL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbkE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbPa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9Wbsa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbzK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbHl79IV9RbODwebcekdQXq;A9pLdbk;QqeKu8Jjjjjbcjo9Rgv8Kjjjjbcbhodnalcefae0mbabcbRbN:kjjbc:GeV86bbavcjdfcbcjdzNjjjb8AdnaiTmbavcjdfadalz:tjjjb8Akabaefhrabcefhwavalfcbcbcjdal9RalcFe0EzNjjjb8Aavavcjdfalz:tjjjbhDcj;abal9Uc;WFbGgecjdaecjd6Ehqcbhkindndnaiak9nmbaDcjlfcbcjdzNjjjb8Aaqaiak9Rakaqfai6Egxcsfgecl4cifcd4hmadakal2fhPdndndnaec9WGgsTmbcbhzaPhHawhOxekdnaxmbalheinaraw9Ram6miawcbamzNjjjbamfhwaecufgembxvkkcbhAaPhOinaDaAfRbbhCaDcjlfheaOhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkaraw9Ram6mdaOcefhOawcbamzNjjjbamfhwaAcefgAal9hmbxlkkindnaxTmbaDazfRbbhCaDcjlfheaHhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkkaraO9Ram6mearaOcbamzNjjjbgLamfgw9RcK6mecbhKaDcjlfhOinaDcjlfaKfhYcwhAczhQceheindndnaegXce9hmbcuhoaYRbbmecbhodninaogecsSmeaecefhoaOaefcefRbbTmbkkcucbaecs6EhoxekaXcethocuaXtc;:bGcFb7hCcbheinaoaCaOaefRbb9nfhoaecefgecz9hmbkkaoaQaoaQ6geEhQaXaAaeEhAaXcetheaXcl6mbkdndndndnaAcufPdiebkaLaKco4fgeaeRbbcdciaAclSEaKci4coGtV86bbaAcw9hmeawaY8Pbb83bbawcwfaYcwf8Pbb83bbawczfhwxdkaLaKco4fgeaeRbbceaKci4coGtV86bbkdncwaA9Tg8Ambinawcb86bbawcefhwxbkkcuaAtcu7hYcbhEaOh3ina3hea8AhCcbhoinaeRbbgQaYcFeGgXaQaX6EaoaAtVhoaecefheaCcufgCmbkawao86bba3a8Afh3awcefhwaEa8AfgEcz6mbkcbheindnaOaefRbbgoaX6mbawao86bbawcefhwkaecefgecz9hmbkkdnaKczfgKas9pmbaOczfhOaraw9RcL0mekkaKas6meawTmeaHcefhHawhOazcefgzalSmixbkkcbhoxikcbhoaraw9Ralcaalca0E6mddnalc8F0mbawcbcaal9RgezNjjjbaefhwkawaDcjdfalz:tjjjbalfab9RhoxdkaDaPaxcufal2falz:tjjjb8Aaxakfhkawmbkcbhokavcjof8Kjjjjbaok9heeuaecaaeca0Eabcj;abae9Uc;WFbGgdcjdadcjd6Egdfcufad9Uae2adcl4cifcd4adV2fcefkmbcbabBdN:kjjbk:zse5u8Jjjjjbc;ae9Rgl8Kjjjjbcbhvdnaici9UgocHfae0mbabcbyd:e:kjjbgrc;GeV86bbalc;abfcFecjezNjjjb8AalcUfgw9cu83ibalc8WfgD9cu83ibalcyfgq9cu83ibalcafgk9cu83ibalcKfgx9cu83ibalczfgm9cu83ibal9cu83iwal9cu83ibabaefc9WfhPabcefgsaofhednaiTmbcmcsarcb9kgzEhHcbhOcbhAcbhCcbhXcbhQindnaeaP9nmbcbhvxikaQcufhvadaCcdtfgLydbhKaLcwfydbhYaLclfydbh8AcbhEdndndninalc;abfavcsGcitfgoydlh3dndndnaoydbgoaK9hmba3a8ASmekdnaoa8A9hmba3aY9hmbaEcefhExekaoaY9hmea3aK9hmeaEcdfhEkaEc870mdaXcufhvaLaEciGcx2goc:y1jjbfydbcdtfydbh3aLaocN1jjbfydbcdtfydbh8AaLaoc:q1jjbfydbcdtfydbhKcbhodnindnalavcsGcdtfydba39hmbaohYxdkcuhYavcufhvaocefgocz9hmbkkaOa3aOSgvaYce9iaYaH9oVgoGfhOdndndncbcsavEaYaoEgvcs9hmbarce9imba3a3aAa3cefaASgvEgAcefSmecmcsavEhvkasavaEcdtc;WeGV86bbavcs9hmea3aA9Rgvcetavc8F917hvinaeavcFb0crtavcFbGV86bbaecefheavcje6hoavcr4hvaoTmbka3hAxvkcPhvasaEcdtcPV86bba3hAkavTmiavaH9omicdhocehEaQhYxlkavcufhvaEclfgEc;ab9hmbkkdnaLceaYaOSceta8AaOSEcx2gvc:q1jjbfydbcdtfydbgKTaLavcN1jjbfydbcdtfydbg8AceSGaLavc:y1jjbfydbcdtfydbg3cdSGaOcb9hGazGg5ce9hmbaw9cu83ibaD9cu83ibaq9cu83ibak9cu83ibax9cu83ibam9cu83ibal9cu83iwal9cu83ibcbhOkcbhEaXcufgvhodnindnalaocsGcdtfydba8A9hmbaEhYxdkcuhYaocufhoaEcefgEcz9hmbkkcbhodnindnalavcsGcdtfydba39hmbaohExdkcuhEavcufhvaocefgocz9hmbkkaOaKaOSg8EfhLdndnaYcm0mbaYcefhYxekcbcsa8AaLSgvEhYaLavfhLkdndnaEcm0mbaEcefhExekcbcsa3aLSgvEhEaLavfhLkc9:cua8EEh8FcbhvaEaYcltVgacFeGhodndndninavcj1jjbfRbbaoSmeavcefgvcz9hmbxdkka5aKaO9havcm0VVmbasavc;WeV86bbxekasa8F86bbaeaa86bbaecefhekdna8EmbaKaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaKhAkdnaYcs9hmba8AaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka8AhAkdnaEcs9hmba3aA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka3hAkalaXcdtfaKBdbaXcefcsGhvdndnaYPzbeeeeeeeeeeeeeebekalavcdtfa8ABdbaXcdfcsGhvkdndnaEPzbeeeeeeeeeeeeeebekalavcdtfa3BdbavcefcsGhvkcihoalc;abfaQcitfgEaKBdlaEa8ABdbaQcefcsGhYcdhEavhXaLhOxekcdhoalaXcdtfa3BdbcehEaXcefcsGhXaQhYkalc;abfaYcitfgva8ABdlava3Bdbalc;abfaQaEfcsGcitfgva3BdlavaKBdbascefhsaQaofcsGhQaCcifgCai6mbkkcbhvaeaP0mbcbhvinaeavfavcj1jjbfRbb86bbavcefgvcz9hmbkaeab9Ravfhvkalc;aef8KjjjjbavkZeeucbhddninadcefgdc8F0meceadtae6mbkkadcrfcFeGcr9Uci2cdfabci9U2cHfkmbcbabBd:e:kjjbk:ydewu8Jjjjjbcz9Rhlcbhvdnaicvfae0mbcbhvabcbRb:e:kjjbc;qeV86bbal9cb83iwabcefhoabaefc98fhrdnaiTmbcbhwcbhDindnaoar6mbcbskadaDcdtfydbgqalcwfawaqav9Rgvavc8F91gv7av9Rc507gwcdtfgkydb9Rgvc8E91c9:Gavcdt7awVhvinaoavcFb0gecrtavcFbGV86bbavcr4hvaocefhoaembkakaqBdbaqhvaDcefgDai9hmbkkcbhvaoar0mbaocbBbbaoab9RclfhvkavkBeeucbhddninadcefgdc8F0meceadtae6mbkkadcwfcFeGcr9Uab2cvfk:bvli99dui99ludnaeTmbcuadcetcuftcu7:Yhvdndncuaicuftcu7:YgoJbbbZMgr:lJbbb9p9DTmbar:Ohwxekcjjjj94hwkcbhicbhDinalclfIdbgrJbbbbJbbjZalIdbgq:lar:lMalcwfIdbgk:lMgr:varJbbbb9BEgrNhxaqarNhrdndnakJbbbb9GTmbaxhqxekJbbjZar:l:tgqaq:maxJbbbb9GEhqJbbjZax:l:tgxax:marJbbbb9GEhrkdndnalcxfIdbgxJbbj:;axJbbj:;9GEgkJbbjZakJbbjZ9FEavNJbbbZJbbb:;axJbbbb9GEMgx:lJbbb9p9DTmbax:Ohmxekcjjjj94hmkdndnaqJbbj:;aqJbbj:;9GEgxJbbjZaxJbbjZ9FEaoNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:OhPxekcjjjj94hPkdndnarJbbj:;arJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;arJbbbb9GEMgr:lJbbb9p9DTmbar:Ohsxekcjjjj94hskdndnadcl9hmbabaifgzas86bbazcifam86bbazcdfaw86bbazcefaP86bbxekabaDfgzas87ebazcofam87ebazclfaw87ebazcdfaP87ebkalczfhlaiclfhiaDcwfhDaecufgembkkk;hlld99eud99eudnaeTmbdndncuaicuftcu7:YgvJbbbZMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikaic;8FiGhrinabcofcicdalclfIdb:lalIdb:l9EgialcwfIdb:lalaicdtfIdb:l9EEgialcxfIdb:lalaicdtfIdb:l9EEgiarV87ebdndnJbbj:;JbbjZalaicdtfIdbJbbbb9DEgoalaicd7cdtfIdbJ;Zl:1ZNNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabcdfaq87ebdndnalaicefciGcdtfIdbJ;Zl:1ZNaoNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabaq87ebdndnaoalaicufciGcdtfIdbJ;Zl:1ZNNgoJbbj:;aoJbbj:;9GEgwJbbjZawJbbjZ9FEavNJbbbZJbbb:;aoJbbbb9GEMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikabclfai87ebabcwfhbalczfhlaecufgembkkk;3viDue99eu8Jjjjjbcjd9Rgo8Kjjjjbadcd4hrdndndndnavcd9hmbadcl6meaohwarhDinawc:CuBdbawclfhwaDcufgDmbkaeTmiadcl6mdarcdthqalhkcbhxinaohwakhDarhminawawydbgPcbaDIdbgs:8cL4cFeGc:cufasJbbbb9BEgzaPaz9kEBdbaDclfhDawclfhwamcufgmmbkakaqfhkaxcefgxaeSmixbkkaeTmdxekaeTmekarcdthkavce9hhqadcl6hdcbhxindndndnaqmbadmdc:CuhDalhwarhminaDcbawIdbgs:8cL4cFeGc:cufasJbbbb9BEgPaDaP9kEhDawclfhwamcufgmmbxdkkc:CuhDdndnavPleddbdkadmdaohwalhmarhPinawcbamIdbgs:8cL4cFeGgzc;:bazc;:b9kEc:cufasJbbbb9BEBdbamclfhmawclfhwaPcufgPmbxdkkadmecbhwarhminaoawfcbalawfIdbgs:8cL4cFeGgPc8AaPc8A9kEc:cufasJbbbb9BEBdbawclfhwamcufgmmbkkadmbcbhwarhPinaDhmdnavceSmbaoawfydbhmkdndnalawfIdbgscjjj;8iamai9RcefgmcLt9R::NJbbbZJbbb:;asJbbbb9GEMgs:lJbbb9p9DTmbas:Ohzxekcjjjj94hzkabawfazcFFFrGamcKtVBdbawclfhwaPcufgPmbkkabakfhbalakfhlaxcefgxae9hmbkkaocjdf8Kjjjjbk;HqdCui998Jjjjjbc:qd9Rgv8Kjjjjbavc:Sefcbc;KbzNjjjb8AcbhodnadTmbcbhoaiTmbdnabae9hmbavcuadcdtgradcFFFFi0Ecbyd:m:kjjbHjjjjbbgeBd:SeavceBd:mdaeabarz:tjjjb8Akavc:GefcwfcbBdbav9cb83i:Geavc:Gefaeadaiavc:Sefz:njjjbavyd:Gehwadci9UgDcbyd:m:kjjbHjjjjbbhravc:Sefavyd:mdgqcdtfarBdbavaqcefgkBd:mdarcbaDzNjjjbhxavc:SefakcdtfcuaicdtaicFFFFi0Ecbyd:m:kjjbHjjjjbbgmBdbavaqcdfgPBd:mdawhramhkinakalIdbalarydbgscwascw6Ecdtfc;ebfIdbMUdbarclfhrakclfhkaicufgimbkavc:SefaPcdtfcuaDcdtadcFFFF970Ecbyd:m:kjjbHjjjjbbgPBdbdnadci6mbaehraPhkaDhiinakamarydbcdtfIdbamarclfydbcdtfIdbMamarcwfydbcdtfIdbMUdbarcxfhrakclfhkaicufgimbkkaqcifhoavc;qbfhzavhravyd:KehHavyd:OehOcbhscbhkcbhAcehCinarhXcihQaeakci2gLcdtfgrydbhdarclfydbhqabaAcx2fgicwfarcwfydbgKBdbaiclfaqBdbaiadBdbaxakfce86bbazaKBdwazaqBdlazadBdbaPakcdtfcbBdbdnasTmbcihQaXhiinazaQcdtfaiydbgrBdbaQaraK9harad9haraq9hGGfhQaiclfhiascufgsmbkkaAcefhAcbhsinaOaHaeasaLfcdtfydbcdtgifydbcdtfgKhrawaifgqydbgdhidnadTmbdninarydbakSmearclfhraicufgiTmdxbkkaraKadcdtfc98fydbBdbaqaqydbcufBdbkascefgsci9hmbkdndnaQTmbcuhkJbbbbhYcbhqavyd:KehKavyd:OehLindndnawazaqcdtfydbcdtgsfydbgrmbaqcefhqxekaqcs0hiamasfgdIdbh8AadalcbaqcefgqaiEcdtfIdbalarcwarcw6Ecdtfc;ebfIdbMgEUdbaEa8A:thEarcdthiaLaKasfydbcdtfhrinaParydbgscdtfgdaEadIdbMg8AUdba8AaYaYa8A9DgdEhYasakadEhkarclfhraic98fgimbkkaqaQ9hmbkakcu9hmekaCaD9pmdindnaxaCfRbbmbaChkxdkaDaCcefgC9hmbxikkaQczaQcz6EhsazhraXhzakcu9hmbkkaocdtavc:Seffc98fhrdninaoTmearydbcbyd1:kjjbH:bjjjbbarc98fhraocufhoxbkkavc:qdf8Kjjjjbk;IlevucuaicdtgvaicFFFFi0Egocbyd:m:kjjbHjjjjbbhralalyd9GgwcdtfarBdbalawcefBd9GabarBdbaocbyd:m:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdlcuadcdtadcFFFFi0Ecbyd:m:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdwabydbcbavzNjjjb8Aadci9UhDdnadTmbabydbhoaehladhrinaoalydbcdtfgvavydbcefBdbalclfhlarcufgrmbkkdnaiTmbabydbhlabydlhrcbhvaihoinaravBdbarclfhralydbavfhvalclfhlaocufgombkkdnadci6mbabydlhrabydwhvcbhlinaecwfydbhoaeclfydbhdaraeydbcdtfgwawydbgwcefBdbavawcdtfalBdbaradcdtfgdadydbgdcefBdbavadcdtfalBdbaraocdtfgoaoydbgocefBdbavaocdtfalBdbaecxfheaDalcefgl9hmbkkdnaiTmbabydlheabydbhlinaeaeydbalydb9RBdbalclfhlaeclfheaicufgimbkkkQbabaeadaic:01jjbz:mjjjbkQbabaeadaic:C:jjjbz:mjjjbk9DeeuabcFeaicdtzNjjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk;Wkivuo99lu8Jjjjjbc;W;Gb9Rgl8Kjjjjbcbhvalcj;Gbfcbc;KbzNjjjb8AalcuadcdtadcFFFFi0Egocbyd:m:kjjbHjjjjbbgrBdj9GalceBd;G9GalcFFF;7rBdwal9cFFF;7;3FF:;Fb83dbalcFFF97Bd;S9Gal9cFFF;7FFF:;u83d;K9Gaicd4hwdndnadmbJFFuFhDJFFuuhqJFFuuhkJFFuFhxJFFuuhmJFFuFhPxekawcdthsaehzincbhiinalaifgHazaifIdbgDaHIdbgxaxaD9EEUdbalc;K;GbfaifgHaDaHIdbgxaxaD9DEUdbaiclfgicx9hmbkazasfhzavcefgvad9hmbkalIdwhqalId;S9GhDalIdlhkalId;O9GhxalIdbhmalId;K9GhPkdndnadTmbJbbbbJbbjZJbbbbaPam:tgPaPJbbbb9DEgPaxak:tgxaxaP9DEgxaDaq:tgDaDax9DEgD:vaDJbbbb9BEhDawcdthsarhHadhzindndnaDaeIdbam:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcv2c;j:KM;jbGhvdndnaDaeclfIdbak:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcq2cM;j:KMeGavVhvdndnaDaecwfIdbaq:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaHavaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcC2c:KM;j:KdGVBdbaeasfheaHclfhHazcufgzmbkalcbcj;GbzNjjjbhiarhHadheinaiaHydbgzcFrGcx2fgvavydbcefBdbaiazcq4cFrGcx2fgvavydlcefBdlaiazcC4cFrGcx2fgzazydwcefBdwaHclfhHaecufgembxdkkalcbcj;GbzNjjjb8AkcbhHcbhzcbhecbhvinalaHfgiydbhsaiazBdbaicwfgwydbhOawavBdbaiclfgiydbhwaiaeBdbasazfhzaOavfhvawaefheaHcxfgHcj;Gb9hmbkcbhHalaocbyd:m:kjjbHjjjjbbgiBd:e9GdnadTmbabhzinazaHBdbazclfhzadaHcefgH9hmbkabhHadhzinalaraHydbgecdtfydbcFrGcx2fgvavydbgvcefBdbaiavcdtfaeBdbaHclfhHazcufgzmbkaihHadhzinalaraHydbgecdtfydbcq4cFrGcx2fgvavydlgvcefBdlabavcdtfaeBdbaHclfhHazcufgzmbkabhHadhzinalaraHydbgecdtfydbcC4cFrGcx2fgvavydwgvcefBdwaiavcdtfaeBdbaHclfhHazcufgzmbkcbhHinabaiydbcdtfaHBdbaiclfhiadaHcefgH9hmbkkclhidninaic98Smealcj;Gbfaifydbcbyd1:kjjbH:bjjjbbaic98fhixbkkalc;W;Gbf8Kjjjjbk9teiucbcbyd:q:kjjbgeabcifc98GfgbBd:q:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:q:kjjbgeabcrfc94GfgbBd:q:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:q:kjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:q:kjjbfgdBd:q:kjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akkk:Iddbcjwk:edb4:h9w9N94:P:gW:j9O:ye9Pbbbbbbebbbdbbbebbbdbbbbbbbdbbbbbbbebbbbbbb:l29hZ;69:9kZ;N;76Z;rg97Z;z;o9xZ8J;B85Z;:;u9yZ;b;k9HZ:2;Z9DZ9e:l9mZ59A8KZ:r;T3Z:A:zYZ79OHZ;j4::8::Y:D9V8:bbbb9s:49:Z8R:hBZ9M9M;M8:L;z;o8:;8:PG89q;x:J878R:hQ8::M:B;e87bbbbbbjZbbjZbbjZ:E;V;N8::Y:DsZ9i;H;68:xd;R8:;h0838:;W:NoZbbbb:WV9O8:uf888:9i;H;68:9c9G;L89;n;m9m89;D8Ko8:bbbbf:8tZ9m836ZS:2AZL;zPZZ818EZ9e:lxZ;U98F8:819E;68:bc:eqkzebbbebbbdbbba:vbb",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(g){n=g.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(g){for(var m=new Uint8Array(g.length),y=0;y<g.length;++y){var b=g.charCodeAt(y);m[y]=b>96?b-97:b>64?b-39:b+4}for(var x=0,y=0;y<g.length;++y)m[x++]=m[y]<60?t[m[y]]:(m[y]-60)*64+m[++y];return m.buffer.slice(0,x)}function r(g){if(!g)throw new Error("Assertion failed")}function s(g){return new Uint8Array(g.buffer,g.byteOffset,g.byteLength)}function a(g,m,y,b){var x=n.exports.sbrk,A=x(m.length*4),C=x(y*4),S=new Uint8Array(n.exports.memory.buffer),v=s(m);S.set(v,A),b&&b(A,A,m.length,y);var P=g(C,A,m.length,y);S=new Uint8Array(n.exports.memory.buffer);var M=new Uint32Array(y);new Uint8Array(M.buffer).set(S.subarray(C,C+y*4)),v.set(S.subarray(A,A+m.length*4)),x(A-x(0));for(var R=0;R<m.length;++R)m[R]=M[m[R]];return[M,P]}function l(g,m,y,b){var x=n.exports.sbrk,A=x(y*4),C=x(y*b),S=new Uint8Array(n.exports.memory.buffer);S.set(s(m),C),g(A,C,y,b),S=new Uint8Array(n.exports.memory.buffer);var v=new Uint32Array(y);return new Uint8Array(v.buffer).set(S.subarray(A,A+y*4)),x(A-x(0)),v}function u(g,m,y,b,x){var A=n.exports.sbrk,C=A(m),S=A(b*x),v=new Uint8Array(n.exports.memory.buffer);v.set(s(y),S);var P=g(C,m,S,b,x),M=new Uint8Array(P);return M.set(v.subarray(C,C+P)),A(C-A(0)),M}function f(g){for(var m=0,y=0;y<g.length;++y){var b=g[y];m=m<b?b:m}return m}function h(g,m){if(r(m==2||m==4),m==4)return new Uint32Array(g.buffer,g.byteOffset,g.byteLength/4);var y=new Uint16Array(g.buffer,g.byteOffset,g.byteLength/2);return new Uint32Array(y)}function p(g,m,y,b,x,A,C){var S=n.exports.sbrk,v=S(y*b),P=S(y*A),M=new Uint8Array(n.exports.memory.buffer);M.set(s(m),P),g(v,y,b,x,P,C);var R=new Uint8Array(y*b);return R.set(M.subarray(v,v+y*b)),S(v-S(0)),R}return{ready:i,supported:!0,reorderMesh:function(g,m,y){var b=m?y?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(n.exports.meshopt_optimizeVertexFetchRemap,g,f(g)+1,b)},reorderPoints:function(g,m){return r(g instanceof Float32Array),r(g.length%m==0),r(m>=3),l(n.exports.meshopt_spatialSortRemap,g,g.length/m,m*4)},encodeVertexBuffer:function(g,m,y){r(y>0&&y<=256),r(y%4==0);var b=n.exports.meshopt_encodeVertexBufferBound(m,y);return u(n.exports.meshopt_encodeVertexBuffer,b,g,m,y)},encodeIndexBuffer:function(g,m,y){r(y==2||y==4),r(m%3==0);var b=h(g,y),x=n.exports.meshopt_encodeIndexBufferBound(m,f(b)+1);return u(n.exports.meshopt_encodeIndexBuffer,x,b,m,4)},encodeIndexSequence:function(g,m,y){r(y==2||y==4);var b=h(g,y),x=n.exports.meshopt_encodeIndexSequenceBound(m,f(b)+1);return u(n.exports.meshopt_encodeIndexSequence,x,b,m,4)},encodeGltfBuffer:function(g,m,y,b){var x={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(x[b]),x[b](g,m,y)},encodeFilterOct:function(g,m,y,b){return r(y==4||y==8),r(b>=1&&b<=16),p(n.exports.meshopt_encodeFilterOct,g,m,y,b,16)},encodeFilterQuat:function(g,m,y,b){return r(y==8),r(b>=4&&b<=16),p(n.exports.meshopt_encodeFilterQuat,g,m,y,b,16)},encodeFilterExp:function(g,m,y,b,x){r(y>0&&y%4==0),r(b>=1&&b<=24);var A={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return p(n.exports.meshopt_encodeFilterExp,g,m,y,b,y,x?A[x]:1)}}}();typeof s1=="object"&&typeof h9=="object"?h9.exports=JV:typeof define=="function"&&define.amd?define([],function(){return JV}):typeof s1=="object"?s1.MeshoptEncoder=JV:(typeof self<"u"?self:s1).MeshoptEncoder=JV});var qre=Xn((a1,m9)=>{var ez=function(){"use strict";var e="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb",n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(n)?a(t):a(e),r,s=WebAssembly.instantiate(o,{}).then(function(x){r=x.instance,r.exports.__wasm_call_ctors()});function a(x){for(var A=new Uint8Array(x.length),C=0;C<x.length;++C){var S=x.charCodeAt(C);A[C]=S>96?S-97:S>64?S-39:S+4}for(var v=0,C=0;C<x.length;++C)A[v++]=A[C]<60?i[A[C]]:(A[C]-60)*64+A[++C];return A.buffer.slice(0,v)}function l(x,A,C,S,v,P,M){var R=x.exports.sbrk,L=S+3&-4,F=R(L*v),_=R(P.length),w=new Uint8Array(x.exports.memory.buffer);w.set(P,_);var D=A(F,S,v,_,P.length);if(D==0&&M&&M(F,L,v),C.set(w.subarray(F,F+S*v)),R(F-R(0)),D!=0)throw new Error("Malformed buffer data: "+D)}var u={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],p=0;function g(x){var A={object:new Worker(x),pending:0,requests:{}};return A.object.onmessage=function(C){var S=C.data;A.pending-=S.count,A.requests[S.id][S.action](S.value),delete A.requests[S.id]},A}function m(x){for(var A="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(o)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+b.name+";"+l.toString()+b.toString(),C=new Blob([A],{type:"text/javascript"}),S=URL.createObjectURL(C),v=h.length;v<x;++v)h[v]=g(S);for(var v=x;v<h.length;++v)h[v].object.postMessage({});h.length=x,URL.revokeObjectURL(S)}function y(x,A,C,S,v){for(var P=h[0],M=1;M<h.length;++M)h[M].pending<P.pending&&(P=h[M]);return new Promise(function(R,L){var F=new Uint8Array(C),_=++p;P.pending+=x,P.requests[_]={resolve:R,reject:L},P.object.postMessage({id:_,count:x,size:A,source:F,mode:S,filter:v},[F.buffer])})}function b(x){var A=x.data;if(!A.id)return self.close();self.ready.then(function(C){try{var S=new Uint8Array(A.count*A.size);l(C,C.exports[A.mode],S,A.count,A.size,A.source,C.exports[A.filter]),self.postMessage({id:A.id,count:A.count,action:"resolve",value:S},[S.buffer])}catch(v){self.postMessage({id:A.id,count:A.count,action:"reject",value:v})}})}return{ready:s,supported:!0,useWorkers:function(x){m(x)},decodeVertexBuffer:function(x,A,C,S,v){l(r,r.exports.meshopt_decodeVertexBuffer,x,A,C,S,r.exports[u[v]])},decodeIndexBuffer:function(x,A,C,S){l(r,r.exports.meshopt_decodeIndexBuffer,x,A,C,S)},decodeIndexSequence:function(x,A,C,S){l(r,r.exports.meshopt_decodeIndexSequence,x,A,C,S)},decodeGltfBuffer:function(x,A,C,S,v,P){l(r,r.exports[f[v]],x,A,C,S,r.exports[u[P]])},decodeGltfBufferAsync:function(x,A,C,S,v){return h.length>0?y(x,A,C,f[S],u[v]):s.then(function(){var P=new Uint8Array(x*A);return l(r,r.exports[f[S]],P,x,A,C,r.exports[u[v]]),P})}}}();typeof a1=="object"&&typeof m9=="object"?m9.exports=ez:typeof define=="function"&&define.amd?define([],function(){return ez}):typeof a1=="object"?a1.MeshoptDecoder=ez:(typeof self<"u"?self:a1).MeshoptDecoder=ez});var Yre=Xn((c1,p9)=>{var tz=function(){"use strict";var e="b9H79Tebbbe9Hk9Geueu9Geub9Gbb9Gsuuuuuuuuuuuu99uueu9Gvuuuuub9Gvuuuuue999Gquuuuuuu99uueu9Gwuuuuuu99ueu9Giuuue999Gluuuueu9GiuuueuizsdilvoirwDbqqbeqlve9Weiiviebeoweuecj:Pdkr:Tewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bbz9TW79O9V9Wt9F79P9T9W29P9M95bl8E9TW79O9V9Wt9F79P9T9W29P9M959x9Pt9OcttV9P9I91tW7bvQ9TW79O9V9Wt9F79P9T9W29P9M959q9V9P9Ut7boX9TW79O9V9Wt9F79P9T9W29P9M959t9J9H2Wbra9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9Wbwl79IV9RbDDwebcekdmxq;UMesdbk:kfvKue99euY99Qu8Jjjjjbc;W;qb9Rgs8Kjjjjbcbhzascxfcbc;Kbz:ljjjb8AdnabaeSmbabaeadcdtz:kjjjb8AkdnamcdGTmbalcrfci4gHcbyd;S1jjbHjjjjbbheascxfasyd2gOcdtfaeBdbasaOcefBd2aecbaHz:ljjjbhAcbhlcbhednadTmbcbhlabheadhHinaAaeydbgOci4fgCaCRbbgCceaOcrGgOtV86bbaCcu7aO4ceGalfhlaeclfheaHcufgHmbkcualcdtalcFFFFi0Ehekaecbyd;S1jjbHjjjjbbhzascxfasyd2gecdtfazBdbasaecefBd2alcd4alfhOcehHinaHgecethHaeaO6mbkcbhXcuaecdtgOaecFFFFi0Ecbyd;S1jjbHjjjjbbhHascxfasyd2gCcdtfaHBdbasaCcefBd2aHcFeaOz:ljjjbhQdnadTmbaecufhCcbhLinabaXcdtfgKydbgAc:v;t;h;Ev2hOcbhedndninaQaOaCGgOcdtfgYydbgHcuSmeazaHcdtfydbaASmdaecefgeaOfhOaeaC9nmbxdkkazaLcdtfaABdbaYaLBdbaLhHaLcefhLkaKaHBdbaXcefgXad9hmbkkaQcbyd;O1jjbH:bjjjbbasasyd2cufBd2kcualcefgecdtaecFFFFi0Ecbyd;S1jjbHjjjjbbh8Aascxfasyd2gecdtfa8ABdbasa8ABdlasaecefBd2cuadcitadcFFFFe0Ecbyd;S1jjbHjjjjbbhEascxfasyd2gecdtfaEBdbasaEBdwasaecefBd2asclfabadalcbz:cjjjbcualcdtg3alcFFFFi0Eg5cbyd;S1jjbHjjjjbbhQascxfasyd2gecdtfaQBdbasaecefBd2a5cbyd;S1jjbHjjjjbbh8Eascxfasyd2gecdtfa8EBdbasaecefBd2alcd4alfhOcehHinaHgecethHaeaO6mbkcbhLcuaecdtgOaecFFFFi0Ecbyd;S1jjbHjjjjbbhHascxfasyd2gCcdtfaHBdbasaCcefBd2aHcFeaOz:ljjjbhXdnalTmbavcd4hCaecufhHinaLhednazTmbazaLcdtfydbhekaiaeaC2cdtfgeydlgOcH4aO7c:F:b:DD2aeydbgOcH4aO7c;D;O:B8J27aeydwgecH4ae7c:3F;N8N27aHGheaLcdth8FdndndndndnazTmbaza8FfhKcbhOinaXaecdtfgYydbgAcuSmlaiazaAcdtfydbaC2cdtfaiaKydbaC2cdtfcxz:ojjjbTmiaOcefgOaefaHGheaOaH9nmbxdkkaiaLaC2cdtfhKcbhOinaXaecdtfgYydbgAcuSmiaiaAaC2cdtfaKcxz:ojjjbTmdaOcefgOaefaHGheaOaH9nmbkkcbhYkaYydbgecu9hmekaYaLBdbaLhekaQa8FfaeBdbaLcefgLal9hmbkcbhea8EhHinaHaeBdbaHclfhHalaecefge9hmbkcbheaQhHa8EhOindnaeaHydbgCSmbaOa8EaCcdtfgCydbBdbaCaeBdbkaHclfhHaOclfhOalaecefge9hmbkkcbhaaXcbyd;O1jjbH:bjjjbbasasyd2cufBd2alcbyd;S1jjbHjjjjbbhXascxfasyd2gecdtfaXBdbasaecefBd2a5cbyd;S1jjbHjjjjbbheascxfasyd2gHcdtfaeBdbasaHcefBd2a5cbyd;S1jjbHjjjjbbhHascxfasyd2gOcdtfaHBdbasaOcefBd2aecFea3z:ljjjbhhaHcFea3z:ljjjbhgdnalTmbaEcwfh8Jindna8AaagOcefgacdtfydbgCa8AaOcdtgefydbgHSmbaCaH9Rh8FaEaHcitfh3agaefh8KahaefhLcbhAindndna3aAcitfydbgYaO9hmbaLaOBdba8KaOBdbxekdna8AaYcdtg8LfgeclfydbgHaeydbgeSmbaEaecitgCfydbaOSmeaHae9Rh8Maecu7aHfhKa8JaCfhHcbheinaKaeSmeaecefheaHydbhCaHcwfhHaCaO9hmbkaea8M6mekaga8LfgeaOaYaeydbcuSEBdbaLaYaOaLydbcuSEBdbkaAcefgAa8F9hmbkkaaal9hmbkaQhHa8EhOaghCahhAcbheindndnaeaHydbgY9hmbdnaeaOydbgY9hmbaAydbhYdnaCydbgKcu9hmbaYcu9hmbaXaefcb86bbxikaXaefhLdnaeaKSmbaeaYSmbaLce86bbxikaLcl86bbxdkdnaea8EaYcdtgKfydb9hmbdnaCydbgLcuSmbaeaLSmbaAydbg8FcuSmbaea8FSmbagaKfydbg3cuSmba3aYSmbahaKfydbgKcuSmbaKaYSmbdnaQaLcdtfydbgYaQaKcdtfydb9hmbaYaQa8FcdtfydbgKSmbaKaQa3cdtfydb9hmbaXaefcd86bbxlkaXaefcl86bbxikaXaefcl86bbxdkaXaefcl86bbxekaXaefaXaYfRbb86bbkaHclfhHaOclfhOaCclfhCaAclfhAalaecefge9hmbkdnaqTmbdndnazTmbazheaQhHalhOindnaqaeydbfRbbTmbaXaHydbfcl86bbkaeclfheaHclfhHaOcufgOmbxdkkaQhealhHindnaqRbbTmbaXaeydbfcl86bbkaqcefhqaeclfheaHcufgHmbkkaQhealhOaXhHindnaXaeydbfRbbcl9hmbaHcl86bbkaeclfheaHcefhHaOcufgOmbkkamceGTmbaXhealhHindnaeRbbce9hmbaecl86bbkaecefheaHcufgHmbkkcualcx2alc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbhaascxfasyd2gecdtfaaBdbasaecefBd2aaaialavazz:djjjbh8NdndnaDmbcbhycbh8Jxekcbh8JawhecbhHindnaeIdbJbbbb9ETmbasc;Wbfa8JcdtfaHBdba8Jcefh8JkaeclfheaDaHcefgH9hmbkcua8Jal2gecdtaecFFFFi0Ecbyd;S1jjbHjjjjbbhyascxfasyd2gecdtfayBdbasaecefBd2alTmba8JTmbarcd4hLdnazTmba8JcdthicbhYayhKinaoazaYcdtfydbaL2cdtfhAasc;WbfheaKhHa8JhOinaHaAaeydbcdtgCfIdbawaCfIdbNUdbaeclfheaHclfhHaOcufgOmbkaKaifhKaYcefgYal9hmbxdkka8JcdthicbhYayhKinaoaYaL2cdtfhAasc;WbfheaKhHa8JhOinaHaAaeydbcdtgCfIdbawaCfIdbNUdbaeclfheaHclfhHaOcufgOmbkaKaifhKaYcefgYal9hmbkkcualc8S2gHalc;D;O;f8U0EgCcbyd;S1jjbHjjjjbbheascxfasyd2gOcdtfaeBdbasaOcefBd2aecbaHz:ljjjbhqdndndndna8JTmbaCcbyd;S1jjbHjjjjbbhvascxfasyd2gecdtfavBdbcehOasaecefBd2avcbaHz:ljjjb8Acua8Jal2gecltgHaecFFFFb0Ecbyd;S1jjbHjjjjbbhrascxfasyd2gecdtfarBdbasaecefBd2arcbaHz:ljjjb8AadmexikcbhvadTmecbhrkcbhAabhHindnaaaHclfydbgYcx2fgeIdbaaaHydbgKcx2fgOIdbg8P:tgIaaaHcwfydbgLcx2fgCIdlaOIdlg8R:tg8SNaCIdba8P:tgRaeIdla8R:tg8UN:tg8Va8VNa8UaCIdwaOIdwg8W:tg8XNa8SaeIdwa8W:tg8UN:tg8Sa8SNa8UaRNa8XaIN:tgIaINMM:rgRJbbbb9ETmba8VaR:vh8VaIaR:vhIa8SaR:vh8SkaqaQaKcdtfydbc8S2fgea8SaR:rgRa8SNNg8UaeIdbMUdbaeaIaRaINg8YNg8XaeIdlMUdlaea8VaRa8VNg8ZNg80aeIdwMUdwaea8Ya8SNg8YaeIdxMUdxaea8Za8SNg81aeIdzMUdzaea8ZaINg8ZaeIdCMUdCaea8SaRa8Va8WNa8Sa8PNa8RaINMM:mg8RNg8PNg8SaeIdKMUdKaeaIa8PNgIaeId3MUd3aea8Va8PNg8VaeIdaMUdaaea8Pa8RNg8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaYcdtfydbc8S2fgea8UaeIdbMUdbaea8XaeIdlMUdlaea80aeIdwMUdwaea8YaeIdxMUdxaea81aeIdzMUdzaea8ZaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaLcdtfydbc8S2fgea8UaeIdbMUdbaea8XaeIdlMUdlaea80aeIdwMUdwaea8YaeIdxMUdxaea81aeIdzMUdzaea8ZaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdyaHcxfhHaAcifgAad6mbkcbhiabhKinabaicdtfhYcbhHinaXaYaHc:G1jjbfydbcdtfydbgOfRbbhedndnaXaKaHfydbgCfRbbgAc99fcFeGcpe0mbaeceSmbaecd9hmekdnaAcufcFeGce0mbahaCcdtfydbaO9hmekdnaecufcFeGce0mbagaOcdtfydbaC9hmekdnaAcv2aefcj1jjbfRbbTmbaQaOcdtfydbaQaCcdtfydb0mekJbbacJbbacJbbjZaeceSEaAceSEh8ZdnaaaYaHc:K1jjbfydbcdtfydbcx2fgeIdwaaaCcx2fgAIdwg8R:tg8VaaaOcx2fgLIdwa8R:tg8Sa8SNaLIdbaAIdbg8W:tgIaINaLIdlaAIdlg8U:tgRaRNMMg8PNa8Va8SNaeIdba8W:tg80aINaRaeIdla8U:tg8YNMMg8Xa8SN:tg8Va8VNa80a8PNa8XaIN:tg8Sa8SNa8Ya8PNa8XaRN:tgIaINMM:rgRJbbbb9ETmba8VaR:vh8VaIaR:vhIa8SaR:vh8SkaqaQaCcdtfydbc8S2fgea8Sa8Za8P:rNgRa8SNNg8XaeIdbMUdbaeaIaRaINg8ZNg80aeIdlMUdlaea8VaRa8VNg8PNg8YaeIdwMUdwaea8Za8SNg8ZaeIdxMUdxaea8Pa8SNg81aeIdzMUdzaea8PaINgBaeIdCMUdCaea8SaRa8Va8RNa8Sa8WNa8UaINMM:mg8RNg8PNg8SaeIdKMUdKaeaIa8PNgIaeId3MUd3aea8Va8PNg8VaeIdaMUdaaea8Pa8RNg8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaOcdtfydbc8S2fgea8XaeIdbMUdbaea80aeIdlMUdlaea8YaeIdwMUdwaea8ZaeIdxMUdxaea81aeIdzMUdzaeaBaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdykaHclfgHcx9hmbkaKcxfhKaicifgiad6mbkdna8JTmbcbhKinJbbbbh8WaaabaKcdtfgeclfydbgLcx2fgHIdwaaaeydbgicx2fgOIdwg8Y:tgIaINaHIdbaOIdbg81:tg8Va8VNaHIdlaOIdlgB:tgRaRNMMg8Zaaaecwfydbg8Fcx2fgeIdwa8Y:tg8PNaIaIa8PNa8VaeIdba81:tg8RNaRaeIdlaB:tg8UNMMg8SN:tJbbbbJbbjZa8Za8Pa8PNa8Ra8RNa8Ua8UNMMg80Na8Sa8SN:tg8X:va8XJbbbb9BEg8XNh83a80aINa8Pa8SN:ta8XNhUa8Za8UNaRa8SN:ta8XNh85a80aRNa8Ua8SN:ta8XNh86a8Za8RNa8Va8SN:ta8XNh87a80a8VNa8Ra8SN:ta8XNh88a8Va8UNa8RaRN:tg8Sa8SNaRa8PNa8UaIN:tg8Sa8SNaIa8RNa8Pa8VN:tg8Sa8SNMM:rJbbbZNh8Sayaia8J2g3cdtfhHaya8Fa8J2gwcdtfhOayaLa8J2g8LcdtfhCa8Y:mh89aB:mh8:a81:mhZcbhAa8JhYJbbbbh8UJbbbbh8XJbbbbh8ZJbbbbh80Jbbbbh8YJbbbbh81JbbbbhBJbbbbhnJbbbbhcinasc;WbfaAfgecwfa8SaUaCIdbaHIdbg8P:tgRNa83aOIdba8P:tg8RNMgINUdbaeclfa8Sa86aRNa85a8RNMg8VNUdbaea8Sa88aRNa87a8RNMgRNUdbaecxfa8Sa89aINa8:a8VNa8PaZaRNMMMg8PNUdba8SaIa8VNNa80Mh80a8SaIaRNNa8YMh8Ya8Sa8VaRNNa81Mh81a8Sa8Pa8PNNa8WMh8Wa8SaIa8PNNa8UMh8Ua8Sa8Va8PNNa8XMh8Xa8SaRa8PNNa8ZMh8Za8SaIaINNaBMhBa8Sa8Va8VNNanMhna8SaRaRNNacMhcaHclfhHaCclfhCaOclfhOaAczfhAaYcufgYmbkavaic8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyavaLc8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyava8Fc8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyara3cltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkara8LcltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkarawcltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkaKcifgKad6mbkkcbhOxekcehOcbhrkcbh8FdndnamcwGg9cmbJbbbbh8ZcbhJcbhocbhCxekcbhea5cbyd;S1jjbHjjjjbbhCascxfasyd2gHcdtfaCBdbasaHcefBd2dnalTmbaChHinaHaeBdbaHclfhHalaecefge9hmbkkdnaOmbcbhiinabaicdtfhLcbhKinaQaLaKcdtgec:G1jjbfydbcdtfydbcdtfydbhHdnaCaQaLaefydbcdtfydbgOcdtfgAydbgeaOSmbinaAaCaegOcdtfgYydbgeBdbaYhAaOae9hmbkkdnaCaHcdtfgAydbgeaHSmbinaAaCaegHcdtfgYydbgeBdbaYhAaHae9hmbkkdnaOaHSmbaCaOaHaOaH0EcdtfaOaHaOaH6EBdbkaKcefgKci9hmbkaicifgiad6mbkkcbhJdnalTmbcbhYindnaQaYcdtgefydbaY9hmbaYhHdnaCaefgKydbgeaYSmbaKhOinaOaCaegHcdtfgAydbgeBdbaAhOaHae9hmbkkaKaHBdbkaYcefgYal9hmbkcbheaQhOaChHcbhJindndnaeaOydbgA9hmbdnaeaHydbgA9hmbaHaJBdbaJcefhJxdkaHaCaAcdtfydbBdbxekaHaCaAcdtfydbBdbkaOclfhOaHclfhHalaecefge9hmbkkcuaJcltgeaJcjjjjiGEcbyd;S1jjbHjjjjbbhoascxfasyd2gHcdtfaoBdbasaHcefBd2aocbaez:ljjjbhAdnalTmbaChOaahealhYinaecwfIdbh8SaeclfIdbhIaAaOydbcltfgHaeIdbaHIdbMUdbaHclfgKaIaKIdbMUdbaHcwfgKa8SaKIdbMUdbaHcxfgHaHIdbJbbjZMUdbaOclfhOaecxfheaYcufgYmbkkdnaJTmbaAheaJhHinaecxfgOIdbh8SaOcbBdbaeaeIdbJbbbbJbbjZa8S:va8SJbbbb9BEg8SNUdbaeclfgOa8SaOIdbNUdbaecwfgOa8SaOIdbNUdbaeczfheaHcufgHmbkkdnalTmbaChOaahealhYinaAaOydbcltfgHcxfgKaecwfIdbaHcwfIdb:tg8Sa8SNaeIdbaHIdb:tg8Sa8SNaeclfIdbaHclfIdb:tg8Sa8SNMMg8SaKIdbgIaIa8S9DEUdbaOclfhOaecxfheaYcufgYmbkkdnaJmbcbhJJFFuuh8ZxekaAcxfheaAhHaJhOinaHaeIdbUdbaeczfheaHclfhHaOcufgOmbkJFFuuh8ZaAheaJhHinaeIdbg8Sa8Za8Za8S9EEh8ZaeclfheaHcufgHmbkkasydlh9ednalTmba9eclfhea9eydbhAaXhHalhYcbhOincbaeydbgKaA9RaHRbbcpeGEaOfhOaHcefhHaeclfheaKhAaYcufgYmbkaOce4h8Fkcuada8F9RcifgTcx2aTc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbhDascxfasyd2gecdtfaDBdbasaecefBd2cuaTcdtaTcFFFFi0Ecbyd;S1jjbHjjjjbbhSascxfasyd2gecdtfaSBdbasaecefBd2a5cbyd;S1jjbHjjjjbbh8Mascxfasyd2gecdtfa8MBdbasaecefBd2alcbyd;S1jjbHjjjjbbh9hascxfasyd2gecdtfa9hBdbasaecefBd2axaxNa8NJbbjZamclGEg83a83N:vhcJbbbbhndnadak9nmbdnaTci6mba8Jclth9iaDcwfh6JbbbbhBJbbbbhninasclfabadalaQz:cjjjbabh8FcbhEcbh5inaba5cdtfh3cbheindnaQa8FaefydbgOcdtgifydbgYaQa3aec:W1jjbfydbcdtfydbgHcdtgwfydbgKSmbaXaHfRbbgLcv2aXaOfRbbgAfc;a1jjbfRbbg8AaAcv2aLfg8Lc;a1jjbfRbbg8KVcFeGTmbdnaKaY9nmba8Lcj1jjbfRbbcFeGmekaAcufhYdnaAaL9hmbaYcFeGce0mbahaifydbaH9hmekdndnaAclSmbaLcl9hmekdnaYcFeGce0mbahaifydbaH9hmdkaLcufcFeGce0mbagawfydbaO9hmekaDaEcx2fgAaHaOa8KcFeGgYEBdlaAaOaHaYEBdbaAaYa8AGcb9hBdwaEcefhEkaeclfgecx9hmbkdna5cifg5ad9pmba8Fcxfh8FaEcifaT9nmekkaETmdcbhiinJbbbbJbbjZaqaQaDaicx2fgAydlgKaAydbgYaAydwgHEgLcdtfydbc8S2fgeIdyg8S:va8SJbbbb9BEaeIdwaaaYaKaHEg8Fcx2fgHIdwgRNaeIdzaHIdbg8PNaeIdaMg8Sa8SMMaRNaeIdlaHIdlg8RNaeIdCaRNaeId3Mg8Sa8SMMa8RNaeIdba8PNaeIdxa8RNaeIdKMg8Sa8SMMa8PNaeId8KMMM:lNh80JbbbbJbbjZaqaQaYcdtfydbc8S2fgeIdyg8S:va8SJbbbb9BEaeIdwaaaKcx2fgHIdwg8VNaeIdzaHIdbg8WNaeIdaMg8Sa8SMMa8VNaeIdlaHIdlg8UNaeIdCa8VNaeId3Mg8Sa8SMMa8UNaeIdba8WNaeIdxa8UNaeIdKMg8Sa8SMMa8WNaeId8KMMM:lNh8YaAcwfh3aAclfhwdna8JTmbavaYc8S2fgOIdwa8VNaOIdza8WNaOIdaMg8Sa8SMMa8VNaOIdla8UNaOIdCa8VNaOId3Mg8Sa8SMMa8UNaOIdba8WNaOIdxa8UNaOIdKMg8Sa8SMMa8WNaOId8KMMMh8SayaKa8J2cdtfhHaraYa8J2cltfheaOIdyh8Xa8JhOinaHIdbgIaIa8XNaecxfIdba8VaecwfIdbNa8WaeIdbNa8UaeclfIdbNMMMgIaIM:tNa8SMh8SaHclfhHaeczfheaOcufgOmbkavaLc8S2fgOIdwaRNaOIdza8PNaOIdaMgIaIMMaRNaOIdla8RNaOIdCaRNaOId3MgIaIMMa8RNaOIdba8PNaOIdxa8RNaOIdKMgIaIMMa8PNaOId8KMMMhIaya8Fa8J2cdtfhHaraLa8J2cltfheaOIdyh8Wa8JhOinaHIdbg8Va8Va8WNaecxfIdbaRaecwfIdbNa8PaeIdbNa8RaeclfIdbNMMMg8Va8VM:tNaIMhIaHclfhHaeczfheaOcufgOmbka80aI:lMh80a8Ya8S:lMh8YkawaKa8Fa8Ya809FgeEBdbaAaYaLaeEBdba3a8Ya80aeEUdbaicefgiaE9hmbkasc;Wbfcbcj;qbz:ljjjb8Aa6heaEhHinasc;WbfaeydbcA4cF8FGgOcFAaOcFA6EcdtfgOaOydbcefBdbaecxfheaHcufgHmbkcbhecbhHinasc;WbfaefgOydbhAaOaHBdbaAaHfhHaeclfgecj;qb9hmbkcbhea6hHinasc;WbfaHydbcA4cF8FGgOcFAaOcFA6EcdtfgOaOydbgOcefBdbaSaOcdtfaeBdbaHcxfhHaEaecefge9hmbkadak9RgOci9Uh9kdnalTmbcbhea8MhHinaHaeBdbaHclfhHalaecefge9hmbkkcbh0a9hcbalz:ljjjbh9maOcO9Uh9na9kce4h9oasydwh9pcbh8KcbhwdninaDaSawcdtfydbcx2fg3Idwg8Sac9Emea8Ka9k9pmeJFFuuhIdna9oaE9pmbaDaSa9ocdtfydbcx2fIdwJbb;aZNhIkdna8SaI9ETmba8San9ETmba8Ka9n0mdkdna9maQa3ydlgicdtg9qfydbgAfg9rRbba9maQa3ydbgLcdtg9sfydbgHfg9tRbbVmbaXaLfRbbh9udna9eaHcdtfgeclfydbgOaeydbgeSmbaOae9RhKa9paecitfheaaaAcx2fg8Lcwfh5a8Lclfh9vaaaHcx2fg8Acwfh9wa8Aclfh9xcbhHceh8Fdnindna8MaeydbcdtfydbgOaASmba8MaeclfydbcdtfydbgYaASmbaOaYSmbaaaYcx2fgYIdbaaaOcx2fgOIdbg8V:tg8Sa9xIdbaOIdlgR:tg8WNa8AIdba8V:tg8UaYIdlaR:tgIN:tg8Pa8Sa9vIdbaR:tg8XNa8LIdba8V:tg80aIN:tgRNaIa9wIdbaOIdwg8R:tg8YNa8WaYIdwa8R:tg8VN:tg8WaIa5Idba8R:tg81Na8Xa8VN:tgINa8Va8UNa8Ya8SN:tg8Ra8Va80Na81a8SN:tg8SNMMa8Pa8PNa8Wa8WNa8Ra8RNMMaRaRNaIaINa8Sa8SNMMN:rJbbj8:N9FmdkaecwfheaHcefgHaK6h8FaKaH9hmbkka8FceGTmba9ocefh9oxeka3cwfhHdndndndna9uc9:fPdebdkaLheina8MaecdtgefaiBdba8EaefydbgeaL9hmbxikkdnagahaha9sfydbaiSEa8Ea9sfydbgLcdtfydbgecu9hmba8Ea9qfydbheka8Ma9sfaiBdbaehika8MaLcdtfaiBdbka9tce86bba9rce86bbaHIdbg8Sanana8S9DEhna0cefh0cecda9uceSEa8Kfh8KkawcefgwaE9hmbkka0TmddnalTmbcbhKcbhiindna8MaicdtgefydbgOaiSmbaQaOcdtfydbh8FdnaiaQaefydb9hg3mbaqa8Fc8S2fgeaqaic8S2fgHIdbaeIdbMUdbaeaHIdlaeIdlMUdlaeaHIdwaeIdwMUdwaeaHIdxaeIdxMUdxaeaHIdzaeIdzMUdzaeaHIdCaeIdCMUdCaeaHIdKaeIdKMUdKaeaHId3aeId3MUd3aeaHIdaaeIdaMUdaaeaHId8KaeId8KMUd8KaeaHIdyaeIdyMUdyka8JTmbavaOc8S2fgeavaic8S2gwfgHIdbaeIdbMUdbaeaHIdlaeIdlMUdlaeaHIdwaeIdwMUdwaeaHIdxaeIdxMUdxaeaHIdzaeIdzMUdzaeaHIdCaeIdCMUdCaeaHIdKaeIdKMUdKaeaHId3aeId3MUd3aeaHIdaaeIdaMUdaaeaHId8KaeId8KMUd8KaeaHIdyaeIdyMUdya9iaO2hLarhHa8JhAinaHaLfgeaHaKfgOIdbaeIdbMUdbaeclfgYaOclfIdbaYIdbMUdbaecwfgYaOcwfIdbaYIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaAcufgAmbka3mbJbbbbJbbjZaqawfgeIdyg8S:va8SJbbbb9BEaeIdwaaa8Fcx2fgHIdwg8SNaeIdzaHIdbgINaeIdaMg8Va8VMMa8SNaeIdlaHIdlg8VNaeIdCa8SNaeId3Mg8Sa8SMMa8VNaeIdbaINaeIdxa8VNaeIdKMg8Sa8SMMaINaeId8KMMM:lNg8SaBaBa8S9DEhBkaKa9ifhKaicefgial9hmbkcbhHahheindnaeydbgOcuSmbdnaHa8MaOcdtgAfydbgO9hmbcuhOahaAfydbgAcuSmba8MaAcdtfydbhOkaeaOBdbkaeclfhealaHcefgH9hmbkcbhHagheindnaeydbgOcuSmbdnaHa8MaOcdtgAfydbgO9hmbcuhOagaAfydbgAcuSmba8MaAcdtfydbhOkaeaOBdbkaeclfhealaHcefgH9hmbkkaBana8JEhBcbhYabhecbhKindna8MaeydbcdtfydbgHa8MaeclfydbcdtfydbgOSmbaHa8MaecwfydbcdtfydbgASmbaOaASmbabaYcdtfgLaHBdbaLcwfaABdbaLclfaOBdbaYcifhYkaecxfheaKcifgKad6mbkdndna9cTmbaYak9nmba8ZaB9FTmbcbhdabhecbhHindnaoaCaeydbgOcdtfydbcdtfIdbaB9ETmbabadcdtfgAaOBdbaAclfaeclfydbBdbaAcwfaecwfydbBdbadcifhdkaecxfheaHcifgHaY6mbkJFFuuh8ZaJTmeaoheaJhHJFFuuh8SinaeIdbgIa8Sa8SaI9EEg8Va8SaIaB9EgOEh8Sa8Va8ZaOEh8ZaeclfheaHcufgHmbxdkkaYhdkadak0mbxdkkasclfabadalaQz:cjjjbkdndnadak0mbadhOxekdna9cmbadhOxekdna8Zac9FmbadhOxekina8ZJbb;aZNg8Saca8Sac9DEh8VJbbbbh8SdnaJTmbaoheaJhHinaeIdbgIa8SaIa8V9FEa8SaIa8S9EEh8SaeclfheaHcufgHmbkkcbhOabhecbhHindnaoaCaeydbgAcdtfydbcdtfIdba8V9ETmbabaOcdtfgYaABdbaYclfaeclfydbBdbaYcwfaecwfydbBdbaOcifhOkaecxfheaHcifgHad6mbkJFFuuh8ZdnaJTmbaoheaJhHJFFuuhIinaeIdbgRaIaIaR9EEg8PaIaRa8V9EgAEhIa8Pa8ZaAEh8ZaeclfheaHcufgHmbkkdnaOad9hmbadhOxdka8Sanana8S9DEhnaOak9nmeaOhda8Zac9FmbkkdnamcjjjjlGTmbazmbaOTmbcbhQabheinaXaeydbgAfRbbc3thKaecwfgLydbhHdndnahaAcdtg8FfydbaeclfgiydbgCSmbcbhYagaCcdtfydbaA9hmekcjjjj94hYkaeaKaYVaAVBdbaXaCfRbbc3thKdndnahaCcdtfydbaHSmbcbhYagaHcdtfydbaC9hmekcjjjj94hYkaiaKaYVaCVBdbaXaHfRbbc3thYdndnahaHcdtfydbaASmbcbhCaga8FfydbaH9hmekcjjjj94hCkaLaYaCVaHVBdbaecxfheaQcifgQaO6mbkkdnazTmbaOTmbaOheinabazabydbcdtfydbBdbabclfhbaecufgembkkdnaPTmbaPa83an:rNUdbkasyd2gecdtascxffc98fhHdninaeTmeaHydbcbyd;O1jjbH:bjjjbbaHc98fhHaecufhexbkkasc;W;qbf8KjjjjbaOk;Yieouabydlhvabydbclfcbaicdtz:ljjjbhoadci9UhrdnadTmbdnalTmbaehwadhDinaoalawydbcdtfydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbxdkkaehwadhDinaoawydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbkkdnaiTmbcbhDaohwinawydbhqawaDBdbawclfhwaqaDfhDaicufgimbkkdnadci6mbinaecwfydbhwaeclfydbhDaeydbhidnalTmbalawcdtfydbhwalaDcdtfydbhDalaicdtfydbhikavaoaicdtfgqydbcitfaDBdbavaqydbcitfawBdlaqaqydbcefBdbavaoaDcdtfgqydbcitfawBdbavaqydbcitfaiBdlaqaqydbcefBdbavaoawcdtfgwydbcitfaiBdbavawydbcitfaDBdlawawydbcefBdbaecxfhearcufgrmbkkabydbcbBdbk;Podvuv998Jjjjjbca9RgvcFFF;7rBd3av9cFFF;7;3FF:;Fb83dCavcFFF97Bdzav9cFFF;7FFF:;u83dwdnadTmbaicd4hodnabmbdnalTmbcbhrinaealarcdtfydbao2cdtfhwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkarcefgrad9hmbxikkaocdthrcbhwincbhiinavcCfaifgDaeaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkaearfheawcefgwad9hmbxdkkdnalTmbcbhrinabarcx2fgiaealarcdtfydbao2cdtfgwIdbUdbaiawIdlUdlaiawIdwUdwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkarcefgrad9hmbxdkkaocdthlcbhraehwinabarcx2fgiaearao2cdtfgDIdbUdbaiaDIdlUdlaiaDIdwUdwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkawalfhwarcefgrad9hmbkkJbbbbavIdwavIdCgk:tgqaqJbbbb9DEgqavIdxavIdKgx:tgmamaq9DEgqavIdzavId3gm:tgPaPaq9DEhPdnabTmbadTmbJbbbbJbbjZaP:vaPJbbbb9BEhqinabaqabIdbak:tNUdbabclfgvaqavIdbax:tNUdbabcwfgvaqavIdbam:tNUdbabcxfhbadcufgdmbkkaPk8MbabaeadaialavcbcbcbcbcbaoarawaDz:bjjjbk8MbabaeadaialavaoarawaDaqakaxamaPz:bjjjbk:nCoDud99rue99lul998Jjjjjbc;Wb9Rgw8KjjjjbdndnarmbcbhDxekawcxfcbc;Kbz:ljjjb8Aawcuadcx2adc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbgqBdxawceBd2aqaeadaicbz:djjjb8AawcuadcdtadcFFFFi0Egkcbyd;S1jjbHjjjjbbgxBdzawcdBd2adcd4adfhmceheinaegicetheaiam6mbkcbhPawcuaicdtgsaicFFFFi0Ecbyd;S1jjbHjjjjbbgzBdCawciBd2dndnar:ZgH:rJbbbZMgO:lJbbb9p9DTmbaO:Ohexekcjjjj94hekaicufhAc:bwhmcbhCadhXcbhQinaChLaeamgKcufaeaK9iEaPgDcefaeaD9kEhYdndnadTmbaYcuf:YhOaqhiaxheadhmindndnaiIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcCthCdndnaiclfIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhExekcjjjj94hEkaEcqtaCVhCdndnaicwfIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhExekcjjjj94hEkaeaCaEVBdbaicxfhiaeclfheamcufgmmbkazcFeasz:ljjjbh3cbh5cbh8Eindna3axa8EcdtfydbgCcm4aC7c:v;t;h;Ev2gics4ai7aAGgmcdtfgEydbgecuSmbaeaCSmbcehiina3amaifaAGgmcdtfgEydbgecuSmeaicefhiaeaC9hmbkkaEaCBdba5aecuSfh5a8Ecefg8Ead9hmbxdkkazcFeasz:ljjjb8Acbh5kaDaYa5ar0giEhPaLa5aiEhCdna5arSmbaYaKaiEgmaP9Rcd9imbdndnaQcl0mbdnaX:ZgOaL:Zg8A:taY:Yg8FaD:Y:tgaa8FaK:Y:tgha5:ZggaH:tNNNaOaH:tahNa8Aag:tNa8AaH:taaNagaO:tNM:va8FMJbbbZMgO:lJbbb9p9DTmbaO:Ohexdkcjjjj94hexekaPamfcd9Theka5aXaiEhXaQcefgQcs9hmekkdndnaCmbcihicbhDxekcbhiawakcbyd;S1jjbHjjjjbbg8EBdKawclBd2aPcuf:Yh8AdndnadTmbaqhiaxheadhmindndnaiIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhCxekcjjjj94hCkaCcCthCdndnaiclfIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhExekcjjjj94hEkaEcqtaCVhCdndnaicwfIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhExekcjjjj94hEkaeaCaEVBdbaicxfhiaeclfheamcufgmmbkazcFeasz:ljjjbh3cbhDcbh5inaxa5cdtgYfydbgCcm4aC7c:v;t;h;Ev2gics4ai7hecbhidndnina3aeaAGgmcdtfgEydbgecuSmednaxaecdtgEfydbaCSmbaicefgiamfheaiaA9nmekka8EaEfydbhixekaEa5BdbaDhiaDcefhDka8EaYfaiBdba5cefg5ad9hmbkcuaDc32giaDc;j:KM;jb0EhexekazcFeasz:ljjjb8AcbhDcbhekawaecbyd;S1jjbHjjjjbbgeBd3awcvBd2aecbaiz:ljjjbhEavcd4hxdnadTmbdnalTmbaxcdth3a8EhCalheaqhmadhAinaEaCydbc32fgiamIdbaiIdbMUdbaiamclfIdbaiIdlMUdlaiamcwfIdbaiIdwMUdwaiaeIdbaiIdxMUdxaiaeclfIdbaiIdzMUdzaiaecwfIdbaiIdCMUdCaiaiIdKJbbjZMUdKaCclfhCaea3fheamcxfhmaAcufgAmbxdkka8EhmaqheadhCinaEamydbc32fgiaeIdbaiIdbMUdbaiaeclfIdbaiIdlMUdlaiaecwfIdbaiIdwMUdwaiaiIdxJbbbbMUdxaiaiIdzJbbbbMUdzaiaiIdCJbbbbMUdCaiaiIdKJbbjZMUdKamclfhmaecxfheaCcufgCmbkkdnaDTmbaEhiaDheinaiaiIdbJbbbbJbbjZaicKfIdbgO:vaOJbbbb9BEgONUdbaiclfgmaOamIdbNUdbaicwfgmaOamIdbNUdbaicxfgmaOamIdbNUdbaiczfgmaOamIdbNUdbaicCfgmaOamIdbNUdbaic3fhiaecufgembkkcbhCawcuaDcdtgYaDcFFFFi0Egicbyd;S1jjbHjjjjbbgeBdaawcoBd2awaicbyd;S1jjbHjjjjbbg3Bd8KaecFeaYz:ljjjbh5dnadTmbJbbjZJbbjZa8A:vaPceSEaoNgOaONh8Aaxcdthxalheina8Aaec;C1jjbalEgmIdwaEa8EydbgAc32fgiIdC:tgOaONamIdbaiIdx:tgOaONamIdlaiIdz:tgOaONMMNaqcwfIdbaiIdw:tgOaONaqIdbaiIdb:tgOaONaqclfIdbaiIdl:tgOaONMMMhOdndna5aAcdtgifgmydbcuSmba3aifIdbaO9ETmekamaCBdba3aifaOUdbka8Eclfh8EaeaxfheaqcxfhqadaCcefgC9hmbkkaba5aYz:kjjjb8AcrhikaicdthiinaiTmeaic98fgiawcxffydbcbyd;O1jjbH:bjjjbbxbkkawc;Wbf8KjjjjbaDk:Odieui99iu8Jjjjjbca9RgicFFF;7rBd3ai9cFFF;7;3FF:;Fb83dCaicFFF97Bdzai9cFFF;7FFF:;u83dwdndnaembJbbjFhlJbbjFhvJbbjFhoxekadcd4cdthrcbhwincbhdinaicCfadfgDabadfIdbglaDIdbgvaval9EEUdbaicwfadfgDalaDIdbgvaval9DEUdbadclfgdcx9hmbkabarfhbawcefgwae9hmbkaiIdzaiId3:thoaiIdxaiIdK:thvaiIdwaiIdC:thlkJbbbbalalJbbbb9DEglavaval9DEglaoaoal9DEk9DeeuabcFeaicdtz:ljjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk9teiucbcbyd;W1jjbgeabcifc98GfgbBd;W1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd;W1jjbgeabcrfc94GfgbBd;W1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd;W1jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd;W1jjbfgdBd;W1jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk6eiucbhidnadTmbdninabRbbglaeRbbgv9hmeaecefheabcefhbadcufgdmbxdkkalav9Rhikaikk:bedbcjwk9Oeeebeebebbeeebebbbbbebebbbbbbbbbebbbdbbbbbbbebbbebbbdbbbbbbbbbbbeeeeebebbebbebebbbeebbbbbbbbbbbbbbbbbbbbbc;OwkxebbbdbbbjNbb",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var y=new Uint8Array(m.length),b=0;b<m.length;++b){var x=m.charCodeAt(b);y[b]=x>96?x-97:x>64?x-39:x+4}for(var A=0,b=0;b<m.length;++b)y[A++]=y[b]<60?t[y[b]]:(y[b]-60)*64+y[++b];return y.buffer.slice(0,A)}function r(m){if(!m)throw new Error("Assertion failed")}function s(m){return new Uint8Array(m.buffer,m.byteOffset,m.byteLength)}function a(m,y,b){var x=n.exports.sbrk,A=x(y.length*4),C=x(b*4),S=new Uint8Array(n.exports.memory.buffer),v=s(y);S.set(v,A);var P=m(C,A,y.length,b);S=new Uint8Array(n.exports.memory.buffer);var M=new Uint32Array(b);new Uint8Array(M.buffer).set(S.subarray(C,C+b*4)),v.set(S.subarray(A,A+y.length*4)),x(A-x(0));for(var R=0;R<y.length;++R)y[R]=M[y[R]];return[M,P]}function l(m){for(var y=0,b=0;b<m.length;++b){var x=m[b];y=y<x?x:y}return y}function u(m,y,b,x,A,C,S,v,P){var M=n.exports.sbrk,R=M(4),L=M(b*4),F=M(A*C),_=M(b*4),w=new Uint8Array(n.exports.memory.buffer);w.set(s(x),F),w.set(s(y),_);var D=m(L,_,b,F,A,C,S,v,P,R);w=new Uint8Array(n.exports.memory.buffer);var I=new Uint32Array(D);s(I).set(w.subarray(L,L+D*4));var N=new Float32Array(1);return s(N).set(w.subarray(R,R+4)),M(R-M(0)),[I,N[0]]}function f(m,y,b,x,A,C,S,v,P,M,R,L,F){var _=n.exports.sbrk,w=_(4),D=_(b*4),I=_(A*C),N=_(A*v),k=_(P.length*4),z=_(b*4),V=M?_(A):0,j=new Uint8Array(n.exports.memory.buffer);j.set(s(x),I),j.set(s(S),N),j.set(s(P),k),j.set(s(y),z),M&&j.set(s(M),V);var U=m(D,z,b,I,A,C,N,v,k,P.length,V,R,L,F,w);j=new Uint8Array(n.exports.memory.buffer);var q=new Uint32Array(U);s(q).set(j.subarray(D,D+U*4));var Y=new Float32Array(1);return s(Y).set(j.subarray(w,w+4)),_(w-_(0)),[q,Y[0]]}function h(m,y,b,x){var A=n.exports.sbrk,C=A(b*x),S=new Uint8Array(n.exports.memory.buffer);S.set(s(y),C);var v=m(C,b,x);return A(C-A(0)),v}function p(m,y,b,x,A,C,S,v){var P=n.exports.sbrk,M=P(v*4),R=P(b*x),L=P(b*C),F=new Uint8Array(n.exports.memory.buffer);F.set(s(y),R),A&&F.set(s(A),L);var _=m(M,R,b,x,L,C,S,v);F=new Uint8Array(n.exports.memory.buffer);var w=new Uint32Array(_);return s(w).set(F.subarray(M,M+_*4)),P(M-P(0)),w}var g={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1<<30};return{ready:i,supported:!0,useExperimentalFeatures:!1,compactMesh:function(m){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0);var y=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m);return a(n.exports.meshopt_optimizeVertexFetchRemap,y,l(m)+1)},simplify:function(m,y,b,x,A,C){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(y instanceof Float32Array),r(y.length%b==0),r(b>=3),r(x>=0&&x<=m.length),r(x%3==0),r(A>=0);for(var S=0,v=0;v<(C?C.length:0);++v)r(C[v]in g),r(this.useExperimentalFeatures||C[v]!="Prune"),S|=g[C[v]];var P=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),M=u(n.exports.meshopt_simplify,P,m.length,y,y.length/b,b*4,x,A,S);return M[0]=m instanceof Uint32Array?M[0]:new m.constructor(M[0]),M},simplifyWithAttributes:function(m,y,b,x,A,C,S,v,P,M){r(this.useExperimentalFeatures),r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(y instanceof Float32Array),r(y.length%b==0),r(b>=3),r(x instanceof Float32Array),r(x.length%A==0),r(A>=0),r(S==null||S instanceof Uint8Array),r(S==null||S.length==y.length/b),r(v>=0&&v<=m.length),r(v%3==0),r(P>=0),r(Array.isArray(C)),r(A>=C.length),r(C.length<=32);for(var R=0;R<C.length;++R)r(C[R]>=0);for(var L=0,R=0;R<(M?M.length:0);++R)r(M[R]in g),L|=g[M[R]];var F=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),_=f(n.exports.meshopt_simplifyWithAttributes,F,m.length,y,y.length/b,b*4,x,A*4,new Float32Array(C),S?new Uint8Array(S):null,v,P,L);return _[0]=m instanceof Uint32Array?_[0]:new m.constructor(_[0]),_},getScale:function(m,y){return r(m instanceof Float32Array),r(m.length%y==0),r(y>=3),h(n.exports.meshopt_simplifyScale,m,m.length/y,y*4)},simplifyPoints:function(m,y,b,x,A,C){return r(this.useExperimentalFeatures),r(m instanceof Float32Array),r(m.length%y==0),r(y>=3),r(b>=0&&b<=m.length/y),x?(r(x instanceof Float32Array),r(x.length%A==0),r(A>=3),r(m.length/y==x.length/A),p(n.exports.meshopt_simplifyPoints,m,m.length/y,y*4,x,A*4,C,b)):p(n.exports.meshopt_simplifyPoints,m,m.length/y,y*4,void 0,0,0,b)}}}();typeof c1=="object"&&typeof p9=="object"?p9.exports=tz:typeof define=="function"&&define.amd?define([],function(){return tz}):typeof c1=="object"?c1.MeshoptSimplifier=tz:(typeof self<"u"?self:c1).MeshoptSimplifier=tz});var Xre=Xn((l1,_9)=>{var nz=function(){var e="b9H79Tebbbefx9Geueu9Geub9Gbb9Giuuueu9Gkuuuuuuuuuu99eu9Gvuuuuueu9Gkuuuuuuuuu9999eu9Gruuuuuuub9Gkuuuuuuuuuuueu9Gouuuuuub9Giuuub9GluuuubiOHdilvorwDqrkbiibeilve9Weiiviebeoweuec:q:Odkr:Yewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9I919P29K9nW79O2Wt79c9V919U9KbeX9TW79O9V9Wt9F9I919P29K9nW79O2Wt7bd39TW79O9V9Wt9F9J9V9T9W91tWJ2917tWV9c9V919U9K7br39TW79O9V9Wt9F9J9V9T9W91tW9nW79O2Wt9c9V919U9K7bDL9TW79O9V9Wt9F9V9Wt9P9T9P96W9nW79O2Wtbql79IV9RbkDwebcekdsPq;L9kHdbkIbabaec9:fgefcufae9Ugeabci9Uadfcufad9Ugbaeab0Ek:oAlPue99eux998Jjjjjbc:We9Rgk8Kjjjjbakc;mbfcbc;Kbz:njjjb8AakcuaocdtgxaocFFFFi0Egmcbyd:e1jjbHjjjjbbgPBd9makceBd:SeakaPBdnakamcbyd:e1jjbHjjjjbbgsBd9qakcdBd:SeakasBd9eakcualcdtalcFFFFi0Ecbyd:e1jjbHjjjjbbgzBd9uakazBd9iakciBd:SeaPcbaxz:njjjbhHalci9UhOdnalTmbaihPalhAinaHaPydbcdtfgCaCydbcefBdbaPclfhPaAcufgAmbkkdnaoTmbcbhPashAaHhCaohXinaAaPBdbaAclfhAaCydbaPfhPaCclfhCaXcufgXmbkkdnalci6mbcbhPaihAinaAcwfydbhCaAclfydbhXasaAydbcdtfgQaQydbgQcefBdbazaQcdtfaPBdbasaXcdtfgXaXydbgXcefBdbazaXcdtfaPBdbasaCcdtfgCaCydbgCcefBdbazaCcdtfaPBdbaAcxfhAaOaPcefgP9hmbkkdnaoTmbaHhAashPaohCinaPaPydbaAydb9RBdbaAclfhAaPclfhPaCcufgCmbkkakamcbyd:e1jjbHjjjjbbgPBd9yakclBd:SeaPaHaxz:mjjjbhmakaOcbyd:e1jjbHjjjjbbgPBd9CakcvBd:SeaPcbaOz:njjjbhLakcuaOcK2alcjjjjd0Ecbyd:e1jjbHjjjjbbgKBd9GakcoBd:SeJbbbbhYdnalci6g8Ambarcd4hxaihAaKhPaOhrJbbbbhEinavaAclfydbax2cdtfgCIdlh3avaAydbax2cdtfgXIdlhYavaAcwfydbax2cdtfgQIdlh5aCIdwh8EaXIdwh8FaQIdwhaaPaCIdbghaXIdbggMaQIdbg8JMJbbnn:vUdbaPclfaXIdlaCIdlMaQIdlMJbbnn:vUdbaQIdwh8KaCIdwh8LaXIdwh8MaPcxfa3aY:tg3aaa8F:tgaNa5aY:tg5a8Ea8F:tg8EN:tgYJbbbbJbbjZahag:tgha5Na8Jag:tgga3N:tg8Fa8FNaYaYNa8EagNaaahN:tgYaYNMM:rgg:vagJbbbb9BEg3NUdbaPczfaYa3NUdbaPcCfa8Fa3NUdbaPcwfa8Ka8Ma8LMMJbbnn:vUdbaEagMhEaAcxfhAaPcKfhParcufgrmbkaEaO:Z:vJbbbZNhYkakcuaOcdtalcFFFF970Ecbyd:e1jjbHjjjjbbgCBd9KakcrBd:SeaYaD:ZN:rhYdna8AmbcbhPaChAinaAaPBdbaAclfhAaOaPcefgP9hmbkkaYJbbbZNh8MakcuaOcltalcFFFFd0Ecbyd:e1jjbHjjjjbbg8ABd9OakcwBd:Secba8AaKaCaOz:djjjb8Aakaocbyd:e1jjbHjjjjbbgPBd2aPcFeaoz:njjjbhrakc8Wfcwf9cb83ibak9cb83i8WcbhPJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgcbhlinJbbbbh3dnaPTmbJbbjZaP:Z:vh3kaka8Ea3NgaUdaaka5a3NghUd3akaEa3Ng8JUdKJbbbbh3dnagagNaYaYNa8Fa8FNMMg8KJbbbb9BmbJbbjZa8K:r:vh3kakaga3NUd8Saka8Fa3NUdyakaYa3NUd8Kdndndnakyd8WgQakydUgAakcKfaeaiakc;abfaKamara8Maqz:ejjjbgCcuSmbdnaPaD9pmbaAaraiaCcx2fgXydbfRbbcFeSfaraXclfydbfRbbcFeSfaraXcwfydbfRbbcFeSfaw9nmdkaQaAcbaeaiakc;abfaKamara8MJbbbbz:ejjjbgCcu9hmekakaaUdCakahUdzaka8JUdxakcuBdwakcFFF;7rBdla8AcbaKaLakcxfakcwfakclfz:fjjjbakydwgCcuSmekdnakc8WfaiaCcx2fgOydbgPaOclfydbgAaOcwfydbgXarabaeadalawaDz:gjjjbTmbalcefhlJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgkamaPcdtfgPaPydbcufBdbamaAcdtfgPaPydbcufBdbamaXcdtfgPaPydbcufBdbcbhXinazasaOaXcdtfydbcdtgAfydbcdtfgxhPaHaAfgvydbgQhAdnaQTmbdninaPydbaCSmeaPclfhPaAcufgATmdxbkkaPaxaQcdtfc98fydbBdbavavydbcufBdbkaXcefgXci9hmbkaKaCcK2fgPIdbh3aPIdlhaaPIdwhhaPIdxh8JaPIdzh8KaPIdCh8LaLaCfce86bbaga8LMhga8Fa8KMh8FaYa8JMhYa8EahMh8Ea5aaMh5aEa3MhEakyd88hPxekkdnaPTmbdnakyd80gAaPci2fgCciGTmbadaCfcbaPaAcu7fciGcefz:njjjb8AkabalcltfgPak8Pi8W83dbaPcwfakc8Wfcwf8Pib83dbalcefhlkcahPdninaPc98Smeakc;mbfaPfydbcbydj1jjbH:bjjjbbaPc98fhPxbkkakc:Wef8Kjjjjbalk;3vivuv99lu8Jjjjjbca9Rgv8Kjjjjbdndnalcw0mbaiydbhoaeabcitfgralcdtcufBdlaraoBdbdnalcd6mbaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkkalabfhrxekcbhDavczfcwfcbBdbav9cb83izavcwfcbBdbav9cb83ibJbbjZhqJbbjZhkinadaiaDcdtfydbcK2fhwcbhrinavczfarfgoawarfIdbgxaoIdbgm:tgPakNamMgmUdbavarfgoaPaxam:tNaoIdbMUdbarclfgrcx9hmbkJbbjZaqJbbjZMgq:vhkaDcefgDal9hmbkcbhoadcbcecdavIdlgxavIdwgm9GEgravIdbgPam9GEaraPax9GEgscdtgrfhzavczfarfIdbhxaihralhwinaiaocdtfgDydbhHaDarydbgOBdbaraHBdbarclfhraoazaOcK2fIdbax9Dfhoawcufgwmbkaeabcitfhrdndnaocv6mbaoalc98f6mekaraiydbBdbaralcdtcufBdlaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkalabfhrxekaraxUdbaeabcitfgrarydlc98GasVBdlabcefaeadaiaoz:djjjbhwararydlciGawabcu7fcdtVBdlawaeadaiaocdtfalao9Rz:djjjbhrkavcaf8Kjjjjbark;Bloeue99vue99Due99dndnaembcuhkxekJbbjZaq:thxaiabcdtfhmavydbhPavydlhsavydwhzcbhHJFFuuhOcvhbcuhkindnaPamaHcdtfydbcdtgvfydbgATmbazasavfydbcdtfhiindndnawalaiydbgCcx2fgvclfydbgXfRbbcFeSawavydbgQfRbbcFeSfawavcwfydbgLfRbbcFeSfgKmbcbhvxekcehvaraQcdtfydbgYceSmbcehvaraXcdtfydbg8AceSmbcehvaraLcdtfydbgEceSmbdna8AcdSaYcdSfaEcdSfcd6mbaKcefhvxekaKcdfhvkdnavab9kmbdndnadTmbaoaCcK2fgQIdwadIdw:tg3a3NaQIdbadIdb:tg3a3NaQIdladIdl:tg3a3NMM:raD:vaxNJbbjZMJ9VO:d86JbbjZaQIdCadIdCNaQIdxadIdxNaQIdzadIdzNMMaqN:tg3a3J9VO:d869DENh3xekaraQcdtfydbaraXcdtfydbfaraLcdtfydbfc99f:Zh3kaCakavab6a3aO9DVgQEhkavabaQEhba3aOaQEhOkaiclfhiaAcufgAmbkkaHcefgHae9hmbkkakk;bddlue99dndndnabaecitfgrydlgwciGgDci9hmbarclfhqxekinabcbawcd4gwalaDcdtfIdbabaecitfIdb:tgkJbbbb9FEgDaecefgefadaialavaoz:fjjjbak:laoIdb9FTmdabaDaw7aefgecitfgrydlgwciGgDci9hmbkarclfhqkabaecitfhecuhbindnaiaeydbgDfRbbmbadaDcK2fgrIdwalIdw:tgkakNarIdbalIdb:tgkakNarIdlalIdl:tgkakNMM:rgkaoIdb9DTmbaoakUdbavaDBdbaqydbhwkaecwfheabcefgbawcd46mbkkk;yleoudnaladfgkRbbcFeSalaefgxRbbgmcFeSfabydwgPfalaifgsRbbcFeSfaD0abydxaq9pVgzce9hmbavawcltfgmab8Pdb83dbamcwfabcwfgm8Pdb83dbdndnamydbmbcbhqxekcbhDaohminalamabydbcdtfydbfcFe86bbamclfhmaDcefgDabydwgq6mbkkdnabydxglci2gDabydlgmfgPciGTmbaraPfcbalamcu7fciGcefz:njjjb8Aabydxci2hDabydlhmabydwhqkab9cb83dwababydbaqfBdbabaDcifc98GamfBdlaxRbbhmcbhPkdnamcFeGcFe9hmbaxaP86bbababydwgmcefBdwaoabydbcdtfamcdtfaeBdbkdnakRbbcFe9hmbakabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfadBdbkdnasRbbcFe9hmbasabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfaiBdbkarabydlfabydxci2faxRbb86bbarabydlfabydxci2fcefakRbb86bbarabydlfabydxci2fcdfasRbb86bbababydxcefBdxazk;Ckovud99euv99eul998Jjjjjbc:G;ae9Rgo8KjjjjbdndnadTmbavcd4hrcbhwcbhDindnaiaeclfydbar2cdtfgvIdbaiaeydbar2cdtfgqIdbgk:tgxaiaecwfydbar2cdtfgmIdlaqIdlgP:tgsNamIdbak:tgzavIdlaP:tgPN:tgkakNaPamIdwaqIdwgH:tgONasavIdwaH:tgHN:tgPaPNaHazNaOaxN:tgxaxNMM:rgsJbbbb9Bmbaoc:G:qefawcx2fgAakas:vUdwaAaxas:vUdlaAaPas:vUdbaocafawc8K2fgAaq8Pdb83dbaAav8Pdb83dxaAam8Pdb83dKaAcwfaqcwfydbBdbaAcCfavcwfydbBdbaAcafamcwfydbBdbawcefhwkaecxfheaDcifgDad6mbkab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbawTmeao9cb83iKao9cb83izaoczfaocafawci2z1jjjbaoIdKhCaoIdChXaoIdzhQao9cb83iwao9cb83ibaoaoc:G:qefawz1jjjbJbbjZhkaoIdwgPJbbbbJbbjZaPaPNaoIdbgPaPNaoIdlgsasNMM:rgx:vaxJbbbb9BEgzNhxasazNhsaPazNhzaoc:G:qefheawhvinaecwfIdbaxNaeIdbazNasaeclfIdbNMMgPakaPak9DEhkaecxfheavcufgvmbkabaCUdwabaXUdlabaQUdbabaoId3UdxdndnakJ;n;m;m899FmbJbbbbhPaoc:G:qefheaocafhvinaCavcwfIdb:taecwfIdbgHNaQavIdb:taeIdbgONaXavclfIdb:taeclfIdbgLNMMaxaHNazaONasaLNMM:vgHaPaHaP9EEhPavc8KfhvaecxfheawcufgwmbkabazUd3abc8KfaxUdbabcafasUdbabcKfaCaxaPN:tUdbabcCfaXasaPN:tUdbabaQazaPN:tUdzabJbbjZakakN:t:rgkUdydndnaxJbbj:;axJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;axJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohexekcjjjj94hekabc8Ufae86bbdndnasJbbj:;asJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;asJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabcRfav86bbdndnazJbbj:;azJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;azJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohqxekcjjjj94hqkabaq86b8SdndnaecKtcK91:YJbb;:9c:vax:t:lavcKtcK91:YJbb;:9c:vas:t:laqcKtcK91:YJbb;:9c:vaz:t:lakMMMJbb;:9cNJbbjZMgk:lJbbb9p9DTmbak:Ohexekcjjjj94hekaecFbaecFb9iEhexekabcjjj;8iBdycFbhekabae86b8Vxekab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbkaoc:G;aef8Kjjjjbk:mvdouq99cbhi8Jjjjjbca9RglczfcwfcbBdbal9cb83izalcwfcbBdbal9cb83ibdnadTmbcbhvinaeaifhocbhrinalczfarfgwavawydbgwaoarfIdbgDaearawcx2ffIdb9DEBdbalarfgwavawydbgwaDaearawcx2ffIdb9EEBdbarclfgrcx9hmbkaicxfhiavcefgvad9hmbkkJbbbbhDcbhrcbhicbhvinaealarfydbcx2fgwIdwaealczfarfydbcx2fgoIdw:tgqaqNawIdbaoIdb:tgqaqNawIdlaoIdl:tgqaqNMMgqaDaqaD9EgwEhDavaiawEhiarclfhravcefgvci9hmbkaealczfaicdtgvfydbcx2fgrIdwaealavfydbcx2fglIdwMJbbbZNhqarIdlalIdlMJbbbZNhkarIdbalIdbMJbbbZNhxaD:rJbbbZNhDdnadTmbindnaecwfIdbgmaq:tgPaPNaeIdbgsax:tgPaPNaeclfIdbgzak:tgPaPNMMgPaDaDN9ETmbaqaDaP:rgH:vJbbbZNJbbbZMgPNamJbbjZaP:tgONMhqakaPNazaONMhkaxaPNasaONMhxaDaHMJbbbZNhDkaecxfheadcufgdmbkkabaDUdxabaqUdwabakUdlabaxUdbkjeeiu8Jjjjjbcj8W9Rgr8Kjjjjbaici2hwdnaiTmbawceawce0EhDarhiinaiaeadRbbcdtfydbBdbadcefhdaiclfhiaDcufgDmbkkabarawaladaoz:hjjjbarcj8Wf8Kjjjjbk:Ylequ8Jjjjjbcjx9Rgl8Kjjjjbcbhvalcjqfcbaiz:njjjb8AdndnadTmbcjehoaehrincuhwarhDcuhqavhkdninawakaoalcjqfaDcefRbbfRbb9RcFeGci6aoalcjqfaDRbbfRbb9RcFeGci6faoalcjqfaDcdfRbbfRbb9RcFeGci6fgxaq9mgmEhwdnammbaxce0mdkaxaqaxaq9kEhqaDcifhDadakcefgk9hmbkkaeawci2fgDcdfRbbhqaDcefRbbhxaDRbbhkaeavci2fgDcifaDawav9Rci2z:qjjjb8Aakalcjqffaocefgo86bbaxalcjqffao86bbaDcdfaq86bbaDcefax86bbaDak86bbaqalcjqffao86bbarcifhravcefgvad9hmbkalcFeaiz:njjjbhoadci2gDceaDce0EhqcbhxindnaoaeRbbgkfgwRbbgDcFe9hmbawax86bbaocjdfaxcdtfabakcdtfydbBdbaxhDaxcefhxkaeaD86bbaecefheaqcufgqmbkaxcdthDxekcbhDkabalcjdfaDz:mjjjb8Aalcjxf8Kjjjjbk9teiucbcbyd11jjbgeabcifc98GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd11jjbgeabcrfc94GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd11jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd11jjbfgdBd11jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk:;Deludndndnadch9pmbabaeSmdaeabadfgi9Rcbadcet9R0mekabaead;8qbbxekaeab7ciGhldndndnabae9pmbdnalTmbadhvabhixikdnabciGmbadhvabhixdkadTmiabaeRbb86bbadcufhvdnabcefgiciGmbaecefhexdkavTmiabaeRbe86beadc9:fhvdnabcdfgiciGmbaecdfhexdkavTmiabaeRbd86bdadc99fhvdnabcifgiciGmbaecifhexdkavTmiabaeRbi86biabclfhiaeclfheadc98fhvxekdnalmbdnaiciGTmbadTmlabadcufgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc9:fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc99fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc98fgdfaeadfRbb86bbkadcl6mbdnadc98fgocd4cefciGgiTmbaec98fhlabc98fhvinavadfaladfydbBdbadc98fhdaicufgimbkkaocx6mbaec9Wfhvabc9WfhoinaoadfgicxfavadfglcxfydbBdbaicwfalcwfydbBdbaiclfalclfydbBdbaialydbBdbadc9Wfgdci0mbkkadTmdadhidnadciGglTmbaecufhvabcufhoadhiinaoaifavaifRbb86bbaicufhialcufglmbkkadcl6mdaec98fhlabc98fhvinavaifgecifalaifgdcifRbb86bbaecdfadcdfRbb86bbaecefadcefRbb86bbaeadRbb86bbaic98fgimbxikkavcl6mbdnavc98fglcd4cefcrGgdTmbavadcdt9RhvinaiaeydbBdbaeclfheaiclfhiadcufgdmbkkalc36mbinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaiaeydzBdzaiaeydCBdCaiaeydKBdKaiaeyd3Bd3aecafheaicafhiavc9Gfgvci0mbkkavTmbdndnavcrGgdmbavhlxekavc94GhlinaiaeRbb86bbaicefhiaecefheadcufgdmbkkavcw6mbinaiaeRbb86bbaiaeRbe86beaiaeRbd86bdaiaeRbi86biaiaeRbl86blaiaeRbv86bvaiaeRbo86boaiaeRbr86braicwfhiaecwfhealc94fglmbkkabkkAebcjwkxebbbdbbbzNbb",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var y=new Uint8Array(m.length),b=0;b<m.length;++b){var x=m.charCodeAt(b);y[b]=x>96?x-97:x>64?x-39:x+4}for(var A=0,b=0;b<m.length;++b)y[A++]=y[b]<60?t[y[b]]:(y[b]-60)*64+y[++b];return y.buffer.slice(0,A)}function r(m){if(!m)throw new Error("Assertion failed")}function s(m){return new Uint8Array(m.buffer,m.byteOffset,m.byteLength)}var a=48,l=16;function u(m,y){var b=m.meshlets[y*4+0],x=m.meshlets[y*4+1],A=m.meshlets[y*4+2],C=m.meshlets[y*4+3];return{vertices:m.vertices.subarray(b,b+A),triangles:m.triangles.subarray(x,x+C*3)}}function f(m,y,b,x,A,C,S){var v=n.exports.sbrk,P=n.exports.meshopt_buildMeshletsBound(m.length,A,C),M=v(P*l),R=v(P*A*4),L=v(P*C*3),F=v(m.byteLength),_=v(y.byteLength),w=new Uint8Array(n.exports.memory.buffer);w.set(s(m),F),w.set(s(y),_);var D=n.exports.meshopt_buildMeshlets(M,R,L,F,m.length,_,b,x,A,C,S);w=new Uint8Array(n.exports.memory.buffer);for(var I=w.subarray(M,M+D*l),N=new Uint32Array(I.buffer,I.byteOffset,I.byteLength/4).slice(),k=0;k<D;++k){var z=N[k*4+0],V=N[k*4+1],b=N[k*4+2],j=N[k*4+3];n.exports.meshopt_optimizeMeshlet(R+z*4,L+V,j,b)}var U=N[(D-1)*4+0],q=N[(D-1)*4+1],Y=N[(D-1)*4+2],te=N[(D-1)*4+3],K=U+Y,Z=q+(te*3+3&-4),ee={meshlets:N,vertices:new Uint32Array(w.buffer,R,K).slice(),triangles:new Uint8Array(w.buffer,L,Z*3).slice(),meshletCount:D};return v(M-v(0)),ee}function h(m){var y=new Float32Array(n.exports.memory.buffer,m,a/4);return{centerX:y[0],centerY:y[1],centerZ:y[2],radius:y[3],coneApexX:y[4],coneApexY:y[5],coneApexZ:y[6],coneAxisX:y[7],coneAxisY:y[8],coneAxisZ:y[9],coneCutoff:y[10]}}function p(m,y,b,x){var A=n.exports.sbrk,C=[],S=A(y.byteLength),v=A(m.vertices.byteLength),P=A(m.triangles.byteLength),M=A(a),R=new Uint8Array(n.exports.memory.buffer);R.set(s(y),S),R.set(s(m.vertices),v),R.set(s(m.triangles),P);for(var L=0;L<m.meshletCount;++L){var F=m.meshlets[L*4+0],_=m.meshlets[L*4+0+1],w=m.meshlets[L*4+0+3];n.exports.meshopt_computeMeshletBounds(M,v+F*4,P+_,w,S,b,x),C.push(h(M))}return A(S-A(0)),C}function g(m,y,b,x){var A=n.exports.sbrk,C=A(a),S=A(m.byteLength),v=A(y.byteLength),P=new Uint8Array(n.exports.memory.buffer);P.set(s(m),S),P.set(s(y),v),n.exports.meshopt_computeClusterBounds(C,S,m.length,v,b,x);var M=h(C);return A(C-A(0)),M}return{ready:i,supported:!0,buildMeshlets:function(m,y,b,x,A,C){r(m.length%3==0),r(y instanceof Float32Array),r(y.length%b==0),r(b>=3),r(x<=255||x>0),r(A<=512),r(A%4==0),C=C||0;var S=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m);return f(S,y,y.length/b,b*4,x,A,C)},computeClusterBounds:function(m,y,b){r(m.length%3==0),r(m.length/3<=512),r(y instanceof Float32Array),r(y.length%b==0),r(b>=3);var x=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m);return g(x,y,y.length/b,b*4)},computeMeshletBounds:function(m,y,b){return r(m.meshletCount!=0),r(y instanceof Float32Array),r(y.length%b==0),r(b>=3),p(m,y,y.length/b,b*4)},extractMeshlet:function(m,y){return r(y>=0&&y<m.meshletCount),u(m,y)}}}();typeof l1=="object"&&typeof _9=="object"?_9.exports=nz:typeof define=="function"&&define.amd?define([],function(){return nz}):typeof l1=="object"?l1.MeshoptClusterizer=nz:(typeof self<"u"?self:l1).MeshoptClusterizer=nz});var $re=Xn((qrn,Kre)=>{var dke=Wre(),hke=qre(),mke=Yre(),pke=Xre();Kre.exports={MeshoptEncoder:dke,MeshoptDecoder:hke,MeshoptSimplifier:mke,MeshoptClusterizer:pke}});var lue=Xn((WRn,cue)=>{"use strict";cue.exports=Eqe;var sL=1e20;function Eqe(e,t){t||(t={});var n=t.cutoff==null?.25:t.cutoff,i=t.radius==null?8:t.radius,o=t.channel||0,r,s,a,l,u,f,h,p,g,m,y;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");r=t.width,s=t.height,l=e,t.stride?f=t.stride:f=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(p=e,h=p.getContext("2d"),r=p.width,s=p.height,g=h.getImageData(0,0,r,s),l=g.data,f=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(p=e.canvas,h=e,r=p.width,s=p.height,g=h.getImageData(0,0,r,s),l=g.data,f=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,l=g.data,f=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(u=l,l=Array(r*s),m=0,y=Math.floor(u.length/f);m<y;m++)l[m]=u[m*f+o]/255;else if(f!==1)throw Error("Raw data can have only 1 value per pixel");var b=Array(r*s),x=Array(r*s),A=Array(a),C=Array(a),S=Array(a+1),v=Array(a);for(m=0,y=r*s;m<y;m++){var P=l[m];b[m]=P===1?0:P===0?sL:Math.pow(Math.max(0,.5-P),2),x[m]=P===1?sL:P===0?0:Math.pow(Math.max(0,P-.5),2)}sue(b,r,s,A,C,v,S),sue(x,r,s,A,C,v,S);var M=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(m=0,y=r*s;m<y;m++)M[m]=Math.min(Math.max(1-((b[m]-x[m])/i+n),0),1);return M}function sue(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var l=0;l<n;l++)i[l]=e[l*t+a];for(aue(i,o,r,s,n),l=0;l<n;l++)e[l*t+a]=o[l]}for(l=0;l<n;l++){for(a=0;a<t;a++)i[a]=e[l*t+a];for(aue(i,o,r,s,t),a=0;a<t;a++)e[l*t+a]=Math.sqrt(o[a])}}function aue(e,t,n,i,o){n[0]=0,i[0]=-sL,i[1]=+sL;for(var r=1,s=0;r<o;r++){for(var a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);a<=i[s];)s--,a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);s++,n[s]=r,i[s]=a,i[s+1]=+sL}for(r=0,s=0;r<o;r++){for(;i[s+1]<r;)s++;t[r]=(r-n[s])*(r-n[s])+e[n[s]]}}});var mue=Xn((lMn,kz)=>{function Nqe(){var e=0,t=1,n=2,i=3,o=4,r=5,s=6,a=7,l=8,u=9,f=10,h=11,p=12,g=13,m=14,y=15,b=16,x=17,A=0,C=1,S=2,v=3,P=4;function M(_,w){return 55296<=_.charCodeAt(w)&&_.charCodeAt(w)<=56319&&56320<=_.charCodeAt(w+1)&&_.charCodeAt(w+1)<=57343}function R(_,w){w===void 0&&(w=0);var D=_.charCodeAt(w);if(55296<=D&&D<=56319&&w<_.length-1){var I=D,N=_.charCodeAt(w+1);return 56320<=N&&N<=57343?(I-55296)*1024+(N-56320)+65536:I}if(56320<=D&&D<=57343&&w>=1){var I=_.charCodeAt(w-1),N=D;return 55296<=I&&I<=56319?(I-55296)*1024+(N-56320)+65536:N}return D}function L(_,w,D){var I=[_].concat(w).concat([D]),N=I[I.length-2],k=D,z=I.lastIndexOf(m);if(z>1&&I.slice(1,z).every(function(U){return U==i})&&[i,g,x].indexOf(_)==-1)return S;var V=I.lastIndexOf(o);if(V>0&&I.slice(1,V).every(function(U){return U==o})&&[p,o].indexOf(N)==-1)return I.filter(function(U){return U==o}).length%2==1?v:P;if(N==e&&k==t)return A;if(N==n||N==e||N==t)return k==m&&w.every(function(U){return U==i})?S:C;if(k==n||k==e||k==t)return C;if(N==s&&(k==s||k==a||k==u||k==f))return A;if((N==u||N==a)&&(k==a||k==l))return A;if((N==f||N==l)&&k==l)return A;if(k==i||k==y)return A;if(k==r)return A;if(N==p)return A;var j=I.indexOf(i)!=-1?I.lastIndexOf(i)-1:I.length-2;return[g,x].indexOf(I[j])!=-1&&I.slice(j+1,-1).every(function(U){return U==i})&&k==m||N==y&&[b,x].indexOf(k)!=-1?A:w.indexOf(o)!=-1?S:N==o&&k==o?A:C}this.nextBreak=function(_,w){if(w===void 0&&(w=0),w<0)return 0;if(w>=_.length-1)return _.length;for(var D=F(R(_,w)),I=[],N=w+1;N<_.length;N++)if(!M(_,N-1)){var k=F(R(_,N));if(L(D,I,k))return N;I.push(k)}return _.length},this.splitGraphemes=function(_){for(var w=[],D=0,I;(I=this.nextBreak(_,D))<_.length;)w.push(_.slice(D,I)),D=I;return D<_.length&&w.push(_.slice(D)),w},this.iterateGraphemes=function(_){var w=0,D={next:function(){var I,N;return(N=this.nextBreak(_,w))<_.length?(I=_.slice(w,N),w=N,{value:I,done:!1}):w<_.length?(I=_.slice(w),w=_.length,{value:I,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(D[Symbol.iterator]=function(){return D}),D},this.countGraphemes=function(_){for(var w=0,D=0,I;(I=this.nextBreak(_,D))<_.length;)D=I,w++;return D<_.length&&w++,w};function F(_){return 1536<=_&&_<=1541||_==1757||_==1807||_==2274||_==3406||_==69821||70082<=_&&_<=70083||_==72250||72326<=_&&_<=72329||_==73030?p:_==13?e:_==10?t:0<=_&&_<=9||11<=_&&_<=12||14<=_&&_<=31||127<=_&&_<=159||_==173||_==1564||_==6158||_==8203||8206<=_&&_<=8207||_==8232||_==8233||8234<=_&&_<=8238||8288<=_&&_<=8292||_==8293||8294<=_&&_<=8303||55296<=_&&_<=57343||_==65279||65520<=_&&_<=65528||65529<=_&&_<=65531||113824<=_&&_<=113827||119155<=_&&_<=119162||_==917504||_==917505||917506<=_&&_<=917535||917632<=_&&_<=917759||918e3<=_&&_<=921599?n:768<=_&&_<=879||1155<=_&&_<=1159||1160<=_&&_<=1161||1425<=_&&_<=1469||_==1471||1473<=_&&_<=1474||1476<=_&&_<=1477||_==1479||1552<=_&&_<=1562||1611<=_&&_<=1631||_==1648||1750<=_&&_<=1756||1759<=_&&_<=1764||1767<=_&&_<=1768||1770<=_&&_<=1773||_==1809||1840<=_&&_<=1866||1958<=_&&_<=1968||2027<=_&&_<=2035||2070<=_&&_<=2073||2075<=_&&_<=2083||2085<=_&&_<=2087||2089<=_&&_<=2093||2137<=_&&_<=2139||2260<=_&&_<=2273||2275<=_&&_<=2306||_==2362||_==2364||2369<=_&&_<=2376||_==2381||2385<=_&&_<=2391||2402<=_&&_<=2403||_==2433||_==2492||_==2494||2497<=_&&_<=2500||_==2509||_==2519||2530<=_&&_<=2531||2561<=_&&_<=2562||_==2620||2625<=_&&_<=2626||2631<=_&&_<=2632||2635<=_&&_<=2637||_==2641||2672<=_&&_<=2673||_==2677||2689<=_&&_<=2690||_==2748||2753<=_&&_<=2757||2759<=_&&_<=2760||_==2765||2786<=_&&_<=2787||2810<=_&&_<=2815||_==2817||_==2876||_==2878||_==2879||2881<=_&&_<=2884||_==2893||_==2902||_==2903||2914<=_&&_<=2915||_==2946||_==3006||_==3008||_==3021||_==3031||_==3072||3134<=_&&_<=3136||3142<=_&&_<=3144||3146<=_&&_<=3149||3157<=_&&_<=3158||3170<=_&&_<=3171||_==3201||_==3260||_==3263||_==3266||_==3270||3276<=_&&_<=3277||3285<=_&&_<=3286||3298<=_&&_<=3299||3328<=_&&_<=3329||3387<=_&&_<=3388||_==3390||3393<=_&&_<=3396||_==3405||_==3415||3426<=_&&_<=3427||_==3530||_==3535||3538<=_&&_<=3540||_==3542||_==3551||_==3633||3636<=_&&_<=3642||3655<=_&&_<=3662||_==3761||3764<=_&&_<=3769||3771<=_&&_<=3772||3784<=_&&_<=3789||3864<=_&&_<=3865||_==3893||_==3895||_==3897||3953<=_&&_<=3966||3968<=_&&_<=3972||3974<=_&&_<=3975||3981<=_&&_<=3991||3993<=_&&_<=4028||_==4038||4141<=_&&_<=4144||4146<=_&&_<=4151||4153<=_&&_<=4154||4157<=_&&_<=4158||4184<=_&&_<=4185||4190<=_&&_<=4192||4209<=_&&_<=4212||_==4226||4229<=_&&_<=4230||_==4237||_==4253||4957<=_&&_<=4959||5906<=_&&_<=5908||5938<=_&&_<=5940||5970<=_&&_<=5971||6002<=_&&_<=6003||6068<=_&&_<=6069||6071<=_&&_<=6077||_==6086||6089<=_&&_<=6099||_==6109||6155<=_&&_<=6157||6277<=_&&_<=6278||_==6313||6432<=_&&_<=6434||6439<=_&&_<=6440||_==6450||6457<=_&&_<=6459||6679<=_&&_<=6680||_==6683||_==6742||6744<=_&&_<=6750||_==6752||_==6754||6757<=_&&_<=6764||6771<=_&&_<=6780||_==6783||6832<=_&&_<=6845||_==6846||6912<=_&&_<=6915||_==6964||6966<=_&&_<=6970||_==6972||_==6978||7019<=_&&_<=7027||7040<=_&&_<=7041||7074<=_&&_<=7077||7080<=_&&_<=7081||7083<=_&&_<=7085||_==7142||7144<=_&&_<=7145||_==7149||7151<=_&&_<=7153||7212<=_&&_<=7219||7222<=_&&_<=7223||7376<=_&&_<=7378||7380<=_&&_<=7392||7394<=_&&_<=7400||_==7405||_==7412||7416<=_&&_<=7417||7616<=_&&_<=7673||7675<=_&&_<=7679||_==8204||8400<=_&&_<=8412||8413<=_&&_<=8416||_==8417||8418<=_&&_<=8420||8421<=_&&_<=8432||11503<=_&&_<=11505||_==11647||11744<=_&&_<=11775||12330<=_&&_<=12333||12334<=_&&_<=12335||12441<=_&&_<=12442||_==42607||42608<=_&&_<=42610||42612<=_&&_<=42621||42654<=_&&_<=42655||42736<=_&&_<=42737||_==43010||_==43014||_==43019||43045<=_&&_<=43046||43204<=_&&_<=43205||43232<=_&&_<=43249||43302<=_&&_<=43309||43335<=_&&_<=43345||43392<=_&&_<=43394||_==43443||43446<=_&&_<=43449||_==43452||_==43493||43561<=_&&_<=43566||43569<=_&&_<=43570||43573<=_&&_<=43574||_==43587||_==43596||_==43644||_==43696||43698<=_&&_<=43700||43703<=_&&_<=43704||43710<=_&&_<=43711||_==43713||43756<=_&&_<=43757||_==43766||_==44005||_==44008||_==44013||_==64286||65024<=_&&_<=65039||65056<=_&&_<=65071||65438<=_&&_<=65439||_==66045||_==66272||66422<=_&&_<=66426||68097<=_&&_<=68099||68101<=_&&_<=68102||68108<=_&&_<=68111||68152<=_&&_<=68154||_==68159||68325<=_&&_<=68326||_==69633||69688<=_&&_<=69702||69759<=_&&_<=69761||69811<=_&&_<=69814||69817<=_&&_<=69818||69888<=_&&_<=69890||69927<=_&&_<=69931||69933<=_&&_<=69940||_==70003||70016<=_&&_<=70017||70070<=_&&_<=70078||70090<=_&&_<=70092||70191<=_&&_<=70193||_==70196||70198<=_&&_<=70199||_==70206||_==70367||70371<=_&&_<=70378||70400<=_&&_<=70401||_==70460||_==70462||_==70464||_==70487||70502<=_&&_<=70508||70512<=_&&_<=70516||70712<=_&&_<=70719||70722<=_&&_<=70724||_==70726||_==70832||70835<=_&&_<=70840||_==70842||_==70845||70847<=_&&_<=70848||70850<=_&&_<=70851||_==71087||71090<=_&&_<=71093||71100<=_&&_<=71101||71103<=_&&_<=71104||71132<=_&&_<=71133||71219<=_&&_<=71226||_==71229||71231<=_&&_<=71232||_==71339||_==71341||71344<=_&&_<=71349||_==71351||71453<=_&&_<=71455||71458<=_&&_<=71461||71463<=_&&_<=71467||72193<=_&&_<=72198||72201<=_&&_<=72202||72243<=_&&_<=72248||72251<=_&&_<=72254||_==72263||72273<=_&&_<=72278||72281<=_&&_<=72283||72330<=_&&_<=72342||72344<=_&&_<=72345||72752<=_&&_<=72758||72760<=_&&_<=72765||_==72767||72850<=_&&_<=72871||72874<=_&&_<=72880||72882<=_&&_<=72883||72885<=_&&_<=72886||73009<=_&&_<=73014||_==73018||73020<=_&&_<=73021||73023<=_&&_<=73029||_==73031||92912<=_&&_<=92916||92976<=_&&_<=92982||94095<=_&&_<=94098||113821<=_&&_<=113822||_==119141||119143<=_&&_<=119145||119150<=_&&_<=119154||119163<=_&&_<=119170||119173<=_&&_<=119179||119210<=_&&_<=119213||119362<=_&&_<=119364||121344<=_&&_<=121398||121403<=_&&_<=121452||_==121461||_==121476||121499<=_&&_<=121503||121505<=_&&_<=121519||122880<=_&&_<=122886||122888<=_&&_<=122904||122907<=_&&_<=122913||122915<=_&&_<=122916||122918<=_&&_<=122922||125136<=_&&_<=125142||125252<=_&&_<=125258||917536<=_&&_<=917631||917760<=_&&_<=917999?i:127462<=_&&_<=127487?o:_==2307||_==2363||2366<=_&&_<=2368||2377<=_&&_<=2380||2382<=_&&_<=2383||2434<=_&&_<=2435||2495<=_&&_<=2496||2503<=_&&_<=2504||2507<=_&&_<=2508||_==2563||2622<=_&&_<=2624||_==2691||2750<=_&&_<=2752||_==2761||2763<=_&&_<=2764||2818<=_&&_<=2819||_==2880||2887<=_&&_<=2888||2891<=_&&_<=2892||_==3007||3009<=_&&_<=3010||3014<=_&&_<=3016||3018<=_&&_<=3020||3073<=_&&_<=3075||3137<=_&&_<=3140||3202<=_&&_<=3203||_==3262||3264<=_&&_<=3265||3267<=_&&_<=3268||3271<=_&&_<=3272||3274<=_&&_<=3275||3330<=_&&_<=3331||3391<=_&&_<=3392||3398<=_&&_<=3400||3402<=_&&_<=3404||3458<=_&&_<=3459||3536<=_&&_<=3537||3544<=_&&_<=3550||3570<=_&&_<=3571||_==3635||_==3763||3902<=_&&_<=3903||_==3967||_==4145||4155<=_&&_<=4156||4182<=_&&_<=4183||_==4228||_==6070||6078<=_&&_<=6085||6087<=_&&_<=6088||6435<=_&&_<=6438||6441<=_&&_<=6443||6448<=_&&_<=6449||6451<=_&&_<=6456||6681<=_&&_<=6682||_==6741||_==6743||6765<=_&&_<=6770||_==6916||_==6965||_==6971||6973<=_&&_<=6977||6979<=_&&_<=6980||_==7042||_==7073||7078<=_&&_<=7079||_==7082||_==7143||7146<=_&&_<=7148||_==7150||7154<=_&&_<=7155||7204<=_&&_<=7211||7220<=_&&_<=7221||_==7393||7410<=_&&_<=7411||_==7415||43043<=_&&_<=43044||_==43047||43136<=_&&_<=43137||43188<=_&&_<=43203||43346<=_&&_<=43347||_==43395||43444<=_&&_<=43445||43450<=_&&_<=43451||43453<=_&&_<=43456||43567<=_&&_<=43568||43571<=_&&_<=43572||_==43597||_==43755||43758<=_&&_<=43759||_==43765||44003<=_&&_<=44004||44006<=_&&_<=44007||44009<=_&&_<=44010||_==44012||_==69632||_==69634||_==69762||69808<=_&&_<=69810||69815<=_&&_<=69816||_==69932||_==70018||70067<=_&&_<=70069||70079<=_&&_<=70080||70188<=_&&_<=70190||70194<=_&&_<=70195||_==70197||70368<=_&&_<=70370||70402<=_&&_<=70403||_==70463||70465<=_&&_<=70468||70471<=_&&_<=70472||70475<=_&&_<=70477||70498<=_&&_<=70499||70709<=_&&_<=70711||70720<=_&&_<=70721||_==70725||70833<=_&&_<=70834||_==70841||70843<=_&&_<=70844||_==70846||_==70849||71088<=_&&_<=71089||71096<=_&&_<=71099||_==71102||71216<=_&&_<=71218||71227<=_&&_<=71228||_==71230||_==71340||71342<=_&&_<=71343||_==71350||71456<=_&&_<=71457||_==71462||72199<=_&&_<=72200||_==72249||72279<=_&&_<=72280||_==72343||_==72751||_==72766||_==72873||_==72881||_==72884||94033<=_&&_<=94078||_==119142||_==119149?r:4352<=_&&_<=4447||43360<=_&&_<=43388?s:4448<=_&&_<=4519||55216<=_&&_<=55238?a:4520<=_&&_<=4607||55243<=_&&_<=55291?l:_==44032||_==44060||_==44088||_==44116||_==44144||_==44172||_==44200||_==44228||_==44256||_==44284||_==44312||_==44340||_==44368||_==44396||_==44424||_==44452||_==44480||_==44508||_==44536||_==44564||_==44592||_==44620||_==44648||_==44676||_==44704||_==44732||_==44760||_==44788||_==44816||_==44844||_==44872||_==44900||_==44928||_==44956||_==44984||_==45012||_==45040||_==45068||_==45096||_==45124||_==45152||_==45180||_==45208||_==45236||_==45264||_==45292||_==45320||_==45348||_==45376||_==45404||_==45432||_==45460||_==45488||_==45516||_==45544||_==45572||_==45600||_==45628||_==45656||_==45684||_==45712||_==45740||_==45768||_==45796||_==45824||_==45852||_==45880||_==45908||_==45936||_==45964||_==45992||_==46020||_==46048||_==46076||_==46104||_==46132||_==46160||_==46188||_==46216||_==46244||_==46272||_==46300||_==46328||_==46356||_==46384||_==46412||_==46440||_==46468||_==46496||_==46524||_==46552||_==46580||_==46608||_==46636||_==46664||_==46692||_==46720||_==46748||_==46776||_==46804||_==46832||_==46860||_==46888||_==46916||_==46944||_==46972||_==47e3||_==47028||_==47056||_==47084||_==47112||_==47140||_==47168||_==47196||_==47224||_==47252||_==47280||_==47308||_==47336||_==47364||_==47392||_==47420||_==47448||_==47476||_==47504||_==47532||_==47560||_==47588||_==47616||_==47644||_==47672||_==47700||_==47728||_==47756||_==47784||_==47812||_==47840||_==47868||_==47896||_==47924||_==47952||_==47980||_==48008||_==48036||_==48064||_==48092||_==48120||_==48148||_==48176||_==48204||_==48232||_==48260||_==48288||_==48316||_==48344||_==48372||_==48400||_==48428||_==48456||_==48484||_==48512||_==48540||_==48568||_==48596||_==48624||_==48652||_==48680||_==48708||_==48736||_==48764||_==48792||_==48820||_==48848||_==48876||_==48904||_==48932||_==48960||_==48988||_==49016||_==49044||_==49072||_==49100||_==49128||_==49156||_==49184||_==49212||_==49240||_==49268||_==49296||_==49324||_==49352||_==49380||_==49408||_==49436||_==49464||_==49492||_==49520||_==49548||_==49576||_==49604||_==49632||_==49660||_==49688||_==49716||_==49744||_==49772||_==49800||_==49828||_==49856||_==49884||_==49912||_==49940||_==49968||_==49996||_==50024||_==50052||_==50080||_==50108||_==50136||_==50164||_==50192||_==50220||_==50248||_==50276||_==50304||_==50332||_==50360||_==50388||_==50416||_==50444||_==50472||_==50500||_==50528||_==50556||_==50584||_==50612||_==50640||_==50668||_==50696||_==50724||_==50752||_==50780||_==50808||_==50836||_==50864||_==50892||_==50920||_==50948||_==50976||_==51004||_==51032||_==51060||_==51088||_==51116||_==51144||_==51172||_==51200||_==51228||_==51256||_==51284||_==51312||_==51340||_==51368||_==51396||_==51424||_==51452||_==51480||_==51508||_==51536||_==51564||_==51592||_==51620||_==51648||_==51676||_==51704||_==51732||_==51760||_==51788||_==51816||_==51844||_==51872||_==51900||_==51928||_==51956||_==51984||_==52012||_==52040||_==52068||_==52096||_==52124||_==52152||_==52180||_==52208||_==52236||_==52264||_==52292||_==52320||_==52348||_==52376||_==52404||_==52432||_==52460||_==52488||_==52516||_==52544||_==52572||_==52600||_==52628||_==52656||_==52684||_==52712||_==52740||_==52768||_==52796||_==52824||_==52852||_==52880||_==52908||_==52936||_==52964||_==52992||_==53020||_==53048||_==53076||_==53104||_==53132||_==53160||_==53188||_==53216||_==53244||_==53272||_==53300||_==53328||_==53356||_==53384||_==53412||_==53440||_==53468||_==53496||_==53524||_==53552||_==53580||_==53608||_==53636||_==53664||_==53692||_==53720||_==53748||_==53776||_==53804||_==53832||_==53860||_==53888||_==53916||_==53944||_==53972||_==54e3||_==54028||_==54056||_==54084||_==54112||_==54140||_==54168||_==54196||_==54224||_==54252||_==54280||_==54308||_==54336||_==54364||_==54392||_==54420||_==54448||_==54476||_==54504||_==54532||_==54560||_==54588||_==54616||_==54644||_==54672||_==54700||_==54728||_==54756||_==54784||_==54812||_==54840||_==54868||_==54896||_==54924||_==54952||_==54980||_==55008||_==55036||_==55064||_==55092||_==55120||_==55148||_==55176?u:44033<=_&&_<=44059||44061<=_&&_<=44087||44089<=_&&_<=44115||44117<=_&&_<=44143||44145<=_&&_<=44171||44173<=_&&_<=44199||44201<=_&&_<=44227||44229<=_&&_<=44255||44257<=_&&_<=44283||44285<=_&&_<=44311||44313<=_&&_<=44339||44341<=_&&_<=44367||44369<=_&&_<=44395||44397<=_&&_<=44423||44425<=_&&_<=44451||44453<=_&&_<=44479||44481<=_&&_<=44507||44509<=_&&_<=44535||44537<=_&&_<=44563||44565<=_&&_<=44591||44593<=_&&_<=44619||44621<=_&&_<=44647||44649<=_&&_<=44675||44677<=_&&_<=44703||44705<=_&&_<=44731||44733<=_&&_<=44759||44761<=_&&_<=44787||44789<=_&&_<=44815||44817<=_&&_<=44843||44845<=_&&_<=44871||44873<=_&&_<=44899||44901<=_&&_<=44927||44929<=_&&_<=44955||44957<=_&&_<=44983||44985<=_&&_<=45011||45013<=_&&_<=45039||45041<=_&&_<=45067||45069<=_&&_<=45095||45097<=_&&_<=45123||45125<=_&&_<=45151||45153<=_&&_<=45179||45181<=_&&_<=45207||45209<=_&&_<=45235||45237<=_&&_<=45263||45265<=_&&_<=45291||45293<=_&&_<=45319||45321<=_&&_<=45347||45349<=_&&_<=45375||45377<=_&&_<=45403||45405<=_&&_<=45431||45433<=_&&_<=45459||45461<=_&&_<=45487||45489<=_&&_<=45515||45517<=_&&_<=45543||45545<=_&&_<=45571||45573<=_&&_<=45599||45601<=_&&_<=45627||45629<=_&&_<=45655||45657<=_&&_<=45683||45685<=_&&_<=45711||45713<=_&&_<=45739||45741<=_&&_<=45767||45769<=_&&_<=45795||45797<=_&&_<=45823||45825<=_&&_<=45851||45853<=_&&_<=45879||45881<=_&&_<=45907||45909<=_&&_<=45935||45937<=_&&_<=45963||45965<=_&&_<=45991||45993<=_&&_<=46019||46021<=_&&_<=46047||46049<=_&&_<=46075||46077<=_&&_<=46103||46105<=_&&_<=46131||46133<=_&&_<=46159||46161<=_&&_<=46187||46189<=_&&_<=46215||46217<=_&&_<=46243||46245<=_&&_<=46271||46273<=_&&_<=46299||46301<=_&&_<=46327||46329<=_&&_<=46355||46357<=_&&_<=46383||46385<=_&&_<=46411||46413<=_&&_<=46439||46441<=_&&_<=46467||46469<=_&&_<=46495||46497<=_&&_<=46523||46525<=_&&_<=46551||46553<=_&&_<=46579||46581<=_&&_<=46607||46609<=_&&_<=46635||46637<=_&&_<=46663||46665<=_&&_<=46691||46693<=_&&_<=46719||46721<=_&&_<=46747||46749<=_&&_<=46775||46777<=_&&_<=46803||46805<=_&&_<=46831||46833<=_&&_<=46859||46861<=_&&_<=46887||46889<=_&&_<=46915||46917<=_&&_<=46943||46945<=_&&_<=46971||46973<=_&&_<=46999||47001<=_&&_<=47027||47029<=_&&_<=47055||47057<=_&&_<=47083||47085<=_&&_<=47111||47113<=_&&_<=47139||47141<=_&&_<=47167||47169<=_&&_<=47195||47197<=_&&_<=47223||47225<=_&&_<=47251||47253<=_&&_<=47279||47281<=_&&_<=47307||47309<=_&&_<=47335||47337<=_&&_<=47363||47365<=_&&_<=47391||47393<=_&&_<=47419||47421<=_&&_<=47447||47449<=_&&_<=47475||47477<=_&&_<=47503||47505<=_&&_<=47531||47533<=_&&_<=47559||47561<=_&&_<=47587||47589<=_&&_<=47615||47617<=_&&_<=47643||47645<=_&&_<=47671||47673<=_&&_<=47699||47701<=_&&_<=47727||47729<=_&&_<=47755||47757<=_&&_<=47783||47785<=_&&_<=47811||47813<=_&&_<=47839||47841<=_&&_<=47867||47869<=_&&_<=47895||47897<=_&&_<=47923||47925<=_&&_<=47951||47953<=_&&_<=47979||47981<=_&&_<=48007||48009<=_&&_<=48035||48037<=_&&_<=48063||48065<=_&&_<=48091||48093<=_&&_<=48119||48121<=_&&_<=48147||48149<=_&&_<=48175||48177<=_&&_<=48203||48205<=_&&_<=48231||48233<=_&&_<=48259||48261<=_&&_<=48287||48289<=_&&_<=48315||48317<=_&&_<=48343||48345<=_&&_<=48371||48373<=_&&_<=48399||48401<=_&&_<=48427||48429<=_&&_<=48455||48457<=_&&_<=48483||48485<=_&&_<=48511||48513<=_&&_<=48539||48541<=_&&_<=48567||48569<=_&&_<=48595||48597<=_&&_<=48623||48625<=_&&_<=48651||48653<=_&&_<=48679||48681<=_&&_<=48707||48709<=_&&_<=48735||48737<=_&&_<=48763||48765<=_&&_<=48791||48793<=_&&_<=48819||48821<=_&&_<=48847||48849<=_&&_<=48875||48877<=_&&_<=48903||48905<=_&&_<=48931||48933<=_&&_<=48959||48961<=_&&_<=48987||48989<=_&&_<=49015||49017<=_&&_<=49043||49045<=_&&_<=49071||49073<=_&&_<=49099||49101<=_&&_<=49127||49129<=_&&_<=49155||49157<=_&&_<=49183||49185<=_&&_<=49211||49213<=_&&_<=49239||49241<=_&&_<=49267||49269<=_&&_<=49295||49297<=_&&_<=49323||49325<=_&&_<=49351||49353<=_&&_<=49379||49381<=_&&_<=49407||49409<=_&&_<=49435||49437<=_&&_<=49463||49465<=_&&_<=49491||49493<=_&&_<=49519||49521<=_&&_<=49547||49549<=_&&_<=49575||49577<=_&&_<=49603||49605<=_&&_<=49631||49633<=_&&_<=49659||49661<=_&&_<=49687||49689<=_&&_<=49715||49717<=_&&_<=49743||49745<=_&&_<=49771||49773<=_&&_<=49799||49801<=_&&_<=49827||49829<=_&&_<=49855||49857<=_&&_<=49883||49885<=_&&_<=49911||49913<=_&&_<=49939||49941<=_&&_<=49967||49969<=_&&_<=49995||49997<=_&&_<=50023||50025<=_&&_<=50051||50053<=_&&_<=50079||50081<=_&&_<=50107||50109<=_&&_<=50135||50137<=_&&_<=50163||50165<=_&&_<=50191||50193<=_&&_<=50219||50221<=_&&_<=50247||50249<=_&&_<=50275||50277<=_&&_<=50303||50305<=_&&_<=50331||50333<=_&&_<=50359||50361<=_&&_<=50387||50389<=_&&_<=50415||50417<=_&&_<=50443||50445<=_&&_<=50471||50473<=_&&_<=50499||50501<=_&&_<=50527||50529<=_&&_<=50555||50557<=_&&_<=50583||50585<=_&&_<=50611||50613<=_&&_<=50639||50641<=_&&_<=50667||50669<=_&&_<=50695||50697<=_&&_<=50723||50725<=_&&_<=50751||50753<=_&&_<=50779||50781<=_&&_<=50807||50809<=_&&_<=50835||50837<=_&&_<=50863||50865<=_&&_<=50891||50893<=_&&_<=50919||50921<=_&&_<=50947||50949<=_&&_<=50975||50977<=_&&_<=51003||51005<=_&&_<=51031||51033<=_&&_<=51059||51061<=_&&_<=51087||51089<=_&&_<=51115||51117<=_&&_<=51143||51145<=_&&_<=51171||51173<=_&&_<=51199||51201<=_&&_<=51227||51229<=_&&_<=51255||51257<=_&&_<=51283||51285<=_&&_<=51311||51313<=_&&_<=51339||51341<=_&&_<=51367||51369<=_&&_<=51395||51397<=_&&_<=51423||51425<=_&&_<=51451||51453<=_&&_<=51479||51481<=_&&_<=51507||51509<=_&&_<=51535||51537<=_&&_<=51563||51565<=_&&_<=51591||51593<=_&&_<=51619||51621<=_&&_<=51647||51649<=_&&_<=51675||51677<=_&&_<=51703||51705<=_&&_<=51731||51733<=_&&_<=51759||51761<=_&&_<=51787||51789<=_&&_<=51815||51817<=_&&_<=51843||51845<=_&&_<=51871||51873<=_&&_<=51899||51901<=_&&_<=51927||51929<=_&&_<=51955||51957<=_&&_<=51983||51985<=_&&_<=52011||52013<=_&&_<=52039||52041<=_&&_<=52067||52069<=_&&_<=52095||52097<=_&&_<=52123||52125<=_&&_<=52151||52153<=_&&_<=52179||52181<=_&&_<=52207||52209<=_&&_<=52235||52237<=_&&_<=52263||52265<=_&&_<=52291||52293<=_&&_<=52319||52321<=_&&_<=52347||52349<=_&&_<=52375||52377<=_&&_<=52403||52405<=_&&_<=52431||52433<=_&&_<=52459||52461<=_&&_<=52487||52489<=_&&_<=52515||52517<=_&&_<=52543||52545<=_&&_<=52571||52573<=_&&_<=52599||52601<=_&&_<=52627||52629<=_&&_<=52655||52657<=_&&_<=52683||52685<=_&&_<=52711||52713<=_&&_<=52739||52741<=_&&_<=52767||52769<=_&&_<=52795||52797<=_&&_<=52823||52825<=_&&_<=52851||52853<=_&&_<=52879||52881<=_&&_<=52907||52909<=_&&_<=52935||52937<=_&&_<=52963||52965<=_&&_<=52991||52993<=_&&_<=53019||53021<=_&&_<=53047||53049<=_&&_<=53075||53077<=_&&_<=53103||53105<=_&&_<=53131||53133<=_&&_<=53159||53161<=_&&_<=53187||53189<=_&&_<=53215||53217<=_&&_<=53243||53245<=_&&_<=53271||53273<=_&&_<=53299||53301<=_&&_<=53327||53329<=_&&_<=53355||53357<=_&&_<=53383||53385<=_&&_<=53411||53413<=_&&_<=53439||53441<=_&&_<=53467||53469<=_&&_<=53495||53497<=_&&_<=53523||53525<=_&&_<=53551||53553<=_&&_<=53579||53581<=_&&_<=53607||53609<=_&&_<=53635||53637<=_&&_<=53663||53665<=_&&_<=53691||53693<=_&&_<=53719||53721<=_&&_<=53747||53749<=_&&_<=53775||53777<=_&&_<=53803||53805<=_&&_<=53831||53833<=_&&_<=53859||53861<=_&&_<=53887||53889<=_&&_<=53915||53917<=_&&_<=53943||53945<=_&&_<=53971||53973<=_&&_<=53999||54001<=_&&_<=54027||54029<=_&&_<=54055||54057<=_&&_<=54083||54085<=_&&_<=54111||54113<=_&&_<=54139||54141<=_&&_<=54167||54169<=_&&_<=54195||54197<=_&&_<=54223||54225<=_&&_<=54251||54253<=_&&_<=54279||54281<=_&&_<=54307||54309<=_&&_<=54335||54337<=_&&_<=54363||54365<=_&&_<=54391||54393<=_&&_<=54419||54421<=_&&_<=54447||54449<=_&&_<=54475||54477<=_&&_<=54503||54505<=_&&_<=54531||54533<=_&&_<=54559||54561<=_&&_<=54587||54589<=_&&_<=54615||54617<=_&&_<=54643||54645<=_&&_<=54671||54673<=_&&_<=54699||54701<=_&&_<=54727||54729<=_&&_<=54755||54757<=_&&_<=54783||54785<=_&&_<=54811||54813<=_&&_<=54839||54841<=_&&_<=54867||54869<=_&&_<=54895||54897<=_&&_<=54923||54925<=_&&_<=54951||54953<=_&&_<=54979||54981<=_&&_<=55007||55009<=_&&_<=55035||55037<=_&&_<=55063||55065<=_&&_<=55091||55093<=_&&_<=55119||55121<=_&&_<=55147||55149<=_&&_<=55175||55177<=_&&_<=55203?f:_==9757||_==9977||9994<=_&&_<=9997||_==127877||127938<=_&&_<=127940||_==127943||127946<=_&&_<=127948||128066<=_&&_<=128067||128070<=_&&_<=128080||_==128110||128112<=_&&_<=128120||_==128124||128129<=_&&_<=128131||128133<=_&&_<=128135||_==128170||128372<=_&&_<=128373||_==128378||_==128400||128405<=_&&_<=128406||128581<=_&&_<=128583||128587<=_&&_<=128591||_==128675||128692<=_&&_<=128694||_==128704||_==128716||129304<=_&&_<=129308||129310<=_&&_<=129311||_==129318||129328<=_&&_<=129337||129341<=_&&_<=129342||129489<=_&&_<=129501?g:127995<=_&&_<=127999?m:_==8205?y:_==9792||_==9794||9877<=_&&_<=9878||_==9992||_==10084||_==127752||_==127806||_==127859||_==127891||_==127908||_==127912||_==127979||_==127981||_==128139||128187<=_&&_<=128188||_==128295||_==128300||_==128488||_==128640||_==128658?b:128102<=_&&_<=128105?x:h}return this}typeof kz<"u"&&kz.exports&&(kz.exports=Nqe)});var npe=Xn((T7,A7)=>{(function(e,t){typeof T7=="object"&&typeof A7<"u"?A7.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.RBush=t())})(T7,function(){"use strict";function e(C,S,v,P,M){t(C,S,v||0,P||C.length-1,M||i)}function t(C,S,v,P,M){for(;P>v;){if(P-v>600){var R=P-v+1,L=S-v+1,F=Math.log(R),_=.5*Math.exp(2*F/3),w=.5*Math.sqrt(F*_*(R-_)/R)*(L-R/2<0?-1:1),D=Math.max(v,Math.floor(S-L*_/R+w)),I=Math.min(P,Math.floor(S+(R-L)*_/R+w));t(C,S,D,I,M)}var N=C[S],k=v,z=P;for(n(C,v,S),M(C[P],N)>0&&n(C,v,P);k<z;){for(n(C,k,z),k++,z--;M(C[k],N)<0;)k++;for(;M(C[z],N)>0;)z--}M(C[v],N)===0?n(C,v,z):(z++,n(C,z,P)),z<=S&&(v=z+1),S<=z&&(P=z-1)}}function n(C,S,v){var P=C[S];C[S]=C[v],C[v]=P}function i(C,S){return C<S?-1:C>S?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var v=this.data,P=[];if(!b(S,v))return P;for(var M=this.toBBox,R=[];v;){for(var L=0;L<v.children.length;L++){var F=v.children[L],_=v.leaf?M(F):F;b(S,_)&&(v.leaf?P.push(F):y(S,_)?this._all(F,P):R.push(F))}v=R.pop()}return P},o.prototype.collides=function(S){var v=this.data;if(!b(S,v))return!1;for(var P=[];v;){for(var M=0;M<v.children.length;M++){var R=v.children[M],L=v.leaf?this.toBBox(R):R;if(b(S,L)){if(v.leaf||y(S,L))return!0;P.push(R)}}v=P.pop()}return!1},o.prototype.load=function(S){if(!(S&&S.length))return this;if(S.length<this._minEntries){for(var v=0;v<S.length;v++)this.insert(S[v]);return this}var P=this._build(S.slice(),0,S.length-1,0);if(!this.data.children.length)this.data=P;else if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var M=this.data;this.data=P,P=M}this._insert(P,this.data.height-P.height-1,!0)}return this},o.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},o.prototype.clear=function(){return this.data=x([]),this},o.prototype.remove=function(S,v){if(!S)return this;for(var P=this.data,M=this.toBBox(S),R=[],L=[],F,_,w;P||R.length;){if(P||(P=R.pop(),_=R[R.length-1],F=L.pop(),w=!0),P.leaf){var D=r(S,P.children,v);if(D!==-1)return P.children.splice(D,1),R.push(P),this._condense(R),this}!w&&!P.leaf&&y(P,M)?(R.push(P),L.push(F),F=0,_=P,P=P.children[0]):_?(F++,P=_.children[F],w=!1):P=null}return this},o.prototype.toBBox=function(S){return S},o.prototype.compareMinX=function(S,v){return S.minX-v.minX},o.prototype.compareMinY=function(S,v){return S.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(S){return this.data=S,this},o.prototype._all=function(S,v){for(var P=[];S;)S.leaf?v.push.apply(v,S.children):P.push.apply(P,S.children),S=P.pop();return v},o.prototype._build=function(S,v,P,M){var R=P-v+1,L=this._maxEntries,F;if(R<=L)return F=x(S.slice(v,P+1)),s(F,this.toBBox),F;M||(M=Math.ceil(Math.log(R)/Math.log(L)),L=Math.ceil(R/Math.pow(L,M-1))),F=x([]),F.leaf=!1,F.height=M;var _=Math.ceil(R/L),w=_*Math.ceil(Math.sqrt(L));A(S,v,P,w,this.compareMinX);for(var D=v;D<=P;D+=w){var I=Math.min(D+w-1,P);A(S,D,I,_,this.compareMinY);for(var N=D;N<=I;N+=_){var k=Math.min(N+_-1,I);F.children.push(this._build(S,N,k,M-1))}}return s(F,this.toBBox),F},o.prototype._chooseSubtree=function(S,v,P,M){for(;M.push(v),!(v.leaf||M.length-1===P);){for(var R=1/0,L=1/0,F=void 0,_=0;_<v.children.length;_++){var w=v.children[_],D=h(w),I=g(S,w)-D;I<L?(L=I,R=D<R?D:R,F=w):I===L&&D<R&&(R=D,F=w)}v=F||v.children[0]}return v},o.prototype._insert=function(S,v,P){var M=P?S:this.toBBox(S),R=[],L=this._chooseSubtree(M,this.data,v,R);for(L.children.push(S),l(L,M);v>=0&&R[v].children.length>this._maxEntries;)this._split(R,v),v--;this._adjustParentBBoxes(M,R,v)},o.prototype._split=function(S,v){var P=S[v],M=P.children.length,R=this._minEntries;this._chooseSplitAxis(P,R,M);var L=this._chooseSplitIndex(P,R,M),F=x(P.children.splice(L,P.children.length-L));F.height=P.height,F.leaf=P.leaf,s(P,this.toBBox),s(F,this.toBBox),v?S[v-1].children.push(F):this._splitRoot(P,F)},o.prototype._splitRoot=function(S,v){this.data=x([S,v]),this.data.height=S.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,v,P){for(var M,R=1/0,L=1/0,F=v;F<=P-v;F++){var _=a(S,0,F,this.toBBox),w=a(S,F,P,this.toBBox),D=m(_,w),I=h(_)+h(w);D<R?(R=D,M=F,L=I<L?I:L):D===R&&I<L&&(L=I,M=F)}return M||P-v},o.prototype._chooseSplitAxis=function(S,v,P){var M=S.leaf?this.compareMinX:u,R=S.leaf?this.compareMinY:f,L=this._allDistMargin(S,v,P,M),F=this._allDistMargin(S,v,P,R);L<F&&S.children.sort(M)},o.prototype._allDistMargin=function(S,v,P,M){S.children.sort(M);for(var R=this.toBBox,L=a(S,0,v,R),F=a(S,P-v,P,R),_=p(L)+p(F),w=v;w<P-v;w++){var D=S.children[w];l(L,S.leaf?R(D):D),_+=p(L)}for(var I=P-v-1;I>=v;I--){var N=S.children[I];l(F,S.leaf?R(N):N),_+=p(F)}return _},o.prototype._adjustParentBBoxes=function(S,v,P){for(var M=P;M>=0;M--)l(v[M],S)},o.prototype._condense=function(S){for(var v=S.length-1,P=void 0;v>=0;v--)S[v].children.length===0?v>0?(P=S[v-1].children,P.splice(P.indexOf(S[v]),1)):this.clear():s(S[v],this.toBBox)};function r(C,S,v){if(!v)return S.indexOf(C);for(var P=0;P<S.length;P++)if(v(C,S[P]))return P;return-1}function s(C,S){a(C,0,C.children.length,S,C)}function a(C,S,v,P,M){M||(M=x(null)),M.minX=1/0,M.minY=1/0,M.maxX=-1/0,M.maxY=-1/0;for(var R=S;R<v;R++){var L=C.children[R];l(M,C.leaf?P(L):L)}return M}function l(C,S){return C.minX=Math.min(C.minX,S.minX),C.minY=Math.min(C.minY,S.minY),C.maxX=Math.max(C.maxX,S.maxX),C.maxY=Math.max(C.maxY,S.maxY),C}function u(C,S){return C.minX-S.minX}function f(C,S){return C.minY-S.minY}function h(C){return(C.maxX-C.minX)*(C.maxY-C.minY)}function p(C){return C.maxX-C.minX+(C.maxY-C.minY)}function g(C,S){return(Math.max(S.maxX,C.maxX)-Math.min(S.minX,C.minX))*(Math.max(S.maxY,C.maxY)-Math.min(S.minY,C.minY))}function m(C,S){var v=Math.max(C.minX,S.minX),P=Math.max(C.minY,S.minY),M=Math.min(C.maxX,S.maxX),R=Math.min(C.maxY,S.maxY);return Math.max(0,M-v)*Math.max(0,R-P)}function y(C,S){return C.minX<=S.minX&&C.minY<=S.minY&&S.maxX<=C.maxX&&S.maxY<=C.maxY}function b(C,S){return S.minX<=C.maxX&&S.minY<=C.maxY&&S.maxX>=C.minX&&S.maxY>=C.minY}function x(C){return{children:C,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(C,S,v,P,M){for(var R=[S,v];R.length;)if(v=R.pop(),S=R.pop(),!(v-S<=P)){var L=S+Math.ceil((v-S)/P/2)*P;e(C,L,S,v,M),R.push(S,L,L,v)}}return o})});var xge=Xn((R8,bge)=>{(function(e,t){typeof R8=="object"&&typeof bge<"u"?t(R8):typeof define=="function"&&define.amd?define(["exports"],t):(e=e||self,t(e.topojson=e.topojson||{}))})(R8,function(e){"use strict";function t(C){return C}function n(C){if(C==null)return t;var S,v,P=C.scale[0],M=C.scale[1],R=C.translate[0],L=C.translate[1];return function(F,_){_||(S=v=0);var w=2,D=F.length,I=new Array(D);for(I[0]=(S+=F[0])*P+R,I[1]=(v+=F[1])*M+L;w<D;)I[w]=F[w],++w;return I}}function i(C){var S=n(C.transform),v,P=1/0,M=P,R=-P,L=-P;function F(w){w=S(w),w[0]<P&&(P=w[0]),w[0]>R&&(R=w[0]),w[1]<M&&(M=w[1]),w[1]>L&&(L=w[1])}function _(w){switch(w.type){case"GeometryCollection":w.geometries.forEach(_);break;case"Point":F(w.coordinates);break;case"MultiPoint":w.coordinates.forEach(F);break}}C.arcs.forEach(function(w){for(var D=-1,I=w.length,N;++D<I;)N=S(w[D],D),N[0]<P&&(P=N[0]),N[0]>R&&(R=N[0]),N[1]<M&&(M=N[1]),N[1]>L&&(L=N[1])});for(v in C.objects)_(C.objects[v]);return[P,M,R,L]}function o(C,S){for(var v,P=C.length,M=P-S;M<--P;)v=C[M],C[M++]=C[P],C[P]=v}function r(C,S){return typeof S=="string"&&(S=C.objects[S]),S.type==="GeometryCollection"?{type:"FeatureCollection",features:S.geometries.map(function(v){return s(C,v)})}:s(C,S)}function s(C,S){var v=S.id,P=S.bbox,M=S.properties==null?{}:S.properties,R=a(C,S);return v==null&&P==null?{type:"Feature",properties:M,geometry:R}:P==null?{type:"Feature",id:v,properties:M,geometry:R}:{type:"Feature",id:v,bbox:P,properties:M,geometry:R}}function a(C,S){var v=n(C.transform),P=C.arcs;function M(D,I){I.length&&I.pop();for(var N=P[D<0?~D:D],k=0,z=N.length;k<z;++k)I.push(v(N[k],k));D<0&&o(I,z)}function R(D){return v(D)}function L(D){for(var I=[],N=0,k=D.length;N<k;++N)M(D[N],I);return I.length<2&&I.push(I[0]),I}function F(D){for(var I=L(D);I.length<4;)I.push(I[0]);return I}function _(D){return D.map(F)}function w(D){var I=D.type,N;switch(I){case"GeometryCollection":return{type:I,geometries:D.geometries.map(w)};case"Point":N=R(D.coordinates);break;case"MultiPoint":N=D.coordinates.map(R);break;case"LineString":N=L(D.arcs);break;case"MultiLineString":N=D.arcs.map(L);break;case"Polygon":N=_(D.arcs);break;case"MultiPolygon":N=D.arcs.map(_);break;default:return null}return{type:I,coordinates:N}}return w(S)}function l(C,S){var v={},P={},M={},R=[],L=-1;S.forEach(function(w,D){var I=C.arcs[w<0?~w:w],N;I.length<3&&!I[1][0]&&!I[1][1]&&(N=S[++L],S[L]=w,S[D]=N)}),S.forEach(function(w){var D=F(w),I=D[0],N=D[1],k,z;if(k=M[I])if(delete M[k.end],k.push(w),k.end=N,z=P[N]){delete P[z.start];var V=z===k?k:k.concat(z);P[V.start=k.start]=M[V.end=z.end]=V}else P[k.start]=M[k.end]=k;else if(k=P[N])if(delete P[k.start],k.unshift(w),k.start=I,z=M[I]){delete M[z.end];var j=z===k?k:z.concat(k);P[j.start=z.start]=M[j.end=k.end]=j}else P[k.start]=M[k.end]=k;else k=[w],P[k.start=I]=M[k.end=N]=k});function F(w){var D=C.arcs[w<0?~w:w],I=D[0],N;return C.transform?(N=[0,0],D.forEach(function(k){N[0]+=k[0],N[1]+=k[1]})):N=D[D.length-1],w<0?[N,I]:[I,N]}function _(w,D){for(var I in w){var N=w[I];delete D[N.start],delete N.start,delete N.end,N.forEach(function(k){v[k<0?~k:k]=1}),R.push(N)}}return _(M,P),_(P,M),S.forEach(function(w){v[w<0?~w:w]||R.push([w])}),R}function u(C){return a(C,f.apply(this,arguments))}function f(C,S,v){var P,M,R;if(arguments.length>1)P=h(C,S,v);else for(M=0,P=new Array(R=C.arcs.length);M<R;++M)P[M]=M;return{type:"MultiLineString",arcs:l(C,P)}}function h(C,S,v){var P=[],M=[],R;function L(I){var N=I<0?~I:I;(M[N]||(M[N]=[])).push({i:I,g:R})}function F(I){I.forEach(L)}function _(I){I.forEach(F)}function w(I){I.forEach(_)}function D(I){switch(R=I,I.type){case"GeometryCollection":I.geometries.forEach(D);break;case"LineString":F(I.arcs);break;case"MultiLineString":case"Polygon":_(I.arcs);break;case"MultiPolygon":w(I.arcs);break}}return D(S),M.forEach(v==null?function(I){P.push(I[0].i)}:function(I){v(I[0].g,I[I.length-1].g)&&P.push(I[0].i)}),P}function p(C){for(var S=-1,v=C.length,P,M=C[v-1],R=0;++S<v;)P=M,M=C[S],R+=P[0]*M[1]-P[1]*M[0];return Math.abs(R)}function g(C){return a(C,m.apply(this,arguments))}function m(C,S){var v={},P=[],M=[];S.forEach(R);function R(_){switch(_.type){case"GeometryCollection":_.geometries.forEach(R);break;case"Polygon":L(_.arcs);break;case"MultiPolygon":_.arcs.forEach(L);break}}function L(_){_.forEach(function(w){w.forEach(function(D){(v[D=D<0?~D:D]||(v[D]=[])).push(_)})}),P.push(_)}function F(_){return p(a(C,{type:"Polygon",arcs:[_]}).coordinates[0])}return P.forEach(function(_){if(!_._){var w=[],D=[_];for(_._=1,M.push(w);_=D.pop();)w.push(_),_.forEach(function(I){I.forEach(function(N){v[N<0?~N:N].forEach(function(k){k._||(k._=1,D.push(k))})})})}}),P.forEach(function(_){delete _._}),{type:"MultiPolygon",arcs:M.map(function(_){var w=[],D;if(_.forEach(function(V){V.forEach(function(j){j.forEach(function(U){v[U<0?~U:U].length<2&&w.push(U)})})}),w=l(C,w),(D=w.length)>1)for(var I=1,N=F(w[0]),k,z;I<D;++I)(k=F(w[I]))>N&&(z=w[0],w[0]=w[I],w[I]=z,N=k);return w}).filter(function(_){return _.length>0})}}function y(C,S){for(var v=0,P=C.length;v<P;){var M=v+P>>>1;C[M]<S?v=M+1:P=M}return v}function b(C){var S={},v=C.map(function(){return[]});function P(V,j){V.forEach(function(U){U<0&&(U=~U);var q=S[U];q?q.push(j):S[U]=[j]})}function M(V,j){V.forEach(function(U){P(U,j)})}function R(V,j){V.type==="GeometryCollection"?V.geometries.forEach(function(U){R(U,j)}):V.type in L&&L[V.type](V.arcs,j)}var L={LineString:P,MultiLineString:M,Polygon:M,MultiPolygon:function(V,j){V.forEach(function(U){M(U,j)})}};C.forEach(R);for(var F in S)for(var _=S[F],w=_.length,D=0;D<w;++D)for(var I=D+1;I<w;++I){var N=_[D],k=_[I],z;(z=v[N])[F=y(z,k)]!==k&&z.splice(F,0,k),(z=v[k])[F=y(z,N)]!==N&&z.splice(F,0,N)}return v}function x(C){if(C==null)return t;var S,v,P=C.scale[0],M=C.scale[1],R=C.translate[0],L=C.translate[1];return function(F,_){_||(S=v=0);var w=2,D=F.length,I=new Array(D),N=Math.round((F[0]-R)/P),k=Math.round((F[1]-L)/M);for(I[0]=N-S,S=N,I[1]=k-v,v=k;w<D;)I[w]=F[w],++w;return I}}function A(C,S){if(C.transform)throw new Error("already quantized");if(!S||!S.scale){if(!((L=Math.floor(S))>=2))throw new Error("n must be \u22652");_=C.bbox||i(C);var v=_[0],P=_[1],M=_[2],R=_[3],L;S={scale:[M-v?(M-v)/(L-1):1,R-P?(R-P)/(L-1):1],translate:[v,P]}}else _=C.bbox;var F=x(S),_,w,D=C.objects,I={};function N(V){return F(V)}function k(V){var j;switch(V.type){case"GeometryCollection":j={type:"GeometryCollection",geometries:V.geometries.map(k)};break;case"Point":j={type:"Point",coordinates:N(V.coordinates)};break;case"MultiPoint":j={type:"MultiPoint",coordinates:V.coordinates.map(N)};break;default:return V}return V.id!=null&&(j.id=V.id),V.bbox!=null&&(j.bbox=V.bbox),V.properties!=null&&(j.properties=V.properties),j}function z(V){var j=0,U=1,q=V.length,Y,te=new Array(q);for(te[0]=F(V[0],0);++j<q;)((Y=F(V[j],j))[0]||Y[1])&&(te[U++]=Y);return U===1&&(te[U++]=[0,0]),te.length=U,te}for(w in D)I[w]=k(D[w]);return{type:"Topology",bbox:_,transform:S,objects:I,arcs:C.arcs.map(z)}}e.bbox=i,e.feature=r,e.merge=g,e.mergeArcs=m,e.mesh=u,e.meshArcs=f,e.neighbors=b,e.quantize=A,e.transform=n,e.untransform=x,Object.defineProperty(e,"__esModule",{value:!0})})});var Vge=Xn(N8=>{"use strict";Object.defineProperty(N8,"__esModule",{value:!0});N8.version=void 0;N8.version="4.1.0"});var IT=Xn(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.isUndefined=zge;cg.isBoolean=irt;cg.defaults=ort;cg.ellipsis=rrt;cg.remove=srt;cg.removeWithPredicate=art;cg.assertNever=crt;function zge(e){return e===void 0}function irt(e){return typeof e=="boolean"}function ort(e,t){for(var n in t)t.hasOwnProperty(n)&&zge(e[n])&&(e[n]=t[n]);return e}function rrt(e,t,n){var i;return e.length>t&&(n==null?(n="&hellip;",i=3):i=n.length,e=e.substring(0,t-i)+n),e}function srt(e,t){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)}function art(e,t){for(var n=e.length-1;n>=0;n--)t(e[n])===!0&&e.splice(n,1)}function crt(e){throw new Error("Unhandled case for value: '".concat(e,"'"))}});var OT=Xn(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.alphaNumericAndMarksRe=Ii.alphaNumericAndMarksCharsStr=Ii.alphaNumericCharsRe=Ii.decimalNumbersStr=Ii.alphaCharsAndMarksStr=Ii.marksStr=Ii.emojiStr=Ii.alphaCharsStr=Ii.controlCharsRe=Ii.quoteRe=Ii.whitespaceRe=Ii.nonDigitRe=Ii.digitRe=Ii.letterRe=void 0;Ii.letterRe=/[A-Za-z]/;Ii.digitRe=/[\d]/;Ii.nonDigitRe=/[\D]/;Ii.whitespaceRe=/\s/;Ii.quoteRe=/['"]/;Ii.controlCharsRe=/[\x00-\x1F\x7F]/;Ii.alphaCharsStr=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source;Ii.emojiStr=/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source;Ii.marksStr=/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source;Ii.alphaCharsAndMarksStr=Ii.alphaCharsStr+Ii.emojiStr+Ii.marksStr;Ii.decimalNumbersStr=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source;Ii.alphaNumericCharsRe=new RegExp("[".concat(Ii.alphaCharsStr+Ii.decimalNumbersStr,"]"));Ii.alphaNumericAndMarksCharsStr=Ii.alphaCharsAndMarksStr+Ii.decimalNumbersStr;Ii.alphaNumericAndMarksRe=new RegExp("[".concat(Ii.alphaNumericAndMarksCharsStr,"]"))});var k8=Xn(B8=>{"use strict";Object.defineProperty(B8,"__esModule",{value:!0});B8.HtmlTag=void 0;var F8=OT(),lrt=function(){function e(t){t===void 0&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return e.prototype.setTagName=function(t){return this.tagName=t,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(t,n){var i=this.getAttrs();return i[t]=n,this},e.prototype.getAttr=function(t){return this.getAttrs()[t]},e.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(t){return this.setAttr("class",t)},e.prototype.addClass=function(t){for(var n=this.getClass(),i=n?n.split(F8.whitespaceRe):[],o=t.split(F8.whitespaceRe),r;r=o.shift();)i.indexOf(r)===-1&&i.push(r);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(t){for(var n=this.getClass(),i=n?n.split(F8.whitespaceRe):[],o=t.split(F8.whitespaceRe),r;i.length&&(r=o.shift());){var s=i.indexOf(r);s!==-1&&i.splice(s,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(t){return(" "+this.getClass()+" ").indexOf(" "+t+" ")!==-1},e.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},e.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var t=this.getTagName(),n=this.buildAttrsStr();return n=n?" "+n:"",["<",t,n,">",this.getInnerHtml(),"</",t,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),n=[];for(var i in t)t.hasOwnProperty(i)&&n.push(i+'="'+t[i]+'"');return n.join(" ")},e}();B8.HtmlTag=lrt});var Hge=Xn(GY=>{"use strict";Object.defineProperty(GY,"__esModule",{value:!0});GY.truncateSmart=urt;function urt(e,t,n){var i,o;n==null?(n="&hellip;",o=3,i=8):(o=n.length,i=n.length);var r=function(A){var C={},S=A,v=S.match(/^([a-z]+):\/\//i);return v&&(C.scheme=v[1],S=S.substr(v[0].length)),v=S.match(/^(.*?)(?=(\?|#|\/|$))/i),v&&(C.host=v[1],S=S.substr(v[0].length)),v=S.match(/^\/(.*?)(?=(\?|#|$))/i),v&&(C.path=v[1],S=S.substr(v[0].length)),v=S.match(/^\?(.*?)(?=(#|$))/i),v&&(C.query=v[1],S=S.substr(v[0].length)),v=S.match(/^#(.*?)$/i),v&&(C.fragment=v[1]),C},s=function(A){var C="";return A.scheme&&A.host&&(C+=A.scheme+"://"),A.host&&(C+=A.host),A.path&&(C+="/"+A.path),A.query&&(C+="?"+A.query),A.fragment&&(C+="#"+A.fragment),C},a=function(A,C){var S=C/2,v=Math.ceil(S),P=-1*Math.floor(S),M="";return P<0&&(M=A.substr(P)),A.substr(0,v)+n+M};if(e.length<=t)return e;var l=t-o,u=r(e);if(u.query){var f=u.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);f&&(u.query=u.query.substr(0,f[1].length),e=s(u))}if(e.length<=t||(u.host&&(u.host=u.host.replace(/^www\./,""),e=s(u)),e.length<=t))return e;var h="";if(u.host&&(h+=u.host),h.length>=l)return u.host.length==t?(u.host.substr(0,t-o)+n).substr(0,l+i):a(h,l).substr(0,l+i);var p="";if(u.path&&(p+="/"+u.path),u.query&&(p+="?"+u.query),p)if((h+p).length>=l){if((h+p).length==t)return(h+p).substr(0,t);var g=l-h.length;return(h+a(p,g)).substr(0,l+i)}else h+=p;if(u.fragment){var m="#"+u.fragment;if((h+m).length>=l){if((h+m).length==t)return(h+m).substr(0,t);var y=l-h.length;return(h+a(m,y)).substr(0,l+i)}else h+=m}if(u.scheme&&u.host){var b=u.scheme+"://";if((h+b).length<l)return(b+h).substr(0,t)}if(h.length<=t)return h;var x="";return l>0&&(x=h.substr(-1*Math.floor(l/2))),(h.substr(0,Math.ceil(l/2))+n+x).substr(0,l+i)}});var Gge=Xn(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.truncateMiddle=frt;function frt(e,t,n){if(e.length<=t)return e;var i,o;n==null?(n="&hellip;",i=8,o=3):(i=n.length,o=n.length);var r=t-o,s="";return r>0&&(s=e.substr(-1*Math.floor(r/2))),(e.substr(0,Math.ceil(r/2))+n+s).substr(0,r+i)}});var jge=Xn(WY=>{"use strict";Object.defineProperty(WY,"__esModule",{value:!0});WY.truncateEnd=hrt;var drt=IT();function hrt(e,t,n){return(0,drt.ellipsis)(e,t,n)}});var qY=Xn(U8=>{"use strict";Object.defineProperty(U8,"__esModule",{value:!0});U8.AnchorTagBuilder=void 0;var mrt=k8(),prt=Hge(),_rt=Gge(),grt=jge(),yrt=function(){function e(t){t===void 0&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return e.prototype.build=function(t){return new mrt.HtmlTag({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},e.prototype.createAttrs=function(t){var n={href:t.getAnchorHref()},i=this.createCssClass(t);return i&&(n.class=i),this.newWindow&&(n.target="_blank",n.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(n.title=t.getAnchorHref()),n},e.prototype.createCssClass=function(t){var n=this.className;if(n){for(var i=[n],o=t.getCssClassSuffixes(),r=0,s=o.length;r<s;r++)i.push(n+"-"+o[r]);return i.join(" ")}else return""},e.prototype.processAnchorText=function(t){return t=this.doTruncate(t),t},e.prototype.doTruncate=function(t){var n=this.truncate;if(!n||!n.length)return t;var i=n.length,o=n.location;return o==="smart"?(0,prt.truncateSmart)(t,i):o==="middle"?(0,_rt.truncateMiddle)(t,i):(0,grt.truncateEnd)(t,i)},e}();U8.AnchorTagBuilder=yrt});var Km={};uJ(Km,{__addDisposableResource:()=>pye,__assign:()=>V8,__asyncDelegator:()=>aye,__asyncGenerator:()=>sye,__asyncValues:()=>cye,__await:()=>jS,__awaiter:()=>eye,__classPrivateFieldGet:()=>dye,__classPrivateFieldIn:()=>mye,__classPrivateFieldSet:()=>hye,__createBinding:()=>H8,__decorate:()=>Yge,__disposeResources:()=>_ye,__esDecorate:()=>Kge,__exportStar:()=>nye,__extends:()=>Wge,__generator:()=>tye,__importDefault:()=>fye,__importStar:()=>uye,__makeTemplateObject:()=>lye,__metadata:()=>Jge,__param:()=>Xge,__propKey:()=>Zge,__read:()=>KY,__rest:()=>qge,__rewriteRelativeImportExtension:()=>gye,__runInitializers:()=>$ge,__setFunctionName:()=>Qge,__spread:()=>iye,__spreadArray:()=>rye,__spreadArrays:()=>oye,__values:()=>z8,default:()=>Trt});function Wge(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");YY(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function qge(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]]);return n}function Yge(e,t,n,i){var o=arguments.length,r=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,n,r):s(t,n))||r);return o>3&&r&&Object.defineProperty(t,n,r),r}function Xge(e,t){return function(n,i){t(n,i,e)}}function Kge(e,t,n,i,o,r){function s(x){if(x!==void 0&&typeof x!="function")throw new TypeError("Function expected");return x}for(var a=i.kind,l=a==="getter"?"get":a==="setter"?"set":"value",u=!t&&e?i.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),h,p=!1,g=n.length-1;g>=0;g--){var m={};for(var y in i)m[y]=y==="access"?{}:i[y];for(var y in i.access)m.access[y]=i.access[y];m.addInitializer=function(x){if(p)throw new TypeError("Cannot add initializers after decoration has completed");r.push(s(x||null))};var b=(0,n[g])(a==="accessor"?{get:f.get,set:f.set}:f[l],m);if(a==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(h=s(b.get))&&(f.get=h),(h=s(b.set))&&(f.set=h),(h=s(b.init))&&o.unshift(h)}else(h=s(b))&&(a==="field"?o.unshift(h):f[l]=h)}u&&Object.defineProperty(u,i.name,f),p=!0}function $ge(e,t,n){for(var i=arguments.length>2,o=0;o<t.length;o++)n=i?t[o].call(e,n):t[o].call(e);return i?n:void 0}function Zge(e){return typeof e=="symbol"?e:"".concat(e)}function Qge(e,t,n){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function Jge(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function eye(e,t,n,i){function o(r){return r instanceof n?r:new n(function(s){s(r)})}return new(n||(n=Promise))(function(r,s){function a(f){try{u(i.next(f))}catch(h){s(h)}}function l(f){try{u(i.throw(f))}catch(h){s(h)}}function u(f){f.done?r(f.value):o(f.value).then(a,l)}u((i=i.apply(e,t||[])).next())})}function tye(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(f){return l([u,f])}}function l(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(i=1,o&&(r=u[0]&2?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:r=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){n.label=u[1];break}if(u[0]===6&&n.label<r[1]){n.label=r[1],r=u;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(u);break}r[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(f){u=[6,f],o=0}finally{i=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function nye(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&H8(t,e,n)}function z8(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function KY(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var i=n.call(e),o,r=[],s;try{for(;(t===void 0||t-- >0)&&!(o=i.next()).done;)r.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return r}function iye(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(KY(arguments[t]));return e}function oye(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),o=0,t=0;t<n;t++)for(var r=arguments[t],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}function rye(e,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,r;i<o;i++)(r||!(i in t))&&(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function jS(e){return this instanceof jS?(this.v=e,this):new jS(e)}function sye(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(e,t||[]),o,r=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(g){return function(m){return Promise.resolve(m).then(g,h)}}function a(g,m){i[g]&&(o[g]=function(y){return new Promise(function(b,x){r.push([g,y,b,x])>1||l(g,y)})},m&&(o[g]=m(o[g])))}function l(g,m){try{u(i[g](m))}catch(y){p(r[0][3],y)}}function u(g){g.value instanceof jS?Promise.resolve(g.value.v).then(f,h):p(r[0][2],g)}function f(g){l("next",g)}function h(g){l("throw",g)}function p(g,m){g(m),r.shift(),r.length&&l(r[0][0],r[0][1])}}function aye(e){var t,n;return t={},i("next"),i("throw",function(o){throw o}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(o,r){t[o]=e[o]?function(s){return(n=!n)?{value:jS(e[o](s)),done:!1}:r?r(s):s}:r}}function cye(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof z8=="function"?z8(e):e[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(r){n[r]=e[r]&&function(s){return new Promise(function(a,l){s=e[r](s),o(a,l,s.done,s.value)})}}function o(r,s,a,l){Promise.resolve(l).then(function(u){r({value:u,done:a})},s)}}function lye(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function uye(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=XY(e),i=0;i<n.length;i++)n[i]!=="default"&&H8(t,e,n[i]);return brt(t,e),t}function fye(e){return e&&e.__esModule?e:{default:e}}function dye(e,t,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)}function hye(e,t,n,i,o){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?o.call(e,n):o?o.value=n:t.set(e,n),n}function mye(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function pye(e,t,n){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var i,o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],n&&(o=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");o&&(i=function(){try{o.call(this)}catch(r){return Promise.reject(r)}}),e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}function _ye(e){function t(r){e.error=e.hasError?new xrt(r,e.error,"An error was suppressed during disposal."):r,e.hasError=!0}var n,i=0;function o(){for(;n=e.stack.pop();)try{if(!n.async&&i===1)return i=0,e.stack.push(n),Promise.resolve().then(o);if(n.dispose){var r=n.dispose.call(n.value);if(n.async)return i|=2,Promise.resolve(r).then(o,function(s){return t(s),o()})}else i|=1}catch(s){t(s)}if(i===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}function gye(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,i,o,r,s){return i?t?".jsx":".js":o&&(!r||!s)?n:o+r+"."+s.toLowerCase()+"js"}):e}var YY,V8,H8,brt,XY,xrt,Trt,$m=SSe(()=>{YY=function(e,t){return YY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},YY(e,t)};V8=function(){return V8=Object.assign||function(t){for(var n,i=1,o=arguments.length;i<o;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},V8.apply(this,arguments)};H8=Object.create?function(e,t,n,i){i===void 0&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){i===void 0&&(i=n),e[i]=t[n]};brt=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},XY=function(e){return XY=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},XY(e)};xrt=typeof SuppressedError=="function"?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};Trt={__extends:Wge,__assign:V8,__rest:qge,__decorate:Yge,__param:Xge,__esDecorate:Kge,__runInitializers:$ge,__propKey:Zge,__setFunctionName:Qge,__metadata:Jge,__awaiter:eye,__generator:tye,__createBinding:H8,__exportStar:nye,__values:z8,__read:KY,__spread:iye,__spreadArrays:oye,__spreadArray:rye,__await:jS,__asyncGenerator:sye,__asyncDelegator:aye,__asyncValues:cye,__makeTemplateObject:lye,__importStar:uye,__importDefault:fye,__classPrivateFieldGet:dye,__classPrivateFieldSet:hye,__classPrivateFieldIn:mye,__addDisposableResource:pye,__disposeResources:_ye,__rewriteRelativeImportExtension:gye}});var RT=Xn(G8=>{"use strict";Object.defineProperty(G8,"__esModule",{value:!0});G8.AbstractMatch=void 0;var Art=function(){function e(t){this._=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(t){this.offset=t},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.type]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}();G8.AbstractMatch=Art});var yye=Xn(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0});MT.tldRegex=MT.tldRegexStr=void 0;MT.tldRegexStr="(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|travelersinsurance|verm\xF6gensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|verm\xF6gensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|pramerica|richardli|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|banamex|bauhaus|bentley|bestbuy|booking|brother|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|yamaxun|youtube|zuerich|\u043A\u0430\u0442\u043E\u043B\u0438\u043A|\u0627\u0644\u0628\u062D\u0631\u064A\u0646|\u0627\u0644\u062C\u0632\u0627\u0626\u0631|\u0627\u0644\u0639\u0644\u064A\u0627\u0646|\u067E\u0627\u06A9\u0633\u062A\u0627\u0646|\u0643\u0627\u062B\u0648\u0644\u064A\u0643|\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kindle|kosher|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|nagoya|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|walter|webcam|xihuan|yachts|yandex|zappos|\u043C\u043E\u0441\u043A\u0432\u0430|\u043E\u043D\u043B\u0430\u0439\u043D|\u0627\u0628\u0648\u0638\u0628\u064A|\u0627\u0631\u0627\u0645\u0643\u0648|\u0627\u0644\u0627\u0631\u062F\u0646|\u0627\u0644\u0645\u063A\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062A|\u0641\u0644\u0633\u0637\u064A\u0646|\u0645\u0644\u064A\u0633\u064A\u0627|\u092D\u093E\u0930\u0924\u092E\u094D|\u0B87\u0BB2\u0B99\u0BCD\u0B95\u0BC8|\u30D5\u30A1\u30C3\u30B7\u30E7\u30F3|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|lipsy|loans|locus|lotte|lotto|mango|media|miami|money|movie|music|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|\u05D9\u05E9\u05E8\u05D0\u05DC|\u0627\u06CC\u0631\u0627\u0646|\u0628\u0627\u0632\u0627\u0631|\u0628\u06BE\u0627\u0631\u062A|\u0633\u0648\u062F\u0627\u0646|\u0633\u0648\u0631\u064A\u0629|\u0647\u0645\u0631\u0627\u0647|\u092D\u093E\u0930\u094B\u0924|\u0938\u0902\u0917\u0920\u0928|\u09AC\u09BE\u0982\u09B2\u09BE|\u0C2D\u0C3E\u0C30\u0C24\u0C4D|\u0D2D\u0D3E\u0D30\u0D24\u0D02|\u5609\u91CC\u5927\u9152\u5E97|aarp|able|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|dvag|erni|fage|fail|fans|farm|fast|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|\u0434\u0435\u0442\u0438|\u0441\u0430\u0439\u0442|\u0628\u0627\u0631\u062A|\u0628\u064A\u062A\u0643|\u0680\u0627\u0631\u062A|\u062A\u0648\u0646\u0633|\u0634\u0628\u0643\u0629|\u0639\u0631\u0627\u0642|\u0639\u0645\u0627\u0646|\u0645\u0648\u0642\u0639|\u092D\u093E\u0930\u0924|\u09AD\u09BE\u09B0\u09A4|\u09AD\u09BE\u09F0\u09A4|\u0A2D\u0A3E\u0A30\u0A24|\u0AAD\u0ABE\u0AB0\u0AA4|\u0B2D\u0B3E\u0B30\u0B24|\u0CAD\u0CBE\u0CB0\u0CA4|\u0DBD\u0D82\u0D9A\u0DCF|\u30A2\u30DE\u30BE\u30F3|\u30B0\u30FC\u30B0\u30EB|\u30AF\u30E9\u30A6\u30C9|\u30DD\u30A4\u30F3\u30C8|\u7EC4\u7EC7\u673A\u6784|\u96FB\u8A0A\u76C8\u79D1|\u9999\u683C\u91CC\u62C9|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|ceo|cfa|cfd|com|cpa|crs|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|scb|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|\u0431\u0435\u043B|\u043A\u043E\u043C|\u049B\u0430\u0437|\u043C\u043A\u0434|\u043C\u043E\u043D|\u043E\u0440\u0433|\u0440\u0443\u0441|\u0441\u0440\u0431|\u0443\u043A\u0440|\u0570\u0561\u0575|\u05E7\u05D5\u05DD|\u0639\u0631\u0628|\u0642\u0637\u0631|\u0643\u0648\u0645|\u0645\u0635\u0631|\u0915\u0949\u092E|\u0928\u0947\u091F|\u0E04\u0E2D\u0E21|\u0E44\u0E17\u0E22|\u0EA5\u0EB2\u0EA7|\u30B9\u30C8\u30A2|\u30BB\u30FC\u30EB|\u307F\u3093\u306A|\u4E2D\u6587\u7F51|\u4E9A\u9A6C\u900A|\u5929\u4E3B\u6559|\u6211\u7231\u4F60|\u65B0\u52A0\u5761|\u6DE1\u9A6C\u9521|\u98DE\u5229\u6D66|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|\u03B5\u03BB|\u03B5\u03C5|\u0431\u0433|\u0435\u044E|\u0440\u0444|\u10D2\u10D4|\uB2F7\uB137|\uB2F7\uCEF4|\uC0BC\uC131|\uD55C\uAD6D|\u30B3\u30E0|\u4E16\u754C|\u4E2D\u4FE1|\u4E2D\u56FD|\u4E2D\u570B|\u4F01\u4E1A|\u4F5B\u5C71|\u4FE1\u606F|\u5065\u5EB7|\u516B\u5366|\u516C\u53F8|\u516C\u76CA|\u53F0\u6E7E|\u53F0\u7063|\u5546\u57CE|\u5546\u5E97|\u5546\u6807|\u5609\u91CC|\u5728\u7EBF|\u5927\u62FF|\u5A31\u4E50|\u5BB6\u96FB|\u5E7F\u4E1C|\u5FAE\u535A|\u6148\u5584|\u624B\u673A|\u62DB\u8058|\u653F\u52A1|\u653F\u5E9C|\u65B0\u95FB|\u65F6\u5C1A|\u66F8\u7C4D|\u673A\u6784|\u6E38\u620F|\u6FB3\u9580|\u70B9\u770B|\u79FB\u52A8|\u7F51\u5740|\u7F51\u5E97|\u7F51\u7AD9|\u7F51\u7EDC|\u8054\u901A|\u8C37\u6B4C|\u8D2D\u7269|\u901A\u8CA9|\u96C6\u56E2|\u98DF\u54C1|\u9910\u5385|\u9999\u6E2F)";MT.tldRegex=new RegExp("^"+MT.tldRegexStr+"$")});var j8=Xn(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.tldUrlHostRe=pi.schemeUrlRe=pi.invalidSchemeRe=pi.urlSuffixedCharsNotAllowedAtEndRe=pi.httpSchemePrefixRe=pi.httpSchemeRe=pi.urlSuffixNotAllowedAsLastCharRe=pi.urlSuffixAllowedSpecialCharsRe=pi.urlSuffixStartCharsRe=pi.domainNameCharRegex=void 0;pi.isSchemeStartChar=Ert;pi.isSchemeChar=Srt;pi.isDomainLabelStartChar=bye;pi.isDomainLabelChar=wrt;pi.isPathChar=vrt;pi.isUrlSuffixStartChar=Drt;pi.isKnownTld=xye;pi.isValidSchemeUrl=Prt;pi.isValidTldMatch=Irt;pi.isValidIpV4Address=Mrt;var LT=OT(),Crt=yye();pi.domainNameCharRegex=LT.alphaNumericAndMarksRe;pi.urlSuffixStartCharsRe=/[\/?#]/;pi.urlSuffixAllowedSpecialCharsRe=/[-+&@#/%=~_()|'$*\[\]{}\u2713]/;pi.urlSuffixNotAllowedAsLastCharRe=/[?!:,.;^]/;pi.httpSchemeRe=/https?:\/\//i;pi.httpSchemePrefixRe=new RegExp("^"+pi.httpSchemeRe.source,"i");pi.urlSuffixedCharsNotAllowedAtEndRe=new RegExp(pi.urlSuffixNotAllowedAsLastCharRe.source+"$");pi.invalidSchemeRe=/^(javascript|vbscript):/i;pi.schemeUrlRe=/^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/;pi.tldUrlHostRe=/^(?:\/\/)?([^/#?:]+)/;function Ert(e){return LT.letterRe.test(e)}function Srt(e){return LT.letterRe.test(e)||LT.digitRe.test(e)||e==="+"||e==="-"||e==="."}function bye(e){return LT.alphaNumericAndMarksRe.test(e)}function wrt(e){return e==="_"||bye(e)}function vrt(e){return LT.alphaNumericAndMarksRe.test(e)||pi.urlSuffixAllowedSpecialCharsRe.test(e)||pi.urlSuffixNotAllowedAsLastCharRe.test(e)}function Drt(e){return pi.urlSuffixStartCharsRe.test(e)}function xye(e){return Crt.tldRegex.test(e.toLowerCase())}function Prt(e){if(pi.invalidSchemeRe.test(e))return!1;var t=e.match(pi.schemeUrlRe);if(!t)return!1;var n=!!t[1],i=t[2];return n?!0:!(i.indexOf(".")===-1||!LT.letterRe.test(i))}function Irt(e){var t=e.match(pi.tldUrlHostRe);if(!t)return!1;var n=t[0],i=n.split(".");if(i.length<2)return!1;var o=i[i.length-1];return!!xye(o)}var Ort=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,Rrt=/[:/?#]/;function Mrt(e){var t=e.split(Rrt,1)[0];return Ort.test(t)}});var $Y=Xn(W8=>{"use strict";Object.defineProperty(W8,"__esModule",{value:!0});W8.UrlMatch=void 0;var Lrt=($m(),nm(Km)),Nrt=RT(),Frt=j8(),Brt=/^(https?:\/\/)?(www\.)?/i,krt=/^\/\//,Urt=function(e){Lrt.__extends(t,e);function t(n){var i=e.call(this,n)||this;return i.type="url",i.url="",i.urlMatchType="scheme",i.protocolRelativeMatch=!1,i.stripPrefix={scheme:!0,www:!0},i.stripTrailingSlash=!0,i.decodePercentEncoding=!0,i.protocolPrepended=!1,i.urlMatchType=n.urlMatchType,i.url=n.url,i.protocolRelativeMatch=n.protocolRelativeMatch,i.stripPrefix=n.stripPrefix,i.stripTrailingSlash=n.stripTrailingSlash,i.decodePercentEncoding=n.decodePercentEncoding,i}return t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var n=this.url;return!this.protocolRelativeMatch&&this.urlMatchType!=="scheme"&&!this.protocolPrepended&&(n=this.url="http://"+n,this.protocolPrepended=!0),n},t.prototype.getAnchorHref=function(){var n=this.getUrl();return n.replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var n=this.getMatchedText();return this.protocolRelativeMatch&&(n=Hrt(n)),this.stripPrefix.scheme&&(n=Vrt(n)),this.stripPrefix.www&&(n=zrt(n)),this.stripTrailingSlash&&(n=Grt(n)),this.decodePercentEncoding&&(n=jrt(n)),n},t}(Nrt.AbstractMatch);W8.UrlMatch=Urt;function Vrt(e){return e.replace(Frt.httpSchemePrefixRe,"")}function zrt(e){return e.replace(Brt,"$1")}function Hrt(e){return e.replace(krt,"")}function Grt(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e}function jrt(e){var t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch{return t}}});var Aye=Xn(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0});NT.mailtoSchemePrefixRe=void 0;NT.isEmailLocalPartStartChar=Yrt;NT.isEmailLocalPartChar=Xrt;NT.isValidEmail=Krt;var Tye=OT(),Wrt=j8();NT.mailtoSchemePrefixRe=/^mailto:/i;var qrt=new RegExp("[".concat(Tye.alphaNumericAndMarksCharsStr,"!#$%&'*+/=?^_`{|}~-]"));function Yrt(e){return Tye.alphaNumericAndMarksRe.test(e)}function Xrt(e){return qrt.test(e)}function Krt(e){var t=e.split(".").pop()||"";return(0,Wrt.isKnownTld)(t)}});var ZY=Xn(q8=>{"use strict";Object.defineProperty(q8,"__esModule",{value:!0});q8.EmailMatch=void 0;var $rt=($m(),nm(Km)),Zrt=RT(),Qrt=function(e){$rt.__extends(t,e);function t(n){var i=e.call(this,n)||this;return i.type="email",i.email="",i.email=n.email,i}return t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Zrt.AbstractMatch);q8.EmailMatch=Qrt});var QY=Xn(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});WS.hashtagServices=void 0;WS.isHashtagTextChar=est;WS.isValidHashtag=tst;var Jrt=OT();function est(e){return e==="_"||Jrt.alphaNumericAndMarksRe.test(e)}function tst(e){return e.length<=140}WS.hashtagServices=["twitter","facebook","instagram","tiktok","youtube"]});var JY=Xn(Y8=>{"use strict";Object.defineProperty(Y8,"__esModule",{value:!0});Y8.HashtagMatch=void 0;var nst=($m(),nm(Km)),ist=IT(),ost=RT(),rst=function(e){nst.__extends(t,e);function t(n){var i=e.call(this,n)||this;return i.type="hashtag",i.serviceName="twitter",i.hashtag="",i.serviceName=n.serviceName,i.hashtag=n.hashtag,i}return t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var n=this.serviceName,i=this.hashtag;switch(n){case"twitter":return"https://twitter.com/hashtag/"+i;case"facebook":return"https://www.facebook.com/hashtag/"+i;case"instagram":return"https://instagram.com/explore/tags/"+i;case"tiktok":return"https://www.tiktok.com/tag/"+i;case"youtube":return"https://youtube.com/hashtag/"+i;default:throw(0,ist.assertNever)(n),new Error("Invalid hashtag service: ".concat(n))}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t.prototype.getCssClassSuffixes=function(){var n=e.prototype.getCssClassSuffixes.call(this),i=this.getServiceName();return i&&n.push(i),n},t}(ost.AbstractMatch);Y8.HashtagMatch=rst});var eX=Xn(qS=>{"use strict";Object.defineProperty(qS,"__esModule",{value:!0});qS.mentionServices=void 0;qS.isMentionTextChar=cst;qS.isValidMention=lst;var sst={twitter:/^@\w{1,15}$/,instagram:/^@[_\w]{1,30}$/,soundcloud:/^@[-a-z0-9_]{3,25}$/,tiktok:/^@[.\w]{1,23}[\w]$/,youtube:/^@[-.·\w]{3,30}$/},ast=/[-\w.]/;function cst(e){return ast.test(e)}function lst(e,t){var n=sst[t];return n.test(e)}qS.mentionServices=["twitter","instagram","soundcloud","tiktok","youtube"]});var tX=Xn(X8=>{"use strict";Object.defineProperty(X8,"__esModule",{value:!0});X8.MentionMatch=void 0;var ust=($m(),nm(Km)),fst=IT(),dst=RT(),hst=function(e){ust.__extends(t,e);function t(n){var i=e.call(this,n)||this;return i.type="mention",i.serviceName="twitter",i.mention="",i.mention=n.mention,i.serviceName=n.serviceName,i}return t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;case"tiktok":return"https://www.tiktok.com/@"+this.mention;case"youtube":return"https://youtube.com/@"+this.mention;default:throw(0,fst.assertNever)(this.serviceName),new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var n=e.prototype.getCssClassSuffixes.call(this),i=this.getServiceName();return i&&n.push(i),n},t}(dst.AbstractMatch);X8.MentionMatch=hst});var Cye=Xn(MF=>{"use strict";Object.defineProperty(MF,"__esModule",{value:!0});MF.isPhoneNumberSeparatorChar=xst;MF.isPhoneNumberControlChar=Tst;MF.isValidPhoneNumber=Ast;var mst=/[-. ]/,pst=/[-. ()]/,_st=/[,;]/,gst=/(?:(?:(?:(\+)?\d{1,3}[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-. ]?(?:\d[-. ]?){6,12}\d+))([,;]+[0-9]+#?)*/,yst=/(0([1-9]-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/,bst=new RegExp("^".concat(gst.source,"|").concat(yst.source,"$"));function xst(e){return mst.test(e)}function Tst(e){return _st.test(e)}function Ast(e){var t=e.charAt(0)==="+"||pst.test(e);return t&&bst.test(e)}});var nX=Xn(K8=>{"use strict";Object.defineProperty(K8,"__esModule",{value:!0});K8.PhoneMatch=void 0;var Cst=($m(),nm(Km)),Est=RT(),Sst=function(e){Cst.__extends(t,e);function t(n){var i=e.call(this,n)||this;return i.type="phone",i.number="",i.plusSign=!1,i.number=n.number,i.plusSign=n.plusSign,i}return t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Est.AbstractMatch);K8.PhoneMatch=Sst});var aX=Xn(Z8=>{"use strict";Object.defineProperty(Z8,"__esModule",{value:!0});Z8.parseMatches=Ost;Z8.excludeUnbalancedTrailingBracesAndPunctuation=wye;var Wa=OT(),wst=$Y(),vo=IT(),$o=j8(),YS=Aye(),vst=ZY(),iX=QY(),Dst=JY(),oX=eX(),Pst=tX(),XS=Cye(),Ist=nX();function Ost(e,t){for(var n=t.tagBuilder,i=t.stripPrefix,o=t.stripTrailingSlash,r=t.decodePercentEncoding,s=t.hashtagServiceName,a=t.mentionServiceName,l=[],u=e.length,f=[],h=0;h<u;h++){var p=e.charAt(h);if(f.length===0)x(p);else{for(var g=f.length-1;g>=0;g--){var m=f[g];switch(m.state){case 11:M(m,p);break;case 12:R(m,p);break;case 0:A(m,p);break;case 1:C(m,p);break;case 2:S(m,p);break;case 3:v(m,p);break;case 4:P(m,p);break;case 5:L(m,p);break;case 6:F(m,p);break;case 7:_(m,p);break;case 13:w(m,p);break;case 14:D(m,p);break;case 8:I(m,p);break;case 9:N(m,p);break;case 10:k(m,p);break;case 15:z(m,p);break;case 16:V(m,p);break;case 17:j(m,p);break;case 18:U(m,p);break;case 19:q(m,p);break;case 20:Y(m,p);break;case 21:te(m,p);break;case 22:K(m,p);break;case 23:Z(m,p);break;case 24:ee(m,p);break;case 25:me(m,p);break;case 26:Te(m,p);break;case 27:ue(m,p);break;case 28:ye(m,p);break;case 29:Ae(m,p);break;case 30:Pe(m,p);break;case 31:Ee(m,p);break;case 32:qe(m,p);break;case 33:it(m,p);break;case 34:Dt(m,p);break;case 35:jt(m,p);break;case 36:$e(m,p);break;case 37:ze(m,p);break;case 38:un(m,p);break;case 39:zt(m,p);break;case 40:Ct(m,p);break;case 41:Ei(m,p);break;default:(0,vo.assertNever)(m.state)}}if(h>0&&(0,$o.isSchemeStartChar)(p)){var y=e.charAt(h-1);!(0,$o.isSchemeStartChar)(y)&&!f.some(Bst)&&f.push($8(h,0))}}}for(var b=f.length-1;b>=0;b--)f.forEach(function(_e){return an(_e)});return l;function x(_e){if(_e==="#")f.push(Nst(h,28));else if(_e==="@")f.push(Fst(h,30));else if(_e==="/")f.push(rX(h,11));else if(_e==="+")f.push(sX(h,37));else if(_e==="(")f.push(sX(h,32));else{if(Wa.digitRe.test(_e)&&(f.push(sX(h,38)),f.push(Mst(h,13))),(0,YS.isEmailLocalPartStartChar)(_e)){var Ce=_e.toLowerCase()==="m"?15:22;f.push(Lst(h,Ce))}(0,$o.isSchemeStartChar)(_e)&&f.push($8(h,0)),Wa.alphaNumericAndMarksRe.test(_e)&&f.push(rX(h,5))}}function A(_e,Ce){Ce===":"?_e.state=2:Ce==="-"?_e.state=1:(0,$o.isSchemeChar)(Ce)||(0,vo.remove)(f,_e)}function C(_e,Ce){Ce==="-"||(Ce==="/"?((0,vo.remove)(f,_e),f.push(rX(h,11))):(0,$o.isSchemeChar)(Ce)?_e.state=0:(0,vo.remove)(f,_e))}function S(_e,Ce){Ce==="/"?_e.state=3:Ce==="."?(0,vo.remove)(f,_e):(0,$o.isDomainLabelStartChar)(Ce)?(_e.state=5,(0,$o.isSchemeStartChar)(Ce)&&f.push($8(h,0))):(0,vo.remove)(f,_e)}function v(_e,Ce){Ce==="/"?_e.state=4:(0,$o.isPathChar)(Ce)?(_e.state=10,_e.acceptStateReached=!0):an(_e)}function P(_e,Ce){Ce==="/"?_e.state=10:(0,$o.isDomainLabelStartChar)(Ce)?(_e.state=5,_e.acceptStateReached=!0):(0,vo.remove)(f,_e)}function M(_e,Ce){Ce==="/"?_e.state=12:(0,vo.remove)(f,_e)}function R(_e,Ce){(0,$o.isDomainLabelStartChar)(Ce)?_e.state=5:(0,vo.remove)(f,_e)}function L(_e,Ce){Ce==="."?_e.state=7:Ce==="-"?_e.state=6:Ce===":"?_e.state=8:(0,$o.isUrlSuffixStartChar)(Ce)?_e.state=10:(0,$o.isDomainLabelChar)(Ce)||an(_e)}function F(_e,Ce){Ce==="-"||(Ce==="."?an(_e):(0,$o.isDomainLabelStartChar)(Ce)?_e.state=5:an(_e))}function _(_e,Ce){Ce==="."?an(_e):(0,$o.isDomainLabelStartChar)(Ce)?(_e.state=5,_e.acceptStateReached=!0):an(_e)}function w(_e,Ce){Ce==="."?_e.state=14:Ce===":"?_e.state=8:Wa.digitRe.test(Ce)||((0,$o.isUrlSuffixStartChar)(Ce)?_e.state=10:Wa.alphaNumericAndMarksRe.test(Ce)?(0,vo.remove)(f,_e):an(_e))}function D(_e,Ce){Wa.digitRe.test(Ce)?(_e.octetsEncountered++,_e.octetsEncountered===4&&(_e.acceptStateReached=!0),_e.state=13):an(_e)}function I(_e,Ce){Wa.digitRe.test(Ce)?_e.state=9:an(_e)}function N(_e,Ce){Wa.digitRe.test(Ce)||((0,$o.isUrlSuffixStartChar)(Ce)?_e.state=10:an(_e))}function k(_e,Ce){(0,$o.isPathChar)(Ce)||an(_e)}function z(_e,Ce){Ce.toLowerCase()==="a"?_e.state=16:K(_e,Ce)}function V(_e,Ce){Ce.toLowerCase()==="i"?_e.state=17:K(_e,Ce)}function j(_e,Ce){Ce.toLowerCase()==="l"?_e.state=18:K(_e,Ce)}function U(_e,Ce){Ce.toLowerCase()==="t"?_e.state=19:K(_e,Ce)}function q(_e,Ce){Ce.toLowerCase()==="o"?_e.state=20:K(_e,Ce)}function Y(_e,Ce){Ce.toLowerCase()===":"?_e.state=21:K(_e,Ce)}function te(_e,Ce){(0,YS.isEmailLocalPartChar)(Ce)?_e.state=22:(0,vo.remove)(f,_e)}function K(_e,Ce){Ce==="."?_e.state=23:Ce==="@"?_e.state=24:(0,YS.isEmailLocalPartChar)(Ce)?_e.state=22:(0,vo.remove)(f,_e)}function Z(_e,Ce){Ce==="."||Ce==="@"?(0,vo.remove)(f,_e):(0,YS.isEmailLocalPartChar)(Ce)?_e.state=22:(0,vo.remove)(f,_e)}function ee(_e,Ce){(0,$o.isDomainLabelStartChar)(Ce)?_e.state=25:(0,vo.remove)(f,_e)}function me(_e,Ce){Ce==="."?_e.state=27:Ce==="-"?_e.state=26:(0,$o.isDomainLabelChar)(Ce)||an(_e)}function Te(_e,Ce){Ce==="-"||Ce==="."?an(_e):(0,$o.isDomainLabelChar)(Ce)?_e.state=25:an(_e)}function ue(_e,Ce){Ce==="."||Ce==="-"?an(_e):(0,$o.isDomainLabelStartChar)(Ce)?(_e.state=25,_e.acceptStateReached=!0):an(_e)}function ye(_e,Ce){(0,iX.isHashtagTextChar)(Ce)?(_e.state=29,_e.acceptStateReached=!0):(0,vo.remove)(f,_e)}function Ae(_e,Ce){(0,iX.isHashtagTextChar)(Ce)||an(_e)}function Pe(_e,Ce){(0,oX.isMentionTextChar)(Ce)?(_e.state=31,_e.acceptStateReached=!0):(0,vo.remove)(f,_e)}function Ee(_e,Ce){(0,oX.isMentionTextChar)(Ce)||(Wa.alphaNumericAndMarksRe.test(Ce)?(0,vo.remove)(f,_e):an(_e))}function ze(_e,Ce){Wa.digitRe.test(Ce)?_e.state=38:((0,vo.remove)(f,_e),x(Ce))}function qe(_e,Ce){Wa.digitRe.test(Ce)?_e.state=33:(0,vo.remove)(f,_e),x(Ce)}function it(_e,Ce){Wa.digitRe.test(Ce)?_e.state=34:(0,vo.remove)(f,_e)}function Dt(_e,Ce){Wa.digitRe.test(Ce)?_e.state=35:(0,vo.remove)(f,_e)}function jt(_e,Ce){Ce===")"?_e.state=36:(0,vo.remove)(f,_e)}function $e(_e,Ce){Wa.digitRe.test(Ce)?_e.state=38:(0,XS.isPhoneNumberSeparatorChar)(Ce)?_e.state=39:(0,vo.remove)(f,_e)}function un(_e,Ce){_e.acceptStateReached=!0,(0,XS.isPhoneNumberControlChar)(Ce)?_e.state=40:Ce==="#"?_e.state=41:Wa.digitRe.test(Ce)||(Ce==="("?_e.state=32:(0,XS.isPhoneNumberSeparatorChar)(Ce)?_e.state=39:(an(_e),(0,$o.isSchemeStartChar)(Ce)&&f.push($8(h,0))))}function zt(_e,Ce){Wa.digitRe.test(Ce)?_e.state=38:Ce==="("?_e.state=32:(an(_e),x(Ce))}function Ct(_e,Ce){(0,XS.isPhoneNumberControlChar)(Ce)||(Ce==="#"?_e.state=41:Wa.digitRe.test(Ce)?_e.state=38:an(_e))}function Ei(_e,Ce){(0,XS.isPhoneNumberControlChar)(Ce)?_e.state=40:Wa.digitRe.test(Ce)?(0,vo.remove)(f,_e):an(_e)}function an(_e){if((0,vo.remove)(f,_e),!!_e.acceptStateReached){var Ce=_e.startIdx,pn=e.slice(_e.startIdx,h);if(pn=wye(pn),_e.type==="url"){var mt=e.charAt(_e.startIdx-1);if(mt==="@")return;var so=_e.matchType;if(so==="scheme"){var Ro=$o.httpSchemeRe.exec(pn);if(Ro&&(Ce=Ce+Ro.index,pn=pn.slice(Ro.index)),!(0,$o.isValidSchemeUrl)(pn))return}else if(so==="tld"){if(!(0,$o.isValidTldMatch)(pn))return}else if(so==="ipV4"){if(!(0,$o.isValidIpV4Address)(pn))return}else(0,vo.assertNever)(so);l.push(new wst.UrlMatch({tagBuilder:n,matchedText:pn,offset:Ce,urlMatchType:so,url:pn,protocolRelativeMatch:pn.slice(0,2)==="//",stripPrefix:i,stripTrailingSlash:o,decodePercentEncoding:r}))}else if(_e.type==="email")(0,YS.isValidEmail)(pn)&&l.push(new vst.EmailMatch({tagBuilder:n,matchedText:pn,offset:Ce,email:pn.replace(YS.mailtoSchemePrefixRe,"")}));else if(_e.type==="hashtag")(0,iX.isValidHashtag)(pn)&&l.push(new Dst.HashtagMatch({tagBuilder:n,matchedText:pn,offset:Ce,serviceName:s,hashtag:pn.slice(1)}));else if(_e.type==="mention")(0,oX.isValidMention)(pn,a)&&l.push(new Pst.MentionMatch({tagBuilder:n,matchedText:pn,offset:Ce,serviceName:a,mention:pn.slice(1)}));else if(_e.type==="phone"){if(pn=pn.replace(/ +$/g,""),(0,XS.isValidPhoneNumber)(pn)){var aa=pn.replace(/[^0-9,;#]/g,"");l.push(new Ist.PhoneMatch({tagBuilder:n,matchedText:pn,offset:Ce,number:aa,plusSign:pn.charAt(0)==="+"}))}}else(0,vo.assertNever)(_e)}}}var Rst=/[\(\{\[]/,Eye=/[\)\}\]]/,Sye={")":"(","}":"{","]":"["};function wye(e){for(var t={"(":0,"{":0,"[":0},n=0;n<e.length;n++){var i=e.charAt(n);Rst.test(i)?t[i]++:Eye.test(i)&&t[Sye[i]]--}for(var o=e.length-1,r;o>=0;)if(r=e.charAt(o),Eye.test(r)){var s=Sye[r];if(t[s]<0)t[s]++,o--;else break}else if($o.urlSuffixedCharsNotAllowedAtEndRe.test(r))o--;else break;return e.slice(0,o+1)}function $8(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"scheme"}}function rX(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"tld"}}function Mst(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"ipV4",octetsEncountered:1}}function Lst(e,t){return{type:"email",startIdx:e,state:t,acceptStateReached:!1}}function Nst(e,t){return{type:"hashtag",startIdx:e,state:t,acceptStateReached:!1}}function Fst(e,t){return{type:"mention",startIdx:e,state:t,acceptStateReached:!1}}function sX(e,t){return{type:"phone",startIdx:e,state:t,acceptStateReached:!1}}function Bst(e){return e.type==="url"&&e.matchType==="scheme"}});var vye=Xn(cX=>{"use strict";Object.defineProperty(cX,"__esModule",{value:!0});cX.parseHtml=Ust;var Pc=($m(),nm(Km)),_l=OT(),kst=IT();function Ust(e,t){for(var n=t.onOpenTag,i=t.onCloseTag,o=t.onText,r=t.onComment,s=t.onDoctype,a=new Zm,l=0,u=e.length,f=0,h=0,p=a;l<u;){var g=e.charAt(l);switch(f){case 0:m(g);break;case 1:y(g);break;case 2:x(g);break;case 3:b(g);break;case 4:A(g);break;case 5:C(g);break;case 6:S(g);break;case 7:v(g);break;case 8:P(g);break;case 9:M(g);break;case 10:R(g);break;case 11:L(g);break;case 12:F(g);break;case 13:_(g);break;case 14:w(g);break;case 15:D(g);break;case 16:I(g);break;case 17:N(g);break;case 18:k(g);break;case 19:z(g);break;case 20:V(g);break;default:(0,kst.assertNever)(f)}l++}h<l&&Y();function m(Z){Z==="<"&&U()}function y(Z){Z==="!"?f=13:Z==="/"?(f=2,p=new Zm(Pc.__assign(Pc.__assign({},p),{isClosing:!0}))):Z==="<"?U():_l.letterRe.test(Z)?(f=3,p=new Zm(Pc.__assign(Pc.__assign({},p),{isOpening:!0}))):(f=0,p=a)}function b(Z){_l.whitespaceRe.test(Z)?(p=new Zm(Pc.__assign(Pc.__assign({},p),{name:te()})),f=4):Z==="<"?U():Z==="/"?(p=new Zm(Pc.__assign(Pc.__assign({},p),{name:te()})),f=12):Z===">"?(p=new Zm(Pc.__assign(Pc.__assign({},p),{name:te()})),q()):!_l.letterRe.test(Z)&&!_l.digitRe.test(Z)&&Z!==":"&&j()}function x(Z){Z===">"?j():_l.letterRe.test(Z)?f=3:j()}function A(Z){_l.whitespaceRe.test(Z)||(Z==="/"?f=12:Z===">"?q():Z==="<"?U():Z==="="||_l.quoteRe.test(Z)||_l.controlCharsRe.test(Z)?j():f=5)}function C(Z){_l.whitespaceRe.test(Z)?f=6:Z==="/"?f=12:Z==="="?f=7:Z===">"?q():Z==="<"?U():_l.quoteRe.test(Z)&&j()}function S(Z){_l.whitespaceRe.test(Z)||(Z==="/"?f=12:Z==="="?f=7:Z===">"?q():Z==="<"?U():_l.quoteRe.test(Z)?j():f=5)}function v(Z){_l.whitespaceRe.test(Z)||(Z==='"'?f=8:Z==="'"?f=9:/[>=`]/.test(Z)?j():Z==="<"?U():f=10)}function P(Z){Z==='"'&&(f=11)}function M(Z){Z==="'"&&(f=11)}function R(Z){_l.whitespaceRe.test(Z)?f=4:Z===">"?q():Z==="<"&&U()}function L(Z){_l.whitespaceRe.test(Z)?f=4:Z==="/"?f=12:Z===">"?q():Z==="<"?U():(f=4,K())}function F(Z){Z===">"?(p=new Zm(Pc.__assign(Pc.__assign({},p),{isClosing:!0})),q()):f=4}function _(Z){e.substr(l,2)==="--"?(l+=2,p=new Zm(Pc.__assign(Pc.__assign({},p),{type:"comment"})),f=14):e.substr(l,7).toUpperCase()==="DOCTYPE"?(l+=7,p=new Zm(Pc.__assign(Pc.__assign({},p),{type:"doctype"})),f=20):j()}function w(Z){Z==="-"?f=15:Z===">"?j():f=16}function D(Z){Z==="-"?f=18:Z===">"?j():f=16}function I(Z){Z==="-"&&(f=17)}function N(Z){Z==="-"?f=18:f=16}function k(Z){Z===">"?q():Z==="!"?f=19:Z==="-"||(f=16)}function z(Z){Z==="-"?f=17:Z===">"?q():f=16}function V(Z){Z===">"?q():Z==="<"&&U()}function j(){f=0,p=a}function U(){f=1,p=new Zm({idx:l})}function q(){var Z=e.slice(h,p.idx);Z&&o(Z,h),p.type==="comment"?r(p.idx):p.type==="doctype"?s(p.idx):(p.isOpening&&n(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),j(),h=l+1}function Y(){var Z=e.slice(h,l);o(Z,h),h=l+1}function te(){var Z=p.idx+(p.isClosing?2:1);return e.slice(Z,l).toLowerCase()}function K(){l--}}var Zm=function(){function e(t){t===void 0&&(t={}),this.idx=t.idx!==void 0?t.idx:-1,this.type=t.type||"tag",this.name=t.name||"",this.isOpening=!!t.isOpening,this.isClosing=!!t.isClosing}return e}()});var Q8=Xn(lX=>{"use strict";Object.defineProperty(lX,"__esModule",{value:!0});var Vst=Vge(),Ls=IT(),zst=qY(),Hst=k8(),Gst=aX(),jst=vye(),Wst=eX(),qst=QY(),Yst=function(){function e(t){t===void 0&&(t={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.tagBuilder=null,this.urls=Xst(t.urls),this.email=(0,Ls.isBoolean)(t.email)?t.email:this.email,this.phone=(0,Ls.isBoolean)(t.phone)?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=(0,Ls.isBoolean)(t.newWindow)?t.newWindow:this.newWindow,this.stripPrefix=Kst(t.stripPrefix),this.stripTrailingSlash=(0,Ls.isBoolean)(t.stripTrailingSlash)?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=(0,Ls.isBoolean)(t.decodePercentEncoding)?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(n!==!1&&Wst.mentionServices.indexOf(n)===-1)throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var i=this.hashtag;if(i!==!1&&qst.hashtagServices.indexOf(i)===-1)throw new Error("invalid `hashtag` cfg '".concat(i,"' - see docs"));this.truncate=$st(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return e.link=function(t,n){var i=new e(n);return i.link(t)},e.parse=function(t,n){var i=new e(n);return i.parse(t)},e.prototype.parse=function(t){var n=this,i=["a","style","script"],o=0,r=[];return(0,jst.parseHtml)(t,{onOpenTag:function(s){i.indexOf(s)>=0&&o++},onText:function(s,a){if(o===0){var l=/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi,u=s.split(l),f=a;u.forEach(function(h,p){if(p%2===0){var g=n.parseText(h,f);r.push.apply(r,g)}f+=h.length})}},onCloseTag:function(s){i.indexOf(s)>=0&&(o=Math.max(o-1,0))},onComment:function(s){},onDoctype:function(s){}}),r=this.compactMatches(r),r=this.removeUnwantedMatches(r),r},e.prototype.compactMatches=function(t){t.sort(function(l,u){return l.getOffset()-u.getOffset()});for(var n=0;n<t.length-1;){var i=t[n],o=i.getOffset(),r=i.getMatchedText().length,s=o+r;if(n+1<t.length){if(t[n+1].getOffset()===o){var a=t[n+1].getMatchedText().length>r?n:n+1;t.splice(a,1);continue}if(t[n+1].getOffset()<s){t.splice(n+1,1);continue}}n++}return t},e.prototype.removeUnwantedMatches=function(t){return this.hashtag||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="hashtag"}),this.email||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="email"}),this.phone||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="phone"}),this.mention||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="mention"}),this.urls.schemeMatches||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="scheme"}),this.urls.tldMatches||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="tld"}),this.urls.ipV4Matches||(0,Ls.removeWithPredicate)(t,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="ipV4"}),t},e.prototype.parseText=function(t,n){n===void 0&&(n=0),n=n||0;for(var i=(0,Gst.parseMatches)(t,{tagBuilder:this.getTagBuilder(),stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding,hashtagServiceName:this.hashtag,mentionServiceName:this.mention||"twitter"}),o=0,r=i.length;o<r;o++)i[o].setOffset(n+i[o].getOffset());return i},e.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var n=this.parse(t),i=[],o=0,r=0,s=n.length;r<s;r++){var a=n[r];i.push(t.substring(o,a.getOffset())),i.push(this.createMatchReturnVal(a)),o=a.getOffset()+a.getMatchedText().length}return i.push(t.substring(o)),i.join("")},e.prototype.createMatchReturnVal=function(t){var n;if(this.replaceFn&&(n=this.replaceFn.call(this.context,t)),typeof n=="string")return n;if(n===!1)return t.getMatchedText();if(n instanceof Hst.HtmlTag)return n.toAnchorString();var i=t.buildTag();return i.toAnchorString()},e.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new zst.AnchorTagBuilder({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},e.version=Vst.version,e}();lX.default=Yst;function Xst(e){return e==null&&(e=!0),(0,Ls.isBoolean)(e)?{schemeMatches:e,tldMatches:e,ipV4Matches:e}:{schemeMatches:(0,Ls.isBoolean)(e.schemeMatches)?e.schemeMatches:!0,tldMatches:(0,Ls.isBoolean)(e.tldMatches)?e.tldMatches:!0,ipV4Matches:(0,Ls.isBoolean)(e.ipV4Matches)?e.ipV4Matches:!0}}function Kst(e){return e==null&&(e=!0),(0,Ls.isBoolean)(e)?{scheme:e,www:e}:{scheme:(0,Ls.isBoolean)(e.scheme)?e.scheme:!0,www:(0,Ls.isBoolean)(e.www)?e.www:!0}}function $st(e){return typeof e=="number"?{length:e,location:"end"}:(0,Ls.defaults)(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})}});var Pye=Xn(Dye=>{"use strict";Object.defineProperty(Dye,"__esModule",{value:!0})});var Iye=Xn(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});var FT=($m(),nm(Km));FT.__exportStar(Pye(),lg);FT.__exportStar(ZY(),lg);FT.__exportStar(JY(),lg);FT.__exportStar(RT(),lg);FT.__exportStar(tX(),lg);FT.__exportStar(nX(),lg);FT.__exportStar($Y(),lg)});var Oye=Xn(uX=>{"use strict";Object.defineProperty(uX,"__esModule",{value:!0});var Zst=($m(),nm(Km));Zst.__exportStar(aX(),uX)});var fX=Xn((Nh,Mye)=>{"use strict";Nh=Mye.exports=Q8().default;Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Autolinker=void 0;var KS=($m(),nm(Km)),Rye=KS.__importDefault(Q8());Nh.Autolinker=Rye.default;Nh.default=Rye.default;KS.__exportStar(Q8(),Nh);KS.__exportStar(qY(),Nh);KS.__exportStar(k8(),Nh);KS.__exportStar(Iye(),Nh);KS.__exportStar(Oye(),Nh)});var fZ=Xn((exports,module)=>{/*!
 * protobuf.js v7.4.0 (c) 2016, daniel wirtz
 * compiled thu, 22 aug 2024 20:30:39 utc
 * licensed under the bsd-3-clause license
 * see: https://github.com/dcodeio/protobuf.js for details
 */(function(undefined){"use strict";(function(t,n,i){function o(s){var a=n[s];return a||t[s][0].call(a=n[s]={exports:{}},o,a,a.exports),a.exports}var r=o(i[0]);r.util.global.protobuf=r,typeof define=="function"&&define.amd&&define(["long"],function(s){return s&&s.isLong&&(r.util.Long=s,r.configure()),r}),typeof module=="object"&&module&&module.exports&&(module.exports=r)})({1:[function(e,t,n){"use strict";t.exports=i;function i(o,r){for(var s=new Array(arguments.length-1),a=0,l=2,u=!0;l<arguments.length;)s[a++]=arguments[l++];return new Promise(function(h,p){s[a]=function(m){if(u)if(u=!1,m)p(m);else{for(var y=new Array(arguments.length-1),b=0;b<y.length;)y[b++]=arguments[b];h.apply(null,y)}};try{o.apply(r||null,s)}catch(g){u&&(u=!1,p(g))}})}},{}],2:[function(e,t,n){"use strict";var i=n;i.length=function(u){var f=u.length;if(!f)return 0;for(var h=0;--f%4>1&&u.charAt(f)==="=";)++h;return Math.ceil(u.length*3)/4-h};for(var o=new Array(64),r=new Array(123),s=0;s<64;)r[o[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(u,f,h){for(var p=null,g=[],m=0,y=0,b;f<h;){var x=u[f++];switch(y){case 0:g[m++]=o[x>>2],b=(x&3)<<4,y=1;break;case 1:g[m++]=o[b|x>>4],b=(x&15)<<2,y=2;break;case 2:g[m++]=o[b|x>>6],g[m++]=o[x&63],y=0;break}m>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,g)),m=0)}return y&&(g[m++]=o[b],g[m++]=61,y===1&&(g[m++]=61)),p?(m&&p.push(String.fromCharCode.apply(String,g.slice(0,m))),p.join("")):String.fromCharCode.apply(String,g.slice(0,m))};var a="invalid encoding";i.decode=function(u,f,h){for(var p=h,g=0,m,y=0;y<u.length;){var b=u.charCodeAt(y++);if(b===61&&g>1)break;if((b=r[b])===undefined)throw Error(a);switch(g){case 0:m=b,g=1;break;case 1:f[h++]=m<<2|(b&48)>>4,m=b,g=2;break;case 2:f[h++]=(m&15)<<4|(b&60)>>2,m=b,g=3;break;case 3:f[h++]=(m&3)<<6|b,g=0;break}}if(g===1)throw Error(a);return h-p},i.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}},{}],3:[function(e,t,n){"use strict";t.exports=i;function i(){this._listeners={}}i.prototype.on=function(r,s,a){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:s,ctx:a||this}),this},i.prototype.off=function(r,s){if(r===undefined)this._listeners={};else if(s===undefined)this._listeners[r]=[];else for(var a=this._listeners[r],l=0;l<a.length;)a[l].fn===s?a.splice(l,1):++l;return this},i.prototype.emit=function(r){var s=this._listeners[r];if(s){for(var a=[],l=1;l<arguments.length;)a.push(arguments[l++]);for(l=0;l<s.length;)s[l].fn.apply(s[l++].ctx,a)}return this}},{}],4:[function(e,t,n){"use strict";t.exports=i(i);function i(l){return typeof Float32Array<"u"?function(){var u=new Float32Array([-0]),f=new Uint8Array(u.buffer),h=f[3]===128;function p(b,x,A){u[0]=b,x[A]=f[0],x[A+1]=f[1],x[A+2]=f[2],x[A+3]=f[3]}function g(b,x,A){u[0]=b,x[A]=f[3],x[A+1]=f[2],x[A+2]=f[1],x[A+3]=f[0]}l.writeFloatLE=h?p:g,l.writeFloatBE=h?g:p;function m(b,x){return f[0]=b[x],f[1]=b[x+1],f[2]=b[x+2],f[3]=b[x+3],u[0]}function y(b,x){return f[3]=b[x],f[2]=b[x+1],f[1]=b[x+2],f[0]=b[x+3],u[0]}l.readFloatLE=h?m:y,l.readFloatBE=h?y:m}():function(){function u(h,p,g,m){var y=p<0?1:0;if(y&&(p=-p),p===0)h(1/p>0?0:2147483648,g,m);else if(isNaN(p))h(2143289344,g,m);else if(p>34028234663852886e22)h((y<<31|2139095040)>>>0,g,m);else if(p<11754943508222875e-54)h((y<<31|Math.round(p/1401298464324817e-60))>>>0,g,m);else{var b=Math.floor(Math.log(p)/Math.LN2),x=Math.round(p*Math.pow(2,-b)*8388608)&8388607;h((y<<31|b+127<<23|x)>>>0,g,m)}}l.writeFloatLE=u.bind(null,o),l.writeFloatBE=u.bind(null,r);function f(h,p,g){var m=h(p,g),y=(m>>31)*2+1,b=m>>>23&255,x=m&8388607;return b===255?x?NaN:y*(1/0):b===0?y*1401298464324817e-60*x:y*Math.pow(2,b-150)*(x+8388608)}l.readFloatLE=f.bind(null,s),l.readFloatBE=f.bind(null,a)}(),typeof Float64Array<"u"?function(){var u=new Float64Array([-0]),f=new Uint8Array(u.buffer),h=f[7]===128;function p(b,x,A){u[0]=b,x[A]=f[0],x[A+1]=f[1],x[A+2]=f[2],x[A+3]=f[3],x[A+4]=f[4],x[A+5]=f[5],x[A+6]=f[6],x[A+7]=f[7]}function g(b,x,A){u[0]=b,x[A]=f[7],x[A+1]=f[6],x[A+2]=f[5],x[A+3]=f[4],x[A+4]=f[3],x[A+5]=f[2],x[A+6]=f[1],x[A+7]=f[0]}l.writeDoubleLE=h?p:g,l.writeDoubleBE=h?g:p;function m(b,x){return f[0]=b[x],f[1]=b[x+1],f[2]=b[x+2],f[3]=b[x+3],f[4]=b[x+4],f[5]=b[x+5],f[6]=b[x+6],f[7]=b[x+7],u[0]}function y(b,x){return f[7]=b[x],f[6]=b[x+1],f[5]=b[x+2],f[4]=b[x+3],f[3]=b[x+4],f[2]=b[x+5],f[1]=b[x+6],f[0]=b[x+7],u[0]}l.readDoubleLE=h?m:y,l.readDoubleBE=h?y:m}():function(){function u(h,p,g,m,y,b){var x=m<0?1:0;if(x&&(m=-m),m===0)h(0,y,b+p),h(1/m>0?0:2147483648,y,b+g);else if(isNaN(m))h(0,y,b+p),h(2146959360,y,b+g);else if(m>17976931348623157e292)h(0,y,b+p),h((x<<31|2146435072)>>>0,y,b+g);else{var A;if(m<22250738585072014e-324)A=m/5e-324,h(A>>>0,y,b+p),h((x<<31|A/4294967296)>>>0,y,b+g);else{var C=Math.floor(Math.log(m)/Math.LN2);C===1024&&(C=1023),A=m*Math.pow(2,-C),h(A*4503599627370496>>>0,y,b+p),h((x<<31|C+1023<<20|A*1048576&1048575)>>>0,y,b+g)}}}l.writeDoubleLE=u.bind(null,o,0,4),l.writeDoubleBE=u.bind(null,r,4,0);function f(h,p,g,m,y){var b=h(m,y+p),x=h(m,y+g),A=(x>>31)*2+1,C=x>>>20&2047,S=4294967296*(x&1048575)+b;return C===2047?S?NaN:A*(1/0):C===0?A*5e-324*S:A*Math.pow(2,C-1075)*(S+4503599627370496)}l.readDoubleLE=f.bind(null,s,0,4),l.readDoubleBE=f.bind(null,a,4,0)}(),l}function o(l,u,f){u[f]=l&255,u[f+1]=l>>>8&255,u[f+2]=l>>>16&255,u[f+3]=l>>>24}function r(l,u,f){u[f]=l>>>24,u[f+1]=l>>>16&255,u[f+2]=l>>>8&255,u[f+3]=l&255}function s(l,u){return(l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24)>>>0}function a(l,u){return(l[u]<<24|l[u+1]<<16|l[u+2]<<8|l[u+3])>>>0}},{}],5:[function(require,module,exports){"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}},{}],6:[function(e,t,n){"use strict";t.exports=i;function i(o,r,s){var a=s||8192,l=a>>>1,u=null,f=a;return function(p){if(p<1||p>l)return o(p);f+p>a&&(u=o(a),f=0);var g=r.call(u,f,f+=p);return f&7&&(f=(f|7)+1),g}}},{}],7:[function(e,t,n){"use strict";var i=n;i.length=function(r){for(var s=0,a=0,l=0;l<r.length;++l)a=r.charCodeAt(l),a<128?s+=1:a<2048?s+=2:(a&64512)===55296&&(r.charCodeAt(l+1)&64512)===56320?(++l,s+=4):s+=3;return s},i.read=function(r,s,a){var l=a-s;if(l<1)return"";for(var u=null,f=[],h=0,p;s<a;)p=r[s++],p<128?f[h++]=p:p>191&&p<224?f[h++]=(p&31)<<6|r[s++]&63:p>239&&p<365?(p=((p&7)<<18|(r[s++]&63)<<12|(r[s++]&63)<<6|r[s++]&63)-65536,f[h++]=55296+(p>>10),f[h++]=56320+(p&1023)):f[h++]=(p&15)<<12|(r[s++]&63)<<6|r[s++]&63,h>8191&&((u||(u=[])).push(String.fromCharCode.apply(String,f)),h=0);return u?(h&&u.push(String.fromCharCode.apply(String,f.slice(0,h))),u.join("")):String.fromCharCode.apply(String,f.slice(0,h))},i.write=function(r,s,a){for(var l=a,u,f,h=0;h<r.length;++h)u=r.charCodeAt(h),u<128?s[a++]=u:u<2048?(s[a++]=u>>6|192,s[a++]=u&63|128):(u&64512)===55296&&((f=r.charCodeAt(h+1))&64512)===56320?(u=65536+((u&1023)<<10)+(f&1023),++h,s[a++]=u>>18|240,s[a++]=u>>12&63|128,s[a++]=u>>6&63|128,s[a++]=u&63|128):(s[a++]=u>>12|224,s[a++]=u>>6&63|128,s[a++]=u&63|128);return a-l}},{}],8:[function(e,t,n){"use strict";var i=n;i.build="minimal",i.Writer=e(16),i.BufferWriter=e(17),i.Reader=e(9),i.BufferReader=e(10),i.util=e(15),i.rpc=e(12),i.roots=e(11),i.configure=o;function o(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}o()},{10:10,11:11,12:12,15:15,16:16,17:17,9:9}],9:[function(e,t,n){"use strict";t.exports=l;var i=e(15),o,r=i.LongBits,s=i.utf8;function a(m,y){return RangeError("index out of range: "+m.pos+" + "+(y||1)+" > "+m.len)}function l(m){this.buf=m,this.pos=0,this.len=m.length}var u=typeof Uint8Array<"u"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new l(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new l(y);throw Error("illegal buffer")},f=function(){return i.Buffer?function(b){return(l.create=function(A){return i.Buffer.isBuffer(A)?new o(A):u(A)})(b)}:u};l.create=f(),l.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,l.prototype.uint32=function(){var y=4294967295;return function(){if(y=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(y=(y|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return y;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return y}}(),l.prototype.int32=function(){return this.uint32()|0},l.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(y&1)|0};function h(){var m=new r(0,0),y=0;if(this.len-this.pos>4){for(;y<4;++y)if(m.lo=(m.lo|(this.buf[this.pos]&127)<<y*7)>>>0,this.buf[this.pos++]<128)return m;if(m.lo=(m.lo|(this.buf[this.pos]&127)<<28)>>>0,m.hi=(m.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return m;y=0}else{for(;y<3;++y){if(this.pos>=this.len)throw a(this);if(m.lo=(m.lo|(this.buf[this.pos]&127)<<y*7)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(this.buf[this.pos++]&127)<<y*7)>>>0,m}if(this.len-this.pos>4){for(;y<5;++y)if(m.hi=(m.hi|(this.buf[this.pos]&127)<<y*7+3)>>>0,this.buf[this.pos++]<128)return m}else for(;y<5;++y){if(this.pos>=this.len)throw a(this);if(m.hi=(m.hi|(this.buf[this.pos]&127)<<y*7+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}l.prototype.bool=function(){return this.uint32()!==0};function p(m,y){return(m[y-4]|m[y-3]<<8|m[y-2]<<16|m[y-1]<<24)>>>0}l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)|0};function g(){if(this.pos+8>this.len)throw a(this,8);return new r(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var y=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var y=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},l.prototype.bytes=function(){var y=this.uint32(),b=this.pos,x=this.pos+y;if(x>this.len)throw a(this,y);if(this.pos+=y,Array.isArray(this.buf))return this.buf.slice(b,x);if(b===x){var A=i.Buffer;return A?A.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,b,x)},l.prototype.string=function(){var y=this.bytes();return s.read(y,0,y.length)},l.prototype.skip=function(y){if(typeof y=="number"){if(this.pos+y>this.len)throw a(this,y);this.pos+=y}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},l.prototype.skipType=function(m){switch(m){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(m=this.uint32()&7)!==4;)this.skipType(m);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+m+" at offset "+this.pos)}return this},l._configure=function(m){o=m,l.create=f(),o._configure();var y=i.Long?"toLong":"toNumber";i.merge(l.prototype,{int64:function(){return h.call(this)[y](!1)},uint64:function(){return h.call(this)[y](!0)},sint64:function(){return h.call(this).zzDecode()[y](!1)},fixed64:function(){return g.call(this)[y](!0)},sfixed64:function(){return g.call(this)[y](!1)}})}},{15:15}],10:[function(e,t,n){"use strict";t.exports=r;var i=e(9);(r.prototype=Object.create(i.prototype)).constructor=r;var o=e(15);function r(s){i.call(this,s)}r._configure=function(){o.Buffer&&(r.prototype._slice=o.Buffer.prototype.slice)},r.prototype.string=function(){var a=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+a,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+a,this.len))},r._configure()},{15:15,9:9}],11:[function(e,t,n){"use strict";t.exports={}},{}],12:[function(e,t,n){"use strict";var i=n;i.Service=e(13)},{13:13}],13:[function(e,t,n){"use strict";t.exports=o;var i=e(15);(o.prototype=Object.create(i.EventEmitter.prototype)).constructor=o;function o(r,s,a){if(typeof r!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!s,this.responseDelimited=!!a}o.prototype.rpcCall=function r(s,a,l,u,f){if(!u)throw TypeError("request must be specified");var h=this;if(!f)return i.asPromise(r,h,s,a,l,u);if(!h.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),undefined;try{return h.rpcImpl(s,a[h.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(g,m){if(g)return h.emit("error",g,s),f(g);if(m===null)return h.end(!0),undefined;if(!(m instanceof l))try{m=l[h.responseDelimited?"decodeDelimited":"decode"](m)}catch(y){return h.emit("error",y,s),f(y)}return h.emit("data",m,s),f(null,m)})}catch(p){return h.emit("error",p,s),setTimeout(function(){f(p)},0),undefined}},o.prototype.end=function(s){return this.rpcImpl&&(s||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{15:15}],14:[function(e,t,n){"use strict";t.exports=o;var i=e(15);function o(l,u){this.lo=l>>>0,this.hi=u>>>0}var r=o.zero=new o(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var s=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(u){if(u===0)return r;var f=u<0;f&&(u=-u);var h=u>>>0,p=(u-h)/4294967296>>>0;return f&&(p=~p>>>0,h=~h>>>0,++h>4294967295&&(h=0,++p>4294967295&&(p=0))),new o(h,p)},o.from=function(u){if(typeof u=="number")return o.fromNumber(u);if(i.isString(u))if(i.Long)u=i.Long.fromString(u);else return o.fromNumber(parseInt(u,10));return u.low||u.high?new o(u.low>>>0,u.high>>>0):r},o.prototype.toNumber=function(u){if(!u&&this.hi>>>31){var f=~this.lo+1>>>0,h=~this.hi>>>0;return f||(h=h+1>>>0),-(f+h*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(u){return i.Long?new i.Long(this.lo|0,this.hi|0,!!u):{low:this.lo|0,high:this.hi|0,unsigned:!!u}};var a=String.prototype.charCodeAt;o.fromHash=function(u){return u===s?r:new o((a.call(u,0)|a.call(u,1)<<8|a.call(u,2)<<16|a.call(u,3)<<24)>>>0,(a.call(u,4)|a.call(u,5)<<8|a.call(u,6)<<16|a.call(u,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var u=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^u)>>>0,this.lo=(this.lo<<1^u)>>>0,this},o.prototype.zzDecode=function(){var u=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^u)>>>0,this.hi=(this.hi>>>1^u)>>>0,this},o.prototype.length=function(){var u=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,h=this.hi>>>24;return h===0?f===0?u<16384?u<128?1:2:u<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:h<128?9:10}},{15:15}],15:[function(e,t,n){"use strict";var i=n;i.asPromise=e(1),i.base64=e(2),i.EventEmitter=e(3),i.float=e(4),i.inquire=e(5),i.utf8=e(7),i.pool=e(6),i.LongBits=e(14),i.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),i.global=i.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a},i.isString=function(a){return typeof a=="string"||a instanceof String},i.isObject=function(a){return a&&typeof a=="object"},i.isset=i.isSet=function(a,l){var u=a[l];return u!=null&&a.hasOwnProperty(l)?typeof u!="object"||(Array.isArray(u)?u.length:Object.keys(u).length)>0:!1},i.Buffer=function(){try{var s=i.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(a){return typeof a=="number"?i.Buffer?i._Buffer_allocUnsafe(a):new i.Array(a):i.Buffer?i._Buffer_from(a):typeof Uint8Array>"u"?a:new Uint8Array(a)},i.Array=typeof Uint8Array<"u"?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(a){return a?i.LongBits.from(a).toHash():i.LongBits.zeroHash},i.longFromHash=function(a,l){var u=i.LongBits.fromHash(a);return i.Long?i.Long.fromBits(u.lo,u.hi,l):u.toNumber(!!l)};function o(s,a,l){for(var u=Object.keys(a),f=0;f<u.length;++f)(s[u[f]]===undefined||!l)&&(s[u[f]]=a[u[f]]);return s}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function r(s){function a(l,u){if(!(this instanceof a))return new a(l,u);Object.defineProperty(this,"message",{get:function(){return l}}),Error.captureStackTrace?Error.captureStackTrace(this,a):Object.defineProperty(this,"stack",{value:new Error().stack||""}),u&&o(this,u)}return a.prototype=Object.create(Error.prototype,{constructor:{value:a,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:undefined,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),a}i.newError=r,i.ProtocolError=r("ProtocolError"),i.oneOfGetter=function(a){for(var l={},u=0;u<a.length;++u)l[a[u]]=1;return function(){for(var f=Object.keys(this),h=f.length-1;h>-1;--h)if(l[f[h]]===1&&this[f[h]]!==undefined&&this[f[h]]!==null)return f[h]}},i.oneOfSetter=function(a){return function(l){for(var u=0;u<a.length;++u)a[u]!==l&&delete this[a[u]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var s=i.Buffer;if(!s){i._Buffer_from=i._Buffer_allocUnsafe=null;return}i._Buffer_from=s.from!==Uint8Array.from&&s.from||function(l,u){return new s(l,u)},i._Buffer_allocUnsafe=s.allocUnsafe||function(l){return new s(l)}}},{1:1,14:14,2:2,3:3,4:4,5:5,6:6,7:7}],16:[function(e,t,n){"use strict";t.exports=h;var i=e(15),o,r=i.LongBits,s=i.base64,a=i.utf8;function l(C,S,v){this.fn=C,this.len=S,this.next=undefined,this.val=v}function u(){}function f(C){this.head=C.head,this.tail=C.tail,this.len=C.len,this.next=C.states}function h(){this.len=0,this.head=new l(u,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(h.create=function(){return new o})()}:function(){return new h}};h.create=p(),h.alloc=function(S){return new i.Array(S)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(S,v,P){return this.tail=this.tail.next=new l(S,v,P),this.len+=v,this};function g(C,S,v){S[v]=C&255}function m(C,S,v){for(;C>127;)S[v++]=C&127|128,C>>>=7;S[v]=C}function y(C,S){this.len=C,this.next=undefined,this.val=S}y.prototype=Object.create(l.prototype),y.prototype.fn=m,h.prototype.uint32=function(S){return this.len+=(this.tail=this.tail.next=new y((S=S>>>0)<128?1:S<16384?2:S<2097152?3:S<268435456?4:5,S)).len,this},h.prototype.int32=function(S){return S<0?this._push(b,10,r.fromNumber(S)):this.uint32(S)},h.prototype.sint32=function(S){return this.uint32((S<<1^S>>31)>>>0)};function b(C,S,v){for(;C.hi;)S[v++]=C.lo&127|128,C.lo=(C.lo>>>7|C.hi<<25)>>>0,C.hi>>>=7;for(;C.lo>127;)S[v++]=C.lo&127|128,C.lo=C.lo>>>7;S[v++]=C.lo}h.prototype.uint64=function(S){var v=r.from(S);return this._push(b,v.length(),v)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(S){var v=r.from(S).zzEncode();return this._push(b,v.length(),v)},h.prototype.bool=function(S){return this._push(g,1,S?1:0)};function x(C,S,v){S[v]=C&255,S[v+1]=C>>>8&255,S[v+2]=C>>>16&255,S[v+3]=C>>>24}h.prototype.fixed32=function(S){return this._push(x,4,S>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(S){var v=r.from(S);return this._push(x,4,v.lo)._push(x,4,v.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(S){return this._push(i.float.writeFloatLE,4,S)},h.prototype.double=function(S){return this._push(i.float.writeDoubleLE,8,S)};var A=i.Array.prototype.set?function(S,v,P){v.set(S,P)}:function(S,v,P){for(var M=0;M<S.length;++M)v[P+M]=S[M]};h.prototype.bytes=function(S){var v=S.length>>>0;if(!v)return this._push(g,1,0);if(i.isString(S)){var P=h.alloc(v=s.length(S));s.decode(S,P,0),S=P}return this.uint32(v)._push(A,v,S)},h.prototype.string=function(S){var v=a.length(S);return v?this.uint32(v)._push(a.write,v,S):this._push(g,1,0)},h.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new l(u,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(u,0,0),this.len=0),this},h.prototype.ldelim=function(){var S=this.head,v=this.tail,P=this.len;return this.reset().uint32(P),P&&(this.tail.next=S.next,this.tail=v,this.len+=P),this},h.prototype.finish=function(){for(var S=this.head.next,v=this.constructor.alloc(this.len),P=0;S;)S.fn(S.val,v,P),P+=S.len,S=S.next;return v},h._configure=function(C){o=C,h.create=p(),o._configure()}},{15:15}],17:[function(e,t,n){"use strict";t.exports=r;var i=e(16);(r.prototype=Object.create(i.prototype)).constructor=r;var o=e(15);function r(){i.call(this)}r._configure=function(){r.alloc=o._Buffer_allocUnsafe,r.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&o.Buffer.prototype.set.name==="set"?function(l,u,f){u.set(l,f)}:function(l,u,f){if(l.copy)l.copy(u,f,0,l.length);else for(var h=0;h<l.length;)u[f++]=l[h++]}},r.prototype.bytes=function(l){o.isString(l)&&(l=o._Buffer_from(l,"base64"));var u=l.length>>>0;return this.uint32(u),u&&this._push(r.writeBytesBuffer,u,l),this};function s(a,l,u){a.length<40?o.utf8.write(a,l,u):l.utf8Write?l.utf8Write(a,u):l.write(a,u)}r.prototype.string=function(l){var u=o.Buffer.byteLength(l);return this.uint32(u),u&&this._push(s,u,l),this},r._configure()},{15:15,16:16}]},{},[8])})()});var vEe=Xn((N9i,QG)=>{/* Copyright 2015-2018 Esri. 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 @preserve */(function(){var e=function(){var o={};o.defaultNoDataValue=-34027999387901484e22,o.decode=function(f,h){h=h||{};var p=h.encodedMaskData||h.encodedMaskData===null,g=l(f,h.inputOffset||0,p),m=h.noDataValue!==null?h.noDataValue:o.defaultNoDataValue,y=r(g,h.pixelType||Float32Array,h.encodedMaskData,m,h.returnMask),b={width:g.width,height:g.height,pixelData:y.resultPixels,minValue:y.minValue,maxValue:g.pixels.maxValue,noDataValue:m};return y.resultMask&&(b.maskData=y.resultMask),h.returnEncodedMask&&g.mask&&(b.encodedMaskData=g.mask.bitset?g.mask.bitset:null),h.returnFileInfo&&(b.fileInfo=s(g),h.computeUsedBitDepths&&(b.fileInfo.bitDepths=a(g))),b};var r=function(f,h,p,g,m){var y=0,b=f.pixels.numBlocksX,x=f.pixels.numBlocksY,A=Math.floor(f.width/b),C=Math.floor(f.height/x),S=2*f.maxZError,v=Number.MAX_VALUE,P;p=p||(f.mask?f.mask.bitset:null);var M,R;M=new h(f.width*f.height),m&&p&&(R=new Uint8Array(f.width*f.height));for(var L=new Float32Array(A*C),F,_,w=0;w<=x;w++){var D=w!==x?C:f.height%x;if(D!==0)for(var I=0;I<=b;I++){var N=I!==b?A:f.width%b;if(N!==0){var k=w*f.width*C+I*A,z=f.width-N,V=f.pixels.blocks[y],j,U,q;V.encoding<2?(V.encoding===0?j=V.rawData:(u(V.stuffedData,V.bitsPerPixel,V.numValidPixels,V.offset,S,L,f.pixels.maxValue),j=L),U=0):V.encoding===2?q=0:q=V.offset;var Y;if(p)for(_=0;_<D;_++){for(k&7&&(Y=p[k>>3],Y<<=k&7),F=0;F<N;F++)k&7||(Y=p[k>>3]),Y&128?(R&&(R[k]=1),P=V.encoding<2?j[U++]:q,v=v>P?P:v,M[k++]=P):(R&&(R[k]=0),M[k++]=g),Y<<=1;k+=z}else if(V.encoding<2)for(_=0;_<D;_++){for(F=0;F<N;F++)P=j[U++],v=v>P?P:v,M[k++]=P;k+=z}else for(v=v>q?q:v,_=0;_<D;_++){for(F=0;F<N;F++)M[k++]=q;k+=z}if(V.encoding===1&&U!==V.numValidPixels)throw"Block and Mask do not match";y++}}}return{resultPixels:M,resultMask:R,minValue:v}},s=function(f){return{fileIdentifierString:f.fileIdentifierString,fileVersion:f.fileVersion,imageType:f.imageType,height:f.height,width:f.width,maxZError:f.maxZError,eofOffset:f.eofOffset,mask:f.mask?{numBlocksX:f.mask.numBlocksX,numBlocksY:f.mask.numBlocksY,numBytes:f.mask.numBytes,maxValue:f.mask.maxValue}:null,pixels:{numBlocksX:f.pixels.numBlocksX,numBlocksY:f.pixels.numBlocksY,numBytes:f.pixels.numBytes,maxValue:f.pixels.maxValue,noDataValue:f.noDataValue}}},a=function(f){for(var h=f.pixels.numBlocksX*f.pixels.numBlocksY,p={},g=0;g<h;g++){var m=f.pixels.blocks[g];m.encoding===0?p.float32=!0:m.encoding===1?p[m.bitsPerPixel]=!0:p[0]=!0}return Object.keys(p)},l=function(f,h,p){var g={},m=new Uint8Array(f,h,10);if(g.fileIdentifierString=String.fromCharCode.apply(null,m),g.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+g.fileIdentifierString;h+=10;var y=new DataView(f,h,24);if(g.fileVersion=y.getInt32(0,!0),g.imageType=y.getInt32(4,!0),g.height=y.getUint32(8,!0),g.width=y.getUint32(12,!0),g.maxZError=y.getFloat64(16,!0),h+=24,!p)if(y=new DataView(f,h,16),g.mask={},g.mask.numBlocksY=y.getUint32(0,!0),g.mask.numBlocksX=y.getUint32(4,!0),g.mask.numBytes=y.getUint32(8,!0),g.mask.maxValue=y.getFloat32(12,!0),h+=16,g.mask.numBytes>0){var b=new Uint8Array(Math.ceil(g.width*g.height/8));y=new DataView(f,h,g.mask.numBytes);var x=y.getInt16(0,!0),A=2,C=0;do{if(x>0)for(;x--;)b[C++]=y.getUint8(A++);else{var S=y.getUint8(A++);for(x=-x;x--;)b[C++]=S}x=y.getInt16(A,!0),A+=2}while(A<g.mask.numBytes);if(x!==-32768||C<b.length)throw"Unexpected end of mask RLE encoding";g.mask.bitset=b,h+=g.mask.numBytes}else g.mask.numBytes|g.mask.numBlocksY|g.mask.maxValue||(g.mask.bitset=new Uint8Array(Math.ceil(g.width*g.height/8)));y=new DataView(f,h,16),g.pixels={},g.pixels.numBlocksY=y.getUint32(0,!0),g.pixels.numBlocksX=y.getUint32(4,!0),g.pixels.numBytes=y.getUint32(8,!0),g.pixels.maxValue=y.getFloat32(12,!0),h+=16;var v=g.pixels.numBlocksX,P=g.pixels.numBlocksY,M=v+(g.width%v>0?1:0),R=P+(g.height%P>0?1:0);g.pixels.blocks=new Array(M*R);for(var L=0,F=0;F<R;F++)for(var _=0;_<M;_++){var w=0,D=f.byteLength-h;y=new DataView(f,h,Math.min(10,D));var I={};g.pixels.blocks[L++]=I;var N=y.getUint8(0);if(w++,I.encoding=N&63,I.encoding>3)throw"Invalid block encoding ("+I.encoding+")";if(I.encoding===2){h++;continue}if(N!==0&&N!==2){if(N>>=6,I.offsetType=N,N===2)I.offset=y.getInt8(1),w++;else if(N===1)I.offset=y.getInt16(1,!0),w+=2;else if(N===0)I.offset=y.getFloat32(1,!0),w+=4;else throw"Invalid block offset type";if(I.encoding===1)if(N=y.getUint8(w),w++,I.bitsPerPixel=N&63,N>>=6,I.numValidPixelsType=N,N===2)I.numValidPixels=y.getUint8(w),w++;else if(N===1)I.numValidPixels=y.getUint16(w,!0),w+=2;else if(N===0)I.numValidPixels=y.getUint32(w,!0),w+=4;else throw"Invalid valid pixel count type"}if(h+=w,I.encoding!==3){var k,z;if(I.encoding===0){var V=(g.pixels.numBytes-1)/4;if(V!==Math.floor(V))throw"uncompressed block has invalid length";k=new ArrayBuffer(V*4),z=new Uint8Array(k),z.set(new Uint8Array(f,h,V*4));var j=new Float32Array(k);I.rawData=j,h+=V*4}else if(I.encoding===1){var U=Math.ceil(I.numValidPixels*I.bitsPerPixel/8),q=Math.ceil(U/4);k=new ArrayBuffer(q*4),z=new Uint8Array(k),z.set(new Uint8Array(f,h,U)),I.stuffedData=new Uint32Array(k),h+=U}}}return g.eofOffset=h,g},u=function(f,h,p,g,m,y,b){var x=(1<<h)-1,A=0,C,S=0,v,P,M=Math.ceil((b-g)/m),R=f.length*4-Math.ceil(h*p/8);for(f[f.length-1]<<=8*R,C=0;C<p;C++){if(S===0&&(P=f[A++],S=32),S>=h)v=P>>>S-h&x,S-=h;else{var L=h-S;v=(P&x)<<L&x,P=f[A++],S=32-L,v+=P>>>S}y[C]=v<M?g+v*m:b}return y};return o}(),t=function(){"use strict";var o={unstuff:function(l,u,f,h,p,g,m,y){var b=(1<<f)-1,x=0,A,C=0,S,v,P,M,R=l.length*4-Math.ceil(f*h/8);if(l[l.length-1]<<=8*R,p)for(A=0;A<h;A++)C===0&&(v=l[x++],C=32),C>=f?(S=v>>>C-f&b,C-=f):(P=f-C,S=(v&b)<<P&b,v=l[x++],C=32-P,S+=v>>>C),u[A]=p[S];else for(M=Math.ceil((y-g)/m),A=0;A<h;A++)C===0&&(v=l[x++],C=32),C>=f?(S=v>>>C-f&b,C-=f):(P=f-C,S=(v&b)<<P&b,v=l[x++],C=32-P,S+=v>>>C),u[A]=S<M?g+S*m:y},unstuffLUT:function(l,u,f,h,p,g){var m=(1<<u)-1,y=0,b=0,x=0,A=0,C=0,S,v=[],P=l.length*4-Math.ceil(u*f/8);l[l.length-1]<<=8*P;var M=Math.ceil((g-h)/p);for(b=0;b<f;b++)A===0&&(S=l[y++],A=32),A>=u?(C=S>>>A-u&m,A-=u):(x=u-A,C=(S&m)<<x&m,S=l[y++],A=32-x,C+=S>>>A),v[b]=C<M?h+C*p:g;return v.unshift(h),v},unstuff2:function(l,u,f,h,p,g,m,y){var b=(1<<f)-1,x=0,A,C=0,S=0,v,P,M;if(p)for(A=0;A<h;A++)C===0&&(P=l[x++],C=32,S=0),C>=f?(v=P>>>S&b,C-=f,S+=f):(M=f-C,v=P>>>S&b,P=l[x++],C=32-M,v|=(P&(1<<M)-1)<<f-M,S=M),u[A]=p[v];else{var R=Math.ceil((y-g)/m);for(A=0;A<h;A++)C===0&&(P=l[x++],C=32,S=0),C>=f?(v=P>>>S&b,C-=f,S+=f):(M=f-C,v=P>>>S&b,P=l[x++],C=32-M,v|=(P&(1<<M)-1)<<f-M,S=M),u[A]=v<R?g+v*m:y}return u},unstuffLUT2:function(l,u,f,h,p,g){var m=(1<<u)-1,y=0,b=0,x=0,A=0,C=0,S=0,v,P=[],M=Math.ceil((g-h)/p);for(b=0;b<f;b++)A===0&&(v=l[y++],A=32,S=0),A>=u?(C=v>>>S&m,A-=u,S+=u):(x=u-A,C=v>>>S&m,v=l[y++],A=32-x,C|=(v&(1<<x)-1)<<u-x,S=x),P[b]=C<M?h+C*p:g;return P.unshift(h),P},originalUnstuff:function(l,u,f,h){var p=(1<<f)-1,g=0,m,y=0,b,x,A,C=l.length*4-Math.ceil(f*h/8);for(l[l.length-1]<<=8*C,m=0;m<h;m++)y===0&&(x=l[g++],y=32),y>=f?(b=x>>>y-f&p,y-=f):(A=f-y,b=(x&p)<<A&p,x=l[g++],y=32-A,b+=x>>>y),u[m]=b;return u},originalUnstuff2:function(l,u,f,h){var p=(1<<f)-1,g=0,m,y=0,b=0,x,A,C;for(m=0;m<h;m++)y===0&&(A=l[g++],y=32,b=0),y>=f?(x=A>>>b&p,y-=f,b+=f):(C=f-y,x=A>>>b&p,A=l[g++],y=32-C,x|=(A&(1<<C)-1)<<f-C,b=C),u[m]=x;return u}},r={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(l){for(var u=65535,f=65535,h=l.length,p=Math.floor(h/2),g=0;p;){var m=p>=359?359:p;p-=m;do u+=l[g++]<<8,f+=u+=l[g++];while(--m);u=(u&65535)+(u>>>16),f=(f&65535)+(f>>>16)}return h&1&&(f+=u+=l[g]<<8),u=(u&65535)+(u>>>16),f=(f&65535)+(f>>>16),(f<<16|u)>>>0},readHeaderInfo:function(l,u){var f=u.ptr,h=new Uint8Array(l,f,6),p={};if(p.fileIdentifierString=String.fromCharCode.apply(null,h),p.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+p.fileIdentifierString;f+=6;var g=new DataView(l,f,8),m=g.getInt32(0,!0);p.fileVersion=m,f+=4,m>=3&&(p.checksum=g.getUint32(4,!0),f+=4),g=new DataView(l,f,12),p.height=g.getUint32(0,!0),p.width=g.getUint32(4,!0),f+=8,m>=4?(p.numDims=g.getUint32(8,!0),f+=4):p.numDims=1,g=new DataView(l,f,40),p.numValidPixel=g.getUint32(0,!0),p.microBlockSize=g.getInt32(4,!0),p.blobSize=g.getInt32(8,!0),p.imageType=g.getInt32(12,!0),p.maxZError=g.getFloat64(16,!0),p.zMin=g.getFloat64(24,!0),p.zMax=g.getFloat64(32,!0),f+=40,u.headerInfo=p,u.ptr=f;var y,b;if(m>=3&&(b=m>=4?52:48,y=this.computeChecksumFletcher32(new Uint8Array(l,f-b,p.blobSize-14)),y!==p.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(l,u){var f=u.headerInfo,h=this.getDataTypeArray(f.imageType),p=f.numDims*this.getDataTypeSize(f.imageType),g=this.readSubArray(l,u.ptr,h,p),m=this.readSubArray(l,u.ptr+p,h,p);u.ptr+=2*p;var y,b=!0;for(y=0;y<f.numDims;y++)if(g[y]!==m[y]){b=!1;break}return f.minValues=g,f.maxValues=m,b},readSubArray:function(l,u,f,h){var p;if(f===Uint8Array)p=new Uint8Array(l,u,h);else{var g=new ArrayBuffer(h),m=new Uint8Array(g);m.set(new Uint8Array(l,u,h)),p=new f(g)}return p},readMask:function(l,u){var f=u.ptr,h=u.headerInfo,p=h.width*h.height,g=h.numValidPixel,m=new DataView(l,f,4),y={};if(y.numBytes=m.getUint32(0,!0),f+=4,(g===0||p===g)&&y.numBytes!==0)throw"invalid mask";var b,x;if(g===0)b=new Uint8Array(Math.ceil(p/8)),y.bitset=b,x=new Uint8Array(p),u.pixels.resultMask=x,f+=y.numBytes;else if(y.numBytes>0){b=new Uint8Array(Math.ceil(p/8)),m=new DataView(l,f,y.numBytes);var A=m.getInt16(0,!0),C=2,S=0,v=0;do{if(A>0)for(;A--;)b[S++]=m.getUint8(C++);else for(v=m.getUint8(C++),A=-A;A--;)b[S++]=v;A=m.getInt16(C,!0),C+=2}while(C<y.numBytes);if(A!==-32768||S<b.length)throw"Unexpected end of mask RLE encoding";x=new Uint8Array(p);var P=0,M=0;for(M=0;M<p;M++)M&7?(P=b[M>>3],P<<=M&7):P=b[M>>3],P&128&&(x[M]=1);u.pixels.resultMask=x,y.bitset=b,f+=y.numBytes}return u.ptr=f,u.mask=y,!0},readDataOneSweep:function(l,u,f){var h=u.ptr,p=u.headerInfo,g=p.numDims,m=p.width*p.height,y=p.imageType,b=p.numValidPixel*r.getDataTypeSize(y)*g,x,A=u.pixels.resultMask;if(f===Uint8Array)x=new Uint8Array(l,h,b);else{var C=new ArrayBuffer(b),S=new Uint8Array(C);S.set(new Uint8Array(l,h,b)),x=new f(C)}if(x.length===m*g)u.pixels.resultPixels=x;else{u.pixels.resultPixels=new f(m*g);var v=0,P=0,M=0,R=0;if(g>1)for(M=0;M<g;M++)for(R=M*m,P=0;P<m;P++)A[P]&&(u.pixels.resultPixels[R+P]=x[v++]);else for(P=0;P<m;P++)A[P]&&(u.pixels.resultPixels[P]=x[v++])}return h+=b,u.ptr=h,!0},readHuffmanTree:function(l,u){var f=this.HUFFMAN_LUT_BITS_MAX,h=new DataView(l,u.ptr,16);u.ptr+=16;var p=h.getInt32(0,!0);if(p<2)throw"unsupported Huffman version";var g=h.getInt32(4,!0),m=h.getInt32(8,!0),y=h.getInt32(12,!0);if(m>=y)return!1;var b=new Uint32Array(y-m);r.decodeBits(l,u,b);var x=[],A,C,S,v;for(A=m;A<y;A++)C=A-(A<g?0:g),x[C]={first:b[A-m],second:null};var P=l.byteLength-u.ptr,M=Math.ceil(P/4),R=new ArrayBuffer(M*4),L=new Uint8Array(R);L.set(new Uint8Array(l,u.ptr,P));var F=new Uint32Array(R),_=0,w,D=0;for(w=F[0],A=m;A<y;A++)C=A-(A<g?0:g),v=x[C].first,v>0&&(x[C].second=w<<_>>>32-v,32-_>=v?(_+=v,_===32&&(_=0,D++,w=F[D])):(_+=v-32,D++,w=F[D],x[C].second|=w>>>32-_));var I=0,N=0,k=new s;for(A=0;A<x.length;A++)x[A]!==void 0&&(I=Math.max(I,x[A].first));I>=f?N=f:N=I,I>=30&&console.log("WARning, large NUM LUT BITS IS "+I);var z=[],V,j,U,q,Y,te;for(A=m;A<y;A++)if(C=A-(A<g?0:g),v=x[C].first,v>0)if(V=[v,C],v<=N)for(j=x[C].second<<N-v,U=1<<N-v,S=0;S<U;S++)z[j|S]=V;else for(j=x[C].second,te=k,q=v-1;q>=0;q--)Y=j>>>q&1,Y?(te.right||(te.right=new s),te=te.right):(te.left||(te.left=new s),te=te.left),q===0&&!te.val&&(te.val=V[1]);return{decodeLut:z,numBitsLUTQick:N,numBitsLUT:I,tree:k,stuffedData:F,srcPtr:D,bitPos:_}},readHuffman:function(l,u,f){var h=u.headerInfo,p=h.numDims,g=u.headerInfo.height,m=u.headerInfo.width,y=m*g,b=this.readHuffmanTree(l,u),x=b.decodeLut,A=b.tree,C=b.stuffedData,S=b.srcPtr,v=b.bitPos,P=b.numBitsLUTQick,M=b.numBitsLUT,R=u.headerInfo.imageType===0?128:0,L,F,_,w=u.pixels.resultMask,D,I,N,k,z,V,j,U=0;v>0&&(S++,v=0);var q=C[S],Y=u.encodeMode===1,te=new f(y*p),K=te,Z;for(Z=0;Z<h.numDims;Z++){if(p>1&&(K=new f(te.buffer,y*Z,y),U=0),u.headerInfo.numValidPixel===m*g)for(V=0,k=0;k<g;k++)for(z=0;z<m;z++,V++){if(F=0,D=q<<v>>>32-P,I=D,32-v<P&&(D|=C[S+1]>>>64-v-P,I=D),x[I])F=x[I][1],v+=x[I][0];else for(D=q<<v>>>32-M,I=D,32-v<M&&(D|=C[S+1]>>>64-v-M,I=D),L=A,j=0;j<M;j++)if(N=D>>>M-j-1&1,L=N?L.right:L.left,!(L.left||L.right)){F=L.val,v=v+j+1;break}v>=32&&(v-=32,S++,q=C[S]),_=F-R,Y?(z>0?_+=U:k>0?_+=K[V-m]:_+=U,_&=255,K[V]=_,U=_):K[V]=_}else for(V=0,k=0;k<g;k++)for(z=0;z<m;z++,V++)if(w[V]){if(F=0,D=q<<v>>>32-P,I=D,32-v<P&&(D|=C[S+1]>>>64-v-P,I=D),x[I])F=x[I][1],v+=x[I][0];else for(D=q<<v>>>32-M,I=D,32-v<M&&(D|=C[S+1]>>>64-v-M,I=D),L=A,j=0;j<M;j++)if(N=D>>>M-j-1&1,L=N?L.right:L.left,!(L.left||L.right)){F=L.val,v=v+j+1;break}v>=32&&(v-=32,S++,q=C[S]),_=F-R,Y?(z>0&&w[V-1]?_+=U:k>0&&w[V-m]?_+=K[V-m]:_+=U,_&=255,K[V]=_,U=_):K[V]=_}u.ptr=u.ptr+(S+1)*4+(v>0?4:0)}u.pixels.resultPixels=te},decodeBits:function(l,u,f,h,p){{var g=u.headerInfo,m=g.fileVersion,y=0,b=new DataView(l,u.ptr,5),x=b.getUint8(0);y++;var A=x>>6,C=A===0?4:3-A,S=(x&32)>0,v=x&31,P=0;if(C===1)P=b.getUint8(y),y++;else if(C===2)P=b.getUint16(y,!0),y+=2;else if(C===4)P=b.getUint32(y,!0),y+=4;else throw"Invalid valid pixel count type";var M=2*g.maxZError,R,L,F,_,w,D,I,N,k,z,V=g.numDims>1?g.maxValues[p]:g.zMax;if(S){for(u.counter.lut++,N=b.getUint8(y),k=v,y++,_=Math.ceil((N-1)*v/8),w=Math.ceil(_/4),L=new ArrayBuffer(w*4),F=new Uint8Array(L),u.ptr+=y,F.set(new Uint8Array(l,u.ptr,_)),I=new Uint32Array(L),u.ptr+=_,z=0;N-1>>>z;)z++;_=Math.ceil(P*z/8),w=Math.ceil(_/4),L=new ArrayBuffer(w*4),F=new Uint8Array(L),F.set(new Uint8Array(l,u.ptr,_)),R=new Uint32Array(L),u.ptr+=_,m>=3?D=o.unstuffLUT2(I,v,N-1,h,M,V):D=o.unstuffLUT(I,v,N-1,h,M,V),m>=3?o.unstuff2(R,f,z,P,D):o.unstuff(R,f,z,P,D)}else u.counter.bitstuffer++,z=v,u.ptr+=y,z>0&&(_=Math.ceil(P*z/8),w=Math.ceil(_/4),L=new ArrayBuffer(w*4),F=new Uint8Array(L),F.set(new Uint8Array(l,u.ptr,_)),R=new Uint32Array(L),u.ptr+=_,m>=3?h==null?o.originalUnstuff2(R,f,z,P):o.unstuff2(R,f,z,P,!1,h,M,V):h==null?o.originalUnstuff(R,f,z,P):o.unstuff(R,f,z,P,!1,h,M,V))}},readTiles:function(l,u,f){var h=u.headerInfo,p=h.width,g=h.height,m=h.microBlockSize,y=h.imageType,b=r.getDataTypeSize(y),x=Math.ceil(p/m),A=Math.ceil(g/m);u.pixels.numBlocksY=A,u.pixels.numBlocksX=x,u.pixels.ptr=0;var C=0,S=0,v=0,P=0,M=0,R=0,L=0,F=0,_=0,w=0,D=0,I=0,N=0,k=0,z=0,V=0,j,U,q,Y,te,K,Z=new f(m*m),ee=g%m||m,me=p%m||m,Te,ue,ye=h.numDims,Ae,Pe=u.pixels.resultMask,Ee=u.pixels.resultPixels;for(v=0;v<A;v++)for(M=v!==A-1?m:ee,P=0;P<x;P++)for(R=P!==x-1?m:me,D=v*p*m+P*m,I=p-R,Ae=0;Ae<ye;Ae++){if(ye>1&&(Ee=new f(u.pixels.resultPixels.buffer,p*g*Ae*b,p*g)),L=l.byteLength-u.ptr,j=new DataView(l,u.ptr,Math.min(10,L)),U={},V=0,F=j.getUint8(0),V++,_=F>>6&255,w=F>>2&15,w!==(P*m>>3&15))throw"integrity issue";if(K=F&3,K>3)throw u.ptr+=V,"Invalid block encoding ("+K+")";if(K===2){u.counter.constant++,u.ptr+=V;continue}else if(K===0){if(u.counter.uncompressed++,u.ptr+=V,N=M*R*b,k=l.byteLength-u.ptr,N=N<k?N:k,q=new ArrayBuffer(N%b===0?N:N+b-N%b),Y=new Uint8Array(q),Y.set(new Uint8Array(l,u.ptr,N)),te=new f(q),z=0,Pe)for(C=0;C<M;C++){for(S=0;S<R;S++)Pe[D]&&(Ee[D]=te[z++]),D++;D+=I}else for(C=0;C<M;C++){for(S=0;S<R;S++)Ee[D++]=te[z++];D+=I}u.ptr+=z*b}else if(Te=r.getDataTypeUsed(y,_),ue=r.getOnePixel(U,V,Te,j),V+=r.getDataTypeSize(Te),K===3)if(u.ptr+=V,u.counter.constantoffset++,Pe)for(C=0;C<M;C++){for(S=0;S<R;S++)Pe[D]&&(Ee[D]=ue),D++;D+=I}else for(C=0;C<M;C++){for(S=0;S<R;S++)Ee[D++]=ue;D+=I}else if(u.ptr+=V,r.decodeBits(l,u,Z,ue,Ae),V=0,Pe)for(C=0;C<M;C++){for(S=0;S<R;S++)Pe[D]&&(Ee[D]=Z[V++]),D++;D+=I}else for(C=0;C<M;C++){for(S=0;S<R;S++)Ee[D++]=Z[V++];D+=I}}},formatFileInfo:function(l){return{fileIdentifierString:l.headerInfo.fileIdentifierString,fileVersion:l.headerInfo.fileVersion,imageType:l.headerInfo.imageType,height:l.headerInfo.height,width:l.headerInfo.width,numValidPixel:l.headerInfo.numValidPixel,microBlockSize:l.headerInfo.microBlockSize,blobSize:l.headerInfo.blobSize,maxZError:l.headerInfo.maxZError,pixelType:r.getPixelType(l.headerInfo.imageType),eofOffset:l.eofOffset,mask:l.mask?{numBytes:l.mask.numBytes}:null,pixels:{numBlocksX:l.pixels.numBlocksX,numBlocksY:l.pixels.numBlocksY,maxValue:l.headerInfo.zMax,minValue:l.headerInfo.zMin,noDataValue:l.noDataValue}}},constructConstantSurface:function(l){var u=l.headerInfo.zMax,f=l.headerInfo.numDims,h=l.headerInfo.height*l.headerInfo.width,p=h*f,g=0,m=0,y=0,b=l.pixels.resultMask;if(b)if(f>1)for(g=0;g<f;g++)for(y=g*h,m=0;m<h;m++)b[m]&&(l.pixels.resultPixels[y+m]=u);else for(m=0;m<h;m++)b[m]&&(l.pixels.resultPixels[m]=u);else if(l.pixels.resultPixels.fill)l.pixels.resultPixels.fill(u);else for(m=0;m<p;m++)l.pixels.resultPixels[m]=u},getDataTypeArray:function(l){var u;switch(l){case 0:u=Int8Array;break;case 1:u=Uint8Array;break;case 2:u=Int16Array;break;case 3:u=Uint16Array;break;case 4:u=Int32Array;break;case 5:u=Uint32Array;break;case 6:u=Float32Array;break;case 7:u=Float64Array;break;default:u=Float32Array}return u},getPixelType:function(l){var u;switch(l){case 0:u="S8";break;case 1:u="U8";break;case 2:u="S16";break;case 3:u="U16";break;case 4:u="S32";break;case 5:u="U32";break;case 6:u="F32";break;case 7:u="F64";break;default:u="F32"}return u},isValidPixelValue:function(l,u){if(u==null)return!1;var f;switch(l){case 0:f=u>=-128&&u<=127;break;case 1:f=u>=0&&u<=255;break;case 2:f=u>=-32768&&u<=32767;break;case 3:f=u>=0&&u<=65536;break;case 4:f=u>=-2147483648&&u<=2147483647;break;case 5:f=u>=0&&u<=4294967296;break;case 6:f=u>=-34027999387901484e22&&u<=34027999387901484e22;break;case 7:f=u>=5e-324&&u<=17976931348623157e292;break;default:f=!1}return f},getDataTypeSize:function(l){var u=0;switch(l){case 0:case 1:u=1;break;case 2:case 3:u=2;break;case 4:case 5:case 6:u=4;break;case 7:u=8;break;default:u=l}return u},getDataTypeUsed:function(l,u){var f=l;switch(l){case 2:case 4:f=l-u;break;case 3:case 5:f=l-2*u;break;case 6:u===0?f=l:u===1?f=2:f=1;break;case 7:u===0?f=l:f=l-2*u+1;break;default:f=l;break}return f},getOnePixel:function(l,u,f,h){var p=0;switch(f){case 0:p=h.getInt8(u);break;case 1:p=h.getUint8(u);break;case 2:p=h.getInt16(u,!0);break;case 3:p=h.getUint16(u,!0);break;case 4:p=h.getInt32(u,!0);break;case 5:p=h.getUInt32(u,!0);break;case 6:p=h.getFloat32(u,!0);break;case 7:p=h.getFloat64(u,!0);break;default:throw"the decoder does not understand this pixel type"}return p}},s=function(l,u,f){this.val=l,this.left=u,this.right=f},a={decode:function(l,u){u=u||{};var f=u.noDataValue,h=0,p={};if(p.ptr=u.inputOffset||0,p.pixels={},!!r.readHeaderInfo(l,p)){var g=p.headerInfo,m=g.fileVersion,y=r.getDataTypeArray(g.imageType);r.readMask(l,p),g.numValidPixel!==g.width*g.height&&!p.pixels.resultMask&&(p.pixels.resultMask=u.maskData);var b=g.width*g.height;if(p.pixels.resultPixels=new y(b*g.numDims),p.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},g.numValidPixel!==0)if(g.zMax===g.zMin)r.constructConstantSurface(p);else if(m>=4&&r.checkMinMaxRanges(l,p))r.constructConstantSurface(p);else{var x=new DataView(l,p.ptr,2),A=x.getUint8(0);if(p.ptr++,A)r.readDataOneSweep(l,p,y);else if(m>1&&g.imageType<=1&&Math.abs(g.maxZError-.5)<1e-5){var C=x.getUint8(1);if(p.ptr++,p.encodeMode=C,C>2||m<4&&C>1)throw"Invalid Huffman flag "+C;C?r.readHuffman(l,p,y):r.readTiles(l,p,y)}else r.readTiles(l,p,y)}p.eofOffset=p.ptr;var S;u.inputOffset?(S=p.headerInfo.blobSize+u.inputOffset-p.ptr,Math.abs(S)>=1&&(p.eofOffset=u.inputOffset+p.headerInfo.blobSize)):(S=p.headerInfo.blobSize-p.ptr,Math.abs(S)>=1&&(p.eofOffset=p.headerInfo.blobSize));var v={width:g.width,height:g.height,pixelData:p.pixels.resultPixels,minValue:g.zMin,maxValue:g.zMax,validPixelCount:g.numValidPixel,dimCount:g.numDims,dimStats:{minValues:g.minValues,maxValues:g.maxValues},maskData:p.pixels.resultMask};if(p.pixels.resultMask&&r.isValidPixelValue(g.imageType,f)){var P=p.pixels.resultMask;for(h=0;h<b;h++)P[h]||(v.pixelData[h]=f);v.noDataValue=f}return p.noDataValue=f,u.returnFileInfo&&(v.fileInfo=r.formatFileInfo(p)),v}},getBandCount:function(l){var u=0,f=0,h={};for(h.ptr=0,h.pixels={};f<l.byteLength-58;)r.readHeaderInfo(l,h),f+=h.headerInfo.blobSize,u++,h.ptr=f;return u}};return a}(),n=function(){var o=new ArrayBuffer(4),r=new Uint8Array(o),s=new Uint32Array(o);return s[0]=1,r[0]===1}(),i={decode:function(o,r){if(!n)throw"Big endian system is not supported.";r=r||{};var s=r.inputOffset||0,a=new Uint8Array(o,s,10),l=String.fromCharCode.apply(null,a),u,f;if(l.trim()==="CntZImage")u=e,f=1;else if(l.substring(0,5)==="Lerc2")u=t,f=2;else throw"Unexpected file identifier string: "+l;for(var h=0,p=o.byteLength-10,g,m=[],y,b,x={width:0,height:0,pixels:[],pixelType:r.pixelType,mask:null,statistics:[]};s<p;){var A=u.decode(o,{inputOffset:s,encodedMaskData:g,maskData:b,returnMask:h===0,returnEncodedMask:h===0,returnFileInfo:!0,pixelType:r.pixelType||null,noDataValue:r.noDataValue||null});s=A.fileInfo.eofOffset,h===0&&(g=A.encodedMaskData,b=A.maskData,x.width=A.width,x.height=A.height,x.dimCount=A.dimCount||1,x.pixelType=A.pixelType||A.fileInfo.pixelType,x.mask=A.maskData),f>1&&A.fileInfo.mask&&A.fileInfo.mask.numBytes>0&&m.push(A.maskData),h++,x.pixels.push(A.pixelData),x.statistics.push({minValue:A.minValue,maxValue:A.maxValue,noDataValue:A.noDataValue,dimStats:A.dimStats})}var C,S,v;if(f>1&&m.length>1){for(v=x.width*x.height,x.bandMasks=m,b=new Uint8Array(v),b.set(m[0]),C=1;C<m.length;C++)for(y=m[C],S=0;S<v;S++)b[S]=b[S]&y[S];x.maskData=b}return x}};typeof define=="function"&&define.amd?define([],function(){return i}):typeof QG<"u"&&QG.exports?QG.exports=i:this.Lerc=i})()});var dSe=Xn((yU,JQ)=>{/*! NoSleep.min.js v0.12.0 - git.io/vfn01 - Rich Tibbett - MIT license */(function(e,t){typeof yU=="object"&&typeof JQ=="object"?JQ.exports=t():typeof define=="function"&&define.amd?define([],t):typeof yU=="object"?yU.NoSleep=t():e.NoSleep=t()})(yU,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(i,o,r){n.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:r})},n.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},n.t=function(i,o){if(1&o&&(i=n(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var s in i)n.d(r,s,function(a){return i[a]}.bind(null,s));return r},n.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(o,"a",o),o},n.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var i=function(){function f(h,p){for(var g=0;g<p.length;g++){var m=p[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(h,m.key,m)}}return function(h,p,g){return p&&f(h.prototype,p),g&&f(h,g),h}}(),o=n(1),r=o.webm,s=o.mp4,a=function(){return typeof navigator<"u"&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream},l=function(){return"wakeLock"in navigator},u=function(){function f(){var h=this;if(function(g,m){if(!(g instanceof m))throw new TypeError("Cannot call a class as a function")}(this,f),this.enabled=!1,l()){this._wakeLock=null;var p=function(){h._wakeLock!==null&&document.visibilityState==="visible"&&h.enable()};document.addEventListener("visibilitychange",p),document.addEventListener("fullscreenchange",p)}else a()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",r),this._addSourceToVideo(this.noSleepVideo,"mp4",s),this.noSleepVideo.addEventListener("loadedmetadata",function(){h.noSleepVideo.duration<=1?h.noSleepVideo.setAttribute("loop",""):h.noSleepVideo.addEventListener("timeupdate",function(){h.noSleepVideo.currentTime>.5&&(h.noSleepVideo.currentTime=Math.random())})}))}return i(f,[{key:"_addSourceToVideo",value:function(h,p,g){var m=document.createElement("source");m.src=g,m.type="video/"+p,h.appendChild(m)}},{key:"enable",value:function(){var h=this;return l()?navigator.wakeLock.request("screen").then(function(p){h._wakeLock=p,h.enabled=!0,console.log("Wake Lock active."),h._wakeLock.addEventListener("release",function(){console.log("Wake Lock released.")})}).catch(function(p){throw h.enabled=!1,console.error(p.name+", "+p.message),p}):a()?(this.disable(),console.warn(`
        NoSleep enabled for older iOS devices. This can interrupt
        active or long-running network requests from completing successfully.
        See https://github.com/richtr/NoSleep.js/issues/15 for more details.
      `),this.noSleepTimer=window.setInterval(function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(function(p){return h.enabled=!0,p}).catch(function(p){throw h.enabled=!1,p})}},{key:"disable",value:function(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):a()?this.noSleepTimer&&(console.warn(`
          NoSleep now disabled for older iOS devices.
        `),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}},{key:"isEnabled",get:function(){return this.enabled}}]),f}();e.exports=u},function(e,t,n){"use strict";e.exports={webm:"data:video/webm;base64, ",mp4:"data:video/mp4;base64, "}}])})});var aDt={};uJ(aDt,{AlphaMode:()=>Em,AlphaPipelineStage:()=>YR,AnchorPointDirect:()=>Z1,AnchorPointIndirect:()=>Q1,Animation:()=>Lk,AnimationViewModel:()=>Nk,Appearance:()=>io,ApproximateTerrainHeights:()=>ui,ArcGISTiledElevationTerrainProvider:()=>Y$,ArcGisBaseMapType:()=>Vh,ArcGisMapServerImageryProvider:()=>dg,ArcGisMapService:()=>Zu,ArcType:()=>qt,ArticulationStageType:()=>xc,AssociativeArray:()=>Et,Atmosphere:()=>Ex,AtmospherePipelineStage:()=>vR,AttributeCompression:()=>Ln,AttributeType:()=>nn,AutoExposure:()=>WB,AutomaticUniforms:()=>Ap,Axis:()=>Fo,AxisAlignedBoundingBox:()=>Qg,B3dmLoader:()=>fR,B3dmParser:()=>cR,BaseLayerPicker:()=>Bk,BaseLayerPickerViewModel:()=>Fk,BatchTable:()=>Rb,BatchTableHierarchy:()=>nx,BatchTexture:()=>el,BatchTexturePipelineStage:()=>XR,Billboard:()=>lo,BillboardCollection:()=>Ru,BillboardGraphics:()=>fc,BillboardLoadState:()=>ss,BillboardTexture:()=>T_,BillboardVisualizer:()=>II,BingMapsGeocoderService:()=>K$,BingMapsImageryProvider:()=>b2,BingMapsStyle:()=>cw,BlendEquation:()=>Fa,BlendFunction:()=>Eo,BlendOption:()=>wo,BlendingState:()=>ln,BoundingRectangle:()=>Ke,BoundingSphere:()=>le,BoundingSphereState:()=>lt,BoundingVolumeSemantics:()=>bx,BoxEmitter:()=>VZ,BoxGeometry:()=>La,BoxGeometryUpdater:()=>HO,BoxGraphics:()=>Vb,BoxOutlineGeometry:()=>Ud,BrdfLutGenerator:()=>K2,Buffer:()=>yt,BufferLoader:()=>ax,BufferUsage:()=>Be,CPUStylingPipelineStage:()=>QR,CallbackPositionProperty:()=>GO,CallbackProperty:()=>Wd,Camera:()=>ro,CameraEventAggregator:()=>QB,CameraEventType:()=>Vi,CameraFlightPath:()=>Z2,Cartesian2:()=>H,Cartesian3:()=>d,Cartesian4:()=>se,Cartographic:()=>he,CartographicGeocoderService:()=>Z$,CatmullRomSpline:()=>Q$,Cesium3DContentGroup:()=>tx,Cesium3DTile:()=>Zf,Cesium3DTileBatchTable:()=>Kp,Cesium3DTileColorBlendMode:()=>Bl,Cesium3DTileContent:()=>zZ,Cesium3DTileContentFactory:()=>Ux,Cesium3DTileContentState:()=>Xo,Cesium3DTileContentType:()=>Ps,Cesium3DTileFeature:()=>Ws,Cesium3DTileFeatureTable:()=>sh,Cesium3DTileOptimizationHint:()=>qf,Cesium3DTileOptimizations:()=>NL,Cesium3DTilePass:()=>Uo,Cesium3DTilePassState:()=>gd,Cesium3DTilePointFeature:()=>A_,Cesium3DTileRefine:()=>qo,Cesium3DTileStyle:()=>NA,Cesium3DTileStyleEngine:()=>zL,Cesium3DTilesInspector:()=>Gk,Cesium3DTilesInspectorViewModel:()=>Hk,Cesium3DTilesVoxelProvider:()=>HZ,Cesium3DTileset:()=>bs,Cesium3DTilesetBaseTraversal:()=>YL,Cesium3DTilesetCache:()=>kL,Cesium3DTilesetGraphics:()=>Yb,Cesium3DTilesetHeatmap:()=>UL,Cesium3DTilesetMetadata:()=>Kx,Cesium3DTilesetMostDetailedTraversal:()=>jL,Cesium3DTilesetSkipTraversal:()=>$L,Cesium3DTilesetStatistics:()=>gh,Cesium3DTilesetTraversal:()=>Zs,Cesium3DTilesetVisualizer:()=>ZL,CesiumInspector:()=>qk,CesiumInspectorViewModel:()=>Wk,CesiumTerrainProvider:()=>DA,CesiumWidget:()=>q3,Check:()=>T,CheckerboardMaterialProperty:()=>kE,CircleEmitter:()=>sk,CircleGeometry:()=>oZ,CircleOutlineGeometry:()=>rZ,ClassificationModelDrawCommand:()=>jM,ClassificationPipelineStage:()=>KR,ClassificationPrimitive:()=>EC,ClassificationType:()=>Un,ClearCommand:()=>ei,ClippingPlane:()=>xx,ClippingPlaneCollection:()=>gs,ClippingPolygon:()=>eE,ClippingPolygonCollection:()=>th,Clock:()=>Ah,ClockRange:()=>$r,ClockStep:()=>mo,ClockViewModel:()=>Ok,CloudCollection:()=>XZ,CloudType:()=>FA,Color:()=>G,ColorBlendMode:()=>bc,ColorGeometryInstanceAttribute:()=>Gt,ColorMaterialProperty:()=>Ut,Command:()=>kQ,ComponentDatatype:()=>$,Composite3DTileContent:()=>QO,CompositeEntityCollection:()=>bq,CompositeMaterialProperty:()=>VE,CompositePositionProperty:()=>ba,CompositeProperty:()=>Sc,CompressedTextureBuffer:()=>Iv,ComputeCommand:()=>Uc,ComputeEngine:()=>Pv,ConditionsExpression:()=>nk,ConeEmitter:()=>$Z,ConstantPositionProperty:()=>qc,ConstantProperty:()=>Kn,ConstantSpline:()=>pR,ContentMetadata:()=>wL,Context:()=>AI,ContextLimits:()=>ut,CoplanarPolygonGeometry:()=>NN,CoplanarPolygonGeometryLibrary:()=>O_,CoplanarPolygonOutlineGeometry:()=>$f,CornerType:()=>Bi,CorrelationGroup:()=>J1,CorridorGeometry:()=>tT,CorridorGeometryLibrary:()=>Wi,CorridorGeometryUpdater:()=>sN,CorridorGraphics:()=>Hb,CorridorOutlineGeometry:()=>rN,Credit:()=>Tt,CreditDisplay:()=>tB,CubeMap:()=>Go,CubeMapFace:()=>Vv,CubicRealPolynomial:()=>gb,CullFace:()=>xi,CullingVolume:()=>_s,CumulusCloud:()=>uf,CustomDataSource:()=>dN,CustomHeightmapTerrainProvider:()=>sZ,CustomShader:()=>pA,CustomShaderMode:()=>y_,CustomShaderPipelineStage:()=>rM,CustomShaderTranslucencyMode:()=>Ly,CylinderGeometry:()=>hN,CylinderGeometryLibrary:()=>nT,CylinderGeometryUpdater:()=>pN,CylinderGraphics:()=>Gb,CylinderOutlineGeometry:()=>mN,CzmlDataSource:()=>SN,DataSource:()=>Kr,DataSourceClock:()=>Ch,DataSourceCollection:()=>wN,DataSourceDisplay:()=>uF,DebugAppearance:()=>tQ,DebugCameraPrimitive:()=>sp,DebugInspector:()=>s3,DebugModelMatrixPrimitive:()=>lk,DefaultProxy:()=>cZ,DepthFunction:()=>dc,DepthPlane:()=>aB,DequantizationPipelineStage:()=>aM,DerivedCommand:()=>ap,DeveloperError:()=>E,DeviceOrientationCameraController:()=>cB,DirectionalLight:()=>nQ,DiscardEmptyTileImagePolicy:()=>lw,DiscardMissingTileImagePolicy:()=>g2,DistanceDisplayCondition:()=>Mt,DistanceDisplayConditionGeometryInstanceAttribute:()=>kn,DoubleEndedPriorityQueue:()=>xA,DoublyLinkedList:()=>BL,DracoLoader:()=>n_,DrawCommand:()=>Qe,DynamicAtmosphereLightingType:()=>a_,DynamicEnvironmentMapManager:()=>c_,DynamicGeometryBatch:()=>cT,DynamicGeometryUpdater:()=>ni,EarthOrientationParameters:()=>xv,EarthOrientationParametersSample:()=>Bg,EasingFunction:()=>Qr,EllipseGeometry:()=>dl,EllipseGeometryLibrary:()=>$l,EllipseGeometryUpdater:()=>DN,EllipseGraphics:()=>jb,EllipseOutlineGeometry:()=>Hu,Ellipsoid:()=>ie,EllipsoidGeodesic:()=>kp,EllipsoidGeometry:()=>Js,EllipsoidGeometryUpdater:()=>IN,EllipsoidGraphics:()=>Wb,EllipsoidOutlineGeometry:()=>Nu,EllipsoidPrimitive:()=>j2,EllipsoidRhumbLine:()=>Ba,EllipsoidSurfaceAppearance:()=>iQ,EllipsoidTangentPlane:()=>ns,EllipsoidTerrainProvider:()=>np,EllipsoidalOccluder:()=>H_,Empty3DTileContent:()=>SE,EncodedCartesian3:()=>Hn,Entity:()=>nr,EntityCluster:()=>Bu,EntityCollection:()=>Qs,EntityView:()=>dF,Event:()=>pe,EventHelper:()=>gr,Expression:()=>Lf,ExpressionNodeType:()=>_t,ExtrapolationType:()=>cl,FeatureDetection:()=>Vt,FeatureIdPipelineStage:()=>My,Fog:()=>lB,ForEach:()=>Oe,FrameRateMonitor:()=>dk,FrameState:()=>uB,Framebuffer:()=>Ur,FramebufferManager:()=>hi,Frozen:()=>W,FrustumCommands:()=>pB,FrustumGeometry:()=>YT,FrustumOutlineGeometry:()=>oB,Fullscreen:()=>Cr,FullscreenButton:()=>Xk,FullscreenButtonViewModel:()=>Yk,GeoJsonDataSource:()=>T0,GeoJsonLoader:()=>dR,GeocodeType:()=>W0,Geocoder:()=>Qk,GeocoderService:()=>Yw,GeocoderViewModel:()=>Zk,GeographicProjection:()=>Oi,GeographicTilingScheme:()=>Ki,Geometry:()=>ct,Geometry3DTileContent:()=>n1,GeometryAttribute:()=>ve,GeometryAttributes:()=>fn,GeometryFactory:()=>uZ,GeometryInstance:()=>St,GeometryInstanceAttribute:()=>hc,GeometryOffsetAttribute:()=>Zt,GeometryPipeline:()=>Nn,GeometryPipelineStage:()=>fM,GeometryType:()=>xf,GeometryUpdater:()=>ii,GeometryUpdaterSet:()=>bT,GeometryVisualizer:()=>QN,GetFeatureInfoFormat:()=>GT,Globe:()=>V2,GlobeDepth:()=>_B,GlobeSurfaceShaderSet:()=>_2,GlobeSurfaceTile:()=>md,GlobeSurfaceTileProvider:()=>I2,GlobeTranslucency:()=>O2,GlobeTranslucencyFramebuffer:()=>gB,GlobeTranslucencyState:()=>fB,GltfBufferViewLoader:()=>kC,GltfDracoLoader:()=>UC,GltfGpmLoader:()=>tR,GltfGpmLocal:()=>nE,GltfImageLoader:()=>VC,GltfIndexBufferLoader:()=>zC,GltfJsonLoader:()=>GC,GltfLoader:()=>rh,GltfLoaderUtil:()=>Vl,GltfMeshPrimitiveGpmLoader:()=>rR,GltfStructuralMetadataLoader:()=>K1,GltfTextureLoader:()=>jC,GltfVertexBufferLoader:()=>WC,GoogleEarthEnterpriseImageryProvider:()=>rQ,GoogleEarthEnterpriseMapsProvider:()=>A2,GoogleEarthEnterpriseMetadata:()=>Og,GoogleEarthEnterpriseTerrainData:()=>Xw,GoogleEarthEnterpriseTerrainProvider:()=>yZ,GoogleEarthEnterpriseTileInformation:()=>Z3,GoogleGeocoderService:()=>xZ,GoogleMaps:()=>OA,GpxDataSource:()=>BF,GregorianDate:()=>im,GridImageryProvider:()=>sQ,GridMaterialProperty:()=>$E,GroundGeometryUpdater:()=>Gn,GroundPolylineGeometry:()=>Fb,GroundPolylinePrimitive:()=>Vd,GroundPrimitive:()=>jc,GroupMetadata:()=>NE,HeadingPitchRange:()=>cd,HeadingPitchRoll:()=>Oa,Heap:()=>_v,HeightReference:()=>We,HeightmapEncoding:()=>fd,HeightmapTerrainData:()=>qa,HeightmapTessellator:()=>ow,HermitePolynomialApproximation:()=>_N,HermiteSpline:()=>Iy,HilbertOrder:()=>LC,HomeButton:()=>$k,HomeButtonViewModel:()=>Kk,HorizontalOrigin:()=>bi,I3SBuildingSceneLayerExplorer:()=>YQ,I3SBuildingSceneLayerExplorerViewModel:()=>Jk,I3SDataProvider:()=>Jh,I3SDecoder:()=>hk,I3SFeature:()=>mk,I3SField:()=>pk,I3SGeometry:()=>Qw,I3SLayer:()=>zA,I3SNode:()=>Jw,I3SStatistics:()=>yk,I3SSublayer:()=>xk,I3SSymbology:()=>gk,I3dmLoader:()=>mR,I3dmParser:()=>hR,ITwinData:()=>uQ,ITwinPlatform:()=>us,Iau2000Orientation:()=>H2,Iau2006XysData:()=>Tv,Iau2006XysSample:()=>hb,IauOrientationAxes:()=>G2,IauOrientationParameters:()=>z2,ImageBasedLighting:()=>ex,ImageBasedLightingPipelineStage:()=>PR,ImageMaterialProperty:()=>ny,Imagery:()=>pw,ImageryLayer:()=>Xa,ImageryLayerCollection:()=>R2,ImageryLayerFeatureInfo:()=>Uh,ImageryProvider:()=>yl,ImageryState:()=>ai,Implicit3DTileContent:()=>XC,ImplicitAvailabilityBitstream:()=>FC,ImplicitMetadataView:()=>BC,ImplicitSubdivisionScheme:()=>or,ImplicitSubtree:()=>gx,ImplicitSubtreeCache:()=>ok,ImplicitSubtreeMetadata:()=>i1,ImplicitTileCoordinates:()=>Qx,ImplicitTileset:()=>Zx,IndexDatatype:()=>Fe,InfoBox:()=>tU,InfoBoxViewModel:()=>eU,InspectorShared:()=>fu,InstanceAttributeSemantic:()=>rs,InstancingPipelineStage:()=>GR,InterpolationAlgorithm:()=>TZ,InterpolationType:()=>ih,Intersect:()=>Wt,IntersectionTests:()=>Zn,Intersections2D:()=>Pg,Interval:()=>Ma,InvertClassification:()=>ww,Ion:()=>Xd,IonGeocodeProviderType:()=>Rg,IonGeocoderService:()=>RA,IonImageryProvider:()=>hg,IonResource:()=>Cu,IonWorldImageryStyle:()=>mg,Iso8601:()=>Ge,JobScheduler:()=>dB,JobType:()=>pa,JsonMetadataTable:()=>l_,JulianDate:()=>Q,KTX2Transcoder:()=>Ov,KeyboardEventModifier:()=>ra,KeyframeNode:()=>go,KmlCamera:()=>kF,KmlDataSource:()=>kT,KmlLookAt:()=>UF,KmlTour:()=>VF,KmlTourFlyTo:()=>HF,KmlTourWait:()=>GF,Label:()=>Uy,LabelCollection:()=>Om,LabelGraphics:()=>Hd,LabelStyle:()=>Yo,LabelVisualizer:()=>JN,LagrangePolynomialApproximation:()=>gN,LeapSecond:()=>Yi,Light:()=>fQ,LightingModel:()=>Dm,LightingPipelineStage:()=>hM,LinearApproximation:()=>Jy,LinearSpline:()=>Py,ManagedArray:()=>Jc,MapMode2D:()=>ru,MapProjection:()=>EZ,MapboxImageryProvider:()=>C2,MapboxStyleImageryProvider:()=>dQ,Material:()=>Xi,MaterialAppearance:()=>ao,MaterialPipelineStage:()=>pM,MaterialProperty:()=>tr,Math:()=>O,Matrix2:()=>Ri,Matrix3:()=>J,Matrix4:()=>B,Megatexture:()=>Lw,MeshPrimitiveGpmLocal:()=>oR,MetadataClass:()=>Qd,MetadataClassProperty:()=>Tm,MetadataComponentType:()=>Nt,MetadataEntity:()=>Bn,MetadataEnum:()=>v1,MetadataEnumValue:()=>w1,MetadataPicking:()=>hB,MetadataPickingPipelineStage:()=>Pu,MetadataPipelineStage:()=>Uf,MetadataSchema:()=>vu,MetadataSchemaLoader:()=>qC,MetadataSemantic:()=>yx,MetadataTable:()=>Nf,MetadataTableProperty:()=>r1,MetadataType:()=>at,MipmapHint:()=>Cf,Model:()=>lh,Model3DTileContent:()=>Ou,ModelAlphaOptions:()=>MM,ModelAnimation:()=>bR,ModelAnimationChannel:()=>yR,ModelAnimationCollection:()=>xR,ModelAnimationLoop:()=>Hl,ModelAnimationState:()=>ah,ModelArticulation:()=>OR,ModelArticulationStage:()=>IR,ModelClippingPlanesPipelineStage:()=>LR,ModelClippingPolygonsPipelineStage:()=>BR,ModelColorPipelineStage:()=>Ry,ModelComponents:()=>Tn,ModelDrawCommand:()=>WM,ModelDrawCommands:()=>XM,ModelFeature:()=>TR,ModelFeatureTable:()=>CR,ModelGraphics:()=>Gp,ModelLightingOptions:()=>zM,ModelMatrixUpdateStage:()=>jR,ModelNode:()=>kR,ModelRenderResources:()=>LM,ModelRuntimeNode:()=>qR,ModelRuntimePrimitive:()=>OM,ModelSceneGraph:()=>KM,ModelSilhouettePipelineStage:()=>BM,ModelSkin:()=>RM,ModelSplitterPipelineStage:()=>UM,ModelStatistics:()=>$M,ModelType:()=>pr,ModelUtility:()=>$t,ModelVisualizer:()=>eF,Moon:()=>q2,MorphTargetsPipelineStage:()=>gM,MorphWeightSpline:()=>SZ,MortonOrder:()=>Wy,Multiple3DTileContent:()=>PL,MultisampleFramebuffer:()=>CI,NavigationHelpButton:()=>aU,NavigationHelpButtonViewModel:()=>sU,NearFarScalar:()=>Bt,NeverTileDiscardPolicy:()=>mQ,NodeRenderResources:()=>VM,NodeStatisticsPipelineStage:()=>WR,NodeTransformationProperty:()=>qb,OIT:()=>yB,Occluder:()=>Y2,OffsetGeometryInstanceAttribute:()=>eo,OpenCageGeocoderService:()=>vZ,OpenStreetMapImageryProvider:()=>Lg,OrderedGroundPrimitiveCollection:()=>vN,OrientedBoundingBox:()=>Dn,OrthographicFrustum:()=>on,OrthographicOffCenterFrustum:()=>jo,Packable:()=>DZ,PackableForInterpolation:()=>PZ,Particle:()=>nv,ParticleBurst:()=>_Q,ParticleEmitter:()=>gQ,ParticleSystem:()=>yQ,Pass:()=>De,PassState:()=>lc,PathGraphics:()=>jp,PathVisualizer:()=>nF,PeliasGeocoderService:()=>J3,PerInstanceColorAppearance:()=>rn,PerformanceDisplay:()=>yg,PerformanceWatchdog:()=>rU,PerformanceWatchdogViewModel:()=>oU,PerspectiveFrustum:()=>Ci,PerspectiveOffCenterFrustum:()=>bl,PickDepth:()=>mB,PickDepthFramebuffer:()=>xB,PickFramebuffer:()=>AB,PickedMetadataInfo:()=>L3,Picking:()=>wB,PickingPipelineStage:()=>yM,PinBuilder:()=>ag,PixelDatatype:()=>Ue,PixelFormat:()=>ke,Plane:()=>sn,PlaneGeometry:()=>ON,PlaneGeometryUpdater:()=>MN,PlaneGraphics:()=>NO,PlaneOutlineGeometry:()=>RN,PntsLoader:()=>QM,PntsParser:()=>Rx,PointCloud:()=>j3,PointCloudEyeDomeLighting:()=>f_,PointCloudShading:()=>vm,PointCloudStylingPipelineStage:()=>xM,PointGraphics:()=>Xb,PointPrimitive:()=>Os,PointPrimitiveCollection:()=>WE,PointVisualizer:()=>oF,PolygonGeometry:()=>s_,PolygonGeometryLibrary:()=>zn,PolygonGeometryUpdater:()=>BN,PolygonGraphics:()=>Gd,PolygonHierarchy:()=>ka,PolygonOutlineGeometry:()=>FN,PolygonPipeline:()=>si,Polyline:()=>Gf,PolylineArrowMaterialProperty:()=>QE,PolylineCollection:()=>dh,PolylineColorAppearance:()=>is,PolylineDashMaterialProperty:()=>eS,PolylineGeometry:()=>ng,PolylineGeometryUpdater:()=>aF,PolylineGlowMaterialProperty:()=>nS,PolylineGraphics:()=>mc,PolylineMaterialAppearance:()=>ha,PolylineOutlineMaterialProperty:()=>e0,PolylinePipeline:()=>Fi,PolylineVisualizer:()=>lF,PolylineVolumeGeometry:()=>VN,PolylineVolumeGeometryLibrary:()=>yh,PolylineVolumeGeometryUpdater:()=>jN,PolylineVolumeGraphics:()=>Kb,PolylineVolumeOutlineGeometry:()=>GN,PositionProperty:()=>zd,PositionPropertyArray:()=>q_,PostProcessStage:()=>ho,PostProcessStageCollection:()=>XB,PostProcessStageComposite:()=>au,PostProcessStageLibrary:()=>tf,PostProcessStageSampleMode:()=>ef,PostProcessStageTextureCache:()=>rA,PpeMetadata:()=>iR,PpeSource:()=>LQ,PpeTexture:()=>nR,Primitive:()=>Pn,PrimitiveCollection:()=>fl,PrimitiveLoadPlan:()=>vx,PrimitiveOutlineGenerator:()=>wx,PrimitiveOutlinePipelineStage:()=>CM,PrimitivePipeline:()=>Mb,PrimitiveRenderResources:()=>HM,PrimitiveState:()=>Pr,PrimitiveStatisticsPipelineStage:()=>EM,PrimitiveType:()=>Me,ProjectionPicker:()=>iU,ProjectionPickerViewModel:()=>nU,Property:()=>X,PropertyArray:()=>oS,PropertyAttribute:()=>Sx,PropertyAttributeProperty:()=>W1,PropertyBag:()=>Xc,PropertyTable:()=>nl,PropertyTexture:()=>u_,PropertyTextureProperty:()=>j1,ProviderViewModel:()=>ds,Proxy:()=>OZ,QuadraticRealPolynomial:()=>Vc,QuadtreeOccluders:()=>M2,QuadtreePrimitive:()=>U2,QuadtreeTile:()=>L2,QuadtreeTileLoadState:()=>ta,QuadtreeTileProvider:()=>bQ,QuantizedMeshTerrainData:()=>vA,QuarticRealPolynomial:()=>Lv,Quaternion:()=>Le,QuaternionSpline:()=>gR,Queue:()=>Cy,Ray:()=>mn,Rectangle:()=>ce,RectangleCollisionChecker:()=>TT,RectangleGeometry:()=>hT,RectangleGeometryLibrary:()=>Is,RectangleGeometryUpdater:()=>WN,RectangleGraphics:()=>jd,RectangleOutlineGeometry:()=>Hx,ReferenceFrame:()=>Hi,ReferenceProperty:()=>Y_,RenderState:()=>Ve,Renderbuffer:()=>_u,RenderbufferFormat:()=>uc,Request:()=>Qo,RequestErrorEvent:()=>sm,RequestScheduler:()=>sc,RequestState:()=>$n,RequestType:()=>ms,Resource:()=>we,ResourceCache:()=>vi,ResourceCacheKey:()=>zl,ResourceCacheStatistics:()=>I1,ResourceLoader:()=>$i,ResourceLoaderState:()=>gt,Rotation:()=>td,RuntimeError:()=>ae,S2Cell:()=>Qp,SDFSettings:()=>Ks,SampledPositionProperty:()=>Ta,SampledProperty:()=>Vu,Sampler:()=>Qt,ScaledPositionProperty:()=>zm,Scene:()=>F3,SceneFramebuffer:()=>QT,SceneMode:()=>oe,SceneMode2DPipelineStage:()=>SM,SceneModePicker:()=>dU,SceneModePickerViewModel:()=>fU,SceneTransforms:()=>Gi,SceneTransitioner:()=>ZB,ScreenSpaceCameraController:()=>t3,ScreenSpaceEventHandler:()=>of,ScreenSpaceEventType:()=>An,SelectedFeatureIdPipelineStage:()=>Ny,SelectionIndicator:()=>uU,SelectionIndicatorViewModel:()=>lU,SensorVolumePortionToDisplay:()=>cS,ShaderBuilder:()=>wb,ShaderCache:()=>gI,ShaderDestination:()=>ge,ShaderFunction:()=>vI,ShaderProgram:()=>Jt,ShaderSource:()=>He,ShaderStruct:()=>wI,ShadowMap:()=>Tg,ShadowMapShader:()=>up,ShadowMode:()=>xn,ShadowVolumeAppearance:()=>bu,ShowGeometryInstanceAttribute:()=>bn,Simon1994PlanetaryPositions:()=>Xg,SimplePolylineGeometry:()=>RZ,SingleTileImageryProvider:()=>E2,SkinningPipelineStage:()=>vM,SkyAtmosphere:()=>B3,SkyBox:()=>k3,SpatialNode:()=>O3,Spdcf:()=>eR,SpecularEnvironmentCubeMap:()=>Yd,SphereEmitter:()=>TQ,SphereGeometry:()=>MZ,SphereOutlineGeometry:()=>M_,Spherical:()=>yN,Spline:()=>Ni,SplitDirection:()=>Vr,Splitter:()=>kw,StaticGeometryColorBatch:()=>rd,StaticGeometryPerMaterialBatch:()=>sd,StaticGroundGeometryColorBatch:()=>wS,StaticGroundGeometryPerMaterialBatch:()=>ZN,StaticGroundPolylinePerMaterialBatch:()=>cF,StaticOutlineGeometryBatch:()=>PS,StencilConstants:()=>kt,StencilFunction:()=>Vn,StencilOperation:()=>ft,SteppedSpline:()=>_R,Stereographic:()=>yc,StorageType:()=>wm,StripeMaterialProperty:()=>sS,StripeOrientation:()=>Eh,StructuralMetadata:()=>Ys,StyleCommandsNeeded:()=>ch,StyleExpression:()=>AQ,Sun:()=>z3,SunLight:()=>Rp,SunPostProcess:()=>o3,SupportedImageFormats:()=>$1,SvgPathBindingHandler:()=>Pk,TaskProcessor:()=>yi,Terrain:()=>Ek,TerrainData:()=>kh,TerrainEncoding:()=>Oc,TerrainFillMesh:()=>bw,TerrainMesh:()=>hd,TerrainOffsetProperty:()=>$b,TerrainProvider:()=>cs,TerrainQuantization:()=>ea,TerrainState:()=>fo,Texture:()=>Rt,TextureAtlas:()=>vb,TextureCache:()=>yI,TextureMagnificationFilter:()=>li,TextureManager:()=>w3,TextureMinificationFilter:()=>Yt,TexturePacker:()=>_C,TextureUniform:()=>RQ,TextureWrap:()=>gn,TileAvailability:()=>Xh,TileBoundingRegion:()=>Lu,TileBoundingS2Cell:()=>ML,TileBoundingSphere:()=>L_,TileBoundingVolume:()=>CQ,TileCoordinatesImageryProvider:()=>wk,TileDiscardPolicy:()=>SQ,TileEdge:()=>yn,TileImagery:()=>_w,TileMapServiceImageryProvider:()=>D0,TileMetadata:()=>vL,TileOrientedBoundingBox:()=>Yl,TileProviderError:()=>Po,TileReplacementQueue:()=>N2,TileSelectionResult:()=>Yn,TileState:()=>wQ,Tileset3DTileContent:()=>tL,TilesetMetadata:()=>LL,TilesetPipelineStage:()=>ER,TilingScheme:()=>LZ,TimeConstants:()=>qn,TimeDynamicImagery:()=>jT,TimeDynamicPointCloud:()=>Vw,TimeInterval:()=>En,TimeIntervalCollection:()=>Xr,TimeIntervalCollectionPositionProperty:()=>X_,TimeIntervalCollectionProperty:()=>K_,TimeStandard:()=>Wn,Timeline:()=>pU,TimelineHighlightRange:()=>hU,TimelineTrack:()=>mU,Tipsify:()=>Nv,ToggleButtonViewModel:()=>Z0,Tonemapper:()=>Cg,TrackingReferenceFrame:()=>Bp,Transforms:()=>Ot,TranslationRotationScale:()=>iy,TranslucentTileClassification:()=>CB,TridiagonalSystemSolver:()=>lE,TrustedServers:()=>iC,TweenCollection:()=>lA,UniformState:()=>TI,UniformType:()=>hA,UrlTemplateImageryProvider:()=>Ya,VERSION:()=>sDt,VRButton:()=>xU,VRButtonViewModel:()=>bU,VRTheWorldTerrainProvider:()=>FZ,VaryingType:()=>MQ,Vector3DTileBatch:()=>bm,Vector3DTileClampedPolylines:()=>CL,Vector3DTileContent:()=>SL,Vector3DTileGeometry:()=>Zp,Vector3DTilePoints:()=>_L,Vector3DTilePolygons:()=>gL,Vector3DTilePolylines:()=>kx,Vector3DTilePrimitive:()=>rx,VelocityOrientationProperty:()=>xN,VelocityVectorProperty:()=>$_,VertexArray:()=>ti,VertexArrayFacade:()=>Mp,VertexAttributeSemantic:()=>ht,VertexFormat:()=>Ie,VerticalExaggeration:()=>Dr,VerticalExaggerationPipelineStage:()=>PM,VerticalOrigin:()=>Fn,VideoSynchronizer:()=>NZ,View:()=>tA,Viewer:()=>tJ,ViewportQuad:()=>vQ,Visibility:()=>xr,Visualizer:()=>MX,VoxelBoxShape:()=>gA,VoxelCell:()=>a3,VoxelContent:()=>_A,VoxelCylinderShape:()=>yA,VoxelEllipsoidShape:()=>bA,VoxelInspector:()=>gU,VoxelInspectorViewModel:()=>_U,VoxelMetadataOrder:()=>Td,VoxelPrimitive:()=>V0,VoxelProvider:()=>PQ,VoxelRenderResources:()=>A3,VoxelShape:()=>IQ,VoxelShapeType:()=>va,VoxelTraversal:()=>R3,VulkanConstants:()=>BZ,WallGeometry:()=>YN,WallGeometryLibrary:()=>mT,WallGeometryUpdater:()=>$N,WallGraphics:()=>Wp,WallOutlineGeometry:()=>KN,WebGLConstants:()=>ne,WebMapServiceImageryProvider:()=>w2,WebMapTileServiceImageryProvider:()=>D2,WebMercatorProjection:()=>Mi,WebMercatorTilingScheme:()=>ls,WindingOrder:()=>ts,WireframeIndexGenerator:()=>gE,WireframePipelineStage:()=>IM,_shadersAcesTonemappingStage:()=>vB,_shadersAdditiveBlend:()=>n3,_shadersAdjustTranslucentFS:()=>JS,_shadersAllMaterialAppearanceFS:()=>MI,_shadersAllMaterialAppearanceVS:()=>LI,_shadersAmbientOcclusionGenerate:()=>DB,_shadersAmbientOcclusionModulate:()=>PB,_shadersAspectRampMaterial:()=>UI,_shadersAtmosphereCommon:()=>nh,_shadersAtmosphereStageFS:()=>SR,_shadersAtmosphereStageVS:()=>wR,_shadersBasicMaterialAppearanceFS:()=>NI,_shadersBasicMaterialAppearanceVS:()=>FI,_shadersBillboardCollectionFS:()=>nL,_shadersBillboardCollectionVS:()=>iL,_shadersBlackAndWhite:()=>IB,_shadersBloomComposite:()=>OB,_shadersBrdfLutGeneratorFS:()=>YF,_shadersBrightPass:()=>i3,_shadersBrightness:()=>RB,_shadersBumpMapMaterial:()=>VI,_shadersCPUStylingStageFS:()=>ZR,_shadersCPUStylingStageVS:()=>$R,_shadersCheckerboardMaterial:()=>zI,_shadersCloudCollectionFS:()=>XF,_shadersCloudCollectionVS:()=>KF,_shadersCloudNoiseFS:()=>$F,_shadersCloudNoiseVS:()=>ZF,_shadersCompareAndPackTranslucentDepth:()=>QF,_shadersCompositeOITFS:()=>JF,_shadersCompositeTranslucentClassification:()=>eA,_shadersComputeIrradianceFS:()=>B1,_shadersComputeRadianceMapFS:()=>k1,_shadersContrastBias:()=>MB,_shadersConvolveSpecularMapFS:()=>U1,_shadersConvolveSpecularMapVS:()=>V1,_shadersCustomShaderStageFS:()=>eM,_shadersCustomShaderStageVS:()=>JR,_shadersCzmBuiltins:()=>Cb,_shadersDepthOfField:()=>LB,_shadersDepthPlaneFS:()=>e2,_shadersDepthPlaneVS:()=>t2,_shadersDepthView:()=>NB,_shadersDepthViewPacked:()=>OQ,_shadersDotMaterial:()=>HI,_shadersEdgeDetection:()=>FB,_shadersElevationBandMaterial:()=>GI,_shadersElevationContourMaterial:()=>jI,_shadersElevationRampMaterial:()=>WI,_shadersEllipsoidFS:()=>ew,_shadersEllipsoidSurfaceAppearanceFS:()=>uk,_shadersEllipsoidSurfaceAppearanceVS:()=>fk,_shadersEllipsoidVS:()=>tw,_shadersFXAA:()=>UB,_shadersFXAA3_11:()=>n2,_shadersFadeMaterial:()=>qI,_shadersFeatureIdStageFS:()=>tM,_shadersFeatureIdStageVS:()=>nM,_shadersFilmicTonemapping:()=>BB,_shadersGaussianBlur1D:()=>F0,_shadersGeometryStageFS:()=>cM,_shadersGeometryStageVS:()=>lM,_shadersGlobeFS:()=>i2,_shadersGlobeVS:()=>o2,_shadersGridMaterial:()=>YI,_shadersGroundAtmosphere:()=>nw,_shadersHSBToRGB:()=>_P,_shadersHSLToRGB:()=>gP,_shadersImageBasedLightingStageFS:()=>DR,_shadersInstancingStageCommon:()=>UR,_shadersInstancingStageVS:()=>VR,_shadersIntersectBox:()=>m3,_shadersIntersectClippingPlanes:()=>h3,_shadersIntersectCylinder:()=>p3,_shadersIntersectDepth:()=>d3,_shadersIntersectEllipsoid:()=>_3,_shadersIntersectLongitude:()=>Rw,_shadersIntersection:()=>dA,_shadersIntersectionUtils:()=>f3,_shadersLegacyInstancingStageVS:()=>zR,_shadersLensFlare:()=>VB,_shadersLightingStageFS:()=>dM,_shadersMaterialStageFS:()=>mM,_shadersMegatexture:()=>T3,_shadersMetadataStageFS:()=>iM,_shadersMetadataStageVS:()=>oM,_shadersModelClippingPlanesStageFS:()=>MR,_shadersModelClippingPolygonsStageFS:()=>FR,_shadersModelClippingPolygonsStageVS:()=>NR,_shadersModelColorStageFS:()=>RR,_shadersModelFS:()=>YM,_shadersModelSilhouetteStageFS:()=>NM,_shadersModelSilhouetteStageVS:()=>FM,_shadersModelSplitterStageFS:()=>kM,_shadersModelVS:()=>qM,_shadersModifiedReinhardTonemapping:()=>zB,_shadersMorphTargetsStageVS:()=>_M,_shadersNightVision:()=>HB,_shadersNormalMapMaterial:()=>XI,_shadersOctree:()=>x3,_shadersPassThrough:()=>su,_shadersPassThroughDepth:()=>M0,_shadersPbrNeutralTonemapping:()=>kB,_shadersPerInstanceColorAppearanceFS:()=>rO,_shadersPerInstanceColorAppearanceVS:()=>sO,_shadersPerInstanceFlatColorAppearanceFS:()=>Ob,_shadersPerInstanceFlatColorAppearanceVS:()=>aO,_shadersPointCloudEyeDomeLighting:()=>sR,_shadersPointCloudStylingStageVS:()=>bM,_shadersPointPrimitiveCollectionFS:()=>Qy,_shadersPointPrimitiveCollectionVS:()=>aN,_shadersPolygonSignedDistanceFS:()=>N1,_shadersPolylineArrowMaterial:()=>KI,_shadersPolylineColorAppearanceVS:()=>AO,_shadersPolylineCommon:()=>xu,_shadersPolylineDashMaterial:()=>$I,_shadersPolylineFS:()=>kb,_shadersPolylineGlowMaterial:()=>ZI,_shadersPolylineMaterialAppearanceVS:()=>CO,_shadersPolylineOutlineMaterial:()=>QI,_shadersPolylineShadowVolumeFS:()=>yO,_shadersPolylineShadowVolumeMorphFS:()=>bO,_shadersPolylineShadowVolumeMorphVS:()=>xO,_shadersPolylineShadowVolumeVS:()=>TO,_shadersPolylineVS:()=>uL,_shadersPrimitiveOutlineStageFS:()=>AM,_shadersPrimitiveOutlineStageVS:()=>TM,_shadersRGBToHSB:()=>GP,_shadersRGBToHSL:()=>jP,_shadersRGBToXYZ:()=>WP,_shadersReinhardTonemapping:()=>GB,_shadersReprojectWebMercatorFS:()=>r2,_shadersReprojectWebMercatorVS:()=>s2,_shadersRimLightingMaterial:()=>JI,_shadersSelectedFeatureIdStageCommon:()=>_E,_shadersShadowVolumeAppearanceFS:()=>AC,_shadersShadowVolumeAppearanceVS:()=>uO,_shadersShadowVolumeFS:()=>Jg,_shadersSilhouette:()=>jB,_shadersSkinningStageVS:()=>wM,_shadersSkyAtmosphereCommon:()=>iw,_shadersSkyAtmosphereFS:()=>a2,_shadersSkyAtmosphereVS:()=>c2,_shadersSkyBoxFS:()=>l2,_shadersSkyBoxVS:()=>u2,_shadersSlopeRampMaterial:()=>eO,_shadersStripeMaterial:()=>tO,_shadersSunFS:()=>f2,_shadersSunTextureFS:()=>d2,_shadersSunVS:()=>h2,_shadersTexturedMaterialAppearanceFS:()=>BI,_shadersTexturedMaterialAppearanceVS:()=>kI,_shadersVector3DTileClampedPolylinesFS:()=>TL,_shadersVector3DTileClampedPolylinesVS:()=>xL,_shadersVector3DTilePolylinesVS:()=>yL,_shadersVectorTileVS:()=>MC,_shadersVerticalExaggerationStageVS:()=>DM,_shadersViewportQuadFS:()=>m2,_shadersViewportQuadVS:()=>mb,_shadersVoxelFS:()=>l3,_shadersVoxelUtils:()=>c3,_shadersVoxelVS:()=>u3,_shadersWater:()=>iO,_shadersWaterMaskMaterial:()=>nO,_shadersXYZToRGB:()=>pI,_shadersacesTonemapping:()=>LD,_shadersalphaWeight:()=>ND,_shadersantialias:()=>FD,_shadersapplyHSBShift:()=>BD,_shadersapproximateSphericalCoordinates:()=>kD,_shadersapproximateTanh:()=>UD,_shadersbackFacing:()=>VD,_shadersbranchFreeTernary:()=>zD,_shaderscascadeColor:()=>HD,_shaderscascadeDistance:()=>GD,_shaderscascadeMatrix:()=>jD,_shaderscascadeWeights:()=>WD,_shadersclipPolygons:()=>qD,_shaderscolumbusViewMorph:()=>YD,_shaderscomputeAtmosphereColor:()=>XD,_shaderscomputeGroundAtmosphereScattering:()=>KD,_shaderscomputePosition:()=>$D,_shaderscomputeScattering:()=>ZD,_shadersconvertUvToBox:()=>g3,_shadersconvertUvToCylinder:()=>y3,_shadersconvertUvToEllipsoid:()=>b3,_shaderscosineAndSine:()=>QD,_shadersdecompressTextureCoordinates:()=>JD,_shadersdegreesPerRadian:()=>Hv,_shadersdepthClamp:()=>eP,_shadersdepthRange:()=>Gv,_shadersdepthRangeStruct:()=>wD,_shaderseastNorthUpToEyeCoordinates:()=>tP,_shadersellipsoidContainsPoint:()=>nP,_shadersellipsoidTextureCoordinates:()=>iP,_shadersepsilon1:()=>jv,_shadersepsilon2:()=>Wv,_shadersepsilon3:()=>qv,_shadersepsilon4:()=>Yv,_shadersepsilon5:()=>Xv,_shadersepsilon6:()=>Kv,_shadersepsilon7:()=>$v,_shadersequalsEpsilon:()=>oP,_shaderseyeOffset:()=>rP,_shaderseyeToWindowCoordinates:()=>sP,_shadersfastApproximateAtan:()=>aP,_shadersfog:()=>cP,_shadersgammaCorrect:()=>lP,_shadersgeodeticSurfaceNormal:()=>uP,_shadersgetDefaultMaterial:()=>fP,_shadersgetDynamicAtmosphereLightDirection:()=>dP,_shadersgetLambertDiffuse:()=>hP,_shadersgetSpecular:()=>mP,_shadersgetWaterNoise:()=>pP,_shadershue:()=>yP,_shadersinfinity:()=>Zv,_shadersinverseGamma:()=>bP,_shadersisEmpty:()=>xP,_shadersisFull:()=>TP,_shaderslatitudeToWebMercatorFraction:()=>AP,_shaderslineDistance:()=>EP,_shaderslinearToSrgb:()=>CP,_shadersluminance:()=>SP,_shadersmaterial:()=>vD,_shadersmaterialInput:()=>DD,_shadersmaximumComponent:()=>wP,_shadersmetersPerPixel:()=>vP,_shadersmodelMaterial:()=>PD,_shadersmodelToWindowCoordinates:()=>DP,_shadersmodelVertexOutput:()=>ID,_shadersmultiplyWithColorBalance:()=>PP,_shadersnearFarScalar:()=>IP,_shadersoctDecode:()=>OP,_shadersoneOverPi:()=>Qv,_shadersoneOverTwoPi:()=>Jv,_shaderspackDepth:()=>RP,_shaderspassCesium3DTile:()=>eD,_shaderspassCesium3DTileClassification:()=>tD,_shaderspassCesium3DTileClassificationIgnoreShow:()=>nD,_shaderspassClassification:()=>iD,_shaderspassCompute:()=>oD,_shaderspassEnvironment:()=>rD,_shaderspassGlobe:()=>sD,_shaderspassOpaque:()=>aD,_shaderspassOverlay:()=>cD,_shaderspassTerrainClassification:()=>lD,_shaderspassTranslucent:()=>uD,_shaderspassVoxels:()=>fD,_shaderspbrLighting:()=>MP,_shaderspbrNeutralTonemapping:()=>LP,_shadersphong:()=>NP,_shaderspi:()=>dD,_shaderspiOverFour:()=>hD,_shaderspiOverSix:()=>mD,_shaderspiOverThree:()=>pD,_shaderspiOverTwo:()=>_D,_shadersplaneDistance:()=>FP,_shaderspointAlongRay:()=>BP,_shadersradiansPerDegree:()=>gD,_shadersray:()=>OD,_shadersrayEllipsoidIntersectionInterval:()=>kP,_shadersraySegment:()=>RD,_shadersraySphereIntersectionInterval:()=>UP,_shadersreadDepth:()=>VP,_shadersreadNonPerspective:()=>zP,_shadersreverseLogDepth:()=>HP,_shadersround:()=>qP,_shaderssaturation:()=>YP,_shaderssceneMode2D:()=>yD,_shaderssceneMode3D:()=>bD,_shaderssceneModeColumbusView:()=>xD,_shaderssceneModeMorphing:()=>TD,_shadersshadowDepthCompare:()=>XP,_shadersshadowParameters:()=>MD,_shadersshadowVisibility:()=>KP,_shaderssignNotZero:()=>$P,_shaderssolarRadius:()=>AD,_shaderssphericalHarmonics:()=>ZP,_shaderssrgbToLinear:()=>QP,_shaderstangentToEyeSpaceMatrix:()=>JP,_shaderstextureCube:()=>eI,_shadersthreePiOver2:()=>CD,_shaderstransformPlane:()=>tI,_shaderstranslateRelativeToEye:()=>nI,_shaderstranslucentPhong:()=>iI,_shaderstranspose:()=>oI,_shaderstwoPi:()=>ED,_shadersunpackClippingExtents:()=>rI,_shadersunpackDepth:()=>sI,_shadersunpackFloat:()=>aI,_shadersunpackUint:()=>cI,_shadersvalueTransform:()=>lI,_shadersvertexLogDepth:()=>uI,_shaderswebMercatorMaxLatitude:()=>SD,_shaderswindowToEyeCoordinates:()=>fI,_shaderswriteDepthClamp:()=>dI,_shaderswriteLogDepth:()=>hI,_shaderswriteNonPerspective:()=>mI,addBuffer:()=>y1,addDefaults:()=>u1,addExtensionsRequired:()=>p1,addExtensionsUsed:()=>Ff,addPipelineExtras:()=>py,addToArray:()=>vs,appendForwardSlash:()=>dv,arrayRemoveDuplicates:()=>xo,barycentricCoordinates:()=>_b,binarySearch:()=>Lo,buildModuleUrl:()=>tn,buildVoxelDrawCommands:()=>E3,clone:()=>je,combine:()=>xt,computeFlyToLocationForRectangle:()=>VT,createBillboardPointCallback:()=>Lx,createCommand:()=>Sn,createDefaultImageryProviderViewModels:()=>kk,createDefaultTerrainProviderViewModels:()=>Uk,createElevationBandMaterial:()=>ZZ,createGooglePhotorealistic3DTileset:()=>QZ,createGuid:()=>jn,createMaterialPropertyDescriptor:()=>No,createOsmBuildingsAsync:()=>JZ,createPropertyDescriptor:()=>fe,createRawPropertyDescriptor:()=>Yc,createTangentSpaceDebugPrimitive:()=>eQ,createTaskProcessorWorker:()=>NQ,createUniform:()=>wv,createUniformArray:()=>vv,createWorldBathymetryAsync:()=>K3,createWorldImageryAsync:()=>pg,createWorldTerrainAsync:()=>PA,decodeGoogleEarthEnterpriseData:()=>$3,decodeVectorPolylinePositions:()=>EL,defaultValue:()=>lZ,defer:()=>Dl,defined:()=>c,demodernizeShader:()=>_I,deprecationWarning:()=>ws,destroyObject:()=>de,exportKml:()=>MY,findAccessorMinMax:()=>hx,findContentMetadata:()=>Vx,findGroupMetadata:()=>zx,findTileMetadata:()=>DL,forEachTextureInMaterial:()=>HC,formatError:()=>ep,freezeRenderState:()=>Sv,getAbsoluteUri:()=>om,getAccessorByteStride:()=>Ul,getBaseUri:()=>hv,getBinaryAccessor:()=>Eu,getClipAndStyleCode:()=>H3,getClippingFunction:()=>fg,getComponentReader:()=>o_,getElement:()=>In,getExtensionFromUri:()=>rb,getFilenameFromUri:()=>j_,getImageFromTypedArray:()=>S3,getImagePixels:()=>Id,getJsonFromTypedArray:()=>ir,getMagic:()=>Kd,getMetadataClassProperty:()=>M3,getMetadataProperty:()=>N3,getStringFromTypedArray:()=>Fl,getTimestamp:()=>Ti,hasExtension:()=>oi,heightReferenceOnEntityPropertyChanged:()=>qp,isBitSet:()=>Fc,isBlobUri:()=>sb,isCrossOriginUrl:()=>Ug,isDataUri:()=>Ep,isLeapYear:()=>Dd,knockout:()=>xe,knockout_3_5_1:()=>GA,knockout_es5:()=>Dk,loadAndExecuteScript:()=>ab,loadCubeMap:()=>SI,loadImageFromTypedArray:()=>ux,loadKTX2:()=>Il,mergeSort:()=>gg,moveTechniqueRenderStates:()=>m1,moveTechniquesToExtension:()=>_1,numberOfComponentsForType:()=>wu,objectToQuery:()=>cb,oneTimeWarning:()=>dt,parseBatchTable:()=>m_,parseFeatureMetadataLegacy:()=>X1,parseGlb:()=>d1,parseResponseHeaders:()=>mv,parseStructuralMetadata:()=>Y1,pickModel:()=>xE,pointInsideTriangle:()=>IZ,preprocess3DTileContent:()=>I_,processVoxelProperties:()=>C3,queryToObject:()=>hu,readAccessorPacked:()=>b1,removeExtension:()=>mx,removeExtensionsRequired:()=>f1,removeExtensionsUsed:()=>dx,removePipelineExtras:()=>h1,removeUnusedElements:()=>g1,resizeImageToNextPowerOfTwo:()=>yy,sampleTerrain:()=>p2,sampleTerrainMostDetailed:()=>UT,scaleToGeodeticSurface:()=>ob,srgbToLinear:()=>MA,subdivideArray:()=>fO,subscribeAndEvaluate:()=>Da,updateAccessorComponentTypes:()=>x1,updateVersion:()=>T1,usesExtension:()=>mr,viewerCesium3DTilesInspectorMixin:()=>nJ,viewerCesiumInspectorMixin:()=>iJ,viewerDragDropMixin:()=>rJ,viewerPerformanceWatchdogMixin:()=>sJ,viewerVoxelInspectorMixin:()=>aJ,webGLConstantToGlslType:()=>kZ,wrapFunction:()=>tk,writeTextToCanvas:()=>Fx});module.exports=nm(aDt);function wSe(e){return e!=null}var c=wSe;function nb(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(nb.prototype=Object.create(Error.prototype),nb.prototype.constructor=nb);nb.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=`
${this.stack.toString()}`),e};nb.throwInstantiationError=function(){throw new nb("This function defines an interface and should not be called directly.")};var E=nb;var Es={};Es.typeOf={};function vSe(e){return`${e} is required, actual value was undefined`}function YA(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Es.defined=function(e,t){if(!c(t))throw new E(vSe(e))};Es.typeOf.func=function(e,t){if(typeof t!="function")throw new E(YA(typeof t,"function",e))};Es.typeOf.string=function(e,t){if(typeof t!="string")throw new E(YA(typeof t,"string",e))};Es.typeOf.number=function(e,t){if(typeof t!="number")throw new E(YA(typeof t,"number",e))};Es.typeOf.number.lessThan=function(e,t,n){if(Es.typeOf.number(e,t),t>=n)throw new E(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Es.typeOf.number.lessThanOrEquals=function(e,t,n){if(Es.typeOf.number(e,t),t>n)throw new E(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Es.typeOf.number.greaterThan=function(e,t,n){if(Es.typeOf.number(e,t),t<=n)throw new E(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Es.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Es.typeOf.number(e,t),t<n)throw new E(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Es.typeOf.object=function(e,t){if(typeof t!="object")throw new E(YA(typeof t,"object",e))};Es.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new E(YA(typeof t,"boolean",e))};Es.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new E(YA(typeof t,"bigint",e))};Es.typeOf.number.equals=function(e,t,n,i){if(Es.typeOf.number(e,n),Es.typeOf.number(t,i),n!==i)throw new E(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};var T=Es;var v5=Zo(AU(),1);var st={};st.EPSILON1=.1;st.EPSILON2=.01;st.EPSILON3=.001;st.EPSILON4=1e-4;st.EPSILON5=1e-5;st.EPSILON6=1e-6;st.EPSILON7=1e-7;st.EPSILON8=1e-8;st.EPSILON9=1e-9;st.EPSILON10=1e-10;st.EPSILON11=1e-11;st.EPSILON12=1e-12;st.EPSILON13=1e-13;st.EPSILON14=1e-14;st.EPSILON15=1e-15;st.EPSILON16=1e-16;st.EPSILON17=1e-17;st.EPSILON18=1e-18;st.EPSILON19=1e-19;st.EPSILON20=1e-20;st.EPSILON21=1e-21;st.GRAVITATIONALPARAMETER=3986004418e5;st.SOLAR_RADIUS=6955e5;st.LUNAR_RADIUS=1737400;st.SIXTY_FOUR_KILOBYTES=64*1024;st.FOUR_GIGABYTES=4*1024*1024*1024;st.sign=Math.sign??function(t){return t=+t,t===0||t!==t?t:t>0?1:-1};st.signNotZero=function(e){return e<0?-1:1};st.toSNorm=function(e,t){return t=t??255,Math.round((st.clamp(e,-1,1)*.5+.5)*t)};st.fromSNorm=function(e,t){return t=t??255,st.clamp(e,0,t)/t*2-1};st.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:st.clamp((e-t)/n,0,1)};st.sinh=Math.sinh??function(t){return(Math.exp(t)-Math.exp(-t))/2};st.cosh=Math.cosh??function(t){return(Math.exp(t)+Math.exp(-t))/2};st.lerp=function(e,t,n){return(1-n)*e+n*t};st.PI=Math.PI;st.ONE_OVER_PI=1/Math.PI;st.PI_OVER_TWO=Math.PI/2;st.PI_OVER_THREE=Math.PI/3;st.PI_OVER_FOUR=Math.PI/4;st.PI_OVER_SIX=Math.PI/6;st.THREE_PI_OVER_TWO=3*Math.PI/2;st.TWO_PI=2*Math.PI;st.ONE_OVER_TWO_PI=1/(2*Math.PI);st.RADIANS_PER_DEGREE=Math.PI/180;st.DEGREES_PER_RADIAN=180/Math.PI;st.RADIANS_PER_ARCSECOND=st.RADIANS_PER_DEGREE/3600;st.toRadians=function(e){if(!c(e))throw new E("degrees is required.");return e*st.RADIANS_PER_DEGREE};st.toDegrees=function(e){if(!c(e))throw new E("radians is required.");return e*st.DEGREES_PER_RADIAN};st.convertLongitudeRange=function(e){if(!c(e))throw new E("angle is required.");let t=st.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};st.clampToLatitudeRange=function(e){if(!c(e))throw new E("angle is required.");return st.clamp(e,-1*st.PI_OVER_TWO,st.PI_OVER_TWO)};st.negativePiToPi=function(e){if(!c(e))throw new E("angle is required.");return e>=-st.PI&&e<=st.PI?e:st.zeroToTwoPi(e+st.PI)-st.PI};st.zeroToTwoPi=function(e){if(!c(e))throw new E("angle is required.");if(e>=0&&e<=st.TWO_PI)return e;let t=st.mod(e,st.TWO_PI);return Math.abs(t)<st.EPSILON14&&Math.abs(e)>st.EPSILON14?st.TWO_PI:t};st.mod=function(e,t){if(!c(e))throw new E("m is required.");if(!c(t))throw new E("n is required.");if(t===0)throw new E("divisor cannot be 0.");return st.sign(e)===st.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};st.equalsEpsilon=function(e,t,n,i){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");n=n??0,i=i??n;let o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))};st.lessThan=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t<-n};st.lessThanOrEquals=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t<n};st.greaterThan=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t>n};st.greaterThanOrEquals=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t>-n};var CU=[1];st.factorial=function(e){if(typeof e!="number"||e<0)throw new E("A number greater than or equal to 0 is required.");let t=CU.length;if(e>=t){let n=CU[t-1];for(let i=t;i<=e;i++){let o=n*i;CU.push(o),n=o}}return CU[e]};st.incrementWrap=function(e,t,n){if(n=n??0,!c(e))throw new E("n is required.");if(t<=n)throw new E("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e};st.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0};st.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new E("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};st.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e};st.clamp=function(e,t,n){return T.typeOf.number("value",e),T.typeOf.number("min",t),T.typeOf.number("max",n),e<t?t:e>n?n:e};var hJ=new v5.default;st.setRandomNumberSeed=function(e){if(!c(e))throw new E("seed is required.");hJ=new v5.default(e)};st.nextRandomNumber=function(){return hJ.random()};st.randomBetween=function(e,t){return st.nextRandomNumber()*(t-e)+e};st.acosClamped=function(e){if(!c(e))throw new E("value is required.");return Math.acos(st.clamp(e,-1,1))};st.asinClamped=function(e){if(!c(e))throw new E("value is required.");return Math.asin(st.clamp(e,-1,1))};st.chordLength=function(e,t){if(!c(e))throw new E("angle is required.");if(!c(t))throw new E("radius is required.");return 2*t*Math.sin(e*.5)};st.logBase=function(e,t){if(!c(e))throw new E("number is required.");if(!c(t))throw new E("base is required.");return Math.log(e)/Math.log(t)};st.cbrt=Math.cbrt??function(t){let n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n};st.log2=Math.log2??function(t){return Math.log(t)*Math.LOG2E};st.fog=function(e,t){let n=e*t;return 1-Math.exp(-(n*n))};st.fastApproximateAtan=function(e){return T.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};st.fastApproximateAtan2=function(e,t){T.typeOf.number("x",e),T.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);let o=Math.max(i,n);n=Math.min(i,n);let r=n/o;if(isNaN(r))throw new E("either x or y must be nonzero");return i=st.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?st.PI_OVER_TWO-i:i,i=e<0?st.PI-i:i,i=t<0?-i:i,i};var O=st;function Je(e,t,n){this.x=e??0,this.y=t??0,this.z=n??0}Je.fromSpherical=function(e,t){T.typeOf.object("spherical",e),c(t)||(t=new Je);let n=e.clock,i=e.cone,o=e.magnitude??1,r=o*Math.sin(i);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(i),t};Je.fromElements=function(e,t,n,i){return c(i)?(i.x=e,i.y=t,i.z=n,i):new Je(e,t,n)};Je.clone=function(e,t){if(c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new Je(e.x,e.y,e.z)};Je.fromCartesian4=Je.clone;Je.packedLength=3;Je.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};Je.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new Je),n.x=e[t++],n.y=e[t++],n.z=e[t],n};Je.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*3;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)Je.pack(e[o],t,o*3);return t};Je.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new E("array length must be a multiple of 3.");let n=e.length;c(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){let o=i/3;t[o]=Je.unpack(e,i,t[o])}return t};Je.fromArray=Je.unpack;Je.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};Je.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};Je.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n};Je.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n};Je.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);let o=O.clamp(e.x,t.x,n.x),r=O.clamp(e.y,t.y,n.y),s=O.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};Je.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};Je.magnitude=function(e){return Math.sqrt(Je.magnitudeSquared(e))};var SU=new Je;Je.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),Je.subtract(e,t,SU),Je.magnitude(SU)};Je.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),Je.subtract(e,t,SU),Je.magnitudeSquared(SU)};Je.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=Je.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new E("normalized result is not a number");return t};Je.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z};Je.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};Je.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};Je.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};Je.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};Je.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};Je.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};Je.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t};Je.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var mJ=new Je;Je.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),Je.multiplyByScalar(t,n,mJ),i=Je.multiplyByScalar(e,1-n,i),Je.add(mJ,i,i)};var EU=new Je,D5=new Je;Je.angleBetween=function(e,t){T.typeOf.object("left",e),T.typeOf.object("right",t),Je.normalize(e,EU),Je.normalize(t,D5);let n=Je.dot(EU,D5),i=Je.magnitude(Je.cross(EU,D5,EU));return Math.atan2(i,n)};var DSe=new Je;Je.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=Je.normalize(e,DSe);return Je.abs(n,n),n.x<=n.y?n.x<=n.z?t=Je.clone(Je.UNIT_X,t):t=Je.clone(Je.UNIT_Z,t):n.y<=n.z?t=Je.clone(Je.UNIT_Y,t):t=Je.clone(Je.UNIT_Z,t),t};Je.projectVector=function(e,t,n){T.defined("a",e),T.defined("b",t),T.defined("result",n);let i=Je.dot(e,t)/Je.dot(t,t);return Je.multiplyByScalar(t,i,n)};Je.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};Je.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};Je.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&O.equalsEpsilon(e.x,t.x,n,i)&&O.equalsEpsilon(e.y,t.y,n,i)&&O.equalsEpsilon(e.z,t.z,n,i)};Je.cross=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,l=t.z,u=o*l-r*a,f=r*s-i*l,h=i*a-o*s;return n.x=u,n.y=f,n.z=h,n};Je.midpoint=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n};Je.fromDegrees=function(e,t,n,i,o){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),e=O.toRadians(e),t=O.toRadians(t),Je.fromRadians(e,t,n,i,o)};var gf=new Je,XA=new Je;Je._ellipsoidRadiiSquared=new Je(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);Je.fromRadians=function(e,t,n,i,o){T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),n=n??0;let r=c(i)?i.radiiSquared:Je._ellipsoidRadiiSquared,s=Math.cos(t);gf.x=s*Math.cos(e),gf.y=s*Math.sin(e),gf.z=Math.sin(t),gf=Je.normalize(gf,gf),Je.multiplyComponents(r,gf,XA);let a=Math.sqrt(Je.dot(gf,XA));return XA=Je.divideByScalar(XA,a,XA),gf=Je.multiplyByScalar(gf,n,gf),c(o)||(o=new Je),Je.add(XA,gf,o)};Je.fromDegreesArray=function(e,t,n){if(T.defined("coordinates",e),e.length<2||e.length%2!==0)throw new E("the number of coordinates must be a multiple of 2 and at least 2");let i=e.length;c(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){let r=e[o],s=e[o+1],a=o/2;n[a]=Je.fromDegrees(r,s,0,t,n[a])}return n};Je.fromRadiansArray=function(e,t,n){if(T.defined("coordinates",e),e.length<2||e.length%2!==0)throw new E("the number of coordinates must be a multiple of 2 and at least 2");let i=e.length;c(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){let r=e[o],s=e[o+1],a=o/2;n[a]=Je.fromRadians(r,s,0,t,n[a])}return n};Je.fromDegreesArrayHeights=function(e,t,n){if(T.defined("coordinates",e),e.length<3||e.length%3!==0)throw new E("the number of coordinates must be a multiple of 3 and at least 3");let i=e.length;c(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){let r=e[o],s=e[o+1],a=e[o+2],l=o/3;n[l]=Je.fromDegrees(r,s,a,t,n[l])}return n};Je.fromRadiansArrayHeights=function(e,t,n){if(T.defined("coordinates",e),e.length<3||e.length%3!==0)throw new E("the number of coordinates must be a multiple of 3 and at least 3");let i=e.length;c(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){let r=e[o],s=e[o+1],a=e[o+2],l=o/3;n[l]=Je.fromRadians(r,s,a,t,n[l])}return n};Je.ZERO=Object.freeze(new Je(0,0,0));Je.ONE=Object.freeze(new Je(1,1,1));Je.UNIT_X=Object.freeze(new Je(1,0,0));Je.UNIT_Y=Object.freeze(new Je(0,1,0));Je.UNIT_Z=Object.freeze(new Je(0,0,1));Je.prototype.clone=function(e){return Je.clone(this,e)};Je.prototype.equals=function(e){return Je.equals(this,e)};Je.prototype.equalsEpsilon=function(e,t,n){return Je.equalsEpsilon(this,e,t,n)};Je.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};var d=Je;function bt(e,t,n,i){this.x=e??0,this.y=t??0,this.z=n??0,this.w=i??0}bt.fromElements=function(e,t,n,i,o){return c(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new bt(e,t,n,i)};bt.fromColor=function(e,t){return T.typeOf.object("color",e),c(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new bt(e.red,e.green,e.blue,e.alpha)};bt.clone=function(e,t){if(c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new bt(e.x,e.y,e.z,e.w)};bt.packedLength=4;bt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};bt.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new bt),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};bt.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*4;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)bt.pack(e[o],t,o*4);return t};bt.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new E("array length must be a multiple of 4.");let n=e.length;c(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){let o=i/4;t[o]=bt.unpack(e,i,t[o])}return t};bt.fromArray=bt.unpack;bt.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)};bt.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)};bt.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n};bt.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n};bt.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);let o=O.clamp(e.x,t.x,n.x),r=O.clamp(e.y,t.y,n.y),s=O.clamp(e.z,t.z,n.z),a=O.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};bt.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};bt.magnitude=function(e){return Math.sqrt(bt.magnitudeSquared(e))};var wU=new bt;bt.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),bt.subtract(e,t,wU),bt.magnitude(wU)};bt.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),bt.subtract(e,t,wU),bt.magnitudeSquared(wU)};bt.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=bt.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new E("normalized result is not a number");return t};bt.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};bt.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n};bt.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n};bt.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};bt.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};bt.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};bt.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};bt.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};bt.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};var pJ=new bt;bt.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),bt.multiplyByScalar(t,n,pJ),i=bt.multiplyByScalar(e,1-n,i),bt.add(pJ,i,i)};var PSe=new bt;bt.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=bt.normalize(e,PSe);return bt.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=bt.clone(bt.UNIT_X,t):t=bt.clone(bt.UNIT_W,t):n.z<=n.w?t=bt.clone(bt.UNIT_Z,t):t=bt.clone(bt.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=bt.clone(bt.UNIT_Y,t):t=bt.clone(bt.UNIT_W,t):n.z<=n.w?t=bt.clone(bt.UNIT_Z,t):t=bt.clone(bt.UNIT_W,t),t};bt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};bt.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]};bt.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&O.equalsEpsilon(e.x,t.x,n,i)&&O.equalsEpsilon(e.y,t.y,n,i)&&O.equalsEpsilon(e.z,t.z,n,i)&&O.equalsEpsilon(e.w,t.w,n,i)};bt.ZERO=Object.freeze(new bt(0,0,0,0));bt.ONE=Object.freeze(new bt(1,1,1,1));bt.UNIT_X=Object.freeze(new bt(1,0,0,0));bt.UNIT_Y=Object.freeze(new bt(0,1,0,0));bt.UNIT_Z=Object.freeze(new bt(0,0,1,0));bt.UNIT_W=Object.freeze(new bt(0,0,0,1));bt.prototype.clone=function(e){return bt.clone(this,e)};bt.prototype.equals=function(e){return bt.equals(this,e)};bt.prototype.equalsEpsilon=function(e,t,n){return bt.equalsEpsilon(this,e,t,n)};bt.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};var P5=new Float32Array(1),nc=new Uint8Array(P5.buffer),ISe=new Uint32Array([287454020]),OSe=new Uint8Array(ISe.buffer),_J=OSe[0]===68;bt.packFloat=function(e,t){return T.typeOf.number("value",e),c(t)||(t=new bt),P5[0]=e,_J?(t.x=nc[0],t.y=nc[1],t.z=nc[2],t.w=nc[3]):(t.x=nc[3],t.y=nc[2],t.z=nc[1],t.w=nc[0]),t};bt.unpackFloat=function(e){return T.typeOf.object("packedFloat",e),_J?(nc[0]=e.x,nc[1]=e.y,nc[2]=e.z,nc[3]=e.w):(nc[0]=e.w,nc[1]=e.z,nc[2]=e.y,nc[3]=e.x),P5[0]};var se=bt;var I5={};I5.EMPTY_OBJECT=Object.freeze({});I5.EMPTY_ARRAY=Object.freeze([]);var W=I5;function tt(e,t,n,i,o,r,s,a,l){this[0]=e??0,this[1]=i??0,this[2]=s??0,this[3]=t??0,this[4]=o??0,this[5]=a??0,this[6]=n??0,this[7]=r??0,this[8]=l??0}tt.packedLength=9;tt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t};tt.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new tt),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n};tt.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*9;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)tt.pack(e[o],t,o*9);return t};tt.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new E("array length must be a multiple of 9.");let n=e.length;c(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){let o=i/9;t[o]=tt.unpack(e,i,t[o])}return t};tt.clone=function(e,t){if(c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new tt(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])};tt.fromArray=tt.unpack;tt.fromColumnMajorArray=function(e,t){return T.defined("values",e),tt.clone(e,t)};tt.fromRowMajorArray=function(e,t){return T.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new tt(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};tt.fromQuaternion=function(e,t){T.typeOf.object("quaternion",e);let n=e.x*e.x,i=e.x*e.y,o=e.x*e.z,r=e.x*e.w,s=e.y*e.y,a=e.y*e.z,l=e.y*e.w,u=e.z*e.z,f=e.z*e.w,h=e.w*e.w,p=n-s-u+h,g=2*(i-f),m=2*(o+l),y=2*(i+f),b=-n+s-u+h,x=2*(a-r),A=2*(o-l),C=2*(a+r),S=-n-s+u+h;return c(t)?(t[0]=p,t[1]=y,t[2]=A,t[3]=g,t[4]=b,t[5]=C,t[6]=m,t[7]=x,t[8]=S,t):new tt(p,g,m,y,b,x,A,C,S)};tt.fromHeadingPitchRoll=function(e,t){T.typeOf.object("headingPitchRoll",e);let n=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),r=Math.sin(-e.pitch),s=Math.sin(-e.heading),a=Math.sin(e.roll),l=n*i,u=-o*s+a*r*i,f=a*s+o*r*i,h=n*s,p=o*i+a*r*s,g=-a*i+o*r*s,m=-r,y=a*n,b=o*n;return c(t)?(t[0]=l,t[1]=h,t[2]=m,t[3]=u,t[4]=p,t[5]=y,t[6]=f,t[7]=g,t[8]=b,t):new tt(l,u,f,h,p,g,m,y,b)};tt.fromScale=function(e,t){return T.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new tt(e.x,0,0,0,e.y,0,0,0,e.z)};tt.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new tt(e,0,0,0,e,0,0,0,e)};tt.fromCrossProduct=function(e,t){return T.typeOf.object("vector",e),c(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new tt(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)};tt.fromRotationX=function(e,t){T.typeOf.number("angle",e);let n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new tt(1,0,0,0,n,-i,0,i,n)};tt.fromRotationY=function(e,t){T.typeOf.number("angle",e);let n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new tt(n,0,i,0,1,0,-i,0,n)};tt.fromRotationZ=function(e,t){T.typeOf.number("angle",e);let n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new tt(n,-i,0,i,n,0,0,0,1)};tt.toArray=function(e,t){return T.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]};tt.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,2),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,2),e*3+t};tt.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);let i=t*3,o=e[i],r=e[i+1],s=e[i+2];return n.x=o,n.y=r,n.z=s,n};tt.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=tt.clone(e,i);let o=t*3;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i};tt.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);let i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n};tt.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=tt.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};var RSe=new d;tt.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);let i=tt.getScale(e,RSe),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};var MSe=new d;tt.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);let i=tt.getScale(e,MSe),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};var O5=new d;tt.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],O5)),t.y=d.magnitude(d.fromElements(e[3],e[4],e[5],O5)),t.z=d.magnitude(d.fromElements(e[6],e[7],e[8],O5)),t};var gJ=new d;tt.getMaximumScale=function(e){return tt.getScale(e,gJ),d.maximumComponent(gJ)};var LSe=new d;tt.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);let i=tt.getScale(e,LSe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};var NSe=new d;tt.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=tt.getScale(e,NSe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t};tt.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],r=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],s=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],a=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],l=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],u=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],f=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=l,n[6]=u,n[7]=f,n[8]=h,n};tt.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n};tt.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n};tt.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z,s=e[0]*i+e[3]*o+e[6]*r,a=e[1]*i+e[4]*o+e[7]*r,l=e[2]*i+e[5]*o+e[8]*r;return n.x=s,n.y=a,n.z=l,n};tt.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};tt.multiplyByScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n};tt.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};tt.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t};tt.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],l=e[2],u=e[5],f=e[8];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=l,t[7]=u,t[8]=f,t};function FSe(e){let t=0;for(let n=0;n<9;++n){let i=e[n];t+=i*i}return Math.sqrt(t)}var R5=[1,0,0],M5=[2,2,1];function BSe(e){let t=0;for(let n=0;n<3;++n){let i=e[tt.getElementIndex(M5[n],R5[n])];t+=2*i*i}return Math.sqrt(t)}function kSe(e,t){let n=O.EPSILON15,i=0,o=1;for(let u=0;u<3;++u){let f=Math.abs(e[tt.getElementIndex(M5[u],R5[u])]);f>i&&(o=u,i=f)}let r=1,s=0,a=R5[o],l=M5[o];if(Math.abs(e[tt.getElementIndex(l,a)])>n){let u=e[tt.getElementIndex(l,l)],f=e[tt.getElementIndex(a,a)],h=e[tt.getElementIndex(l,a)],p=(u-f)/2/h,g;p<0?g=-1/(-p+Math.sqrt(1+p*p)):g=1/(p+Math.sqrt(1+p*p)),r=1/Math.sqrt(1+g*g),s=g*r}return t=tt.clone(tt.IDENTITY,t),t[tt.getElementIndex(a,a)]=t[tt.getElementIndex(l,l)]=r,t[tt.getElementIndex(l,a)]=s,t[tt.getElementIndex(a,l)]=-s,t}var vU=new tt,yJ=new tt;tt.computeEigenDecomposition=function(e,t){T.typeOf.object("matrix",e);let n=O.EPSILON20,i=10,o=0,r=0;c(t)||(t={});let s=t.unitary=tt.clone(tt.IDENTITY,t.unitary),a=t.diagonal=tt.clone(e,t.diagonal),l=n*FSe(a);for(;r<i&&BSe(a)>l;)kSe(a,vU),tt.transpose(vU,yJ),tt.multiply(a,vU,a),tt.multiply(yJ,a,a),tt.multiply(s,vU,s),++o>2&&(++r,o=0);return t};tt.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t};tt.determinant=function(e){T.typeOf.object("matrix",e);let t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],l=e[5],u=e[8];return t*(r*u-l*s)+o*(l*i-n*u)+a*(n*s-r*i)};tt.inverse=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],l=e[6],u=e[7],f=e[8],h=tt.determinant(e);if(Math.abs(h)<=O.EPSILON15)throw new E("matrix is not invertible");t[0]=s*f-u*a,t[1]=u*o-i*f,t[2]=i*a-s*o,t[3]=l*a-r*f,t[4]=n*f-l*o,t[5]=r*o-n*a,t[6]=r*u-l*s,t[7]=l*i-n*u,t[8]=n*s-r*i;let p=1/h;return tt.multiplyByScalar(t,p,t)};var USe=new tt;tt.inverseTranspose=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),tt.inverse(tt.transpose(e,USe),t)};tt.equals=function(e,t){return e===t||c(e)&&c(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]};tt.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n};tt.IDENTITY=Object.freeze(new tt(1,0,0,0,1,0,0,0,1));tt.ZERO=Object.freeze(new tt(0,0,0,0,0,0,0,0,0));tt.COLUMN0ROW0=0;tt.COLUMN0ROW1=1;tt.COLUMN0ROW2=2;tt.COLUMN1ROW0=3;tt.COLUMN1ROW1=4;tt.COLUMN1ROW2=5;tt.COLUMN2ROW0=6;tt.COLUMN2ROW1=7;tt.COLUMN2ROW2=8;Object.defineProperties(tt.prototype,{length:{get:function(){return tt.packedLength}}});tt.prototype.clone=function(e){return tt.clone(this,e)};tt.prototype.equals=function(e){return tt.equals(this,e)};tt.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]};tt.prototype.equalsEpsilon=function(e,t){return tt.equalsEpsilon(this,e,t)};tt.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
(${this[1]}, ${this[4]}, ${this[7]})
(${this[2]}, ${this[5]}, ${this[8]})`};var J=tt;function lv(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(lv.prototype=Object.create(Error.prototype),lv.prototype.constructor=lv);lv.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=`
${this.stack.toString()}`),e};var ae=lv;function et(e,t,n,i,o,r,s,a,l,u,f,h,p,g,m,y){this[0]=e??0,this[1]=o??0,this[2]=l??0,this[3]=p??0,this[4]=t??0,this[5]=r??0,this[6]=u??0,this[7]=g??0,this[8]=n??0,this[9]=s??0,this[10]=f??0,this[11]=m??0,this[12]=i??0,this[13]=a??0,this[14]=h??0,this[15]=y??0}et.packedLength=16;et.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t};et.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new et),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n};et.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*16;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)et.pack(e[o],t,o*16);return t};et.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new E("array length must be a multiple of 16.");let n=e.length;c(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){let o=i/16;t[o]=et.unpack(e,i,t[o])}return t};et.clone=function(e,t){if(c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new et(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])};et.fromArray=et.unpack;et.fromColumnMajorArray=function(e,t){return T.defined("values",e),et.clone(e,t)};et.fromRowMajorArray=function(e,t){return T.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new et(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])};et.fromRotationTranslation=function(e,t,n){return T.typeOf.object("rotation",e),t=t??d.ZERO,c(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new et(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)};et.fromTranslationQuaternionRotationScale=function(e,t,n,i){T.typeOf.object("translation",e),T.typeOf.object("rotation",t),T.typeOf.object("scale",n),c(i)||(i=new et);let o=n.x,r=n.y,s=n.z,a=t.x*t.x,l=t.x*t.y,u=t.x*t.z,f=t.x*t.w,h=t.y*t.y,p=t.y*t.z,g=t.y*t.w,m=t.z*t.z,y=t.z*t.w,b=t.w*t.w,x=a-h-m+b,A=2*(l-y),C=2*(u+g),S=2*(l+y),v=-a+h-m+b,P=2*(p-f),M=2*(u-g),R=2*(p+f),L=-a-h+m+b;return i[0]=x*o,i[1]=S*o,i[2]=M*o,i[3]=0,i[4]=A*r,i[5]=v*r,i[6]=R*r,i[7]=0,i[8]=C*s,i[9]=P*s,i[10]=L*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};et.fromTranslationRotationScale=function(e,t){return T.typeOf.object("translationRotationScale",e),et.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};et.fromTranslation=function(e,t){return T.typeOf.object("translation",e),et.fromRotationTranslation(J.IDENTITY,e,t)};et.fromScale=function(e,t){return T.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new et(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};et.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new et(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};et.fromRotation=function(e,t){return T.typeOf.object("rotation",e),c(t)||(t=new et),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};var KA=new d,$A=new d,uv=new d;et.fromCamera=function(e,t){T.typeOf.object("camera",e);let n=e.position,i=e.direction,o=e.up;T.typeOf.object("camera.position",n),T.typeOf.object("camera.direction",i),T.typeOf.object("camera.up",o),d.normalize(i,KA),d.normalize(d.cross(KA,o,$A),$A),d.normalize(d.cross($A,KA,uv),uv);let r=$A.x,s=$A.y,a=$A.z,l=KA.x,u=KA.y,f=KA.z,h=uv.x,p=uv.y,g=uv.z,m=n.x,y=n.y,b=n.z,x=r*-m+s*-y+a*-b,A=h*-m+p*-y+g*-b,C=l*m+u*y+f*b;return c(t)?(t[0]=r,t[1]=h,t[2]=-l,t[3]=0,t[4]=s,t[5]=p,t[6]=-u,t[7]=0,t[8]=a,t[9]=g,t[10]=-f,t[11]=0,t[12]=x,t[13]=A,t[14]=C,t[15]=1,t):new et(r,s,a,x,h,p,g,A,-l,-u,-f,C,0,0,0,1)};et.computePerspectiveFieldOfView=function(e,t,n,i,o){T.typeOf.number.greaterThan("fovY",e,0),T.typeOf.number.lessThan("fovY",e,Math.PI),T.typeOf.number.greaterThan("near",n,0),T.typeOf.number.greaterThan("far",i,0),T.typeOf.object("result",o);let s=1/Math.tan(e*.5),a=s/t,l=(i+n)/(n-i),u=2*i*n/(n-i);return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=l,o[11]=-1,o[12]=0,o[13]=0,o[14]=u,o[15]=0,o};et.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.number("far",r),T.typeOf.object("result",s);let a=1/(t-e),l=1/(i-n),u=1/(r-o),f=-(t+e)*a,h=-(i+n)*l,p=-(r+o)*u;return a*=2,l*=2,u*=-2,s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=u,s[11]=0,s[12]=f,s[13]=h,s[14]=p,s[15]=1,s};et.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.number("far",r),T.typeOf.object("result",s);let a=2*o/(t-e),l=2*o/(i-n),u=(t+e)/(t-e),f=(i+n)/(i-n),h=-(r+o)/(r-o),p=-1,g=-2*r*o/(r-o);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=u,s[9]=f,s[10]=h,s[11]=p,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};et.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.object("result",r);let s=2*o/(t-e),a=2*o/(i-n),l=(t+e)/(t-e),u=(i+n)/(i-n),f=-1,h=-1,p=-2*o;return r[0]=s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=l,r[9]=u,r[10]=f,r[11]=h,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r};et.computeViewportTransformation=function(e,t,n,i){c(i)||(i=new et),e=e??W.EMPTY_OBJECT;let o=e.x??0,r=e.y??0,s=e.width??0,a=e.height??0;t=t??0,n=n??1;let l=s*.5,u=a*.5,f=(n-t)*.5,h=l,p=u,g=f,m=o+l,y=r+u,b=t+f,x=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=g,i[11]=0,i[12]=m,i[13]=y,i[14]=b,i[15]=x,i};et.computeView=function(e,t,n,i,o){return T.typeOf.object("position",e),T.typeOf.object("direction",t),T.typeOf.object("up",n),T.typeOf.object("right",i),T.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-d.dot(i,e),o[13]=-d.dot(n,e),o[14]=d.dot(t,e),o[15]=1,o};et.toArray=function(e,t){return T.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]};et.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,3),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,3),e*4+t};et.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("result",n);let i=t*4,o=e[i],r=e[i+1],s=e[i+2],a=e[i+3];return n.x=o,n.y=r,n.z=s,n.w=a,n};et.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=et.clone(e,i);let o=t*4;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w,i};et.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("result",n);let i=e[t],o=e[t+4],r=e[t+8],s=e[t+12];return n.x=i,n.y=o,n.z=r,n.w=s,n};et.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=et.clone(e,i),i[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};et.setTranslation=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("translation",t),T.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};var VSe=new d;et.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);let i=et.getScale(e,VSe),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};var zSe=new d;et.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);let i=et.getScale(e,zSe),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};var L5=new d;et.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],L5)),t.y=d.magnitude(d.fromElements(e[4],e[5],e[6],L5)),t.z=d.magnitude(d.fromElements(e[8],e[9],e[10],L5)),t};var bJ=new d;et.getMaximumScale=function(e){return et.getScale(e,bJ),d.maximumComponent(bJ)};var HSe=new d;et.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);let i=et.getScale(e,HSe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=e[3],n[4]=t[3]*i.y,n[5]=t[4]*i.y,n[6]=t[5]*i.y,n[7]=e[7],n[8]=t[6]*i.z,n[9]=t[7]*i.z,n[10]=t[8]*i.z,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};var GSe=new d;et.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=et.getScale(e,GSe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[4]/n.y,t[4]=e[5]/n.y,t[5]=e[6]/n.y,t[6]=e[8]/n.z,t[7]=e[9]/n.z,t[8]=e[10]/n.z,t};et.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],f=e[7],h=e[8],p=e[9],g=e[10],m=e[11],y=e[12],b=e[13],x=e[14],A=e[15],C=t[0],S=t[1],v=t[2],P=t[3],M=t[4],R=t[5],L=t[6],F=t[7],_=t[8],w=t[9],D=t[10],I=t[11],N=t[12],k=t[13],z=t[14],V=t[15],j=i*C+a*S+h*v+y*P,U=o*C+l*S+p*v+b*P,q=r*C+u*S+g*v+x*P,Y=s*C+f*S+m*v+A*P,te=i*M+a*R+h*L+y*F,K=o*M+l*R+p*L+b*F,Z=r*M+u*R+g*L+x*F,ee=s*M+f*R+m*L+A*F,me=i*_+a*w+h*D+y*I,Te=o*_+l*w+p*D+b*I,ue=r*_+u*w+g*D+x*I,ye=s*_+f*w+m*D+A*I,Ae=i*N+a*k+h*z+y*V,Pe=o*N+l*k+p*z+b*V,Ee=r*N+u*k+g*z+x*V,ze=s*N+f*k+m*z+A*V;return n[0]=j,n[1]=U,n[2]=q,n[3]=Y,n[4]=te,n[5]=K,n[6]=Z,n[7]=ee,n[8]=me,n[9]=Te,n[10]=ue,n[11]=ye,n[12]=Ae,n[13]=Pe,n[14]=Ee,n[15]=ze,n};et.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n};et.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n};et.multiplyTransformation=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],l=e[6],u=e[8],f=e[9],h=e[10],p=e[12],g=e[13],m=e[14],y=t[0],b=t[1],x=t[2],A=t[4],C=t[5],S=t[6],v=t[8],P=t[9],M=t[10],R=t[12],L=t[13],F=t[14],_=i*y+s*b+u*x,w=o*y+a*b+f*x,D=r*y+l*b+h*x,I=i*A+s*C+u*S,N=o*A+a*C+f*S,k=r*A+l*C+h*S,z=i*v+s*P+u*M,V=o*v+a*P+f*M,j=r*v+l*P+h*M,U=i*R+s*L+u*F+p,q=o*R+a*L+f*F+g,Y=r*R+l*L+h*F+m;return n[0]=_,n[1]=w,n[2]=D,n[3]=0,n[4]=I,n[5]=N,n[6]=k,n[7]=0,n[8]=z,n[9]=V,n[10]=j,n[11]=0,n[12]=U,n[13]=q,n[14]=Y,n[15]=1,n};et.multiplyByMatrix3=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("rotation",t),T.typeOf.object("result",n);let i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],l=e[6],u=e[8],f=e[9],h=e[10],p=t[0],g=t[1],m=t[2],y=t[3],b=t[4],x=t[5],A=t[6],C=t[7],S=t[8],v=i*p+s*g+u*m,P=o*p+a*g+f*m,M=r*p+l*g+h*m,R=i*y+s*b+u*x,L=o*y+a*b+f*x,F=r*y+l*b+h*x,_=i*A+s*C+u*S,w=o*A+a*C+f*S,D=r*A+l*C+h*S;return n[0]=v,n[1]=P,n[2]=M,n[3]=0,n[4]=R,n[5]=L,n[6]=F,n[7]=0,n[8]=_,n[9]=w,n[10]=D,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};et.multiplyByTranslation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("translation",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z,s=i*e[0]+o*e[4]+r*e[8]+e[12],a=i*e[1]+o*e[5]+r*e[9]+e[13],l=i*e[2]+o*e[6]+r*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=s,n[13]=a,n[14]=l,n[15]=e[15],n};et.multiplyByScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z;return i===1&&o===1&&r===1?et.clone(e,n):(n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=e[3],n[4]=o*e[4],n[5]=o*e[5],n[6]=o*e[6],n[7]=e[7],n[8]=r*e[8],n[9]=r*e[9],n[10]=r*e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n)};et.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};et.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z,s=t.w,a=e[0]*i+e[4]*o+e[8]*r+e[12]*s,l=e[1]*i+e[5]*o+e[9]*r+e[13]*s,u=e[2]*i+e[6]*o+e[10]*r+e[14]*s,f=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=l,n.z=u,n.w=f,n};et.multiplyByPointAsVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r,a=e[1]*i+e[5]*o+e[9]*r,l=e[2]*i+e[6]*o+e[10]*r;return n.x=s,n.y=a,n.z=l,n};et.multiplyByPoint=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);let i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r+e[12],a=e[1]*i+e[5]*o+e[9]*r+e[13],l=e[2]*i+e[6]*o+e[10]*r+e[14];return n.x=s,n.y=a,n.z=l,n};et.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n};et.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t};et.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[1],i=e[2],o=e[3],r=e[6],s=e[7],a=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=r,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=s,t[14]=a,t[15]=e[15],t};et.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t};et.equals=function(e,t){return e===t||c(e)&&c(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]};et.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n};et.getTranslation=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t};et.getMatrix3=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};var jSe=new J,WSe=new J,qSe=new se,YSe=new se(0,0,0,1);et.inverse=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],l=e[9],u=e[13],f=e[2],h=e[6],p=e[10],g=e[14],m=e[3],y=e[7],b=e[11],x=e[15],A=p*x,C=g*b,S=h*x,v=g*y,P=h*b,M=p*y,R=f*x,L=g*m,F=f*b,_=p*m,w=f*y,D=h*m,I=A*a+v*l+P*u-(C*a+S*l+M*u),N=C*s+R*l+_*u-(A*s+L*l+F*u),k=S*s+L*a+w*u-(v*s+R*a+D*u),z=M*s+F*a+D*l-(P*s+_*a+w*l),V=C*i+S*o+M*r-(A*i+v*o+P*r),j=A*n+L*o+F*r-(C*n+R*o+_*r),U=v*n+R*i+D*r-(S*n+L*i+w*r),q=P*n+_*i+w*o-(M*n+F*i+D*o);A=o*u,C=r*l,S=i*u,v=r*a,P=i*l,M=o*a,R=n*u,L=r*s,F=n*l,_=o*s,w=n*a,D=i*s;let Y=A*y+v*b+P*x-(C*y+S*b+M*x),te=C*m+R*b+_*x-(A*m+L*b+F*x),K=S*m+L*y+w*x-(v*m+R*y+D*x),Z=M*m+F*y+D*b-(P*m+_*y+w*b),ee=S*p+M*g+C*h-(P*g+A*h+v*p),me=F*g+A*f+L*p-(R*p+_*g+C*f),Te=R*h+D*g+v*f-(w*g+S*f+L*h),ue=w*p+P*f+_*h-(F*h+D*p+M*f),ye=n*I+i*N+o*k+r*z;if(Math.abs(ye)<O.EPSILON21){if(J.equalsEpsilon(et.getMatrix3(e,jSe),WSe,O.EPSILON7)&&se.equals(et.getRow(e,3,qSe),YSe))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;throw new ae("matrix is not invertible because its determinate is zero.")}return ye=1/ye,t[0]=I*ye,t[1]=N*ye,t[2]=k*ye,t[3]=z*ye,t[4]=V*ye,t[5]=j*ye,t[6]=U*ye,t[7]=q*ye,t[8]=Y*ye,t[9]=te*ye,t[10]=K*ye,t[11]=Z*ye,t[12]=ee*ye,t[13]=me*ye,t[14]=Te*ye,t[15]=ue*ye,t};et.inverseTransformation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],l=e[8],u=e[9],f=e[10],h=e[12],p=e[13],g=e[14],m=-n*h-i*p-o*g,y=-r*h-s*p-a*g,b=-l*h-u*p-f*g;return t[0]=n,t[1]=r,t[2]=l,t[3]=0,t[4]=i,t[5]=s,t[6]=u,t[7]=0,t[8]=o,t[9]=a,t[10]=f,t[11]=0,t[12]=m,t[13]=y,t[14]=b,t[15]=1,t};var XSe=new et;et.inverseTranspose=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),et.inverse(et.transpose(e,XSe),t)};et.IDENTITY=Object.freeze(new et(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1));et.ZERO=Object.freeze(new et(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));et.COLUMN0ROW0=0;et.COLUMN0ROW1=1;et.COLUMN0ROW2=2;et.COLUMN0ROW3=3;et.COLUMN1ROW0=4;et.COLUMN1ROW1=5;et.COLUMN1ROW2=6;et.COLUMN1ROW3=7;et.COLUMN2ROW0=8;et.COLUMN2ROW1=9;et.COLUMN2ROW2=10;et.COLUMN2ROW3=11;et.COLUMN3ROW0=12;et.COLUMN3ROW1=13;et.COLUMN3ROW2=14;et.COLUMN3ROW3=15;Object.defineProperties(et.prototype,{length:{get:function(){return et.packedLength}}});et.prototype.clone=function(e){return et.clone(this,e)};et.prototype.equals=function(e){return et.equals(this,e)};et.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]};et.prototype.equalsEpsilon=function(e,t){return et.equalsEpsilon(this,e,t)};et.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};var B=et;var KSe={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047},ne=Object.freeze(KSe);var $Se=new d;function wt(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}var ua={};ua[ne.FLOAT]="float";ua[ne.FLOAT_VEC2]="vec2";ua[ne.FLOAT_VEC3]="vec3";ua[ne.FLOAT_VEC4]="vec4";ua[ne.INT]="int";ua[ne.INT_VEC2]="ivec2";ua[ne.INT_VEC3]="ivec3";ua[ne.INT_VEC4]="ivec4";ua[ne.BOOL]="bool";ua[ne.BOOL_VEC2]="bvec2";ua[ne.BOOL_VEC3]="bvec3";ua[ne.BOOL_VEC4]="bvec4";ua[ne.FLOAT_MAT2]="mat2";ua[ne.FLOAT_MAT3]="mat3";ua[ne.FLOAT_MAT4]="mat4";ua[ne.SAMPLER_2D]="sampler2D";ua[ne.SAMPLER_CUBE]="samplerCube";wt.prototype.getDeclaration=function(e){let t=`uniform ${ua[this._datatype]} ${e}`,n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};var ZSe={czm_viewport:new wt({size:1,datatype:ne.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new wt({size:1,datatype:ne.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new wt({size:1,datatype:ne.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_eyeEllipsoidNormalEC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.eyeEllipsoidNormalEC}}),czm_eyeEllipsoidCurvature:new wt({size:1,datatype:ne.FLOAT_VEC2,getValue:function(e){return e.eyeEllipsoidCurvature}}),czm_modelToEnu:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.modelToEnu}}),czm_enuToModel:new wt({size:1,datatype:ne.FLOAT_MAT4,getValue:function(e){return e.enuToModel}}),czm_entireFrustum:new wt({size:1,datatype:ne.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new wt({size:1,datatype:ne.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new wt({size:1,datatype:ne.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return B.getTranslation(e.inverseView,$Se)}}),czm_frameNumber:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new wt({size:1,datatype:ne.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new wt({size:1,datatype:ne.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new wt({size:1,datatype:ne.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new wt({size:1,datatype:ne.SAMPLER_CUBE,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapsMaximumLOD:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new wt({size:9,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new wt({size:1,datatype:ne.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.fogDensity}}),czm_fogVisualDensityScalar:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.fogVisualDensityScalar}}),czm_fogMinimumBrightness:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.fogMinimumBrightness}}),czm_atmosphereHsbShift:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.atmosphereHsbShift}}),czm_atmosphereLightIntensity:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.atmosphereLightIntensity}}),czm_atmosphereRayleighCoefficient:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.atmosphereRayleighCoefficient}}),czm_atmosphereRayleighScaleHeight:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.atmosphereRayleighScaleHeight}}),czm_atmosphereMieCoefficient:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.atmosphereMieCoefficient}}),czm_atmosphereMieScaleHeight:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.atmosphereMieScaleHeight}}),czm_atmosphereMieAnisotropy:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.atmosphereMieAnisotropy}}),czm_atmosphereDynamicLighting:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.atmosphereDynamicLighting}}),czm_splitPosition:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new wt({size:1,datatype:ne.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new wt({size:1,datatype:ne.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new wt({size:1,datatype:ne.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},Ap=ZSe;function QSe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var jn=QSe;function JSe(){return!0}function ewe(e,t){t=t??"This object was destroyed, i.e., destroy() was called.";function n(){throw new E(t)}for(let i in e)typeof e[i]=="function"&&(e[i]=n);e.isDestroyed=JSe}var de=ewe;var Vs={UNSIGNED_BYTE:ne.UNSIGNED_BYTE,UNSIGNED_SHORT:ne.UNSIGNED_SHORT,UNSIGNED_INT:ne.UNSIGNED_INT};Vs.getSizeInBytes=function(e){switch(e){case Vs.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Vs.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Vs.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new E("indexDatatype is required and must be a valid IndexDatatype constant.")};Vs.fromSizeInBytes=function(e){switch(e){case 2:return Vs.UNSIGNED_SHORT;case 4:return Vs.UNSIGNED_INT;case 1:return Vs.UNSIGNED_BYTE;default:throw new E("Size in bytes cannot be mapped to an IndexDatatype")}};Vs.validate=function(e){return c(e)&&(e===Vs.UNSIGNED_BYTE||e===Vs.UNSIGNED_SHORT||e===Vs.UNSIGNED_INT)};Vs.createTypedArray=function(e,t){if(!c(e))throw new E("numberOfVertices is required.");return e>=O.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};Vs.createTypedArrayFromArrayBuffer=function(e,t,n,i){if(!c(e))throw new E("numberOfVertices is required.");if(!c(t))throw new E("sourceArray is required.");if(!c(n))throw new E("byteOffset is required.");return e>=O.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};Vs.fromTypedArray=function(e){if(e instanceof Uint8Array)return Vs.UNSIGNED_BYTE;if(e instanceof Uint16Array)return Vs.UNSIGNED_SHORT;if(e instanceof Uint32Array)return Vs.UNSIGNED_INT;throw new E("array must be a Uint8Array, Uint16Array, or Uint32Array.")};var Fe=Object.freeze(Vs);var DU={STREAM_DRAW:ne.STREAM_DRAW,STATIC_DRAW:ne.STATIC_DRAW,DYNAMIC_DRAW:ne.DYNAMIC_DRAW,validate:function(e){return e===DU.STREAM_DRAW||e===DU.STATIC_DRAW||e===DU.DYNAMIC_DRAW}},Be=Object.freeze(DU);function yf(e){if(e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context),!c(e.typedArray)&&!c(e.sizeInBytes))throw new E("Either options.sizeInBytes or options.typedArray is required.");if(c(e.typedArray)&&c(e.sizeInBytes))throw new E("Cannot pass in both options.sizeInBytes and options.typedArray.");if(c(e.typedArray)&&(T.typeOf.object("options.typedArray",e.typedArray),T.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!Be.validate(e.usage))throw new E("usage is invalid.");let t=e.context._gl,n=e.bufferTarget,i=e.typedArray,o=e.sizeInBytes,r=e.usage,s=c(i);s&&(o=i.byteLength),T.typeOf.number.greaterThan("sizeInBytes",o,0);let a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=jn(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}yf.createVertexBuffer=function(e){return T.defined("options.context",e.context),new yf({context:e.context,bufferTarget:ne.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};yf.createIndexBuffer=function(e){if(T.defined("options.context",e.context),!Fe.validate(e.indexDatatype))throw new E("Invalid indexDatatype.");if(e.indexDatatype===Fe.UNSIGNED_INT&&!e.context.elementIndexUint)throw new E("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.  Check context.elementIndexUint.");let t=e.context,n=e.indexDatatype,i=Fe.getSizeInBytes(n),o=new yf({context:t,bufferTarget:ne.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o};Object.defineProperties(yf.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});yf.prototype._getBuffer=function(){return this._buffer};yf.prototype.copyFromArrayView=function(e,t){t=t??0,T.defined("arrayView",e),T.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);let n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};yf.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new E("A WebGL 2 context is required.");if(!c(e))throw new E("readBuffer must be defined.");if(!c(i)||i<=0)throw new E("sizeInBytes must be defined and be greater than zero.");if(!c(t)||t<0||t+i>e._sizeInBytes)throw new E("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!c(n)||n<0||n+i>this._sizeInBytes)throw new E("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&n<t+i||t>n&&t<n+i))throw new E("When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.");if(this._bufferTarget===ne.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==ne.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==ne.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===ne.ELEMENT_ARRAY_BUFFER)throw new E("Can not copy an index buffer into another buffer type.");let o=ne.COPY_READ_BUFFER,r=ne.COPY_WRITE_BUFFER,s=this._gl;s.bindBuffer(r,this._buffer),s.bindBuffer(o,e._buffer),s.copyBufferSubData(o,r,t,n,i),s.bindBuffer(r,null),s.bindBuffer(o,null)};yf.prototype.getBufferData=function(e,t,n,i){if(t=t??0,n=n??0,!this._webgl2)throw new E("A WebGL 2 context is required.");if(!c(e))throw new E("arrayView is required.");let o,r,s=e.byteLength;if(c(i)?(o=i,c(s)?r=1:(s=e.length,r=e.BYTES_PER_ELEMENT)):c(s)?(o=s-n,r=1):(s=e.length,o=s-n,r=e.BYTES_PER_ELEMENT),n<0||n>s)throw new E("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new E("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new E("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new E("sourceOffset + length must be less than the buffers size.");let a=this._gl,l=ne.COPY_READ_BUFFER;a.bindBuffer(l,this._buffer),a.getBufferSubData(l,t,e,n,i),a.bindBuffer(l,null)};yf.prototype.isDestroyed=function(){return!1};yf.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),de(this)};var yt=yf;var Fg,Br={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},vl={};Object.defineProperties(vl,{element:{get:function(){if(vl.supportsFullscreen())return document[Br.fullscreenElement]}},changeEventName:{get:function(){if(vl.supportsFullscreen())return Br.fullscreenchange}},errorEventName:{get:function(){if(vl.supportsFullscreen())return Br.fullscreenerror}},enabled:{get:function(){if(vl.supportsFullscreen())return document[Br.fullscreenEnabled]}},fullscreen:{get:function(){if(vl.supportsFullscreen())return vl.element!==null}}});vl.supportsFullscreen=function(){if(c(Fg))return Fg;Fg=!1;let e=document.body;if(typeof e.requestFullscreen=="function")return Br.requestFullscreen="requestFullscreen",Br.exitFullscreen="exitFullscreen",Br.fullscreenEnabled="fullscreenEnabled",Br.fullscreenElement="fullscreenElement",Br.fullscreenchange="fullscreenchange",Br.fullscreenerror="fullscreenerror",Fg=!0,Fg;let t=["webkit","moz","o","ms","khtml"],n;for(let i=0,o=t.length;i<o;++i){let r=t[i];n=`${r}RequestFullscreen`,typeof e[n]=="function"?(Br.requestFullscreen=n,Fg=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(Br.requestFullscreen=n,Fg=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?Br.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(Br.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?Br.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(Br.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?Br.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(Br.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),Br.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),Br.fullscreenerror=n)}return Fg};vl.requestFullscreen=function(e,t){vl.supportsFullscreen()&&e[Br.requestFullscreen]({vrDisplay:t})};vl.exitFullscreen=function(){vl.supportsFullscreen()&&document[Br.exitFullscreen]()};vl._names=Br;var Cr=vl;var oc;typeof navigator<"u"?oc=navigator:oc={};function ib(e){let t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}var PU,xJ;function V5(){if(!c(PU)&&(PU=!1,!NU())){let e=/ Chrome\/([\.0-9]+)/.exec(oc.userAgent);e!==null&&(PU=!0,xJ=ib(e[1]))}return PU}function twe(){return V5()&&xJ}var IU,TJ;function AJ(){if(!c(IU)&&(IU=!1,!V5()&&!NU()&&/ Safari\/[\.0-9]+/.test(oc.userAgent))){let e=/ Version\/([\.0-9]+)/.exec(oc.userAgent);e!==null&&(IU=!0,TJ=ib(e[1]))}return IU}function nwe(){return AJ()&&TJ}var OU,k5;function CJ(){if(!c(OU)){OU=!1;let e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(oc.userAgent);e!==null&&(OU=!0,k5=ib(e[1]),k5.isNightly=!!e[2])}return OU}function iwe(){return CJ()&&k5}var fv,U5;function EJ(){if(!c(fv)){fv=!1;let e;oc.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(oc.userAgent),e!==null&&(fv=!0,U5=ib(e[1]))):oc.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(oc.userAgent),e!==null&&(fv=!0,U5=ib(e[1])))}return fv}function owe(){return EJ()&&U5}var RU,SJ;function NU(){if(!c(RU)){RU=!1;let e=/ Edg\/([\.0-9]+)/.exec(oc.userAgent);e!==null&&(RU=!0,SJ=ib(e[1]))}return RU}function rwe(){return NU()&&SJ}var MU,z5;function FU(){if(!c(MU)){MU=!1;let e=/Firefox\/([\.0-9]+)/.exec(oc.userAgent);e!==null&&(MU=!0,z5=ib(e[1]))}return MU}var N5;function swe(){return c(N5)||(N5=/Windows/i.test(oc.appVersion)),N5}var F5;function awe(){return c(F5)||(F5=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),F5}function cwe(){return FU()&&z5}var B5;function lwe(){return c(B5)||(B5=!FU()&&typeof PointerEvent<"u"&&(!c(oc.pointerEnabled)||oc.pointerEnabled)),B5}var wJ,LU;function vJ(){if(!c(LU)){let e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");let t=e.style.imageRendering;LU=c(t)&&t!=="",LU&&(wJ=t)}return LU}function uwe(){return vJ()?wJ:void 0}function ic(){if(!ic.initialized)throw new E("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return ic._result}ic._promise=void 0;ic._result=void 0;ic.initialize=function(){return c(ic._promise)||(ic._promise=new Promise(e=>{let t=new Image;t.onload=function(){ic._result=t.width>0&&t.height>0,e(ic._result)},t.onerror=function(){ic._result=!1,e(ic._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),ic._promise};Object.defineProperties(ic,{initialized:{get:function(){return c(ic._result)}}});var ZA=[];typeof ArrayBuffer<"u"&&(ZA.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&ZA.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&ZA.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&ZA.push(BigInt64Array),typeof BigUint64Array<"u"&&ZA.push(BigUint64Array));var bf={isChrome:V5,chromeVersion:twe,isSafari:AJ,safariVersion:nwe,isWebkit:CJ,webkitVersion:iwe,isInternetExplorer:EJ,internetExplorerVersion:owe,isEdge:NU,edgeVersion:rwe,isFirefox:FU,firefoxVersion:cwe,isWindows:swe,isIPadOrIOS:awe,hardwareConcurrency:oc.hardwareConcurrency??3,supportsPointerEvents:lwe,supportsImageRenderingPixelated:vJ,supportsWebP:ic,imageRenderingValue:uwe,typedArrayTypes:ZA};bf.supportsBasis=function(e){return bf.supportsWebAssembly()&&e.context.supportsBasis};bf.supportsFullscreen=function(){return Cr.supportsFullscreen()};bf.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};bf.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};bf.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};bf.supportsBigInt=function(){return typeof BigInt<"u"};bf.supportsWebWorkers=function(){return typeof Worker<"u"};bf.supportsWebAssembly=function(){return typeof WebAssembly<"u"};bf.supportsWebgl2=function(e){return T.defined("scene",e),e.context.webgl2};bf.supportsEsmWebWorkers=function(){return!FU()||parseInt(z5)>=114};var Vt=bf;function H5(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n*6<1?e+(t-e)*6*n:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function re(e,t,n,i){this.red=e??1,this.green=t??1,this.blue=n??1,this.alpha=i??1}re.fromCartesian4=function(e,t){return T.typeOf.object("cartesian",e),c(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new re(e.x,e.y,e.z,e.w)};re.fromBytes=function(e,t,n,i,o){return e=re.byteToFloat(e??255),t=re.byteToFloat(t??255),n=re.byteToFloat(n??255),i=re.byteToFloat(i??255),c(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new re(e,t,n,i)};re.fromAlpha=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("alpha",t),c(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new re(e.red,e.green,e.blue,t)};var G5,j5,Cp;Vt.supportsTypedArrays()&&(G5=new ArrayBuffer(4),j5=new Uint32Array(G5),Cp=new Uint8Array(G5));re.fromRgba=function(e,t){return j5[0]=e,re.fromBytes(Cp[0],Cp[1],Cp[2],Cp[3],t)};re.fromHsl=function(e,t,n,i,o){e=(e??0)%1,t=t??0,n=n??0,i=i??1;let r=n,s=n,a=n;if(t!==0){let l;n<.5?l=n*(1+t):l=n+t-n*t;let u=2*n-l;r=H5(u,l,e+1/3),s=H5(u,l,e),a=H5(u,l,e-1/3)}return c(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new re(r,s,a,i)};re.fromRandom=function(e,t){e=e??W.EMPTY_OBJECT;let n=e.red;if(!c(n)){let s=e.minimumRed??0,a=e.maximumRed??1;T.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+O.nextRandomNumber()*(a-s)}let i=e.green;if(!c(i)){let s=e.minimumGreen??0,a=e.maximumGreen??1;T.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+O.nextRandomNumber()*(a-s)}let o=e.blue;if(!c(o)){let s=e.minimumBlue??0,a=e.maximumBlue??1;T.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+O.nextRandomNumber()*(a-s)}let r=e.alpha;if(!c(r)){let s=e.minimumAlpha??0,a=e.maximumAlpha??1;T.typeOf.number.lessThanOrEquals("minimumAlpha",s,a),r=s+O.nextRandomNumber()*(a-s)}return c(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new re(n,i,o,r)};var fwe=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,dwe=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,hwe=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,mwe=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;re.fromCssColorString=function(e,t){T.typeOf.string("color",e),c(t)||(t=new re),e=e.trim();let n=re[e.toUpperCase()];if(c(n))return re.clone(n,t),t;let i=fwe.exec(e);return i!==null?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(i[4]??"f",16)/15,t):(i=dwe.exec(e),i!==null?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(i[4]??"ff",16)/255,t):(i=hwe.exec(e),i!==null?(t.red=parseFloat(i[1])/(i[1].substr(-1)==="%"?100:255),t.green=parseFloat(i[2])/(i[2].substr(-1)==="%"?100:255),t.blue=parseFloat(i[3])/(i[3].substr(-1)==="%"?100:255),t.alpha=parseFloat(i[4]??"1.0"),t):(i=mwe.exec(e),i!==null?re.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(i[4]??"1.0"),t):(t=void 0,t))))};re.packedLength=4;re.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};re.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new re),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};re.byteToFloat=function(e){return e/255};re.floatToByte=function(e){return e===1?255:e*256|0};re.clone=function(e,t){if(c(e))return c(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new re(e.red,e.green,e.blue,e.alpha)};re.equals=function(e,t){return e===t||c(e)&&c(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};re.equalsArray=function(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]};re.prototype.clone=function(e){return re.clone(this,e)};re.prototype.equals=function(e){return re.equals(this,e)};re.prototype.equalsEpsilon=function(e,t){return this===e||c(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t};re.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};re.prototype.toCssColorString=function(){let e=re.floatToByte(this.red),t=re.floatToByte(this.green),n=re.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};re.prototype.toCssHexString=function(){let e=re.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=re.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=re.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=re.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};re.prototype.toBytes=function(e){let t=re.floatToByte(this.red),n=re.floatToByte(this.green),i=re.floatToByte(this.blue),o=re.floatToByte(this.alpha);return c(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};re.prototype.toRgba=function(){return Cp[0]=re.floatToByte(this.red),Cp[1]=re.floatToByte(this.green),Cp[2]=re.floatToByte(this.blue),Cp[3]=re.floatToByte(this.alpha),j5[0]};re.prototype.brighten=function(e,t){return T.typeOf.number("magnitude",e),T.typeOf.number.greaterThanOrEquals("magnitude",e,0),T.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t};re.prototype.darken=function(e,t){return T.typeOf.number("magnitude",e),T.typeOf.number.greaterThanOrEquals("magnitude",e,0),T.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};re.prototype.withAlpha=function(e,t){return re.fromAlpha(this,e,t)};re.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n};re.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n};re.multiply=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n};re.divide=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n};re.mod=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n};re.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),i.red=O.lerp(e.red,t.red,n),i.green=O.lerp(e.green,t.green,n),i.blue=O.lerp(e.blue,t.blue,n),i.alpha=O.lerp(e.alpha,t.alpha,n),i};re.multiplyByScalar=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};re.divideByScalar=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};re.ALICEBLUE=Object.freeze(re.fromCssColorString("#F0F8FF"));re.ANTIQUEWHITE=Object.freeze(re.fromCssColorString("#FAEBD7"));re.AQUA=Object.freeze(re.fromCssColorString("#00FFFF"));re.AQUAMARINE=Object.freeze(re.fromCssColorString("#7FFFD4"));re.AZURE=Object.freeze(re.fromCssColorString("#F0FFFF"));re.BEIGE=Object.freeze(re.fromCssColorString("#F5F5DC"));re.BISQUE=Object.freeze(re.fromCssColorString("#FFE4C4"));re.BLACK=Object.freeze(re.fromCssColorString("#000000"));re.BLANCHEDALMOND=Object.freeze(re.fromCssColorString("#FFEBCD"));re.BLUE=Object.freeze(re.fromCssColorString("#0000FF"));re.BLUEVIOLET=Object.freeze(re.fromCssColorString("#8A2BE2"));re.BROWN=Object.freeze(re.fromCssColorString("#A52A2A"));re.BURLYWOOD=Object.freeze(re.fromCssColorString("#DEB887"));re.CADETBLUE=Object.freeze(re.fromCssColorString("#5F9EA0"));re.CHARTREUSE=Object.freeze(re.fromCssColorString("#7FFF00"));re.CHOCOLATE=Object.freeze(re.fromCssColorString("#D2691E"));re.CORAL=Object.freeze(re.fromCssColorString("#FF7F50"));re.CORNFLOWERBLUE=Object.freeze(re.fromCssColorString("#6495ED"));re.CORNSILK=Object.freeze(re.fromCssColorString("#FFF8DC"));re.CRIMSON=Object.freeze(re.fromCssColorString("#DC143C"));re.CYAN=Object.freeze(re.fromCssColorString("#00FFFF"));re.DARKBLUE=Object.freeze(re.fromCssColorString("#00008B"));re.DARKCYAN=Object.freeze(re.fromCssColorString("#008B8B"));re.DARKGOLDENROD=Object.freeze(re.fromCssColorString("#B8860B"));re.DARKGRAY=Object.freeze(re.fromCssColorString("#A9A9A9"));re.DARKGREEN=Object.freeze(re.fromCssColorString("#006400"));re.DARKGREY=re.DARKGRAY;re.DARKKHAKI=Object.freeze(re.fromCssColorString("#BDB76B"));re.DARKMAGENTA=Object.freeze(re.fromCssColorString("#8B008B"));re.DARKOLIVEGREEN=Object.freeze(re.fromCssColorString("#556B2F"));re.DARKORANGE=Object.freeze(re.fromCssColorString("#FF8C00"));re.DARKORCHID=Object.freeze(re.fromCssColorString("#9932CC"));re.DARKRED=Object.freeze(re.fromCssColorString("#8B0000"));re.DARKSALMON=Object.freeze(re.fromCssColorString("#E9967A"));re.DARKSEAGREEN=Object.freeze(re.fromCssColorString("#8FBC8F"));re.DARKSLATEBLUE=Object.freeze(re.fromCssColorString("#483D8B"));re.DARKSLATEGRAY=Object.freeze(re.fromCssColorString("#2F4F4F"));re.DARKSLATEGREY=re.DARKSLATEGRAY;re.DARKTURQUOISE=Object.freeze(re.fromCssColorString("#00CED1"));re.DARKVIOLET=Object.freeze(re.fromCssColorString("#9400D3"));re.DEEPPINK=Object.freeze(re.fromCssColorString("#FF1493"));re.DEEPSKYBLUE=Object.freeze(re.fromCssColorString("#00BFFF"));re.DIMGRAY=Object.freeze(re.fromCssColorString("#696969"));re.DIMGREY=re.DIMGRAY;re.DODGERBLUE=Object.freeze(re.fromCssColorString("#1E90FF"));re.FIREBRICK=Object.freeze(re.fromCssColorString("#B22222"));re.FLORALWHITE=Object.freeze(re.fromCssColorString("#FFFAF0"));re.FORESTGREEN=Object.freeze(re.fromCssColorString("#228B22"));re.FUCHSIA=Object.freeze(re.fromCssColorString("#FF00FF"));re.GAINSBORO=Object.freeze(re.fromCssColorString("#DCDCDC"));re.GHOSTWHITE=Object.freeze(re.fromCssColorString("#F8F8FF"));re.GOLD=Object.freeze(re.fromCssColorString("#FFD700"));re.GOLDENROD=Object.freeze(re.fromCssColorString("#DAA520"));re.GRAY=Object.freeze(re.fromCssColorString("#808080"));re.GREEN=Object.freeze(re.fromCssColorString("#008000"));re.GREENYELLOW=Object.freeze(re.fromCssColorString("#ADFF2F"));re.GREY=re.GRAY;re.HONEYDEW=Object.freeze(re.fromCssColorString("#F0FFF0"));re.HOTPINK=Object.freeze(re.fromCssColorString("#FF69B4"));re.INDIANRED=Object.freeze(re.fromCssColorString("#CD5C5C"));re.INDIGO=Object.freeze(re.fromCssColorString("#4B0082"));re.IVORY=Object.freeze(re.fromCssColorString("#FFFFF0"));re.KHAKI=Object.freeze(re.fromCssColorString("#F0E68C"));re.LAVENDER=Object.freeze(re.fromCssColorString("#E6E6FA"));re.LAVENDAR_BLUSH=Object.freeze(re.fromCssColorString("#FFF0F5"));re.LAWNGREEN=Object.freeze(re.fromCssColorString("#7CFC00"));re.LEMONCHIFFON=Object.freeze(re.fromCssColorString("#FFFACD"));re.LIGHTBLUE=Object.freeze(re.fromCssColorString("#ADD8E6"));re.LIGHTCORAL=Object.freeze(re.fromCssColorString("#F08080"));re.LIGHTCYAN=Object.freeze(re.fromCssColorString("#E0FFFF"));re.LIGHTGOLDENRODYELLOW=Object.freeze(re.fromCssColorString("#FAFAD2"));re.LIGHTGRAY=Object.freeze(re.fromCssColorString("#D3D3D3"));re.LIGHTGREEN=Object.freeze(re.fromCssColorString("#90EE90"));re.LIGHTGREY=re.LIGHTGRAY;re.LIGHTPINK=Object.freeze(re.fromCssColorString("#FFB6C1"));re.LIGHTSEAGREEN=Object.freeze(re.fromCssColorString("#20B2AA"));re.LIGHTSKYBLUE=Object.freeze(re.fromCssColorString("#87CEFA"));re.LIGHTSLATEGRAY=Object.freeze(re.fromCssColorString("#778899"));re.LIGHTSLATEGREY=re.LIGHTSLATEGRAY;re.LIGHTSTEELBLUE=Object.freeze(re.fromCssColorString("#B0C4DE"));re.LIGHTYELLOW=Object.freeze(re.fromCssColorString("#FFFFE0"));re.LIME=Object.freeze(re.fromCssColorString("#00FF00"));re.LIMEGREEN=Object.freeze(re.fromCssColorString("#32CD32"));re.LINEN=Object.freeze(re.fromCssColorString("#FAF0E6"));re.MAGENTA=Object.freeze(re.fromCssColorString("#FF00FF"));re.MAROON=Object.freeze(re.fromCssColorString("#800000"));re.MEDIUMAQUAMARINE=Object.freeze(re.fromCssColorString("#66CDAA"));re.MEDIUMBLUE=Object.freeze(re.fromCssColorString("#0000CD"));re.MEDIUMORCHID=Object.freeze(re.fromCssColorString("#BA55D3"));re.MEDIUMPURPLE=Object.freeze(re.fromCssColorString("#9370DB"));re.MEDIUMSEAGREEN=Object.freeze(re.fromCssColorString("#3CB371"));re.MEDIUMSLATEBLUE=Object.freeze(re.fromCssColorString("#7B68EE"));re.MEDIUMSPRINGGREEN=Object.freeze(re.fromCssColorString("#00FA9A"));re.MEDIUMTURQUOISE=Object.freeze(re.fromCssColorString("#48D1CC"));re.MEDIUMVIOLETRED=Object.freeze(re.fromCssColorString("#C71585"));re.MIDNIGHTBLUE=Object.freeze(re.fromCssColorString("#191970"));re.MINTCREAM=Object.freeze(re.fromCssColorString("#F5FFFA"));re.MISTYROSE=Object.freeze(re.fromCssColorString("#FFE4E1"));re.MOCCASIN=Object.freeze(re.fromCssColorString("#FFE4B5"));re.NAVAJOWHITE=Object.freeze(re.fromCssColorString("#FFDEAD"));re.NAVY=Object.freeze(re.fromCssColorString("#000080"));re.OLDLACE=Object.freeze(re.fromCssColorString("#FDF5E6"));re.OLIVE=Object.freeze(re.fromCssColorString("#808000"));re.OLIVEDRAB=Object.freeze(re.fromCssColorString("#6B8E23"));re.ORANGE=Object.freeze(re.fromCssColorString("#FFA500"));re.ORANGERED=Object.freeze(re.fromCssColorString("#FF4500"));re.ORCHID=Object.freeze(re.fromCssColorString("#DA70D6"));re.PALEGOLDENROD=Object.freeze(re.fromCssColorString("#EEE8AA"));re.PALEGREEN=Object.freeze(re.fromCssColorString("#98FB98"));re.PALETURQUOISE=Object.freeze(re.fromCssColorString("#AFEEEE"));re.PALEVIOLETRED=Object.freeze(re.fromCssColorString("#DB7093"));re.PAPAYAWHIP=Object.freeze(re.fromCssColorString("#FFEFD5"));re.PEACHPUFF=Object.freeze(re.fromCssColorString("#FFDAB9"));re.PERU=Object.freeze(re.fromCssColorString("#CD853F"));re.PINK=Object.freeze(re.fromCssColorString("#FFC0CB"));re.PLUM=Object.freeze(re.fromCssColorString("#DDA0DD"));re.POWDERBLUE=Object.freeze(re.fromCssColorString("#B0E0E6"));re.PURPLE=Object.freeze(re.fromCssColorString("#800080"));re.RED=Object.freeze(re.fromCssColorString("#FF0000"));re.ROSYBROWN=Object.freeze(re.fromCssColorString("#BC8F8F"));re.ROYALBLUE=Object.freeze(re.fromCssColorString("#4169E1"));re.SADDLEBROWN=Object.freeze(re.fromCssColorString("#8B4513"));re.SALMON=Object.freeze(re.fromCssColorString("#FA8072"));re.SANDYBROWN=Object.freeze(re.fromCssColorString("#F4A460"));re.SEAGREEN=Object.freeze(re.fromCssColorString("#2E8B57"));re.SEASHELL=Object.freeze(re.fromCssColorString("#FFF5EE"));re.SIENNA=Object.freeze(re.fromCssColorString("#A0522D"));re.SILVER=Object.freeze(re.fromCssColorString("#C0C0C0"));re.SKYBLUE=Object.freeze(re.fromCssColorString("#87CEEB"));re.SLATEBLUE=Object.freeze(re.fromCssColorString("#6A5ACD"));re.SLATEGRAY=Object.freeze(re.fromCssColorString("#708090"));re.SLATEGREY=re.SLATEGRAY;re.SNOW=Object.freeze(re.fromCssColorString("#FFFAFA"));re.SPRINGGREEN=Object.freeze(re.fromCssColorString("#00FF7F"));re.STEELBLUE=Object.freeze(re.fromCssColorString("#4682B4"));re.TAN=Object.freeze(re.fromCssColorString("#D2B48C"));re.TEAL=Object.freeze(re.fromCssColorString("#008080"));re.THISTLE=Object.freeze(re.fromCssColorString("#D8BFD8"));re.TOMATO=Object.freeze(re.fromCssColorString("#FF6347"));re.TURQUOISE=Object.freeze(re.fromCssColorString("#40E0D0"));re.VIOLET=Object.freeze(re.fromCssColorString("#EE82EE"));re.WHEAT=Object.freeze(re.fromCssColorString("#F5DEB3"));re.WHITE=Object.freeze(re.fromCssColorString("#FFFFFF"));re.WHITESMOKE=Object.freeze(re.fromCssColorString("#F5F5F5"));re.YELLOW=Object.freeze(re.fromCssColorString("#FFFF00"));re.YELLOWGREEN=Object.freeze(re.fromCssColorString("#9ACD32"));re.TRANSPARENT=Object.freeze(new re(0,0,0,0));var G=re;function BU(e){e=e??W.EMPTY_OBJECT,this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner,this.pass=e.pass}BU.ALL=Object.freeze(new BU({color:new G(0,0,0,0),depth:1,stencil:0}));BU.prototype.execute=function(e,t){e.clear(this,t)};var ei=BU;var pwe={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,VOXELS:9,OVERLAY:10,NUMBER_OF_PASSES:11},De=Object.freeze(pwe);function DJ(e){e=e??W.EMPTY_OBJECT,this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=e.persists??!1,this.pass=De.COMPUTE,this.owner=e.owner}DJ.prototype.execute=function(e){e.execute(this)};var Uc=DJ;function Ft(e,t){this.x=e??0,this.y=t??0}Ft.fromElements=function(e,t,n){return c(n)?(n.x=e,n.y=t,n):new Ft(e,t)};Ft.clone=function(e,t){if(c(e))return c(t)?(t.x=e.x,t.y=e.y,t):new Ft(e.x,e.y)};Ft.fromCartesian3=Ft.clone;Ft.fromCartesian4=Ft.clone;Ft.packedLength=2;Ft.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.x,t[n]=e.y,t};Ft.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new Ft),n.x=e[t++],n.y=e[t],n};Ft.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*2;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)Ft.pack(e[o],t,o*2);return t};Ft.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new E("array length must be a multiple of 2.");let n=e.length;c(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){let o=i/2;t[o]=Ft.unpack(e,i,t[o])}return t};Ft.fromArray=Ft.unpack;Ft.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y)};Ft.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y)};Ft.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n};Ft.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n};Ft.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);let o=O.clamp(e.x,t.x,n.x),r=O.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};Ft.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y};Ft.magnitude=function(e){return Math.sqrt(Ft.magnitudeSquared(e))};var kU=new Ft;Ft.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),Ft.subtract(e,t,kU),Ft.magnitude(kU)};Ft.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),Ft.subtract(e,t,kU),Ft.magnitudeSquared(kU)};Ft.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=Ft.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new E("normalized result is not a number");return t};Ft.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y};Ft.cross=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.y-e.y*t.x};Ft.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n};Ft.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n};Ft.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n};Ft.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n};Ft.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n};Ft.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n};Ft.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t};Ft.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var PJ=new Ft;Ft.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),Ft.multiplyByScalar(t,n,PJ),i=Ft.multiplyByScalar(e,1-n,i),Ft.add(PJ,i,i)};var IJ=new Ft,OJ=new Ft;Ft.angleBetween=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),Ft.normalize(e,IJ),Ft.normalize(t,OJ),O.acosClamped(Ft.dot(IJ,OJ))};var _we=new Ft;Ft.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=Ft.normalize(e,_we);return Ft.abs(n,n),n.x<=n.y?t=Ft.clone(Ft.UNIT_X,t):t=Ft.clone(Ft.UNIT_Y,t),t};Ft.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y};Ft.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]};Ft.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&O.equalsEpsilon(e.x,t.x,n,i)&&O.equalsEpsilon(e.y,t.y,n,i)};Ft.ZERO=Object.freeze(new Ft(0,0));Ft.ONE=Object.freeze(new Ft(1,1));Ft.UNIT_X=Object.freeze(new Ft(1,0));Ft.UNIT_Y=Object.freeze(new Ft(0,1));Ft.prototype.clone=function(e){return Ft.clone(this,e)};Ft.prototype.equals=function(e){return Ft.equals(this,e)};Ft.prototype.equalsEpsilon=function(e,t,n){return Ft.equalsEpsilon(this,e,t,n)};Ft.prototype.toString=function(){return`(${this.x}, ${this.y})`};var H=Ft;var gwe=new d,ywe=new d;function bwe(e,t,n,i,o){if(!c(e))throw new E("cartesian is required.");if(!c(t))throw new E("oneOverRadii is required.");if(!c(n))throw new E("oneOverRadiiSquared is required.");if(!c(i))throw new E("centerToleranceSquared is required.");let r=e.x,s=e.y,a=e.z,l=t.x,u=t.y,f=t.z,h=r*r*l*l,p=s*s*u*u,g=a*a*f*f,m=h+p+g,y=Math.sqrt(1/m),b=d.multiplyByScalar(e,y,gwe);if(m<i)return isFinite(y)?d.clone(b,o):void 0;let x=n.x,A=n.y,C=n.z,S=ywe;S.x=b.x*x*2,S.y=b.y*A*2,S.z=b.z*C*2;let v=(1-y)*d.magnitude(e)/(.5*d.magnitude(S)),P=0,M,R,L,F,_,w,D,I,N,k,z;do{v-=P,L=1/(1+v*x),F=1/(1+v*A),_=1/(1+v*C),w=L*L,D=F*F,I=_*_,N=w*L,k=D*F,z=I*_,M=h*w+p*D+g*I-1,R=h*N*x+p*k*A+g*z*C;let V=-2*R;P=M/V}while(Math.abs(M)>O.EPSILON12);return c(o)?(o.x=r*L,o.y=s*F,o.z=a*_,o):new d(r*L,s*F,a*_)}var ob=bwe;function zo(e,t,n){this.longitude=e??0,this.latitude=t??0,this.height=n??0}zo.fromRadians=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),n=n??0,c(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new zo(e,t,n)};zo.fromDegrees=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),e=O.toRadians(e),t=O.toRadians(t),zo.fromRadians(e,t,n,i)};var xwe=new d,Twe=new d,Awe=new d;zo._ellipsoidOneOverRadii=new d(1/6378137,1/6378137,1/6356752314245179e-9);zo._ellipsoidOneOverRadiiSquared=new d(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9));zo._ellipsoidCenterToleranceSquared=O.EPSILON1;zo.fromCartesian=function(e,t,n){let i=c(t)?t.oneOverRadii:zo._ellipsoidOneOverRadii,o=c(t)?t.oneOverRadiiSquared:zo._ellipsoidOneOverRadiiSquared,r=c(t)?t._centerToleranceSquared:zo._ellipsoidCenterToleranceSquared,s=ob(e,i,o,r,Twe);if(!c(s))return;let a=d.multiplyComponents(s,o,xwe);a=d.normalize(a,a);let l=d.subtract(e,s,Awe),u=Math.atan2(a.y,a.x),f=Math.asin(a.z),h=O.sign(d.dot(l,e))*d.magnitude(l);return c(n)?(n.longitude=u,n.latitude=f,n.height=h,n):new zo(u,f,h)};zo.toCartesian=function(e,t,n){return T.defined("cartographic",e),d.fromRadians(e.longitude,e.latitude,e.height,t,n)};zo.clone=function(e,t){if(c(e))return c(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new zo(e.longitude,e.latitude,e.height)};zo.equals=function(e,t){return e===t||c(e)&&c(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};zo.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};zo.ZERO=Object.freeze(new zo(0,0,0));zo.prototype.clone=function(e){return zo.clone(this,e)};zo.prototype.equals=function(e){return zo.equals(this,e)};zo.prototype.equalsEpsilon=function(e,t){return zo.equalsEpsilon(this,e,t)};zo.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};var he=zo;function MJ(e,t,n,i){t=t??0,n=n??0,i=i??0,T.typeOf.number.greaterThanOrEquals("x",t,0),T.typeOf.number.greaterThanOrEquals("y",n,0),T.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new d(t,n,i),e._radiiSquared=new d(t*t,n*n,i*i),e._radiiToTheFourth=new d(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new d(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new d(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=O.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function gi(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,MJ(this,e,t,n)}Object.defineProperties(gi.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}});gi.clone=function(e,t){if(!c(e))return;let n=e._radii;return c(t)?(d.clone(n,t._radii),d.clone(e._radiiSquared,t._radiiSquared),d.clone(e._radiiToTheFourth,t._radiiToTheFourth),d.clone(e._oneOverRadii,t._oneOverRadii),d.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new gi(n.x,n.y,n.z)};gi.fromCartesian3=function(e,t){return c(t)||(t=new gi),c(e)&&MJ(t,e.x,e.y,e.z),t};gi.WGS84=Object.freeze(new gi(6378137,6378137,6356752314245179e-9));gi.UNIT_SPHERE=Object.freeze(new gi(1,1,1));gi.MOON=Object.freeze(new gi(O.LUNAR_RADIUS,O.LUNAR_RADIUS,O.LUNAR_RADIUS));gi._default=gi.WGS84;Object.defineProperties(gi,{default:{get:function(){return gi._default},set:function(e){T.typeOf.object("value",e),gi._default=e,d._ellipsoidRadiiSquared=e.radiiSquared,he._ellipsoidOneOverRadii=e.oneOverRadii,he._ellipsoidOneOverRadiiSquared=e.oneOverRadiiSquared,he._ellipsoidCenterToleranceSquared=e._centerToleranceSquared}}});gi.prototype.clone=function(e){return gi.clone(this,e)};gi.packedLength=d.packedLength;gi.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,d.pack(e._radii,t,n),t};gi.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=d.unpack(e,t);return gi.fromCartesian3(i,n)};gi.prototype.geocentricSurfaceNormal=d.normalize;gi.prototype.geodeticSurfaceNormalCartographic=function(e,t){T.typeOf.object("cartographic",e);let n=e.longitude,i=e.latitude,o=Math.cos(i),r=o*Math.cos(n),s=o*Math.sin(n),a=Math.sin(i);return c(t)||(t=new d),t.x=r,t.y=s,t.z=a,d.normalize(t,t)};gi.prototype.geodeticSurfaceNormal=function(e,t){if(T.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new E("cartesian has a NaN component");if(!d.equalsEpsilon(e,d.ZERO,O.EPSILON14))return c(t)||(t=new d),t=d.multiplyComponents(e,this._oneOverRadiiSquared,t),d.normalize(t,t)};var Cwe=new d,Ewe=new d;gi.prototype.cartographicToCartesian=function(e,t){let n=Cwe,i=Ewe;this.geodeticSurfaceNormalCartographic(e,n),d.multiplyComponents(this._radiiSquared,n,i);let o=Math.sqrt(d.dot(n,i));return d.divideByScalar(i,o,i),d.multiplyByScalar(n,e.height,n),c(t)||(t=new d),d.add(i,n,t)};gi.prototype.cartographicArrayToCartesianArray=function(e,t){T.defined("cartographics",e);let n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};var Swe=new d,wwe=new d,vwe=new d;gi.prototype.cartesianToCartographic=function(e,t){let n=this.scaleToGeodeticSurface(e,wwe);if(!c(n))return;let i=this.geodeticSurfaceNormal(n,Swe),o=d.subtract(e,n,vwe),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=O.sign(d.dot(o,e))*d.magnitude(o);return c(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new he(r,s,a)};gi.prototype.cartesianArrayToCartographicArray=function(e,t){T.defined("cartesians",e);let n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};gi.prototype.scaleToGeodeticSurface=function(e,t){return ob(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};gi.prototype.scaleToGeocentricSurface=function(e,t){T.typeOf.object("cartesian",e),c(t)||(t=new d);let n=e.x,i=e.y,o=e.z,r=this._oneOverRadiiSquared,s=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return d.multiplyByScalar(e,s,t)};gi.prototype.transformPositionToScaledSpace=function(e,t){return c(t)||(t=new d),d.multiplyComponents(e,this._oneOverRadii,t)};gi.prototype.transformPositionFromScaledSpace=function(e,t){return c(t)||(t=new d),d.multiplyComponents(e,this._radii,t)};gi.prototype.equals=function(e){return this===e||c(e)&&d.equals(this._radii,e._radii)};gi.prototype.toString=function(){return this._radii.toString()};gi.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(T.typeOf.object("position",e),!O.equalsEpsilon(this._radii.x,this._radii.y,O.EPSILON15))throw new E("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");T.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=t??0;let i=this._squaredXOverSquaredZ;if(c(n)||(n=new d),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};var Dwe=new d;gi.prototype.getLocalCurvature=function(e,t){T.typeOf.object("surfacePosition",e),c(t)||(t=new H);let n=this.getSurfaceNormalIntersectionWithZAxis(e,0,Dwe),i=d.distance(e,n),o=this.minimumRadius*i/this.maximumRadius**2,r=i*o**2;return H.fromElements(1/i,1/r,t)};var Pwe=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],Iwe=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function RJ(e,t,n){T.typeOf.number("a",e),T.typeOf.number("b",t),T.typeOf.func("func",n);let i=.5*(t+e),o=.5*(t-e),r=0;for(let s=0;s<5;s++){let a=o*Pwe[s];r+=Iwe[s]*(n(i+a)+n(i-a))}return r*=o,r}gi.prototype.surfaceArea=function(e){T.typeOf.object("rectangle",e);let t=e.west,n=e.east,i=e.south,o=e.north;for(;n<t;)n+=O.TWO_PI;let r=this._radiiSquared,s=r.x,a=r.y,l=r.z,u=s*a;return RJ(i,o,function(f){let h=Math.cos(f),p=Math.sin(f);return Math.cos(f)*RJ(t,n,function(g){let m=Math.cos(g),y=Math.sin(g);return Math.sqrt(u*p*p+l*(a*m*m+s*y*y)*h*h)})})};var ie=gi;function UU(e){this._ellipsoid=e??ie.default,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(UU.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});UU.prototype.project=function(e,t){let n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};UU.prototype.unproject=function(e,t){if(!c(e))throw new E("cartesian is required");let n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};var Oi=UU;var Owe={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Wt=Object.freeze(Owe);function Rwe(e,t,n){T.defined("array",e),T.defined("itemToFind",t),T.defined("comparator",n);let i=0,o=e.length-1,r,s;for(;i<=o;){if(r=~~((i+o)/2),s=n(e[r],t),s<0){i=r+1;continue}if(s>0){o=r-1;continue}return r}return~(o+1)}var Lo=Rwe;function Mwe(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}var Bg=Mwe;function Lwe(e){if(e===null||isNaN(e))throw new E("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}var Dd=Lwe;var LJ=[31,28,31,30,31,30,31,31,30,31,30,31];function Nwe(e,t,n,i,o,r,s,a){e=e??1,t=t??1,n=n??1,i=i??0,o=o??0,r=r??0,s=s??0,a=a??!1,y(),b(),this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a;function y(){T.typeOf.number.greaterThanOrEquals("Year",e,1),T.typeOf.number.lessThanOrEquals("Year",e,9999),T.typeOf.number.greaterThanOrEquals("Month",t,1),T.typeOf.number.lessThanOrEquals("Month",t,12),T.typeOf.number.greaterThanOrEquals("Day",n,1),T.typeOf.number.lessThanOrEquals("Day",n,31),T.typeOf.number.greaterThanOrEquals("Hour",i,0),T.typeOf.number.lessThanOrEquals("Hour",i,23),T.typeOf.number.greaterThanOrEquals("Minute",o,0),T.typeOf.number.lessThanOrEquals("Minute",o,59),T.typeOf.bool("IsLeapSecond",a),T.typeOf.number.greaterThanOrEquals("Second",r,0),T.typeOf.number.lessThanOrEquals("Second",r,a?60:59),T.typeOf.number.greaterThanOrEquals("Millisecond",s,0),T.typeOf.number.lessThan("Millisecond",s,1e3)}function b(){let x=t===2&&Dd(e)?LJ[t-1]+1:LJ[t-1];if(n>x)throw new E("Month and Day represents invalid date")}}var im=Nwe;function Fwe(e,t){this.julianDate=e,this.offset=t}var Yi=Fwe;var Bwe={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1},qn=Object.freeze(Bwe);var kwe={UTC:0,TAI:1},Wn=Object.freeze(kwe);var FJ=new im,VU=[31,28,31,30,31,30,31,31,30,31,30,31],zU=29;function W5(e,t){return It.compare(e.julianDate,t.julianDate)}var QA=new Yi;function GU(e){QA.julianDate=e;let t=It.leapSeconds,n=Lo(t,QA,W5);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&It.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),It.addSeconds(e,i,e)}function NJ(e,t){QA.julianDate=e;let n=It.leapSeconds,i=Lo(n,QA,W5);if(i<0&&(i=~i),i===0)return It.addSeconds(e,-n[0].offset,t);if(i>=n.length)return It.addSeconds(e,-n[i-1].offset,t);let o=It.secondsDifference(n[i].julianDate,e);if(o===0)return It.addSeconds(e,-n[i].offset,t);if(!(o<=1))return It.addSeconds(e,-n[--i].offset,t)}function kg(e,t,n){let i=t/qn.SECONDS_PER_DAY|0;return e+=i,t-=qn.SECONDS_PER_DAY*i,t<0&&(e--,t+=qn.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function q5(e,t,n,i,o,r,s){let a=(t-14)/12|0,l=e+4800+a,u=(1461*l/4|0)+(367*(t-2-12*a)/12|0)-(3*((l+100)/100|0)/4|0)+n-32075;i=i-12,i<0&&(i+=24);let f=r+(i*qn.SECONDS_PER_HOUR+o*qn.SECONDS_PER_MINUTE+s*qn.SECONDS_PER_MILLISECOND);return f>=43200&&(u-=1),[u,f]}var Uwe=/^(\d{4})$/,Vwe=/^(\d{4})-(\d{2})$/,zwe=/^(\d{4})-?(\d{3})$/,Hwe=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,Gwe=/^(\d{4})-?(\d{2})-?(\d{2})$/,Y5=/([Z+\-])?(\d{2})?:?(\d{2})?$/,jwe=/^(\d{2})(\.\d+)?/.source+Y5.source,Wwe=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Y5.source,qwe=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Y5.source,Pd="Invalid ISO 8601 date.";function It(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=e??0,t=t??0,n=n??Wn.UTC;let i=e|0;t=t+(e-i)*qn.SECONDS_PER_DAY,kg(i,t,this),n===Wn.UTC&&GU(this)}It.fromGregorianDate=function(e,t){if(!(e instanceof im))throw new E("date must be a valid GregorianDate.");let n=q5(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return c(t)?(kg(n[0],n[1],t),GU(t),t):new It(n[0],n[1],Wn.UTC)};It.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new E("date must be a valid JavaScript Date.");let n=q5(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return c(t)?(kg(n[0],n[1],t),GU(t),t):new It(n[0],n[1],Wn.UTC)};It.fromIso8601=function(e,t){if(typeof e!="string")throw new E(Pd);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,l=0,u=0,f=n[0],h=n[1],p,g;if(!c(f))throw new E(Pd);let m;if(n=f.match(Gwe),n!==null){if(m=f.split("-").length-1,m>0&&m!==2)throw new E(Pd);i=+n[1],o=+n[2],r=+n[3]}else if(n=f.match(Vwe),n!==null)i=+n[1],o=+n[2];else if(n=f.match(Uwe),n!==null)i=+n[1];else{let A;if(n=f.match(zwe),n!==null){if(i=+n[1],A=+n[2],g=Dd(i),A<1||g&&A>366||!g&&A>365)throw new E(Pd)}else if(n=f.match(Hwe),n!==null){i=+n[1];let C=+n[2],S=+n[3]||0;if(m=f.split("-").length-1,m>0&&(!c(n[3])&&m!==1||c(n[3])&&m!==2))throw new E(Pd);let v=new Date(Date.UTC(i,0,4));A=C*7+S-v.getUTCDay()-3}else throw new E(Pd);p=new Date(Date.UTC(i,0,1)),p.setUTCDate(A),o=p.getUTCMonth()+1,r=p.getUTCDate()}if(g=Dd(i),o<1||o>12||r<1||(o!==2||!g)&&r>VU[o-1]||g&&o===2&&r>zU)throw new E(Pd);let y;if(c(h)){if(n=h.match(qwe),n!==null){if(m=h.split(":").length-1,m>0&&m!==2&&m!==3)throw new E(Pd);s=+n[1],a=+n[2],l=+n[3],u=+(n[4]||0)*1e3,y=5}else if(n=h.match(Wwe),n!==null){if(m=h.split(":").length-1,m>2)throw new E(Pd);s=+n[1],a=+n[2],l=+(n[3]||0)*60,y=4}else if(n=h.match(jwe),n!==null)s=+n[1],a=+(n[2]||0)*60,y=3;else throw new E(Pd);if(a>=60||l>=61||s>24||s===24&&(a>0||l>0||u>0))throw new E(Pd);let A=n[y],C=+n[y+1],S=+(n[y+2]||0);switch(A){case"+":s=s-C,a=a-S;break;case"-":s=s+C,a=a+S;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}let b=l===60;for(b&&l--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(p=g&&o===2?zU:VU[o-1];r>p;)r-=p,o++,o>12&&(o-=12,i++),p=g&&o===2?zU:VU[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),p=g&&o===2?zU:VU[o-1],r+=p;let x=q5(i,o,r,s,a,l,u);return c(t)?(kg(x[0],x[1],t),GU(t)):t=new It(x[0],x[1],Wn.UTC),b&&It.addSeconds(t,1,t),t};It.now=function(e){return It.fromDate(new Date,e)};var HU=new It(0,0,Wn.TAI);It.toGregorianDate=function(e,t){if(!c(e))throw new E("julianDate is required.");let n=!1,i=NJ(e,HU);c(i)||(It.addSeconds(e,-1,HU),i=NJ(HU,HU),n=!0);let o=i.dayNumber,r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0,a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;let l=4e3*(s+1)/1461001|0;s=s-(1461*l/4|0)+31|0;let u=80*s/2447|0,f=s-(2447*u/80|0)|0;s=u/11|0;let h=u+2-12*s|0,p=100*(a-49)+l+s|0,g=r/qn.SECONDS_PER_HOUR|0,m=r-g*qn.SECONDS_PER_HOUR,y=m/qn.SECONDS_PER_MINUTE|0;m=m-y*qn.SECONDS_PER_MINUTE;let b=m|0,x=(m-b)/qn.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(b+=1),c(t)?(t.year=p,t.month=h,t.day=f,t.hour=g,t.minute=y,t.second=b,t.millisecond=x,t.isLeapSecond=n,t):new im(p,h,f,g,y,b,x,n)};It.toDate=function(e){if(!c(e))throw new E("julianDate is required.");let t=It.toGregorianDate(e,FJ),n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))};It.toIso8601=function(e,t){if(!c(e))throw new E("julianDate is required.");let n=It.toGregorianDate(e,FJ),i=n.year,o=n.month,r=n.day,s=n.hour,a=n.minute,l=n.second,u=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&l===0&&u===0&&(i=9999,o=12,r=31,s=24);let f;if(!c(t)&&u!==0){let h=u*.01;return f=h<1e-6?h.toFixed(20).replace(".","").replace(/0+$/,""):h.toString().replace(".",""),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${f}Z`}return!c(t)||t===0?`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}Z`:(f=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${f}Z`)};It.clone=function(e,t){if(c(e))return c(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new It(e.dayNumber,e.secondsOfDay,Wn.TAI)};It.compare=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");let n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};It.equals=function(e,t){return e===t||c(e)&&c(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};It.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(It.secondsDifference(e,t))<=n};It.totalDays=function(e){if(!c(e))throw new E("julianDate is required.");return e.dayNumber+e.secondsOfDay/qn.SECONDS_PER_DAY};It.secondsDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");return(e.dayNumber-t.dayNumber)*qn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};It.daysDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");let n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/qn.SECONDS_PER_DAY;return n+i};It.computeTaiMinusUtc=function(e){QA.julianDate=e;let t=It.leapSeconds,n=Lo(t,QA,W5);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};It.addSeconds=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("seconds is required.");if(!c(n))throw new E("result is required.");return kg(e.dayNumber,e.secondsOfDay+t,n)};It.addMinutes=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("minutes is required.");if(!c(n))throw new E("result is required.");let i=e.secondsOfDay+t*qn.SECONDS_PER_MINUTE;return kg(e.dayNumber,i,n)};It.addHours=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("hours is required.");if(!c(n))throw new E("result is required.");let i=e.secondsOfDay+t*qn.SECONDS_PER_HOUR;return kg(e.dayNumber,i,n)};It.addDays=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("days is required.");if(!c(n))throw new E("result is required.");let i=e.dayNumber+t;return kg(i,e.secondsOfDay,n)};It.lessThan=function(e,t){return It.compare(e,t)<0};It.lessThanOrEquals=function(e,t){return It.compare(e,t)<=0};It.greaterThan=function(e,t){return It.compare(e,t)>0};It.greaterThanOrEquals=function(e,t){return It.compare(e,t)>=0};It.prototype.clone=function(e){return It.clone(this,e)};It.prototype.equals=function(e){return It.equals(this,e)};It.prototype.equalsEpsilon=function(e,t){return It.equalsEpsilon(this,e,t)};It.prototype.toString=function(){return It.toIso8601(this)};It.leapSeconds=[new Yi(new It(2441317,43210,Wn.TAI),10),new Yi(new It(2441499,43211,Wn.TAI),11),new Yi(new It(2441683,43212,Wn.TAI),12),new Yi(new It(2442048,43213,Wn.TAI),13),new Yi(new It(2442413,43214,Wn.TAI),14),new Yi(new It(2442778,43215,Wn.TAI),15),new Yi(new It(2443144,43216,Wn.TAI),16),new Yi(new It(2443509,43217,Wn.TAI),17),new Yi(new It(2443874,43218,Wn.TAI),18),new Yi(new It(2444239,43219,Wn.TAI),19),new Yi(new It(2444786,43220,Wn.TAI),20),new Yi(new It(2445151,43221,Wn.TAI),21),new Yi(new It(2445516,43222,Wn.TAI),22),new Yi(new It(2446247,43223,Wn.TAI),23),new Yi(new It(2447161,43224,Wn.TAI),24),new Yi(new It(2447892,43225,Wn.TAI),25),new Yi(new It(2448257,43226,Wn.TAI),26),new Yi(new It(2448804,43227,Wn.TAI),27),new Yi(new It(2449169,43228,Wn.TAI),28),new Yi(new It(2449534,43229,Wn.TAI),29),new Yi(new It(2450083,43230,Wn.TAI),30),new Yi(new It(2450630,43231,Wn.TAI),31),new Yi(new It(2451179,43232,Wn.TAI),32),new Yi(new It(2453736,43233,Wn.TAI),33),new Yi(new It(2454832,43234,Wn.TAI),34),new Yi(new It(2456109,43235,Wn.TAI),35),new Yi(new It(2457204,43236,Wn.TAI),36),new Yi(new It(2457754,43237,Wn.TAI),37)];var Q=It;var tee=Zo(du(),1);function Ywe(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}var dv=Ywe;function GJ(e,t){if(e===null||typeof e!="object")return e;t=t??!1;let n=new e.constructor;for(let i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=GJ(o,t)),n[i]=o}return n}var je=GJ;function jJ(e,t,n){n=n??!1;let i={},o=c(e),r=c(t),s,a,l;if(o)for(s in e)e.hasOwnProperty(s)&&(a=e[s],r&&n&&typeof a=="object"&&t.hasOwnProperty(s)?(l=t[s],typeof l=="object"?i[s]=jJ(a,l,n):i[s]=a):i[s]=a);if(r)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(l=t[s],i[s]=l);return i}var xt=jJ;function Xwe(){let e,t,n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}var Dl=Xwe;var WJ=Zo(du(),1);function X5(e,t){let n;return typeof document<"u"&&(n=document),X5._implementation(e,t,n)}X5._implementation=function(e,t,n){if(!c(e))throw new E("relative uri is required.");if(!c(t)){if(typeof n>"u")return e;t=n.baseURI??n.location.href}let i=new WJ.default(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};var om=X5;var qJ=Zo(du(),1);function Kwe(e,t){if(!c(e))throw new E("uri is required.");let n="",i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new qJ.default(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}var hv=Kwe;var YJ=Zo(du(),1);function $we(e){if(!c(e))throw new E("uri is required.");let t=new YJ.default(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),i=n.lastIndexOf("."),i===-1?n="":n=n.substr(i+1),n}var rb=$we;var XJ={};function Zwe(e,t,n){c(t)||(t=e.width),c(n)||(n=e.height);let i=XJ[t];c(i)||(i={},XJ[t]=i);let o=i[n];if(!c(o)){let r=document.createElement("canvas");r.width=t,r.height=n,o=r.getContext("2d",{willReadFrequently:!0}),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}var Id=Zwe;var Qwe=/^blob:/i;function Jwe(e){return T.typeOf.string("uri",e),Qwe.test(e)}var sb=Jwe;var rm;function eve(e){c(rm)||(rm=document.createElement("a")),rm.href=window.location.href;let t=rm.host,n=rm.protocol;return rm.href=e,rm.href=rm.href,n!==rm.protocol||t!==rm.host}var Ug=eve;var tve=/^data:/i;function nve(e){return T.typeOf.string("uri",e),tve.test(e)}var Ep=nve;function ive(e){let t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");let o=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,o.removeChild(t),n()},t.onerror=function(r){i(r)},o.appendChild(t)})}var ab=ive;function ove(e){if(!c(e))throw new E("obj is required.");let t="";for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r)t+=`${o+encodeURIComponent(i[r])}&`;else t+=`${o+encodeURIComponent(i)}&`}return t=t.slice(0,-1),t}var cb=ove;function rve(e){if(!c(e))throw new E("queryString is required.");let t={};if(e==="")return t;let n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,o=n.length;i<o;++i){let r=n[i].split("="),s=decodeURIComponent(r[0]),a=r[1];c(a)?a=decodeURIComponent(a):a="";let l=t[s];typeof l=="string"?t[s]=[l,a]:Array.isArray(l)?l.push(a):t[s]=a}return t}var hu=rve;var sve={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},$n=Object.freeze(sve);var ave={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},ms=Object.freeze(ave);function YU(e){e=e??W.EMPTY_OBJECT;let t=e.throttleByServer??!1,n=e.throttle??!1;this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=e.priority??0,this.throttle=n,this.throttleByServer=t,this.type=e.type??ms.OTHER,this.serverKey=e.serverKey,this.state=$n.UNISSUED,this.deferred=void 0,this.cancelled=!1}YU.prototype.cancel=function(){this.cancelled=!0};YU.prototype.clone=function(e){return c(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=$n.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new YU(this)};var Qo=YU;function cve(e){let t={};if(!e)return t;let n=e.split(`\r
`);for(let i=0;i<n.length;++i){let o=n[i],r=o.indexOf(": ");if(r>0){let s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}var mv=cve;function KJ(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=mv(this.responseHeaders))}KJ.prototype.toString=function(){let e="Request has failed.";return c(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};var sm=KJ;var XU=Zo(du(),1);function pv(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(pv.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});pv.prototype.addEventListener=function(e,t){T.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);let n=this;return function(){n.removeEventListener(e,t)}};pv.prototype.removeEventListener=function(e,t){T.typeOf.func("listener",e);let n=this._listeners,i=this._scopes,o=-1;for(let r=0;r<n.length;r++)if(n[r]===e&&i[r]===t){o=r;break}return o!==-1?(this._insideRaiseEvent?(this._toRemove.push(o),n[o]=void 0,i[o]=void 0):(n.splice(o,1),i.splice(o,1)),!0):!1};function lve(e,t){return t-e}pv.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let e,t=this._listeners,n=this._scopes,i=t.length;for(e=0;e<i;e++){let r=t[e];c(r)&&t[e].apply(n[e],arguments)}let o=this._toRemove;if(i=o.length,i>0){for(o.sort(lve),e=0;e<i;e++){let r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};var pe=pv;function lb(e){T.typeOf.object("options",e),T.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(lb.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){T.typeOf.number.greaterThanOrEquals("maximumLength",e,0);let t=this._length;if(e<t){let n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}});function K5(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}lb.prototype.reserve=function(e){e=e??this._length,this._array.length=e};lb.prototype.heapify=function(e){e=e??0;let t=this._length,n=this._comparator,i=this._array,o=-1,r=!0;for(;r;){let s=2*(e+1),a=s-1;a<t&&n(i[a],i[e])<0?o=a:o=e,s<t&&n(i[s],i[o])<0&&(o=s),o!==e?(K5(i,o,e),e=o):r=!1}};lb.prototype.resort=function(){let e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};lb.prototype.insert=function(e){T.defined("element",e);let t=this._array,n=this._comparator,i=this._maximumLength,o=this._length++;for(o<t.length?t[o]=e:t.push(e);o!==0;){let s=Math.floor((o-1)/2);if(n(t[o],t[s])<0)K5(t,o,s),o=s;else break}let r;return c(i)&&this._length>i&&(r=t[i],this._length=i),r};lb.prototype.pop=function(e){if(e=e??0,this._length===0)return;T.typeOf.number.lessThan("index",e,this._length);let t=this._array,n=t[e];return K5(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};var _v=lb;function uve(e,t){return e.priority-t.priority}var to={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},tC=20,rc=new _v({comparator:uve});rc.maximumLength=tC;rc.reserve(tC);var am=[],Sp={},fve=typeof document<"u"?new XU.default(document.location.href):new XU.default,KU=new pe;function Jo(){}Jo.maximumRequests=50;Jo.maximumRequestsPerServer=18;Jo.requestsByServer={};Jo.throttleRequests=!0;Jo.debugShowStatistics=!1;Jo.requestCompletedEvent=KU;Object.defineProperties(Jo,{statistics:{get:function(){return to}},priorityHeapLength:{get:function(){return tC},set:function(e){if(e<tC)for(;rc.length>e;){let t=rc.pop();ub(t)}tC=e,rc.maximumLength=e,rc.reserve(e)}}});function $J(e){c(e.priorityFunction)&&(e.priority=e.priorityFunction())}Jo.serverHasOpenSlots=function(e,t){t=t??1;let n=Jo.requestsByServer[e]??Jo.maximumRequestsPerServer;return Sp[e]+t<=n};Jo.heapHasOpenSlots=function(e){return rc.length+e<=tC};function ZJ(e){return e.state===$n.UNISSUED&&(e.state=$n.ISSUED,e.deferred=Dl()),e.deferred.promise}function dve(e){return function(t){if(e.state===$n.CANCELLED)return;let n=e.deferred;--to.numberOfActiveRequests,--Sp[e.serverKey],KU.raiseEvent(),e.state=$n.RECEIVED,e.deferred=void 0,n.resolve(t)}}function hve(e){return function(t){e.state!==$n.CANCELLED&&(++to.numberOfFailedRequests,--to.numberOfActiveRequests,--Sp[e.serverKey],KU.raiseEvent(t),e.state=$n.FAILED,e.deferred.reject(t))}}function QJ(e){let t=ZJ(e);return e.state=$n.ACTIVE,am.push(e),++to.numberOfActiveRequests,++to.numberOfActiveRequestsEver,++Sp[e.serverKey],e.requestFunction().then(dve(e)).catch(hve(e)),t}function ub(e){let t=e.state===$n.ACTIVE;if(e.state=$n.CANCELLED,++to.numberOfCancelledRequests,c(e.deferred)){let n=e.deferred;e.deferred=void 0,n.reject()}t&&(--to.numberOfActiveRequests,--Sp[e.serverKey],++to.numberOfCancelledActiveRequests),c(e.cancelFunction)&&e.cancelFunction()}Jo.update=function(){let e,t,n=0,i=am.length;for(e=0;e<i;++e){if(t=am[e],t.cancelled&&ub(t),t.state!==$n.ACTIVE){++n;continue}n>0&&(am[e-n]=t)}am.length-=n;let o=rc.internalArray,r=rc.length;for(e=0;e<r;++e)$J(o[e]);rc.resort();let s=Math.max(Jo.maximumRequests-am.length,0),a=0;for(;a<s&&rc.length>0;){if(t=rc.pop(),t.cancelled){ub(t);continue}if(t.throttleByServer&&!Jo.serverHasOpenSlots(t.serverKey)){ub(t);continue}QJ(t),++a}mve()};Jo.getServerKey=function(e){T.typeOf.string("url",e);let t=new XU.default(e);t.scheme()===""&&(t=t.absoluteTo(fve),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);let i=Sp[n];return c(i)||(Sp[n]=0),n};Jo.request=function(e){if(T.typeOf.object("request",e),T.typeOf.string("request.url",e.url),T.typeOf.func("request.requestFunction",e.requestFunction),Ep(e.url)||sb(e.url))return KU.raiseEvent(),e.state=$n.RECEIVED,e.requestFunction();if(++to.numberOfAttemptedRequests,c(e.serverKey)||(e.serverKey=Jo.getServerKey(e.url)),Jo.throttleRequests&&e.throttleByServer&&!Jo.serverHasOpenSlots(e.serverKey))return;if(!Jo.throttleRequests||!e.throttle)return QJ(e);if(am.length>=Jo.maximumRequests)return;$J(e);let t=rc.insert(e);if(c(t)){if(t===e)return;ub(t)}return ZJ(e)};function mve(){Jo.debugShowStatistics&&(to.numberOfActiveRequests===0&&to.lastNumberOfActiveRequests>0&&(to.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${to.numberOfAttemptedRequests}`),to.numberOfAttemptedRequests=0),to.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${to.numberOfCancelledRequests}`),to.numberOfCancelledRequests=0),to.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${to.numberOfCancelledActiveRequests}`),to.numberOfCancelledActiveRequests=0),to.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${to.numberOfFailedRequests}`),to.numberOfFailedRequests=0)),to.lastNumberOfActiveRequests=to.numberOfActiveRequests)}Jo.clearForSpecs=function(){for(;rc.length>0;){let t=rc.pop();ub(t)}let e=am.length;for(let t=0;t<e;++t)ub(am[t]);am.length=0,Sp={},to.numberOfAttemptedRequests=0,to.numberOfActiveRequests=0,to.numberOfCancelledRequests=0,to.numberOfCancelledActiveRequests=0,to.numberOfFailedRequests=0,to.numberOfActiveRequestsEver=0,to.lastNumberOfActiveRequests=0};Jo.numberOfActiveRequestsByServer=function(e){return Sp[e]};Jo.requestHeap=rc;var sc=Jo;var JJ=Zo(du(),1);var gv={},nC={};gv.add=function(e,t){if(!c(e))throw new E("host is required.");if(!c(t)||t<=0)throw new E("port is required to be greater than 0.");let n=`${e.toLowerCase()}:${t}`;c(nC[n])||(nC[n]=!0)};gv.remove=function(e,t){if(!c(e))throw new E("host is required.");if(!c(t)||t<=0)throw new E("port is required to be greater than 0.");let n=`${e.toLowerCase()}:${t}`;c(nC[n])&&delete nC[n]};function pve(e){let t=new JJ.default(e);t.normalize();let n=t.authority();if(n.length!==0){if(t.authority(n),n.indexOf("@")!==-1&&(n=n.split("@")[1]),n.indexOf(":")===-1){let i=t.scheme();if(i.length===0&&(i=window.location.protocol,i=i.substring(0,i.length-1)),i==="http")n+=":80";else if(i==="https")n+=":443";else return}return n}}gv.contains=function(e){if(!c(e))throw new E("url is required.");let t=pve(e);return!!(c(t)&&c(nC[t]))};gv.clear=function(){nC={}};var iC=gv;var nee=function(){try{let e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function vt(e){e=e??W.EMPTY_OBJECT,typeof e=="string"&&(e={url:e}),T.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=cm(e.templateValues,{}),this._queryParameters=cm(e.queryParameters,{}),this.headers=cm(e.headers,{}),this.request=e.request??new Qo,this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=e.retryAttempts??0,this._retryCount=0,e.parseUrl??!0?this.parseUrl(e.url,!0,!0):this._url=e.url,this._credits=e.credits}function cm(e,t){return c(e)?je(e):t}vt.createIfNeeded=function(e){return e instanceof vt?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new vt({url:e})};var oC;vt.supportsImageBitmapOptions=function(){return c(oC)?oC:typeof createImageBitmap!="function"?(oC=Promise.resolve(!1),oC):(oC=vt.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then(function(t){let n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){let n=Id(t[0]),i=Id(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),oC)};Object.defineProperties(vt,{isBlobSupported:{get:function(){return nee}}});Object.defineProperties(vt.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){this.parseUrl(e,!1,!1)}},extension:{get:function(){return rb(this._url)}},isDataUri:{get:function(){return Ep(this._url)}},isBlobUri:{get:function(){return sb(this._url)}},isCrossOriginUrl:{get:function(){return Ug(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}});vt.prototype.toString=function(){return this.getUrlComponent(!0,!0)};vt.prototype.parseUrl=function(e,t,n,i){let o=new tee.default(e),r=_ve(o.query());this._queryParameters=t?ZU(r,this.queryParameters,n):r,o.search(""),o.fragment(""),c(i)&&o.scheme()===""&&(o=o.absoluteTo(om(i))),this._url=o.toString()};function _ve(e){return e.length===0?{}:e.indexOf("=")===-1?{[e]:void 0}:hu(e)}function ZU(e,t,n){if(!n)return xt(e,t);let i=je(e,!0);for(let o in t)if(t.hasOwnProperty(o)){let r=i[o],s=t[o];c(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}vt.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=this._url;e&&(n=`${n}${gve(this.queryParameters)}`),n=n.replace(/%7B/g,"{").replace(/%7D/g,"}");let i=this._templateValues;return Object.keys(i).length>0&&(n=n.replace(/{(.*?)}/g,function(o,r){let s=i[r];return c(s)?encodeURIComponent(s):o})),t&&c(this.proxy)&&(n=this.proxy.getURL(n)),n};function gve(e){let t=Object.keys(e);return t.length===0?"":t.length===1&&!c(e[t[0]])?`?${t[0]}`:`?${cb(e)}`}vt.prototype.setQueryParameters=function(e,t){t?this._queryParameters=ZU(this._queryParameters,e,!1):this._queryParameters=ZU(e,this._queryParameters,!1)};vt.prototype.appendQueryParameters=function(e){this._queryParameters=ZU(e,this._queryParameters,!0)};vt.prototype.setTemplateValues=function(e,t){t?this._templateValues=xt(this._templateValues,e):this._templateValues=xt(e,this._templateValues)};vt.prototype.getDerivedResource=function(e){let t=this.clone();if(t._retryCount=0,c(e.url)){let n=e.preserveQueryParameters??!1;t.parseUrl(e.url,!0,n,this._url)}return c(e.queryParameters)&&(t._queryParameters=xt(e.queryParameters,t.queryParameters)),c(e.templateValues)&&(t._templateValues=xt(e.templateValues,t.templateValues)),c(e.headers)&&(t.headers=xt(e.headers,t.headers)),c(e.proxy)&&(t.proxy=e.proxy),c(e.request)&&(t.request=e.request),c(e.retryCallback)&&(t.retryCallback=e.retryCallback),c(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};vt.prototype.retryOnError=function(e){let t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);let n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})};vt.prototype.clone=function(e){return c(e)?(e._url=this._url,e._queryParameters=je(this._queryParameters),e._templateValues=je(this._templateValues),e.headers=je(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e):new vt({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:c(this.credits)?this.credits.slice():void 0})};vt.prototype.getBaseUri=function(e){return hv(this.getUrlComponent(e),e)};vt.prototype.appendForwardSlash=function(){this._url=dv(this._url)};vt.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};vt.fetchArrayBuffer=function(e){return new vt(e).fetchArrayBuffer()};vt.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};vt.fetchBlob=function(e){return new vt(e).fetchBlob()};vt.prototype.fetchImage=function(e){e=e??W.EMPTY_OBJECT;let t=e.preferImageBitmap??!1,n=e.preferBlob??!1,i=e.flipY??!1,o=e.skipColorSpaceConversion??!1;if(Z5(this.request),!nee||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return $5({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});let r=this.fetchBlob();if(!c(r))return;let s,a,l,u;return vt.supportsImageBitmapOptions().then(function(f){return s=f,a=s&&t,r}).then(function(f){if(!c(f))return;if(u=f,a)return vt.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});let h=window.URL.createObjectURL(f);return l=new vt({url:h}),$5({resource:l,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(f){if(c(f))return f.blob=u,a||window.URL.revokeObjectURL(l.url),f}).catch(function(f){return c(l)&&window.URL.revokeObjectURL(l.url),f.blob=u,Promise.reject(f)})};function $5(e){let t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,o=e.preferImageBitmap,r=t.request;r.url=t.url,r.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);let l=Dl();return vt._Implementations.createImage(r,a,l,n,i,o),l.promise};let s=sc.request(r);if(c(s))return s.catch(function(a){return r.state!==$n.FAILED?Promise.reject(a):t.retryOnError(a).then(function(l){return l?(r.state=$n.UNISSUED,r.deferred=void 0,$5({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}vt.fetchImage=function(e){return new vt(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};vt.prototype.fetchText=function(){return this.fetch({responseType:"text"})};vt.fetchText=function(e){return new vt(e).fetchText()};vt.prototype.fetchJson=function(){let e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(c(e))return e.then(function(t){if(c(t))return JSON.parse(t)})};vt.fetchJson=function(e){return new vt(e).fetchJson()};vt.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};vt.fetchXML=function(e){return new vt(e).fetchXML()};vt.prototype.fetchJsonp=function(e){e=e??"callback",Z5(this.request);let t;do t=`loadJsonp${O.nextRandomNumber().toString().substring(2,8)}`;while(c(window[t]));return iee(this,e,t)};function iee(e,t,n){let i={};i[t]=n,e.setQueryParameters(i);let o=e.request,r=e.url;o.url=r,o.requestFunction=function(){let a=Dl();return window[n]=function(l){a.resolve(l);try{delete window[n]}catch{window[n]=void 0}},vt._Implementations.loadAndExecuteScript(r,n,a),a.promise};let s=sc.request(o);if(c(s))return s.catch(function(a){return o.state!==$n.FAILED?Promise.reject(a):e.retryOnError(a).then(function(l){return l?(o.state=$n.UNISSUED,o.deferred=void 0,iee(e,t,n)):Promise.reject(a)})})}vt.fetchJsonp=function(e){return new vt(e).fetchJsonp(e.callbackParameterName)};vt.prototype._makeRequest=function(e){let t=this;Z5(t.request);let n=t.request,i=t.url;n.url=i,n.requestFunction=function(){let r=e.responseType,s=xt(e.headers,t.headers),a=e.overrideMimeType,l=e.method,u=e.data,f=Dl(),h=vt._Implementations.loadWithXhr(i,r,l,u,s,f,a);return c(h)&&c(h.abort)&&(n.cancelFunction=function(){h.abort()}),f.promise};let o=sc.request(n);if(c(o))return o.then(function(r){return n.cancelFunction=void 0,r}).catch(function(r){return n.cancelFunction=void 0,n.state!==$n.FAILED?Promise.reject(r):t.retryOnError(r).then(function(s){return s?(n.state=$n.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(r)})})};function Z5(e){if(e.state===$n.ISSUED||e.state===$n.ACTIVE)throw new ae("The Resource is already being fetched.");e.state=$n.UNISSUED,e.deferred=void 0}var yve=/^data:(.*?)(;base64)?,(.*)$/;function $U(e,t){let n=decodeURIComponent(t);return e?atob(n):n}function eee(e,t){let n=$U(e,t),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r);return i}function bve(e,t){t=t??"";let n=e[1],i=!!e[2],o=e[3],r,s;switch(t){case"":case"text":return $U(i,o);case"arraybuffer":return eee(i,o);case"blob":return r=eee(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString($U(i,o),n);case"json":return JSON.parse($U(i,o));default:throw new E(`Unhandled responseType: ${t}`)}}vt.prototype.fetch=function(e){return e=cm(e,{}),e.method="GET",this._makeRequest(e)};vt.fetch=function(e){return new vt(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt.prototype.delete=function(e){return e=cm(e,{}),e.method="DELETE",this._makeRequest(e)};vt.delete=function(e){return new vt(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};vt.prototype.head=function(e){return e=cm(e,{}),e.method="HEAD",this._makeRequest(e)};vt.head=function(e){return new vt(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt.prototype.options=function(e){return e=cm(e,{}),e.method="OPTIONS",this._makeRequest(e)};vt.options=function(e){return new vt(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt.prototype.post=function(e,t){return T.defined("data",e),t=cm(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};vt.post=function(e){return new vt(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt.prototype.put=function(e,t){return T.defined("data",e),t=cm(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};vt.put=function(e){return new vt(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt.prototype.patch=function(e,t){return T.defined("data",e),t=cm(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};vt.patch=function(e){return new vt(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};vt._Implementations={};vt._Implementations.loadImageElement=function(e,t,n){let i=new Image;i.onload=function(){i.naturalWidth===0&&i.naturalHeight===0&&i.width===0&&i.height===0&&(i.width=300,i.height=150),n.resolve(i)},i.onerror=function(o){n.reject(o)},t&&(iC.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};vt._Implementations.createImage=function(e,t,n,i,o,r){let s=e.url;vt.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){vt._Implementations.loadImageElement(s,t,n);return}let l="blob",u="GET",f=Dl(),h=vt._Implementations.loadWithXhr(s,l,u,void 0,void 0,f,void 0,void 0,void 0);return c(h)&&c(h.abort)&&(e.cancelFunction=function(){h.abort()}),f.promise.then(function(p){if(!c(p)){n.reject(new ae(`Successfully retrieved ${s} but it contained no content.`));return}return vt.createImageBitmapFromBlob(p,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(p){n.resolve(p)})}).catch(function(a){n.reject(a)})};vt.createImageBitmapFromBlob=function(e,t){return T.defined("options",t),T.typeOf.bool("options.flipY",t.flipY),T.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),T.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function xve(e,t,n,i,o,r,s){fetch(e,{method:n,headers:o}).then(async a=>{if(!a.ok){let l={};a.headers.forEach((u,f)=>{l[f]=u}),r.reject(new sm(a.status,a,l));return}switch(t){case"text":r.resolve(a.text());break;case"json":r.resolve(a.json());break;default:r.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{r.reject(new sm)})}var Tve=typeof XMLHttpRequest>"u";vt._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){let a=yve.exec(e);if(a!==null){r.resolve(bve(a,t));return}if(Tve){xve(e,t,n,i,o,r,s);return}let l=new XMLHttpRequest;if(iC.contains(e)&&(l.withCredentials=!0),l.open(n,e,!0),c(s)&&c(l.overrideMimeType)&&l.overrideMimeType(s),c(o))for(let f in o)o.hasOwnProperty(f)&&l.setRequestHeader(f,o[f]);c(t)&&(l.responseType=t);let u=!1;return typeof e=="string"&&(u=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),l.onload=function(){if((l.status<200||l.status>=300)&&!(u&&l.status===0)){r.reject(new sm(l.status,l.response,l.getAllResponseHeaders()));return}let f=l.response,h=l.responseType;if(n==="HEAD"||n==="OPTIONS"){let g=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};g.forEach(function(y){let b=y.split(": "),x=b.shift();m[x]=b.join(": ")}),r.resolve(m);return}if(l.status===204)r.resolve(void 0);else if(c(f)&&(!c(t)||h===t))r.resolve(f);else if(t==="json"&&typeof f=="string")try{r.resolve(JSON.parse(f))}catch(p){r.reject(p)}else(h===""||h==="document")&&c(l.responseXML)&&l.responseXML.hasChildNodes()?r.resolve(l.responseXML):(h===""||h==="text")&&c(l.responseText)?r.resolve(l.responseText):r.reject(new ae("Invalid XMLHttpRequest response type."))},l.onerror=function(f){r.reject(new sm)},l.send(i),l};vt._Implementations.loadAndExecuteScript=function(e,t,n){return ab(e,t).catch(function(i){n.reject(i)})};vt._DefaultImplementations={};vt._DefaultImplementations.createImage=vt._Implementations.createImage;vt._DefaultImplementations.loadWithXhr=vt._Implementations.loadWithXhr;vt._DefaultImplementations.loadAndExecuteScript=vt._Implementations.loadAndExecuteScript;vt.DEFAULT=Object.freeze(new vt({url:typeof document>"u"?"":document.location.href.split("?")[0]}));var we=vt;function bv(e){e=e??W.EMPTY_OBJECT,this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=e.addNewLeapSeconds??!0,c(e.data)?oee(this,e.data):oee(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}bv.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT;let n=we.createIfNeeded(e),i;try{i=await n.fetchJson()}catch{throw new ae(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new bv({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};bv.NONE=Object.freeze({compute:function(e,t){return c(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new Bg(0,0,0,0,0),t}});bv.prototype.compute=function(e,t){if(!c(this._samples))return;if(c(t)||(t=new Bg(0,0,0,0,0)),this._samples.length===0)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;let n=this._dates,i=this._lastIndex,o=0,r=0;if(c(i)){let a=n[i],l=n[i+1],u=Q.lessThanOrEquals(a,e),f=!c(l),h=f||Q.greaterThanOrEquals(l,e);if(u&&h)return o=i,!f&&l.equals(e)&&++o,r=o+1,see(this,n,this._samples,e,o,r,t),t}let s=Lo(n,e,Q.compare,this._dateColumn);return s>=0?(s<n.length-1&&n[s+1].equals(e)&&++s,o=s,r=s):(r=~s,o=r-1,o<0&&(o=0)),this._lastIndex=o,see(this,n,this._samples,e,o,r,t),t};function Ave(e,t){return Q.compare(e.julianDate,t)}function oee(e,t){if(!c(t.columnNames))throw new ae("Error in loaded EOP data: The columnNames property is required.");if(!c(t.samples))throw new ae("Error in loaded EOP data: The samples property is required.");let n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),o=t.columnNames.indexOf("yPoleWanderRadians"),r=t.columnNames.indexOf("ut1MinusUtcSeconds"),s=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||o<0||r<0||s<0||a<0||l<0)throw new ae("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");let u=e._samples=t.samples,f=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=o,e._ut1MinusUtcSecondsColumn=r,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=l,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let h,p=e._addNewLeapSeconds;for(let g=0,m=u.length;g<m;g+=e._columnCount){let y=u[g+n],b=u[g+l],x=y+qn.MODIFIED_JULIAN_DATE_DIFFERENCE,A=new Q(x,b,Wn.TAI);if(f.push(A),p){if(b!==h&&c(h)){let C=Q.leapSeconds,S=Lo(C,A,Ave);if(S<0){let v=new Yi(A,b);C.splice(~S,0,v)}}h=b}}}function ree(e,t,n,i,o){let r=n*i;o.xPoleWander=t[r+e._xPoleWanderRadiansColumn],o.yPoleWander=t[r+e._yPoleWanderRadiansColumn],o.xPoleOffset=t[r+e._xCelestialPoleOffsetRadiansColumn],o.yPoleOffset=t[r+e._yCelestialPoleOffsetRadiansColumn],o.ut1MinusUtc=t[r+e._ut1MinusUtcSecondsColumn]}function yv(e,t,n){return t+e*(n-t)}function see(e,t,n,i,o,r,s){let a=e._columnCount;if(r>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;let l=t[o],u=t[r];if(l.equals(u)||i.equals(l))return ree(e,n,o,a,s),s;if(i.equals(u))return ree(e,n,r,a,s),s;let f=Q.secondsDifference(i,l)/Q.secondsDifference(u,l),h=o*a,p=r*a,g=n[h+e._ut1MinusUtcSecondsColumn],m=n[p+e._ut1MinusUtcSecondsColumn],y=m-g;if(y>.5||y<-.5){let b=n[h+e._taiMinusUtcSecondsColumn],x=n[p+e._taiMinusUtcSecondsColumn];b!==x&&(u.equals(i)?g=m:m-=x-b)}return s.xPoleWander=yv(f,n[h+e._xPoleWanderRadiansColumn],n[p+e._xPoleWanderRadiansColumn]),s.yPoleWander=yv(f,n[h+e._yPoleWanderRadiansColumn],n[p+e._yPoleWanderRadiansColumn]),s.xPoleOffset=yv(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[p+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=yv(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[p+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=yv(f,g,m),s}var xv=bv;function ac(e,t,n){this.heading=e??0,this.pitch=t??0,this.roll=n??0}ac.fromQuaternion=function(e,t){if(!c(e))throw new E("quaternion is required");c(t)||(t=new ac);let n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),o=2*(e.w*e.x+e.y*e.z),r=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,r),t.roll=Math.atan2(o,i),t.pitch=-O.asinClamped(n),t};ac.fromDegrees=function(e,t,n,i){if(!c(e))throw new E("heading is required");if(!c(t))throw new E("pitch is required");if(!c(n))throw new E("roll is required");return c(i)||(i=new ac),i.heading=e*O.RADIANS_PER_DEGREE,i.pitch=t*O.RADIANS_PER_DEGREE,i.roll=n*O.RADIANS_PER_DEGREE,i};ac.clone=function(e,t){if(c(e))return c(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new ac(e.heading,e.pitch,e.roll)};ac.equals=function(e,t){return e===t||c(e)&&c(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};ac.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&O.equalsEpsilon(e.heading,t.heading,n,i)&&O.equalsEpsilon(e.pitch,t.pitch,n,i)&&O.equalsEpsilon(e.roll,t.roll,n,i)};ac.prototype.clone=function(e){return ac.clone(this,e)};ac.prototype.equals=function(e){return ac.equals(this,e)};ac.prototype.equalsEpsilon=function(e,t,n){return ac.equalsEpsilon(this,e,t,n)};ac.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};var Oa=ac;var aee={},cee=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function Cve(){let e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){let i=e[t].getAttribute("src"),o=cee.exec(i);if(o!==null)return o[1]}}var QU;function lee(e){return typeof document>"u"?e:(c(QU)||(QU=document.createElement("a")),QU.href=e,QU.href)}var fb;function uee(){if(c(fb))return fb;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:c(aee?.url)?e=om(".",aee.url):typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?e=om("..",db("Core/buildModuleUrl.js")):e=Cve(),!c(e))throw new E("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return fb=new we({url:lee(e)}),fb.appendForwardSlash(),fb}function Eve(e){return lee(require.toUrl(`../${e}`))}function fee(e){return uee().getDerivedResource({url:e}).url}var JU;function db(e){return c(JU)||(typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?JU=Eve:JU=fee),JU(e)}db._cesiumScriptRegex=cee;db._buildModuleUrlFromBaseUrl=fee;db._clearBaseResource=function(){fb=void 0};db.setBaseUrl=function(e){fb=we.DEFAULT.getDerivedResource({url:e})};db.getCesiumBaseUrl=uee;var tn=db;function Sve(e,t,n){this.x=e,this.y=t,this.s=n}var hb=Sve;function ej(e){e=e??W.EMPTY_OBJECT,this._xysFileUrlTemplate=we.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=e.interpolationOrder??9,this._sampleZeroJulianEphemerisDate=e.sampleZeroJulianEphemerisDate??24423965e-1,this._sampleZeroDateTT=new Q(this._sampleZeroJulianEphemerisDate,0,Wn.TAI),this._stepSizeDays=e.stepSizeDays??1,this._samplesPerXysFile=e.samplesPerXysFile??1e3,this._totalSamples=e.totalSamples??27426,this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];let t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t);for(let r=0;r<=t;++r){n[r]=o,i[r]=r*this._stepSizeDays;for(let s=0;s<=t;++s)s!==r&&(n[r]*=r-s);n[r]=1/n[r]}this._work=new Array(t+1),this._coef=new Array(t+1)}var wve=new Q(0,0,Wn.TAI);function Q5(e,t,n){let i=wve;return i.dayNumber=t,i.secondsOfDay=n,Q.daysDifference(i,e._sampleZeroDateTT)}ej.prototype.preload=function(e,t,n,i){let o=Q5(this,e,t),r=Q5(this,n,i),s=o/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=r/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);let l=s/this._samplesPerXysFile|0,u=a/this._samplesPerXysFile|0,f=[];for(let h=l;h<=u;++h)f.push(J5(this,h));return Promise.all(f)};ej.prototype.computeXysRadians=function(e,t,n){let i=Q5(this,e,t);if(i<0)return;let o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;let r=this._interpolationOrder,s=o-(r/2|0);s<0&&(s=0);let a=s+r;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-r,s<0&&(s=0));let l=!1,u=this._samples;if(c(u[s*3])||(J5(this,s/this._samplesPerXysFile|0),l=!0),c(u[a*3])||(J5(this,a/this._samplesPerXysFile|0),l=!0),l)return;c(n)?(n.x=0,n.y=0,n.s=0):n=new hb(0,0,0);let f=i-s*this._stepSizeDays,h=this._work,p=this._denominators,g=this._coef,m=this._xTable,y,b;for(y=0;y<=r;++y)h[y]=f-m[y];for(y=0;y<=r;++y){for(g[y]=1,b=0;b<=r;++b)b!==y&&(g[y]*=h[b]);g[y]*=p[y];let x=(s+y)*3;n.x+=g[y]*u[x++],n.y+=g[y]*u[x++],n.s+=g[y]*u[x]}return n};function J5(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n,i=e._xysFileUrlTemplate;c(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new we({url:tn(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});let o=n.fetchJson().then(function(r){e._chunkDownloadsInProgress[t]=!1;let s=e._samples,a=r.samples,l=t*e._samplesPerXysFile*3;for(let u=0,f=a.length;u<f;++u)s[l+u]=a[u]});return e._chunkDownloadsInProgress[t]=o,o}var Tv=ej;function nt(e,t,n,i){this.x=e??0,this.y=t??0,this.z=n??0,this.w=i??0}var Av=new d;nt.fromAxisAngle=function(e,t,n){T.typeOf.object("axis",e),T.typeOf.number("angle",t);let i=t/2,o=Math.sin(i);Av=d.normalize(e,Av);let r=Av.x*o,s=Av.y*o,a=Av.z*o,l=Math.cos(i);return c(n)?(n.x=r,n.y=s,n.z=a,n.w=l,n):new nt(r,s,a,l)};var vve=[1,2,0],Dve=new Array(3);nt.fromRotationMatrix=function(e,t){T.typeOf.object("matrix",e);let n,i,o,r,s,a=e[J.COLUMN0ROW0],l=e[J.COLUMN1ROW1],u=e[J.COLUMN2ROW2],f=a+l+u;if(f>0)n=Math.sqrt(f+1),s=.5*n,n=.5/n,i=(e[J.COLUMN1ROW2]-e[J.COLUMN2ROW1])*n,o=(e[J.COLUMN2ROW0]-e[J.COLUMN0ROW2])*n,r=(e[J.COLUMN0ROW1]-e[J.COLUMN1ROW0])*n;else{let h=vve,p=0;l>a&&(p=1),u>a&&u>l&&(p=2);let g=h[p],m=h[g];n=Math.sqrt(e[J.getElementIndex(p,p)]-e[J.getElementIndex(g,g)]-e[J.getElementIndex(m,m)]+1);let y=Dve;y[p]=.5*n,n=.5/n,s=(e[J.getElementIndex(m,g)]-e[J.getElementIndex(g,m)])*n,y[g]=(e[J.getElementIndex(g,p)]+e[J.getElementIndex(p,g)])*n,y[m]=(e[J.getElementIndex(m,p)]+e[J.getElementIndex(p,m)])*n,i=-y[0],o=-y[1],r=-y[2]}return c(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new nt(i,o,r,s)};var dee=new nt,hee=new nt,tj=new nt,mee=new nt;nt.fromHeadingPitchRoll=function(e,t){return T.typeOf.object("headingPitchRoll",e),mee=nt.fromAxisAngle(d.UNIT_X,e.roll,dee),tj=nt.fromAxisAngle(d.UNIT_Y,-e.pitch,t),t=nt.multiply(tj,mee,tj),hee=nt.fromAxisAngle(d.UNIT_Z,-e.heading,dee),nt.multiply(hee,t,t)};var eV=new d,nj=new d,Od=new nt,pee=new nt,tV=new nt;nt.packedLength=4;nt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};nt.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new nt),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};nt.packedInterpolationLength=3;nt.convertPackedArrayForInterpolation=function(e,t,n,i){nt.unpack(e,n*4,tV),nt.conjugate(tV,tV);for(let o=0,r=n-t+1;o<r;o++){let s=o*3;nt.unpack(e,(t+o)*4,Od),nt.multiply(Od,tV,Od),Od.w<0&&nt.negate(Od,Od),nt.computeAxis(Od,eV);let a=nt.computeAngle(Od);c(i)||(i=[]),i[s]=eV.x*a,i[s+1]=eV.y*a,i[s+2]=eV.z*a}};nt.unpackInterpolationResult=function(e,t,n,i,o){c(o)||(o=new nt),d.fromArray(e,0,nj);let r=d.magnitude(nj);return nt.unpack(t,i*4,pee),r===0?nt.clone(nt.IDENTITY,Od):nt.fromAxisAngle(nj,r,Od),nt.multiply(Od,pee,o)};nt.clone=function(e,t){if(c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new nt(e.x,e.y,e.z,e.w)};nt.conjugate=function(e,t){return T.typeOf.object("quaternion",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};nt.magnitudeSquared=function(e){return T.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};nt.magnitude=function(e){return Math.sqrt(nt.magnitudeSquared(e))};nt.normalize=function(e,t){T.typeOf.object("result",t);let n=1/nt.magnitude(e),i=e.x*n,o=e.y*n,r=e.z*n,s=e.w*n;return t.x=i,t.y=o,t.z=r,t.w=s,t};nt.inverse=function(e,t){T.typeOf.object("result",t);let n=nt.magnitudeSquared(e);return t=nt.conjugate(e,t),nt.multiplyByScalar(t,1/n,t)};nt.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};nt.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};nt.negate=function(e,t){return T.typeOf.object("quaternion",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};nt.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};nt.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,l=t.y,u=t.z,f=t.w,h=s*a+i*f+o*u-r*l,p=s*l-i*u+o*f+r*a,g=s*u+i*l-o*a+r*f,m=s*f-i*a-o*l-r*u;return n.x=h,n.y=p,n.z=g,n.w=m,n};nt.multiplyByScalar=function(e,t,n){return T.typeOf.object("quaternion",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};nt.divideByScalar=function(e,t,n){return T.typeOf.object("quaternion",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};nt.computeAxis=function(e,t){T.typeOf.object("quaternion",e),T.typeOf.object("result",t);let n=e.w;if(Math.abs(n-1)<O.EPSILON6||Math.abs(n+1)<O.EPSILON6)return t.x=1,t.y=t.z=0,t;let i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t};nt.computeAngle=function(e){return T.typeOf.object("quaternion",e),Math.abs(e.w-1)<O.EPSILON6?0:2*Math.acos(e.w)};var ij=new nt;nt.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),ij=nt.multiplyByScalar(t,n,ij),i=nt.multiplyByScalar(e,1-n,i),nt.add(ij,i,i)};var _ee=new nt,oj=new nt,rj=new nt;nt.slerp=function(e,t,n,i){T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i);let o=nt.dot(e,t),r=t;if(o<0&&(o=-o,r=_ee=nt.negate(t,_ee)),1-o<O.EPSILON6)return nt.lerp(e,r,n,i);let s=Math.acos(o);return oj=nt.multiplyByScalar(e,Math.sin((1-n)*s),oj),rj=nt.multiplyByScalar(r,Math.sin(n*s),rj),i=nt.add(oj,rj,i),nt.multiplyByScalar(i,1/Math.sin(s),i)};nt.log=function(e,t){T.typeOf.object("quaternion",e),T.typeOf.object("result",t);let n=O.acosClamped(e.w),i=0;return n!==0&&(i=n/Math.sin(n)),d.multiplyByScalar(e,i,t)};nt.exp=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);let n=d.magnitude(e),i=0;return n!==0&&(i=Math.sin(n)/n),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=Math.cos(n),t};var Pve=new d,Ive=new d,Cv=new nt,rC=new nt;nt.computeInnerQuadrangle=function(e,t,n,i){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("q2",n),T.typeOf.object("result",i);let o=nt.conjugate(t,Cv);nt.multiply(o,n,rC);let r=nt.log(rC,Pve);nt.multiply(o,e,rC);let s=nt.log(rC,Ive);return d.add(r,s,r),d.multiplyByScalar(r,.25,r),d.negate(r,r),nt.exp(r,Cv),nt.multiply(t,Cv,i)};nt.squad=function(e,t,n,i,o,r){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("s0",n),T.typeOf.object("s1",i),T.typeOf.number("t",o),T.typeOf.object("result",r);let s=nt.slerp(e,t,o,Cv),a=nt.slerp(n,i,o,rC);return nt.slerp(s,a,2*o*(1-o),r)};var Ove=new nt,gee=1.9011074535173003,nV=Vt.supportsTypedArrays()?new Float32Array(8):[],iV=Vt.supportsTypedArrays()?new Float32Array(8):[],wp=Vt.supportsTypedArrays()?new Float32Array(8):[],vp=Vt.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){let t=e+1,n=2*t+1;nV[e]=1/(t*n),iV[e]=t/n}nV[7]=gee/(8*17);iV[7]=gee*8/17;nt.fastSlerp=function(e,t,n,i){T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i);let o=nt.dot(e,t),r;o>=0?r=1:(r=-1,o=-o);let s=o-1,a=1-n,l=n*n,u=a*a;for(let g=7;g>=0;--g)wp[g]=(nV[g]*l-iV[g])*s,vp[g]=(nV[g]*u-iV[g])*s;let f=r*n*(1+wp[0]*(1+wp[1]*(1+wp[2]*(1+wp[3]*(1+wp[4]*(1+wp[5]*(1+wp[6]*(1+wp[7])))))))),h=a*(1+vp[0]*(1+vp[1]*(1+vp[2]*(1+vp[3]*(1+vp[4]*(1+vp[5]*(1+vp[6]*(1+vp[7])))))))),p=nt.multiplyByScalar(e,h,Ove);return nt.multiplyByScalar(t,f,i),nt.add(p,i,i)};nt.fastSquad=function(e,t,n,i,o,r){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("s0",n),T.typeOf.object("s1",i),T.typeOf.number("t",o),T.typeOf.object("result",r);let s=nt.fastSlerp(e,t,o,Cv),a=nt.fastSlerp(n,i,o,rC);return nt.fastSlerp(s,a,2*o*(1-o),r)};nt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};nt.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n};nt.ZERO=Object.freeze(new nt(0,0,0,0));nt.IDENTITY=Object.freeze(new nt(0,0,0,1));nt.prototype.clone=function(e){return nt.clone(this,e)};nt.prototype.equals=function(e){return nt.equals(this,e)};nt.prototype.equalsEpsilon=function(e,t){return nt.equalsEpsilon(this,e,t)};nt.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};var Le=nt;var fi={},sj={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},sC={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},aj={},Pl={east:new d,north:new d,up:new d,west:new d,south:new d,down:new d},Vg=new d,zg=new d,Hg=new d;fi.localFrameToFixedFrameGenerator=function(e,t){if(!sj.hasOwnProperty(e)||!sj[e].hasOwnProperty(t))throw new E("firstAxis and secondAxis must be east, north, up, west, south or down.");let n=sj[e][t],i,o=e+t;return c(aj[o])?i=aj[o]:(i=function(r,s,a){if(!c(r))throw new E("origin is required.");if(isNaN(r.x)||isNaN(r.y)||isNaN(r.z))throw new E("origin has a NaN component");if(c(a)||(a=new B),d.equalsEpsilon(r,d.ZERO,O.EPSILON14))d.unpack(sC[e],0,Vg),d.unpack(sC[t],0,zg),d.unpack(sC[n],0,Hg);else if(O.equalsEpsilon(r.x,0,O.EPSILON14)&&O.equalsEpsilon(r.y,0,O.EPSILON14)){let l=O.sign(r.z);d.unpack(sC[e],0,Vg),e!=="east"&&e!=="west"&&d.multiplyByScalar(Vg,l,Vg),d.unpack(sC[t],0,zg),t!=="east"&&t!=="west"&&d.multiplyByScalar(zg,l,zg),d.unpack(sC[n],0,Hg),n!=="east"&&n!=="west"&&d.multiplyByScalar(Hg,l,Hg)}else{s=s??ie.default,s.geodeticSurfaceNormal(r,Pl.up);let l=Pl.up,u=Pl.east;u.x=-r.y,u.y=r.x,u.z=0,d.normalize(u,Pl.east),d.cross(l,u,Pl.north),d.multiplyByScalar(Pl.up,-1,Pl.down),d.multiplyByScalar(Pl.east,-1,Pl.west),d.multiplyByScalar(Pl.north,-1,Pl.south),Vg=Pl[e],zg=Pl[t],Hg=Pl[n]}return a[0]=Vg.x,a[1]=Vg.y,a[2]=Vg.z,a[3]=0,a[4]=zg.x,a[5]=zg.y,a[6]=zg.z,a[7]=0,a[8]=Hg.x,a[9]=Hg.y,a[10]=Hg.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},aj[o]=i),i};fi.eastNorthUpToFixedFrame=fi.localFrameToFixedFrameGenerator("east","north");fi.northEastDownToFixedFrame=fi.localFrameToFixedFrameGenerator("north","east");fi.northUpEastToFixedFrame=fi.localFrameToFixedFrameGenerator("north","up");fi.northWestUpToFixedFrame=fi.localFrameToFixedFrameGenerator("north","west");var Rve=new Le,Mve=new d(1,1,1),Lve=new B;fi.headingPitchRollToFixedFrame=function(e,t,n,i,o){T.typeOf.object("HeadingPitchRoll",t),i=i??fi.eastNorthUpToFixedFrame;let r=Le.fromHeadingPitchRoll(t,Rve),s=B.fromTranslationQuaternionRotationScale(d.ZERO,r,Mve,Lve);return o=i(e,n,o),B.multiply(o,s,o)};var Nve=new B,Fve=new J;fi.headingPitchRollQuaternion=function(e,t,n,i,o){T.typeOf.object("HeadingPitchRoll",t);let r=fi.headingPitchRollToFixedFrame(e,t,n,i,Nve),s=B.getMatrix3(r,Fve);return Le.fromRotationMatrix(s,o)};var Bve=new d(1,1,1),kve=new d,yee=new B,Uve=new B,Vve=new J,zve=new Le;fi.fixedFrameToHeadingPitchRoll=function(e,t,n,i){T.defined("transform",e),t=t??ie.default,n=n??fi.eastNorthUpToFixedFrame,c(i)||(i=new Oa);let o=B.getTranslation(e,kve);if(d.equals(o,d.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=B.inverseTransformation(n(o,t,yee),yee),s=B.setScale(e,Bve,Uve);s=B.setTranslation(s,d.ZERO,s),r=B.multiply(r,s,r);let a=Le.fromRotationMatrix(B.getMatrix3(r,Vve),zve);return a=Le.normalize(a,a),Oa.fromQuaternion(a,i)};var Hve=6*3600+41*60+50.54841,Gve=8640184812866e-6,jve=.093104,Wve=-62e-7,qve=11772758384668e-32,Yve=72921158553e-15,Xve=O.TWO_PI/86400,oV=new Q;fi.computeIcrfToCentralBodyFixedMatrix=function(e,t){let n=fi.computeIcrfToFixedMatrix(e,t);return c(n)||(n=fi.computeTemeToPseudoFixedMatrix(e,t)),n};fi.computeTemeToPseudoFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");oV=Q.addSeconds(e,-Q.computeTaiMinusUtc(e),oV);let n=oV.dayNumber,i=oV.secondsOfDay,o,r=n-2451545;i>=43200?o=(r+.5)/qn.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/qn.DAYS_PER_JULIAN_CENTURY;let a=(Hve+o*(Gve+o*(jve+o*Wve)))*Xve%O.TWO_PI,l=Yve+qve*(n-24515455e-1),u=(i+qn.SECONDS_PER_DAY*.5)%qn.SECONDS_PER_DAY,f=a+l*u,h=Math.cos(f),p=Math.sin(f);return c(t)?(t[0]=h,t[1]=-p,t[2]=0,t[3]=p,t[4]=h,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new J(h,p,0,-p,h,0,0,0,1)};fi.iau2006XysData=new Tv;fi.earthOrientationParameters=xv.NONE;var uj=32.184,Kve=2451545;fi.preloadIcrfFixed=function(e){let t=e.start.dayNumber,n=e.start.secondsOfDay+uj,i=e.stop.dayNumber,o=e.stop.secondsOfDay+uj;return fi.iau2006XysData.preload(t,n,i,o)};fi.computeIcrfToFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new J);let n=fi.computeFixedToIcrfMatrix(e,t);if(c(n))return J.transpose(n,t)};var $ve=32.184,Zve=2451545,rV=new Oa,Qve=new J,Jve=new Q;fi.computeMoonFixedToIcrfMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new J);let n=Q.addSeconds(e,$ve,Jve),i=Q.totalDays(n)-Zve,o=O.toRadians(12.112)-O.toRadians(.052992)*i,r=O.toRadians(24.224)-O.toRadians(.105984)*i,s=O.toRadians(227.645)+O.toRadians(13.012)*i,a=O.toRadians(261.105)+O.toRadians(13.340716)*i,l=O.toRadians(358)+O.toRadians(.9856)*i;return rV.pitch=O.toRadians(180)-O.toRadians(3.878)*Math.sin(o)-O.toRadians(.12)*Math.sin(r)+O.toRadians(.07)*Math.sin(s)-O.toRadians(.017)*Math.sin(a),rV.roll=O.toRadians(66.53-90)+O.toRadians(1.543)*Math.cos(o)+O.toRadians(.24)*Math.cos(r)-O.toRadians(.028)*Math.cos(s)+O.toRadians(.007)*Math.cos(a),rV.heading=O.toRadians(244.375-90)+O.toRadians(13.17635831)*i+O.toRadians(3.558)*Math.sin(o)+O.toRadians(.121)*Math.sin(r)-O.toRadians(.064)*Math.sin(s)+O.toRadians(.016)*Math.sin(a)+O.toRadians(.025)*Math.sin(l),J.fromHeadingPitchRoll(rV,Qve)};fi.computeIcrfToMoonFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new J);let n=fi.computeMoonFixedToIcrfMatrix(e,t);if(c(n))return J.transpose(n,t)};var eDe=new hb(0,0,0),tDe=new Bg(0,0,0,0,0,0),cj=new J,lj=new J;fi.computeFixedToIcrfMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new J);let n=fi.earthOrientationParameters.compute(e,tDe);if(!c(n))return;let i=e.dayNumber,o=e.secondsOfDay+uj,r=fi.iau2006XysData.computeXysRadians(i,o,eDe);if(!c(r))return;let s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,l=1/(1+Math.sqrt(1-s*s-a*a)),u=cj;u[0]=1-l*s*s,u[3]=-l*s*a,u[6]=s,u[1]=-l*s*a,u[4]=1-l*a*a,u[7]=a,u[2]=-s,u[5]=-a,u[8]=1-l*(s*s+a*a);let f=J.fromRotationZ(-r.s,lj),h=J.multiply(u,f,cj),p=e.dayNumber,g=e.secondsOfDay-Q.computeTaiMinusUtc(e)+n.ut1MinusUtc,m=p-2451545,y=g/qn.SECONDS_PER_DAY,b=.779057273264+y+.00273781191135448*(m+y);b=b%1*O.TWO_PI;let x=J.fromRotationZ(b,lj),A=J.multiply(h,x,cj),C=Math.cos(n.xPoleWander),S=Math.cos(n.yPoleWander),v=Math.sin(n.xPoleWander),P=Math.sin(n.yPoleWander),M=i-Kve+o/qn.SECONDS_PER_DAY;M/=36525;let R=-47e-6*M*O.RADIANS_PER_DEGREE/3600,L=Math.cos(R),F=Math.sin(R),_=lj;return _[0]=C*L,_[1]=C*F,_[2]=v,_[3]=-S*F+P*v*L,_[4]=S*L+P*v*F,_[5]=-P*C,_[6]=-P*F-S*v*L,_[7]=P*L-S*v*F,_[8]=S*C,J.multiply(A,_,t)};var nDe=new se;fi.pointToWindowCoordinates=function(e,t,n,i){return i=fi.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};fi.pointToGLWindowCoordinates=function(e,t,n,i){if(!c(e))throw new E("modelViewProjectionMatrix is required.");if(!c(t))throw new E("viewportTransformation is required.");if(!c(n))throw new E("point is required.");c(i)||(i=new H);let o=nDe;return B.multiplyByVector(e,se.fromElements(n.x,n.y,n.z,1,o),o),se.multiplyByScalar(o,1/o.w,o),B.multiplyByVector(t,o,o),H.fromCartesian4(o,i)};var iDe=new d,oDe=new d,rDe=new d;fi.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("velocity is required.");let o=(n??ie.default).geodeticSurfaceNormal(e,iDe),r=d.cross(t,o,oDe);d.equalsEpsilon(r,d.ZERO,O.EPSILON6)&&(r=d.clone(d.UNIT_X,r));let s=d.cross(r,t,rDe);return d.normalize(s,s),d.cross(t,s,r),d.negate(r,r),d.normalize(r,r),c(i)||(i=new J),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};var bee=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),xee=new he,fj=new d,sDe=new d,aDe=new J,dj=new B,Tee=new B;fi.basisTo2D=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("matrix is required.");if(!c(n))throw new E("result is required.");let i=B.getTranslation(t,sDe),o=e.ellipsoid,r;if(d.equals(i,d.ZERO))r=d.clone(d.ZERO,fj);else{let f=o.cartesianToCartographic(i,xee);r=e.project(f,fj),d.fromElements(r.z,r.x,r.y,r)}let s=fi.eastNorthUpToFixedFrame(i,o,dj),a=B.inverseTransformation(s,Tee),l=B.getMatrix3(t,aDe),u=B.multiplyByMatrix3(a,l,n);return B.multiply(bee,u,n),B.setTranslation(n,r,n),n};fi.ellipsoidTo2DModelMatrix=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("center is required.");if(!c(n))throw new E("result is required.");let i=e.ellipsoid,o=fi.eastNorthUpToFixedFrame(t,i,dj),r=B.inverseTransformation(o,Tee),s=i.cartesianToCartographic(t,xee),a=e.project(s,fj);d.fromElements(a.z,a.x,a.y,a);let l=B.fromTranslation(a,dj);return B.multiply(bee,r,n),B.multiply(l,n,n),n};var Ot=fi;function vn(e,t,n,i){this.west=e??0,this.south=t??0,this.east=n??0,this.north=i??0}Object.defineProperties(vn.prototype,{width:{get:function(){return vn.computeWidth(this)}},height:{get:function(){return vn.computeHeight(this)}}});vn.packedLength=4;vn.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};vn.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new vn),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};vn.computeWidth=function(e){T.typeOf.object("rectangle",e);let t=e.east,n=e.west;return t<n&&(t+=O.TWO_PI),t-n};vn.computeHeight=function(e){return T.typeOf.object("rectangle",e),e.north-e.south};vn.fromDegrees=function(e,t,n,i,o){return e=O.toRadians(e??0),t=O.toRadians(t??0),n=O.toRadians(n??0),i=O.toRadians(i??0),c(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new vn(e,t,n,i)};vn.fromRadians=function(e,t,n,i,o){return c(o)?(o.west=e??0,o.south=t??0,o.east=n??0,o.north=i??0,o):new vn(e,t,n,i)};vn.fromCartographicArray=function(e,t){T.defined("cartographics",e);let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let l=0,u=e.length;l<u;l++){let f=e[l];n=Math.min(n,f.longitude),i=Math.max(i,f.longitude),s=Math.min(s,f.latitude),a=Math.max(a,f.latitude);let h=f.longitude>=0?f.longitude:f.longitude+O.TWO_PI;o=Math.min(o,h),r=Math.max(r,h)}return i-n>r-o&&(n=o,i=r,i>O.PI&&(i=i-O.TWO_PI),n>O.PI&&(n=n-O.TWO_PI)),c(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new vn(n,s,i,a)};vn.fromCartesianArray=function(e,t,n){T.defined("cartesians",e),t=t??ie.default;let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let u=0,f=e.length;u<f;u++){let h=t.cartesianToCartographic(e[u]);i=Math.min(i,h.longitude),o=Math.max(o,h.longitude),a=Math.min(a,h.latitude),l=Math.max(l,h.latitude);let p=h.longitude>=0?h.longitude:h.longitude+O.TWO_PI;r=Math.min(r,p),s=Math.max(s,p)}return o-i>s-r&&(i=r,o=s,o>O.PI&&(o=o-O.TWO_PI),i>O.PI&&(i=i-O.TWO_PI)),c(n)?(n.west=i,n.south=a,n.east=o,n.north=l,n):new vn(i,a,o,l)};var cDe=new d,lDe=new d,uDe=new d,fDe=new d,dDe=new d,hj=new Array(5);for(let e=0;e<hj.length;++e)hj[e]=new d;vn.fromBoundingSphere=function(e,t,n){T.typeOf.object("boundingSphere",e);let i=e.center,o=e.radius;if(c(t)||(t=ie.default),c(n)||(n=new vn),d.equals(i,d.ZERO))return vn.clone(vn.MAX_VALUE,n),n;let r=Ot.eastNorthUpToFixedFrame(i,t,cDe),s=B.multiplyByPointAsVector(r,d.UNIT_X,lDe);d.normalize(s,s);let a=B.multiplyByPointAsVector(r,d.UNIT_Y,uDe);d.normalize(a,a),d.multiplyByScalar(a,o,a),d.multiplyByScalar(s,o,s);let l=d.negate(a,dDe),u=d.negate(s,fDe),f=hj,h=f[0];return d.add(i,a,h),h=f[1],d.add(i,u,h),h=f[2],d.add(i,l,h),h=f[3],d.add(i,s,h),f[4]=i,vn.fromCartesianArray(f,t,n)};vn.clone=function(e,t){if(c(e))return c(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new vn(e.west,e.south,e.east,e.north)};vn.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n};vn.prototype.clone=function(e){return vn.clone(this,e)};vn.prototype.equals=function(e){return vn.equals(this,e)};vn.equals=function(e,t){return e===t||c(e)&&c(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};vn.prototype.equalsEpsilon=function(e,t){return vn.equalsEpsilon(this,e,t)};vn._validate=function(e){T.typeOf.object("rectangle",e);let t=e.north;T.typeOf.number.greaterThanOrEquals("north",t,-O.PI_OVER_TWO),T.typeOf.number.lessThanOrEquals("north",t,O.PI_OVER_TWO);let n=e.south;T.typeOf.number.greaterThanOrEquals("south",n,-O.PI_OVER_TWO),T.typeOf.number.lessThanOrEquals("south",n,O.PI_OVER_TWO);let i=e.west;T.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),T.typeOf.number.lessThanOrEquals("west",i,Math.PI);let o=e.east;T.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),T.typeOf.number.lessThanOrEquals("east",o,Math.PI)};vn.southwest=function(e,t){return T.typeOf.object("rectangle",e),c(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new he(e.west,e.south)};vn.northwest=function(e,t){return T.typeOf.object("rectangle",e),c(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new he(e.west,e.north)};vn.northeast=function(e,t){return T.typeOf.object("rectangle",e),c(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new he(e.east,e.north)};vn.southeast=function(e,t){return T.typeOf.object("rectangle",e),c(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new he(e.east,e.south)};vn.center=function(e,t){T.typeOf.object("rectangle",e);let n=e.east,i=e.west;n<i&&(n+=O.TWO_PI);let o=O.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return c(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new he(o,r)};vn.intersection=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=O.TWO_PI:r<s&&i>0&&(r+=O.TWO_PI),i<o&&s<0?s+=O.TWO_PI:r<s&&o<0&&(o+=O.TWO_PI);let a=O.negativePiToPi(Math.max(o,s)),l=O.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&l<=a)return;let u=Math.max(e.south,t.south),f=Math.min(e.north,t.north);if(!(u>=f))return c(n)?(n.west=a,n.south=u,n.east=l,n.north=f,n):new vn(a,u,l,f)};vn.simpleIntersection=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t);let i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return c(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new vn(i,o,r,s)};vn.union=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t),c(n)||(n=new vn);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=O.TWO_PI:r<s&&i>0&&(r+=O.TWO_PI),i<o&&s<0?s+=O.TWO_PI:r<s&&o<0&&(o+=O.TWO_PI);let a=O.negativePiToPi(Math.min(o,s)),l=O.negativePiToPi(Math.max(i,r));return n.west=a,n.south=Math.min(e.south,t.south),n.east=l,n.north=Math.max(e.north,t.north),n};vn.expand=function(e,t,n){return T.typeOf.object("rectangle",e),T.typeOf.object("cartographic",t),c(n)||(n=new vn),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n};vn.contains=function(e,t){T.typeOf.object("rectangle",e),T.typeOf.object("cartographic",t);let n=t.longitude,i=t.latitude,o=e.west,r=e.east;return r<o&&(r+=O.TWO_PI,n<0&&(n+=O.TWO_PI)),(n>o||O.equalsEpsilon(n,o,O.EPSILON14))&&(n<r||O.equalsEpsilon(n,r,O.EPSILON14))&&i>=e.south&&i<=e.north};var hDe=new he;vn.subsample=function(e,t,n,i){T.typeOf.object("rectangle",e),t=t??ie.default,n=n??0,c(i)||(i=[]);let o=0,r=e.north,s=e.south,a=e.east,l=e.west,u=hDe;u.height=n,u.longitude=l,u.latitude=r,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.latitude=s,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,r<0?u.latitude=r:s>0?u.latitude=s:u.latitude=0;for(let f=1;f<8;++f)u.longitude=-Math.PI+f*O.PI_OVER_TWO,vn.contains(e,u)&&(i[o]=t.cartographicToCartesian(u,i[o]),o++);return u.latitude===0&&(u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++),i.length=o,i};vn.subsection=function(e,t,n,i,o,r){if(T.typeOf.object("rectangle",e),T.typeOf.number.greaterThanOrEquals("westLerp",t,0),T.typeOf.number.lessThanOrEquals("westLerp",t,1),T.typeOf.number.greaterThanOrEquals("southLerp",n,0),T.typeOf.number.lessThanOrEquals("southLerp",n,1),T.typeOf.number.greaterThanOrEquals("eastLerp",i,0),T.typeOf.number.lessThanOrEquals("eastLerp",i,1),T.typeOf.number.greaterThanOrEquals("northLerp",o,0),T.typeOf.number.lessThanOrEquals("northLerp",o,1),T.typeOf.number.lessThanOrEquals("westLerp",t,i),T.typeOf.number.lessThanOrEquals("southLerp",n,o),c(r)||(r=new vn),e.west<=e.east){let a=e.east-e.west;r.west=e.west+t*a,r.east=e.west+i*a}else{let a=O.TWO_PI+e.east-e.west;r.west=O.negativePiToPi(e.west+t*a),r.east=O.negativePiToPi(e.west+i*a)}let s=e.north-e.south;return r.south=e.south+n*s,r.north=e.south+o*s,t===1&&(r.west=e.east),i===1&&(r.east=e.east),n===1&&(r.south=e.north),o===1&&(r.north=e.north),r};vn.MAX_VALUE=Object.freeze(new vn(-Math.PI,-O.PI_OVER_TWO,Math.PI,O.PI_OVER_TWO));var ce=vn;function kr(e,t,n,i){this.x=e??0,this.y=t??0,this.width=n??0,this.height=i??0}kr.packedLength=4;kr.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};kr.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new kr),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};kr.fromPoints=function(e,t){if(c(t)||(t=new kr),!c(e)||e.length===0)return t.x=0,t.y=0,t.width=0,t.height=0,t;let n=e.length,i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;a<n;a++){let l=e[a],u=l.x,f=l.y;i=Math.min(u,i),r=Math.max(u,r),o=Math.min(f,o),s=Math.max(f,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};var Aee=new Oi,mDe=new he,pDe=new he;kr.fromRectangle=function(e,t,n){if(c(n)||(n=new kr),!c(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;Aee._ellipsoid=ie.default,t=t??Aee;let i=t.project(ce.southwest(e,mDe)),o=t.project(ce.northeast(e,pDe));return H.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};kr.clone=function(e,t){if(c(e))return c(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new kr(e.x,e.y,e.width,e.height)};kr.union=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),c(n)||(n=new kr);let i=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),s=Math.max(e.y+e.height,t.y+t.height);return n.x=i,n.y=o,n.width=r-i,n.height=s-o,n};kr.expand=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("point",t),n=kr.clone(e,n);let i=t.x-n.x,o=t.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),o>n.height?n.height=o:o<0&&(n.height-=o,n.y=t.y),n};kr.intersect=function(e,t){T.typeOf.object("left",e),T.typeOf.object("right",t);let n=e.x,i=e.y,o=t.x,r=t.y;return n>o+t.width||n+e.width<o||i+e.height<r||i>r+t.height?Wt.OUTSIDE:Wt.INTERSECTING};kr.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};kr.prototype.clone=function(e){return kr.clone(this,e)};kr.prototype.intersect=function(e){return kr.intersect(this,e)};kr.prototype.equals=function(e){return kr.equals(this,e)};var Ke=kr;var Ra={POINTS:ne.POINTS,LINES:ne.LINES,LINE_LOOP:ne.LINE_LOOP,LINE_STRIP:ne.LINE_STRIP,TRIANGLES:ne.TRIANGLES,TRIANGLE_STRIP:ne.TRIANGLE_STRIP,TRIANGLE_FAN:ne.TRIANGLE_FAN};Ra.isLines=function(e){return e===Ra.LINES||e===Ra.LINE_LOOP||e===Ra.LINE_STRIP};Ra.isTriangles=function(e){return e===Ra.TRIANGLES||e===Ra.TRIANGLE_STRIP||e===Ra.TRIANGLE_FAN};Ra.validate=function(e){return e===Ra.POINTS||e===Ra.LINES||e===Ra.LINE_LOOP||e===Ra.LINE_STRIP||e===Ra.TRIANGLES||e===Ra.TRIANGLE_STRIP||e===Ra.TRIANGLE_FAN};var Me=Object.freeze(Ra);var mb=`in vec4 position;
in vec2 textureCoordinates;
out vec2 v_textureCoordinates;
void main()
{
gl_Position = position;
v_textureCoordinates = textureCoordinates;
}
`;var Er={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function Ev(e){e=e??W.EMPTY_OBJECT,this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=e.primitiveType??Me.TRIANGLES,this._vertexArray=e.vertexArray,this._count=e.count,this._offset=e.offset??0,this._instanceCount=e.instanceCount??0,this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._pickMetadataAllowed=e.pickMetadataAllowed===!0,this._pickedMetadataInfo=void 0,this._flags=0,this.cull=e.cull??!0,this.occlude=e.occlude??!0,this.executeInClosestFrustum=e.executeInClosestFrustum??!1,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.castShadows=e.castShadows??!1,this.receiveShadows=e.receiveShadows??!1,this.pickOnly=e.pickOnly??!1,this.depthForTranslucentClassification=e.depthForTranslucentClassification??!1,this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function cc(e,t){return(e._flags&t)===t}function Gg(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(Ev.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return cc(this,Er.CULL)},set:function(e){cc(this,Er.CULL)!==e&&(Gg(this,Er.CULL,e),this.dirty=!0)}},occlude:{get:function(){return cc(this,Er.OCCLUDE)},set:function(e){cc(this,Er.OCCLUDE)!==e&&(Gg(this,Er.OCCLUDE,e),this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return cc(this,Er.CAST_SHADOWS)},set:function(e){cc(this,Er.CAST_SHADOWS)!==e&&(Gg(this,Er.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return cc(this,Er.RECEIVE_SHADOWS)},set:function(e){cc(this,Er.RECEIVE_SHADOWS)!==e&&(Gg(this,Er.RECEIVE_SHADOWS,e),this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return cc(this,Er.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){cc(this,Er.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(Gg(this,Er.EXECUTE_IN_CLOSEST_FRUSTUM,e),this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return cc(this,Er.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){cc(this,Er.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(Gg(this,Er.DEBUG_SHOW_BOUNDING_VOLUME,e),this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickMetadataAllowed:{get:function(){return this._pickMetadataAllowed}},pickedMetadataInfo:{get:function(){return this._pickedMetadataInfo},set:function(e){this._pickedMetadataInfo!==e&&(this._pickedMetadataInfo=e,this.dirty=!0)}},pickOnly:{get:function(){return cc(this,Er.PICK_ONLY)},set:function(e){cc(this,Er.PICK_ONLY)!==e&&(Gg(this,Er.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return cc(this,Er.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){cc(this,Er.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(Gg(this,Er.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});Ev.shallowClone=function(e,t){if(c(e))return c(t)||(t=new Ev),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._pickMetadataAllowed=e._pickMetadataAllowed,t._pickedMetadataInfo=e._pickedMetadataInfo,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t};Ev.prototype.execute=function(e,t){e.draw(this,t)};var Qe=Ev;var di={UNSIGNED_BYTE:ne.UNSIGNED_BYTE,UNSIGNED_SHORT:ne.UNSIGNED_SHORT,UNSIGNED_INT:ne.UNSIGNED_INT,FLOAT:ne.FLOAT,HALF_FLOAT:ne.HALF_FLOAT_OES,UNSIGNED_INT_24_8:ne.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:ne.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:ne.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:ne.UNSIGNED_SHORT_5_6_5};di.toWebGLConstant=function(e,t){switch(e){case di.UNSIGNED_BYTE:return ne.UNSIGNED_BYTE;case di.UNSIGNED_SHORT:return ne.UNSIGNED_SHORT;case di.UNSIGNED_INT:return ne.UNSIGNED_INT;case di.FLOAT:return ne.FLOAT;case di.HALF_FLOAT:return t.webgl2?ne.HALF_FLOAT:ne.HALF_FLOAT_OES;case di.UNSIGNED_INT_24_8:return ne.UNSIGNED_INT_24_8;case di.UNSIGNED_SHORT_4_4_4_4:return ne.UNSIGNED_SHORT_4_4_4_4;case di.UNSIGNED_SHORT_5_5_5_1:return ne.UNSIGNED_SHORT_5_5_5_1;case di.UNSIGNED_SHORT_5_6_5:return di.UNSIGNED_SHORT_5_6_5}};di.isPacked=function(e){return e===di.UNSIGNED_INT_24_8||e===di.UNSIGNED_SHORT_4_4_4_4||e===di.UNSIGNED_SHORT_5_5_5_1||e===di.UNSIGNED_SHORT_5_6_5};di.sizeInBytes=function(e){switch(e){case di.UNSIGNED_BYTE:return 1;case di.UNSIGNED_SHORT:case di.UNSIGNED_SHORT_4_4_4_4:case di.UNSIGNED_SHORT_5_5_5_1:case di.UNSIGNED_SHORT_5_6_5:case di.HALF_FLOAT:return 2;case di.UNSIGNED_INT:case di.FLOAT:case di.UNSIGNED_INT_24_8:return 4}};di.validate=function(e){return e===di.UNSIGNED_BYTE||e===di.UNSIGNED_SHORT||e===di.UNSIGNED_INT||e===di.FLOAT||e===di.HALF_FLOAT||e===di.UNSIGNED_INT_24_8||e===di.UNSIGNED_SHORT_4_4_4_4||e===di.UNSIGNED_SHORT_5_5_5_1||e===di.UNSIGNED_SHORT_5_6_5};di.getTypedArrayConstructor=function(e){let t=di.sizeInBytes(e);return t===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:t===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:t===Float32Array.BYTES_PER_ELEMENT&&e===di.FLOAT?Float32Array:Uint32Array};var Ue=Object.freeze(di);var rt={DEPTH_COMPONENT:ne.DEPTH_COMPONENT,DEPTH_STENCIL:ne.DEPTH_STENCIL,ALPHA:ne.ALPHA,RED:ne.RED,RG:ne.RG,RGB:ne.RGB,RGBA:ne.RGBA,LUMINANCE:ne.LUMINANCE,LUMINANCE_ALPHA:ne.LUMINANCE_ALPHA,RGB_DXT1:ne.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:ne.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:ne.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:ne.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:ne.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:ne.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:ne.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:ne.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:ne.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:ne.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:ne.COMPRESSED_RGBA_BPTC_UNORM};rt.componentsLength=function(e){switch(e){case rt.RGB:return 3;case rt.RGBA:return 4;case rt.LUMINANCE_ALPHA:case rt.RG:return 2;case rt.ALPHA:case rt.RED:case rt.LUMINANCE:return 1;default:return 1}};rt.validate=function(e){return e===rt.DEPTH_COMPONENT||e===rt.DEPTH_STENCIL||e===rt.ALPHA||e===rt.RED||e===rt.RG||e===rt.RGB||e===rt.RGBA||e===rt.LUMINANCE||e===rt.LUMINANCE_ALPHA||e===rt.RGB_DXT1||e===rt.RGBA_DXT1||e===rt.RGBA_DXT3||e===rt.RGBA_DXT5||e===rt.RGB_PVRTC_4BPPV1||e===rt.RGB_PVRTC_2BPPV1||e===rt.RGBA_PVRTC_4BPPV1||e===rt.RGBA_PVRTC_2BPPV1||e===rt.RGBA_ASTC||e===rt.RGB_ETC1||e===rt.RGB8_ETC2||e===rt.RGBA8_ETC2_EAC||e===rt.RGBA_BC7};rt.isColorFormat=function(e){return e===rt.RED||e===rt.ALPHA||e===rt.RGB||e===rt.RGBA||e===rt.LUMINANCE||e===rt.LUMINANCE_ALPHA};rt.isDepthFormat=function(e){return e===rt.DEPTH_COMPONENT||e===rt.DEPTH_STENCIL};rt.isCompressedFormat=function(e){return e===rt.RGB_DXT1||e===rt.RGBA_DXT1||e===rt.RGBA_DXT3||e===rt.RGBA_DXT5||e===rt.RGB_PVRTC_4BPPV1||e===rt.RGB_PVRTC_2BPPV1||e===rt.RGBA_PVRTC_4BPPV1||e===rt.RGBA_PVRTC_2BPPV1||e===rt.RGBA_ASTC||e===rt.RGB_ETC1||e===rt.RGB8_ETC2||e===rt.RGBA8_ETC2_EAC||e===rt.RGBA_BC7};rt.isDXTFormat=function(e){return e===rt.RGB_DXT1||e===rt.RGBA_DXT1||e===rt.RGBA_DXT3||e===rt.RGBA_DXT5};rt.isPVRTCFormat=function(e){return e===rt.RGB_PVRTC_4BPPV1||e===rt.RGB_PVRTC_2BPPV1||e===rt.RGBA_PVRTC_4BPPV1||e===rt.RGBA_PVRTC_2BPPV1};rt.isASTCFormat=function(e){return e===rt.RGBA_ASTC};rt.isETC1Format=function(e){return e===rt.RGB_ETC1};rt.isETC2Format=function(e){return e===rt.RGB8_ETC2||e===rt.RGBA8_ETC2_EAC};rt.isBC7Format=function(e){return e===rt.RGBA_BC7};rt.compressedTextureSizeInBytes=function(e,t,n){switch(e){case rt.RGB_DXT1:case rt.RGBA_DXT1:case rt.RGB_ETC1:case rt.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case rt.RGBA_DXT3:case rt.RGBA_DXT5:case rt.RGBA_ASTC:case rt.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case rt.RGB_PVRTC_4BPPV1:case rt.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case rt.RGB_PVRTC_2BPPV1:case rt.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case rt.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};rt.textureSizeInBytes=function(e,t,n,i){let o=rt.componentsLength(e);return Ue.isPacked(t)&&(o=1),o*Ue.sizeInBytes(t)*n*i};rt.alignmentInBytes=function(e,t,n){let i=rt.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};rt.createTypedArray=function(e,t,n,i){let o=Ue.getTypedArrayConstructor(t),r=rt.componentsLength(e)*n*i;return new o(r)};rt.flipY=function(e,t,n,i,o){if(o===1)return e;let r=rt.createTypedArray(t,n,i,o),s=rt.componentsLength(t),a=i*s;for(let l=0;l<o;++l){let u=l*i*s,f=(o-l-1)*i*s;for(let h=0;h<a;++h)r[f+h]=e[u+h]}return r};rt.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===rt.DEPTH_STENCIL)return ne.DEPTH24_STENCIL8;if(e===rt.DEPTH_COMPONENT){if(t===Ue.UNSIGNED_SHORT)return ne.DEPTH_COMPONENT16;if(t===Ue.UNSIGNED_INT)return ne.DEPTH_COMPONENT24}if(t===Ue.FLOAT)switch(e){case rt.RGBA:return ne.RGBA32F;case rt.RGB:return ne.RGB32F;case rt.RG:return ne.RG32F;case rt.RED:return ne.R32F}if(t===Ue.HALF_FLOAT)switch(e){case rt.RGBA:return ne.RGBA16F;case rt.RGB:return ne.RGB16F;case rt.RG:return ne.RG16F;case rt.RED:return ne.R16F}return e};var ke=Object.freeze(rt);var Sr={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_maximumSamples:0,_highpFloatSupported:!1,_highpIntSupported:!1};Object.defineProperties(Sr,{maximumCombinedTextureImageUnits:{get:function(){return Sr._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return Sr._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return Sr._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return Sr._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return Sr._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return Sr._maximumTextureSize}},maximumVaryingVectors:{get:function(){return Sr._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return Sr._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return Sr._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return Sr._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return Sr._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return Sr._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return Sr._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return Sr._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return Sr._maximumViewportWidth}},maximumViewportHeight:{get:function(){return Sr._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return Sr._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return Sr._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return Sr._maximumColorAttachments}},maximumSamples:{get:function(){return Sr._maximumSamples}},highpFloatSupported:{get:function(){return Sr._highpFloatSupported}},highpIntSupported:{get:function(){return Sr._highpIntSupported}}});var ut=Sr;function mj(e,t,n){let i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function sV(e,t,n){let i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Rd(e){e=e??W.EMPTY_OBJECT;let t=e.context;T.defined("options.context",t);let n=t._gl,i=ut.maximumColorAttachments;if(this._gl=n,this._framebuffer=n.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=e.destroyAttachments??!0,c(e.colorTextures)&&c(e.colorRenderbuffers))throw new E("Cannot have both color texture and color renderbuffer attachments.");if(c(e.depthTexture)&&c(e.depthRenderbuffer))throw new E("Cannot have both a depth texture and depth renderbuffer attachment.");if(c(e.depthStencilTexture)&&c(e.depthStencilRenderbuffer))throw new E("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.");let o=c(e.depthTexture)||c(e.depthRenderbuffer),r=c(e.depthStencilTexture)||c(e.depthStencilRenderbuffer);if(o&&r)throw new E("Cannot have both a depth and depth-stencil attachment.");if(c(e.stencilRenderbuffer)&&r)throw new E("Cannot have both a stencil and depth-stencil attachment.");if(o&&c(e.stencilRenderbuffer))throw new E("Cannot have both a depth and stencil attachment.");if(this._bind(),c(e.colorTextures)){let s=e.colorTextures,a=this._colorTextures.length=this._activeColorAttachments.length=s.length;if(a>i)throw new E("The number of color attachments exceeds the number supported.");for(let l=0;l<a;++l){let u=s[l];if(!ke.isColorFormat(u.pixelFormat))throw new E("The color-texture pixel-format must be a color format.");if(u.pixelDatatype===Ue.FLOAT&&!t.colorBufferFloat)throw new E("The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat.");if(u.pixelDatatype===Ue.HALF_FLOAT&&!t.colorBufferHalfFloat)throw new E("The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat.");let f=this._gl.COLOR_ATTACHMENT0+l;mj(this,f,u),this._activeColorAttachments[l]=f,this._colorTextures[l]=u}}if(c(e.colorRenderbuffers)){let s=e.colorRenderbuffers,a=this._colorRenderbuffers.length=this._activeColorAttachments.length=s.length;if(a>i)throw new E("The number of color attachments exceeds the number supported.");for(let l=0;l<a;++l){let u=s[l],f=this._gl.COLOR_ATTACHMENT0+l;sV(this,f,u),this._activeColorAttachments[l]=f,this._colorRenderbuffers[l]=u}}if(c(e.depthTexture)){let s=e.depthTexture;if(s.pixelFormat!==ke.DEPTH_COMPONENT)throw new E("The depth-texture pixel-format must be DEPTH_COMPONENT.");mj(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(c(e.depthRenderbuffer)){let s=e.depthRenderbuffer;sV(this,this._gl.DEPTH_ATTACHMENT,s),this._depthRenderbuffer=s}if(c(e.stencilRenderbuffer)){let s=e.stencilRenderbuffer;sV(this,this._gl.STENCIL_ATTACHMENT,s),this._stencilRenderbuffer=s}if(c(e.depthStencilTexture)){let s=e.depthStencilTexture;if(s.pixelFormat!==ke.DEPTH_STENCIL)throw new E("The depth-stencil pixel-format must be DEPTH_STENCIL.");mj(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}if(c(e.depthStencilRenderbuffer)){let s=e.depthStencilRenderbuffer;sV(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilRenderbuffer=s}this._unBind()}Object.defineProperties(Rd.prototype,{status:{get:function(){this._bind();let e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}});Rd.prototype._bind=function(){let e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};Rd.prototype._unBind=function(){let e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};Rd.prototype.bindDraw=function(){let e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};Rd.prototype.bindRead=function(){let e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};Rd.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};Rd.prototype.getColorTexture=function(e){if(!c(e)||e<0||e>=this._colorTextures.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]};Rd.prototype.getColorRenderbuffer=function(e){if(!c(e)||e<0||e>=this._colorRenderbuffers.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]};Rd.prototype.isDestroyed=function(){return!1};Rd.prototype.destroy=function(){if(this.destroyAttachments){let e=this._colorTextures;for(let n=0;n<e.length;++n){let i=e[n];c(i)&&i.destroy()}let t=this._colorRenderbuffers;for(let n=0;n<t.length;++n){let i=t[n];c(i)&&i.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),de(this)};var Ur=Rd;var aV={CLOCKWISE:ne.CW,COUNTER_CLOCKWISE:ne.CCW};aV.validate=function(e){return e===aV.CLOCKWISE||e===aV.COUNTER_CLOCKWISE};var ts=Object.freeze(aV);function Cee(e){if(typeof e!="object"||e===null)return e;let t,n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&t!=="_applyFunctions"&&(e[t]=Cee(e[t]));return Object.freeze(e)}var Sv=Cee;function Eee(e){return e===ne.FUNC_ADD||e===ne.FUNC_SUBTRACT||e===ne.FUNC_REVERSE_SUBTRACT||e===ne.MIN||e===ne.MAX}function cV(e){return e===ne.ZERO||e===ne.ONE||e===ne.SRC_COLOR||e===ne.ONE_MINUS_SRC_COLOR||e===ne.DST_COLOR||e===ne.ONE_MINUS_DST_COLOR||e===ne.SRC_ALPHA||e===ne.ONE_MINUS_SRC_ALPHA||e===ne.DST_ALPHA||e===ne.ONE_MINUS_DST_ALPHA||e===ne.CONSTANT_COLOR||e===ne.ONE_MINUS_CONSTANT_COLOR||e===ne.CONSTANT_ALPHA||e===ne.ONE_MINUS_CONSTANT_ALPHA||e===ne.SRC_ALPHA_SATURATE}function _De(e){return e===ne.FRONT||e===ne.BACK||e===ne.FRONT_AND_BACK}function gDe(e){return e===ne.NEVER||e===ne.LESS||e===ne.EQUAL||e===ne.LEQUAL||e===ne.GREATER||e===ne.NOTEQUAL||e===ne.GEQUAL||e===ne.ALWAYS}function See(e){return e===ne.NEVER||e===ne.LESS||e===ne.EQUAL||e===ne.LEQUAL||e===ne.GREATER||e===ne.NOTEQUAL||e===ne.GEQUAL||e===ne.ALWAYS}function aC(e){return e===ne.ZERO||e===ne.KEEP||e===ne.REPLACE||e===ne.INCR||e===ne.DECR||e===ne.INVERT||e===ne.INCR_WRAP||e===ne.DECR_WRAP}function um(e){let t=e??W.EMPTY_OBJECT,n=t.cull??W.EMPTY_OBJECT,i=t.polygonOffset??W.EMPTY_OBJECT,o=t.scissorTest??W.EMPTY_OBJECT,r=o.rectangle??W.EMPTY_OBJECT,s=t.depthRange??W.EMPTY_OBJECT,a=t.depthTest??W.EMPTY_OBJECT,l=t.colorMask??W.EMPTY_OBJECT,u=t.blending??W.EMPTY_OBJECT,f=u.color??W.EMPTY_OBJECT,h=t.stencilTest??W.EMPTY_OBJECT,p=h.frontOperation??W.EMPTY_OBJECT,g=h.backOperation??W.EMPTY_OBJECT,m=t.sampleCoverage??W.EMPTY_OBJECT,y=t.viewport;if(this.frontFace=t.frontFace??ts.COUNTER_CLOCKWISE,this.cull={enabled:n.enabled??!1,face:n.face??ne.BACK},this.lineWidth=t.lineWidth??1,this.polygonOffset={enabled:i.enabled??!1,factor:i.factor??0,units:i.units??0},this.scissorTest={enabled:o.enabled??!1,rectangle:Ke.clone(r)},this.depthRange={near:s.near??0,far:s.far??1},this.depthTest={enabled:a.enabled??!1,func:a.func??ne.LESS},this.colorMask={red:l.red??!0,green:l.green??!0,blue:l.blue??!0,alpha:l.alpha??!0},this.depthMask=t.depthMask??!0,this.stencilMask=t.stencilMask??-1,this.blending={enabled:u.enabled??!1,color:new G(f.red??0,f.green??0,f.blue??0,f.alpha??0),equationRgb:u.equationRgb??ne.FUNC_ADD,equationAlpha:u.equationAlpha??ne.FUNC_ADD,functionSourceRgb:u.functionSourceRgb??ne.ONE,functionSourceAlpha:u.functionSourceAlpha??ne.ONE,functionDestinationRgb:u.functionDestinationRgb??ne.ZERO,functionDestinationAlpha:u.functionDestinationAlpha??ne.ZERO},this.stencilTest={enabled:h.enabled??!1,frontFunction:h.frontFunction??ne.ALWAYS,backFunction:h.backFunction??ne.ALWAYS,reference:h.reference??0,mask:h.mask??-1,frontOperation:{fail:p.fail??ne.KEEP,zFail:p.zFail??ne.KEEP,zPass:p.zPass??ne.KEEP},backOperation:{fail:g.fail??ne.KEEP,zFail:g.zFail??ne.KEEP,zPass:g.zPass??ne.KEEP}},this.sampleCoverage={enabled:m.enabled??!1,value:m.value??1,invert:m.invert??!1},this.viewport=c(y)?new Ke(y.x,y.y,y.width,y.height):void 0,this.lineWidth<ut.minimumAliasedLineWidth||this.lineWidth>ut.maximumAliasedLineWidth)throw new E("renderState.lineWidth is out of range.  Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!ts.validate(this.frontFace))throw new E("Invalid renderState.frontFace.");if(!_De(this.cull.face))throw new E("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new E("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new E("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new E("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new E("renderState.depthRange.far must be less than or equal to one.");if(!gDe(this.depthTest.func))throw new E("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new E("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!Eee(this.blending.equationRgb))throw new E("Invalid renderState.blending.equationRgb.");if(!Eee(this.blending.equationAlpha))throw new E("Invalid renderState.blending.equationAlpha.");if(!cV(this.blending.functionSourceRgb))throw new E("Invalid renderState.blending.functionSourceRgb.");if(!cV(this.blending.functionSourceAlpha))throw new E("Invalid renderState.blending.functionSourceAlpha.");if(!cV(this.blending.functionDestinationRgb))throw new E("Invalid renderState.blending.functionDestinationRgb.");if(!cV(this.blending.functionDestinationAlpha))throw new E("Invalid renderState.blending.functionDestinationAlpha.");if(!See(this.stencilTest.frontFunction))throw new E("Invalid renderState.stencilTest.frontFunction.");if(!See(this.stencilTest.backFunction))throw new E("Invalid renderState.stencilTest.backFunction.");if(!aC(this.stencilTest.frontOperation.fail))throw new E("Invalid renderState.stencilTest.frontOperation.fail.");if(!aC(this.stencilTest.frontOperation.zFail))throw new E("Invalid renderState.stencilTest.frontOperation.zFail.");if(!aC(this.stencilTest.frontOperation.zPass))throw new E("Invalid renderState.stencilTest.frontOperation.zPass.");if(!aC(this.stencilTest.backOperation.fail))throw new E("Invalid renderState.stencilTest.backOperation.fail.");if(!aC(this.stencilTest.backOperation.zFail))throw new E("Invalid renderState.stencilTest.backOperation.zFail.");if(!aC(this.stencilTest.backOperation.zPass))throw new E("Invalid renderState.stencilTest.backOperation.zPass.");if(c(this.viewport)){if(this.viewport.width<0)throw new E("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new E("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>ut.maximumViewportWidth)throw new E(`renderState.viewport.width must be less than or equal to the maximum viewport width (${ut.maximumViewportWidth.toString()}).  Check maximumViewportWidth.`);if(this.viewport.height>ut.maximumViewportHeight)throw new E(`renderState.viewport.height must be less than or equal to the maximum viewport height (${ut.maximumViewportHeight.toString()}).  Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}var yDe=0,lm={};um.fromCache=function(e){let t=JSON.stringify(e),n=lm[t];if(c(n))return++n.referenceCount,n.state;let i=new um(e),o=JSON.stringify(i);return n=lm[o],c(n)||(i.id=yDe++,i=Sv(i),n={referenceCount:0,state:i},lm[o]=n),++n.referenceCount,lm[t]={referenceCount:1,state:n.state},n.state};um.removeFromCache=function(e){let t=new um(e),n=JSON.stringify(t),i=lm[n],o=JSON.stringify(e),r=lm[o];c(r)&&(--r.referenceCount,r.referenceCount===0&&(delete lm[o],c(i)&&--i.referenceCount)),c(i)&&i.referenceCount===0&&delete lm[n]};um.getCache=function(){return lm};um.clearCache=function(){lm={}};function pb(e,t,n){n?e.enable(t):e.disable(t)}function wee(e,t){e.frontFace(t.frontFace)}function vee(e,t){let n=t.cull,i=n.enabled;pb(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function Dee(e,t){e.lineWidth(t.lineWidth)}function Pee(e,t){let n=t.polygonOffset,i=n.enabled;pb(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function Iee(e,t,n){let i=t.scissorTest,o=c(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(pb(e,e.SCISSOR_TEST,o),o){let r=c(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function Oee(e,t){let n=t.depthRange;e.depthRange(n.near,n.far)}function Ree(e,t){let n=t.depthTest,i=n.enabled;pb(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function Mee(e,t){let n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function Lee(e,t){e.depthMask(t.depthMask)}function Nee(e,t){e.stencilMask(t.stencilMask)}function bDe(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function Fee(e,t,n){let i=t.blending,o=c(n.blendingEnabled)?n.blendingEnabled:i.enabled;pb(e,e.BLEND,o),o&&(bDe(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function Bee(e,t){let n=t.stencilTest,i=n.enabled;if(pb(e,e.STENCIL_TEST,i),i){let o=n.frontFunction,r=n.backFunction,s=n.reference,a=n.mask;e.stencilFunc(o,s,a),e.stencilFuncSeparate(e.BACK,r,s,a),e.stencilFuncSeparate(e.FRONT,o,s,a);let l=n.frontOperation,u=l.fail,f=l.zFail,h=l.zPass;e.stencilOpSeparate(e.FRONT,u,f,h);let p=n.backOperation,g=p.fail,m=p.zFail,y=p.zPass;e.stencilOpSeparate(e.BACK,g,m,y)}}function kee(e,t){let n=t.sampleCoverage,i=n.enabled;pb(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}var xDe=new Ke;function Uee(e,t,n){let i=t.viewport??n.viewport;c(i)||(i=xDe,i.width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}um.apply=function(e,t,n){wee(e,t),vee(e,t),Dee(e,t),Pee(e,t),Oee(e,t),Ree(e,t),Mee(e,t),Lee(e,t),Nee(e,t),Bee(e,t),kee(e,t),Iee(e,t,n),Fee(e,t,n),Uee(e,t,n)};function TDe(e,t){let n=[];return e.frontFace!==t.frontFace&&n.push(wee),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(vee),e.lineWidth!==t.lineWidth&&n.push(Dee),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(Pee),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(Oee),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(Ree),(e.colorMask.red!==t.colorMask.red||e.colorMask.green!==t.colorMask.green||e.colorMask.blue!==t.colorMask.blue||e.colorMask.alpha!==t.colorMask.alpha)&&n.push(Mee),e.depthMask!==t.depthMask&&n.push(Lee),e.stencilMask!==t.stencilMask&&n.push(Nee),(e.stencilTest.enabled!==t.stencilTest.enabled||e.stencilTest.frontFunction!==t.stencilTest.frontFunction||e.stencilTest.backFunction!==t.stencilTest.backFunction||e.stencilTest.reference!==t.stencilTest.reference||e.stencilTest.mask!==t.stencilTest.mask||e.stencilTest.frontOperation.fail!==t.stencilTest.frontOperation.fail||e.stencilTest.frontOperation.zFail!==t.stencilTest.frontOperation.zFail||e.stencilTest.backOperation.fail!==t.stencilTest.backOperation.fail||e.stencilTest.backOperation.zFail!==t.stencilTest.backOperation.zFail||e.stencilTest.backOperation.zPass!==t.stencilTest.backOperation.zPass)&&n.push(Bee),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(kee),n}um.partialApply=function(e,t,n,i,o,r){if(t!==n){let f=n._applyFunctions[t.id];c(f)||(f=TDe(t,n),n._applyFunctions[t.id]=f);let h=f.length;for(let p=0;p<h;++p)f[p](e,n)}let s=c(i.scissorTest)?i.scissorTest:t.scissorTest,a=c(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&Iee(e,n,o);let l=c(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,u=c(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(l!==u||u&&t.blending!==n.blending)&&Fee(e,n,o),(t!==n||i!==o||i.context!==o.context)&&Uee(e,n,o)};um.getState=function(e){if(!c(e))throw new E("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:Ke.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:G.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:c(e.viewport)?Ke.clone(e.viewport):void 0}};var Ve=um;function Kt(e,t,n,i){this[0]=e??0,this[1]=n??0,this[2]=t??0,this[3]=i??0}Kt.packedLength=4;Kt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};Kt.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new Kt),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};Kt.packArray=function(e,t){T.defined("array",e);let n=e.length,i=n*4;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)Kt.pack(e[o],t,o*4);return t};Kt.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new E("array length must be a multiple of 4.");let n=e.length;c(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){let o=i/4;t[o]=Kt.unpack(e,i,t[o])}return t};Kt.clone=function(e,t){if(c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Kt(e[0],e[2],e[1],e[3])};Kt.fromArray=Kt.unpack;Kt.fromColumnMajorArray=function(e,t){return T.defined("values",e),Kt.clone(e,t)};Kt.fromRowMajorArray=function(e,t){return T.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Kt(e[0],e[1],e[2],e[3])};Kt.fromScale=function(e,t){return T.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Kt(e.x,0,0,e.y)};Kt.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Kt(e,0,0,e)};Kt.fromRotation=function(e,t){T.typeOf.number("angle",e);let n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Kt(n,-i,i,n)};Kt.toArray=function(e,t){return T.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]};Kt.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,1),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,1),e*2+t};Kt.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("result",n);let i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};Kt.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=Kt.clone(e,i);let o=t*2;return i[o]=n.x,i[o+1]=n.y,i};Kt.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("result",n);let i=e[t],o=e[t+2];return n.x=i,n.y=o,n};Kt.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=Kt.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};var ADe=new H;Kt.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);let i=Kt.getScale(e,ADe),o=t.x/i.x,r=t.y/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};var CDe=new H;Kt.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);let i=Kt.getScale(e,CDe),o=t/i.x,r=t/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};var Vee=new H;Kt.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=H.magnitude(H.fromElements(e[0],e[1],Vee)),t.y=H.magnitude(H.fromElements(e[2],e[3],Vee)),t};var zee=new H;Kt.getMaximumScale=function(e){return Kt.getScale(e,zee),H.maximumComponent(zee)};var EDe=new H;Kt.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);let i=Kt.getScale(e,EDe);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.y,n[3]=t[3]*i.y,n};var SDe=new H;Kt.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=Kt.getScale(e,SDe);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.y,t[3]=e[3]/n.y,t};Kt.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);let i=e[0]*t[0]+e[2]*t[1],o=e[0]*t[2]+e[2]*t[3],r=e[1]*t[0]+e[3]*t[1],s=e[1]*t[2]+e[3]*t[3];return n[0]=i,n[1]=r,n[2]=o,n[3]=s,n};Kt.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n};Kt.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n};Kt.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);let i=e[0]*t.x+e[2]*t.y,o=e[1]*t.x+e[3]*t.y;return n.x=i,n.y=o,n};Kt.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Kt.multiplyByScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n};Kt.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Kt.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};Kt.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);let n=e[0],i=e[2],o=e[1],r=e[3];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t};Kt.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t};Kt.equals=function(e,t){return e===t||c(e)&&c(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]};Kt.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]};Kt.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n};Kt.IDENTITY=Object.freeze(new Kt(1,0,0,1));Kt.ZERO=Object.freeze(new Kt(0,0,0,0));Kt.COLUMN0ROW0=0;Kt.COLUMN0ROW1=1;Kt.COLUMN1ROW0=2;Kt.COLUMN1ROW1=3;Object.defineProperties(Kt.prototype,{length:{get:function(){return Kt.packedLength}}});Kt.prototype.clone=function(e){return Kt.clone(this,e)};Kt.prototype.equals=function(e){return Kt.equals(this,e)};Kt.prototype.equalsEpsilon=function(e,t){return Kt.equalsEpsilon(this,e,t)};Kt.prototype.toString=function(){return`(${this[0]}, ${this[2]})
(${this[1]}, ${this[3]})`};var Ri=Kt;function wDe(e,t,n,i){switch(t.type){case e.FLOAT:return new Hee(e,t,n,i);case e.FLOAT_VEC2:return new Gee(e,t,n,i);case e.FLOAT_VEC3:return new jee(e,t,n,i);case e.FLOAT_VEC4:return new Wee(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new pj(e,t,n,i);case e.INT:case e.BOOL:return new qee(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new Yee(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new Xee(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new Kee(e,t,n,i);case e.FLOAT_MAT2:return new $ee(e,t,n,i);case e.FLOAT_MAT3:return new Zee(e,t,n,i);case e.FLOAT_MAT4:return new Qee(e,t,n,i);default:throw new ae(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function Hee(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}Hee.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function Gee(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}Gee.prototype.set=function(){let e=this.value;H.equals(e,this._value)||(H.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))};function jee(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}jee.prototype.set=function(){let e=this.value;if(c(e.red))G.equals(e,this._value)||(this._value=G.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(c(e.x))d.equals(e,this._value)||(this._value=d.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new E(`Invalid vec3 value for uniform "${this.name}".`)};function Wee(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}Wee.prototype.set=function(){let e=this.value;if(c(e.red))G.equals(e,this._value)||(this._value=G.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else if(c(e.x))se.equals(e,this._value)||(this._value=se.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w));else throw new E(`Invalid vec4 value for uniform "${this.name}".`)};function pj(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}pj.prototype.set=function(){let e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);let t=this.value;e.bindTexture(t._target,t._texture)};pj.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function qee(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}qee.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function Yee(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}Yee.prototype.set=function(){let e=this.value;H.equals(e,this._value)||(H.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))};function Xee(e,t,n,i){this.name=n,this.value=void 0,this._value=new d,this._gl=e,this._location=i}Xee.prototype.set=function(){let e=this.value;d.equals(e,this._value)||(d.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function Kee(e,t,n,i){this.name=n,this.value=void 0,this._value=new se,this._gl=e,this._location=i}Kee.prototype.set=function(){let e=this.value;se.equals(e,this._value)||(se.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};var vDe=new Float32Array(4);function $ee(e,t,n,i){this.name=n,this.value=void 0,this._value=new Ri,this._gl=e,this._location=i}$ee.prototype.set=function(){if(!Ri.equalsArray(this.value,this._value,0)){Ri.clone(this.value,this._value);let e=Ri.toArray(this.value,vDe);this._gl.uniformMatrix2fv(this._location,!1,e)}};var DDe=new Float32Array(9);function Zee(e,t,n,i){this.name=n,this.value=void 0,this._value=new J,this._gl=e,this._location=i}Zee.prototype.set=function(){if(!J.equalsArray(this.value,this._value,0)){J.clone(this.value,this._value);let e=J.toArray(this.value,DDe);this._gl.uniformMatrix3fv(this._location,!1,e)}};var PDe=new Float32Array(16);function Qee(e,t,n,i){this.name=n,this.value=void 0,this._value=new B,this._gl=e,this._location=i}Qee.prototype.set=function(){if(!B.equalsArray(this.value,this._value,0)){B.clone(this.value,this._value);let e=B.toArray(this.value,PDe);this._gl.uniformMatrix4fv(this._location,!1,e)}};var wv=wDe;function IDe(e,t,n,i){switch(t.type){case e.FLOAT:return new Jee(e,t,n,i);case e.FLOAT_VEC2:return new ete(e,t,n,i);case e.FLOAT_VEC3:return new tte(e,t,n,i);case e.FLOAT_VEC4:return new nte(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new _j(e,t,n,i);case e.INT:case e.BOOL:return new ite(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new ote(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new rte(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new ste(e,t,n,i);case e.FLOAT_MAT2:return new ate(e,t,n,i);case e.FLOAT_MAT3:return new cte(e,t,n,i);case e.FLOAT_MAT4:return new lte(e,t,n,i);default:throw new ae(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function Jee(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._location=i[0]}Jee.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1;for(let o=0;o<t;++o){let r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1fv(this._location,n)};function ete(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*2),this._gl=e,this._location=i[0]}ete.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];H.equalsArray(s,n,o)||(H.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2fv(this._location,n)};function tte(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*3),this._gl=e,this._location=i[0]}tte.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];if(c(s.red))(s.red!==n[o]||s.green!==n[o+1]||s.blue!==n[o+2])&&(n[o]=s.red,n[o+1]=s.green,n[o+2]=s.blue,i=!0);else if(c(s.x))d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0);else throw new E("Invalid vec3 value.");o+=3}i&&this._gl.uniform3fv(this._location,n)};function nte(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}nte.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];if(c(s.red))G.equalsArray(s,n,o)||(G.pack(s,n,o),i=!0);else if(c(s.x))se.equalsArray(s,n,o)||(se.pack(s,n,o),i=!0);else throw new E("Invalid vec4 value.");o+=4}i&&this._gl.uniform4fv(this._location,n)};function _j(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._locations=i,this.textureUnitIndex=void 0}_j.prototype.set=function(){let e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let o=0;o<i;++o){let r=n[o];e.activeTexture(t+o),e.bindTexture(r._target,r._texture)}};_j.prototype._setSampler=function(e){this.textureUnitIndex=e;let t=this._locations,n=t.length;for(let i=0;i<n;++i){let o=e+i;this._gl.uniform1i(t[i],o)}return e+n};function ite(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o),this._gl=e,this._location=i[0]}ite.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1;for(let o=0;o<t;++o){let r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1iv(this._location,n)};function ote(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*2),this._gl=e,this._location=i[0]}ote.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];H.equalsArray(s,n,o)||(H.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2iv(this._location,n)};function rte(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*3),this._gl=e,this._location=i[0]}rte.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)};function ste(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*4),this._gl=e,this._location=i[0]}ste.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];se.equalsArray(s,n,o)||(se.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniform4iv(this._location,n)};function ate(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}ate.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];Ri.equalsArray(s,n,o)||(Ri.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function cte(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*9),this._gl=e,this._location=i[0]}cte.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];J.equalsArray(s,n,o)||(J.pack(s,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)};function lte(e,t,n,i){let o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*16),this._gl=e,this._location=i[0]}lte.prototype.set=function(){let e=this.value,t=e.length,n=this._value,i=!1,o=0;for(let r=0;r<t;++r){let s=e[r];B.equalsArray(s,n,o)||(B.pack(s,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};var vv=IDe;var ODe=0;function Dp(e){let t=e.vertexShaderText,n=e.fragmentShaderText;typeof spector<"u"&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));let i=RDe(t,n);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=i.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=i.fragmentShaderText,this.id=ODe++}Dp.fromCache=function(e){return e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)};Dp.replaceCache=function(e){return e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(Dp.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return lV(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return lV(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return lV(this),this._uniformsByName}}});function ute(e){let t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(c(n)){let i=n.length;for(let o=0;o<i;o++){let r=n[o].trim(),s=r.slice(r.lastIndexOf(" ")+1);t.push(s)}}return t}function RDe(e,t){let n={};if(!ut.highpFloatSupported||!ut.highpIntSupported){let i,o,r,s,a=ute(e),l=ute(t),u=a.length,f=l.length;for(i=0;i<u;i++)for(o=0;o<f;o++)if(a[i]===l[o]){r=a[i],s=`czm_mediump_${r}`;let h=new RegExp(`${r}\\b`,"g");t=t.replace(h,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}var fm="[Cesium WebGL] ";function MDe(e,t){let n=t._vertexShaderText,i=t._fragmentShaderText,o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,n),e.compileShader(o);let r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,i),e.compileShader(r);let s=e.createProgram();e.attachShader(s,o),e.attachShader(s,r);let a=t._attributeLocations;if(c(a))for(let p in a)a.hasOwnProperty(p)&&e.bindAttribLocation(s,a[p],p);e.linkProgram(s);let l;if(e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(l=e.getShaderInfoLog(o),c(l)&&l.length>0&&console.log(`${fm}Vertex shader compile log: ${l}`),l=e.getShaderInfoLog(r),c(l)&&l.length>0&&console.log(`${fm}Fragment shader compile log: ${l}`),l=e.getProgramInfoLog(s),c(l)&&l.length>0&&console.log(`${fm}Shader program link log: ${l}`)),e.deleteShader(o),e.deleteShader(r),s;let u,f=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(l=e.getProgramInfoLog(s),console.error(`${fm}Shader program link log: ${l}`),h(o,"vertex"),h(r,"fragment"),u=`Program failed to link.  Link log: ${l}`):(l=e.getShaderInfoLog(o),console.error(`${fm}Vertex shader compile log: ${l}`),console.error(`${fm} Vertex shader source:
${n}`),u=`Vertex shader failed to compile.  Compile log: ${l}`):(l=e.getShaderInfoLog(r),console.error(`${fm}Fragment shader compile log: ${l}`),console.error(`${fm} Fragment shader source:
${i}`),u=`Fragment shader failed to compile.  Compile log: ${l}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new ae(u);function h(p,g){if(!c(f))return;let m=f.getTranslatedShaderSource(p);if(m===""){console.error(`${fm}${g} shader translation failed.`);return}console.error(`${fm}Translated ${g} shaderSource:
${m}`)}}function LDe(e,t,n){let i={};for(let o=0;o<n;++o){let r=e.getActiveAttrib(t,o),s=e.getAttribLocation(t,r.name);i[r.name]={name:r.name,type:r.type,index:s}}return i}function NDe(e,t){let n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){let a=e.getActiveUniform(t,s),l="[0]",u=a.name.indexOf(l,a.name.length-l.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(u.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){let f=e.getUniformLocation(t,u);if(f!==null){let h=wv(e,a,u,f);n[u]=h,i.push(h),h._setSampler&&o.push(h)}}else{let f,h,p,g,m=u.indexOf("[");if(m>=0){if(f=n[u.slice(0,m)],!c(f))continue;h=f._locations,h.length<=1&&(p=f.value,g=e.getUniformLocation(t,u),g!==null&&(h.push(g),p.push(e.getUniform(t,g))))}else{h=[];for(let y=0;y<a.size;++y)g=e.getUniformLocation(t,`${u}[${y}]`),g!==null&&h.push(g);f=vv(e,a,u,h),n[u]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function FDe(e,t){let n=[],i=[];for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=o,a=e._duplicateUniformNames[s];c(a)&&(r.name=a,s=a);let l=Ap[s];c(l)?n.push({uniform:r,automaticUniform:l}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function BDe(e,t,n){e.useProgram(t);let i=0,o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}function lV(e){c(e._program)||fte(e)}function fte(e){let t=e._program,n=e._gl,i=MDe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=NDe(n,i),s=FDe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=LDe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=BDe(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,l,u,f){let h=e._vertexShaderText,p=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=l.replace(g," != ");try{fte(e),u(e._program)}catch(m){e._vertexShaderText=h,e._fragmentShaderText=p;let b=/(?:Compile|Link) error: ([^]*)/.exec(m.message);f(b?b[1]:m.message)}})}Dp.prototype._bind=function(){lV(this),this._gl.useProgram(this._program)};Dp.prototype._setUniforms=function(e,t,n){let i,o;if(c(e)){let a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){let l=a[o];if(!c(e[l.name]))throw new E(`Unknown uniform: ${l.name}`);l.value=e[l.name]()}}let r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){let a=r[o];a.uniform.value=a.automaticUniform.getValue(t)}let s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){let a=this._gl,l=this._program;if(a.validateProgram(l),!a.getProgramParameter(l,a.VALIDATE_STATUS))throw new E(`Program validation failed.  Program info log: ${a.getProgramInfoLog(l)}`)}};Dp.prototype.isDestroyed=function(){return!1};Dp.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Dp.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),de(this)};var Jt=Dp;function uV(e){this._context=e}var Dv,kDe=new Qe({primitiveType:Me.TRIANGLES}),UDe=new ei({color:new G(0,0,0,0)});function VDe(e,t){return new Ur({context:e,colorTextures:[t],destroyAttachments:!1})}function zDe(e,t){return Jt.fromCache({context:e,vertexShaderSource:mb,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function HDe(e,t){return(!c(Dv)||Dv.viewport.width!==e||Dv.viewport.height!==t)&&(Dv=Ve.fromCache({viewport:new Ke(0,0,e,t)})),Dv}uV.prototype.execute=function(e){if(T.defined("computeCommand",e),c(e.preExecute)&&e.preExecute(e),!c(e.fragmentShaderSource)&&!c(e.shaderProgram))throw new E("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");T.defined("computeCommand.outputTexture",e.outputTexture);let t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=c(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=c(e.shaderProgram)?e.shaderProgram:zDe(o,e.fragmentShaderSource),a=VDe(o,t),l=HDe(n,i),u=e.uniformMap,f=UDe;f.framebuffer=a,f.renderState=l,f.execute(o);let h=kDe;h.vertexArray=r,h.renderState=l,h.shaderProgram=s,h.uniformMap=u,h.framebuffer=a,h.execute(o),a.destroy(),e.persists||(s.destroy(),c(e.vertexArray)&&r.destroy()),c(e.postExecute)&&e.postExecute(t)};uV.prototype.isDestroyed=function(){return!1};uV.prototype.destroy=function(){return de(this)};var Pv=uV;var wn={BYTE:ne.BYTE,UNSIGNED_BYTE:ne.UNSIGNED_BYTE,SHORT:ne.SHORT,UNSIGNED_SHORT:ne.UNSIGNED_SHORT,INT:ne.INT,UNSIGNED_INT:ne.UNSIGNED_INT,FLOAT:ne.FLOAT,DOUBLE:ne.DOUBLE};wn.getSizeInBytes=function(e){if(!c(e))throw new E("value is required.");switch(e){case wn.BYTE:return Int8Array.BYTES_PER_ELEMENT;case wn.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case wn.SHORT:return Int16Array.BYTES_PER_ELEMENT;case wn.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case wn.INT:return Int32Array.BYTES_PER_ELEMENT;case wn.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case wn.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case wn.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new E("componentDatatype is not a valid value.")}};wn.fromTypedArray=function(e){if(e instanceof Int8Array)return wn.BYTE;if(e instanceof Uint8Array)return wn.UNSIGNED_BYTE;if(e instanceof Int16Array)return wn.SHORT;if(e instanceof Uint16Array)return wn.UNSIGNED_SHORT;if(e instanceof Int32Array)return wn.INT;if(e instanceof Uint32Array)return wn.UNSIGNED_INT;if(e instanceof Float32Array)return wn.FLOAT;if(e instanceof Float64Array)return wn.DOUBLE;throw new E("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};wn.validate=function(e){return c(e)&&(e===wn.BYTE||e===wn.UNSIGNED_BYTE||e===wn.SHORT||e===wn.UNSIGNED_SHORT||e===wn.INT||e===wn.UNSIGNED_INT||e===wn.FLOAT||e===wn.DOUBLE)};wn.createTypedArray=function(e,t){if(!c(e))throw new E("componentDatatype is required.");if(!c(t))throw new E("valuesOrLength is required.");switch(e){case wn.BYTE:return new Int8Array(t);case wn.UNSIGNED_BYTE:return new Uint8Array(t);case wn.SHORT:return new Int16Array(t);case wn.UNSIGNED_SHORT:return new Uint16Array(t);case wn.INT:return new Int32Array(t);case wn.UNSIGNED_INT:return new Uint32Array(t);case wn.FLOAT:return new Float32Array(t);case wn.DOUBLE:return new Float64Array(t);default:throw new E("componentDatatype is not a valid value.")}};wn.createArrayBufferView=function(e,t,n,i){if(!c(e))throw new E("componentDatatype is required.");if(!c(t))throw new E("buffer is required.");switch(n=n??0,i=i??(t.byteLength-n)/wn.getSizeInBytes(e),e){case wn.BYTE:return new Int8Array(t,n,i);case wn.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case wn.SHORT:return new Int16Array(t,n,i);case wn.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case wn.INT:return new Int32Array(t,n,i);case wn.UNSIGNED_INT:return new Uint32Array(t,n,i);case wn.FLOAT:return new Float32Array(t,n,i);case wn.DOUBLE:return new Float64Array(t,n,i);default:throw new E("componentDatatype is not a valid value.")}};wn.fromName=function(e){switch(e){case"BYTE":return wn.BYTE;case"UNSIGNED_BYTE":return wn.UNSIGNED_BYTE;case"SHORT":return wn.SHORT;case"UNSIGNED_SHORT":return wn.UNSIGNED_SHORT;case"INT":return wn.INT;case"UNSIGNED_INT":return wn.UNSIGNED_INT;case"FLOAT":return wn.FLOAT;case"DOUBLE":return wn.DOUBLE;default:throw new E("name is not a valid value.")}};var $=Object.freeze(wn);var GDe={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},xf=Object.freeze(GDe);function gj(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=e.primitiveType??Me.TRIANGLES,this.boundingSphere=e.boundingSphere,this.geometryType=e.geometryType??xf.NONE,this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}gj.computeNumberOfVertices=function(e){T.typeOf.object("geometry",e);let t=-1;for(let n in e.attributes)if(e.attributes.hasOwnProperty(n)&&c(e.attributes[n])&&c(e.attributes[n].values)){let i=e.attributes[n],o=i.values.length/i.componentsPerAttribute;if(t!==o&&t!==-1)throw new E("All attribute lists must have the same number of attributes.");t=o}return t};var jDe=new he,WDe=new d,dte=new B,qDe=[new he,new he,new he],YDe=[new H,new H,new H],XDe=[new H,new H,new H],KDe=new d,$De=new Le,ZDe=new B,QDe=new Ri;gj._textureCoordinateRotationPoints=function(e,t,n,i){let o,r=ce.center(i,jDe),s=he.toCartesian(r,n,WDe),a=Ot.eastNorthUpToFixedFrame(s,n,dte),l=B.inverse(a,dte),u=YDe,f=qDe;f[0].longitude=i.west,f[0].latitude=i.south,f[1].longitude=i.west,f[1].latitude=i.north,f[2].longitude=i.east,f[2].latitude=i.south;let h=KDe;for(o=0;o<3;o++)he.toCartesian(f[o],n,h),h=B.multiplyByPointAsVector(l,h,h),u[o].x=h.x,u[o].y=h.y;let p=Le.fromAxisAngle(d.UNIT_Z,-t,$De),g=J.fromQuaternion(p,ZDe),m=e.length,y=Number.POSITIVE_INFINITY,b=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,A=Number.NEGATIVE_INFINITY;for(o=0;o<m;o++)h=B.multiplyByPointAsVector(l,e[o],h),h=J.multiplyByVector(g,h,h),y=Math.min(y,h.x),b=Math.min(b,h.y),x=Math.max(x,h.x),A=Math.max(A,h.y);let C=Ri.fromRotation(t,QDe),S=XDe;S[0].x=y,S[0].y=b,S[1].x=y,S[1].y=A,S[2].x=x,S[2].y=b;let v=u[0],P=u[2].x-v.x,M=u[1].y-v.y;for(o=0;o<3;o++){let w=S[o];Ri.multiplyByVector(C,w,w),w.x=(w.x-v.x)/P,w.y=(w.y-v.y)/M}let R=S[0],L=S[1],F=S[2],_=new Array(6);return H.pack(R,_),H.pack(L,_,2),H.pack(F,_,4),_};var ct=gj;function JDe(e){if(e=e??W.EMPTY_OBJECT,!c(e.componentDatatype))throw new E("options.componentDatatype is required.");if(!c(e.componentsPerAttribute))throw new E("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.values))throw new E("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=e.normalize??!1,this.values=e.values}var ve=JDe;function cC(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(cC.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}},arrayBufferView:{get:function(){return this._buffer}}});cC.clone=function(e){if(c(e))return new cC(e._format,e._datatype,e._width,e._height,e._buffer)};cC.prototype.clone=function(){return cC.clone(this)};var Iv=cC;var hte=Zo(du(),1);function mte(){if(!c(fa._canTransferArrayBuffer)){let e=xj("transferTypedArrayTest");e.postMessage=e.webkitPostMessage??e.postMessage;let t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return fa._canTransferArrayBuffer=!1,fa._canTransferArrayBuffer}fa._canTransferArrayBuffer=new Promise(i=>{e.onmessage=function(o){let r=o.data.array,s=c(r)&&r[0]===t;i(s),e.terminate(),fa._canTransferArrayBuffer=s}})}return fa._canTransferArrayBuffer}var bj=new pe;function yj(e){let t;try{t=new Blob([e],{type:"application/javascript"})}catch{let o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,r=new o;r.append(e),t=r.getBlob("application/javascript")}return(window.URL||window.webkitURL).createObjectURL(t)}function xj(e){let t=new hte.default(e),n=t.scheme().length!==0&&t.fragment().length===0,i=e.replace(/\.js$/,""),o={},r,s;if(Ug(e))s=e;else if(!n){let a=tn(`${fa._workerModulePrefix}/${i}.js`);Ug(a)&&(s=a)}if(s){let a=`import "${s}";`;return r=yj(a),o.type="module",new Worker(r,o)}if(!n&&typeof CESIUM_WORKERS<"u"){let a=`
      importScripts("${yj(CESIUM_WORKERS)}");
      CesiumWorkers["${i}"]();
    `;return r=yj(a),new Worker(r,o)}if(r=e,n||(r=tn(`${fa._workerModulePrefix+i}.js`)),!Vt.supportsEsmWebWorkers())throw new ae("This browser is not supported. Please update your browser to continue.");return o.type="module",new Worker(r,o)}async function ePe(e,t){let n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Vt.supportsWebAssembly()){if(!c(t.fallbackModulePath))throw new ae(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=tn(t.fallbackModulePath),n}n.wasmBinaryFile=tn(t.wasmBinaryFile);let i=await we.fetchArrayBuffer({url:n.wasmBinaryFile});return n.wasmBinary=i,n}function fa(e,t){this._workerPath=e,this._maximumActiveTasks=t??Number.POSITIVE_INFINITY,this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}var tPe=(e,t,n,i)=>{let o=({data:r})=>{if(r.id===t){if(c(r.error)){let s=r.error;s.name==="RuntimeError"?(s=new ae(r.error.message),s.stack=r.error.stack):s.name==="DeveloperError"?(s=new E(r.error.message),s.stack=r.error.stack):s.name==="Error"&&(s=new Error(r.error.message),s.stack=r.error.stack),bj.raiseEvent(s),i(s)}else bj.raiseEvent(),n(r.result);e.removeEventListener("message",o)}};return o},nPe=[];async function iPe(e,t,n){let i=await Promise.resolve(mte());c(n)?i||(n.length=0):n=nPe;let o=e._nextID++,r=new Promise((s,a)=>{e._worker.addEventListener("message",tPe(e._worker,o,s,a))});return e._worker.postMessage({id:o,baseUrl:tn.getCesiumBaseUrl().url,parameters:t,canTransferArrayBuffer:i},n),r}async function oPe(e,t,n){++e._activeTasks;try{let i=await iPe(e,t,n);return--e._activeTasks,i}catch(i){throw--e._activeTasks,i}}fa.prototype.scheduleTask=function(e,t){if(c(this._worker)||(this._worker=xj(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return oPe(this,e,t)};fa.prototype.initWebAssemblyModule=async function(e){if(c(this._webAssemblyPromise))return this._webAssemblyPromise;let t=async()=>{let n=this._worker=xj(this._workerPath),i=await ePe(this,e),o=await Promise.resolve(mte()),r,s=i.wasmBinary;c(s)&&o&&(r=[s]);let a=new Promise((l,u)=>{n.onmessage=function({data:f}){c(f)?l(f.result):u(new ae("Could not configure wasm module"))}});return n.postMessage({canTransferArrayBuffer:o,parameters:{webAssemblyConfig:i}},r),a};return this._webAssemblyPromise=t(),this._webAssemblyPromise};fa.prototype.isDestroyed=function(){return!1};fa.prototype.destroy=function(){return c(this._worker)&&this._worker.terminate(),de(this)};fa.taskCompletedEvent=bj;fa._defaultWorkerModulePrefix="Workers/";fa._workerModulePrefix=fa._defaultWorkerModulePrefix;fa._canTransferArrayBuffer=void 0;var yi=fa;function Pp(){}Pp._transcodeTaskProcessor=new yi("transcodeKTX2",Number.POSITIVE_INFINITY);Pp._readyPromise=void 0;function rPe(){let e=Pp._transcodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(t){if(t)return Pp._transcodeTaskProcessor;throw new ae("KTX2 transcoder could not be initialized.")});Pp._readyPromise=e}Pp.transcode=function(e,t){return T.defined("supportedTargetFormats",t),c(Pp._readyPromise)||rPe(),Pp._readyPromise.then(function(n){let i=e;e instanceof ArrayBuffer&&(i=new Uint8Array(e));let o={supportedTargetFormats:t,ktx2Buffer:i};return n.scheduleTask(o,[i.buffer])}).then(function(n){let i=n.length,o=Object.keys(n[0]);for(let r=0;r<i;r++){let s=n[r];for(let a=0;a<o.length;a++){let l=s[o[a]];s[o[a]]=new Iv(l.internalFormat,l.datatype,l.width,l.height,l.levelBuffer)}}if(o.length===1){for(let r=0;r<i;++r)n[r]=n[r][o[0]];i===1&&(n=n[0])}return n}).catch(function(n){throw n})};var Ov=Pp;var pte;_te.setKTX2SupportedFormats=function(e,t,n,i,o,r){pte={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function _te(e){T.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=we.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return Ov.transcode(n,pte)})}var Il=_te;function sPe(e,t){this.start=e??0,this.stop=t??0}var Ma=sPe;function hn(e,t){this.center=d.clone(e??d.ZERO),this.radius=t??0}var Cj=new d,Ej=new d,Sj=new d,wj=new d,vj=new d,Dj=new d,Pj=new d,da=new d,Ij=new d,Oj=new d,Rj=new d,Mj=new d,aPe=4/3*O.PI;hn.fromPoints=function(e,t){if(c(t)||(t=new hn),!c(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;let n=d.clone(e[0],Pj),i=d.clone(n,Cj),o=d.clone(n,Ej),r=d.clone(n,Sj),s=d.clone(n,wj),a=d.clone(n,vj),l=d.clone(n,Dj),u=e.length,f;for(f=1;f<u;f++){d.clone(e[f],n);let R=n.x,L=n.y,F=n.z;R<i.x&&d.clone(n,i),R>s.x&&d.clone(n,s),L<o.y&&d.clone(n,o),L>a.y&&d.clone(n,a),F<r.z&&d.clone(n,r),F>l.z&&d.clone(n,l)}let h=d.magnitudeSquared(d.subtract(s,i,da)),p=d.magnitudeSquared(d.subtract(a,o,da)),g=d.magnitudeSquared(d.subtract(l,r,da)),m=i,y=s,b=h;p>b&&(b=p,m=o,y=a),g>b&&(b=g,m=r,y=l);let x=Ij;x.x=(m.x+y.x)*.5,x.y=(m.y+y.y)*.5,x.z=(m.z+y.z)*.5;let A=d.magnitudeSquared(d.subtract(y,x,da)),C=Math.sqrt(A),S=Oj;S.x=i.x,S.y=o.y,S.z=r.z;let v=Rj;v.x=s.x,v.y=a.y,v.z=l.z;let P=d.midpoint(S,v,Mj),M=0;for(f=0;f<u;f++){d.clone(e[f],n);let R=d.magnitude(d.subtract(n,P,da));R>M&&(M=R);let L=d.magnitudeSquared(d.subtract(n,x,da));if(L>A){let F=Math.sqrt(L);C=(C+F)*.5,A=C*C;let _=F-C;x.x=(C*x.x+_*n.x)/F,x.y=(C*x.y+_*n.y)/F,x.z=(C*x.z+_*n.z)/F}}return C<M?(d.clone(x,t.center),t.radius=C):(d.clone(P,t.center),t.radius=M),t};var gte=new Oi,cPe=new d,lPe=new d,Tj=new he,Aj=new he;hn.fromRectangle2D=function(e,t,n){return hn.fromRectangleWithHeights2D(e,t,0,0,n)};hn.fromRectangleWithHeights2D=function(e,t,n,i,o){if(c(o)||(o=new hn),!c(e))return o.center=d.clone(d.ZERO,o.center),o.radius=0,o;gte._ellipsoid=ie.default,t=t??gte,ce.southwest(e,Tj),Tj.height=n,ce.northeast(e,Aj),Aj.height=i;let r=t.project(Tj,cPe),s=t.project(Aj,lPe),a=s.x-r.x,l=s.y-r.y,u=s.z-r.z;o.radius=Math.sqrt(a*a+l*l+u*u)*.5;let f=o.center;return f.x=r.x+a*.5,f.y=r.y+l*.5,f.z=r.z+u*.5,o};var uPe=[];hn.fromRectangle3D=function(e,t,n,i){if(t=t??ie.default,n=n??0,c(i)||(i=new hn),!c(e))return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;let o=ce.subsample(e,t,n,uPe);return hn.fromPoints(o,i)};hn.fromVertices=function(e,t,n,i){if(c(i)||(i=new hn),!c(e)||e.length===0)return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;t=t??d.ZERO,n=n??3,T.typeOf.number.greaterThanOrEquals("stride",n,3);let o=Pj;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;let r=d.clone(o,Cj),s=d.clone(o,Ej),a=d.clone(o,Sj),l=d.clone(o,wj),u=d.clone(o,vj),f=d.clone(o,Dj),h=e.length,p;for(p=0;p<h;p+=n){let F=e[p]+t.x,_=e[p+1]+t.y,w=e[p+2]+t.z;o.x=F,o.y=_,o.z=w,F<r.x&&d.clone(o,r),F>l.x&&d.clone(o,l),_<s.y&&d.clone(o,s),_>u.y&&d.clone(o,u),w<a.z&&d.clone(o,a),w>f.z&&d.clone(o,f)}let g=d.magnitudeSquared(d.subtract(l,r,da)),m=d.magnitudeSquared(d.subtract(u,s,da)),y=d.magnitudeSquared(d.subtract(f,a,da)),b=r,x=l,A=g;m>A&&(A=m,b=s,x=u),y>A&&(A=y,b=a,x=f);let C=Ij;C.x=(b.x+x.x)*.5,C.y=(b.y+x.y)*.5,C.z=(b.z+x.z)*.5;let S=d.magnitudeSquared(d.subtract(x,C,da)),v=Math.sqrt(S),P=Oj;P.x=r.x,P.y=s.y,P.z=a.z;let M=Rj;M.x=l.x,M.y=u.y,M.z=f.z;let R=d.midpoint(P,M,Mj),L=0;for(p=0;p<h;p+=n){o.x=e[p]+t.x,o.y=e[p+1]+t.y,o.z=e[p+2]+t.z;let F=d.magnitude(d.subtract(o,R,da));F>L&&(L=F);let _=d.magnitudeSquared(d.subtract(o,C,da));if(_>S){let w=Math.sqrt(_);v=(v+w)*.5,S=v*v;let D=w-v;C.x=(v*C.x+D*o.x)/w,C.y=(v*C.y+D*o.y)/w,C.z=(v*C.z+D*o.z)/w}}return v<L?(d.clone(C,i.center),i.radius=v):(d.clone(R,i.center),i.radius=L),i};hn.fromEncodedCartesianVertices=function(e,t,n){if(c(n)||(n=new hn),!c(e)||!c(t)||e.length!==t.length||e.length===0)return n.center=d.clone(d.ZERO,n.center),n.radius=0,n;let i=Pj;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];let o=d.clone(i,Cj),r=d.clone(i,Ej),s=d.clone(i,Sj),a=d.clone(i,wj),l=d.clone(i,vj),u=d.clone(i,Dj),f=e.length,h;for(h=0;h<f;h+=3){let L=e[h]+t[h],F=e[h+1]+t[h+1],_=e[h+2]+t[h+2];i.x=L,i.y=F,i.z=_,L<o.x&&d.clone(i,o),L>a.x&&d.clone(i,a),F<r.y&&d.clone(i,r),F>l.y&&d.clone(i,l),_<s.z&&d.clone(i,s),_>u.z&&d.clone(i,u)}let p=d.magnitudeSquared(d.subtract(a,o,da)),g=d.magnitudeSquared(d.subtract(l,r,da)),m=d.magnitudeSquared(d.subtract(u,s,da)),y=o,b=a,x=p;g>x&&(x=g,y=r,b=l),m>x&&(x=m,y=s,b=u);let A=Ij;A.x=(y.x+b.x)*.5,A.y=(y.y+b.y)*.5,A.z=(y.z+b.z)*.5;let C=d.magnitudeSquared(d.subtract(b,A,da)),S=Math.sqrt(C),v=Oj;v.x=o.x,v.y=r.y,v.z=s.z;let P=Rj;P.x=a.x,P.y=l.y,P.z=u.z;let M=d.midpoint(v,P,Mj),R=0;for(h=0;h<f;h+=3){i.x=e[h]+t[h],i.y=e[h+1]+t[h+1],i.z=e[h+2]+t[h+2];let L=d.magnitude(d.subtract(i,M,da));L>R&&(R=L);let F=d.magnitudeSquared(d.subtract(i,A,da));if(F>C){let _=Math.sqrt(F);S=(S+_)*.5,C=S*S;let w=_-S;A.x=(S*A.x+w*i.x)/_,A.y=(S*A.y+w*i.y)/_,A.z=(S*A.z+w*i.z)/_}}return S<R?(d.clone(A,n.center),n.radius=S):(d.clone(M,n.center),n.radius=R),n};hn.fromCornerPoints=function(e,t,n){T.typeOf.object("corner",e),T.typeOf.object("oppositeCorner",t),c(n)||(n=new hn);let i=d.midpoint(e,t,n.center);return n.radius=d.distance(i,t),n};hn.fromEllipsoid=function(e,t){return T.typeOf.object("ellipsoid",e),c(t)||(t=new hn),d.clone(d.ZERO,t.center),t.radius=e.maximumRadius,t};var fPe=new d;hn.fromBoundingSpheres=function(e,t){if(c(t)||(t=new hn),!c(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;let n=e.length;if(n===1)return hn.clone(e[0],t);if(n===2)return hn.union(e[0],e[1],t);let i=[],o;for(o=0;o<n;o++)i.push(e[o].center);t=hn.fromPoints(i,t);let r=t.center,s=t.radius;for(o=0;o<n;o++){let a=e[o];s=Math.max(s,d.distance(r,a.center,fPe)+a.radius)}return t.radius=s,t};var dPe=new d,hPe=new d,mPe=new d;hn.fromOrientedBoundingBox=function(e,t){T.defined("orientedBoundingBox",e),c(t)||(t=new hn);let n=e.halfAxes,i=J.getColumn(n,0,dPe),o=J.getColumn(n,1,hPe),r=J.getColumn(n,2,mPe);return d.add(i,o,i),d.add(i,r,i),t.center=d.clone(e.center,t.center),t.radius=d.magnitude(i),t};var pPe=new d,_Pe=new d;hn.fromTransformation=function(e,t){T.typeOf.object("transformation",e),c(t)||(t=new hn);let n=B.getTranslation(e,pPe),i=B.getScale(e,_Pe),o=.5*d.magnitude(i);return t.center=d.clone(n,t.center),t.radius=o,t};hn.clone=function(e,t){if(c(e))return c(t)?(t.center=d.clone(e.center,t.center),t.radius=e.radius,t):new hn(e.center,e.radius)};hn.packedLength=4;hn.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=n??0;let i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t};hn.unpack=function(e,t,n){T.defined("array",e),t=t??0,c(n)||(n=new hn);let i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};var gPe=new d,yPe=new d;hn.union=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),c(n)||(n=new hn);let i=e.center,o=e.radius,r=t.center,s=t.radius,a=d.subtract(r,i,gPe),l=d.magnitude(a);if(o>=l+s)return e.clone(n),n;if(s>=l+o)return t.clone(n),n;let u=(o+l+s)*.5,f=d.multiplyByScalar(a,(-o+u)/l,yPe);return d.add(f,i,f),d.clone(f,n.center),n.radius=u,n};var bPe=new d;hn.expand=function(e,t,n){T.typeOf.object("sphere",e),T.typeOf.object("point",t),n=hn.clone(e,n);let i=d.magnitude(d.subtract(t,n.center,bPe));return i>n.radius&&(n.radius=i),n};hn.intersectPlane=function(e,t){T.typeOf.object("sphere",e),T.typeOf.object("plane",t);let n=e.center,i=e.radius,o=t.normal,r=d.dot(o,n)+t.distance;return r<-i?Wt.OUTSIDE:r<i?Wt.INTERSECTING:Wt.INSIDE};hn.transform=function(e,t,n){return T.typeOf.object("sphere",e),T.typeOf.object("transform",t),c(n)||(n=new hn),n.center=B.multiplyByPoint(t,e.center,n.center),n.radius=B.getMaximumScale(t)*e.radius,n};var xPe=new d;hn.distanceSquaredTo=function(e,t){T.typeOf.object("sphere",e),T.typeOf.object("cartesian",t);let n=d.subtract(e.center,t,xPe),i=d.magnitude(n)-e.radius;return i<=0?0:i*i};hn.transformWithoutScale=function(e,t,n){return T.typeOf.object("sphere",e),T.typeOf.object("transform",t),c(n)||(n=new hn),n.center=B.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var TPe=new d;hn.computePlaneDistances=function(e,t,n,i){T.typeOf.object("sphere",e),T.typeOf.object("position",t),T.typeOf.object("direction",n),c(i)||(i=new Ma);let o=d.subtract(e.center,t,TPe),r=d.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};var yte=new d,APe=new d,CPe=new d,EPe=new d,SPe=new d,wPe=new he,xte=new Array(8);for(let e=0;e<8;++e)xte[e]=new d;var bte=new Oi;hn.projectTo2D=function(e,t,n){T.typeOf.object("sphere",e),bte._ellipsoid=ie.default,t=t??bte;let i=t.ellipsoid,o=e.center,r=e.radius,s;d.equals(o,d.ZERO)?s=d.clone(d.UNIT_X,yte):s=i.geodeticSurfaceNormal(o,yte);let a=d.cross(d.UNIT_Z,s,APe);d.normalize(a,a);let l=d.cross(s,a,CPe);d.normalize(l,l),d.multiplyByScalar(s,r,s),d.multiplyByScalar(l,r,l),d.multiplyByScalar(a,r,a);let u=d.negate(l,SPe),f=d.negate(a,EPe),h=xte,p=h[0];d.add(s,l,p),d.add(p,a,p),p=h[1],d.add(s,l,p),d.add(p,f,p),p=h[2],d.add(s,u,p),d.add(p,f,p),p=h[3],d.add(s,u,p),d.add(p,a,p),d.negate(s,s),p=h[4],d.add(s,l,p),d.add(p,a,p),p=h[5],d.add(s,l,p),d.add(p,f,p),p=h[6],d.add(s,u,p),d.add(p,f,p),p=h[7],d.add(s,u,p),d.add(p,a,p);let g=h.length;for(let x=0;x<g;++x){let A=h[x];d.add(o,A,A);let C=i.cartesianToCartographic(A,wPe);t.project(C,A)}n=hn.fromPoints(h,n),o=n.center;let m=o.x,y=o.y,b=o.z;return o.x=b,o.y=m,o.z=y,n};hn.isOccluded=function(e,t){return T.typeOf.object("sphere",e),T.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)};hn.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&e.radius===t.radius};hn.prototype.intersectPlane=function(e){return hn.intersectPlane(this,e)};hn.prototype.distanceSquaredTo=function(e){return hn.distanceSquaredTo(this,e)};hn.prototype.computePlaneDistances=function(e,t,n){return hn.computePlaneDistances(this,e,t,n)};hn.prototype.isOccluded=function(e){return hn.isOccluded(this,e)};hn.prototype.equals=function(e){return hn.equals(this,e)};hn.prototype.clone=function(e){return hn.clone(this,e)};hn.prototype.volume=function(){let e=this.radius;return aPe*e*e*e};var le=hn;function vPe(e){e=e??W.EMPTY_OBJECT,this.position=e.position,this.normal=e.normal,this.st=e.st,this.bitangent=e.bitangent,this.tangent=e.tangent,this.color=e.color}var fn=vPe;var DPe={NONE:0,TOP:1,ALL:2},Zt=Object.freeze(DPe);function ps(e){e=e??W.EMPTY_OBJECT,this.position=e.position??!1,this.normal=e.normal??!1,this.st=e.st??!1,this.bitangent=e.bitangent??!1,this.tangent=e.tangent??!1,this.color=e.color??!1}ps.POSITION_ONLY=Object.freeze(new ps({position:!0}));ps.POSITION_AND_NORMAL=Object.freeze(new ps({position:!0,normal:!0}));ps.POSITION_NORMAL_AND_ST=Object.freeze(new ps({position:!0,normal:!0,st:!0}));ps.POSITION_AND_ST=Object.freeze(new ps({position:!0,st:!0}));ps.POSITION_AND_COLOR=Object.freeze(new ps({position:!0,color:!0}));ps.ALL=Object.freeze(new ps({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));ps.DEFAULT=ps.POSITION_NORMAL_AND_ST;ps.packedLength=6;ps.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,t[n++]=e.position?1:0,t[n++]=e.normal?1:0,t[n++]=e.st?1:0,t[n++]=e.tangent?1:0,t[n++]=e.bitangent?1:0,t[n]=e.color?1:0,t};ps.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=t??0,c(n)||(n=new ps),n.position=e[t++]===1,n.normal=e[t++]===1,n.st=e[t++]===1,n.tangent=e[t++]===1,n.bitangent=e[t++]===1,n.color=e[t]===1,n};ps.clone=function(e,t){if(c(e))return c(t)||(t=new ps),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};var Ie=ps;var PPe=new d;function mu(e){e=e??W.EMPTY_OBJECT;let t=e.minimum,n=e.maximum;if(T.typeOf.object("min",t),T.typeOf.object("max",n),c(e.offsetAttribute)&&e.offsetAttribute===Zt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");let i=e.vertexFormat??Ie.DEFAULT;this._minimum=d.clone(t),this._maximum=d.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}mu.fromDimensions=function(e){e=e??W.EMPTY_OBJECT;let t=e.dimensions;T.typeOf.object("dimensions",t),T.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),T.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),T.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);let n=d.multiplyByScalar(t,.5,new d);return new mu({minimum:d.negate(n,new d),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};mu.fromAxisAlignedBoundingBox=function(e){return T.typeOf.object("boundingBox",e),new mu({minimum:e.minimum,maximum:e.maximum})};mu.packedLength=2*d.packedLength+Ie.packedLength+1;mu.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,d.pack(e._minimum,t,n),d.pack(e._maximum,t,n+d.packedLength),Ie.pack(e._vertexFormat,t,n+2*d.packedLength),t[n+2*d.packedLength+Ie.packedLength]=e._offsetAttribute??-1,t};var Ate=new d,Cte=new d,Ete=new Ie,Tte={minimum:Ate,maximum:Cte,vertexFormat:Ete,offsetAttribute:void 0};mu.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=d.unpack(e,t,Ate),o=d.unpack(e,t+d.packedLength,Cte),r=Ie.unpack(e,t+2*d.packedLength,Ete),s=e[t+2*d.packedLength+Ie.packedLength];return c(n)?(n._minimum=d.clone(i,n._minimum),n._maximum=d.clone(o,n._maximum),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(Tte.offsetAttribute=s===-1?void 0:s,new mu(Tte))};mu.createGeometry=function(e){let t=e._minimum,n=e._maximum,i=e._vertexFormat;if(d.equals(t,n))return;let o=new fn,r,s;if(i.position&&(i.st||i.normal||i.tangent||i.bitangent)){if(i.position&&(s=new Float64Array(6*4*3),s[0]=t.x,s[1]=t.y,s[2]=n.z,s[3]=n.x,s[4]=t.y,s[5]=n.z,s[6]=n.x,s[7]=n.y,s[8]=n.z,s[9]=t.x,s[10]=n.y,s[11]=n.z,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=n.x,s[16]=t.y,s[17]=t.z,s[18]=n.x,s[19]=n.y,s[20]=t.z,s[21]=t.x,s[22]=n.y,s[23]=t.z,s[24]=n.x,s[25]=t.y,s[26]=t.z,s[27]=n.x,s[28]=n.y,s[29]=t.z,s[30]=n.x,s[31]=n.y,s[32]=n.z,s[33]=n.x,s[34]=t.y,s[35]=n.z,s[36]=t.x,s[37]=t.y,s[38]=t.z,s[39]=t.x,s[40]=n.y,s[41]=t.z,s[42]=t.x,s[43]=n.y,s[44]=n.z,s[45]=t.x,s[46]=t.y,s[47]=n.z,s[48]=t.x,s[49]=n.y,s[50]=t.z,s[51]=n.x,s[52]=n.y,s[53]=t.z,s[54]=n.x,s[55]=n.y,s[56]=n.z,s[57]=t.x,s[58]=n.y,s[59]=n.z,s[60]=t.x,s[61]=t.y,s[62]=t.z,s[63]=n.x,s[64]=t.y,s[65]=t.z,s[66]=n.x,s[67]=t.y,s[68]=n.z,s[69]=t.x,s[70]=t.y,s[71]=n.z,o.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){let u=new Float32Array(72);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=1,u[9]=0,u[10]=0,u[11]=1,u[12]=0,u[13]=0,u[14]=-1,u[15]=0,u[16]=0,u[17]=-1,u[18]=0,u[19]=0,u[20]=-1,u[21]=0,u[22]=0,u[23]=-1,u[24]=1,u[25]=0,u[26]=0,u[27]=1,u[28]=0,u[29]=0,u[30]=1,u[31]=0,u[32]=0,u[33]=1,u[34]=0,u[35]=0,u[36]=-1,u[37]=0,u[38]=0,u[39]=-1,u[40]=0,u[41]=0,u[42]=-1,u[43]=0,u[44]=0,u[45]=-1,u[46]=0,u[47]=0,u[48]=0,u[49]=1,u[50]=0,u[51]=0,u[52]=1,u[53]=0,u[54]=0,u[55]=1,u[56]=0,u[57]=0,u[58]=1,u[59]=0,u[60]=0,u[61]=-1,u[62]=0,u[63]=0,u[64]=-1,u[65]=0,u[66]=0,u[67]=-1,u[68]=0,u[69]=0,u[70]=-1,u[71]=0,o.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:u})}if(i.st){let u=new Float32Array(48);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=1,u[5]=1,u[6]=0,u[7]=1,u[8]=1,u[9]=0,u[10]=0,u[11]=0,u[12]=0,u[13]=1,u[14]=1,u[15]=1,u[16]=0,u[17]=0,u[18]=1,u[19]=0,u[20]=1,u[21]=1,u[22]=0,u[23]=1,u[24]=1,u[25]=0,u[26]=0,u[27]=0,u[28]=0,u[29]=1,u[30]=1,u[31]=1,u[32]=1,u[33]=0,u[34]=0,u[35]=0,u[36]=0,u[37]=1,u[38]=1,u[39]=1,u[40]=0,u[41]=0,u[42]=1,u[43]=0,u[44]=1,u[45]=1,u[46]=0,u[47]=1,o.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:u})}if(i.tangent){let u=new Float32Array(72);u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u[6]=1,u[7]=0,u[8]=0,u[9]=1,u[10]=0,u[11]=0,u[12]=-1,u[13]=0,u[14]=0,u[15]=-1,u[16]=0,u[17]=0,u[18]=-1,u[19]=0,u[20]=0,u[21]=-1,u[22]=0,u[23]=0,u[24]=0,u[25]=1,u[26]=0,u[27]=0,u[28]=1,u[29]=0,u[30]=0,u[31]=1,u[32]=0,u[33]=0,u[34]=1,u[35]=0,u[36]=0,u[37]=-1,u[38]=0,u[39]=0,u[40]=-1,u[41]=0,u[42]=0,u[43]=-1,u[44]=0,u[45]=0,u[46]=-1,u[47]=0,u[48]=-1,u[49]=0,u[50]=0,u[51]=-1,u[52]=0,u[53]=0,u[54]=-1,u[55]=0,u[56]=0,u[57]=-1,u[58]=0,u[59]=0,u[60]=1,u[61]=0,u[62]=0,u[63]=1,u[64]=0,u[65]=0,u[66]=1,u[67]=0,u[68]=0,u[69]=1,u[70]=0,u[71]=0,o.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:u})}if(i.bitangent){let u=new Float32Array(72);u[0]=0,u[1]=1,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=0,u[7]=1,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=1,u[14]=0,u[15]=0,u[16]=1,u[17]=0,u[18]=0,u[19]=1,u[20]=0,u[21]=0,u[22]=1,u[23]=0,u[24]=0,u[25]=0,u[26]=1,u[27]=0,u[28]=0,u[29]=1,u[30]=0,u[31]=0,u[32]=1,u[33]=0,u[34]=0,u[35]=1,u[36]=0,u[37]=0,u[38]=1,u[39]=0,u[40]=0,u[41]=1,u[42]=0,u[43]=0,u[44]=1,u[45]=0,u[46]=0,u[47]=1,u[48]=0,u[49]=0,u[50]=1,u[51]=0,u[52]=0,u[53]=1,u[54]=0,u[55]=0,u[56]=1,u[57]=0,u[58]=0,u[59]=1,u[60]=0,u[61]=0,u[62]=1,u[63]=0,u[64]=0,u[65]=1,u[66]=0,u[67]=0,u[68]=1,u[69]=0,u[70]=0,u[71]=1,o.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:u})}r=new Uint16Array(6*2*3),r[0]=0,r[1]=1,r[2]=2,r[3]=0,r[4]=2,r[5]=3,r[6]=6,r[7]=5,r[8]=4,r[9]=7,r[10]=6,r[11]=4,r[12]=8,r[13]=9,r[14]=10,r[15]=8,r[16]=10,r[17]=11,r[18]=14,r[19]=13,r[20]=12,r[21]=15,r[22]=14,r[23]=12,r[24]=18,r[25]=17,r[26]=16,r[27]=19,r[28]=18,r[29]=16,r[30]=20,r[31]=21,r[32]=22,r[33]=20,r[34]=22,r[35]=23}else s=new Float64Array(8*3),s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=n.x,s[4]=t.y,s[5]=t.z,s[6]=n.x,s[7]=n.y,s[8]=t.z,s[9]=t.x,s[10]=n.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=n.z,s[15]=n.x,s[16]=t.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=t.x,s[22]=n.y,s[23]=n.z,o.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:s}),r=new Uint16Array(6*2*3),r[0]=4,r[1]=5,r[2]=6,r[3]=4,r[4]=6,r[5]=7,r[6]=1,r[7]=0,r[8]=3,r[9]=1,r[10]=3,r[11]=2,r[12]=1,r[13]=6,r[14]=5,r[15]=1,r[16]=2,r[17]=6,r[18]=2,r[19]=3,r[20]=7,r[21]=2,r[22]=7,r[23]=6,r[24]=3,r[25]=0,r[26]=4,r[27]=3,r[28]=4,r[29]=7,r[30]=0,r[31]=1,r[32]=5,r[33]=0,r[34]=5,r[35]=4;let a=d.subtract(n,t,PPe),l=d.magnitude(a)*.5;if(c(e._offsetAttribute)){let u=s.length,f=e._offsetAttribute===Zt.NONE?0:1,h=new Uint8Array(u/3).fill(f);o.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new ct({attributes:o,indices:r,primitiveType:Me.TRIANGLES,boundingSphere:new le(d.ZERO,l),offsetAttribute:e._offsetAttribute})};var Lj;mu.getUnitBox=function(){return c(Lj)||(Lj=mu.createGeometry(mu.fromDimensions({dimensions:new d(1,1,1),vertexFormat:Ie.POSITION_ONLY}))),Lj};var La=mu;var no={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};no.getMathType=function(e){switch(e){case no.SCALAR:return Number;case no.VEC2:return H;case no.VEC3:return d;case no.VEC4:return se;case no.MAT2:return Ri;case no.MAT3:return J;case no.MAT4:return B;default:throw new E("attributeType is not a valid value.")}};no.getNumberOfComponents=function(e){switch(e){case no.SCALAR:return 1;case no.VEC2:return 2;case no.VEC3:return 3;case no.VEC4:case no.MAT2:return 4;case no.MAT3:return 9;case no.MAT4:return 16;default:throw new E("attributeType is not a valid value.")}};no.getAttributeLocationCount=function(e){switch(e){case no.SCALAR:case no.VEC2:case no.VEC3:case no.VEC4:return 1;case no.MAT2:return 2;case no.MAT3:return 3;case no.MAT4:return 4;default:throw new E("attributeType is not a valid value.")}};no.getGlslType=function(e){switch(T.typeOf.string("attributeType",e),e){case no.SCALAR:return"float";case no.VEC2:return"vec2";case no.VEC3:return"vec3";case no.VEC4:return"vec4";case no.MAT2:return"mat2";case no.MAT3:return"mat3";case no.MAT4:return"mat4";default:throw new E("attributeType is not a valid value.")}};var nn=Object.freeze(no);var Ste=1/256,wte=256,bo={};bo.octEncodeInRange=function(e,t,n){T.defined("vector",e),T.defined("result",n);let i=d.magnitudeSquared(e);if(Math.abs(i-1)>O.EPSILON6)throw new E("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){let o=n.x,r=n.y;n.x=(1-Math.abs(r))*O.signNotZero(o),n.y=(1-Math.abs(o))*O.signNotZero(r)}return n.x=O.toSNorm(n.x,t),n.y=O.toSNorm(n.y,t),n};bo.octEncode=function(e,t){return bo.octEncodeInRange(e,255,t)};var Rv=new H,vte=new Uint8Array(1);function fV(e){return vte[0]=e,vte[0]}bo.octEncodeToCartesian4=function(e,t){return bo.octEncodeInRange(e,65535,Rv),t.x=fV(Rv.x*Ste),t.y=fV(Rv.x),t.z=fV(Rv.y*Ste),t.w=fV(Rv.y),t};bo.octDecodeInRange=function(e,t,n,i){if(T.defined("result",i),e<0||e>n||t<0||t>n)throw new E(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=O.fromSNorm(e,n),i.y=O.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){let o=i.x;i.x=(1-Math.abs(i.y))*O.signNotZero(o),i.y=(1-Math.abs(o))*O.signNotZero(i.y)}return d.normalize(i,i)};bo.octDecode=function(e,t,n){return bo.octDecodeInRange(e,t,255,n)};bo.octDecodeFromCartesian4=function(e,t){T.typeOf.object("encoded",e),T.typeOf.object("result",t);let n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new E("x, y, z, and w must be unsigned normalized integers between 0 and 255");let s=n*wte+i,a=o*wte+r;return bo.octDecodeInRange(s,a,65535,t)};bo.octPackFloat=function(e){return T.defined("encoded",e),256*e.x+e.y};var Fj=new H;bo.octEncodeFloat=function(e){return bo.octEncode(e,Fj),bo.octPackFloat(Fj)};bo.octDecodeFloat=function(e,t){T.defined("value",e);let n=e/256,i=Math.floor(n),o=(n-i)*256;return bo.octDecode(i,o,t)};bo.octPack=function(e,t,n,i){T.defined("v1",e),T.defined("v2",t),T.defined("v3",n),T.defined("result",i);let o=bo.octEncodeFloat(e),r=bo.octEncodeFloat(t),s=bo.octEncode(n,Fj);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};bo.octUnpack=function(e,t,n,i){T.defined("packed",e),T.defined("v1",t),T.defined("v2",n),T.defined("v3",i);let o=e.x/65536,r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;let a=Math.floor(o),l=(o-a)*65536;bo.octDecodeFloat(s,t),bo.octDecodeFloat(l,n),bo.octDecode(r,a,i)};bo.compressTextureCoordinates=function(e){T.defined("textureCoordinates",e);let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};bo.decompressTextureCoordinates=function(e,t){T.defined("compressed",e),T.defined("result",t);let n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function Nj(e){return e>>1^-(e&1)}bo.zigZagDeltaDecode=function(e,t,n){T.defined("uBuffer",e),T.defined("vBuffer",t),T.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),c(n)&&T.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);let i=e.length,o=0,r=0,s=0;for(let a=0;a<i;++a)o+=Nj(e[a]),r+=Nj(t[a]),e[a]=o,t[a]=r,c(n)&&(s+=Nj(n[a]),n[a]=s)};bo.dequantize=function(e,t,n,i){T.defined("typedArray",e),T.defined("componentDatatype",t),T.defined("type",n),T.defined("count",i);let o=nn.getNumberOfComponents(n),r;switch(t){case $.BYTE:r=127;break;case $.UNSIGNED_BYTE:r=255;break;case $.SHORT:r=32767;break;case $.UNSIGNED_SHORT:r=65535;break;case $.INT:r=2147483647;break;case $.UNSIGNED_INT:r=4294967295;break;default:throw new E(`Cannot dequantize component datatype: ${t}`)}let s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let l=0;l<o;l++){let u=a*o+l;s[u]=Math.max(e[u]/r,-1)}return s};bo.decodeRGB565=function(e,t){T.defined("typedArray",e);let n=e.length*3;c(t)&&T.typeOf.number.equals("result.length","typedArray.length * 3",t.length,n);let i=e.length;c(t)||(t=new Float32Array(i*3));let o=31,r=63,s=1/31,a=1/63;for(let l=0;l<i;l++){let u=e[l],f=u>>11,h=u>>5&r,p=u&o,g=3*l;t[g]=f*s,t[g+1]=h*a,t[g+2]=p*s}return t};var Ln=bo;var Dte=new d,Pte=new d,Ite=new d;function IPe(e,t,n,i,o){T.defined("point",e),T.defined("p0",t),T.defined("p1",n),T.defined("p2",i),c(o)||(o=new d);let r,s,a,l,u,f,h,p;if(c(t.z)){if(d.equalsEpsilon(e,t,O.EPSILON14))return d.clone(d.UNIT_X,o);if(d.equalsEpsilon(e,n,O.EPSILON14))return d.clone(d.UNIT_Y,o);if(d.equalsEpsilon(e,i,O.EPSILON14))return d.clone(d.UNIT_Z,o);r=d.subtract(n,t,Dte),s=d.subtract(i,t,Pte),a=d.subtract(e,t,Ite),l=d.dot(r,r),u=d.dot(r,s),f=d.dot(r,a),h=d.dot(s,s),p=d.dot(s,a)}else{if(H.equalsEpsilon(e,t,O.EPSILON14))return d.clone(d.UNIT_X,o);if(H.equalsEpsilon(e,n,O.EPSILON14))return d.clone(d.UNIT_Y,o);if(H.equalsEpsilon(e,i,O.EPSILON14))return d.clone(d.UNIT_Z,o);r=H.subtract(n,t,Dte),s=H.subtract(i,t,Pte),a=H.subtract(e,t,Ite),l=H.dot(r,r),u=H.dot(r,s),f=H.dot(r,a),h=H.dot(s,s),p=H.dot(s,a)}o.y=h*f-u*p,o.z=l*p-u*f;let g=l*h-u*u;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}var _b=IPe;function dm(){this.high=d.clone(d.ZERO),this.low=d.clone(d.ZERO)}dm.encode=function(e,t){T.typeOf.number("value",e),c(t)||(t={high:0,low:0});let n;return e>=0?(n=Math.floor(e/65536)*65536,t.high=n,t.low=e-n):(n=Math.floor(-e/65536)*65536,t.high=-n,t.low=e+n),t};var Ip={high:0,low:0};dm.fromCartesian=function(e,t){T.typeOf.object("cartesian",e),c(t)||(t=new dm);let n=t.high,i=t.low;return dm.encode(e.x,Ip),n.x=Ip.high,i.x=Ip.low,dm.encode(e.y,Ip),n.y=Ip.high,i.y=Ip.low,dm.encode(e.z,Ip),n.z=Ip.high,i.z=Ip.low,t};var Bj=new dm;dm.writeElements=function(e,t,n){T.defined("cartesianArray",t),T.typeOf.number("index",n),T.typeOf.number.greaterThanOrEquals("index",n,0),dm.fromCartesian(e,Bj);let i=Bj.high,o=Bj.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z};var Hn=dm;var kj={};kj.computeDiscriminant=function(e,t,n){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");return t*t-4*e*n};function Ote(e,t,n){let i=e+t;return O.sign(e)!==O.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}kj.computeRealRoots=function(e,t,n){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");let i;if(e===0)return t===0?[]:[-n/t];if(t===0){if(n===0)return[0,0];let l=Math.abs(n),u=Math.abs(e);if(l<u&&l/u<O.EPSILON14)return[0,0];if(l>u&&u/l<O.EPSILON14)return[];if(i=-n/e,i<0)return[];let f=Math.sqrt(i);return[-f,f]}else if(n===0)return i=-t/e,i<0?[i,0]:[0,i];let o=t*t,r=4*e*n,s=Ote(o,-r,O.EPSILON14);if(s<0)return[];let a=-.5*Ote(t,O.sign(t)*Math.sqrt(s),O.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};var Vc=kj;var Vj={};Vj.computeDiscriminant=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");let o=e*e,r=t*t,s=n*n,a=i*i;return 18*e*t*n*i+r*s-27*o*a-4*(e*s*n+r*t*i)};function Uj(e,t,n,i){let o=e,r=t/3,s=n/3,a=i,l=o*s,u=r*a,f=r*r,h=s*s,p=o*s-f,g=o*a-r*s,m=r*a-h,y=4*p*m-g*g,b,x;if(y<0){let q,Y,te;f*u>=l*h?(q=o,Y=p,te=-2*r*p+o*g):(q=a,Y=m,te=-a*g+2*s*m);let Z=-(te<0?-1:1)*Math.abs(q)*Math.sqrt(-y);x=-te+Z;let ee=x/2,me=ee<0?-Math.pow(-ee,1/3):Math.pow(ee,1/3),Te=x===Z?-me:-Y/me;return b=Y<=0?me+Te:-te/(me*me+Te*Te+Y),f*u>=l*h?[(b-r)/o]:[-a/(b+s)]}let A=p,C=-2*r*p+o*g,S=m,v=-a*g+2*s*m,P=Math.sqrt(y),M=Math.sqrt(3)/2,R=Math.abs(Math.atan2(o*P,-C)/3);b=2*Math.sqrt(-A);let L=Math.cos(R);x=b*L;let F=b*(-L/2-M*Math.sin(R)),_=x+F>2*r?x-r:F-r,w=o,D=_/w;R=Math.abs(Math.atan2(a*P,-v)/3),b=2*Math.sqrt(-S),L=Math.cos(R),x=b*L,F=b*(-L/2-M*Math.sin(R));let I=-a,N=x+F<2*s?x+s:F+s,k=I/N,z=w*N,V=-_*N-w*I,j=_*I,U=(s*V-r*j)/(-r*V+s*z);return D<=U?D<=k?U<=k?[D,U,k]:[D,k,U]:[k,D,U]:D<=k?[U,D,k]:U<=k?[U,k,D]:[k,U,D]}Vj.computeRealRoots=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");let o,r;if(e===0)return Vc.computeRealRoots(t,n,i);if(t===0){if(n===0){if(i===0)return[0,0,0];r=-i/e;let s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[s,s,s]}else if(i===0)return o=Vc.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return Uj(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):Uj(e,t,0,i);if(i===0)return o=Vc.computeRealRoots(e,t,n),o.length===0?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]}return Uj(e,t,n,i)};var gb=Vj;var zj={};zj.computeDiscriminant=function(e,t,n,i,o){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");if(typeof o!="number")throw new E("e is a required number.");let r=e*e,s=r*e,a=t*t,l=a*t,u=n*n,f=u*n,h=i*i,p=h*i,g=o*o,m=g*o;return a*u*h-4*l*p-4*e*f*h+18*e*t*n*p-27*r*h*h+256*s*m+o*(18*l*n*i-4*a*f+16*e*u*u-80*e*t*u*i-6*e*a*h+144*r*n*h)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function Md(e,t,n,i){let o=e*e,r=t-3*o/8,s=n-t*e/2+o*e/8,a=i-n*e/4+t*o/16-3*o*o/256,l=gb.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(l.length>0){let u=-e/4,f=l[l.length-1];if(Math.abs(f)<O.EPSILON14){let h=Vc.computeRealRoots(1,r,a);if(h.length===2){let p=h[0],g=h[1],m;if(p>=0&&g>=0){let y=Math.sqrt(p),b=Math.sqrt(g);return[u-b,u-y,u+y,u+b]}else{if(p>=0&&g<0)return m=Math.sqrt(p),[u-m,u+m];if(p<0&&g>=0)return m=Math.sqrt(g),[u-m,u+m]}}return[]}else if(f>0){let h=Math.sqrt(f),p=(r+f-s/h)/2,g=(r+f+s/h)/2,m=Vc.computeRealRoots(1,h,p),y=Vc.computeRealRoots(1,-h,g);return m.length!==0?(m[0]+=u,m[1]+=u,y.length!==0?(y[0]+=u,y[1]+=u,m[1]<=y[0]?[m[0],m[1],y[0],y[1]]:y[1]<=m[0]?[y[0],y[1],m[0],m[1]]:m[0]>=y[0]&&m[1]<=y[1]?[y[0],m[0],m[1],y[1]]:y[0]>=m[0]&&y[1]<=m[1]?[m[0],y[0],y[1],m[1]]:m[0]>y[0]&&m[0]<y[1]?[y[0],m[0],y[1],m[1]]:[m[0],y[0],m[1],y[1]]):m):y.length!==0?(y[0]+=u,y[1]+=u,y):[]}}return[]}function Mv(e,t,n,i){let o=n*n,r=t*t,s=e*e,a=-2*t,l=n*e+r-4*i,u=s*i-n*t*e+o,f=gb.computeRealRoots(1,a,l,u);if(f.length>0){let h=f[0],p=t-h,g=p*p,m=e/2,y=p/2,b=g-4*i,x=g+4*Math.abs(i),A=s-4*h,C=s+4*Math.abs(h),S,v;if(h<0||b*C<A*x){let w=Math.sqrt(A);S=w/2,v=w===0?0:(e*y-n)/w}else{let w=Math.sqrt(b);S=w===0?0:(e*y-n)/w,v=w/2}let P,M;m===0&&S===0?(P=0,M=0):O.sign(m)===O.sign(S)?(P=m+S,M=h/P):(M=m-S,P=h/M);let R,L;y===0&&v===0?(R=0,L=0):O.sign(y)===O.sign(v)?(R=y+v,L=i/R):(L=y-v,R=i/L);let F=Vc.computeRealRoots(1,P,R),_=Vc.computeRealRoots(1,M,L);if(F.length!==0)return _.length!==0?F[1]<=_[0]?[F[0],F[1],_[0],_[1]]:_[1]<=F[0]?[_[0],_[1],F[0],F[1]]:F[0]>=_[0]&&F[1]<=_[1]?[_[0],F[0],F[1],_[1]]:_[0]>=F[0]&&_[1]<=F[1]?[F[0],_[0],_[1],F[1]]:F[0]>_[0]&&F[0]<_[1]?[_[0],F[0],_[1],F[1]]:[F[0],_[0],F[1],_[1]]:F;if(_.length!==0)return _}return[]}zj.computeRealRoots=function(e,t,n,i,o){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");if(typeof o!="number")throw new E("e is a required number.");if(Math.abs(e)<O.EPSILON15)return gb.computeRealRoots(t,n,i,o);let r=t/e,s=n/e,a=i/e,l=o/e,u=r<0?1:0;switch(u+=s<0?u+1:u,u+=a<0?u+1:u,u+=l<0?u+1:u,u){case 0:return Md(r,s,a,l);case 1:return Mv(r,s,a,l);case 2:return Mv(r,s,a,l);case 3:return Md(r,s,a,l);case 4:return Md(r,s,a,l);case 5:return Mv(r,s,a,l);case 6:return Md(r,s,a,l);case 7:return Md(r,s,a,l);case 8:return Mv(r,s,a,l);case 9:return Md(r,s,a,l);case 10:return Md(r,s,a,l);case 11:return Mv(r,s,a,l);case 12:return Md(r,s,a,l);case 13:return Md(r,s,a,l);case 14:return Md(r,s,a,l);case 15:return Md(r,s,a,l);default:return}};var Lv=zj;function dV(e,t){t=d.clone(t??d.ZERO),d.equals(t,d.ZERO)||d.normalize(t,t),this.origin=d.clone(e??d.ZERO),this.direction=t}dV.clone=function(e,t){if(c(e))return c(t)?(t.origin=d.clone(e.origin),t.direction=d.clone(e.direction),t):new dV(e.origin,e.direction)};dV.getPoint=function(e,t,n){return T.typeOf.object("ray",e),T.typeOf.number("t",t),c(n)||(n=new d),n=d.multiplyByScalar(e.direction,t,n),d.add(e.origin,n,n)};var mn=dV;var Ho={};Ho.rayPlane=function(e,t,n){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("plane is required.");c(n)||(n=new d);let i=e.origin,o=e.direction,r=t.normal,s=d.dot(r,o);if(Math.abs(s)<O.EPSILON15)return;let a=(-t.distance-d.dot(r,i))/s;if(!(a<0))return n=d.multiplyByScalar(o,a,n),d.add(i,n,n)};var OPe=new d,RPe=new d,Ute=new d,Rte=new d,Mte=new d;Ho.rayTriangleParametric=function(e,t,n,i,o){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("p0 is required.");if(!c(n))throw new E("p1 is required.");if(!c(i))throw new E("p2 is required.");o=o??!1;let r=e.origin,s=e.direction,a=d.subtract(n,t,OPe),l=d.subtract(i,t,RPe),u=d.cross(s,l,Ute),f=d.dot(a,u),h,p,g,m,y;if(o){if(f<O.EPSILON6||(h=d.subtract(r,t,Rte),g=d.dot(h,u),g<0||g>f)||(p=d.cross(h,a,Mte),m=d.dot(s,p),m<0||g+m>f))return;y=d.dot(l,p)/f}else{if(Math.abs(f)<O.EPSILON6)return;let b=1/f;if(h=d.subtract(r,t,Rte),g=d.dot(h,u)*b,g<0||g>1||(p=d.cross(h,a,Mte),m=d.dot(s,p)*b,m<0||g+m>1))return;y=d.dot(l,p)*b}return y};Ho.rayTriangle=function(e,t,n,i,o,r){let s=Ho.rayTriangleParametric(e,t,n,i,o);if(!(!c(s)||s<0))return c(r)||(r=new d),d.multiplyByScalar(e.direction,s,r),d.add(e.origin,r,r)};var MPe=new mn;Ho.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!c(e))throw new E("v0 is required.");if(!c(t))throw new E("v1 is required.");if(!c(n))throw new E("p0 is required.");if(!c(i))throw new E("p1 is required.");if(!c(o))throw new E("p2 is required.");let a=MPe;d.clone(e,a.origin),d.subtract(t,e,a.direction),d.normalize(a.direction,a.direction);let l=Ho.rayTriangleParametric(a,n,i,o,r);if(!(!c(l)||l<0||l>d.distance(e,t)))return c(s)||(s=new d),d.multiplyByScalar(a.direction,l,s),d.add(a.origin,s,s)};function LPe(e,t,n,i){let o=t*t-4*e*n;if(o<0)return;if(o>0){let s=1/(2*e),a=Math.sqrt(o),l=(-t+a)*s,u=(-t-a)*s;return l<u?(i.root0=l,i.root1=u):(i.root0=u,i.root1=l),i}let r=-t/(2*e);if(r!==0)return i.root0=i.root1=r,i}var NPe={root0:0,root1:0};function Vte(e,t,n){c(n)||(n=new Ma);let i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=d.subtract(i,r,Ute),l=d.dot(o,o),u=2*d.dot(o,a),f=d.magnitudeSquared(a)-s,h=LPe(l,u,f,NPe);if(c(h))return n.start=h.root0,n.stop=h.root1,n}Ho.raySphere=function(e,t,n){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("sphere is required.");if(n=Vte(e,t,n),!(!c(n)||n.stop<0))return n.start=Math.max(n.start,0),n};var FPe=new mn;Ho.lineSegmentSphere=function(e,t,n,i){if(!c(e))throw new E("p0 is required.");if(!c(t))throw new E("p1 is required.");if(!c(n))throw new E("sphere is required.");let o=FPe;d.clone(e,o.origin);let r=d.subtract(t,e,o.direction),s=d.magnitude(r);if(d.normalize(r,r),i=Vte(o,n,i),!(!c(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};var BPe=new d,kPe=new d;Ho.rayEllipsoid=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");let n=t.oneOverRadii,i=d.multiplyComponents(n,e.origin,BPe),o=d.multiplyComponents(n,e.direction,kPe),r=d.magnitudeSquared(i),s=d.dot(i,o),a,l,u,f,h;if(r>1){if(s>=0)return;let p=s*s;if(a=r-1,l=d.magnitudeSquared(o),u=l*a,p<u)return;if(p>u){f=s*s-u,h=-s+Math.sqrt(f);let m=h/l,y=a/h;return m<y?new Ma(m,y):{start:y,stop:m}}let g=Math.sqrt(a/l);return new Ma(g,g)}else if(r<1)return a=r-1,l=d.magnitudeSquared(o),u=l*a,f=s*s-u,h=-s+Math.sqrt(f),new Ma(0,h/l);if(s<0)return l=d.magnitudeSquared(o),new Ma(0,-s/l)};function yb(e,t,n){let i=e+t;return O.sign(e)!==O.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}Ho.quadraticVectorExpression=function(e,t,n,i,o){let r=i*i,s=o*o,a=(e[J.COLUMN1ROW1]-e[J.COLUMN2ROW2])*s,l=o*(i*yb(e[J.COLUMN1ROW0],e[J.COLUMN0ROW1],O.EPSILON15)+t.y),u=e[J.COLUMN0ROW0]*r+e[J.COLUMN2ROW2]*s+i*t.x+n,f=s*yb(e[J.COLUMN2ROW1],e[J.COLUMN1ROW2],O.EPSILON15),h=o*(i*yb(e[J.COLUMN2ROW0],e[J.COLUMN0ROW2])+t.z),p,g=[];if(h===0&&f===0){if(p=Vc.computeRealRoots(a,l,u),p.length===0)return g;let R=p[0],L=Math.sqrt(Math.max(1-R*R,0));if(g.push(new d(i,o*R,o*-L)),g.push(new d(i,o*R,o*L)),p.length===2){let F=p[1],_=Math.sqrt(Math.max(1-F*F,0));g.push(new d(i,o*F,o*-_)),g.push(new d(i,o*F,o*_))}return g}let m=h*h,y=f*f,b=a*a,x=h*f,A=b+y,C=2*(l*a+x),S=2*u*a+l*l-y+m,v=2*(u*l-x),P=u*u-m;if(A===0&&C===0&&S===0&&v===0)return g;p=Lv.computeRealRoots(A,C,S,v,P);let M=p.length;if(M===0)return g;for(let R=0;R<M;++R){let L=p[R],F=L*L,_=Math.max(1-F,0),w=Math.sqrt(_),D;O.sign(a)===O.sign(u)?D=yb(a*F+u,l*L,O.EPSILON12):O.sign(u)===O.sign(l*L)?D=yb(a*F,l*L+u,O.EPSILON12):D=yb(a*F+l*L,u,O.EPSILON12);let I=yb(f*L,h,O.EPSILON15),N=D*I;N<0?g.push(new d(i,o*L,o*w)):N>0?g.push(new d(i,o*L,o*-w)):w!==0?(g.push(new d(i,o*L,o*-w)),g.push(new d(i,o*L,o*w)),++R):g.push(new d(i,o*L,o*w))}return g};var Hj=new d,Lte=new d,Nte=new d,hV=new d,UPe=new d,VPe=new J,zPe=new J,HPe=new J,GPe=new J,jPe=new J,Fte=new J,Bte=new J,kte=new d,WPe=new d,qPe=new he;Ho.grazingAltitudeLocation=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");let n=e.origin,i=e.direction;if(!d.equals(n,d.ZERO)){let P=t.geodeticSurfaceNormal(n,Hj);if(d.dot(i,P)>=0)return n}let o=c(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,Hj),s=d.normalize(r,r),a=d.mostOrthogonalAxis(r,hV),l=d.normalize(d.cross(a,s,Lte),Lte),u=d.normalize(d.cross(s,l,Nte),Nte),f=VPe;f[0]=s.x,f[1]=s.y,f[2]=s.z,f[3]=l.x,f[4]=l.y,f[5]=l.z,f[6]=u.x,f[7]=u.y,f[8]=u.z;let h=J.transpose(f,zPe),p=J.fromScale(t.radii,HPe),g=J.fromScale(t.oneOverRadii,GPe),m=jPe;m[0]=0,m[1]=-i.z,m[2]=i.y,m[3]=i.z,m[4]=0,m[5]=-i.x,m[6]=-i.y,m[7]=i.x,m[8]=0;let y=J.multiply(J.multiply(h,g,Fte),m,Fte),b=J.multiply(J.multiply(y,p,Bte),f,Bte),x=J.multiplyByVector(y,n,UPe),A=Ho.quadraticVectorExpression(b,d.negate(x,Hj),0,0,1),C,S,v=A.length;if(v>0){let P=d.clone(d.ZERO,WPe),M=Number.NEGATIVE_INFINITY;for(let L=0;L<v;++L){C=J.multiplyByVector(p,J.multiplyByVector(f,A[L],kte),kte);let F=d.normalize(d.subtract(C,n,hV),hV),_=d.dot(F,i);_>M&&(M=_,P=d.clone(C,P))}let R=t.cartesianToCartographic(P,qPe);return M=O.clamp(M,0,1),S=d.magnitude(d.subtract(P,n,hV))*Math.sqrt(1-M*M),S=o?-S:S,R.height=S,t.cartographicToCartesian(R,new d)}};var YPe=new d;Ho.lineSegmentPlane=function(e,t,n,i){if(!c(e))throw new E("endPoint0 is required.");if(!c(t))throw new E("endPoint1 is required.");if(!c(n))throw new E("plane is required.");c(i)||(i=new d);let o=d.subtract(t,e,YPe),r=n.normal,s=d.dot(r,o);if(Math.abs(s)<O.EPSILON6)return;let a=d.dot(r,e),l=-(n.distance+a)/s;if(!(l<0||l>1))return d.multiplyByScalar(o,l,i),d.add(e,i,i),i};Ho.trianglePlaneIntersection=function(e,t,n,i){if(!c(e)||!c(t)||!c(n)||!c(i))throw new E("p0, p1, p2, and plane are required.");let o=i.normal,r=i.distance,s=d.dot(o,e)+r<0,a=d.dot(o,t)+r<0,l=d.dot(o,n)+r<0,u=0;u+=s?1:0,u+=a?1:0,u+=l?1:0;let f,h;if((u===1||u===2)&&(f=new d,h=new d),u===1){if(s)return Ho.lineSegmentPlane(e,t,i,f),Ho.lineSegmentPlane(e,n,i,h),{positions:[e,t,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(a)return Ho.lineSegmentPlane(t,n,i,f),Ho.lineSegmentPlane(t,e,i,h),{positions:[e,t,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(l)return Ho.lineSegmentPlane(n,e,i,f),Ho.lineSegmentPlane(n,t,i,h),{positions:[e,t,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!l)return Ho.lineSegmentPlane(e,n,i,f),Ho.lineSegmentPlane(t,n,i,h),{positions:[e,t,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}else return Ho.lineSegmentPlane(n,t,i,f),Ho.lineSegmentPlane(e,t,i,h),{positions:[e,t,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};else return Ho.lineSegmentPlane(t,e,i,f),Ho.lineSegmentPlane(n,e,i,h),{positions:[e,t,n,f,h],indices:[1,2,4,1,4,3,0,3,4]}};var Zn=Ho;function zs(e,t){if(T.typeOf.object("normal",e),!O.equalsEpsilon(d.magnitude(e),1,O.EPSILON6))throw new E("normal must be normalized.");T.typeOf.number("distance",t),this.normal=d.clone(e),this.distance=t}zs.fromPointNormal=function(e,t,n){if(T.typeOf.object("point",e),T.typeOf.object("normal",t),!O.equalsEpsilon(d.magnitude(t),1,O.EPSILON6))throw new E("normal must be normalized.");let i=-d.dot(t,e);return c(n)?(d.clone(t,n.normal),n.distance=i,n):new zs(t,i)};var XPe=new d;zs.fromCartesian4=function(e,t){T.typeOf.object("coefficients",e);let n=d.fromCartesian4(e,XPe),i=e.w;if(!O.equalsEpsilon(d.magnitude(n),1,O.EPSILON6))throw new E("normal must be normalized.");return c(t)?(d.clone(n,t.normal),t.distance=i,t):new zs(n,i)};zs.getPointDistance=function(e,t){return T.typeOf.object("plane",e),T.typeOf.object("point",t),d.dot(e.normal,t)+e.distance};var KPe=new d;zs.projectPointOntoPlane=function(e,t,n){T.typeOf.object("plane",e),T.typeOf.object("point",t),c(n)||(n=new d);let i=zs.getPointDistance(e,t),o=d.multiplyByScalar(e.normal,i,KPe);return d.subtract(t,o,n)};var $Pe=new B,ZPe=new se,QPe=new d;zs.transform=function(e,t,n){T.typeOf.object("plane",e),T.typeOf.object("transform",t);let i=e.normal,o=e.distance,r=B.inverseTranspose(t,$Pe),s=se.fromElements(i.x,i.y,i.z,o,ZPe);s=B.multiplyByVector(r,s,s);let a=d.fromCartesian4(s,QPe);return s=se.divideByScalar(s,d.magnitude(a),s),zs.fromCartesian4(s,n)};zs.clone=function(e,t){return T.typeOf.object("plane",e),c(t)?(d.clone(e.normal,t.normal),t.distance=e.distance,t):new zs(e.normal,e.distance)};zs.equals=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.distance===t.distance&&d.equals(e.normal,t.normal)};zs.ORIGIN_XY_PLANE=Object.freeze(new zs(d.UNIT_Z,0));zs.ORIGIN_YZ_PLANE=Object.freeze(new zs(d.UNIT_X,0));zs.ORIGIN_ZX_PLANE=Object.freeze(new zs(d.UNIT_Y,0));var sn=zs;var Gj={};Gj.calculateACMR=function(e){e=e??W.EMPTY_OBJECT;let t=e.indices,n=e.maximumIndex,i=e.cacheSize??24;if(!c(t))throw new E("indices is required.");let o=t.length;if(o<3||o%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");if(!c(n)){n=0;let a=0,l=t[a];for(;a<o;)l>n&&(n=l),++a,l=t[a]}let r=[];for(let a=0;a<n+1;a++)r[a]=0;let s=i+1;for(let a=0;a<o;++a)s-r[t[a]]>i&&(r[t[a]]=s,++s);return(s-i+1)/(o/3)};Gj.tipsify=function(e){e=e??W.EMPTY_OBJECT;let t=e.indices,n=e.maximumIndex,i=e.cacheSize??24,o;function r(_,w,D,I){for(;w.length>=1;){let N=w[w.length-1];if(w.splice(w.length-1,1),_[N].numLiveTriangles>0)return N}for(;o<I;){if(_[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(_,w,D,I,N,k,z){let V=-1,j,U=-1,q=0;for(;q<D.length;){let Y=D[q];I[Y].numLiveTriangles&&(j=0,N-I[Y].timeStamp+2*I[Y].numLiveTriangles<=w&&(j=N-I[Y].timeStamp),(j>U||U===-1)&&(U=j,V=Y)),++q}return V===-1?r(I,k,_,z):V}if(!c(t))throw new E("indices is required.");let a=t.length;if(a<3||a%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");let l=0,u=0,f=t[u],h=a;if(c(n))l=n+1;else{for(;u<h;)f>l&&(l=f),++u,f=t[u];if(l===-1)return 0;++l}let p=[],g;for(g=0;g<l;g++)p[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};u=0;let m=0;for(;u<h;)p[t[u]].vertexTriangles.push(m),++p[t[u]].numLiveTriangles,p[t[u+1]].vertexTriangles.push(m),++p[t[u+1]].numLiveTriangles,p[t[u+2]].vertexTriangles.push(m),++p[t[u+2]].numLiveTriangles,++m,u+=3;let y=0,b=i+1;o=1;let x=[],A=[],C,S,v=0,P=[],M=a/3,R=[];for(g=0;g<M;g++)R[g]=!1;let L,F;for(;y!==-1;){x=[],S=p[y],F=S.vertexTriangles.length;for(let _=0;_<F;++_)if(m=S.vertexTriangles[_],!R[m]){R[m]=!0,u=m+m+m;for(let w=0;w<3;++w)L=t[u],x.push(L),A.push(L),P[v]=L,++v,C=p[L],--C.numLiveTriangles,b-C.timeStamp>i&&(C.timeStamp=b,++b),++u}y=s(t,i,x,p,b,A,l)}return P};var Nv=Gj;var zc={};function xV(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function JPe(e){let t=e.length,n=t/3*6,i=Fe.createTypedArray(t,n),o=0;for(let r=0;r<t;r+=3,o+=6)xV(i,o,e[r],e[r+1],e[r+2]);return i}function eIe(e){let t=e.length;if(t>=3){let n=(t-2)*6,i=Fe.createTypedArray(t,n);xV(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)xV(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function tIe(e){if(e.length>0){let t=e.length-1,n=(t-1)*6,i=Fe.createTypedArray(t,n),o=e[0],r=0;for(let s=1;s<t;++s,r+=6)xV(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}zc.toWireframe=function(e){if(!c(e))throw new E("geometry is required.");let t=e.indices;if(c(t)){switch(e.primitiveType){case Me.TRIANGLES:e.indices=JPe(t);break;case Me.TRIANGLE_STRIP:e.indices=eIe(t);break;case Me.TRIANGLE_FAN:e.indices=tIe(t);break;default:throw new E("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=Me.LINES}return e};zc.createLineSegmentsForVectors=function(e,t,n){if(t=t??"normal",!c(e))throw new E("geometry is required.");if(!c(e.attributes.position))throw new E("geometry.attributes.position is required.");if(!c(e.attributes[t]))throw new E(`geometry.attributes must have an attribute with the same name as the attributeName parameter, ${t}.`);n=n??1e4;let i=e.attributes.position.values,o=e.attributes[t].values,r=i.length,s=new Float64Array(2*r),a=0;for(let f=0;f<r;f+=3)s[a++]=i[f],s[a++]=i[f+1],s[a++]=i[f+2],s[a++]=i[f]+o[f]*n,s[a++]=i[f+1]+o[f+1]*n,s[a++]=i[f+2]+o[f+2]*n;let l,u=e.boundingSphere;return c(u)&&(l=new le(u.center,u.radius+n)),new ct({attributes:{position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:Me.LINES,boundingSphere:l})};zc.createAttributeLocations=function(e){if(!c(e))throw new E("geometry is required.");let t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={},o=0,r,s=t.length;for(r=0;r<s;++r){let a=t[r];c(n[a])&&(i[a]=o++)}for(let a in n)n.hasOwnProperty(a)&&!c(i[a])&&(i[a]=o++);return i};zc.reorderForPreVertexCache=function(e){if(!c(e))throw new E("geometry is required.");let t=ct.computeNumberOfVertices(e),n=e.indices;if(c(n)){let i=new Int32Array(t);for(let p=0;p<t;p++)i[p]=-1;let o=n,r=o.length,s=Fe.createTypedArray(t,r),a=0,l=0,u=0,f;for(;a<r;)f=i[o[a]],f!==-1?s[l]=f:(f=o[a],i[f]=u,s[l]=u,++u),++a,++l;e.indices=s;let h=e.attributes;for(let p in h)if(h.hasOwnProperty(p)&&c(h[p])&&c(h[p].values)){let g=h[p],m=g.values,y=0,b=g.componentsPerAttribute,x=$.createTypedArray(g.componentDatatype,u*b);for(;y<t;){let A=i[y];if(A!==-1)for(let C=0;C<b;C++)x[b*A+C]=m[b*y+C];++y}g.values=x}}return e};zc.reorderForPostVertexCache=function(e,t){if(!c(e))throw new E("geometry is required.");let n=e.indices;if(e.primitiveType===Me.TRIANGLES&&c(n)){let i=n.length,o=0;for(let r=0;r<i;r++)n[r]>o&&(o=n[r]);e.indices=Nv.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function zte(e){let t={};for(let n in e)if(e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)){let i=e[n];t[n]=new ve({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function nIe(e,t,n){for(let i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){let o=t[i];for(let r=0;r<o.componentsPerAttribute;++r)e[i].values.push(o.values[n*o.componentsPerAttribute+r])}}zc.fitToUnsignedShortIndices=function(e){if(!c(e))throw new E("geometry is required.");if(c(e.indices)&&e.primitiveType!==Me.TRIANGLES&&e.primitiveType!==Me.LINES&&e.primitiveType!==Me.POINTS)throw new E("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");let t=[],n=ct.computeNumberOfVertices(e);if(c(e.indices)&&n>=O.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=zte(e.attributes),a=e.indices,l=a.length,u;e.primitiveType===Me.TRIANGLES?u=3:e.primitiveType===Me.LINES?u=2:e.primitiveType===Me.POINTS&&(u=1);for(let f=0;f<l;f+=u){for(let h=0;h<u;++h){let p=a[f+h],g=i[p];c(g)||(g=r++,i[p]=g,nIe(s,e.attributes,p)),o.push(g)}r+u>=O.SIXTY_FOUR_KILOBYTES&&(t.push(new ct({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=zte(e.attributes))}o.length!==0&&t.push(new ct({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};var Hte=new d,iIe=new he;zc.projectTo2D=function(e,t,n,i,o){if(!c(e))throw new E("geometry is required.");if(!c(t))throw new E("attributeName is required.");if(!c(n))throw new E("attributeName3D is required.");if(!c(i))throw new E("attributeName2D is required.");if(!c(e.attributes[t]))throw new E(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==$.DOUBLE)throw new E("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");let r=e.attributes[t];o=c(o)?o:new Oi;let s=o.ellipsoid,a=r.values,l=new Float64Array(a.length),u=0;for(let f=0;f<a.length;f+=3){let h=d.fromArray(a,f,Hte),p=s.cartesianToCartographic(h,iIe);if(!c(p))throw new E(`Could not project point (${h.x}, ${h.y}, ${h.z}) to 2D.`);let g=o.project(p,Hte);l[u++]=g.x,l[u++]=g.y,l[u++]=g.z}return e.attributes[n]=r,e.attributes[i]=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:l}),delete e.attributes[t],e};var jj={high:0,low:0};zc.encodeAttribute=function(e,t,n,i){if(!c(e))throw new E("geometry is required.");if(!c(t))throw new E("attributeName is required.");if(!c(n))throw new E("attributeHighName is required.");if(!c(i))throw new E("attributeLowName is required.");if(!c(e.attributes[t]))throw new E(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==$.DOUBLE)throw new E("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");let o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),l=new Float32Array(s);for(let f=0;f<s;++f)Hn.encode(r[f],jj),a[f]=jj.high,l[f]=jj.low;let u=o.componentsPerAttribute;return e.attributes[n]=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:u,values:a}),e.attributes[i]=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:u,values:l}),delete e.attributes[t],e};var Nd=new d;function Wj(e,t){if(c(t)){let n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,Nd),B.multiplyByPoint(e,Nd,Nd),d.pack(Nd,n,o)}}function qj(e,t){if(c(t)){let n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,Nd),J.multiplyByVector(e,Nd,Nd),Nd=d.normalize(Nd,Nd),d.pack(Nd,n,o)}}var mV=new B,pV=new J;zc.transformToWorldCoordinates=function(e){if(!c(e))throw new E("instance is required.");let t=e.modelMatrix;if(B.equals(t,B.IDENTITY))return e;let n=e.geometry.attributes;Wj(t,n.position),Wj(t,n.prevPosition),Wj(t,n.nextPosition),(c(n.normal)||c(n.tangent)||c(n.bitangent))&&(B.inverse(t,mV),B.transpose(mV,mV),B.getMatrix3(mV,pV),qj(pV,n.normal),qj(pV,n.tangent),qj(pV,n.bitangent));let i=e.geometry.boundingSphere;return c(i)&&(e.geometry.boundingSphere=le.transform(i,t,i)),e.modelMatrix=B.clone(B.IDENTITY),e};function oIe(e,t){let n=e.length,i={},o=e[0][t].attributes,r;for(r in o)if(o.hasOwnProperty(r)&&c(o[r])&&c(o[r].values)){let s=o[r],a=s.values.length,l=!0;for(let u=1;u<n;++u){let f=e[u][t].attributes[r];if(!c(f)||s.componentDatatype!==f.componentDatatype||s.componentsPerAttribute!==f.componentsPerAttribute||s.normalize!==f.normalize){l=!1;break}a+=f.values.length}l&&(i[r]=new ve({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:$.createTypedArray(s.componentDatatype,a)}))}return i}var rIe=new d;function Yj(e,t){let n=e.length,i,o,r,s,a=e[0].modelMatrix,l=c(e[0][t].indices),u=e[0][t].primitiveType;for(o=1;o<n;++o){if(!B.equals(e[o].modelMatrix,a))throw new E("All instances must have the same modelMatrix.");if(c(e[o][t].indices)!==l)throw new E("All instance geometries must have an indices or not have one.");if(e[o][t].primitiveType!==u)throw new E("All instance geometries must have the same primitiveType.")}let f=oIe(e,t),h,p,g;for(i in f)if(f.hasOwnProperty(i))for(h=f[i].values,s=0,o=0;o<n;++o)for(p=e[o][t].attributes[i].values,g=p.length,r=0;r<g;++r)h[s++]=p[r];let m;if(l){let A=0;for(o=0;o<n;++o)A+=e[o][t].indices.length;let C=ct.computeNumberOfVertices(new ct({attributes:f,primitiveType:Me.POINTS})),S=Fe.createTypedArray(C,A),v=0,P=0;for(o=0;o<n;++o){let M=e[o][t].indices,R=M.length;for(s=0;s<R;++s)S[v++]=P+M[s];P+=ct.computeNumberOfVertices(e[o][t])}m=S}let y=new d,b=0,x;for(o=0;o<n;++o){if(x=e[o][t].boundingSphere,!c(x)){y=void 0;break}d.add(x.center,y,y)}if(c(y))for(d.divideByScalar(y,n,y),o=0;o<n;++o){x=e[o][t].boundingSphere;let A=d.magnitude(d.subtract(x.center,y,rIe))+x.radius;A>b&&(b=A)}return new ct({attributes:f,indices:m,primitiveType:u,boundingSphere:c(y)?new le(y,b):void 0})}zc.combineInstances=function(e){if(!c(e)||e.length<1)throw new E("instances is required and must have length greater than zero.");let t=[],n=[],i=e.length;for(let r=0;r<i;++r){let s=e[r];c(s.geometry)?t.push(s):c(s.westHemisphereGeometry)&&c(s.eastHemisphereGeometry)&&n.push(s)}let o=[];return t.length>0&&o.push(Yj(t,"geometry")),n.length>0&&(o.push(Yj(n,"westHemisphereGeometry")),o.push(Yj(n,"eastHemisphereGeometry"))),o};var Tf=new d,Fv=new d,lC=new d,uC=new d;zc.computeNormal=function(e){if(!c(e))throw new E("geometry is required.");if(!c(e.attributes.position)||!c(e.attributes.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(e.indices))throw new E("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Me.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");let t=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,r=t.length,s=new Array(o),a=new Array(r/3),l=new Array(r),u;for(u=0;u<o;u++)s[u]={indexOffset:0,count:0,currentCount:0};let f=0;for(u=0;u<r;u+=3){let m=t[u],y=t[u+1],b=t[u+2],x=m*3,A=y*3,C=b*3;Fv.x=i[x],Fv.y=i[x+1],Fv.z=i[x+2],lC.x=i[A],lC.y=i[A+1],lC.z=i[A+2],uC.x=i[C],uC.y=i[C+1],uC.z=i[C+2],s[m].count++,s[y].count++,s[b].count++,d.subtract(lC,Fv,lC),d.subtract(uC,Fv,uC),a[f]=d.cross(lC,uC,new d),f++}let h=0;for(u=0;u<o;u++)s[u].indexOffset+=h,h+=s[u].count;f=0;let p;for(u=0;u<r;u+=3){p=s[t[u]];let m=p.indexOffset+p.currentCount;l[m]=f,p.currentCount++,p=s[t[u+1]],m=p.indexOffset+p.currentCount,l[m]=f,p.currentCount++,p=s[t[u+2]],m=p.indexOffset+p.currentCount,l[m]=f,p.currentCount++,f++}let g=new Float32Array(o*3);for(u=0;u<o;u++){let m=u*3;if(p=s[u],d.clone(d.ZERO,Tf),p.count>0){for(f=0;f<p.count;f++)d.add(Tf,a[l[p.indexOffset+f]],Tf);d.equalsEpsilon(d.ZERO,Tf,O.EPSILON10)&&d.clone(a[l[p.indexOffset]],Tf)}d.equalsEpsilon(d.ZERO,Tf,O.EPSILON10)&&(Tf.z=1),d.normalize(Tf,Tf),g[m]=Tf.x,g[m+1]=Tf.y,g[m+2]=Tf.z}return e.attributes.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g}),e};var sIe=new d,Gte=new d,aIe=new d;zc.computeTangentAndBitangent=function(e){if(!c(e))throw new E("geometry is required.");let t=e.attributes,n=e.indices;if(!c(t.position)||!c(t.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(t.normal)||!c(t.normal.values))throw new E("geometry.attributes.normal.values is required.");if(!c(t.st)||!c(t.st.values))throw new E("geometry.attributes.st.values is required.");if(!c(n))throw new E("geometry.indices is required.");if(n.length<2||n.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Me.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");let i=e.attributes.position.values,o=e.attributes.normal.values,r=e.attributes.st.values,s=e.attributes.position.values.length/3,a=n.length,l=new Array(s*3),u;for(u=0;u<l.length;u++)l[u]=0;let f,h,p;for(u=0;u<a;u+=3){let y=n[u],b=n[u+1],x=n[u+2];f=y*3,h=b*3,p=x*3;let A=y*2,C=b*2,S=x*2,v=i[f],P=i[f+1],M=i[f+2],R=r[A],L=r[A+1],F=r[C+1]-L,_=r[S+1]-L,w=1/((r[C]-R)*_-(r[S]-R)*F),D=(_*(i[h]-v)-F*(i[p]-v))*w,I=(_*(i[h+1]-P)-F*(i[p+1]-P))*w,N=(_*(i[h+2]-M)-F*(i[p+2]-M))*w;l[f]+=D,l[f+1]+=I,l[f+2]+=N,l[h]+=D,l[h+1]+=I,l[h+2]+=N,l[p]+=D,l[p+1]+=I,l[p+2]+=N}let g=new Float32Array(s*3),m=new Float32Array(s*3);for(u=0;u<s;u++){f=u*3,h=f+1,p=f+2;let y=d.fromArray(o,f,sIe),b=d.fromArray(l,f,aIe),x=d.dot(y,b);d.multiplyByScalar(y,x,Gte),d.normalize(d.subtract(b,Gte,b),b),g[f]=b.x,g[h]=b.y,g[p]=b.z,d.normalize(d.cross(y,b,b),b),m[f]=b.x,m[h]=b.y,m[p]=b.z}return e.attributes.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:m}),e};var Bv=new H,Ld=new d,jte=new d,Wte=new d,_V=new H;zc.compressVertices=function(e){if(!c(e))throw new E("geometry is required.");let t=e.attributes.extrudeDirection,n,i;if(c(t)){let P=t.values;i=P.length/3;let M=new Float32Array(i*2),R=0;for(n=0;n<i;++n){if(d.fromArray(P,n*3,Ld),d.equals(Ld,d.ZERO)){R+=2;continue}_V=Ln.octEncodeInRange(Ld,65535,_V),M[R++]=_V.x,M[R++]=_V.y}return e.attributes.compressedAttributes=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:M}),delete e.attributes.extrudeDirection,e}let o=e.attributes.normal,r=e.attributes.st,s=c(o),a=c(r);if(!s&&!a)return e;let l=e.attributes.tangent,u=e.attributes.bitangent,f=c(l),h=c(u),p,g,m,y;s&&(p=o.values),a&&(g=r.values),f&&(m=l.values),h&&(y=u.values),i=(s?p.length:g.length)/(s?3:2);let A=i,C=a&&s?2:1;C+=f||h?1:0,A*=C;let S=new Float32Array(A),v=0;for(n=0;n<i;++n){a&&(H.fromArray(g,n*2,Bv),S[v++]=Ln.compressTextureCoordinates(Bv));let P=n*3;s&&c(m)&&c(y)?(d.fromArray(p,P,Ld),d.fromArray(m,P,jte),d.fromArray(y,P,Wte),Ln.octPack(Ld,jte,Wte,Bv),S[v++]=Bv.x,S[v++]=Bv.y):(s&&(d.fromArray(p,P,Ld),S[v++]=Ln.octEncodeFloat(Ld)),f&&(d.fromArray(m,P,Ld),S[v++]=Ln.octEncodeFloat(Ld)),h&&(d.fromArray(y,P,Ld),S[v++]=Ln.octEncodeFloat(Ld)))}return e.attributes.compressedAttributes=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:C,values:S}),s&&delete e.attributes.normal,a&&delete e.attributes.st,h&&delete e.attributes.bitangent,f&&delete e.attributes.tangent,e};function cIe(e){if(c(e.indices))return e;let t=ct.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least three.");if(t%3!==0)throw new E("The number of vertices must be a multiple of three.");let n=Fe.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function lIe(e){let t=ct.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least three.");let n=Fe.createTypedArray(t,(t-2)*3);n[0]=1,n[1]=0,n[2]=2;let i=3;for(let o=3;o<t;++o)n[i++]=o-1,n[i++]=0,n[i++]=o;return e.indices=n,e.primitiveType=Me.TRIANGLES,e}function uIe(e){let t=ct.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least 3.");let n=Fe.createTypedArray(t,(t-2)*3);n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let o=3;o<t-1;o+=2)n[i++]=o,n[i++]=o-1,n[i++]=o+1,o+2<t&&(n[i++]=o,n[i++]=o+1,n[i++]=o+2);return e.indices=n,e.primitiveType=Me.TRIANGLES,e}function fIe(e){if(c(e.indices))return e;let t=ct.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");if(t%2!==0)throw new E("The number of vertices must be a multiple of 2.");let n=Fe.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function dIe(e){let t=ct.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");let n=Fe.createTypedArray(t,(t-1)*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return e.indices=n,e.primitiveType=Me.LINES,e}function hIe(e){let t=ct.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");let n=Fe.createTypedArray(t,t*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return n[i++]=t-1,n[i]=0,e.indices=n,e.primitiveType=Me.LINES,e}function mIe(e){switch(e.primitiveType){case Me.TRIANGLE_FAN:return lIe(e);case Me.TRIANGLE_STRIP:return uIe(e);case Me.TRIANGLES:return cIe(e);case Me.LINE_STRIP:return dIe(e);case Me.LINE_LOOP:return hIe(e);case Me.LINES:return fIe(e)}return e}function jg(e,t){Math.abs(e.y)<O.EPSILON6&&(t?e.y=-O.EPSILON6:e.y=O.EPSILON6)}function pIe(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){jg(e,e.y<0),jg(t,t.y<0),jg(n,n.y<0);return}let i=Math.abs(e.y),o=Math.abs(t.y),r=Math.abs(n.y),s;i>o?i>r?s=O.sign(e.y):s=O.sign(n.y):o>r?s=O.sign(t.y):s=O.sign(n.y);let a=s<0;jg(e,a),jg(t,a),jg(n,a)}var qte=new d;function Af(e,t,n,i){d.add(e,d.multiplyByScalar(d.subtract(t,e,qte),e.y/(e.y-t.y),qte),n),d.clone(n,i),jg(n,!0),jg(i,!1)}var bb=new d,xb=new d,Tb=new d,Ab=new d,Xj={positions:new Array(7),indices:new Array(3*3)};function _Ie(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;pIe(e,t,n);let i=e.y<0,o=t.y<0,r=n.y<0,s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;let a=Xj.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Af(e,t,bb,Tb),Af(e,n,xb,Ab),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Af(t,n,bb,Tb),Af(t,e,xb,Ab),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Af(n,e,bb,Tb),Af(n,t,xb,Ab),a[0]=2,a[3]=0,a[4]=1,a[6]=0)):s===2&&(a[2]=4,a[4]=4,a[5]=3,a[7]=5,a[8]=6,i?o?r||(Af(n,e,bb,Tb),Af(n,t,xb,Ab),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Af(t,n,bb,Tb),Af(t,e,xb,Ab),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Af(e,t,bb,Tb),Af(e,n,xb,Ab),a[0]=1,a[1]=2,a[3]=1,a[6]=0));let l=Xj.positions;return l[0]=e,l[1]=t,l[2]=n,l.length=3,(s===1||s===2)&&(l[3]=bb,l[4]=xb,l[5]=Tb,l[6]=Ab,l.length=7),Xj}function Yte(e,t){let n=e.attributes;if(n.position.values.length===0)return;for(let o in n)if(n.hasOwnProperty(o)&&c(n[o])&&c(n[o].values)){let r=n[o];r.values=$.createTypedArray(r.componentDatatype,r.values)}let i=ct.computeNumberOfVertices(e);return e.indices=Fe.createTypedArray(i,e.indices),t&&(e.boundingSphere=le.fromVertices(n.position.values)),e}function dC(e){let t=e.attributes,n={};for(let i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){let o=t[i];n[i]=new ve({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new ct({attributes:n,indices:[],primitiveType:e.primitiveType})}function Qj(e,t,n){let i=c(e.geometry.boundingSphere);t=Yte(t,i),n=Yte(n,i),c(n)&&!c(t)?e.geometry=n:!c(n)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function Jj(e,t){let n=new e,i=new e,o=new e;return function(r,s,a,l,u,f,h,p){let g=e.fromArray(u,r*t,n),m=e.fromArray(u,s*t,i),y=e.fromArray(u,a*t,o);e.multiplyByScalar(g,l.x,g),e.multiplyByScalar(m,l.y,m),e.multiplyByScalar(y,l.z,y);let b=e.add(g,m,g);e.add(b,y,b),p&&e.normalize(b,b),e.pack(b,f,h*t)}}var gIe=Jj(se,4),bV=Jj(d,3),Jte=Jj(H,2),yIe=function(e,t,n,i,o,r,s){let a=o[e]*i.x,l=o[t]*i.y,u=o[n]*i.z;r[s]=a+l+u>O.EPSILON6?1:0},kv=new d,Kj=new d,$j=new d,bIe=new d;function gV(e,t,n,i,o,r,s,a,l,u,f,h,p,g,m,y){if(!c(r)&&!c(s)&&!c(a)&&!c(l)&&!c(u)&&g===0)return;let b=d.fromArray(o,e*3,kv),x=d.fromArray(o,t*3,Kj),A=d.fromArray(o,n*3,$j),C=_b(i,b,x,A,bIe);if(c(C)){if(c(r)&&bV(e,t,n,C,r,h.normal.values,y,!0),c(u)){let S=d.fromArray(u,e*3,kv),v=d.fromArray(u,t*3,Kj),P=d.fromArray(u,n*3,$j);d.multiplyByScalar(S,C.x,S),d.multiplyByScalar(v,C.y,v),d.multiplyByScalar(P,C.z,P);let M;!d.equals(S,d.ZERO)||!d.equals(v,d.ZERO)||!d.equals(P,d.ZERO)?(M=d.add(S,v,S),d.add(M,P,M),d.normalize(M,M)):(M=kv,M.x=0,M.y=0,M.z=0),d.pack(M,h.extrudeDirection.values,y*3)}if(c(f)&&yIe(e,t,n,C,f,h.applyOffset.values,y),c(s)&&bV(e,t,n,C,s,h.tangent.values,y,!0),c(a)&&bV(e,t,n,C,a,h.bitangent.values,y,!0),c(l)&&Jte(e,t,n,C,l,h.st.values,y),g>0)for(let S=0;S<g;S++){let v=p[S];xIe(e,t,n,C,y,m[v],h[v])}}}function xIe(e,t,n,i,o,r,s){let a=r.componentsPerAttribute,l=r.values,u=s.values;switch(a){case 4:gIe(e,t,n,i,l,u,o,!1);break;case 3:bV(e,t,n,i,l,u,o,!1);break;case 2:Jte(e,t,n,i,l,u,o,!1);break;default:u[o]=l[e]*i.x+l[t]*i.y+l[n]*i.z}}function hm(e,t,n,i,o,r){let s=e.position.values.length/3;if(o!==-1){let a=i[o],l=n[a];return l===-1?(n[a]=s,e.position.values.push(r.x,r.y,r.z),t.push(s),s):(t.push(l),l)}return e.position.values.push(r.x,r.y,r.z),t.push(s),s}var TIe={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function Xte(e){let t=e.geometry,n=t.attributes,i=n.position.values,o=c(n.normal)?n.normal.values:void 0,r=c(n.bitangent)?n.bitangent.values:void 0,s=c(n.tangent)?n.tangent.values:void 0,a=c(n.st)?n.st.values:void 0,l=c(n.extrudeDirection)?n.extrudeDirection.values:void 0,u=c(n.applyOffset)?n.applyOffset.values:void 0,f=t.indices,h=[];for(let M in n)n.hasOwnProperty(M)&&!TIe[M]&&c(n[M])&&h.push(M);let p=h.length,g=dC(t),m=dC(t),y,b,x,A,C,S=[];S.length=i.length/3;let v=[];for(v.length=i.length/3,C=0;C<S.length;++C)S[C]=-1,v[C]=-1;let P=f.length;for(C=0;C<P;C+=3){let M=f[C],R=f[C+1],L=f[C+2],F=d.fromArray(i,M*3),_=d.fromArray(i,R*3),w=d.fromArray(i,L*3),D=_Ie(F,_,w);if(c(D)&&D.positions.length>3){let I=D.positions,N=D.indices,k=N.length;for(let z=0;z<k;++z){let V=N[z],j=I[V];j.y<0?(y=m.attributes,b=m.indices,x=S):(y=g.attributes,b=g.indices,x=v),A=hm(y,b,x,f,V<3?C+V:-1,j),gV(M,R,L,j,i,o,s,r,a,l,u,y,h,p,n,A)}}else c(D)&&(F=D.positions[0],_=D.positions[1],w=D.positions[2]),F.y<0?(y=m.attributes,b=m.indices,x=S):(y=g.attributes,b=g.indices,x=v),A=hm(y,b,x,f,C,F),gV(M,R,L,F,i,o,s,r,a,l,u,y,h,p,n,A),A=hm(y,b,x,f,C+1,_),gV(M,R,L,_,i,o,s,r,a,l,u,y,h,p,n,A),A=hm(y,b,x,f,C+2,w),gV(M,R,L,w,i,o,s,r,a,l,u,y,h,p,n,A)}Qj(e,m,g)}var ene=sn.fromPointNormal(d.ZERO,d.UNIT_Y),AIe=new d,CIe=new d;function fC(e,t,n,i,o,r,s){if(!c(s))return;let a=d.fromArray(i,e*3,kv);d.equalsEpsilon(a,n,O.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function Kte(e){let t=e.geometry,n=t.attributes,i=n.position.values,o=c(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=dC(t),a=dC(t),l,u=r.length,f=[];f.length=i.length/3;let h=[];for(h.length=i.length/3,l=0;l<f.length;++l)f[l]=-1,h[l]=-1;for(l=0;l<u;l+=2){let p=r[l],g=r[l+1],m=d.fromArray(i,p*3,kv),y=d.fromArray(i,g*3,Kj),b;Math.abs(m.y)<O.EPSILON6&&(m.y<0?m.y=-O.EPSILON6:m.y=O.EPSILON6),Math.abs(y.y)<O.EPSILON6&&(y.y<0?y.y=-O.EPSILON6:y.y=O.EPSILON6);let x=s.attributes,A=s.indices,C=h,S=a.attributes,v=a.indices,P=f,M=Zn.lineSegmentPlane(m,y,ene,$j);if(c(M)){let R=d.multiplyByScalar(d.UNIT_Y,5*O.EPSILON9,AIe);m.y<0&&(d.negate(R,R),x=a.attributes,A=a.indices,C=f,S=s.attributes,v=s.indices,P=h);let L=d.add(M,R,CIe);b=hm(x,A,C,r,l,m),fC(p,g,m,i,b,x,o),b=hm(x,A,C,r,-1,L),fC(p,g,L,i,b,x,o),d.negate(R,R),d.add(M,R,L),b=hm(S,v,P,r,-1,L),fC(p,g,L,i,b,S,o),b=hm(S,v,P,r,l+1,y),fC(p,g,y,i,b,S,o)}else{let R,L,F;m.y<0?(R=a.attributes,L=a.indices,F=f):(R=s.attributes,L=s.indices,F=h),b=hm(R,L,F,r,l,m),fC(p,g,m,i,b,R,o),b=hm(R,L,F,r,l+1,y),fC(p,g,y,i,b,R,o)}}Qj(e,a,s)}var $te=new H,EIe=new H,tne=new d,nne=new d,Zj=new d,SIe=new d,wIe=new d,vIe=new d,Zte=new se;function Qte(e){let t=e.attributes,n=t.position.values,i=t.prevPosition.values,o=t.nextPosition.values,r=n.length;for(let s=0;s<r;s+=3){let a=d.unpack(n,s,tne);if(a.x>0)continue;let l=d.unpack(i,s,nne);(a.y<0&&l.y>0||a.y>0&&l.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):d.pack(a,i,s));let u=d.unpack(o,s,Zj);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):d.pack(a,o,s))}}var DIe=5*O.EPSILON9,yV=O.EPSILON6;function PIe(e){let t=e.geometry,n=t.attributes,i=n.position.values,o=n.prevPosition.values,r=n.nextPosition.values,s=n.expandAndWidth.values,a=c(n.st)?n.st.values:void 0,l=c(n.color)?n.color.values:void 0,u=dC(t),f=dC(t),h,p,g,m=!1,y=i.length/3;for(h=0;h<y;h+=4){let b=h,x=h+2,A=d.fromArray(i,b*3,tne),C=d.fromArray(i,x*3,nne);if(Math.abs(A.y)<yV)for(A.y=yV*(C.y<0?-1:1),i[h*3+1]=A.y,i[(h+1)*3+1]=A.y,p=b*3;p<b*3+4*3;p+=3)o[p]=i[h*3],o[p+1]=i[h*3+1],o[p+2]=i[h*3+2];if(Math.abs(C.y)<yV)for(C.y=yV*(A.y<0?-1:1),i[(h+2)*3+1]=C.y,i[(h+3)*3+1]=C.y,p=b*3;p<b*3+4*3;p+=3)r[p]=i[(h+2)*3],r[p+1]=i[(h+2)*3+1],r[p+2]=i[(h+2)*3+2];let S=u.attributes,v=u.indices,P=f.attributes,M=f.indices,R=Zn.lineSegmentPlane(A,C,ene,SIe);if(c(R)){m=!0;let L=d.multiplyByScalar(d.UNIT_Y,DIe,wIe);A.y<0&&(d.negate(L,L),S=f.attributes,v=f.indices,P=u.attributes,M=u.indices);let F=d.add(R,L,vIe);S.position.values.push(A.x,A.y,A.z,A.x,A.y,A.z),S.position.values.push(F.x,F.y,F.z),S.position.values.push(F.x,F.y,F.z),S.prevPosition.values.push(o[b*3],o[b*3+1],o[b*3+2]),S.prevPosition.values.push(o[b*3+3],o[b*3+4],o[b*3+5]),S.prevPosition.values.push(A.x,A.y,A.z,A.x,A.y,A.z),S.nextPosition.values.push(F.x,F.y,F.z),S.nextPosition.values.push(F.x,F.y,F.z),S.nextPosition.values.push(F.x,F.y,F.z),S.nextPosition.values.push(F.x,F.y,F.z),d.negate(L,L),d.add(R,L,F),P.position.values.push(F.x,F.y,F.z),P.position.values.push(F.x,F.y,F.z),P.position.values.push(C.x,C.y,C.z,C.x,C.y,C.z),P.prevPosition.values.push(F.x,F.y,F.z),P.prevPosition.values.push(F.x,F.y,F.z),P.prevPosition.values.push(F.x,F.y,F.z),P.prevPosition.values.push(F.x,F.y,F.z),P.nextPosition.values.push(C.x,C.y,C.z,C.x,C.y,C.z),P.nextPosition.values.push(r[x*3],r[x*3+1],r[x*3+2]),P.nextPosition.values.push(r[x*3+3],r[x*3+4],r[x*3+5]);let _=H.fromArray(s,b*2,$te),w=Math.abs(_.y);S.expandAndWidth.values.push(-1,w,1,w),S.expandAndWidth.values.push(-1,-w,1,-w),P.expandAndWidth.values.push(-1,w,1,w),P.expandAndWidth.values.push(-1,-w,1,-w);let D=d.magnitudeSquared(d.subtract(R,A,Zj));if(D/=d.magnitudeSquared(d.subtract(C,A,Zj)),c(l)){let I=se.fromArray(l,b*4,Zte),N=se.fromArray(l,x*4,Zte),k=O.lerp(I.x,N.x,D),z=O.lerp(I.y,N.y,D),V=O.lerp(I.z,N.z,D),j=O.lerp(I.w,N.w,D);for(p=b*4;p<b*4+2*4;++p)S.color.values.push(l[p]);for(S.color.values.push(k,z,V,j),S.color.values.push(k,z,V,j),P.color.values.push(k,z,V,j),P.color.values.push(k,z,V,j),p=x*4;p<x*4+2*4;++p)P.color.values.push(l[p])}if(c(a)){let I=H.fromArray(a,b*2,$te),N=H.fromArray(a,(h+3)*2,EIe),k=O.lerp(I.x,N.x,D);for(p=b*2;p<b*2+2*2;++p)S.st.values.push(a[p]);for(S.st.values.push(k,I.y),S.st.values.push(k,N.y),P.st.values.push(k,I.y),P.st.values.push(k,N.y),p=x*2;p<x*2+2*2;++p)P.st.values.push(a[p])}g=S.position.values.length/3-4,v.push(g,g+2,g+1),v.push(g+1,g+2,g+3),g=P.position.values.length/3-4,M.push(g,g+2,g+1),M.push(g+1,g+2,g+3)}else{let L,F;for(A.y<0?(L=f.attributes,F=f.indices):(L=u.attributes,F=u.indices),L.position.values.push(A.x,A.y,A.z),L.position.values.push(A.x,A.y,A.z),L.position.values.push(C.x,C.y,C.z),L.position.values.push(C.x,C.y,C.z),p=h*3;p<h*3+4*3;++p)L.prevPosition.values.push(o[p]),L.nextPosition.values.push(r[p]);for(p=h*2;p<h*2+4*2;++p)L.expandAndWidth.values.push(s[p]),c(a)&&L.st.values.push(a[p]);if(c(l))for(p=h*4;p<h*4+4*4;++p)L.color.values.push(l[p]);g=L.position.values.length/3-4,F.push(g,g+2,g+1),F.push(g+1,g+2,g+3)}}m&&(Qte(f),Qte(u)),Qj(e,f,u)}zc.splitLongitude=function(e){if(!c(e))throw new E("instance is required.");let t=e.geometry,n=t.boundingSphere;if(c(n)&&(n.center.x-n.radius>0||le.intersectPlane(n,sn.ORIGIN_ZX_PLANE)!==Wt.INTERSECTING))return e;if(t.geometryType!==xf.NONE)switch(t.geometryType){case xf.POLYLINES:PIe(e);break;case xf.TRIANGLES:Xte(e);break;case xf.LINES:Kte(e);break}else mIe(t),t.primitiveType===Me.TRIANGLES?Xte(e):t.primitiveType===Me.LINES&&Kte(e);return e};var Nn=zc;function Uv(e,t,n,i,o,r,s,a,l,u,f){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=l,this._flipY=u,this._initialized=f}Object.defineProperties(Uv.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});Uv.prototype.copyFrom=function(e){T.defined("options",e);let{xOffset:t=0,yOffset:n=0,source:i,skipColorSpaceConversion:o=!1}=e;if(T.defined("options.source",i),T.typeOf.number.greaterThanOrEquals("xOffset",t,0),T.typeOf.number.greaterThanOrEquals("yOffset",n,0),t+i.width>this._size)throw new E("xOffset + options.source.width must be less than or equal to width.");if(n+i.height>this._size)throw new E("yOffset + options.source.height must be less than or equal to height.");let{width:r,height:s}=i,a=this._context._gl,l=this._textureTarget,u=this._targetFace;a.activeTexture(a.TEXTURE0),a.bindTexture(l,this._texture);let f=i.arrayBufferView,h=this._size,p=this._pixelFormat,g=this._internalFormat,m=this._pixelDatatype,y=this._preMultiplyAlpha,b=this._flipY,x=4;c(f)&&(x=ke.alignmentInBytes(p,m,r)),a.pixelStorei(a.UNPACK_ALIGNMENT,x),o?a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,a.NONE):a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,a.BROWSER_DEFAULT_WEBGL);let A=!1;if(!this._initialized){let C;t===0&&n===0&&r===h&&s===h?(c(f)?(a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),b&&(f=ke.flipY(f,p,m,h,h)),C=f):(a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b),C=i),A=!0):(a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),C=ke.createTypedArray(p,m,h,h)),a.texImage2D(u,0,g,h,h,0,p,Ue.toWebGLConstant(m,this._context),C),this._initialized=!0}A||(c(f)?(a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),b&&(f=ke.flipY(f,p,m,r,s)),a.texSubImage2D(u,0,t,n,r,s,p,Ue.toWebGLConstant(m,this._context),f)):(a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b),a.texSubImage2D(u,0,t,n,p,Ue.toWebGLConstant(m,this._context),i))),a.bindTexture(l,null)};Uv.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=e??0,t=t??0,n=n??0,i=i??0,o=o??this._size,r=r??this._size,T.typeOf.number.greaterThanOrEquals("xOffset",e,0),T.typeOf.number.greaterThanOrEquals("yOffset",t,0),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new E("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new E("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===Ue.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Ue.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");let s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(this._targetFace,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};Uv.prototype.copyMipmapFromFramebuffer=function(e,t,n,i,o){if(e=e??0,t=t??0,n=n??this._size,i=i??this._size,o=o??0,T.typeOf.number.greaterThanOrEquals("xOffset",e,0),T.typeOf.number.greaterThanOrEquals("yOffset",t,0),e+n>this._size)throw new E("xOffset + source.width must be less than or equal to width.");if(t+i>this._size)throw new E("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===Ue.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Ue.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");let r=this._context._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture),r.copyTexImage2D(this._targetFace,o,this._internalFormat,e,t,n,i,0),r.bindTexture(s,null),this._initialized=!0};var Vv=Uv;var TV={DONT_CARE:ne.DONT_CARE,FASTEST:ne.FASTEST,NICEST:ne.NICEST,validate:function(e){return e===TV.DONT_CARE||e===TV.FASTEST||e===TV.NICEST}},Cf=Object.freeze(TV);var AV={NEAREST:ne.NEAREST,LINEAR:ne.LINEAR};AV.validate=function(e){return e===AV.NEAREST||e===AV.LINEAR};var li=Object.freeze(AV);var Wg={NEAREST:ne.NEAREST,LINEAR:ne.LINEAR,NEAREST_MIPMAP_NEAREST:ne.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:ne.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:ne.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:ne.LINEAR_MIPMAP_LINEAR};Wg.validate=function(e){return e===Wg.NEAREST||e===Wg.LINEAR||e===Wg.NEAREST_MIPMAP_NEAREST||e===Wg.LINEAR_MIPMAP_NEAREST||e===Wg.NEAREST_MIPMAP_LINEAR||e===Wg.LINEAR_MIPMAP_LINEAR};var Yt=Object.freeze(Wg);var CV={CLAMP_TO_EDGE:ne.CLAMP_TO_EDGE,REPEAT:ne.REPEAT,MIRRORED_REPEAT:ne.MIRRORED_REPEAT,validate:function(e){return e===CV.CLAMP_TO_EDGE||e===CV.REPEAT||e===CV.MIRRORED_REPEAT}},gn=Object.freeze(CV);function zv(e){e=e??W.EMPTY_OBJECT;let{wrapS:t=gn.CLAMP_TO_EDGE,wrapT:n=gn.CLAMP_TO_EDGE,minificationFilter:i=Yt.LINEAR,magnificationFilter:o=li.LINEAR,maximumAnisotropy:r=1}=e;if(!gn.validate(t))throw new E("Invalid sampler.wrapS.");if(!gn.validate(n))throw new E("Invalid sampler.wrapT.");if(!Yt.validate(i))throw new E("Invalid sampler.minificationFilter.");if(!li.validate(o))throw new E("Invalid sampler.magnificationFilter.");T.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(zv.prototype,{wrapS:{get:function(){return this._wrapS}},wrapT:{get:function(){return this._wrapT}},minificationFilter:{get:function(){return this._minificationFilter}},magnificationFilter:{get:function(){return this._magnificationFilter}},maximumAnisotropy:{get:function(){return this._maximumAnisotropy}}});zv.equals=function(e,t){return e===t||c(e)&&c(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};zv.NEAREST=Object.freeze(new zv({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST}));var Qt=zv;function IIe(e,t,n,i){let o=c(t.vertexBuffer),r=c(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new E("attribute must have a vertexBuffer or a value.");if(o&&r)throw new E("attribute cannot have both a vertexBuffer and a value.  It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(s!==1&&s!==2&&s!==3&&s!==4)throw r?new E("attribute.value.length must be in the range [1, 4]."):new E("attribute.componentsPerAttribute must be in the range [1, 4].");if(c(t.componentDatatype)&&!$.validate(t.componentDatatype))throw new E("attribute must have a valid componentDatatype or not specify it.");if(c(t.strideInBytes)&&t.strideInBytes>255)throw new E("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new E("instanced arrays is not supported");if(c(t.instanceDivisor)&&t.instanceDivisor<0)throw new E("attribute must have an instanceDivisor greater than or equal to zero");if(c(t.instanceDivisor)&&r)throw new E("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&t.index===0)throw new E("attribute zero cannot have an instanceDivisor greater than 0");let a={index:t.index??n,enabled:t.enabled??!0,vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:t.componentDatatype??$.FLOAT,normalize:t.normalize??!1,offsetInBytes:t.offsetInBytes??0,strideInBytes:t.strideInBytes??0,instanceDivisor:t.instanceDivisor??0};if(o)a.vertexAttrib=function(l){let u=this.index;l.bindBuffer(l.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),l.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),l.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(l){l.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(l){l.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(l){l.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(l){l.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(l){l.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(l){}}e.push(a)}function one(e,t,n){for(let i=0;i<t.length;++i){let o=t[i];o.enabled&&o.vertexAttrib(e)}c(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function Op(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context),T.defined("options.attributes",e.attributes);let t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer,r,s=[],a=1,l=!1,u=!1,f=i.length;for(r=0;r<f;++r)IIe(s,i[r],r,t);for(f=s.length,r=0;r<f;++r){let g=s[r];if(c(g.vertexBuffer)&&g.instanceDivisor===0){let m=g.strideInBytes||g.componentsPerAttribute*$.getSizeInBytes(g.componentDatatype);a=g.vertexBuffer.sizeInBytes/m;break}}for(r=0;r<f;++r)s[r].instanceDivisor>0&&(l=!0),c(s[r].value)&&(u=!0);let h={};for(r=0;r<f;++r){let g=s[r].index;if(h[g])throw new E(`Index ${g} is used by more than one attribute.`);h[g]=!0}let p;t.vertexArrayObject&&(p=t.glCreateVertexArray(),t.glBindVertexArray(p),one(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=l,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=p,this._attributes=s,this._indexBuffer=o}function ine(e){return e.values.length/e.componentsPerAttribute}function OIe(e){return $.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function RIe(e){let t,n,i,o=[];for(n in e)e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)&&(o.push(n),e[n].componentDatatype===$.DOUBLE&&(e[n].componentDatatype=$.FLOAT,e[n].values=$.createTypedArray($.FLOAT,e[n].values)));let r,s=o.length;if(s>0)for(r=ine(e[o[0]]),t=1;t<s;++t){let u=ine(e[o[t]]);if(u!==r)throw new ae(`Each attribute list must have the same number of vertices.  Attribute ${o[t]} has a different number of vertices (${u.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(u,f){return $.getSizeInBytes(e[f].componentDatatype)-$.getSizeInBytes(e[u].componentDatatype)});let a=0,l={};for(t=0;t<s;++t)n=o[t],i=e[n],l[n]=a,a+=OIe(i);if(a>0){let u=$.getSizeInBytes(e[o[0]].componentDatatype),f=a%u;f!==0&&(a+=u-f);let h=r*a,p=new ArrayBuffer(h),g={};for(t=0;t<s;++t){n=o[t];let m=$.getSizeInBytes(e[n].componentDatatype);g[n]={pointer:$.createTypedArray(e[n].componentDatatype,p),index:l[n]/m,strideInComponentType:a/m}}for(t=0;t<r;++t)for(let m=0;m<s;++m){n=o[m],i=e[n];let y=i.values,b=g[n],x=b.pointer,A=i.componentsPerAttribute;for(let C=0;C<A;++C)x[b.index+C]=y[t*A+C];b.index+=b.strideInComponentType}return{buffer:p,offsetsInBytes:l,vertexSizeInBytes:a}}}Op.fromGeometry=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context);let t=e.context,n=e.geometry??W.EMPTY_OBJECT,i=e.bufferUsage??Be.DYNAMIC_DRAW,o=e.attributeLocations??W.EMPTY_OBJECT,r=e.interleave??!1,s=e.vertexArrayAttributes,a,l,u,f=c(s)?s:[],h=n.attributes;if(r){let m=RIe(h);if(c(m)){u=yt.createVertexBuffer({context:t,typedArray:m.buffer,usage:i});let y=m.offsetsInBytes,b=m.vertexSizeInBytes;for(a in h)h.hasOwnProperty(a)&&c(h[a])&&(l=h[a],c(l.values)?f.push({index:o[a],vertexBuffer:u,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:y[a],strideInBytes:b}):f.push({index:o[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in h)if(h.hasOwnProperty(a)&&c(h[a])){l=h[a];let m=l.componentDatatype;m===$.DOUBLE&&(m=$.FLOAT),u=void 0,c(l.values)&&(u=yt.createVertexBuffer({context:t,typedArray:$.createTypedArray(m,l.values),usage:i})),f.push({index:o[a],vertexBuffer:u,value:l.value,componentDatatype:m,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize})}let p,g=n.indices;return c(g)&&(ct.computeNumberOfVertices(n)>=O.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?p=yt.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:Fe.UNSIGNED_INT}):p=yt.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:Fe.UNSIGNED_SHORT})),new Op({context:t,attributes:f,indexBuffer:p})};Object.defineProperties(Op.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});Op.prototype.getAttribute=function(e){return T.defined("index",e),this._attributes[e]};function MIe(e){let t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;let i=t._vertexAttribDivisors,o=e._attributes,r=ut.maximumVertexAttributes,s;if(n){let a=o.length;for(s=0;s<a;++s){let l=o[s];if(l.enabled){let u=l.instanceDivisor,f=l.index;u!==i[f]&&(t.glVertexAttribDivisor(f,u),i[f]=u)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function LIe(e,t){let n=e._attributes,i=n.length;for(let o=0;o<i;++o){let r=n[o];r.enabled&&c(r.value)&&r.vertexAttrib(t)}}Op.prototype._bind=function(){c(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&MIe(this),this._hasConstantAttributes&&LIe(this,this._gl)):one(this._gl,this._attributes,this._indexBuffer)};Op.prototype._unBind=function(){if(c(this._vao))this._context.glBindVertexArray(null);else{let e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){let i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}};Op.prototype.isDestroyed=function(){return!1};Op.prototype.destroy=function(){let e=this._attributes;for(let n=0;n<e.length;++n){let i=e[n].vertexBuffer;c(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}let t=this._indexBuffer;return c(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),c(this._vao)&&this._context.glDeleteVertexArray(this._vao),de(this)};var ti=Op;function Co(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context);let{context:t,source:n,pixelFormat:i=ke.RGBA,pixelDatatype:o=Ue.UNSIGNED_BYTE,flipY:r=!0,skipColorSpaceConversion:s=!1,sampler:a=new Qt}=e,l=e.preMultiplyAlpha||i===ke.RGB||i===ke.LUMINANCE,{width:u,height:f}=e;if(c(n)){if(!Object.values(Co.FaceName).every(C=>c(n[C])))throw new E(`options.source requires faces ${Object.values(Co.FaceName).join(", ")}.`);({width:u,height:f}=n.positiveX);for(let C of Co.faceNames()){let S=n[C];if(Number(S.width)!==u||Number(S.height)!==f)throw new E("Each face in options.source must have the same width and height.")}}let h=u;if(!c(u)||!c(f))throw new E("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(u!==f)throw new E("Width must equal height.");if(h<=0)throw new E("Width and height must be greater than zero.");if(h>ut.maximumCubeMapSize)throw new E(`Width and height must be less than or equal to the maximum cube map size (${ut.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!ke.validate(i))throw new E("Invalid options.pixelFormat.");if(ke.isDepthFormat(i))throw new E("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!Ue.validate(o))throw new E("Invalid options.pixelDatatype.");if(o===Ue.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(o===Ue.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");let p=ke.textureSizeInBytes(i,o,h,h)*6,g=ke.toInternalFormat(i,o,t),m=t._gl,y=m.TEXTURE_CUBE_MAP,b=m.createTexture();this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=y,this._texture=b,this._pixelFormat=i,this._pixelDatatype=o,this._size=h,this._hasMipmap=!1,this._sizeInBytes=p,this._preMultiplyAlpha=l,this._flipY=r;let x=c(n);function A(C){return new Vv(t,b,y,C,g,i,o,h,l,r,x)}this._positiveX=A(m.TEXTURE_CUBE_MAP_POSITIVE_X),this._negativeX=A(m.TEXTURE_CUBE_MAP_NEGATIVE_X),this._positiveY=A(m.TEXTURE_CUBE_MAP_POSITIVE_Y),this._negativeY=A(m.TEXTURE_CUBE_MAP_NEGATIVE_Y),this._positiveZ=A(m.TEXTURE_CUBE_MAP_POSITIVE_Z),this._negativeZ=A(m.TEXTURE_CUBE_MAP_NEGATIVE_Z),this._sampler=a,rne(this,a),m.activeTexture(m.TEXTURE0),m.bindTexture(y,b),s?m.pixelStorei(m.UNPACK_COLORSPACE_CONVERSION_WEBGL,m.NONE):m.pixelStorei(m.UNPACK_COLORSPACE_CONVERSION_WEBGL,m.BROWSER_DEFAULT_WEBGL);for(let C of Co.faceNames())e6(this[C],n?.[C],0);m.bindTexture(y,null)}Co.prototype.copyFace=function(e,t,n,i){let o=e.context,r=new Ur({context:o,colorTextures:[t],destroyAttachments:!1});r._bind(),this[n].copyMipmapFromFramebuffer(0,0,t.width,t.height,i??0),r._unBind(),r.destroy()};Co.FaceName=Object.freeze({POSITIVEX:"positiveX",NEGATIVEX:"negativeX",POSITIVEY:"positiveY",NEGATIVEY:"negativeY",POSITIVEZ:"positiveZ",NEGATIVEZ:"negativeZ"});function*NIe(){yield Co.FaceName.POSITIVEX,yield Co.FaceName.NEGATIVEX,yield Co.FaceName.POSITIVEY,yield Co.FaceName.NEGATIVEY,yield Co.FaceName.POSITIVEZ,yield Co.FaceName.NEGATIVEZ}Co.faceNames=function(){return NIe()};function e6(e,t,n){n=n??0;let i=e._targetFace,o=Math.max(Math.floor(e._size/2**n),1),r=e._pixelFormat,s=e._pixelDatatype,a=e._internalFormat,l=e._flipY,u=e._preMultiplyAlpha,f=e._context,h=f._gl;if(!c(t)){h.texImage2D(i,n,a,o,o,0,r,Ue.toWebGLConstant(s,f),null);return}let{arrayBufferView:p}=t,g=4;c(p)&&(g=ke.alignmentInBytes(r,s,o)),h.pixelStorei(h.UNPACK_ALIGNMENT,g),c(p)?(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1),l&&(p=ke.flipY(p,r,s,o,o)),h.texImage2D(i,n,a,o,o,0,r,Ue.toWebGLConstant(s,f),p)):(h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,l),h.texImage2D(i,n,a,r,Ue.toWebGLConstant(s,f),t))}Co.loadFace=e6;Object.defineProperties(Co.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){rne(this,e),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}});Co.getDirection=function(e,t){switch(e){case Co.FaceName.POSITIVEX:return d.clone(d.UNIT_X,t);case Co.FaceName.NEGATIVEX:return d.negate(d.UNIT_X,t);case Co.FaceName.POSITIVEY:return d.clone(d.UNIT_Y,t);case Co.FaceName.NEGATIVEY:return d.negate(d.UNIT_Y,t);case Co.FaceName.POSITIVEZ:return d.clone(d.UNIT_Z,t);case Co.FaceName.NEGATIVEZ:return d.negate(d.UNIT_Z,t)}};function rne(e,t){let{minificationFilter:n,magnificationFilter:i}=t,o=[Yt.NEAREST_MIPMAP_NEAREST,Yt.NEAREST_MIPMAP_LINEAR,Yt.LINEAR_MIPMAP_NEAREST,Yt.LINEAR_MIPMAP_LINEAR].includes(n),r=e._context,s=e._pixelDatatype;(s===Ue.FLOAT&&!r.textureFloatLinear||s===Ue.HALF_FLOAT&&!r.textureHalfFloatLinear)&&(n=o?Yt.NEAREST_MIPMAP_NEAREST:Yt.NEAREST,i=li.NEAREST);let a=r._gl,l=e._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(l,e._texture),a.texParameteri(l,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(l,a.TEXTURE_MAG_FILTER,i),a.texParameteri(l,a.TEXTURE_WRAP_S,t.wrapS),a.texParameteri(l,a.TEXTURE_WRAP_T,t.wrapT),c(e._textureFilterAnisotropic)&&a.texParameteri(l,e._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.maximumAnisotropy),a.bindTexture(l,null)}Co.prototype.loadMipmaps=function(e,t){if(T.defined("source",e),!Array.isArray(e))throw new E("source must be an array");let n=Math.log2(this._size);if(e.length!==n)throw new E("all mip levels must be defined");t=t??!1;let i=this._context._gl,o=this._texture,r=this._textureTarget;i.activeTexture(i.TEXTURE0),i.bindTexture(r,o),t?i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE):i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL);for(let s=0;s<e.length;s++){let a=e[s],l=s+1;for(let u of Co.faceNames())e6(this[u],a[u],l)}i.bindTexture(r,null),this._hasMipmap=!0};Co.prototype.generateMipmap=function(e){if(e=e??Cf.DONT_CARE,this._size>1&&!O.isPowerOfTwo(this._size))throw new E("width and height must be a power of two to call generateMipmap().");if(!Cf.validate(e))throw new E("hint is invalid.");this._hasMipmap=!0;let t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};Co.createVertexArray=function(e){let t=La.createGeometry(La.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ie.POSITION_ONLY})),n=this._attributeLocations=Nn.createAttributeLocations(t);return ti.fromGeometry({context:e,geometry:t,attributeLocations:n,bufferUsage:Be.STATIC_DRAW})};Co.prototype.isDestroyed=function(){return!1};Co.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=de(this._positiveX),this._negativeX=de(this._negativeX),this._positiveY=de(this._positiveY),this._negativeY=de(this._negativeY),this._positiveZ=de(this._positiveZ),this._negativeZ=de(this._negativeZ),de(this)};var Go=Co;function FIe(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}var lc=FIe;var Hv=`const float czm_degreesPerRadian = 57.29577951308232;
`;var Gv=`const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
`;var jv=`const float czm_epsilon1 = 0.1;
`;var Wv=`const float czm_epsilon2 = 0.01;
`;var qv=`const float czm_epsilon3 = 0.001;
`;var Yv=`const float czm_epsilon4 = 0.0001;
`;var Xv=`const float czm_epsilon5 = 0.00001;
`;var Kv=`const float czm_epsilon6 = 0.000001;
`;var $v=`const float czm_epsilon7 = 0.0000001;
`;var Zv=`const float czm_infinity = 5906376272000.0;
`;var Qv=`const float czm_oneOverPi = 0.3183098861837907;
`;var Jv=`const float czm_oneOverTwoPi = 0.15915494309189535;
`;var eD=`const float czm_passCesium3DTile = 4.0;
`;var tD=`const float czm_passCesium3DTileClassification = 5.0;
`;var nD=`const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
`;var iD=`const float czm_passClassification = 7.0;
`;var oD=`const float czm_passCompute = 1.0;
`;var rD=`const float czm_passEnvironment = 0.0;
`;var sD=`const float czm_passGlobe = 2.0;
`;var aD=`const float czm_passOpaque = 7.0;
`;var cD=`const float czm_passOverlay = 10.0;
`;var lD=`const float czm_passTerrainClassification = 3.0;
`;var uD=`const float czm_passTranslucent = 8.0;
`;var fD=`const float czm_passVoxels = 9.0;
`;var dD=`const float czm_pi = 3.141592653589793;
`;var hD=`const float czm_piOverFour = 0.7853981633974483;
`;var mD=`const float czm_piOverSix = 0.5235987755982988;
`;var pD=`const float czm_piOverThree = 1.0471975511965976;
`;var _D=`const float czm_piOverTwo = 1.5707963267948966;
`;var gD=`const float czm_radiansPerDegree = 0.017453292519943295;
`;var yD=`const float czm_sceneMode2D = 2.0;
`;var bD=`const float czm_sceneMode3D = 3.0;
`;var xD=`const float czm_sceneModeColumbusView = 1.0;
`;var TD=`const float czm_sceneModeMorphing = 0.0;
`;var AD=`const float czm_solarRadius = 695500000.0;
`;var CD=`const float czm_threePiOver2 = 4.71238898038469;
`;var ED=`const float czm_twoPi = 6.283185307179586;
`;var SD=`const float czm_webMercatorMaxLatitude = 1.4844222297453324;
`;var wD=`struct czm_depthRangeStruct
{
float near;
float far;
};
`;var vD=`struct czm_material
{
vec3 diffuse;
float specular;
float shininess;
vec3 normal;
vec3 emission;
float alpha;
};
`;var DD=`struct czm_materialInput
{
float s;
vec2 st;
vec3 str;
vec3 normalEC;
mat3 tangentToEyeMatrix;
vec3 positionToEyeEC;
float height;
float slope;
float aspect;
float waterMask;
};
`;var PD=`struct czm_modelMaterial {
vec4 baseColor;
vec3 diffuse;
float alpha;
vec3 specular;
float roughness;
vec3 normalEC;
float occlusion;
vec3 emissive;
#ifdef USE_SPECULAR
float specularWeight;
#endif
#ifdef USE_ANISOTROPY
vec3 anisotropicT;
vec3 anisotropicB;
float anisotropyStrength;
#endif
#ifdef USE_CLEARCOAT
float clearcoatFactor;
float clearcoatRoughness;
vec3 clearcoatNormal;
#endif
};
`;var ID=`struct czm_modelVertexOutput {
vec3 positionMC;
float pointSize;
};
`;var OD=`struct czm_ray
{
vec3 origin;
vec3 direction;
};
`;var RD=`struct czm_raySegment
{
float start;
float stop;
};
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
`;var MD=`struct czm_shadowParameters
{
#ifdef USE_CUBE_MAP_SHADOW
vec3 texCoords;
#else
vec2 texCoords;
#endif
float depthBias;
float depth;
float nDotL;
vec2 texelStepSize;
float normalShadingSmooth;
float darkness;
};
`;var LD=`vec3 czm_acesTonemapping(vec3 color) {
float g = 0.985;
float a = 0.065;
float b = 0.0001;
float c = 0.433;
float d = 0.238;
color = (color * (color + a) - b) / (color * (g * color + c) + d);
color = clamp(color, 0.0, 1.0);
return color;
}
`;var ND=`float czm_alphaWeight(float a)
{
float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));
}
`;var FD=`vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)
{
float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);
float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);
val1 = val1 * (1.0 - val2);
val1 = val1 * val1 * (3.0 - (2.0 * val1));
val1 = pow(val1, 0.5);
vec4 midColor = (color1 + color2) * 0.5;
return mix(midColor, currentColor, val1);
}
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)
{
return czm_antialias(color1, color2, currentColor, dist, 0.1);
}
`;var BD=`vec3 czm_applyHSBShift(vec3 rgb, vec3 hsbShift, bool ignoreBlackPixels) {
vec3 hsb = czm_RGBToHSB(rgb);
hsb.x += hsbShift.x;
hsb.y = clamp(hsb.y + hsbShift.y, 0.0, 1.0);
if (ignoreBlackPixels) {
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + hsbShift.z : 0.0;
} else {
hsb.z = hsb.z + hsbShift.z;
}
hsb.z = clamp(hsb.z, 0.0, 1.0);
return czm_HSBToRGB(hsb);
}
`;var kD=`vec2 czm_approximateSphericalCoordinates(vec3 normal) {
float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);
float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);
return vec2(latitudeApproximation, longitudeApproximation);
}
`;var UD=`float czm_approximateTanh(float x) {
float x2 = x * x;
return max(-1.0, min(1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));
}
`;var VD=`bool czm_backFacing()
{
return gl_FrontFacing == false;
}
`;var zD=`float czm_branchFreeTernary(bool comparison, float a, float b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {
float useA = float(comparison);
return a * useA + b * (1.0 - useA);
}
`;var HD=`vec4 czm_cascadeColor(vec4 weights)
{
return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +
vec4(0.0, 1.0, 0.0, 1.0) * weights.y +
vec4(0.0, 0.0, 1.0, 1.0) * weights.z +
vec4(1.0, 0.0, 1.0, 1.0) * weights.w;
}
`;var GD=`uniform vec4 shadowMap_cascadeDistances;
float czm_cascadeDistance(vec4 weights)
{
return dot(shadowMap_cascadeDistances, weights);
}
`;var jD=`uniform mat4 shadowMap_cascadeMatrices[4];
mat4 czm_cascadeMatrix(vec4 weights)
{
return shadowMap_cascadeMatrices[0] * weights.x +
shadowMap_cascadeMatrices[1] * weights.y +
shadowMap_cascadeMatrices[2] * weights.z +
shadowMap_cascadeMatrices[3] * weights.w;
}
`;var WD=`uniform vec4 shadowMap_cascadeSplits[2];
vec4 czm_cascadeWeights(float depthEye)
{
vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));
vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);
return near * far;
}
`;var qD=`float getSignedDistance(vec2 uv, highp sampler2D clippingDistance) {
float signedDistance = texture(clippingDistance, uv).r;
return (signedDistance - 0.5) * 2.0;
}
void czm_clipPolygons(highp sampler2D clippingDistance, int extentsLength, vec2 clippingPosition, int regionIndex) {
vec2 rectUv = clippingPosition;
if (regionIndex < 0 || rectUv.x <= 0.0 || rectUv.y <= 0.0 || rectUv.x >= 1.0 || rectUv.y >= 1.0) {
#ifdef CLIPPING_INVERSE
discard;
#endif
return;
}
vec2 clippingDistanceTextureDimensions = vec2(textureSize(clippingDistance, 0));
vec2 sampleOffset = max(1.0 / clippingDistanceTextureDimensions, vec2(0.005));
float dimension = float(extentsLength);
if (extentsLength > 2) {
dimension = ceil(log2(float(extentsLength)));
}
vec2 textureOffset = vec2(mod(float(regionIndex), dimension), floor(float(regionIndex) / dimension)) / dimension;
vec2 uv = textureOffset + rectUv / dimension;
float signedDistance = getSignedDistance(uv, clippingDistance);
#ifdef CLIPPING_INVERSE
if (signedDistance > 0.0)  {
discard;
}
#else
if (signedDistance < 0.0)  {
discard;
}
#endif
}
`;var YD=`vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
{
vec3 p = mix(position2D.xyz, position3D.xyz, time);
return vec4(p, 1.0);
}
`;var XD=`vec4 czm_computeAtmosphereColor(
vec3 positionWC,
vec3 lightDirection,
vec3 rayleighColor,
vec3 mieColor,
float opacity
) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
float cosAngleSq = cosAngle * cosAngle;
float G = czm_atmosphereMieAnisotropy;
float GSq = G * G;
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
vec3 rayleigh = rayleighPhase * rayleighColor;
vec3 mie = miePhase * mieColor;
vec3 color = (rayleigh + mie) * czm_atmosphereLightIntensity;
return vec4(color, opacity);
}
vec4 czm_computeAtmosphereColor(
czm_ray primaryRay,
vec3 lightDirection,
vec3 rayleighColor,
vec3 mieColor,
float opacity
) {
vec3 direction = normalize(primaryRay.direction);
float cosAngle = dot(direction, lightDirection);
float cosAngleSq = cosAngle * cosAngle;
float G = czm_atmosphereMieAnisotropy;
float GSq = G * G;
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
vec3 rayleigh = rayleighPhase * rayleighColor;
vec3 mie = miePhase * mieColor;
vec3 color = (rayleigh + mie) * czm_atmosphereLightIntensity;
return vec4(color, opacity);
}
`;var KD=`void czm_computeGroundAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
float atmosphereInnerRadius = length(positionWC);
czm_computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
}
`;var $D=`vec4 czm_computePosition();
`;var ZD=`void czm_computeScattering(
czm_ray primaryRay,
float primaryRayLength,
vec3 lightDirection,
float atmosphereInnerRadius,
out vec3 rayleighColor,
out vec3 mieColor,
out float opacity
) {
const float ATMOSPHERE_THICKNESS = 111e3;
const int PRIMARY_STEPS_MAX = 16;
const int LIGHT_STEPS_MAX = 4;
rayleighColor = vec3(0.0);
mieColor = vec3(0.0);
opacity = 0.0;
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
vec3 origin = vec3(0.0);
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
return;
}
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
float start_0 = primaryRayAtmosphereIntersect.start;
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
float x_o_a = start_0 - ATMOSPHERE_THICKNESS;
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0);
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0);
float rayPositionLength = primaryRayAtmosphereIntersect.start;
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
vec3 rayleighAccumulation = vec3(0.0);
vec3 mieAccumulation = vec3(0.0);
vec2 opticalDepth = vec2(0.0);
vec2 heightScale = vec2(czm_atmosphereRayleighScaleHeight, czm_atmosphereMieScaleHeight);
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
if (i >= PRIMARY_STEPS) {
break;
}
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
opticalDepth += sampleDensity;
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
float lightPositionLength = 0.0;
vec2 lightOpticalDepth = vec2(0.0);
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
if (j >= LIGHT_STEPS) {
break;
}
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
lightPositionLength += lightStepLength;
}
vec3 attenuation = exp(-((czm_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (czm_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
rayleighAccumulation += sampleDensity.x * attenuation;
mieAccumulation += sampleDensity.y * attenuation;
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
}
rayleighColor = czm_atmosphereRayleighCoefficient * rayleighAccumulation;
mieColor = czm_atmosphereMieCoefficient * mieAccumulation;
opacity = length(exp(-((czm_atmosphereMieCoefficient * opticalDepth.y) + (czm_atmosphereRayleighCoefficient * opticalDepth.x))));
}
`;var QD=`vec2 cordic(float angle)
{
vec2 vector = vec2(6.0725293500888267e-1, 0.0);
float sense = (angle < 0.0) ? -1.0 : 1.0;
mat2 rotation = mat2(1.0, sense, -sense, 1.0);
vector = rotation * vector;
angle -= sense * 7.8539816339744828e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
float factor = sense * 5.0e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.6364760900080609e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.5e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.4497866312686414e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.25e-1;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.2435499454676144e-1;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 6.25e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 6.2418809995957350e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.125e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.1239833430268277e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.5625e-2;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.5623728620476831e-2;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 7.8125e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 7.8123410601011111e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.90625e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.9062301319669718e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.953125e-3;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.9531225164788188e-3;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 9.765625e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 9.7656218955931946e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 4.8828125e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.8828121119489829e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.44140625e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.4414062014936177e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.220703125e-4;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.2207031189367021e-4;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 6.103515625e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 6.1035156174208773e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.0517578125e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.0517578115526096e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.52587890625e-5;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.5258789061315762e-5;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 7.62939453125e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 7.6293945311019700e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 3.814697265625e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 3.8146972656064961e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.9073486328125e-6;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 1.9073486328101870e-6;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 9.5367431640625e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 9.5367431640596084e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 4.76837158203125e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 4.7683715820308884e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 2.384185791015625e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
angle -= sense * 2.3841857910155797e-7;
sense = (angle < 0.0) ? -1.0 : 1.0;
factor = sense * 1.1920928955078125e-7;
rotation[0][1] = factor;
rotation[1][0] = -factor;
vector = rotation * vector;
return vector;
}
vec2 czm_cosineAndSine(float angle)
{
if (angle < -czm_piOverTwo || angle > czm_piOverTwo)
{
if (angle < 0.0)
{
return -cordic(angle + czm_pi);
}
else
{
return -cordic(angle - czm_pi);
}
}
else
{
return cordic(angle);
}
}
`;var JD=`vec2 czm_decompressTextureCoordinates(float encoded)
{
float temp = encoded / 4096.0;
float xZeroTo4095 = floor(temp);
float stx = xZeroTo4095 / 4095.0;
float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;
return vec2(stx, sty);
}
`;var eP=`#if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH)
out float v_WindowZ;
#endif
vec4 czm_depthClamp(vec4 coords)
{
#ifndef LOG_DEPTH
#if __VERSION__ == 300 || defined(GL_EXT_frag_depth)
v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
coords.z = 0.0;
#else
coords.z = min(coords.z, coords.w);
#endif
#endif
return coords;
}
`;var tP=`mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
{
vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));
vec3 tangentEC = normalize(czm_normal3D * tangentMC);
vec3 bitangentEC = normalize(cross(normalEC, tangentEC));
return mat3(
tangentEC.x,   tangentEC.y,   tangentEC.z,
bitangentEC.x, bitangentEC.y, bitangentEC.z,
normalEC.x,    normalEC.y,    normalEC.z);
}
`;var nP=`bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)
{
vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;
return (dot(scaled, scaled) <= 1.0);
}
`;var iP=`vec2 czm_ellipsoidTextureCoordinates(vec3 normal)
{
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
}
`;var oP=`bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec4(epsilon)));
}
bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec3(epsilon)));
}
bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {
return all(lessThanEqual(abs(left - right), vec2(epsilon)));
}
bool czm_equalsEpsilon(float left, float right, float epsilon) {
return (abs(left - right) <= epsilon);
}
`;var rP=`vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
{
vec4 p = positionEC;
vec4 zEyeOffset = normalize(p) * eyeOffset.z;
p.xy += eyeOffset.xy + zEyeOffset.xy;
p.z += zEyeOffset.z;
return p;
}
`;var sP=`vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
{
vec4 q = czm_projection * positionEC;
q.xyz /= q.w;
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;
return q;
}
`;var aP=`float czm_fastApproximateAtan(float x) {
return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
}
float czm_fastApproximateAtan(float x, float y) {
float t = abs(x);
float opposite = abs(y);
float adjacent = max(t, opposite);
opposite = min(t, opposite);
t = czm_fastApproximateAtan(opposite / adjacent);
t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);
t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);
t = czm_branchFreeTernary(y < 0.0, -t, t);
return t;
}
`;var cP=`vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)
{
float scalar = distanceToCamera * czm_fogDensity;
float fog = 1.0 - exp(-(scalar * scalar));
return mix(color, fogColor, fog);
}
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)
{
float scalar = distanceToCamera * czm_fogDensity;
float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));
return mix(color, fogColor, fog);
}
`;var lP=`vec3 czm_gammaCorrect(vec3 color) {
#ifdef HDR
color = pow(color, vec3(czm_gamma));
#endif
return color;
}
vec4 czm_gammaCorrect(vec4 color) {
#ifdef HDR
color.rgb = pow(color.rgb, vec3(czm_gamma));
#endif
return color;
}
`;var uP=`vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
{
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
}
`;var fP=`czm_material czm_getDefaultMaterial(czm_materialInput materialInput)
{
czm_material material;
material.diffuse = vec3(0.0);
material.specular = 0.0;
material.shininess = 1.0;
material.normal = materialInput.normalEC;
material.emission = vec3(0.0);
material.alpha = 1.0;
return material;
}
`;var dP=`vec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) {
const float NONE = 0.0;
const float SCENE_LIGHT = 1.0;
const float SUNLIGHT = 2.0;
vec3 lightDirection =
positionWC * float(lightEnum == NONE) +
czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) +
czm_sunDirectionWC * float(lightEnum == SUNLIGHT);
return normalize(lightDirection);
}
`;var hP=`float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
{
return max(dot(lightDirectionEC, normalEC), 0.0);
}
`;var mP=`float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
{
vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
float specular = max(dot(toReflectedLight, toEyeEC), 0.0);
return pow(specular, max(shininess, czm_epsilon2));
}
`;var pP=`vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)
{
float cosAngle = cos(angleInRadians);
float sinAngle = sin(angleInRadians);
vec2 s0 = vec2(1.0/17.0, 0.0);
vec2 s1 = vec2(-1.0/29.0, 0.0);
vec2 s2 = vec2(1.0/101.0, 1.0/59.0);
vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);
s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));
s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));
s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));
s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));
vec2 uv0 = (uv/103.0) + (time * s0);
vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);
vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);
vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);
uv0 = fract(uv0);
uv1 = fract(uv1);
uv2 = fract(uv2);
uv3 = fract(uv3);
vec4 noise = (texture(normalMap, uv0)) +
(texture(normalMap, uv1)) +
(texture(normalMap, uv2)) +
(texture(normalMap, uv3));
return ((noise / 4.0) - 0.5) * 2.0;
}
`;var _P=`const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 czm_HSBToRGB(vec3 hsb)
{
vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);
return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);
}
`;var gP=`vec3 hueToRGB(float hue)
{
float r = abs(hue * 6.0 - 3.0) - 1.0;
float g = 2.0 - abs(hue * 6.0 - 2.0);
float b = 2.0 - abs(hue * 6.0 - 4.0);
return clamp(vec3(r, g, b), 0.0, 1.0);
}
vec3 czm_HSLToRGB(vec3 hsl)
{
vec3 rgb = hueToRGB(hsl.x);
float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
return (rgb - 0.5) * c + hsl.z;
}
`;var yP=`vec3 czm_hue(vec3 rgb, float adjustment)
{
const mat3 toYIQ = mat3(0.299,     0.587,     0.114,
0.595716, -0.274453, -0.321263,
0.211456, -0.522591,  0.311135);
const mat3 toRGB = mat3(1.0,  0.9563,  0.6210,
1.0, -0.2721, -0.6474,
1.0, -1.107,   1.7046);
vec3 yiq = toYIQ * rgb;
float hue = atan(yiq.z, yiq.y) + adjustment;
float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);
vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));
return toRGB * color;
}
`;var bP=`vec3 czm_inverseGamma(vec3 color) {
return pow(color, vec3(1.0 / czm_gamma));
}
`;var xP=`bool czm_isEmpty(czm_raySegment interval)
{
return (interval.stop < 0.0);
}
`;var TP=`bool czm_isFull(czm_raySegment interval)
{
return (interval.start == 0.0 && interval.stop == czm_infinity);
}
`;var AP=`float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)
{
float sinLatitude = sin(latitude);
float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));
return (mercatorY - southMercatorY) * oneOverMercatorHeight;
}
`;var CP=`vec3 czm_linearToSrgb(vec3 linearIn)
{
return pow(linearIn, vec3(1.0/2.2));
}
vec4 czm_linearToSrgb(vec4 linearIn)
{
vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
return vec4(srgbOut, linearIn.a);
}
`;var EP=`float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {
return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);
}
`;var SP=`float czm_luminance(vec3 rgb)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
return dot(rgb, W);
}
`;var wP=`float czm_maximumComponent(vec2 v)
{
return max(v.x, v.y);
}
float czm_maximumComponent(vec3 v)
{
return max(max(v.x, v.y), v.z);
}
float czm_maximumComponent(vec4 v)
{
return max(max(max(v.x, v.y), v.z), v.w);
}
`;var vP=`float czm_metersPerPixel(vec4 positionEC, float pixelRatio)
{
float width = czm_viewport.z;
float height = czm_viewport.w;
float pixelWidth;
float pixelHeight;
float top = czm_frustumPlanes.x;
float bottom = czm_frustumPlanes.y;
float left = czm_frustumPlanes.z;
float right = czm_frustumPlanes.w;
if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)
{
float frustumWidth = right - left;
float frustumHeight = top - bottom;
pixelWidth = frustumWidth / width;
pixelHeight = frustumHeight / height;
}
else
{
float distanceToPixel = -positionEC.z;
float inverseNear = 1.0 / czm_currentFrustum.x;
float tanTheta = top * inverseNear;
pixelHeight = 2.0 * distanceToPixel * tanTheta / height;
tanTheta = right * inverseNear;
pixelWidth = 2.0 * distanceToPixel * tanTheta / width;
}
return max(pixelWidth, pixelHeight) * pixelRatio;
}
float czm_metersPerPixel(vec4 positionEC)
{
return czm_metersPerPixel(positionEC, czm_pixelRatio);
}
`;var DP=`vec4 czm_modelToWindowCoordinates(vec4 position)
{
vec4 q = czm_modelViewProjection * position;
q.xyz /= q.w;
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz;
return q;
}
`;var PP=`vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 target = left * right;
float leftLuminance = dot(left, W);
float rightLuminance = dot(right, W);
float targetLuminance = dot(target, W);
return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;
}
`;var IP=`float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)
{
float valueAtMin = nearFarScalar.y;
float valueAtMax = nearFarScalar.w;
float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;
float farDistanceSq = nearFarScalar.z * nearFarScalar.z;
float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);
t = pow(clamp(t, 0.0, 1.0), 0.2);
return mix(valueAtMin, valueAtMax, t);
}
`;var OP=`vec3 czm_octDecode(vec2 encoded, float range)
{
if (encoded.x == 0.0 && encoded.y == 0.0) {
return vec3(0.0, 0.0, 0.0);
}
encoded = encoded / range * 2.0 - 1.0;
vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));
if (v.z < 0.0)
{
v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);
}
return normalize(v);
}
vec3 czm_octDecode(vec2 encoded)
{
return czm_octDecode(encoded, 255.0);
}
vec3 czm_octDecode(float encoded)
{
float temp = encoded / 256.0;
float x = floor(temp);
float y = (temp - x) * 256.0;
return czm_octDecode(vec2(x, y));
}
void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)
{
float temp = encoded.x / 65536.0;
float x = floor(temp);
float encodedFloat1 = (temp - x) * 65536.0;
temp = encoded.y / 65536.0;
float y = floor(temp);
float encodedFloat2 = (temp - y) * 65536.0;
vector1 = czm_octDecode(encodedFloat1);
vector2 = czm_octDecode(encodedFloat2);
vector3 = czm_octDecode(vec2(x, y));
}
`;var RP=`vec4 czm_packDepth(float depth)
{
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
return enc;
}
`;var MP=`vec3 lambertianDiffuse(vec3 diffuseColor)
{
return diffuseColor / czm_pi;
}
vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
{
float versine = 1.0 - VdotH;
float versineSquared = versine * versine;
return f0 + (f90 - f0) * versineSquared * versineSquared * versine;
}
#ifdef USE_ANISOTROPY
float smithVisibilityGGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)
{
vec3 roughnessScale = vec3(tangentialRoughness, bitangentRoughness, 1.0);
float GGXV = lightDirection.z * length(roughnessScale * viewDirection);
float GGXL = viewDirection.z * length(roughnessScale * lightDirection);
float v = 0.5 / (GGXV + GGXL);
return clamp(v, 0.0, 1.0);
}
float GGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 halfwayDirection)
{
float roughnessSquared = bitangentRoughness * tangentialRoughness;
vec3 f = halfwayDirection * vec3(bitangentRoughness, tangentialRoughness, roughnessSquared);
float w2 = roughnessSquared / dot(f, f);
return roughnessSquared * w2 * w2 / czm_pi;
}
#endif
float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
{
float alphaRoughnessSq = alphaRoughness * alphaRoughness;
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0)
{
return 0.5 / GGX;
}
return 0.0;
}
float GGX(float alphaRoughness, float NdotH)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float f = (NdotH * alphaRoughnessSquared - NdotH) * NdotH + 1.0;
return alphaRoughnessSquared / (czm_pi * f * f);
}
float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float alphaRoughness)
{
float NdotL = clamp(dot(normal, lightDirection), 0.0, 1.0);
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);
float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
float NdotH = clamp(dot(normal, halfwayDirection), 0.0, 1.0);
float D = GGX(alphaRoughness, NdotH);
return G * D;
}
vec3 czm_pbrLighting(vec3 viewDirectionEC, vec3 normalEC, vec3 lightDirectionEC, czm_modelMaterial material)
{
vec3 halfwayDirectionEC = normalize(viewDirectionEC + lightDirectionEC);
float VdotH = clamp(dot(viewDirectionEC, halfwayDirectionEC), 0.0, 1.0);
float NdotL = clamp(dot(normalEC, lightDirectionEC), 0.001, 1.0);
vec3 f0 = material.specular;
float reflectance = czm_maximumComponent(f0);
vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
vec3 F = fresnelSchlick2(f0, f90, VdotH);
#if defined(USE_SPECULAR)
F *= material.specularWeight;
#endif
float alphaRoughness = material.roughness * material.roughness;
#ifdef USE_ANISOTROPY
mat3 tbn = mat3(material.anisotropicT, material.anisotropicB, normalEC);
vec3 lightDirection = lightDirectionEC * tbn;
vec3 viewDirection = viewDirectionEC * tbn;
vec3 halfwayDirection = halfwayDirectionEC * tbn;
float anisotropyStrength = material.anisotropyStrength;
float tangentialRoughness = mix(alphaRoughness, 1.0, anisotropyStrength * anisotropyStrength);
float bitangentRoughness = clamp(alphaRoughness, 0.001, 1.0);
float G = smithVisibilityGGX_anisotropic(bitangentRoughness, tangentialRoughness, lightDirection, viewDirection);
float D = GGX_anisotropic(bitangentRoughness, tangentialRoughness, halfwayDirection);
vec3 specularContribution = F * G * D;
#else
float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alphaRoughness);
vec3 specularContribution = F * specularStrength;
#endif
vec3 diffuseColor = material.diffuse;
vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
return (diffuseContribution + specularContribution) * NdotL;
}
`;var LP=`vec3 czm_pbrNeutralTonemapping(vec3 color) {
const float startCompression = 0.8 - 0.04;
const float desaturation = 0.15;
float x = min(color.r, min(color.g, color.b));
float offset = czm_branchFreeTernary(x < 0.08, x - 6.25 * x * x, 0.04);
color -= offset;
float peak = max(color.r, max(color.g, color.b));
if (peak < startCompression) return color;
const float d = 1.0 - startCompression;
float newPeak = 1.0 - d * d / (peak + d - startCompression);
color *= newPeak / peak;
float g = 1.0 - 1.0 / (desaturation * (peak - newPeak) + 1.0);
return mix(color, newPeak * vec3(1.0, 1.0, 1.0), g);
}
`;var NP=`float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)
{
return czm_getLambertDiffuse(lightDirectionEC, material.normal);
}
float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)
{
return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);
}
vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);
if (czm_sceneMode == czm_sceneMode3D) {
diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);
}
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
vec3 materialDiffuse = material.diffuse * 0.5;
vec3 ambient = materialDiffuse;
vec3 color = ambient + material.emission;
color += materialDiffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
vec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
vec3 ambient = vec3(0.0);
vec3 color = ambient + material.emission;
color += material.diffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
`;var FP=`float czm_planeDistance(vec4 plane, vec3 point) {
return (dot(plane.xyz, point) + plane.w);
}
float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
return (dot(planeNormal, point) + planeDistance);
}
`;var BP=`vec3 czm_pointAlongRay(czm_ray ray, float time)
{
return ray.origin + (time * ray.direction);
}
`;var kP=`czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)
{
vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;
vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;
q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;
float q2 = dot(q, q);
float qw = dot(q, w);
if (q2 > 1.0)
{
if (qw >= 0.0)
{
return czm_emptyRaySegment;
}
else
{
float qw2 = qw * qw;
float difference = q2 - 1.0;
float w2 = dot(w, w);
float product = w2 * difference;
if (qw2 < product)
{
return czm_emptyRaySegment;
}
else if (qw2 > product)
{
float discriminant = qw * qw - product;
float temp = -qw + sqrt(discriminant);
float root0 = temp / w2;
float root1 = difference / temp;
if (root0 < root1)
{
czm_raySegment i = czm_raySegment(root0, root1);
return i;
}
else
{
czm_raySegment i = czm_raySegment(root1, root0);
return i;
}
}
else
{
float root = sqrt(difference / w2);
czm_raySegment i = czm_raySegment(root, root);
return i;
}
}
}
else if (q2 < 1.0)
{
float difference = q2 - 1.0;
float w2 = dot(w, w);
float product = w2 * difference;
float discriminant = qw * qw - product;
float temp = -qw + sqrt(discriminant);
czm_raySegment i = czm_raySegment(0.0, temp / w2);
return i;
}
else
{
if (qw < 0.0)
{
float w2 = dot(w, w);
czm_raySegment i = czm_raySegment(0.0, -qw / w2);
return i;
}
else
{
return czm_emptyRaySegment;
}
}
}
`;var UP=`czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)
{
vec3 o = ray.origin;
vec3 d = ray.direction;
vec3 oc = o - center;
float a = dot(d, d);
float b = 2.0 * dot(d, oc);
float c = dot(oc, oc) - (radius * radius);
float det = (b * b) - (4.0 * a * c);
if (det < 0.0) {
return czm_emptyRaySegment;
}
float sqrtDet = sqrt(det);
float t0 = (-b - sqrtDet) / (2.0 * a);
float t1 = (-b + sqrtDet) / (2.0 * a);
czm_raySegment result = czm_raySegment(t0, t1);
return result;
}
`;var VP=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
return czm_reverseLogDepth(texture(depthTexture, texCoords).r);
}
`;var zP=`float czm_readNonPerspective(float value, float oneOverW) {
return value * oneOverW;
}
vec2 czm_readNonPerspective(vec2 value, float oneOverW) {
return value * oneOverW;
}
vec3 czm_readNonPerspective(vec3 value, float oneOverW) {
return value * oneOverW;
}
vec4 czm_readNonPerspective(vec4 value, float oneOverW) {
return value * oneOverW;
}
`;var HP=`float czm_reverseLogDepth(float logZ)
{
#ifdef LOG_DEPTH
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = exp2(log2Depth) - 1.0;
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
#endif
return logZ;
}
`;var GP=`const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec3 czm_RGBToHSB(vec3 rgb)
{
vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));
vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
float d = q.x - min(q.w, q.y);
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);
}
`;var jP=`vec3 RGBtoHCV(vec3 rgb)
{
vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);
vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);
float c = q.x - min(q.w, q.y);
float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);
return vec3(h, c, q.x);
}
vec3 czm_RGBToHSL(vec3 rgb)
{
vec3 hcv = RGBtoHCV(rgb);
float l = hcv.z - hcv.y * 0.5;
float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);
return vec3(hcv.x, s, l);
}
`;var WP=`vec3 czm_RGBToXYZ(vec3 rgb)
{
const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,
0.3576, 0.7152, 0.1192,
0.1805, 0.0722, 0.9505);
vec3 xyz = RGB2XYZ * rgb;
vec3 Yxy;
Yxy.r = xyz.g;
float temp = dot(vec3(1.0), xyz);
Yxy.gb = xyz.rg / temp;
return Yxy;
}
`;var qP=`float czm_round(float value) {
return floor(value + 0.5);
}
vec2 czm_round(vec2 value) {
return floor(value + 0.5);
}
vec3 czm_round(vec3 value) {
return floor(value + 0.5);
}
vec4 czm_round(vec4 value) {
return floor(value + 0.5);
}
`;var YP=`vec3 czm_saturation(vec3 rgb, float adjustment)
{
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 intensity = vec3(dot(rgb, W));
return mix(intensity, rgb, adjustment);
}
`;var XP=`float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
{
return czm_unpackDepth(czm_textureCube(shadowMap, d));
}
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
{
#ifdef USE_SHADOW_DEPTH_TEXTURE
return texture(shadowMap, uv).r;
#else
return czm_unpackDepth(texture(shadowMap, uv));
#endif
}
float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)
{
return step(depth, czm_sampleShadowMap(shadowMap, uv));
}
float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)
{
return step(depth, czm_sampleShadowMap(shadowMap, uv));
}
`;var KP=`float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)
{
#ifdef USE_NORMAL_SHADING
#ifdef USE_NORMAL_SHADING_SMOOTH
float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);
#else
float strength = step(0.0, nDotL);
#endif
visibility *= strength;
#endif
visibility = max(visibility, darkness);
return visibility;
}
#ifdef USE_CUBE_MAP_SHADOW
float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)
{
float depthBias = shadowParameters.depthBias;
float depth = shadowParameters.depth;
float nDotL = shadowParameters.nDotL;
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
float darkness = shadowParameters.darkness;
vec3 uvw = shadowParameters.texCoords;
depth -= depthBias;
float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
}
#else
float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)
{
float depthBias = shadowParameters.depthBias;
float depth = shadowParameters.depth;
float nDotL = shadowParameters.nDotL;
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
float darkness = shadowParameters.darkness;
vec2 uv = shadowParameters.texCoords;
depth -= depthBias;
#ifdef USE_SOFT_SHADOWS
vec2 texelStepSize = shadowParameters.texelStepSize;
float radius = 1.0;
float dx0 = -texelStepSize.x * radius;
float dy0 = -texelStepSize.y * radius;
float dx1 = texelStepSize.x * radius;
float dy1 = texelStepSize.y * radius;
float visibility = (
czm_shadowDepthCompare(shadowMap, uv, depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)
) * (1.0 / 9.0);
#else
float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);
#endif
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
}
#endif
`;var $P=`float czm_signNotZero(float value)
{
return value >= 0.0 ? 1.0 : -1.0;
}
vec2 czm_signNotZero(vec2 value)
{
return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));
}
vec3 czm_signNotZero(vec3 value)
{
return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));
}
vec4 czm_signNotZero(vec4 value)
{
return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));
}
`;var ZP=`vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])
{
vec3 L00 = coefficients[0];
vec3 L1_1 = coefficients[1];
vec3 L10 = coefficients[2];
vec3 L11 = coefficients[3];
vec3 L2_2 = coefficients[4];
vec3 L2_1 = coefficients[5];
vec3 L20 = coefficients[6];
vec3 L21 = coefficients[7];
vec3 L22 = coefficients[8];
float x = normal.x;
float y = normal.y;
float z = normal.z;
vec3 L =
L00
+ L1_1 * y
+ L10 * z
+ L11 * x
+ L2_2 * (y * x)
+ L2_1 * (y * z)
+ L20 * (3.0 * z * z - 1.0)
+ L21 * (z * x)
+ L22 * (x * x - y * y);
return max(L, vec3(0.0));
}
`;var QP=`vec3 czm_srgbToLinear(vec3 srgbIn)
{
return pow(srgbIn, vec3(2.2));
}
vec4 czm_srgbToLinear(vec4 srgbIn)
{
vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));
return vec4(linearOut, srgbIn.a);
}
`;var JP=`mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
{
vec3 normal = normalize(normalEC);
vec3 tangent = normalize(tangentEC);
vec3 bitangent = normalize(bitangentEC);
return mat3(tangent.x  , tangent.y  , tangent.z,
bitangent.x, bitangent.y, bitangent.z,
normal.x   , normal.y   , normal.z);
}
`;var eI=`vec4 czm_textureCube(samplerCube sampler, vec3 p) {
#if __VERSION__ == 300
return texture(sampler, p);
#else
return textureCube(sampler, p);
#endif
}
vec4 czm_textureCube(samplerCube sampler, vec3 p, float lod) {
#if __VERSION__ == 300
return textureLod(sampler, p, lod);
#elif defined(GL_EXT_shader_texture_lod)
return textureCubeLodEXT(sampler, p, lod);
#endif
}
`;var tI=`vec4 czm_transformPlane(vec4 plane, mat4 transform) {
vec4 transformedPlane = transform * plane;
float normalMagnitude = length(transformedPlane.xyz);
return transformedPlane / normalMagnitude;
}
`;var nI=`vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
{
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
if (length(highDifference) == 0.0) {
highDifference = vec3(0);
}
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
return vec4(highDifference + lowDifference, 1.0);
}
`;var iI=`vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);
if (czm_sceneMode == czm_sceneMode3D) {
diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);
}
diffuse = clamp(diffuse, 0.0, 1.0);
float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);
vec3 materialDiffuse = material.diffuse * 0.5;
vec3 ambient = materialDiffuse;
vec3 color = ambient + material.emission;
color += materialDiffuse * diffuse * czm_lightColor;
color += material.specular * specular * czm_lightColor;
return vec4(color, material.alpha);
}
`;var oI=`mat2 czm_transpose(mat2 matrix)
{
return mat2(
matrix[0][0], matrix[1][0],
matrix[0][1], matrix[1][1]);
}
mat3 czm_transpose(mat3 matrix)
{
return mat3(
matrix[0][0], matrix[1][0], matrix[2][0],
matrix[0][1], matrix[1][1], matrix[2][1],
matrix[0][2], matrix[1][2], matrix[2][2]);
}
mat4 czm_transpose(mat4 matrix)
{
return mat4(
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);
}
`;var rI=`vec2 getLookupUv(vec2 dimensions, int i) {
int pixY = i / int(dimensions.x);
int pixX = i - (pixY * int(dimensions.x));
float pixelWidth = 1.0 / dimensions.x;
float pixelHeight = 1.0 / dimensions.y;
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
return vec2(u, v);
}
vec4 czm_unpackClippingExtents(highp sampler2D extentsTexture, int index) {
vec2 textureDimensions = vec2(textureSize(extentsTexture, 0));
return texture(extentsTexture, getLookupUv(textureDimensions, index));
}
`;var sI=`float czm_unpackDepth(vec4 packedDepth)
{
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
}
`;var aI=`float czm_unpackFloat(vec4 packedFloat)
{
packedFloat = floor(packedFloat * 255.0 + 0.5);
float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;
float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;
if (exponent == -127.0)
{
return 0.0;
}
float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);
float result = sign * exp2(exponent - 23.0) * mantissa;
return result;
}
`;var cI=`int czm_unpackUint(float packedValue) {
float rounded = czm_round(packedValue * 255.0);
return int(rounded);
}
int czm_unpackUint(vec2 packedValue) {
vec2 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec2(1.0, 256.0)));
}
int czm_unpackUint(vec3 packedValue) {
vec3 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));
}
int czm_unpackUint(vec4 packedValue) {
vec4 rounded = czm_round(packedValue * 255.0);
return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));
}
`;var lI=`float czm_valueTransform(float offset, float scale, float value) {
return scale * value + offset;
}
vec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {
return scale * value + offset;
}
vec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {
return scale * value + offset;
}
vec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {
return scale * value + offset;
}
mat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {
return matrixCompMult(scale, value) + offset;
}
mat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {
return matrixCompMult(scale, value) + offset;
}
mat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {
return matrixCompMult(scale, value) + offset;
}
`;var uI=`#ifdef LOG_DEPTH
out float v_depthFromNearPlusOne;
#ifdef SHADOW_MAP
out vec3 v_logPositionEC;
#endif
#endif
vec4 czm_updatePositionDepth(vec4 coords) {
#if defined(LOG_DEPTH)
#ifdef SHADOW_MAP
vec3 logPositionEC = (czm_inverseProjection * coords).xyz;
v_logPositionEC = logPositionEC;
#endif
coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;
#endif
return coords;
}
void czm_vertexLogDepth()
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
gl_Position = czm_updatePositionDepth(gl_Position);
#endif
}
void czm_vertexLogDepth(vec4 clipCoords)
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
czm_updatePositionDepth(clipCoords);
#endif
}
`;var fI=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
{
float x = 2.0 * screenCoordinate.x - 1.0;
float y = 2.0 * screenCoordinate.y - 1.0;
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
vec4 q = vec4(x, y, z, 1.0);
q /= screenCoordinate.w;
if (!(czm_inverseProjection == mat4(0.0)))
{
q = czm_inverseProjection * q;
}
else
{
float top = czm_frustumPlanes.x;
float bottom = czm_frustumPlanes.y;
float left = czm_frustumPlanes.z;
float right = czm_frustumPlanes.w;
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
q.x = (q.x * (right - left) + left + right) * 0.5;
q.y = (q.y * (top - bottom) + bottom + top) * 0.5;
q.z = (q.z * (near - far) - near - far) * 0.5;
q.w = 1.0;
}
return q;
}
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
{
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));
}
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)
{
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)
float near = czm_currentFrustum.x;
float far = czm_currentFrustum.y;
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
float depthFromNear = exp2(log2Depth) - 1.0;
float depthFromCamera = depthFromNear + near;
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
eyeCoordinate.w = 1.0 / depthFromCamera;
return eyeCoordinate;
#else
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
#endif
return eyeCoordinate;
}
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
{
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
}
`;var dI=`#if !defined(LOG_DEPTH)
in float v_WindowZ;
#endif
void czm_writeDepthClamp()
{
#if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
#endif
}
`;var hI=`#ifdef LOG_DEPTH
in float v_depthFromNearPlusOne;
#ifdef POLYGON_OFFSET
uniform vec2 u_polygonOffset;
#endif
#endif
void czm_writeLogDepth(float depth)
{
#if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
discard;
}
#ifdef POLYGON_OFFSET
float factor = u_polygonOffset[0];
float units = u_polygonOffset[1];
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
if (factor != 0.0) {
float x = dFdx(depth);
float y = dFdy(depth);
float m = sqrt(x * x + y * y);
depth += m * factor;
}
#endif
#endif
gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
#ifdef POLYGON_OFFSET
gl_FragDepth += czm_epsilon7 * units;
#endif
#endif
}
void czm_writeLogDepth() {
#ifdef LOG_DEPTH
czm_writeLogDepth(v_depthFromNearPlusOne);
#endif
}
`;var mI=`float czm_writeNonPerspective(float value, float w) {
return value * w;
}
vec2 czm_writeNonPerspective(vec2 value, float w) {
return value * w;
}
vec3 czm_writeNonPerspective(vec3 value, float w) {
return value * w;
}
vec4 czm_writeNonPerspective(vec4 value, float w) {
return value * w;
}
`;var pI=`vec3 czm_XYZToRGB(vec3 Yxy)
{
const mat3 XYZ2RGB = mat3( 3.2405, -0.9693,  0.0556,
-1.5371,  1.8760, -0.2040,
-0.4985,  0.0416,  1.0572);
vec3 xyz;
xyz.r = Yxy.r * Yxy.g / Yxy.b;
xyz.g = Yxy.r;
xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;
return XYZ2RGB * xyz;
}
`;var Cb={czm_degreesPerRadian:Hv,czm_depthRange:Gv,czm_epsilon1:jv,czm_epsilon2:Wv,czm_epsilon3:qv,czm_epsilon4:Yv,czm_epsilon5:Xv,czm_epsilon6:Kv,czm_epsilon7:$v,czm_infinity:Zv,czm_oneOverPi:Qv,czm_oneOverTwoPi:Jv,czm_passCesium3DTile:eD,czm_passCesium3DTileClassification:tD,czm_passCesium3DTileClassificationIgnoreShow:nD,czm_passClassification:iD,czm_passCompute:oD,czm_passEnvironment:rD,czm_passGlobe:sD,czm_passOpaque:aD,czm_passOverlay:cD,czm_passTerrainClassification:lD,czm_passTranslucent:uD,czm_passVoxels:fD,czm_pi:dD,czm_piOverFour:hD,czm_piOverSix:mD,czm_piOverThree:pD,czm_piOverTwo:_D,czm_radiansPerDegree:gD,czm_sceneMode2D:yD,czm_sceneMode3D:bD,czm_sceneModeColumbusView:xD,czm_sceneModeMorphing:TD,czm_solarRadius:AD,czm_threePiOver2:CD,czm_twoPi:ED,czm_webMercatorMaxLatitude:SD,czm_depthRangeStruct:wD,czm_material:vD,czm_materialInput:DD,czm_modelMaterial:PD,czm_modelVertexOutput:ID,czm_ray:OD,czm_raySegment:RD,czm_shadowParameters:MD,czm_acesTonemapping:LD,czm_alphaWeight:ND,czm_antialias:FD,czm_applyHSBShift:BD,czm_approximateSphericalCoordinates:kD,czm_approximateTanh:UD,czm_backFacing:VD,czm_branchFreeTernary:zD,czm_cascadeColor:HD,czm_cascadeDistance:GD,czm_cascadeMatrix:jD,czm_cascadeWeights:WD,czm_clipPolygons:qD,czm_columbusViewMorph:YD,czm_computeAtmosphereColor:XD,czm_computeGroundAtmosphereScattering:KD,czm_computePosition:$D,czm_computeScattering:ZD,czm_cosineAndSine:QD,czm_decompressTextureCoordinates:JD,czm_depthClamp:eP,czm_eastNorthUpToEyeCoordinates:tP,czm_ellipsoidContainsPoint:nP,czm_ellipsoidTextureCoordinates:iP,czm_equalsEpsilon:oP,czm_eyeOffset:rP,czm_eyeToWindowCoordinates:sP,czm_fastApproximateAtan:aP,czm_fog:cP,czm_gammaCorrect:lP,czm_geodeticSurfaceNormal:uP,czm_getDefaultMaterial:fP,czm_getDynamicAtmosphereLightDirection:dP,czm_getLambertDiffuse:hP,czm_getSpecular:mP,czm_getWaterNoise:pP,czm_HSBToRGB:_P,czm_HSLToRGB:gP,czm_hue:yP,czm_inverseGamma:bP,czm_isEmpty:xP,czm_isFull:TP,czm_latitudeToWebMercatorFraction:AP,czm_linearToSrgb:CP,czm_lineDistance:EP,czm_luminance:SP,czm_maximumComponent:wP,czm_metersPerPixel:vP,czm_modelToWindowCoordinates:DP,czm_multiplyWithColorBalance:PP,czm_nearFarScalar:IP,czm_octDecode:OP,czm_packDepth:RP,czm_pbrLighting:MP,czm_pbrNeutralTonemapping:LP,czm_phong:NP,czm_planeDistance:FP,czm_pointAlongRay:BP,czm_rayEllipsoidIntersectionInterval:kP,czm_raySphereIntersectionInterval:UP,czm_readDepth:VP,czm_readNonPerspective:zP,czm_reverseLogDepth:HP,czm_RGBToHSB:GP,czm_RGBToHSL:jP,czm_RGBToXYZ:WP,czm_round:qP,czm_saturation:YP,czm_shadowDepthCompare:XP,czm_shadowVisibility:KP,czm_signNotZero:$P,czm_sphericalHarmonics:ZP,czm_srgbToLinear:QP,czm_tangentToEyeSpaceMatrix:JP,czm_textureCube:eI,czm_transformPlane:tI,czm_translateRelativeToEye:nI,czm_translucentPhong:iI,czm_transpose:oI,czm_unpackClippingExtents:rI,czm_unpackDepth:sI,czm_unpackFloat:aI,czm_unpackUint:cI,czm_valueTransform:lI,czm_vertexLogDepth:uI,czm_windowToEyeCoordinates:fI,czm_writeDepthClamp:dI,czm_writeLogDepth:hI,czm_writeNonPerspective:mI,czm_XYZToRGB:pI};function BIe(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/\n\s*(in)\s+(vec\d|mat\d|float)/g,`
varying $2`),/out_FragData_(\d+)/.test(n)&&(n=`#extension GL_EXT_draw_buffers : enable
${n}`,n=n.replaceAll(/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,""),n=n.replaceAll(/out_FragData_(\d+)/g,"gl_FragData[$1]")),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,""),n=n.replaceAll(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable
${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT")),n=`#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#endif
${n}`,n=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
${n}`):(n=n.replaceAll(/(in)\s+(vec\d|mat\d|float)/g,"attribute $2"),n=n.replaceAll(/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,"varying $2 $3;")),n=`#version 100
${n}`,n}var _I=BIe;function sne(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){let n=t.match(/\n/gm).length,i="";for(let o=0;o<n;++o)i+=`
`;return i})}function ane(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return c(i)||(t=sne(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function cne(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);c(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&Hs._czmBuiltinsAndUniforms.hasOwnProperty(i)){let o=ane(i,Hs._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),cne(o,t)}}))}function kIe(e){let t=[],n=[];for(;e.length>0;){let o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){let o=t.shift();e.push(o);for(let r=0;r<o.dependsOn.length;++r){let s=o.dependsOn[r],a=s.requiredBy.indexOf(o);s.requiredBy.splice(a,1),s.requiredBy.length===0&&t.push(s)}}let i=[];for(let o=0;o<n.length;++o)n[o].requiredBy.length!==0&&i.push(n[o]);if(i.length!==0){let o=`A circular dependency was found in the following built-in functions/structs/constants: 
`;for(let r=0;r<i.length;++r)o=`${o+i[r].name}
`;throw new E(o)}}function UIe(e){let t=[],n=ane("main",e,t);cne(n,t),kIe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function lne(e,t,n){let i,o,r="",s=e.sources;if(c(s))for(i=0,o=s.length;i<o;++i)r+=`
#line 0
${s[i]}`;r=sne(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(y,b){if(c(a)&&a!==b)throw new E(`inconsistent versions found: ${a} and ${b}`);return a=b,`
`});let l=[];r=r.replace(/#extension.*\n/gm,function(y){return l.push(y),`
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");let u=e.pickColorQualifier;c(u)&&(r=Hs.createPickFragmentShaderSource(r,u));let f="",h=l.length;for(i=0;i<h;i++)f+=l[i];t&&(f+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
    precision highp float;
    precision highp int;
#else
    precision mediump float;
    precision mediump int;
    #define highp mediump
#endif

`);let p=e.defines;if(c(p))for(i=0,o=p.length;i<o;++i){let y=p[i];y.length!==0&&(f+=`#define ${y}
`)}n.textureFloatLinear&&(f+=`#define OES_texture_float_linear

`),n.floatingPointTexture&&(f+=`#define OES_texture_float

`);let g="";e.includeBuiltIns&&(g=UIe(r)),f+=`
#line 0
`;let m=g+r;return n.webgl2&&t&&!/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g.test(m)&&!/czm_out_FragColor/g.test(m)&&/out_FragColor/g.test(m)&&(f+=`layout(location = 0) out vec4 out_FragColor;

`),f+=g,f+=r,n.webgl2?f=`#version 300 es
${f}`:f=_I(f,t),f}function Hs(e){e=e??W.EMPTY_OBJECT;let t=e.pickColorQualifier;if(c(t)&&t!=="uniform"&&t!=="in")throw new E("options.pickColorQualifier must be 'uniform' or 'in'.");this.defines=c(e.defines)?e.defines.slice(0):[],this.sources=c(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=e.includeBuiltIns??!0}Hs.prototype.clone=function(){return new Hs({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};Hs.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};Hs.prototype.getCacheKey=function(){let t=this.defines.slice().sort().join(","),n=this.pickColorQualifier,i=this.includeBuiltIns,o=this.sources.join(`
`);return`${t}:${n}:${i}:${o}`};Hs.prototype.createCombinedVertexShader=function(e){return lne(this,!1,e)};Hs.prototype.createCombinedFragmentShader=function(e){return lne(this,!0,e)};Hs._czmBuiltinsAndUniforms={};for(let e in Cb)Cb.hasOwnProperty(e)&&(Hs._czmBuiltinsAndUniforms[e]=Cb[e]);for(let e in Ap)if(Ap.hasOwnProperty(e)){let t=Ap[e];typeof t.getDeclaration=="function"&&(Hs._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}Hs.createPickVertexShaderSource=function(e){return`${Hs.replaceMain(e,"czm_old_main")}
in vec4 pickColor; 
out vec4 czm_pickColor; 
void main() 
{ 
    czm_old_main(); 
    czm_pickColor = pickColor; 
}`};Hs.createPickFragmentShaderSource=function(e,t){let n=Hs.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor; 
void main() 
{ 
    czm_old_main(); 
    if (out_FragColor.a == 0.0) { 
       discard; 
    } 
    out_FragColor = czm_pickColor; 
}`;return`${n}
${i}`};function VIe(e,t){let n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}function une(e,t){let n=e.sources,i=n.length;for(let o=0;o<i;++o)if(n[o].indexOf(t)!==-1)return!0;return!1}function fne(e,t){let n=t.length;for(let i=0;i<n;++i){let o=t[i];if(une(e,o))return o}}var zIe=["v_normalEC","v_normal"];Hs.findNormalVarying=function(e){return une(e,"#ifdef HAS_NORMALS")?VIe(e,"HAS_NORMALS")?"v_normalEC":void 0:fne(e,zIe)};var HIe=["v_positionEC"];Hs.findPositionVarying=function(e){return fne(e,HIe)};var He=Hs;function Fd(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(Fd.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});Fd.prototype.replaceShaderProgram=function(e){return c(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function GIe(e){let t=Object.keys(e).sort();return JSON.stringify(e,t)}Fd.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource,i=e.attributeLocations;typeof t=="string"&&(t=new He({sources:[t]})),typeof n=="string"&&(n=new He({sources:[n]}));let o=t.getCacheKey(),r=n.getCacheKey(),s=c(i)?GIe(i):"",a=`${o}:${r}:${s}`,l;if(c(this._shaders[a]))l=this._shaders[a],delete this._shadersToRelease[a];else{let u=this._context,f=t.createCombinedVertexShader(u),h=n.createCombinedFragmentShader(u),p=new Jt({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:t,vertexShaderText:f,fragmentShaderSource:n,fragmentShaderText:h,attributeLocations:i});l={cache:this,shaderProgram:p,keyword:a,derivedKeywords:[],count:0},p._cachedShader=l,this._shaders[a]=l,++this._numberOfShaders}return++l.count,l.shaderProgram};Fd.prototype.replaceDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(c(r)){t6(this,r);let s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};Fd.prototype.getDerivedShaderProgram=function(e,t){let n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(c(o))return o.shaderProgram};Fd.prototype.createDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=n.vertexShaderSource,s=n.fragmentShaderSource,a=n.attributeLocations;typeof r=="string"&&(r=new He({sources:[r]})),typeof s=="string"&&(s=new He({sources:[s]}));let l=this._context,u=r.createCombinedVertexShader(l),f=s.createCombinedFragmentShader(l),h=new Jt({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:f,attributeLocations:a}),p={cache:this,shaderProgram:h,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),h._cachedShader=p,this._shaders[o]=p,h};function t6(e,t){let n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){let r=n[o]+t.keyword,s=e._shaders[r];t6(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}Fd.prototype.destroyReleasedShaderPrograms=function(){let e=this._shadersToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];t6(this,n),--this._numberOfShaders}this._shadersToRelease={}};Fd.prototype.releaseShaderProgram=function(e){if(c(e)){let t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};Fd.prototype.isDestroyed=function(){return!1};Fd.prototype.destroy=function(){let e=this._shaders;for(let t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return de(this)};var gI=Fd;function Bd(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context);let{context:t,source:n,pixelFormat:i=ke.RGBA,pixelDatatype:o=Ue.UNSIGNED_BYTE,flipY:r=!0,skipColorSpaceConversion:s=!1,sampler:a=new Qt}=e,{width:l,height:u}=e;c(n)&&(c(l)||(l=n.videoWidth??n.naturalWidth??n.width),c(u)||(u=n.videoHeight??n.naturalHeight??n.height));let f=e.preMultiplyAlpha||i===ke.RGB||i===ke.LUMINANCE,h=ke.toInternalFormat(i,o,t),p=ke.isCompressedFormat(h);if(!c(l)||!c(u))throw new E("options requires a source field to create an initialized texture or width and height fields to create a blank texture.");if(T.typeOf.number.greaterThan("width",l,0),l>ut.maximumTextureSize)throw new E(`Width must be less than or equal to the maximum texture size (${ut.maximumTextureSize}).  Check maximumTextureSize.`);if(T.typeOf.number.greaterThan("height",u,0),u>ut.maximumTextureSize)throw new E(`Height must be less than or equal to the maximum texture size (${ut.maximumTextureSize}).  Check maximumTextureSize.`);if(!ke.validate(i))throw new E("Invalid options.pixelFormat.");if(!p&&!Ue.validate(o))throw new E("Invalid options.pixelDatatype.");if(i===ke.DEPTH_COMPONENT&&o!==Ue.UNSIGNED_SHORT&&o!==Ue.UNSIGNED_INT)throw new E("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(i===ke.DEPTH_STENCIL&&o!==Ue.UNSIGNED_INT_24_8)throw new E("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(o===Ue.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.  Check context.floatingPointTexture.");if(o===Ue.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(ke.isDepthFormat(i)){if(c(n))throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture.  Check context.depthTexture.")}if(p){if(!c(n)||!c(n.arrayBufferView))throw new E("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(ke.isDXTFormat(h)&&!t.s3tc)throw new E("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(ke.isPVRTCFormat(h)&&!t.pvrtc)throw new E("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(ke.isASTCFormat(h)&&!t.astc)throw new E("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(ke.isETC2Format(h)&&!t.etc)throw new E("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(ke.isETC1Format(h)&&!t.etc1)throw new E("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(ke.isBC7Format(h)&&!t.bc7)throw new E("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(ke.compressedTextureSizeInBytes(h,l,u)!==n.arrayBufferView.byteLength)throw new E("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}let g=t._gl,m=p?ke.compressedTextureSizeInBytes(i,l,u):ke.textureSizeInBytes(i,o,l,u);this._id=e.id??jn(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=g.TEXTURE_2D,this._texture=g.createTexture(),this._internalFormat=h,this._pixelFormat=i,this._pixelDatatype=o,this._width=l,this._height=u,this._dimensions=new H(l,u),this._hasMipmap=!1,this._sizeInBytes=m,this._preMultiplyAlpha=f,this._flipY=r,this._initialized=!1,this._sampler=void 0,this._sampler=a,pne(this,a),g.activeTexture(g.TEXTURE0),g.bindTexture(this._textureTarget,this._texture),c(n)?(s?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),c(n.arrayBufferView)?ke.isCompressedFormat(h)?jIe(this,n):dne(this,n):c(n.framebuffer)?qIe(this,n):hne(this,n),this._initialized=!0):mne(this),g.bindTexture(this._textureTarget,null)}function jIe(e,t){let i=e._context._gl,o=e._textureTarget,r=e._internalFormat,{width:s,height:a}=e;if(i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.compressedTexImage2D(o,0,r,s,a,0,t.arrayBufferView),c(t.mipLevels)){let l=s,u=a;for(let f=0;f<t.mipLevels.length;++f)l=EV(l),u=EV(u),i.compressedTexImage2D(o,f+1,r,l,u,0,t.mipLevels[f])}}function dne(e,t){let n=e._context,i=n._gl,o=e._textureTarget,r=e._internalFormat,{width:s,height:a,pixelFormat:l,pixelDatatype:u,flipY:f}=e,h=ke.alignmentInBytes(l,u,s);i.pixelStorei(i.UNPACK_ALIGNMENT,h),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let{arrayBufferView:p}=t;if(f&&(p=ke.flipY(p,l,u,s,a)),i.texImage2D(o,0,r,s,a,0,l,Ue.toWebGLConstant(u,n),p),c(t.mipLevels)){let g=s,m=a;for(let y=0;y<t.mipLevels.length;++y)g=EV(g),m=EV(m),i.texImage2D(o,y+1,r,g,m,0,l,Ue.toWebGLConstant(u,n),t.mipLevels[y])}}function WIe(e,t,n,i,o,r){let s=e._context,a=s._gl,{pixelFormat:l,pixelDatatype:u}=e,f=ke.alignmentInBytes(l,u,o);a.pixelStorei(a.UNPACK_ALIGNMENT,f),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),e.flipY&&(t=ke.flipY(t,l,u,o,r)),a.texSubImage2D(e._textureTarget,0,n,i,o,r,l,Ue.toWebGLConstant(u,s),t)}function qIe(e,t){let n=e._context,i=n._gl;i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),t.framebuffer!==n.defaultFramebuffer&&t.framebuffer._bind(),i.copyTexImage2D(e._textureTarget,0,e._internalFormat,t.xOffset,t.yOffset,e.width,e.height,0),t.framebuffer!==n.defaultFramebuffer&&t.framebuffer._unBind()}function hne(e,t){let n=e._context,i=n._gl;i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.preMultiplyAlpha),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e.flipY),i.texImage2D(e._textureTarget,0,e._internalFormat,e.pixelFormat,Ue.toWebGLConstant(e.pixelDatatype,n),t)}function YIe(e,t,n,i){let o=e._context,r=o._gl;r.pixelStorei(r.UNPACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.preMultiplyAlpha),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,e.flipY),r.texSubImage2D(e._textureTarget,0,n,i,e.pixelFormat,Ue.toWebGLConstant(e.pixelDatatype,o),t)}function EV(e){let t=Math.floor(e/2)|0;return Math.max(t,1)}function mne(e){let t=e._context;t._gl.texImage2D(e._textureTarget,0,e._internalFormat,e._width,e._height,0,e._pixelFormat,Ue.toWebGLConstant(e._pixelDatatype,t),null)}Bd.create=function(e){return new Bd(e)};Bd.fromFramebuffer=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context);let t=e.context,n=t._gl,{pixelFormat:i=ke.RGB,framebufferXOffset:o=0,framebufferYOffset:r=0,width:s=n.drawingBufferWidth,height:a=n.drawingBufferHeight,framebuffer:l}=e;if(!ke.validate(i))throw new E("Invalid pixelFormat.");if(ke.isDepthFormat(i)||ke.isCompressedFormat(i))throw new E("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(T.defined("options.context",t),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",r,0),o+s>n.drawingBufferWidth)throw new E("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new E("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new Bd({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:c(l)?l:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(Bd.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){pne(this,e),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},dimensions:{get:function(){return this._dimensions}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}});function pne(e,t){let{minificationFilter:n,magnificationFilter:i}=t,o=[Yt.NEAREST_MIPMAP_NEAREST,Yt.NEAREST_MIPMAP_LINEAR,Yt.LINEAR_MIPMAP_NEAREST,Yt.LINEAR_MIPMAP_LINEAR].includes(n),r=e._context,s=e._pixelFormat,a=e._pixelDatatype;(a===Ue.FLOAT&&!r.textureFloatLinear||a===Ue.HALF_FLOAT&&!r.textureHalfFloatLinear)&&(n=o?Yt.NEAREST_MIPMAP_NEAREST:Yt.NEAREST,i=li.NEAREST),r.webgl2&&ke.isDepthFormat(s)&&(n=Yt.NEAREST,i=li.NEAREST);let l=r._gl,u=e._textureTarget;l.activeTexture(l.TEXTURE0),l.bindTexture(u,e._texture),l.texParameteri(u,l.TEXTURE_MIN_FILTER,n),l.texParameteri(u,l.TEXTURE_MAG_FILTER,i),l.texParameteri(u,l.TEXTURE_WRAP_S,t.wrapS),l.texParameteri(u,l.TEXTURE_WRAP_T,t.wrapT),c(e._textureFilterAnisotropic)&&l.texParameteri(u,e._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.maximumAnisotropy),l.bindTexture(u,null)}Bd.prototype.copyFrom=function(e){T.defined("options",e);let{xOffset:t=0,yOffset:n=0,source:i,skipColorSpaceConversion:o=!1}=e;if(T.defined("options.source",i),ke.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(ke.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");T.typeOf.number.greaterThanOrEquals("xOffset",t,0),T.typeOf.number.greaterThanOrEquals("yOffset",n,0),T.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+i.width,this._width),T.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+i.height,this._height);let s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture);let{width:l,height:u}=i;c(i.videoWidth)&&c(i.videoHeight)?(l=i.videoWidth,u=i.videoHeight):c(i.naturalWidth)&&c(i.naturalHeight)&&(l=i.naturalWidth,u=i.naturalHeight),o?s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE):s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL);let f=!1;this._initialized||(t===0&&n===0&&l===this._width&&u===this._height?(c(i.arrayBufferView)?dne(this,i):hne(this,i),f=!0):(s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),mne(this)),this._initialized=!0),f||(c(i.arrayBufferView)?WIe(this,i.arrayBufferView,t,n,l,u):YIe(this,i,t,n)),s.bindTexture(a,null)};Bd.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=e??0,t=t??0,n=n??0,i=i??0,o=o??this._width,r=r??this._height,ke.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===Ue.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Ue.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(ke.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");T.typeOf.number.greaterThanOrEquals("xOffset",e,0),T.typeOf.number.greaterThanOrEquals("yOffset",t,0),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),T.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),T.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);let s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(a,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};Bd.prototype.generateMipmap=function(e){if(e=e??Cf.DONT_CARE,ke.isDepthFormat(this._pixelFormat))throw new E("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(ke.isCompressedFormat(this._pixelFormat))throw new E("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!O.isPowerOfTwo(this._width))throw new E("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!O.isPowerOfTwo(this._height))throw new E("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!Cf.validate(e))throw new E("hint is invalid.");this._hasMipmap=!0;let t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};Bd.prototype.isDestroyed=function(){return!1};Bd.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),de(this)};var Rt=Bd;function Eb(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(Eb.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});Eb.prototype.getTexture=function(e){let t=this._textures[e];if(c(t))return delete this._texturesToRelease[e],++t.count,t.texture};Eb.prototype.addTexture=function(e,t){let n={texture:t,count:1};t.finalDestroy=t.destroy;let i=this;t.destroy=function(){--n.count===0&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures};Eb.prototype.destroyReleasedTextures=function(){let e=this._texturesToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}};Eb.prototype.isDestroyed=function(){return!1};Eb.prototype.destroy=function(){let e=this._textures;for(let t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return de(this)};var yI=Eb;function Ef(e){this.planes=e??[]}var bI=[new d,new d,new d];d.clone(d.UNIT_X,bI[0]);d.clone(d.UNIT_Y,bI[1]);d.clone(d.UNIT_Z,bI[2]);var qg=new d,XIe=new d,_ne=new sn(new d(1,0,0),0);Ef.fromBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");c(t)||(t=new Ef);let n=bI.length,i=t.planes;i.length=2*n;let o=e.center,r=e.radius,s=0;for(let a=0;a<n;++a){let l=bI[a],u=i[s],f=i[s+1];c(u)||(u=i[s]=new se),c(f)||(f=i[s+1]=new se),d.multiplyByScalar(l,-r,qg),d.add(o,qg,qg),u.x=l.x,u.y=l.y,u.z=l.z,u.w=-d.dot(l,qg),d.multiplyByScalar(l,r,qg),d.add(o,qg,qg),f.x=-l.x,f.y=-l.y,f.z=-l.z,f.w=-d.dot(d.negate(l,XIe),qg),s+=2}return t};Ef.prototype.computeVisibility=function(e){if(!c(e))throw new E("boundingVolume is required.");let t=this.planes,n=!1;for(let i=0,o=t.length;i<o;++i){let r=e.intersectPlane(sn.fromCartesian4(t[i],_ne));if(r===Wt.OUTSIDE)return Wt.OUTSIDE;r===Wt.INTERSECTING&&(n=!0)}return n?Wt.INTERSECTING:Wt.INSIDE};Ef.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!c(e))throw new E("boundingVolume is required.");if(!c(t))throw new E("parentPlaneMask is required.");if(t===Ef.MASK_OUTSIDE||t===Ef.MASK_INSIDE)return t;let n=Ef.MASK_INSIDE,i=this.planes;for(let o=0,r=i.length;o<r;++o){let s=o<31?1<<o:0;if(o<31&&!(t&s))continue;let a=e.intersectPlane(sn.fromCartesian4(i[o],_ne));if(a===Wt.OUTSIDE)return Ef.MASK_OUTSIDE;a===Wt.INTERSECTING&&(n|=s)}return n};Ef.MASK_OUTSIDE=4294967295;Ef.MASK_INSIDE=0;Ef.MASK_INDETERMINATE=2147483647;var _s=Ef;function mm(e){e=e??W.EMPTY_OBJECT,this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=e.near??1,this._near=this.near,this.far=e.far??5e8,this._far=this.far,this._cullingVolume=new _s,this._orthographicMatrix=new B}function gne(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new E("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new E("right must be greater than left.");if(e.bottom>e.top)throw new E("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=B.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(mm.prototype,{projectionMatrix:{get:function(){return gne(this),this._orthographicMatrix}}});var KIe=new d,$Ie=new d,ZIe=new d,n6=new d;mm.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");let i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,f=d.cross(t,n,KIe);d.normalize(f,f);let h=$Ie;d.multiplyByScalar(t,l,h),d.add(e,h,h);let p=ZIe;d.multiplyByScalar(f,a,p),d.add(h,p,p);let g=i[0];return c(g)||(g=i[0]=new se),g.x=f.x,g.y=f.y,g.z=f.z,g.w=-d.dot(f,p),d.multiplyByScalar(f,s,p),d.add(h,p,p),g=i[1],c(g)||(g=i[1]=new se),g.x=-f.x,g.y=-f.y,g.z=-f.z,g.w=-d.dot(d.negate(f,n6),p),d.multiplyByScalar(n,r,p),d.add(h,p,p),g=i[2],c(g)||(g=i[2]=new se),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-d.dot(n,p),d.multiplyByScalar(n,o,p),d.add(h,p,p),g=i[3],c(g)||(g=i[3]=new se),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-d.dot(d.negate(n,n6),p),g=i[4],c(g)||(g=i[4]=new se),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-d.dot(t,h),d.multiplyByScalar(t,u,p),d.add(e,p,p),g=i[5],c(g)||(g=i[5]=new se),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-d.dot(d.negate(t,n6),p),this._cullingVolume};mm.prototype.getPixelDimensions=function(e,t,n,i,o){if(gne(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required.");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");let r=this.right-this.left,s=this.top-this.bottom,a=i*r/e,l=i*s/t;return o.x=a,o.y=l,o};mm.prototype.clone=function(e){return c(e)||(e=new mm),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};mm.prototype.equals=function(e){return c(e)&&e instanceof mm&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};mm.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof mm&&O.equalsEpsilon(this.right,e.right,t,n)&&O.equalsEpsilon(this.left,e.left,t,n)&&O.equalsEpsilon(this.top,e.top,t,n)&&O.equalsEpsilon(this.bottom,e.bottom,t,n)&&O.equalsEpsilon(this.near,e.near,t,n)&&O.equalsEpsilon(this.far,e.far,t,n)};var jo=mm;function Ol(e){e=e??W.EMPTY_OBJECT,this._offCenterFrustum=new jo,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=e.near??1,this._near=this.near,this.far=e.far??5e8,this._far=this.far}Ol.packedLength=4;Ol.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};Ol.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new Ol),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function Yg(e){if(!c(e.width)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("width, aspectRatio, near, or far parameters are not set.");let t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new E("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;let n=1/e.aspectRatio;t.right=e.width*.5,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}Object.defineProperties(Ol.prototype,{projectionMatrix:{get:function(){return Yg(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return Yg(this),this._offCenterFrustum}}});Ol.prototype.computeCullingVolume=function(e,t,n){return Yg(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};Ol.prototype.getPixelDimensions=function(e,t,n,i,o){return Yg(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};Ol.prototype.clone=function(e){return c(e)||(e=new Ol),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};Ol.prototype.equals=function(e){return!c(e)||!(e instanceof Ol)?!1:(Yg(this),Yg(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};Ol.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof Ol)?!1:(Yg(this),Yg(e),O.equalsEpsilon(this.width,e.width,t,n)&&O.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};var on=Ol;var i6={};function QIe(e){let t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}var JIe=32.184,eOe=2451545;function Bne(e,t){t=Q.addSeconds(e,JIe,t);let n=Q.totalDays(t)-eOe;return t=Q.addSeconds(t,QIe(n),t),t}var SV=new Q(2451545,0,Wn.TAI),tOe=1e3,Sf=O.RADIANS_PER_DEGREE,pu=O.RADIANS_PER_ARCSECOND,Na=14959787e4,yne=new J;function kne(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=O.PI),n<0||n>O.PI)throw new E("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");let a=e*(1-t),l=i-o,u=o,f=iOe(r-i,t);if(nOe(t,0)==="Hyperbolic"&&Math.abs(O.negativePiToPi(f))>=Math.acos(-1/t))throw new E("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");aOe(l,n,u,yne);let p=a*(1+t),g=Math.cos(f),m=Math.sin(f),y=1+t*g;if(y<=O.Epsilon10)throw new E("elements cannot be converted to cartesian");let b=p/y;return c(s)?(s.x=b*g,s.y=b*m,s.z=0):s=new d(b*g,b*m,0),J.multiplyByVector(yne,s,s)}function nOe(e,t){if(e<0)throw new E("eccentricity cannot be negative.");return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function iOe(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");let n=rOe(e,t);return sOe(n,t)}var bne=50,oOe=O.EPSILON8;function rOe(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");let n=Math.floor(e/O.TWO_PI);e-=n*O.TWO_PI;let i=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE,r;for(r=0;r<bne&&Math.abs(o-i)>oOe;++r){o=i;let s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=bne)throw new E("Kepler equation did not converge");return o=i+n*O.TWO_PI,o}function sOe(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");let n=Math.floor(e/O.TWO_PI);e-=n*O.TWO_PI;let i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t),r=Math.atan2(o,i);return r=O.zeroToTwoPi(r),e<0&&(r-=O.TWO_PI),r+=n*O.TWO_PI,r}function aOe(e,t,n,i){if(t<0||t>O.PI)throw new E("inclination out of range");let o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),l=Math.cos(n),u=Math.sin(n);return c(i)?(i[0]=l*o-u*r*s,i[1]=u*o+l*r*s,i[2]=r*a,i[3]=-l*r-u*o*s,i[4]=-u*r+l*o*s,i[5]=o*a,i[6]=u*a,i[7]=-l*a,i[8]=s):i=new J(l*o-u*r*s,-l*r-u*o*s,u*a,u*o+l*r*s,-u*r+l*o*s,-l*a,r*a,o*a,s),i}var cOe=1.0000010178*Na,lOe=100.46645683*Sf,uOe=129597742283429e-5*pu,xne=16002,Tne=21863,Ane=32004,Cne=10931,Ene=14529,Sne=16368,wne=15318,vne=32794,fOe=64*1e-7*Na,dOe=-152*1e-7*Na,hOe=62*1e-7*Na,mOe=-8*1e-7*Na,pOe=32*1e-7*Na,_Oe=-41*1e-7*Na,gOe=19*1e-7*Na,yOe=-11*1e-7*Na,bOe=-150*1e-7*Na,xOe=-46*1e-7*Na,TOe=68*1e-7*Na,AOe=54*1e-7*Na,COe=14*1e-7*Na,EOe=24*1e-7*Na,SOe=-28*1e-7*Na,wOe=22*1e-7*Na,Dne=10,Pne=16002,Ine=21863,One=10931,Rne=1473,Mne=32004,Lne=4387,Nne=73,vOe=-325*1e-7,DOe=-322*1e-7,POe=-79*1e-7,IOe=232*1e-7,OOe=-52*1e-7,ROe=97*1e-7,MOe=55*1e-7,LOe=-41*1e-7,NOe=-105*1e-7,FOe=-137*1e-7,BOe=258*1e-7,kOe=35*1e-7,UOe=-116*1e-7,VOe=-88*1e-7,zOe=-112*1e-7,HOe=-80*1e-7,hC=new Q(0,0,Wn.TAI);function GOe(e,t){Bne(e,hC);let i=(hC.dayNumber-SV.dayNumber+(hC.secondsOfDay-SV.secondsOfDay)/qn.SECONDS_PER_DAY)/(qn.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=cOe+fOe*Math.cos(xne*o)+bOe*Math.sin(xne*o)+dOe*Math.cos(Tne*o)+xOe*Math.sin(Tne*o)+hOe*Math.cos(Ane*o)+TOe*Math.sin(Ane*o)+mOe*Math.cos(Cne*o)+AOe*Math.sin(Cne*o)+pOe*Math.cos(Ene*o)+COe*Math.sin(Ene*o)+_Oe*Math.cos(Sne*o)+EOe*Math.sin(Sne*o)+gOe*Math.cos(wne*o)+SOe*Math.sin(wne*o)+yOe*Math.cos(vne*o)+wOe*Math.sin(vne*o),s=lOe+uOe*i+vOe*Math.cos(Dne*o)+NOe*Math.sin(Dne*o)+DOe*Math.cos(Pne*o)+FOe*Math.sin(Pne*o)+POe*Math.cos(Ine*o)+BOe*Math.sin(Ine*o)+IOe*Math.cos(One*o)+kOe*Math.sin(One*o)+OOe*Math.cos(Rne*o)+UOe*Math.sin(Rne*o)+ROe*Math.cos(Mne*o)+VOe*Math.sin(Mne*o)+MOe*Math.cos(Lne*o)+zOe*Math.sin(Lne*o)+LOe*Math.cos(Nne*o)+HOe*Math.sin(Nne*o),a=.0167086342-.0004203654*i,l=102.93734808*Sf+11612.3529*pu*i,u=469.97289*pu*i,f=174.87317577*Sf-8679.27034*pu*i;return kne(r,a,u,l,f,s,t)}function Une(e,t){Bne(e,hC);let i=(hC.dayNumber-SV.dayNumber+(hC.secondsOfDay-SV.secondsOfDay)/qn.SECONDS_PER_DAY)/qn.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i,a=383397.7725+.004*i,l=.055545526-16e-9*i,u=5.15668983*Sf,f=-8e-5*i+.02966*o-42e-6*r-13e-8*s,h=83.35324312*Sf,p=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s,g=125.04455501*Sf,m=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s,y=218.31664563*Sf,b=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s,x=297.85019547*Sf+pu*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),A=93.27209062*Sf+pu*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),C=134.96340251*Sf+pu*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),S=357.52910918*Sf+pu*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),v=310.17137918*Sf-pu*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),P=2*x,M=4*x,R=6*x,L=2*C,F=3*C,_=4*C,w=2*A;a+=3400.4*Math.cos(P)-635.6*Math.cos(P-C)-235.6*Math.cos(C)+218.1*Math.cos(P-S)+181*Math.cos(P+C),l+=.014216*Math.cos(P-C)+.008551*Math.cos(P-L)-.001383*Math.cos(C)+.001356*Math.cos(P+C)-.001147*Math.cos(M-F)-914e-6*Math.cos(M-L)+869e-6*Math.cos(P-S-C)-627e-6*Math.cos(P)-394e-6*Math.cos(M-_)+282e-6*Math.cos(P-S-L)-279e-6*Math.cos(x-C)-236e-6*Math.cos(L)+231e-6*Math.cos(M)+229e-6*Math.cos(R-_)-201e-6*Math.cos(L-w),f+=486.26*Math.cos(P-w)-40.13*Math.cos(P)+37.51*Math.cos(w)+25.73*Math.cos(L-w)+19.97*Math.cos(P-S-w),p+=-55609*Math.sin(P-C)-34711*Math.sin(P-L)-9792*Math.sin(C)+9385*Math.sin(M-F)+7505*Math.sin(M-L)+5318*Math.sin(P+C)+3484*Math.sin(M-_)-3417*Math.sin(P-S-C)-2530*Math.sin(R-_)-2376*Math.sin(P)-2075*Math.sin(P-F)-1883*Math.sin(L)-1736*Math.sin(R-5*C)+1626*Math.sin(S)-1370*Math.sin(R-F),m+=-5392*Math.sin(P-w)-540*Math.sin(S)-441*Math.sin(P)+423*Math.sin(w)-288*Math.sin(L-w),b+=-3332.9*Math.sin(P)+1197.4*Math.sin(P-C)-662.5*Math.sin(S)+396.3*Math.sin(C)-218*Math.sin(P-S);let D=2*v,I=3*v;f+=46.997*Math.cos(v)*i-.614*Math.cos(P-w+v)*i+.614*Math.cos(P-w-v)*i-.0297*Math.cos(D)*o-.0335*Math.cos(v)*o+.0012*Math.cos(P-w+D)*o-16e-5*Math.cos(v)*r+4e-5*Math.cos(I)*r+4e-5*Math.cos(D)*r;let N=2.116*Math.sin(v)*i-.111*Math.sin(P-w-v)*i-.0015*Math.sin(v)*o;p+=N,b+=N,m+=-520.77*Math.sin(v)*i+13.66*Math.sin(P-w+v)*i+1.12*Math.sin(P-v)*i-1.06*Math.sin(w-v)*i+.66*Math.sin(D)*o+.371*Math.sin(v)*o-.035*Math.sin(P-w+D)*o-.015*Math.sin(P-w+v)*o+.0014*Math.sin(v)*r-.0011*Math.sin(I)*r-9e-4*Math.sin(D)*r,a*=tOe;let k=u+f*pu,z=h+p*pu,V=y+b*pu,j=g+m*pu;return kne(a,l,k,z,j,V,t)}var Fne=.012300034,jOe=Fne/(Fne+1)*-1;function WOe(e,t){return t=Une(e,t),d.multiplyByScalar(t,jOe,t)}var Vne=new J(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819),xI=new d;i6.computeSunPositionInEarthInertialFrame=function(e,t){return c(e)||(e=Q.now()),c(t)||(t=new d),xI=GOe(e,xI),t=d.negate(xI,t),WOe(e,xI),d.subtract(t,xI,t),J.multiplyByVector(Vne,t,t),t};i6.computeMoonPositionInEarthInertialFrame=function(e,t){return c(e)||(e=Q.now()),t=Une(e,t),J.multiplyByVector(Vne,t,t),t};var Xg=i6;var wV={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};wV.getMorphTime=function(e){return e===wV.SCENE3D?1:e===wV.MORPHING?void 0:0};var oe=Object.freeze(wV);function qOe(e){e=e??W.EMPTY_OBJECT,this.color=G.clone(e.color??G.WHITE),this.intensity=e.intensity??2}var Rp=qOe;function mC(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Ke,this._viewportCartesian4=new se,this._viewportDirty=!1,this._viewportOrthographicMatrix=B.clone(B.IDENTITY),this._viewportTransformation=B.clone(B.IDENTITY),this._model=B.clone(B.IDENTITY),this._view=B.clone(B.IDENTITY),this._inverseView=B.clone(B.IDENTITY),this._projection=B.clone(B.IDENTITY),this._infiniteProjection=B.clone(B.IDENTITY),this._entireFrustum=new H,this._currentFrustum=new H,this._frustumPlanes=new se,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=J.clone(B.IDENTITY),this._view3DDirty=!0,this._view3D=new B,this._inverseView3DDirty=!0,this._inverseView3D=new B,this._inverseModelDirty=!0,this._inverseModel=new B,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new J,this._viewRotation=new J,this._inverseViewRotation=new J,this._viewRotation3D=new J,this._inverseViewRotation3D=new J,this._inverseProjectionDirty=!0,this._inverseProjection=new B,this._modelViewDirty=!0,this._modelView=new B,this._modelView3DDirty=!0,this._modelView3D=new B,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new B,this._inverseModelViewDirty=!0,this._inverseModelView=new B,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new B,this._viewProjectionDirty=!0,this._viewProjection=new B,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new B,this._modelViewProjectionDirty=!0,this._modelViewProjection=new B,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new B,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new B,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new B,this._normalDirty=!0,this._normal=new J,this._normal3DDirty=!0,this._normal3D=new J,this._inverseNormalDirty=!0,this._inverseNormal=new J,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new J,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new Hn,this._cameraPosition=new d,this._sunPositionWC=new d,this._sunPositionColumbusView=new d,this._sunDirectionWC=new d,this._sunDirectionEC=new d,this._moonDirectionEC=new d,this._lightDirectionWC=new d,this._lightDirectionEC=new d,this._lightColor=new d,this._lightColorHdr=new d,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new d,this._cameraRight=new d,this._cameraUp=new d,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new H,this._eyeEllipsoidNormalEC=new d,this._eyeEllipsoidCurvature=new H,this._modelToEnu=new B,this._enuToModel=new B,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new G,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._fogVisualDensityScalar=void 0,this._fogMinimumBrightness=void 0,this._atmosphereHsbShift=void 0,this._atmosphereLightIntensity=void 0,this._atmosphereRayleighCoefficient=new d,this._atmosphereRayleighScaleHeight=new d,this._atmosphereMieCoefficient=new d,this._atmosphereMieScaleHeight=void 0,this._atmosphereMieAnisotropy=void 0,this._atmosphereDynamicLighting=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties(mC.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!Ke.equals(e,this._viewport)){Ke.clone(e,this._viewport);let t=this._viewport,n=this._viewportCartesian4;n.x=t.x,n.y=t.y,n.z=t.width,n.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return Hne(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return Hne(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){B.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,B.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){let e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,B.getMatrix3(this.inverseModel,e),J.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return r6(this),this._view3D}},viewRotation:{get:function(){return r6(this),this._viewRotation}},viewRotation3D:{get:function(){return r6(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return Wne(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return Wne(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return i1e(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return o1e(this),this._modelView}},modelView3D:{get:function(){return r1e(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return f1e(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return s1e(this),this._inverseModelView}},inverseModelView3D:{get:function(){return a1e(this),this._inverseModelView3D}},viewProjection:{get:function(){return c1e(this),this._viewProjection}},inverseViewProjection:{get:function(){return l1e(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return u1e(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return d1e(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return h1e(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return m1e(this),this._modelViewInfiniteProjection}},normal:{get:function(){return p1e(this),this._normal}},normal3D:{get:function(){return _1e(this),this._normal3D}},inverseNormal:{get:function(){return g1e(this),this._inverseNormal}},inverseNormal3D:{get:function(){return y1e(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},eyeEllipsoidNormalEC:{get:function(){return this._eyeEllipsoidNormalEC}},eyeEllipsoidCurvature:{get:function(){return this._eyeEllipsoidCurvature}},modelToEnu:{get:function(){return this._modelToEnu}},enuToModel:{get:function(){return this._enuToModel}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return jne(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return jne(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},fogVisualDensityScalar:{get:function(){return this._fogVisualDensityScalar}},fogMinimumBrightness:{get:function(){return this._fogMinimumBrightness}},atmosphereHsbShift:{get:function(){return this._atmosphereHsbShift}},atmosphereLightIntensity:{get:function(){return this._atmosphereLightIntensity}},atmosphereRayleighCoefficient:{get:function(){return this._atmosphereRayleighCoefficient}},atmosphereRayleighScaleHeight:{get:function(){return this._atmosphereRayleighScaleHeight}},atmosphereMieCoefficient:{get:function(){return this._atmosphereMieCoefficient}},atmosphereMieScaleHeight:{get:function(){return this._atmosphereMieScaleHeight}},atmosphereMieAnisotropy:{get:function(){return this._atmosphereMieAnisotropy}},atmosphereDynamicLighting:{get:function(){return this._atmosphereDynamicLighting}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return this._ellipsoid??ie.default}}});function YOe(e,t){B.clone(t,e._view),B.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function XOe(e,t){B.clone(t,e._inverseView),B.getMatrix3(t,e._inverseViewRotation)}function KOe(e,t){B.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function $Oe(e,t){B.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}var zne=new d,ZOe=new B;function QOe(e,t){d.clone(t.positionWC,e._cameraPosition),d.clone(t.directionWC,e._cameraDirection),d.clone(t.rightWC,e._cameraRight),d.clone(t.upWC,e._cameraUp);let n=e._ellipsoid,i,o=t.positionCartographic;if(c(o)?(e._eyeHeight=o.height,e._eyeEllipsoidNormalEC=n.geodeticSurfaceNormalCartographic(o,e._eyeEllipsoidNormalEC),i=d.fromRadians(o.longitude,o.latitude,0,n,zne)):(e._eyeHeight=-n.maximumRadius,d.magnitude(t.positionWC)>0&&(e._eyeEllipsoidNormalEC=d.normalize(t.positionWC,e._eyeEllipsoidNormalEC)),i=n.scaleToGeodeticSurface(t.positionWC,zne)),e._encodedCameraPositionMCDirty=!0,!c(i))return;e._eyeEllipsoidNormalEC=J.multiplyByVector(e._viewRotation,e._eyeEllipsoidNormalEC,e._eyeEllipsoidNormalEC);let r=Ot.eastNorthUpToFixedFrame(i,n,ZOe);e._enuToModel=B.multiplyTransformation(e.inverseModel,r,e._enuToModel),e._modelToEnu=B.inverseTransformation(e._enuToModel,e._modelToEnu),O.equalsEpsilon(n._radii.x,n._radii.y,O.EPSILON15)&&(e._eyeEllipsoidCurvature=n.getLocalCurvature(i,e._eyeEllipsoidCurvature))}var o6=new J,JOe=new he;function e1e(e,t){Ot.computeIcrfToCentralBodyFixedMatrix(t.time,o6);let n=Xg.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);J.multiplyByVector(o6,n,n),d.normalize(n,e._sunDirectionWC),n=J.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),d.normalize(n,n),n=Xg.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),J.multiplyByVector(o6,n,n),J.multiplyByVector(e.viewRotation3D,n,n),d.normalize(n,n);let i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,JOe);i.project(r,e._sunPositionColumbusView)}mC.prototype.updateCamera=function(e){YOe(this,e.viewMatrix),XOe(this,e.inverseViewMatrix),QOe(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==oe.SCENE2D&&e.frustum instanceof on};mC.prototype.updateFrustum=function(e){KOe(this,e.projectionMatrix),c(e.infiniteProjectionMatrix)&&$Oe(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=O.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne;let t=e.offCenterFrustum;c(t)&&(e=t),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right};mC.prototype.updatePass=function(e){this._pass=e};var t1e=[],n1e=new Rp;mC.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;let t=e.camera;this.updateCamera(t),e.mode===oe.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=this._frustum2DWidth*.5,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),e1e(this,e);let n=e.light??n1e;n instanceof Rp?(this._lightDirectionWC=d.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=d.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=d.normalize(d.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=J.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));let i=n.color,o=d.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=d.multiplyByScalar(o,n.intensity,o);let r=d.maximumComponent(o);r>1?d.divideByScalar(o,r,this._lightColor):d.clone(o,this._lightColor);let s=e.brdfLutGenerator,a=c(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=e.environmentMap??e.context.defaultCubeMap,this._sphericalHarmonicCoefficients=e.sphericalHarmonicCoefficients??t1e,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,this._fogDensity=e.fog.density,this._fogVisualDensityScalar=e.fog.visualDensityScalar,this._fogMinimumBrightness=e.fog.minimumBrightness;let l=e.atmosphere;c(l)&&(this._atmosphereHsbShift=d.fromElements(l.hueShift,l.saturationShift,l.brightnessShift,this._atmosphereHsbShift),this._atmosphereLightIntensity=l.lightIntensity,this._atmosphereRayleighCoefficient=d.clone(l.rayleighCoefficient,this._atmosphereRayleighCoefficient),this._atmosphereRayleighScaleHeight=l.rayleighScaleHeight,this._atmosphereMieCoefficient=d.clone(l.mieCoefficient,this._atmosphereMieCoefficient),this._atmosphereMieScaleHeight=l.mieScaleHeight,this._atmosphereMieAnisotropy=l.mieAnisotropy,this._atmosphereDynamicLighting=l.dynamicLighting),this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Ot.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;let u=t.frustum.fov,f=this._viewport,h;c(u)?f.height>f.width?h=Math.tan(.5*u)*2/f.height:h=Math.tan(.5*u)*2/f.width:h=1/Math.max(f.width,f.height),this._geometricToleranceOverMeter=h*e.maximumScreenSpaceError,G.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function Hne(e){if(e._viewportDirty){let t=e._viewport;B.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),B.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function i1e(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==oe.SCENE2D&&e._mode!==oe.MORPHING&&!e._orthographicIn3D?B.inverse(e._projection,e._inverseProjection):B.clone(B.ZERO,e._inverseProjection))}function o1e(e){e._modelViewDirty&&(e._modelViewDirty=!1,B.multiplyTransformation(e._view,e._model,e._modelView))}function r1e(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,B.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function s1e(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,B.inverse(e.modelView,e._inverseModelView))}function a1e(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,B.inverse(e.modelView3D,e._inverseModelView3D))}function c1e(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,B.multiply(e._projection,e._view,e._viewProjection))}function l1e(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,B.inverse(e.viewProjection,e._inverseViewProjection))}function u1e(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,B.multiply(e._projection,e.modelView,e._modelViewProjection))}function f1e(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;let t=e.modelView,n=e._modelViewRelativeToEye;n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=0,n[13]=0,n[14]=0,n[15]=t[15]}}function d1e(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,B.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function h1e(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,B.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function m1e(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,B.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function p1e(e){if(e._normalDirty){e._normalDirty=!1;let t=e._normal;B.getMatrix3(e.inverseModelView,t),J.transpose(t,t)}}function _1e(e){if(e._normal3DDirty){e._normal3DDirty=!1;let t=e._normal3D;B.getMatrix3(e.inverseModelView3D,t),J.transpose(t,t)}}function g1e(e){if(e._inverseNormalDirty){e._inverseNormalDirty=!1;let t=e._inverseNormal;B.getMatrix3(e.modelView,t),J.transpose(t,t)}}function y1e(e){if(e._inverseNormal3DDirty){e._inverseNormal3DDirty=!1;let t=e._inverseNormal3D;B.getMatrix3(e.modelView3D,t),J.transpose(t,t)}}var Gne=new d;function jne(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,B.multiplyByPoint(e.inverseModel,e._cameraPosition,Gne),Hn.fromCartesian(Gne,e._encodedCameraPositionMC))}var b1e=new d,x1e=new d,T1e=new d,A1e=new d,C1e=new he,E1e=new d,S1e=new B;function w1e(e,t,n,i,o,r,s,a){let l=b1e;l.x=e.y,l.y=e.z,l.z=e.x;let u=x1e;u.x=n.y,u.y=n.z,u.z=n.x;let f=T1e;f.x=i.y,f.y=i.z,f.z=i.x;let h=A1e;h.x=t.y,h.y=t.z,h.z=t.x,r===oe.SCENE2D&&(l.z=o*.5);let p=s.unproject(l,C1e);p.longitude=O.clamp(p.longitude,-Math.PI,Math.PI),p.latitude=O.clamp(p.latitude,-O.PI_OVER_TWO,O.PI_OVER_TWO);let g=s.ellipsoid,m=g.cartographicToCartesian(p,E1e),y=Ot.eastNorthUpToFixedFrame(m,g,S1e);return B.multiplyByPointAsVector(y,u,u),B.multiplyByPointAsVector(y,f,f),B.multiplyByPointAsVector(y,h,h),c(a)||(a=new B),a[0]=u.x,a[1]=f.x,a[2]=-h.x,a[3]=0,a[4]=u.y,a[5]=f.y,a[6]=-h.y,a[7]=0,a[8]=u.z,a[9]=f.z,a[10]=-h.z,a[11]=0,a[12]=-d.dot(u,m),a[13]=-d.dot(f,m),a[14]=d.dot(h,m),a[15]=1,a}function r6(e){e._view3DDirty&&(e._mode===oe.SCENE3D?B.clone(e._view,e._view3D):w1e(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),B.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function Wne(e){e._inverseView3DDirty&&(B.inverseTransformation(e.view3D,e._inverseView3D),B.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}var TI=mC;function wf(e,t){T.defined("canvas",e);let{getWebGLStub:n,requestWebgl1:i,webgl:o={},allowTextureFilterAnisotropic:r=!0}=t??{};o.alpha=o.alpha??!1,o.stencil=o.stencil??!0,o.powerPreference=o.powerPreference??"high-performance";let s=c(n)?n(e,o):v1e(e,o,i),l=typeof WebGL2RenderingContext<"u"&&s instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=s,this._gl=s,this._webgl2=l,this._id=jn(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new gI(this),this._textureCache=new yI;let u=s;this._stencilBits=u.getParameter(u.STENCIL_BITS),ut._maximumCombinedTextureImageUnits=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ut._maximumCubeMapSize=u.getParameter(u.MAX_CUBE_MAP_TEXTURE_SIZE),ut._maximumFragmentUniformVectors=u.getParameter(u.MAX_FRAGMENT_UNIFORM_VECTORS),ut._maximumTextureImageUnits=u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS),ut._maximumRenderbufferSize=u.getParameter(u.MAX_RENDERBUFFER_SIZE),ut._maximumTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),ut._maximumVaryingVectors=u.getParameter(u.MAX_VARYING_VECTORS),ut._maximumVertexAttributes=u.getParameter(u.MAX_VERTEX_ATTRIBS),ut._maximumVertexTextureImageUnits=u.getParameter(u.MAX_VERTEX_TEXTURE_IMAGE_UNITS),ut._maximumVertexUniformVectors=u.getParameter(u.MAX_VERTEX_UNIFORM_VECTORS),ut._maximumSamples=this._webgl2?u.getParameter(u.MAX_SAMPLES):0;let f=u.getParameter(u.ALIASED_LINE_WIDTH_RANGE);ut._minimumAliasedLineWidth=f[0],ut._maximumAliasedLineWidth=f[1];let h=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);ut._minimumAliasedPointSize=h[0],ut._maximumAliasedPointSize=h[1];let p=u.getParameter(u.MAX_VIEWPORT_DIMS);ut._maximumViewportWidth=p[0],ut._maximumViewportHeight=p[1];let g=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);ut._highpFloatSupported=g.precision!==0;let m=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_INT);ut._highpIntSupported=m.rangeMax!==0,this._antialias=u.getContextAttributes().antialias,this._standardDerivatives=!!wr(u,["OES_standard_derivatives"]),this._blendMinmax=!!wr(u,["EXT_blend_minmax"]),this._elementIndexUint=!!wr(u,["OES_element_index_uint"]),this._depthTexture=!!wr(u,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!wr(u,["EXT_frag_depth"]),this._debugShaders=wr(u,["WEBGL_debug_shaders"]),this._textureFloat=!!wr(u,["OES_texture_float"]),this._textureHalfFloat=!!wr(u,["OES_texture_half_float"]),this._textureFloatLinear=!!wr(u,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!wr(u,["OES_texture_half_float_linear"]),this._supportsTextureLod=!!wr(u,["EXT_shader_texture_lod"]),this._colorBufferFloat=!!wr(u,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!wr(u,["EXT_float_blend"]),this._colorBufferHalfFloat=!!wr(u,["EXT_color_buffer_half_float"]),this._s3tc=!!wr(u,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!wr(u,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!wr(u,["WEBGL_compressed_texture_astc"]),this._etc=!!wr(u,["WEBG_compressed_texture_etc"]),this._etc1=!!wr(u,["WEBGL_compressed_texture_etc1"]),this._bc7=!!wr(u,["EXT_texture_compression_bptc"]),Il.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);let y=r?wr(u,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=y,ut._maximumTextureFilterAnisotropy=c(y)?u.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let b,x,A,C,S,v,P,M,R,L;if(l){let D=this;b=function(){return D._gl.createVertexArray()},x=function(I){D._gl.bindVertexArray(I)},A=function(I){D._gl.deleteVertexArray(I)},C=function(I,N,k,z,V){u.drawElementsInstanced(I,N,k,z,V)},S=function(I,N,k,z){u.drawArraysInstanced(I,N,k,z)},v=function(I,N){u.vertexAttribDivisor(I,N)},P=function(I){u.drawBuffers(I)}}else M=wr(u,["OES_vertex_array_object"]),c(M)&&(b=function(){return M.createVertexArrayOES()},x=function(D){M.bindVertexArrayOES(D)},A=function(D){M.deleteVertexArrayOES(D)}),R=wr(u,["ANGLE_instanced_arrays"]),c(R)&&(C=function(D,I,N,k,z){R.drawElementsInstancedANGLE(D,I,N,k,z)},S=function(D,I,N,k){R.drawArraysInstancedANGLE(D,I,N,k)},v=function(D,I){R.vertexAttribDivisorANGLE(D,I)}),L=wr(u,["WEBGL_draw_buffers"]),c(L)&&(P=function(D){L.drawBuffersWEBGL(D)});this.glCreateVertexArray=b,this.glBindVertexArray=x,this.glDeleteVertexArray=A,this.glDrawElementsInstanced=C,this.glDrawArraysInstanced=S,this.glVertexAttribDivisor=v,this.glDrawBuffers=P,this._vertexArrayObject=!!M,this._instancedArrays=!!R,this._drawBuffers=!!L,ut._maximumDrawBuffers=this.drawBuffers?u.getParameter(ne.MAX_DRAW_BUFFERS):1,ut._maximumColorAttachments=this.drawBuffers?u.getParameter(ne.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new G(0,0,0,0),this._clearDepth=1,this._clearStencil=0;let F=new TI,_=new lc(this),w=Ve.fromCache();this._defaultPassState=_,this._defaultRenderState=w,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=F,this._currentRenderState=w,this._currentPassState=_,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let D=0;D<ut._maximumVertexAttributes;D++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:n,requestWebgl1:i,webgl:o,allowTextureFilterAnisotropic:r},this.cache={},Ve.apply(u,w,_)}function v1e(e,t,n){if(typeof WebGLRenderingContext>"u")throw new ae("The browser does not support WebGL.  Visit http://get.webgl.org.");!n&&!(typeof WebGL2RenderingContext<"u")&&(n=!0);let o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!c(r))throw new ae("The browser supports WebGL, but initialization failed.");return r}function D1e(e,t){let n="WebGL Error:  ";switch(t){case e.INVALID_ENUM:n+="INVALID_ENUM";break;case e.INVALID_VALUE:n+="INVALID_VALUE";break;case e.INVALID_OPERATION:n+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:n+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n+="CONTEXT_LOST_WEBGL lost";break;default:n+=`Unknown (${t})`}return n}function P1e(e,t,n,i){let o=`${D1e(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function I1e(e,t,n){let i=e.getError();if(i!==e.NO_ERROR)throw new ae(P1e(e,t,n,i))}function O1e(e,t,n){return{get:function(){let i=e[t];return n(e,`get: ${t}`,i),e[t]},set:function(i){e[t]=i,n(e,`set: ${t}`,i)}}}function R1e(e,t){if(!c(t))return e;function n(o){return function(){let r=o.apply(e,arguments);return t(e,o,arguments),r}}let i={};for(let o in e){let r=e[o];r instanceof Function?i[o]=n(r):Object.defineProperty(i,o,O1e(e,o,t))}return i}function wr(e,t){let n=t.length;for(let i=0;i<n;++i){let o=e.getExtension(t[i]);if(o)return o}}var M1e={};Object.defineProperties(wf.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},supportsTextureLod:{get:function(){return this._webgl2||this._supportsTextureLod}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=R1e(this._originalGLContext,e?I1e:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new Rt({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,0])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return this._defaultEmissiveTexture===void 0&&(this._defaultEmissiveTexture=new Rt({context:this,pixelFormat:ke.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return this._defaultNormalTexture===void 0&&(this._defaultNormalTexture=new Rt({context:this,pixelFormat:ke.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(this._defaultCubeMap===void 0){let e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new Go({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return M1e}}});function L1e(e){if(e.validateFramebuffer){let t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let i;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:i="Framebuffer is not complete.  Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached.  Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:i="Framebuffer is not complete.  Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:i="Framebuffer is not complete.  Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:i="Framebuffer is not complete.  Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";break}throw new E(i)}}}function qne(e,t,n,i){let o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,Ve.partialApply(e._gl,o,t,r,n,i)}var s6;typeof WebGLRenderingContext<"u"&&(s6=[ne.BACK]);function a6(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=s6;if(c(t))t._bind(),L1e(e),n=t._getActiveColorAttachments();else{let i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}var N1e=new ei;wf.prototype.clear=function(e,t){e=e??N1e,t=t??this._defaultPassState;let n=this._gl,i=0,o=e.color,r=e.depth,s=e.stencil;c(o)&&(G.equals(this._clearColor,o)||(G.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),c(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),c(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);let a=e.renderState??this._defaultRenderState;qne(this,a,t,!0);let l=e.framebuffer??t.framebuffer;a6(this,l),n.clear(i)};function F1e(e,t,n,i,o){if(c(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new E("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");a6(e,t),qne(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function B1e(e,t,n,i){let o=t._primitiveType,r=t._vertexArray,s=t._offset,a=t._count,l=t.instanceCount;if(!Me.validate(o))throw new E("drawCommand.primitiveType is required and must be valid.");if(T.defined("drawCommand.vertexArray",r),T.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),c(a)&&T.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),T.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",l,0),l>0&&!e.instancedArrays)throw new E("Instanced arrays extension is not supported");e._us.model=t._modelMatrix??B.IDENTITY,n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();let u=r.indexBuffer;c(u)?(s=s*u.bytesPerIndex,c(a)?a=Math.min(a,u.numberOfIndices):a=u.numberOfIndices,l===0?e._gl.drawElements(o,a,u.indexDatatype,s):e.glDrawElementsInstanced(o,a,u.indexDatatype,s,l)):(c(a)?a=Math.min(a,r.numberOfVertices):a=r.numberOfVertices,l===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,l)),r._unBind()}wf.prototype.draw=function(e,t,n,i){T.defined("drawCommand",e),T.defined("drawCommand.shaderProgram",e._shaderProgram),t=t??this._defaultPassState;let o=e._framebuffer??t.framebuffer,r=e._renderState??this._defaultRenderState;n=n??e._shaderProgram,i=i??e._uniformMap,F1e(this,o,t,n,r),B1e(this,e,n,i)};wf.prototype.endFrame=function(){let e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);let t=s6;this.drawBuffers&&this.glDrawBuffers(t);let n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let i=0;i<n;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)};wf.prototype.readPixels=function(e){let t=this._gl;e=e??W.EMPTY_OBJECT;let n=Math.max(e.x??0,0),i=Math.max(e.y??0,0),o=e.width??t.drawingBufferWidth,r=e.height??t.drawingBufferHeight,s=e.framebuffer;T.typeOf.number.greaterThan("readState.width",o,0),T.typeOf.number.greaterThan("readState.height",r,0);let a=Ue.UNSIGNED_BYTE;c(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);let l=ke.createTypedArray(ke.RGBA,a,o,r);return a6(this,s),t.readPixels(n,i,o,r,ke.RGBA,Ue.toWebGLConstant(a,this),l),l};var Yne={position:0,textureCoordinates:1};wf.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!c(e)){let t=new ct({attributes:{position:new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:Me.TRIANGLES});e=ti.fromGeometry({context:this,geometry:t,attributeLocations:Yne,bufferUsage:Be.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};wf.prototype.createViewportQuadCommand=function(e,t){return t=t??W.EMPTY_OBJECT,new Qe({vertexArray:this.getViewportQuadVertexArray(),primitiveType:Me.TRIANGLES,renderState:t.renderState,shaderProgram:Jt.fromCache({context:this,vertexShaderSource:mb,fragmentShaderSource:e,attributeLocations:Yne}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};wf.prototype.getObjectByPickColor=function(e){return T.defined("pickColor",e),this._pickObjects[e.toRgba()]};function c6(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(c6.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});c6.prototype.destroy=function(){delete this._pickObjects[this.key]};wf.prototype.createPickId=function(e){T.defined("object",e),++this._nextPickColor[0];let t=this._nextPickColor[0];if(t===0)throw new ae("Out of unique Pick IDs.");return this._pickObjects[t]=e,new c6(this._pickObjects,t,G.fromRgba(t))};wf.prototype.isDestroyed=function(){return!1};wf.prototype.destroy=function(){let e=this.cache;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];c(n.destroy)&&n.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),de(this)};var AI=wf;function pC(e){e=e??W.EMPTY_OBJECT;let{context:t,width:n,height:i,colorRenderbuffers:o,colorTextures:r,depthStencilRenderbuffer:s,depthStencilTexture:a,destroyAttachments:l}=e;if(T.defined("options.context",t),T.defined("options.width",n),T.defined("options.height",i),this._width=n,this._height=i,c(o)!==c(r))throw new E("Both color renderbuffer and texture attachments must be provided.");if(c(s)!==c(a))throw new E("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new Ur({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:l}),this._colorFramebuffer=new Ur({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:l})}pC.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};pC.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};pC.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();let n=e._gl,i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),c(this._colorFramebuffer.depthStencilTexture)&&(i|=n.DEPTH_BUFFER_BIT|(t?n.STENCIL_BUFFER_BIT:0)),n.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,i,n.NEAREST),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null)};pC.prototype.isDestroyed=function(){return!1};pC.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),de(this)};var CI=pC;var Rl={RGBA4:ne.RGBA4,RGBA8:ne.RGBA8,RGBA16F:ne.RGBA16F,RGBA32F:ne.RGBA32F,RGB5_A1:ne.RGB5_A1,RGB565:ne.RGB565,DEPTH_COMPONENT16:ne.DEPTH_COMPONENT16,STENCIL_INDEX8:ne.STENCIL_INDEX8,DEPTH_STENCIL:ne.DEPTH_STENCIL,DEPTH24_STENCIL8:ne.DEPTH24_STENCIL8,validate:function(e){return e===Rl.RGBA4||e===Rl.RGBA8||e===Rl.RGBA16F||e===Rl.RGBA32F||e===Rl.RGB5_A1||e===Rl.RGB565||e===Rl.DEPTH_COMPONENT16||e===Rl.STENCIL_INDEX8||e===Rl.DEPTH_STENCIL||e===Rl.DEPTH24_STENCIL8},getColorFormat:function(e){return e===ne.FLOAT?Rl.RGBA32F:e===ne.HALF_FLOAT_OES?Rl.RGBA16F:Rl.RGBA8}},uc=Object.freeze(Rl);function EI(e){e=e??W.EMPTY_OBJECT,T.defined("options.context",e.context);let n=e.context._gl,i=ut.maximumRenderbufferSize,o=e.format??uc.RGBA4,r=c(e.width)?e.width:n.drawingBufferWidth,s=c(e.height)?e.height:n.drawingBufferHeight,a=e.numSamples??1;if(!uc.validate(o))throw new E("Invalid format.");if(T.typeOf.number.greaterThan("width",r,0),r>i)throw new E(`Width must be less than or equal to the maximum renderbuffer size (${i}).  Check maximumRenderbufferSize.`);if(T.typeOf.number.greaterThan("height",s,0),s>i)throw new E(`Height must be less than or equal to the maximum renderbuffer size (${i}).  Check maximumRenderbufferSize.`);this._gl=n,this._format=o,this._width=r,this._height=s,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),a>1?n.renderbufferStorageMultisample(n.RENDERBUFFER,a,o,r,s):n.renderbufferStorage(n.RENDERBUFFER,o,r,s),n.bindRenderbuffer(n.RENDERBUFFER,null)}Object.defineProperties(EI.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});EI.prototype._getRenderbuffer=function(){return this._renderbuffer};EI.prototype.isDestroyed=function(){return!1};EI.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),de(this)};var _u=EI;function Ss(e){if(e=e??W.EMPTY_OBJECT,this._numSamples=e.numSamples??1,this._colorAttachmentsLength=e.colorAttachmentsLength??1,this._color=e.color??!0,this._depth=e.depth??!1,this._depthStencil=e.depthStencil??!1,this._supportsDepthTexture=e.supportsDepthTexture??!1,!this._color&&!this._depth&&!this._depthStencil)throw new E("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new E("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=e.createColorAttachments??!0,this._createDepthAttachments=e.createDepthAttachments??!0,this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(Ss.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}});Ss.prototype.isDirty=function(e,t,n,i,o){n=n??1;let r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=c(i)&&this._pixelDatatype!==i||c(o)&&this._pixelFormat!==o,l=n===1?c(this._framebuffer):c(this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!l||this._color&&!c(this._colorTextures[0])};Ss.prototype.update=function(e,t,n,i,o,r){if(!c(t)||!c(n))throw new E("width and height must be defined.");if(i=e.msaa?i??1:1,o=o??(this._color?this._pixelDatatype??Ue.UNSIGNED_BYTE:void 0),r=r??(this._color?this._pixelFormat??ke.RGBA:void 0),this.isDirty(t,n,i,o,r)){if(this.destroy(),this._width=t,this._height=n,this._numSamples=i,this._pixelDatatype=o,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments){for(let s=0;s<this._colorAttachmentsLength;++s)if(this._colorTextures[s]=new Rt({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:Qt.NEAREST}),this._numSamples>1){let a=uc.getColorFormat(o);this._colorRenderbuffers[s]=new _u({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new Rt({context:e,width:t,height:n,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8,sampler:Qt.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new _u({context:e,width:t,height:n,format:uc.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new _u({context:e,width:t,height:n,format:uc.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new Rt({context:e,width:t,height:n,pixelFormat:ke.DEPTH_COMPONENT,pixelDatatype:Ue.UNSIGNED_INT,sampler:Qt.NEAREST}):this._depthRenderbuffer=new _u({context:e,width:t,height:n,format:uc.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new CI({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new Ur({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};Ss.prototype.getColorTexture=function(e){if(e=e??0,e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorTextures[e]};Ss.prototype.setColorTexture=function(e,t){if(t=t??0,this._createColorAttachments)throw new E("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};Ss.prototype.getColorRenderbuffer=function(e){if(e=e??0,e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]};Ss.prototype.setColorRenderbuffer=function(e,t){if(t=t??0,this._createColorAttachments)throw new E("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};Ss.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};Ss.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};Ss.prototype.getDepthTexture=function(){return this._depthTexture};Ss.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};Ss.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};Ss.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};Ss.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};Ss.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};Ss.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};Ss.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};Ss.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};Ss.prototype.destroy=function(){if(this._color){let e=this._colorTextures,t=this._colorRenderbuffers;for(let n=0;n<e.length;++n){let i=e[n];this._createColorAttachments&&c(i)&&!i.isDestroyed()&&i.destroy(),c(i)&&i.isDestroyed()&&(e[n]=void 0);let o=t[n];this._createColorAttachments&&c(o)&&!o.isDestroyed()&&o.destroy(),c(o)&&o.isDestroyed()&&(t[n]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),c(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),c(this._depthStencilRenderbuffer)&&this._depthStencilRenderbuffer.isDestroyed()&&(this._depthStencilRenderbuffer=void 0)),this._depth&&(this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),c(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),c(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};var hi=Ss;function k1e(e,t,n){if(T.defined("context",e),T.defined("urls",t),Object.values(Go.FaceName).some(r=>!c(t[r])))throw new E("urls must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");let i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[we.createIfNeeded(t.positiveX).fetchImage(i),we.createIfNeeded(t.negativeX).fetchImage(i),we.createIfNeeded(t.positiveY).fetchImage(i),we.createIfNeeded(t.negativeY).fetchImage(i),we.createIfNeeded(t.positiveZ).fetchImage(i),we.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new Go({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}var SI=k1e;var Sb={VERTEX:0,FRAGMENT:1,BOTH:2};Sb.includesVertexShader=function(e){return T.typeOf.number("destination",e),e===Sb.VERTEX||e===Sb.BOTH};Sb.includesFragmentShader=function(e){return T.typeOf.number("destination",e),e===Sb.FRAGMENT||e===Sb.BOTH};var ge=Object.freeze(Sb);function l6(e){this.name=e,this.fields=[]}l6.prototype.addField=function(e,t){let n=`    ${e} ${t};`;this.fields.push(n)};l6.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=["    float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};var wI=l6;function u6(e){this.signature=e,this.body=[]}u6.prototype.addLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);let t=this.body;if(Array.isArray(e)){let n=e.length;for(let i=0;i<n;i++)t.push(`    ${e[i]}`)}else t.push(`    ${e}`)};u6.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};var vI=u6;function Hc(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}Object.defineProperties(Hc.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});Hc.prototype.addDefine=function(e,t,n){T.typeOf.string("identifier",e),n=n??ge.BOTH;let i=e;c(t)&&(i+=` ${t.toString()}`),ge.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),ge.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};Hc.prototype.addStruct=function(e,t,n){T.typeOf.string("structId",e),T.typeOf.string("structName",t),T.typeOf.number("destination",n),this._structs[e]=new wI(t),ge.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),ge.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};Hc.prototype.addStructField=function(e,t,n){T.typeOf.string("structId",e),T.typeOf.string("type",t),T.typeOf.string("identifier",n),this._structs[e].addField(t,n)};Hc.prototype.addFunction=function(e,t,n){T.typeOf.string("functionName",e),T.typeOf.string("signature",t),T.typeOf.number("destination",n),this._functions[e]=new vI(t),ge.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),ge.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};Hc.prototype.addFunctionLines=function(e,t){if(T.typeOf.string("functionName",e),typeof t!="string"&&!Array.isArray(t))throw new E(`Expected lines to be a string or an array of strings, actual value was ${t}`);this._functions[e].addLines(t)};Hc.prototype.addUniform=function(e,t,n){T.typeOf.string("type",e),T.typeOf.string("identifier",t),n=n??ge.BOTH;let i=`uniform ${e} ${t};`;ge.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),ge.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};Hc.prototype.setPositionAttribute=function(e,t){if(T.typeOf.string("type",e),T.typeOf.string("identifier",t),c(this._positionAttributeLine))throw new E("setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()");return this._positionAttributeLine=`in ${e} ${t};`,this._attributeLocations[t]=0,0};Hc.prototype.addAttribute=function(e,t){T.typeOf.string("type",e),T.typeOf.string("identifier",t);let n=`in ${e} ${t};`;this._attributeLines.push(n);let i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=V1e(e),i};Hc.prototype.addVarying=function(e,t,n){T.typeOf.string("type",e),T.typeOf.string("identifier",t),n=c(n)?`${n} `:"";let i=`${e} ${t};`;this._vertexShaderParts.varyingLines.push(`${n}out ${i}`),this._fragmentShaderParts.varyingLines.push(`${n}in ${i}`)};Hc.prototype.addVertexLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);let t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Hc.prototype.addFragmentLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);let t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Hc.prototype.buildShaderProgram=function(e){T.typeOf.object("context",e);let t=c(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=U1e(this),i=z1e(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
`),r=new He({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
`),a=new He({defines:this._fragmentShaderParts.defineLines,sources:[s]});return Jt.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};Hc.prototype.clone=function(){return je(this,!0)};function U1e(e){let t=[],n=[],i,o=e._vertexShaderParts.structIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.structIds,i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function V1e(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function z1e(e){let t=[],n=[],i,o=e._vertexShaderParts.functionIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.functionIds,i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}var wb=Hc;function DI({x:e,y:t,width:n,height:i}){this.rectangle=new Ke(e,t,n,i),this.childNode1=void 0,this.childNode2=void 0,this.index=void 0}function f6({width:e,height:t,borderPadding:n}){this._width=e,this._height=t,this._borderPadding=n,this._root=new DI({x:n,y:n,width:e-2*n,height:t-2*n})}f6.prototype.pack=function(e,{width:t,height:n}){T.typeOf.number.greaterThanOrEquals("index",e,0),T.typeOf.number.greaterThanOrEquals("image.width",t,1),T.typeOf.number.greaterThanOrEquals("image.height",n,1);let i=this._findNode(this._root,{width:t,height:n});if(c(i))return i.index=e,i};f6.prototype._findNode=function(e,{width:t,height:n}){if(c(e)){if(!c(e.childNode1)&&!c(e.childNode2)){if(c(e.index))return;let{rectangle:i}=e,o=i.width,r=i.height,s=o-t,a=r-n;return s<0||a<0?void 0:s===0&&a===0?e:s>a?(e.childNode1=new DI({x:i.x,y:i.y,width:t,height:r}),e.childNode2=new DI({x:i.x+t,y:i.y,width:s,height:r}),this._findNode(e.childNode1,{width:t,height:n})):(e.childNode1=new DI({x:i.x,y:i.y,width:o,height:n}),e.childNode2=new DI({x:i.x,y:i.y+n,width:o,height:a}),this._findNode(e.childNode1,{width:t,height:n}))}return this._findNode(e.childNode1,{width:t,height:n})||this._findNode(e.childNode2,{width:t,height:n})}};var _C=f6;var Xne=16;function Ml(e){e=e??W.EMPTY_OBJECT;let t=e.borderWidthInPixels??1,n=e.initialSize??new H(Xne,Xne);T.typeOf.number.greaterThanOrEquals("options.borderWidthInPixels",t,0),T.typeOf.number.greaterThan("options.initialSize.x",n.x,0),T.typeOf.number.greaterThan("options.initialSize.y",n.y,0),this._pixelFormat=e.pixelFormat??ke.RGBA,this._sampler=e.sampler,this._borderWidthInPixels=t,this._initialSize=n,this._texturePacker=void 0,this._rectangles=[],this._subRegions=new Map,this._guid=jn(),this._imagesToAddQueue=[],this._indexById=new Map,this._indexPromiseById=new Map,this._nextIndex=0}Object.defineProperties(Ml.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},rectangles:{get:function(){return this._rectangles}},texture:{get:function(){return this._texture}},pixelFormat:{get:function(){return this._pixelFormat}},sampler:{get:function(){return this._sampler}},numberOfImages:{get:function(){return this._nextIndex}},guid:{get:function(){return this._guid}},sizeInBytes:{get:function(){return c(this._texture)?this._texture.sizeInBytes:0}}});Ml.prototype.computeTextureCoordinates=function(e,t){T.typeOf.number.greaterThanOrEquals("index",e,0);let n=this._texture,i=this._rectangles[e];if(c(t)||(t=new Ke),!c(i))return t.x=0,t.y=0,t.width=0,t.height=0,t;let o=n.width,r=n.height,s=i.width,a=i.height,l=i.x,u=i.y,f=this._subRegions.get(e);if(c(f)){let h=this._rectangles[f];l+=h.x,u+=h.y}return t.x=l/o,t.y=u/r,t.width=s/o,t.height=a/r,t};Ml.prototype._copyFromTexture=function(e,t,n,i){let o=this._pixelFormat,r=this._sampler,s=new Rt({context:e,height:n,width:t,pixelFormat:o,sampler:r}),a=e._gl,l=s._textureTarget,u=this._texture,f=new Ur({context:e,colorTextures:[u],destroyAttachments:!1});a.activeTexture(a.TEXTURE0),a.bindTexture(l,s._texture),f._bind();let h=this.rectangles,p=this._subRegions;for(let g=0;g<h.length;++g){let m=i[g],y=h[g];if(!c(m)||!c(y)||c(p.get(g)))continue;let{x:b,y:x,width:A,height:C}=m;a.copyTexSubImage2D(l,0,b,x,y.x,y.y,A,C)}return a.bindTexture(l,null),s._initialized=!0,f._unBind(),f.destroy(),s};Ml.prototype._resize=function(e,t=0){let n=this._borderWidthInPixels,i=this._rectangles,o=this._imagesToAddQueue,r=this._texture,s=r.width,a=r.height,l=this._subRegions,u=i.map((A,C)=>new Kne({index:C,image:A})).filter((A,C)=>c(A.image)&&!c(l.get(C))),f=0,h=0,p=0;for(let A=t;A<o.length;++A){let{width:C,height:S}=o[A].image;f=Math.max(f,C),h=Math.max(h,S),p+=C*S,u.push(o[A])}s=Math.max(f,s),a=Math.max(h,a),e.webgl2||(s=O.nextPowerOfTwo(s),a=O.nextPowerOfTwo(a));let g=p,m=1;for(;g/s/a>=1;)m*=2,s>a?a*=m:s*=m;u.sort(({image:A},{image:C})=>C.height*C.width-A.height*A.width);let y=new Array(this._nextIndex);for(let A of this._subRegions.keys())c(l.get(A))&&(y[A]=i[A]);let b,x=!1;for(;!x;){b=new _C({height:a,width:s,borderPadding:n});let A;for(A=0;A<u.length;++A){let{index:C,image:S}=u[A];if(!c(S))continue;let v=b.pack(C,S);if(!c(v)){s>a?a*=2:s*=2;break}y[C]=v.rectangle}x=A===u.length}this._texturePacker=b,this._texture=this._copyFromTexture(e,s,a,y),r.destroy(),this._rectangles=y,this._guid=jn()};Ml.prototype.getImageIndex=function(e){return T.typeOf.string("id",e),this._indexById.get(e)};Ml.prototype._copyImageToTexture=function({index:e,image:t,resolve:n,reject:i}){let o=this._texture,r=this._rectangles[e];try{o.copyFrom({source:t,xOffset:r.x,yOffset:r.y}),c(n)&&n(e)}catch(s){if(c(i)){i(s);return}}};function Kne({index:e,image:t,resolve:n,reject:i}){this.index=e,this.image=t,this.resolve=n,this.reject=i,this.rectangle=void 0}Ml.prototype._addImage=function(e,t){return T.typeOf.number.greaterThanOrEquals("index",e,0),T.defined("image",t),new Promise((n,i)=>{this._imagesToAddQueue.push(new Kne({index:e,image:t,resolve:n,reject:i})),this._imagesToAddQueue.sort(({image:o},{image:r})=>r.height*r.width-o.height*o.width)})};Ml.prototype._processImageQueue=function(e){let t=this._imagesToAddQueue;if(t.length===0)return!1;this._rectangles.length=this._nextIndex;let n,i;for(n=0;n<t.length;++n){let o=t[n],{image:r,index:s}=o,a=this._texturePacker.pack(s,r);if(!c(a)){try{this._resize(e,n)}catch(l){i=l,c(o.reject)&&o.reject(i)}break}this._rectangles[s]=a.rectangle}if(c(i)){for(n=n+1;n<t.length;++n){let{resolve:o}=t[n];c(o)&&o(-1)}return t.length=0,!1}for(let o=0;o<t.length;++o)this._copyImageToTexture(t[o]);return t.length=0,!0};Ml.prototype.update=function(e){if(!c(this._texture)){let t=this._initialSize.x,n=this._initialSize.y,i=this._pixelFormat,o=this._sampler,r=this._borderWidthInPixels;this._texture=new Rt({context:e,width:t,height:n,pixelFormat:i,sampler:o}),this._texturePacker=new _C({height:n,width:t,borderPadding:r})}return this._processImageQueue(e)};async function H1e(e,t){return typeof e=="function"&&(e=e(t)),(typeof e=="string"||e instanceof we)&&(e=we.createIfNeeded(e).fetchImage()),e}Ml.prototype.addImage=function(e,t){T.typeOf.string("id",e),T.defined("image",t);let n=this._indexPromiseById.get(e);if(c(n))return n;let i=this._nextIndex++;return this._indexById.set(e,i),n=(async()=>(t=await H1e(t,e),T.defined("image",t),this.isDestroyed()||!c(t)?-1:this._addImage(i,t)))(),this._indexPromiseById.set(e,n),n};Ml.prototype.addImageSubRegion=function(e,t){T.typeOf.string("id",e),T.defined("subRegion",t);let n=this._indexById.get(e);if(!c(n))throw new ae(`image with id "${e}" not found in the atlas.`);let i=this._indexPromiseById.get(e);for(let[r,s]of this._subRegions.entries())if(n===s&&this._rectangles[r].equals(t))return i.then(l=>l===-1?-1:r);let o=this._nextIndex++;return this._subRegions.set(o,n),this._rectangles[o]=t.clone(),i.then(r=>{if(r===-1)return-1;let s=this._rectangles[r];return T.typeOf.number.lessThanOrEquals("subRegion.x",t.x,s.width),T.typeOf.number.lessThanOrEquals("subRegion.x + subRegion.width",t.x+t.width,s.width),T.typeOf.number.lessThanOrEquals("subRegion.y",t.y,s.height),T.typeOf.number.lessThanOrEquals("subRegion.y + subRegion.height",t.y+t.height,s.height),o})};Ml.prototype.isDestroyed=function(){return!1};Ml.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),this._imagesToAddQueue.forEach(({resolve:e})=>{c(e)&&e(-1)}),de(this)};var vb=Ml;function Gs(e,t,n,i){if(T.defined("context",e),!t||t.length===0)throw new E("At least one attribute is required.");let o=Gs._verifyAttributes(t);n=n??0;let r=[],s={},a,l,u=o.length;for(let h=0;h<u;++h){let p=o[h];if(p.vertexBuffer){r.push(p);continue}l=p.usage,a=s[l],c(a)||(a=s[l]=[]),a.push(p)}function f(h,p){return $.getSizeInBytes(p.componentDatatype)-$.getSizeInBytes(h.componentDatatype)}this._allBuffers=[];for(l in s)if(s.hasOwnProperty(l)){a=s[l],a.sort(f);let h=Gs._vertexSizeInBytes(a),p=a[0].usage,g={vertexSizeInBytes:h,vertexBuffer:void 0,usage:p,needsCommit:!1,arrayBuffer:void 0,arrayViews:Gs._createArrayViews(a,h)};this._allBuffers.push(g)}this._size=0,this._instanced=i??!1,this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}Gs._verifyAttributes=function(e){let t=[];for(let i=0;i<e.length;++i){let o=e[i],r={index:o.index??i,enabled:o.enabled??!0,componentsPerAttribute:o.componentsPerAttribute,componentDatatype:o.componentDatatype??$.FLOAT,normalize:o.normalize??!1,vertexBuffer:o.vertexBuffer,usage:o.usage??Be.STATIC_DRAW};if(t.push(r),r.componentsPerAttribute!==1&&r.componentsPerAttribute!==2&&r.componentsPerAttribute!==3&&r.componentsPerAttribute!==4)throw new E("attribute.componentsPerAttribute must be in the range [1, 4].");let s=r.componentDatatype;if(!$.validate(s))throw new E("Attribute must have a valid componentDatatype or not specify it.");if(!Be.validate(r.usage))throw new E("Attribute must have a valid usage or not specify it.")}let n=new Array(t.length);for(let i=0;i<t.length;++i){let r=t[i].index;if(n[r])throw new E(`Index ${r} is used by more than one attribute.`);n[r]=!0}return t};Gs._vertexSizeInBytes=function(e){let t=0,n=e.length;for(let s=0;s<n;++s){let a=e[s];t+=a.componentsPerAttribute*$.getSizeInBytes(a.componentDatatype)}let i=n>0?$.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};Gs._createArrayViews=function(e,t){let n=[],i=0,o=e.length;for(let r=0;r<o;++r){let s=e[r],a=s.componentDatatype;n.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:a,normalize:s.normalize,offsetInBytes:i,vertexSizeInComponentType:t/$.getSizeInBytes(a),view:void 0}),i+=s.componentsPerAttribute*$.getSizeInBytes(a)}return n};Gs.prototype.resize=function(e){this._size=e;let t=this._allBuffers;this.writers=[];for(let n=0,i=t.length;n<i;++n){let o=t[n];Gs._resize(o,this._size),Gs._appendWriters(this.writers,o)}d6(this)};Gs._resize=function(e,t){if(e.vertexSizeInBytes>0){let n=new ArrayBuffer(t*e.vertexSizeInBytes);if(c(e.arrayBuffer)){let r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let l=0;l<a;++l)r[l]=s[l]}let i=e.arrayViews,o=i.length;for(let r=0;r<o;++r){let s=i[r];s.view=$.createArrayBufferView(s.componentDatatype,n,s.offsetInBytes)}e.arrayBuffer=n}};var G1e=[function(e,t,n){return function(i,o){t[i*n]=o,e.needsCommit=!0}},function(e,t,n){return function(i,o,r){let s=i*n;t[s]=o,t[s+1]=r,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s){let a=i*n;t[a]=o,t[a+1]=r,t[a+2]=s,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s,a){let l=i*n;t[l]=o,t[l+1]=r,t[l+2]=s,t[l+3]=a,e.needsCommit=!0}}];Gs._appendWriters=function(e,t){let n=t.arrayViews,i=n.length;for(let o=0;o<i;++o){let r=n[o];e[r.index]=G1e[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};Gs.prototype.commit=function(e){let t=!1,n=this._allBuffers,i,o,r;for(o=0,r=n.length;o<r;++o)i=n[o],t=j1e(this,i)||t;if(t||!c(this.va)){d6(this);let s=this.va=[],a=O.SIXTY_FOUR_KILOBYTES-4,l=c(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let u=0;u<l;++u){let f=[];for(o=0,r=n.length;o<r;++o){i=n[o];let h=u*(i.vertexSizeInBytes*a);Gs._appendAttributes(f,i,h,this._instanced)}f=f.concat(this._precreated),s.push({va:new ti({context:this._context,attributes:f,indexBuffer:e}),indicesCount:1.5*(u!==l-1?a:this._size%a)})}}};function j1e(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;let n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=c(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=yt.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}Gs._appendAttributes=function(e,t,n,i){let o=t.arrayViews,r=o.length;for(let s=0;s<r;++s){let a=o[s];e.push({index:a.index,enabled:a.enabled,componentsPerAttribute:a.componentsPerAttribute,componentDatatype:a.componentDatatype,normalize:a.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:n+a.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:i?1:0})}};Gs.prototype.subCommit=function(e,t){if(e<0||e>=this._size)throw new E("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new E("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");let n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)W1e(n[i],e,t)};function W1e(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){let i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}Gs.prototype.endSubCommits=function(){let e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function d6(e){let t=e.va;if(!c(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}Gs.prototype.isDestroyed=function(){return!1};Gs.prototype.destroy=function(){let e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){let i=e[t];i.vertexBuffer=i.vertexBuffer&&i.vertexBuffer.destroy()}return d6(this),de(this)};var Mp=Gs;function Kg(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new pe,this.setValue(e)}Object.defineProperties(Kg.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});Kg.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};Kg.prototype.setValue=function(e){let t=this._value;if(t!==e){let n=c(e),i=n&&typeof e.clone=="function",o=n&&typeof e.equals=="function";(!o||!e.equals(t))&&(this._hasClone=i,this._hasEquals=o,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}};Kg.prototype.equals=function(e){return this===e||e instanceof Kg&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};Kg.prototype.valueOf=function(){return this._value};Kg.prototype.toString=function(){return String(this._value)};var Kn=Kg;function q1e(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(r){let s=this[t],a=this[n];c(a)&&(a(),this[n]=void 0),r!==void 0&&(!c(r)||!c(r.getValue))&&c(o)&&(r=o(r)),s!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,s)),c(r)&&c(r.definitionChanged)&&(this[n]=r.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,r,r)},this))}}}function Y1e(e){return new Kn(e)}function X1e(e,t,n){return q1e(e,`_${e.toString()}`,`_${e.toString()}Subscription`,t??!1,n??Y1e)}var fe=X1e;function PI(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this._splitDirection=void 0,this._splitDirectionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(PI.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),image:fe("image"),scale:fe("scale"),pixelOffset:fe("pixelOffset"),eyeOffset:fe("eyeOffset"),horizontalOrigin:fe("horizontalOrigin"),verticalOrigin:fe("verticalOrigin"),heightReference:fe("heightReference"),color:fe("color"),rotation:fe("rotation"),alignedAxis:fe("alignedAxis"),sizeInMeters:fe("sizeInMeters"),width:fe("width"),height:fe("height"),scaleByDistance:fe("scaleByDistance"),translucencyByDistance:fe("translucencyByDistance"),pixelOffsetScaleByDistance:fe("pixelOffsetScaleByDistance"),imageSubRegion:fe("imageSubRegion"),distanceDisplayCondition:fe("distanceDisplayCondition"),disableDepthTestDistance:fe("disableDepthTestDistance"),splitDirection:fe("splitDirection")});PI.prototype.clone=function(e){return c(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e.splitDirection=this._splitDirection,e):new PI(this)};PI.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this._show??e.show,this.image=this._image??e.image,this.scale=this._scale??e.scale,this.pixelOffset=this._pixelOffset??e.pixelOffset,this.eyeOffset=this._eyeOffset??e.eyeOffset,this.horizontalOrigin=this._horizontalOrigin??e.horizontalOrigin,this.verticalOrigin=this._verticalOrigin??e.verticalOrigin,this.heightReference=this._heightReference??e.heightReference,this.color=this._color??e.color,this.rotation=this._rotation??e.rotation,this.alignedAxis=this._alignedAxis??e.alignedAxis,this.sizeInMeters=this._sizeInMeters??e.sizeInMeters,this.width=this._width??e.width,this.height=this._height??e.height,this.scaleByDistance=this._scaleByDistance??e.scaleByDistance,this.translucencyByDistance=this._translucencyByDistance??e.translucencyByDistance,this.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance??e.pixelOffsetScaleByDistance,this.imageSubRegion=this._imageSubRegion??e.imageSubRegion,this.distanceDisplayCondition=this._distanceDisplayCondition??e.distanceDisplayCondition,this.disableDepthTestDistance=this._disableDepthTestDistance??e.disableDepthTestDistance,this.splitDirection=this.splitDirection??e.splitDirection};var fc=PI;function Db(){this._array=[],this._hash={}}Object.defineProperties(Db.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});Db.prototype.contains=function(e){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");return c(this._hash[e])};Db.prototype.set=function(e,t){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");let n=this._hash[e];t!==n&&(this.remove(e),this._hash[e]=t,this._array.push(t))};Db.prototype.get=function(e){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");return this._hash[e]};Db.prototype.remove=function(e){if(c(e)&&typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");let t=this._hash[e],n=c(t);if(n){let i=this._array;i.splice(i.indexOf(t),1),delete this._hash[e]}return n};Db.prototype.removeAll=function(){let e=this._array;e.length>0&&(this._hash={},e.length=0)};var Et=Db;function gu(e,t){e=e??0,this._near=e,t=t??Number.MAX_VALUE,this._far=t}Object.defineProperties(gu.prototype,{near:{get:function(){return this._near},set:function(e){this._near=e}},far:{get:function(){return this._far},set:function(e){this._far=e}}});gu.packedLength=2;gu.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,t[n++]=e.near,t[n]=e.far,t};gu.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=t??0,c(n)||(n=new gu),n.near=e[t++],n.far=e[t],n};gu.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.far===t.far};gu.clone=function(e,t){if(c(e))return c(t)||(t=new gu),t.near=e.near,t.far=e.far,t};gu.prototype.clone=function(e){return gu.clone(this,e)};gu.prototype.equals=function(e){return gu.equals(this,e)};var Mt=gu;function vf(e,t,n,i){this.near=e??0,this.nearValue=t??0,this.far=n??1,this.farValue=i??0}vf.clone=function(e,t){if(c(e))return c(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new vf(e.near,e.nearValue,e.far,e.farValue)};vf.packedLength=4;vf.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};vf.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=t??0,c(n)||(n=new vf),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};vf.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};vf.prototype.clone=function(e){return vf.clone(this,e)};vf.prototype.equals=function(e){return vf.equals(this,e)};var Bt=vf;var Pb={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2,CLAMP_TO_TERRAIN:3,RELATIVE_TO_TERRAIN:4,CLAMP_TO_3D_TILE:5,RELATIVE_TO_3D_TILE:6,CLIP_TO_GROUND:7},We=Object.freeze(Pb);function Df(e){return e===Pb.CLAMP_TO_GROUND||e===Pb.CLAMP_TO_3D_TILE||e===Pb.CLAMP_TO_TERRAIN}function gC(e){return e===Pb.RELATIVE_TO_GROUND||e===Pb.RELATIVE_TO_3D_TILE||e===Pb.RELATIVE_TO_TERRAIN}var K1e={CENTER:0,LEFT:1,RIGHT:-1},bi=Object.freeze(K1e);var $1e={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},Fn=Object.freeze($1e);var Z1e=Object.freeze({DONE:0,PENDING:1,FAILED:2}),lt=Z1e;function kd(){E.throwInstantiationError()}Object.defineProperties(kd.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});kd.prototype.getValue=E.throwInstantiationError;kd.prototype.equals=E.throwInstantiationError;kd.equals=function(e,t){return e===t||c(e)&&e.equals(t)};kd.arrayEquals=function(e,t){if(e===t)return!0;if(!c(e)||!c(t)||e.length!==t.length)return!1;let n=e.length;for(let i=0;i<n;i++)if(!kd.equals(e[i],t[i]))return!1;return!0};kd.isConstant=function(e){return!c(e)||e.isConstant};kd.getValueOrUndefined=function(e,t,n){return c(e)?e.getValue(t,n):void 0};kd.getValueOrDefault=function(e,t,n,i){return c(e)?e.getValue(t,i)??n:n};kd.getValueOrClonedDefault=function(e,t,n,i){let o;return c(e)&&(o=e.getValue(t,i)),c(o)||(o=n.clone(o)),o};var X=kd;var Q1e={LEFT:-1,NONE:0,RIGHT:1},Vr=Object.freeze(Q1e);var J1e=G.WHITE,eRe=d.ZERO,tRe=We.NONE,nRe=H.ZERO,iRe=1,oRe=0,rRe=d.ZERO,sRe=bi.CENTER,aRe=Fn.CENTER,cRe=!1,lRe=Vr.NONE,uRe=new d,fRe=new G,dRe=new d,hRe=new H,mRe=new Bt,pRe=new Bt,_Re=new Bt,gRe=new Ke,yRe=new Mt;function $ne(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function $g(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener($g.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Et,this._onCollectionChanged(t,t.values,[],[])}$g.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){let r=t[i],s=r.entity,a=s._billboard,l,u=r.billboard,f=s.isShowing&&s.isAvailable(e)&&X.getValueOrDefault(a._show,e,!0),h;if(f&&(h=X.getValueOrUndefined(s._position,e,uRe),l=X.getValueOrUndefined(a._image,e),f=c(h)&&c(l)),!f){h6(r,s,n);continue}X.isConstant(s._position)||(n._clusterDirty=!0),c(u)||(u=n.getBillboard(s),u.id=s,r.billboard=u,r.textureValue=void 0),u.show=f,r.textureValue!==l&&(u.image=l,r.textureValue=l),u.position=h,u.color=X.getValueOrDefault(a._color,e,J1e,fRe),u.eyeOffset=X.getValueOrDefault(a._eyeOffset,e,eRe,dRe),u.heightReference=X.getValueOrDefault(a._heightReference,e,tRe),u.pixelOffset=X.getValueOrDefault(a._pixelOffset,e,nRe,hRe),u.scale=X.getValueOrDefault(a._scale,e,iRe),u.rotation=X.getValueOrDefault(a._rotation,e,oRe),u.alignedAxis=X.getValueOrDefault(a._alignedAxis,e,rRe),u.horizontalOrigin=X.getValueOrDefault(a._horizontalOrigin,e,sRe),u.verticalOrigin=X.getValueOrDefault(a._verticalOrigin,e,aRe),u.width=X.getValueOrUndefined(a._width,e),u.height=X.getValueOrUndefined(a._height,e),u.scaleByDistance=X.getValueOrUndefined(a._scaleByDistance,e,mRe),u.translucencyByDistance=X.getValueOrUndefined(a._translucencyByDistance,e,pRe),u.pixelOffsetScaleByDistance=X.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,_Re),u.sizeInMeters=X.getValueOrDefault(a._sizeInMeters,e,cRe),u.distanceDisplayCondition=X.getValueOrUndefined(a._distanceDisplayCondition,e,yRe),u.disableDepthTestDistance=X.getValueOrUndefined(a._disableDepthTestDistance,e),u.splitDirection=X.getValueOrDefault(a._splitDirection,e,lRe);let p=X.getValueOrUndefined(a._imageSubRegion,e,gRe);c(p)&&u.setImageSubRegion(u.image,p)}return!0};$g.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");let n=this._items.get(e.id);if(!c(n)||!c(n.billboard))return lt.FAILED;let i=n.billboard;if(i.heightReference===We.NONE)t.center=d.clone(i.position,t.center);else{if(!c(i._clampedPosition))return lt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,lt.DONE};$g.prototype.isDestroyed=function(){return!1};$g.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener($g.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return de(this)};$g.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._billboard)&&c(r._position)&&s.set(r.id,new $ne(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._billboard)&&c(r._position)?s.contains(r.id)||s.set(r.id,new $ne(r)):(h6(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],h6(s.get(r.id),r,a),s.remove(r.id)};function h6(e,t,n){c(e)&&(e.billboard=void 0,n.removeBillboard(t))}var II=$g;var bRe=new d;function pm(e){e=e??W.EMPTY_OBJECT;let t=e.minimum,n=e.maximum;if(T.typeOf.object("min",t),T.typeOf.object("max",n),c(e.offsetAttribute)&&e.offsetAttribute===Zt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=d.clone(t),this._max=d.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}pm.fromDimensions=function(e){e=e??W.EMPTY_OBJECT;let t=e.dimensions;T.typeOf.object("dimensions",t),T.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),T.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),T.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);let n=d.multiplyByScalar(t,.5,new d);return new pm({minimum:d.negate(n,new d),maximum:n,offsetAttribute:e.offsetAttribute})};pm.fromAxisAlignedBoundingBox=function(e){return T.typeOf.object("boundindBox",e),new pm({minimum:e.minimum,maximum:e.maximum})};pm.packedLength=2*d.packedLength+1;pm.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,d.pack(e._min,t,n),d.pack(e._max,t,n+d.packedLength),t[n+d.packedLength*2]=e._offsetAttribute??-1,t};var Qne=new d,Jne=new d,Zne={minimum:Qne,maximum:Jne,offsetAttribute:void 0};pm.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=d.unpack(e,t,Qne),o=d.unpack(e,t+d.packedLength,Jne),r=e[t+d.packedLength*2];return c(n)?(n._min=d.clone(i,n._min),n._max=d.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(Zne.offsetAttribute=r===-1?void 0:r,new pm(Zne))};pm.createGeometry=function(e){let t=e._min,n=e._max;if(d.equals(t,n))return;let i=new fn,o=new Uint16Array(12*2),r=new Float64Array(8*3);r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=n.x,r[4]=t.y,r[5]=t.z,r[6]=n.x,r[7]=n.y,r[8]=t.z,r[9]=t.x,r[10]=n.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=n.z,r[15]=n.x,r[16]=t.y,r[17]=n.z,r[18]=n.x,r[19]=n.y,r[20]=n.z,r[21]=t.x,r[22]=n.y,r[23]=n.z,i.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:r}),o[0]=4,o[1]=5,o[2]=5,o[3]=6,o[4]=6,o[5]=7,o[6]=7,o[7]=4,o[8]=0,o[9]=1,o[10]=1,o[11]=2,o[12]=2,o[13]=3,o[14]=3,o[15]=0,o[16]=0,o[17]=4,o[18]=1,o[19]=5,o[20]=2,o[21]=6,o[22]=3,o[23]=7;let s=d.subtract(n,t,bRe),a=d.magnitude(s)*.5;if(c(e._offsetAttribute)){let l=r.length,u=e._offsetAttribute===Zt.NONE?0:1,f=new Uint8Array(l/3).fill(u);i.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new ct({attributes:i,indices:o,primitiveType:Me.LINES,boundingSphere:new le(d.ZERO,a),offsetAttribute:e._offsetAttribute})};var Ud=pm;function yC(e,t,n,i){e=e??1,t=t??1,n=n??1,i=i??1,this.value=new Uint8Array([G.floatToByte(e),G.floatToByte(t),G.floatToByte(n),G.floatToByte(i)])}Object.defineProperties(yC.prototype,{componentDatatype:{get:function(){return $.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});yC.fromColor=function(e){if(!c(e))throw new E("color is required.");return new yC(e.red,e.green,e.blue,e.alpha)};yC.toValue=function(e,t){if(!c(e))throw new E("color is required.");return c(t)?e.toBytes(t):new Uint8Array(e.toBytes())};yC.equals=function(e,t){return e===t||c(e)&&c(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]};var Gt=yC;function OI(e,t){if(e=e??0,t=t??Number.MAX_VALUE,t<=e)throw new E("far distance must be greater than near distance.");this.value=new Float32Array([e,t])}Object.defineProperties(OI.prototype,{componentDatatype:{get:function(){return $.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});OI.fromDistanceDisplayCondition=function(e){if(!c(e))throw new E("distanceDisplayCondition is required.");if(e.far<=e.near)throw new E("distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance.");return new OI(e.near,e.far)};OI.toValue=function(e,t){if(!c(e))throw new E("distanceDisplayCondition is required.");return c(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])};var kn=OI;function xRe(e){if(e=e??W.EMPTY_OBJECT,!c(e.geometry))throw new E("options.geometry is required.");this.geometry=e.geometry,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=e.attributes??{},this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}var St=xRe;function er(e){e=e??W.EMPTY_OBJECT,this.start=c(e.start)?Q.clone(e.start):new Q,this.stop=c(e.stop)?Q.clone(e.stop):new Q,this.data=e.data,this.isStartIncluded=e.isStartIncluded??!0,this.isStopIncluded=e.isStopIncluded??!0}Object.defineProperties(er.prototype,{isEmpty:{get:function(){let e=Q.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});var bC={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};er.fromIso8601=function(e,t){T.typeOf.object("options",e),T.typeOf.string("options.iso8601",e.iso8601);let n=e.iso8601.split("/");if(n.length!==2)throw new E("options.iso8601 is an invalid ISO 8601 interval.");let i=Q.fromIso8601(n[0]),o=Q.fromIso8601(n[1]),r=e.isStartIncluded??!0,s=e.isStopIncluded??!0,a=e.data;return c(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(bC.start=i,bC.stop=o,bC.isStartIncluded=r,bC.isStopIncluded=s,bC.data=a,new er(bC))};er.toIso8601=function(e,t){return T.typeOf.object("timeInterval",e),`${Q.toIso8601(e.start,t)}/${Q.toIso8601(e.stop,t)}`};er.clone=function(e,t){if(c(e))return c(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new er(e)};er.equals=function(e,t,n){return e===t||c(e)&&c(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&Q.equals(e.start,t.start)&&Q.equals(e.stop,t.stop)&&(e.data===t.data||c(n)&&n(e.data,t.data)))};er.equalsEpsilon=function(e,t,n,i){return n=n??0,e===t||c(e)&&c(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&Q.equalsEpsilon(e.start,t.start,n)&&Q.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||c(i)&&i(e.data,t.data)))};er.intersect=function(e,t,n,i){if(T.typeOf.object("left",e),!c(t))return er.clone(er.EMPTY,n);let o=e.start,r=e.stop,s=t.start,a=t.stop,l=Q.greaterThanOrEquals(s,o)&&Q.greaterThanOrEquals(r,s),u=!l&&Q.lessThanOrEquals(s,o)&&Q.lessThanOrEquals(o,a);if(!l&&!u)return er.clone(er.EMPTY,n);let f=e.isStartIncluded,h=e.isStopIncluded,p=t.isStartIncluded,g=t.isStopIncluded,m=Q.lessThan(r,a);return c(n)||(n=new er),n.start=l?s:o,n.isStartIncluded=f&&p||!Q.equals(s,o)&&(l&&p||u&&f),n.stop=m?r:a,n.isStopIncluded=m?h:h&&g||!Q.equals(a,r)&&g,n.data=c(i)?i(e.data,t.data):e.data,n};er.contains=function(e,t){if(T.typeOf.object("timeInterval",e),T.typeOf.object("julianDate",t),e.isEmpty)return!1;let n=Q.compare(e.start,t);if(n===0)return e.isStartIncluded;let i=Q.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};er.prototype.clone=function(e){return er.clone(this,e)};er.prototype.equals=function(e,t){return er.equals(this,e,t)};er.prototype.equalsEpsilon=function(e,t,n){return er.equalsEpsilon(this,e,t,n)};er.prototype.toString=function(){return er.toIso8601(this)};er.EMPTY=Object.freeze(new er({start:new Q,stop:new Q,isStartIncluded:!1,isStopIncluded:!1}));var En=er;var eie=Object.freeze(Q.fromIso8601("0000-01-01T00:00:00Z")),tie=Object.freeze(Q.fromIso8601("9999-12-31T24:00:00Z")),TRe=Object.freeze(new En({start:eie,stop:tie})),ARe={MINIMUM_VALUE:eie,MAXIMUM_VALUE:tie,MAXIMUM_INTERVAL:TRe},Ge=ARe;function RI(e,t,n){e=e??0,t=t??0,n=n??0,this.value=new Float32Array([e,t,n])}Object.defineProperties(RI.prototype,{componentDatatype:{get:function(){return $.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});RI.fromCartesian3=function(e){return T.defined("offset",e),new RI(e.x,e.y,e.z)};RI.toValue=function(e,t){return T.defined("offset",e),c(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};var eo=RI;function vV(e){e=e??!0,this.value=vV.toValue(e)}Object.defineProperties(vV.prototype,{componentDatatype:{get:function(){return $.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});vV.toValue=function(e,t){if(!c(e))throw new E("show is required.");return c(t)?(t[0]=e,t):new Uint8Array([e])};var bn=vV;var MI=`in vec3 v_positionEC;
in vec3 v_normalEC;
in vec3 v_tangentEC;
in vec3 v_bitangentEC;
in vec2 v_st;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;
materialInput.positionToEyeEC = positionToEyeEC;
materialInput.st = v_st;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var LI=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec3 tangent;
in vec3 bitangent;
in vec2 st;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out vec3 v_tangentEC;
out vec3 v_bitangentEC;
out vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_tangentEC = czm_normal * tangent;
v_bitangentEC = czm_normal * bitangent;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var NI=`in vec3 v_positionEC;
in vec3 v_normalEC;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var FI=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var BI=`in vec3 v_positionEC;
in vec3 v_normalEC;
in vec2 v_st;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
materialInput.st = v_st;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var kI=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec2 st;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var CRe={ADD:ne.FUNC_ADD,SUBTRACT:ne.FUNC_SUBTRACT,REVERSE_SUBTRACT:ne.FUNC_REVERSE_SUBTRACT,MIN:ne.MIN,MAX:ne.MAX},Fa=Object.freeze(CRe);var ERe={ZERO:ne.ZERO,ONE:ne.ONE,SOURCE_COLOR:ne.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:ne.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:ne.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:ne.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:ne.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:ne.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:ne.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:ne.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:ne.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:ne.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:ne.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:ne.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:ne.SRC_ALPHA_SATURATE},Eo=Object.freeze(ERe);var SRe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.SOURCE_ALPHA,functionSourceAlpha:Eo.ONE,functionDestinationRgb:Eo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Eo.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.ONE,functionSourceAlpha:Eo.ONE,functionDestinationRgb:Eo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Eo.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.SOURCE_ALPHA,functionSourceAlpha:Eo.ONE,functionDestinationRgb:Eo.ONE,functionDestinationAlpha:Eo.ONE})},ln=Object.freeze(SRe);var wRe={FRONT:ne.FRONT,BACK:ne.BACK,FRONT_AND_BACK:ne.FRONT_AND_BACK},xi=Object.freeze(wRe);function xC(e){e=e??W.EMPTY_OBJECT,this.material=e.material,this.translucent=e.translucent??!0,this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=e.closed??!1}Object.defineProperties(xC.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}});xC.prototype.getFragmentShaderSource=function(){let e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),c(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
`)};xC.prototype.isTranslucent=function(){return c(this.material)&&this.material.isTranslucent()||!c(this.material)&&this.translucent};xC.prototype.getRenderState=function(){let e=this.isTranslucent(),t=je(this.renderState,!1);return e?(t.depthMask=!1,t.blending=ln.ALPHA_BLEND):t.depthMask=!0,t};xC.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=ln.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:xi.BACK}),c(n)&&(i=xt(n,i,!0)),i};var io=xC;var UI=`uniform sampler2D image;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var VI=`uniform sampler2D image;
uniform float strength;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
vec2 centerPixel = fract(repeat * st);
float centerBump = texture(image, centerPixel).channel;
float imageWidth = float(imageDimensions.x);
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
float rightBump = texture(image, rightPixel).channel;
float imageHeight = float(imageDimensions.y);
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
float topBump = texture(image, leftPixel).channel;
vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
material.normal = normalEC;
material.diffuse = vec3(0.01);
return material;
}
`;var zI=`uniform vec4 lightColor;
uniform vec4 darkColor;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);
float scaledWidth = fract(repeat.s * st.s);
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
float scaledHeight = fract(repeat.t * st.t);
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
float value = min(scaledWidth, scaledHeight);
vec4 currentColor = mix(lightColor, darkColor, b);
vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var HI=`uniform vec4 lightColor;
uniform vec4 darkColor;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));
vec4 color = mix(lightColor, darkColor, b);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var GI=`uniform sampler2D heights;
uniform sampler2D colors;
float getHeight(int idx, float invTexSize)
{
vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);
#ifdef OES_texture_float
return texture(heights, uv).x;
#else
return czm_unpackFloat(texture(heights, uv));
#endif
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float height = materialInput.height;
float invTexSize = 1.0 / float(heightsDimensions.x);
float minHeight = getHeight(0, invTexSize);
float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);
if (height < minHeight || height > maxHeight) {
material.diffuse = vec3(0.0);
material.alpha = 0.0;
return material;
}
int idxBelow = 0;
int idxAbove = heightsDimensions.x;
float heightBelow = minHeight;
float heightAbove = maxHeight;
const int maxIterations = 16;
for (int i = 0; i < maxIterations; i++) {
if (idxBelow >= idxAbove - 1) {
break;
}
int idxMid = (idxBelow + idxAbove) / 2;
float heightTex = getHeight(idxMid, invTexSize);
if (height > heightTex) {
idxBelow = idxMid;
heightBelow = heightTex;
} else {
idxAbove = idxMid;
heightAbove = heightTex;
}
}
float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);
vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);
vec4 color = texture(colors, colorUv);
if (color.a > 0.0)
{
color.rgb /= color.a;
}
color.rgb = czm_gammaCorrect(color.rgb);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var jI=`uniform vec4 color;
uniform float spacing;
uniform float width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float distanceToContour = mod(materialInput.height, spacing);
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
float dxc = abs(dFdx(materialInput.height));
float dyc = abs(dFdy(materialInput.height));
float dF = max(dxc, dyc) * czm_pixelRatio * width;
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
#else
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
#endif
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var WI=`uniform sampler2D image;
uniform float minimumHeight;
uniform float maximumHeight;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);
vec4 rampColor = texture(image, vec2(scaledHeight, 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var qI=`uniform vec4 fadeInColor;
uniform vec4 fadeOutColor;
uniform float maximumDistance;
uniform bool repeat;
uniform vec2 fadeDirection;
uniform vec2 time;
float getTime(float t, float coord)
{
float scalar = 1.0 / maximumDistance;
float q  = distance(t, coord) * scalar;
if (repeat)
{
float r = distance(t, coord + 1.0) * scalar;
float s = distance(t, coord - 1.0) * scalar;
q = min(min(r, s), q);
}
return clamp(q, 0.0, 1.0);
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float s = getTime(time.x, st.s) * fadeDirection.s;
float t = getTime(time.y, st.t) * fadeDirection.t;
float u = length(vec2(s, t));
vec4 color = mix(fadeInColor, fadeOutColor, u);
color = czm_gammaCorrect(color);
material.emission = color.rgb;
material.alpha = color.a;
return material;
}
`;var YI=`uniform vec4 color;
uniform float cellAlpha;
uniform vec2 lineCount;
uniform vec2 lineThickness;
uniform vec2 lineOffset;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
float value;
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
const float fuzz = 1.2;
vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;
vec2 dx = abs(dFdx(st));
vec2 dy = abs(dFdy(st));
vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;
value = min(
smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),
smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));
#else
const float fuzz = 0.05;
vec2 range = 0.5 - (lineThickness * 0.05);
value = min(
1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),
1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));
#endif
float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));
float sRim = smoothstep(0.8, 1.0, dRim);
value *= (1.0 - sRim);
vec4 halfColor;
halfColor.rgb = color.rgb * 0.5;
halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));
halfColor = czm_gammaCorrect(halfColor);
material.diffuse = halfColor.rgb;
material.emission = halfColor.rgb;
material.alpha = halfColor.a;
return material;
}
`;var XI=`uniform sampler2D image;
uniform float strength;
uniform vec2 repeat;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 textureValue = texture(image, fract(repeat * materialInput.st));
vec3 normalTangentSpace = textureValue.channels;
normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;
normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);
normalTangentSpace = normalize(normalTangentSpace);
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
material.normal = normalEC;
return material;
}
`;var KI=`uniform vec4 color;
float getPointOnLine(vec2 p0, vec2 p1, float x)
{
float slope = (p0.y - p1.y) / (p0.x - p1.x);
return slope * (x - p0.x) + p0.y;
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;
#else
float base = 0.975;
#endif
vec2 center = vec2(1.0, 0.5);
float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);
float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);
float halfWidth = 0.15;
float s = step(0.5 - halfWidth, st.t);
s *= 1.0 - step(0.5 + halfWidth, st.t);
s *= 1.0 - step(base, st.s);
float t = step(base, materialInput.st.s);
t *= 1.0 - step(ptOnUpperLine, st.t);
t *= step(ptOnLowerLine, st.t);
float dist;
if (st.s < base)
{
float d1 = abs(st.t - (0.5 - halfWidth));
float d2 = abs(st.t - (0.5 + halfWidth));
dist = min(d1, d2);
}
else
{
float d1 = czm_infinity;
if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)
{
d1 = abs(st.s - base);
}
float d2 = abs(st.t - ptOnUpperLine);
float d3 = abs(st.t - ptOnLowerLine);
dist = min(min(d1, d2), d3);
}
vec4 outsideColor = vec4(0.0);
vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));
vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var $I=`uniform vec4 color;
uniform vec4 gapColor;
uniform float dashLength;
uniform float dashPattern;
in float v_polylineAngle;
const float maskLength = 16.0;
mat2 rotate(float rad) {
float c = cos(rad);
float s = sin(rad);
return mat2(
c, s,
-s, c
);
}
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));
float maskIndex = floor(dashPosition * maskLength);
float maskTest = floor(dashPattern / pow(2.0, maskIndex));
vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;
if (fragColor.a < 0.005) {
discard;
}
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`;var ZI=`uniform vec4 color;
uniform float glowPower;
uniform float taperPower;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);
if (taperPower <= 0.99999) {
glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));
}
vec4 fragColor;
fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);
fragColor.a = clamp(0.0, 1.0, glow) * color.a;
fragColor = czm_gammaCorrect(fragColor);
material.emission = fragColor.rgb;
material.alpha = fragColor.a;
return material;
}
`;var QI=`uniform vec4 color;
uniform vec4 outlineColor;
uniform float outlineWidth;
in float v_width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec2 st = materialInput.st;
float halfInteriorWidth =  0.5 * (v_width - outlineWidth) / v_width;
float b = step(0.5 - halfInteriorWidth, st.t);
b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);
float d1 = abs(st.t - (0.5 - halfInteriorWidth));
float d2 = abs(st.t - (0.5 + halfInteriorWidth));
float dist = min(d1, d2);
vec4 currentColor = mix(outlineColor, color, b);
vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var JI=`uniform vec4 color;
uniform vec4 rimColor;
uniform float width;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));
float s = smoothstep(1.0 - width, 1.0, d);
vec4 outColor = czm_gammaCorrect(color);
vec4 outRimColor = czm_gammaCorrect(rimColor);
material.diffuse = outColor.rgb;
material.emission = outRimColor.rgb * s;
material.alpha = mix(outColor.a, outRimColor.a, s);
return material;
}
`;var eO=`uniform sampler2D image;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 rampColor = texture(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));
rampColor = czm_gammaCorrect(rampColor);
material.diffuse = rampColor.rgb;
material.alpha = rampColor.a;
return material;
}
`;var tO=`uniform vec4 evenColor;
uniform vec4 oddColor;
uniform float offset;
uniform float repeat;
uniform bool horizontal;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));
float value = fract((coord - offset) * (repeat * 0.5));
float dist = min(value, min(abs(value - 0.5), 1.0 - value));
vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));
vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);
color = czm_gammaCorrect(color);
material.diffuse = color.rgb;
material.alpha = color.a;
return material;
}
`;var nO=`uniform vec4 waterColor;
uniform vec4 landColor;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
vec4 outColor = mix(landColor, waterColor, materialInput.waterMask);
outColor = czm_gammaCorrect(outColor);
material.diffuse = outColor.rgb;
material.alpha = outColor.a;
return material;
}
`;var iO=`uniform sampler2D specularMap;
uniform sampler2D normalMap;
uniform vec4 baseWaterColor;
uniform vec4 blendColor;
uniform float frequency;
uniform float animationSpeed;
uniform float amplitude;
uniform float specularIntensity;
uniform float fadeFactor;
czm_material czm_getMaterial(czm_materialInput materialInput)
{
czm_material material = czm_getDefaultMaterial(materialInput);
float time = czm_frameNumber * animationSpeed;
float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);
float specularMapValue = texture(specularMap, materialInput.st).r;
vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);
vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));
normalTangentSpace.xy /= fade;
normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);
normalTangentSpace = normalize(normalTangentSpace);
float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);
material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;
material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);
material.diffuse += (0.1 * tsPerturbationRatio);
material.diffuse = material.diffuse;
material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);
material.specular = specularIntensity;
material.shininess = 10.0;
return material;
}
`;function Ye(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=e.minificationFilter??Yt.LINEAR,this._magnificationFilter=e.magnificationFilter??li.LINEAR,this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,vRe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),c(Ye._uniformList[this.type])||(Ye._uniformList[this.type]=Object.keys(this._uniforms))}Ye._uniformList={};Ye.fromType=function(e,t){if(!c(Ye._materialCache.getMaterial(e)))throw new E(`material with type '${e}' does not exist.`);let n=new Ye({fabric:{type:e}});if(c(t))for(let i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};Ye.prototype.isTranslucent=function(){if(c(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0,t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){let o=t[i];if(typeof o=="function"?e=e&&o():e=e&&o,!e)break}return e};Ye.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n,i=this._loadedImages,o=i.length;for(t=0;t<o;++t){let l=i[t];n=l.id;let u=l.image,f;Array.isArray(u)&&(f=u.slice(1,u.length).map(function(y){return y.bufferView}),u=u[0]);let h=new Qt({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter}),p;c(u.internalFormat)?p=new Rt({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:f},sampler:h}):p=new Rt({context:e,source:u,sampler:h});let g=this._textures[n];c(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=p;let m=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(m)){let y=this.uniforms[m];y.x=p._width,y.y=p._height}}i.length=0;let r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){let l=r[t];n=l.id;let u=l.images,f=new Go({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new Qt({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=f}r.length=0;let s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);let a=this.materials;for(let l in a)a.hasOwnProperty(l)&&a[l].update(e)};Ye.prototype.isDestroyed=function(){return!1};Ye.prototype.destroy=function(){let e=this._textures;for(let n in e)if(e.hasOwnProperty(n)){let i=e[n];i!==this._defaultTexture&&i.destroy()}let t=this.materials;for(let n in t)t.hasOwnProperty(n)&&t[n].destroy();return de(this)};function vRe(e,t){e=e??W.EMPTY_OBJECT,t._strict=e.strict??!1,t._count=e.count??0,t._template=je(e.fabric??W.EMPTY_OBJECT),t._template.uniforms=je(t._template.uniforms??W.EMPTY_OBJECT),t._template.materials=je(t._template.materials??W.EMPTY_OBJECT),t.type=c(t._template.type)?t._template.type:jn(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n,i=Ye._materialCache.getMaterial(t.type);if(c(i)){let r=je(i.fabric,!0);t._template=xt(t._template,r,!0),n=i.translucent}ORe(t),c(i)||Ye._materialCache.addMaterial(t.type,t),MRe(t),BRe(t),URe(t);let o=t._translucentFunctions.length===0?!0:void 0;if(n=n??o,n=e.translucent??n,c(n))if(typeof n=="function"){let r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function m6(e,t,n,i){if(c(e)){for(let o in e)if(e.hasOwnProperty(o)){let r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function nie(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){let o=`'${t[i]}'`;n+=i===t.length-1?`or ${o}.`:`${o}, `}throw new E(n)}function DRe(e,t){let n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new E(n)}var PRe=["type","materials","uniforms","components","source"],IRe=["diffuse","specular","shininess","normal","emission","alpha"];function ORe(e){let t=e._template,n=t.uniforms,i=t.materials,o=t.components;if(c(o)&&c(t.source))throw new E("fabric: cannot have source and components in the same template.");m6(t,PRe,nie,!0),m6(o,IRe,nie,!0);let r=[];for(let s in i)i.hasOwnProperty(s)&&r.push(s);m6(n,r,DRe,!1)}function RRe(e,t){let n=t._template.materials;for(let i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}function MRe(e){let t=e._template.components,n=e._template.source;if(c(n))e.shaderSource+=`${n}
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
{
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
`,c(t)){let i=Object.keys(e._template.materials).length>0;for(let o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){let s=i&&RRe(t[o],e)?t[o]:`czm_gammaCorrect(${t[o]})`;e.shaderSource+=`material.${o} = ${s}; 
`}else o==="alpha"?e.shaderSource+=`material.alpha = ${t.alpha}; 
`:e.shaderSource+=`material.${o} = ${t[o]};
`}e.shaderSource+=`return material;
}
`}}var iie={mat2:Ri,mat3:J,mat4:B},LRe=/\.ktx2$/i;function NRe(e){let t;return function(n,i){let o=n.uniforms,r=o[e],s=t!==r,a=!c(r)||r===Ye.DefaultImageId;t=r;let l=n._textures[e],u,f;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&c(l)&&(l!==i.defaultTexture&&l.destroy(),l=void 0),!c(l)||l===i.defaultTexture){let p=new Qt({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});l=new Rt({context:i,source:r,sampler:p}),n._textures[e]=l;return}l.copyFrom({source:r})}else c(l)||(n._textures[e]=i.defaultTexture);return}if(r instanceof Rt&&r!==l){n._texturePaths[e]=void 0;let p=n._textures[e];c(p)&&p!==n._defaultTexture&&p.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=r._width,f.y=r._height);return}if(s&&c(l)&&a&&(l!==n._defaultTexture&&l.destroy(),l=void 0),c(l)||(n._texturePaths[e]=void 0,l=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=l._width,f.y=l._height)),a)return;let h=r instanceof we;if(!c(n._texturePaths[e])||h&&r.url!==n._texturePaths[e].url||!h&&r!==n._texturePaths[e]){if(typeof r=="string"||h){let p=h?r:we.createIfNeeded(r),g;LRe.test(p.url)?g=Il(p.url):g=p.fetchImage(),Promise.resolve(g).then(function(m){n._loadedImages.push({id:e,image:m})}).catch(function(){c(l)&&l!==n._defaultTexture&&l.destroy(),n._textures[e]=n._defaultTexture})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}function FRe(e){return function(t,n){let i=t.uniforms[e];if(i instanceof Go){let r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(c(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===Ye.DefaultCubeMapId)return;let o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){let r=[we.createIfNeeded(i.positiveX).fetchImage(),we.createIfNeeded(i.negativeX).fetchImage(),we.createIfNeeded(i.positiveY).fetchImage(),we.createIfNeeded(i.negativeY).fetchImage(),we.createIfNeeded(i.positiveZ).fetchImage(),we.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function BRe(e){let t=e._template.uniforms;for(let n in t)t.hasOwnProperty(n)&&oie(e,n)}function oie(e,t){let n=e._strict,i=e._template.uniforms,o=i[t],r=kRe(o);if(!c(r))throw new E(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=oO(e,t,o,!1),s===0&&n)throw new E(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){let u=`${t}Dimensions`;VRe(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},oie(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){let u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}let l=`${t}_${e._count++}`;if(s=oO(e,t,l),s===1&&n)throw new E(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(NRe(t));else if(r==="samplerCube")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(FRe(t));else if(r.indexOf("mat")!==-1){let u=new iie[r];e._uniforms[l]=function(){return iie[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[l]=function(){return e.uniforms[t]}}}function kRe(e){let t=e.type;if(!c(t)){let n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof we||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===Ye.DefaultCubeMapId?t="samplerCube":t="sampler2D";else if(n==="object")if(Array.isArray(e))(e.length===4||e.length===9||e.length===16)&&(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(let o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function URe(e){let t=e._strict,n=e._template.materials;for(let i in n)if(n.hasOwnProperty(i)){let o=new Ye({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=xt(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);let r="czm_getMaterial",s=`${r}_${e._count++}`;oO(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;let a=`${s}(materialInput)`;if(oO(e,i,a)===0&&t)throw new E(`strict: shader source does not use material '${i}'.`)}}function oO(e,t,n,i){i=i??!0;let o=0,r="([\\w])?",s=`([\\w${i?".":""}])?`,a=new RegExp(s+t+r,"g");return e.shaderSource=e.shaderSource.replace(a,function(l,u,f){return u||f?l:(o+=1,n)}),o}function VRe(e,t,n){return oO(e,t,t,n)}Ye._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};Ye.DefaultImageId="czm_defaultImage";Ye.DefaultCubeMapId="czm_defaultCubeMap";Ye.ColorType="Color";Ye._materialCache.addMaterial(Ye.ColorType,{fabric:{type:Ye.ColorType,uniforms:{color:new G(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Ye.ImageType="Image";Ye._materialCache.addMaterial(Ye.ImageType,{fabric:{type:Ye.ImageType,uniforms:{image:Ye.DefaultImageId,repeat:new H(1,1),color:new G(1,1,1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Ye.DiffuseMapType="DiffuseMap";Ye._materialCache.addMaterial(Ye.DiffuseMapType,{fabric:{type:Ye.DiffuseMapType,uniforms:{image:Ye.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Ye.AlphaMapType="AlphaMap";Ye._materialCache.addMaterial(Ye.AlphaMapType,{fabric:{type:Ye.AlphaMapType,uniforms:{image:Ye.DefaultImageId,channel:"a",repeat:new H(1,1)},components:{alpha:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});Ye.SpecularMapType="SpecularMap";Ye._materialCache.addMaterial(Ye.SpecularMapType,{fabric:{type:Ye.SpecularMapType,uniforms:{image:Ye.DefaultImageId,channel:"r",repeat:new H(1,1)},components:{specular:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});Ye.EmissionMapType="EmissionMap";Ye._materialCache.addMaterial(Ye.EmissionMapType,{fabric:{type:Ye.EmissionMapType,uniforms:{image:Ye.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{emission:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Ye.BumpMapType="BumpMap";Ye._materialCache.addMaterial(Ye.BumpMapType,{fabric:{type:Ye.BumpMapType,uniforms:{image:Ye.DefaultImageId,channel:"r",strength:.8,repeat:new H(1,1)},source:VI},translucent:!1});Ye.NormalMapType="NormalMap";Ye._materialCache.addMaterial(Ye.NormalMapType,{fabric:{type:Ye.NormalMapType,uniforms:{image:Ye.DefaultImageId,channels:"rgb",strength:.8,repeat:new H(1,1)},source:XI},translucent:!1});Ye.GridType="Grid";Ye._materialCache.addMaterial(Ye.GridType,{fabric:{type:Ye.GridType,uniforms:{color:new G(0,1,0,1),cellAlpha:.1,lineCount:new H(8,8),lineThickness:new H(1,1),lineOffset:new H(0,0)},source:YI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});Ye.StripeType="Stripe";Ye._materialCache.addMaterial(Ye.StripeType,{fabric:{type:Ye.StripeType,uniforms:{horizontal:!0,evenColor:new G(1,1,1,.5),oddColor:new G(0,0,1,.5),offset:0,repeat:5},source:tO},translucent:function(e){let t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});Ye.CheckerboardType="Checkerboard";Ye._materialCache.addMaterial(Ye.CheckerboardType,{fabric:{type:Ye.CheckerboardType,uniforms:{lightColor:new G(1,1,1,.5),darkColor:new G(0,0,0,.5),repeat:new H(5,5)},source:zI},translucent:function(e){let t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Ye.DotType="Dot";Ye._materialCache.addMaterial(Ye.DotType,{fabric:{type:Ye.DotType,uniforms:{lightColor:new G(1,1,0,.75),darkColor:new G(0,1,1,.75),repeat:new H(5,5)},source:HI},translucent:function(e){let t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Ye.WaterType="Water";Ye._materialCache.addMaterial(Ye.WaterType,{fabric:{type:Ye.WaterType,uniforms:{baseWaterColor:new G(.2,.3,.6,1),blendColor:new G(0,1,.699,1),specularMap:Ye.DefaultImageId,normalMap:Ye.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:iO},translucent:function(e){let t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});Ye.RimLightingType="RimLighting";Ye._materialCache.addMaterial(Ye.RimLightingType,{fabric:{type:Ye.RimLightingType,uniforms:{color:new G(1,0,0,.7),rimColor:new G(1,1,1,.4),width:.3},source:JI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});Ye.FadeType="Fade";Ye._materialCache.addMaterial(Ye.FadeType,{fabric:{type:Ye.FadeType,uniforms:{fadeInColor:new G(1,0,0,1),fadeOutColor:new G(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new H(.5,.5)},source:qI},translucent:function(e){let t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});Ye.PolylineArrowType="PolylineArrow";Ye._materialCache.addMaterial(Ye.PolylineArrowType,{fabric:{type:Ye.PolylineArrowType,uniforms:{color:new G(1,1,1,1)},source:KI},translucent:!0});Ye.PolylineDashType="PolylineDash";Ye._materialCache.addMaterial(Ye.PolylineDashType,{fabric:{type:Ye.PolylineDashType,uniforms:{color:new G(1,0,1,1),gapColor:new G(0,0,0,0),dashLength:16,dashPattern:255},source:$I},translucent:!0});Ye.PolylineGlowType="PolylineGlow";Ye._materialCache.addMaterial(Ye.PolylineGlowType,{fabric:{type:Ye.PolylineGlowType,uniforms:{color:new G(0,.5,1,1),glowPower:.25,taperPower:1},source:ZI},translucent:!0});Ye.PolylineOutlineType="PolylineOutline";Ye._materialCache.addMaterial(Ye.PolylineOutlineType,{fabric:{type:Ye.PolylineOutlineType,uniforms:{color:new G(1,1,1,1),outlineColor:new G(1,0,0,1),outlineWidth:1},source:QI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});Ye.ElevationContourType="ElevationContour";Ye._materialCache.addMaterial(Ye.ElevationContourType,{fabric:{type:Ye.ElevationContourType,uniforms:{spacing:100,color:new G(1,0,0,1),width:1},source:jI},translucent:!1});Ye.ElevationRampType="ElevationRamp";Ye._materialCache.addMaterial(Ye.ElevationRampType,{fabric:{type:Ye.ElevationRampType,uniforms:{image:Ye.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:WI},translucent:!1});Ye.SlopeRampMaterialType="SlopeRamp";Ye._materialCache.addMaterial(Ye.SlopeRampMaterialType,{fabric:{type:Ye.SlopeRampMaterialType,uniforms:{image:Ye.DefaultImageId},source:eO},translucent:!1});Ye.AspectRampMaterialType="AspectRamp";Ye._materialCache.addMaterial(Ye.AspectRampMaterialType,{fabric:{type:Ye.AspectRampMaterialType,uniforms:{image:Ye.DefaultImageId},source:UI},translucent:!1});Ye.ElevationBandType="ElevationBand";Ye._materialCache.addMaterial(Ye.ElevationBandType,{fabric:{type:Ye.ElevationBandType,uniforms:{heights:Ye.DefaultImageId,colors:Ye.DefaultImageId},source:GI},translucent:!0});Ye.WaterMaskType="WaterMask";Ye._materialCache.addMaterial(Ye.WaterMaskType,{fabric:{type:Ye.WaterMaskType,source:nO,uniforms:{waterColor:new G(1,1,1,1),landColor:new G(0,0,0,0)}},translucent:!1});var Xi=Ye;function Ib(e){e=e??W.EMPTY_OBJECT;let t=e.translucent??!0,n=e.closed??!1,i=e.materialSupport??Ib.MaterialSupport.TEXTURED;this.material=c(e.material)?e.material:Xi.fromType(Xi.ColorType),this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??i.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource??i.fragmentShaderSource,this._renderState=io.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=e.flat??!1,this._faceForward=e.faceForward??!n}Object.defineProperties(Ib.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});Ib.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;Ib.prototype.isTranslucent=io.prototype.isTranslucent;Ib.prototype.getRenderState=io.prototype.getRenderState;Ib.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ie.POSITION_AND_NORMAL,vertexShaderSource:FI,fragmentShaderSource:NI}),TEXTURED:Object.freeze({vertexFormat:Ie.POSITION_NORMAL_AND_ST,vertexShaderSource:kI,fragmentShaderSource:BI}),ALL:Object.freeze({vertexFormat:Ie.ALL,vertexShaderSource:LI,fragmentShaderSource:MI})};var ao=Ib;var rO=`in vec3 v_positionEC;
in vec3 v_normalEC;
in vec4 v_color;
void main()
{
vec3 positionToEyeEC = -v_positionEC;
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
vec4 color = czm_gammaCorrect(v_color);
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = color.rgb;
material.alpha = color.a;
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
}
`;var sO=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 normal;
in vec4 color;
in float batchId;
out vec3 v_positionEC;
out vec3 v_normalEC;
out vec4 v_color;
void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_normalEC = czm_normal * normal;
v_color = color;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var Ob=`in vec4 v_color;
void main()
{
out_FragColor = czm_gammaCorrect(v_color);
}
`;var aO=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec4 color;
in float batchId;
out vec4 v_color;
void main()
{
vec4 p = czm_computePosition();
v_color = color;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function Lp(e){e=e??W.EMPTY_OBJECT;let t=e.translucent??!0,n=e.closed??!1,i=e.flat??!1,o=i?aO:sO,r=i?Ob:rO,s=i?Lp.FLAT_VERTEX_FORMAT:Lp.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??o,this._fragmentShaderSource=e.fragmentShaderSource??r,this._renderState=io.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=e.faceForward??!n}Object.defineProperties(Lp.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});Lp.VERTEX_FORMAT=Ie.POSITION_AND_NORMAL;Lp.FLAT_VERTEX_FORMAT=Ie.POSITION_ONLY;Lp.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;Lp.prototype.isTranslucent=io.prototype.isTranslucent;Lp.prototype.getRenderState=io.prototype.getRenderState;var rn=Lp;function TC(e){this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(TC.prototype,{isConstant:{get:function(){return X.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color")});TC.prototype.getType=function(e){return"Color"};var zRe=new Q;TC.prototype.getValue=function(e,t){return c(e)||(e=Q.now(zRe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,G.WHITE,t.color),t};TC.prototype.equals=function(e){return this===e||e instanceof TC&&X.equals(this._color,e._color)};var Ut=TC;function Zg(e){e=e??W.EMPTY_OBJECT,this._ellipsoid=e.ellipsoid??ie.default,this._rectangle=e.rectangle??ce.MAX_VALUE,this._projection=new Oi(this._ellipsoid),this._numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX??2,this._numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY??1}Object.defineProperties(Zg.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Zg.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Zg.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Zg.prototype.rectangleToNativeRectangle=function(e,t){T.defined("rectangle",e);let n=O.toDegrees(e.west),i=O.toDegrees(e.south),o=O.toDegrees(e.east),r=O.toDegrees(e.north);return c(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new ce(n,i,o,r)};Zg.prototype.tileXYToNativeRectangle=function(e,t,n,i){let o=this.tileXYToRectangle(e,t,n,i);return o.west=O.toDegrees(o.west),o.south=O.toDegrees(o.south),o.east=O.toDegrees(o.east),o.north=O.toDegrees(o.north),o};Zg.prototype.tileXYToRectangle=function(e,t,n,i){let o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,l=e*a+o.west,u=(e+1)*a+o.west,f=o.height/s,h=o.north-t*f,p=o.north-(t+1)*f;return c(i)||(i=new ce(l,p,u,h)),i.west=l,i.south=p,i.east=u,i.north=h,i};Zg.prototype.positionToTileXY=function(e,t,n){let i=this._rectangle;if(!ce.contains(i,e))return;let o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r,l=e.longitude;i.east<i.west&&(l+=O.TWO_PI);let u=(l-i.west)/s|0;u>=o&&(u=o-1);let f=(i.north-e.latitude)/a|0;return f>=r&&(f=r-1),c(n)?(n.x=u,n.y=f,n):new H(u,f)};var Ki=Zg;var rie=new d,sie=new d,aie=new he,p6=new d,HRe=new d,cie=new le,GRe=new Ki,cO=[new he,new he,new he,new he],lO=new H,vr={};vr.initialize=function(){let e=vr._initPromise;return c(e)||(e=we.fetchJson(tn("Assets/approximateTerrainHeights.json")).then(function(t){vr._terrainHeights=t}),vr._initPromise=e),e};vr.getMinimumMaximumHeights=function(e,t){if(T.defined("rectangle",e),!c(vr._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=t??ie.default;let n=lie(e),i=vr._defaultMinTerrainHeight,o=vr._defaultMaxTerrainHeight;if(c(n)){let r=`${n.level}-${n.x}-${n.y}`,s=vr._terrainHeights[r];c(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(ce.northeast(e,aie),rie),t.cartographicToCartesian(ce.southwest(e,aie),sie),d.midpoint(sie,rie,p6);let a=t.scaleToGeodeticSurface(p6,HRe);if(c(a)){let l=d.distance(p6,a);i=Math.min(i,-l)}else i=vr._defaultMinTerrainHeight}return i=Math.max(vr._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};vr.getBoundingSphere=function(e,t){if(T.defined("rectangle",e),!c(vr._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=t??ie.default;let n=lie(e),i=vr._defaultMaxTerrainHeight;if(c(n)){let r=`${n.level}-${n.x}-${n.y}`,s=vr._terrainHeights[r];c(s)&&(i=s[1])}let o=le.fromRectangle3D(e,t,0);return le.fromRectangle3D(e,t,i,cie),le.union(o,cie,o)};function lie(e){he.fromRadians(e.east,e.north,0,cO[0]),he.fromRadians(e.west,e.north,0,cO[1]),he.fromRadians(e.east,e.south,0,cO[2]),he.fromRadians(e.west,e.south,0,cO[3]);let t=0,n=0,i=0,o=0,r=vr._terrainHeightsMaxLevel,s;for(s=0;s<=r;++s){let a=!1;for(let l=0;l<4;++l){let u=cO[l];if(GRe.positionToTileXY(u,s,lO),l===0)i=lO.x,o=lO.y;else if(i!==lO.x||o!==lO.y){a=!0;break}}if(a)break;t=i,n=o}if(s!==0)return{x:t,y:n,level:s>r?r:s-1}}vr._terrainHeightsMaxLevel=6;vr._defaultMaxTerrainHeight=9e3;vr._defaultMinTerrainHeight=-1e5;vr._terrainHeights=void 0;vr._initPromise=void 0;Object.defineProperties(vr,{initialized:{get:function(){return c(vr._terrainHeights)}}});var ui=vr;function Gc(e,t,n){this.minimum=d.clone(e??d.ZERO),this.maximum=d.clone(t??d.ZERO),c(n)?n=d.clone(n):n=d.midpoint(this.minimum,this.maximum,new d),this.center=n}Gc.fromCorners=function(e,t,n){return T.defined("minimum",e),T.defined("maximum",t),c(n)||(n=new Gc),n.minimum=d.clone(e,n.minimum),n.maximum=d.clone(t,n.maximum),n.center=d.midpoint(e,t,n.center),n};Gc.fromPoints=function(e,t){if(c(t)||(t=new Gc),!c(e)||e.length===0)return t.minimum=d.clone(d.ZERO,t.minimum),t.maximum=d.clone(d.ZERO,t.maximum),t.center=d.clone(d.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z,l=e.length;for(let h=1;h<l;h++){let p=e[h],g=p.x,m=p.y,y=p.z;n=Math.min(g,n),r=Math.max(g,r),i=Math.min(m,i),s=Math.max(m,s),o=Math.min(y,o),a=Math.max(y,a)}let u=t.minimum;u.x=n,u.y=i,u.z=o;let f=t.maximum;return f.x=r,f.y=s,f.z=a,t.center=d.midpoint(u,f,t.center),t};Gc.clone=function(e,t){if(c(e))return c(t)?(t.minimum=d.clone(e.minimum,t.minimum),t.maximum=d.clone(e.maximum,t.maximum),t.center=d.clone(e.center,t.center),t):new Gc(e.minimum,e.maximum,e.center)};Gc.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&d.equals(e.minimum,t.minimum)&&d.equals(e.maximum,t.maximum)};var DV=new d;Gc.intersectPlane=function(e,t){T.defined("box",e),T.defined("plane",t),DV=d.subtract(e.maximum,e.minimum,DV);let n=d.multiplyByScalar(DV,.5,DV),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=d.dot(e.center,i)+t.distance;return r-o>0?Wt.INSIDE:r+o<0?Wt.OUTSIDE:Wt.INTERSECTING};Gc.prototype.clone=function(e){return Gc.clone(this,e)};Gc.prototype.intersectPlane=function(e){return Gc.intersectPlane(this,e)};Gc.prototype.equals=function(e){return Gc.equals(this,e)};var Qg=Gc;var _6=new se;function _m(e,t){if(T.defined("origin",e),t=t??ie.default,e=t.scaleToGeodeticSurface(e),!c(e))throw new E("origin must not be at the center of the ellipsoid.");let n=Ot.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=d.fromCartesian4(B.getColumn(n,0,_6)),this._yAxis=d.fromCartesian4(B.getColumn(n,1,_6));let i=d.fromCartesian4(B.getColumn(n,2,_6));this._plane=sn.fromPointNormal(e,i)}Object.defineProperties(_m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});var jRe=new Qg;_m.fromPoints=function(e,t){T.defined("cartesians",e);let n=Qg.fromPoints(e,jRe);return new _m(n.center,t)};var uie=new mn,PV=new d;_m.prototype.projectPointOntoPlane=function(e,t){T.defined("cartesian",e);let n=uie;n.origin=e,d.normalize(e,n.direction);let i=Zn.rayPlane(n,this._plane,PV);if(c(i)||(d.negate(n.direction,n.direction),i=Zn.rayPlane(n,this._plane,PV)),c(i)){let o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return c(t)?(t.x=r,t.y=s,t):new H(r,s)}};_m.prototype.projectPointsOntoPlane=function(e,t){T.defined("cartesians",e),c(t)||(t=[]);let n=0,i=e.length;for(let o=0;o<i;o++){let r=this.projectPointOntoPlane(e[o],t[n]);c(r)&&(t[n]=r,n++)}return t.length=n,t};_m.prototype.projectPointToNearestOnPlane=function(e,t){T.defined("cartesian",e),c(t)||(t=new H);let n=uie;n.origin=e,d.clone(this._plane.normal,n.direction);let i=Zn.rayPlane(n,this._plane,PV);c(i)||(d.negate(n.direction,n.direction),i=Zn.rayPlane(n,this._plane,PV));let o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return t.x=r,t.y=s,t};_m.prototype.projectPointsToNearestOnPlane=function(e,t){T.defined("cartesians",e),c(t)||(t=[]);let n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};var WRe=new d;_m.prototype.projectPointOntoEllipsoid=function(e,t){T.defined("cartesian",e),c(t)||(t=new d);let n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=WRe;return d.multiplyByScalar(o,e.x,s),t=d.add(i,s,t),d.multiplyByScalar(r,e.y,s),d.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};_m.prototype.projectPointsOntoEllipsoid=function(e,t){T.defined("cartesians",e);let n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.projectPointOntoEllipsoid(e[i],t[i]);return t};var ns=_m;function zi(e,t){this.center=d.clone(e??d.ZERO),this.halfAxes=J.clone(t??J.ZERO)}zi.packedLength=d.packedLength+J.packedLength;zi.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,d.pack(e.center,t,n),J.pack(e.halfAxes,t,n+d.packedLength),t};zi.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new zi),d.unpack(e,t,n.center),J.unpack(e,t+d.packedLength,n.halfAxes),n};var qRe=new d,YRe=new d,XRe=new d,KRe=new d,$Re=new d,ZRe=new d,QRe=new J,JRe={unitary:new J,diagonal:new J};zi.fromPoints=function(e,t){if(c(t)||(t=new zi),!c(e)||e.length===0)return t.halfAxes=J.ZERO,t.center=d.ZERO,t;let n,i=e.length,o=d.clone(e[0],qRe);for(n=1;n<i;n++)d.add(o,e[n],o);let r=1/i;d.multiplyByScalar(o,r,o);let s=0,a=0,l=0,u=0,f=0,h=0,p;for(n=0;n<i;n++)p=d.subtract(e[n],o,YRe),s+=p.x*p.x,a+=p.x*p.y,l+=p.x*p.z,u+=p.y*p.y,f+=p.y*p.z,h+=p.z*p.z;s*=r,a*=r,l*=r,u*=r,f*=r,h*=r;let g=QRe;g[0]=s,g[1]=a,g[2]=l,g[3]=a,g[4]=u,g[5]=f,g[6]=l,g[7]=f,g[8]=h;let m=J.computeEigenDecomposition(g,JRe),y=J.clone(m.unitary,t.halfAxes),b=J.getColumn(y,0,KRe),x=J.getColumn(y,1,$Re),A=J.getColumn(y,2,ZRe),C=-Number.MAX_VALUE,S=-Number.MAX_VALUE,v=-Number.MAX_VALUE,P=Number.MAX_VALUE,M=Number.MAX_VALUE,R=Number.MAX_VALUE;for(n=0;n<i;n++)p=e[n],C=Math.max(d.dot(b,p),C),S=Math.max(d.dot(x,p),S),v=Math.max(d.dot(A,p),v),P=Math.min(d.dot(b,p),P),M=Math.min(d.dot(x,p),M),R=Math.min(d.dot(A,p),R);b=d.multiplyByScalar(b,.5*(P+C),b),x=d.multiplyByScalar(x,.5*(M+S),x),A=d.multiplyByScalar(A,.5*(R+v),A);let L=d.add(b,x,t.center);d.add(L,A,L);let F=XRe;return F.x=C-P,F.y=S-M,F.z=v-R,d.multiplyByScalar(F,.5,F),J.multiplyByScale(t.halfAxes,F,t.halfAxes),t};var _ie=new d,eMe=new d;function fie(e,t,n,i,o,r,s,a,l,u,f){if(!c(o)||!c(r)||!c(s)||!c(a)||!c(l)||!c(u))throw new E("all extents (minimum/maximum X/Y/Z) are required.");c(f)||(f=new zi);let h=f.halfAxes;J.setColumn(h,0,t,h),J.setColumn(h,1,n,h),J.setColumn(h,2,i,h);let p=_ie;p.x=(o+r)/2,p.y=(s+a)/2,p.z=(l+u)/2;let g=eMe;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(u-l)/2;let m=f.center;return p=J.multiplyByVector(h,p,p),d.add(e,p,m),J.multiplyByScale(h,g,h),f}var die=new he,tMe=new d,nMe=new he,iMe=new he,oMe=new he,rMe=new he,sMe=new he,aMe=new d,hie=new d,cMe=new d,mie=new d,lMe=new d,uMe=new H,fMe=new H,dMe=new H,hMe=new H,mMe=new H,pMe=new d,_Me=new d,gMe=new d,yMe=new d,bMe=new H,xMe=new d,TMe=new d,AMe=new d,CMe=new sn(d.UNIT_X,0);zi.fromRectangle=function(e,t,n,i,o){if(!c(e))throw new E("rectangle is required");if(e.width<0||e.width>O.TWO_PI)throw new E("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>O.PI)throw new E("Rectangle height must be between 0 and pi");if(c(i)&&!O.equalsEpsilon(i.radii.x,i.radii.y,O.EPSILON15))throw new E("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");t=t??0,n=n??0,i=i??ie.default;let r,s,a,l,u,f,h;if(e.width<=O.PI){let M=ce.center(e,die),R=i.cartographicToCartesian(M,tMe),L=new ns(R,i);h=L.plane;let F=M.longitude,_=e.south<0&&e.north>0?0:M.latitude,w=he.fromRadians(F,e.north,n,nMe),D=he.fromRadians(e.west,e.north,n,iMe),I=he.fromRadians(e.west,_,n,oMe),N=he.fromRadians(e.west,e.south,n,rMe),k=he.fromRadians(F,e.south,n,sMe),z=i.cartographicToCartesian(w,aMe),V=i.cartographicToCartesian(D,hie),j=i.cartographicToCartesian(I,cMe),U=i.cartographicToCartesian(N,mie),q=i.cartographicToCartesian(k,lMe),Y=L.projectPointToNearestOnPlane(z,uMe),te=L.projectPointToNearestOnPlane(V,fMe),K=L.projectPointToNearestOnPlane(j,dMe),Z=L.projectPointToNearestOnPlane(U,hMe),ee=L.projectPointToNearestOnPlane(q,mMe);return r=Math.min(te.x,K.x,Z.x),s=-r,l=Math.max(te.y,Y.y),a=Math.min(Z.y,ee.y),D.height=N.height=t,V=i.cartographicToCartesian(D,hie),U=i.cartographicToCartesian(N,mie),u=Math.min(sn.getPointDistance(h,V),sn.getPointDistance(h,U)),f=n,fie(L.origin,L.xAxis,L.yAxis,L.zAxis,r,s,a,l,u,f,o)}let p=e.south>0,g=e.north<0,m=p?e.south:g?e.north:0,y=ce.center(e,die).longitude,b=d.fromRadians(y,m,n,i,pMe);b.z=0;let A=Math.abs(b.x)<O.EPSILON10&&Math.abs(b.y)<O.EPSILON10?d.UNIT_X:d.normalize(b,_Me),C=d.UNIT_Z,S=d.cross(A,C,gMe);h=sn.fromPointNormal(b,A,CMe);let v=d.fromRadians(y+O.PI_OVER_TWO,m,n,i,yMe);s=d.dot(sn.projectPointOntoPlane(h,v,bMe),S),r=-s,l=d.fromRadians(0,e.north,g?t:n,i,xMe).z,a=d.fromRadians(0,e.south,p?t:n,i,TMe).z;let P=d.fromRadians(e.east,m,n,i,AMe);return u=sn.getPointDistance(h,P),f=0,fie(b,S,C,A,r,s,a,l,u,f,o)};zi.fromTransformation=function(e,t){return T.typeOf.object("transformation",e),c(t)||(t=new zi),t.center=B.getTranslation(e,t.center),t.halfAxes=B.getMatrix3(e,t.halfAxes),t.halfAxes=J.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};zi.clone=function(e,t){if(c(e))return c(t)?(d.clone(e.center,t.center),J.clone(e.halfAxes,t.halfAxes),t):new zi(e.center,e.halfAxes)};zi.intersectPlane=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("plane is required.");let n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,l=Math.abs(r*o[J.COLUMN0ROW0]+s*o[J.COLUMN0ROW1]+a*o[J.COLUMN0ROW2])+Math.abs(r*o[J.COLUMN1ROW0]+s*o[J.COLUMN1ROW1]+a*o[J.COLUMN1ROW2])+Math.abs(r*o[J.COLUMN2ROW0]+s*o[J.COLUMN2ROW1]+a*o[J.COLUMN2ROW2]),u=d.dot(i,n)+t.distance;return u<=-l?Wt.OUTSIDE:u>=l?Wt.INSIDE:Wt.INTERSECTING};var gie=new d,yie=new d,bie=new d,EMe=new d,pie=new d,SMe=new d;zi.distanceSquaredTo=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("cartesian is required.");let n=d.subtract(t,e.center,_ie),i=e.halfAxes,o=J.getColumn(i,0,gie),r=J.getColumn(i,1,yie),s=J.getColumn(i,2,bie),a=d.magnitude(o),l=d.magnitude(r),u=d.magnitude(s),f=!0,h=!0,p=!0;a>0?d.divideByScalar(o,a,o):f=!1,l>0?d.divideByScalar(r,l,r):h=!1,u>0?d.divideByScalar(s,u,s):p=!1;let g=!f+!h+!p,m,y,b;if(g===1){let S=o;m=r,y=s,h?p||(S=s,y=o):(S=r,m=o),b=d.cross(m,y,pie),S===o?o=b:S===r?r=b:S===s&&(s=b)}else if(g===2){m=o,h?m=r:p&&(m=s);let S=d.UNIT_Y;S.equalsEpsilon(m,O.EPSILON3)&&(S=d.UNIT_X),y=d.cross(m,S,EMe),d.normalize(y,y),b=d.cross(m,y,pie),d.normalize(b,b),m===o?(r=y,s=b):m===r?(s=y,o=b):m===s&&(o=y,r=b)}else g===3&&(o=d.UNIT_X,r=d.UNIT_Y,s=d.UNIT_Z);let x=SMe;x.x=d.dot(n,o),x.y=d.dot(n,r),x.z=d.dot(n,s);let A=0,C;return x.x<-a?(C=x.x+a,A+=C*C):x.x>a&&(C=x.x-a,A+=C*C),x.y<-l?(C=x.y+l,A+=C*C):x.y>l&&(C=x.y-l,A+=C*C),x.z<-u?(C=x.z+u,A+=C*C):x.z>u&&(C=x.z-u,A+=C*C),A};var wMe=new d,vMe=new d;zi.computePlaneDistances=function(e,t,n,i){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("position is required.");if(!c(n))throw new E("direction is required.");c(i)||(i=new Ma);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=e.center,a=e.halfAxes,l=J.getColumn(a,0,gie),u=J.getColumn(a,1,yie),f=J.getColumn(a,2,bie),h=d.add(l,u,wMe);d.add(h,f,h),d.add(h,s,h);let p=d.subtract(h,t,vMe),g=d.dot(n,p);return o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,h),d.add(h,u,h),d.add(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,p),g=d.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};var DMe=new d,PMe=new d,IMe=new d;zi.computeCorners=function(e,t){T.typeOf.object("box",e),c(t)||(t=[new d,new d,new d,new d,new d,new d,new d,new d]);let n=e.center,i=e.halfAxes,o=J.getColumn(i,0,DMe),r=J.getColumn(i,1,PMe),s=J.getColumn(i,2,IMe);return d.clone(n,t[0]),d.subtract(t[0],o,t[0]),d.subtract(t[0],r,t[0]),d.subtract(t[0],s,t[0]),d.clone(n,t[1]),d.subtract(t[1],o,t[1]),d.subtract(t[1],r,t[1]),d.add(t[1],s,t[1]),d.clone(n,t[2]),d.subtract(t[2],o,t[2]),d.add(t[2],r,t[2]),d.subtract(t[2],s,t[2]),d.clone(n,t[3]),d.subtract(t[3],o,t[3]),d.add(t[3],r,t[3]),d.add(t[3],s,t[3]),d.clone(n,t[4]),d.add(t[4],o,t[4]),d.subtract(t[4],r,t[4]),d.subtract(t[4],s,t[4]),d.clone(n,t[5]),d.add(t[5],o,t[5]),d.subtract(t[5],r,t[5]),d.add(t[5],s,t[5]),d.clone(n,t[6]),d.add(t[6],o,t[6]),d.add(t[6],r,t[6]),d.subtract(t[6],s,t[6]),d.clone(n,t[7]),d.add(t[7],o,t[7]),d.add(t[7],r,t[7]),d.add(t[7],s,t[7]),t};var OMe=new J;zi.computeTransformation=function(e,t){T.typeOf.object("box",e),c(t)||(t=new B);let n=e.center,i=J.multiplyByUniformScale(e.halfAxes,2,OMe);return B.fromRotationTranslation(i,n,t)};var RMe=new le;zi.isOccluded=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("occluder is required.");let n=le.fromOrientedBoundingBox(e,RMe);return!t.isBoundingSphereVisible(n)};zi.prototype.intersectPlane=function(e){return zi.intersectPlane(this,e)};zi.prototype.distanceSquaredTo=function(e){return zi.distanceSquaredTo(this,e)};zi.prototype.computePlaneDistances=function(e,t,n){return zi.computePlaneDistances(this,e,t,n)};zi.prototype.computeCorners=function(e){return zi.computeCorners(this,e)};zi.prototype.computeTransformation=function(e){return zi.computeTransformation(this,e)};zi.prototype.isOccluded=function(e){return zi.isOccluded(this,e)};zi.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&J.equals(e.halfAxes,t.halfAxes)};zi.prototype.clone=function(e){return zi.clone(this,e)};zi.prototype.equals=function(e){return zi.equals(this,e)};var Dn=zi;var IV={};IV.getHeight=function(e,t,n){if(!Number.isFinite(t))throw new E("scale must be a finite number.");if(!Number.isFinite(n))throw new E("relativeHeight must be a finite number.");return(e-n)*t+n};var MMe=new he;IV.getPosition=function(e,t,n,i,o){let r=t.cartesianToCartographic(e,MMe);if(!c(r))return d.clone(e,o);let s=IV.getHeight(r.height,n,i);return d.fromRadians(r.longitude,r.latitude,s,t,o)};var Dr=IV;var uO=`in vec3 position3DHigh;
in vec3 position3DLow;
in float batchId;
#ifdef EXTRUDED_GEOMETRY
in vec3 extrudeDirection;
uniform float u_globeMinimumAltitude;
#endif // EXTRUDED_GEOMETRY
#ifdef PER_INSTANCE_COLOR
out vec4 v_color;
#endif // PER_INSTANCE_COLOR
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
out vec4 v_sphericalExtents;
#else // SPHERICAL
out vec2 v_inversePlaneExtents;
out vec4 v_westPlane;
out vec4 v_southPlane;
#endif // SPHERICAL
out vec3 v_uvMinAndSphericalLongitudeRotation;
out vec3 v_uMaxAndInverseDistance;
out vec3 v_vMaxAndInverseDistance;
#endif // TEXTURE_COORDINATES
void main()
{
vec4 position = czm_computePosition();
#ifdef EXTRUDED_GEOMETRY
float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));
delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;
position = position + vec4(extrudeDirection * delta, 0.0);
#endif
#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);
v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);
#else // SPHERICAL
#ifdef COLUMBUS_VIEW_2D
vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);
vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);
vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));
bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;
planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);
planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);
idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;
idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));
planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);
planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;
vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;
vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;
#else // COLUMBUS_VIEW_2D
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;
vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;
vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;
#endif // COLUMBUS_VIEW_2D
vec3 eastWard = southEastCorner - southWestCorner;
float eastExtent = length(eastWard);
eastWard /= eastExtent;
vec3 northWard = northWestCorner - southWestCorner;
float northExtent = length(northWard);
northWard /= northExtent;
v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));
v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));
v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);
#endif // SPHERICAL
vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);
vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);
v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);
v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);
v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;
#endif // TEXTURE_COORDINATES
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#endif
gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);
}
`;var Jg=`#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
void main(void)
{
#ifdef VECTOR_TILE
out_FragColor = czm_gammaCorrect(u_highlightColor);
#else
out_FragColor = vec4(1.0);
#endif
czm_writeDepthClamp();
}
`;var xie={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};xie.NUMBER_OF_CLASSIFICATION_TYPES=3;var Un=Object.freeze(xie);var LMe={NEVER:ne.NEVER,LESS:ne.LESS,EQUAL:ne.EQUAL,LESS_OR_EQUAL:ne.LEQUAL,GREATER:ne.GREATER,NOT_EQUAL:ne.NOTEQUAL,GREATER_OR_EQUAL:ne.GEQUAL,ALWAYS:ne.ALWAYS},dc=Object.freeze(LMe);function NMe(e,t){if(!c(e))throw new E("array is required.");if(!c(t)||t<1)throw new E("numberOfArrays must be greater than 0.");let n=[],i=e.length,o=0;for(;o<i;){let r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}var fO=NMe;function Np(e,t,n){if(!c(e))throw new E("context is required");if(!c(t))throw new E("attributes is required");if(!c(n))throw new E("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;let i=FMe(t),o=e.floatingPointTexture,r=i===Ue.FLOAT&&!o,s=BMe(t,r),a=kMe(s,t,r),l=Math.floor(ut.maximumTextureSize/a),u=Math.min(n,l),f=a*u,h=Math.ceil(n/u),p=1/f,g=p*.5,m=1/h,y=m*.5;this._textureDimensions=new H(f,h),this._textureStep=new se(p,g,m,y),this._pixelDatatype=r?Ue.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;let b=4*f*h;this._batchValues=i===Ue.FLOAT&&!r?new Float32Array(b):new Uint8Array(b),this._batchValuesDirty=!1}Object.defineProperties(Np.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function FMe(e){let t=!1,n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==$.UNSIGNED_BYTE){t=!0;break}return t?Ue.FLOAT:Ue.UNSIGNED_BYTE}function Aie(e,t){let n=e[t].componentsPerAttribute;return n===2?H:n===3?d:n===4?se:Number}function BMe(e,t){let n=new Array(e.length),i=0,o=e.length;for(let r=0;r<o;++r){let a=e[r].componentDatatype;n[r]=i,a!==$.UNSIGNED_BYTE&&t?i+=4:++i}return n}function kMe(e,t,n){let i=e.length,o=e[i-1];return t[i-1].componentDatatype!==$.UNSIGNED_BYTE&&n?o+4:o+1}var dO=new se;function UMe(e,t,n){let i=se.unpack(e,t,dO),o=se.unpackFloat(i);i=se.unpack(e,t+4,dO);let r=se.unpackFloat(i);i=se.unpack(e,t+8,dO);let s=se.unpackFloat(i);i=se.unpack(e,t+12,dO);let a=se.unpackFloat(i);return se.fromElements(o,r,s,a,n)}function VMe(e,t,n){let i=se.packFloat(e.x,dO);se.pack(i,t,n),i=se.packFloat(e.y,i),se.pack(i,t,n+4),i=se.packFloat(e.z,i),se.pack(i,t,n+8),i=se.packFloat(e.w,i),se.pack(i,t,n+12)}var Tie=new se;Np.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");let i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o,a;this._packFloats&&i[t].componentDatatype!==Ue.UNSIGNED_BYTE?a=UMe(this._batchValues,s,Tie):a=se.unpack(this._batchValues,s,Tie);let l=Aie(i,t);return c(l.fromCartesian4)?l.fromCartesian4(a,n):c(l.clone)?l.clone(a,n):a.x};var zMe=[void 0,void 0,new H,new d,new se],HMe=new se;Np.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");if(!c(n))throw new E("value is required.");let i=this._attributes,o=zMe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=Aie(this._attributes,t);if(c(s.equals)?s.equals(r,n):r===n)return;let l=HMe;l.x=c(n.x)?n.x:n,l.y=c(n.y)?n.y:0,l.z=c(n.z)?n.z:0,l.w=c(n.w)?n.w:0;let u=this._offsets[t],h=4*this._stride*e+4*u;this._packFloats&&i[t].componentDatatype!==Ue.UNSIGNED_BYTE?VMe(l,this._batchValues,h):se.pack(l,this._batchValues,h),this._batchValuesDirty=!0};function GMe(e,t){let n=e._textureDimensions;e._texture=new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:Qt.NEAREST,flipY:!1})}function jMe(e){let t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}Np.prototype.update=function(e){c(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,c(this._texture)||GMe(this,e.context),jMe(this))};Np.prototype.getUniformMapCallback=function(){let e=this;return function(t){return e._attributes.length===0?t:xt(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function WMe(e){let t=e._stride;return e._textureDimensions.y===1?`uniform vec4 batchTextureStep; 
vec2 computeSt(float batchId) 
{ 
    float stepX = batchTextureStep.x; 
    float centerX = batchTextureStep.y; 
    float numberOfAttributes = float(${t}); 
    return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5); 
} 
`:`uniform vec4 batchTextureStep; 
uniform vec2 batchTextureDimensions; 
vec2 computeSt(float batchId) 
{ 
    float stepX = batchTextureStep.x; 
    float centerX = batchTextureStep.y; 
    float stepY = batchTextureStep.z; 
    float centerY = batchTextureStep.w; 
    float numberOfAttributes = float(${t}); 
    float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x); 
    float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x); 
    return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); 
} 
`}function qMe(e){return e===1?"float":`vec${e}`}function YMe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function XMe(e,t){let i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=qMe(o),a=YMe(o),l=e._offsets[t],u=`${s} ${r}(float batchId) 
{ 
    vec2 st = computeSt(batchId); 
    st.x += batchTextureStep.x * float(${l}); 
`;return e._packFloats&&i.componentDatatype!==Ue.UNSIGNED_BYTE?u+=`vec4 textureValue; 
textureValue.x = czm_unpackFloat(texture(batchTexture, st)); 
textureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0))); 
textureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); 
textureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); 
`:u+=`    vec4 textureValue = texture(batchTexture, st); 
`,u+=`    ${s} value = textureValue${a}; 
`,e._pixelDatatype===Ue.UNSIGNED_BYTE&&i.componentDatatype===$.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0; 
`:e._pixelDatatype===Ue.FLOAT&&i.componentDatatype===$.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0; 
`),u+=`    return value; 
} 
`,u}Np.prototype.getVertexShaderCallback=function(){let e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture; 
`;t+=`${WMe(this)}
`;let n=e.length;for(let i=0;i<n;++i)t+=XMe(this,i);return function(i){let o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};Np.prototype.isDestroyed=function(){return!1};Np.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),de(this)};var Rb=Np;function Ll(e){this._ellipsoid=e??ie.WGS84,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(Ll.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Ll.mercatorAngleToGeodeticLatitude=function(e){return O.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};Ll.geodeticLatitudeToMercatorAngle=function(e){e>Ll.MaximumLatitude?e=Ll.MaximumLatitude:e<-Ll.MaximumLatitude&&(e=-Ll.MaximumLatitude);let t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};Ll.MaximumLatitude=Ll.mercatorAngleToGeodeticLatitude(Math.PI);Ll.prototype.project=function(e,t){let n=this._semimajorAxis,i=e.longitude*n,o=Ll.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};Ll.prototype.unproject=function(e,t){if(!c(e))throw new E("cartesian is required");let n=this._oneOverSemimajorAxis,i=e.x*n,o=Ll.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};var Mi=Ll;function KMe(e,t,n){let i=!n,o=e.length,r;if(!i&&o>1){let s=e[0].modelMatrix;for(r=1;r<o;++r)if(!B.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)c(e[r].geometry)&&Nn.transformToWorldCoordinates(e[r]);else B.multiplyTransformation(t,e[0].modelMatrix,t)}function g6(e,t){let n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});let r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function $Me(e){let t=e.length;for(let n=0;n<t;++n){let i=e[n];c(i.geometry)?g6(i.geometry,n):c(i.westHemisphereGeometry)&&c(i.eastHemisphereGeometry)&&(g6(i.westHemisphereGeometry,n),g6(i.eastHemisphereGeometry,n))}}function ZMe(e){let t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix,l,u,f,h=t.length;for(l=0;l<h;++l)if(c(t[l].geometry)){f=t[l].geometry.primitiveType;break}for(l=1;l<h;++l)if(c(t[l].geometry)&&t[l].geometry.primitiveType!==f)throw new E("All instance geometries must have the same primitiveType.");if(KMe(t,a,o),!o)for(l=0;l<h;++l)c(t[l].geometry)&&Nn.splitLongitude(t[l]);if($Me(t),r)for(l=0;l<h;++l){let g=t[l];c(g.geometry)?(Nn.reorderForPostVertexCache(g.geometry),Nn.reorderForPreVertexCache(g.geometry)):c(g.westHemisphereGeometry)&&c(g.eastHemisphereGeometry)&&(Nn.reorderForPostVertexCache(g.westHemisphereGeometry),Nn.reorderForPreVertexCache(g.westHemisphereGeometry),Nn.reorderForPostVertexCache(g.eastHemisphereGeometry),Nn.reorderForPreVertexCache(g.eastHemisphereGeometry))}let p=Nn.combineInstances(t);for(h=p.length,l=0;l<h;++l){u=p[l];let g=u.attributes;if(o)for(let m in g)g.hasOwnProperty(m)&&g[m].componentDatatype===$.DOUBLE&&Nn.encodeAttribute(u,m,`${m}3DHigh`,`${m}3DLow`);else for(let m in g)if(g.hasOwnProperty(m)&&g[m].componentDatatype===$.DOUBLE){let y=`${m}3D`,b=`${m}2D`;Nn.projectTo2D(u,m,y,b,n),c(u.boundingSphere)&&m==="position"&&(u.boundingSphereCV=le.fromVertices(u.attributes.position2D.values)),Nn.encodeAttribute(u,y,`${y}High`,`${y}Low`),Nn.encodeAttribute(u,b,`${b}High`,`${b}Low`)}s&&Nn.compressVertices(u)}if(!i){let g=[];for(h=p.length,l=0;l<h;++l)u=p[l],g=g.concat(Nn.fitToUnsignedShortIndices(u));p=g}return p}function y6(e,t,n,i){let o,r,s,a=i.length-1;if(a>=0){let u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;let l=e.length;for(let u=0;u<l;++u){let h=e[u][t];if(!c(h))continue;let p=h.indices.length;o+p>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:p}),o+=p}}function QMe(e,t){let n=[];return y6(e,"geometry",t,n),y6(e,"westHemisphereGeometry",t,n),y6(e,"eastHemisphereGeometry",t,n),n}var Fp={};Fp.combineGeometry=function(e){let t,n,i=e.instances,o=i.length,r,s,a=!1;o>0&&(t=ZMe(e),t.length>0&&(n=Nn.createAttributeLocations(t[0]),e.createPickOffsets&&(r=QMe(i,t))),c(i[0].attributes)&&c(i[0].attributes.offset)&&(s=new Array(o),a=!0));let l=new Array(o),u=new Array(o);for(let f=0;f<o;++f){let h=i[f],p=h.geometry;c(p)&&(l[f]=p.boundingSphere,u[f]=p.boundingSphereCV,a&&(s[f]=h.geometry.offsetAttribute));let g=h.eastHemisphereGeometry,m=h.westHemisphereGeometry;c(g)&&c(m)&&(c(g.boundingSphere)&&c(m.boundingSphere)&&(l[f]=le.union(g.boundingSphere,m.boundingSphere)),c(g.boundingSphereCV)&&c(m.boundingSphereCV)&&(u[f]=le.union(g.boundingSphereCV,m.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:l,boundingSpheresCV:u}};function JMe(e,t){let n=e.attributes;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];c(o)&&c(o.values)&&t.push(o.values.buffer)}c(e.indices)&&t.push(e.indices.buffer)}function eLe(e,t){let n=e.length;for(let i=0;i<n;++i)JMe(e[i],t)}function tLe(e){let t=1,n=e.length;for(let i=0;i<n;i++){let o=e[i];if(++t,!c(o))continue;let r=o.attributes;t+=7+2*le.packedLength+(c(o.indices)?o.indices.length:0);for(let s in r)if(r.hasOwnProperty(s)&&c(r[s])){let a=r[s];t+=5+a.values.length}}return t}Fp.packCreateGeometryResults=function(e,t){let n=new Float64Array(tLe(e)),i=[],o={},r=e.length,s=0;n[s++]=r;for(let a=0;a<r;a++){let l=e[a],u=c(l);if(n[s++]=u?1:0,!u)continue;n[s++]=l.primitiveType,n[s++]=l.geometryType,n[s++]=l.offsetAttribute??-1;let f=c(l.boundingSphere)?1:0;n[s++]=f,f&&le.pack(l.boundingSphere,n,s),s+=le.packedLength;let h=c(l.boundingSphereCV)?1:0;n[s++]=h,h&&le.pack(l.boundingSphereCV,n,s),s+=le.packedLength;let p=l.attributes,g=[];for(let y in p)p.hasOwnProperty(y)&&c(p[y])&&(g.push(y),c(o[y])||(o[y]=i.length,i.push(y)));n[s++]=g.length;for(let y=0;y<g.length;y++){let b=g[y],x=p[b];n[s++]=o[b],n[s++]=x.componentDatatype,n[s++]=x.componentsPerAttribute,n[s++]=x.normalize?1:0,n[s++]=x.values.length,n.set(x.values,s),s+=x.values.length}let m=c(l.indices)?l.indices.length:0;n[s++]=m,m>0&&(n.set(l.indices,s),s+=m)}return t.push(n.buffer),{stringTable:i,packedData:n}};Fp.unpackCreateGeometryResults=function(e){let t=e.stringTable,n=e.packedData,i,o=new Array(n[0]),r=0,s=1;for(;s<n.length;){if(!(n[s++]===1)){o[r++]=void 0;continue}let l=n[s++],u=n[s++],f=n[s++];f===-1&&(f=void 0);let h,p;n[s++]===1&&(h=le.unpack(n,s)),s+=le.packedLength,n[s++]===1&&(p=le.unpack(n,s)),s+=le.packedLength;let y,b,x,A=new fn,C=n[s++];for(i=0;i<C;i++){let v=t[n[s++]],P=n[s++];x=n[s++];let M=n[s++]!==0;y=n[s++],b=$.createTypedArray(P,y);for(let R=0;R<y;R++)b[R]=n[s++];A[v]=new ve({componentDatatype:P,componentsPerAttribute:x,normalize:M,values:b})}let S;if(y=n[s++],y>0){let v=b.length/x;for(S=Fe.createTypedArray(v,y),i=0;i<y;i++)S[i]=n[s++]}o[r++]=new ct({primitiveType:l,geometryType:u,boundingSphere:h,boundingSphereCV:p,indices:S,attributes:A,offsetAttribute:f})}return o};function nLe(e,t){let n=e.length,i=new Float64Array(1+n*19),o=0;i[o++]=n;for(let r=0;r<n;r++){let s=e[r];if(B.pack(s.modelMatrix,i,o),o+=B.packedLength,c(s.attributes)&&c(s.attributes.offset)){let a=s.attributes.offset.value;i[o]=a[0],i[o+1]=a[1],i[o+2]=a[2]}o+=3}return t.push(i.buffer),i}function iLe(e){let t=e,n=new Array(t[0]),i=0,o=1;for(;o<t.length;){let r=B.unpack(t,o),s;o+=B.packedLength,c(t[o])&&(s={offset:new eo(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}Fp.packCombineGeometryParameters=function(e,t){let n=e.createGeometryResults,i=n.length;for(let o=0;o<i;o++)t.push(n[o].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:nLe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof Oi,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};Fp.unpackCombineGeometryParameters=function(e){let t=iLe(e.packedInstances),n=e.createGeometryResults,i=n.length,o=0;for(let a=0;a<i;a++){let l=Fp.unpackCreateGeometryResults(n[a]),u=l.length;for(let f=0;f<u;f++){let h=l[f],p=t[o];p.geometry=h,++o}}let r=ie.clone(e.ellipsoid),s=e.isGeographic?new Oi(r):new Mi(r);return{instances:t,ellipsoid:r,projection:s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:B.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}};function Cie(e){let t=e.length,n=1+(le.packedLength+1)*t,i=new Float32Array(n),o=0;i[o++]=t;for(let r=0;r<t;++r){let s=e[r];c(s)?(i[o++]=1,le.pack(e[r],i,o)):i[o++]=0,o+=le.packedLength}return i}function Eie(e){let t=new Array(e[0]),n=0,i=1;for(;i<e.length;)e[i++]===1&&(t[n]=le.unpack(e,i)),++n,i+=le.packedLength;return t}Fp.packCombineGeometryResults=function(e,t){c(e.geometries)&&eLe(e.geometries,t);let n=Cie(e.boundingSpheres),i=Cie(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:i}};Fp.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:Eie(e.boundingSpheres),boundingSpheresCV:Eie(e.boundingSpheresCV)}};var Mb=Fp;var oLe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},Pr=Object.freeze(oLe);var yu={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};yu.NUMBER_OF_SHADOW_MODES=4;yu.castShadows=function(e){return e===yu.ENABLED||e===yu.CAST_ONLY};yu.receiveShadows=function(e){return e===yu.ENABLED||e===yu.RECEIVE_ONLY};yu.fromCastReceive=function(e,t){return e&&t?yu.ENABLED:e?yu.CAST_ONLY:t?yu.RECEIVE_ONLY:yu.DISABLED};var xn=Object.freeze(yu);function Ir(e){if(e=e??W.EMPTY_OBJECT,this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=new B,this.show=e.show??!0,this._vertexCacheOptimize=e.vertexCacheOptimize??!1,this._interleave=e.interleave??!1,this._releaseGeometryInstances=e.releaseGeometryInstances??!0,this._allowPicking=e.allowPicking??!0,this._asynchronous=e.asynchronous??!0,this._compressVertices=e.compressVertices??!0,this.cull=e.cull??!0,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.rtcCenter=e.rtcCenter,c(this.rtcCenter)&&(!c(this.geometryInstances)||Array.isArray(this.geometryInstances)&&this.geometryInstances.length!==1))throw new E("Relative-to-center rendering only supports one geometry instance.");this.shadows=e.shadows??xn.DISABLED,this._translucent=void 0,this._state=Pr.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=new Map,this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}Object.defineProperties(Ir.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}}});function rLe(e){let t=e.length,n=[],i=e[0].attributes,o;for(o in i)if(i.hasOwnProperty(o)&&c(i[o])){let r=i[o],s=!0;for(let a=1;a<t;++a){let l=e[a].attributes[o];if(!c(l)||r.componentDatatype!==l.componentDatatype||r.componentsPerAttribute!==l.componentsPerAttribute||r.normalize!==l.normalize){s=!1;break}}s&&n.push(o)}return n}var sLe=new H,aLe=new d,Mie=new se;function Lie(e){let t=e.length;if(t===1)return e[0];if(t===2)return H.unpack(e,0,sLe);if(t===3)return d.unpack(e,0,aLe);if(t===4)return se.unpack(e,0,Mie)}function cLe(e,t){let n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;let r=rLe(i),s=r.length,a=[],l={},u={},f,p=i[0].attributes,g,m,y;for(g=0;g<s;++g)m=r[g],y=p[m],l[m]=g,a.push({functionName:`czm_batchTable_${m}`,componentDatatype:y.componentDatatype,componentsPerAttribute:y.componentsPerAttribute,normalize:y.normalize});r.indexOf("distanceDisplayCondition")!==-1&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:$.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:$.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:$.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:$.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:$.FLOAT,componentsPerAttribute:1}),u.center3DHigh=a.length-5,u.center3DLow=a.length-4,u.center2DHigh=a.length-3,u.center2DLow=a.length-2,u.radius=a.length-1),r.indexOf("offset")!==-1&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:$.FLOAT,componentsPerAttribute:3}),f=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});let b=a.length,x=new Rb(t,a,o);for(g=0;g<o;++g){let A=i[g];p=A.attributes;for(let M=0;M<s;++M){m=r[M],y=p[m];let R=Lie(y.value),L=l[m];x.setBatchedAttribute(g,L,R)}let C={primitive:A.pickPrimitive??e};c(A.id)&&(C.id=A.id);let S=t.createPickId(C);e._pickIds.push(S);let v=S.color,P=Mie;P.x=G.floatToByte(v.red),P.y=G.floatToByte(v.green),P.z=G.floatToByte(v.blue),P.w=G.floatToByte(v.alpha),x.setBatchedAttribute(g,b-1,P)}e._batchTable=x,e._batchTableAttributeIndices=l,e._batchTableBoundingSphereAttributeIndices=u,e._batchTableOffsetAttribute2DIndex=f}function lLe(e){let t;return Array.isArray(e.values)?t=e.values.slice(0):t=new e.values.constructor(e.values),new ve({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function uLe(e){let t=e.attributes,n=new fn;for(let o in t)t.hasOwnProperty(o)&&c(t[o])&&(n[o]=lLe(t[o]));let i;if(c(e.indices)){let o=e.indices;Array.isArray(o)?i=o.slice(0):i=new o.constructor(o)}return new ct({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:le.clone(e.boundingSphere)})}function fLe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:B.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}var dLe=/in\s+vec(?:3|4)\s+(.*)3DHigh;/g;Ir._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=dLe.exec(t))!==null;){let a=i[1],l=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;l!=="vec4 czm_computePosition()"&&(o+=`${l};
`),c(e.rtcCenter)?(t=t.replace(/in\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/in\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
`,r+=`in vec4 position;
`,s+=`${l}
{
    return u_modifiedModelView * position;
}

`,t=t.replace(/czm_modelViewRelativeToEye\s+\*\s+/g,""),t=t.replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${l}
{
    return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
}

`:(r+=`in vec3 ${a}2DHigh;
in vec3 ${a}2DLow;
`,s+=`${l}
{
    vec4 p;
    if (czm_morphTime == 1.0)
    {
        p = czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
    }
    else if (czm_morphTime == 0.0)
    {
        p = czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy);
    }
    else
    {
        p = czm_columbusViewMorph(
                czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy),
                czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow),
                czm_morphTime);
    }
    return p;
}

`)}return[o,r,t,s].join(`
`)};Ir._appendShowToShader=function(e,t){return c(e._batchTableAttributeIndices.show)?`${He.replaceMain(t,"czm_non_show_main")}
void main() 
{ 
    czm_non_show_main(); 
    gl_Position *= czm_batchTable_show(batchId); 
}`:t};Ir._updateColorAttribute=function(e,t,n){if(!c(e._batchTableAttributeIndices.color)&&!c(e._batchTableAttributeIndices.depthFailColor)||t.search(/in\s+vec4\s+color;/g)===-1)return t;if(n&&!c(e._batchTableAttributeIndices.depthFailColor))throw new E("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/in\s+vec4\s+color;/g,""),n?i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i};function Sie(e){return`${He.replaceMain(e,"czm_non_pick_main")}
out vec4 v_pickColor; 
void main() 
{ 
    czm_non_pick_main(); 
    v_pickColor = czm_batchTable_pickColor(batchId); 
}`}function wie(e){return`in vec4 v_pickColor;
${e}`}Ir._updatePickColorAttribute=function(e){let t=e.replace(/in\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};Ir._appendOffsetToShader=function(e,t){if(!c(e._batchTableAttributeIndices.offset))return t;let n=`in float batchId;
`;n+="in float applyOffset;";let i=t.replace(/in\s+float\s+batchId;/g,n),o=`vec4 $1 = czm_computePosition();
`;return o+=`    if (czm_sceneMode == czm_sceneMode3D)
`,o+=`    {
`,o+="        $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",o+=`    }
`,o+=`    else
`,o+=`    {
`,o+="        $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",o+=`    }
`,i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,o),i};Ir._appendDistanceDisplayConditionToShader=function(e,t,n){if(!c(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i=He.replaceMain(t,"czm_non_distanceDisplayCondition_main"),o=`void main() 
{ 
    czm_non_distanceDisplayCondition_main(); 
    vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);
    vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);
    vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);
    float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);
`;return n?o+=`    vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
`:o+=`    vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);
    vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);
    vec4 centerRTE;
    if (czm_morphTime == 1.0)
    {
        centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
    }
    else if (czm_morphTime == 0.0)
    {
        centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);
    }
    else
    {
        centerRTE = czm_columbusViewMorph(
                czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),
                czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),
                czm_morphTime);
    }
`,o+=`    float radiusSq = boundingSphereRadius * boundingSphereRadius; 
    float distanceSq; 
    if (czm_sceneMode == czm_sceneMode2D) 
    { 
        distanceSq = czm_eyeHeight2D.y - radiusSq; 
    } 
    else 
    { 
        distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; 
    } 
    distanceSq = max(distanceSq, 0.0); 
    float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; 
    float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; 
    float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; 
    gl_Position *= show; 
}`,`${i}
${o}`};function vie(e,t){if(!e.compressVertices)return t;let n=t.search(/in\s+vec3\s+normal;/g)!==-1,i=t.search(/in\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;let o=t.search(/in\s+vec3\s+tangent;/g)!==-1,r=t.search(/in\s+vec3\s+bitangent;/g)!==-1,s=i&&n?2:1;s+=o||r?1:0;let a=s>1?`vec${s}`:"float",l="compressedAttributes",u=`in ${a} ${l};`,f="",h="";if(i){f+=`vec2 st;
`;let m=s>1?`${l}.x`:l;h+=`    st = czm_decompressTextureCoordinates(${m});
`}n&&o&&r?(f+=`vec3 normal;
vec3 tangent;
vec3 bitangent;
`,h+=`    czm_octDecode(${l}.${i?"yz":"xy"}, normal, tangent, bitangent);
`):(n&&(f+=`vec3 normal;
`,h+=`    normal = czm_octDecode(${l}${s>1?`.${i?"y":"x"}`:""});
`),o&&(f+=`vec3 tangent;
`,h+=`    tangent = czm_octDecode(${l}.${i&&n?"z":"y"});
`),r&&(f+=`vec3 bitangent;
`,h+=`    bitangent = czm_octDecode(${l}.${i&&n?"z":"y"});
`));let p=t;p=p.replace(/in\s+vec3\s+normal;/g,""),p=p.replace(/in\s+vec2\s+st;/g,""),p=p.replace(/in\s+vec3\s+tangent;/g,""),p=p.replace(/in\s+vec3\s+bitangent;/g,""),p=He.replaceMain(p,"czm_non_compressed_main");let g=`void main() 
{ 
${h}    czm_non_compressed_main(); 
}`;return[u,f,p,g].join(`
`)}function hLe(e){let t=He.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
    czm_non_depth_clamp_main();
    gl_Position = czm_depthClamp(gl_Position);}
`,t}function mLe(e){let t=He.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
    czm_non_depth_clamp_main();
    #if defined(LOG_DEPTH)
        czm_writeLogDepth();
    #else
        czm_writeDepthClamp();
    #endif
}
`,t}function Die(e,t){let n=e.vertexAttributes;for(let i in n)if(n.hasOwnProperty(i)&&!c(t[i]))throw new E(`Appearance/Geometry mismatch.  The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry.  Use the appearance's vertexFormat property when constructing the geometry.`)}function pLe(e,t){return function(){return e[t]}}var b6=Math.max(Vt.hardwareConcurrency-1,1),OV,_Le=new yi("combineGeometry");function gLe(e,t){let n,i,o,r,s=e._instanceIds;if(e._state===Pr.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let a=e._numberOfInstances=n.length,l=[],u=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),c(i._workerName)&&c(i._workerPath)||!c(i._workerName)&&!c(i._workerPath))throw new E("Must define either _workerName or _workerPath for asynchronous geometry.");u.push({moduleName:i._workerName,modulePath:i._workerPath,geometry:i})}if(!c(OV))for(OV=new Array(b6),o=0;o<b6;o++)OV[o]=new yi("createGeometry");let f;for(u=fO(u,b6),o=0;o<u.length;o++){let h=0,p=u[o],g=p.length;for(r=0;r<g;++r)f=p[r],i=f.geometry,c(i.constructor.pack)&&(f.offset=h,h+=i.constructor.packedLength??i.packedLength);let m;if(h>0){let y=new Float64Array(h);for(m=[y.buffer],r=0;r<g;++r)f=p[r],i=f.geometry,c(i.constructor.pack)&&(i.constructor.pack(i,y,f.offset),f.geometry=y)}l.push(OV[o].scheduleTask({subTasks:u[o]},m))}e._state=Pr.CREATING,Promise.all(l).then(function(h){e._createGeometryResults=h,e._state=Pr.CREATED}).catch(function(h){mO(e,t,Pr.FAILED,h)})}else if(e._state===Pr.CREATED){let a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let l=t.scene3DOnly,u=t.mapProjection,f=_Le.scheduleTask(Mb.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=Pr.COMBINING,Promise.resolve(f).then(function(h){let p=Mb.unpackCombineGeometryResults(h);e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=B.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Pr.COMBINED):mO(e,t,Pr.FAILED,void 0)}).catch(function(h){mO(e,t,Pr.FAILED,h)})}}function yLe(e,t){let n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds,s,a,l=0;for(a=0;a<i;a++){s=n[a];let p=s.geometry,g;c(p.attributes)&&c(p.primitiveType)?g=uLe(p):g=p.constructor.createGeometry(p),o[l++]=fLe(s,g),r.push(s.id)}o.length=l;let u=t.scene3DOnly,f=t.mapProjection,h=Mb.combineGeometry({instances:o,ellipsoid:f.ellipsoid,projection:f,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=h.geometries,e._attributeLocations=h.attributeLocations,e.modelMatrix=B.clone(h.modelMatrix,e.modelMatrix),e._pickOffsets=h.pickOffsets,e._offsetInstanceExtend=h.offsetInstanceExtend,e._instanceBoundingSpheres=h.boundingSpheres,e._instanceBoundingSpheresCV=h.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Pr.COMBINED):mO(e,t,Pr.FAILED,void 0)}function bLe(e,t){let n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!c(n)){e._recomputeBoundingSpheres=!1;return}let i,o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length,a=e._tempBoundingSpheres;if(!c(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new le;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let y=a[i],b=e._batchTable.getBatchedAttribute(i,n,new d);y=r[i].clone(y),kie(y,b,o[i])}let l=[],u=[],f=[];for(i=0;i<s;++i){let y=a[i];y.center.x-y.radius>0||le.intersectPlane(y,sn.ORIGIN_ZX_PLANE)!==Wt.INTERSECTING?l.push(y):(u.push(y),f.push(y))}let h=l[0],p=f[0],g=u[0];for(i=1;i<l.length;i++)h=le.union(h,l[i]);for(i=1;i<f.length;i++)p=le.union(p,f[i]);for(i=1;i<u.length;i++)g=le.union(g,u[i]);let m=[];for(c(h)&&m.push(h),c(p)&&m.push(p),c(g)&&m.push(g),i=0;i<m.length;i++){let y=m[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=y,e._boundingSphereCV[i]=le.projectTo2D(y,t.mapProjection,e._boundingSphereCV[i])}Ir._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}var Pie=new Hn,Nie=new he,Fie=new d,Bie=new le;function xLe(e,t){if(!c(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;let i=e._batchTableBoundingSphereAttributeIndices,o=i.center3DHigh,r=i.center3DLow,s=i.center2DHigh,a=i.center2DLow,l=i.radius,u=t.mapProjection,f=u.ellipsoid,h=e._batchTable,p=e._instanceBoundingSpheres,g=p.length;for(let m=0;m<g;++m){let y=p[m];if(!c(y))continue;let b=e.modelMatrix;c(b)&&(y=le.transform(y,b,Bie));let x=y.center,A=y.radius,C=Hn.fromCartesian(x,Pie);if(h.setBatchedAttribute(m,o,C.high),h.setBatchedAttribute(m,r,C.low),!t.scene3DOnly){let S=f.cartesianToCartographic(x,Nie),v=u.project(S,Fie);C=Hn.fromCartesian(v,Pie),h.setBatchedAttribute(m,s,C.high),h.setBatchedAttribute(m,a,C.low)}h.setBatchedAttribute(m,l,A)}e._batchTableBoundingSpheresUpdated=!0}var x6=new d,TLe=new d;function Iie(e,t){if(!c(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;let i=e._batchTableOffsetAttribute2DIndex,o=t.mapProjection,r=o.ellipsoid,s=e._batchTable,a=e._instanceBoundingSpheres,l=a.length;for(let u=0;u<l;++u){let f=a[u];if(!c(f))continue;let h=s.getBatchedAttribute(u,e._batchTableAttributeIndices.offset);if(d.equals(h,d.ZERO)){s.setBatchedAttribute(u,i,d.ZERO);continue}let p=e.modelMatrix;c(p)&&(f=le.transform(f,p,Bie));let g=f.center;g=r.scaleToGeodeticSurface(g,TLe);let m=r.cartesianToCartographic(g,Nie),y=o.project(m,Fie),b=d.add(h,g,x6);m=r.cartesianToCartographic(b,m);let x=o.project(m,x6),A=d.subtract(x,y,x6),C=A.x;A.x=A.z,A.z=A.y,A.y=C,s.setBatchedAttribute(u,i,A)}e._batchTableOffsetsUpdated=!0}function ALe(e,t){let n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let l=0;l<a;++l){let u=i[l];if(s.push(ti.fromGeometry({context:r,geometry:u,attributeLocations:n,bufferUsage:Be.STATIC_DRAW,interleave:e._interleave})),c(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,u);else if(e._boundingSpheres.push(le.clone(u.boundingSphere)),e._boundingSphereWC.push(new le),!o){let f=u.boundingSphereCV.center,h=f.x,p=f.y,g=f.z;f.x=g,f.y=h,f.z=p,e._boundingSphereCV.push(le.clone(u.boundingSphereCV)),e._boundingSphere2D.push(new le),e._boundingSphereMorph.push(new le)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,mO(e,t,Pr.COMPLETE,void 0)}function CLe(e,t,n,i){let o=n.getRenderState(),r;i?(r=je(o,!1),r.cull={enabled:!0,face:xi.BACK},e._frontFaceRS=Ve.fromCache(r),r.cull.face=xi.FRONT,e._backFaceRS=Ve.fromCache(r)):(e._frontFaceRS=Ve.fromCache(o),e._backFaceRS=e._frontFaceRS),r=je(o,!1),c(e._depthFailAppearance)&&(r.depthTest.enabled=!1),c(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=je(o,!1),r.depthTest.func=dc.GREATER,i?(r.cull={enabled:!0,face:xi.BACK},e._frontFaceDepthFailRS=Ve.fromCache(r),r.cull.face=xi.FRONT,e._backFaceDepthFailRS=Ve.fromCache(r)):(e._frontFaceDepthFailRS=Ve.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function ELe(e,t,n){let i=t.context,o=e._attributeLocations,r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=Ir._appendOffsetToShader(e,r),r=Ir._appendShowToShader(e,r),r=Ir._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=Sie(r),r=Ir._updateColorAttribute(e,r,!1),r=vie(e,r),r=Ir._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=wie(s),e._sp=Jt.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),Die(e._sp,o),c(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=Ir._appendShowToShader(e,r),r=Ir._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=Sie(r),r=Ir._updateColorAttribute(e,r,!0),r=vie(e,r),r=Ir._modifyShaderPosition(e,r,t.scene3DOnly),r=hLe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=wie(s),s=mLe(s),e._spDepthFail=Jt.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),Die(e._spDepthFail,o))}var hO=new B,Oie=new d;function Rie(e,t,n,i){let o=c(n)?n._uniforms:void 0,r={},s=t.uniforms;if(c(s)){for(let l in s)if(s.hasOwnProperty(l)){if(c(o)&&c(o[l]))throw new E(`Appearance and material have a uniform with the same name: ${l}`);r[l]=pLe(s,l)}}let a=xt(r,o);return a=e._batchTable.getUniformMapCallback()(a),c(e.rtcCenter)&&(a.u_modifiedModelView=function(){let l=i.context.uniformState.view;return B.multiply(l,e._modelMatrix,hO),B.multiplyByPoint(hO,e.rtcCenter,Oie),B.setTranslation(hO,Oie,hO),hO}),a}function SLe(e,t,n,i,o,r,s,a){let l=Rie(e,t,n,a),u;c(e._depthFailAppearance)&&(u=Rie(e,e._depthFailAppearance,e._depthFailAppearance.material,a));let f=i?De.TRANSLUCENT:De.OPAQUE,h=o?2:1;h*=c(e._depthFailAppearance)?2:1,r.length=e._va.length*h;let p=r.length,g=0;for(let m=0;m<p;++m){let y;o&&(y=r[m],c(y)||(y=r[m]=new Qe({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceRS,y.shaderProgram=e._sp,y.uniformMap=l,y.pass=f,++m),y=r[m],c(y)||(y=r[m]=new Qe({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceRS,y.shaderProgram=e._sp,y.uniformMap=l,y.pass=f,c(e._depthFailAppearance)&&(o&&(++m,y=r[m],c(y)||(y=r[m]=new Qe({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++m,y=r[m],c(y)||(y=r[m]=new Qe({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++g}}Ir._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!B.equals(n,e._modelMatrix))for(B.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],c(s)&&(e._boundingSphereWC[o]=le.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=le.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=le.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));let a=e.appearance.pixelSize;if(c(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];let l=e._boundingSphereWC[o],f=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;l.radius=s.radius+f}};function wLe(e,t,n,i,o,r,s,a){if(t.mode!==oe.SCENE3D&&!B.equals(o,B.IDENTITY))throw new E("Primitive.modelMatrix is only supported in 3D mode.");Ir._updateBoundingVolumes(e,t,o);let l;t.mode===oe.SCENE3D?l=e._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?l=e._boundingSphereCV:t.mode===oe.SCENE2D&&c(e._boundingSphere2D)?l=e._boundingSphere2D:c(e._boundingSphereMorph)&&(l=e._boundingSphereMorph);let u=t.commandList,f=t.passes;if(f.render||f.pick){let h=e.allowPicking,p=xn.castShadows(e.shadows),g=xn.receiveShadows(e.shadows),m=n.length,y=a?2:1;y*=c(e._depthFailAppearance)?2:1;for(let b=0;b<m;++b){let x=Math.floor(b/y),A=n[b];A.modelMatrix=o,A.boundingVolume=l[x],A.cull=r,A.debugShowBoundingVolume=s,A.castShadows=p,A.receiveShadows=g,h?A.pickId="v_pickColor":A.pickId=void 0,u.push(A)}}}Ir.prototype.update=function(e){if(!c(this.geometryInstances)&&this._va.length===0||c(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&this.geometryInstances.length===0||!c(this.appearance)||e.mode!==oe.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(c(this._error))throw this._error;if(c(this.rtcCenter)&&!e.scene3DOnly)throw new E("RTC rendering is only available for 3D only scenes.");if(this._state===Pr.FAILED)return;let t=e.context;if(c(this._batchTable)||cLe(this,t),this._batchTable.attributes.length>0){if(ut.maximumVertexTextureImageUnits===0)throw new ae("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==Pr.COMPLETE&&this._state!==Pr.COMBINED&&(this.asynchronous?gLe(this,e):yLe(this,e)),this._state===Pr.COMBINED&&(xLe(this,e),Iie(this,e),ALe(this,e)),!this.show||this._state!==Pr.COMPLETE)return;this._batchTableOffsetsUpdated||Iie(this,e),this._recomputeBoundingSpheres&&bLe(this,e);let n=this.appearance,i=n.material,o=!1,r=!1;this._appearance!==n?(this._appearance=n,this._material=i,o=!0,r=!0):this._material!==i&&(this._material=i,r=!0);let s=this.depthFailAppearance,a=c(s)?s.material:void 0;this._depthFailAppearance!==s?(this._depthFailAppearance=s,this._depthFailMaterial=a,o=!0,r=!0):this._depthFailMaterial!==a&&(this._depthFailMaterial=a,r=!0);let l=this._appearance.isTranslucent();this._translucent!==l&&(this._translucent=l,o=!0),c(this._material)&&this._material.update(t);let u=n.closed&&l;o&&(this._createRenderStatesFunction??CLe)(this,t,n,u),r&&(this._createShaderProgramFunction??ELe)(this,e,n),(o||r)&&(this._createCommandsFunction??SLe)(this,n,i,l,u,this._colorCommands,this._pickCommands,e),(this._updateAndQueueCommandsFunction??wLe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};var vLe=new le,DLe=new le;function kie(e,t,n){if(n===Zt.TOP){let i=le.clone(e,vLe),o=le.clone(e,DLe);o.center=d.add(o.center,t,o.center),e=le.union(i,o,e)}else n===Zt.ALL&&(e.center=d.add(e.center,t,e.center));return e}function PLe(e,t,n){return function(){let i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=$.createTypedArray(o.componentDatatype,r);return c(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function ILe(e,t,n,i,o){return function(r){if(!c(r)||!c(r.length)||r.length<1||r.length>4)throw new E("value must be and array with length between 1 and 4.");let s=Lie(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}var OLe=new d;function RLe(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(c(i)){i=i.clone();let o=e.modelMatrix,r=t.offset;c(r)&&kie(i,d.fromArray(r.get(),0,OLe),e._offsetInstanceExtend[n]),c(o)&&(i=le.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function MLe(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}Ir.prototype.getGeometryInstanceAttributes=function(e){if(!c(e))throw new E("id is required");if(!c(this._batchTable))throw new E("must call update before calling getGeometryInstanceAttributes");let t=this._perInstanceAttributeCache.get(e);if(c(t))return t;let n=-1,i=this._lastPerInstanceAttributeIndex,o=this._instanceIds,r=o.length;for(let u=0;u<r;++u){let f=(i+u)%r;if(e===o[f]){n=f;break}}if(n===-1)return;let s=this._batchTable,a=this._batchTableAttributeIndices;t={};let l={};for(let u in a)if(a.hasOwnProperty(u)){let f=a[u];l[u]={get:PLe(s,n,f),set:ILe(s,n,f,this,u)}}return RLe(this,l,n),MLe(this,l,n),Object.defineProperties(t,l),this._lastPerInstanceAttributeIndex=n,this._perInstanceAttributeCache.set(e,t),t};Ir.prototype.isDestroyed=function(){return!1};Ir.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();let n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;let i=this._pickIds;for(e=i.length,t=0;t<e;++t)i[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,de(this)};function mO(e,t,n,i){e._error=i,e._state=n,t.afterRender.push(function(){e._ready=e._state===Pr.COMPLETE||e._state===Pr.FAILED})}var Pn=Ir;function LLe(e){if(e=e??W.EMPTY_OBJECT,!c(e.componentDatatype))throw new E("options.componentDatatype is required.");if(!c(e.componentsPerAttribute))throw new E("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.value))throw new E("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=e.normalize??!1,this.value=e.value}var hc=LLe;var AC=`#ifdef TEXTURE_COORDINATES
#ifdef SPHERICAL
in vec4 v_sphericalExtents;
#else // SPHERICAL
in vec2 v_inversePlaneExtents;
in vec4 v_westPlane;
in vec4 v_southPlane;
#endif // SPHERICAL
in vec3 v_uvMinAndSphericalLongitudeRotation;
in vec3 v_uMaxAndInverseDistance;
in vec3 v_vMaxAndInverseDistance;
#endif // TEXTURE_COORDINATES
#ifdef PER_INSTANCE_COLOR
in vec4 v_color;
#endif
#ifdef NORMAL_EC
vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {
vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);
return eyeCoordinate.xyz / eyeCoordinate.w;
}
vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {
vec2 glFragCoordXY = gl_FragCoord.xy;
float upOrRightLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
float downOrLeftLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));
bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);
float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);
float useDownOrLeft = float(useUpOrRight == 0.0);
vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);
vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);
return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;
}
#endif // NORMAL_EC
void main(void)
{
#ifdef REQUIRES_EC
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
#endif
#ifdef REQUIRES_WC
vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;
vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;
#endif
#ifdef TEXTURE_COORDINATES
vec2 uv;
#ifdef SPHERICAL
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);
sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;
uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;
#else // SPHERICAL
uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;
uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;
#endif // SPHERICAL
#endif // TEXTURE_COORDINATES
#ifdef PICK
#ifdef CULL_FRAGMENTS
if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {
out_FragColor.a = 1.0;
czm_writeDepthClamp();
}
#else // CULL_FRAGMENTS
out_FragColor.a = 1.0;
#endif // CULL_FRAGMENTS
#else // PICK
#ifdef CULL_FRAGMENTS
if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {
discard;
}
#endif
#ifdef NORMAL_EC
vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));
vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));
vec3 normalEC = normalize(cross(leftRight, downUp));
#endif
#ifdef PER_INSTANCE_COLOR
vec4 color = czm_gammaCorrect(v_color);
#ifdef FLAT
out_FragColor = color;
#else // FLAT
czm_materialInput materialInput;
materialInput.normalEC = normalEC;
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
czm_material material = czm_getDefaultMaterial(materialInput);
material.diffuse = color.rgb;
material.alpha = color.a;
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
out_FragColor.rgb *= out_FragColor.a;
#else // PER_INSTANCE_COLOR
czm_materialInput materialInput;
#ifdef USES_NORMAL_EC
materialInput.normalEC = normalEC;
#endif
#ifdef USES_POSITION_TO_EYE_EC
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
#endif
#ifdef USES_TANGENT_TO_EYE
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);
#endif
#ifdef USES_ST
materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;
materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;
#endif
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else // FLAT
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
#endif // FLAT
out_FragColor.rgb *= out_FragColor.a;
#endif // PER_INSTANCE_COLOR
czm_writeDepthClamp();
#endif // PICK
}
`;function Pf(e,t,n){T.typeOf.bool("extentsCulling",e),T.typeOf.bool("planarExtents",t),T.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};let i=new T6;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;let o=new T6;if(o.requiresTextureCoordinates=e,n instanceof rn)i.requiresNormalEC=!n.flat;else{let r=`${n.material.shaderSource}
${n.fragmentShaderSource}`;i.normalEC=r.indexOf("materialInput.normalEC")!==-1||r.indexOf("czm_getDefaultMaterial")!==-1,i.positionToEyeEC=r.indexOf("materialInput.positionToEyeEC")!==-1,i.tangentToEyeMatrix=r.indexOf("materialInput.tangentToEyeMatrix")!==-1,i.st=r.indexOf("materialInput.st")!==-1}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Pf.prototype.createFragmentShader=function(e){T.typeOf.bool("columbusView2D",e);let t=this._appearance,n=this._colorShaderDependencies,i=[];!e&&!this._planarExtents&&i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof rn&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let o="";return t instanceof rn||(o=t.material.shaderSource),new He({defines:i,sources:[o,AC]})};Pf.prototype.createPickFragmentShader=function(e){T.typeOf.bool("columbusView2D",e);let t=this._pickShaderDependencies,n=["PICK"];return!e&&!this._planarExtents&&n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new He({defines:n,sources:[AC],pickColorQualifier:"in"})};Pf.prototype.createVertexShader=function(e,t,n,i){return T.defined("defines",e),T.typeOf.string("vertexShaderSource",t),T.typeOf.bool("columbusView2D",n),T.defined("mapProjection",i),qie(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Pf.prototype.createPickVertexShader=function(e,t,n,i){return T.defined("defines",e),T.typeOf.string("vertexShaderSource",t),T.typeOf.bool("columbusView2D",n),T.defined("mapProjection",i),qie(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};var Uie=new d,Vie=new he,zie={high:0,low:0};function qie(e,t,n,i,o,r,s,a){let l=i.slice();if(a.eastMostYhighDefine===""){let u=Vie;u.longitude=O.PI,u.latitude=0,u.height=0;let f=s.project(u,Uie),h=Hn.encode(f.x,zie);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`;let p=Vie;p.longitude=-O.PI,p.latitude=0,p.height=0;let g=s.project(p,Uie);h=Hn.encode(g.x,zie),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`}return n&&(l.push(a.eastMostYhighDefine),l.push(a.eastMostYlowDefine),l.push(a.westMostYhighDefine),l.push(a.westMostYlowDefine)),c(r)&&r instanceof rn&&l.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(l.push("TEXTURE_COORDINATES"),t||n||l.push("SPHERICAL"),n&&l.push("COLUMBUS_VIEW_2D")),new He({defines:l,sources:[o]})}function T6(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}Object.defineProperties(T6.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});function Hie(e,t,n){return Math.abs((t.y-e.y)*n.x-(t.x-e.x)*n.y+t.x*e.y-t.y*e.x)/H.distance(t,e)}var NLe=[new H,new H,new H,new H];function Yie(e,t){let n=NLe,i=H.unpack(t,0,n[0]),o=H.unpack(t,2,n[1]),r=H.unpack(t,4,n[2]);e.uMaxVmax=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});let s=1/Hie(i,o,r),a=1/Hie(i,r,o);e.uvMinAndExtents=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}var Xie=new he,Kie=new d,FLe=new d,BLe=new d,RV={high:0,low:0};function $ie(e,t,n){let i=Xie;i.height=0,i.longitude=e.west,i.latitude=e.south;let o=t.project(i,Kie);i.latitude=e.north;let r=t.project(i,FLe);i.longitude=e.east,i.latitude=e.south;let s=t.project(i,BLe),a=[0,0,0,0],l=[0,0,0,0],u=Hn.encode(o.x,RV);a[0]=u.high,l[0]=u.low,u=Hn.encode(o.y,RV),a[1]=u.high,l[1]=u.low,u=Hn.encode(r.y,RV),a[2]=u.high,l[2]=u.low,u=Hn.encode(s.x,RV),a[3]=u.high,l[3]=u.low,n.planes2D_HIGH=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,value:l})}var kLe=new B,ULe=new B,Gie=new d,VLe=new he,zLe=[new he,new he,new he,new he,new he,new he,new he,new he];function HLe(e,t,n,i,o,r){let s=ce.center(e,VLe);s.height=n;let a=he.toCartesian(s,t,Gie),l=Ot.eastNorthUpToFixedFrame(a,t,kLe),u=B.inverse(l,ULe),f=e.west,h=e.east,p=e.north,g=e.south,m=zLe;m[0].latitude=g,m[0].longitude=f,m[1].latitude=p,m[1].longitude=f,m[2].latitude=p,m[2].longitude=h,m[3].latitude=g,m[3].longitude=h;let y=(f+h)*.5,b=(p+g)*.5;m[4].latitude=g,m[4].longitude=y,m[5].latitude=p,m[5].longitude=y,m[6].latitude=b,m[6].longitude=f,m[7].latitude=b,m[7].longitude=h;let x=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY;for(let R=0;R<8;R++){m[R].height=n;let L=he.toCartesian(m[R],t,Gie);B.multiplyByPoint(u,L,L),L.z=0,x=Math.min(x,L.x),A=Math.max(A,L.x),C=Math.min(C,L.y),S=Math.max(S,L.y)}let v=i;v.x=x,v.y=C,v.z=0,B.multiplyByPoint(l,v,v);let P=o;P.x=A,P.y=C,P.z=0,B.multiplyByPoint(l,P,P),d.subtract(P,v,o);let M=r;M.x=x,M.y=S,M.z=0,B.multiplyByPoint(l,M,M),d.subtract(M,v,r)}var GLe=new d,jLe=new d,WLe=new Hn;Pf.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){T.typeOf.object("boundingRectangle",e),T.defined("textureCoordinateRotationPoints",t),T.typeOf.object("ellipsoid",n),T.typeOf.object("projection",i);let r=Kie,s=GLe,a=jLe;HLe(e,n,o??0,r,s,a);let l={};Yie(l,t);let u=Hn.fromCartesian(r,WLe);return l.southWest_HIGH=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.high,[0,0,0])}),l.southWest_LOW=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.low,[0,0,0])}),l.eastward=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(s,[0,0,0])}),l.northward=new hc({componentDatatype:$.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(a,[0,0,0])}),$ie(e,i,l),l};var qLe=new d;function jie(e,t,n,i){let o=Xie;o.latitude=e,o.longitude=t,o.height=0;let r=he.toCartesian(o,n,qLe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=O.fastApproximateAtan2(s,r.z),l=O.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=l,i}var Wie=new H;Pf.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){T.typeOf.object("boundingRectangle",e),T.defined("textureCoordinateRotationPoints",t),T.typeOf.object("ellipsoid",n),T.typeOf.object("projection",i);let o=jie(e.south,e.west,n,Wie),r=o.x,s=o.y,a=jie(e.north,e.east,n,Wie),l=a.x,u=a.y,f=0;s>u&&(f=O.PI-s,s=-O.PI,u+=f),r-=O.EPSILON5,s-=O.EPSILON5,l+=O.EPSILON5,u+=O.EPSILON5;let h=1/(u-s),p=1/(l-r),g={sphericalExtents:new hc({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,p,h]}),longitudeRotation:new hc({componentDatatype:$.FLOAT,componentsPerAttribute:1,normalize:!1,value:[f]})};return Yie(g,t),$ie(e,i,g),g};Pf.hasAttributesForTextureCoordinatePlanes=function(e){return c(e.southWest_HIGH)&&c(e.southWest_LOW)&&c(e.northward)&&c(e.eastward)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};Pf.hasAttributesForSphericalExtents=function(e){return c(e.sphericalExtents)&&c(e.longitudeRotation)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};function YLe(e){return Math.max(e.width,e.height)>Pf.MAX_WIDTH_FOR_PLANAR_EXTENTS}Pf.shouldUseSphericalCoordinates=function(e){return T.typeOf.object("rectangle",e),YLe(e)};Pf.MAX_WIDTH_FOR_PLANAR_EXTENTS=O.toRadians(1);var bu=Pf;var XLe={NEVER:ne.NEVER,LESS:ne.LESS,EQUAL:ne.EQUAL,LESS_OR_EQUAL:ne.LEQUAL,GREATER:ne.GREATER,NOT_EQUAL:ne.NOTEQUAL,GREATER_OR_EQUAL:ne.GEQUAL,ALWAYS:ne.ALWAYS},Vn=Object.freeze(XLe);var KLe={ZERO:ne.ZERO,KEEP:ne.KEEP,REPLACE:ne.REPLACE,INCREMENT:ne.INCR,DECREMENT:ne.DECR,INVERT:ne.INVERT,INCREMENT_WRAP:ne.INCR_WRAP,DECREMENT_WRAP:ne.DECR_WRAP},ft=Object.freeze(KLe);var MV={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};MV.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:Vn.ALWAYS,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.REPLACE},backFunction:Vn.ALWAYS,backOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.REPLACE},reference:MV.CESIUM_3D_TILE_MASK,mask:MV.CESIUM_3D_TILE_MASK}};var kt=Object.freeze(MV);function Lb(e){e=e??W.EMPTY_OBJECT;let t=e.geometryInstances;this.geometryInstances=t,this.show=e.show??!0,this.classificationType=e.classificationType??Un.BOTH,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.debugShowShadowVolume=e.debugShowShadowVolume??!1,this._debugShowShadowVolume=!1,this._extruded=e._extruded??!1,this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:e.vertexCacheOptimize??!1,interleave:e.interleave??!1,releaseGeometryInstances:e.releaseGeometryInstances??!0,allowPicking:e.allowPicking??!0,asynchronous:e.asynchronous??!0,compressVertices:e.compressVertices??!0,_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(Lb.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}});Lb.isSupported=function(e){return e.context.stencilBuffer};function CC(e,t){let n=t?Vn.EQUAL:Vn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:ft.KEEP,zFail:ft.DECREMENT_WRAP,zPass:ft.KEEP},backFunction:n,backOperation:{fail:ft.KEEP,zFail:ft.INCREMENT_WRAP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:dc.LESS_OR_EQUAL},depthMask:!1}}function C6(e){return{stencilTest:{enabled:e,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:ln.PRE_MULTIPLIED_ALPHA_BLEND}}var $Le={stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function ZLe(e,t,n,i){if(c(e._rsStencilDepthPass))return;let o=!e.debugShowShadowVolume;e._rsStencilDepthPass=Ve.fromCache(CC(o,!1)),e._rsStencilDepthPass3DTiles=Ve.fromCache(CC(o,!0)),e._rsColorPass=Ve.fromCache(C6(o,!1)),e._rsPickPass=Ve.fromCache($Le)}function QLe(e,t){if(!e.compressVertices)return t;if(t.search(/in\s+vec3\s+extrudeDirection;/g)!==-1){let n="compressedAttributes",i=`in vec2 ${n};`,o=`vec3 extrudeDirection;
`,r=`    extrudeDirection = czm_octDecode(${n}, 65535.0);
`,s=t;s=s.replace(/in\s+vec3\s+extrudeDirection;/g,""),s=He.replaceMain(s,"czm_non_compressed_main");let a=`void main() 
{ 
${r}    czm_non_compressed_main(); 
}`;return[i,o,s,a].join(`
`)}}function JLe(e,t){let n=t.context,i=e._primitive,o=uO;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Pn._appendDistanceDisplayConditionToShader(i,o),o=Pn._modifyShaderPosition(e,o,t.scene3DOnly),o=Pn._updateColorAttribute(i,o);let r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=QLe(i,o));let a=e._extruded?"EXTRUDED_GEOMETRY":"",l=new He({defines:[a],sources:[o]}),u=new He({sources:[Jg]}),f=e._primitive._attributeLocations,h=new bu(s,r,e.appearance);if(e._spStencil=Jt.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:f}),e._primitive.allowPicking){let m=He.createPickVertexShaderSource(o);m=Pn._appendShowToShader(i,m),m=Pn._updatePickColorAttribute(m);let y=h.createPickFragmentShader(!1),b=h.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=Jt.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:b,fragmentShaderSource:y,attributeLocations:f}),s){let x=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!c(x)){let A=h.createPickFragmentShader(!0),C=h.createPickVertexShader([a],m,!0,t.mapProjection);x=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:C,fragmentShaderSource:A,attributeLocations:f})}e._spPick2D=x}}else e._spPick=Jt.fromCache({context:n,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:f});o=Pn._appendShowToShader(i,o),l=new He({defines:[a],sources:[o]}),e._sp=Jt.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:f});let p=h.createFragmentShader(!1),g=h.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Jt.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:p,attributeLocations:f}),s){let m=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!c(m)){let y=h.createFragmentShader(!0),b=h.createVertexShader([a],o,!0,t.mapProjection);m=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:b,fragmentShaderSource:y,attributeLocations:f})}e._spColor2D=m}}function eNe(e,t){let n=e._primitive,i=n._va.length*2;t.length=i;let o,r,s,a=0,l=n._batchTable.getUniformMapCallback()(e._uniformMap),u=e._needs2DShader;for(o=0;o<i;o+=2){let g=n._va[a++];r=t[o],c(r)||(r=t[o]=new Qe({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=De.TERRAIN_CLASSIFICATION,s=Qe.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=De.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],c(r)||(r=t[o+1]=new Qe({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=De.TERRAIN_CLASSIFICATION;let y=e.appearance.material;if(c(y)&&(l=xt(l,y._uniforms)),r.uniformMap=l,s=Qe.shallowClone(r,r.derivedCommands.tileset),s.pass=De.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let b=Qe.shallowClone(r,r.derivedCommands.appearance2D);b.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=b,b=Qe.shallowClone(s,s.derivedCommands.appearance2D),b.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=b}}let f=e._commandsIgnoreShow,h=e._spStencil,p=0;i=f.length=i/2;for(let g=0;g<i;++g){let m=f[g]=Qe.shallowClone(t[p],f[g]);m.shaderProgram=h,m.pass=De.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,p+=2}}function tNe(e,t){let n=e._usePickOffsets,i=e._primitive,o=i._va.length*2,r,s=0,a;n&&(r=i._pickOffsets,o=r.length*2),t.length=o;let l,u,f,h=0,p=i._batchTable.getUniformMapCallback()(e._uniformMap),g=e._needs2DShader;for(l=0;l<o;l+=2){let m=i._va[h++];if(n&&(a=r[s++],m=i._va[a.index]),u=t[l],c(u)||(u=t[l]=new Qe({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=m,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=p,u.pass=De.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=Qe.shallowClone(u,u.derivedCommands.tileset),f.renderState=e._rsStencilDepthPass3DTiles,f.pass=De.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,u=t[l+1],c(u)||(u=t[l+1]=new Qe({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=m,u.renderState=e._rsPickPass,u.shaderProgram=e._spPick,u.uniformMap=p,u.pass=De.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=Qe.shallowClone(u,u.derivedCommands.tileset),f.pass=De.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,g){let y=Qe.shallowClone(u,u.derivedCommands.pick2D);y.shaderProgram=e._spPick2D,u.derivedCommands.pick2D=y,y=Qe.shallowClone(f,f.derivedCommands.pick2D),y.shaderProgram=e._spPick2D,f.derivedCommands.pick2D=y}}}function nNe(e,t,n,i,o,r,s){eNe(e,r),tNe(e,s)}function Zie(e,t){return Math.floor(e%t/2)}function A6(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function Qie(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function iNe(e,t,n,i,o,r,s,a){let l=e._primitive;Pn._updateBoundingVolumes(l,t,o);let u;t.mode===oe.SCENE3D?u=l._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?u=l._boundingSphereCV:t.mode===oe.SCENE2D&&c(l._boundingSphere2D)?u=l._boundingSphere2D:c(l._boundingSphereMorph)&&(u=l._boundingSphereMorph);let f=e.classificationType,h=f!==Un.CESIUM_3D_TILE,p=f!==Un.TERRAIN,g=t.passes,m,y,b;if(g.render){let x=n.length;for(m=0;m<x;++m)y=u[Zie(m,x)],h&&(b=n[m],A6(b,t,o,r,y,s)),p&&(b=n[m].derivedCommands.tileset,A6(b,t,o,r,y,s));if(t.invertClassification){let A=e._commandsIgnoreShow,C=A.length;for(m=0;m<C;++m)y=u[m],b=A[m],A6(b,t,o,r,y,s)}}if(g.pick){let x=i.length,A=l._pickOffsets;for(m=0;m<x;++m){let C=A[Zie(m,x)];y=u[C.index],h&&(b=i[m],Qie(b,t,o,r,y)),p&&(b=i[m].derivedCommands.tileset,Qie(b,t,o,r,y))}}}Lb.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;let t=this.appearance;c(t)&&c(t.material)&&t.material.update(e.context);let n=this,i=this._primitiveOptions;if(!c(this._primitive)){let o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s,a,l,u=!1,f=!0,h,p=!1,g=!1;for(r>0&&(l=o[0].attributes,p=bu.hasAttributesForSphericalExtents(l),g=bu.hasAttributesForTextureCoordinatePlanes(l),h=l.color),s=0;s<r;s++){a=o[s];let y=a.attributes.color;if(c(y))u=!0;else if(u)throw new E("All GeometryInstances must have color attributes to use per-instance color.");f=f&&c(y)&&Gt.equals(h,y)}if(!f&&!p&&!g)throw new E("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(u&&!c(t)&&(t=new rn({flat:!0}),this.appearance=t),!u&&t instanceof rn)throw new E("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(c(t.material)&&!p&&!g)throw new E("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!p&&!g,this._hasSphericalExtentsAttribute=p,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=u;let m=new Array(r);for(s=0;s<r;++s)a=o[s],m[s]=new St({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:this._pickPrimitive??n});i.appearance=t,i.geometryInstances=m,c(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(y,b){n._createBoundingVolumeFunction(y,b)}),i._createRenderStatesFunction=function(y,b,x,A){ZLe(n,b)},i._createShaderProgramFunction=function(y,b,x){JLe(n,b)},i._createCommandsFunction=function(y,b,x,A,C,S,v){nNe(n,void 0,void 0,!0,!1,S,v)},c(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(y,b,x,A,C,S,v,P){n._updateAndQueueCommandsFunction(y,b,x,A,C,S,v,P)}:i._updateAndQueueCommandsFunction=function(y,b,x,A,C,S,v,P){iNe(n,b,x,A,C,S,v,P)},this._primitive=new Pn(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=Ve.fromCache(CC(!1,!1)),this._rsStencilDepthPass3DTiles=Ve.fromCache(CC(!1,!0)),this._rsColorPass=Ve.fromCache(C6(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=Ve.fromCache(CC(!0,!1)),this._rsStencilDepthPass3DTiles=Ve.fromCache(CC(!0,!0)),this._rsColorPass=Ve.fromCache(C6(!0))),this._primitive.appearance!==t){if(!this._hasSphericalExtentsAttribute&&!this._hasPlanarExtentsAttributes&&c(t.material))throw new E("Materials on ClassificationPrimitives are not supported except via GroundPrimitive");if(!this._hasPerColorAttribute&&t instanceof rn)throw new E("PerInstanceColorAppearance requires color GeometryInstanceAttribute");this._primitive.appearance=t}this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Lb.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Lb.prototype.isDestroyed=function(){return!1};Lb.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,de(this)};var EC=Lb;var oNe={u_globeMinimumAltitude:function(){return 55e3}};function Nl(e){e=e??W.EMPTY_OBJECT;let t=e.appearance,n=e.geometryInstances;if(!c(t)&&c(n)){let o=Array.isArray(n)?n:[n],r=o.length;for(let s=0;s<r;s++){let a=o[s].attributes;if(c(a)&&c(a.color)){t=new rn({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=e.show??!0,this.classificationType=e.classificationType??Un.BOTH,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.debugShowShadowVolume=e.debugShowShadowVolume??!1,this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=ui._defaultMaxTerrainHeight,this._minTerrainHeight=ui._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;let i=this;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:e.vertexCacheOptimize??!1,interleave:e.interleave??!1,releaseGeometryInstances:e.releaseGeometryInstances??!0,allowPicking:e.allowPicking??!0,asynchronous:e.asynchronous??!0,compressVertices:e.compressVertices??!0,_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:i,_extruded:!0,_uniformMap:oNe}}Object.defineProperties(Nl.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}}});Nl.isSupported=EC.isSupported;function Jie(e){return function(t,n){let i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function eoe(e){return function(t,n){return e._minHeight}}var rNe=new d,sNe=new d,aNe=new d,cNe=new he,lNe=new ce;function LV(e,t){let n=e.mapProjection.ellipsoid;if(!c(t.attributes)||!c(t.attributes.position3DHigh))return c(t.rectangle)?t.rectangle:void 0;let i=t.attributes.position3DHigh.values,o=t.attributes.position3DLow.values,r=i.length,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(let h=0;h<r;h+=3){let p=d.unpack(i,h,rNe),g=d.unpack(o,h,sNe),m=d.add(p,g,aNe),y=n.cartesianToCartographic(m,cNe),b=y.latitude,x=y.longitude;s=Math.min(s,b),a=Math.min(a,x),l=Math.max(l,b),u=Math.max(u,x)}let f=lNe;return f.north=l,f.south=s,f.east=u,f.west=a,f}function uNe(e,t,n){let i=ui.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function fNe(e,t,n){let i=t.mapProjection.ellipsoid,o=LV(t,n),r=Dn.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){let s=t.mapProjection,a=le.fromRectangleWithHeights2D(o,s,e._maxHeight,e._minHeight);d.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function E6(e,t){return Math.floor(e%t/2)}function S6(e,t,n,i,o,r,s){let a=e._primitive;n.mode!==oe.SCENE3D&&t.shaderProgram===a._spColor&&a._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function toe(e,t,n,i,o,r){let s=e._primitive;n.mode!==oe.SCENE3D&&t.shaderProgram===s._spPick&&s._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,n.commandList.push(t)}function dNe(e,t,n,i,o,r,s,a){let l;t.mode===oe.SCENE3D?l=e._boundingVolumes:l=e._boundingVolumes2D;let u=e.classificationType,f=u!==Un.CESIUM_3D_TILE,h=u!==Un.TERRAIN,p=t.passes,g=e._primitive,m,y,b;if(p.render){let x=n.length;for(m=0;m<x;++m)y=l[E6(m,x)],f&&(b=n[m],S6(e,b,t,o,r,y,s)),h&&(b=n[m].derivedCommands.tileset,S6(e,b,t,o,r,y,s));if(t.invertClassification){let A=g._commandsIgnoreShow,C=A.length;for(m=0;m<C;++m)y=l[m],b=A[m],S6(e,b,t,o,r,y,s)}}if(p.pick){let x=i.length,A;for(e._useFragmentCulling||(A=g._primitive._pickOffsets),m=0;m<x;++m){if(y=l[E6(m,x)],!e._useFragmentCulling){let C=A[E6(m,x)];y=l[C.index]}f&&(b=i[m],toe(e,b,t,o,r,y)),h&&(b=i[m].derivedCommands.tileset,toe(e,b,t,o,r,y))}}}Nl.initializeTerrainHeights=function(){return ui.initialize()};Nl.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;if(!ui.initialized){if(!this.asynchronous)throw new E("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");Nl.initializeTerrainHeights();return}let t=this,n=this._classificationPrimitiveOptions;if(!c(this._primitive)){let i=e.mapProjection.ellipsoid,o,r,s,a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],l=a.length,u=new Array(l),f,h;for(f=0;f<l;++f){o=a[f],r=o.geometry;let y=LV(e,r);c(h)?c(y)&&ce.union(h,y,h):h=ce.clone(y);let b=o.id;if(c(b)&&c(y)){let x=ui.getBoundingSphere(y,i);this._boundingSpheresKeys.push(b),this._boundingSpheres.push(x)}if(s=r.constructor,!c(s)||!c(s.createShadowVolume))throw new E("Not all of the geometry instances have GroundPrimitive support.")}uNe(this,h,i);let p=e.verticalExaggeration,g=e.verticalExaggerationRelativeHeight;this._minHeight=Dr.getHeight(this._minTerrainHeight,p,g),this._maxHeight=Dr.getHeight(this._maxTerrainHeight,p,g);let m=Nl._supportsMaterials(e.context);if(this._useFragmentCulling=m,m){let y,b=!0;for(f=0;f<l;++f)if(o=a[f],r=o.geometry,h=LV(e,r),bu.shouldUseSphericalCoordinates(h)){b=!1;break}for(f=0;f<l;++f){o=a[f],r=o.geometry,s=r.constructor;let x=LV(e,r),A=r.textureCoordinateRotationPoints;b?y=bu.getPlanarTextureCoordinateAttributes(x,A,i,e.mapProjection,this._maxHeight):y=bu.getSphericalExtentGeometryInstanceAttributes(x,A,i,e.mapProjection);let C=o.attributes;for(let S in C)C.hasOwnProperty(S)&&(y[S]=C[S]);u[f]=new St({geometry:s.createShadowVolume(r,eoe(this),Jie(this)),attributes:y,id:o.id})}}else for(f=0;f<l;++f)o=a[f],r=o.geometry,s=r.constructor,u[f]=new St({geometry:s.createShadowVolume(r,eoe(this),Jie(this)),attributes:o.attributes,id:o.id});n.geometryInstances=u,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(y,b){fNe(t,y,b)},n._updateAndQueueCommandsFunction=function(y,b,x,A,C,S,v,P){dNe(t,b,x,A,C,S,v,P)},this._primitive=new EC(n)}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Nl.prototype.getBoundingSphere=function(e){let t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};Nl.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Nl.prototype.isDestroyed=function(){return!1};Nl.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),de(this)};Nl._supportsMaterials=function(e){return e.depthTexture};Nl.supportsMaterials=function(e){return T.typeOf.object("scene",e),Nl._supportsMaterials(e.frameState.context)};var jc=Nl;function SC(){E.throwInstantiationError()}Object.defineProperties(SC.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});SC.prototype.getType=E.throwInstantiationError;SC.prototype.getValue=E.throwInstantiationError;SC.prototype.equals=E.throwInstantiationError;var hNe=new Q;SC.getValue=function(e,t,n){let i;return c(e)||(e=Q.now(hNe)),c(t)&&(i=t.getType(e),c(i))?((!c(n)||n.type!==i)&&(n=Xi.fromType(i)),t.getValue(e,n.uniforms),n):((!c(n)||n.type!==Xi.ColorType)&&(n=Xi.fromType(Xi.ColorType)),G.clone(G.WHITE,n.uniforms.color),n)};var tr=SC;function Nb(e,t,n){T.defined("geometryUpdater",e),T.defined("primitives",t),T.defined("orderedGroundPrimitives",n),this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}Nb.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!X.getValueOrDefault(t.show,n,!0)};Nb.prototype._setOptions=E.throwInstantiationError;Nb.prototype.update=function(e){T.defined("time",e);let t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,o=this._orderedGroundPrimitives;n?o.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;let r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;let a=this._geometryUpdater.shadowsProperty.getValue(e),l=this._options;if(!c(s.fill)||s.fill.getValue(e)){let u=t.fillMaterialProperty,f=u instanceof Ut,h,p=t._getIsClosed(l);if(f)h=new rn({closed:p,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{let g=tr.getValue(e,u,this._material);this._material=g,h=new ao({material:g,translucent:g.isTranslucent(),closed:p})}if(n)l.vertexFormat=rn.VERTEX_FORMAT,this._primitive=o.add(new jc({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:h,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),X.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{l.vertexFormat=h.vertexFormat;let g=this._geometryUpdater.createFillGeometryInstance(e);f&&(h.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Pn({geometryInstances:g,appearance:h,asynchronous:!1,shadows:a}))}}if(!n&&c(s.outline)&&s.outline.getValue(e)){let u=this._geometryUpdater.createOutlineGeometryInstance(e),f=X.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Pn({geometryInstances:u,appearance:new rn({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(f)}}),asynchronous:!1,shadows:a}))}};Nb.prototype.getBoundingSphere=function(e){if(!c(e))throw new E("result is required.");let t=this._entity,n=this._primitive,i=this._outlinePrimitive,o;return c(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))?(le.clone(o.boundingSphere,e),lt.DONE):c(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))?(le.clone(o.boundingSphere,e),lt.DONE):c(n)&&!n.ready||c(i)&&!i.ready?lt.PENDING:lt.FAILED};Nb.prototype.isDestroyed=function(){return!1};Nb.prototype.destroy=function(){let e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),de(this)};var ni=Nb;var noe={};function pO(e,t){if(!c(e))throw new E("identifier is required.");c(noe[e])||(noe[e]=!0,console.warn(t??e))}pO.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.";pO.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined.  zIndex will be ignored";pO.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height.  heightReference will be ignored";pO.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight.  extrudedHeightReference will be ignored";var dt=pO;var mNe={AUTODETECT:0,ENU:1,INERTIAL:2,VELOCITY:3},Bp=Object.freeze(mNe);var pNe={NONE:0,GEODESIC:1,RHUMB:2},qt=Object.freeze(pNe);var ioe=O.EPSILON10;function _Ne(e,t,n,i){if(T.defined("equalsEpsilon",t),!c(e))return;n=n??!1;let o=c(i),r=e.length;if(r<2)return e;let s,a=e[0],l,u,f=0,h=-1;for(s=1;s<r;++s)l=e[s],t(a,l,ioe)?(c(u)||(u=e.slice(0,s),f=s-1,h=0),o&&i.push(s)):(c(u)&&(u.push(l),f=s,o&&(h=i.length)),a=l);return n&&t(e[0],e[r-1],ioe)&&(o&&(c(u)?i.splice(h,0,f):i.push(r-1)),c(u)?u.length-=1:u=e.slice(0,-1)),c(u)?u:e}var xo=_Ne;function gNe(e){let t=e._uSquared,n=e._ellipsoid.maximumRadius,i=e._ellipsoid.minimumRadius,o=(n-i)/n,r=Math.cos(e._startHeading),s=Math.sin(e._startHeading),a=(1-o)*Math.tan(e._start.latitude),l=1/Math.sqrt(1+a*a),u=l*a,f=Math.atan2(a,r),h=l*s,p=h*h,g=1-p,m=Math.sqrt(g),y=t/4,b=y*y,x=b*y,A=b*b,C=1+y-3*b/4+5*x/4-175*A/64,S=1-y+15*b/8-35*x/8,v=1-3*y+35*b/4,P=1-5*y,M=C*f-S*Math.sin(2*f)*y/2-v*Math.sin(4*f)*b/16-P*Math.sin(6*f)*x/48-Math.sin(8*f)*5*A/512,R=e._constants;R.a=n,R.b=i,R.f=o,R.cosineHeading=r,R.sineHeading=s,R.tanU=a,R.cosineU=l,R.sineU=u,R.sigma=f,R.sineAlpha=h,R.sineSquaredAlpha=p,R.cosineSquaredAlpha=g,R.cosineAlpha=m,R.u2Over4=y,R.u4Over16=b,R.u6Over64=x,R.u8Over256=A,R.a0=C,R.a1=S,R.a2=v,R.a3=P,R.distanceRatio=M}function yNe(e,t){return e*t*(4+e*(4-3*t))/16}function ooe(e,t,n,i,o,r,s){let a=yNe(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function bNe(e,t,n,i,o,r,s){let a=(t-n)/t,l=r-i,u=Math.atan((1-a)*Math.tan(o)),f=Math.atan((1-a)*Math.tan(s)),h=Math.cos(u),p=Math.sin(u),g=Math.cos(f),m=Math.sin(f),y=h*g,b=h*m,x=p*m,A=p*g,C=l,S=O.TWO_PI,v=Math.cos(C),P=Math.sin(C),M,R,L,F,_;do{v=Math.cos(C),P=Math.sin(C);let U=b-A*v;L=Math.sqrt(g*g*P*P+U*U),R=x+y*v,M=Math.atan2(L,R);let q;L===0?(q=0,F=1):(q=y*P/L,F=1-q*q),S=C,_=R-2*x/F,isFinite(_)||(_=0),C=l+ooe(a,q,F,M,L,R,_)}while(Math.abs(C-S)>O.EPSILON12);let w=F*(t*t-n*n)/(n*n),D=1+w*(4096+w*(w*(320-175*w)-768))/16384,I=w*(256+w*(w*(74-47*w)-128))/1024,N=_*_,k=I*L*(_+I*(R*(2*N-1)-I*_*(4*L*L-3)*(4*N-3)/6)/4),z=n*D*(M-k),V=Math.atan2(g*P,b-A*v),j=Math.atan2(h*P,b*v-A);e._distance=z,e._startHeading=V,e._endHeading=j,e._uSquared=w}var xNe=new d,w6=new d;function roe(e,t,n,i){let o=d.normalize(i.cartographicToCartesian(t,w6),xNe),r=d.normalize(i.cartographicToCartesian(n,w6),w6);T.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125),bNe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=he.clone(t,e._start),e._end=he.clone(n,e._end),e._start.height=0,e._end.height=0,gNe(e)}function _O(e,t,n){let i=n??ie.default;this._ellipsoid=i,this._start=new he,this._end=new he,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,c(e)&&c(t)&&roe(this,e,t,i)}Object.defineProperties(_O.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return T.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return T.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return T.defined("distance",this._distance),this._endHeading}}});_O.prototype.setEndPoints=function(e,t){T.defined("start",e),T.defined("end",t),roe(this,e,t,this._ellipsoid)};_O.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};_O.prototype.interpolateUsingSurfaceDistance=function(e,t){T.defined("distance",this._distance);let n=this._constants,i=n.distanceRatio+e/n.b,o=Math.cos(2*i),r=Math.cos(4*i),s=Math.cos(6*i),a=Math.sin(2*i),l=Math.sin(4*i),u=Math.sin(6*i),f=Math.sin(8*i),h=i*i,p=i*h,g=n.u8Over256,m=n.u2Over4,y=n.u6Over64,b=n.u4Over16,x=2*p*g*o/3+i*(1-m+7*b/4-15*y/4+579*g/64-(b-15*y/4+187*g/16)*o-(5*y/4-115*g/16)*r-29*g*s/16)+(m/2-b+71*y/32-85*g/16)*a+(5*b/16-5*y/4+383*g/96)*l-h*((y-11*g/2)*a+5*g*l/2)+(29*y/96-29*g/16)*u+539*g*f/1536,A=Math.asin(Math.sin(x)*n.cosineAlpha),C=Math.atan(n.a/n.b*Math.tan(A));x=x-n.sigma;let S=Math.cos(2*n.sigma+x),v=Math.sin(x),P=Math.cos(x),M=n.cosineU*P,R=n.sineU*v,F=Math.atan2(v*n.sineHeading,M-R*n.cosineHeading)-ooe(n.f,n.sineAlpha,n.cosineSquaredAlpha,x,v,P,S);return c(t)?(t.longitude=this._start.longitude+F,t.latitude=C,t.height=0,t):new he(this._start.longitude+F,C,0)};var kp=_O;function D6(e,t,n){if(e===0)return t*n;let i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,l=a*i,u=n,f=Math.sin(2*u),h=Math.sin(4*u),p=Math.sin(6*u),g=Math.sin(8*u),m=Math.sin(10*u),y=Math.sin(12*u);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*l/1048576)*u-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*l/524288)*f+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*l/8388608)*h-(35*r/3072+175*s/12288+3675*a/262144+13475*l/1048576)*p+(315*s/131072+2205*a/524288+43659*l/8388608)*g-(693*a/1310720+6237*l/5242880)*m+1001*l/8388608*y)}function TNe(e,t,n){let i=e/n;if(t===0)return i;let o=i*i,r=o*i,s=r*i,a=t,l=a*a,u=l*l,f=u*l,h=f*l,p=h*l,g=p*l,m=Math.sin(2*i),y=Math.cos(2*i),b=Math.sin(4*i),x=Math.cos(4*i),A=Math.sin(6*i),C=Math.cos(6*i),S=Math.sin(8*i),v=Math.cos(8*i),P=Math.sin(10*i),M=Math.cos(10*i),R=Math.sin(12*i);return i+i*l/4+7*i*u/64+15*i*f/256+579*i*h/16384+1515*i*p/65536+16837*i*g/1048576+(3*i*u/16+45*i*f/256-i*(32*o-561)*h/4096-i*(232*o-1677)*p/16384+i*(399985-90560*o+512*s)*g/5242880)*y+(21*i*f/256+483*i*h/4096-i*(224*o-1969)*p/16384-i*(33152*o-112599)*g/1048576)*x+(151*i*h/4096+4681*i*p/65536+1479*i*g/16384-453*r*g/32768)*C+(1097*i*p/65536+42783*i*g/1048576)*v+8011*i*g/1048576*M+(3*l/8+3*u/16+213*f/2048-3*o*f/64+255*h/4096-33*o*h/512+20861*p/524288-33*o*p/512+s*p/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*m+(21*u/256+21*f/256+533*h/8192-21*o*h/512+197*p/4096-315*o*p/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*b+(151*f/6144+151*h/4096+5019*p/131072-453*o*p/16384+26965*g/786432-8607*o*g/131072)*A+(1097*h/131072+1097*p/65536+225797*g/10485760-1097*o*g/65536)*S+(8011*p/2621440+8011*g/1048576)*P+293393*g/251658240*R}function wC(e,t){if(e===0)return Math.log(Math.tan(.5*(O.PI_OVER_TWO+t)));let n=e*Math.sin(t);return Math.log(Math.tan(.5*(O.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function ANe(e,t,n,i,o){let r=wC(e._ellipticity,n),s=wC(e._ellipticity,o);return Math.atan2(O.negativePiToPi(i-t),s-r)}function CNe(e,t,n,i,o,r,s){let a=e._heading,l=r-i,u=0;if(O.equalsEpsilon(Math.abs(a),O.PI_OVER_TWO,O.EPSILON8))if(t===n)u=t*Math.cos(o)*O.negativePiToPi(l);else{let f=Math.sin(o);u=t*Math.cos(o)*O.negativePiToPi(l)/Math.sqrt(1-e._ellipticitySquared*f*f)}else{let f=D6(e._ellipticity,t,o);u=(D6(e._ellipticity,t,s)-f)/Math.cos(a)}return Math.abs(u)}var ENe=new d,v6=new d;function soe(e,t,n,i){let o=d.normalize(i.cartographicToCartesian(t,v6),ENe),r=d.normalize(i.cartographicToCartesian(n,v6),v6);T.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125);let s=i.maximumRadius,a=i.minimumRadius,l=s*s,u=a*a;e._ellipticitySquared=(l-u)/l,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=he.clone(t,e._start),e._start.height=0,e._end=he.clone(n,e._end),e._end.height=0,e._heading=ANe(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=CNe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function aoe(e,t,n,i,o,r){if(n===0)return he.clone(e,r);let s=o*o,a,l,u;if(Math.abs(O.PI_OVER_TWO-Math.abs(t))>O.EPSILON8){let f=D6(o,i,e.latitude),h=n*Math.cos(t),p=f+h;if(l=TNe(p,o,i),Math.abs(t)<O.EPSILON10)a=O.negativePiToPi(e.longitude);else{let g=wC(o,e.latitude),m=wC(o,l);u=Math.tan(t)*(m-g),a=O.negativePiToPi(e.longitude+u)}}else{l=e.latitude;let f;if(o===0)f=i*Math.cos(e.latitude);else{let h=Math.sin(e.latitude);f=i*Math.cos(e.latitude)/Math.sqrt(1-s*h*h)}u=n/f,t>0?a=O.negativePiToPi(e.longitude+u):a=O.negativePiToPi(e.longitude-u)}return c(r)?(r.longitude=a,r.latitude=l,r.height=0,r):new he(a,l,0)}function Up(e,t,n){let i=n??ie.default;this._ellipsoid=i,this._start=new he,this._end=new he,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,c(e)&&c(t)&&soe(this,e,t,i)}Object.defineProperties(Up.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return T.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return T.defined("distance",this._distance),this._heading}}});Up.fromStartHeadingDistance=function(e,t,n,i,o){T.defined("start",e),T.defined("heading",t),T.defined("distance",n),T.typeOf.number.greaterThan("distance",n,0);let r=i??ie.default,s=r.maximumRadius,a=r.minimumRadius,l=s*s,u=a*a,f=Math.sqrt((l-u)/l);t=O.negativePiToPi(t);let h=aoe(e,t,n,r.maximumRadius,f);return!c(o)||c(i)&&!i.equals(o.ellipsoid)?new Up(e,h,r):(o.setEndPoints(e,h),o)};Up.prototype.setEndPoints=function(e,t){T.defined("start",e),T.defined("end",t),soe(this,e,t,this._ellipsoid)};Up.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};Up.prototype.interpolateUsingSurfaceDistance=function(e,t){if(T.typeOf.number("distance",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");return aoe(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};Up.prototype.findIntersectionWithLongitude=function(e,t){if(T.typeOf.number("intersectionLongitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");let n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=O.negativePiToPi(e),O.equalsEpsilon(Math.abs(e),Math.PI,O.EPSILON14)&&(e=O.sign(r.longitude)*Math.PI),c(t)||(t=new he),Math.abs(O.PI_OVER_TWO-o)<=O.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(O.equalsEpsilon(Math.abs(O.PI_OVER_TWO-o),O.PI_OVER_TWO,O.EPSILON8))return O.equalsEpsilon(e,r.longitude,O.EPSILON12)?void 0:(t.longitude=e,t.latitude=O.PI_OVER_TWO*O.sign(O.PI_OVER_TWO-i),t.height=0,t);let s=r.latitude,a=n*Math.sin(s),l=Math.tan(.5*(O.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a),f=r.latitude,h;do{h=f;let p=n*Math.sin(h),g=(1+p)/(1-p);f=2*Math.atan(l*Math.pow(g/u,n/2))-O.PI_OVER_TWO}while(!O.equalsEpsilon(f,h,O.EPSILON12));return t.longitude=e,t.latitude=f,t.height=0,t};Up.prototype.findIntersectionWithLatitude=function(e,t){if(T.typeOf.number("intersectionLatitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");let n=this._ellipticity,i=this._heading,o=this._start;if(O.equalsEpsilon(Math.abs(i),O.PI_OVER_TWO,O.EPSILON8))return;let r=wC(n,o.latitude),s=wC(n,e),a=Math.tan(i)*(s-r),l=O.negativePiToPi(o.longitude+a);return c(t)?(t.longitude=l,t.latitude=e,t.height=0,t):new he(l,e,0)};var Ba=Up;var F6=[Oi,Mi],SNe=F6.length,voe=Math.cos(O.toRadians(30)),coe=Math.cos(O.toRadians(150)),Doe=0,Poe=1e3;function ty(e){e=e??W.EMPTY_OBJECT;let t=e.positions;if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(c(e.arcType)&&e.arcType!==qt.GEODESIC&&e.arcType!==qt.RHUMB)throw new E("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=e.width??1,this._positions=t,this.granularity=e.granularity??9999,this.loop=e.loop??!1,this.arcType=e.arcType??qt.GEODESIC,this._ellipsoid=ie.default,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ty.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+ie.packedLength+1+1}}});ty.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<SNe;i++)if(t instanceof F6[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};var wNe=new d,loe=new d,uoe=new d;function N6(e,t,n,i,o){let r=Wc(i,e,0,wNe),s=Wc(i,e,n,loe),a=Wc(i,t,0,uoe),l=Vp(s,r,loe),u=Vp(a,r,uoe);return d.cross(u,l,o),d.normalize(o,o)}var vNe=new he,DNe=new d,PNe=new d,INe=new d;function P6(e,t,n,i,o,r,s,a,l,u,f){if(o===0)return;let h;r===qt.GEODESIC?h=new kp(e,t,s):r===qt.RHUMB&&(h=new Ba(e,t,s));let p=h.surfaceDistance;if(p<o)return;let g=N6(e,t,i,s,INe),m=Math.ceil(p/o),y=p/m,b=y,x=m-1,A=a.length;for(let C=0;C<x;C++){let S=h.interpolateUsingSurfaceDistance(b,vNe),v=Wc(s,S,n,DNe),P=Wc(s,S,i,PNe);d.pack(g,a,A),d.pack(v,l,A),d.pack(P,u,A),f.push(S.latitude),f.push(S.longitude),A+=3,b+=y}}var I6=new he;function Wc(e,t,n,i){return he.clone(t,I6),I6.height=n,he.toCartesian(I6,e,i)}ty.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t);let i=n??0,o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){let a=o[s];d.pack(a,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,ie.pack(e._ellipsoid,t,i),i+=ie.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t};ty.unpack=function(e,t,n){T.defined("array",e);let i=t??0,o=e[i++],r=new Array(o);for(let p=0;p<o;p++)r[p]=d.unpack(e,i),i+=3;let s=e[i++],a=e[i++]===1,l=e[i++],u=ie.unpack(e,i);i+=ie.packedLength;let f=e[i++],h=e[i++]===1;return c(n)||(n=new ty({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=l,n._ellipsoid=u,n._projectionIndex=f,n._scene3DOnly=h,n};function Vp(e,t,n){return d.subtract(e,t,n),d.normalize(n,n),n}function foe(e,t,n,i){return i=Vp(e,t,i),i=d.cross(i,n,i),i=d.normalize(i,i),i=d.cross(n,i,i),i}var ONe=new d,RNe=new d,MNe=new d,Ioe=new d,LNe=0,NNe=-1;function O6(e,t,n,i,o){let r=Vp(n,t,Ioe),s=foe(e,t,r,ONe),a=foe(i,t,r,RNe);if(O.equalsEpsilon(d.dot(s,a),NNe,O.EPSILON5))return o=d.cross(r,s,o),o=d.normalize(o,o),o;o=d.add(a,s,o),o=d.normalize(o,o);let l=d.cross(r,o,MNe);return d.dot(a,l)<LNe&&(o=d.negate(o,o)),o}var kV=sn.fromPointNormal(d.ZERO,d.UNIT_Y),FNe=new d,BNe=new d,kNe=new d,UNe=new d,VNe=new d,NV=new d,FV=new he,doe=new he,hoe=new he;ty.createGeometry=function(e){let t=!e._scene3DOnly,n=e.loop,i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new F6[e._projectionIndex](i),a=Doe,l=Poe,u,f,h=e._positions,p=h.length;p===2&&(n=!1);let g,m,y,b,x=new Ba(void 0,void 0,i),A,C,S,v=[h[0]];for(f=0;f<p-1;f++)g=h[f],m=h[f+1],A=Zn.lineSegmentPlane(g,m,kV,NV),c(A)&&!d.equalsEpsilon(A,g,O.EPSILON7)&&!d.equalsEpsilon(A,m,O.EPSILON7)&&(e.arcType===qt.GEODESIC?v.push(d.clone(A)):e.arcType===qt.RHUMB&&(S=i.cartesianToCartographic(A,FV).longitude,y=i.cartesianToCartographic(g,FV),b=i.cartesianToCartographic(m,doe),x.setEndPoints(y,b),C=x.findIntersectionWithLongitude(S,hoe),A=i.cartographicToCartesian(C,NV),c(A)&&!d.equalsEpsilon(A,g,O.EPSILON7)&&!d.equalsEpsilon(A,m,O.EPSILON7)&&v.push(d.clone(A)))),v.push(m);n&&(g=h[p-1],m=h[0],A=Zn.lineSegmentPlane(g,m,kV,NV),c(A)&&!d.equalsEpsilon(A,g,O.EPSILON7)&&!d.equalsEpsilon(A,m,O.EPSILON7)&&(e.arcType===qt.GEODESIC?v.push(d.clone(A)):e.arcType===qt.RHUMB&&(S=i.cartesianToCartographic(A,FV).longitude,y=i.cartesianToCartographic(g,FV),b=i.cartesianToCartographic(m,doe),x.setEndPoints(y,b),C=x.findIntersectionWithLongitude(S,hoe),A=i.cartographicToCartesian(C,NV),c(A)&&!d.equalsEpsilon(A,g,O.EPSILON7)&&!d.equalsEpsilon(A,m,O.EPSILON7)&&v.push(d.clone(A)))));let P=v.length,M=new Array(P);for(f=0;f<P;f++){let Y=he.fromCartesian(v[f],i);Y.height=0,M[f]=Y}if(M=xo(M,he.equalsEpsilon),P=M.length,P<2)return;let R=[],L=[],F=[],_=[],w=FNe,D=BNe,I=kNe,N=UNe,k=VNe,z=M[0],V=M[1],j=M[P-1];for(w=Wc(i,j,a,w),N=Wc(i,V,a,N),D=Wc(i,z,a,D),I=Wc(i,z,l,I),n?k=O6(w,D,I,N,k):k=N6(z,V,l,i,k),d.pack(k,L,0),d.pack(D,F,0),d.pack(I,_,0),R.push(z.latitude),R.push(z.longitude),P6(z,V,a,l,o,r,i,L,F,_,R),f=1;f<P-1;++f){w=d.clone(D,w),D=d.clone(N,D);let Y=M[f];Wc(i,Y,l,I),Wc(i,M[f+1],a,N),O6(w,D,I,N,k),u=L.length,d.pack(k,L,u),d.pack(D,F,u),d.pack(I,_,u),R.push(Y.latitude),R.push(Y.longitude),P6(M[f],M[f+1],a,l,o,r,i,L,F,_,R)}let U=M[P-1],q=M[P-2];if(D=Wc(i,U,a,D),I=Wc(i,U,l,I),n){let Y=M[0];w=Wc(i,q,a,w),N=Wc(i,Y,a,N),k=O6(w,D,I,N,k)}else k=N6(q,U,l,i,k);if(u=L.length,d.pack(k,L,u),d.pack(D,F,u),d.pack(I,_,u),R.push(U.latitude),R.push(U.longitude),n){for(P6(U,z,a,l,o,r,i,L,F,_,R),u=L.length,f=0;f<3;++f)L[u+f]=L[f],F[u+f]=F[f],_[u+f]=_[f];R.push(z.latitude),R.push(z.longitude)}return dFe(n,s,F,_,L,R,t)};var zNe=new d,HNe=new J,GNe=new Le;function moe(e,t,n,i){let o=Vp(n,t,zNe),r=d.dot(o,e);if(r>voe||r<coe){let s=Vp(i,n,Ioe),a=r<coe?O.PI_OVER_TWO:-O.PI_OVER_TWO,l=Le.fromAxisAngle(s,a,GNe),u=J.fromQuaternion(l,HNe);return J.multiplyByVector(u,e,e),!0}return!1}var poe=new he,jNe=new d,_oe=new d;function gO(e,t,n,i,o){let r=he.toCartesian(t,e._ellipsoid,jNe),s=d.add(r,n,_oe),a=!1,l=e._ellipsoid,u=l.cartesianToCartographic(s,poe);Math.abs(t.longitude-u.longitude)>O.PI_OVER_TWO&&(a=!0,s=d.subtract(r,n,_oe),u=l.cartesianToCartographic(s,poe)),u.height=0;let f=e.project(u,o);return o=d.subtract(f,i,o),o.z=0,o=d.normalize(o,o),a&&d.negate(o,o),o}var WNe=new d,goe=new d;function yoe(e,t,n,i,o,r){let s=d.subtract(t,e,WNe);d.normalize(s,s);let a=n-Doe,l=d.multiplyByScalar(s,a,goe);d.add(e,l,o);let u=i-Poe;l=d.multiplyByScalar(s,u,goe),d.add(t,l,r)}var qNe=new d;function BV(e,t){let n=sn.getPointDistance(kV,e),i=sn.getPointDistance(kV,t),o=qNe;O.equalsEpsilon(n,0,O.EPSILON2)?(o=Vp(t,e,o),d.multiplyByScalar(o,O.EPSILON2,o),d.add(e,o,e)):O.equalsEpsilon(i,0,O.EPSILON2)&&(o=Vp(e,t,o),d.multiplyByScalar(o,O.EPSILON2,o),d.add(t,o,t))}function YNe(e,t){let n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(O.equalsEpsilon(n,O.PI,O.EPSILON11)){let o=O.sign(t.longitude);return e.longitude=o*(n-O.EPSILON11),1}else if(O.equalsEpsilon(i,O.PI,O.EPSILON11)){let o=O.sign(e.longitude);return t.longitude=o*(i-O.EPSILON11),2}return 0}var Ooe=new he,Roe=new he,boe=new d,R6=new d,xoe=new d,Toe=new d,XNe=new d,Aoe=new d,KNe=[Ooe,Roe],$Ne=new ce,ZNe=new d,QNe=new d,JNe=new d,eFe=new d,tFe=new d,nFe=new d,M6=new d,L6=new d,iFe=new d,oFe=new d,rFe=new d,Coe=new d,sFe=new d,aFe=new d,cFe=new Hn,lFe=new Hn,Eoe=new d,uFe=new d,Soe=new d,fFe=[new le,new le],Moe=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],woe=Moe.length;function dFe(e,t,n,i,o,r,s){let a,l,u=t._ellipsoid,f=n.length/3-1,h=f*8,p=h*4,g=f*36,m=h>65535?new Uint32Array(g):new Uint16Array(g),y=new Float64Array(h*3),b=new Float32Array(p),x=new Float32Array(p),A=new Float32Array(p),C=new Float32Array(p),S=new Float32Array(p),v,P,M,R;s&&(v=new Float32Array(p),P=new Float32Array(p),M=new Float32Array(p),R=new Float32Array(h*2));let L=r.length/2,F=0,_=Ooe;_.height=0;let w=Roe;w.height=0;let D=boe,I=R6;if(s)for(l=0,a=1;a<L;a++)_.latitude=r[l],_.longitude=r[l+1],w.latitude=r[l+2],w.longitude=r[l+3],D=t.project(_,D),I=t.project(w,I),F+=d.distance(D,I),l+=2;let N=i.length/3;I=d.unpack(i,0,I);let k=0;for(l=3,a=1;a<N;a++)D=d.clone(I,D),I=d.unpack(i,l,I),k+=d.distance(D,I),l+=3;let z;l=3;let V=0,j=0,U=0,q=0,Y=!1,te=d.unpack(n,0,Toe),K=d.unpack(i,0,R6),Z=d.unpack(o,0,Aoe);if(e){let Ee=d.unpack(n,n.length-6,xoe);moe(Z,Ee,te,K)&&(Z=d.negate(Z,Z))}let ee=0,me=0,Te=0;for(a=0;a<f;a++){let Ee=d.clone(te,xoe),ze=d.clone(K,boe),qe=d.clone(Z,XNe);Y&&(qe=d.negate(qe,qe)),te=d.unpack(n,l,Toe),K=d.unpack(i,l,R6),Z=d.unpack(o,l,Aoe),Y=moe(Z,Ee,te,K),_.latitude=r[V],_.longitude=r[V+1],w.latitude=r[V+2],w.longitude=r[V+3];let it,Dt,jt,$e;if(s){let _i=YNe(_,w);it=t.project(_,tFe),Dt=t.project(w,nFe);let ca=Vp(Dt,it,Eoe);ca.y=Math.abs(ca.y),jt=M6,$e=L6,_i===0||d.dot(ca,d.UNIT_Y)>voe?(jt=gO(t,_,qe,it,M6),$e=gO(t,w,Z,Dt,L6)):_i===1?($e=gO(t,w,Z,Dt,L6),jt.x=0,jt.y=O.sign(_.longitude-Math.abs(w.longitude)),jt.z=0):(jt=gO(t,_,qe,it,M6),$e.x=0,$e.y=O.sign(_.longitude-w.longitude),$e.z=0)}let un=d.distance(ze,K),zt=Hn.fromCartesian(Ee,cFe),Ct=d.subtract(te,Ee,iFe),Ei=d.normalize(Ct,Coe),an=d.subtract(ze,Ee,oFe);an=d.normalize(an,an);let _e=d.cross(Ei,an,Coe);_e=d.normalize(_e,_e);let Ce=d.cross(an,qe,sFe);Ce=d.normalize(Ce,Ce);let pn=d.subtract(K,te,rFe);pn=d.normalize(pn,pn);let mt=d.cross(Z,pn,aFe);mt=d.normalize(mt,mt);let so=un/k,Ro=ee/k,aa=0,Nr,Cs,Ne,ot=0,Xe=0;if(s){aa=d.distance(it,Dt),Nr=Hn.fromCartesian(it,lFe),Cs=d.subtract(Dt,it,Eoe),Ne=d.normalize(Cs,uFe);let _i=Ne.x;Ne.x=Ne.y,Ne.y=-_i,ot=aa/F,Xe=me/F}for(z=0;z<8;z++){let _i=q+z*4,ca=j+z*2,Jr=_i+3,El=z<4?1:-1,yo=z===2||z===3||z===6||z===7?1:-1;d.pack(zt.high,b,_i),b[Jr]=Ct.x,d.pack(zt.low,x,_i),x[Jr]=Ct.y,d.pack(Ce,A,_i),A[Jr]=Ct.z,d.pack(mt,C,_i),C[Jr]=so*El,d.pack(_e,S,_i);let Fr=Ro*yo;Fr===0&&yo<0&&(Fr=9),S[Jr]=Fr,s&&(v[_i]=Nr.high.x,v[_i+1]=Nr.high.y,v[_i+2]=Nr.low.x,v[_i+3]=Nr.low.y,M[_i]=-jt.y,M[_i+1]=jt.x,M[_i+2]=$e.y,M[_i+3]=-$e.x,P[_i]=Cs.x,P[_i+1]=Cs.y,P[_i+2]=Ne.x,P[_i+3]=Ne.y,R[ca]=ot*El,Fr=Xe*yo,Fr===0&&yo<0&&(Fr=9),R[ca+1]=Fr)}let Ze=JNe,pt=eFe,Ht=ZNe,Cn=QNe,Mo=ce.fromCartographicArray(KNe,$Ne),Ao=ui.getMinimumMaximumHeights(Mo,u),Za=Ao.minimumTerrainHeight,Qa=Ao.maximumTerrainHeight;Te+=Math.abs(Za),Te+=Math.abs(Qa),yoe(Ee,ze,Za,Qa,Ze,Ht),yoe(te,K,Za,Qa,pt,Cn);let Si=d.multiplyByScalar(_e,O.EPSILON5,Soe);d.add(Ze,Si,Ze),d.add(pt,Si,pt),d.add(Ht,Si,Ht),d.add(Cn,Si,Cn),BV(Ze,pt),BV(Ht,Cn),d.pack(Ze,y,U),d.pack(pt,y,U+3),d.pack(Cn,y,U+6),d.pack(Ht,y,U+9),Si=d.multiplyByScalar(_e,-2*O.EPSILON5,Soe),d.add(Ze,Si,Ze),d.add(pt,Si,pt),d.add(Ht,Si,Ht),d.add(Cn,Si,Cn),BV(Ze,pt),BV(Ht,Cn),d.pack(Ze,y,U+12),d.pack(pt,y,U+15),d.pack(Cn,y,U+18),d.pack(Ht,y,U+21),V+=2,l+=3,j+=16,U+=24,q+=32,ee+=un,me+=aa}l=0;let ue=0;for(a=0;a<f;a++){for(z=0;z<woe;z++)m[l+z]=Moe[z]+ue;ue+=8,l+=woe}let ye=fFe;le.fromVertices(n,d.ZERO,3,ye[0]),le.fromVertices(i,d.ZERO,3,ye[1]);let Ae=le.fromBoundingSpheres(ye);Ae.radius+=Te/(f*2);let Pe={position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,normalize:!1,values:y}),startHiAndForwardOffsetX:ey(b),startLoAndForwardOffsetY:ey(x),startNormalAndForwardOffsetZ:ey(A),endNormalAndTextureCoordinateNormalizationX:ey(C),rightNormalAndTextureCoordinateNormalizationY:ey(S)};return s&&(Pe.startHiLo2D=ey(v),Pe.offsetAndRight2D=ey(P),Pe.startEndNormals2D=ey(M),Pe.texcoordNormalization2D=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,normalize:!1,values:R})),new ct({attributes:Pe,indices:m,boundingSphere:Ae})}function ey(e){return new ve({componentDatatype:$.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}ty._projectNormal=gO;var Fb=ty;var yO=`in vec4 v_startPlaneNormalEcAndHalfWidth;
in vec4 v_endPlaneNormalEcAndBatchId;
in vec4 v_rightPlaneEC;
in vec4 v_endEcAndStartEcX;
in vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef PER_INSTANCE_COLOR
in vec4 v_color;
#endif
void main(void)
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);
if (logDepthOrDepth == 0.0) {
#ifdef DEBUG_SHOW_VOLUME
out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
eyeCoordinate /= eyeCoordinate.w;
float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);
float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
#ifdef DEBUG_SHOW_VOLUME
out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec3 alignedPlaneNormal;
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);
#ifdef PER_INSTANCE_COLOR
out_FragColor = czm_gammaCorrect(v_color);
#else // PER_INSTANCE_COLOR
float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);
s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;
float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);
czm_materialInput materialInput;
materialInput.s = s;
materialInput.st = vec2(s, t);
materialInput.str = vec3(s, t, 0.0);
czm_material material = czm_getMaterial(materialInput);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
out_FragColor.rgb *= out_FragColor.a;
czm_writeDepthClamp();
}
`;var bO=`in vec3 v_forwardDirectionEC;
in vec3 v_texcoordNormalizationAndHalfWidth;
in float v_batchId;
#ifdef PER_INSTANCE_COLOR
in vec4 v_color;
#else
in vec2 v_alignedPlaneDistances;
in float v_texcoordT;
#endif
float rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {
return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);
}
void main(void)
{
vec4 eyeCoordinate = gl_FragCoord;
eyeCoordinate /= eyeCoordinate.w;
#ifdef PER_INSTANCE_COLOR
out_FragColor = czm_gammaCorrect(v_color);
#else // PER_INSTANCE_COLOR
float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);
float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);
distanceFromStart = max(0.0, distanceFromStart);
distanceFromEnd = max(0.0, distanceFromEnd);
float s = distanceFromStart / (distanceFromStart + distanceFromEnd);
s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;
czm_materialInput materialInput;
materialInput.s = s;
materialInput.st = vec2(s, v_texcoordT);
materialInput.str = vec3(s, v_texcoordT, 0.0);
czm_material material = czm_getMaterial(materialInput);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#endif // PER_INSTANCE_COLOR
}
`;var xO=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec4 startHiAndForwardOffsetX;
in vec4 startLoAndForwardOffsetY;
in vec4 startNormalAndForwardOffsetZ;
in vec4 endNormalAndTextureCoordinateNormalizationX;
in vec4 rightNormalAndTextureCoordinateNormalizationY;
in vec4 startHiLo2D;
in vec4 offsetAndRight2D;
in vec4 startEndNormals2D;
in vec2 texcoordNormalization2D;
in float batchId;
out vec3 v_forwardDirectionEC;
out vec3 v_texcoordNormalizationAndHalfWidth;
out float v_batchId;
#ifdef WIDTH_VARYING
out float v_width;
#endif
#ifdef ANGLE_VARYING
out float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
out vec4 v_color;
#else
out vec2 v_alignedPlaneDistances;
out float v_texcoordT;
#endif
void main()
{
v_batchId = batchId;
vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));
vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);
vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
vec4 startPlane2D;
vec4 startPlane3D;
startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);
startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);
vec4 rightPlane2D;
vec4 rightPlane3D;
rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);
rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);
posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);
posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);
posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));
vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));
vec4 endPlane2D;
vec4 endPlane3D;
endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);
endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);
v_forwardDirectionEC = normalize(endEC - startEC);
vec2 cleanTexcoordNormalization2D;
cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);
cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));
vec2 cleanTexcoordNormalization3D;
cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;
cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));
v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#else // PER_INSTANCE_COLOR
v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);
v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);
#endif // PER_INSTANCE_COLOR
#ifdef WIDTH_VARYING
float width = czm_batchTable_width(batchId);
float halfWidth = width * 0.5;
v_width = width;
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#else
float halfWidth = 0.5 * czm_batchTable_width(batchId);
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#endif
vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow);
float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));
float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);
vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection));
vec3 normalEC = normalize(cross(planeDirection, upOrDown));
vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
positionEc3D.xyz += geodeticSurfaceNormal;
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC;
vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));
absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));
planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);
upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection));
normalEC = normalize(cross(planeDirection, upOrDown));
geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
positionEc2D.xyz += geodeticSurfaceNormal;
normalEC *= sign(texcoordNormalization2D.x);
#ifndef PER_INSTANCE_COLOR
v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
#endif
positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC;
gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);
#ifdef ANGLE_VARYING
vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
#endif
}
`;var TO=`in vec3 position3DHigh;
in vec3 position3DLow;
#ifndef COLUMBUS_VIEW_2D
in vec4 startHiAndForwardOffsetX;
in vec4 startLoAndForwardOffsetY;
in vec4 startNormalAndForwardOffsetZ;
in vec4 endNormalAndTextureCoordinateNormalizationX;
in vec4 rightNormalAndTextureCoordinateNormalizationY;
#else
in vec4 startHiLo2D;
in vec4 offsetAndRight2D;
in vec4 startEndNormals2D;
in vec2 texcoordNormalization2D;
#endif
in float batchId;
out vec4 v_startPlaneNormalEcAndHalfWidth;
out vec4 v_endPlaneNormalEcAndBatchId;
out vec4 v_rightPlaneEC;
out vec4 v_endEcAndStartEcX;
out vec4 v_texcoordNormalizationAndStartEcYZ;
#ifdef WIDTH_VARYING
out float v_width;
#endif
#ifdef ANGLE_VARYING
out float v_polylineAngle;
#endif
#ifdef PER_INSTANCE_COLOR
out vec4 v_color;
#endif
void main()
{
#ifdef COLUMBUS_VIEW_2D
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;
vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);
vec3 ecEnd = forwardDirectionEC + ecStart;
forwardDirectionEC = normalize(forwardDirectionEC);
v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
vec4 startPlaneEC;
startPlaneEC.xyz =  czm_normal * vec3(0.0, startEndNormals2D.xy);
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
vec4 endPlaneEC;
endPlaneEC.xyz =  czm_normal * vec3(0.0, startEndNormals2D.zw);
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);
v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;
#else // COLUMBUS_VIEW_2D
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;
vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);
vec3 ecEnd = ecStart + offset;
vec3 forwardDirectionEC = normalize(offset);
vec4 startPlaneEC;
startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
vec4 endPlaneEC;
endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;
#endif // COLUMBUS_VIEW_2D
v_endEcAndStartEcX.xyz = ecEnd;
v_endEcAndStartEcX.w = ecStart.x;
v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;
#ifdef PER_INSTANCE_COLOR
v_color = czm_batchTable_color(batchId);
#endif // PER_INSTANCE_COLOR
vec4 positionRelativeToEye = czm_computePosition();
vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye;
float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));
float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);
vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection));
vec3 normalEC = normalize(cross(planeDirection, upOrDown));
upOrDown = cross(forwardDirectionEC, normalEC);
upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;
upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;
upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;
positionEC.xyz += upOrDown;
v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));
float width = czm_batchTable_width(batchId);
#ifdef WIDTH_VARYING
v_width = width;
#endif
v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;
v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;
v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;
v_endPlaneNormalEcAndBatchId.w = batchId;
width = width * max(0.0, czm_metersPerPixel(positionEC));
width = width / dot(normalEC, v_rightPlaneEC.xyz);
#ifdef COLUMBUS_VIEW_2D
normalEC *= sign(texcoordNormalization2D.x);
#else
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
#endif
positionEC.xyz += width * normalEC;
gl_Position = czm_depthClamp(czm_projection * positionEC);
#ifdef ANGLE_VARYING
vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
#endif
}
`;var AO=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec2 expandAndWidth;
in vec4 color;
in float batchId;
out vec4 v_color;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = czm_computePosition();
vec4 prev = czm_computePrevPosition();
vec4 next = czm_computeNextPosition();
float angle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
v_color = color;
}
`;var xu=`void clipLineSegmentToNearPlane(
vec3 p0,
vec3 p1,
out vec4 positionWC,
out bool clipped,
out bool culledByNearPlane,
out vec4 clippedPositionEC)
{
culledByNearPlane = false;
clipped = false;
vec3 p0ToP1 = p1 - p0;
float magnitude = length(p0ToP1);
vec3 direction = normalize(p0ToP1);
float endPoint0Distance =  czm_currentFrustum.x + p0.z;
float denominator = -direction.z;
if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)
{
culledByNearPlane = true;
}
else if (endPoint0Distance > 0.0)
{
float t = endPoint0Distance / denominator;
if (t < 0.0 || t > magnitude)
{
culledByNearPlane = true;
}
else
{
p0 = p0 + t * direction;
p0.z = min(p0.z, -czm_currentFrustum.x);
clipped = true;
}
}
clippedPositionEC = vec4(p0, 1.0);
positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);
}
vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)
{
#ifdef POLYLINE_DASH
vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);
vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);
vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);
vec2 lineDir;
if (usePrevious) {
lineDir = normalize(positionWindow.xy - previousWindow.xy);
}
else {
lineDir = normalize(nextWindow.xy - positionWindow.xy);
}
angle = atan(lineDir.x, lineDir.y) - 1.570796327;
angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;
#endif
vec4 clippedPrevWC, clippedPrevEC;
bool prevSegmentClipped, prevSegmentCulled;
clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);
vec4 clippedNextWC, clippedNextEC;
bool nextSegmentClipped, nextSegmentCulled;
clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);
bool segmentClipped, segmentCulled;
vec4 clippedPositionWC, clippedPositionEC;
clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);
if (segmentCulled)
{
return vec4(0.0, 0.0, 0.0, 1.0);
}
vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);
vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);
if (prevSegmentCulled)
{
directionToPrevWC = -directionToNextWC;
}
else if (nextSegmentCulled)
{
directionToNextWC = -directionToPrevWC;
}
vec2 thisSegmentForwardWC, otherSegmentForwardWC;
if (usePrevious)
{
thisSegmentForwardWC = -directionToPrevWC;
otherSegmentForwardWC = directionToNextWC;
}
else
{
thisSegmentForwardWC = directionToNextWC;
otherSegmentForwardWC =  -directionToPrevWC;
}
vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);
vec2 leftWC = thisSegmentLeftWC;
float expandWidth = width * 0.5;
if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))
{
vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);
vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;
float leftSumLength = length(leftSumWC);
leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);
vec2 u = -thisSegmentForwardWC;
vec2 v = leftWC;
float sinAngle = abs(u.x * v.y - u.y * v.x);
expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);
}
vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;
return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;
}
vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)
{
vec4 positionEC = czm_modelViewRelativeToEye * position;
vec4 prevEC = czm_modelViewRelativeToEye * previous;
vec4 nextEC = czm_modelViewRelativeToEye * next;
return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);
}
`;var B6=`${xu}
${AO}`,hFe=Ob;Vt.isInternetExplorer()||(B6=`#define CLIP_POLYLINE 
${B6}`);function Bb(e){e=e??W.EMPTY_OBJECT;let t=e.translucent??!0,n=!1,i=Bb.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??B6,this._fragmentShaderSource=e.fragmentShaderSource??hFe,this._renderState=io.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Bb.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Bb.VERTEX_FORMAT=Ie.POSITION_ONLY;Bb.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;Bb.prototype.isTranslucent=io.prototype.isTranslucent;Bb.prototype.getRenderState=io.prototype.getRenderState;var is=Bb;var CO=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec2 expandAndWidth;
in vec2 st;
in float batchId;
out float v_width;
out vec2 v_st;
out float v_polylineAngle;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = czm_computePosition();
vec4 prev = czm_computePrevPosition();
vec4 next = czm_computeNextPosition();
float angle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
v_width = width;
v_st.s = st.s;
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
v_polylineAngle = angle;
}
`;var kb=`#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
in vec2 v_st;
void main()
{
czm_materialInput materialInput;
vec2 st = v_st;
st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
materialInput.s = st.s;
materialInput.st = st;
materialInput.str = vec3(st, 0.0);
czm_material material = czm_getMaterial(materialInput);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#ifdef VECTOR_TILE
out_FragColor *= u_highlightColor;
#endif
czm_writeLogDepth();
}
`;var k6=`${xu}
${CO}`,mFe=kb;Vt.isInternetExplorer()||(k6=`#define CLIP_POLYLINE 
${k6}`);function Ub(e){e=e??W.EMPTY_OBJECT;let t=e.translucent??!0,n=!1,i=Ub.VERTEX_FORMAT;this.material=c(e.material)?e.material:Xi.fromType(Xi.ColorType),this.translucent=t,this._vertexShaderSource=e.vertexShaderSource??k6,this._fragmentShaderSource=e.fragmentShaderSource??mFe,this._renderState=io.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Ub.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&(e=`#define POLYLINE_DASH
${e}`),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Ub.VERTEX_FORMAT=Ie.POSITION_AND_ST;Ub.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;Ub.prototype.isTranslucent=io.prototype.isTranslucent;Ub.prototype.getRenderState=io.prototype.getRenderState;var ha=Ub;function zp(e){e=e??W.EMPTY_OBJECT,this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;c(t)||(t=new ha),this.appearance=t,this.show=e.show??!0,this.classificationType=e.classificationType??Un.BOTH,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this._debugShowShadowVolume=e.debugShowShadowVolume??!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:e.interleave??!1,releaseGeometryInstances:e.releaseGeometryInstances??!0,allowPicking:e.allowPicking??!0,asynchronous:e.asynchronous??!0,compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=Loe(!1),this._renderState3DTiles=Loe(!0),this._renderStateMorph=Ve.fromCache({cull:{enabled:!0,face:xi.FRONT},depthTest:{enabled:!0},blending:ln.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(zp.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});zp.initializeTerrainHeights=function(){return ui.initialize()};function pFe(e,t,n){let i=t.context,o=e._primitive,r=o._attributeLocations,s=o._batchTable.getVertexShaderCallback()(TO);s=Pn._appendShowToShader(o,s),s=Pn._appendDistanceDisplayConditionToShader(o,s),s=Pn._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(xO);a=Pn._appendShowToShader(o,a),a=Pn._appendDistanceDisplayConditionToShader(o,a),a=Pn._modifyShaderPosition(e,a,t.scene3DOnly);let l=o._batchTable.getVertexShaderCallback()(yO),u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`],f="",h="";c(n.material)?(h=c(n.material)?n.material.shaderSource:"",h.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),h.search(/in\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):f="PER_INSTANCE_COLOR",u.push(f);let p=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",f]:[f],g=new He({defines:u,sources:[s]}),m=new He({defines:p,sources:[h,l]});e._sp=Jt.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:r});let y=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!c(y)){let x=new He({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});y=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:x,fragmentShaderSource:m,attributeLocations:r})}e._sp2D=y;let b=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!c(b)){let x=new He({defines:u.concat([`MAX_TERRAIN_HEIGHT ${ui._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});l=o._batchTable.getVertexShaderCallback()(bO);let A=new He({defines:p,sources:[h,l]});b=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:x,fragmentShaderSource:A,attributeLocations:r})}e._spMorph=b}function Loe(e){return Ve.fromCache({cull:{enabled:!0},blending:ln.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Vn.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:Vn.EQUAL,backOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK}})}function _Fe(e,t,n,i,o,r){let s=e._primitive,a=s._va.length;o.length=a,r.length=a;let u=t instanceof is?{}:n._uniforms,f=s._batchTable.getUniformMapCallback()(u);for(let h=0;h<a;h++){let p=s._va[h],g=o[h];c(g)||(g=o[h]=new Qe({owner:e,primitiveType:s._primitiveType})),g.vertexArray=p,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=f,g.pass=De.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";let m=Qe.shallowClone(g,g.derivedCommands.tileset);m.renderState=e._renderState3DTiles,m.pass=De.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=m;let y=Qe.shallowClone(g,g.derivedCommands.color2D);y.shaderProgram=e._sp2D,g.derivedCommands.color2D=y;let b=Qe.shallowClone(m,m.derivedCommands.color2D);b.shaderProgram=e._sp2D,m.derivedCommands.color2D=b;let x=Qe.shallowClone(g,g.derivedCommands.colorMorph);x.renderState=e._renderStateMorph,x.shaderProgram=e._spMorph,x.pickId="czm_batchTable_pickColor(v_batchId)",g.derivedCommands.colorMorph=x}}function Noe(e,t,n,i,o,r,s){n.mode===oe.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==oe.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function gFe(e,t,n,i,o,r,s){let a=e._primitive;Pn._updateBoundingVolumes(a,t,o);let l;t.mode===oe.SCENE3D?l=a._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?l=a._boundingSphereCV:t.mode===oe.SCENE2D&&c(a._boundingSphere2D)?l=a._boundingSphere2D:c(a._boundingSphereMorph)&&(l=a._boundingSphereMorph);let u=t.mode===oe.MORPHING,f=e.classificationType,h=f!==Un.CESIUM_3D_TILE,p=f!==Un.TERRAIN&&!u,g,m=t.passes;if(m.render||m.pick&&a.allowPicking){let y=n.length;for(let b=0;b<y;++b){let x=l[b];h&&(g=n[b],Noe(e,g,t,o,r,x,s)),p&&(g=n[b].derivedCommands.tileset,Noe(e,g,t,o,r,x,s))}}}zp.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;if(!ui.initialized){if(!this.asynchronous)throw new E("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");zp.initializeTerrainHeights();return}let t,n=this,i=this._primitiveOptions;if(!c(this._primitive)){let o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s=new Array(r),a;for(t=0;t<r;++t)if(a=o[t].attributes,!c(a)||!c(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){let l=o[t];a={};let u=l.attributes;for(let f in u)u.hasOwnProperty(f)&&(a[f]=u[f]);c(a.width)||(a.width=new hc({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,value:[l.geometry.width]})),l.geometry._scene3DOnly=e.scene3DOnly,Fb.setProjectionAndEllipsoid(l.geometry,e.mapProjection),s[t]=new St({geometry:l.geometry,attributes:a,id:l.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(l,u,f){pFe(n,u,f)},i._createCommandsFunction=function(l,u,f,h,p,g,m){_Fe(n,u,f,h,g,m)},i._updateAndQueueCommandsFunction=function(l,u,f,h,p,g,m,y){gFe(n,u,f,h,p,g,m)},this._primitive=new Pn(i)}if(this.appearance instanceof is&&!this._hasPerInstanceColors)throw new E("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};zp.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};zp.isSupported=function(e){return e.frameState.context.depthTexture};zp.prototype.isDestroyed=function(){return!1};zp.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,de(this)};var Vd=zp;var yFe=new H(1,1),bFe=!1,xFe=G.WHITE;function vC(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}Object.defineProperties(vC.prototype,{isConstant:{get:function(){return X.isConstant(this._image)&&X.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:fe("image"),repeat:fe("repeat"),color:fe("color"),transparent:fe("transparent")});vC.prototype.getType=function(e){return"Image"};var TFe=new Q;vC.prototype.getValue=function(e,t){return c(e)||(e=Q.now(TFe)),c(t)||(t={}),t.image=X.getValueOrUndefined(this._image,e),t.repeat=X.getValueOrClonedDefault(this._repeat,e,yFe,t.repeat),t.color=X.getValueOrClonedDefault(this._color,e,xFe,t.color),X.getValueOrDefault(this._transparent,e,bFe)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};vC.prototype.equals=function(e){return this===e||e instanceof vC&&X.equals(this._image,e._image)&&X.equals(this._repeat,e._repeat)&&X.equals(this._color,e._color)&&X.equals(this._transparent,e._transparent)};var ny=vC;function AFe(e){if(e instanceof G)return new Ut(e);if(typeof e=="string"||e instanceof we||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){let t=new ny;return t.image=e,t}throw new E(`Unable to infer material type: ${e}`)}function CFe(e,t){return fe(e,t,AFe)}var No=CFe;function EO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(EO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),dimensions:fe("dimensions"),heightReference:fe("heightReference"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});EO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new EO(this)};EO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.dimensions=this.dimensions??e.dimensions,this.heightReference=this.heightReference??e.heightReference,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var Vb=EO;var EFe={FIXED:0,INERTIAL:1},Hi=Object.freeze(EFe);function DC(){E.throwInstantiationError()}Object.defineProperties(DC.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError},referenceFrame:{get:E.throwInstantiationError}});DC.prototype.getValue=E.throwInstantiationError;DC.prototype.getValueInReferenceFrame=E.throwInstantiationError;DC.prototype.equals=E.throwInstantiationError;var Foe=new J;DC.convertToReferenceFrame=function(e,t,n,i,o){if(!c(t))return t;if(c(o)||(o=new d),n===i)return d.clone(t,o);let r=Ot.computeIcrfToCentralBodyFixedMatrix(e,Foe);if(n===Hi.INERTIAL)return J.multiplyByVector(r,t,o);if(n===Hi.FIXED)return J.multiplyByVector(J.transpose(r,Foe),t,o)};var zd=DC;function zb(e,t){this._definitionChanged=new pe,this._value=d.clone(e),this._referenceFrame=t??Hi.FIXED}Object.defineProperties(zb.prototype,{isConstant:{get:function(){return!c(this._value)||this._referenceFrame===Hi.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});var SFe=new Q;zb.prototype.getValue=function(e,t){return c(e)||(e=Q.now(SFe)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};zb.prototype.setValue=function(e,t){let n=!1;d.equals(this._value,e)||(n=!0,this._value=d.clone(e)),c(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};zb.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");return zd.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};zb.prototype.equals=function(e){return this===e||e instanceof zb&&d.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};var qc=zb;function SO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(SO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),positions:fe("positions"),width:fe("width"),height:fe("height"),heightReference:fe("heightReference"),extrudedHeight:fe("extrudedHeight"),extrudedHeightReference:fe("extrudedHeightReference"),cornerType:fe("cornerType"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition"),classificationType:fe("classificationType"),zIndex:fe("zIndex")});SO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new SO(this)};SO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.positions=this.positions??e.positions,this.width=this.width??e.width,this.height=this.height??e.height,this.heightReference=this.heightReference??e.heightReference,this.extrudedHeight=this.extrudedHeight??e.extrudedHeight,this.extrudedHeightReference=this.extrudedHeightReference??e.extrudedHeightReference,this.cornerType=this.cornerType??e.cornerType,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.classificationType=this.classificationType??e.classificationType,this.zIndex=this.zIndex??e.zIndex};var Hb=SO;function wFe(e){return e}function vFe(e,t){return fe(e,t,wFe)}var Yc=vFe;function wO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(wO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),length:fe("length"),topRadius:fe("topRadius"),bottomRadius:fe("bottomRadius"),heightReference:fe("heightReference"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),numberOfVerticalLines:fe("numberOfVerticalLines"),slices:fe("slices"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});wO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new wO(this)};wO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.length=this.length??e.length,this.topRadius=this.topRadius??e.topRadius,this.bottomRadius=this.bottomRadius??e.bottomRadius,this.heightReference=this.heightReference??e.heightReference,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.numberOfVerticalLines=this.numberOfVerticalLines??e.numberOfVerticalLines,this.slices=this.slices??e.slices,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var Gb=wO;function vO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(vO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),semiMajorAxis:fe("semiMajorAxis"),semiMinorAxis:fe("semiMinorAxis"),height:fe("height"),heightReference:fe("heightReference"),extrudedHeight:fe("extrudedHeight"),extrudedHeightReference:fe("extrudedHeightReference"),rotation:fe("rotation"),stRotation:fe("stRotation"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),numberOfVerticalLines:fe("numberOfVerticalLines"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition"),classificationType:fe("classificationType"),zIndex:fe("zIndex")});vO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new vO(this)};vO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.semiMajorAxis=this.semiMajorAxis??e.semiMajorAxis,this.semiMinorAxis=this.semiMinorAxis??e.semiMinorAxis,this.height=this.height??e.height,this.heightReference=this.heightReference??e.heightReference,this.extrudedHeight=this.extrudedHeight??e.extrudedHeight,this.extrudedHeightReference=this.extrudedHeightReference??e.extrudedHeightReference,this.rotation=this.rotation??e.rotation,this.stRotation=this.stRotation??e.stRotation,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.numberOfVerticalLines=this.numberOfVerticalLines??e.numberOfVerticalLines,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.classificationType=this.classificationType??e.classificationType,this.zIndex=this.zIndex??e.zIndex};var jb=vO;function DO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(DO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),radii:fe("radii"),innerRadii:fe("innerRadii"),minimumClock:fe("minimumClock"),maximumClock:fe("maximumClock"),minimumCone:fe("minimumCone"),maximumCone:fe("maximumCone"),heightReference:fe("heightReference"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),stackPartitions:fe("stackPartitions"),slicePartitions:fe("slicePartitions"),subdivisions:fe("subdivisions"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});DO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new DO(this)};DO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.radii=this.radii??e.radii,this.innerRadii=this.innerRadii??e.innerRadii,this.minimumClock=this.minimumClock??e.minimumClock,this.maximumClock=this.maximumClock??e.maximumClock,this.minimumCone=this.minimumCone??e.minimumCone,this.maximumCone=this.maximumCone??e.maximumCone,this.heightReference=this.heightReference??e.heightReference,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.stackPartitions=this.stackPartitions??e.stackPartitions,this.slicePartitions=this.slicePartitions??e.slicePartitions,this.subdivisions=this.subdivisions??e.subdivisions,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var Wb=DO;function PO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(PO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),text:fe("text"),font:fe("font"),style:fe("style"),scale:fe("scale"),showBackground:fe("showBackground"),backgroundColor:fe("backgroundColor"),backgroundPadding:fe("backgroundPadding"),pixelOffset:fe("pixelOffset"),eyeOffset:fe("eyeOffset"),horizontalOrigin:fe("horizontalOrigin"),verticalOrigin:fe("verticalOrigin"),heightReference:fe("heightReference"),fillColor:fe("fillColor"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),translucencyByDistance:fe("translucencyByDistance"),pixelOffsetScaleByDistance:fe("pixelOffsetScaleByDistance"),scaleByDistance:fe("scaleByDistance"),distanceDisplayCondition:fe("distanceDisplayCondition"),disableDepthTestDistance:fe("disableDepthTestDistance")});PO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new PO(this)};PO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.text=this.text??e.text,this.font=this.font??e.font,this.style=this.style??e.style,this.scale=this.scale??e.scale,this.showBackground=this.showBackground??e.showBackground,this.backgroundColor=this.backgroundColor??e.backgroundColor,this.backgroundPadding=this.backgroundPadding??e.backgroundPadding,this.pixelOffset=this.pixelOffset??e.pixelOffset,this.eyeOffset=this.eyeOffset??e.eyeOffset,this.horizontalOrigin=this.horizontalOrigin??e.horizontalOrigin,this.verticalOrigin=this.verticalOrigin??e.verticalOrigin,this.heightReference=this.heightReference??e.heightReference,this.fillColor=this.fillColor??e.fillColor,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.translucencyByDistance=this.translucencyByDistance??e.translucencyByDistance,this.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance??e.pixelOffsetScaleByDistance,this.scaleByDistance=this.scaleByDistance??e.scaleByDistance,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.disableDepthTestDistance=this.disableDepthTestDistance??e.disableDepthTestDistance};var Hd=PO;var DFe=new d(1,1,1),PFe=d.ZERO,IFe=Le.IDENTITY;function Boe(e,t,n){this.translation=d.clone(e??PFe),this.rotation=Le.clone(t??IFe),this.scale=d.clone(n??DFe)}Boe.prototype.equals=function(e){return this===e||c(e)&&d.equals(this.translation,e.translation)&&Le.equals(this.rotation,e.rotation)&&d.equals(this.scale,e.scale)};var iy=Boe;var U6=new iy;function IO(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}Object.defineProperties(IO.prototype,{isConstant:{get:function(){return X.isConstant(this._translation)&&X.isConstant(this._rotation)&&X.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:fe("translation"),rotation:fe("rotation"),scale:fe("scale")});var OFe=new Q;IO.prototype.getValue=function(e,t){return c(e)||(e=Q.now(OFe)),c(t)||(t=new iy),t.translation=X.getValueOrClonedDefault(this._translation,e,U6.translation,t.translation),t.rotation=X.getValueOrClonedDefault(this._rotation,e,U6.rotation,t.rotation),t.scale=X.getValueOrClonedDefault(this._scale,e,U6.scale,t.scale),t};IO.prototype.equals=function(e){return this===e||e instanceof IO&&X.equals(this._translation,e._translation)&&X.equals(this._rotation,e._rotation)&&X.equals(this._scale,e._scale)};var qb=IO;function Hp(e,t){this._propertyNames=[],this._definitionChanged=new pe,c(e)&&this.merge(e,t)}Object.defineProperties(Hp.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){let e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!X.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});Hp.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function RFe(e){return new Kn(e)}Hp.prototype.addProperty=function(e,t,n){let i=this._propertyNames;if(!c(e))throw new E("propertyName is required.");if(i.indexOf(e)!==-1)throw new E(`${e} is already a registered property.`);i.push(e),Object.defineProperty(this,e,fe(e,!0,n??RFe)),c(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};Hp.prototype.removeProperty=function(e){let n=this._propertyNames.indexOf(e);if(!c(e))throw new E("propertyName is required.");if(n===-1)throw new E(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e],this._definitionChanged.raiseEvent(this)};var MFe=new Q;Hp.prototype.getValue=function(e,t){c(e)||(e=Q.now(MFe)),c(t)||(t={});let n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){let r=n[i];t[r]=X.getValueOrUndefined(this[r],e,t[r])}return t};Hp.prototype.merge=function(e,t){if(!c(e))throw new E("source is required.");let n=this._propertyNames,i=c(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){let s=i[o],a=this[s],l=e[s];a===void 0&&n.indexOf(s)===-1&&this.addProperty(s,void 0,t),l!==void 0&&(a!==void 0?c(a)&&c(a.merge)&&a.merge(l):c(l)&&c(l.merge)&&c(l.clone)?this[s]=l.clone():this[s]=l)}};function LFe(e,t){let n=e._propertyNames,i=t._propertyNames,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;++r){let s=n[r];if(i.indexOf(s)===-1||!X.equals(e[s],t[s]))return!1}return!0}Hp.prototype.equals=function(e){return this===e||e instanceof Hp&&LFe(this,e)};var Xc=Hp;function koe(e){return new qb(e)}function NFe(e){return new Xc(e,koe)}function FFe(e){return new Xc(e)}function BFe(e){return new Xc(e)}function OO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._hasVerticalExaggeration=void 0,this._hasVerticalExaggerationSubscription=void 0,this._enableVerticalExaggeration=void 0,this._enableVerticalExaggerationSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._environmentMapOptions=void 0,this._environmentMapOptionsSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this._customShader=void 0,this._customShaderSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(OO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),uri:fe("uri"),scale:fe("scale"),enableVerticalExaggeration:fe("enableVerticalExaggeration"),minimumPixelSize:fe("minimumPixelSize"),maximumScale:fe("maximumScale"),incrementallyLoadTextures:fe("incrementallyLoadTextures"),runAnimations:fe("runAnimations"),clampAnimations:fe("clampAnimations"),shadows:fe("shadows"),heightReference:fe("heightReference"),silhouetteColor:fe("silhouetteColor"),silhouetteSize:fe("silhouetteSize"),color:fe("color"),colorBlendMode:fe("colorBlendMode"),colorBlendAmount:fe("colorBlendAmount"),imageBasedLightingFactor:fe("imageBasedLightingFactor"),environmentMapOptions:fe("environmentMapOptions",void 0,BFe),lightColor:fe("lightColor"),distanceDisplayCondition:fe("distanceDisplayCondition"),nodeTransformations:fe("nodeTransformations",void 0,NFe),articulations:fe("articulations",void 0,FFe),clippingPlanes:fe("clippingPlanes"),customShader:fe("customShader")});OO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.enableVerticalExaggeration=this.enableVerticalExaggeration,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.environmentMapOptions=this.environmentMapOptions,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e.customShader=this.customShader,e):new OO(this)};OO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.uri=this.uri??e.uri,this.scale=this.scale??e.scale,this.enableVerticalExaggeration=this.enableVerticalExaggeration??e.enableVerticalExaggeration,this.minimumPixelSize=this.minimumPixelSize??e.minimumPixelSize,this.maximumScale=this.maximumScale??e.maximumScale,this.incrementallyLoadTextures=this.incrementallyLoadTextures??e.incrementallyLoadTextures,this.runAnimations=this.runAnimations??e.runAnimations,this.clampAnimations=this.clampAnimations??e.clampAnimations,this.shadows=this.shadows??e.shadows,this.heightReference=this.heightReference??e.heightReference,this.silhouetteColor=this.silhouetteColor??e.silhouetteColor,this.silhouetteSize=this.silhouetteSize??e.silhouetteSize,this.color=this.color??e.color,this.colorBlendMode=this.colorBlendMode??e.colorBlendMode,this.colorBlendAmount=this.colorBlendAmount??e.colorBlendAmount,this.imageBasedLightingFactor=this.imageBasedLightingFactor??e.imageBasedLightingFactor,this.environmentMapOptions=this.environmentMapOptions??e.environmentMapOptions,this.lightColor=this.lightColor??e.lightColor,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.clippingPlanes=this.clippingPlanes??e.clippingPlanes,this.customShader=this.customShader??e.customShader;let t=e.nodeTransformations;if(c(t)){let i=this.nodeTransformations;c(i)?i.merge(t):this.nodeTransformations=new Xc(t,koe)}let n=e.articulations;if(c(n)){let i=this.articulations;c(i)?i.merge(n):this.articulations=new Xc(n)}};var Gp=OO;function RO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(RO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),uri:fe("uri"),maximumScreenSpaceError:fe("maximumScreenSpaceError")});RO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new RO(this)};RO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.uri=this.uri??e.uri,this.maximumScreenSpaceError=this.maximumScreenSpaceError??e.maximumScreenSpaceError};var Yb=RO;function MO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(MO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),leadTime:fe("leadTime"),trailTime:fe("trailTime"),width:fe("width"),resolution:fe("resolution"),material:No("material"),distanceDisplayCondition:fe("distanceDisplayCondition")});MO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new MO(this)};MO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.leadTime=this.leadTime??e.leadTime,this.trailTime=this.trailTime??e.trailTime,this.width=this.width??e.width,this.resolution=this.resolution??e.resolution,this.material=this.material??e.material,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var jp=MO;function LO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(LO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),plane:fe("plane"),dimensions:fe("dimensions"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});LO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new LO(this)};LO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.plane=this.plane??e.plane,this.dimensions=this.dimensions??e.dimensions,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var NO=LO;function FO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this._splitDirection=void 0,this._splitDirectionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(FO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),pixelSize:fe("pixelSize"),heightReference:fe("heightReference"),color:fe("color"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),scaleByDistance:fe("scaleByDistance"),translucencyByDistance:fe("translucencyByDistance"),distanceDisplayCondition:fe("distanceDisplayCondition"),disableDepthTestDistance:fe("disableDepthTestDistance"),splitDirection:fe("splitDirection")});FO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e.splitDirection=this.splitDirection,e):new FO(this)};FO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.pixelSize=this.pixelSize??e.pixelSize,this.heightReference=this.heightReference??e.heightReference,this.color=this.color??e.color,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.scaleByDistance=this.scaleByDistance??e.scaleByDistance,this.translucencyByDistance=this._translucencyByDistance??e.translucencyByDistance,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.disableDepthTestDistance=this.disableDepthTestDistance??e.disableDepthTestDistance,this.splitDirection=this.splitDirection??e.splitDirection};var Xb=FO;function kFe(e,t){this.positions=c(e)?e:[],this.holes=c(t)?t:[]}var ka=kFe;function UFe(e){return Array.isArray(e)&&(e=new ka(e)),new Kn(e)}function BO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this._textureCoordinates=void 0,this._textureCoordinatesSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(BO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),hierarchy:fe("hierarchy",void 0,UFe),height:fe("height"),heightReference:fe("heightReference"),extrudedHeight:fe("extrudedHeight"),extrudedHeightReference:fe("extrudedHeightReference"),stRotation:fe("stRotation"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),perPositionHeight:fe("perPositionHeight"),closeTop:fe("closeTop"),closeBottom:fe("closeBottom"),arcType:fe("arcType"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition"),classificationType:fe("classificationType"),zIndex:fe("zIndex"),textureCoordinates:fe("textureCoordinates")});BO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e.textureCoordinates=this.textureCoordinates,e):new BO(this)};BO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.hierarchy=this.hierarchy??e.hierarchy,this.height=this.height??e.height,this.heightReference=this.heightReference??e.heightReference,this.extrudedHeight=this.extrudedHeight??e.extrudedHeight,this.extrudedHeightReference=this.extrudedHeightReference??e.extrudedHeightReference,this.stRotation=this.stRotation??e.stRotation,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.perPositionHeight=this.perPositionHeight??e.perPositionHeight,this.closeTop=this.closeTop??e.closeTop,this.closeBottom=this.closeBottom??e.closeBottom,this.arcType=this.arcType??e.arcType,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.classificationType=this.classificationType??e.classificationType,this.zIndex=this.zIndex??e.zIndex,this.textureCoordinates=this.textureCoordinates??e.textureCoordinates};var Gd=BO;function kO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(kO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),positions:fe("positions"),width:fe("width"),granularity:fe("granularity"),material:No("material"),depthFailMaterial:No("depthFailMaterial"),arcType:fe("arcType"),clampToGround:fe("clampToGround"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition"),classificationType:fe("classificationType"),zIndex:fe("zIndex")});kO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new kO(this)};kO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.positions=this.positions??e.positions,this.width=this.width??e.width,this.granularity=this.granularity??e.granularity,this.material=this.material??e.material,this.depthFailMaterial=this.depthFailMaterial??e.depthFailMaterial,this.arcType=this.arcType??e.arcType,this.clampToGround=this.clampToGround??e.clampToGround,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.classificationType=this.classificationType??e.classificationType,this.zIndex=this.zIndex??e.zIndex};var mc=kO;function UO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(UO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),positions:fe("positions"),shape:fe("shape"),cornerType:fe("cornerType"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});UO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new UO(this)};UO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.positions=this.positions??e.positions,this.shape=this.shape??e.shape,this.cornerType=this.cornerType??e.cornerType,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var Kb=UO;function VO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(VO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),coordinates:fe("coordinates"),height:fe("height"),heightReference:fe("heightReference"),extrudedHeight:fe("extrudedHeight"),extrudedHeightReference:fe("extrudedHeightReference"),rotation:fe("rotation"),stRotation:fe("stRotation"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition"),classificationType:fe("classificationType"),zIndex:fe("zIndex")});VO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new VO(this)};VO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.coordinates=this.coordinates??e.coordinates,this.height=this.height??e.height,this.heightReference=this.heightReference??e.heightReference,this.extrudedHeight=this.extrudedHeight??e.extrudedHeight,this.extrudedHeightReference=this.extrudedHeightReference??e.extrudedHeightReference,this.rotation=this.rotation??e.rotation,this.stRotation=this.stRotation??e.stRotation,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition,this.classificationType=this.classificationType??e.classificationType,this.zIndex=this.zIndex??e.zIndex};var jd=VO;function zO(e){this._definitionChanged=new pe,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(e??W.EMPTY_OBJECT)}Object.defineProperties(zO.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:fe("show"),positions:fe("positions"),minimumHeights:fe("minimumHeights"),maximumHeights:fe("maximumHeights"),granularity:fe("granularity"),fill:fe("fill"),material:No("material"),outline:fe("outline"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth"),shadows:fe("shadows"),distanceDisplayCondition:fe("distanceDisplayCondition")});zO.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new zO(this)};zO.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=this.show??e.show,this.positions=this.positions??e.positions,this.minimumHeights=this.minimumHeights??e.minimumHeights,this.maximumHeights=this.maximumHeights??e.maximumHeights,this.granularity=this.granularity??e.granularity,this.fill=this.fill??e.fill,this.material=this.material??e.material,this.outline=this.outline??e.outline,this.outlineColor=this.outlineColor??e.outlineColor,this.outlineWidth=this.outlineWidth??e.outlineWidth,this.shadows=this.shadows??e.shadows,this.distanceDisplayCondition=this.distanceDisplayCondition??e.distanceDisplayCondition};var Wp=zO;var VFe=new he,V6=[];function zFe(e){return new qc(e)}function HFe(e){return fe(e,void 0,zFe)}function js(e,t){return fe(e,void 0,function(n){return n instanceof t?n:new t(n)})}function If(e){e=e??W.EMPTY_OBJECT;let t=e.id;c(t)||(t=jn()),this._availability=void 0,this._id=t,this._definitionChanged=new pe,this._name=e.name,this._show=e.show??!0,this._trackingReferenceFrame=e.trackingReferenceFrame??Bp.AUTODETECT,this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall",...V6],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function z6(e,t,n){let i=t.length;for(let o=0;o<i;o++){let r=t[o],s=r._show;(!n&&s)!==(n&&s)&&z6(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(If.prototype,{availability:Yc("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:Yc("name"),show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(e===this._show)return;let t=this.isShowing;this._show=e;let n=this.isShowing;t!==n&&z6(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},trackingReferenceFrame:Yc("trackingReferenceFrame"),isShowing:{get:function(){return this._show&&(!c(this.entityCollection)||this.entityCollection.show)&&(!c(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){let t=this._parent;if(t===e)return;let n=this.isShowing;if(c(t)){let o=t._children.indexOf(this);t._children.splice(o,1)}this._parent=e,c(e)&&e._children.push(this);let i=this.isShowing;n!==i&&z6(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:js("billboard",fc),box:js("box",Vb),corridor:js("corridor",Hb),cylinder:js("cylinder",Gb),description:fe("description"),ellipse:js("ellipse",jb),ellipsoid:js("ellipsoid",Wb),label:js("label",Hd),model:js("model",Gp),tileset:js("tileset",Yb),orientation:fe("orientation"),path:js("path",jp),plane:js("plane",NO),point:js("point",Xb),polygon:js("polygon",Gd),polyline:js("polyline",mc),polylineVolume:js("polylineVolume",Kb),properties:js("properties",Xc),position:HFe("position"),rectangle:js("rectangle",jd),viewFrom:fe("viewFrom"),wall:js("wall",Wp)});If.registerEntityType=function(e,t){Object.defineProperties(If.prototype,{[e]:js(e,t)}),V6.includes(e)||V6.push(e)};If.prototype.isAvailable=function(e){if(!c(e))throw new E("time is required.");let t=this._availability;return!c(t)||t.contains(e)};If.prototype.addProperty=function(e){let t=this._propertyNames;if(!c(e))throw new E("propertyName is required.");if(t.indexOf(e)!==-1)throw new E(`${e} is already a registered property.`);if(e in this)throw new E(`${e} is a reserved property name.`);t.push(e),Object.defineProperty(this,e,Yc(e,!0))};If.prototype.removeProperty=function(e){let n=this._propertyNames.indexOf(e);if(!c(e))throw new E("propertyName is required.");if(n===-1)throw new E(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e]};If.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.name=this.name??e.name,this.availability=this.availability??e.availability;let t=this._propertyNames,n=c(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let o=0;o<i;o++){let r=n[o];if(r==="parent"||r==="name"||r==="availability"||r==="children")continue;let s=this[r],a=e[r];!c(s)&&t.indexOf(r)===-1&&this.addProperty(r),c(a)&&(c(s)?c(s.merge)&&s.merge(a):c(a.merge)&&c(a.clone)?this[r]=a.clone():this[r]=a)}};var Uoe=new J,Voe=new d,zoe=new Le;If.prototype.computeModelMatrix=function(e,t){T.typeOf.object("time",e);let n=X.getValueOrUndefined(this._position,e,Voe);if(!c(n))return;let i=X.getValueOrUndefined(this._orientation,e,zoe);return c(i)?t=B.fromRotationTranslation(J.fromQuaternion(i,Uoe),n,t):t=Ot.eastNorthUpToFixedFrame(n,void 0,t),t};If.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){T.typeOf.object("time",e);let r=X.getValueOrDefault(t,e,We.NONE),s=X.getValueOrUndefined(this._position,e,Voe);if(r===We.NONE||!c(s)||d.equalsEpsilon(s,d.ZERO,O.EPSILON8))return this.computeModelMatrix(e,o);let a=i.cartesianToCartographic(s,VFe);r===We.CLIP_TO_GROUND?a.height<n&&(a.height=n):Df(r)?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);let l=X.getValueOrUndefined(this._orientation,e,zoe);return c(l)?o=B.fromRotationTranslation(J.fromQuaternion(l,Uoe),s,o):o=Ot.eastNorthUpToFixedFrame(s,void 0,o),o};If.supportsMaterialsforEntitiesOnTerrain=function(e){return jc.supportsMaterials(e)};If.supportsPolylinesOnTerrain=function(e){return Vd.isSupported(e)};var nr=If;var GFe=new Ut(G.WHITE),jFe=new Kn(!0),WFe=new Kn(!0),qFe=new Kn(!1),YFe=new Kn(G.BLACK),XFe=new Kn(xn.DISABLED),KFe=new Kn(new Mt),$Fe=new Kn(Un.BOTH);function Kc(e){T.defined("options.entity",e.entity),T.defined("options.scene",e.scene),T.defined("options.geometryOptions",e.geometryOptions),T.defined("options.geometryPropertyName",e.geometryPropertyName),T.defined("options.observedPropertyNames",e.observedPropertyNames);let t=e.entity,n=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new pe,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=`${n}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=nr.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(Kc.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!c(this._entity.availability)&&X.isConstant(this._showProperty)&&X.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!c(this._entity.availability)&&X.isConstant(this._showProperty)&&X.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}});Kc.prototype.isOutlineVisible=function(e){let t=this._entity;return(this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e))??!1};Kc.prototype.isFilled=function(e){let t=this._entity;return(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e))??!1};Kc.prototype.createFillGeometryInstance=E.throwInstantiationError;Kc.prototype.createOutlineGeometryInstance=E.throwInstantiationError;Kc.prototype.isDestroyed=function(){return!1};Kc.prototype.destroy=function(){de(this)};Kc.prototype._isHidden=function(e,t){let n=t.show;return c(n)&&n.isConstant&&!n.getValue(Ge.MINIMUM_VALUE)};Kc.prototype._isOnTerrain=function(e,t){return!1};Kc.prototype._getIsClosed=function(e){return!0};Kc.prototype._isDynamic=E.throwInstantiationError;Kc.prototype._setStaticOptions=E.throwInstantiationError;Kc.prototype._onEntityPropertyChanged=function(e,t,n,i){if(this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!c(o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}let r=o.fill,s=c(r)&&r.isConstant?r.getValue(Ge.MINIMUM_VALUE):!0,a=o.outline,l=c(a);if(l&&a.isConstant&&(l=a.getValue(Ge.MINIMUM_VALUE)),!s&&!l){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}let u=o.show;if(this._isHidden(e,o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}this._materialProperty=o.material??GFe,this._fillProperty=r??WFe,this._showProperty=u??jFe,this._showOutlineProperty=o.outline??qFe,this._outlineColorProperty=l?o.outlineColor??YFe:void 0,this._shadowsProperty=o.shadows??XFe,this._distanceDisplayConditionProperty=o.distanceDisplayCondition??KFe,this._classificationTypeProperty=o.classificationType??$Fe,this._fillEnabled=s;let f=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof Ut);if(l&&f&&(dt(dt.geometryOutlines),l=!1),this._onTerrain=f,this._outlineEnabled=l,this._isDynamic(e,o))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,o),this._isClosed=this._getIsClosed(this._options);let h=o.outlineWidth;this._outlineWidth=c(h)?h.getValue(Ge.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Kc.prototype.createDynamicUpdater=function(e,t){if(T.defined("primitives",e),T.defined("groundPrimitives",t),!this._dynamic)throw new E("This instance does not represent dynamic geometry.");return new this.constructor.DynamicGeometryUpdater(this,e,t)};var ii=Kc;function PC(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new pe,this.setCallback(e,t)}Object.defineProperties(PC.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}});var ZFe=new Q;PC.prototype.getValue=function(e,t){return c(e)||(e=Q.now(ZFe)),this._callback(e,t)};PC.prototype.setCallback=function(e,t){if(!c(e))throw new E("callback is required.");if(!c(t))throw new E("isConstant is required.");let n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};PC.prototype.equals=function(e){return this===e||e instanceof PC&&this._callback===e._callback&&this._isConstant===e._isConstant};var Wd=PC;var Hoe=new d;function IC(e,t,n,i){T.defined("scene",e),T.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new d,this._cartographicPosition=new he,this._normal=new d,this._definitionChanged=new pe,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;let o=this;if(c(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){o._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){o._updateClamping()})),t.isConstant){let r=t.getValue(Ge.MINIMUM_VALUE,Hoe);if(!c(r)||d.equals(r,d.ZERO)||!c(e.globe))return;this._position=d.clone(r,this._position),this._updateClamping(),this._normal=e.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(IC.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});IC.prototype._updateClamping=function(){c(this._removeCallbackFunc)&&this._removeCallbackFunc();let e=this._scene,t=this._position;if(d.equals(t,d.ZERO)){this._terrainHeight=0;return}let i=e.ellipsoid.cartesianToCartographic(t,this._cartographicPosition),o=e.getHeight(i,this._heightReference);c(o)?this._terrainHeight=o:this._terrainHeight=0;let r=s=>{this._terrainHeight=s.height,this.definitionChanged.raiseEvent()};this._removeCallbackFunc=e.updateHeight(i,r,this._heightReference)};var QFe=new Q;IC.prototype.getValue=function(e,t){c(e)||(e=Q.now(QFe));let n=X.getValueOrDefault(this._heightReference,e,We.NONE),i=X.getValueOrDefault(this._extrudedHeightReference,e,We.NONE);if(n===We.NONE&&!gC(i))return this._position=d.clone(d.ZERO,this._position),d.clone(d.ZERO,t);if(this._positionProperty.isConstant&&n!==We.CLIP_TO_GROUND)return d.multiplyByScalar(this._normal,this._terrainHeight,t);let o=this._scene,r=this._positionProperty.getValue(e,Hoe);if(!c(r)||d.equals(r,d.ZERO)||!c(o.globe))return d.clone(d.ZERO,t);if(d.equalsEpsilon(this._position,r,O.EPSILON10)&&n!==We.CLIP_TO_GROUND)return d.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=d.clone(r,this._position),this._updateClamping();let s=o.ellipsoid.geodeticSurfaceNormal(r,this._normal);if(n===We.CLIP_TO_GROUND){let l=o.globe.ellipsoid.cartesianToCartographic(r,scratchCarto);return this._terrainHeight>=l.height?d.multiplyByScalar(s,this._terrainHeight-l.height,t):d.clone(d.ZERO,t)}return d.multiplyByScalar(s,this._terrainHeight,t)};IC.prototype.isDestroyed=function(){return!1};IC.prototype.destroy=function(){return c(this._removeEventListener)&&this._removeEventListener(),c(this._removeModeListener)&&this._removeModeListener(),c(this._removeCallbackFunc)&&this._removeCallbackFunc(),de(this)};var $b=IC;function JFe(e,t,n,i){if(ii.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!c(o))return;c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);let r=o.heightReference;if(c(r)){let s=new Wd(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new $b(this._scene,s,r)}}var qp=JFe;var Goe=d.ZERO,joe=new d,e2e=new d,Woe=new G;function t2e(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function Tu(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new t2e(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}c(Object.create)&&(Tu.prototype=Object.create(ii.prototype),Tu.prototype.constructor=Tu);Object.defineProperties(Tu.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Tu.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i=new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=kn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Ut){let a;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,Woe)),c(a)||(a=G.WHITE),s.color=Gt.fromColor(a)}return c(this._options.offsetAttribute)&&(s.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,Goe,joe))),new St({id:t,geometry:La.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.ellipsoid),attributes:s})};Tu.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,Woe),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,Goe,joe))),new St({id:t,geometry:Ud.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.ellipsoid),attributes:r})};Tu.prototype._computeCenter=function(e,t){return X.getValueOrUndefined(this._entity.position,e,t)};Tu.prototype._isHidden=function(e,t){return!c(t.dimensions)||!c(e.position)||ii.prototype._isHidden.call(this,e,t)};Tu.prototype._isDynamic=function(e,t){return!e.position.isConstant||!X.isConstant(e.orientation)||!t.dimensions.isConstant||!X.isConstant(t.outlineWidth)};Tu.prototype._setStaticOptions=function(e,t){let n=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Ut?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(Ge.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==We.NONE?Zt.ALL:void 0};Tu.prototype._onEntityPropertyChanged=qp;Tu.DynamicGeometryUpdater=OC;function OC(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(OC.prototype=Object.create(ni.prototype),OC.prototype.constructor=OC);OC.prototype._isHidden=function(e,t,n){let i=X.getValueOrUndefined(e.position,n,e2e),o=this._options.dimensions;return!c(i)||!c(o)||ni.prototype._isHidden.call(this,e,t,n)};OC.prototype._setOptions=function(e,t,n){let i=X.getValueOrDefault(t.heightReference,n,We.NONE),o=this._options;o.dimensions=X.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==We.NONE?Zt.ALL:void 0};var HO=Tu;function Zb(e,t,n){this._callback=void 0,this._isConstant=void 0,this._referenceFrame=n??Hi.FIXED,this._definitionChanged=new pe,this.setCallback(e,t)}Object.defineProperties(Zb.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});var n2e=new Q;Zb.prototype.getValue=function(e,t){return c(e)||(e=Q.now(n2e)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};Zb.prototype.setCallback=function(e,t){if(!c(e))throw new E("callback is required.");if(!c(t))throw new E("isConstant is required.");let n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};Zb.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");let i=this._callback(e,n);return zd.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};Zb.prototype.equals=function(e){return this===e||e instanceof Zb&&this._callback===e._callback&&this._isConstant===e._isConstant&&this._referenceFrame===e._referenceFrame};var GO=Zb;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */var{entries:tre,setPrototypeOf:qoe,isFrozen:i2e,getPrototypeOf:o2e,getOwnPropertyDescriptor:r2e}=Object,{freeze:Zc,seal:Of,create:nre}=Object,{apply:Y6,construct:X6}=typeof Reflect<"u"&&Reflect;Zc||(Zc=function(t){return t});Of||(Of=function(t){return t});Y6||(Y6=function(t,n,i){return t.apply(n,i)});X6||(X6=function(t,n){return new t(...n)});var UV=Au(Array.prototype.forEach),Yoe=Au(Array.prototype.pop),jO=Au(Array.prototype.push),zV=Au(String.prototype.toLowerCase),H6=Au(String.prototype.toString),Xoe=Au(String.prototype.match),WO=Au(String.prototype.replace),s2e=Au(String.prototype.indexOf),a2e=Au(String.prototype.trim),qd=Au(Object.prototype.hasOwnProperty),$c=Au(RegExp.prototype.test),qO=c2e(TypeError);function Au(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return Y6(e,t,i)}}function c2e(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return X6(e,n)}}function Li(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zV;qoe&&qoe(e,null);let i=t.length;for(;i--;){let o=t[i];if(typeof o=="string"){let r=n(o);r!==o&&(i2e(t)||(t[i]=r),o=r)}e[o]=!0}return e}function l2e(e){for(let t=0;t<e.length;t++)qd(e,t)||(e[t]=null);return e}function Qb(e){let t=nre(null);for(let[n,i]of tre(e))qd(e,n)&&(Array.isArray(i)?t[n]=l2e(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Qb(i):t[n]=i);return t}function YO(e,t){for(;e!==null;){let i=r2e(e,t);if(i){if(i.get)return Au(i.get);if(typeof i.value=="function")return Au(i.value)}e=o2e(e)}function n(){return null}return n}var Koe=Zc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),G6=Zc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j6=Zc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),u2e=Zc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),W6=Zc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),f2e=Zc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$oe=Zc(["#text"]),Zoe=Zc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),q6=Zc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Qoe=Zc(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),VV=Zc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),d2e=Of(/\{\{[\w\W]*|[\w\W]*\}\}/gm),h2e=Of(/<%[\w\W]*|[\w\W]*%>/gm),m2e=Of(/\$\{[\w\W]*}/gm),p2e=Of(/^data-[\-\w.\u00B7-\uFFFF]+$/),_2e=Of(/^aria-[\-\w]+$/),ire=Of(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),g2e=Of(/^(?:\w+script|data):/i),y2e=Of(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ore=Of(/^html$/i),b2e=Of(/^[a-z][.\w]*(-[.\w]+)+$/i),Joe=Object.freeze({__proto__:null,ARIA_ATTR:_2e,ATTR_WHITESPACE:y2e,CUSTOM_ELEMENT:b2e,DATA_ATTR:p2e,DOCTYPE_NAME:ore,ERB_EXPR:h2e,IS_ALLOWED_URI:ire,IS_SCRIPT_OR_DATA:g2e,MUSTACHE_EXPR:d2e,TMPLIT_EXPR:m2e}),XO={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},x2e=function(){return typeof window>"u"?null:window},T2e=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null,o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(i=n.getAttribute(o));let r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},ere=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rre(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x2e(),t=cn=>rre(cn);if(t.version="3.2.3",t.removed=[],!e||!e.document||e.document.nodeType!==XO.document)return t.isSupported=!1,t;let{document:n}=e,i=n,o=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:g}=e,m=l.prototype,y=YO(m,"cloneNode"),b=YO(m,"remove"),x=YO(m,"nextSibling"),A=YO(m,"childNodes"),C=YO(m,"parentNode");if(typeof s=="function"){let cn=n.createElement("template");cn.content&&cn.content.ownerDocument&&(n=cn.content.ownerDocument)}let S,v="",{implementation:P,createNodeIterator:M,createDocumentFragment:R,getElementsByTagName:L}=n,{importNode:F}=i,_=ere();t.isSupported=typeof tre=="function"&&typeof C=="function"&&P&&P.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:w,ERB_EXPR:D,TMPLIT_EXPR:I,DATA_ATTR:N,ARIA_ATTR:k,IS_SCRIPT_OR_DATA:z,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:j}=Joe,{IS_ALLOWED_URI:U}=Joe,q=null,Y=Li({},[...Koe,...G6,...j6,...W6,...$oe]),te=null,K=Li({},[...Zoe,...q6,...Qoe,...VV]),Z=Object.seal(nre(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ee=null,me=null,Te=!0,ue=!0,ye=!1,Ae=!0,Pe=!1,Ee=!0,ze=!1,qe=!1,it=!1,Dt=!1,jt=!1,$e=!1,un=!0,zt=!1,Ct="user-content-",Ei=!0,an=!1,_e={},Ce=null,pn=Li({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),mt=null,so=Li({},["audio","video","img","source","image","track"]),Ro=null,aa=Li({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nr="http://www.w3.org/1998/Math/MathML",Cs="http://www.w3.org/2000/svg",Ne="http://www.w3.org/1999/xhtml",ot=Ne,Xe=!1,Ze=null,pt=Li({},[Nr,Cs,Ne],H6),Ht=Li({},["mi","mo","mn","ms","mtext"]),Cn=Li({},["annotation-xml"]),Mo=Li({},["title","style","font","a","script"]),Ao=null,Za=["application/xhtml+xml","text/html"],Qa="text/html",Si=null,_i=null,ca=n.createElement("form"),Jr=function(Se){return Se instanceof RegExp||Se instanceof Function},El=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(_i&&_i===Se)){if((!Se||typeof Se!="object")&&(Se={}),Se=Qb(Se),Ao=Za.indexOf(Se.PARSER_MEDIA_TYPE)===-1?Qa:Se.PARSER_MEDIA_TYPE,Si=Ao==="application/xhtml+xml"?H6:zV,q=qd(Se,"ALLOWED_TAGS")?Li({},Se.ALLOWED_TAGS,Si):Y,te=qd(Se,"ALLOWED_ATTR")?Li({},Se.ALLOWED_ATTR,Si):K,Ze=qd(Se,"ALLOWED_NAMESPACES")?Li({},Se.ALLOWED_NAMESPACES,H6):pt,Ro=qd(Se,"ADD_URI_SAFE_ATTR")?Li(Qb(aa),Se.ADD_URI_SAFE_ATTR,Si):aa,mt=qd(Se,"ADD_DATA_URI_TAGS")?Li(Qb(so),Se.ADD_DATA_URI_TAGS,Si):so,Ce=qd(Se,"FORBID_CONTENTS")?Li({},Se.FORBID_CONTENTS,Si):pn,ee=qd(Se,"FORBID_TAGS")?Li({},Se.FORBID_TAGS,Si):{},me=qd(Se,"FORBID_ATTR")?Li({},Se.FORBID_ATTR,Si):{},_e=qd(Se,"USE_PROFILES")?Se.USE_PROFILES:!1,Te=Se.ALLOW_ARIA_ATTR!==!1,ue=Se.ALLOW_DATA_ATTR!==!1,ye=Se.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=Se.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Pe=Se.SAFE_FOR_TEMPLATES||!1,Ee=Se.SAFE_FOR_XML!==!1,ze=Se.WHOLE_DOCUMENT||!1,Dt=Se.RETURN_DOM||!1,jt=Se.RETURN_DOM_FRAGMENT||!1,$e=Se.RETURN_TRUSTED_TYPE||!1,it=Se.FORCE_BODY||!1,un=Se.SANITIZE_DOM!==!1,zt=Se.SANITIZE_NAMED_PROPS||!1,Ei=Se.KEEP_CONTENT!==!1,an=Se.IN_PLACE||!1,U=Se.ALLOWED_URI_REGEXP||ire,ot=Se.NAMESPACE||Ne,Ht=Se.MATHML_TEXT_INTEGRATION_POINTS||Ht,Cn=Se.HTML_INTEGRATION_POINTS||Cn,Z=Se.CUSTOM_ELEMENT_HANDLING||{},Se.CUSTOM_ELEMENT_HANDLING&&Jr(Se.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Z.tagNameCheck=Se.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Se.CUSTOM_ELEMENT_HANDLING&&Jr(Se.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Z.attributeNameCheck=Se.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Se.CUSTOM_ELEMENT_HANDLING&&typeof Se.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=Se.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Pe&&(ue=!1),jt&&(Dt=!0),_e&&(q=Li({},$oe),te=[],_e.html===!0&&(Li(q,Koe),Li(te,Zoe)),_e.svg===!0&&(Li(q,G6),Li(te,q6),Li(te,VV)),_e.svgFilters===!0&&(Li(q,j6),Li(te,q6),Li(te,VV)),_e.mathMl===!0&&(Li(q,W6),Li(te,Qoe),Li(te,VV))),Se.ADD_TAGS&&(q===Y&&(q=Qb(q)),Li(q,Se.ADD_TAGS,Si)),Se.ADD_ATTR&&(te===K&&(te=Qb(te)),Li(te,Se.ADD_ATTR,Si)),Se.ADD_URI_SAFE_ATTR&&Li(Ro,Se.ADD_URI_SAFE_ATTR,Si),Se.FORBID_CONTENTS&&(Ce===pn&&(Ce=Qb(Ce)),Li(Ce,Se.FORBID_CONTENTS,Si)),Ei&&(q["#text"]=!0),ze&&Li(q,["html","head","body"]),q.table&&(Li(q,["tbody"]),delete ee.tbody),Se.TRUSTED_TYPES_POLICY){if(typeof Se.TRUSTED_TYPES_POLICY.createHTML!="function")throw qO('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Se.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qO('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=Se.TRUSTED_TYPES_POLICY,v=S.createHTML("")}else S===void 0&&(S=T2e(g,o)),S!==null&&typeof v=="string"&&(v=S.createHTML(""));Zc&&Zc(Se),_i=Se}},yo=Li({},[...G6,...j6,...u2e]),Fr=Li({},[...W6,...f2e]),xp=function(Se){let Pt=C(Se);(!Pt||!Pt.tagName)&&(Pt={namespaceURI:ot,tagName:"template"});let _n=zV(Se.tagName),Ar=zV(Pt.tagName);return Ze[Se.namespaceURI]?Se.namespaceURI===Cs?Pt.namespaceURI===Ne?_n==="svg":Pt.namespaceURI===Nr?_n==="svg"&&(Ar==="annotation-xml"||Ht[Ar]):!!yo[_n]:Se.namespaceURI===Nr?Pt.namespaceURI===Ne?_n==="math":Pt.namespaceURI===Cs?_n==="math"&&Cn[Ar]:!!Fr[_n]:Se.namespaceURI===Ne?Pt.namespaceURI===Cs&&!Cn[Ar]||Pt.namespaceURI===Nr&&!Ht[Ar]?!1:!Fr[_n]&&(Mo[_n]||!yo[_n]):!!(Ao==="application/xhtml+xml"&&Ze[Se.namespaceURI]):!1},es=function(Se){jO(t.removed,{element:Se});try{C(Se).removeChild(Se)}catch{b(Se)}},hf=function(Se,Pt){try{jO(t.removed,{attribute:Pt.getAttributeNode(Se),from:Pt})}catch{jO(t.removed,{attribute:null,from:Pt})}if(Pt.removeAttribute(Se),Se==="is")if(Dt||jt)try{es(Pt)}catch{}else try{Pt.setAttribute(Se,"")}catch{}},Ja=function(Se){let Pt=null,_n=null;if(it)Se="<remove></remove>"+Se;else{let Ia=Xoe(Se,/^[\r\n\t ]+/);_n=Ia&&Ia[0]}Ao==="application/xhtml+xml"&&ot===Ne&&(Se='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Se+"</body></html>");let Ar=S?S.createHTML(Se):Se;if(ot===Ne)try{Pt=new p().parseFromString(Ar,Ao)}catch{}if(!Pt||!Pt.documentElement){Pt=P.createDocument(ot,"template",null);try{Pt.documentElement.innerHTML=Xe?v:Ar}catch{}}let tc=Pt.body||Pt.documentElement;return Se&&_n&&tc.insertBefore(n.createTextNode(_n),tc.childNodes[0]||null),ot===Ne?L.call(Pt,ze?"html":"body")[0]:ze?Pt.documentElement:tc},tb=function(Se){return M.call(Se.ownerDocument||Se,Se,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},la=function(Se){return Se instanceof h&&(typeof Se.nodeName!="string"||typeof Se.textContent!="string"||typeof Se.removeChild!="function"||!(Se.attributes instanceof f)||typeof Se.removeAttribute!="function"||typeof Se.setAttribute!="function"||typeof Se.namespaceURI!="string"||typeof Se.insertBefore!="function"||typeof Se.hasChildNodes!="function")},Sl=function(Se){return typeof a=="function"&&Se instanceof a};function ec(cn,Se,Pt){UV(cn,_n=>{_n.call(t,Se,Pt,_i)})}let hs=function(Se){let Pt=null;if(ec(_.beforeSanitizeElements,Se,null),la(Se))return es(Se),!0;let _n=Si(Se.nodeName);if(ec(_.uponSanitizeElement,Se,{tagName:_n,allowedTags:q}),Se.hasChildNodes()&&!Sl(Se.firstElementChild)&&$c(/<[/\w]/g,Se.innerHTML)&&$c(/<[/\w]/g,Se.textContent)||Se.nodeType===XO.progressingInstruction||Ee&&Se.nodeType===XO.comment&&$c(/<[/\w]/g,Se.data))return es(Se),!0;if(!q[_n]||ee[_n]){if(!ee[_n]&&pf(_n)&&(Z.tagNameCheck instanceof RegExp&&$c(Z.tagNameCheck,_n)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(_n)))return!1;if(Ei&&!Ce[_n]){let Ar=C(Se)||Se.parentNode,tc=A(Se)||Se.childNodes;if(tc&&Ar){let Ia=tc.length;for(let wl=Ia-1;wl>=0;--wl){let tm=y(tc[wl],!0);tm.__removalCount=(Se.__removalCount||0)+1,Ar.insertBefore(tm,x(Se))}}}return es(Se),!0}return Se instanceof l&&!xp(Se)||(_n==="noscript"||_n==="noembed"||_n==="noframes")&&$c(/<\/no(script|embed|frames)/i,Se.innerHTML)?(es(Se),!0):(Pe&&Se.nodeType===XO.text&&(Pt=Se.textContent,UV([w,D,I],Ar=>{Pt=WO(Pt,Ar," ")}),Se.textContent!==Pt&&(jO(t.removed,{element:Se.cloneNode()}),Se.textContent=Pt)),ec(_.afterSanitizeElements,Se,null),!1)},mf=function(Se,Pt,_n){if(un&&(Pt==="id"||Pt==="name")&&(_n in n||_n in ca))return!1;if(!(ue&&!me[Pt]&&$c(N,Pt))){if(!(Te&&$c(k,Pt))){if(!te[Pt]||me[Pt]){if(!(pf(Se)&&(Z.tagNameCheck instanceof RegExp&&$c(Z.tagNameCheck,Se)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Se))&&(Z.attributeNameCheck instanceof RegExp&&$c(Z.attributeNameCheck,Pt)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(Pt))||Pt==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&$c(Z.tagNameCheck,_n)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(_n))))return!1}else if(!Ro[Pt]){if(!$c(U,WO(_n,V,""))){if(!((Pt==="src"||Pt==="xlink:href"||Pt==="href")&&Se!=="script"&&s2e(_n,"data:")===0&&mt[Se])){if(!(ye&&!$c(z,WO(_n,V,"")))){if(_n)return!1}}}}}}return!0},pf=function(Se){return Se!=="annotation-xml"&&Xoe(Se,j)},_f=function(Se){ec(_.beforeSanitizeAttributes,Se,null);let{attributes:Pt}=Se;if(!Pt||la(Se))return;let _n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te,forceKeepAttr:void 0},Ar=Pt.length;for(;Ar--;){let tc=Pt[Ar],{name:Ia,namespaceURI:wl,value:tm}=tc,cv=Si(Ia),kc=Ia==="value"?tm:a2e(tm);if(_n.attrName=cv,_n.attrValue=kc,_n.keepAttr=!0,_n.forceKeepAttr=void 0,ec(_.uponSanitizeAttribute,Se,_n),kc=_n.attrValue,zt&&(cv==="id"||cv==="name")&&(hf(Ia,Se),kc=Ct+kc),Ee&&$c(/((--!?|])>)|<\/(style|title)/i,kc)){hf(Ia,Se);continue}if(_n.forceKeepAttr||(hf(Ia,Se),!_n.keepAttr))continue;if(!Ae&&$c(/\/>/i,kc)){hf(Ia,Se);continue}Pe&&UV([w,D,I],lJ=>{kc=WO(kc,lJ," ")});let cJ=Si(Se.nodeName);if(mf(cJ,cv,kc)){if(S&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!wl)switch(g.getAttributeType(cJ,cv)){case"TrustedHTML":{kc=S.createHTML(kc);break}case"TrustedScriptURL":{kc=S.createScriptURL(kc);break}}try{wl?Se.setAttributeNS(wl,Ia,kc):Se.setAttribute(Ia,kc),la(Se)?es(Se):Yoe(t.removed)}catch{}}}ec(_.afterSanitizeAttributes,Se,null)},Vo=function cn(Se){let Pt=null,_n=tb(Se);for(ec(_.beforeSanitizeShadowDOM,Se,null);Pt=_n.nextNode();)ec(_.uponSanitizeShadowNode,Pt,null),hs(Pt),_f(Pt),Pt.content instanceof r&&cn(Pt.content);ec(_.afterSanitizeShadowDOM,Se,null)};return t.sanitize=function(cn){let Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Pt=null,_n=null,Ar=null,tc=null;if(Xe=!cn,Xe&&(cn="<!-->"),typeof cn!="string"&&!Sl(cn))if(typeof cn.toString=="function"){if(cn=cn.toString(),typeof cn!="string")throw qO("dirty is not a string, aborting")}else throw qO("toString is not a function");if(!t.isSupported)return cn;if(qe||El(Se),t.removed=[],typeof cn=="string"&&(an=!1),an){if(cn.nodeName){let tm=Si(cn.nodeName);if(!q[tm]||ee[tm])throw qO("root node is forbidden and cannot be sanitized in-place")}}else if(cn instanceof a)Pt=Ja("<!---->"),_n=Pt.ownerDocument.importNode(cn,!0),_n.nodeType===XO.element&&_n.nodeName==="BODY"||_n.nodeName==="HTML"?Pt=_n:Pt.appendChild(_n);else{if(!Dt&&!Pe&&!ze&&cn.indexOf("<")===-1)return S&&$e?S.createHTML(cn):cn;if(Pt=Ja(cn),!Pt)return Dt?null:$e?v:""}Pt&&it&&es(Pt.firstChild);let Ia=tb(an?cn:Pt);for(;Ar=Ia.nextNode();)hs(Ar),_f(Ar),Ar.content instanceof r&&Vo(Ar.content);if(an)return cn;if(Dt){if(jt)for(tc=R.call(Pt.ownerDocument);Pt.firstChild;)tc.appendChild(Pt.firstChild);else tc=Pt;return(te.shadowroot||te.shadowrootmode)&&(tc=F.call(i,tc,!0)),tc}let wl=ze?Pt.outerHTML:Pt.innerHTML;return ze&&q["!doctype"]&&Pt.ownerDocument&&Pt.ownerDocument.doctype&&Pt.ownerDocument.doctype.name&&$c(ore,Pt.ownerDocument.doctype.name)&&(wl="<!DOCTYPE "+Pt.ownerDocument.doctype.name+`>
`+wl),Pe&&UV([w,D,I],tm=>{wl=WO(wl,tm," ")}),S&&$e?S.createHTML(wl):wl},t.setConfig=function(){let cn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};El(cn),qe=!0},t.clearConfig=function(){_i=null,qe=!1},t.isValidAttribute=function(cn,Se,Pt){_i||El({});let _n=Si(cn),Ar=Si(Se);return mf(_n,Ar,Pt)},t.addHook=function(cn,Se){typeof Se=="function"&&jO(_[cn],Se)},t.removeHook=function(cn){return Yoe(_[cn])},t.removeHooks=function(cn){_[cn]=[]},t.removeAllHooks=function(){_=ere()},t}var sre=rre();var A2e=0,K6={};function gm(e,t){T.typeOf.string("html",e);let n,i=e;c(K6[i])?n=K6[i]:(n=A2e++,K6[i]=n),t=t??!1,this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(gm.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!c(this._element)){let e=sre.sanitize(this._html),t=document.createElement("div");t.className="cesium-credit-wrapper",t._creditId=this._id,t.style.display="inline",t.innerHTML=e;let n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}});gm.equals=function(e,t){return e===t||c(e)&&c(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};gm.prototype.equals=function(e){return gm.equals(this,e)};gm.prototype.isIon=function(){return this.html.indexOf("ion-credit.png")!==-1};gm.getIonCredit=function(e){let t=c(e.collapsible)&&!e.collapsible;return new gm(e.html,t)};gm.clone=function(e){if(c(e))return new gm(e.html,e.showOnScreen)};var Tt=gm;function C2e(e,t){if(!c(e)||!c(t))throw new E("identifier and message are required.");dt(e,t)}var ws=C2e;function Jb(e){this._url=e,this._cubeMapBuffers=void 0,this._texture=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._errorEvent=new pe}Object.defineProperties(Jb.prototype,{url:{get:function(){return this._url}},errorEvent:{get:function(){return this._errorEvent}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}}});Jb.isSupported=function(e){return(e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat)&&e.supportsTextureLod};function $6(e){e._cubeMapBuffers=void 0}Jb.prototype.update=function(e){let{context:t}=e;if(!Jb.isSupported(t))return;if(c(this._texture)){$6(this);return}if(!c(this._texture)&&!this._loading){let f=t.textureCache.getTexture(this._url);c(f)&&($6(this),this._texture=f,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0)}let n=this._cubeMapBuffers;if(!c(n)&&!this._loading){let f=this;Il(this._url).then(function(h){f._cubeMapBuffers=h,f._loading=!1}).catch(function(h){f.isDestroyed()||f._errorEvent.raiseEvent(h)}),this._loading=!0}if(!c(this._cubeMapBuffers))return;let{pixelDatatype:i}=n[0].positiveX;c(i)||(i=t.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT);let o=ke.RGBA,r=n.length;this._maximumMipmapLevel=r-1;let s=n[0].positiveX.width,a=Math.log2(s)+1;if(r!==a){let f={};Object.values(Go.FaceName).forEach(h=>{f[h]=void 0});for(let h=r;h<a;h++)n.push(f)}let l=new Qt({minificationFilter:Yt.LINEAR_MIPMAP_LINEAR}),u=new Go({context:t,source:n[0],flipY:!1,pixelDatatype:i,pixelFormat:o,sampler:l});u.loadMipmaps(n.slice(1)),this._texture=u,this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture),this._ready=!0};Jb.prototype.isDestroyed=function(){return!1};Jb.prototype.destroy=function(){return $6(this),this._texture=this._texture&&this._texture.destroy(),de(this)};var Yd=Jb;function KO(e){e=e??W.EMPTY_OBJECT;let t=c(e.imageBasedLightingFactor)?H.clone(e.imageBasedLightingFactor):new H(1,1);T.typeOf.object("options.imageBasedLightingFactor",t),T.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),T.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),T.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),T.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;let n=e.sphericalHarmonicCoefficients;if(c(n)&&(!Array.isArray(n)||n.length!==9))throw new E("options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._sphericalHarmonicCoefficients=n,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentCubeMap=void 0,this._specularEnvironmentCubeMapDirty=!0,this._specularEnvironmentMapLoaded=!1,this._previousSpecularEnvironmentMapLoaded=!1,this._useDefaultSpecularMaps=!1,this._useDefaultSphericalHarmonics=!1,this._shouldRegenerateShaders=!1,this._previousFrameNumber=void 0,this._previousImageBasedLightingFactor=H.clone(t),this._previousSphericalHarmonicCoefficients=n,this._removeErrorListener=void 0}Object.defineProperties(KO.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){T.typeOf.object("imageBasedLightingFactor",e),T.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),T.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),T.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),T.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.y",e.y,1),this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=H.clone(e,this._imageBasedLightingFactor)}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){if(c(e)&&(!Array.isArray(e)||e.length!==9))throw new E("sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentCubeMapDirty=this._specularEnvironmentCubeMapDirty||e!==this._specularEnvironmentMaps,this._specularEnvironmentMapLoaded=!1),this._specularEnvironmentMaps=e}},enabled:{get:function(){return this._imageBasedLightingFactor.x>0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},specularEnvironmentCubeMap:{get:function(){return this._specularEnvironmentCubeMap}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return c(this._specularEnvironmentCubeMap)&&this._specularEnvironmentCubeMap.ready||this._useDefaultSpecularMaps}}});function E2e(e,t){if(Yd.isSupported(t)){if(e._specularEnvironmentCubeMap=e._specularEnvironmentCubeMap&&e._specularEnvironmentCubeMap.destroy(),c(e._specularEnvironmentMaps)){let n=new Yd(e._specularEnvironmentMaps);e._specularEnvironmentCubeMap=n,e._removeErrorListener=n.errorEvent.addEventListener(i=>{console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}KO.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;let t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;let n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;H.equals(n,i)||(this._shouldRegenerateShaders=n.x>0&&i.x===0||n.x===0&&i.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||n.y>0&&i.y===0||n.y===0&&i.y>0,this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||c(this._previousSphericalHarmonicCoefficients)!==c(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentCubeMapDirty&&(E2e(this,t),this._specularEnvironmentCubeMapDirty=!1),c(this._specularEnvironmentCubeMap)&&(this._specularEnvironmentCubeMap.update(e),this._specularEnvironmentCubeMap.ready&&(this._specularEnvironmentMapLoaded=!0));let o=!c(this._specularEnvironmentCubeMap)&&c(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!c(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!c(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!c(this._specularEnvironmentCubeMap)&&c(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)};KO.prototype.isDestroyed=function(){return!1};KO.prototype.destroy=function(){return this._specularEnvironmentCubeMap=this._specularEnvironmentCubeMap&&this._specularEnvironmentCubeMap.destroy(),this._removeErrorListener=this._removeErrorListener&&this._removeErrorListener(),de(this)};var ex=KO;var Q6=Zo(du(),1);var Z6,are="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjNjVkZDYxOC01NmEwLTQ1ZmEtOGE2ZS1lYWUyODM4ZWQxYzQiLCJpZCI6MjU5LCJpYXQiOjE3NDYxMTA0Njl9.uyhPpCQKB1dodfbqTx0ZUPOLhnrSXd-qWixDxc4GYXk",HV={};HV.defaultAccessToken=are;HV.defaultServer=new we({url:"https://api.cesium.com/"});HV.getDefaultTokenCredit=function(e){if(e===are){if(!c(Z6)){let t=`<b>             This application is using Cesium's default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i>             with an access token from your ion account before making any Cesium API calls.             You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>`;Z6=new Tt(t,!0)}return Z6}};var Xd=HV;function Qc(e,t){T.defined("endpoint",e),T.defined("endpointResource",t);let n,i=e.externalType,o=c(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:S2e};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new ae("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");we.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Q6.default(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}c(Object.create)&&(Qc.prototype=Object.create(we.prototype),Qc.prototype.constructor=Qc);Qc.fromAssetId=function(e,t){let n=Qc._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new Qc(i,n)})};Object.defineProperties(Qc.prototype,{credits:{get:function(){return c(this._ionRoot)?this._ionRoot.credits:c(this._credits)?this._credits:(this._credits=Qc.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});Qc.getCreditsFromEndpoint=function(e,t){let n=e.attributions.map(Tt.getIonCredit),i=Xd.getDefaultTokenCredit(t.queryParameters.access_token);return c(i)&&n.push(Tt.clone(i)),n};Qc.prototype.clone=function(e){let t=this._ionRoot??this;return c(e)||(e=new Qc(t._ionEndpoint,t._ionEndpointResource)),e=we.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};Qc.prototype.fetchImage=function(e){if(!this._isExternal){let t=e;e={preferBlob:!0},c(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return we.prototype.fetchImage.call(this,e)};Qc.prototype._makeRequest=function(e){return this._isExternal||new Q6.default(this.url).authority()!==this._ionEndpointDomain?we.prototype._makeRequest.call(this,e):(c(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,e.headers["X-Cesium-Client"]="CesiumJS",typeof CESIUM_VERSION<"u"&&(e.headers["X-Cesium-Client-Version"]=CESIUM_VERSION),we.prototype._makeRequest.call(this,e))};Qc._createEndpointResource=function(e,t){T.defined("assetId",e),t=t??W.EMPTY_OBJECT;let n=t.server??Xd.defaultServer,i=t.accessToken??Xd.defaultAccessToken;n=we.createIfNeeded(n);let o={url:`v1/assets/${e}/endpoint`};return c(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function S2e(e,t){let n=e._ionRoot??e,i=n._ionEndpointResource,o=typeof Image<"u";return!c(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(c(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then(function(r){return n._ionEndpoint=r,r}).finally(function(r){return n._pendingPromise=void 0,r})),n._pendingPromise.then(function(r){return e._ionEndpoint=r,!0}))}var Cu=Qc;function ym(e){e=e??0,this._array=new Array(e),this._length=e}Object.defineProperties(ym.prototype,{length:{get:function(){return this._length},set:function(e){T.typeOf.number.greaterThanOrEquals("length",e,0);let t=this._array,n=this._length;if(e<n)for(let i=e;i<n;++i)t[i]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}});ym.prototype.get=function(e){return T.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};ym.prototype.set=function(e,t){T.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};ym.prototype.peek=function(){return this._array[this._length-1]};ym.prototype.push=function(e){let t=this.length++;this._array[t]=e};ym.prototype.pop=function(){if(this._length===0)return;let e=this._array[this._length-1];return--this.length,e};ym.prototype.reserve=function(e){T.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};ym.prototype.resize=function(e){T.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};ym.prototype.trim=function(e){e=e??this._length,this._array.length=e};var Jc=ym;var Yp={X:0,Y:1,Z:2};Yp.Y_UP_TO_Z_UP=B.fromRotationTranslation(J.fromArray([1,0,0,0,0,1,0,-1,0]));Yp.Z_UP_TO_Y_UP=B.fromRotationTranslation(J.fromArray([1,0,0,0,0,-1,0,1,0]));Yp.X_UP_TO_Z_UP=B.fromRotationTranslation(J.fromArray([0,0,1,0,1,0,-1,0,0]));Yp.Z_UP_TO_X_UP=B.fromRotationTranslation(J.fromArray([0,0,-1,0,1,0,1,0,0]));Yp.X_UP_TO_Y_UP=B.fromRotationTranslation(J.fromArray([0,1,0,-1,0,0,0,0,1]));Yp.Y_UP_TO_X_UP=B.fromRotationTranslation(J.fromArray([0,-1,0,1,0,0,0,0,1]));Yp.fromName=function(e){return T.typeOf.string("name",e),Yp[e]};var Fo=Object.freeze(Yp);function cre(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(cre.prototype,{metadata:{get:function(){return this._metadata}}});var tx=cre;function oy(e,t,n){if(!c(e))throw new E("uint8Array is required.");if(t<0)throw new E("byteOffset cannot be negative.");if(n<0)throw new E("byteLength cannot be negative.");if(t+n>e.byteLength)throw new E("sub-region exceeds array bounds.");return t=t??0,n=n??e.byteLength-t,e=e.subarray(t,t+n),oy.decode(e)}oy.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};oy.decodeWithFromCharCode=function(e){let t="",n=w2e(e),i=n.length;for(let o=0;o<i;++o){let r=n[o];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t};function $O(e,t,n){return t<=e&&e<=n}function w2e(e){let t=0,n=0,i=0,o=128,r=191,s=[],a=e.length;for(let l=0;l<a;++l){let u=e[l];if(i===0){if($O(u,0,127)){s.push(u);continue}if($O(u,194,223)){i=1,t=u&31;continue}if($O(u,224,239)){u===224&&(o=160),u===237&&(r=159),i=2,t=u&15;continue}if($O(u,240,244)){u===240&&(o=144),u===244&&(r=143),i=3,t=u&7;continue}throw new ae("String decoding failed.")}if(!$O(u,o,r)){t=i=n=0,o=128,r=191,--l;continue}o=128,r=191,t=t<<6|u&63,++n,n===i&&(s.push(t),t=i=n=0)}return s}typeof TextDecoder<"u"?oy.decode=oy.decodeWithTextDecoder:oy.decode=oy.decodeWithFromCharCode;var Fl=oy;function v2e(e,t){return t=t??0,Fl(e,t,Math.min(4,e.length))}var Kd=v2e;function Rf(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,c(i)||(i=[]),this._contents=i,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Rf.prototype,{featurePropertiesDirty:{get:function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e;let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].metadata=e}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e;let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].group=e}}});var ZO=Uint32Array.BYTES_PER_ELEMENT;Rf.fromTileType=async function(e,t,n,i,o,r){o=o??0;let s=new Uint8Array(i),a=new DataView(i);o+=ZO;let l=a.getUint32(o,!0);if(l!==1)throw new ae(`Only Composite Tile version 1 is supported. Version ${l} is not.`);o+=ZO,o+=ZO;let u=a.getUint32(o,!0);o+=ZO;let f=n.queryParameters.compositeIndex;c(f)?f=`${f}_`:f="";let h=[];h.length=u;for(let m=0;m<u;++m){let y=Kd(s,o),b=a.getUint32(o+ZO*2,!0),x=r[y],A=`${f}${m}`,C=n.getDerivedResource({queryParameters:{compositeIndex:A}});if(c(x))h[m]=Promise.resolve(x(e,t,C,i,o));else throw new ae(`Unknown tile content type, ${y}, inside Composite tile`);o+=b}let p=await Promise.all(h);return new Rf(e,t,n,p)};Rf.prototype.hasProperty=function(e,t){return!1};Rf.prototype.getFeature=function(e){};Rf.prototype.applyDebugSettings=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Rf.prototype.applyStyle=function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Rf.prototype.update=function(e,t){let n=this._contents,i=n.length,o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)};Rf.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY,r=this._contents,s=r.length;for(let a=0;a<s;++a){let l=r[a].pick(e,t,n);if(!c(l))continue;let u=d.distance(e.origin,l);u<o&&(i=l,o=u)}if(c(i))return n};Rf.prototype.isDestroyed=function(){return!1};Rf.prototype.destroy=function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return de(this)};var QO=Rf;function D2e(e,t,n){return JSON.parse(Fl(e,t,n))}var ir=D2e;function pc(e){T.typeOf.number("options.featuresLength",e.featuresLength),T.typeOf.object("options.owner",e.owner),this._id=jn();let t=e.featuresLength;this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[];let n,i;if(t>0){let o=Math.min(t,ut.maximumTextureSize),r=Math.ceil(t/ut.maximumTextureSize),s=1/o,a=s*.5,l=1/r,u=l*.5;n=new H(o,r),i=new se(s,a,l,u)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}Object.defineProperties(pc.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return c(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),c(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}});pc.DEFAULT_COLOR_VALUE=G.WHITE;pc.DEFAULT_SHOW_VALUE=!0;function lre(e){let t=e._textureDimensions;return t.x*t.y*4}function ure(e){if(!c(e._batchValues)){let t=lre(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function fre(e){if(!c(e._showAlphaProperties)){let t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function JO(e,t){if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}pc.prototype.setShow=function(e,t){if(JO(e,this._featuresLength),T.typeOf.bool("show",t),t&&!c(this._showAlphaProperties))return;let n=fre(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;let r=ure(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};pc.prototype.setAllShow=function(e){T.typeOf.bool("show",e);let t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};pc.prototype.getShow=function(e){if(JO(e,this._featuresLength),!c(this._showAlphaProperties))return!0;let t=e*2;return this._showAlphaProperties[t]===255};var P2e=new Array(4);pc.prototype.setColor=function(e,t){if(JO(e,this._featuresLength),T.typeOf.object("color",t),G.equals(t,pc.DEFAULT_COLOR_VALUE)&&!c(this._batchValues))return;let n=t.toBytes(P2e),i=n[3],o=ure(this),r=e*4,s=fre(this),a=e*2;if(o[r]!==n[0]||o[r+1]!==n[1]||o[r+2]!==n[2]||s[a+1]!==i){o[r]=n[0],o[r+1]=n[1],o[r+2]=n[2];let l=s[a+1]!==255,u=s[a]!==0;o[r+3]=u?i:0,s[a+1]=i;let f=i!==255;f&&!l?++this._translucentFeaturesLength:!f&&l&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,c(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};pc.prototype.setAllColor=function(e){T.typeOf.object("color",e);let t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};pc.prototype.getColor=function(e,t){if(JO(e,this._featuresLength),T.typeOf.object("result",t),!c(this._batchValues))return G.clone(pc.DEFAULT_COLOR_VALUE,t);let n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return G.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};pc.prototype.getPickColor=function(e){return JO(e,this._featuresLength),this._pickIds[e]};function dre(e,t,n){let i=e._textureDimensions;return new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:Qt.NEAREST})}function I2e(e,t){let n=e._featuresLength;if(!c(e._pickTexture)&&n>0){let i=e._pickIds,o=lre(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let l=0;l<n;++l){let u=t.createPickId(s.getFeature(l));i.push(u);let f=u.color,h=l*4;r[h]=G.floatToByte(f.red),r[h+1]=G.floatToByte(f.green),r[h+2]=G.floatToByte(f.blue),r[h+3]=G.floatToByte(f.alpha)}e._pickTexture=dre(e,t,r),c(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function O2e(e){let t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}pc.prototype.update=function(e,t){let n=t.context;this._defaultTexture=n.defaultTexture;let i=t.passes;(i.pick||i.postProcess)&&I2e(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,c(this._batchTexture)||(this._batchTexture=dre(this,n,this._batchValues),c(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),O2e(this))};pc.prototype.isDestroyed=function(){return!1};pc.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();let e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return de(this)};var el=pc;var R2e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},M2e={SCALAR:void 0,VEC2:H,VEC3:d,VEC4:se,MAT2:Ri,MAT3:J,MAT4:B};function L2e(e){let t=e.componentType,n;typeof t=="string"?n=$.fromName(t):n=t;let i=R2e[e.type],o=M2e[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return $.createArrayBufferView(n,r,s,i*a)}}}var Eu=L2e;function Xp(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,this._byteLength=0,T.typeOf.object("options.extension",e.extension),N2e(this,e.extension,e.binaryBody),U2e(this)}Object.defineProperties(Xp.prototype,{byteLength:{get:function(){return this._byteLength}}});function N2e(e,t,n){let i,o,r,s=t.instancesLength,a=t.classes,l=t.classIds,u=t.parentCounts,f=t.parentIds,h=s,p=0;c(l.byteOffset)&&(l.componentType=l.componentType??$.UNSIGNED_SHORT,l.type=nn.SCALAR,r=Eu(l),l=r.createArrayBufferView(n.buffer,n.byteOffset+l.byteOffset,s),p+=l.byteLength);let g;if(c(u)){for(c(u.byteOffset)&&(u.componentType=u.componentType??$.UNSIGNED_SHORT,u.type=nn.SCALAR,r=Eu(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),p+=u.byteLength),g=new Uint16Array(s),h=0,i=0;i<s;++i)g[i]=h,h+=u[i];p+=g.byteLength}c(f)&&c(f.byteOffset)&&(f.componentType=f.componentType??$.UNSIGNED_SHORT,f.type=nn.SCALAR,r=Eu(f),f=r.createArrayBufferView(n.buffer,n.byteOffset+f.byteOffset,h),p+=f.byteLength);let m=a.length;for(i=0;i<m;++i){let x=a[i].length,A=a[i].instances,C=F2e(x,A,n);p+=B2e(C),a[i].instances=xt(C,A)}let y=new Array(m).fill(0),b=new Uint16Array(s);for(i=0;i<s;++i)o=l[i],b[i]=y[o],++y[o];p+=b.byteLength,e._classes=a,e._classIds=l,e._classIndexes=b,e._parentCounts=u,e._parentIndexes=g,e._parentIds=f,e._byteLength=p}function F2e(e,t,n){let i;for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=r.byteOffset;if(c(s)){let a=r.componentType,l=r.type;if(!c(a))throw new ae("componentType is required.");if(!c(l))throw new ae("type is required.");if(!c(n))throw new ae(`Property ${o} requires a batch table binary.`);let u=Eu(r),f=u.componentsPerAttribute,h=u.classType,p=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);c(i)||(i={}),i[o]={typedArray:p,componentCount:f,type:h}}}return i}function B2e(e){let t=0;for(let n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}var k2e=[];function U2e(e){let t=k2e;t.length=0;let i=e._classIds.length;for(let o=0;o<i;++o)hre(e,o,t)}function hre(e,t,n){let i=e._parentCounts,o=e._parentIds,r=e._parentIndexes,a=e._classIds.length;if(!c(o))return;if(t>=a)throw new E(`Parent index ${t} exceeds the total number of instances: ${a}`);if(n.indexOf(t)>-1)throw new E("Circular dependency detected in the batch table hierarchy.");n.push(t);let l=c(i)?i[t]:1,u=c(i)?r[t]:t;for(let f=0;f<l;++f){let h=o[u+f];h!==t&&hre(e,h,n)}n.pop(t)}var V2e=[],z2e=[],H2e=0;function G2e(e,t,n){let i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,l=V2e;l.length=Math.max(l.length,a);let u=++H2e,f=z2e;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),l[t]===u)continue;l[t]=u;let h=n(e,t);if(c(h))return h;let p=o[t],g=s[t];for(let m=0;m<p;++m){let y=r[g+m];y!==t&&f.push(y)}}}function j2e(e,t,n){let i=!0;for(;i;){let o=n(e,t);if(c(o))return o;let r=e._parentIds[t];i=r!==t,t=r}}function e1(e,t,n){let i=e._parentCounts,o=e._parentIds;if(c(o)){if(c(i))return G2e(e,t,n)}else return n(e,t);return j2e(e,t,n)}Xp.prototype.hasProperty=function(e,t){let n=e1(this,e,function(i,o){let r=i._classIds[o],s=i._classes[r].instances;if(c(s[t]))return!0});return c(n)};Xp.prototype.propertyExists=function(e){let t=this._classes,n=t.length;for(let i=0;i<n;++i){let o=t[i].instances;if(c(o[e]))return!0}return!1};Xp.prototype.getPropertyIds=function(e,t){return t=c(t)?t:[],t.length=0,e1(this,e,function(n,i){let o=n._classIds[i],r=n._classes[o].instances;for(let s in r)r.hasOwnProperty(s)&&t.indexOf(s)===-1&&t.push(s)}),t};Xp.prototype.getProperty=function(e,t){return e1(this,e,function(n,i){let o=n._classIds[i],r=n._classes[o],s=n._classIndexes[i],a=r.instances[t];if(c(a))return c(a.typedArray)?W2e(a,s):je(a[s],!0)})};function W2e(e,t){let n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}Xp.prototype.setProperty=function(e,t,n){let i=e1(this,e,function(o,r){let s=o._classIds[r],a=o._classes[s],l=o._classIndexes[r],u=a.instances[t];if(c(u)){if(r!==e)throw new E(`Inherited property "${t}" is read-only.`);return c(u.typedArray)?q2e(u,l,n):u[l]=je(n,!0),!0}});return c(i)};function q2e(e,t,n){let i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}Xp.prototype.isClass=function(e,t){let n=e1(this,e,function(i,o){let r=i._classIds[o];if(i._classes[r].name===t)return!0});return c(n)};Xp.prototype.getClassName=function(e){let t=this._classIds[e];return this._classes[t].name};var nx=Xp;var Y2e={HIGHLIGHT:0,REPLACE:1,MIX:2},Bl=Object.freeze(Y2e);var J6=el.DEFAULT_COLOR_VALUE,e9=el.DEFAULT_SHOW_VALUE;function To(e,t,n,i,o){this.featuresLength=t;let r;c(n)&&(r=n.extensions),this._extensions=r??{};let s=X2e(n);this._properties=s,this._batchTableHierarchy=K2e(this,n,i);let a=pre(t,s,i);this._binaryPropertiesByteLength=$2e(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new el({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}To._deprecationWarning=ws;Object.defineProperties(To.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return c(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function X2e(e){let t={};if(!c(e))return t;for(let n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=je(e[n],!0));return t}function K2e(e,t,n){if(!c(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"],o=t.HIERARCHY;if(c(o)&&(To._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=o,i=o),!!c(i))return new nx({extension:i,binaryBody:n})}function pre(e,t,n){let i;for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=r.byteOffset;if(c(s)){let a=r.componentType,l=r.type;if(!c(a))throw new ae("componentType is required.");if(!c(l))throw new ae("type is required.");if(!c(n))throw new ae(`Property ${o} requires a batch table binary.`);let u=Eu(r),f=u.componentsPerAttribute,h=u.classType,p=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);c(i)||(i={}),i[o]={typedArray:p,componentCount:f,type:h}}}return i}function $2e(e){if(!c(e))return 0;let t=0;for(let n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}To.getBinaryProperties=function(e,t,n){return pre(e,t,n)};To.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};To.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};To.prototype.getShow=function(e){return this._batchTexture.getShow(e)};To.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};To.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};To.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};To.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};var Z2e=new G;To.prototype.applyStyle=function(e){if(!c(e)){this.setAllColor(J6),this.setAllShow(e9);return}let t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){let o=t.getFeature(i),r=c(e.color)?e.color.evaluateColor(o,Z2e)??J6:J6,s=c(e.show)?e.show.evaluate(o)??e9:e9;this.setColor(i,r),this.setShow(i,s)}};function Q2e(e,t){let n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function J2e(e,t,n){let i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}function RC(e,t){if(!c(e)||e<0||e>=t)throw new E(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}To.prototype.isClass=function(e,t){RC(e,this.featuresLength),T.typeOf.string("className",t);let n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};To.prototype.isExactClass=function(e,t){return T.typeOf.string("className",t),this.getExactClassName(e)===t};To.prototype.getExactClassName=function(e){RC(e,this.featuresLength);let t=this._batchTableHierarchy;if(c(t))return t.getClassName(e)};To.prototype.hasProperty=function(e,t){return RC(e,this.featuresLength),T.typeOf.string("name",t),c(this._properties[t])||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};To.prototype.hasPropertyBySemantic=function(){return!1};To.prototype.getPropertyIds=function(e,t){RC(e,this.featuresLength),t=c(t)?t:[],t.length=0;let n=Object.keys(this._properties);return t.push.apply(t,n),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};To.prototype.getPropertyBySemantic=function(e,t){};To.prototype.getProperty=function(e,t){if(RC(e,this.featuresLength),T.typeOf.string("name",t),c(this._batchTableBinaryProperties)){let i=this._batchTableBinaryProperties[t];if(c(i))return Q2e(i,e)}let n=this._properties[t];if(c(n))return je(n[e],!0);if(c(this._batchTableHierarchy)){let i=this._batchTableHierarchy.getProperty(e,t);if(c(i))return i}};To.prototype.setProperty=function(e,t,n){let i=this.featuresLength;if(RC(e,i),T.typeOf.string("name",t),c(this._batchTableBinaryProperties)){let r=this._batchTableBinaryProperties[t];if(c(r)){J2e(r,e,n);return}}if(c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];c(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=je(n,!0)};function eBe(e){return e._batchTexture.textureDimensions.y===1?`uniform vec4 tile_textureStep; 
vec2 computeSt(float batchId) 
{ 
    float stepX = tile_textureStep.x; 
    float centerX = tile_textureStep.y; 
    return vec2(centerX + (batchId * stepX), 0.5); 
} 
`:`uniform vec4 tile_textureStep; 
uniform vec2 tile_textureDimensions; 
vec2 computeSt(float batchId) 
{ 
    float stepX = tile_textureStep.x; 
    float centerX = tile_textureStep.y; 
    float stepY = tile_textureStep.z; 
    float centerY = tile_textureStep.w; 
    float xId = mod(batchId, tile_textureDimensions.x); 
    float yId = floor(batchId / tile_textureDimensions.x); 
    return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); 
} 
`}To.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;let i=this;return function(o){let r=_re(o,n,!1),s;return ut.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand; 
`),s+=`uniform sampler2D tile_batchTexture; 
out vec4 tile_featureColor; 
out vec2 tile_featureSt; 
void main() 
{ 
    vec2 st = computeSt(${t}); 
    vec4 featureProperties = texture(tile_batchTexture, st); 
    tile_color(featureProperties); 
    float show = ceil(featureProperties.a); 
    gl_Position *= show; 
`,e&&(s+=`    bool isStyleTranslucent = (featureProperties.a != 1.0); 
    if (czm_pass == czm_passTranslucent) 
    { 
        if (!isStyleTranslucent && !tile_translucentCommand) 
        { 
            gl_Position *= 0.0; 
        } 
    } 
    else 
    { 
        if (isStyleTranslucent) 
        { 
            gl_Position *= 0.0; 
        } 
    } 
`),s+=`    tile_featureColor = featureProperties; 
    tile_featureSt = st; 
}`):s=`out vec2 tile_featureSt; 
void main() 
{ 
    tile_color(vec4(1.0)); 
    tile_featureSt = computeSt(${t}); 
}`,`${r}
${eBe(i)}${s}`}};function mre(e,t){return e=He.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend; 
void tile_color(vec4 tile_featureColor) 
{ 
    tile_main(); 
    tile_featureColor = czm_gammaCorrect(tile_featureColor); 
    out_FragColor.a *= tile_featureColor.a; 
    float highlight = ceil(tile_colorBlend); 
    out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); 
} 
`:`${e}void tile_color(vec4 tile_featureColor) 
{ 
    tile_main(); 
} 
`}function tBe(e,t){let n=`texture(${t}`,i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u<e.length;++u){let f=e.charAt(u);if(f==="(")++s;else if(f===")"&&(--s,s===0)){r=u+1;break}}let l=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+l+e.slice(r),i=o+l.length,o=e.indexOf(n,i)}return e}function _re(e,t,n){if(!c(t))return mre(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`),o=e.match(i);if(!c(o))return mre(e,n);let r=o[0],s=o[2];e=He.replaceMain(e,"tile_main"),e=e.replace(r,"");let a=`bool isWhite(vec3 color) 
{ 
    return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); 
} 
vec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) 
{ 
    vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); 
    vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; 
    return vec4(diffuse.rgb, sourceDiffuse.a); 
} 
`,l=`    tile_featureColor = czm_gammaCorrect(tile_featureColor); 
    out_FragColor.a *= tile_featureColor.a; 
    float highlight = ceil(tile_colorBlend); 
    out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); 
`,u;if(s==="vec3"||s==="vec4"){let f=s==="vec3"?`vec4(${t}, 1.0)`:t,h=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,h),u=`    vec4 source = ${f}; 
    tile_diffuse = tile_diffuse_final(source, tile_featureColor); 
    tile_main(); 
`}else s==="sampler2D"&&(e=tBe(e,t),u=`    tile_diffuse = tile_featureColor; 
    tile_main(); 
`);return e=`uniform float tile_colorBlend; 
vec4 tile_diffuse = vec4(1.0); 
${a}${r}
${e}
void tile_color(vec4 tile_featureColor) 
{ 
${u}`,n&&(e+=l),e+=`} 
`,e}To.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=_re(i,t,!0),ut.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture; 
in vec2 tile_featureSt; 
in vec4 tile_featureColor; 
void main() 
{ 
    tile_color(tile_featureColor); 
`,n&&(i+=`    out_FragColor.rgb *= out_FragColor.a; 
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand; 
`),i+=`uniform sampler2D tile_pickTexture; 
uniform sampler2D tile_batchTexture; 
in vec2 tile_featureSt; 
void main() 
{ 
    vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); 
    if (featureProperties.a == 0.0) { 
        discard; 
    } 
`,e&&(i+=`    bool isStyleTranslucent = (featureProperties.a != 1.0); 
    if (czm_pass == czm_passTranslucent) 
    { 
        if (!isStyleTranslucent && !tile_translucentCommand) 
        { 
            discard; 
        } 
    } 
    else 
    { 
        if (isStyleTranslucent) 
        { 
            discard; 
        } 
    } 
`),i+=`    tile_color(featureProperties); 
`,n&&(i+=`    out_FragColor.rgb *= out_FragColor.a; 
`),i+=`} 
`),i}};function nBe(e){let t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===Bl.HIGHLIGHT)return 0;if(n===Bl.REPLACE)return 1;if(n===Bl.MIX)return O.clamp(i,O.EPSILON4,1);throw new E(`Invalid color blend mode "${n}".`)}To.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;let e=this;return function(t){return xt(t,{tile_batchTexture:function(){return e._batchTexture.batchTexture??e._batchTexture.defaultTexture},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return nBe(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};To.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};var ry={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};To.prototype.addDerivedCommands=function(e,t){let n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s.isSkippingLevelOfDetail&&s.hasMixedContent&&e.context.stencilBuffer,l=iBe(this);for(let u=t;u<i;++u){let f=n[u];if(f.pass===De.COMPUTE)continue;let h=f.derivedCommands.tileset;(!c(h)||f.dirty)&&(h={},f.derivedCommands.tileset=h,h.originalCommand=oBe(f),f.dirty=!1);let p=h.originalCommand;l!==ry.ALL_OPAQUE&&f.pass!==De.TRANSLUCENT&&(c(h.translucent)||(h.translucent=rBe(p))),l!==ry.ALL_TRANSLUCENT&&f.pass!==De.TRANSLUCENT&&(c(h.opaque)||(h.opaque=sBe(p)),a&&(r||(c(h.zback)||(h.zback=cBe(e.context,p)),s._backfaceCommands.push(h.zback)),(!c(h.stencil)||o._selectionDepth!==uBe(h.stencil))&&(f.renderState.depthMask?h.stencil=lBe(p,o._selectionDepth):h.stencil=h.opaque)));let g=a?h.stencil:h.opaque,m=h.translucent;f.pass!==De.TRANSLUCENT?(l===ry.ALL_OPAQUE&&(n[u]=g),l===ry.ALL_TRANSLUCENT&&(n[u]=m),l===ry.OPAQUE_AND_TRANSLUCENT&&(n[u]=g,n.push(m))):n[u]=p}};function iBe(e){let t=e._batchTexture.translucentFeaturesLength;return t===0?ry.ALL_OPAQUE:t===e.featuresLength?ry.ALL_TRANSLUCENT:ry.OPAQUE_AND_TRANSLUCENT}function oBe(e){let t=Qe.shallowClone(e),n=t.pass===De.TRANSLUCENT;return t.uniformMap=c(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function rBe(e){let t=Qe.shallowClone(e);return t.pass=De.TRANSLUCENT,t.renderState=fBe(e.renderState),t}function sBe(e){let t=Qe.shallowClone(e);return t.renderState=dBe(e.renderState),t}function aBe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!c(n)){let i=t.fragmentShaderSource.clone();i.defines=c(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function cBe(e,t){let n=Qe.shallowClone(t),i=je(n.renderState,!0);i.cull.enabled=!0,i.cull.face=xi.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=kt.setCesium3DTileBit(),i.stencilMask=kt.CESIUM_3D_TILE_MASK,n.renderState=Ve.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=je(t.uniformMap);let o=new H(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=aBe(e,t.shaderProgram),n}function lBe(e,t){let n=Qe.shallowClone(e),i=je(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=kt.SKIP_LOD_MASK,i.stencilTest.reference=kt.CESIUM_3D_TILE_MASK|t<<kt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=Vn.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ft.REPLACE,i.stencilTest.backFunction=Vn.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=ft.REPLACE,i.stencilMask=kt.CESIUM_3D_TILE_MASK|kt.SKIP_LOD_MASK,n.renderState=Ve.fromCache(i),n}function uBe(e){return(e.renderState.stencilTest.reference&kt.SKIP_LOD_MASK)>>>kt.SKIP_LOD_BIT_SHIFT}function fBe(e){let t=je(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=ln.ALPHA_BLEND,t.stencilTest=kt.setCesium3DTileBit(),t.stencilMask=kt.CESIUM_3D_TILE_MASK,Ve.fromCache(t)}function dBe(e){let t=je(e,!0);return t.stencilTest=kt.setCesium3DTileBit(),t.stencilMask=kt.CESIUM_3D_TILE_MASK,Ve.fromCache(t)}To.prototype.update=function(e,t){this._batchTexture.update(e,t)};To.prototype.isDestroyed=function(){return!1};To.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),de(this)};var Kp=To;function hBe(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var bm=hBe;var MC=`in vec3 position;
in float a_batchId;
uniform mat4 u_modifiedModelViewProjection;
void main()
{
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
}
`;function Mf(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Mf.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return c(this._color)||(this._color=new G),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(c(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}});Mf.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Mf.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Mf.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Mf.getPropertyInherited=function(e,t,n){let i=e.batchTable;if(c(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}let o=e.metadata;if(c(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}let r=e.tile,s=r.metadata;if(c(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(c(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),c(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}let l=c(e.group)?e.group.metadata:void 0;if(c(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}let u=e.tileset.metadata;if(c(u)){if(u.hasPropertyBySemantic(n))return u.getPropertyBySemantic(n);if(u.hasProperty(n))return u.getProperty(n)}};Mf.prototype.getPropertyInherited=function(e){return Mf.getPropertyInherited(this._content,this._batchId,e)};Mf.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Mf.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Mf.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Mf.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var Ws=Mf;var t9=class{add(t,n,i){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][i?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(i){i.call(n&&n.context?n.context:n,n)})}},n9=class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}},kl=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,n,i){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,i?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,n){return e.literals[t]=n,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){let n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(e.hooks[t]){let i={context:this,node:n};return e.hooks.run(t,i),i.node}return n}searchHook(t){if(e.hooks[t]){let n={context:this};return e.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],i,o;for(;this.index<this.expr.length;)if(i=this.code,i===e.SEMCOL_CODE||i===e.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())n.push(o);else if(this.index<this.expr.length){if(i===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),n=t.length;for(;n>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,i,o,r,s,a,l,u;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:e.binaryPrecedence(n),right_a:e.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=e.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:e.right_associative.has(n)},u=n;let f=h=>r.right_a&&h.right_a?i>h.prec:i<=h.prec;for(;o.length>2&&f(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:e.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),o.push(r,t)}for(l=o.length-1,t=o[l];l>1;)t={type:e.BINARY_EXP,operator:o[l-1].value,left:o[l-2],right:t},l-=2;return t}gobbleToken(){let t,n,i,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,e.max_unop_len),i=n.length;i>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=i;let r=this.gobbleToken();return r||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}e.isIdentifierStart(t)?(o=this.gobbleIdentifier(),e.literals.hasOwnProperty(o.name)?o={type:e.LITERAL,value:e.literals[o.name],raw:o.name}:o.name===e.this_str&&(o={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===e.PERIOD_CODE||n===e.OBRACK_CODE||n===e.OPAREN_CODE||n===e.QUMARK_CODE;){let i;if(n===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(n===e.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,i;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,e.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",n=this.index,i=this.expr.charAt(this.index++),o=!1;for(;this.index<this.expr.length;){let r=this.expr.charAt(this.index++);if(r===i){o=!0;break}else if(r==="\\")switch(r=this.expr.charAt(this.index++),r){case"n":t+=`
`;break;case"r":t+="\r";break;case"t":t+="	";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=r}else t+=r}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){let n=[],i=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===e.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===e.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let s=n.length;s<o;s++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{let s=this.gobbleExpression();(!s||s.type===e.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},mBe=new t9;Object.assign(kl,{hooks:mBe,plugins:new n9(kl),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});kl.max_unop_len=kl.getMaxKeyLen(kl.unary_ops);kl.max_binop_len=kl.getMaxKeyLen(kl.binary_ops);var sy=e=>new kl(e).parse(),pBe=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(kl).filter(e=>!pBe.includes(e)&&sy[e]===void 0).forEach(e=>{sy[e]=kl[e]});sy.Jsep=kl;var _Be="ConditionalExpression",gBe={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:_Be,test:i,consequent:o,alternate:r},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=i}}else this.throwError("Expected :")}})}};sy.plugins.register(gBe);var yBe={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18},_t=Object.freeze(yBe);function $d(e,t){T.typeOf.string("expression",e),this._expression=e,e=OBe(e,t),e=MBe(RBe(e)),sy.addBinaryOp("=~",0),sy.addBinaryOp("!~",0);let n;try{n=sy(e)}catch(i){throw new ae(i)}this._runtimeAst=wi(this,n)}Object.defineProperties($d.prototype,{expression:{get:function(){return this._expression}}});var Rn={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new H],cartesian3Array:[new d],cartesian4Array:[new se],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);let e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new H),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new d),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new se),this.cartesian4Array[this.cartesian4Index++]}};$d.prototype.evaluate=function(e,t){Rn.reset();let n=this._runtimeAst.evaluate(e);return t instanceof G&&n instanceof se?G.fromCartesian4(n,t):n instanceof H||n instanceof d||n instanceof se?n.clone(t):n};$d.prototype.evaluateColor=function(e,t){Rn.reset();let n=this._runtimeAst.evaluate(e);return G.fromCartesian4(n,t)};$d.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
{
    return ${o};
}
`,o};$d.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};$d.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var bBe=["!","-","+"],gre=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],t1=/\${(.*?)}/g,xBe=/\\/g,TBe="@#%",ABe=/@#%/g,WV=new G,qV={abs:qs(Math.abs),sqrt:qs(Math.sqrt),cos:qs(Math.cos),sin:qs(Math.sin),tan:qs(Math.tan),acos:qs(Math.acos),asin:qs(Math.asin),atan:qs(Math.atan),radians:qs(O.toRadians),degrees:qs(O.toDegrees),sign:qs(O.sign),floor:qs(Math.floor),ceil:qs(Math.ceil),round:qs(Math.round),exp:qs(Math.exp),exp2:qs(EBe),log:qs(Math.log),log2:qs(SBe),fract:qs(CBe),length:wBe,normalize:vBe},YV={atan2:GV(Math.atan2,!1),pow:GV(Math.pow,!1),min:GV(Math.min,!0),max:GV(Math.max,!0),distance:DBe,dot:PBe,cross:IBe},r9={clamp:yre(O.clamp,!0),mix:yre(O.lerp,!0)};function CBe(e){return e-Math.floor(e)}function EBe(e){return Math.pow(2,e)}function SBe(e){return O.log2(e)}function qs(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof H)return H.fromElements(e(n.x),e(n.y),Rn.getCartesian2());if(n instanceof d)return d.fromElements(e(n.x),e(n.y),e(n.z),Rn.getCartesian3());if(n instanceof se)return se.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Rn.getCartesian4());throw new ae(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function GV(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof H)return H.fromElements(e(i.x,o),e(i.y,o),Rn.getCartesian2());if(i instanceof d)return d.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Rn.getCartesian3());if(i instanceof se)return se.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Rn.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x),e(i.y,o.y),Rn.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Rn.getCartesian3());if(i instanceof se&&o instanceof se)return se.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Rn.getCartesian4());throw new ae(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function yre(e,t){return function(n,i,o,r){if(t&&typeof r=="number"){if(typeof i=="number"&&typeof o=="number")return e(i,o,r);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),Rn.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Rn.getCartesian3());if(i instanceof se&&o instanceof se)return se.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),Rn.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof H&&o instanceof H&&r instanceof H)return H.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),Rn.getCartesian2());if(i instanceof d&&o instanceof d&&r instanceof d)return d.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Rn.getCartesian3());if(i instanceof se&&o instanceof se&&r instanceof se)return se.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),Rn.getCartesian4());throw new ae(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function wBe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof H)return H.magnitude(t);if(t instanceof d)return d.magnitude(t);if(t instanceof se)return se.magnitude(t);throw new ae(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function vBe(e,t){if(typeof t=="number")return 1;if(t instanceof H)return H.normalize(t,Rn.getCartesian2());if(t instanceof d)return d.normalize(t,Rn.getCartesian3());if(t instanceof se)return se.normalize(t,Rn.getCartesian4());throw new ae(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function DBe(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof H&&n instanceof H)return H.distance(t,n);if(t instanceof d&&n instanceof d)return d.distance(t,n);if(t instanceof se&&n instanceof se)return se.distance(t,n);throw new ae(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function PBe(e,t,n){if(typeof t=="number"&&typeof n=="number")return t*n;if(t instanceof H&&n instanceof H)return H.dot(t,n);if(t instanceof d&&n instanceof d)return d.dot(t,n);if(t instanceof se&&n instanceof se)return se.dot(t,n);throw new ae(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function IBe(e,t,n){if(t instanceof d&&n instanceof d)return d.cross(t,n,Rn.getCartesian3());throw new ae(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function At(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,GBe(this)}function OBe(e,t){if(!c(t))return e;for(let n in t)if(t.hasOwnProperty(n)){let i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;c(o)&&(e=e.replace(i,o))}return e}function RBe(e){return e.replace(xBe,TBe)}function o9(e){return e.replace(ABe,"\\")}function MBe(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){let o=t.indexOf("'"),r=t.indexOf('"'),s;if(o>=0&&o<i)s=t.indexOf("'",o+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else if(r>=0&&r<i)s=t.indexOf('"',r+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else{n+=t.substr(0,i);let a=t.indexOf("}");if(a<0)throw new ae("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function LBe(e){let t=typeof e.value;if(e.value===null)return new At(_t.LITERAL_NULL,null);if(t==="boolean")return new At(_t.LITERAL_BOOLEAN,e.value);if(t==="number")return new At(_t.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new At(_t.VARIABLE_IN_STRING,e.value):new At(_t.LITERAL_STRING,o9(e.value))}function NBe(e,t){let n=t.arguments,i=n.length,o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;let l=t.callee.object;if(o==="test"||o==="exec"){if(!c(l.callee)||l.callee.name!=="regExp")throw new ae(`${o} is not a function.`);return i===0?o==="test"?new At(_t.LITERAL_BOOLEAN,!1):new At(_t.LITERAL_NULL,null):(s=wi(e,l),a=wi(e,n[0]),new At(_t.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=wi(e,l),new At(_t.FUNCTION_CALL,o,r);throw new ae(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new At(_t.LITERAL_COLOR,o);if(r=wi(e,n[0]),c(n[1])){let l=wi(e,n[1]);return new At(_t.LITERAL_COLOR,o,[r,l])}return new At(_t.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new ae(`${o} requires three arguments.`);return r=[wi(e,n[0]),wi(e,n[1]),wi(e,n[2])],new At(_t.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new ae(`${o} requires four arguments.`);return r=[wi(e,n[0]),wi(e,n[1]),wi(e,n[2]),wi(e,n[3])],new At(_t.LITERAL_COLOR,o,r)}else if(o==="vec2"||o==="vec3"||o==="vec4"){r=new Array(i);for(let l=0;l<i;++l)r[l]=wi(e,n[l]);return new At(_t.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new At(_t.LITERAL_BOOLEAN,!0):new At(_t.LITERAL_BOOLEAN,!1):(r=wi(e,n[0]),new At(_t.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new ae(`${o} requires exactly one argument.`);return r=wi(e,n[0]),new At(_t.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new ae(`${o} does not take any argument.`);return new At(_t.UNARY,o)}else if(c(qV[o])){if(i!==1)throw new ae(`${o} requires exactly one argument.`);return r=wi(e,n[0]),new At(_t.UNARY,o,r)}else if(c(YV[o])){if(i!==2)throw new ae(`${o} requires exactly two arguments.`);return s=wi(e,n[0]),a=wi(e,n[1]),new At(_t.BINARY,o,s,a)}else if(c(r9[o])){if(i!==3)throw new ae(`${o} requires exactly three arguments.`);s=wi(e,n[0]),a=wi(e,n[1]);let l=wi(e,n[2]);return new At(_t.TERNARY,o,s,a,l)}else{if(o==="Boolean")return i===0?new At(_t.LITERAL_BOOLEAN,!1):(r=wi(e,n[0]),new At(_t.UNARY,o,r));if(o==="Number")return i===0?new At(_t.LITERAL_NUMBER,0):(r=wi(e,n[0]),new At(_t.UNARY,o,r));if(o==="String")return i===0?new At(_t.LITERAL_STRING,""):(r=wi(e,n[0]),new At(_t.UNARY,o,r));if(o==="regExp")return FBe(e,t)}}throw new ae(`Unexpected function call "${o}".`)}function FBe(e,t){let n=t.arguments;if(n.length===0)return new At(_t.LITERAL_REGEX,new RegExp);let i=wi(e,n[0]),o;if(n.length>1){let r=wi(e,n[1]);if(i9(i)&&i9(r)){try{o=new RegExp(o9(String(i._value)),r._value)}catch(s){throw new ae(s)}return new At(_t.LITERAL_REGEX,o)}return new At(_t.REGEX,i,r)}if(i9(i)){try{o=new RegExp(o9(String(i._value)))}catch(r){throw new ae(r)}return new At(_t.LITERAL_REGEX,o)}return new At(_t.REGEX,i)}function BBe(e){if(zBe(e.name)){let t=HBe(e.name);return t.substr(0,8)==="tiles3d_"?new At(_t.BUILTIN_VARIABLE,t):new At(_t.VARIABLE,t)}else{if(e.name==="NaN")return new At(_t.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new At(_t.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new At(_t.LITERAL_UNDEFINED,void 0)}throw new ae(`${e.name} is not defined.`)}function kBe(e){let t=e.property.name;if(t==="PI")return new At(_t.LITERAL_NUMBER,Math.PI);if(t==="E")return new At(_t.LITERAL_NUMBER,Math.E)}function UBe(e){if(e.property.name==="POSITIVE_INFINITY")return new At(_t.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function VBe(e,t){if(t.object.name==="Math")return kBe(t);if(t.object.name==="Number")return UBe(t);let n,i=wi(e,t.object);return t.computed?(n=wi(e,t.property),new At(_t.MEMBER,"brackets",i,n)):(n=new At(_t.LITERAL_STRING,t.property.name),new At(_t.MEMBER,"dot",i,n))}function i9(e){return e._type>=_t.LITERAL_NULL}function zBe(e){return e.substr(0,4)==="czm_"}function HBe(e){return e.substr(4)}function wi(e,t){let n,i,o,r;if(t.type==="Literal")n=LBe(t);else if(t.type==="CallExpression")n=NBe(e,t);else if(t.type==="Identifier")n=BBe(t);else if(t.type==="UnaryExpression"){i=t.operator;let s=wi(e,t.argument);if(bBe.indexOf(i)>-1)n=new At(_t.UNARY,i,s);else throw new ae(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=wi(e,t.left),r=wi(e,t.right),gre.indexOf(i)>-1)n=new At(_t.BINARY,i,o,r);else throw new ae(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=wi(e,t.left),r=wi(e,t.right),gre.indexOf(i)>-1&&(n=new At(_t.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){let s=wi(e,t.test);o=wi(e,t.consequent),r=wi(e,t.alternate),n=new At(_t.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=VBe(e,t);else if(t.type==="ArrayExpression"){let s=[];for(let a=0;a<t.elements.length;a++)s[a]=wi(e,t.elements[a]);n=new At(_t.ARRAY,s)}else throw t.type==="Compound"?new ae("Provide exactly one expression."):new ae("Cannot parse expression.");return n}function GBe(e){e._type===_t.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===_t.FUNCTION_CALL?e._value==="test"?e.evaluate=e._evaluateRegExpTest:e._value==="exec"?e.evaluate=e._evaluateRegExpExec:e._value==="toString"&&(e.evaluate=e._evaluateToString):e._type===_t.UNARY?e._value==="!"?e.evaluate=e._evaluateNot:e._value==="-"?e.evaluate=e._evaluateNegative:e._value==="+"?e.evaluate=e._evaluatePositive:e._value==="isNaN"?e.evaluate=e._evaluateNaN:e._value==="isFinite"?e.evaluate=e._evaluateIsFinite:e._value==="isExactClass"?e.evaluate=e._evaluateIsExactClass:e._value==="isClass"?e.evaluate=e._evaluateIsClass:e._value==="getExactClassName"?e.evaluate=e._evaluateGetExactClassName:e._value==="Boolean"?e.evaluate=e._evaluateBooleanConversion:e._value==="Number"?e.evaluate=e._evaluateNumberConversion:e._value==="String"?e.evaluate=e._evaluateStringConversion:c(qV[e._value])&&(e.evaluate=WBe(e._value)):e._type===_t.BINARY?e._value==="+"?e.evaluate=e._evaluatePlus:e._value==="-"?e.evaluate=e._evaluateMinus:e._value==="*"?e.evaluate=e._evaluateTimes:e._value==="/"?e.evaluate=e._evaluateDivide:e._value==="%"?e.evaluate=e._evaluateMod:e._value==="==="?e.evaluate=e._evaluateEqualsStrict:e._value==="!=="?e.evaluate=e._evaluateNotEqualsStrict:e._value==="<"?e.evaluate=e._evaluateLessThan:e._value==="<="?e.evaluate=e._evaluateLessThanOrEquals:e._value===">"?e.evaluate=e._evaluateGreaterThan:e._value===">="?e.evaluate=e._evaluateGreaterThanOrEquals:e._value==="&&"?e.evaluate=e._evaluateAnd:e._value==="||"?e.evaluate=e._evaluateOr:e._value==="=~"?e.evaluate=e._evaluateRegExpMatch:e._value==="!~"?e.evaluate=e._evaluateRegExpNotMatch:c(YV[e._value])&&(e.evaluate=qBe(e._value)):e._type===_t.TERNARY?e.evaluate=YBe(e._value):e._type===_t.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===_t.ARRAY?e.evaluate=e._evaluateArray:e._type===_t.VARIABLE?e.evaluate=e._evaluateVariable:e._type===_t.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===_t.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===_t.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===_t.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===_t.REGEX?e.evaluate=e._evaluateRegExp:e._type===_t.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=jBe):e.evaluate=e._evaluateLiteral}function jBe(e){return c(e)?e.content.tileset.timeSinceLoad:0}function WBe(e){let t=qV[e];return function(n){let i=this._left.evaluate(n);return t(e,i)}}function qBe(e){let t=YV[e];return function(n){let i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function YBe(e){let t=r9[e];return function(n){let i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}function XV(e,t){if(c(e))return e.getPropertyInherited(t)}At.prototype._evaluateLiteral=function(){return this._value};At.prototype._evaluateLiteralColor=function(e){let t=WV,n=this._left;if(this._value==="color")c(n)?n.length>1?(G.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):G.fromCssColorString(n[0].evaluate(e),t):G.fromBytes(255,255,255,255,t);else if(this._value==="rgb")G.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if(this._value==="rgba"){let i=n[3].evaluate(e)*255;G.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?G.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&G.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return se.fromColor(t,Rn.getCartesian4())};At.prototype._evaluateLiteralVector=function(e){let t=Rn.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){let l=i[a].evaluate(e);if(typeof l=="number")t.push(l);else if(l instanceof H)t.push(l.x,l.y);else if(l instanceof d)t.push(l.x,l.y,l.z);else if(l instanceof se)t.push(l.x,l.y,l.z,l.w);else throw new ae(`${n} argument must be a vector or number. Argument is ${l}.`)}let r=t.length,s=parseInt(n.charAt(3));if(r===0)throw new ae(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new ae(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new ae(`Invalid ${n} constructor. Too many arguments.`);if(r===1){let a=t[0];t.push(a,a,a)}if(n==="vec2")return H.fromArray(t,0,Rn.getCartesian2());if(n==="vec3")return d.fromArray(t,0,Rn.getCartesian3());if(n==="vec4")return se.fromArray(t,0,Rn.getCartesian4())};At.prototype._evaluateLiteralString=function(){return this._value};At.prototype._evaluateVariableString=function(e){let t=this._value,n=t1.exec(t);for(;n!==null;){let i=n[0],o=n[1],r=XV(e,o);c(r)||(r=""),t=t.replace(i,r),t1.lastIndex+=r.length-i.length,n=t1.exec(t)}return t};At.prototype._evaluateVariable=function(e){return XV(e,this._value)};function ix(e){return e._value==="feature"}At.prototype._evaluateMemberDot=function(e){if(ix(this._left))return XV(e,this._right.evaluate(e));let t=this._left.evaluate(e);if(!c(t))return;let n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof se){if(n==="r")return t.x;if(n==="g")return t.y;if(n==="b")return t.z;if(n==="a")return t.w}return t[n]};At.prototype._evaluateMemberBrackets=function(e){if(ix(this._left))return XV(e,this._right.evaluate(e));let t=this._left.evaluate(e);if(!c(t))return;let n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof se){if(n===0||n==="r")return t.x;if(n===1||n==="g")return t.y;if(n===2||n==="b")return t.z;if(n===3||n==="a")return t.w}return t[n]};At.prototype._evaluateArray=function(e){let t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};At.prototype._evaluateNot=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ae(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};At.prototype._evaluateNegative=function(e){let t=this._left.evaluate(e);if(t instanceof H)return H.negate(t,Rn.getCartesian2());if(t instanceof d)return d.negate(t,Rn.getCartesian3());if(t instanceof se)return se.negate(t,Rn.getCartesian4());if(typeof t=="number")return-t;throw new ae(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};At.prototype._evaluatePositive=function(e){let t=this._left.evaluate(e);if(!(t instanceof H||t instanceof d||t instanceof se||typeof t=="number"))throw new ae(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};At.prototype._evaluateLessThan=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ae(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};At.prototype._evaluateLessThanOrEquals=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ae(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};At.prototype._evaluateGreaterThan=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ae(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};At.prototype._evaluateGreaterThanOrEquals=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ae(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};At.prototype._evaluateOr=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ae(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;let n=this._right.evaluate(e);if(typeof n!="boolean")throw new ae(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};At.prototype._evaluateAnd=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ae(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;let n=this._right.evaluate(e);if(typeof n!="boolean")throw new ae(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};At.prototype._evaluatePlus=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.add(t,n,Rn.getCartesian2());if(n instanceof d&&t instanceof d)return d.add(t,n,Rn.getCartesian3());if(n instanceof se&&t instanceof se)return se.add(t,n,Rn.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new ae(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};At.prototype._evaluateMinus=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.subtract(t,n,Rn.getCartesian2());if(n instanceof d&&t instanceof d)return d.subtract(t,n,Rn.getCartesian3());if(n instanceof se&&t instanceof se)return se.subtract(t,n,Rn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new ae(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};At.prototype._evaluateTimes=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.multiplyComponents(t,n,Rn.getCartesian2());if(n instanceof H&&typeof t=="number")return H.multiplyByScalar(n,t,Rn.getCartesian2());if(t instanceof H&&typeof n=="number")return H.multiplyByScalar(t,n,Rn.getCartesian2());if(n instanceof d&&t instanceof d)return d.multiplyComponents(t,n,Rn.getCartesian3());if(n instanceof d&&typeof t=="number")return d.multiplyByScalar(n,t,Rn.getCartesian3());if(t instanceof d&&typeof n=="number")return d.multiplyByScalar(t,n,Rn.getCartesian3());if(n instanceof se&&t instanceof se)return se.multiplyComponents(t,n,Rn.getCartesian4());if(n instanceof se&&typeof t=="number")return se.multiplyByScalar(n,t,Rn.getCartesian4());if(t instanceof se&&typeof n=="number")return se.multiplyByScalar(t,n,Rn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new ae(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};At.prototype._evaluateDivide=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.divideComponents(t,n,Rn.getCartesian2());if(t instanceof H&&typeof n=="number")return H.divideByScalar(t,n,Rn.getCartesian2());if(n instanceof d&&t instanceof d)return d.divideComponents(t,n,Rn.getCartesian3());if(t instanceof d&&typeof n=="number")return d.divideByScalar(t,n,Rn.getCartesian3());if(n instanceof se&&t instanceof se)return se.divideComponents(t,n,Rn.getCartesian4());if(t instanceof se&&typeof n=="number")return se.divideByScalar(t,n,Rn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new ae(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};At.prototype._evaluateMod=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.fromElements(t.x%n.x,t.y%n.y,Rn.getCartesian2());if(n instanceof d&&t instanceof d)return d.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Rn.getCartesian3());if(n instanceof se&&t instanceof se)return se.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,Rn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new ae(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};At.prototype._evaluateEqualsStrict=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof se&&t instanceof se?t.equals(n):t===n};At.prototype._evaluateNotEqualsStrict=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof se&&t instanceof se?!t.equals(n):t!==n};At.prototype._evaluateConditional=function(e){let t=this._test.evaluate(e);if(typeof t!="boolean")throw new ae(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};At.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};At.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};At.prototype._evaluateIsExactClass=function(e){return c(e)?e.isExactClass(this._left.evaluate(e)):!1};At.prototype._evaluateIsClass=function(e){return c(e)?e.isClass(this._left.evaluate(e)):!1};At.prototype._evaluateGetExactClassName=function(e){if(c(e))return e.getExactClassName()};At.prototype._evaluateBooleanConversion=function(e){return!!this._left.evaluate(e)};At.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};At.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};At.prototype._evaluateRegExp=function(e){let t=this._value.evaluate(e),n="";c(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new ae(o)}return i};At.prototype._evaluateRegExpTest=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new ae(`RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);return t.test(n)};At.prototype._evaluateRegExpMatch=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return t.test(n);if(n instanceof RegExp&&typeof t=="string")return n.test(t);throw new ae(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};At.prototype._evaluateRegExpNotMatch=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return!t.test(n);if(n instanceof RegExp&&typeof t=="string")return!n.test(t);throw new ae(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};At.prototype._evaluateRegExpExec=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new ae(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);let i=t.exec(n);return c(i)?i[1]:null};At.prototype._evaluateToString=function(e){let t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof H||t instanceof d||t instanceof se)return String(t);throw new ae(`Unexpected function call "${this._value}".`)};function bre(e){let t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==_t.LITERAL_NUMBER)return;let i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return G.fromHsl(i,o,r,s,WV)}function xre(e){let t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==_t.LITERAL_NUMBER)return;let i=WV;return i.red=t[0]._value/255,i.green=t[1]._value/255,i.blue=t[2]._value/255,i.alpha=n===4?t[3]._value:1,i}function ay(e){return e%1===0?e.toFixed(1):e.toString()}function XBe(e){let t=ay(e.red),n=ay(e.green),i=ay(e.blue);return`vec3(${t}, ${n}, ${i})`}function jV(e){let t=ay(e.red),n=ay(e.green),i=ay(e.blue),o=ay(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function Tre(e,t,n,i){let o=e.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=e[s].getShaderExpression(t,n,i);return r}function Are(e,t){return c(t[e])?t[e]:$d.NULL_SENTINEL}$d.NULL_SENTINEL="czm_infinity";At.prototype.getShaderExpression=function(e,t,n){let i,o,r,s,a=this._type,l=this._value;c(this._left)&&(Array.isArray(this._left)?o=Tre(this._left,e,t,this):o=this._left.getShaderExpression(e,t,this)),c(this._right)&&(r=this._right.getShaderExpression(e,t,this)),c(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(l=Tre(this._value,e,t,this));let u,f,h;switch(a){case _t.VARIABLE:return ix(this)?void 0:Are(l,e);case _t.UNARY:if(l==="Boolean")return`bool(${o})`;if(l==="Number")return`float(${o})`;if(l==="round")return`floor(${o} + 0.5)`;if(c(qV[l]))return`${l}(${o})`;if(l==="isNaN")return`(${o} != ${o})`;if(l==="isFinite")return`(abs(${o}) < czm_infinity)`;if(l==="String"||l==="isExactClass"||l==="isClass"||l==="getExactClassName")throw new ae(`Error generating style shader: "${l}" is not supported.`);return l+o;case _t.BINARY:return l==="%"?`mod(${o}, ${r})`:l==="==="?`(${o} == ${r})`:l==="!=="?`(${o} != ${r})`:l==="atan2"?`atan(${o}, ${r})`:c(YV[l])?`${l}(${o}, ${r})`:`(${o} ${l} ${r})`;case _t.TERNARY:if(c(r9[l]))return`${l}(${o}, ${r}, ${s})`;break;case _t.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case _t.MEMBER:return ix(this._left)?Are(r,e):r==="r"||r==="x"||r==="0.0"?`${o}[0]`:r==="g"||r==="y"||r==="1.0"?`${o}[1]`:r==="b"||r==="z"||r==="2.0"?`${o}[2]`:r==="a"||r==="w"||r==="3.0"?`${o}[3]`:`${o}[int(${r})]`;case _t.FUNCTION_CALL:throw new ae(`Error generating style shader: "${l}" is not supported.`);case _t.ARRAY:if(l.length===4)return`vec4(${l[0]}, ${l[1]}, ${l[2]}, ${l[3]})`;if(l.length===3)return`vec3(${l[0]}, ${l[1]}, ${l[2]})`;if(l.length===2)return`vec2(${l[0]}, ${l[1]})`;throw new ae("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case _t.REGEX:throw new ae("Error generating style shader: Regular expressions are not supported.");case _t.VARIABLE_IN_STRING:throw new ae("Error generating style shader: Converting a variable to a string is not supported.");case _t.LITERAL_NULL:return $d.NULL_SENTINEL;case _t.LITERAL_BOOLEAN:return l?"true":"false";case _t.LITERAL_NUMBER:return ay(l);case _t.LITERAL_STRING:if(c(n)&&n._type===_t.MEMBER&&(l==="r"||l==="g"||l==="b"||l==="a"||l==="x"||l==="y"||l==="z"||l==="w"||ix(n._left)))return l;if(i=G.fromCssColorString(l,WV),c(i))return XBe(i);throw new ae("Error generating style shader: String literals are not supported.");case _t.LITERAL_COLOR:if(u=o,l==="color"){if(c(u)){if(u.length>1){let p=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${p}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(l==="rgb")return i=xre(this),c(i)?jV(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, 1.0)`;if(l==="rgba")return u[3]!=="1.0"&&(t.translucent=!0),i=xre(this),c(i)?jV(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(l==="hsl")return i=bre(this),c(i)?jV(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(l==="hsla")return i=bre(this),c(i)?(i.alpha!==1&&(t.translucent=!0),jV(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case _t.LITERAL_VECTOR:if(!c(o))throw new E("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");f=o.length,h=`${l}(`;for(let p=0;p<f;++p)h+=o[p],p<f-1&&(h+=", ");return h+=")",h;case _t.LITERAL_REGEX:throw new ae("Error generating style shader: Regular expressions are not supported.");case _t.LITERAL_UNDEFINED:return $d.NULL_SENTINEL;case _t.BUILTIN_VARIABLE:if(l==="tiles3d_tileset_time")return l}};At.prototype.getVariables=function(e,t){let n,i,o,r=this._type,s=this._value;if(c(this._left))if(Array.isArray(this._left))for(n=this._left,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);else this._left.getVariables(e,this);if(c(this._right)&&this._right.getVariables(e,this),c(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(n=this._value,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);let a;switch(r){case _t.VARIABLE:ix(this)||e.push(s);break;case _t.VARIABLE_IN_STRING:for(a=t1.exec(s);a!==null;)e.push(a[1]),a=t1.exec(s);break;case _t.LITERAL_STRING:c(t)&&t._type===_t.MEMBER&&ix(t._left)&&e.push(s);break}};var Lf=$d;function $p(e){e=e??W.EMPTY_OBJECT,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=e.center??d.ZERO,this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=G.clone(G.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=e.classificationType??Un.BOTH,this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};let t=this._batchIds.length;for(let n=0;n<t;++n){let i=this._batchIds[n];this._batchIdLookUp[i]=n}}Object.defineProperties($p.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});var KBe={position:0,a_batchId:1};function $Be(e,t){if(c(e._va))return;let n=yt.createVertexBuffer({context:t,typedArray:e._positions,usage:Be.STATIC_DRAW}),i=yt.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:Be.STATIC_DRAW}),o=yt.createIndexBuffer({context:t,typedArray:e._indices,usage:Be.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:$.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:$.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new ti({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new ti({context:t,attributes:r,indexBuffer:yt.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:Be.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0}function ZBe(e,t){if(c(e._sp))return;let n=e._batchTable,i=e._attributeLocations??KBe,o=e._pickId,r=e._vertexShaderSource,s=e._fragmentShaderSource;if(c(r)){e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=He.replaceMain(s,"czm_non_pick_main"),s=`${s}void main() 
{ 
    czm_non_pick_main(); 
    out_FragColor = ${o}; 
} 
`,e._spPick=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}let a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(MC),l=n.getFragmentShaderCallback(!1,void 0,!0)(Jg);o=n.getPickId();let u=new He({sources:[a]}),f=new He({defines:["VECTOR_TILE"],sources:[l]});e._sp=Jt.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),u=new He({sources:[MC]}),f=new He({defines:["VECTOR_TILE"],sources:[Jg]}),e._spStencil=Jt.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),l=He.replaceMain(l,"czm_non_pick_main"),l=`${l}
void main() 
{ 
    czm_non_pick_main(); 
    out_FragColor = ${o}; 
} 
`;let h=new He({sources:[a]}),p=new He({defines:["VECTOR_TILE"],sources:[l]});e._spPick=Jt.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:p,attributeLocations:i})}function Cre(e){let t=e?Vn.EQUAL:Vn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:ft.KEEP,zFail:ft.DECREMENT_WRAP,zPass:ft.KEEP},backFunction:t,backOperation:{fail:ft.KEEP,zFail:ft.INCREMENT_WRAP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:dc.LESS_OR_EQUAL},depthMask:!1}}var QBe={stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:ln.PRE_MULTIPLIED_ALPHA_BLEND},JBe={stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function e3e(e){c(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Ve.fromCache(Cre(!1)),e._rsStencilDepthPass3DTiles=Ve.fromCache(Cre(!0)),e._rsColorPass=Ve.fromCache(QBe),e._rsPickPass=Ve.fromCache(JBe))}var ox=new B,Ere=new d;function t3e(e,t){if(c(e._uniformMap))return;let n={u_modifiedModelViewProjection:function(){let i=t.uniformState.view,o=t.uniformState.projection;return B.clone(i,ox),B.multiplyByPoint(ox,e._center,Ere),B.setTranslation(ox,Ere,ox),B.multiply(o,ox,ox),ox},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function s9(e,t,n,i,o,r,s){let a=e.constructor.BYTES_PER_ELEMENT,l=r.length;for(let u=0;u<l;++u){let f=r[u],h=s[f],p=i[h],g=o[h],m=new e.constructor(e.buffer,a*p,g);t.set(m,n),i[h]=n,n+=g}return n}function n3e(e,t){let n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length),a=t.pop(),l=[a],u=s9(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){let f=t.pop();if(G.equals(f.color,a.color))u=s9(n,s,u,i,o,f.batchIds,r),a.batchIds=a.batchIds.concat(f.batchIds),a.count=u-a.offset;else{let h=u;u=s9(n,s,u,i,o,f.batchIds,r),f.offset=h,f.count=u-h,l.push(f),a=f}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=l}function a9(e,t,n,i,o,r,s){let a=e.bytesPerIndex,l=r.length;for(let u=0;u<l;++u){let f=r[u],h=s[f],p=i[h],g=o[h];t.copyFromBuffer(e,p*a,n*a,g*a),i[h]=n,n+=g}return n}function i3e(e,t){let n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp,r=t.pop(),s=[r],a=e._va.indexBuffer,l=e._vaSwap.indexBuffer,u=a9(a,l,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){let h=t.pop();if(G.equals(h.color,r.color))u=a9(a,l,u,n,i,h.batchIds,o),r.batchIds=r.batchIds.concat(h.batchIds),r.count=u-r.offset;else{let p=u;u=a9(a,l,u,n,i,h.batchIds,o),h.offset=p,h.count=u-p,s.push(h),r=h}}let f=e._va;e._va=e._vaSwap,e._vaSwap=f,e._batchedIndices=s}function o3e(e,t){return t.color.toRgba()-e.color.toRgba()}function r3e(e,t){if(!e._batchDirty)return!1;let n=e._batchedIndices,i=n.length,o=!1,r={};for(let s=0;s<i;++s){let l=n[s].color.toRgba();if(c(r[l])){o=!0;break}else r[l]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(o3e),t.webgl2?i3e(e,n):n3e(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function s3e(e,t){let n=r3e(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(c(i)&&!n&&i.length===s)return;i.length=s;let a=e._va,l=e._sp,u=e._modelMatrix??B.IDENTITY,f=e._uniformMap,h=e._boundingVolume;for(let p=0;p<r;++p){let g=o[p].offset,m=o[p].count,y=i[p*2];c(y)||(y=i[p*2]=new Qe({owner:e})),y.vertexArray=a,y.modelMatrix=u,y.offset=g,y.count=m,y.renderState=e._rsStencilDepthPass,y.shaderProgram=l,y.uniformMap=f,y.boundingVolume=h,y.cull=!1,y.pass=De.TERRAIN_CLASSIFICATION;let b=Qe.shallowClone(y,y.derivedCommands.tileset);b.renderState=e._rsStencilDepthPass3DTiles,b.pass=De.CESIUM_3D_TILE_CLASSIFICATION,y.derivedCommands.tileset=b;let x=i[p*2+1];c(x)||(x=i[p*2+1]=new Qe({owner:e})),x.vertexArray=a,x.modelMatrix=u,x.offset=g,x.count=m,x.renderState=e._rsColorPass,x.shaderProgram=l,x.uniformMap=f,x.boundingVolume=h,x.cull=!1,x.pass=De.TERRAIN_CLASSIFICATION;let A=Qe.shallowClone(x,x.derivedCommands.tileset);A.pass=De.CESIUM_3D_TILE_CLASSIFICATION,x.derivedCommands.tileset=A}e._commandsDirty=!0}function a3e(e,t){if(e.classificationType===Un.TERRAIN||!t.invertClassification||c(e._commandsIgnoreShow)&&!e._commandsDirty)return;let n=e._commands,i=e._commandsIgnoreShow,o=e._spStencil,r=n.length,s=i.length=r/2,a=0;for(let l=0;l<s;++l){let u=i[l]=Qe.shallowClone(n[a],i[l]);u.shaderProgram=o,u.pass=De.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function c3e(e){if(!e._pickCommandsDirty)return;let t=e._indexOffsets.length,n=e._pickCommands;n.length=t*2;let i=e._va,o=e._spStencil,r=e._spPick,s=e._modelMatrix??B.IDENTITY,a=e._uniformMap;for(let l=0;l<t;++l){let u=e._indexOffsets[l],f=e._indexCounts[l],h=c(e._boundingVolumes)?e._boundingVolumes[l]:e.boundingVolume,p=n[l*2];c(p)||(p=n[l*2]=new Qe({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=u,p.count=f,p.renderState=e._rsStencilDepthPass,p.shaderProgram=o,p.uniformMap=a,p.boundingVolume=h,p.pass=De.TERRAIN_CLASSIFICATION;let g=Qe.shallowClone(p,p.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=De.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=g;let m=n[l*2+1];c(m)||(m=n[l*2+1]=new Qe({owner:e,pickOnly:!0})),m.vertexArray=i,m.modelMatrix=s,m.offset=u,m.count=f,m.renderState=e._rsPickPass,m.shaderProgram=r,m.uniformMap=a,m.boundingVolume=h,m.pass=De.TERRAIN_CLASSIFICATION;let y=Qe.shallowClone(m,m.derivedCommands.tileset);y.pass=De.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=y}e._pickCommandsDirty=!1}$p.prototype.createFeatures=function(e,t){let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o];t[r]=new Ws(e,r)}};$p.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function l3e(e,t){e._updatingAllCommands=!0;let n=e._batchIds,i=n.length,o;for(o=0;o<i;++o){let s=n[o],a=t[s];a.show=!0,a.color=G.WHITE}let r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=G.clone(G.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}var u3e=new G,f3e=G.WHITE,d3e=!0,h3e=/\$/;$p.prototype.applyStyle=function(e,t){if(!c(e)){l3e(this,t);return}let n=e.color,i=n instanceof Lf&&!h3e.test(n.expression);this._updatingAllCommands=i;let o=this._batchIds,r=o.length,s;for(s=0;s<r;++s){let a=o[s],l=t[a];l.color=c(e.color)?e.color.evaluateColor(l,u3e):f3e,l.show=c(e.show)?e.show.evaluate(l):d3e}if(i){let a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=G.clone(G.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};$p.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;let n=this._batchIdLookUp,i=n[e];if(!c(i))return;let o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],l=this._batchedIndices,u=l.length,f;for(f=0;f<u;++f){let y=l[f].offset,b=l[f].count;if(s>=y&&s<y+b)break}l.push(new bm({color:G.clone(t),offset:s,count:a,batchIds:[e]}));let h=[],p=[],g=l[f].batchIds,m=g.length;for(let y=0;y<m;++y){let b=g[y];if(b===e)continue;let x=n[b];o[x]<s?h.push(b):p.push(b)}p.length!==0&&l.push(new bm({color:G.clone(l[f].color),offset:s+a,count:l[f].offset+l[f].count-(s+a),batchIds:p})),h.length!==0?(l[f].count=s-l[f].offset,l[f].batchIds=h):l.splice(f,1),this._batchDirty=!0};function Sre(e,t,n,i){let o=e.classificationType,r=o!==Un.CESIUM_3D_TILE,s=o!==Un.TERRAIN,a=t.commandList,l=n.length,u,f;for(f=0;f<l;++f)r&&(u=n[f],u.pass=De.TERRAIN_CLASSIFICATION,a.push(u)),s&&(u=n[f].derivedCommands.tileset,u.pass=De.CESIUM_3D_TILE_CLASSIFICATION,a.push(u));if(!(!t.invertClassification||!c(i)))for(l=i.length,f=0;f<l;++f)a.push(i[f])}function m3e(e,t){let n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){let r=t[o+1];r.pass=De.OPAQUE,n.push(r)}}function p3e(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;c(e._rsWireframe)||(e._rsWireframe=Ve.fromCache({}));let n,i;e.debugWireframe?(n=e._rsWireframe,i=Me.LINES):(n=e._rsColorPass,i=Me.TRIANGLES);let o=e._commands,r=o.length;for(let s=0;s<r;s+=2){let a=o[s+1];a.renderState=n,a.primitiveType=i}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}$p.prototype.update=function(e){let t=e.context;$Be(this,t),ZBe(this,t),e3e(this),t3e(this,t);let n=e.passes;n.render&&(s3e(this,t),a3e(this,e),p3e(this),this._debugWireframe?m3e(e,this._commands):Sre(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(c3e(this),Sre(this,e,this._pickCommands))};$p.prototype.isDestroyed=function(){return!1};$p.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),de(this)};var rx=$p;function Su(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,c(this._center)||(c(this._boundingVolume)?this._center=d.clone(this._boundingVolume.center):this._center=d.clone(d.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Un.BOTH}Object.defineProperties(Su.prototype,{trianglesLength:{get:function(){return c(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}});Su.packedBoxLength=B.packedLength+d.packedLength;Su.packedCylinderLength=B.packedLength+2;Su.packedEllipsoidLength=B.packedLength+d.packedLength;Su.packedSphereLength=d.packedLength+1;function _3e(e){let t=new Float64Array(B.packedLength+d.packedLength),n=0;return d.pack(e._center,t,n),n+=d.packedLength,B.pack(e._modelMatrix,t,n),t}function g3e(e,t){let n=0,i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let l=0;l<o;++l)r[l]=le.unpack(t,n),n+=le.packedLength;let s=t[n++],a=e._batchedIndices=new Array(s);for(let l=0;l<s;++l){let u=G.unpack(t,n);n+=G.packedLength;let f=t[n++],h=t[n++],p=t[n++],g=new Array(p);for(let m=0;m<p;++m)g[m]=t[n++];a[l]=new bm({color:u,offset:f,count:h,batchIds:g})}return i}var y3e=new yi("createVectorTileGeometries",5),b3e=new G;function x3e(e){if(!c(e._primitive)&&!c(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,o=e._cylinderBatchIds,r=e._ellipsoids,s=e._ellipsoidBatchIds,a=e._spheres,l=e._sphereBatchIds,u=e._batchTableColors,f=e._packedBuffer;if(!c(u)){let m=0;c(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),m+=n.length),c(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),m+=o.length),c(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),m+=s.length),c(e._spheres)&&(a=e._sphere=a.slice(),l=e._sphereBatchIds=l.slice(),m+=l.length),u=e._batchTableColors=new Uint32Array(m);let y=e._batchTable;for(let b=0;b<m;++b){let x=y.getColor(b,b3e);u[b]=x.toRgba()}f=e._packedBuffer=_3e(e)}let h=[];c(t)&&h.push(t.buffer,n.buffer),c(i)&&h.push(i.buffer,o.buffer),c(r)&&h.push(r.buffer,s.buffer),c(a)&&h.push(a.buffer,l.buffer),h.push(u.buffer,f.buffer);let p={boxes:c(t)?t.buffer:void 0,boxBatchIds:c(t)?n.buffer:void 0,cylinders:c(i)?i.buffer:void 0,cylinderBatchIds:c(i)?o.buffer:void 0,ellipsoids:c(r)?r.buffer:void 0,ellipsoidBatchIds:c(r)?s.buffer:void 0,spheres:c(a)?a.buffer:void 0,sphereBatchIds:c(a)?l.buffer:void 0,batchTableColors:u.buffer,packedBuffer:f.buffer},g=e._verticesPromise=y3e.scheduleTask(p,h);return c(g)?g.then(function(m){if(e.isDestroyed())return;let y=new Float64Array(m.packedBuffer);g3e(e,y)===2?e._indices=new Uint16Array(m.indices):e._indices=new Uint32Array(m.indices),e._indexOffsets=new Uint32Array(m.indexOffsets),e._indexCounts=new Uint32Array(m.indexCounts),e._positions=new Float32Array(m.positions),e._vertexBatchIds=new Uint16Array(m.vertexBatchIds),e._batchIds=new Uint16Array(m.batchIds),T3e(e),e._ready=!0}).catch(m=>{e.isDestroyed()||(e._error=m)}):void 0}}function T3e(e){c(e._primitive)||(e._primitive=new rx({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:e._pickObject??e}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0)}Su.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Su.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Su.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Su.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};Su.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=x3e(this)),c(this._error)){let t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};Su.prototype.isDestroyed=function(){return!1};Su.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),de(this)};var Zp=Su;function xm(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,E3e(this,i,o)}Object.defineProperties(xm.prototype,{featuresLength:{get:function(){return c(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return c(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return c(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function A3e(e){return function(t,n){c(e._geometries)&&e._geometries.updateCommands(t,n)}}function C3e(e,t){let n,i,o,r,s,a=e.BOXES_LENGTH??0,l=e.CYLINDERS_LENGTH??0,u=e.ELLIPSOIDS_LENGTH??0,f=e.SPHERES_LENGTH??0;if(a>0&&c(e.BOX_BATCH_IDS)){let m=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,m,a)}if(l>0&&c(e.CYLINDER_BATCH_IDS)){let m=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,m,l)}if(u>0&&c(e.ELLIPSOID_BATCH_IDS)){let m=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,m,u)}if(f>0&&c(e.SPHERE_BATCH_IDS)){let m=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,m,f)}let h=c(n)||c(i)||c(o)||c(r),p=a>0&&!c(n)||l>0&&!c(i)||u>0&&!c(o)||f>0&&!c(r);if(h&&p)throw new ae("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)&&!c(r)){let m=0;if(!c(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=m++;if(!c(i)&&l>0)for(i=new Uint16Array(l),s=0;s<l;++s)i[s]=m++;if(!c(o)&&u>0)for(o=new Uint16Array(u),s=0;s<u;++s)o[s]=m++;if(!c(r)&&f>0)for(r=new Uint16Array(f),s=0;s<f;++s)r[s]=m++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}var sx=Uint32Array.BYTES_PER_ELEMENT;function E3e(e,t,n){n=n??0;let i=new Uint8Array(t),o=new DataView(t);n+=sx;let r=o.getUint32(n,!0);if(r!==1)throw new ae(`Only Geometry tile version 1 is supported.  Version ${r} is not.`);n+=sx;let s=o.getUint32(n,!0);if(n+=sx,s===0){e._ready=!0;return}let a=o.getUint32(n,!0);if(n+=sx,a===0)throw new ae("Feature table must have a byte length greater than zero");let l=o.getUint32(n,!0);n+=sx;let u=o.getUint32(n,!0);n+=sx;let f=o.getUint32(n,!0);n+=sx;let h=ir(i,n,a);n+=a;let p=new Uint8Array(t,n,l);n+=l;let g,m;u>0&&(g=ir(i,n,u),n+=u,f>0&&(m=new Uint8Array(t,n,f),m=new Uint8Array(m)));let y=h.BOXES_LENGTH??0,b=h.CYLINDERS_LENGTH??0,x=h.ELLIPSOIDS_LENGTH??0,A=h.SPHERES_LENGTH??0,C=y+b+x+A,S=new Kp(e,C,g,m,A3e(e));if(e._batchTable=S,C===0)return;let v=e.tile.computedTransform,P;c(h.RTC_CENTER)&&(P=d.unpack(h.RTC_CENTER),B.multiplyByPoint(v,P,P));let M=C3e(h,p);if(y>0||b>0||x>0||A>0){let R,L,F,_;if(y>0){let w=p.byteOffset+h.BOXES.byteOffset;R=new Float32Array(p.buffer,w,Zp.packedBoxLength*y)}if(b>0){let w=p.byteOffset+h.CYLINDERS.byteOffset;L=new Float32Array(p.buffer,w,Zp.packedCylinderLength*b)}if(x>0){let w=p.byteOffset+h.ELLIPSOIDS.byteOffset;F=new Float32Array(p.buffer,w,Zp.packedEllipsoidLength*x)}if(A>0){let w=p.byteOffset+h.SPHERES.byteOffset;_=new Float32Array(p.buffer,w,Zp.packedSphereLength*A)}return e._geometries=new Zp({boxes:R,boxBatchIds:M.boxes,cylinders:L,cylinderBatchIds:M.cylinders,ellipsoids:F,ellipsoidBatchIds:M.ellipsoids,spheres:_,sphereBatchIds:M.spheres,center:P,modelMatrix:v,batchTable:S,boundingVolume:e.tile.boundingVolume.boundingVolume}),e}return Promise.resolve(e)}function wre(e){let t=e.featuresLength;if(!c(e._features)&&t>0){let n=new Array(t);c(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}xm.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};xm.prototype.getFeature=function(e){let t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return wre(this),this._features[e]};xm.prototype.applyDebugSettings=function(e,t){c(this._geometries)&&this._geometries.applyDebugSettings(e,t)};xm.prototype.applyStyle=function(e){wre(this),c(this._geometries)&&this._geometries.applyStyle(e,this._features)};xm.prototype.update=function(e,t){c(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),c(this._batchTable)&&this._geometries.ready&&(this._batchTable.update(e,t),this._ready=!0)};xm.prototype.pick=function(e,t,n){};xm.prototype.isDestroyed=function(){return!1};xm.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),de(this)};var n1=xm;var c9={};c9.encode2D=function(e,t,n){let i=Math.pow(2,e);if(T.typeOf.number("level",e),T.typeOf.number("x",t),T.typeOf.number("y",n),e<1)throw new E("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new E("Invalid coordinates for given level.");let o={x:t,y:n},r,s,a,l=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,l+=BigInt((3*r^s)*a*a),vre(i,o,r,s);return l};c9.decode2D=function(e,t){if(T.typeOf.number("level",e),T.typeOf.bigint("index",t),e<1)throw new E("Hilbert level cannot be less than 1.");if(t<BigInt(0)||t>=BigInt(Math.pow(4,e)))throw new E("Hilbert index exceeds valid maximum for given level.");let n=Math.pow(2,e),i={x:0,y:0},o,r,s,a;for(s=1,a=t;s<n;s*=2)o=1&Number(a/BigInt(2)),r=1&Number(a^BigInt(o)),vre(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function vre(e,t,n,i){if(i!==0)return;n===1&&(t.x=e-1-t.x,t.y=e-1-t.y);let o=t.x;t.x=t.y,t.y=o}var LC=c9;var fy=30,S3e=1<<fy,w3e=1<<fy+1>>>0,l9=2*fy+1,cy=4,Ire=[],Ore=[],v3e=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],ly=1,NC=2,KV=[ly,0,0,ly|NC];function hr(e){if(!Vt.supportsBigInt())throw new ae("S2 required BigInt support");if(!c(e))throw new E("cell ID is required.");if(!hr.isValidId(e))throw new E("cell ID is invalid.");this._cellId=e,this._level=hr.getLevel(e)}hr.fromToken=function(e){if(T.typeOf.string("token",e),!hr.isValidToken(e))throw new E("token is invalid.");return new hr(hr.getIdFromToken(e))};hr.isValidId=function(e){return T.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(l9)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};hr.isValidToken=function(e){return T.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?hr.isValidId(hr.getIdFromToken(e)):!1};hr.getIdFromToken=function(e){return T.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};hr.getTokenFromId=function(e){T.typeOf.bigint("cellId",e);let t=Math.floor(B3e(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};hr.getLevel=function(e){if(T.typeOf.bigint("cellId",e),!hr.isValidId(e))throw new E;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return fy-(t>>1)};hr.prototype.getChild=function(e){if(T.typeOf.number("index",e),e<0||e>3)throw new E("child index must be in the range [0-3].");if(this._level===30)throw new E("cannot get child of leaf cell.");let t=Lre(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new hr(n)};hr.prototype.getParent=function(){if(this._level===0)throw new E("cannot get parent of root cell.");let e=Lre(this._cellId)<<BigInt(2);return new hr(this._cellId&~e+BigInt(1)|e)};hr.prototype.getParentAtLevel=function(e){if(this._level===0||e<0||this._level<e)throw new E("cannot get parent at invalid level.");let t=N3e(e);return new hr(this._cellId&-t|t)};hr.prototype.getCenter=function(e){e=e??ie.WGS84;let t=D3e(this._cellId,this._level);t=d.normalize(t,t);let n=new he.fromCartesian(t,ie.UNIT_SPHERE);return he.toCartesian(n,e,new d)};hr.prototype.getVertex=function(e,t){if(T.typeOf.number("index",e),e<0||e>3)throw new E("vertex index must be in the range [0-3].");t=t??ie.WGS84;let n=P3e(this._cellId,this._level,e);n=d.normalize(n,n);let i=new he.fromCartesian(n,ie.UNIT_SPHERE);return he.toCartesian(i,t,new d)};hr.fromFacePositionLevel=function(e,t,n){if(T.typeOf.bigint("position",t),e<0||e>5)throw new E("Invalid S2 Face (must be within 0-5)");if(n<0||n>fy)throw new E("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new E("Invalid Hilbert position for level");let i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),o=t.toString(2),r=Array(2*n-o.length+1).join("0"),s=Array(l9-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new hr(a)};function D3e(e,t){let n=I3e(e,t);return O3e(n[0],n[1],n[2])}function P3e(e,t,n){let i=Rre(e,t),o=R3e([i[1],i[2]],t),r=n>>1&1;return Mre(i[0],o[0][r^n&1],o[1][r])}function I3e(e,t){let n=Rre(e),i=n[0],o=n[1],r=n[2],s=t===30,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),l=s?1:a?2:0,u=(o<<1)+l,f=(r<<1)+l;return[i,u,f]}function Rre(e){Ire.length===0&&L3e();let t=Number(e>>BigInt(l9)),n=t&ly,i=(1<<cy)-1,o=0,r=0;for(let s=7;s>=0;s--){let l=(1<<2*(s===7?fy-7*cy:cy))-1;n+=Number(e>>BigInt(s*2*cy+1)&BigInt(l))<<2,n=Ore[n];let u=s*cy;o+=n>>cy+2<<u,r+=(n>>2&i)<<u,n&=ly|NC}return[t,o,r]}function O3e(e,t,n){let i=Dre(t),o=Dre(n),r=$V(i),s=$V(o);return Mre(e,r,s)}function Mre(e,t,n){switch(e){case 0:return new d(1,t,n);case 1:return new d(-t,1,n);case 2:return new d(-t,-n,1);case 3:return new d(-1,-n,-t);case 4:return new d(n,-1,-t);default:return new d(n,t,-1)}}function $V(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Dre(e){return 1/w3e*e}function R3e(e,t){let n=[[],[]],i=M3e(t);for(let o=0;o<2;++o){let r=e[o]&-i,s=r+i;n[o][0]=$V(Pre(r)),n[o][1]=$V(Pre(s))}return n}function M3e(e){return 1<<fy-e>>>0}function Pre(e){return 1/S3e*e}function uy(e,t,n,i,o,r){if(e===cy){let s=(t<<cy)+n;Ire[(s<<2)+i]=(o<<2)+r,Ore[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;let s=v3e[r];uy(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^KV[0]),uy(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^KV[1]),uy(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^KV[2]),uy(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^KV[3])}}function L3e(){uy(0,0,0,0,0,0),uy(0,0,0,ly,0,ly),uy(0,0,0,NC,0,NC),uy(0,0,0,ly|NC,0,ly|NC)}function Lre(e){return e&~e+BigInt(1)}function N3e(e){return BigInt(1)<<BigInt(2*(fy-e))}var F3e=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function B3e(e){return F3e[(-e&e)%BigInt(67)]}var Qp=hr;function k3e(e,t){return c(e)&&c(e.extensions)&&c(e.extensions[t])}var oi=k3e;function u9(e){let t=e.lengthBits,n=e.availableCount;T.typeOf.number("options.lengthBits",t);let i=e.constant,o=e.bitstream;if(c(i))n=t;else{let r=Math.ceil(t/8);if(o.length!==r)throw new ae(`Availability bitstream must be exactly ${r} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);let s=e.computeAvailableCountEnabled??!1;!c(n)&&s&&(n=U3e(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function U3e(e,t){let n=0;for(let i=0;i<t;i++){let o=i>>3,r=i%8;n+=e[o]>>r&1}return n}Object.defineProperties(u9.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});u9.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new E("Bit index out of bounds.");if(c(this._constant))return this._constant;let t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};var FC=u9;function Jp(e){e=e??W.EMPTY_OBJECT;let t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;T.typeOf.object("options.metadataTable",t),T.typeOf.object("options.class",n),T.typeOf.number("options.entityId",i),T.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(Jp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Jp.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};Jp.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};Jp.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};Jp.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};Jp.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};Jp.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};Jp.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};var BC=Jp;var ZV={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};ZV.getBranchingFactor=function(e){switch(e){case ZV.OCTREE:return 8;case ZV.QUADTREE:return 4;default:throw new E("subdivisionScheme is not a valid value.")}};var or=Object.freeze(ZV);function ma(){}Object.defineProperties(ma.prototype,{class:{get:function(){E.throwInstantiationError()}}});ma.prototype.hasProperty=function(e){E.throwInstantiationError()};ma.prototype.hasPropertyBySemantic=function(e){E.throwInstantiationError()};ma.prototype.getPropertyIds=function(e){E.throwInstantiationError()};ma.prototype.getProperty=function(e){E.throwInstantiationError()};ma.prototype.setProperty=function(e,t){E.throwInstantiationError()};ma.prototype.getPropertyBySemantic=function(e){E.throwInstantiationError()};ma.prototype.setPropertyBySemantic=function(e,t){E.throwInstantiationError()};ma.hasProperty=function(e,t,n){if(T.typeOf.string("propertyId",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n),c(t[e]))return!0;let i=n.properties;if(!c(i))return!1;let o=i[e];return!!(c(o)&&c(o.default))};ma.hasPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n);let i=n.propertiesBySemantic;if(!c(i))return!1;let o=i[e];return c(o)};ma.getPropertyIds=function(e,t,n){T.typeOf.object("properties",e),T.typeOf.object("classDefinition",t),n=c(n)?n:[],n.length=0;for(let o in e)e.hasOwnProperty(o)&&c(e[o])&&n.push(o);let i=t.properties;if(c(i))for(let o in i)i.hasOwnProperty(o)&&!c(e[o])&&c(i[o].default)&&n.push(o);return n};ma.getProperty=function(e,t,n){if(T.typeOf.string("propertyId",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n),!c(n.properties[e]))throw new E(`Class definition missing property ${e}`);let i=n.properties[e],o=t[e];Array.isArray(o)&&(o=o.slice());let r=!0;if(o=i.handleNoData(o),!c(o)&&c(i.default))return o=je(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(c(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};ma.setProperty=function(e,t,n,i){if(T.typeOf.string("propertyId",e),T.defined("value",t),T.typeOf.object("properties",n),T.typeOf.object("classDefinition",i),!c(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o,r=i.properties;return c(r)&&(o=r[e]),c(o)&&(t=o.packVectorAndMatrixTypes(t,!0),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};ma.getPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n);let i=n.propertiesBySemantic;if(!c(i))return;let o=i[e];if(c(o))return ma.getProperty(o.id,t,n)};ma.setPropertyBySemantic=function(e,t,n,i){T.typeOf.string("semantic",e),T.defined("value",t),T.typeOf.object("properties",n),T.typeOf.object("classDefinition",i);let o=i.propertiesBySemantic;if(!c(o))return!1;let r=i.propertiesBySemantic[e];return c(r)?ma.setProperty(r.id,t,n,i):!1};var Bn=ma;function e_(e){e=e??W.EMPTY_OBJECT;let t=e.subtreeMetadata,n=e.class;T.typeOf.object("options.subtreeMetadata",t),T.typeOf.object("options.class",n);let i=c(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(e_.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});e_.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};e_.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};e_.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};e_.prototype.getProperty=function(e){return Bn.getProperty(e,this._properties,this._class)};e_.prototype.setProperty=function(e,t){return Bn.setProperty(e,t,this._properties,this._class)};e_.prototype.getPropertyBySemantic=function(e){return Bn.getPropertyBySemantic(e,this._properties,this._class)};e_.prototype.setPropertyBySemantic=function(e,t){return Bn.setPropertyBySemantic(e,t,this._properties,this._class)};var i1=e_;var Lt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};Lt.getMinimum=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:return-128;case Lt.UINT8:return 0;case Lt.INT16:return-32768;case Lt.UINT16:return 0;case Lt.INT32:return-2147483648;case Lt.UINT32:return 0;case Lt.INT64:return Vt.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case Lt.UINT64:return Vt.supportsBigInt()?BigInt(0):0;case Lt.FLOAT32:return-34028234663852886e22;case Lt.FLOAT64:return-Number.MAX_VALUE}};Lt.getMaximum=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:return 127;case Lt.UINT8:return 255;case Lt.INT16:return 32767;case Lt.UINT16:return 65535;case Lt.INT32:return 2147483647;case Lt.UINT32:return 4294967295;case Lt.INT64:return Vt.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case Lt.UINT64:return Vt.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case Lt.FLOAT32:return 34028234663852886e22;case Lt.FLOAT64:return Number.MAX_VALUE}};Lt.isIntegerType=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:case Lt.UINT8:case Lt.INT16:case Lt.UINT16:case Lt.INT32:case Lt.UINT32:case Lt.INT64:case Lt.UINT64:return!0;default:return!1}};Lt.isUnsignedIntegerType=function(e){switch(T.typeOf.string("type",e),e){case Lt.UINT8:case Lt.UINT16:case Lt.UINT32:case Lt.UINT64:return!0;default:return!1}};Lt.isVectorCompatible=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:case Lt.UINT8:case Lt.INT16:case Lt.UINT16:case Lt.INT32:case Lt.UINT32:case Lt.FLOAT32:case Lt.FLOAT64:return!0;default:return!1}};Lt.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new E("value must be a number or a BigInt");if(!Lt.isIntegerType(t))throw new E("type must be an integer type");return Math.max(Number(e)/Number(Lt.getMaximum(t)),-1)};Lt.unnormalize=function(e,t){if(T.typeOf.number("value",e),!Lt.isIntegerType(t))throw new E("type must be an integer type");let n=Lt.getMaximum(t),i=Lt.isUnsignedIntegerType(t)?0:-n;return e=O.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===Lt.INT64||t===Lt.UINT64)&&Vt.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};Lt.applyValueTransform=function(e,t,n){return n*e+t};Lt.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};Lt.getSizeInBytes=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:case Lt.UINT8:return 1;case Lt.INT16:case Lt.UINT16:return 2;case Lt.INT32:case Lt.UINT32:return 4;case Lt.INT64:case Lt.UINT64:return 8;case Lt.FLOAT32:return 4;case Lt.FLOAT64:return 8}};Lt.fromComponentDatatype=function(e){switch(T.typeOf.number("componentDatatype",e),e){case $.BYTE:return Lt.INT8;case $.UNSIGNED_BYTE:return Lt.UINT8;case $.SHORT:return Lt.INT16;case $.UNSIGNED_SHORT:return Lt.UINT16;case $.INT:return Lt.INT32;case $.UNSIGNED_INT:return Lt.UINT32;case $.FLOAT:return Lt.FLOAT32;case $.DOUBLE:return Lt.FLOAT64}};Lt.toComponentDatatype=function(e){switch(T.typeOf.string("type",e),e){case Lt.INT8:return $.BYTE;case Lt.UINT8:return $.UNSIGNED_BYTE;case Lt.INT16:return $.SHORT;case Lt.UINT16:return $.UNSIGNED_SHORT;case Lt.INT32:return $.INT;case Lt.UINT32:return $.UNSIGNED_INT;case Lt.FLOAT32:return $.FLOAT;case Lt.FLOAT64:return $.DOUBLE}};var Nt=Object.freeze(Lt);var Wo={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};Wo.isVectorType=function(e){switch(T.typeOf.string("type",e),e){case Wo.VEC2:case Wo.VEC3:case Wo.VEC4:return!0;default:return!1}};Wo.isMatrixType=function(e){switch(T.typeOf.string("type",e),e){case Wo.MAT2:case Wo.MAT3:case Wo.MAT4:return!0;default:return!1}};Wo.getComponentCount=function(e){switch(T.typeOf.string("type",e),e){case Wo.SCALAR:case Wo.STRING:case Wo.ENUM:case Wo.BOOLEAN:return 1;case Wo.VEC2:return 2;case Wo.VEC3:return 3;case Wo.VEC4:return 4;case Wo.MAT2:return 4;case Wo.MAT3:return 9;case Wo.MAT4:return 16;default:throw new E(`Invalid metadata type ${e}`)}};Wo.getMathType=function(e){switch(e){case Wo.VEC2:return H;case Wo.VEC3:return d;case Wo.VEC4:return se;case Wo.MAT2:return Ri;case Wo.MAT3:return J;case Wo.MAT4:return B;default:return}};var at=Object.freeze(Wo);function Ua(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.type;T.typeOf.string("options.id",t),T.typeOf.string("options.type",n);let i=e.componentType,o=e.enumType,r=c(i)&&Nt.isIntegerType(i)&&(e.normalized??!1);this._id=t,this._name=e.name,this._description=e.description,this._semantic=e.semantic,this._isLegacyExtension=e.isLegacyExtension,this._type=n,this._componentType=i,this._enumType=o,this._valueType=c(o)?o.valueType:i,this._isArray=e.isArray??!1,this._isVariableLengthArray=e.isVariableLengthArray??!1,this._arrayLength=e.arrayLength,this._min=je(e.min,!0),this._max=je(e.max,!0),this._normalized=r;let s=je(e.offset,!0),a=je(e.scale,!0),l=c(s)||c(a),u=!0;c(s)||(s=this.expandConstant(0,u)),c(a)||(a=this.expandConstant(1,u)),this._offset=s,this._scale=a,this._hasValueTransform=l,this._noData=je(e.noData,!0),this._default=je(e.default,!0),this._required=e.required??!0,this._extras=je(e.extras,!0),this._extensions=je(e.extensions,!0)}Ua.fromJson=function(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.property;T.typeOf.string("options.id",t),T.typeOf.object("options.property",n),T.typeOf.string("options.property.type",n.type);let i=V3e(n),o=z3e(n,e.enums),r;return c(i)?i?r=c(n.optional)?!n.optional:!0:r=n.required??!1:r=!1,new Ua({id:t,type:o.type,componentType:o.componentType,enumType:o.enumType,isArray:o.isArray,isVariableLengthArray:o.isVariableLengthArray,arrayLength:o.arrayLength,normalized:n.normalized,min:n.min,max:n.max,offset:n.offset,scale:n.scale,noData:n.noData,default:n.default,required:r,name:n.name,description:n.description,semantic:n.semantic,extras:n.extras,extensions:n.extensions,isLegacyExtension:i})};Object.defineProperties(Ua.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},isArray:{get:function(){return this._isArray}},isVariableLengthArray:{get:function(){return this._isVariableLengthArray}},arrayLength:{get:function(){return this._arrayLength}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},noData:{get:function(){return this._noData}},default:{get:function(){return this._default}},required:{get:function(){return this._required}},semantic:{get:function(){return this._semantic}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function V3e(e){if(e.type==="ARRAY")return!0;let t=e.type;if(t===at.SCALAR||at.isMatrixType(t)||at.isVectorType(t))return!1;if(c(Nt[t]))return!0;if(c(e.noData)||c(e.scale)||c(e.offset)||c(e.required)||c(e.count)||c(e.array)||c(e.optional))return!1}function z3e(e,t){let n=e.type,i=e.componentType,o=n==="ARRAY",r,s,a;o?(r=!0,s=e.componentCount,a=!c(s)):e.array?(r=!0,s=e.count,a=!c(e.count)):(r=!1,s=void 0,a=!1);let l;if(c(e.enumType)&&(l=t[e.enumType]),n===at.ENUM)return{type:n,componentType:void 0,enumType:l,valueType:l.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===at.ENUM)return{type:i,componentType:void 0,enumType:l,valueType:l.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===at.SCALAR||at.isMatrixType(n)||at.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===at.BOOLEAN||n===at.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===at.BOOLEAN||i===at.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(c(i)&&c(Nt[i]))return{type:at.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(c(Nt[n]))return{type:at.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new E(`unknown metadata type {type: ${n}, componentType: ${i})`)}Ua.prototype.normalize=function(e){return this._normalized?f9(e,this._valueType,Nt.normalize):e};Ua.prototype.unnormalize=function(e){return this._normalized?f9(e,this._valueType,Nt.unnormalize):e};Ua.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Ua.valueTransformInPlace(e,this._offset,this._scale,Nt.applyValueTransform)};Ua.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Ua.valueTransformInPlace(e,this._offset,this._scale,Nt.unapplyValueTransform)};Ua.prototype.expandConstant=function(e,t){t=t??!1;let n=this._isArray,i=this._arrayLength,o=at.getComponentCount(this._type),r=n&&o>1;if(!n&&o===1)return e;if(!n)return new Array(o).fill(e);if(!r)return new Array(i).fill(e);if(!t)return new Array(this._arrayLength*o).fill(e);let s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)};Ua.prototype.handleNoData=function(e){let t=this._noData;if(!c(t))return e;if(!kre(e,t))return e};function kre(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!kre(e[n],t[n]))return!1;return!0}Ua.prototype.unpackVectorAndMatrixTypes=function(e,t){t=t??!1;let n=at.getMathType(this._type),i=this._isArray,o=at.getComponentCount(this._type),r=i&&o>1;return c(n)?t&&r?e.map(function(s){return n.unpack(s)}):i?n.unpackArray(e):n.unpack(e):e};Ua.prototype.packVectorAndMatrixTypes=function(e,t){t=t??!1;let n=at.getMathType(this._type),i=this._isArray,o=at.getComponentCount(this._type),r=i&&o>1;return c(n)?t&&r?e.map(function(s){return n.pack(s,[])}):i?n.packArray(e,[]):n.pack(e,[]):e};Ua.prototype.validate=function(e){if(!(!c(e)&&c(this._default)))return this._required&&!c(e)?"required property must have a value":this._isArray?H3e(this,e):Ure(this,e)};function H3e(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;let n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;i<n;i++){let o=Ure(e,t[i]);if(c(o))return o}}function Ure(e,t){let n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return at.isVectorType(n)?G3e(t,n,i):at.isMatrixType(n)?j3e(t,n,i):n===at.STRING?W3e(t):n===at.BOOLEAN?q3e(t):n===at.ENUM?Y3e(t,o):X3e(t,i,r)}function G3e(e,t,n){if(!Nt.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===at.VEC2&&!(e instanceof H))return`vector value ${e} must be a Cartesian2`;if(t===at.VEC3&&!(e instanceof d))return`vector value ${e} must be a Cartesian3`;if(t===at.VEC4&&!(e instanceof se))return`vector value ${e} must be a Cartesian4`}function j3e(e,t,n){if(!Nt.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===at.MAT2&&!(e instanceof Ri))return`matrix value ${e} must be a Matrix2`;if(t===at.MAT3&&!(e instanceof J))return`matrix value ${e} must be a Matrix3`;if(t===at.MAT4&&!(e instanceof B))return`matrix value ${e} must be a Matrix4`}function W3e(e){if(typeof e!="string")return QV(e,at.STRING)}function q3e(e){if(typeof e!="boolean")return QV(e,at.BOOLEAN)}function Y3e(e,t){let n=typeof e;if(c(t))return n!=="string"||!c(t.valuesByName[e])?`value ${e} is not a valid enum name for ${t.id}`:void 0}function X3e(e,t,n){let i=typeof e;switch(t){case Nt.INT8:case Nt.UINT8:case Nt.INT16:case Nt.UINT16:case Nt.INT32:case Nt.UINT32:case Nt.FLOAT32:case Nt.FLOAT64:return i!=="number"?QV(e,t):isFinite(e)?Fre(e,t,n):Bre(e,t);case Nt.INT64:case Nt.UINT64:return i!=="number"&&i!=="bigint"?QV(e,t):i==="number"&&!isFinite(e)?Bre(e,t):Fre(e,t,n)}}function QV(e,t){return`value ${e} does not match type ${t}`}function Nre(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function Fre(e,t,n){if(n){let i=Nt.isUnsignedIntegerType(t)?0:-1;return e<i||e>1?Nre(e,t,n):void 0}if(e<Nt.getMinimum(t)||e>Nt.getMaximum(t))return Nre(e,t,n)}function Bre(e,t){return`value ${e} of type ${t} must be finite`}function f9(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=f9(e[i],t,n);return e}Ua.valueTransformInPlace=function(e,t,n,i){if(!Array.isArray(e))return i(e,t,n);for(let o=0;o<e.length;o++)e[o]=Ua.valueTransformInPlace(e[o],t[o],n[o],i);return e};var Tm=Ua;function o1(e){e=e??W.EMPTY_OBJECT;let t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews;T.typeOf.number.greaterThan("options.count",t,0),T.typeOf.object("options.property",n),T.typeOf.object("options.classProperty",i),T.typeOf.object("options.bufferViews",o);let r=i.type,s=i.isArray,a=i.isVariableLengthArray,l=i.valueType,u=i.enumType,f=r===at.STRING,h=r===at.BOOLEAN,p=0,g;if(a){let _=n.arrayOffsetType??n.offsetType;_=Nt[_]??Nt.UINT32;let w=n.arrayOffsets??n.arrayOffsetBufferView;g=new d9(o[w],_,t+1),p+=g.typedArray.byteLength}let m=at.getComponentCount(r),y;a?y=g.get(t)-g.get(0):s?y=t*i.arrayLength:y=t;let b=m*y,x;if(f){let _=n.stringOffsetType??n.offsetType;_=Nt[_]??Nt.UINT32;let w=n.stringOffsets??n.stringOffsetBufferView;x=new d9(o[w],_,b+1),p+=x.typedArray.byteLength}(f||h)&&(l=Nt.UINT8);let A;f?A=x.get(b)-x.get(0):h?A=Math.ceil(b/8):A=b;let C=n.values??n.bufferView,S=new d9(o[C],l,A);p+=S.typedArray.byteLength;let v=n.offset,P=n.scale,M=i.hasValueTransform||c(v)||c(P);v=v??i.offset,P=P??i.scale,v=Vre(v),P=Vre(P);let R,L,F=this;f?R=function(_){return Z3e(_,F._values,F._stringOffsets)}:h?(R=function(_){return Q3e(_,F._values)},L=function(_,w){J3e(_,F._values,w)}):c(u)?(R=function(_){let w=F._values.get(_);return u.namesByValue[w]},L=function(_,w){let D=u.valuesByName[w];F._values.set(_,D)}):(R=function(_){return F._values.get(_)},L=function(_,w){F._values.set(_,w)}),this._arrayOffsets=g,this._stringOffsets=x,this._values=S,this._classProperty=i,this._count=t,this._vectorComponentCount=m,this._min=n.min,this._max=n.max,this._offset=v,this._scale=P,this._hasValueTransform=M,this._getValue=R,this._setValue=L,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=p}Object.defineProperties(o1.prototype,{hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){return this._byteLength}}});o1.prototype.get=function(e){zre(this,e);let t=K3e(this,e);return t=this._classProperty.handleNoData(t),c(t)?(t=this._classProperty.normalize(t),t=ake(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};o1.prototype.set=function(e,t){let n=this._classProperty;T.defined("value",t),zre(this,e);let i=n.validate(t);if(c(i))throw new E(i);t=n.packVectorAndMatrixTypes(t),t=cke(this,t),t=n.unnormalize(t),$3e(this,e,t)};o1.prototype.getTypedArray=function(){if(c(this._values))return this._values.typedArray};function Vre(e){if(!Array.isArray(e))return e;let t=[];for(let n=0;n<e.length;n++){let i=e[n];Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}function zre(e,t){let n=e._count;if(!c(t)||t<0||t>=n){let i=n-1;throw new E(`index is required and between zero and count - 1. Actual value: ${i}`)}}function K3e(e,t){Gre(e)&&jre(e);let n=e._classProperty,i=n.isArray,o=n.type,r=at.getComponentCount(o);if(c(e._unpackedValues)){let s=e._unpackedValues[t];return i?je(s,!0):s}return!i&&r===1?e._getValue(t):Hre(e,n,t)}function Hre(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;let s=at.getComponentCount(t.type);i*=s,o*=s}else{let a=(t.arrayLength??1)*e._vectorComponentCount;i=n*a,o=a}let r=new Array(o);for(let s=0;s<o;s++)r[s]=e._getValue(i+s);return r}function $3e(e,t,n){rke(e,t,n)&&jre(e);let i=e._classProperty,o=i.isArray,r=i.type,s=at.getComponentCount(r);if(c(e._unpackedValues)){i.isArray&&(n=je(n,!0)),e._unpackedValues[t]=n;return}if(!o&&s===1){e._setValue(t,n);return}let a,l;if(i.isVariableLengthArray)a=e._arrayOffsets.get(t),l=e._arrayOffsets.get(t+1)-a;else{let f=(i.arrayLength??1)*e._vectorComponentCount;a=t*f,l=f}for(let u=0;u<l;++u)e._setValue(a+u,n[u])}function Z3e(e,t,n){let i=n.get(e),o=n.get(e+1)-i;return Fl(t.typedArray,i,o)}function Q3e(e,t){let n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function J3e(e,t,n){let i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function eke(e,t){let n=t.dataView,i=e*8,o=0,r=(n.getUint8(i+7)&128)>0,s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=l*Math.pow(256,a)}return r&&(o=-o),o}function tke(e,t){let n=t.dataView,i=e*8,o=BigInt(0),r=(n.getUint8(i+7)&128)>0,s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=BigInt(l)*(BigInt(1)<<BigInt(a*8))}return r&&(o=-o),o}function nke(e,t){let n=t.dataView,i=e*8,o=n.getUint32(i,!0),r=n.getUint32(i+4,!0);return o+4294967296*r}function ike(e,t){let n=t.dataView,i=e*8,o=BigInt(n.getUint32(i,!0)),r=BigInt(n.getUint32(i+4,!0));return o+BigInt(4294967296)*r}function oke(e){switch(e){case Nt.INT8:return $.BYTE;case Nt.UINT8:return $.UNSIGNED_BYTE;case Nt.INT16:return $.SHORT;case Nt.UINT16:return $.UNSIGNED_SHORT;case Nt.INT32:return $.INT;case Nt.UINT32:return $.UNSIGNED_INT;case Nt.FLOAT32:return $.FLOAT;case Nt.FLOAT64:return $.DOUBLE}}function Gre(e){if(c(e._unpackedValues))return!1;let t=e._classProperty,n=t.type,i=t.valueType;return n===at.STRING||i===Nt.INT64&&!Vt.supportsBigInt64Array()||i===Nt.UINT64&&!Vt.supportsBigUint64Array()}function rke(e,t,n){if(Gre(e))return!0;let i=e._arrayOffsets;if(c(i)){let o=i.get(t+1)-i.get(t),r=n.length;if(o!==r)return!0}return!1}function jre(e){e._unpackedValues=ske(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function ske(e){let t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=at.getComponentCount(r);if(!o&&s===1){for(let a=0;a<t;++a)n[a]=e._getValue(a);return n}for(let a=0;a<t;a++)n[a]=Hre(e,i,a);return n}function ake(e,t){let i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Tm.valueTransformInPlace(t,e._offset,e._scale,Nt.applyValueTransform)}function cke(e,t){let i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Tm.valueTransformInPlace(t,e._offset,e._scale,Nt.unapplyValueTransform)}function d9(e,t,n){let i=this,o,r,s;if(t===Nt.INT64)Vt.supportsBigInt()?Vt.supportsBigInt64Array()?(o=new BigInt64Array(e.buffer,e.byteOffset,n),s=function(a,l){i.typedArray[a]=BigInt(l)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return tke(a,i)}):(dt("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return eke(a,i)});else if(t===Nt.UINT64)Vt.supportsBigInt()?Vt.supportsBigUint64Array()?(o=new BigUint64Array(e.buffer,e.byteOffset,n),s=function(a,l){i.typedArray[a]=BigInt(l)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return ike(a,i)}):(dt("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return nke(a,i)});else{let a=oke(t);o=$.createArrayBufferView(a,e.buffer,e.byteOffset,n),s=function(l,u){i.typedArray[l]=u}}c(r)||(r=function(a){return i.typedArray[a]}),this.typedArray=o,this.dataView=new DataView(o.buffer,o.byteOffset),this.get=r,this.set=s,this._componentType=t}var r1=o1;function Zd(e){e=e??W.EMPTY_OBJECT;let t=e.count,n=e.class;T.typeOf.number.greaterThan("options.count",t,0),T.typeOf.object("options.class",n);let i=0,o={};if(c(e.properties)){for(let r in e.properties)if(e.properties.hasOwnProperty(r)){let s=new r1({count:t,property:e.properties[r],classProperty:n.properties[r],bufferViews:e.bufferViews});o[r]=s,i+=s.byteLength}}this._count=t,this._class=n,this._properties=o,this._byteLength=i}Object.defineProperties(Zd.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});Zd.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};Zd.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};Zd.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};Zd.prototype.getProperty=function(e,t){T.typeOf.string("propertyId",t);let n=this._properties[t],i;return c(n)?i=n.get(e):i=lke(this._class,t),i};Zd.prototype.setProperty=function(e,t,n){T.typeOf.string("propertyId",t);let i=this._properties[t];return c(i)?(i.set(e,n),!0):!1};Zd.prototype.getPropertyBySemantic=function(e,t){T.typeOf.string("semantic",t);let n,i=this._class.propertiesBySemantic;if(c(i)&&(n=i[t]),c(n))return this.getProperty(e,n.id)};Zd.prototype.setPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",t);let i,o=this._class.propertiesBySemantic;return c(o)&&(i=o[t]),c(i)?this.setProperty(e,i.id,n):!1};Zd.prototype.getPropertyTypedArray=function(e){T.typeOf.string("propertyId",e);let t=this._properties[e];if(c(t))return t.getTypedArray()};Zd.prototype.getPropertyTypedArrayBySemantic=function(e){T.typeOf.string("semantic",e);let t,n=this._class.propertiesBySemantic;if(c(n)&&(t=n[e]),c(t))return this.getPropertyTypedArray(t.id)};function lke(e,t){let n=e.properties;if(!c(n))return;let i=n[t];if(c(i)&&c(i.default)){let o=i.default;return i.isArray&&(o=je(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}var Nf=Zd;function dy(){}Object.defineProperties(dy.prototype,{cacheKey:{get:function(){E.throwInstantiationError()}}});dy.prototype.load=function(){E.throwInstantiationError()};dy.prototype.unload=function(){};dy.prototype.process=function(e){return!1};dy.prototype.getError=function(e,t){T.typeOf.string("errorMessage",e),c(t)&&c(t.message)&&(e+=`
${t.message}`);let n=new ae(e);return c(t)&&(n.stack=`Original stack:
${t.stack}
Handler stack:
${n.stack}`),n};dy.prototype.isDestroyed=function(){return!1};dy.prototype.destroy=function(){return this.unload(),de(this)};var $i=dy;var uke={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,READY:4,FAILED:5},gt=Object.freeze(uke);function t_(e){e=e??W.EMPTY_OBJECT;let t=e.typedArray,n=e.resource,i=e.cacheKey;if(c(t)===c(n))throw new E("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(t_.prototype=Object.create($i.prototype),t_.prototype.constructor=t_);Object.defineProperties(t_.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});t_.prototype.load=async function(){return c(this._promise)?this._promise:c(this._typedArray)?(this._promise=Promise.resolve(this),this._promise):(this._promise=fke(this),this._promise)};async function fke(e){let t=e._resource;e._state=gt.LOADING;try{let n=await t_._fetchArrayBuffer(t);return e.isDestroyed()?void 0:(e._typedArray=new Uint8Array(n),e._state=gt.READY,e)}catch(n){if(e.isDestroyed())return;e._state=gt.FAILED;let i=`Failed to load external buffer: ${t.url}`;throw e.getError(i,n)}}t_._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};t_.prototype.unload=function(){this._typedArray=void 0};var ax=t_;var Zre=Zo($re(),1);function cx(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.bufferViewId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r);let a=n.bufferViews[i],l=a.buffer,u=a.byteOffset,f=a.byteLength,h=!1,p,g,m,y;if(oi(a,"EXT_meshopt_compression")){let x=a.extensions.EXT_meshopt_compression;l=x.buffer,u=x.byteOffset??0,f=x.byteLength,h=!0,p=x.byteStride,g=x.count,m=x.mode,y=x.filter??"NONE"}let b=n.buffers[l];this._hasMeshopt=h,this._meshoptByteStride=p,this._meshoptCount=g,this._meshoptMode=m,this._meshoptFilter=y,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=b,this._bufferId=l,this._byteOffset=u,this._byteLength=f,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(cx.prototype=Object.create($i.prototype),cx.prototype.constructor=cx);Object.defineProperties(cx.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});async function _ke(e){try{let t=gke(e);if(e._bufferLoader=t,await t.load(),e.isDestroyed())return;let n=t.typedArray,i=new Uint8Array(n.buffer,n.byteOffset+e._byteOffset,e._byteLength);if(e.unload(),e._typedArray=i,e._hasMeshopt){let o=e._meshoptCount,r=e._meshoptByteStride,s=new Uint8Array(o*r);Zre.MeshoptDecoder.decodeGltfBuffer(s,o,r,e._typedArray,e._meshoptMode,e._meshoptFilter),e._typedArray=s}return e._state=gt.READY,e}catch(t){if(e.isDestroyed())return;throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load buffer view",t)}}cx.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,this._promise=_ke(this),this._promise)};function gke(e){let t=e._resourceCache,n=e._buffer;if(c(n.uri)){let o=e._baseResource.getDerivedResource({url:n.uri});return t.getExternalBufferLoader({resource:o})}return t.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:e._bufferId})}cx.prototype.unload=function(){c(this._bufferLoader)&&!this._bufferLoader.isDestroyed()&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};var kC=cx;function zr(){}zr._maxDecodingConcurrency=Math.max(Vt.hardwareConcurrency-1,1);zr._decoderTaskProcessor=void 0;zr._taskProcessorReady=!1;zr._error=void 0;zr._getDecoderTaskProcessor=function(){if(!c(zr._decoderTaskProcessor)){let e=new yi("decodeDraco",zr._maxDecodingConcurrency);e.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(t){t?zr._taskProcessorReady=!0:zr._error=new ae("Draco decoder could not be initialized.")}).catch(t=>{zr._error=t}),zr._decoderTaskProcessor=e}return zr._decoderTaskProcessor};zr.decodePointCloud=function(e){let t=zr._getDecoderTaskProcessor();if(c(zr._error))throw zr._error;if(zr._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};zr.decodeBufferView=function(e){let t=zr._getDecoderTaskProcessor();if(c(zr._error))throw zr._error;if(zr._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};var n_=zr;var ri={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function yke(e){switch(e){case ri.POSITION:return"positionMC";case ri.NORMAL:return"normalMC";case ri.TANGENT:return"tangentMC";case ri.TEXCOORD:return"texCoord";case ri.COLOR:return"color";case ri.JOINTS:return"joints";case ri.WEIGHTS:return"weights";case ri.FEATURE_ID:return"featureId";default:throw new E("semantic is not a valid value.")}}ri.hasSetIndex=function(e){switch(T.typeOf.string("semantic",e),e){case ri.POSITION:case ri.NORMAL:case ri.TANGENT:return!1;case ri.TEXCOORD:case ri.COLOR:case ri.JOINTS:case ri.WEIGHTS:case ri.FEATURE_ID:return!0;default:throw new E("semantic is not a valid value.")}};ri.fromGltfSemantic=function(e){T.typeOf.string("gltfSemantic",e);let t=e,i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return ri.POSITION;case"NORMAL":return ri.NORMAL;case"TANGENT":return ri.TANGENT;case"TEXCOORD":return ri.TEXCOORD;case"COLOR":return ri.COLOR;case"JOINTS":return ri.JOINTS;case"WEIGHTS":return ri.WEIGHTS;case"_FEATURE_ID":return ri.FEATURE_ID}};ri.fromPntsSemantic=function(e){switch(T.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return ri.POSITION;case"RGBA":case"RGB":case"RGB565":return ri.COLOR;case"NORMAL":case"NORMAL_OCT16P":return ri.NORMAL;case"BATCH_ID":return ri.FEATURE_ID;default:throw new E("pntsSemantic is not a valid value.")}};ri.getGlslType=function(e){switch(T.typeOf.string("semantic",e),e){case ri.POSITION:case ri.NORMAL:case ri.TANGENT:return"vec3";case ri.TEXCOORD:return"vec2";case ri.COLOR:return"vec4";case ri.JOINTS:return"ivec4";case ri.WEIGHTS:return"vec4";case ri.FEATURE_ID:return"int";default:throw new E("semantic is not a valid value.")}};ri.getVariableName=function(e,t){T.typeOf.string("semantic",e);let n=yke(e);return c(t)&&(n+=`_${t}`),n};var ht=Object.freeze(ri);function hy(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.primitive,o=e.draco,r=e.gltfResource,s=e.baseResource,a=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.primitive",i),T.typeOf.object("options.draco",o),T.typeOf.object("options.gltfResource",r),T.typeOf.object("options.baseResource",s),this._resourceCache=t,this._gltfResource=r,this._baseResource=s,this._gltf=n,this._primitive=i,this._draco=o,this._cacheKey=a,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=gt.UNLOADED,this._promise=void 0,this._dracoError=void 0}c(Object.create)&&(hy.prototype=Object.create($i.prototype),hy.prototype.constructor=hy);Object.defineProperties(hy.prototype,{cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});async function bke(e){let t=e._resourceCache;try{let n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._draco.bufferView,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,await n.load(),e.isDestroyed()?void 0:(e._bufferViewTypedArray=n.typedArray,e._state=gt.PROCESSING,e)}catch(n){if(e.isDestroyed())return;Qre(e,n)}}hy.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,this._promise=bke(this),this._promise)};function Qre(e,t){throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load Draco",t)}async function xke(e,t){try{let n=await t;return e.isDestroyed()?void 0:(e.unload(),e._decodedData={indices:n.indexArray,vertexAttributes:n.attributeData},e._state=gt.READY,e._baseResource)}catch(n){if(e.isDestroyed())return;e._dracoError=n}}var lx={};lx[ht.POSITION]="POSITION";lx[ht.NORMAL]="NORMAL";lx[ht.COLOR]="COLOR";lx[ht.TEXCOORD]="TEX_COORD";function Tke(e){for(let t in lx)if(lx.hasOwnProperty(t)&&e.startsWith(t))return lx[t]}hy.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.PROCESSING||(c(this._dracoError)&&Qre(this,this._dracoError),!c(this._bufferViewTypedArray))||c(this._decodePromise))return!1;let t=this._draco,n=this._primitive,i=this._gltf,o=i.bufferViews,r=t.bufferView,s=o[r],a=t.attributes,l=[];for(let h in n.attributes)if(n.attributes.hasOwnProperty(h)){let p=Tke(h);c(p)&&i.accessors[n.attributes[h]].componentType===$.FLOAT&&(l.includes(p)||l.push(p))}let u={array:new Uint8Array(this._bufferViewTypedArray),bufferView:s,compressedAttributes:a,dequantizeInShader:!0,attributesToSkipTransform:l},f=n_.decodeBufferView(u);if(!c(f))return!1;this._decodePromise=xke(this,f)};hy.prototype.unload=function(){c(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0,this._primitive=void 0};var UC=hy;function Ake(e){let t=e.uint8Array,n=e.format,i=e.request,o=e.flipY??!1,r=e.skipColorSpaceConversion??!1;T.typeOf.object("uint8Array",t),T.typeOf.string("format",n);let s=new Blob([t],{type:n}),a;return we.supportsImageBitmapOptions().then(function(l){return l?Promise.resolve(we.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new we({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(l){return c(a)&&window.URL.revokeObjectURL(a),l}).catch(function(l){return c(a)&&window.URL.revokeObjectURL(a),Promise.reject(l)})}var ux=Ake;function i_(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.imageId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r);let a=n.images[i],l=a.bufferView,u=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=l,this._uri=u,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(i_.prototype=Object.create($i.prototype),i_.prototype.constructor=i_);Object.defineProperties(i_.prototype,{cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}});i_.prototype.load=function(){return c(this._promise)?this._promise:c(this._bufferViewId)?(this._promise=Cke(this),this._promise):(this._promise=Eke(this),this._promise)};function Jre(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map(function(n){return n.bufferView}),e=e[0]),{image:e,mipLevels:t}}async function Cke(e){e._state=gt.LOADING;let t=e._resourceCache;try{let n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;let i=n.typedArray,o=await wke(i);if(e.isDestroyed())return;let r=Jre(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=gt.READY,e}catch(n){return e.isDestroyed()?void 0:ese(e,n,"Failed to load embedded image")}}async function Eke(e){e._state=gt.LOADING;let t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});try{let o=await Dke(i);if(e.isDestroyed())return;let r=Jre(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=gt.READY,e}catch(o){return e.isDestroyed()?void 0:ese(e,o,`Failed to load image: ${n}`)}}function ese(e,t,n){return e.unload(),e._state=gt.FAILED,Promise.reject(e.getError(n,t))}function Ske(e){let t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===137&&t[1]===80)return"image/png";if(t[0]===171&&t[1]===75)return"image/ktx2";if(n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&i[0]===87&&i[1]===69&&i[2]===66&&i[3]===80)return"image/webp";throw new ae("Image format is not recognized")}async function wke(e){let t=Ske(e);if(t==="image/ktx2"){let n=new Uint8Array(e);return Il(n)}return i_._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}var vke=/(^data:image\/ktx2)|(\.ktx2$)/i;function Dke(e){let t=e.getUrlComponent(!1,!0);return vke.test(t)?Il(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}i_.prototype.unload=function(){c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0};i_._loadImageFromTypedArray=ux;var VC=i_;var Pke={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},pa=Object.freeze(Pke);function my(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.primitive,a=e.draco,l=e.cacheKey,u=e.asynchronous??!0,f=e.loadBuffer??!1,h=e.loadTypedArray??!1;if(T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.accessorId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),!f&&!h)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let p=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=p,this._primitive=s,this._draco=a,this._cacheKey=l,this._asynchronous=u,this._loadBuffer=f,this._loadTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(my.prototype=Object.create($i.prototype),my.prototype.constructor=my);Object.defineProperties(my.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}});var Ike=new y9;my.prototype.load=async function(){return c(this._promise)?this._promise:c(this._draco)?(this._promise=Oke(this),this._promise):(this._promise=Rke(this),this._promise)};async function Oke(e){e._state=gt.LOADING;let t=e._resourceCache;try{let n=t.getDracoLoader({gltf:e._gltf,primitive:e._primitive,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,await n.load(),e.isDestroyed()?void 0:(e._state=gt.LOADED,e)}catch(n){if(e.isDestroyed())return;g9(e,n)}}async function Rke(e){let t=e._gltf,n=e._accessorId,o=t.accessors[n].bufferView;e._state=gt.LOADING;let r=e._resourceCache;try{let s=r.getBufferViewLoader({gltf:t,bufferViewId:o,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=s,await s.load(),e.isDestroyed())return;let a=s.typedArray;return e._typedArray=Mke(e,a),e._state=gt.PROCESSING,e}catch(s){if(e.isDestroyed())return;g9(e,s)}}function Mke(e,t){let n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=Fe.getSizeInBytes(s),l=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){let h=r*a,p=new Uint8Array(l,u,h);l=new Uint8Array(p).buffer,u=0,ws("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let f;return s===Fe.UNSIGNED_BYTE?f=new Uint8Array(l,u,r):s===Fe.UNSIGNED_SHORT?f=new Uint16Array(l,u,r):s===Fe.UNSIGNED_INT&&(f=new Uint32Array(l,u,r)),f}function g9(e,t){throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load index buffer",t)}function y9(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}y9.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};y9.prototype.execute=function(){this.buffer=tse(this.typedArray,this.indexDatatype,this.context)};function tse(e,t,n){let i=yt.createIndexBuffer({typedArray:e,context:n,usage:Be.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}my.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.LOADED&&this._state!==gt.PROCESSING)return!1;let t=this._typedArray,n=this._indexDatatype;if(c(this._dracoLoader))try{this._dracoLoader.process(e)&&(t=this._dracoLoader.decodedData.indices.typedArray,this._typedArray=t,n=$.fromTypedArray(t),this._indexDatatype=n)}catch(o){g9(this,o)}if(!c(t))return!1;let i;if(this._loadBuffer&&this._asynchronous){let o=Ike;if(o.set(t,n,e.context),!e.jobScheduler.execute(o,pa.BUFFER))return!1;i=o.buffer}else this._loadBuffer&&(i=tse(t,n,e.context));return this.unload(),this._buffer=i,this._typedArray=this._loadTypedArray?t:void 0,this._state=gt.READY,this._resourceCache.statistics.addGeometryLoader(this),!0};my.prototype.unload=function(){c(this._buffer)&&this._buffer.destroy();let e=this._resourceCache;c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),c(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0,this._primitive=void 0};var zC=my;function Lke(e,t,n){if(n=n??!1,n){let i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}var vs=Lke;function Nke(e,t){return c(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}var mr=Nke;function Xt(){}Xt.objectLegacy=function(e,t){if(c(e)){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let i=e[n],o=t(i,n);if(c(o))return o}}};Xt.object=function(e,t){if(c(e)){let n=e.length;for(let i=0;i<n;i++){let o=e[i],r=t(o,i);if(c(r))return r}}};Xt.topLevel=function(e,t,n){let i=e[t];return c(i)&&!Array.isArray(i)?Xt.objectLegacy(i,n):Xt.object(i,n)};Xt.accessor=function(e,t){return Xt.topLevel(e,"accessors",t)};Xt.accessorWithSemantic=function(e,t,n){let i={};return Xt.mesh(e,function(o){return Xt.meshPrimitive(o,function(r){let s=Xt.meshPrimitiveAttribute(r,function(a,l){if(l.indexOf(t)===0&&!c(i[a])){i[a]=!0;let u=n(a);if(c(u))return u}});return c(s)?s:Xt.meshPrimitiveTarget(r,function(a){return Xt.meshPrimitiveTargetAttribute(a,function(l,u){if(u.indexOf(t)===0&&!c(i[l])){i[l]=!0;let f=n(l);if(c(f))return f}})})})})};Xt.accessorContainingVertexAttributeData=function(e,t){let n={};return Xt.mesh(e,function(i){return Xt.meshPrimitive(i,function(o){let r=Xt.meshPrimitiveAttribute(o,function(s){if(!c(n[s])){n[s]=!0;let a=t(s);if(c(a))return a}});return c(r)?r:Xt.meshPrimitiveTarget(o,function(s){return Xt.meshPrimitiveTargetAttribute(s,function(a){if(!c(n[a])){n[a]=!0;let l=t(a);if(c(l))return l}})})})})};Xt.accessorContainingIndexData=function(e,t){let n={};return Xt.mesh(e,function(i){return Xt.meshPrimitive(i,function(o){let r=o.indices;if(c(r)&&!c(n[r])){n[r]=!0;let s=t(r);if(c(s))return s}})})};Xt.animation=function(e,t){return Xt.topLevel(e,"animations",t)};Xt.animationChannel=function(e,t){let n=e.channels;return Xt.object(n,t)};Xt.animationSampler=function(e,t){let n=e.samplers;return Xt.object(n,t)};Xt.buffer=function(e,t){return Xt.topLevel(e,"buffers",t)};Xt.bufferView=function(e,t){return Xt.topLevel(e,"bufferViews",t)};Xt.camera=function(e,t){return Xt.topLevel(e,"cameras",t)};Xt.image=function(e,t){return Xt.topLevel(e,"images",t)};Xt.material=function(e,t){return Xt.topLevel(e,"materials",t)};Xt.materialValue=function(e,t){let n=e.values;c(e.extensions)&&c(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let o=t(n[i],i);if(c(o))return o}};Xt.mesh=function(e,t){return Xt.topLevel(e,"meshes",t)};Xt.meshPrimitive=function(e,t){let n=e.primitives;if(c(n)){let i=n.length;for(let o=0;o<i;o++){let r=n[o],s=t(r,o);if(c(s))return s}}};Xt.meshPrimitiveAttribute=function(e,t){let n=e.attributes;for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let o=t(n[i],i);if(c(o))return o}};Xt.meshPrimitiveTarget=function(e,t){let n=e.targets;if(c(n)){let i=n.length;for(let o=0;o<i;++o){let r=t(n[o],o);if(c(r))return r}}};Xt.meshPrimitiveTargetAttribute=function(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let i=e[n],o=t(i,n);if(c(o))return o}};Xt.node=function(e,t){return Xt.topLevel(e,"nodes",t)};Xt.nodeInTree=function(e,t,n){let i=e.nodes;if(c(i)){let o=t.length;for(let r=0;r<o;r++){let s=t[r],a=i[s];if(c(a)){let l=n(a,s);if(c(l))return l;let u=a.children;if(c(u)&&(l=Xt.nodeInTree(e,u,n),c(l)))return l}}}};Xt.nodeInScene=function(e,t,n){let i=t.nodes;if(c(i))return Xt.nodeInTree(e,i,n)};Xt.program=function(e,t){return mr(e,"KHR_techniques_webgl")?Xt.object(e.extensions.KHR_techniques_webgl.programs,t):Xt.topLevel(e,"programs",t)};Xt.sampler=function(e,t){return Xt.topLevel(e,"samplers",t)};Xt.scene=function(e,t){return Xt.topLevel(e,"scenes",t)};Xt.shader=function(e,t){return mr(e,"KHR_techniques_webgl")?Xt.object(e.extensions.KHR_techniques_webgl.shaders,t):Xt.topLevel(e,"shaders",t)};Xt.skin=function(e,t){return Xt.topLevel(e,"skins",t)};Xt.skinJoint=function(e,t){let n=e.joints;if(c(n)){let i=n.length;for(let o=0;o<i;o++){let r=n[o],s=t(r);if(c(s))return s}}};Xt.techniqueAttribute=function(e,t){let n=e.attributes;for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let o=t(n[i],i);if(c(o))return o}};Xt.techniqueUniform=function(e,t){let n=e.uniforms;for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let o=t(n[i],i);if(c(o))return o}};Xt.techniqueParameter=function(e,t){let n=e.parameters;for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let o=t(n[i],i);if(c(o))return o}};Xt.technique=function(e,t){return mr(e,"KHR_techniques_webgl")?Xt.object(e.extensions.KHR_techniques_webgl.techniques,t):Xt.topLevel(e,"techniques",t)};Xt.texture=function(e,t){return Xt.topLevel(e,"textures",t)};var Oe=Xt;function Fke(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}var wu=Fke;function Bke(e,t){let n=t.bufferView;if(c(n)){let i=e.bufferViews[n];if(c(i.byteStride)&&i.byteStride>0)return i.byteStride}return $.getSizeInBytes(t.componentType)*wu(t.type)}var Ul=Bke;function kke(e){Oe.accessor(e,function(n){c(n.bufferView)&&(n.byteOffset=n.byteOffset??0)}),Oe.bufferView(e,function(n){c(n.buffer)&&(n.byteOffset=n.byteOffset??0)}),Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){if(i.mode=i.mode??ne.TRIANGLES,!c(i.material)){c(e.materials)||(e.materials=[]);let o={name:"default"};i.material=vs(e.materials,o)}})}),Oe.accessorContainingVertexAttributeData(e,function(n){let i=e.accessors[n],o=i.bufferView;if(i.normalized=i.normalized??!1,c(o)){let r=e.bufferViews[o];r.byteStride=Ul(e,i),r.target=ne.ARRAY_BUFFER}}),Oe.accessorContainingIndexData(e,function(n){let o=e.accessors[n].bufferView;if(c(o)){let r=e.bufferViews[o];r.target=ne.ELEMENT_ARRAY_BUFFER}}),Oe.material(e,function(n){let i=n.extensions??W.EMPTY_OBJECT,o=i.KHR_materials_common;if(c(o)){let l=o.technique,u=c(o.values)?o.values:{};o.values=u,u.ambient=c(u.ambient)?u.ambient:[0,0,0,1],u.emission=c(u.emission)?u.emission:[0,0,0,1],u.transparency=u.transparency??1,l!=="CONSTANT"&&(u.diffuse=c(u.diffuse)?u.diffuse:[0,0,0,1],l!=="LAMBERT"&&(u.specular=c(u.specular)?u.specular:[0,0,0,1],u.shininess=u.shininess??0)),o.transparent=o.transparent??!1,o.doubleSided=o.doubleSided??!1;return}n.emissiveFactor=n.emissiveFactor??[0,0,0],n.alphaMode=n.alphaMode??"OPAQUE",n.doubleSided=n.doubleSided??!1,n.alphaMode==="MASK"&&(n.alphaCutoff=n.alphaCutoff??.5);let r=i.KHR_techniques_webgl;c(r)&&Oe.materialValue(n,function(l){c(l.index)&&fx(l)}),fx(n.emissiveTexture),fx(n.normalTexture),fx(n.occlusionTexture);let s=n.pbrMetallicRoughness;c(s)&&(s.baseColorFactor=s.baseColorFactor??[1,1,1,1],s.metallicFactor=s.metallicFactor??1,s.roughnessFactor=s.roughnessFactor??1,fx(s.baseColorTexture),fx(s.metallicRoughnessTexture));let a=i.KHR_materials_pbrSpecularGlossiness;c(a)&&(a.diffuseFactor=a.diffuseFactor??[1,1,1,1],a.specularFactor=a.specularFactor??[1,1,1],a.glossinessFactor=a.glossinessFactor??1,fx(a.specularGlossinessTexture))}),Oe.animation(e,function(n){Oe.animationSampler(n,function(i){i.interpolation=i.interpolation??"LINEAR"})});let t=Uke(e);return Oe.node(e,function(n,i){c(t[i])||c(n.translation)||c(n.rotation)||c(n.scale)?(n.translation=n.translation??[0,0,0],n.rotation=n.rotation??[0,0,0,1],n.scale=n.scale??[1,1,1]):n.matrix=n.matrix??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}),Oe.sampler(e,function(n){n.wrapS=n.wrapS??ne.REPEAT,n.wrapT=n.wrapT??ne.REPEAT}),c(e.scenes)&&!c(e.scene)&&(e.scene=0),e}function Uke(e){let t={};return Oe.animation(e,function(n){Oe.animationChannel(n,function(i){let o=i.target,r=o.node,s=o.path;(s==="translation"||s==="rotation"||s==="scale")&&(t[r]=!0)})}),t}function fx(e){c(e)&&(e.texCoord=e.texCoord??0)}var u1=kke;function Vke(e){return Oe.shader(e,function(t){iz(t)}),Oe.buffer(e,function(t){iz(t)}),Oe.image(e,function(t){iz(t)}),iz(e),e}function iz(e){e.extras=c(e.extras)?e.extras:{},e.extras._pipeline=c(e.extras._pipeline)?e.extras._pipeline:{}}var py=Vke;function zke(e,t){let n=e.extensionsRequired;if(c(n)){let i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}var f1=zke;function Hke(e,t){let n=e.extensionsUsed;if(c(n)){let i=n.indexOf(t);i>=0&&n.splice(i,1),f1(e,t),n.length===0&&delete e.extensionsUsed}}var dx=Hke;var Gke=4;function jke(e){if(Kd(e)!=="glTF")throw new ae("File is not valid binary glTF");let n=nse(e,0,5),i=n[1];if(i!==1&&i!==2)throw new ae("Binary glTF version is not 1 or 2");return i===1?Wke(e,n):qke(e,n)}function nse(e,t,n){let i=new DataView(e.buffer),o=new Array(n);for(let r=0;r<n;++r)o[r]=i.getUint32(e.byteOffset+t+r*Gke,!0);return o}function Wke(e,t){let n=t[2],i=t[3];if(t[4]!==0)throw new ae("Binary glTF scene format is not JSON");let r=20,s=r+i,a=Fl(e,r,i),l=JSON.parse(a);py(l);let u=e.subarray(s,n),f=l.buffers;if(c(f)&&Object.keys(f).length>0){let h=f.binary_glTF??f.KHR_binary_glTF;c(h)&&(h.extras._pipeline.source=u,delete h.uri)}return dx(l,"KHR_binary_glTF"),l}function qke(e,t){let n=t[2],i=12,o,r;for(;i<n;){let s=nse(e,i,2),a=s[0],l=s[1];i+=8;let u=e.subarray(i,i+a);if(i+=a,l===1313821514){let f=Fl(u);o=JSON.parse(f),py(o)}else l===5130562&&(r=u)}if(c(o)&&c(r)){let s=o.buffers;if(c(s)&&s.length>0){let a=s[0];a.extras._pipeline.source=r}}return o}var d1=jke;function Yke(e){return Oe.shader(e,function(t){oz(t)}),Oe.buffer(e,function(t){oz(t)}),Oe.image(e,function(t){oz(t)}),oz(e),e}function oz(e){c(e.extras)&&(c(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}var h1=Yke;function Xke(e,t){let n=e.extensionsUsed;c(n)||(n=[],e.extensionsUsed=n),vs(n,t,!0)}var Ff=Xke;function Kke(e){switch(e){case $.BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt8(n+s*o)};case $.UNSIGNED_BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint8(n+s*o)};case $.SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt16(n+s*o,!0)};case $.UNSIGNED_SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint16(n+s*o,!0)};case $.INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt32(n+s*o,!0)};case $.UNSIGNED_INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint32(n+s*o,!0)};case $.FLOAT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat32(n+s*o,!0)};case $.DOUBLE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat64(n+s*o,!0)}}}var o_=Kke;function $ke(e,t){let n=e.bufferViews,i=e.buffers,o=t.bufferView,r=wu(t.type);if(!c(t.bufferView))return{min:new Array(r).fill(0),max:new Array(r).fill(0)};let s=new Array(r).fill(Number.POSITIVE_INFINITY),a=new Array(r).fill(Number.NEGATIVE_INFINITY),l=n[o],u=l.buffer,h=i[u].extras._pipeline.source,p=t.count,g=Ul(e,t),m=t.byteOffset+l.byteOffset+h.byteOffset,y=t.componentType,b=$.getSizeInBytes(y),x=new DataView(h.buffer),A=new Array(r),C=o_(y);for(let S=0;S<p;S++){C(x,m,r,b,A);for(let v=0;v<r;v++){let P=A[v];s[v]=Math.min(s[v],P),a[v]=Math.max(a[v],P)}m+=g}return{min:s,max:a}}var hx=$ke;var Zke=[ne.FUNC_ADD,ne.FUNC_ADD],Qke=[ne.ONE,ne.ZERO,ne.ONE,ne.ZERO];function ise(e,t){let n=e.enable;return c(n)?n.indexOf(t)>-1:!1}var Jke=[ne.ZERO,ne.ONE,ne.SRC_COLOR,ne.ONE_MINUS_SRC_COLOR,ne.SRC_ALPHA,ne.ONE_MINUS_SRC_ALPHA,ne.DST_ALPHA,ne.ONE_MINUS_DST_ALPHA,ne.DST_COLOR,ne.ONE_MINUS_DST_COLOR];function eUe(e,t){if(!c(e))return t;for(let n=0;n<4;n++)if(Jke.indexOf(e[n])===-1)return t;return e}function tUe(e){let t={},n={},i=e.techniques;return c(i)&&(Oe.technique(e,function(o,r){let s=o.states;if(c(s)){let a=n[r]={};if(ise(s,ne.BLEND)){a.alphaMode="BLEND";let l=s.functions;c(l)&&(c(l.blendEquationSeparate)||c(l.blendFuncSeparate))&&(t[r]={blendEquation:l.blendEquationSeparate??Zke,blendFactors:eUe(l.blendFuncSeparate,Qke)})}ise(s,ne.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(c(e.extensions)||(e.extensions={}),Ff(e,"KHR_blend")),Oe.material(e,function(o){if(c(o.technique)){let r=n[o.technique];Oe.objectLegacy(r,function(a,l){o[l]=a});let s=t[o.technique];c(s)&&(c(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}var m1=tUe;function nUe(e,t){let n=e.extensionsRequired;c(n)||(n=[],e.extensionsRequired=n),vs(n,t,!0),Ff(e,t)}var p1=nUe;function iUe(e){let t=e.techniques,n={},i={},o={};if(c(t)){let r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,Oe.technique(e,function(a,l){let u={name:a.name,program:void 0,attributes:{},uniforms:{}},f;if(Oe.techniqueAttribute(a,function(h,p){f=a.parameters[h],u.attributes[p]={semantic:f.semantic}}),Oe.techniqueUniform(a,function(h,p){f=a.parameters[h],u.uniforms[p]={count:f.count,node:f.node,type:f.type,semantic:f.semantic,value:f.value},c(n[l])||(n[l]={}),n[l][h]=p}),c(o[a.program]))u.program=o[a.program];else{let h=e.programs[a.program],p={name:h.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[h.fragmentShader];p.fragmentShader=vs(r.shaders,g,!0);let m=e.shaders[h.vertexShader];p.vertexShader=vs(r.shaders,m,!0),u.program=vs(r.programs,p),o[a.program]=u.program}i[l]=vs(r.techniques,u)}),r.techniques.length>0&&(c(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,Ff(e,"KHR_techniques_webgl"),p1(e,"KHR_techniques_webgl"))}return Oe.material(e,function(r){if(c(r.technique)){let s={technique:i[r.technique]};Oe.objectLegacy(r.values,function(a,l){c(s.values)||(s.values={});let u=n[r.technique][l];c(u)&&(s.values[u]=a)}),c(r.extensions)||(r.extensions={}),r.extensions.KHR_techniques_webgl=s}delete r.technique,delete r.values}),delete e.techniques,delete e.programs,delete e.shaders,e}var _1=iUe;function oUe(e,t){T.typeOf.object("material",e),T.defined("handler",t);let n=e.pbrMetallicRoughness;if(c(n)){if(c(n.baseColorTexture)){let r=n.baseColorTexture,s=t(r.index,r);if(c(s))return s}if(c(n.metallicRoughnessTexture)){let r=n.metallicRoughnessTexture,s=t(r.index,r);if(c(s))return s}}let{extensions:i}=e;if(c(i)){let r=i.KHR_materials_pbrSpecularGlossiness;if(c(r)){if(c(r.diffuseTexture)){let l=r.diffuseTexture,u=t(l.index,l);if(c(u))return u}if(c(r.specularGlossinessTexture)){let l=r.specularGlossinessTexture,u=t(l.index,l);if(c(u))return u}}let s=i.KHR_materials_specular;if(c(s)){let{specularTexture:l,specularColorTexture:u}=s;if(c(l)){let f=t(l.index,l);if(c(f))return f}if(c(u)){let f=t(u.index,u);if(c(f))return f}}let a=i.KHR_materials_common;if(c(a)&&c(a.values)){let{diffuse:l,ambient:u,emission:f,specular:h}=a.values;if(c(l)&&c(l.index)){let p=t(l.index,l);if(c(p))return p}if(c(u)&&c(u.index)){let p=t(u.index,u);if(c(p))return p}if(c(f)&&c(f.index)){let p=t(f.index,f);if(c(p))return p}if(c(h)&&c(h.index)){let p=t(h.index,h);if(c(p))return p}}}let o=Oe.materialValue(e,function(r){if(c(r.index)){let s=t(r.index,r);if(c(s))return s}});if(c(o))return o;if(c(e.emissiveTexture)){let r=e.emissiveTexture,s=t(r.index,r);if(c(s))return s}if(c(e.normalTexture)){let r=e.normalTexture,s=t(r.index,r);if(c(s))return s}if(c(e.occlusionTexture)){let r=e.occlusionTexture,s=t(r.index,r);if(c(s))return s}}var HC=oUe;var ose=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function rUe(e,t){return t=t??ose,ose.forEach(function(n){t.indexOf(n)>-1&&aUe(e,n)}),e}var sUe={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function aUe(e,t){let n=sUe[t],i=e[n];if(c(i)){let o=0,r=Cm[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(Am[t](e,a-o),o++)}}function Am(){}Am.accessor=function(e,t){e.accessors.splice(t,1),Oe.mesh(e,function(i){Oe.meshPrimitive(i,function(o){Oe.meshPrimitiveAttribute(o,function(a,l){a>t&&o.attributes[l]--}),Oe.meshPrimitiveTarget(o,function(a){Oe.meshPrimitiveTargetAttribute(a,function(l,u){l>t&&a[u]--})});let r=o.indices;c(r)&&r>t&&o.indices--;let s=o.extensions;c(s)&&c(s.CESIUM_primitive_outline)&&s.CESIUM_primitive_outline.indices>t&&--s.CESIUM_primitive_outline.indices})}),Oe.skin(e,function(i){c(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),Oe.animation(e,function(i){Oe.animationSampler(i,function(o){c(o.input)&&o.input>t&&o.input--,c(o.output)&&o.output>t&&o.output--})})};Am.buffer=function(e,t){e.buffers.splice(t,1),Oe.bufferView(e,function(i){c(i.buffer)&&i.buffer>t&&i.buffer--,c(i.extensions)&&c(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};Am.bufferView=function(e,t){if(e.bufferViews.splice(t,1),Oe.accessor(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Oe.shader(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Oe.image(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),mr(e,"KHR_draco_mesh_compression")&&Oe.mesh(e,function(i){Oe.meshPrimitive(i,function(o){c(o.extensions)&&c(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),mr(e,"EXT_feature_metadata")){let o=e.extensions.EXT_feature_metadata.featureTables;for(let r in o)if(o.hasOwnProperty(r)){let a=o[r].properties;if(c(a)){for(let l in a)if(a.hasOwnProperty(l)){let u=a[l];c(u.bufferView)&&u.bufferView>t&&u.bufferView--,c(u.arrayOffsetBufferView)&&u.arrayOffsetBufferView>t&&u.arrayOffsetBufferView--,c(u.stringOffsetBufferView)&&u.stringOffsetBufferView>t&&u.stringOffsetBufferView--}}}}if(mr(e,"EXT_structural_metadata")){let o=e.extensions.EXT_structural_metadata.propertyTables;if(c(o)){let r=o.length;for(let s=0;s<r;++s){let l=o[s].properties;for(let u in l)if(l.hasOwnProperty(u)){let f=l[u];c(f.values)&&f.values>t&&f.values--,c(f.arrayOffsets)&&f.arrayOffsets>t&&f.arrayOffsets--,c(f.stringOffsets)&&f.stringOffsets>t&&f.stringOffsets--}}}}};Am.image=function(e,t){e.images.splice(t,1),Oe.texture(e,function(i){c(i.source)&&i.source>t&&--i.source;let o=i.extensions;c(o)&&c(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:c(o)&&c(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};Am.mesh=function(e,t){e.meshes.splice(t,1),Oe.node(e,function(i){c(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};Am.node=function(e,t){e.nodes.splice(t,1),Oe.skin(e,function(i){c(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),Oe.animation(e,function(i){Oe.animationChannel(i,function(o){c(o.target)&&c(o.target.node)&&o.target.node>t&&o.target.node--})}),Oe.technique(e,function(i){Oe.techniqueUniform(i,function(o){c(o.node)&&o.node>t&&o.node--})}),Oe.node(e,function(i){c(i.children)&&(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),Oe.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};Am.material=function(e,t){e.materials.splice(t,1),Oe.mesh(e,function(i){Oe.meshPrimitive(i,function(o){c(o.material)&&o.material>t&&o.material--})})};Am.sampler=function(e,t){e.samplers.splice(t,1),Oe.texture(e,function(i){c(i.sampler)&&i.sampler>t&&--i.sampler})};Am.texture=function(e,t){if(e.textures.splice(t,1),Oe.material(e,function(i){HC(i,function(o,r){r.index>t&&--r.index})}),mr(e,"EXT_feature_metadata")){Oe.mesh(e,function(r){Oe.meshPrimitive(r,function(s){let a=s.extensions;if(c(a)&&c(a.EXT_feature_metadata)){let u=a.EXT_feature_metadata.featureIdTextures;if(c(u)){let f=u.length;for(let h=0;h<f;++h){let g=u[h].featureIds.texture;g.index>t&&--g.index}}}})});let o=e.extensions.EXT_feature_metadata.featureTextures;for(let r in o)if(o.hasOwnProperty(r)){let a=o[r].properties;if(c(a)){for(let l in a)if(a.hasOwnProperty(l)){let f=a[l].texture;f.index>t&&--f.index}}}}if(mr(e,"EXT_mesh_features")&&Oe.mesh(e,function(i){Oe.meshPrimitive(i,function(o){let r=o.extensions;if(c(r)&&c(r.EXT_mesh_features)){let a=r.EXT_mesh_features.featureIds;if(c(a)){let l=a.length;for(let u=0;u<l;++u){let f=a[u];c(f.texture)&&f.texture.index>t&&--f.texture.index}}}})}),mr(e,"EXT_structural_metadata")){let o=e.extensions.EXT_structural_metadata.propertyTextures;if(c(o)){let r=o.length;for(let s=0;s<r;++s){let l=o[s].properties;for(let u in l)if(l.hasOwnProperty(u)){let f=l[u];f.index>t&&--f.index}}}}};function Cm(){}Cm.accessor=function(e){let t={};return Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){Oe.meshPrimitiveAttribute(i,function(r){t[r]=!0}),Oe.meshPrimitiveTarget(i,function(r){Oe.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});let o=i.indices;c(o)&&(t[o]=!0)})}),Oe.skin(e,function(n){c(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),Oe.animation(e,function(n){Oe.animationSampler(n,function(i){c(i.input)&&(t[i.input]=!0),c(i.output)&&(t[i.output]=!0)})}),mr(e,"EXT_mesh_gpu_instancing")&&Oe.node(e,function(n){c(n.extensions)&&c(n.extensions.EXT_mesh_gpu_instancing)&&Object.keys(n.extensions.EXT_mesh_gpu_instancing.attributes).forEach(function(i){let o=n.extensions.EXT_mesh_gpu_instancing.attributes[i];t[o]=!0})}),mr(e,"CESIUM_primitive_outline")&&Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){let o=i.extensions;if(c(o)&&c(o.CESIUM_primitive_outline)){let s=o.CESIUM_primitive_outline.indices;c(s)&&(t[s]=!0)}})}),t};Cm.buffer=function(e){let t={};return Oe.bufferView(e,function(n){c(n.buffer)&&(t[n.buffer]=!0),c(n.extensions)&&c(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};Cm.bufferView=function(e){let t={};if(Oe.accessor(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),Oe.shader(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),Oe.image(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),mr(e,"KHR_draco_mesh_compression")&&Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){c(i.extensions)&&c(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),mr(e,"EXT_feature_metadata")){let i=e.extensions.EXT_feature_metadata.featureTables;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o].properties;if(c(s)){for(let a in s)if(s.hasOwnProperty(a)){let l=s[a];c(l.bufferView)&&(t[l.bufferView]=!0),c(l.arrayOffsetBufferView)&&(t[l.arrayOffsetBufferView]=!0),c(l.stringOffsetBufferView)&&(t[l.stringOffsetBufferView]=!0)}}}}if(mr(e,"EXT_structural_metadata")){let i=e.extensions.EXT_structural_metadata.propertyTables;if(c(i)){let o=i.length;for(let r=0;r<o;++r){let a=i[r].properties;for(let l in a)if(a.hasOwnProperty(l)){let u=a[l];c(u.values)&&(t[u.values]=!0),c(u.arrayOffsets)&&(t[u.arrayOffsets]=!0),c(u.stringOffsets)&&(t[u.stringOffsets]=!0)}}}}return t};Cm.image=function(e){let t={};return Oe.texture(e,function(n){c(n.source)&&(t[n.source]=!0),c(n.extensions)&&c(n.extensions.EXT_texture_webp)?t[n.extensions.EXT_texture_webp.source]=!0:c(n.extensions)&&c(n.extensions.KHR_texture_basisu)&&(t[n.extensions.KHR_texture_basisu.source]=!0)}),t};Cm.mesh=function(e){let t={};return Oe.node(e,function(n){if(c(n.mesh&&c(e.meshes))){let i=e.meshes[n.mesh];c(i)&&c(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}}),t};function rse(e,t,n){let i=e.nodes[t];return c(i.mesh)||c(i.camera)||c(i.skin)||c(i.weights)||c(i.extras)||c(i.extensions)&&Object.keys(i.extensions).length!==0||c(n[t])?!1:!c(i.children)||i.children.filter(function(o){return!rse(e,o,n)}).length===0}Cm.node=function(e){let t={};return Oe.skin(e,function(n){c(n.skeleton)&&(t[n.skeleton]=!0),Oe.skinJoint(n,function(i){t[i]=!0})}),Oe.animation(e,function(n){Oe.animationChannel(n,function(i){c(i.target)&&c(i.target.node)&&(t[i.target.node]=!0)})}),Oe.technique(e,function(n){Oe.techniqueUniform(n,function(i){c(i.node)&&(t[i.node]=!0)})}),Oe.node(e,function(n,i){rse(e,i,t)||(t[i]=!0)}),t};Cm.material=function(e){let t={};return Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){c(i.material)&&(t[i.material]=!0)})}),t};Cm.texture=function(e){let t={};if(Oe.material(e,function(n){HC(n,function(i){t[i]=!0})}),mr(e,"EXT_feature_metadata")){Oe.mesh(e,function(o){Oe.meshPrimitive(o,function(r){let s=r.extensions;if(c(s)&&c(s.EXT_feature_metadata)){let l=s.EXT_feature_metadata.featureIdTextures;if(c(l)){let u=l.length;for(let f=0;f<u;++f){let p=l[f].featureIds.texture;t[p.index]=!0}}}})});let i=e.extensions.EXT_feature_metadata.featureTextures;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o].properties;if(c(s)){for(let a in s)if(s.hasOwnProperty(a)){let u=s[a].texture;t[u.index]=!0}}}}if(mr(e,"EXT_mesh_features")&&Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){let o=i.extensions;if(c(o)&&c(o.EXT_mesh_features)){let s=o.EXT_mesh_features.featureIds;if(c(s)){let a=s.length;for(let l=0;l<a;++l){let u=s[l];c(u.texture)&&(t[u.texture.index]=!0)}}}})}),mr(e,"EXT_structural_metadata")){let i=e.extensions.EXT_structural_metadata.propertyTextures;if(c(i)){let o=i.length;for(let r=0;r<o;++r){let a=i[r].properties;for(let l in a)if(a.hasOwnProperty(l)){let u=a[l];t[u.index]=!0}}}}return t};Cm.sampler=function(e){let t={};return Oe.texture(e,function(n){c(n.sampler)&&(t[n.sampler]=!0)}),t};var g1=rUe;function cUe(e,t){let n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:vs(e.buffers,n),byteOffset:0,byteLength:t.length};return vs(e.bufferViews,o)}var y1=cUe;function lUe(e,t){let n=Ul(e,t),i=$.getSizeInBytes(t.componentType),o=wu(t.type),r=t.count,s=new Array(o*r);if(!c(t.bufferView))return s.fill(0);let a=e.bufferViews[t.bufferView],l=e.buffers[a.buffer].extras._pipeline.source,u=t.byteOffset+a.byteOffset+l.byteOffset,f=new DataView(l.buffer),h=new Array(o),p=o_(t.componentType);for(let g=0;g<r;++g){p(f,u,o,i,h);for(let m=0;m<o;++m)s[g*o+m]=h[m];u+=n}return s}var b1=lUe;function uUe(e){let t;return Oe.accessorWithSemantic(e,"JOINTS_0",function(n){let i=e.accessors[n];t=i.componentType,t===ne.BYTE?rz(e,i,$.UNSIGNED_BYTE):t!==ne.UNSIGNED_BYTE&&t!==ne.UNSIGNED_SHORT&&rz(e,i,$.UNSIGNED_SHORT)}),Oe.accessorWithSemantic(e,"WEIGHTS_0",function(n){let i=e.accessors[n];t=i.componentType,t===ne.BYTE?rz(e,i,$.UNSIGNED_BYTE):t===ne.SHORT&&rz(e,i,$.UNSIGNED_SHORT)}),e}function rz(e,t,n){let i=$.createTypedArray(n,b1(e,t)),o=new Uint8Array(i.buffer);t.bufferView=y1(e,o),t.componentType=n,t.byteOffset=0}var x1=uUe;function fUe(e,t){return dx(e,t),t==="CESIUM_RTC"&&dUe(e),b9(e,t)}function dUe(e){Oe.technique(e,function(t){Oe.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function b9(e,t){if(Array.isArray(e)){let n=e.length;for(let i=0;i<n;++i)b9(e[i],t)}else if(e!==null&&typeof e=="object"&&e.constructor===Object){let n=e.extensions,i;c(n)&&(i=n[t],c(i)&&(delete n[t],Object.keys(n).length===0&&delete e.extensions));for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&b9(e[o],t);return i}}var mx=fUe;var sz={.8:yUe,"1.0":UUe,"2.0":void 0};function hUe(e,t){t=t??W.EMPTY_OBJECT;let n=t.targetVersion,i=e.version;e.asset=e.asset??{version:"1.0"},e.asset.version=e.asset.version??"1.0",i=(i??e.asset.version).toString(),Object.prototype.hasOwnProperty.call(sz,i)||(c(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(sz,i)||(i="1.0"));let o=sz[i];for(;c(o)&&i!==n;)o(e,t),i=e.asset.version,o=sz[i];return t.keepLegacyExtensions||(HUe(e,t),GUe(e)),e}function cse(e){let t=e.materials;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n],o=i.instanceTechnique;c(o)&&(i.technique=o.technique,i.values=o.values,delete i.instanceTechnique)}}function mUe(e){let t=e.meshes;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let o=t[n].primitives;if(c(o)){let r=o.length;for(let s=0;s<r;++s){let a=o[s],l=a.primitive??ne.TRIANGLES;a.mode=a.mode??l,delete a.primitive}}}}function pUe(e){let t=e.nodes,n=new d,i=new Le;for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o];if(c(r.rotation)){let a=r.rotation;d.fromArray(a,0,n),Le.fromAxisAngle(n,a[3],i),r.rotation=[i.x,i.y,i.z,i.w]}let s=r.instanceSkin;c(s)&&(r.skeletons=s.skeletons,r.skin=s.skin,r.meshes=s.meshes,delete r.instanceSkin)}}function _Ue(e){let t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new d,a=new Le;for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)){let u=t[l],f=u.channels,h=u.parameters,p=u.samplers;if(c(f)){let g=f.length;for(let m=0;m<g;++m){let y=f[m];if(y.target.path==="rotation"){let b=h[p[y.sampler].output];if(c(r[b]))continue;r[b]=!0;let x=n[b],A=i[x.bufferView],S=o[A.buffer].extras._pipeline.source,v=S.byteOffset+A.byteOffset+x.byteOffset,P=x.componentType,M=x.count,R=wu(x.type),L=x.count*R,F=$.createArrayBufferView(P,S.buffer,v,L);for(let _=0;_<M;_++){let w=_*R;d.unpack(F,w,s);let D=F[w+3];Le.fromAxisAngle(s,D,a),Le.pack(a,F,w)}}}}}}function gUe(e){let t=e.techniques;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n],o=i.passes;if(c(o)){let r=i.pass??"defaultPass";if(Object.prototype.hasOwnProperty.call(o,r)){let s=o[r],a=s.instanceProgram;i.attributes=i.attributes??a.attributes,i.program=i.program??a.program,i.uniforms=i.uniforms??a.uniforms,i.states=i.states??s.states}delete i.passes,delete i.pass}}}function yUe(e){c(e.asset)||(e.asset={});let t=e.asset;if(t.version="1.0",typeof t.profile=="string"){let n=t.profile.split(" ");t.profile={api:n[0],version:n[1]}}else t.profile={};if(c(e.version)&&delete e.version,cse(e),mUe(e),pUe(e),_Ue(e),gUe(e),c(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),c(e.lights)){let n=e.extensions??{};e.extensions=n;let i=n.KHR_materials_common??{};n.KHR_materials_common=i,i.lights=e.lights,delete e.lights,Ff(e,"KHR_materials_common")}}function bUe(e){let t=e.animations;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n],o=i.parameters;if(c(o)){let r=i.samplers;for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s)){let a=r[s];a.input=o[a.input],a.output=o[a.output]}delete i.parameters}}}function sse(e,t){let n=[];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let o=e[i];t[i]=n.length,n.push(o),c(o.name)||(o.name=i)}return n}function xUe(e){let t,n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}},i,o={},r=e.nodes;for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i=r[s].jointName,c(i)&&(o[i]=s));for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&c(n[s])){let a={},l=e[s];e[s]=sse(l,a),n[s]=a}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);c(e.scene)&&(e.scene=n.scenes[e.scene]),Oe.bufferView(e,function(s){c(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),Oe.accessor(e,function(s){c(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),Oe.shader(e,function(s){let a=s.extensions;if(c(a)){let l=a.KHR_binary_glTF;c(l)&&(s.bufferView=n.bufferViews[l.bufferView],delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Oe.program(e,function(s){c(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),c(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),Oe.technique(e,function(s){c(s.program)&&(s.program=n.programs[s.program]),Oe.techniqueParameter(s,function(a){c(a.node)&&(a.node=n.nodes[a.node]);let l=a.value;typeof l=="string"&&(a.value={index:n.textures[l]})})}),Oe.mesh(e,function(s){Oe.meshPrimitive(s,function(a){c(a.indices)&&(a.indices=n.accessors[a.indices]),Oe.meshPrimitiveAttribute(a,function(l,u){a.attributes[u]=n.accessors[l]}),c(a.material)&&(a.material=n.materials[a.material])})}),Oe.node(e,function(s){let a=s.children;if(c(a)){let l=a.length;for(t=0;t<l;++t)a[t]=n.nodes[a[t]]}if(c(s.meshes)){let l=s.meshes,u=l.length;if(u>0)for(s.mesh=n.meshes[l[0]],t=1;t<u;++t){let f={mesh:n.meshes[l[t]]},h=vs(e.nodes,f);c(a)||(a=[],s.children=a),a.push(h)}delete s.meshes}if(c(s.camera)&&(s.camera=n.cameras[s.camera]),c(s.skin)&&(s.skin=n.skins[s.skin]),c(s.skeletons)){let l=s.skeletons;if(l.length>0&&c(s.skin)){let f=e.skins[s.skin];f.skeleton=n.nodes[l[0]]}delete s.skeletons}c(s.jointName)&&delete s.jointName}),Oe.skin(e,function(s){c(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);let a=s.jointNames;if(c(a)){let l=[],u=a.length;for(t=0;t<u;++t)l[t]=o[a[t]];s.joints=l,delete s.jointNames}}),Oe.scene(e,function(s){let a=s.nodes;if(c(a)){let l=a.length;for(t=0;t<l;++t)a[t]=n.nodes[a[t]]}}),Oe.animation(e,function(s){let a={};s.samplers=sse(s.samplers,a),Oe.animationSampler(s,function(l){l.input=n.accessors[l.input],l.output=n.accessors[l.output]}),Oe.animationChannel(s,function(l){l.sampler=a[l.sampler];let u=l.target;c(u)&&(u.node=n.nodes[u.id],delete u.id)})}),Oe.material(e,function(s){c(s.technique)&&(s.technique=n.techniques[s.technique]),Oe.materialValue(s,function(l,u){typeof l=="string"&&(s.values[u]={index:n.textures[l]})});let a=s.extensions;if(c(a)){let l=a.KHR_materials_common;c(l)&&c(l.values)&&Oe.materialValue(l,function(u,f){typeof u=="string"&&(l.values[f]={index:n.textures[u]})})}}),Oe.image(e,function(s){let a=s.extensions;if(c(a)){let l=a.KHR_binary_glTF;c(l)&&(s.bufferView=n.bufferViews[l.bufferView],s.mimeType=l.mimeType,delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Oe.texture(e,function(s){c(s.sampler)&&(s.sampler=n.samplers[s.sampler]),c(s.source)&&(s.source=n.images[s.source])})}function TUe(e){Oe.animation(e,function(t){Oe.animationSampler(t,function(n){delete n.name})})}function AUe(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];Array.isArray(n)&&n.length===0&&delete e[t]}Oe.node(e,function(t){c(t.children)&&t.children.length===0&&delete t.children})}function CUe(e){let t=e.asset;delete t.profile,delete t.premultipliedAlpha}var EUe={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function SUe(e){let t=e.extensionsUsed;if(e.extensionsRequired=e.extensionsRequired??[],c(t)){let n=t.length;for(let i=0;i<n;++i){let o=t[i];c(EUe[o])&&e.extensionsRequired.push(o)}}}function wUe(e){Oe.buffer(e,function(t){delete t.type})}function vUe(e){Oe.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function DUe(e){Oe.mesh(e,function(t){Oe.meshPrimitive(t,function(n){Oe.meshPrimitiveAttribute(n,function(i,o){o==="TEXCOORD"?n.attributes.TEXCOORD_0=i:o==="COLOR"&&(n.attributes.COLOR_0=i)}),delete n.attributes.TEXCOORD,delete n.attributes.COLOR})}),Oe.technique(e,function(t){Oe.techniqueParameter(t,function(n){let i=n.semantic;c(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}var PUe={POSITION:!0,NORMAL:!0,TANGENT:!0},IUe={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function OUe(e){let t={};Oe.mesh(e,function(n){Oe.meshPrimitive(n,function(i){Oe.meshPrimitiveAttribute(i,function(o,r){if(r.charAt(0)!=="_"){let s=r.search(/_[0-9]+/g),a=r,l="_0";s>=0&&(a=r.substring(0,s),l=r.substring(s));let u,f=IUe[a];c(f)?(u=f+l,t[r]=u):c(PUe[a])||(u=`_${r}`,t[r]=u)}});for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],s=i.attributes[o];c(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),Oe.technique(e,function(n){Oe.techniqueParameter(n,function(i){let o=t[i.semantic];c(o)&&(i.semantic=o)})})}function RUe(e){Oe.camera(e,function(t){let n=t.perspective;if(c(n)){let i=n.aspectRatio;c(i)&&i===0&&delete n.aspectRatio;let o=n.yfov;c(o)&&o===0&&(n.yfov=1)}})}function T9(e,t){return c(t.byteStride)&&t.byteStride!==0?t.byteStride:Ul(e,t)}function MUe(e){Oe.buffer(e,function(t){c(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),Oe.accessor(e,function(t){let n=t.bufferView;if(c(n)){let i=e.bufferViews[n],o=T9(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(i.byteLength??0,r)}})}function LUe(e){let t,n,i,o=e.bufferViews,r={};Oe.accessorContainingVertexAttributeData(e,function(a){let l=e.accessors[a];c(l.bufferView)&&(r[l.bufferView]=!0)});let s={};Oe.accessor(e,function(a){c(a.bufferView)&&(s[a.bufferView]=s[a.bufferView]??[],s[a.bufferView].push(a))});for(let a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];let l=s[a];l.sort(function(p,g){return p.byteOffset-g.byteOffset});let u=0,f=0,h=l.length;for(t=0;t<h;++t){let p=l[t],g=T9(e,p),m=p.byteOffset,y=p.count*g;delete p.byteStride;let b=t<h-1,x=b?T9(e,l[t+1]):void 0;if(g!==x){let A=je(i,!0);r[a]&&(A.byteStride=g),A.byteOffset+=u,A.byteLength=m+y-u;let C=vs(o,A);for(n=f;n<=t;++n)p=l[n],p.bufferView=C,p.byteOffset=p.byteOffset-u;u=b?l[t+1].byteOffset:void 0,f=t+1}}}g1(e,["accessor","bufferView","buffer"])}function NUe(e){Oe.accessorWithSemantic(e,"POSITION",function(t){let n=e.accessors[t];if(!c(n.min)||!c(n.max)){let i=hx(e,n);n.min=i.min,n.max=i.max}})}function lse(e){return(!c(e.children)||e.children.length===0)&&(!c(e.meshes)||e.meshes.length===0)&&!c(e.camera)&&!c(e.skin)&&!c(e.skeletons)&&!c(e.jointName)&&(!c(e.translation)||d.fromArray(e.translation).equals(d.ZERO))&&(!c(e.scale)||d.fromArray(e.scale).equals(new d(1,1,1)))&&(!c(e.rotation)||se.fromArray(e.rotation).equals(new se(0,0,0,1)))&&(!c(e.matrix)||B.fromColumnMajorArray(e.matrix).equals(B.IDENTITY))&&!c(e.extensions)&&!c(e.extras)}function use(e,t){Oe.scene(e,function(n){let i=n.nodes;if(c(i)){let o=i.length;for(let r=o;r>=0;--r)if(i[r]===t){i.splice(r,1);return}}}),Oe.node(e,function(n,i){if(c(n.children)){let o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),lse(n)&&use(e,i))}}),delete e.nodes[t]}function FUe(e){return Oe.node(e,function(t,n){lse(t)&&use(e,n)}),e}function BUe(e){Oe.animation(e,function(t){Oe.animationSampler(t,function(n){let i=e.accessors[n.input];if(!c(i.min)||!c(i.max)){let o=hx(e,i);i.min=o.min,i.max=o.max}})})}function kUe(e){Oe.accessor(e,function(t){if(c(t.min)||c(t.max)){let n=hx(e,t);c(t.min)&&(t.min=n.min),c(t.max)&&(t.max=n.max)}})}function UUe(e){e.asset=e.asset??{},e.asset.version="2.0",cse(e),bUe(e),FUe(e),xUe(e),TUe(e),CUe(e),SUe(e),MUe(e),LUe(e),NUe(e),BUe(e),kUe(e),wUe(e),vUe(e),DUe(e),OUe(e),x1(e),RUe(e),m1(e),_1(e),AUe(e)}var VUe=["u_tex","u_diffuse","u_emission","u_diffuse_tex"],zUe=["u_diffuse","u_diffuse_mat"];function A9(e){e.pbrMetallicRoughness=c(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function C9(e){return c(e.index)}function E9(e){return Array.isArray(e)&&e.length===4}function fse(e){let t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){let i=e[n];i<=.04045?t[n]=e[n]*.07739938080495357:t[n]=Math.pow((i+.055)*.9478672985781991,2.4)}return t}function HUe(e,t){t=t??W.EMPTY_OBJECT;let n=t.baseColorTextureNames??VUe,i=t.baseColorFactorNames??zUe;Oe.material(e,function(o){Oe.materialValue(o,function(r,s){n.indexOf(s)!==-1&&C9(r)?(A9(o),o.pbrMetallicRoughness.baseColorTexture=r):i.indexOf(s)!==-1&&E9(r)&&(A9(o),o.pbrMetallicRoughness.baseColorFactor=fse(r))})}),mx(e,"KHR_techniques_webgl"),mx(e,"KHR_blend")}function x9(e,t){c(t)&&(E9(t)?e.pbrMetallicRoughness.baseColorFactor=fse(t):C9(t)&&(e.pbrMetallicRoughness.baseColorTexture=t))}function ase(e,t){c(t)&&(E9(t)?e.emissiveFactor=t.slice(0,3):C9(t)&&(e.emissiveTexture=t))}function GUe(e){Oe.material(e,function(t){let n=(t.extensions??W.EMPTY_OBJECT).KHR_materials_common;if(!c(n))return;let i=n.values??{},o=i.ambient,r=i.diffuse,s=i.emission,a=i.transparency,l=n.doubleSided,u=n.transparent;A9(t),n.technique==="CONSTANT"?(Ff(e,"KHR_materials_unlit"),t.extensions=c(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={},x9(t,s),x9(t,o)):(x9(t,r),ase(t,o),ase(t,s)),c(l)&&(t.doubleSided=l),c(a)&&(c(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=a:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,a]),c(u)&&(t.alphaMode=u?"BLEND":"OPAQUE")}),mx(e,"KHR_materials_common")}var T1=hUe;function _c(){}_c.getError=function(e,t,n){let i=`Failed to load ${e}: ${t}`;c(n)&&c(n.message)&&(i+=`
${n.message}`);let o=new ae(i);return c(n)&&(o.stack=`Original stack:
${n.stack}
Handler stack:
${o.stack}`),o};_c.getNodeTransform=function(e){return c(e.matrix)?e.matrix:B.fromTranslationQuaternionRotationScale(c(e.translation)?e.translation:d.ZERO,c(e.rotation)?e.rotation:Le.IDENTITY,c(e.scale)?e.scale:d.ONE)};_c.getAttributeBySemantic=function(e,t,n){let i=e.attributes,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=c(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};_c.getAttributeByName=function(e,t){let n=e.attributes,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.name===t)return r}};_c.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.positionalLabel===t||i.label===t)return i}};_c.hasQuantizedAttributes=function(e){if(!c(e))return!1;for(let t=0;t<e.length;t++){let n=e[t];if(c(n.quantization))return!0}return!1};_c.getAttributeInfo=function(e){let t=e.semantic,n=e.setIndex,i,o=!1;c(t)?(i=ht.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());let r=/^color_\d+$/.test(i),s=e.type,a=nn.getGlslType(s);r&&(a="vec4");let l=c(e.quantization),u;return l&&(u=r?"vec4":nn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:l,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};var jUe=new d,WUe=new d;_c.getPositionMinMax=function(e,t,n){let i=_c.getAttributeBySemantic(e,"POSITION"),o=i.max,r=i.min;return c(n)&&c(t)&&(r=d.add(r,t,WUe),o=d.add(o,n,jUe)),{min:r,max:o}};_c.getAxisCorrectionMatrix=function(e,t,n){return n=B.clone(B.IDENTITY,n),e===Fo.Y?n=B.clone(Fo.Y_UP_TO_Z_UP,n):e===Fo.X&&(n=B.clone(Fo.X_UP_TO_Z_UP,n)),t===Fo.Z&&(n=B.multiplyTransformation(n,Fo.Z_UP_TO_X_UP,n)),n};var qUe=new J;_c.getCullFace=function(e,t){if(!Me.isTriangles(t))return xi.BACK;let n=B.getMatrix3(e,qUe);return J.determinant(n)<0?xi.FRONT:xi.BACK};_c.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};_c.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_implicit_cylinder_region:!0,EXT_implicit_ellipsoid_region:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_primitive_voxels:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_implicit_shapes:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_specular:!0,KHR_materials_anisotropy:!0,KHR_materials_clearcoat:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_techniques_webgl:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};_c.checkSupportedExtensions=function(e){let t=e.length;for(let n=0;n<t;n++){let i=e[n];if(!_c.supportedExtensions[i])throw new ae(`Unsupported glTF Extension: ${i}`)}};var $t=_c;function _y(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(_y.prototype=Object.create($i.prototype),_y.prototype.constructor=_y);Object.defineProperties(_y.prototype,{cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});_y.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,c(this._gltfJson)?(this._promise=dse(this,this._gltfJson),this._promise):c(this._typedArray)?(this._promise=hse(this,this._typedArray),this._promise):(this._promise=YUe(this),this._promise))};async function YUe(e){let t;try{let n=await e._fetchGltf();if(e.isDestroyed())return;t=new Uint8Array(n)}catch(n){if(e.isDestroyed())return;S9(e,n)}return hse(e,t)}function S9(e,t){e.unload(),e._state=gt.FAILED;let n=`Failed to load glTF: ${e._gltfResource.url}`;throw e.getError(n,t)}async function XUe(e,t){if(c(t.asset)&&t.asset.version==="2.0"&&!mr(t,"KHR_techniques_webgl")&&!mr(t,"KHR_materials_common"))return Promise.resolve();let n=[];Oe.buffer(t,function(i){if(!c(i.extras._pipeline.source)&&c(i.uri)){let o=e._baseResource.getDerivedResource({url:i.uri}),s=e._resourceCache.getExternalBufferLoader({resource:o});e._bufferLoaders.push(s),n.push(s.load().then(function(){s.isDestroyed()||(i.extras._pipeline.source=s.typedArray)}))}}),await Promise.all(n),T1(t)}function KUe(e){let t=[];return Oe.buffer(e,function(n){let i=n.uri;!c(n.extras._pipeline.source)&&c(i)&&Ep(i)&&(delete n.uri,t.push(we.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function $Ue(e,t){let n=[];return Oe.buffer(t,function(i,o){let r=i.extras._pipeline.source;if(c(r)&&!c(i.uri)){let a=e._resourceCache.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:o,typedArray:r});e._bufferLoaders.push(a),n.push(a.load())}}),Promise.all(n)}async function dse(e,t){try{py(t),await KUe(t),await XUe(e,t),u1(t),await $Ue(e,t),h1(t);let n=t.asset.version;if(n!=="1.0"&&n!=="2.0")throw new ae(`Unsupported glTF version: ${n}`);let i=t.extensionsRequired;return c(i)&&$t.checkSupportedExtensions(i),e._gltf=t,e._state=gt.READY,e}catch(n){if(e.isDestroyed())return;S9(e,n)}}async function hse(e,t){let n;try{Kd(t)==="glTF"?n=d1(t):n=ir(t)}catch(i){if(e.isDestroyed())return;S9(e,i)}return dse(e,n)}_y.prototype.unload=function(){let e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)e[n]=!e[n].isDestroyed()&&this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0};_y.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};var GC=_y;var ZUe={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},Em=Object.freeze(ZUe);var So={};function QUe(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function JUe(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.typedArray=void 0,this.buffer=void 0,this.byteOffset=0,this.byteStride=void 0}function eVe(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function tVe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.setIndex=void 0,this.label=void 0,this.positionalLabel=void 0}function nVe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.offset=0,this.repeat=void 0,this.label=void 0,this.positionalLabel=void 0}function iVe(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.textureReader=void 0,this.label=void 0,this.positionalLabel=void 0}function oVe(){this.attributes=[]}function rVe(){this.attributes=[],this.morphTargets=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIds=[],this.propertyTextureIds=[],this.propertyAttributeIds=[],this.outlineCoordinates=void 0}function sVe(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function aVe(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function cVe(){this.name=void 0,this.index=void 0,this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0,this.morphWeights=[],this.articulationName=void 0}function lVe(){this.nodes=[]}var uVe={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function fVe(){this.input=[],this.interpolation=void 0,this.output=[]}function dVe(){this.node=void 0,this.path=void 0}function hVe(){this.sampler=void 0,this.target=void 0}function mVe(){this.name=void 0,this.samplers=[],this.channels=[]}function pVe(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function _Ve(){this.name=void 0,this.stages=[]}function mse(){this.credits=[]}function gVe(){this.asset=new mse,this.scene=void 0,this.nodes=[],this.skins=[],this.animations=[],this.articulations=[],this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=B.clone(B.IDENTITY),this.extensions={}}function yVe(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=J.clone(J.IDENTITY),this.scale=1,this.channels=void 0}function gy(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=se.clone(gy.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=gy.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=gy.DEFAULT_ROUGHNESS_FACTOR}gy.DEFAULT_BASE_COLOR_FACTOR=se.ONE;gy.DEFAULT_METALLIC_FACTOR=1;gy.DEFAULT_ROUGHNESS_FACTOR=1;function px(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=se.clone(px.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=d.clone(px.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=px.DEFAULT_GLOSSINESS_FACTOR}px.DEFAULT_DIFFUSE_FACTOR=se.ONE;px.DEFAULT_SPECULAR_FACTOR=d.ONE;px.DEFAULT_GLOSSINESS_FACTOR=1;function A1(){this.specularFactor=A1.DEFAULT_SPECULAR_FACTOR,this.specularTexture=void 0,this.specularColorFactor=d.clone(A1.DEFAULT_SPECULAR_COLOR_FACTOR),this.specularColorTexture=void 0}A1.DEFAULT_SPECULAR_FACTOR=1;A1.DEFAULT_SPECULAR_COLOR_FACTOR=d.ONE;function C1(){this.anisotropyStrength=C1.DEFAULT_ANISOTROPY_STRENGTH,this.anisotropyRotation=C1.DEFAULT_ANISOTROPY_ROTATION,this.anisotropyTexture=void 0}C1.DEFAULT_ANISOTROPY_STRENGTH=0;C1.DEFAULT_ANISOTROPY_ROTATION=0;function E1(){this.clearcoatFactor=E1.DEFAULT_CLEARCOAT_FACTOR,this.clearcoatTexture=void 0,this.clearcoatRoughnessFactor=E1.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR,this.clearcoatRoughnessTexture=void 0,this.clearcoatNormalTexture=void 0}E1.DEFAULT_CLEARCOAT_FACTOR=0;E1.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR=0;function w9(){this.metallicRoughness=new gy,this.specularGlossiness=void 0,this.specular=void 0,this.anisotropy=void 0,this.clearcoat=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=d.clone(w9.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=Em.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}w9.DEFAULT_EMISSIVE_FACTOR=d.ZERO;So.Quantization=QUe;So.Attribute=JUe;So.Indices=eVe;So.FeatureIdAttribute=tVe;So.FeatureIdTexture=iVe;So.FeatureIdImplicitRange=nVe;So.MorphTarget=oVe;So.Primitive=rVe;So.Instances=sVe;So.Skin=aVe;So.Node=cVe;So.Scene=lVe;So.AnimatedPropertyType=Object.freeze(uVe);So.AnimationSampler=fVe;So.AnimationTarget=dVe;So.AnimationChannel=hVe;So.Animation=mVe;So.ArticulationStage=pVe;So.Articulation=_Ve;So.Asset=mse;So.Components=gVe;So.TextureReader=yVe;So.MetallicRoughness=gy;So.SpecularGlossiness=px;So.Specular=A1;So.Anisotropy=C1;So.Clearcoat=E1;So.Material=w9;var Tn=So;var az={};az.getImageIdFromTexture=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,textureId:n,supportedImageFormats:i}=e;T.typeOf.object("options.gltf",t),T.typeOf.number("options.textureId",n),T.typeOf.object("options.supportedImageFormats",i);let o=t.textures[n],r=o.extensions;if(c(r)){if(i.webp&&c(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&c(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source};az.createSampler=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,textureInfo:n,compressedTextureNoMipmap:i=!1}=e;T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n);let o=gn.REPEAT,r=gn.REPEAT,s=Yt.LINEAR,a=li.LINEAR,l=n.index,f=t.textures[l].sampler;if(c(f)){let h=t.samplers[f];o=h.wrapS??o,r=h.wrapT??r,s=h.minFilter??s,a=h.magFilter??a}return i&&s!==Yt.LINEAR&&s!==Yt.NEAREST&&(s===Yt.NEAREST_MIPMAP_NEAREST||s===Yt.NEAREST_MIPMAP_LINEAR?s=Yt.NEAREST:s=Yt.LINEAR),new Qt({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};var bVe=new H(1,1);az.createModelTextureReader=function(e){e=e??W.EMPTY_OBJECT;let{textureInfo:t,channels:n,texture:i}=e;T.typeOf.object("options.textureInfo",t);let o=t.texCoord??0,r,s=t.extensions?.KHR_texture_transform;if(c(s)){o=s.texCoord??o;let l=c(s.offset)?H.unpack(s.offset):H.ZERO,u=s.rotation??0,f=c(s.scale)?H.unpack(s.scale):bVe;u=-u,r=new J(Math.cos(u)*f.x,-Math.sin(u)*f.y,l.x,Math.sin(u)*f.x,Math.cos(u)*f.y,l.y,0,0,1)}let a=new Tn.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.scale=t.scale,a.transform=r,a.channels=n,a};var Vl=az;function xVe(e){let t=document.createElement("canvas");return t.width=O.nextPowerOfTwo(e.width),t.height=O.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}var yy=xVe;function by(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,l=e.asynchronous??!0;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.textureInfo",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),T.typeOf.object("options.supportedImageFormats",s);let u=i.index,f=Vl.getImageIdFromTexture({gltf:n,textureId:u,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=f,this._gltfResource=o,this._baseResource=r,this._cacheKey=a,this._asynchronous=l,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(by.prototype=Object.create($i.prototype),by.prototype.constructor=by);Object.defineProperties(by.prototype,{cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});var TVe=new v9;async function AVe(e){let t=e._resourceCache;try{let n=t.getImageLoader({gltf:e._gltf,imageId:e._imageId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._imageLoader=n,await n.load(),e.isDestroyed()?void 0:(e._image=n.image,e._mipLevels=n.mipLevels,e._state=gt.LOADED,e)}catch(n){if(e.isDestroyed())return;throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load texture",n)}}by.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,this._promise=AVe(this),this._promise)};function v9(){this.gltf=void 0,this.textureInfo=void 0,this.textureId=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}v9.prototype.set=function(e,t,n,i,o,r){this.gltf=e,this.textureInfo=t,this.textureId=n,this.image=i,this.mipLevels=o,this.context=r};v9.prototype.execute=function(){this.texture=pse(this.gltf,this.textureInfo,this.textureId,this.image,this.mipLevels,this.context)};function pse(e,t,n,i,o,r){let s=i.internalFormat,a=!1;ke.isCompressedFormat(s)&&!c(o)&&(a=!0);let l=Vl.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:a}),u=l.minificationFilter,f=l.wrapS,h=l.wrapT,p=u===Yt.NEAREST_MIPMAP_NEAREST||u===Yt.NEAREST_MIPMAP_LINEAR||u===Yt.LINEAR_MIPMAP_NEAREST||u===Yt.LINEAR_MIPMAP_LINEAR,g=!c(s)&&p,m=g||f===gn.REPEAT||f===gn.MIRRORED_REPEAT||h===gn.REPEAT||h===gn.MIRRORED_REPEAT,y=!O.isPowerOfTwo(i.width)||!O.isPowerOfTwo(i.height),b=m&&y,x;return c(s)?(!r.webgl2&&ke.isCompressedFormat(s)&&y&&m&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),x=Rt.create({id:n,context:r,source:{arrayBufferView:i.bufferView,mipLevels:o},width:i.width,height:i.height,pixelFormat:i.internalFormat,sampler:l})):(b&&(i=yy(i)),x=Rt.create({id:n,context:r,source:i,sampler:l,flipY:!1,skipColorSpaceConversion:!0})),g&&x.generateMipmap(),x}by.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.LOADED&&this._state!==gt.PROCESSING||c(this._texture)||!c(this._image))return!1;this._state=gt.PROCESSING;let t;if(this._asynchronous){let n=TVe;if(n.set(this._gltf,this._textureInfo,this._cacheKey,this._image,this._mipLevels,e.context),!e.jobScheduler.execute(n,pa.TEXTURE))return;t=n.texture}else t=pse(this._gltf,this._textureInfo,this._cacheKey,this._image,this._mipLevels,e.context);return this.unload(),this._texture=t,this._state=gt.READY,this._resourceCache.statistics.addTextureLoader(this),!0};by.prototype.unload=function(){c(this._texture)&&this._texture.destroy(),c(this._imageLoader)&&!this._imageLoader.isDestroyed()&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0};var jC=by;function xy(e){e=e??W.EMPTY_OBJECT;let t=e.resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.primitive,a=e.draco,l=e.attributeSemantic,u=e.accessorId,f=e.cacheKey,h=e.asynchronous??!0,p=e.loadBuffer??!1,g=e.loadTypedArray??!1;if(T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),!p&&!g)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let m=c(r),y=c(s),b=_se(a,l),x=c(l),A=c(u);if(m===b)throw new E("One of options.bufferViewId and options.draco must be defined.");if(b&&!x)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(b&&!A)throw new E("When options.draco is defined options.accessorId must also be defined.");if(b&&!y)throw new E("When options.draco is defined options.primitive must also be defined.");b&&(T.typeOf.object("options.primitive",s),T.typeOf.object("options.draco",a),T.typeOf.string("options.attributeSemantic",l),T.typeOf.number("options.accessorId",u)),this._resourceCache=t,this._gltfResource=i,this._baseResource=o,this._gltf=n,this._bufferViewId=r,this._primitive=s,this._draco=a,this._attributeSemantic=l,this._accessorId=u,this._cacheKey=f,this._asynchronous=h,this._loadBuffer=p,this._loadTypedArray=g,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(xy.prototype=Object.create($i.prototype),xy.prototype.constructor=xy);Object.defineProperties(xy.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}});function _se(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}xy.prototype.load=async function(){return c(this._promise)?this._promise:_se(this._draco,this._attributeSemantic)?(this._promise=EVe(this),this._promise):(this._promise=wVe(this),this._promise)};function CVe(e,t,n,i){let r=(1<<e.quantizationBits)-1,s=1/r,a=new Tn.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=nn.VEC2,a.normalizationRange=r;else{let l=nn.getMathType(i);if(l===Number){let u=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=u,a.normalizationRange=r,a.quantizedVolumeStepSize=u*s}else{a.quantizedVolumeOffset=l.unpack(e.minValues),a.normalizationRange=l.unpack(new Array(n).fill(r));let u=new Array(n).fill(e.range);a.quantizedVolumeDimensions=l.unpack(u);let f=u.map(function(h){return h*s});a.quantizedVolumeStepSize=l.unpack(f)}}return a}async function EVe(e){e._state=gt.LOADING;let t=e._resourceCache;try{let n=t.getDracoLoader({gltf:e._gltf,primitive:e._primitive,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,await n.load(),e.isDestroyed()?void 0:(e._state=gt.LOADED,e)}catch{if(e.isDestroyed())return;D9(e)}}function SVe(e){e._state=gt.PROCESSING;let n=e._dracoLoader.decodedData.vertexAttributes,i=e._attributeSemantic,o=n[i],r=e._accessorId,a=e._gltf.accessors[r].type,l=o.array,u=o.data.quantization;c(u)&&(e._quantization=CVe(u,o.data.componentDatatype,o.data.componentsPerAttribute,a)),e._typedArray=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)}async function wVe(e){e._state=gt.LOADING;let t=e._resourceCache;try{let n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,await n.load(),e.isDestroyed()?void 0:(e._typedArray=n.typedArray,e._state=gt.PROCESSING,e)}catch(n){if(e.isDestroyed())return;D9(e,n)}}function D9(e,t){throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load vertex buffer",t)}function P9(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}P9.prototype.set=function(e,t){this.typedArray=e,this.context=t};P9.prototype.execute=function(){this.buffer=gse(this.typedArray,this.context)};function gse(e,t){let n=yt.createVertexBuffer({typedArray:e,context:t,usage:Be.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}var vVe=new P9;xy.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.LOADED&&this._state!==gt.PROCESSING)return!1;if(c(this._dracoLoader)){try{if(!this._dracoLoader.process(e))return!1}catch(i){D9(this,i)}SVe(this)}let t,n=this._typedArray;if(this._loadBuffer&&this._asynchronous){let i=vVe;if(i.set(n,e.context),!e.jobScheduler.execute(i,pa.BUFFER))return!1;t=i.buffer}else this._loadBuffer&&(t=gse(n,e.context));return this.unload(),this._buffer=t,this._typedArray=this._loadTypedArray?n:void 0,this._state=gt.READY,this._resourceCache.statistics.addGeometryLoader(this),!0};xy.prototype.unload=function(){c(this._buffer)&&this._buffer.destroy();let e=this._resourceCache;c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),c(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0,this._primitive=void 0};var WC=xy;function S1(e){e=e??W.EMPTY_OBJECT;let t=e.id;T.typeOf.string("options.id",t);let n=e.properties??{},i={};for(let o in n)if(n.hasOwnProperty(o)){let r=n[o];c(r.semantic)&&(i[r.semantic]=r)}this._id=t,this._name=e.name,this._description=e.description,this._properties=n,this._propertiesBySemantic=i,this._extras=je(e.extras,!0),this._extensions=je(e.extensions,!0)}S1.fromJson=function(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.class;T.typeOf.string("options.id",t),T.typeOf.object("options.class",n);let i={};for(let o in n.properties)if(n.properties.hasOwnProperty(o)){let r=Tm.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new S1({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(S1.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});S1.BATCH_TABLE_CLASS_NAME="_batchTable";var Qd=S1;function cz(e){e=e??W.EMPTY_OBJECT;let t=e.value,n=e.name;T.typeOf.number("options.value",t),T.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=je(e.extras,!0),this._extensions=je(e.extensions,!0)}cz.fromJson=function(e){return T.typeOf.object("value",e),new cz({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(cz.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var w1=cz;function lz(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.values;T.typeOf.string("options.id",t),T.defined("options.values",n);let i={},o={},r=n.length;for(let a=0;a<r;++a){let l=n[a];i[l.value]=l.name,o[l.name]=l.value}let s=e.valueType??Nt.UINT16;this._values=n,this._namesByValue=i,this._valuesByName=o,this._valueType=s,this._id=t,this._name=e.name,this._description=e.description,this._extras=je(e.extras,!0),this._extensions=je(e.extensions,!0)}lz.fromJson=function(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.enum;T.typeOf.string("options.id",t),T.typeOf.object("options.enum",n);let i=n.values.map(function(o){return w1.fromJson(o)});return new lz({id:t,values:i,valueType:Nt[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(lz.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var v1=lz;function uz(e){e=e??W.EMPTY_OBJECT;let t=e.classes??{},n=e.enums??{};this._classes=t,this._enums=n,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=je(e.extras,!0),this._extensions=je(e.extensions,!0)}uz.fromJson=function(e){T.typeOf.object("schema",e);let t={};if(c(e.enums))for(let i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=v1.fromJson({id:i,enum:e.enums[i]}));let n={};if(c(e.classes))for(let i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=Qd.fromJson({id:i,class:e.classes[i],enums:t}));return new uz({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(uz.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var vu=uz;function _x(e){e=e??W.EMPTY_OBJECT;let t=e.schema,n=e.resource,i=e.cacheKey;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");this._schema=c(t)?vu.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(_x.prototype=Object.create($i.prototype),_x.prototype.constructor=_x);Object.defineProperties(_x.prototype,{cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});_x.prototype.load=async function(){return c(this._promise)?this._promise:c(this._schema)?(this._promise=Promise.resolve(this),this._promise):(this._promise=DVe(this),this._promise)};async function DVe(e){let t=e._resource;e._state=gt.LOADING;try{let n=await t.fetchJson();return e.isDestroyed()?void 0:(e._schema=vu.fromJson(n),e._state=gt.READY,e)}catch(n){if(e.isDestroyed())return;e._state=gt.FAILED;let i=`Failed to load schema: ${t.url}`;throw e.getError(i,n)}}_x.prototype.unload=function(){this._schema=void 0};var qC=_x;var Jd={};function YC(e){return om(e.url)}function fz(e){let{byteOffset:t,byteLength:n}=e;if(oi(e,"EXT_meshopt_compression")){let i=e.extensions.EXT_meshopt_compression;t=i.byteOffset??0,n=i.byteLength}return`${t}-${t+n}`}function PVe(e,t){let n=t.byteOffset+e.byteOffset,{componentType:i,type:o,count:r}=e;return`${n}-${i}-${o}-${r}`}function yse(e,t){return`${YC(e)}-buffer-id-${t}`}function D1(e,t,n,i){if(c(e.uri)){let o=i.getDerivedResource({url:e.uri});return YC(o)}return yse(n,t)}function I9(e,t,n,i){let o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],l=D1(a,s,n,i),u=fz(r);return`${l}-range-${u}`}function bse(e,t,n,i){let o=e.images[t],r=o.bufferView,s=o.uri;if(c(s)){let p=i.getDerivedResource({url:s});return YC(p)}let a=e.bufferViews[r],l=a.buffer,u=e.buffers[l],f=D1(u,l,n,i),h=fz(a);return`${f}-range-${h}`}function IVe(e,t){let n=Vl.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}Jd.getSchemaCacheKey=function(e){let{schema:t,resource:n}=e;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");return c(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${YC(n)}`};Jd.getExternalBufferCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{resource:t}=e;return T.typeOf.object("options.resource",t),`external-buffer:${YC(t)}`};Jd.getEmbeddedBufferCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{parentResource:t,bufferId:n}=e;return T.typeOf.object("options.parentResource",t),T.typeOf.number("options.bufferId",n),`embedded-buffer:${yse(t,n)}`};Jd.getGltfCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltfResource:t}=e;return T.typeOf.object("options.gltfResource",t),`gltf:${YC(t)}`};Jd.getBufferViewCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,bufferViewId:n,gltfResource:i,baseResource:o}=e;T.typeOf.object("options.gltf",t),T.typeOf.number("options.bufferViewId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);let r=t.bufferViews[n],s=r.buffer,a=t.buffers[s];oi(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);let l=D1(a,s,i,o),u=fz(r);return`buffer-view:${l}-range-${u}`};Jd.getDracoCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,draco:n,gltfResource:i,baseResource:o}=e;return T.typeOf.object("options.gltf",t),T.typeOf.object("options.draco",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),`draco:${I9(t,n,i,o)}`};Jd.getVertexBufferCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:l=!1,loadBuffer:u=!1,loadTypedArray:f=!1}=e;T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),T.typeOf.object("options.frameState",o);let h=c(r),p=OVe(s,a),g=c(a);if(h===p)throw new E("One of options.bufferViewId and options.draco must be defined.");if(p&&!g)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(p&&(T.typeOf.object("options.draco",s),T.typeOf.string("options.attributeSemantic",a)),!u&&!f)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let m="";if(l&&(m+="-dequantize"),u&&(m+="-buffer",m+=`-context-${o.context.id}`),f&&(m+="-typed-array"),c(s))return`vertex-buffer:${I9(t,s,n,i)}-draco-${a}${m}`;let y=t.bufferViews[r],b=y.buffer,x=t.buffers[b],A=D1(x,b,n,i),C=fz(y);return`vertex-buffer:${A}-range-${C}${m}`};function OVe(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}Jd.getIndexBufferCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:a=!1,loadTypedArray:l=!1}=e;if(T.typeOf.object("options.gltf",t),T.typeOf.number("options.accessorId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.frameState",r),!a&&!l)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let u="";if(a&&(u+="-buffer",u+=`-context-${r.context.id}`),l&&(u+="-typed-array"),c(s))return`index-buffer:${I9(t,s,i,o)}-draco${u}`;let f=t.accessors[n],h=f.bufferView,p=t.bufferViews[h],g=p.buffer,m=t.buffers[g],y=D1(m,g,i,o),b=PVe(f,p);return`index-buffer:${y}-accessor-${b}${u}`};Jd.getImageCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,imageId:n,gltfResource:i,baseResource:o}=e;return T.typeOf.object("options.gltf",t),T.typeOf.number("options.imageId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),`image:${bse(t,n,i,o)}`};Jd.getTextureCacheKey=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s}=e;T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.supportedImageFormats",r),T.typeOf.object("options.frameState",s);let a=n.index,l=Vl.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),u=bse(t,l,i,o),f=IVe(t,n);return`texture:${u}-sampler-${f}-context-${s.context.id}`};var zl=Jd;function P1(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}P1.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};P1.prototype.addGeometryLoader=function(e){T.typeOf.object("loader",e);let t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;let n=e.buffer,i=e.typedArray,o=0;c(n)&&(o+=n.sizeInBytes),c(i)&&(o+=i.byteLength),this.geometryByteLength+=o,this._geometrySizes[t]=o};P1.prototype.addTextureLoader=function(e){T.typeOf.object("loader",e);let t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;let n=e.texture.sizeInBytes;this.texturesByteLength+=e.texture.sizeInBytes,this._textureSizes[t]=n};P1.prototype.removeLoader=function(e){T.typeOf.object("loader",e);let t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],c(n)&&(this.geometryByteLength-=n);let i=this._textureSizes[t];delete this._textureSizes[t],c(i)&&(this.texturesByteLength-=i)};var I1=P1;function Mn(){}Mn.cacheEntries={};Mn.statistics=new I1;function RVe(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}Mn.get=function(e){T.typeOf.string("cacheKey",e);let t=Mn.cacheEntries[e];if(c(t))return++t.referenceCount,t.resourceLoader};Mn.add=function(e){T.typeOf.object("resourceLoader",e);let t=e.cacheKey;if(T.typeOf.string("options.resourceLoader.cacheKey",t),c(Mn.cacheEntries[t]))throw new E(`Resource with this cacheKey is already in the cache: ${t}`);return Mn.cacheEntries[t]=new RVe(e),e};Mn.unload=function(e){T.typeOf.object("resourceLoader",e);let t=e.cacheKey,n=Mn.cacheEntries[t];if(!c(n))throw new E(`Resource is not in the cache: ${t}`);--n.referenceCount,n.referenceCount===0&&(Mn.statistics.removeLoader(e),e.destroy(),delete Mn.cacheEntries[t])};Mn.getSchemaLoader=function(e){e=e??W.EMPTY_OBJECT;let{schema:t,resource:n}=e;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");let i=zl.getSchemaCacheKey({schema:t,resource:n}),o=Mn.get(i);return c(o)?o:(o=new qC({schema:t,resource:n,cacheKey:i}),Mn.add(o))};Mn.getEmbeddedBufferLoader=function(e){e=e??W.EMPTY_OBJECT;let{parentResource:t,bufferId:n,typedArray:i}=e;T.typeOf.object("options.parentResource",t),T.typeOf.number("options.bufferId",n);let o=zl.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n}),r=Mn.get(o);return c(r)?r:(T.typeOf.object("options.typedArray",i),r=new ax({typedArray:i,cacheKey:o}),Mn.add(r))};Mn.getExternalBufferLoader=function(e){e=e??W.EMPTY_OBJECT;let{resource:t}=e;T.typeOf.object("options.resource",t);let n=zl.getExternalBufferCacheKey({resource:t}),i=Mn.get(n);return c(i)?i:(i=new ax({resource:t,cacheKey:n}),Mn.add(i))};Mn.getGltfJsonLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltfResource:t,baseResource:n,typedArray:i,gltfJson:o}=e;T.typeOf.object("options.gltfResource",t),T.typeOf.object("options.baseResource",n);let r=zl.getGltfCacheKey({gltfResource:t}),s=Mn.get(r);return c(s)?s:(s=new GC({resourceCache:Mn,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),Mn.add(s))};Mn.getBufferViewLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,bufferViewId:n,gltfResource:i,baseResource:o}=e;T.typeOf.object("options.gltf",t),T.typeOf.number("options.bufferViewId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);let r=zl.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o}),s=Mn.get(r);return c(s)?s:(s=new kC({resourceCache:Mn,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),Mn.add(s))};Mn.getDracoLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,primitive:n,draco:i,gltfResource:o,baseResource:r}=e;T.typeOf.object("options.gltf",t),T.typeOf.object("options.primitive",n),T.typeOf.object("options.draco",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r);let s=zl.getDracoCacheKey({gltf:t,draco:i,gltfResource:o,baseResource:r}),a=Mn.get(s);return c(a)?a:(a=new UC({resourceCache:Mn,gltf:t,primitive:n,draco:i,gltfResource:o,baseResource:r,cacheKey:s}),Mn.add(a))};Mn.getVertexBufferLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,primitive:s,draco:a,attributeSemantic:l,accessorId:u,asynchronous:f=!0,dequantize:h=!1,loadBuffer:p=!1,loadTypedArray:g=!1}=e;if(T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),T.typeOf.object("options.frameState",o),!p&&!g)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let m=c(r),y=c(s),b=MVe(a,l),x=c(l),A=c(u);if(m===b)throw new E("One of options.bufferViewId and options.draco must be defined.");if(b&&!x)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(b&&!A)throw new E("When options.draco is defined options.haAccessorId must also be defined.");if(b&&!y)throw new E("When options.draco is defined options.primitive must also be defined.");b&&(T.typeOf.object("options.draco",a),T.typeOf.string("options.attributeSemantic",l),T.typeOf.number("options.accessorId",u));let C=zl.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:a,attributeSemantic:l,dequantize:h,loadBuffer:p,loadTypedArray:g}),S=Mn.get(C);return c(S)?S:(S=new WC({resourceCache:Mn,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,primitive:s,draco:a,attributeSemantic:l,accessorId:u,cacheKey:C,asynchronous:f,dequantize:h,loadBuffer:p,loadTypedArray:g}),Mn.add(S))};function MVe(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}Mn.getIndexBufferLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,primitive:s,draco:a,asynchronous:l=!0,loadBuffer:u=!1,loadTypedArray:f=!1}=e;if(T.typeOf.object("options.gltf",t),T.typeOf.number("options.accessorId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.frameState",r),!u&&!f)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let h=zl.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:a,loadBuffer:u,loadTypedArray:f}),p=Mn.get(h);return c(p)?p:(p=new zC({resourceCache:Mn,gltf:t,accessorId:n,gltfResource:i,baseResource:o,primitive:s,draco:a,cacheKey:h,asynchronous:l,loadBuffer:u,loadTypedArray:f}),Mn.add(p))};Mn.getImageLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,imageId:n,gltfResource:i,baseResource:o}=e;T.typeOf.object("options.gltf",t),T.typeOf.number("options.imageId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);let r=zl.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o}),s=Mn.get(r);return c(s)?s:(s=new VC({resourceCache:Mn,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),Mn.add(s))};Mn.getTextureLoader=function(e){e=e??W.EMPTY_OBJECT;let{gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a=!0}=e;T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.supportedImageFormats",r),T.typeOf.object("options.frameState",s);let l=zl.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s}),u=Mn.get(l);return c(u)?u:(u=new jC({resourceCache:Mn,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:l,asynchronous:a}),Mn.add(u))};Mn.clearForSpecs=function(){let e=[WC,zC,UC,jC,VC,kC,ax,qC,GC],t,n=Mn.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort(function(r,s){let a=e.indexOf(r.resourceLoader.constructor),l=e.indexOf(s.resourceLoader.constructor);return a-l});let o=i.length;for(let r=0;r<o;++r){let s=i[r];t=s.resourceLoader.cacheKey,c(n[t])&&(s.resourceLoader.destroy(),delete n[t])}Mn.statistics.clear()};var vi=Mn;function _a(e,t,n){T.typeOf.object("resource",e),T.typeOf.object("implicitTileset",t),T.typeOf.object("implicitCoordinates",n),this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=n,this._subtreeLevels=t.subtreeLevels,this._subdivisionScheme=t.subdivisionScheme,this._branchingFactor=t.branchingFactor,this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],this._ready=!1}Object.defineProperties(_a.prototype,{ready:{get:function(){return this._ready}},metadata:{get:function(){return this._metadata}},tileMetadataTable:{get:function(){return this._tileMetadataTable}},tilePropertyTableJson:{get:function(){return this._tilePropertyTableJson}},contentMetadataTables:{get:function(){return this._contentMetadataTables}},contentPropertyTableJsons:{get:function(){return this._contentPropertyTableJsons}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}});_a.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};_a.prototype.tileIsAvailableAtCoordinates=function(e){let t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};_a.prototype.contentIsAvailableAtIndex=function(e,t){if(t=t??0,t<0||t>=this._contentAvailabilityBitstreams.length)throw new E("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)};_a.prototype.contentIsAvailableAtCoordinates=function(e,t){let n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};_a.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};_a.prototype.childSubtreeIsAvailableAtCoordinates=function(e){let t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};_a.prototype.getLevelOffset=function(e){let t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};_a.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===or.OCTREE&&(t=3),e>>t};_a.fromSubtreeJson=async function(e,t,n,i,o){if(T.typeOf.object("resource",e),c(t)===c(n))throw new E("One of json and subtreeView must be defined.");T.typeOf.object("implicitTileset",i),T.typeOf.object("implicitCoordinates",o);let r=new _a(e,i,o),s;c(t)?s={json:t,binary:void 0}:s=LVe(n);let a=s.json;r._subtreeJson=a;let l;if(oi(a,"3DTILES_metadata"))l=a.extensions["3DTILES_metadata"];else if(c(a.tileMetadata)){let A=a.tileMetadata;l=a.propertyTables[A]}let u=[];if(c(a.contentMetadata)){let A=a.contentMetadata.length;for(let C=0;C<A;C++){let S=a.contentMetadata[C];u.push(a.propertyTables[S])}}let f,h=i.metadataSchema,p=a.subtreeMetadata;if(c(p)){let A=p.class,C=h.classes[A];f=new i1({subtreeMetadata:p,class:C})}r._metadata=f,r._tilePropertyTableJson=l,r._contentPropertyTableJsons=u;let g={constant:0};a.contentAvailabilityHeaders=[],oi(a,"3DTILES_multiple_contents")?a.contentAvailabilityHeaders=a.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(a.contentAvailability)?a.contentAvailabilityHeaders=a.contentAvailability:a.contentAvailabilityHeaders.push(a.contentAvailability??g);let m=NVe(a.buffers),y=FVe(a.bufferViews,m);BVe(a,y),c(l)&&xse(l,y);for(let A=0;A<u.length;A++){let C=u[A];xse(C,y)}let b=await kVe(r,m,s.binary),x=VVe(y,b);return zVe(r,a,i,x),c(l)&&(HVe(r,i,x),jVe(r)),GVe(r,i,x),WVe(r),r._ready=!0,r};function LVe(e){let n=new DataView(e.buffer,e.byteOffset),i=8,o=n.getUint32(i,!0);i+=8;let r=n.getUint32(i,!0);i+=8;let s=ir(e,i,o);i+=o;let a=e.subarray(i,i+r);return{json:s,binary:a}}function NVe(e){e=c(e)?e:[];for(let t=0;t<e.length;t++){let n=e[t];n.isExternal=c(n.uri),n.isActive=!1}return e}function FVe(e,t){e=c(e)?e:[];for(let n=0;n<e.length;n++){let i=e[n],o=t[i.buffer];i.bufferHeader=o,i.isActive=!1}return e}function BVe(e,t){let n,i=e.tileAvailability;c(i.bitstream)?n=t[i.bitstream]:c(i.bufferView)&&(n=t[i.bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);let o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,c(o[s].bitstream)?n=t[o[s].bitstream]:c(o[s].bufferView)&&(n=t[o[s].bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;let r=e.childSubtreeAvailability;c(r.bitstream)?n=t[r.bitstream]:c(r.bufferView)&&(n=t[r.bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}function xse(e,t){let n=e.properties,i;for(let o in n)if(n.hasOwnProperty(o)){let r=n[o],s=r.values??r.bufferView;i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0;let a=r.stringOffsets??r.stringOffsetBufferView;c(a)&&(i=t[a],i.isActive=!0,i.bufferHeader.isActive=!0);let l=r.arrayOffsets??r.arrayOffsetBufferView;c(l)&&(i=t[l],i.isActive=!0,i.bufferHeader.isActive=!0)}}function kVe(e,t,n){let i=[];for(let o=0;o<t.length;o++){let r=t[o];if(!r.isActive)i.push(Promise.resolve(void 0));else if(r.isExternal){let s=UVe(e,r);i.push(s)}else i.push(Promise.resolve(n))}return Promise.all(i).then(function(o){let r={};for(let s=0;s<o.length;s++){let a=o[s];c(a)&&(r[s]=a)}return r})}async function UVe(e,t){let i=e._resource.getDerivedResource({url:t.uri}),o=vi.getExternalBufferLoader({resource:i});e._bufferLoader=o;try{await o.load()}catch(r){if(o.isDestroyed())return;throw r}return o.typedArray}function VVe(e,t){let n={};for(let i=0;i<e.length;i++){let o=e[i];if(!o.isActive)continue;let r=o.byteOffset,s=r+o.byteLength,l=t[o.buffer].subarray(r,s);n[i]=l}return n}function zVe(e,t,n,i){let o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),l=oi(t,"3DTILES_metadata"),u=c(e._tilePropertyTableJson),f=l||u;e._tileAvailability=O9(t.tileAvailability,i,s,f);let h=e._contentPropertyTableJsons.length>0;f=f||h;for(let p=0;p<t.contentAvailabilityHeaders.length;p++){let g=O9(t.contentAvailabilityHeaders[p],i,s,f);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=O9(t.childSubtreeAvailability,i,a)}function O9(e,t,n,i){if(c(e.constant))return new FC({constant:!!e.constant,lengthBits:n,availableCount:e.availableCount});let o;return c(e.bitstream)?o=t[e.bitstream]:c(e.bufferView)&&(o=t[e.bufferView]),new FC({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function HVe(e,t,n){let i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new Nf({class:a,count:o,properties:i.properties,bufferViews:n})}function GVe(e,t,n){let i=e._contentPropertyTableJsons,o=e._contentAvailabilityBitstreams,r=t.metadataSchema,s=e._contentMetadataTables;for(let a=0;a<i.length;a++){let l=i[a],f=o[a].availableCount,h=l.class,p=r.classes[h],g=new Nf({class:p,count:f,properties:l.properties,bufferViews:n});s.push(g)}}function Tse(e){let t=0,n=e.lengthBits,i=e.availableCount,o;i<256?o=new Uint8Array(n):i<65536?o=new Uint16Array(n):o=new Uint32Array(n);for(let r=0;r<e.lengthBits;r++)e.getBit(r)&&(o[r]=t,t++);return o}function jVe(e){let t=Tse(e._tileAvailability);e._tileJumpBuffer=t}function WVe(e){let t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){let o=n[i],r=Tse(o);t.push(r)}}_a.prototype.getTileIndex=function(e){let t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new ae("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};_a.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new ae("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function qVe(e,t){if(!c(e._tileMetadataTable))return;let n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function YVe(e,t,n){let i=e._contentMetadataTables;if(!c(i))return;let o=i[n];if(!c(o))return;let r=e._contentAvailabilityBitstreams[n],s=e.getTileIndex(t);if(r.getBit(s))return e._contentJumpBuffers[n][s]}_a.prototype.getTileMetadataView=function(e){let t=qVe(this,e);if(!c(t))return;let n=this._tileMetadataTable;return new BC({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};_a.prototype.getContentMetadataView=function(e,t){let n=YVe(this,e,t);if(!c(n))return;let i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new BC({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};_a.prototype.isDestroyed=function(){return!1};_a.prototype.destroy=function(){return c(this._bufferLoader)&&vi.unload(this._bufferLoader),de(this)};var gx=_a;var XVe={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILESET_TILE_COUNT:"TILESET_TILE_COUNT",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"},yx=Object.freeze(XVe);var eh={};eh.parseAllBoundingVolumeSemantics=function(e){return T.typeOf.object("tileMetadata",e),{tile:{boundingVolume:eh.parseBoundingVolumeSemantic("TILE",e),minimumHeight:eh._parseMinimumHeight("TILE",e),maximumHeight:eh._parseMaximumHeight("TILE",e)},content:{boundingVolume:eh.parseBoundingVolumeSemantic("CONTENT",e),minimumHeight:eh._parseMinimumHeight("CONTENT",e),maximumHeight:eh._parseMaximumHeight("CONTENT",e)}}};eh.parseBoundingVolumeSemantic=function(e,t){if(T.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");T.typeOf.object("tileMetadata",t);let n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(c(i))return{box:i};let o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(c(r))return{region:r};let s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);if(c(a))return{sphere:a}};eh._parseMinimumHeight=function(e,t){if(T.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");T.typeOf.object("tileMetadata",t);let n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)};eh._parseMaximumHeight=function(e,t){if(T.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");T.typeOf.object("tileMetadata",t);let n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)};var bx=eh;function tl(e,t,n){T.defined("tile.implicitTileset",t.implicitTileset),T.defined("tile.implicitCoordinates",t.implicitCoordinates);let i=t.implicitTileset,o=t.implicitCoordinates;this._implicitTileset=i,this._implicitCoordinates=o,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=n,this._metadata=void 0,this.featurePropertiesDirty=!1,this._group=void 0;let r=o.getTemplateValues(),s=i.subtreeUriTemplate.getDerivedResource({templateValues:r});this._url=s.getUrlComponent(!0),this._ready=!1}Object.defineProperties(tl.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){throw new E("Implicit3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});tl.fromSubtreeJson=async function(e,t,n,i,o,r){if(T.defined("tile.implicitTileset",t.implicitTileset),T.defined("tile.implicitCoordinates",t.implicitCoordinates),c(i)===c(o))throw new E("One of json and arrayBuffer must be defined.");r=r??0;let s;c(o)&&(s=new Uint8Array(o,r));let a=t.implicitTileset,l=t.implicitCoordinates,u=await gx.fromSubtreeJson(n,i,s,a,l),f=new tl(e,t,n);return f._implicitSubtree=u,KVe(f,u),f._ready=!0,f};function KVe(e,t){let n=e._tile,i=e._implicitCoordinates.childIndex,o=ZVe(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;let s=$Ve(e,t,o.bottomRow);for(let a=0;a<s.length;a++){let l=s[a],u=l.tile,f=sze(e,u,l.childIndex);u.children.push(f),r.numberOfTilesTotal++}}function $Ve(e,t,n){let i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){let s=n[r];if(c(s))for(let a=0;a<o;a++){let l=r*o+a;t.childSubtreeIsAvailableAtIndex(l)&&i.push({tile:s,childIndex:a})}}return i}function ZVe(e,t,n,i){let s=Ase(e,t,n,i,0,!0),a=e._tileset.statistics,l=[s],u=[],f=e._implicitTileset;for(let h=1;h<f.subtreeLevels;h++){let p=t.getLevelOffset(h),g=f.branchingFactor*l.length;for(let m=0;m<g;m++){let y=p+m;if(!t.tileIsAvailableAtIndex(y)){u.push(void 0);continue}let b=t.getParentMortonIndex(m),x=l[b],A=m%f.branchingFactor,C=Ase(e,t,x,A,y);x.children.push(C),a.numberOfTilesTotal++,u.push(C)}l=u,u=[]}return{rootTile:s,bottomRow:l}}function Cse(e,t,n){let i=yx.TILE_GEOMETRIC_ERROR;return c(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function Ase(e,t,n,i,o,r){let s=e._implicitTileset,a;r??!1?a=n.implicitCoordinates:a=n.implicitCoordinates.getChildCoordinates(i);let l,u,f;if(c(t.tilePropertyTableJson)){l=t.getTileMetadataView(a);let P=bx.parseAllBoundingVolumeSemantics(l);u=P.tile,f=P.content}let p=t.contentPropertyTableJsons.length,g=!1;for(let P=0;P<p;P++)if(t.contentIsAvailableAtCoordinates(a,P)){g=!0;break}let m=eze(s,a,i,r,n,u),y=[];for(let P=0;P<s.contentCount;P++){if(!t.contentIsAvailableAtIndex(o,P))continue;let L={uri:s.contentUriTemplates[P].getDerivedResource({templateValues:a.getTemplateValues()}).url},F=tze(m,f);c(F)&&(L.boundingVolume=F),y.push(xt(L,s.contentHeaders[P]))}let b=Cse(l,s,a),x={boundingVolume:m,geometricError:b,refine:s.refine,contents:y},A=!0,C=je(s.tileHeader,A);delete C.boundingVolume,delete C.transform,delete C.metadata;let S=xt(x,C,A),v=Dse(e,s.baseResource,S,n);return v.implicitCoordinates=a,v.implicitSubtree=t,v.metadata=l,v.hasImplicitContentMetadata=g,v}function dz(e,t){return c(e)&&c(t)&&(c(t.minimumHeight)||c(t.maximumHeight))&&(oi(e,"3DTILES_bounding_volume_S2")||c(e.region))}function M9(e,t){c(t)&&(oi(e,"3DTILES_bounding_volume_S2")?JVe(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):c(e.region)&&QVe(e.region,t.minimumHeight,t.maximumHeight))}function QVe(e,t,n){c(t)&&(e[4]=t),c(n)&&(e[5]=n)}function JVe(e,t,n){c(t)&&(e.minimumHeight=t),c(n)&&(e.maximumHeight=n)}function eze(e,t,n,i,o,r){let s;return!c(r)||!c(r.boundingVolume)||!dz(r.boundingVolume,r)&&dz(e.boundingVolume,r)?s=Ese(e,t,n,i??!1,o):s=r.boundingVolume,M9(s,r),s}function tze(e,t){let n;return c(t)&&(n=t.boundingVolume),dz(n,t)?M9(n,t):dz(e,t)&&(n=je(e,!0),M9(n,t)),n}function Ese(e,t,n,i,o){let r=e.boundingVolume;return oi(r,"3DTILES_bounding_volume_S2")?Sse(i,o,n,t.level,t.x,t.y,t.z):c(r.region)?{region:vse(r.region,t.level,t.x,t.y,t.z)}:{box:wse(r.box,t.level,t.x,t.y,t.z)}}function Sse(e,t,n,i,o,r,s){T.typeOf.bool("parentIsPlaceholderTile",e),T.typeOf.object("parentTile",t),T.typeOf.number("childIndex",n),T.typeOf.number("level",i),T.typeOf.number("x",o),T.typeOf.number("y",r),c(s)&&T.typeOf.number("z",s);let a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:Qp.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};let l=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),u=l%2===0?LC.encode2D(i,o,r):LC.encode2D(i,r,o),f=Qp.fromFacePositionLevel(l,BigInt(u),i),h,p;if(c(s)){let g=(a.maximumHeight+a.minimumHeight)/2;h=n<4?a.minimumHeight:g,p=n<4?g:a.maximumHeight}else h=a.minimumHeight,p=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:Qp.getTokenFromId(f._cellId),minimumHeight:h,maximumHeight:p}}}}var nze=new d,ize=new d,R9=new d,oze=new J;function wse(e,t,n,i,o){if(T.typeOf.object("rootBox",e),T.typeOf.number("level",t),T.typeOf.number("x",n),T.typeOf.number("y",i),c(o)&&T.typeOf.number("z",o),t===0)return e;let r=d.unpack(e,0,ize),s=J.unpack(e,3,oze),a=Math.pow(2,-t),l=-1+(2*n+1)*a,u=-1+(2*i+1)*a,f=0,h=d.fromElements(a,a,1,nze);c(o)&&(f=-1+(2*o+1)*a,h.z=a);let p=d.fromElements(l,u,f,R9);p=J.multiplyByVector(s,p,R9),p=d.add(p,r,R9);let g=J.clone(s);g=J.multiplyByScale(g,h,g);let m=new Array(12);return d.pack(p,m),J.pack(g,m,3),m}var rze=new ce;function vse(e,t,n,i,o){if(T.typeOf.object("rootRegion",e),T.typeOf.number("level",t),T.typeOf.number("x",n),T.typeOf.number("y",i),c(o)&&T.typeOf.number("z",o),t===0)return e.slice();let r=ce.unpack(e,0,rze),s=e[4],a=e[5],l=Math.pow(2,-t),u=l*r.width,f=O.negativePiToPi(r.west+n*u),h=O.negativePiToPi(f+u),p=l*r.height,g=O.negativePiToPi(r.south+i*p),m=O.negativePiToPi(g+p),y=s,b=a;if(c(o)){let x=l*(a-s);y+=o*x,b=y+x}return[f,g,h,m,y,b]}function sze(e,t,n){let i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=Ese(i,o,n,!1,t),s=Cse(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,l={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=Dse(e,i.baseResource,l,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function Dse(e,t,n,i){let o=e._tile.constructor;return new o(e._tileset,t,n,i)}tl.prototype.hasProperty=function(e,t){return!1};tl.prototype.getFeature=function(e){};tl.prototype.applyDebugSettings=function(e,t){};tl.prototype.applyStyle=function(e){};tl.prototype.update=function(e,t){};tl.prototype.pick=function(e,t,n){};tl.prototype.isDestroyed=function(){return!1};tl.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),de(this)};tl._deriveBoundingBox=wse;tl._deriveBoundingRegion=vse;tl._deriveBoundingVolumeS2=Sse;var XC=tl;var aze={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Hl=Object.freeze(aze);function KC(e,t){T.typeOf.object("normal",e),T.typeOf.number("distance",t),this._distance=t,this._normal=new Pse(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(KC.prototype,{distance:{get:function(){return this._distance},set:function(e){T.typeOf.number("value",e),c(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){T.typeOf.object("value",e),c(this.onChangeCallback)&&!d.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),d.clone(e,this._normal._cartesian3)}}});KC.fromPlane=function(e,t){return T.typeOf.object("plane",e),c(t)?(t.normal=e.normal,t.distance=e.distance):t=new KC(e.normal,e.distance),t};KC.clone=function(e,t){return c(t)?(t.normal=e.normal,t.distance=e.distance,t):new KC(e.normal,e.distance)};function Pse(e,t){this._clippingPlane=t,this._cartesian3=d.clone(e)}Object.defineProperties(Pse.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){T.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){T.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){T.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});var xx=KC;function gc(e){e=e??W.EMPTY_OBJECT,this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=e.enabled??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this.edgeColor=G.clone(e.edgeColor??G.WHITE),this.edgeWidth=e.edgeWidth??0,this.planeAdded=new pe,this.planeRemoved=new pe,this._owner=void 0;let t=e.unionClippingRegions??!1;this._unionClippingRegions=t,this._testIntersection=t?Lse:Nse,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;let n=e.planes;if(c(n)){let i=n.length;for(let o=0;o<i;++o)this.add(n[o])}}function Lse(e){return e===Wt.OUTSIDE}function Nse(e){return e===Wt.INSIDE}Object.defineProperties(gc.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?Lse:Nse)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}});function Ise(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}gc.prototype.add=function(e){let t=this._planes.length,n=this;e.onChangeCallback=function(i){Ise(n,i)},e.index=t,Ise(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};gc.prototype.get=function(e){return T.typeOf.number("index",e),this._planes[e]};function Fse(e,t){let n=e.length;for(let i=0;i<n;++i)if(sn.equals(e[i],t))return i;return-1}gc.prototype.contains=function(e){return Fse(this._planes,e)!==-1};gc.prototype.remove=function(e){let t=this._planes,n=Fse(t,e);if(n===-1)return!1;e instanceof xx&&(e.onChangeCallback=void 0,e.index=-1);let i=t.length-1;for(let o=n;o<i;++o){let r=t[o+1];t[o]=r,r instanceof xx&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};gc.prototype.removeAll=function(){let e=this._planes,t=e.length;for(let n=0;n<t;++n){let i=e[n];i instanceof xx&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};var cze=new se,lze=new se;function Ose(e,t,n){let i=e._uint8View,o=e._planes,r=0;for(let s=t;s<n;++s){let a=o[s],l=Ln.octEncodeToCartesian4(a.normal,lze);i[r]=l.x,i[r+1]=l.y,i[r+2]=l.z,i[r+3]=l.w;let u=se.packFloat(a.distance,cze);i[r+4]=u.x,i[r+5]=u.y,i[r+6]=u.z,i[r+7]=u.w,r+=8}}function Rse(e,t,n){let i=e._float32View,o=e._planes,r=0;for(let s=t;s<n;++s){let a=o[s],l=a.normal;i[r]=l.x,i[r+1]=l.y,i[r+2]=l.z,i[r+3]=a.distance,r+=4}}function Bse(e,t){let n=ut.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}var uze=new H;gc.prototype.update=function(e){let t=this._clippingPlanesTexture,n=e.context,i=gc.useFloatTexture(n),o=i?this.length:this.length*2;if(c(t)){let s=t.width*t.height;(s<o||o<.25*s)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(this.length===0)return;if(!c(t)){let s=Bse(o,uze);s.y*=2,i?(t=new Rt({context:n,width:s.x,height:s.y,pixelFormat:ke.RGBA,pixelDatatype:Ue.FLOAT,sampler:Qt.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new Rt({context:n,width:s.x,height:s.y,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,sampler:Qt.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(s.x*s.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}let r=this._dirtyIndex;if(!(!this._multipleDirtyPlanes&&r===-1)){if(this._multipleDirtyPlanes)i?(Rse(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(Ose(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let s=0,a=0;i?(a=Math.floor(r/t.width),s=Math.floor(r-a*t.width),Rse(this,r,r+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:s,yOffset:a})):(a=Math.floor(r*2/t.width),s=Math.floor(r*2-a*t.width),Ose(this,r,r+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:s,yOffset:a}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};var fze=new B,Mse=new sn(d.UNIT_X,0);gc.prototype.computeIntersectionWithBoundingVolume=function(e,t){let n=this._planes,i=n.length,o=this.modelMatrix;c(t)&&(o=B.multiply(t,o,fze));let r=Wt.INSIDE;!this.unionClippingRegions&&i>0&&(r=Wt.OUTSIDE);for(let s=0;s<i;++s){let a=n[s];sn.transform(a,o,Mse);let l=e.intersectPlane(Mse);if(l===Wt.INTERSECTING)r=l;else if(this._testIntersection(l))return l}return r};gc.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new E("ClippingPlaneCollection should only be assigned to one object");e._owner=t,t[n]=e}};gc.useFloatTexture=function(e){return e.floatingPointTexture};gc.getTextureResolution=function(e,t,n){let i=e.texture;if(c(i))return n.x=i.width,n.y=i.height,n;let o=gc.useFloatTexture(t)?e.length:e.length*2,r=Bse(o,n);return r.y*=2,r};gc.prototype.isDestroyed=function(){return!1};gc.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),de(this)};var gs=gc;function F9(e,t,n=2){let i=t&&t.length,o=i?t[0]*n:e.length,r=Use(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;let a,l,u;if(i&&(r=_ze(e,t,r,n)),e.length>80*n){a=1/0,l=1/0;let f=-1/0,h=-1/0;for(let p=n;p<o;p+=n){let g=e[p],m=e[p+1];g<a&&(a=g),m<l&&(l=m),g>f&&(f=g),m>h&&(h=m)}u=Math.max(f-a,h-l),u=u!==0?32767/u:0}return R1(r,s,n,a,l,u,0),s}function Use(e,t,n,i,o){let r;if(o===vze(e,t,n,i)>0)for(let s=t;s<n;s+=i)r=kse(s/i|0,e[s],e[s+1],r);else for(let s=n-i;s>=t;s-=i)r=kse(s/i|0,e[s],e[s+1],r);return r&&$C(r,r.next)&&(L1(r),r=r.next),r}function Tx(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&($C(n,n.next)||Hr(n.prev,n,n.next)===0)){if(L1(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function R1(e,t,n,i,o,r,s){if(!e)return;!s&&r&&Tze(e,i,o,r);let a=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(r?hze(e,i,o,r):dze(e)){t.push(l.i,e.i,u.i),L1(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=mze(Tx(e),t),R1(e,t,n,i,o,r,2)):s===2&&pze(e,t,n,i,o,r):R1(Tx(e),t,n,i,o,r,1);break}}}function dze(e){let t=e.prev,n=e,i=e.next;if(Hr(t,n,i)>=0)return!1;let o=t.x,r=n.x,s=i.x,a=t.y,l=n.y,u=i.y,f=Math.min(o,r,s),h=Math.min(a,l,u),p=Math.max(o,r,s),g=Math.max(a,l,u),m=i.next;for(;m!==t;){if(m.x>=f&&m.x<=p&&m.y>=h&&m.y<=g&&O1(o,a,r,l,s,u,m.x,m.y)&&Hr(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function hze(e,t,n,i){let o=e.prev,r=e,s=e.next;if(Hr(o,r,s)>=0)return!1;let a=o.x,l=r.x,u=s.x,f=o.y,h=r.y,p=s.y,g=Math.min(a,l,u),m=Math.min(f,h,p),y=Math.max(a,l,u),b=Math.max(f,h,p),x=L9(g,m,t,n,i),A=L9(y,b,t,n,i),C=e.prevZ,S=e.nextZ;for(;C&&C.z>=x&&S&&S.z<=A;){if(C.x>=g&&C.x<=y&&C.y>=m&&C.y<=b&&C!==o&&C!==s&&O1(a,f,l,h,u,p,C.x,C.y)&&Hr(C.prev,C,C.next)>=0||(C=C.prevZ,S.x>=g&&S.x<=y&&S.y>=m&&S.y<=b&&S!==o&&S!==s&&O1(a,f,l,h,u,p,S.x,S.y)&&Hr(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;C&&C.z>=x;){if(C.x>=g&&C.x<=y&&C.y>=m&&C.y<=b&&C!==o&&C!==s&&O1(a,f,l,h,u,p,C.x,C.y)&&Hr(C.prev,C,C.next)>=0)return!1;C=C.prevZ}for(;S&&S.z<=A;){if(S.x>=g&&S.x<=y&&S.y>=m&&S.y<=b&&S!==o&&S!==s&&O1(a,f,l,h,u,p,S.x,S.y)&&Hr(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function mze(e,t){let n=e;do{let i=n.prev,o=n.next.next;!$C(i,o)&&zse(i,n,n.next,o)&&M1(i,o)&&M1(o,i)&&(t.push(i.i,n.i,o.i),L1(n),L1(n.next),n=e=o),n=n.next}while(n!==e);return Tx(n)}function pze(e,t,n,i,o,r){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Eze(s,a)){let l=Hse(s,a);s=Tx(s,s.next),l=Tx(l,l.next),R1(s,t,n,i,o,r,0),R1(l,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function _ze(e,t,n,i){let o=[];for(let r=0,s=t.length;r<s;r++){let a=t[r]*i,l=r<s-1?t[r+1]*i:e.length,u=Use(e,a,l,i,!1);u===u.next&&(u.steiner=!0),o.push(Cze(u))}o.sort(gze);for(let r=0;r<o.length;r++)n=yze(o[r],n);return n}function gze(e,t){let n=e.x-t.x;if(n===0&&(n=e.y-t.y,n===0)){let i=(e.next.y-e.y)/(e.next.x-e.x),o=(t.next.y-t.y)/(t.next.x-t.x);n=i-o}return n}function yze(e,t){let n=bze(e,t);if(!n)return t;let i=Hse(n,e);return Tx(i,i.next),Tx(n,n.next)}function bze(e,t){let n=t,i=e.x,o=e.y,r=-1/0,s;if($C(e,n))return n;do{if($C(e,n.next))return n.next;if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){let h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=i&&h>r&&(r=h,s=n.x<n.next.x?n:n.next,h===i))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,u=s.y,f=1/0;n=s;do{if(i>=n.x&&n.x>=l&&i!==n.x&&Vse(o<u?i:r,o,l,u,o<u?r:i,o,n.x,n.y)){let h=Math.abs(o-n.y)/(i-n.x);M1(n,e)&&(h<f||h===f&&(n.x>s.x||n.x===s.x&&xze(s,n)))&&(s=n,f=h)}n=n.next}while(n!==a);return s}function xze(e,t){return Hr(e.prev,e,t.prev)<0&&Hr(t.next,e,e.next)<0}function Tze(e,t,n,i){let o=e;do o.z===0&&(o.z=L9(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,Aze(o)}function Aze(e){let t,n=1;do{let i=e,o;e=null;let r=null;for(t=0;i;){t++;let s=i,a=0;for(let u=0;u<n&&(a++,s=s.nextZ,!!s);u++);let l=n;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||i.z<=s.z)?(o=i,i=i.nextZ,a--):(o=s,s=s.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;i=s}r.nextZ=null,n*=2}while(t>1);return e}function L9(e,t,n,i,o){return e=(e-n)*o|0,t=(t-i)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Cze(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Vse(e,t,n,i,o,r,s,a){return(o-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(r-a)>=(o-s)*(i-a)}function O1(e,t,n,i,o,r,s,a){return!(e===s&&t===a)&&Vse(e,t,n,i,o,r,s,a)}function Eze(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Sze(e,t)&&(M1(e,t)&&M1(t,e)&&wze(e,t)&&(Hr(e.prev,e,t.prev)||Hr(e,t.prev,t))||$C(e,t)&&Hr(e.prev,e,e.next)>0&&Hr(t.prev,t,t.next)>0)}function Hr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function $C(e,t){return e.x===t.x&&e.y===t.y}function zse(e,t,n,i){let o=mz(Hr(e,t,n)),r=mz(Hr(e,t,i)),s=mz(Hr(n,i,e)),a=mz(Hr(n,i,t));return!!(o!==r&&s!==a||o===0&&hz(e,n,t)||r===0&&hz(e,i,t)||s===0&&hz(n,e,i)||a===0&&hz(n,t,i))}function hz(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function mz(e){return e>0?1:e<0?-1:0}function Sze(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&zse(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function M1(e,t){return Hr(e.prev,e,e.next)<0?Hr(e,t,e.next)>=0&&Hr(e,e.prev,t)>=0:Hr(e,t,e.prev)<0||Hr(e,e.next,t)<0}function wze(e,t){let n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function Hse(e,t){let n=N9(e.i,e.x,e.y),i=N9(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function kse(e,t,n,i){let o=N9(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function L1(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function N9(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vze(e,t,n,i){let o=0;for(let r=t,s=n-i;r<n;r+=i)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}var Dze=new d,Pze=new d,Ty={};Ty.computeArea2D=function(e){T.defined("positions",e),T.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);let t=e.length,n=0;for(let i=t-1,o=0;o<t;i=o++){let r=e[i],s=e[o];n+=r.x*s.y-s.x*r.y}return n*.5};Ty.computeWindingOrder2D=function(e){return Ty.computeArea2D(e)>0?ts.COUNTER_CLOCKWISE:ts.CLOCKWISE};Ty.triangulate=function(e,t){T.defined("positions",e);let n=H.packArray(e);return F9(n,t,2)};var qse=new d,Yse=new d,Xse=new d,Gse=new d,jse=new d,Wse=new d,r_=new d,Kse=new H,$se=new H,Zse=new H,ZC=new H;Ty.computeSubdivision=function(e,t,n,i,o){o=o??O.RADIANS_PER_DEGREE;let r=c(i);T.typeOf.object("ellipsoid",e),T.defined("positions",t),T.defined("indices",n),T.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),T.typeOf.number.equals("indices.length % 3","0",n.length%3,0),T.typeOf.number.greaterThan("granularity",o,0);let s=n.slice(0),a,l=t.length,u=new Array(l*3),f=new Array(l*2),h=0,p=0;for(a=0;a<l;a++){let C=t[a];if(u[h++]=C.x,u[h++]=C.y,u[h++]=C.z,r){let S=i[a];f[p++]=S.x,f[p++]=S.y}}let g=[],m={},y=e.maximumRadius,b=O.chordLength(o,y),x=b*b;for(;s.length>0;){let C=s.pop(),S=s.pop(),v=s.pop(),P=d.fromArray(u,v*3,qse),M=d.fromArray(u,S*3,Yse),R=d.fromArray(u,C*3,Xse),L,F,_;r&&(L=H.fromArray(f,v*2,Kse),F=H.fromArray(f,S*2,$se),_=H.fromArray(f,C*2,Zse));let w=d.multiplyByScalar(d.normalize(P,Gse),y,Gse),D=d.multiplyByScalar(d.normalize(M,jse),y,jse),I=d.multiplyByScalar(d.normalize(R,Wse),y,Wse),N=d.magnitudeSquared(d.subtract(w,D,r_)),k=d.magnitudeSquared(d.subtract(D,I,r_)),z=d.magnitudeSquared(d.subtract(I,w,r_)),V=Math.max(N,k,z),j,U,q;V>x?N===V?(j=`${Math.min(v,S)} ${Math.max(v,S)}`,a=m[j],c(a)||(U=d.add(P,M,r_),d.multiplyByScalar(U,.5,U),u.push(U.x,U.y,U.z),a=u.length/3-1,m[j]=a,r&&(q=H.add(L,F,ZC),H.multiplyByScalar(q,.5,q),f.push(q.x,q.y))),s.push(v,a,C),s.push(a,S,C)):k===V?(j=`${Math.min(S,C)} ${Math.max(S,C)}`,a=m[j],c(a)||(U=d.add(M,R,r_),d.multiplyByScalar(U,.5,U),u.push(U.x,U.y,U.z),a=u.length/3-1,m[j]=a,r&&(q=H.add(F,_,ZC),H.multiplyByScalar(q,.5,q),f.push(q.x,q.y))),s.push(S,a,v),s.push(a,C,v)):z===V&&(j=`${Math.min(C,v)} ${Math.max(C,v)}`,a=m[j],c(a)||(U=d.add(R,P,r_),d.multiplyByScalar(U,.5,U),u.push(U.x,U.y,U.z),a=u.length/3-1,m[j]=a,r&&(q=H.add(_,L,ZC),H.multiplyByScalar(q,.5,q),f.push(q.x,q.y))),s.push(C,a,S),s.push(a,v,S)):(g.push(v),g.push(S),g.push(C))}let A={attributes:{position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Me.TRIANGLES};return r&&(A.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:f})),new ct(A)};var Ize=new he,Oze=new he,Rze=new he,B9=new he;Ty.computeRhumbLineSubdivision=function(e,t,n,i,o){o=o??O.RADIANS_PER_DEGREE;let r=c(i);T.typeOf.object("ellipsoid",e),T.defined("positions",t),T.defined("indices",n),T.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),T.typeOf.number.equals("indices.length % 3","0",n.length%3,0),T.typeOf.number.greaterThan("granularity",o,0);let s=n.slice(0),a,l=t.length,u=new Array(l*3),f=new Array(l*2),h=0,p=0;for(a=0;a<l;a++){let v=t[a];if(u[h++]=v.x,u[h++]=v.y,u[h++]=v.z,r){let P=i[a];f[p++]=P.x,f[p++]=P.y}}let g=[],m={},y=e.maximumRadius,b=O.chordLength(o,y),x=new Ba(void 0,void 0,e),A=new Ba(void 0,void 0,e),C=new Ba(void 0,void 0,e);for(;s.length>0;){let v=s.pop(),P=s.pop(),M=s.pop(),R=d.fromArray(u,M*3,qse),L=d.fromArray(u,P*3,Yse),F=d.fromArray(u,v*3,Xse),_,w,D;r&&(_=H.fromArray(f,M*2,Kse),w=H.fromArray(f,P*2,$se),D=H.fromArray(f,v*2,Zse));let I=e.cartesianToCartographic(R,Ize),N=e.cartesianToCartographic(L,Oze),k=e.cartesianToCartographic(F,Rze);x.setEndPoints(I,N);let z=x.surfaceDistance;A.setEndPoints(N,k);let V=A.surfaceDistance;C.setEndPoints(k,I);let j=C.surfaceDistance,U=Math.max(z,V,j),q,Y,te,K,Z;U>b?z===U?(q=`${Math.min(M,P)} ${Math.max(M,P)}`,a=m[q],c(a)||(Y=x.interpolateUsingFraction(.5,B9),te=(I.height+N.height)*.5,K=d.fromRadians(Y.longitude,Y.latitude,te,e,r_),u.push(K.x,K.y,K.z),a=u.length/3-1,m[q]=a,r&&(Z=H.add(_,w,ZC),H.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(M,a,v),s.push(a,P,v)):V===U?(q=`${Math.min(P,v)} ${Math.max(P,v)}`,a=m[q],c(a)||(Y=A.interpolateUsingFraction(.5,B9),te=(N.height+k.height)*.5,K=d.fromRadians(Y.longitude,Y.latitude,te,e,r_),u.push(K.x,K.y,K.z),a=u.length/3-1,m[q]=a,r&&(Z=H.add(w,D,ZC),H.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(P,a,M),s.push(a,v,M)):j===U&&(q=`${Math.min(v,M)} ${Math.max(v,M)}`,a=m[q],c(a)||(Y=C.interpolateUsingFraction(.5,B9),te=(k.height+I.height)*.5,K=d.fromRadians(Y.longitude,Y.latitude,te,e,r_),u.push(K.x,K.y,K.z),a=u.length/3-1,m[q]=a,r&&(Z=H.add(D,_,ZC),H.multiplyByScalar(Z,.5,Z),f.push(Z.x,Z.y))),s.push(v,a,P),s.push(a,M,P)):(g.push(M),g.push(P),g.push(v))}let S={attributes:{position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Me.TRIANGLES};return r&&(S.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:f})),new ct(S)};Ty.scaleToGeodeticHeight=function(e,t,n,i){n=n??ie.default;let o=Dze,r=Pze;if(t=t??0,i=i??!0,c(e)){let s=e.length;for(let a=0;a<s;a+=3)d.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),d.multiplyByScalar(o,t,o),d.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};var si=Ty;function Ay(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(Ay.prototype,{length:{get:function(){return this._length}}});Ay.prototype.enqueue=function(e){this._array.push(e),this._length++};Ay.prototype.dequeue=function(){if(this._length===0)return;let e=this._array,t=this._offset,n=e[t];return e[t]=void 0,t++,t>10&&t*2>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n};Ay.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};Ay.prototype.contains=function(e){return this._array.indexOf(e)!==-1};Ay.prototype.clear=function(){this._array.length=this._offset=this._length=0};Ay.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};var Cy=Ay;var rr={};rr.computeHierarchyPackedLength=function(e,t){let n=0,i=[e];for(;i.length>0;){let o=i.pop();if(!c(o))continue;n+=2;let r=o.positions,s=o.holes;if(c(r)&&r.length>0&&(n+=r.length*t.packedLength),c(s)){let a=s.length;for(let l=0;l<a;++l)i.push(s[l])}}return n};rr.packPolygonHierarchy=function(e,t,n,i){let o=[e];for(;o.length>0;){let r=o.pop();if(!c(r))continue;let s=r.positions,a=r.holes;if(t[n++]=c(s)?s.length:0,t[n++]=c(a)?a.length:0,c(s)){let l=s.length;for(let u=0;u<l;++u,n+=i.packedLength)i.pack(s[u],t,n)}if(c(a)){let l=a.length;for(let u=0;u<l;++u)o.push(a[u])}}return n};rr.unpackPolygonHierarchy=function(e,t,n){let i=e[t++],o=e[t++],r=new Array(i),s=o>0?new Array(o):void 0;for(let a=0;a<i;++a,t+=n.packedLength)r[a]=n.unpack(e,t);for(let a=0;a<o;++a)s[a]=rr.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};var Ax=new H;function eae(e,t,n,i){return H.subtract(t,e,Ax),H.multiplyByScalar(Ax,n/i,Ax),H.add(e,Ax,Ax),[Ax.x,Ax.y]}var Ey=new d;function Mze(e,t,n,i){return d.subtract(t,e,Ey),d.multiplyByScalar(Ey,n/i,Ey),d.add(e,Ey,Ey),[Ey.x,Ey.y,Ey.z]}rr.subdivideLineCount=function(e,t,n){let o=d.distance(e,t)/n,r=Math.max(0,Math.ceil(O.log2(o)));return Math.pow(2,r)};var _z=new he,gz=new he,Lze=new he,Nze=new d,pz=new Ba;rr.subdivideRhumbLineCount=function(e,t,n,i){let o=e.cartesianToCartographic(t,_z),r=e.cartesianToCartographic(n,gz),a=new Ba(o,r,e).surfaceDistance/i,l=Math.max(0,Math.ceil(O.log2(a)));return Math.pow(2,l)};rr.subdivideTexcoordLine=function(e,t,n,i,o,r){let s=rr.subdivideLineCount(n,i,o),a=H.distance(e,t),l=a/s,u=r;u.length=s*2;let f=0;for(let h=0;h<s;h++){let p=eae(e,t,h*l,a);u[f++]=p[0],u[f++]=p[1]}return u};rr.subdivideLine=function(e,t,n,i){let o=rr.subdivideLineCount(e,t,n),r=d.distance(e,t),s=r/o;c(i)||(i=[]);let a=i;a.length=o*3;let l=0;for(let u=0;u<o;u++){let f=Mze(e,t,u*s,r);a[l++]=f[0],a[l++]=f[1],a[l++]=f[2]}return a};rr.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){let a=n.cartesianToCartographic(i,_z),l=n.cartesianToCartographic(o,gz);pz.setEndPoints(a,l);let u=pz.surfaceDistance/r,f=Math.max(0,Math.ceil(O.log2(u))),h=Math.pow(2,f),p=H.distance(e,t),g=p/h,m=s;m.length=h*2;let y=0;for(let b=0;b<h;b++){let x=eae(e,t,b*g,p);m[y++]=x[0],m[y++]=x[1]}return m};rr.subdivideRhumbLine=function(e,t,n,i,o){let r=e.cartesianToCartographic(t,_z),s=e.cartesianToCartographic(n,gz),a=new Ba(r,s,e);if(c(o)||(o=[]),a.surfaceDistance<=i)return o.length=3,o[0]=t.x,o[1]=t.y,o[2]=t.z,o;let l=a.surfaceDistance/i,u=Math.max(0,Math.ceil(O.log2(l))),f=Math.pow(2,u),h=a.surfaceDistance/f,p=o;p.length=f*3;let g=0;for(let m=0;m<f;m++){let y=a.interpolateUsingSurfaceDistance(m*h,Lze),b=e.cartographicToCartesian(y,Nze);p[g++]=b.x,p[g++]=b.y,p[g++]=b.z}return p};var Fze=new d,Bze=new d,kze=new d,Uze=new d;rr.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=i??ie.default;let r=Fze,s=Bze,a=kze,l=Uze;if(c(e)&&c(e.attributes)&&c(e.attributes.position)){let u=e.attributes.position.values,f=u.length/2;for(let h=0;h<f;h+=3)d.fromArray(u,h,a),i.geodeticSurfaceNormal(a,r),l=i.scaleToGeodeticSurface(a,l),s=d.multiplyByScalar(r,n,s),s=d.add(l,s,s),u[h+f]=s.x,u[h+1+f]=s.y,u[h+2+f]=s.z,o&&(l=d.clone(a,l)),s=d.multiplyByScalar(r,t,s),s=d.add(l,s,s),u[h]=s.x,u[h+1]=s.y,u[h+2]=s.z}return e};rr.polygonOutlinesFromHierarchy=function(e,t,n){let i=[],o=new Cy;o.enqueue(e);let r,s,a;for(;o.length!==0;){let l=o.dequeue(),u=l.positions;if(t)for(a=u.length,r=0;r<a;r++)n.scaleToGeodeticSurface(u[r],u[r]);if(u=xo(u,d.equalsEpsilon,!0),u.length<3)continue;let f=l.holes?l.holes.length:0;for(r=0;r<f;r++){let h=l.holes[r],p=h.positions;if(t)for(a=p.length,s=0;s<a;++s)n.scaleToGeodeticSurface(p[s],p[s]);if(p=xo(p,d.equalsEpsilon,!0),p.length<3)continue;i.push(p);let g=0;for(c(h.holes)&&(g=h.holes.length),s=0;s<g;s++)o.enqueue(h.holes[s])}i.push(u)}return i};var Vze=new he;function zze(e,t,n){let i=n.cartesianToCartographic(e,_z),o=n.cartesianToCartographic(t,gz);if(Math.sign(i.latitude)===Math.sign(o.latitude))return;pz.setEndPoints(i,o);let r=pz.findIntersectionWithLatitude(0,Vze);if(!c(r))return;let s=Math.min(i.longitude,o.longitude),a=Math.max(i.longitude,o.longitude);if(Math.abs(a-s)>O.PI){let l=s;s=a,a=l}if(!(r.longitude<s||r.longitude>a))return n.cartographicToCartesian(r)}function Hze(e,t,n,i){if(i===qt.RHUMB)return zze(e,t,n);let o=Zn.lineSegmentPlane(e,t,sn.ORIGIN_XY_PLANE);if(c(o))return n.scaleToGeodeticSurface(o,o)}var Gze=new he;function jze(e,t,n){let i=[],o,r,s,a,l,u=0;for(;u<e.length;){o=e[u],r=e[(u+1)%e.length],s=O.sign(o.z),a=O.sign(r.z);let f=h=>t.cartesianToCartographic(h,Gze).longitude;if(s===0)i.push({position:u,type:s,visited:!1,next:a,theta:f(o)});else if(a!==0){if(l=Hze(o,r,t,n),++u,!c(l))continue;e.splice(u,0,l),i.push({position:u,type:s,visited:!1,next:a,theta:f(l)})}++u}return i}function tae(e,t,n,i,o,r,s){let a=[],l=r,u=h=>p=>p.position===h,f=[];do{let h=n[l];a.push(h);let p=i.findIndex(u(l)),g=i[p];if(!c(g)){++l;continue}let{visited:m,type:y,next:b}=g;if(g.visited=!0,y===0){if(b===0){let S=i[p-(s?1:-1)];if(S?.position===l+1)S.visited=!0;else{++l;continue}}if(!m&&s&&b>0||r===l&&!s&&b<0){++l;continue}}if(!(s?y>=0:y<=0)){++l;continue}m||f.push(l);let A=p+(s?1:-1),C=i[A];if(!c(C)){++l;continue}l=C.position}while(l<n.length&&l>=0&&l!==r&&a.length<n.length);e.splice(t,o,a);for(let h of f)t=tae(e,++t,n,i,0,h,!s);return t}rr.splitPolygonsOnEquator=function(e,t,n,i){c(i)||(i=[]),i.splice(0,0,...e),i.length=e.length;let o=0;for(;o<i.length;){let r=i[o],s=r.slice();if(r.length<3){i[o]=s,++o;continue}let a=jze(s,t,n);if(s.length===r.length||a.length<=1){i[o]=s,++o;continue}a.sort((u,f)=>u.theta-f.theta);let l=s[0].z>=0;o=tae(i,o,s,a,1,0,l)}return i};rr.polygonsFromHierarchy=function(e,t,n,i,o,r){let s=[],a=[],l=new Cy;l.enqueue(e);let u=c(r);for(;l.length!==0;){let f=l.dequeue(),h=f.positions,p=f.holes,g,m;if(i)for(m=h.length,g=0;g<m;g++)o.scaleToGeodeticSurface(h[g],h[g]);if(t||(h=xo(h,d.equalsEpsilon,!0)),h.length<3)continue;let y=n(h);if(!c(y))continue;let b=[],x=si.computeWindingOrder2D(y);if(x===ts.CLOCKWISE&&(y.reverse(),h=h.slice().reverse()),u){u=!1;let P=[h];if(P=r(P,P),P.length>1){for(let M of P)l.enqueue(new ka(M,p));continue}}let A=h.slice(),C=c(p)?p.length:0,S=[],v;for(g=0;g<C;g++){let P=p[g],M=P.positions;if(i)for(m=M.length,v=0;v<m;++v)o.scaleToGeodeticSurface(M[v],M[v]);if(t||(M=xo(M,d.equalsEpsilon,!0)),M.length<3)continue;let R=n(M);if(!c(R))continue;x=si.computeWindingOrder2D(R),x===ts.CLOCKWISE&&(R.reverse(),M=M.slice().reverse()),S.push(M),b.push(A.length),A=A.concat(M),y=y.concat(R);let L=0;for(c(P.holes)&&(L=P.holes.length),v=0;v<L;v++)l.enqueue(P.holes[v])}s.push({outerRing:h,holes:S}),a.push({positions:A,positions2D:y,holes:b})}return{hierarchy:s,polygons:a}};var Wze=new H,qze=new d,Yze=new Le,Xze=new J;rr.computeBoundingRectangle=function(e,t,n,i,o){let r=Le.fromAxisAngle(e,i,Yze),s=J.fromQuaternion(r,Xze),a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,h=n.length;for(let p=0;p<h;++p){let g=d.clone(n[p],qze);J.multiplyByVector(s,g,g);let m=t(g,Wze);c(m)&&(a=Math.min(a,m.x),l=Math.max(l,m.x),u=Math.min(u,m.y),f=Math.max(f,m.y))}return o.x=a,o.y=u,o.width=l-a,o.height=f-u,o};rr.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=si.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);let l=t.positions,u=c(n),f=u?n.positions:void 0;if(o){let h=l.length,p=new Array(h*3),g=0;for(let b=0;b<h;b++){let x=l[b];p[g++]=x.x,p[g++]=x.y,p[g++]=x.z}let m={attributes:{position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:p})},indices:a,primitiveType:Me.TRIANGLES};u&&(m.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:H.packArray(f)}));let y=new ct(m);return r.normal?Nn.computeNormal(y):y}if(s===qt.GEODESIC)return si.computeSubdivision(e,l,a,f,i);if(s===qt.RHUMB)return si.computeRhumbLineSubdivision(e,l,a,f,i)};var Qse=[],Jse=[],Kze=new d,$ze=new d;rr.computeWallGeometry=function(e,t,n,i,o,r){let s,a,l,u,f,h,p,g,m,y=e.length,b=0,x=0,A=c(t),C=A?t.positions:void 0;if(o)for(a=y*3*2,s=new Array(a*2),A&&(m=y*2*2,g=new Array(m*2)),l=0;l<y;l++)u=e[l],f=e[(l+1)%y],s[b]=s[b+a]=u.x,++b,s[b]=s[b+a]=u.y,++b,s[b]=s[b+a]=u.z,++b,s[b]=s[b+a]=f.x,++b,s[b]=s[b+a]=f.y,++b,s[b]=s[b+a]=f.z,++b,A&&(h=C[l],p=C[(l+1)%y],g[x]=g[x+m]=h.x,++x,g[x]=g[x+m]=h.y,++x,g[x]=g[x+m]=p.x,++x,g[x]=g[x+m]=p.y,++x);else{let R=O.chordLength(i,n.maximumRadius),L=0;if(r===qt.GEODESIC)for(l=0;l<y;l++)L+=rr.subdivideLineCount(e[l],e[(l+1)%y],R);else if(r===qt.RHUMB)for(l=0;l<y;l++)L+=rr.subdivideRhumbLineCount(n,e[l],e[(l+1)%y],R);for(a=(L+y)*3,s=new Array(a*2),A&&(m=(L+y)*2,g=new Array(m*2)),l=0;l<y;l++){u=e[l],f=e[(l+1)%y];let F,_;A&&(h=C[l],p=C[(l+1)%y]),r===qt.GEODESIC?(F=rr.subdivideLine(u,f,R,Jse),A&&(_=rr.subdivideTexcoordLine(h,p,u,f,R,Qse))):r===qt.RHUMB&&(F=rr.subdivideRhumbLine(n,u,f,R,Jse),A&&(_=rr.subdivideTexcoordRhumbLine(h,p,n,u,f,R,Qse)));let w=F.length;for(let D=0;D<w;++D,++b)s[b]=F[D],s[b+a]=F[D];if(s[b]=f.x,s[b+a]=f.x,++b,s[b]=f.y,s[b+a]=f.y,++b,s[b]=f.z,s[b+a]=f.z,++b,A){let D=_.length;for(let I=0;I<D;++I,++x)g[x]=_[I],g[x+m]=_[I];g[x]=p.x,g[x+m]=p.x,++x,g[x]=p.y,g[x+m]=p.y,++x}}}y=s.length;let S=Fe.createTypedArray(y/3,y-e.length*6),v=0;for(y/=6,l=0;l<y;l++){let R=l,L=R+1,F=R+y,_=F+1;u=d.fromArray(s,R*3,Kze),f=d.fromArray(s,L*3,$ze),!d.equalsEpsilon(u,f,O.EPSILON10,O.EPSILON10)&&(S[v++]=R,S[v++]=F,S[v++]=L,S[v++]=L,S[v++]=F,S[v++]=_)}let P={attributes:new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:s})}),indices:S,primitiveType:Me.TRIANGLES};return A&&(P.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:g})),new ct(P)};var zn=rr;function Gr(e,t){this.position=e,c(this.position)||(this.position=new H),this.tangentPlane=t,c(this.tangentPlane)||(this.tangentPlane=Gr.NORTH_POLE_TANGENT_PLANE)}Object.defineProperties(Gr.prototype,{ellipsoid:{get:function(){return this.tangentPlane.ellipsoid}},x:{get:function(){return this.position.x}},y:{get:function(){return this.position.y}},conformalLatitude:{get:function(){let e=H.magnitude(this.position),t=2*this.ellipsoid.maximumRadius;return this.tangentPlane.plane.normal.z*(O.PI_OVER_TWO-2*Math.atan2(e,t))}},longitude:{get:function(){let e=O.PI_OVER_TWO+Math.atan2(this.y,this.x);return e>Math.PI&&(e-=O.TWO_PI),e}}});var QC=new he,Zze=new d;Gr.prototype.getLatitude=function(e){c(e)||(e=ie.default),QC.latitude=this.conformalLatitude,QC.longitude=this.longitude,QC.height=0;let t=this.ellipsoid.cartographicToCartesian(QC,Zze);return e.cartesianToCartographic(t,QC),QC.latitude};var Qze=new mn,Jze=new d,e4e=new d;Gr.fromCartesian=function(e,t){T.defined("cartesian",e);let n=O.signNotZero(e.z),i=Gr.NORTH_POLE_TANGENT_PLANE,o=Gr.SOUTH_POLE;n<0&&(i=Gr.SOUTH_POLE_TANGENT_PLANE,o=Gr.NORTH_POLE);let r=Qze;r.origin=i.ellipsoid.scaleToGeocentricSurface(e,r.origin),r.direction=d.subtract(r.origin,o,Jze),d.normalize(r.direction,r.direction);let s=Zn.rayPlane(r,i.plane,e4e),a=d.subtract(s,o,s),l=d.dot(i.xAxis,a),u=n*d.dot(i.yAxis,a);return c(t)?(t.position=new H(l,u),t.tangentPlane=i,t):new Gr(new H(l,u),i)};Gr.fromCartesianArray=function(e,t){T.defined("cartesians",e);let n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=Gr.fromCartesian(e[i],t[i]);return t};Gr.clone=function(e,t){if(c(e))return c(t)?(t.position=e.position,t.tangentPlane=e.tangentPlane,t):new Gr(e.position,e.tangentPlane)};Gr.HALF_UNIT_SPHERE=Object.freeze(new ie(.5,.5,.5));Gr.NORTH_POLE=Object.freeze(new d(0,0,.5));Gr.SOUTH_POLE=Object.freeze(new d(0,0,-.5));Gr.NORTH_POLE_TANGENT_PLANE=Object.freeze(new ns(Gr.NORTH_POLE,Gr.HALF_UNIT_SPHERE));Gr.SOUTH_POLE_TANGENT_PLANE=Object.freeze(new ns(Gr.SOUTH_POLE,Gr.HALF_UNIT_SPHERE));var yc=Gr;var t4e=new he,nae=new he;function n4e(e,t,n,i){let r=i.cartesianToCartographic(e,t4e).height,s=i.cartesianToCartographic(t,nae);s.height=r,i.cartographicToCartesian(s,t);let a=i.cartesianToCartographic(n,nae);a.height=r-100,i.cartographicToCartesian(a,n)}var iae=new Ke,i4e=new d,o4e=new d,r4e=new d,s4e=new d,a4e=new d,c4e=new d,yz=new d,Sm=new d,JC=new d,l4e=new H,u4e=new H,f4e=new d,oae=new Le,d4e=new J,h4e=new J;function k9(e){let t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=c(n.attributes.st)?n.attributes.st.values:void 0,s=o.length,a=e.wall,l=e.top||a,u=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){let f=e.boundingRectangle,h=e.rotationAxis,p=e.projectTo2d,g=e.ellipsoid,m=e.stRotation,y=e.perPositionHeight,b=l4e;b.x=f.x,b.y=f.y;let x=t.st?new Float32Array(2*(s/3)):void 0,A;t.normal&&(y&&l&&!a?A=n.attributes.normal.values:A=new Float32Array(s));let C=t.tangent?new Float32Array(s):void 0,S=t.bitangent?new Float32Array(s):void 0,v=i?new Float32Array(s):void 0,P=0,M=0,R=o4e,L=r4e,F=s4e,_=!0,w=d4e,D=h4e;if(m!==0){let k=Le.fromAxisAngle(h,m,oae);w=J.fromQuaternion(k,w),k=Le.fromAxisAngle(h,-m,oae),D=J.fromQuaternion(k,D)}else w=J.clone(J.IDENTITY,w),D=J.clone(J.IDENTITY,D);let I=0,N=0;l&&u&&(I=s/2,N=s/3,s/=2);for(let k=0;k<s;k+=3){let z=d.fromArray(o,k,f4e);if(t.st&&!c(r)){let V=J.multiplyByVector(w,z,i4e);V=g.scaleToGeodeticSurface(V,V);let j=p([V],u4e)[0];H.subtract(j,b,j);let U=O.clamp(j.x/f.width,0,1),q=O.clamp(j.y/f.height,0,1);u&&(x[P+N]=U,x[P+1+N]=q),l&&(x[P]=U,x[P+1]=q),P+=2}if(t.normal||t.tangent||t.bitangent||i){let V=M+1,j=M+2;if(a){if(k+3<s){let U=d.fromArray(o,k+3,a4e);if(_){let q=d.fromArray(o,k+s,c4e);y&&n4e(z,U,q,g),d.subtract(U,z,U),d.subtract(q,z,q),R=d.normalize(d.cross(q,U,R),R),_=!1}d.equalsEpsilon(U,z,O.EPSILON10)&&(_=!0)}(t.tangent||t.bitangent)&&(F=g.geodeticSurfaceNormal(z,F),t.tangent&&(L=d.normalize(d.cross(F,R,L),L)))}else R=g.geodeticSurfaceNormal(z,R),(t.tangent||t.bitangent)&&(y&&(yz=d.fromArray(A,M,yz),Sm=d.cross(d.UNIT_Z,yz,Sm),Sm=d.normalize(J.multiplyByVector(D,Sm,Sm),Sm),t.bitangent&&(JC=d.normalize(d.cross(yz,Sm,JC),JC))),L=d.cross(d.UNIT_Z,R,L),L=d.normalize(J.multiplyByVector(D,L,L),L),t.bitangent&&(F=d.normalize(d.cross(R,L,F),F)));t.normal&&(e.wall?(A[M+I]=R.x,A[V+I]=R.y,A[j+I]=R.z):u&&(A[M+I]=-R.x,A[V+I]=-R.y,A[j+I]=-R.z),(l&&!y||a)&&(A[M]=R.x,A[V]=R.y,A[j]=R.z)),i&&(a&&(R=g.geodeticSurfaceNormal(z,R)),v[M+I]=-R.x,v[V+I]=-R.y,v[j+I]=-R.z),t.tangent&&(e.wall?(C[M+I]=L.x,C[V+I]=L.y,C[j+I]=L.z):u&&(C[M+I]=-L.x,C[V+I]=-L.y,C[j+I]=-L.z),l&&(y?(C[M]=Sm.x,C[V]=Sm.y,C[j]=Sm.z):(C[M]=L.x,C[V]=L.y,C[j]=L.z))),t.bitangent&&(u&&(S[M+I]=F.x,S[V+I]=F.y,S[j+I]=F.z),l&&(y?(S[M]=JC.x,S[V]=JC.y,S[j]=JC.z):(S[M]=F.x,S[V]=F.y,S[j]=F.z))),M+=3}}t.st&&!c(r)&&(n.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:x})),t.normal&&(n.attributes.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:A})),t.tangent&&(n.attributes.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:C})),t.bitangent&&(n.attributes.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:S})),i&&(n.attributes.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:v}))}if(e.extrude&&c(e.offsetAttribute)){let f=o.length/3,h=new Uint8Array(f);if(e.offsetAttribute===Zt.TOP)l&&u||a?h=h.fill(1,0,f/2):l&&(h=h.fill(1));else{let p=e.offsetAttribute===Zt.NONE?0:1;h=h.fill(p)}n.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return n}var rae=[];function m4e(e,t,n,i,o,r,s,a,l,u){let f={walls:[]},h;if(s||a){let A=zn.createGeometryFromPositions(e,t,n,i,r,l,u),C=A.attributes.position.values,S=A.indices,v,P;if(s&&a){let M=C.concat(C);v=M.length/3,P=Fe.createTypedArray(v,S.length*2),P.set(S);let R=S.length,L=v/2;for(h=0;h<R;h+=3){let F=P[h]+L,_=P[h+1]+L,w=P[h+2]+L;P[h+R]=w,P[h+1+R]=_,P[h+2+R]=F}if(A.attributes.position.values=M,r&&l.normal){let F=A.attributes.normal.values;A.attributes.normal.values=new Float32Array(M.length),A.attributes.normal.values.set(F)}if(l.st&&c(n)){let F=A.attributes.st.values;A.attributes.st.values=new Float32Array(v*2),A.attributes.st.values=F.concat(F)}A.indices=P}else if(a){for(v=C.length/3,P=Fe.createTypedArray(v,S.length),h=0;h<S.length;h+=3)P[h]=S[h+2],P[h+1]=S[h+1],P[h+2]=S[h];A.indices=P}f.topAndBottom=new St({geometry:A})}let p=o.outerRing,g=ns.fromPoints(p,e),m=g.projectPointsOntoPlane(p,rae),y=si.computeWindingOrder2D(m);y===ts.CLOCKWISE&&(p=p.slice().reverse());let b=zn.computeWallGeometry(p,n,e,i,r,u);f.walls.push(new St({geometry:b}));let x=o.holes;for(h=0;h<x.length;h++){let A=x[h];m=g.projectPointsOntoPlane(A,rae),y=si.computeWindingOrder2D(m),y===ts.COUNTER_CLOCKWISE&&(A=A.slice().reverse()),b=zn.computeWallGeometry(A,n,e,i,r,u),f.walls.push(new St({geometry:b}))}return f}function kf(e){if(T.typeOf.object("options",e),T.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),c(e.perPositionHeight)&&e.perPositionHeight&&c(e.height))throw new E("Cannot use both options.perPositionHeight and options.height");if(c(e.arcType)&&e.arcType!==qt.GEODESIC&&e.arcType!==qt.RHUMB)throw new E("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");let t=e.polygonHierarchy,n=e.vertexFormat??Ie.DEFAULT,i=e.ellipsoid??ie.default,o=e.granularity??O.RADIANS_PER_DEGREE,r=e.stRotation??0,s=e.textureCoordinates,a=e.perPositionHeight??!1,l=a&&c(e.extrudedHeight),u=e.height??0,f=e.extrudedHeight??u;if(!l){let h=Math.max(u,f);f=Math.min(u,f),u=h}this._vertexFormat=Ie.clone(n),this._ellipsoid=ie.clone(i),this._granularity=o,this._stRotation=r,this._height=u,this._extrudedHeight=f,this._closeTop=e.closeTop??!0,this._closeBottom=e.closeBottom??!0,this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=l,this._shadowVolume=e.shadowVolume??!1,this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=e.arcType??qt.GEODESIC,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=zn.computeHierarchyPackedLength(t,d)+ie.packedLength+Ie.packedLength+(s?zn.computeHierarchyPackedLength(s,H):1)+12}kf.fromPositions=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.positions",e.positions);let t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates};return new kf(t)};kf.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,n=zn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._stRotation,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._closeTop?1:0,t[n++]=e._closeBottom?1:0,t[n++]=e._shadowVolume?1:0,t[n++]=e._offsetAttribute??-1,t[n++]=e._arcType,c(e._textureCoordinates)?n=zn.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};var p4e=ie.clone(ie.UNIT_SPHERE),_4e=new Ie,g4e={polygonHierarchy:{}};kf.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=zn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,p4e);t+=ie.packedLength;let r=Ie.unpack(e,t,_4e);t+=Ie.packedLength;let s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++]===1,h=e[t++]===1,p=e[t++]===1,g=e[t++]===1,m=e[t++]===1,y=e[t++],b=e[t++],x=e[t]===-1?void 0:zn.unpackPolygonHierarchy(e,t,H);c(x)?(t=x.startingIndex,delete x.startingIndex):t++;let A=e[t++];return c(n)||(n=new kf(g4e)),n._polygonHierarchy=i,n._ellipsoid=ie.clone(o,n._ellipsoid),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=l,n._stRotation=u,n._perPositionHeightExtrude=f,n._perPositionHeight=h,n._closeTop=p,n._closeBottom=g,n._shadowVolume=m,n._offsetAttribute=y===-1?void 0:y,n._arcType=b,n._textureCoordinates=x,n.packedLength=A,n};var y4e=new H,b4e=new H,x4e=new yc;function sae(e,t,n,i,o,r){let s=e.longitude,a=s>=0?s:s+O.TWO_PI;o.westOverIdl=Math.min(o.westOverIdl,a),o.eastOverIdl=Math.max(o.eastOverIdl,a),r.west=Math.min(r.west,s),r.east=Math.max(r.east,s);let l=e.getLatitude(n),u=l;if(r.south=Math.min(r.south,l),r.north=Math.max(r.north,l),i!==qt.RHUMB){let p=H.subtract(t.position,e.position,y4e),g=H.dot(t.position,p)/H.dot(p,p);if(g>0&&g<1){let m=H.add(t.position,H.multiplyByScalar(p,-g,p),b4e),y=yc.clone(t,x4e);y.position=m;let b=y.getLatitude(n);r.south=Math.min(r.south,b),r.north=Math.max(r.north,b),Math.abs(l)>Math.abs(b)&&(u=b)}}let f=t.x*e.y-e.x*t.y,h=Math.sign(f);h!==0&&(h*=H.angleBetween(t.position,e.position)),u>=0&&(o.northAngle+=h),u<=0&&(o.southAngle+=h)}var aae=new yc,T4e=new yc,Bf={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};kf.computeRectangleFromPositions=function(e,t,n,i){if(T.defined("positions",e),c(i)||(i=new ce),e.length<3)return i;i.west=Number.POSITIVE_INFINITY,i.east=Number.NEGATIVE_INFINITY,i.south=Number.POSITIVE_INFINITY,i.north=Number.NEGATIVE_INFINITY,Bf.northAngle=0,Bf.southAngle=0,Bf.westOverIdl=Number.POSITIVE_INFINITY,Bf.eastOverIdl=Number.NEGATIVE_INFINITY;let o=e.length,r=yc.fromCartesian(e[0],T4e);for(let s=1;s<o;s++){let a=yc.fromCartesian(e[s],aae);sae(a,r,t,n,Bf,i),r=yc.clone(a,r)}return sae(yc.fromCartesian(e[0],aae),r,t,n,Bf,i),i.east-i.west>Bf.eastOverIdl-Bf.westOverIdl&&(i.west=Bf.westOverIdl,i.east=Bf.eastOverIdl,i.east>O.PI&&(i.east=i.east-O.TWO_PI),i.west>O.PI&&(i.west=i.west-O.TWO_PI)),O.equalsEpsilon(Math.abs(Bf.northAngle),O.TWO_PI,O.EPSILON10)&&(i.north=O.PI_OVER_TWO,i.east=O.PI,i.west=-O.PI),O.equalsEpsilon(Math.abs(Bf.southAngle),O.TWO_PI,O.EPSILON10)&&(i.south=-O.PI_OVER_TWO,i.east=O.PI,i.west=-O.PI),i};var A4e=new yc;function C4e(e,t,n){return e.height>=O.PI||e.width>=O.PI?yc.fromCartesian(t[0],A4e).tangentPlane:ns.fromPoints(t,n)}var cae=new he;function E4e(e,t,n){return(i,o)=>{if(e.height>=O.PI||e.width>=O.PI){if(e.south<0&&e.north>0){c(o)||(o=[]);for(let s=0;s<i.length;++s){let a=n.cartesianToCartographic(i[s],cae);o[s]=new H(a.longitude/O.PI,a.latitude/O.PI_OVER_TWO)}return o.length=i.length,o}return yc.fromCartesianArray(i,o)}return ns.fromPoints(t,n).projectPointsOntoPlane(i,o)}}function S4e(e,t,n){if(e.height>=O.PI||e.width>=O.PI)return(o,r)=>{if(e.south<0&&e.north>0){let s=n.cartesianToCartographic(o,cae);return c(r)||(r=new H),r.x=s.longitude/O.PI,r.y=s.latitude/O.PI_OVER_TWO,r}return yc.fromCartesian(o,r)};let i=ns.fromPoints(t,n);return(o,r)=>i.projectPointsOntoPlane(o,r)}function w4e(e,t,n,i){return(o,r)=>!i&&(e.height>=O.PI_OVER_TWO||e.width>=2*O.PI_OVER_THREE)?zn.splitPolygonsOnEquator(o,t,n,r):o}function v4e(e,t,n,i){if(t.height>=O.PI||t.width>=O.PI)return Ke.fromRectangle(t,void 0,iae);let o=e,r=ns.fromPoints(o,n);return zn.computeBoundingRectangle(r.plane.normal,r.projectPointOntoPlane.bind(r),o,i,iae)}kf.createGeometry=function(e){let t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,l=e._closeBottom,u=e._arcType,f=e._textureCoordinates,h=c(f),p=r.positions;if(p.length<3)return;let g=e.rectangle,m=zn.polygonsFromHierarchy(r,h,E4e(g,p,n),!s,n,w4e(g,n,u,s)),y=m.hierarchy,b=m.polygons,x=function(I){return I},A=h?zn.polygonsFromHierarchy(f,!0,x,!1,n).polygons:void 0;if(y.length===0)return;let C=y[0].outerRing,S=v4e(C,g,n,o),v=[],P=e._height,M=e._extrudedHeight,R=e._perPositionHeightExtrude||!O.equalsEpsilon(P,M,0,O.EPSILON2),L={perPositionHeight:s,vertexFormat:t,geometry:void 0,rotationAxis:C4e(g,C,n).plane.normal,projectTo2d:S4e(g,C,n),boundingRectangle:S,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u},F;if(R)for(L.extrude=!0,L.top=a,L.bottom=l,L.shadowVolume=e._shadowVolume,L.offsetAttribute=e._offsetAttribute,F=0;F<b.length;F++){let I=m4e(n,b[F],h?A[F]:void 0,i,y[F],s,a,l,t,u),N;a&&l?(N=I.topAndBottom,L.geometry=zn.scaleToGeodeticHeightExtruded(N.geometry,P,M,n,s)):a?(N=I.topAndBottom,N.geometry.attributes.position.values=si.scaleToGeodeticHeight(N.geometry.attributes.position.values,P,n,!s),L.geometry=N.geometry):l&&(N=I.topAndBottom,N.geometry.attributes.position.values=si.scaleToGeodeticHeight(N.geometry.attributes.position.values,M,n,!0),L.geometry=N.geometry),(a||l)&&(L.wall=!1,N.geometry=k9(L),v.push(N));let k=I.walls;L.wall=!0;for(let z=0;z<k.length;z++){let V=k[z];L.geometry=zn.scaleToGeodeticHeightExtruded(V.geometry,P,M,n,s),V.geometry=k9(L),v.push(V)}}else for(F=0;F<b.length;F++){let I=new St({geometry:zn.createGeometryFromPositions(n,b[F],h?A[F]:void 0,i,s,t,u)});if(I.geometry.attributes.position.values=si.scaleToGeodeticHeight(I.geometry.attributes.position.values,P,n,!s),L.geometry=I.geometry,I.geometry=k9(L),c(e._offsetAttribute)){let N=I.geometry.attributes.position.values.length,k=e._offsetAttribute===Zt.NONE?0:1,z=new Uint8Array(N/3).fill(k);I.geometry.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:z})}v.push(I)}let _=Nn.combineInstances(v)[0];_.attributes.position.values=new Float64Array(_.attributes.position.values),_.indices=Fe.createTypedArray(_.attributes.position.values.length/3,_.indices);let w=_.attributes,D=le.fromVertices(w.position.values);return t.position||delete w.position,new ct({attributes:w,indices:_.indices,primitiveType:_.primitiveType,boundingSphere:D,offsetAttribute:e._offsetAttribute})};kf.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new kf({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})};function D4e(e){let t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];let n=e._ellipsoid,i=e._polygonHierarchy.positions,o=e.rectangle;return ct._textureCoordinateRotationPoints(i,t,n,o)}Object.defineProperties(kf.prototype,{rectangle:{get:function(){if(!c(this._rectangle)){let e=this._polygonHierarchy.positions;this._rectangle=kf.computeRectangleFromPositions(e,this._ellipsoid,this._arcType)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=D4e(this)),this._textureCoordinateRotationPoints}}});var s_=kf;function Cx(e){T.typeOf.object("options",e),T.typeOf.object("options.positions",e.positions),T.typeOf.number.greaterThanOrEquals("options.positions.length",e.positions.length,3),this._ellipsoid=e.ellipsoid??ie.default,this._positions=[...e.positions]}Object.defineProperties(Cx.prototype,{length:{get:function(){return this._positions.length}},positions:{get:function(){return this._positions}},ellipsoid:{get:function(){return this._ellipsoid}}});Cx.clone=function(e,t){return T.typeOf.object("polygon",e),c(t)?(t._ellipsoid=e.ellipsoid,t._positions.length=0,t._positions.push(...e.positions),t):new Cx({positions:e.positions,ellipsoid:e.ellipsoid})};Cx.equals=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.ellipsoid.equals(t.ellipsoid)&&e.positions===t.positions};Cx.prototype.computeRectangle=function(e){return s_.computeRectangleFromPositions(this.positions,this.ellipsoid,void 0,e)};var P4e=new ce,lae=new d;Cx.prototype.computeSphericalExtents=function(e){c(e)||(e=new ce);let t=this.computeRectangle(P4e),n=he.toCartesian(ce.southwest(t),this.ellipsoid,lae),i=Math.sqrt(n.x*n.x+n.y*n.y),o=O.fastApproximateAtan2(i,n.z),r=O.fastApproximateAtan2(n.x,n.y);return e.south=o,e.west=r,n=he.toCartesian(ce.northeast(t),this.ellipsoid,lae),i=Math.sqrt(n.x*n.x+n.y*n.y),o=O.fastApproximateAtan2(i,n.z),r=O.fastApproximateAtan2(n.x,n.y),e.north=o,e.east=r,e};var eE=Cx;var N1=`in vec2 v_textureCoordinates;
uniform int u_polygonsLength;
uniform int u_extentsLength;
uniform highp sampler2D u_polygonTexture;
uniform highp sampler2D u_extentsTexture;
int getPolygonIndex(float dimension, vec2 coord) {
vec2 uv = coord.xy * dimension;
return int(floor(uv.y) * dimension + floor(uv.x));
}
vec2 getLookupUv(ivec2 dimensions, int i) {
int pixY = i / dimensions.x;
int pixX = i - (pixY * dimensions.x);
float pixelWidth = 1.0 / float(dimensions.x);
float pixelHeight = 1.0 / float(dimensions.y);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
return vec2(u, v);
}
vec4 getExtents(int i) {
return texture(u_extentsTexture, getLookupUv(textureSize(u_extentsTexture, 0), i));
}
ivec2 getPositionsLengthAndExtentsIndex(int i) {
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
vec4 value = texture(u_polygonTexture, uv);
return ivec2(int(value.x), int(value.y));
}
vec2 getPolygonPosition(int i) {
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
return texture(u_polygonTexture, uv).xy;
}
vec2 getCoordinates(vec2 textureCoordinates, vec4 extents) {
float latitude = mix(extents.x, extents.x + 1.0 / extents.z, textureCoordinates.y);
float longitude = mix(extents.y, extents.y + 1.0 / extents.w, textureCoordinates.x);
return vec2(latitude, longitude);
}
void main() {
int lastPolygonIndex = 0;
out_FragColor = vec4(1.0);
float dimension = float(u_extentsLength);
if (u_extentsLength > 2) {
dimension = ceil(log2(float(u_extentsLength)));
}
int regionIndex = getPolygonIndex(dimension, v_textureCoordinates);
for (int polygonIndex = 0; polygonIndex < u_polygonsLength; polygonIndex++) {
ivec2 positionsLengthAndExtents = getPositionsLengthAndExtentsIndex(lastPolygonIndex);
int positionsLength = positionsLengthAndExtents.x;
int polygonExtentsIndex = positionsLengthAndExtents.y;
lastPolygonIndex += 1;
if (polygonExtentsIndex == regionIndex) {
float clipAmount = czm_infinity;
vec4 extents = getExtents(polygonExtentsIndex);
vec2 textureOffset = vec2(mod(float(polygonExtentsIndex), dimension), floor(float(polygonExtentsIndex) / dimension)) / dimension;
vec2 p = getCoordinates((v_textureCoordinates - textureOffset) * dimension, extents);
float s = 1.0;
for (int i = 0, j = positionsLength - 1; i < positionsLength; j = i, i++) {
vec2 a = getPolygonPosition(lastPolygonIndex + i);
vec2 b = getPolygonPosition(lastPolygonIndex + j);
vec2 ab = b - a;
vec2 pa = p - a;
float t = dot(pa, ab) / dot(ab, ab);
t = clamp(t, 0.0, 1.0);
vec2 pq = pa - t * ab;
float d = length(pq);
bvec3 cond = bvec3(p.y >= a.y,
p.y < b.y,
ab.x * pa.y > ab.y * pa.x);
if (all(cond) || all(not(cond))) s = -s;
if (abs(d) < abs(clipAmount)) {
clipAmount = d;
}
}
vec4 result = (s * vec4(clipAmount * length(extents.zw))) / 2.0 + 0.5;
out_FragColor = min(out_FragColor, result);
}
lastPolygonIndex += positionsLength;
}
}
`;function os(e){e=e??W.EMPTY_OBJECT,this._polygons=[],this._totalPositions=0,this.enabled=e.enabled??!0,this.inverse=e.inverse??!1,this.polygonAdded=new pe,this.polygonRemoved=new pe,this._owner=void 0,this._float32View=void 0,this._extentsFloat32View=void 0,this._extentsCount=0,this._polygonsTexture=void 0,this._extentsTexture=void 0,this._signedDistanceTexture=void 0,this._signedDistanceComputeCommand=void 0;let t=e.polygons;if(c(t)){let n=t.length;for(let i=0;i<n;++i)this._polygons.push(t[i])}}Object.defineProperties(os.prototype,{length:{get:function(){return this._polygons.length}},totalPositions:{get:function(){return this._totalPositions}},extentsTexture:{get:function(){return this._extentsTexture}},extentsCount:{get:function(){return this._extentsCount}},pixelsNeededForExtents:{get:function(){return this.length}},pixelsNeededForPolygonPositions:{get:function(){return this.totalPositions+this.length}},clippingTexture:{get:function(){return this._signedDistanceTexture}},owner:{get:function(){return this._owner}},clippingPolygonsState:{get:function(){return this.inverse?-this.extentsCount:this.extentsCount}}});os.prototype.add=function(e){T.typeOf.object("polygon",e);let t=this._polygons.length;return this._polygons.push(e),this.polygonAdded.raiseEvent(e,t),e};os.prototype.get=function(e){return T.typeOf.number("index",e),this._polygons[e]};os.prototype.contains=function(e){return T.typeOf.object("polygon",e),this._polygons.some(t=>eE.equals(t,e))};os.prototype.remove=function(e){T.typeOf.object("polygon",e);let t=this._polygons,n=t.findIndex(i=>eE.equals(i,e));return n===-1?!1:(t.splice(n,1),this.polygonRemoved.raiseEvent(e,n),!0)};var I4e=new ce;function O4e(e){let t=[],n=[],i=e.length;for(let r=0;r<i;++r){let a=e[r].computeSphericalExtents(),l=Math.max(a.height*2.5,.001),u=Math.max(a.width*2.5,.001),f=ce.clone(a);f.south-=l,f.west-=u,f.north+=l,f.east+=u,f.south=Math.max(f.south,-Math.PI),f.west=Math.max(f.west,-Math.PI),f.north=Math.min(f.north,Math.PI),f.east=Math.min(f.east,Math.PI);let h=[r];for(let p=0;p<t.length;++p){let g=t[p];if(c(g)&&c(ce.simpleIntersection(g,f))&&!ce.equals(g,f)){let m=n[p];h.push(...m),m.reduce((y,b)=>ce.union(e[b].computeSphericalExtents(I4e),y,y),a),t[p]=void 0,n[p]=void 0,l=Math.max(a.height*2.5,.001),u=Math.max(a.width*2.5,.001),f=ce.clone(a,f),f.south-=l,f.west-=u,f.north+=l,f.east+=u,f.south=Math.max(f.south,-Math.PI),f.west=Math.max(f.west,-Math.PI),f.north=Math.min(f.north,Math.PI),f.east=Math.min(f.east,Math.PI),p=-1}}t.push(f),n.push(h)}let o=new Map;return n.filter(c).forEach((r,s)=>r.forEach(a=>o.set(a,s))),{extentsList:t.filter(c),extentsIndexByPolygon:o}}os.prototype.removeAll=function(){let e=this._polygons,t=e.length;for(let n=0;n<t;++n){let i=e[n];this.polygonRemoved.raiseEvent(i,n)}this._polygons=[]};function R4e(e){let t=e._float32View,n=e._extentsFloat32View,i=e._polygons,{extentsList:o,extentsIndexByPolygon:r}=O4e(i),s=0;for(let[l,u]of i.entries()){let f=u.length;t[s++]=f,t[s++]=r.get(l);for(let h=0;h<f;++h){let p=u.positions[h],g=Math.hypot(p.x,p.y),m=O.fastApproximateAtan2(g,p.z),y=O.fastApproximateAtan2(p.x,p.y);t[s++]=m,t[s++]=y}}let a=0;for(let l of o){let u=1/(l.east-l.west),f=1/(l.north-l.south);n[a++]=l.south,n[a++]=l.west,n[a++]=f,n[a++]=u}e._extentsCount=o.length}var U9=new H;os.prototype.update=function(e){let t=e.context;if(!os.isSupported(e))throw new ae("ClippingPolygonCollections are only supported for WebGL 2.");let n=this._polygons.reduce((s,a)=>s+a.length,0);if(n===this.totalPositions||(this._totalPositions=n,this.length===0))return;c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0,this._signedDistanceComputeCommand=void 0);let i=this._polygonsTexture,o=this._extentsTexture,r=this._signedDistanceTexture;if(c(i)){let s=i.width*i.height;(s<this.pixelsNeededForPolygonPositions||this.pixelsNeededForPolygonPositions<.25*s)&&(i.destroy(),i=void 0,this._polygonsTexture=void 0)}if(!c(i)){let s=os.getTextureResolution(i,this.pixelsNeededForPolygonPositions,U9);i=new Rt({context:t,width:s.x,height:s.y,pixelFormat:ke.RG,pixelDatatype:Ue.FLOAT,sampler:Qt.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*2),this._polygonsTexture=i}if(c(o)){let s=o.width*o.height;(s<this.pixelsNeededForExtents||this.pixelsNeededForExtents<.25*s)&&(o.destroy(),o=void 0,this._extentsTexture=void 0)}if(!c(o)){let s=os.getTextureResolution(o,this.pixelsNeededForExtents,U9);o=new Rt({context:t,width:s.x,height:s.y,pixelFormat:ke.RGBA,pixelDatatype:Ue.FLOAT,sampler:Qt.NEAREST,flipY:!1}),this._extentsFloat32View=new Float32Array(s.x*s.y*4),this._extentsTexture=o}if(R4e(this),o.copyFrom({source:{width:o.width,height:o.height,arrayBufferView:this._extentsFloat32View}}),i.copyFrom({source:{width:i.width,height:i.height,arrayBufferView:this._float32View}}),!c(r)){let s=os.getClippingDistanceTextureResolution(this,U9);r=new Rt({context:t,width:s.x,height:s.y,pixelFormat:t.webgl2?ke.RED:ke.LUMINANCE,pixelDatatype:Ue.FLOAT,sampler:new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR,magnificationFilter:li.LINEAR}),flipY:!1}),this._signedDistanceTexture=r}this._signedDistanceComputeCommand=M4e(this)};os.prototype.queueCommands=function(e){c(this._signedDistanceComputeCommand)&&e.commandList.push(this._signedDistanceComputeCommand)};function M4e(e){let t=e._polygonsTexture,n=e._extentsTexture;return new Uc({fragmentShaderSource:N1,outputTexture:e._signedDistanceTexture,uniformMap:{u_polygonsLength:function(){return e.length},u_extentsLength:function(){return e.extentsCount},u_extentsTexture:function(){return n},u_polygonTexture:function(){return t}},persists:!1,owner:e,postExecute:()=>{e._signedDistanceComputeCommand=void 0}})}var uae=new ce,L4e=new ce;os.prototype.computeIntersectionWithBoundingVolume=function(e,t){let n=this._polygons,i=n.length,o=Wt.OUTSIDE;this.inverse&&(o=Wt.INSIDE);for(let r=0;r<i;++r){let a=n[r].computeRectangle(),l=e.rectangle;if(!c(l)&&c(e.boundingVolume?.computeCorners)){let f=e.boundingVolume.computeCorners();l=ce.fromCartesianArray(f,t,uae)}c(l)||(l=ce.fromBoundingSphere(e.boundingSphere,t,uae));let u=ce.simpleIntersection(l,a,L4e);c(u)&&(o=Wt.INTERSECTING)}return o};os.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new E("ClippingPolygonCollection should only be assigned to one object");e._owner=t,t[n]=e}};os.isSupported=function(e){return e?.context.webgl2};os.getTextureResolution=function(e,t,n){if(c(e))return n.x=e.width,n.y=e.height,n;let i=ut.maximumTextureSize;return n.x=Math.min(t,i),n.y=Math.ceil(t/n.x),n.y*=2,n};os.getClippingDistanceTextureResolution=function(e,t){let n=e.signedDistanceTexture;return c(n)?(t.x=n.width,t.y=n.height,t):(t.x=Math.min(ut.maximumTextureSize,4096),t.y=Math.min(ut.maximumTextureSize,4096),t)};os.getClippingExtentsTextureResolution=function(e,t){let n=e.extentsTexture;return c(n)?(t.x=n.width,t.y=n.height,t):os.getTextureResolution(n,e.pixelsNeededForExtents,t)};os.prototype.isDestroyed=function(){return!1};os.prototype.destroy=function(){return c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0),this._polygonsTexture=this._polygonsTexture&&this._polygonsTexture.destroy(),this._extentsTexture=this._extentsTexture&&this._extentsTexture.destroy(),this._signedDistanceTexture=this._signedDistanceTexture&&this._signedDistanceTexture.destroy(),de(this)};var th=os;var F1={NONE:0,SCENE_LIGHT:1,SUNLIGHT:2};F1.fromGlobeFlags=function(e){return e.enableLighting&&e.dynamicAtmosphereLighting?e.dynamicAtmosphereLightingFromSun?F1.SUNLIGHT:F1.SCENE_LIGHT:F1.NONE};var a_=Object.freeze(F1);function fae(){this.lightIntensity=10,this.rayleighCoefficient=new d(55e-7,13e-6,284e-7),this.mieCoefficient=new d(21e-6,21e-6,21e-6),this.rayleighScaleHeight=1e4,this.mieScaleHeight=3200,this.mieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.dynamicLighting=a_.NONE}fae.requiresColorCorrect=function(e){return!(O.equalsEpsilon(e.hueShift,0,O.EPSILON7)&&O.equalsEpsilon(e.saturationShift,0,O.EPSILON7)&&O.equalsEpsilon(e.brightnessShift,0,O.EPSILON7))};var Ex=fae;var nh=`uniform vec3 u_radiiAndDynamicAtmosphereColor;
uniform float u_atmosphereLightIntensity;
uniform float u_atmosphereRayleighScaleHeight;
uniform float u_atmosphereMieScaleHeight;
uniform float u_atmosphereMieAnisotropy;
uniform vec3 u_atmosphereRayleighCoefficient;
uniform vec3 u_atmosphereMieCoefficient;
const float ATMOSPHERE_THICKNESS = 111e3;
const int PRIMARY_STEPS_MAX = 16;
const int LIGHT_STEPS_MAX = 4;
void computeScattering(
czm_ray primaryRay,
float primaryRayLength,
vec3 lightDirection,
float atmosphereInnerRadius,
out vec3 rayleighColor,
out vec3 mieColor,
out float opacity
) {
rayleighColor = vec3(0.0);
mieColor = vec3(0.0);
opacity = 0.0;
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
vec3 origin = vec3(0.0);
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
return;
}
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
float start_0 = primaryRayAtmosphereIntersect.start;
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
float x_o_a = start_0 - ATMOSPHERE_THICKNESS;
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0);
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0);
float rayPositionLength = primaryRayAtmosphereIntersect.start;
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
vec3 rayleighAccumulation = vec3(0.0);
vec3 mieAccumulation = vec3(0.0);
vec2 opticalDepth = vec2(0.0);
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
if (i >= PRIMARY_STEPS) {
break;
}
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
opticalDepth += sampleDensity;
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
float lightPositionLength = 0.0;
vec2 lightOpticalDepth = vec2(0.0);
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
if (j >= LIGHT_STEPS) {
break;
}
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
lightPositionLength += lightStepLength;
}
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
rayleighAccumulation += sampleDensity.x * attenuation;
mieAccumulation += sampleDensity.y * attenuation;
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
}
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
mieColor = u_atmosphereMieCoefficient * mieAccumulation;
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
}
vec4 computeAtmosphereColor(
vec3 positionWC,
vec3 lightDirection,
vec3 rayleighColor,
vec3 mieColor,
float opacity
) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
float cosAngleSq = cosAngle * cosAngle;
float G = u_atmosphereMieAnisotropy;
float GSq = G * G;
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
vec3 rayleigh = rayleighPhase * rayleighColor;
vec3 mie = miePhase * mieColor;
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;
return vec4(color, opacity);
}
`;var B1=`uniform samplerCube u_radianceMap;
in vec2 v_textureCoordinates;
const float twoSqrtPi = 2.0 * sqrt(czm_pi);
float computeShBasis(int index, vec3 s) {
if (index == 0) {
return 1.0 / twoSqrtPi;
}
if (index == 1) {
return -sqrt(3.0) * s.y / twoSqrtPi;
}
if (index == 2) {
return sqrt(3.0) * s.z / twoSqrtPi;
}
if (index == 3) {
return -sqrt(3.0) * s.x / twoSqrtPi;
}
if (index == 4) {
return sqrt(15.0) * s.y * s.x / twoSqrtPi;
}
if (index == 5) {
return -sqrt(15.0) * s.y * s.z / twoSqrtPi;
}
if (index == 6) {
return sqrt(5.0) * (3.0 * s.z * s.z - 1.0) / 2.0 / twoSqrtPi;
}
if (index == 7) {
return -sqrt(15.0) * s.x * s.z / twoSqrtPi;
}
if (index == 8) {
return sqrt(15.0) * (s.x * s.x - s.y * s.y) / 2.0 / twoSqrtPi;
}
return 0.0;
}
float vdcRadicalInverse(int i)
{
float r;
float base = 2.0;
float value = 0.0;
float invBase = 1.0 / base;
float invBi = invBase;
for (int x = 0; x < 100; x++)
{
if (i <= 0)
{
break;
}
r = mod(float(i), base);
value += r * invBi;
invBi *= invBase;
i = int(float(i) * invBase);
}
return value;
}
vec2 hammersley2D(int i, int N)
{
return vec2(float(i) / float(N), vdcRadicalInverse(i));
}
const int samples = 256;
const float solidAngle = 1.0 / float(samples);
void main() {
vec2 uv = v_textureCoordinates.xy * 3.0;
int coefficientIndex = int(floor(uv.y) * 3.0 + floor(uv.x));
for (int i = 0; i < samples; ++i) {
vec2 xi = hammersley2D(i, samples);
float phi = czm_twoPi * xi.x;
float cosTheta = 1.0 - 2.0 * sqrt(1.0 - xi.y * xi.y);
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
vec3 direction = normalize(vec3(sinTheta * cos(phi), cosTheta, sinTheta * sin(phi)));
float Ylm = computeShBasis(coefficientIndex, direction);
vec3 lookupDirection = -direction.xyz;
lookupDirection.z = -lookupDirection.z;
vec4 color = czm_textureCube(u_radianceMap, lookupDirection, 0.0);
out_FragColor += Ylm * color * solidAngle * sinTheta;
}
}
`;var k1=`precision highp float;
in vec2 v_textureCoordinates;
uniform vec3 u_faceDirection;
uniform vec3 u_positionWC;
uniform mat4 u_enuToFixedFrame;
uniform vec4 u_brightnessSaturationGammaIntensity;
uniform vec4 u_groundColor;
vec4 getCubeMapDirection(vec2 uv, vec3 faceDir) {
vec2 scaledUV = uv * 2.0 - 1.0;
if (faceDir.x != 0.0) {
return vec4(faceDir.x,  scaledUV.x * faceDir.x, -scaledUV.y, 0.0);
} else if (faceDir.y != 0.0) {
return vec4(scaledUV.x, -scaledUV.y * faceDir.y, faceDir.y, 0.0);
} else {
return vec4(scaledUV.x * faceDir.z, -faceDir.z, -scaledUV.y, 0.0);
}
}
void main() {
float height = length(u_positionWC);
float atmosphereInnerRadius = u_radiiAndDynamicAtmosphereColor.y;
float ellipsoidHeight = max(height - atmosphereInnerRadius, 0.0);
vec3 positionWC = u_positionWC / height * (ellipsoidHeight + atmosphereInnerRadius);
float atmosphereOuterRadius = u_radiiAndDynamicAtmosphereColor.x;
float atmosphereHeight = atmosphereOuterRadius - atmosphereInnerRadius;
vec3 direction = (u_enuToFixedFrame * getCubeMapDirection(v_textureCoordinates, u_faceDirection)).xyz;
vec3 normalizedDirection = normalize(direction);
czm_ray ray = czm_ray(positionWC, normalizedDirection);
czm_raySegment intersection = czm_raySphereIntersectionInterval(ray, vec3(0.0), atmosphereInnerRadius);
if (!czm_isEmpty(intersection)) {
intersection = czm_rayEllipsoidIntersectionInterval(ray, vec3(0.0), czm_ellipsoidInverseRadii);
}
bool onEllipsoid = intersection.start >= 0.0;
float rayLength = czm_branchFreeTernary(onEllipsoid, intersection.start, atmosphereOuterRadius);
vec3 skyPositionWC = positionWC + normalizedDirection * rayLength;
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirectionWC = normalize(czm_getDynamicAtmosphereLightDirection(skyPositionWC, lightEnum));
vec3 mieColor;
vec3 rayleighColor;
float opacity;
czm_computeScattering(
ray,
rayLength,
lightDirectionWC,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
vec4 atmopshereColor = czm_computeAtmosphereColor(ray, lightDirectionWC, rayleighColor, mieColor, opacity);
#ifdef ATMOSPHERE_COLOR_CORRECT
const bool ignoreBlackPixels = true;
atmopshereColor.rgb = czm_applyHSBShift(atmopshereColor.rgb, czm_atmosphereHsbShift, ignoreBlackPixels);
#endif
vec3 lookupDirection = -normalizedDirection;
lookupDirection.x = -lookupDirection.x;
lookupDirection = -normalize(czm_temeToPseudoFixed * lookupDirection);
lookupDirection.x = -lookupDirection.x;
float skyAlpha = clamp((1.0 - ellipsoidHeight / atmosphereHeight) * atmopshereColor.a, 0.0, 1.0);
skyAlpha = czm_branchFreeTernary(length(atmopshereColor.rgb) <= czm_epsilon7, 0.0, skyAlpha);
float intensity = u_brightnessSaturationGammaIntensity.w;
vec4 sceneSkyBoxColor = czm_textureCube(czm_environmentMap, lookupDirection);
vec3 skyBackgroundColor = mix(czm_backgroundColor.rgb, sceneSkyBoxColor.rgb, sceneSkyBoxColor.a);
vec4 combinedSkyColor = vec4(mix(skyBackgroundColor, atmopshereColor.rgb * intensity, skyAlpha), 1.0);
vec3 up = normalize(positionWC);
float occlusion = max(dot(lightDirectionWC, up), 0.05);
vec4 groundColor = vec4(u_groundColor.rgb * u_groundColor.a * (vec3(intensity * occlusion) + atmopshereColor.rgb), 1.0);
vec4 blendedGroundColor = mix(groundColor, atmopshereColor, clamp(ellipsoidHeight / atmosphereHeight, 0.0, 1.0));
vec4 color = czm_branchFreeTernary(onEllipsoid, blendedGroundColor, combinedSkyColor);
float brightness = u_brightnessSaturationGammaIntensity.x;
float saturation = u_brightnessSaturationGammaIntensity.y;
float gamma = u_brightnessSaturationGammaIntensity.z;
#ifdef ENVIRONMENT_COLOR_CORRECT
color.rgb = mix(vec3(0.0), color.rgb, brightness);
color.rgb = czm_saturation(color.rgb, saturation);
#endif
color.rgb = pow(color.rgb, vec3(gamma));
color.rgb = czm_gammaCorrect(color.rgb);
out_FragColor = color;
}
`;var U1=`precision highp float;
in vec3 v_textureCoordinates;
uniform float u_roughness;
uniform samplerCube u_radianceTexture;
uniform vec3 u_faceDirection;
float vdcRadicalInverse(int i)
{
float r;
float base = 2.0;
float value = 0.0;
float invBase = 1.0 / base;
float invBi = invBase;
for (int x = 0; x < 100; x++)
{
if (i <= 0)
{
break;
}
r = mod(float(i), base);
value += r * invBi;
invBi *= invBase;
i = int(float(i) * invBase);
}
return value;
}
vec2 hammersley2D(int i, int N)
{
return vec2(float(i) / float(N), vdcRadicalInverse(i));
}
vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float phi = czm_twoPi * xi.x;
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 tangentX = normalize(cross(upVector, N));
vec3 tangentY = cross(N, tangentX);
return tangentX * H.x + tangentY * H.y + N * H.z;
}
const int samples = 128;
void main() {
vec3 normal = u_faceDirection;
vec3 V = normalize(v_textureCoordinates);
float roughness = u_roughness;
vec4 color = vec4(0.0);
float weight = 0.0;
for (int i = 0; i < samples; ++i) {
vec2 xi = hammersley2D(i, samples);
vec3 H = importanceSampleGGX(xi, roughness, V);
vec3 L = 2.0 * dot(V, H) * H - V;
float NdotL = max(dot(V, L), 0.0);
if (NdotL > 0.0) {
color += vec4(czm_textureCube(u_radianceTexture, L).rgb, 1.0) * NdotL;
weight += NdotL;
}
}
out_FragColor = color / weight;
}
`;var V1=`in vec3 position;
out vec3 v_textureCoordinates;
uniform vec3 u_faceDirection;
vec3 getCubeMapDirection(vec2 uv, vec3 faceDir) {
vec2 scaledUV = uv;
if (faceDir.x != 0.0) {
return vec3(faceDir.x, scaledUV.y, scaledUV.x * faceDir.x);
} else if (faceDir.y != 0.0) {
return vec3(scaledUV.x, -faceDir.y, -scaledUV.y * faceDir.y);
} else {
return vec3(scaledUV.x * faceDir.z, scaledUV.y, -faceDir.z);
}
}
void main()
{
v_textureCoordinates = getCubeMapDirection(position.xy, u_faceDirection);
v_textureCoordinates.y = -v_textureCoordinates.y;
v_textureCoordinates.z = -v_textureCoordinates.z;
gl_Position = vec4(position, 1.0);
}
`;function Qn(e){this._position=void 0,this._radianceMapDirty=!1,this._radianceCommandsDirty=!1,this._convolutionsCommandsDirty=!1,this._irradianceCommandDirty=!1,this._irradianceTextureDirty=!1,this._sphericalHarmonicCoefficientsDirty=!1,this._shouldRegenerateShaders=!1,this._shouldReset=!1,e=e??W.EMPTY_OBJECT;let t=Math.min(e.mipmapLevels??7,Math.log2(ut.maximumCubeMapSize));this._mipmapLevels=t,this._radianceMapComputeCommands=new Array(6),this._convolutionComputeCommands=new Array((t-1)*6),this._irradianceComputeCommand=void 0,this._radianceMapFS=void 0,this._irradianceMapFS=void 0,this._convolveSP=void 0,this._va=void 0,this._radianceMapTextures=new Array(6),this._specularMapTextures=new Array((t-1)*6),this._radianceCubeMap=void 0,this._irradianceMapTexture=void 0,this._sphericalHarmonicCoefficients=Qn.DEFAULT_SPHERICAL_HARMONIC_COEFFICIENTS.slice(),this._lastTime=new Q;let n=Math.pow(2,t-1);this._textureDimensions=new H(n,n),this._radiiAndDynamicAtmosphereColor=new d,this._sceneEnvironmentMap=void 0,this._backgroundColor=void 0,this._owner=void 0,this.enabled=e.enabled??!0,this.shouldUpdate=!0,this.maximumSecondsDifference=e.maximumSecondsDifference??60*60,this.maximumPositionEpsilon=e.maximumPositionEpsilon??1e3,this.atmosphereScatteringIntensity=e.atmosphereScatteringIntensity??2,this.gamma=e.gamma??1,this.brightness=e.brightness??1,this.saturation=e.saturation??1,this.groundColor=e.groundColor??Qn.AVERAGE_EARTH_GROUND_COLOR,this.groundAlbedo=e.groundAlbedo??.31}Object.defineProperties(Qn.prototype,{owner:{get:function(){return this._owner}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},position:{get:function(){return this._position},set:function(e){d.equalsEpsilon(e,this._position,0,this.maximumPositionEpsilon)||(this._position=d.clone(e,this._position),this._shouldReset=!0)}},radianceCubeMap:{get:function(){return this._radianceCubeMap}},maximumMipmapLevel:{get:function(){return this._mipmapLevels}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}}});Qn._maximumComputeCommandCount=8;Qn._activeComputeCommandCount=0;Qn._nextFrameCommandQueue=[];Qn._queueCommand=(e,t)=>{if(Qn._activeComputeCommandCount>=Qn._maximumComputeCommandCount){Qn._nextFrameCommandQueue.push(e);return}t.commandList.push(e),Qn._activeComputeCommandCount++};Qn._updateCommandQueue=e=>{if(Qn._maximumComputeCommandCount=Math.log2(ut.maximumCubeMapSize),Qn._nextFrameCommandQueue.length>0&&Qn._activeComputeCommandCount<Qn._maximumComputeCommandCount){let t=Qn._nextFrameCommandQueue.shift();for(;c(t)&&Qn._activeComputeCommandCount<Qn._maximumComputeCommandCount;){if(t.owner.isDestroyed()||t.canceled){t=Qn._nextFrameCommandQueue.shift();continue}e.commandList.push(t),Qn._activeComputeCommandCount++,t=Qn._nextFrameCommandQueue.shift()}c(t)&&Qn._nextFrameCommandQueue.push(t)}};Qn.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new E("DynamicEnvironmentMapManager should only be assigned to one object");e._owner=t,t[n]=e}};Qn.prototype.reset=function(){let e=this._radianceMapComputeCommands.length;for(let t=0;t<e;++t)c(this._radianceMapComputeCommands[t])&&(this._radianceMapComputeCommands[t].canceled=!0),this._radianceMapComputeCommands[t]=void 0;e=this._convolutionComputeCommands.length;for(let t=0;t<e;++t)c(this._convolutionComputeCommands[t])&&(this._convolutionComputeCommands[t].canceled=!0),this._convolutionComputeCommands[t]=void 0;c(this._irradianceComputeCommand)&&(this._irradianceComputeCommand.canceled=!0,this._irradianceComputeCommand=void 0),this._radianceMapDirty=!0,this._radianceCommandsDirty=!0,this._convolutionsCommandsDirty=!1,this._irradianceCommandDirty=!1};var N4e=new d,F4e=new d;function B4e(e,t){let n=e._position,i=t.atmosphere,o=t.mapProjection.ellipsoid,r=o.scaleToGeodeticSurface(n,F4e),s=1.025,a=N4e,l=c(r)?d.magnitude(r):o.maximumRadius;return a.x=l*s,a.y=l,a.z=i.dynamicLighting,!d.equalsEpsilon(e._radiiAndDynamicAtmosphereColor,a)||t.environmentMap!==e._sceneEnvironmentMap||t.backgroundColor!==e._backgroundColor?(d.clone(a,e._radiiAndDynamicAtmosphereColor),e._sceneEnvironmentMap=t.environmentMap,e._backgroundColor=t.backgroundColor,!0):!1}var dae=new d,k4e=new B,U4e=new se,V4e=new G;function z4e(e,t){let n=t.context,i=e._textureDimensions;if(c(e._radianceCubeMap)||(e._radianceCubeMap=new Go({context:n,width:i.x,height:i.y,pixelDatatype:Ue.UNSIGNED_BYTE,pixelFormat:ke.RGBA})),e._radianceCommandsDirty){let o=e._radianceMapFS;c(o)||(o=new He({sources:[nh,k1]}),e._radianceMapFS=o),Ex.requiresColorCorrect(t.atmosphere)&&o.defines.push("ATMOSPHERE_COLOR_CORRECT");let r=e._position,s=e._radiiAndDynamicAtmosphereColor,a=t.mapProjection.ellipsoid,l=Ot.eastNorthUpToFixedFrame(r,a,k4e),u=U4e;u.x=e.brightness,u.y=e.saturation,u.z=e.gamma,u.w=e.atmosphereScatteringIntensity,(e.brightness!==1||e.saturation!==1||e.gamma!==1)&&o.defines.push("ENVIRONMENT_COLOR_CORRECT");let f=0;for(let h of Go.faceNames()){let p=e._radianceMapTextures[f];c(p)&&!p.isDestroyed()&&p.destroy(),p=new Rt({context:n,width:i.x,height:i.y,pixelDatatype:Ue.UNSIGNED_BYTE,pixelFormat:ke.RGBA}),e._radianceMapTextures[f]=p;let g=f,m=new Uc({fragmentShaderSource:o,outputTexture:p,uniformMap:{u_radiiAndDynamicAtmosphereColor:()=>s,u_enuToFixedFrame:()=>l,u_faceDirection:()=>Go.getDirection(h,dae),u_positionWC:()=>r,u_brightnessSaturationGammaIntensity:()=>u,u_groundColor:()=>e.groundColor.withAlpha(e.groundAlbedo,V4e)},owner:e});m.postExecute=()=>{if(e.isDestroyed()||m.canceled){Qn._activeComputeCommandCount--;return}let y=e._radianceMapComputeCommands;y[g]=void 0;let b=new Ur({context:n,colorTextures:[e._radianceMapTextures[g]]});b._bind(),e._radianceCubeMap[h].copyFromFramebuffer(),b._unBind(),b.destroy(),Qn._activeComputeCommandCount--,y.some(c)||(e._convolutionsCommandsDirty=!0,e._shouldRegenerateShaders=!0)},e._radianceMapComputeCommands[f]=m,Qn._queueCommand(m,t),f++}e._radianceCommandsDirty=!1}}function H4e(e,t){let n=e._radianceCubeMap;n.generateMipmap();let i=e._mipmapLevels,o=e._textureDimensions,r=o.x/2,s=o.y/2,a=t.context,l=0,u=(h,p,g,m,y)=>()=>{if(e.isDestroyed()||h.canceled){Qn._activeComputeCommandCount--;return}let b=e._convolutionComputeCommands;b[p]=void 0,n.copyFace(t,g,m,y),l++,Qn._activeComputeCommandCount--,g.destroy(),e._specularMapTextures[p]=void 0;let x=e._specularMapTextures.length;l>=x&&(e._irradianceCommandDirty=!0,n.sampler=new Qt({minificationFilter:Yt.LINEAR_MIPMAP_LINEAR}),e._shouldRegenerateShaders=!0,e._va.destroy(),e._va=void 0,e._convolveSP.destroy(),e._convolveSP=void 0)},f=0;for(let h=1;h<i;++h){for(let p of Go.faceNames()){c(e._specularMapTextures[f])&&e._specularMapTextures[f].destroy();let g=e._specularMapTextures[f]=new Rt({context:a,width:r,height:s,pixelDatatype:Ue.UNSIGNED_BYTE,pixelFormat:ke.RGBA}),m=e._va;c(m)||(m=Go.createVertexArray(a,p),e._va=m);let y=e._convolveSP;c(y)||(y=Jt.fromCache({context:a,vertexShaderSource:V1,fragmentShaderSource:U1,attributeLocations:{positions:0}}),e._convolveSP=y);let b=new Uc({shaderProgram:y,vertexArray:m,outputTexture:g,persists:!0,owner:e,uniformMap:{u_roughness:()=>h/(i-1),u_radianceTexture:()=>n??a.defaultTexture,u_faceDirection:()=>Go.getDirection(p,dae)}});b.postExecute=u(b,f,g,p,h),e._convolutionComputeCommands[f]=b,Qn._queueCommand(b,t),++f}r/=2,s/=2}}var hae=new H(3,3);function G4e(e,t){let n=t.context,i=hae,o=e._irradianceMapTexture;c(o)&&!o.isDestroyed()&&o.destroy(),o=new Rt({context:n,width:i.x,height:i.y,pixelDatatype:Ue.FLOAT,pixelFormat:ke.RGBA}),e._irradianceMapTexture=o;let r=e._irradianceMapFS;c(r)||(r=new He({sources:[B1]}),e._irradianceMapFS=r);let s=new Uc({fragmentShaderSource:r,outputTexture:o,owner:e,uniformMap:{u_radianceMap:()=>e._radianceCubeMap??n.defaultTexture}});s.postExecute=()=>{if(e.isDestroyed()||s.canceled){Qn._activeComputeCommandCount--;return}e._irradianceTextureDirty=!1,e._irradianceComputeCommand=void 0,e._sphericalHarmonicCoefficientsDirty=!0,e._irradianceMapFS=void 0,Qn._activeComputeCommandCount--},e._irradianceComputeCommand=s,Qn._queueCommand(s,t),e._irradianceTextureDirty=!0}function j4e(e,t){let n=t.context;if(!c(e._irradianceMapTexture))return;let i=new Ur({context:n,colorTextures:[e._irradianceMapTexture],destroyAttachments:!1}),o=hae,r=n.readPixels({x:0,y:0,width:o.x,height:o.y,framebuffer:i});for(let s=0;s<9;++s)e._sphericalHarmonicCoefficients[s]=d.unpack(r,s*4),d.multiplyByScalar(e._sphericalHarmonicCoefficients[s],e.atmosphereScatteringIntensity,e._sphericalHarmonicCoefficients[s]);i.destroy(),e._irradianceMapTexture.destroy(),e._irradianceMapTexture=void 0,e._shouldRegenerateShaders=!0}Qn.prototype.update=function(e){let t=e.mode;if(!Qn.isDynamicUpdateSupported(e)||!this.enabled||!this.shouldUpdate||!c(this._position)||t===oe.MORPHING){this._shouldRegenerateShaders=!1;return}Qn._updateCommandQueue(e);let i=e.atmosphere.dynamicLighting,o=B4e(this,e)||i===a_.SUNLIGHT&&!Q.equalsEpsilon(e.time,this._lastTime,this.maximumSecondsDifference);if(this._shouldReset||o){this.reset(),this._shouldReset=!1,this._lastTime=Q.clone(e.time,this._lastTime);return}if(this._radianceMapDirty&&(z4e(this,e),this._radianceMapDirty=!1),this._convolutionsCommandsDirty&&(H4e(this,e),this._convolutionsCommandsDirty=!1),this._irradianceCommandDirty&&(G4e(this,e),this._irradianceCommandDirty=!1),this._irradianceTextureDirty){this._shouldRegenerateShaders=!1;return}if(this._sphericalHarmonicCoefficientsDirty){j4e(this,e),this._sphericalHarmonicCoefficientsDirty=!1;return}this._shouldRegenerateShaders=!1};Qn.prototype.isDestroyed=function(){return!1};Qn.prototype.destroy=function(){let e=this._radianceMapComputeCommands.length;for(let t=0;t<e;++t)this._radianceMapComputeCommands[t]=void 0;e=this._convolutionComputeCommands.length;for(let t=0;t<e;++t)this._convolutionComputeCommands[t]=void 0;this._irradianceMapComputeCommand=void 0,e=this._radianceMapTextures.length;for(let t=0;t<e;++t)this._radianceMapTextures[t]=this._radianceMapTextures[t]&&!this._radianceMapTextures[t].isDestroyed()&&this._radianceMapTextures[t].destroy();e=this._specularMapTextures.length;for(let t=0;t<e;++t)this._specularMapTextures[t]=this._specularMapTextures[t]&&!this._specularMapTextures[t].isDestroyed()&&this._specularMapTextures[t].destroy();return this._radianceCubeMap=this._radianceCubeMap&&this._radianceCubeMap.destroy(),this._irradianceMapTexture=this._irradianceMapTexture&&!this._irradianceMapTexture.isDestroyed()&&this._irradianceMapTexture.destroy(),c(this._va)&&this._va.destroy(),c(this._convolveSP)&&this._convolveSP.destroy(),de(this)};Qn.isDynamicUpdateSupported=function(e){let t=e.context;return t.halfFloatingPointTexture||t.colorBufferFloat};Qn.AVERAGE_EARTH_GROUND_COLOR=Object.freeze(G.fromCssColorString("#717145"));Qn.DEFAULT_SPHERICAL_HARMONIC_COEFFICIENTS=Object.freeze([Object.freeze(new d(.35449,.35449,.35449)),d.ZERO,d.ZERO,d.ZERO,d.ZERO,d.ZERO,d.ZERO,d.ZERO,d.ZERO]);var c_=Qn;var z1={HIGHLIGHT:0,REPLACE:1,MIX:2};z1.getColorBlend=function(e,t){if(e===z1.HIGHLIGHT)return 0;if(e===z1.REPLACE)return 1;if(e===z1.MIX)return O.clamp(t,O.EPSILON4,1)};var bc=Object.freeze(z1);var W4e={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},xc=Object.freeze(W4e);var q4e={STEP:0,LINEAR:1,CUBICSPLINE:2},ih=Object.freeze(q4e);var mae={};function H1(e){T.typeOf.number.greaterThan("options.count",e.count,0),T.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=je(e.properties,!0)}H1.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,mae)};H1.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,mae,e)};H1.prototype.getProperty=function(e,t){if(T.typeOf.number("index",e),T.typeOf.string("propertyId",t),e<0||e>=this._count)throw new E(`index must be in the range [0, ${this._count})`);let n=this._properties[t];if(c(n))return je(n[e],!0)};H1.prototype.setProperty=function(e,t,n){if(T.typeOf.number("index",e),T.typeOf.string("propertyId",t),e<0||e>=this._count)throw new E(`index must be in the range [0, ${this._count})`);let i=this._properties[t];c(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=je(n,!0)};var l_=H1;function Tc(e){e=e??W.EMPTY_OBJECT,T.typeOf.number("options.count",e.count),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Object.defineProperties(Tc.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(c(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){let e=0;return c(this._metadataTable)&&(e+=this._metadataTable.byteLength),c(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});Tc.prototype.hasProperty=function(e,t){return T.typeOf.number("index",e),T.typeOf.string("propertyId",t),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(t)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};Tc.prototype.hasPropertyBySemantic=function(e,t){return T.typeOf.number("index",e),T.typeOf.string("semantic",t),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};Tc.prototype.propertyExists=function(e){return T.typeOf.string("propertyId",e),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(e)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};Tc.prototype.propertyExistsBySemantic=function(e){return T.typeOf.string("semantic",e),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};var V9=[];Tc.prototype.getPropertyIds=function(e,t){return t=c(t)?t:[],t.length=0,c(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(V9)),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,V9)),c(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(V9)),t};Tc.prototype.getProperty=function(e,t){let n;if(c(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),c(n))||c(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),c(n))||c(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),c(n)))return n};Tc.prototype.setProperty=function(e,t,n){c(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(c(this._jsonMetadataTable)||(this._jsonMetadataTable=new l_({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};Tc.prototype.getPropertyBySemantic=function(e,t){if(c(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};Tc.prototype.setPropertyBySemantic=function(e,t,n){return c(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};Tc.prototype.getPropertyTypedArray=function(e){if(T.typeOf.string("propertyId",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};Tc.prototype.getPropertyTypedArrayBySemantic=function(e){if(T.typeOf.string("semantic",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function z9(e,t){if(!c(e)||e<0||e>=t)throw new E(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Tc.prototype.isClass=function(e,t){z9(e,this.count),T.typeOf.string("className",t);let n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};Tc.prototype.isExactClass=function(e,t){return z9(e,this.count),T.typeOf.string("className",t),this.getExactClassName(e)===t};Tc.prototype.getExactClassName=function(e){z9(e,this.count);let t=this._batchTableHierarchy;if(c(t))return t.getClassName(e)};var nl=Tc;function G1(e){e=e??W.EMPTY_OBJECT;let t=e.property,n=e.classProperty,i=e.textures;T.typeOf.object("options.property",t),T.typeOf.object("options.classProperty",n),T.typeOf.object("options.textures",i);let o=c(t.channels)?t.channels:[0],r=t,s=Vl.createModelTextureReader({textureInfo:r,channels:K4e(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,l=t.scale,u=n.hasValueTransform||c(a)||c(l);a=a??n.offset,l=l??n.scale,a=n.unpackVectorAndMatrixTypes(a),l=n.unpackVectorAndMatrixTypes(l),this._offset=a,this._scale=l,this._hasValueTransform=u,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(G1.prototype,{textureReader:{get:function(){return this._textureReader}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});G1.prototype.isGpuCompatible=function(){let e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?e.isVariableLengthArray?(dt(`Property texture property ${e.id} is a variable-length array, which is not supported`),!1):e.arrayLength>4?(dt(`Property texture property ${e.id} is an array of length ${e.arrayLength}, but may have at most a length of 4`),!1):t!==at.SCALAR?(dt(`Property texture property ${e.id} is an array of type ${t}, but only SCALAR is supported`),!1):n!==Nt.UINT8?(dt(`Property texture property ${e.id} is an array with component type ${n}, but only UINT8 is supported`),!1):!0:at.isVectorType(t)||t===at.SCALAR?n!==Nt.UINT8?(dt(`Property texture property ${e.id} has component type ${n}, but only UINT8 is supported`),!1):!0:(dt(`Property texture property ${e.id} has an unsupported type`),!1)};var Y4e=[void 0,"float","vec2","vec3","vec4"],X4e=[void 0,"int","ivec2","ivec3","ivec4"];G1.prototype.getGlslType=function(){let e=this._classProperty,t=at.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?Y4e[t]:X4e[t]};G1.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function K4e(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}var j1=G1;function H9(e){e=e??W.EMPTY_OBJECT;let t=e.propertyTexture,n=e.class,i=e.textures;T.typeOf.object("options.propertyTexture",t),T.typeOf.object("options.class",n),T.typeOf.object("options.textures",i);let o=t.extensions,r=t.extras,s={};if(c(t.properties))for(let a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new j1({property:t.properties[a],classProperty:n.properties[a],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=s,this._extras=r,this._extensions=o}Object.defineProperties(H9.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});H9.prototype.getProperty=function(e){return T.typeOf.string("propertyId",e),this._properties[e]};var u_=H9;function pae(e){e=e??W.EMPTY_OBJECT;let t=e.property,n=e.classProperty;T.typeOf.object("options.property",t),T.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale,r=n.hasValueTransform||c(i)||c(o);i=i??n.offset,o=o??n.scale,i=n.unpackVectorAndMatrixTypes(i),o=n.unpackVectorAndMatrixTypes(o),this._offset=i,this._scale=o,this._hasValueTransform=r,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(pae.prototype,{attribute:{get:function(){return this._attribute}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var W1=pae;function G9(e){e=e??W.EMPTY_OBJECT;let t=e.propertyAttribute,n=e.class;T.typeOf.object("options.propertyAttribute",t),T.typeOf.object("options.class",n);let i={};if(c(t.properties))for(let o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new W1({property:t.properties[o],classProperty:n.properties[o]}));this._name=e.name,this._id=e.id,this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(G9.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});G9.prototype.getProperty=function(e){return T.typeOf.string("propertyId",e),this._properties[e]};var Sx=G9;function q1(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.schema",e.schema),this._schema=e.schema;let t=e.propertyTables;this._propertyTableCount=c(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}Object.defineProperties(q1.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}},propertyTablesByteLength:{get:function(){if(!c(this._propertyTables))return 0;let e=0,t=this._propertyTables.length;for(let n=0;n<t;n++)e+=this._propertyTables[n].byteLength;return e}}});q1.prototype.getPropertyTable=function(e){return T.typeOf.number("propertyTableId",e),this._propertyTables[e]};q1.prototype.getPropertyTexture=function(e){return T.typeOf.number("propertyTextureId",e),this._propertyTextures[e]};q1.prototype.getPropertyAttribute=function(e){return T.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]};var Ys=q1;function $4e(e){e=e??W.EMPTY_OBJECT;let t=e.extension,n=e.schema;T.typeOf.object("options.extension",t),T.typeOf.object("options.schema",n);let i=[];if(c(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){let a=t.propertyTables[s],l=n.classes[a.class],u=new Nf({count:a.count,properties:a.properties,class:l,bufferViews:e.bufferViews});i.push(new nl({id:s,name:a.name,count:a.count,metadataTable:u,extras:a.extras,extensions:a.extensions}))}let o=[];if(c(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){let a=t.propertyTextures[s];o.push(new u_({id:s,name:a.name,propertyTexture:a,class:n.classes[a.class],textures:e.textures}))}let r=[];if(c(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){let a=t.propertyAttributes[s];r.push(new Sx({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new Ys({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}var Y1=$4e;function Z4e(e){e=e??W.EMPTY_OBJECT;let t=e.extension,n=e.schema;T.typeOf.object("options.extension",t),T.typeOf.object("options.schema",n);let i,o=[],r;if(c(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){let a=r[i],l=t.featureTables[a],u=n.classes[l.class],f=new Nf({count:l.count,properties:l.properties,class:u,bufferViews:e.bufferViews});o.push(new nl({id:a,count:l.count,metadataTable:f,extras:l.extras,extensions:l.extensions}))}let s=[];if(c(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){let a=r[i],l=t.featureTextures[a];s.push(new u_({id:a,propertyTexture:Q4e(l),class:n.classes[l.class],textures:e.textures}))}return new Ys({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function Q4e(e){let t={class:e.class,properties:{}},n=e.properties;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i],r={channels:J4e(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=xt(o.texture,r,!0)}return t}function J4e(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]="rgba".indexOf(e[i]);return n}var X1=Z4e;function Sy(e){e=e??W.EMPTY_OBJECT;let{gltf:t,extension:n,extensionLegacy:i,gltfResource:o,baseResource:r,supportedImageFormats:s,frameState:a,cacheKey:l,asynchronous:u=!0}=e;if(T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),T.typeOf.object("options.supportedImageFormats",s),T.typeOf.object("options.frameState",a),!c(e.extension)&&!c(e.extensionLegacy))throw new E("One of options.extension or options.extensionLegacy must be specified");this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=l,this._asynchronous=u,this._bufferViewLoaders=[],this._bufferViewIds=[],this._textureLoaders=[],this._textureIds=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(Sy.prototype=Object.create($i.prototype),Sy.prototype.constructor=Sy);Object.defineProperties(Sy.prototype,{cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});async function e8e(e){try{let t=r8e(e),n=u8e(e),i=f8e(e);return await Promise.all([t,n,i]),e.isDestroyed()?void 0:(e._gltf=void 0,e._state=gt.LOADED,e)}catch(t){if(e.isDestroyed())return;throw e.unload(),e._state=gt.FAILED,e.getError("Failed to load structural metadata",t)}}Sy.prototype.load=function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,this._promise=e8e(this),this._promise)};function t8e(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;c(o)&&(t[o]=!0),c(r)&&(t[r]=!0),c(s)&&(t[s]=!0)}}function n8e(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;c(o)&&(t[o]=!0),c(r)&&(t[r]=!0),c(s)&&(t[s]=!0)}}function i8e(e){let t=e.propertyTables,n={};if(c(t))for(let i=0;i<t.length;i++){let o=t[i];t8e(o.properties,n)}return n}function o8e(e){let t=e.featureTables,n={};if(c(t)){for(let i in t)if(t.hasOwnProperty(i)){let r=t[i].properties;c(r)&&n8e(r,n)}}return n}async function r8e(e){let t;c(e._extension)?t=i8e(e._extension):t=o8e(e._extensionLegacy);let n=[];for(let i in t)if(t.hasOwnProperty(i)){let o=vi.getBufferViewLoader({gltf:e._gltf,bufferViewId:parseInt(i),gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoaders.push(o),e._bufferViewIds.push(i),n.push(o.load())}return Promise.all(n)}function s8e(e){let t={},n=e.propertyTextures;if(c(n))for(let i=0;i<n.length;i++){let r=n[i].properties;c(r)&&a8e(r,t)}return t}function a8e(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n];t[i.index]=i}}function c8e(e){let t={},n=e.featureTextures;if(c(n)){for(let i in n)if(n.hasOwnProperty(i)){let r=n[i].properties;c(r)&&l8e(r,t)}}return t}function l8e(e,t){for(let n in e)if(e.hasOwnProperty(n)){let o=e[n].texture;t[o.index]=o}}function u8e(e){let t;c(e._extension)?t=s8e(e._extension):t=c8e(e._extensionLegacy);let n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,l=[];for(let u in t)if(t.hasOwnProperty(u)){let f=vi.getTextureLoader({gltf:n,textureInfo:t[u],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});e._textureLoaders.push(f),e._textureIds.push(u),l.push(f.load())}return Promise.all(l)}async function f8e(e){let t=e._extension??e._extensionLegacy,n;if(c(t.schemaUri)){let i=e._baseResource.getDerivedResource({url:t.schemaUri});n=vi.getSchemaLoader({resource:i})}else n=vi.getSchemaLoader({schema:t.schema});if(e._schemaLoader=n,await n.load(),!n.isDestroyed())return n.schema}Sy.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.LOADED)return!1;let t=this._textureLoaders,n=t.length,i=!0;for(let a=0;a<n;++a){let u=t[a].process(e);i=i&&u}if(!i)return!1;let o=this._schemaLoader.schema,r={};for(let a=0;a<this._bufferViewIds.length;++a){let l=this._bufferViewIds[a],u=this._bufferViewLoaders[a];if(!u.isDestroyed()){let f=new Uint8Array(u.typedArray);r[l]=f}}let s={};for(let a=0;a<this._textureIds.length;++a){let l=this._textureIds[a],u=t[a];u.isDestroyed()||(s[l]=u.texture)}return c(this._extension)?this._structuralMetadata=Y1({extension:this._extension,schema:o,bufferViews:r,textures:s}):this._structuralMetadata=X1({extension:this._extensionLegacy,schema:o,bufferViews:r,textures:s}),_ae(this),this._state=gt.READY,!0};function _ae(e){let t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)vi.unload(t[i]);e._bufferViewLoaders.length=0,e._bufferViewIds.length=0}function d8e(e){let t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)vi.unload(t[i]);e._textureLoaders.length=0,e._textureIds.length=0}Sy.prototype.unload=function(){_ae(this),d8e(this),c(this._schemaLoader)&&vi.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};var K1=Sy;var tE={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};tE.fromGltfSemantic=function(e){T.typeOf.string("gltfSemantic",e);let t=e,i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return tE.TRANSLATION;case"ROTATION":return tE.ROTATION;case"SCALE":return tE.SCALE;case"_FEATURE_ID":return tE.FEATURE_ID}};var rs=Object.freeze(tE);var h8e=65534,m8e=255;function bz(e){e=e??W.EMPTY_OBJECT;let t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;T.typeOf.object("options.triangleIndices",t),T.typeOf.object("options.outlineIndices",n),T.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new bae(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],p8e(this)}Object.defineProperties(bz.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function p8e(e){let t=e._triangleIndices,n=e._edges,i=[],o=e._extraVertices,r=e._originalVertexCount,s={};for(let a=0;a<t.length;a+=3){let l=t[a],u=t[a+1],f=t[a+2],h=!1,p=h||n.hasEdge(l,u),g=h||n.hasEdge(u,f),m=h||n.hasEdge(f,l),y=gae(i,l,u,f,p,g,m);for(;c(y);){let b=s[y];if(!c(b)){b=r+o.length;let x=y;for(;x>=r;)x=o[x-r];o.push(x),s[y]=b}b>h8e&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):b>m8e&&t instanceof Uint8Array&&(t=new Uint16Array(t)),y===l?(l=b,t[a]=b):y===u?(u=b,t[a+1]=b):(f=b,t[a+2]=b),y=gae(i,l,u,f,p,g,m)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function gae(e,t,n,i,o,r,s){let a=s?1:0,l=o?1:0,u=0,f=j9(e,t,a,l,u);if(f===0)return t;let h=0,p=o?1:0,g=r?1:0,m=j9(e,n,h,p,g);if(m===0)return n;let y=s?1:0,b=0,x=r?1:0,A=j9(e,i,y,b,x);if(A===0)return i;let C=f&m&A,S,v,P;if(C&1)S=0,v=1,P=2;else if(C&2)S=0,P=1,v=2;else if(C&4)v=0,S=1,P=2;else if(C&8)v=0,P=1,S=2;else if(C&16)P=0,S=1,v=2;else if(C&32)P=0,v=1,S=2;else{let F=W9(f),_=W9(m),w=W9(A);return F<_&&F<w?t:_<w?n:i}let M=t*3;e[M+S]=a,e[M+v]=l,e[M+P]=u;let R=n*3;e[R+S]=h,e[R+v]=p,e[R+P]=g;let L=i*3;e[L+S]=y,e[L+v]=b,e[L+P]=x}function j9(e,t,n,i,o){let r=t*3,s=e[r],a=e[r+1],l=e[r+2];return c(s)?(s===n&&a===i&&l===o)<<0|(s===n&&a===o&&l===i)<<1|(s===i&&a===n&&l===o)<<2|(s===i&&a===o&&l===n)<<3|(s===o&&a===n&&l===i)<<4|(s===o&&a===i&&l===n)<<5:63}function W9(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}bz.prototype.updateAttribute=function(e){let t=this._extraVertices,n=e.length,i=n/this._originalVertexCount,o=t.length,r=e.constructor,s=new r(e.length+o*i);s.set(e);for(let a=0;a<o;a++){let l=t[a]*i,u=n+a*i;for(let f=0;f<i;f++)s[u+f]=s[l+f]}return s};bz.createTexture=function(e){let t=e.cache.modelOutliningCache;if(c(t)||(t=e.cache.modelOutliningCache={}),c(t.outlineTexture))return t.outlineTexture;let n=Math.min(4096,ut.maximumTextureSize),i=n,o=yae(i),r=[];for(;i>1;)i>>=1,r.push(yae(i));let s=new Rt({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:ke.LUMINANCE,sampler:new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR_MIPMAP_LINEAR,magnificationFilter:li.LINEAR})});return t.outlineTexture=s,s};function yae(e){let t=new Uint8Array(e);return t[e-1]=192,e===8?t[e-1]=96:e===4?t[e-1]=48:e===2?t[e-1]=24:e===1&&(t[e-1]=12),t}function bae(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n<e.length;n+=2){let i=e[n],o=e[n+1],r=Math.min(i,o),s=Math.max(i,o),a=r*this._originalVertexCount+s;this._edges.add(a)}}bae.prototype.hasEdge=function(e,t){let n=Math.min(e,t),i=Math.max(e,t),o=n*this._originalVertexCount+i;return this._edges.has(o)};var wx=bz;function xae(e){T.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function _8e(e){T.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function xz(e){T.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}xz.prototype.postProcess=function(e){this.needsOutlines&&(g8e(this),b8e(this,e))};function g8e(e){let t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new wx({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=Fe.fromTypedArray(n.typedArray);let r=y8e(o.outlineCoordinates),s=new xae(r);s.loadBuffer=!0,s.loadTypedArray=!1,e.attributePlans.push(s),t.outlineCoordinates=s.attribute;let a=e.attributePlans,l=e.attributePlans.length;for(let u=0;u<l;u++){let f=a[u].attribute;f.typedArray=o.updateAttribute(f.typedArray)}}function y8e(e){let t=new Tn.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=$.FLOAT,t.type=nn.VEC3,t.normalized=!1,t.count=e.length/3,t}function b8e(e,t){x8e(e.attributePlans,t),c(e.indicesPlan)&&T8e(e.indicesPlan,t)}function x8e(e,t){let n=e.length;for(let i=0;i<n;i++){let o=e[i],r=o.attribute,s=r.typedArray;if(o.loadBuffer){let a=yt.createVertexBuffer({typedArray:s,context:t,usage:Be.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function T8e(e,t){let n=e.indices;if(e.loadBuffer){let i=yt.createIndexBuffer({typedArray:n.typedArray,context:t,usage:Be.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}xz.AttributeLoadPlan=xae;xz.IndicesLoadPlan=_8e;var vx=xz;function A8e(e){e=e??W.EMPTY_OBJECT,this.webp=e.webp??!1,this.basis=e.basis??!1}var $1=A8e;function Tae(e){T.typeOf.object("options.position",e.position),T.typeOf.object("options.adjustmentParams",e.adjustmentParams),this._position=e.position,this._adjustmentParams=e.adjustmentParams}Object.defineProperties(Tae.prototype,{position:{get:function(){return this._position}},adjustmentParams:{get:function(){return this._adjustmentParams}}});var Z1=Tae;function Aae(e){T.typeOf.object("options.position",e.position),T.typeOf.object("options.adjustmentParams",e.adjustmentParams),T.typeOf.object("options.covarianceMatrix",e.covarianceMatrix),this._position=e.position,this._adjustmentParams=e.adjustmentParams,this._covarianceMatrix=e.covarianceMatrix}Object.defineProperties(Aae.prototype,{position:{get:function(){return this._position}},adjustmentParams:{get:function(){return this._adjustmentParams}},covarianceMatrix:{get:function(){return this._covarianceMatrix}}});var Q1=Aae;function Cae(e){T.typeOf.object("options.groupFlags",e.groupFlags),T.typeOf.object("options.rotationThetas",e.rotationThetas),T.typeOf.object("options.params",e.params),this._groupFlags=e.groupFlags,this._rotationThetas=e.rotationThetas,this._params=e.params}Object.defineProperties(Cae.prototype,{groupFlags:{get:function(){return this._groupFlags}},rotationThetas:{get:function(){return this._rotationThetas}},params:{get:function(){return this._params}}});var J1=Cae;var C8e={Direct:"Direct",Indirect:"Indirect"},wm=Object.freeze(C8e);function Eae(e){if(T.typeOf.string("options.storageType",e.storageType),this._storageType=e.storageType,this._anchorPointsIndirect=e.anchorPointsIndirect,this._anchorPointsDirect=e.anchorPointsDirect,this._intraTileCorrelationGroups=e.intraTileCorrelationGroups,this._covarianceDirect=e.covarianceDirect,this.storageType===wm.Indirect){if(!c(this.anchorPointsIndirect))throw new ae("The anchorPointsIndirect are required for 'Indirect' storage");if(!c(this.intraTileCorrelationGroups))throw new ae("The intraTileCorrelationGroups are required for 'Indirect' storage");if(c(this.anchorPointsDirect))throw new ae("The anchorPointsDirect must be omitted for 'Indirect' storage");if(c(this.covarianceDirect))throw new ae("The covarianceDirect must be omitted for 'Indirect' storage")}else{if(!c(this.anchorPointsDirect))throw new ae("The anchorPointsDirect are required for 'Direct' storage");if(!c(this.covarianceDirect))throw new ae("The covarianceDirect is required for 'Direct' storage");if(c(this.anchorPointsIndirect))throw new ae("The anchorPointsIndirect must be omitted for 'Direct' storage");if(c(this.intraTileCorrelationGroups))throw new ae("The intraTileCorrelationGroups must be omitted for 'Direct' storage")}}Object.defineProperties(Eae.prototype,{storageType:{get:function(){return this._storageType}},anchorPointsIndirect:{get:function(){return this._anchorPointsIndirect}},anchorPointsDirect:{get:function(){return this._anchorPointsDirect}},intraTileCorrelationGroups:{get:function(){return this._intraTileCorrelationGroups}},covarianceDirect:{get:function(){return this._covarianceDirect}}});var nE=Eae;function Sae(e){T.typeOf.number.greaterThan("options.A",e.A,0),T.typeOf.number.lessThanOrEquals("options.A",e.A,1),T.typeOf.number.greaterThanOrEquals("options.alpha",e.alpha,0),T.typeOf.number.lessThan("options.alpha",e.alpha,1),T.typeOf.number.greaterThanOrEquals("options.beta",e.beta,0),T.typeOf.number.lessThanOrEquals("options.beta",e.beta,10),T.typeOf.number.greaterThan("options.T",e.T,0),this._A=e.A,this._alpha=e.alpha,this._beta=e.beta,this._T=e.T}Object.defineProperties(Sae.prototype,{A:{get:function(){return this._A}},alpha:{get:function(){return this._alpha}},beta:{get:function(){return this._beta}},T:{get:function(){return this._T}}});var eR=Sae;function iE(){}function wae(e){return new J(e[0],e[1],e[3],e[1],e[2],e[4],e[3],e[4],e[5])}function E8e(e){let t=d.fromArray(e.position,0,new d),n=d.fromArray(e.adjustmentParams,0,new d);return new Z1({position:t,adjustmentParams:n})}function S8e(e){let t=d.fromArray(e.position,0,new d),n=d.fromArray(e.adjustmentParams,0,new d),i=wae(e.covarianceMatrix);return new Q1({position:t,adjustmentParams:n,covarianceMatrix:i})}function w8e(e){let t=e.groupFlags,n=d.fromArray(e.rotationThetas,0,new d),i=[];for(let r of e.params){let s=new eR({A:r.A,alpha:r.alpha,beta:r.beta,T:r.T});i.push(s)}return new J1({groupFlags:t,rotationThetas:n,params:i})}iE.load=function(e){T.typeOf.object("gltfGpmLocalJson",e);let t=e.storageType;if(t===wm.Direct)return iE.loadDirect(e);if(t===wm.Indirect)return iE.loadIndirect(e);throw new ae(`Invalid storage type in NGA_gpm_local - expected 'Direct' or 'Indirect', but found ${t}`)};iE.loadDirect=function(e){T.typeOf.object("gltfGpmLocalJson",e),T.typeOf.object("gltfGpmLocalJson.anchorPointsDirect",e.anchorPointsDirect),T.typeOf.object("gltfGpmLocalJson.covarianceDirectUpperTriangle",e.covarianceDirectUpperTriangle);let t=[],n=e.anchorPointsDirect;for(let r of n){let s=E8e(r);t.push(s)}let i=wae(e.covarianceDirectUpperTriangle);return new nE({storageType:wm.Direct,anchorPointsDirect:t,covarianceDirect:i})};iE.loadIndirect=function(e){T.typeOf.object("gltfGpmLocalJson",e),T.typeOf.object("gltfGpmLocalJson.anchorPointsIndirect",e.anchorPointsIndirect),T.typeOf.object("gltfGpmLocalJson.intraTileCorrelationGroups",e.intraTileCorrelationGroups);let t=[],n=e.anchorPointsIndirect;for(let s of n){let a=S8e(s);t.push(a)}let i=e.intraTileCorrelationGroups,o=[];for(let s of i){let a=w8e(s);o.push(a)}return new nE({storageType:wm.Indirect,anchorPointsIndirect:t,intraTileCorrelationGroups:o})};var tR=iE;function vae(e){T.typeOf.object("options.traits",e.traits),T.typeOf.number.greaterThanOrEquals("options.index",e.index,0),this._traits=e.traits,this._noData=e.noData,this._offset=e.offset,this._scale=e.scale,this._index=e.index,this._texCoord=e.texCoord}Object.defineProperties(vae.prototype,{traits:{get:function(){return this._traits}},noData:{get:function(){return this._noData}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},index:{get:function(){return this._index}},texCoord:{get:function(){return this._texCoord}}});var nR=vae;function Dae(e){T.typeOf.string("options.source",e.source),this._min=e.min,this._max=e.max,this._source=e.source}Object.defineProperties(Dae.prototype,{min:{get:function(){return this._min}},max:{get:function(){return this._max}},source:{get:function(){return this._source}}});var iR=Dae;function Pae(e){this._ppeTextures=e}Object.defineProperties(Pae.prototype,{ppeTextures:{get:function(){return this._ppeTextures}}});var oR=Pae;function Or(e){e=e??W.EMPTY_OBJECT;let t=e.gltf,n=e.extension,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=e.cacheKey,l=e.asynchronous??!0;T.typeOf.object("options.gltf",t),T.typeOf.object("options.extension",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.supportedImageFormats",r),T.typeOf.object("options.frameState",s),this._gltfResource=i,this._baseResource=o,this._gltf=t,this._extension=n,this._supportedImageFormats=r,this._frameState=s,this._cacheKey=a,this._asynchronous=l,this._textureLoaders=[],this._textureIds=[],this._meshPrimitiveGpmLocal=void 0,this._structuralMetadata=void 0,this._state=gt.UNLOADED,this._promise=void 0}c(Object.create)&&(Or.prototype=Object.create($i.prototype),Or.prototype.constructor=Or);Object.defineProperties(Or.prototype,{cacheKey:{get:function(){return this._cacheKey}},meshPrimitiveGpmLocal:{get:function(){return this._meshPrimitiveGpmLocal}},structuralMetadata:{get:function(){return this._structuralMetadata}}});Or.prototype._loadResources=async function(){try{return await this._loadTextures(),this.isDestroyed()?void 0:(this._gltf=void 0,this._state=gt.LOADED,this)}catch(e){if(this.isDestroyed())return;throw this.unload(),this._state=gt.FAILED,this.getError("Failed to load GPM data",e)}};Or.prototype.load=function(){return c(this._promise)?this._promise:(this._state=gt.LOADING,this._promise=this._loadResources(this),this._promise)};function v8e(e){let t={},n=e.ppeTextures;if(c(n))for(let i=0;i<n.length;i++){let o=n[i];t[o.index]=o}return t}Or.prototype._loadTextures=function(){let e;c(this._extension)&&(e=v8e(this._extension));let t=this._gltf,n=this._gltfResource,i=this._baseResource,o=this._supportedImageFormats,r=this._frameState,s=this._asynchronous,a=[];for(let l in e)if(e.hasOwnProperty(l)){let u=vi.getTextureLoader({gltf:t,textureInfo:e[l],gltfResource:n,baseResource:i,supportedImageFormats:o,frameState:r,asynchronous:s});this._textureLoaders.push(u),this._textureIds.push(l),a.push(u.load())}return Promise.all(a)};Or.ppeTexturesMetadataSchemaCache=new Map;Or._createPpeTextureClassJson=function(e,t){let n=e.traits,i=n.source,o=e.offset??0,r=(e.scale??1)*255;return{name:`PPE texture class ${t}`,properties:{[i]:{name:"PPE",type:"SCALAR",componentType:"UINT8",normalized:!0,offset:o,scale:r,min:n.min,max:n.max}}}};Or._obtainPpeTexturesMetadataSchema=function(e){let n=Or._collectPpeTexturePropertyIdentifiers(e).toString(),i=Or.ppeTexturesMetadataSchemaCache.get(n);if(c(i))return i;let r={id:`PPE_TEXTURE_SCHEMA_${Or.ppeTexturesMetadataSchemaCache.size}`,classes:{}},s=e.ppeTextures;for(let a=0;a<s.length;a++){let l=s[a],u=`ppeTexture_${a}`,f=Or._createPpeTextureClassJson(l,a);r.classes[u]=f}return i=vu.fromJson(r),Or.ppeTexturesMetadataSchemaCache.set(n,i),i};Or._collectPpeTexturePropertyIdentifiers=function(e){let t=[],n=e.ppeTextures;for(let i=0;i<n.length;i++){let o=n[i],r=Or._createPpeTextureClassJson(o,i),s=JSON.stringify(r);t.push(s)}return t};Or._convertToStructuralMetadata=function(e,t){let n=[],i=Or._obtainPpeTexturesMetadataSchema(e),o=e.ppeTextures;for(let s=0;s<o.length;s++){let a=o[s],l=`ppeTexture_${s}`,f=a.traits.source,h=i.classes[l],p={class:l,properties:{[f]:{index:a.index,texCoord:a.texCoord}}};n.push(new u_({id:s,name:a.name,propertyTexture:p,class:h,textures:t}))}return new Ys({schema:i,propertyTables:[],propertyTextures:n,propertyAttributes:[]})};Or.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===gt.READY)return!0;if(this._state!==gt.LOADED)return!1;let t=this._textureLoaders,n=t.length,i=!0;for(let u=0;u<n;++u){let h=t[u].process(e);i=i&&h}if(!i)return!1;let o={};for(let u=0;u<this._textureIds.length;++u){let f=this._textureIds[u],h=t[u];h.isDestroyed()||(o[f]=h.texture)}let r=[],s=this._extension;if(c(s.ppeTextures)){let u=s.ppeTextures;for(let f of u){let h=f.traits,p=new iR({min:h.min,max:h.max,source:h.source}),g=new nR({traits:p,noData:f.noData,offset:f.offset,scale:f.scale,index:f.index,texCoord:f.texCoord});r.push(g)}}let a=new oR(r);this._meshPrimitiveGpmLocal=a;let l=Or._convertToStructuralMetadata(a,o);return this._structuralMetadata=l,this._state=gt.READY,!0};Or.prototype._unloadTextures=function(){let e=this._textureLoaders,t=e.length;for(let n=0;n<t;++n)vi.unload(e[n]);this._textureLoaders.length=0,this._textureIds.length=0};Or.prototype.unload=function(){this._unloadTextures(),this._gltf=void 0,this._extension=void 0,this._structuralMetadata=void 0};var rR=Or;var{Attribute:D8e,Indices:P8e,FeatureIdAttribute:Iae,FeatureIdTexture:Oae,FeatureIdImplicitRange:Rae,MorphTarget:I8e,Primitive:O8e,Instances:R8e,Skin:M8e,Node:L8e,AnimatedPropertyType:N8e,AnimationSampler:F8e,AnimationTarget:B8e,AnimationChannel:k8e,Animation:U8e,ArticulationStage:V8e,Articulation:z8e,Asset:H8e,Scene:G8e,Components:j8e,MetallicRoughness:W8e,SpecularGlossiness:q8e,Specular:Y8e,Anisotropy:q9,Clearcoat:Y9,Material:X8e}=Tn,Bo={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function oh(e){e=e??W.EMPTY_OBJECT;let{gltfResource:t,typedArray:n,releaseGltfJson:i=!1,asynchronous:o=!0,incrementallyLoadTextures:r=!0,upAxis:s=Fo.Y,forwardAxis:a=Fo.Z,loadAttributesAsTypedArray:l=!1,loadAttributesFor2D:u=!1,enablePick:f=!1,loadIndicesForWireframe:h=!1,loadPrimitiveOutline:p=!0,loadForClassification:g=!1,renameBatchIdSemantic:m=!1}=e;T.typeOf.object("options.gltfResource",t);let{baseResource:y=t.clone()}=e;this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=y,this._typedArray=n,this._releaseGltfJson=i,this._asynchronous=o,this._incrementallyLoadTextures=r,this._upAxis=s,this._forwardAxis=a,this._loadAttributesAsTypedArray=l,this._loadAttributesFor2D=u,this._enablePick=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=p,this._loadForClassification=g,this._renameBatchIdSemantic=m,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=Bo.NOT_LOADED,this._textureState=Bo.NOT_LOADED,this._promise=void 0,this._processError=void 0,this._textureErrors=[],this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._textureCallbacks=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._geometryCallbacks=[],this._structuralMetadataLoader=void 0,this._meshPrimitiveGpmLoader=void 0,this._loadResourcesPromise=void 0,this._resourcesLoaded=!1,this._texturesLoaded=!1,this._supportedImageFormats=void 0,this._postProcessBuffers=[],this._components=void 0}c(Object.create)&&(oh.prototype=Object.create($i.prototype),oh.prototype.constructor=oh);Object.defineProperties(oh.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},gltfJson:{get:function(){return c(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},texturesLoaded:{get:function(){return this._texturesLoaded}}});async function K8e(e){e._state=Bo.LOADING,e._textureState=Bo.LOADING;try{let t=vi.getGltfJsonLoader({gltfResource:e._gltfResource,baseResource:e._baseResource,typedArray:e._typedArray,gltfJson:e._gltfJson});return e._gltfJsonLoader=t,await t.load(),e.isDestroyed()||e.isUnloaded()||t.isDestroyed()?void 0:(e._state=Bo.LOADED,e._textureState=Bo.LOADED,e)}catch(t){if(e.isDestroyed())return;e._state=Bo.FAILED,e._textureState=Bo.FAILED,Tz(e,t)}}async function $8e(e,t){Vt.supportsWebP.initialized||await Vt.supportsWebP.initialize(),e._supportedImageFormats=new $1({webp:Vt.supportsWebP(),basis:t.context.supportsBasis});let n=JHe(e,t);return e._state=Bo.PROCESSING,e._textureState=Bo.PROCESSING,c(e._gltfJsonLoader)&&e._releaseGltfJson&&(vi.unload(e._gltfJsonLoader),e._gltfJsonLoader=void 0),n}oh.prototype.load=async function(){return c(this._promise)?this._promise:(this._promise=K8e(this),this._promise)};function Tz(e,t){throw e.unload(),e.getError("Failed to load glTF",t)}function Z8e(e,t){let n=!0,i=e._geometryLoaders;for(let s=0;s<i.length;++s){let a=i[s].process(t);a&&c(e._geometryCallbacks[s])&&(e._geometryCallbacks[s](),e._geometryCallbacks[s]=void 0),n=n&&a}let o=e._structuralMetadataLoader;if(c(o)){let s=o.process(t);s&&(e._components.structuralMetadata=o.structuralMetadata),n=n&&s}let r=e._meshPrimitiveGpmLoader;if(c(r)){let s=r.process(t);s&&(c(e._components.structuralMetadata)&&dt("structural-metadata-gpm","The model defines both the 'EXT_structural_metadata' extension and the 'NGA_gpm_local' extension. The data from the 'EXT_structural_metadata' extension will be replaced with the data from the 'NGA_gpm_local' extension, and will no longer be available for styling and picking."),e._components.structuralMetadata=r.structuralMetadata),n=n&&s}n&&(e._state=Bo.POST_PROCESSING)}function Q8e(e,t){let n=e._primitiveLoadPlans;for(let i=0;i<n.length;i++){let o=n[i];o.postProcess(t),o.needsOutlines&&J8e(e,o)}}function J8e(e,t){let n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;c(o)&&n.push(o.buffer);let r=i.attributes;for(let a=0;a<r.length;a++){let l=r[a];c(l.buffer)&&n.push(l.buffer)}let s=i.indices;c(s)&&c(s.buffer)&&n.push(s.buffer)}oh.prototype._process=function(e){return this._state===Bo.READY?!0:(this._state===Bo.PROCESSING&&Z8e(this,e),this._resourcesLoaded&&this._state===Bo.POST_PROCESSING&&(Q8e(this,e.context),this._state=Bo.PROCESSED),this._resourcesLoaded&&this._state===Bo.PROCESSED?(zae(this),this._typedArray=void 0,this._state=Bo.READY,!0):!1)};oh.prototype._processTextures=function(e){if(this._textureState===Bo.READY)return!0;if(this._textureState!==Bo.PROCESSING)return!1;let t=!0,n=this._textureLoaders;for(let i=0;i<n.length;++i){let o=n[i].process(e);o&&c(this._textureCallbacks[i])&&(this._textureCallbacks[i](),this._textureCallbacks[i]=void 0),t=t&&o}return t?(this._textureState=Bo.READY,this._texturesLoaded=!0,!0):!1};oh.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===Bo.LOADED&&!c(this._loadResourcesPromise)&&(this._loadResourcesPromise=$8e(this,e).then(()=>{this._resourcesLoaded=!0}).catch(o=>{this._processError=o})),c(this._processError)){this._state=Bo.FAILED;let o=this._processError;this._processError=void 0,Tz(this,o)}let t=this._textureErrors.pop();if(c(t)){let o=this.getError("Failed to load glTF texture",t);throw o.name="TextureError",o}if(this._state===Bo.FAILED)return!1;let n=!1;try{n=this._process(e)}catch(o){this._state=Bo.FAILED,Tz(this,o)}let i=!1;try{i=this._processTextures(e)}catch(o){this._textureState=Bo.FAILED,Tz(this,o)}return this._incrementallyLoadTextures?n:n&&i};function eHe(e,t,n,i,o,r,s,a){let l=e.gltfJson,f=l.accessors[t].bufferView;return vi.getVertexBufferLoader({gltf:l,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:f,primitive:i,draco:o,attributeSemantic:n,accessorId:t,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s})}function tHe(e,t,n,i,o,r,s){return vi.getIndexBufferLoader({gltf:e.gltfJson,accessorId:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,primitive:n,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r})}function nHe(e,t){let n=vi.getBufferViewLoader({gltf:e.gltfJson,bufferViewId:t,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(n),n}function Mae(e,t,n){let i=t.byteOffset,o=Ul(e,t),r=t.count,s=wu(t.type),a=t.componentType,l=$.getSizeInBytes(a),u=l*s,f=r*s;if(o===u)return n=new Uint8Array(n),$.createArrayBufferView(a,n.buffer,n.byteOffset+i,f);let h=$.createTypedArray(a,f),p=new DataView(n.buffer),g=new Array(s),m=o_(t.componentType);i=n.byteOffset+i;for(let y=0;y<r;++y){m(p,i,s,l,g);for(let b=0;b<s;++b)h[y*s+b]=g[b];i+=o}return h}function iHe(e,t){let n=e.type;if(n===nn.SCALAR)return t.fill(0);let i=nn.getMathType(n);return t.fill(i.clone(i.ZERO))}function oHe(e,t,n,i){let o=e.type,r=e.count;if(o===nn.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===nn.VEC4&&i)for(let s=0;s<r;s++)n[s]=Le.unpack(t,s*4);else{let s=nn.getMathType(o),a=nn.getNumberOfComponents(o);for(let l=0;l<r;l++)n[l]=s.unpack(t,l*a)}return n}async function rHe(e,t,n,i,o){let{gltfJson:r}=e;if(await t.load(),e.isDestroyed())return;let s=Mae(r,n,t.typedArray);i=i??!1,oHe(n,s,o,i)}function Az(e,t,n){let i=new Array(t.count),o=t.bufferView;if(c(o)){let r=nHe(e,o),s=rHe(e,r,t,n,i);return e._loaderPromises.push(s),i}return iHe(t,i)}function Du(e,t){if(c(t))return e===Number?t[0]:e.unpack(t)}function sHe(e){return e===Number?0:new e}function aHe(e){switch(e){case $.BYTE:return 127;case $.UNSIGNED_BYTE:return 255;case $.SHORT:return 32767;case $.UNSIGNED_SHORT:return 65535;default:return 1}}var cHe={VEC2:new H(-1,-1),VEC3:new d(-1,-1,-1),VEC4:new se(-1,-1,-1,-1)};function lHe(e,t){let n=aHe(e.componentDatatype),i=cHe[e.type],o=e.min;c(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;c(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function uHe(e,t,n){let i=e.decodeMatrix,o=Du(n,e.decodedMin),r=Du(n,e.decodedMax);c(o)&&c(r)&&(t.min=o,t.max=r);let s=new Tn.Quantization;s.componentDatatype=t.componentDatatype,s.type=t.type,i.length===4?(s.quantizedVolumeOffset=i[2],s.quantizedVolumeStepSize=i[0]):i.length===9?(s.quantizedVolumeOffset=new H(i[6],i[7]),s.quantizedVolumeStepSize=new H(i[0],i[4])):i.length===16?(s.quantizedVolumeOffset=new d(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new d(i[0],i[5],i[10])):i.length===25&&(s.quantizedVolumeOffset=new se(i[20],i[21],i[22],i[23]),s.quantizedVolumeStepSize=new se(i[0],i[6],i[12],i[18])),t.quantization=s}function fHe(e,t,n,i,o){let r=e.accessors[t],s=nn.getMathType(r.type),a=r.normalized??!1,l=new D8e;l.name=n,l.semantic=i,l.setIndex=o,l.constant=sHe(s),l.componentDatatype=r.componentType,l.normalized=a,l.count=r.count,l.type=r.type,l.min=Du(s,r.min),l.max=Du(s,r.max),l.byteOffset=r.byteOffset,l.byteStride=Ul(e,r),oi(r,"WEB3D_quantized_attributes")&&uHe(r.extensions.WEB3D_quantized_attributes,l,s);let u=l.semantic===ht.POSITION||l.semantic===ht.NORMAL||l.semantic===ht.TANGENT||l.semantic===ht.TEXCOORD;return e.extensionsRequired?.includes("KHR_mesh_quantization")&&a&&u&&lHe(l,s),l}function Lae(e){let n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}var dHe={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function X9(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");let o=t.fromGltfSemantic(i),r=dHe;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function hHe(e){let t=e===ht.POSITION,n=e===ht.FEATURE_ID,i=e===ht.TEXCOORD;return t||n||i}function mHe(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){let o=c(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=$.createArrayBufferView(o,t.typedArray.buffer)}}function pHe(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){let s=i.typedArray;n.typedArray=Mae(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function Nae(e,t,n,i,o,r,s,a){let l=e.gltfJson,u=l.accessors[t],f=u.bufferView,h=n.gltfSemantic,p=n.renamedSemantic,g=n.modelSemantic,m=c(g)?Lae(p):void 0,b=fHe(l,t,h,g,m);if(!c(o)&&!c(f))return b;let x=eHe(e,t,h,i,o,r,s,a),A=e._geometryLoaders.length;e._geometryLoaders.push(x);let C=x.load();return e._loaderPromises.push(C),e._geometryCallbacks[A]=()=>{c(o)&&c(o.attributes)&&c(o.attributes[h])?mHe(b,x,r,s):pHe(l,u,b,x,r,s)},b}function Fae(e,t,n,i,o,r,s,a){let l=n.modelSemantic,u=l===ht.POSITION,f=l===ht.FEATURE_ID,h=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,p=u&&e._enablePick&&!a.context.webgl2,g=e._loadForClassification&&f,m=e._loadAttributesAsTypedArray,y=!m,b=m||h||p||g,C=Nae(e,t,n,i,o,s?!1:y,s?!0:b,a),S=new vx.AttributeLoadPlan(C);return S.loadBuffer=y,S.loadTypedArray=b,S}function _He(e,t,n,i,o){let r=e.gltfJson.accessors,s=c(n.ROTATION),a=c(n.TRANSLATION)&&c(r[n.TRANSLATION].min)&&c(r[n.TRANSLATION].max),l=X9(e,rs,i),u=l.modelSemantic,f=u===rs.TRANSLATION||u===rs.ROTATION||u===rs.SCALE,h=u===rs.TRANSLATION,p=e._loadAttributesAsTypedArray||s&&f||!o.context.instancedArrays,g=e._enablePick&&!o.context.webgl2,m=!p,y=e._loadAttributesFor2D&&!o.scene3DOnly;return Nae(e,t,l,void 0,void 0,m,p||h&&(!a||y||g),o)}function gHe(e,t,n,i,o,r,s){let a=e.gltfJson.accessors[t],l=a.bufferView;if(!c(i)&&!c(l))return;let u=new P8e;u.count=a.count;let f=e._loadAttributesAsTypedArray,h=(e._loadIndicesForWireframe||e._enablePick)&&!s.context.webgl2,p=e._loadForClassification&&o,m=!f,y=f||h||p,A=tHe(e,t,n,i,r?!1:m,r?!0:y,s),C=e._geometryLoaders.length;e._geometryLoaders.push(A);let S=A.load();e._loaderPromises.push(S),e._geometryCallbacks[C]=()=>{u.indexDatatype=A.indexDatatype,u.buffer=A.buffer,u.typedArray=A.typedArray};let v=new vx.IndicesLoadPlan(u);return v.loadBuffer=m,v.loadTypedArray=y,v}function il(e,t,n,i){let o=e.gltfJson,r=Vl.getImageIdFromTexture({gltf:o,textureId:t.index,supportedImageFormats:e._supportedImageFormats});if(!c(r))return;let s=vi.getTextureLoader({gltf:o,textureInfo:t,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:e._supportedImageFormats,frameState:n,asynchronous:e._asynchronous}),a=Vl.createModelTextureReader({textureInfo:t}),l=e._textureLoaders.length;e._textureLoaders.push(s);let u=s.load().catch(f=>{if(!e.isDestroyed()){if(!e._incrementallyLoadTextures)throw f;e._textureState=Bo.FAILED,e._textureErrors.push(f)}});return e._texturesPromises.push(u),e._textureCallbacks[l]=()=>{a.texture=s.texture,c(i)&&(a.texture.sampler=i)},a}function yHe(e,t,n){let{diffuseTexture:i,specularGlossinessTexture:o,diffuseFactor:r,specularFactor:s,glossinessFactor:a}=t,l=new q8e;return c(i)&&(l.diffuseTexture=il(e,i,n)),c(o)&&(l.specularGlossinessTexture=il(e,o,n)),l.diffuseFactor=Du(se,r),l.specularFactor=Du(d,s),l.glossinessFactor=a,l}function bHe(e,t,n){let{baseColorTexture:i,metallicRoughnessTexture:o,baseColorFactor:r,metallicFactor:s,roughnessFactor:a}=t,l=new W8e;return c(i)&&(l.baseColorTexture=il(e,i,n)),c(o)&&(l.metallicRoughnessTexture=il(e,o,n)),l.baseColorFactor=Du(se,r),l.metallicFactor=s,l.roughnessFactor=a,l}function xHe(e,t,n){let{specularFactor:i,specularTexture:o,specularColorFactor:r,specularColorTexture:s}=t,a=new Y8e;return c(o)&&(a.specularTexture=il(e,o,n)),c(s)&&(a.specularColorTexture=il(e,s,n)),a.specularFactor=i,a.specularColorFactor=Du(d,r),a}function THe(e,t,n){let{anisotropyStrength:i=q9.DEFAULT_ANISOTROPY_STRENGTH,anisotropyRotation:o=q9.DEFAULT_ANISOTROPY_ROTATION,anisotropyTexture:r}=t,s=new q9;return c(r)&&(s.anisotropyTexture=il(e,r,n)),s.anisotropyStrength=i,s.anisotropyRotation=o,s}function AHe(e,t,n){let{clearcoatFactor:i=Y9.DEFAULT_CLEARCOAT_FACTOR,clearcoatTexture:o,clearcoatRoughnessFactor:r=Y9.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR,clearcoatRoughnessTexture:s,clearcoatNormalTexture:a}=t,l=new Y9;return c(o)&&(l.clearcoatTexture=il(e,o,n)),c(s)&&(l.clearcoatRoughnessTexture=il(e,s,n)),c(a)&&(l.clearcoatNormalTexture=il(e,a,n)),l.clearcoatFactor=i,l.clearcoatRoughnessFactor=r,l}function CHe(e,t,n){let i=new X8e,o=t.extensions??W.EMPTY_OBJECT,r=o.KHR_materials_pbrSpecularGlossiness,s=o.KHR_materials_specular,a=o.KHR_materials_anisotropy,l=o.KHR_materials_clearcoat,u=t.pbrMetallicRoughness;return i.unlit=c(o.KHR_materials_unlit),c(r)?i.specularGlossiness=yHe(e,r,n):(c(u)&&(i.metallicRoughness=bHe(e,u,n)),c(s)&&!i.unlit&&(i.specular=xHe(e,s,n)),c(a)&&!i.unlit&&(i.anisotropy=THe(e,a,n)),c(l)&&!i.unlit&&(i.clearcoat=AHe(e,l,n))),c(t.emissiveTexture)&&(i.emissiveTexture=il(e,t.emissiveTexture,n)),c(t.normalTexture)&&!e._loadForClassification&&(i.normalTexture=il(e,t.normalTexture,n)),c(t.occlusionTexture)&&(i.occlusionTexture=il(e,t.occlusionTexture,n)),i.emissiveFactor=Du(d,t.emissiveFactor),i.alphaMode=t.alphaMode,i.alphaCutoff=t.alphaCutoff,i.doubleSided=t.doubleSided,i}function Bae(e,t){let n=new Iae;return n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.propertyTableId=e.propertyTable,n.setIndex=e.attribute,n.label=e.label,n.positionalLabel=t,n}function kae(e,t,n,i){let o=new Iae,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=Lae(r.attribute),o.positionalLabel=i,o}function Uae(e,t){let n=new Rae;return n.propertyTableId=e.propertyTable,n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.label=e.label,n.positionalLabel=t,n.offset=0,n.repeat=1,n}function Vae(e,t,n,i){let o=new Rae,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=r.constant??0;let s=r.divisor??0;return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function EHe(e,t,n,i){let o=new Oae;o.featureCount=t.featureCount,o.nullFeatureId=t.nullFeatureId,o.propertyTableId=t.propertyTable,o.label=t.label,o.positionalLabel=i;let r=t.texture;o.textureReader=il(e,r,n,Qt.NEAREST);let a=(c(r.channels)?r.channels:[0]).map(function(l){return"rgba".charAt(l)}).join("");return o.textureReader.channels=a,o}function SHe(e,t,n,i,o,r){let s=new Oae,a=t.featureIds,l=a.texture;return s.featureCount=o,s.propertyTableId=n,s.textureReader=il(e,l,i,Qt.NEAREST),s.textureReader.channels=a.channels,s.positionalLabel=r,s}function wHe(e,t,n,i,o){let r=new I8e,s=void 0,a=void 0,l=!1;for(let u in t){if(!t.hasOwnProperty(u))continue;let f=t[u],h=X9(e,ht,u),p=Fae(e,f,h,s,a,l,n,o);r.attributes.push(p.attribute),i.attributePlans.push(p)}return r}function vHe(e,t,n,i){let o=new O8e,r=new vx(o);e._primitiveLoadPlans.push(r);let s=t.material;c(s)&&(o.material=CHe(e,e.gltfJson.materials[s],i));let a=t.extensions??W.EMPTY_OBJECT,l=!1,u=a.CESIUM_primitive_outline;e._loadPrimitiveOutline&&c(u)&&(l=!0,r.needsOutlines=!0,r.outlineIndices=DHe(e,u,r));let f=e._loadForClassification,h=a.KHR_draco_mesh_compression,p=!1,g=t.attributes;if(c(g))for(let v in g){if(!g.hasOwnProperty(v))continue;let P=g[v],M=X9(e,ht,v),R=M.modelSemantic;if(f&&!hHe(R))continue;R===ht.FEATURE_ID&&(p=!0);let L=Fae(e,P,M,t,h,n,l,i);r.attributePlans.push(L),o.attributes.push(L.attribute)}let m=t.targets;if(c(m)&&!f)for(let v=0;v<m.length;++v)o.morphTargets.push(wHe(e,m[v],l,r,i));let y=t.indices;if(c(y)){let v=gHe(e,y,t,h,p,l,i);c(v)&&(r.indicesPlan=v,o.indices=v.indices)}let b=a.EXT_structural_metadata,x=a.EXT_mesh_features,A=a.EXT_feature_metadata,C=c(A);c(x)?PHe(e,o,x,i):C&&IHe(e,o,A,i),c(b)?OHe(o,b):C&&RHe(e,o,A);let S=t.mode;if(f&&S!==Me.TRIANGLES)throw new ae("Only triangle meshes can be used for classification.");return o.primitiveType=S,o}function DHe(e,t){let n=t.indices,i=e.gltfJson.accessors[n];return Az(e,i,!1)}function PHe(e,t,n,i){let o;c(n)&&c(n.featureIds)?o=n.featureIds:o=[];for(let r=0;r<o.length;r++){let s=o[r],a=`featureId_${r}`,l;c(s.texture)?l=EHe(e,s,i,a):c(s.attribute)?l=Bae(s,a):l=Uae(s,a),t.featureIds.push(l)}}function IHe(e,t,n,i){let{featureTables:o}=e.gltfJson.extensions.EXT_feature_metadata,r=0,s=n.featureIdAttributes;if(c(s))for(let l=0;l<s.length;++l){let u=s[l],f=u.featureTable,h=e._sortedPropertyTableIds.indexOf(f),p=o[f].count,g=`featureId_${r}`;r++;let m;c(u.featureIds.attribute)?m=kae(u,h,p,g):m=Vae(u,h,p,g),t.featureIds.push(m)}let a=n.featureIdTextures;if(c(a))for(let l=0;l<a.length;++l){let u=a[l],f=u.featureTable,h=e._sortedPropertyTableIds.indexOf(f),p=o[f].count,g=`featureId_${r}`;r++;let m=SHe(e,u,h,i,p,g);t.featureIds.push(m)}}function OHe(e,t){if(!c(t))return;let{propertyTextures:n,propertyAttributes:i}=t;c(n)&&(e.propertyTextureIds=n),c(i)&&(e.propertyAttributeIds=i)}function RHe(e,t,n){c(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function MHe(e,t,n){let i=t.EXT_mesh_gpu_instancing,o=new R8e,r=i.attributes;if(c(r))for(let u in r){if(!r.hasOwnProperty(u))continue;let f=r[u];o.attributes.push(_He(e,f,r,u,n))}let s=i.extensions??W.EMPTY_OBJECT,a=t.EXT_instance_features,l=s.EXT_feature_metadata;return c(a)?LHe(o,a):c(l)&&NHe(e.gltfJson,o,l,e._sortedPropertyTableIds),o}function LHe(e,t){let n=t.featureIds;for(let i=0;i<n.length;i++){let o=n[i],r=`instanceFeatureId_${i}`,s;c(o.attribute)?s=Bae(o,r):s=Uae(o,r),e.featureIds.push(s)}}function NHe(e,t,n,i){let o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(c(r))for(let s=0;s<r.length;++s){let a=r[s],l=a.featureTable,u=i.indexOf(l),f=o[l].count,h=`instanceFeatureId_${s}`,p;c(a.featureIds.attribute)?p=kae(a,u,f,h):p=Vae(a,u,f,h),t.featureIds.push(p)}}function FHe(e,t,n){let i=new L8e;i.name=t.name,i.matrix=Du(B,t.matrix),i.translation=Du(d,t.translation),i.rotation=Du(Le,t.rotation),i.scale=Du(d,t.scale);let o=t.extensions??W.EMPTY_OBJECT,r=o.EXT_mesh_gpu_instancing,s=o.AGI_articulations;if(c(r)){if(e._loadForClassification)throw new ae("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");i.instances=MHe(e,o,n)}c(s)&&(i.articulationName=s.articulationName);let a=t.mesh;if(c(a)){let l=e.gltfJson.meshes[a],u=l.primitives;for(let p=0;p<u.length;++p)i.primitives.push(vHe(e,u[p],c(i.instances),n));let f=t.weights??l.weights,h=i.primitives[0].morphTargets;i.morphWeights=c(f)?f.slice():new Array(h.length).fill(0)}return i}function BHe(e,t){let n=e.gltfJson.nodes;if(!c(n))return[];let i=n.map(function(o,r){let s=FHe(e,o,t);return s.index=r,s});for(let o=0;o<i.length;++o){let r=n[o].children;if(c(r))for(let s=0;s<r.length;++s)i[o].children.push(i[r[s]])}return i}function kHe(e,t,n){let i=new M8e,o=t.joints;i.joints=o.map(s=>n[s]);let r=t.inverseBindMatrices;if(c(r)){let s=e.gltfJson.accessors[r];i.inverseBindMatrices=Az(e,s)}else i.inverseBindMatrices=new Array(o.length).fill(B.IDENTITY);return i}function UHe(e,t){let n=e.gltfJson.skins;if(e._loadForClassification||!c(n))return[];let i=n.map(function(r,s){let a=kHe(e,r,t);return a.index=s,a}),o=e.gltfJson.nodes;for(let r=0;r<t.length;++r){let s=o[r].skin;c(s)&&(t[r].skin=i[s])}return i}async function VHe(e,t,n,i){let o=new K1({gltf:e.gltfJson,extension:t,extensionLegacy:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:e._supportedImageFormats,frameState:i,asynchronous:e._asynchronous});return e._structuralMetadataLoader=o,o.load()}async function zHe(e,t,n,i){let o=new rR({gltf:t,extension:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:e._supportedImageFormats,frameState:i,asynchronous:e._asynchronous});return e._meshPrimitiveGpmLoader=o,o.load()}function HHe(e,t){let n=new F8e,i=e.gltfJson.accessors,o=i[t.input];n.input=Az(e,o);let r=t.interpolation;n.interpolation=ih[r]??ih.LINEAR;let s=i[t.output];return n.output=Az(e,s,!0),n}function GHe(e,t){let n=new B8e,i=e.node;if(!c(i))return;n.node=t[i];let o=e.path.toUpperCase();return n.path=N8e[o],n}function jHe(e,t,n){let i=new k8e,o=e.sampler;return i.sampler=t[o],i.target=GHe(e.target,n),i}function WHe(e,t,n){let i=new U8e;i.name=t.name;let o=t.samplers.map(function(s,a){let l=HHe(e,s);return l.index=a,l}),r=t.channels.map(function(s){return jHe(s,o,n)});return i.samplers=o,i.channels=r,i}function qHe(e,t){let n=e.gltfJson.animations;return e._loadForClassification||!c(n)?[]:n.map(function(o,r){let s=WHe(e,o,t);return s.index=r,s})}function YHe(e){let t=new V8e;t.name=e.name;let n=e.type.toUpperCase();return t.type=xc[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function XHe(e){let t=new z8e;return t.name=e.name,t.stages=e.stages.map(YHe),t}function KHe(e){let n=(e.extensions??W.EMPTY_OBJECT).AGI_articulations?.articulations;return c(n)?n.map(XHe):[]}function $He(e){let t;return c(e.scenes)&&c(e.scene)&&(t=e.scenes[e.scene].nodes),t=t??e.nodes,t=c(t)?t:[],t}function ZHe(e,t){let n=new G8e,i=$He(e);return n.nodes=i.map(function(o){return t[o]}),n}var QHe=new d;function JHe(e,t){let n=e.gltfJson,i=n.extensions??W.EMPTY_OBJECT,o=i.EXT_structural_metadata,r=i.EXT_feature_metadata,s=i.CESIUM_RTC;if(c(r)){let A=r.featureTables,C=r.featureTextures,S=c(A)?A:[],v=c(C)?C:[];e._sortedPropertyTableIds=Object.keys(S).sort(),e._sortedFeatureTextureIds=Object.keys(v).sort()}let a=BHe(e,t),l=UHe(e,a),u=qHe(e,a),f=KHe(n),h=ZHe(n,a),p=new j8e,g=new H8e,m=n.asset.copyright;if(c(m)){let A=m.split(";").map(function(C){return new Tt(C.trim())});g.credits=A}if(p.asset=g,p.scene=h,p.nodes=a,p.skins=l,p.animations=u,p.articulations=f,p.upAxis=e._upAxis,p.forwardAxis=e._forwardAxis,c(s)){let A=d.fromArray(s.center,0,QHe);p.transform=B.fromTranslation(A,p.transform)}if(e._components=p,c(o)||c(r)){let A=VHe(e,o,r,t);e._loaderPromises.push(A)}let y=i.NGA_gpm_local;if(c(y)){let A=tR.load(y);e._components.extensions.NGA_gpm_local=A}let b=n.meshes;if(c(b))for(let A of b){let C=A.primitives;if(c(C))for(let S of C){let v=S.extensions;if(c(v)){let P=v.NGA_gpm_local;if(c(P)){let M=zHe(e,n,P,t);e._loaderPromises.push(M)}}}}let x=[];return x.push.apply(x,e._loaderPromises),e._incrementallyLoadTextures||x.push.apply(x,e._texturesPromises),Promise.all(x)}function eGe(e){let t=e._textureLoaders;for(let n=0;n<t.length;++n)t[n]=!t[n].isDestroyed()&&vi.unload(t[n]);e._textureLoaders.length=0}function zae(e){let t=e._bufferViewLoaders;for(let n=0;n<t.length;++n)t[n]=!t[n].isDestroyed()&&vi.unload(t[n]);e._bufferViewLoaders.length=0}function tGe(e){let t=e._geometryLoaders;for(let n=0;n<t.length;++n)t[n]=!t[n].isDestroyed()&&vi.unload(t[n]);e._geometryLoaders.length=0}function nGe(e){let t=e._postProcessBuffers;for(let n=0;n<t.length;n++){let i=t[n];i.isDestroyed()||i.destroy()}t.length=0}function iGe(e){c(e._structuralMetadataLoader)&&!e._structuralMetadataLoader.isDestroyed()&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}function oGe(e){c(e._meshPrimitiveGpmLoader)&&!e._meshPrimitiveGpmLoader.isDestroyed()&&(e._meshPrimitiveGpmLoader.destroy(),e._meshPrimitiveGpmLoader=void 0)}oh.prototype.isUnloaded=function(){return this._state===Bo.UNLOADED};oh.prototype.unload=function(){c(this._gltfJsonLoader)&&!this._gltfJsonLoader.isDestroyed()&&vi.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,eGe(this),zae(this),tGe(this),nGe(this),iGe(this),oGe(this),this._components=void 0,this._typedArray=void 0,this._state=Bo.UNLOADED};var rh=oh;var sR=`uniform sampler2D u_pointCloud_colorGBuffer;
uniform sampler2D u_pointCloud_depthGBuffer;
uniform vec2 u_distanceAndEdlStrength;
in vec2 v_textureCoordinates;
vec2 neighborContribution(float log2Depth, vec2 offset)
{
float dist = u_distanceAndEdlStrength.x;
vec2 texCoordOrig = v_textureCoordinates + offset * dist;
vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);
vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);
float depthOrLogDepth0 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord0));
float depthOrLogDepth1 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord1));
if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {
return vec2(0.0);
}
float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);
return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);
}
void main()
{
float depthOrLogDepth = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, v_textureCoordinates));
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);
eyeCoordinate /= eyeCoordinate.w;
float log2Depth = log2(-eyeCoordinate.z);
if (depthOrLogDepth == 0.0)
{
discard;
}
vec4 color = texture(u_pointCloud_colorGBuffer, v_textureCoordinates);
vec2 texelSize = 1.0 / czm_viewport.zw;
vec2 responseAndCount = vec2(0.0);
responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));
responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));
responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));
responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));
float response = responseAndCount.x / responseAndCount.y;
float strength = u_distanceAndEdlStrength.y;
float shade = exp(-response * 300.0 * strength);
color.rgb *= shade;
out_FragColor = vec4(color);
gl_FragDepth = depthOrLogDepth;
}
`;function oE(){this._framebuffer=new hi({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(oE.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});function rGe(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}var K9=new H;function sGe(e,t){let n=new He({defines:["LOG_DEPTH_WRITE"],sources:[sR]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return K9.x=e._radius,K9.y=e._strength,K9}},o=Ve.fromCache({blending:ln.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:kt.setCesium3DTileBit(),stencilMask:kt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:De.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ei({framebuffer:e.framebuffer,color:new G(0,0,0,0),depth:1,renderState:Ve.fromCache(),pass:De.CESIUM_3D_TILE,owner:e})}function aGe(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),sGe(e,t)}function Hae(e){return e.drawBuffers&&e.fragmentDepth}oE.isSupported=Hae;function cGe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!c(n)){let i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources.splice(0,0,`layout (location = 0) out vec4 out_FragData_0;
layout (location = 1) out vec4 out_FragData_1;`),o.sources=o.sources.map(function(r){return r=He.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replaceAll(/out_FragColor/g,"out_FragData_0"),r}),o.sources.push(`void main() 
{ 
    czm_point_cloud_post_process_main(); 
#ifdef LOG_DEPTH
    czm_writeLogDepth();
    out_FragData_1 = czm_packDepth(gl_FragDepth); 
#else
    out_FragData_1 = czm_packDepth(gl_FragCoord.z);
#endif
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}oE.prototype.update=function(e,t,n,i){if(!Hae(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,aGe(this,e.context);let o,r=e.commandList,s=r.length;for(o=t;o<s;++o){let u=r[o];if(u.primitiveType!==Me.POINTS||u.pass===De.TRANSLUCENT)continue;let f,h,p=u.derivedCommands.pointCloudProcessor;c(p)&&(f=p.command,h=p.originalShaderProgram),(!c(f)||u.dirty||h!==u.shaderProgram||f.framebuffer!==this.framebuffer)&&(f=Qe.shallowClone(u,f),f.framebuffer=this.framebuffer,f.shaderProgram=cGe(e.context,u.shaderProgram),f.castShadows=!1,f.receiveShadows=!1,c(p)||(p={command:f,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=p),p.originalShaderProgram=u.shaderProgram),r[o]=f}let a=this._clearCommand,l=this._drawCommand;l.boundingVolume=i,r.push(l),r.push(a)};oE.prototype.isDestroyed=function(){return!1};oE.prototype.destroy=function(){return rGe(this),de(this)};var f_=oE;function Gae(e){let t=e??{};this.attenuation=t.attenuation??!1,this.geometricErrorScale=t.geometricErrorScale??1,this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=t.eyeDomeLighting??!0,this.eyeDomeLightingStrength=t.eyeDomeLightingStrength??1,this.eyeDomeLightingRadius=t.eyeDomeLightingRadius??1,this.backFaceCulling=t.backFaceCulling??!1,this.normalShading=t.normalShading??!0}Gae.isSupported=function(e){return f_.isSupported(e.context)};var vm=Gae;var Va={},lGe=new se(0,0,0,1),Ac=new se,uGe=new Ke,$9=new H,Z9=new H;Va.worldToWindowCoordinates=function(e,t,n){return Va.worldWithEyeOffsetToWindowCoordinates(e,t,d.ZERO,n)};var jae=new se,Wae=new d;function aR(e,t,n,i){let o=n.viewMatrix,r=B.multiplyByVector(o,se.fromElements(e.x,e.y,e.z,1,jae),jae),s=d.multiplyComponents(t,d.normalize(r,Wae),Wae);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,B.multiplyByVector(n.frustum.projectionMatrix,r,i)}var fGe=new he(Math.PI,O.PI_OVER_TWO),dGe=new d,hGe=new d;Va.worldWithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("position is required.");let o=e.frameState,r=Va.computeActualEllipsoidPosition(o,t,lGe);if(!c(r))return;let s=e.canvas,a=uGe;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;let l=e.camera,u=!1;if(o.mode===oe.SCENE2D){let f=e.mapProjection,h=fGe,p=f.project(h,dGe),g=d.clone(l.position,hGe),m=l.frustum.clone(),y=B.computeViewportTransformation(a,0,1,new B),b=l.frustum.projectionMatrix,x=l.positionWC.y,A=d.fromElements(O.sign(x)*p.x-x,0,-l.positionWC.x),C=Ot.pointToGLWindowCoordinates(b,y,A);if(x===0||C.x<=0||C.x>=s.clientWidth)u=!0;else{if(C.x>s.clientWidth*.5){a.width=C.x,l.frustum.right=p.x-x,Ac=aR(r,n,l,Ac),Va.clipToGLWindowCoordinates(a,Ac,$9),a.x+=C.x,l.position.x=-l.position.x;let S=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-S,Ac=aR(r,n,l,Ac),Va.clipToGLWindowCoordinates(a,Ac,Z9)}else{a.x+=C.x,a.width-=C.x,l.frustum.left=-p.x-x,Ac=aR(r,n,l,Ac),Va.clipToGLWindowCoordinates(a,Ac,$9),a.x=a.x-a.width,l.position.x=-l.position.x;let S=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-S,Ac=aR(r,n,l,Ac),Va.clipToGLWindowCoordinates(a,Ac,Z9)}d.clone(g,l.position),l.frustum=m.clone(),i=H.clone($9,i),(i.x<0||i.x>s.clientWidth)&&(i.x=Z9.x)}}if(o.mode!==oe.SCENE2D||u){if(Ac=aR(r,n,l,Ac),Ac.z<0&&!(l.frustum instanceof on)&&!(l.frustum instanceof jo))return;i=Va.clipToGLWindowCoordinates(a,Ac,i)}return i.y=s.clientHeight-i.y,i};Va.worldToDrawingBufferCoordinates=function(e,t,n){if(n=Va.worldToWindowCoordinates(e,t,n),!!c(n))return Va.transformWindowToDrawingBuffer(e,n,n)};var d_=new d,mGe=new he;Va.computeActualEllipsoidPosition=function(e,t,n){let i=e.mode;if(i===oe.SCENE3D)return d.clone(t,n);let o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,mGe);if(!c(r))return;if(o.project(r,d_),i===oe.COLUMBUS_VIEW)return d.fromElements(d_.z,d_.x,d_.y,n);if(i===oe.SCENE2D)return d.fromElements(0,d_.x,d_.y,n);let s=e.morphTime;return d.fromElements(O.lerp(d_.z,t.x,s),O.lerp(d_.x,t.y,s),O.lerp(d_.y,t.z,s),n)};var qae=new d,Yae=new d,Xae=new B;Va.clipToGLWindowCoordinates=function(e,t,n){return d.divideByScalar(t,t.w,qae),B.computeViewportTransformation(e,0,1,Xae),B.multiplyByPoint(Xae,qae,Yae),H.fromCartesian3(Yae,n)};Va.transformWindowToDrawingBuffer=function(e,t,n){let i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return H.fromElements(t.x*o,t.y*r,n)};var pGe=new se,Kae=new se;Va.drawingBufferToWorldCoordinates=function(e,t,n,i){let r=e.context.uniformState,s=r.currentFrustum,a=s.x,l=s.y;if(e.frameState.useLogDepth){let g=n*r.log2FarDepthFromNearPlusOne,m=Math.pow(2,g)-1;n=l*(1-a/(m+a))/(l-a)}let u=e.view.passState.viewport,f=se.clone(se.UNIT_W,pGe);f.x=(t.x-u.x)/u.width*2-1,f.y=(t.y-u.y)/u.height*2-1,f.z=n*2-1,f.w=1;let h,p=e.camera.frustum;if(c(p.fovy)){h=B.multiplyByVector(r.inverseViewProjection,f,Kae);let g=1/h.w;d.multiplyByScalar(h,g,h)}else{let g=p.offCenterFrustum;c(g)&&(p=g),h=Kae,h.x=(f.x*(p.right-p.left)+p.left+p.right)*.5,h.y=(f.y*(p.top-p.bottom)+p.bottom+p.top)*.5,h.z=(f.z*(a-l)-a-l)*.5,h.w=1,h=B.multiplyByVector(r.inverseView,h,h)}return d.fromCartesian4(h,i)};var Gi=Va;var rE={};rE._deprecationWarning=ws;var h_=Uint32Array.BYTES_PER_ELEMENT;rE.parse=function(e,t){let n=t??0;T.defined("arrayBuffer",e),t=n;let i=new Uint8Array(e),o=new DataView(e);t+=h_;let r=o.getUint32(t,!0);if(r!==1)throw new ae(`Only Batched 3D Model version 1 is supported.  Version ${r} is not.`);t+=h_;let s=o.getUint32(t,!0);t+=h_;let a=o.getUint32(t,!0);t+=h_;let l=o.getUint32(t,!0);t+=h_;let u=o.getUint32(t,!0);t+=h_;let f=o.getUint32(t,!0);t+=h_;let h;u>=570425344?(t-=h_*2,h=a,u=l,f=0,a=0,l=0,rE._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):f>=570425344&&(t-=h_,h=u,u=a,f=l,a=0,l=0,rE._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel."));let p;a===0?p={BATCH_LENGTH:h??0}:(p=ir(i,t,a),t+=a);let g=new Uint8Array(e,t,l);t+=l;let m,y;u>0&&(m=ir(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));let b=n+s-t;if(b===0)throw new ae("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,b):(rE._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+b))),{batchLength:h,featureTableJson:p,featureTableBinary:g,batchTableJson:m,batchTableBinary:y,gltf:x}};var cR=rE;function lR(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function $ae(e,t,n,i,o,r){let s=e._cachedTypedArrays,a=s[t];return c(a)||(a=$.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function _Ge(e,t,n,i){let o=e._cachedTypedArrays,r=o[t];return c(r)||(r=$.createTypedArray(n,i),o[t]=r),r}lR.prototype.getGlobalProperty=function(e,t,n){let i=this.json[e];if(c(i))return c(i.byteOffset)?(t=t??$.UNSIGNED_INT,n=n??1,$ae(this,e,t,n,1,i.byteOffset)):i};lR.prototype.hasProperty=function(e){return c(this.json[e])};lR.prototype.getPropertyArray=function(e,t,n){let i=this.json[e];if(c(i))return c(i.byteOffset)?(c(i.componentType)&&(t=$.fromName(i.componentType)),$ae(this,e,t,n,this.featuresLength,i.byteOffset)):_Ge(this,e,t,i)};lR.prototype.getProperty=function(e,t,n,i,o){let r=this.json[e];if(!c(r))return;let s=this.getPropertyArray(e,t,n);if(n===1)return s[i];for(let a=0;a<n;++a)o[a]=s[n*i+a];return o};var sh=lR;function uR(e){T.typeOf.number("options.count",e.count),T.typeOf.object("options.batchTable",e.batchTable);let t=e.count,n=e.batchTable,i=e.binaryBody,o=e.parseAsPropertyAttributes??!1,r=e.customAttributeOutput;if(o&&!c(r))throw new E("customAttributeOutput is required when parsing batch table as property attributes");let s=gGe(n),a;c(s.jsonProperties)&&(a=new l_({count:t,properties:s.jsonProperties}));let l;c(s.hierarchy)&&(l=new nx({extension:s.hierarchy,binaryBody:i}));let u=Qd.BATCH_TABLE_CLASS_NAME,f=s.binaryProperties,h,p,g;if(o){let b=bGe(t,u,f,i,r);g=b.transcodedSchema,p=[new Sx({propertyAttribute:b.propertyAttributeJson,class:b.transcodedClass})]}else{let b=yGe(t,u,f,i);g=b.transcodedSchema;let x=b.featureTableJson;h=new Nf({count:x.count,properties:x.properties,class:b.transcodedClass,bufferViews:b.bufferViewsTypedArrays}),p=[]}let m=[];if(c(h)||c(a)||c(l)){let b=new nl({id:0,name:"Batch Table",count:t,metadataTable:h,jsonMetadataTable:a,batchTableHierarchy:l});m.push(b)}let y={schema:g,propertyTables:m,propertyAttributes:p,extensions:s.extensions,extras:s.extras};return new Ys(y)}function gGe(e){let t=e.HIERARCHY,n=e.extras,i=e.extensions,o;c(t)?(uR._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):c(i)&&(o=i["3DTILES_batch_table_hierarchy"]);let r,s={};for(let a in e){if(!e.hasOwnProperty(a)||a==="HIERARCHY"||a==="extensions"||a==="extras")continue;let l=e[a];Array.isArray(l)?(r=c(r)?r:{},r[a]=l):s[a]=l}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}function yGe(e,t,n,i){let o={},r={},s={},a=0;for(let h in n){if(!n.hasOwnProperty(h))continue;if(!c(i))throw new ae(`Property ${h} requires a batch table binary.`);let p=n[h],g=Eu(p);r[h]={bufferView:a},o[h]=Zae(p),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+p.byteOffset,e),a++}let l={classes:{}};l.classes[t]={properties:o};let u=vu.fromJson(l);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:u,transcodedClass:u.classes[t]}}function bGe(e,t,n,i,o){let r={},s={},a=0;for(let h in n){if(!n.hasOwnProperty(h))continue;let p=n[h];if(!c(i)&&!c(p.typedArray))throw new ae(`Property ${h} requires a batch table binary.`);let g=$t.sanitizeGlslIdentifier(h);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);let m=Zae(p);m.name=h,r[g]=m;let y=g.toUpperCase();y.startsWith("_")||(y=`_${y}`);let b=p.typedArray;c(b)||(b=Eu(p).createArrayBufferView(i.buffer,i.byteOffset+p.byteOffset,e));let x=new Tn.Attribute;x.name=y,x.count=e,x.type=p.type;let A=$.fromTypedArray(b);(A===$.INT||A===$.UNSIGNED_INT||A===$.DOUBLE)&&(uR._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${y}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),b=new Float32Array(b)),x.componentDatatype=$.fromTypedArray(b),x.typedArray=b,o.push(x),s[g]={attribute:y}}let l={classes:{}};l.classes[t]={properties:r};let u=vu.fromJson(l);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:u,transcodedClass:u.classes[t]}}function Zae(e){let t=xGe(e.componentType);return{type:e.type,componentType:t}}function xGe(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}uR._deprecationWarning=ws;uR._oneTimeWarning=dt;var m_=uR;var Dx={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},TGe=Tn.FeatureIdAttribute;function wy(e){e=e??W.EMPTY_OBJECT;let t=e.b3dmResource,n=e.baseResource,i=e.arrayBuffer,o=e.byteOffset??0,r=e.releaseGltfJson??!1,s=e.asynchronous??!0,a=e.incrementallyLoadTextures??!0,l=e.upAxis??Fo.Y,u=e.forwardAxis??Fo.X,f=e.loadAttributesAsTypedArray??!1,h=e.loadAttributesFor2D??!1,p=e.enablePick??!1,g=e.loadIndicesForWireframe??!1,m=e.loadPrimitiveOutline??!0,y=e.loadForClassification??!1;T.typeOf.object("options.b3dmResource",t),T.typeOf.object("options.arrayBuffer",i),n=c(n)?n:t.clone(),this._b3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=l,this._forwardAxis=u,this._loadAttributesAsTypedArray=f,this._loadAttributesFor2D=h,this._enablePick=p,this._loadIndicesForWireframe=g,this._loadPrimitiveOutline=m,this._loadForClassification=y,this._state=Dx.UNLOADED,this._promise=void 0,this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=B.IDENTITY}c(Object.create)&&(wy.prototype=Object.create($i.prototype),wy.prototype.constructor=wy);Object.defineProperties(wy.prototype,{texturesLoaded:{get:function(){return this._gltfLoader?.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});wy.prototype.load=function(){if(c(this._promise))return this._promise;let e=cR.parse(this._arrayBuffer,this._byteOffset),t=e.batchLength,n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new sh(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;let a=s.getGlobalProperty("RTC_CENTER",$.FLOAT,3);c(a)&&(this._transform=B.fromTranslation(d.fromArray(a))),this._batchTable={json:o,binary:r};let l=new rh({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadAttributesFor2D:this._loadAttributesFor2D,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline,loadForClassification:this._loadForClassification,renameBatchIdSemantic:!0});this._gltfLoader=l,this._state=Dx.LOADING;let u=this;return this._promise=l.load().then(function(){if(!u.isDestroyed())return u._state=Dx.PROCESSING,u}).catch(function(f){if(!u.isDestroyed())return AGe(u,f)}),this._promise};function AGe(e,t){return e.unload(),e._state=Dx.FAILED,t=e.getError("Failed to load b3dm",t),Promise.reject(t)}wy.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===Dx.READY)return!0;if(this._state!==Dx.PROCESSING||!this._gltfLoader.process(e))return!1;let n=this._gltfLoader.components;return n.transform=B.multiplyTransformation(this._transform,n.transform,n.transform),CGe(this,n),this._components=n,this._arrayBuffer=void 0,this._state=Dx.READY,!0};function CGe(e,t){let n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(c(n.json))o=m_({count:i,batchTable:n.json,binaryBody:n.binary});else{let a=new nl({name:Qd.BATCH_TABLE_CLASS_NAME,count:i});o=new Ys({schema:{},propertyTables:[a]})}let r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)Qae(r[a]);t.structuralMetadata=o}function Qae(e){let t=e.children.length;for(let i=0;i<t;i++)Qae(e.children[i]);let n=e.primitives.length;for(let i=0;i<n;i++){let o=e.primitives[i],r=$t.getAttributeBySemantic(o,ht.FEATURE_ID);if(c(r)){r.setIndex=0;let s=new TGe;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}wy.prototype.unload=function(){c(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};var fR=wy;function vy(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.geoJson",e.geoJson),this._geoJson=e.geoJson,this._components=void 0}c(Object.create)&&(vy.prototype=Object.create($i.prototype),vy.prototype.constructor=vy);Object.defineProperties(vy.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}}});vy.prototype.load=function(){return Promise.resolve(this)};vy.prototype.process=function(e){return T.typeOf.object("frameState",e),c(this._components)||(this._components=FGe(this._geoJson,e),this._geoJson=void 0),!0};function EGe(){this.lines=void 0,this.points=void 0,this.properties=void 0}function SGe(){this.features=[]}function Q9(e){let t=e[0],n=e[1],i=e[2]??0;return new d(t,n,i)}function J9(e){let t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=Q9(e[o]);return[n]}function wGe(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=J9(e[i])[0];return n}function Jae(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=J9(e[i])[0];return n}function vGe(e){let t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,Jae(e[i]));return n}function DGe(e){return[Q9(e)]}function PGe(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=Q9(e[i]);return n}var IGe={LineString:J9,MultiLineString:wGe,MultiPolygon:vGe,Polygon:Jae,MultiPoint:PGe,Point:DGe},OGe={LineString:Me.LINES,MultiLineString:Me.LINES,MultiPolygon:Me.LINES,Polygon:Me.LINES,MultiPoint:Me.POINTS,Point:Me.POINTS};function ece(e,t){if(!c(e.geometry))return;let n=e.geometry.type,i=IGe[n],o=OGe[n],r=e.geometry.coordinates;if(!c(i)||!c(r))return;let s=new EGe;o===Me.LINES?s.lines=i(r):o===Me.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function RGe(e,t){let n=e.features,i=n.length;for(let o=0;o<i;o++)ece(n[o],t)}var MGe={FeatureCollection:RGe,Feature:ece},Cz=new d;function LGe(e,t,n){let i=0,o=0,r=e.length;for(let L=0;L<r;L++){let F=e[L];if(c(F.lines)){let _=F.lines.length;for(let w=0;w<_;w++){let D=F.lines[w];i+=D.length,o+=(D.length-1)*2}}}let s=new Float32Array(i*3),a=new Float32Array(i),l=Fe.createTypedArray(i,o),u=Fe.fromTypedArray(l),f=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),p=0,g=0;for(let L=0;L<r;L++){let F=e[L];if(!c(F.lines))continue;let _=F.lines.length;for(let w=0;w<_;w++){let D=F.lines[w],I=D.length;for(let N=0;N<I;N++){let k=D[N],z=d.fromDegrees(k.x,k.y,k.z,ie.WGS84,Cz),V=B.multiplyByPoint(t,z,Cz);d.minimumByComponent(f,V,f),d.maximumByComponent(h,V,h),d.pack(V,s,p*3),a[p]=L,N<I-1&&(l[g*2]=p,l[g*2+1]=p+1,g++),p++}}}let m=yt.createVertexBuffer({typedArray:s,context:n.context,usage:Be.STATIC_DRAW});m.vertexArrayDestroyable=!1;let y=yt.createVertexBuffer({typedArray:a,context:n.context,usage:Be.STATIC_DRAW});y.vertexArrayDestroyable=!1;let b=yt.createIndexBuffer({typedArray:l,context:n.context,usage:Be.STATIC_DRAW,indexDatatype:u});b.vertexArrayDestroyable=!1;let x=new Tn.Attribute;x.semantic=ht.POSITION,x.componentDatatype=$.FLOAT,x.type=nn.VEC3,x.count=i,x.min=f,x.max=h,x.buffer=m;let A=new Tn.Attribute;A.semantic=ht.FEATURE_ID,A.setIndex=0,A.componentDatatype=$.FLOAT,A.type=nn.SCALAR,A.count=i,A.buffer=y;let C=[x,A],S=new Tn.Material;S.unlit=!0;let v=new Tn.Indices;v.indexDatatype=u,v.count=l.length,v.buffer=b;let P=new Tn.FeatureIdAttribute;P.featureCount=r,P.propertyTableId=0,P.setIndex=0,P.positionalLabel="featureId_0";let M=[P],R=new Tn.Primitive;return R.attributes=C,R.indices=v,R.featureIds=M,R.primitiveType=Me.LINES,R.material=S,R}function NGe(e,t,n){let i=0,o=e.length;for(let C=0;C<o;C++){let S=e[C];c(S.points)&&(i+=S.points.length)}let r=new Float32Array(i*3),s=new Float32Array(i),a=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),u=0;for(let C=0;C<o;C++){let S=e[C];if(!c(S.points))continue;let v=S.points.length;for(let P=0;P<v;P++){let M=S.points[P],R=d.fromDegrees(M.x,M.y,M.z,ie.WGS84,Cz),L=B.multiplyByPoint(t,R,Cz);d.minimumByComponent(a,L,a),d.maximumByComponent(l,L,l),d.pack(L,r,u*3),s[u]=C,u++}}let f=yt.createVertexBuffer({typedArray:r,context:n.context,usage:Be.STATIC_DRAW});f.vertexArrayDestroyable=!1;let h=yt.createVertexBuffer({typedArray:s,context:n.context,usage:Be.STATIC_DRAW});h.vertexArrayDestroyable=!1;let p=new Tn.Attribute;p.semantic=ht.POSITION,p.componentDatatype=$.FLOAT,p.type=nn.VEC3,p.count=i,p.min=a,p.max=l,p.buffer=f;let g=new Tn.Attribute;g.semantic=ht.FEATURE_ID,g.setIndex=0,g.componentDatatype=$.FLOAT,g.type=nn.SCALAR,g.count=i,g.buffer=h;let m=[p,g],y=new Tn.Material;y.unlit=!0;let b=new Tn.FeatureIdAttribute;b.featureCount=o,b.propertyTableId=0,b.setIndex=0,b.positionalLabel="featureId_0";let x=[b],A=new Tn.Primitive;return A.attributes=m,A.featureIds=x,A.primitiveType=Me.POINTS,A.material=y,A}function FGe(e,t){let n=new SGe,i=MGe[e.type];c(i)&&i(e,n);let o=n.features,r=o.length;if(r===0)throw new ae("GeoJSON must have at least one feature");let s={};for(let L=0;L<r;L++){let _=o[L].properties??W.EMPTY_OBJECT;for(let w in _)_.hasOwnProperty(w)&&(c(s[w])||(s[w]=new Array(r)))}for(let L=0;L<r;L++){let F=o[L];for(let _ in s)if(s.hasOwnProperty(_)){let w=F.properties[_]??"";s[_][L]=w}}let a=new l_({count:r,properties:s}),u=[new nl({id:0,count:r,jsonMetadataTable:a})],f=vu.fromJson({}),h=new Ys({schema:f,propertyTables:u}),p=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),m=!1,y=!1;for(let L=0;L<r;L++){let F=o[L];if(c(F.lines)){m=!0;let _=F.lines.length;for(let w=0;w<_;w++){let D=F.lines[w],I=D.length;for(let N=0;N<I;N++)d.minimumByComponent(p,D[N],p),d.maximumByComponent(g,D[N],g)}}if(c(F.points)){y=!0;let _=F.points.length;for(let w=0;w<_;w++){let D=F.points[w];d.minimumByComponent(p,D,p),d.maximumByComponent(g,D,g)}}}let b=d.midpoint(p,g,new d),x=d.fromDegrees(b.x,b.y,b.z,ie.WGS84,new d),A=Ot.eastNorthUpToFixedFrame(x,ie.WGS84,new B),C=B.inverseTransformation(A,new B),S=[];m&&S.push(LGe(o,C,t)),y&&S.push(NGe(o,C,t));let v=new Tn.Node;v.index=0,v.primitives=S;let P=[v],M=new Tn.Scene;M.nodes=P;let R=new Tn.Components;return R.scene=M,R.nodes=P,R.transform=A,R.structuralMetadata=h,R}vy.prototype.unload=function(){this._components=void 0};var dR=vy;var Ez={};Ez._deprecationWarning=ws;var Dy=Uint32Array.BYTES_PER_ELEMENT;Ez.parse=function(e,t){T.defined("arrayBuffer",e);let n=t??0;t=n;let i=new Uint8Array(e),o=new DataView(e);t+=Dy;let r=o.getUint32(t,!0);if(r!==1)throw new ae(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=Dy;let s=o.getUint32(t,!0);t+=Dy;let a=o.getUint32(t,!0);if(a===0)throw new ae("featureTableJsonByteLength is zero, the feature table must be defined.");t+=Dy;let l=o.getUint32(t,!0);t+=Dy;let u=o.getUint32(t,!0);t+=Dy;let f=o.getUint32(t,!0);t+=Dy;let h=o.getUint32(t,!0);if(h!==1&&h!==0)throw new ae(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${h} is not.`);t+=Dy;let p=ir(i,t,a);t+=a;let g=new Uint8Array(e,t,l);t+=l;let m,y;u>0&&(m=ir(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));let b=n+s-t;if(b===0)throw new ae("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,b):(Ez._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+b))),{gltfFormat:h,featureTableJson:p,featureTableBinary:g,batchTableJson:m,batchTableBinary:y,gltf:x}};var hR=Ez;var p_={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},Sz=Tn.Attribute,BGe=Tn.FeatureIdAttribute,nce=Tn.Instances;function __(e){e=e??W.EMPTY_OBJECT;let t=e.i3dmResource,n=e.arrayBuffer,i=e.baseResource,o=e.byteOffset??0,r=e.releaseGltfJson??!1,s=e.asynchronous??!0,a=e.incrementallyLoadTextures??!0,l=e.upAxis??Fo.Y,u=e.forwardAxis??Fo.X,f=e.loadAttributesAsTypedArray??!1,h=e.loadIndicesForWireframe??!1,p=e.loadPrimitiveOutline??!0,g=e.enablePick??!1;T.typeOf.object("options.i3dmResource",t),T.typeOf.object("options.arrayBuffer",n),i=c(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=l,this._forwardAxis=u,this._loadAttributesAsTypedArray=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=p,this._enablePick=g,this._state=p_.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._buffers=[],this._components=void 0,this._transform=B.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}c(Object.create)&&(__.prototype=Object.create($i.prototype),__.prototype.constructor=__);Object.defineProperties(__.prototype,{texturesLoaded:{get:function(){return this._gltfLoader?.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});__.prototype.load=function(){if(c(this._promise))return this._promise;let e=hR.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new sh(t,n);this._featureTable=s;let a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!c(a))throw new ae("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;let l=s.getGlobalProperty("RTC_CENTER",$.FLOAT,3);c(l)&&(this._transform=B.fromTranslation(d.fromArray(l))),this._batchTable={json:i,binary:o};let u={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(r===0){let h=Fl(e.gltf);h=h.replace(/[\s\0]+$/,"");let p=this._baseResource.getDerivedResource({url:h});u.gltfResource=p,u.baseResource=p}else u.gltfResource=this._i3dmResource,u.typedArray=e.gltf;let f=new rh(u);return this._gltfLoader=f,this._state=p_.LOADING,this._promise=f.load().then(()=>{if(!this.isDestroyed())return this._state=p_.PROCESSING,this}).catch(h=>{if(!this.isDestroyed())throw kGe(this,h)}),this._promise};function kGe(e,t){return e.unload(),e._state=p_.FAILED,e.getError("Failed to load i3dm",t)}__.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state===p_.READY)return!0;let t=this._gltfLoader,n=!1;if(this._state===p_.PROCESSING&&(n=t.process(e)),!n)return!1;let i=t.components;return i.transform=B.multiplyTransformation(this._transform,i.transform,i.transform),zGe(this,i,e),UGe(this,i),this._components=i,this._arrayBuffer=void 0,this._state=p_.READY,!0};function UGe(e,t){let n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(c(n.json))o=m_({count:i,batchTable:n.json,binaryBody:n.binary});else{let r=new nl({name:Qd.BATCH_TABLE_CLASS_NAME,count:i});o=new Ys({schema:{},propertyTables:[r]})}t.structuralMetadata=o}var wz=new d,eW=new Array(4),VGe=new B;function zGe(e,t,n){let i,o=e._featureTable,r=e._instancesLength;if(r===0)return;let s=o.getGlobalProperty("RTC_CENTER",$.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),l=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,u=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),f=GGe(o,r),h;l&&(h=new Float32Array(4*r));let p;u&&(p=new Float32Array(3*r));let g=new Float32Array(r),m=d.unpackArray(f),y=new d,b=new d,x=new d,A=new d,C=new J,S=new Le,v=new Array(4),P=new d,M=new Array(3),R=new B;if(!c(s)||d.equals(d.unpack(s),d.ZERO)){let V=le.fromPoints(m);for(i=0;i<m.length;i++)d.subtract(m[i],V.center,wz),f[3*i+0]=wz.x,f[3*i+1]=wz.y,f[3*i+2]=wz.z;let j=B.fromTranslation(V.center,VGe);t.transform=B.multiplyTransformation(j,t.transform,t.transform)}for(i=0;i<r;i++){y=d.clone(m[i]),c(s)&&d.add(y,d.unpack(s),y),l&&(jGe(o,a,i,S,y,x,b,A,C,R),Le.pack(S,v,0),h[4*i+0]=v[0],h[4*i+1]=v[1],h[4*i+2]=v[2],h[4*i+3]=v[3]),u&&(WGe(o,i,P),d.pack(P,M,0),p[3*i+0]=M[0],p[3*i+1]=M[1],p[3*i+2]=M[2]);let V=o.getProperty("BATCH_ID",$.UNSIGNED_SHORT,1,i);c(V)||(V=i),g[i]=V}let L=new nce;L.transformInWorldSpace=!0;let F=e._buffers,_=new Sz;if(_.name="Instance Translation",_.semantic=rs.TRANSLATION,_.componentDatatype=$.FLOAT,_.type=nn.VEC3,_.count=r,_.typedArray=f,!l){let V=yt.createVertexBuffer({context:n.context,typedArray:f,usage:Be.STATIC_DRAW});V.vertexArrayDestroyable=!1,F.push(V),_.buffer=V}if(L.attributes.push(_),l){let V=new Sz;V.name="Instance Rotation",V.semantic=rs.ROTATION,V.componentDatatype=$.FLOAT,V.type=nn.VEC4,V.count=r,V.typedArray=h,L.attributes.push(V)}if(u){let V=new Sz;if(V.name="Instance Scale",V.semantic=rs.SCALE,V.componentDatatype=$.FLOAT,V.type=nn.VEC3,V.count=r,l)V.typedArray=p;else{let j=yt.createVertexBuffer({context:n.context,typedArray:p,usage:Be.STATIC_DRAW});j.vertexArrayDestroyable=!1,F.push(j),V.buffer=j}L.attributes.push(V)}let w=new Sz;w.name="Instance Feature ID",w.setIndex=0,w.semantic=rs.FEATURE_ID,w.componentDatatype=$.FLOAT,w.type=nn.SCALAR,w.count=r;let D=yt.createVertexBuffer({context:n.context,typedArray:g,usage:Be.STATIC_DRAW});D.vertexArrayDestroyable=!1,F.push(D),w.buffer=D,L.attributes.push(w);let I=new BGe;I.propertyTableId=0,I.setIndex=0,I.positionalLabel="instanceFeatureId_0",L.featureIds.push(I);let N=t.nodes,k=N.length,z=!1;for(i=0;i<k;i++){let V=N[i];V.primitives.length>0&&(V.instances=z?HGe(L):L,z=!0)}}function HGe(e){let t=new nce;t.transformInWorldSpace=e.transformInWorldSpace;let n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=je(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function GGe(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",$.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",$.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",$.FLOAT,3);if(!c(i))throw new ae("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let o=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",$.FLOAT,3);if(!c(o))throw new ae("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let r=new Float32Array(n.length);for(let s=0;s<n.length/3;s++)for(let a=0;a<3;a++){let l=3*s+a;r[l]=n[l]/65535*o[a]+i[a]}return r}else throw new ae("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}var tce=new Array(4);function jGe(e,t,n,i,o,r,s,a,l,u){let f=e.getProperty("NORMAL_UP",$.FLOAT,3,n,eW),h=e.getProperty("NORMAL_RIGHT",$.FLOAT,3,n,tce),p=!1;if(c(f)){if(!c(h))throw new ae("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");d.unpack(f,0,r),d.unpack(h,0,s),p=!0}else{let g=e.getProperty("NORMAL_UP_OCT32P",$.UNSIGNED_SHORT,2,n,eW),m=e.getProperty("NORMAL_RIGHT_OCT32P",$.UNSIGNED_SHORT,2,n,tce);if(c(g)){if(!c(m))throw new ae("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");Ln.octDecodeInRange(g[0],g[1],65535,r),Ln.octDecodeInRange(m[0],m[1],65535,s),p=!0}else t?(Ot.eastNorthUpToFixedFrame(o,ie.WGS84,u),B.getMatrix3(u,l)):J.clone(J.IDENTITY,l)}p&&(d.cross(s,r,a),d.normalize(a,a),J.setColumn(l,0,s,l),J.setColumn(l,1,r,l),J.setColumn(l,2,a,l)),Le.fromRotationMatrix(l,i)}function WGe(e,t,n){n=d.fromElements(1,1,1,n);let i=e.getProperty("SCALE",$.FLOAT,1,t);c(i)&&d.multiplyByScalar(n,i,n);let o=e.getProperty("SCALE_NON_UNIFORM",$.FLOAT,3,t,eW);c(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function qGe(e){let t=e._buffers,n=t.length;for(let i=0;i<n;i++){let o=t[i];o.isDestroyed()||o.destroy()}t.length=0}__.prototype.isUnloaded=function(){return this._state===p_.UNLOADED};__.prototype.unload=function(){c(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),qGe(this),this._components=void 0,this._arrayBuffer=void 0,this._state=p_.UNLOADED};var mR=__;var YGe={STOPPED:0,ANIMATING:1},ah=Object.freeze(YGe);function sE(){this.times=void 0,this.points=void 0,E.throwInstantiationError()}sE.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof d)return d;if(e instanceof Le)return Le;throw new E("point must be a Cartesian3, Quaternion, or number.")};sE.prototype.evaluate=E.throwInstantiationError;sE.prototype.findTimeInterval=function(e,t){let n=this.times,i=n.length;if(T.typeOf.number("time",e),e<n[0]||e>n[i-1])throw new E("time is out of range.");if(t=t??0,e>=n[t]){if(t+1<i&&e<n[t+1])return t;if(t+2<i&&e<n[t+2])return t+1}else if(t-1>=0&&e>=n[t-1])return t-1;let o;if(e>n[t])for(o=t;o<i-1&&!(e>=n[o]&&e<n[o+1]);++o);else for(o=t-1;o>=0&&!(e>=n[o]&&e<n[o+1]);--o);return o===i-1&&(o=i-2),o};sE.prototype.wrapTime=function(e){T.typeOf.number("time",e);let t=this.times,n=t[t.length-1],i=t[0],o=n-i,r;return e<i&&(r=Math.floor((i-e)/o)+1,e+=r*o),e>n&&(r=Math.floor((e-n)/o)+1,e-=r*o),e};sE.prototype.clampTime=function(e){T.typeOf.number("time",e);let t=this.times;return O.clamp(e,t[0],t[t.length-1])};var Ni=sE;function aE(e){this._value=e,this._valueType=Ni.getPointType(e)}Object.defineProperties(aE.prototype,{value:{get:function(){return this._value}}});aE.prototype.findTimeInterval=function(e){throw new E("findTimeInterval cannot be called on a ConstantSpline.")};aE.prototype.wrapTime=function(e){return T.typeOf.number("time",e),0};aE.prototype.clampTime=function(e){return T.typeOf.number("time",e),0};aE.prototype.evaluate=function(e,t){T.typeOf.number("time",e);let n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};var pR=aE;function cE(e){e=e??W.EMPTY_OBJECT;let t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=Ni.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(cE.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});cE.prototype.findTimeInterval=Ni.prototype.findTimeInterval;cE.prototype.wrapTime=Ni.prototype.wrapTime;cE.prototype.clampTime=Ni.prototype.clampTime;cE.prototype.evaluate=function(e,t){let n=this.points,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);return this._pointType===Number?(1-r)*n[o]+r*n[o+1]:(c(t)||(t=new d),d.lerp(n[o],n[o+1],r,t))};var Py=cE;var ice={};ice.solve=function(e,t,n,i){if(!c(e)||!(e instanceof Array))throw new E("The array lower is required.");if(!c(t)||!(t instanceof Array))throw new E("The array diagonal is required.");if(!c(n)||!(n instanceof Array))throw new E("The array upper is required.");if(!c(i)||!(i instanceof Array))throw new E("The array right is required.");if(t.length!==i.length)throw new E("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new E("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new E("lower and upper must be one less than the length of diagonal.");let o=new Array(n.length),r=new Array(i.length),s=new Array(i.length),a;for(a=0;a<r.length;a++)r[a]=new d,s[a]=new d;o[0]=n[0]/t[0],r[0]=d.multiplyByScalar(i[0],1/t[0],r[0]);let l;for(a=1;a<o.length;++a)l=1/(t[a]-o[a-1]*e[a-1]),o[a]=n[a]*l,r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],l,r[a]);for(l=1/(t[a]-o[a-1]*e[a-1]),r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],l,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=d.subtract(r[a],d.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};var lE=ice;var oce=[],rce=[],sce=[],ace=[];function XGe(e,t,n){let i=oce,o=sce,r=rce,s=ace;i.length=o.length=e.length-1,r.length=s.length=e.length;let a;i[0]=r[0]=1,o[0]=0;let l=s[0];for(c(l)||(l=s[0]=new d),d.clone(t,l),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,l=s[a],c(l)||(l=s[a]=new d),d.subtract(e[a+1],e[a-1],l),d.multiplyByScalar(l,3,l);return i[a]=0,o[a]=1,r[a]=4,l=s[a],c(l)||(l=s[a]=new d),d.subtract(e[a+1],e[a-1],l),d.multiplyByScalar(l,3,l),r[a+1]=1,l=s[a+1],c(l)||(l=s[a+1]=new d),d.clone(n,l),lE.solve(i,r,o,s)}function KGe(e){let t=oce,n=sce,i=rce,o=ace;t.length=n.length=e.length-1,i.length=o.length=e.length;let r;t[0]=n[0]=1,i[0]=2;let s=o[0];for(c(s)||(s=o[0]=new d),d.subtract(e[1],e[0],s),d.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],c(s)||(s=o[r]=new d),d.subtract(e[r+1],e[r-1],s),d.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],c(s)||(s=o[r]=new d),d.subtract(e[r],e[r-1],s),d.multiplyByScalar(s,3,s),lE.solve(t,i,n,o)}function Gl(e){e=e??W.EMPTY_OBJECT;let t=e.points,n=e.times,i=e.inTangents,o=e.outTangents;if(!c(t)||!c(n)||!c(i)||!c(o))throw new E("times, points, inTangents, and outTangents are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");if(i.length!==o.length||i.length!==t.length-1)throw new E("inTangents and outTangents must have a length equal to points.length - 1.");if(this._times=n,this._points=t,this._pointType=Ni.getPointType(t[0]),this._pointType!==Ni.getPointType(i[0])||this._pointType!==Ni.getPointType(o[0]))throw new E("inTangents and outTangents must be of the same type as points.");this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(Gl.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},inTangents:{get:function(){return this._inTangents}},outTangents:{get:function(){return this._outTangents}}});Gl.createC1=function(e){e=e??W.EMPTY_OBJECT;let t=e.times,n=e.points,i=e.tangents;if(!c(n)||!c(t)||!c(i))throw new E("points, times and tangents are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length||t.length!==i.length)throw new E("times, points and tangents must have the same length.");let o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Gl({times:t,points:n,inTangents:r,outTangents:o})};Gl.createNaturalCubic=function(e){e=e??W.EMPTY_OBJECT;let t=e.times,n=e.points;if(!c(n)||!c(t))throw new E("points and times are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new E("times.length must be equal to points.length.");if(n.length<3)return new Py({points:n,times:t});let i=KGe(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Gl({times:t,points:n,inTangents:r,outTangents:o})};Gl.createClampedCubic=function(e){e=e??W.EMPTY_OBJECT;let t=e.times,n=e.points,i=e.firstTangent,o=e.lastTangent;if(!c(n)||!c(t)||!c(i)||!c(o))throw new E("points, times, firstTangent and lastTangent are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new E("times.length must be equal to points.length.");let r=Ni.getPointType(n[0]);if(r!==Ni.getPointType(i)||r!==Ni.getPointType(o))throw new E("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new Py({points:n,times:t});let s=XGe(n,i,o),a=s.slice(0,s.length-1),l=s.slice(1,s.length);return new Gl({times:t,points:n,inTangents:l,outTangents:a})};Gl.hermiteCoefficientMatrix=new B(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);Gl.prototype.findTimeInterval=Ni.prototype.findTimeInterval;var $Ge=new se,uE=new d;Gl.prototype.wrapTime=Ni.prototype.wrapTime;Gl.prototype.clampTime=Ni.prototype.clampTime;Gl.prototype.evaluate=function(e,t){let n=this.points,i=this.times,o=this.inTangents,r=this.outTangents;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);let s=this._lastTimeIndex,a=i[s+1]-i[s],l=(e-i[s])/a,u=$Ge;u.z=l,u.y=l*l,u.x=u.y*l,u.w=1;let f=B.multiplyByVector(Gl.hermiteCoefficientMatrix,u,u);f.z*=a,f.w*=a;let h=this._pointType;return h===Number?n[s]*f.x+n[s+1]*f.y+r[s]*f.z+o[s]*f.w:(c(t)||(t=new h),t=h.multiplyByScalar(n[s],f.x,t),h.multiplyByScalar(n[s+1],f.y,uE),h.add(t,uE,t),h.multiplyByScalar(r[s],f.z,uE),h.add(t,uE,t),h.multiplyByScalar(o[s],f.w,uE),h.add(t,uE,t))};var Iy=Gl;function fE(e){e=e??W.EMPTY_OBJECT;let t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=Ni.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(fE.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});fE.prototype.findTimeInterval=Ni.prototype.findTimeInterval;fE.prototype.wrapTime=Ni.prototype.wrapTime;fE.prototype.clampTime=Ni.prototype.clampTime;fE.prototype.evaluate=function(e,t){let n=this.points;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);let i=this._lastTimeIndex,o=this._pointType;return o===Number?n[i]:(c(t)||(t=new o),o.clone(n[i],t))};var _R=fE;function ZGe(e){let t=e.points,n=e.times;return function(i,o){c(o)||(o=new Le);let r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=t[r],l=t[r+1];return Le.fastSlerp(a,l,s,o)}}function dE(e){e=e??W.EMPTY_OBJECT;let t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._evaluateFunction=ZGe(this),this._lastTimeIndex=0}Object.defineProperties(dE.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});dE.prototype.findTimeInterval=Ni.prototype.findTimeInterval;dE.prototype.wrapTime=Ni.prototype.wrapTime;dE.prototype.clampTime=Ni.prototype.clampTime;dE.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};var gR=dE;var hE=Tn.AnimatedPropertyType;function tW(e){e=e??W.EMPTY_OBJECT;let t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;T.typeOf.object("options.channel",t),T.typeOf.object("options.runtimeAnimation",n),T.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,n5e(this)}Object.defineProperties(tW.prototype,{channel:{get:function(){return this._channel}},runtimeAnimation:{get:function(){return this._runtimeAnimation}},runtimeNode:{get:function(){return this._runtimeNode}},splines:{get:function(){return this._splines}}});function QGe(e,t){let n=[],i=[],o=[],r=t.length;for(let s=0;s<r;s+=3)i.push(t[s]),n.push(t[s+1]),o.push(t[s+2]);return i.splice(0,1),o.length=o.length-1,new Iy({times:e,points:n,inTangents:i,outTangents:o})}function cce(e,t,n,i){if(e.length===1&&t.length===1)return new pR(t[0]);switch(n){case ih.STEP:return new _R({times:e,points:t});case ih.CUBICSPLINE:return QGe(e,t);case ih.LINEAR:return i===hE.ROTATION?new gR({times:e,points:t}):new Py({times:e,points:t})}}function JGe(e,t,n,i,o){let r=[];if(i===hE.WEIGHTS){let a=t.length/o,l,u;for(l=0;l<o;l++){let f=new Array(a),h=l;if(n===ih.CUBICSPLINE)for(u=0;u<a;u+=3)f[u]=t[h],f[u+1]=t[h+o],f[u+2]=t[h+2*o],h+=o*3;else for(u=0;u<a;u++)f[u]=t[h],h+=o;r.push(cce(e,f,n,i))}}else r.push(cce(e,t,n,i));return r}var e5e=new d,t5e=new Le;function n5e(e){let t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,a=t.target.path,l=e._runtimeNode,u=c(l.morphWeights)?l.morphWeights.length:1,f=JGe(i,o,r,a,u);e._splines=f,e._path=a}tW.prototype.animate=function(e){let t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===hE.WEIGHTS){let r=o.morphWeights,s=r.length;for(let a=0;a<s;a++){let l=t[a],u=i.clampAnimations?l.clampTime(e):l.wrapTime(e);r[a]=l.evaluate(u)}}else{if(o.userAnimated)return;{let r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);n===hE.TRANSLATION||n===hE.SCALE?o[n]=r.evaluate(s,e5e):n===hE.ROTATION&&(o[n]=r.evaluate(s,t5e))}}};var yR=tW;function nW(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=Q.clone(n.startTime),this._delay=n.delay??0,this._stopTime=Q.clone(n.stopTime),this.removeOnStop=n.removeOnStop??!1,this._multiplier=n.multiplier??1,this._reverse=n.reverse??!1,this._loop=n.loop??Hl.NONE,this._startOffset=n.startOffset??0,this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new pe,this.update=new pe,this.stop=new pe,this._state=ah.STOPPED,this._computedStartTime=void 0,this._duration=void 0;let i=this;this._raiseStartEvent=function(){i.start.raiseEvent(e,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(e,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(e,i)},this._model=e,this._localStartTime=void 0,this._localStopTime=void 0,i5e(this)}Object.defineProperties(nW.prototype,{animation:{get:function(){return this._animation}},name:{get:function(){return this._name}},runtimeChannels:{get:function(){return this._runtimeChannels}},model:{get:function(){return this._model}},localStartTime:{get:function(){return this._localStartTime}},localStopTime:{get:function(){return this._localStopTime}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},startOffset:{get:function(){return this._startOffset}},animationTime:{get:function(){return this._animationTime}}});function i5e(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=e._model.sceneGraph,r=e._animation.channels,s=r.length,a=[];for(let l=0;l<s;l++){let u=r[l],f=u.target;if(!c(f))continue;let h=f.node.index,p=i._runtimeNodes[h],g=new yR({channel:u,runtimeAnimation:e,runtimeNode:p}),m=u.sampler.input;t=Math.min(t,m[0]),n=Math.max(n,m[m.length-1]),a.push(g)}e._runtimeChannels=a,e._localStartTime=t,e._localStopTime=n}nW.prototype.animate=function(e){let t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};var bR=nW;function g_(e){this.animationAdded=new pe,this.animationRemoved=new pe,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(g_.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function iW(e,t,n){let i=e._model,o=new bR(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}g_.prototype.add=function(e){e=e??W.EMPTY_OBJECT;let t=this._model;if(!t.ready)throw new E("Animations are not loaded.  Wait for Model.ready to be true.");let n=t.sceneGraph.components.animations;if(!c(e.name)&&!c(e.index))throw new E("Either options.name or options.index must be defined.");if(c(e.multiplier)&&e.multiplier<=0)throw new E("options.multiplier must be greater than zero.");if(c(e.index)&&(e.index>=n.length||e.index<0))throw new E("options.index must be a valid animation index.");let i=e.index;if(c(i))return iW(this,n[i],e);let o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}if(!c(i))throw new E("options.name must be a valid animation name.");return iW(this,n[i],e)};g_.prototype.addAll=function(e){e=e??W.EMPTY_OBJECT;let t=this._model;if(!t.ready)throw new E("Animations are not loaded.  Wait for Model.ready to be true.");if(c(e.multiplier)&&e.multiplier<=0)throw new E("options.multiplier must be greater than zero.");let n=t.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){let s=iW(this,n[r],e);i.push(s)}return i};g_.prototype.remove=function(e){if(!c(e))return!1;let t=this._runtimeAnimations,n=t.indexOf(e);return n!==-1?(t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0):!1};g_.prototype.removeAll=function(){let e=this._model,t=this._runtimeAnimations,n=t.length;this._runtimeAnimations.length=0;for(let i=0;i<n;++i)this.animationRemoved.raiseEvent(e,t[i])};g_.prototype.contains=function(e){return c(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};g_.prototype.get=function(e){if(!c(e))throw new E("index is required.");if(e>=this._runtimeAnimations.length||e<0)throw new E("index must be valid within the range of the collection");return this._runtimeAnimations[e]};var vz=[];function o5e(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}g_.prototype.update=function(e){let t=this._runtimeAnimations,n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&Q.equals(e.time,this._previousTime))return!1;this._previousTime=Q.clone(e.time,this._previousTime);let i=!1,o=e.time,r=this._model;for(let s=0;s<n;++s){let a=t[s];c(a._computedStartTime)||(a._computedStartTime=Q.addSeconds(a.startTime??o,a.delay,new Q)),c(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));let l=a._computedStartTime,u=a._duration,f=a.stopTime,h=Q.lessThanOrEquals(l,o),p=c(f)&&Q.greaterThan(o,f),g=0;if(u!==0){let b=Q.secondsDifference(p?f:o,l);g=c(a._animationTime)?a._animationTime(u,b):b/u}let m=a.loop===Hl.REPEAT||a.loop===Hl.MIRRORED_REPEAT,y=(h||m&&!c(a.startTime))&&(g<=1||m)&&!p;if(g===a._prevAnimationDelta){let b=a._state===ah.STOPPED;if(y!==b)continue}if(a._prevAnimationDelta=g,y||a._state===ah.ANIMATING){if(y&&a._state===ah.STOPPED&&(a._state=ah.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Hl.REPEAT)g=g-Math.floor(g);else if(a.loop===Hl.MIRRORED_REPEAT){let A=Math.floor(g),C=g-A;g=A%2===1?1-C:C}let b=a.startOffset;a.reverse&&(g=1-g,b=-b);let x=g*u*a.multiplier+b;x=O.clamp(x,a.localStartTime,a.localStopTime),a.animate(x),a.update.numberOfListeners>0&&(a._updateEventTime=x,e.afterRender.push(a._raiseUpdateEvent)),i=!0,y||(a._state=ah.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&vz.push(a))}}n=vz.length;for(let s=0;s<n;++s){let a=vz[s];t.splice(t.indexOf(a),1),e.afterRender.push(o5e(this,r,a))}return vz.length=0,i};var xR=g_;function Px(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(Px.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return c(this._color)||(this._color=new G),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}});Px.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};Px.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};Px.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};Px.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};Px.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};var TR=Px;var AR={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};AR.getStyleCommandsNeeded=function(e,t){return t===0?AR.ALL_OPAQUE:t===e?AR.ALL_TRANSLUCENT:AR.OPAQUE_AND_TRANSLUCENT};var ch=Object.freeze(AR);var Oy={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};Oy.is3DTiles=function(e){switch(T.typeOf.string("modelType",e),e){case Oy.TILE_GLTF:case Oy.TILE_B3DM:case Oy.TILE_I3DM:case Oy.TILE_PNTS:case Oy.TILE_GEOJSON:return!0;case Oy.GLTF:return!1;default:throw new E("modelType is not a valid value.")}};var pr=Object.freeze(Oy);function jr(e){let t=e.model,n=e.propertyTable;T.typeOf.object("propertyTable",n),T.typeOf.object("model",t),this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=ch.ALL_OPAQUE,r5e(this)}Object.defineProperties(jr.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return c(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}});function r5e(e){let t=e._model,n=pr.is3DTiles(t.type),i=e._propertyTable.count;if(i===0)return;let o,r=new Array(i);if(n){let s=t.content;for(o=0;o<i;o++)r[o]=new Ws(s,o)}else for(o=0;o<i;o++)r[o]=new TR({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new el({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}jr.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);let t=ch.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};jr.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};jr.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};jr.prototype.getShow=function(e){return this._batchTexture.getShow(e)};jr.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};jr.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};jr.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};jr.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};jr.prototype.getFeature=function(e){return this._features[e]};jr.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};jr.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};jr.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};jr.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};jr.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};jr.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};jr.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};jr.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};jr.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};var s5e=new G;jr.prototype.applyStyle=function(e){if(!c(e)){this.setAllColor(el.DEFAULT_COLOR_VALUE),this.setAllShow(el.DEFAULT_SHOW_VALUE);return}for(let t=0;t<this._featuresLength;t++){let n=this.getFeature(t),i=c(e.color)?e.color.evaluateColor(n,s5e)??el.DEFAULT_COLOR_VALUE:el.DEFAULT_COLOR_VALUE,o=c(e.show)?e.show.evaluate(n)??el.DEFAULT_SHOW_VALUE:el.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};jr.prototype.isDestroyed=function(){return!1};jr.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),de(this)};var CR=jr;var lce={name:"TilesetPipelineStage"};lce.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,ge.FRAGMENT);let r={u_polygonOffset:function(){return H.ZERO}};e.uniformMap=xt(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}let i=e.renderStateOptions;i.stencilTest=kt.setCesium3DTileBit(),i.stencilMask=kt.CESIUM_3D_TILE_MASK};var ER=lce;var SR=`vec2 nearestPointOnEllipseFast(vec2 pos, vec2 radii) {
vec2 p = abs(pos);
vec2 inverseRadii = 1.0 / radii;
vec2 evoluteScale = (radii.x * radii.x - radii.y * radii.y) * vec2(1.0, -1.0) * inverseRadii;
vec2 tTrigs = vec2(0.70710678118);
vec2 v = radii * tTrigs;
vec2 evolute = evoluteScale * tTrigs * tTrigs * tTrigs;
vec2 q = normalize(p - evolute) * length(v - evolute);
tTrigs = (q + evolute) * inverseRadii;
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
v = radii * tTrigs;
return v * sign(pos);
}
vec3 computeEllipsoidPositionWC(vec3 positionMC) {
vec3 positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
vec2 positionEllipse = vec2(length(positionWC.xy), positionWC.z);
vec2 nearestPoint = nearestPointOnEllipseFast(positionEllipse, czm_ellipsoidRadii.xz);
return vec3(nearestPoint.x * normalize(positionWC.xy), nearestPoint.y);
}
void applyFog(inout vec4 color, vec4 groundAtmosphereColor, vec3 lightDirection, float distanceToCamera) {
vec3 fogColor = groundAtmosphereColor.rgb;
const float NONE = 0.0;
if (czm_atmosphereDynamicLighting != NONE) {
float darken = clamp(dot(normalize(czm_viewerPositionWC), lightDirection), czm_fogMinimumBrightness, 1.0);
fogColor *= darken;
}
#ifndef HDR
fogColor.rgb = czm_pbrNeutralTonemapping(fogColor.rgb);
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
#endif
vec3 withFog = czm_fog(distanceToCamera, color.rgb, fogColor, czm_fogVisualDensityScalar);
color = vec4(withFog, color.a);
}
void atmosphereStage(inout vec4 color, in ProcessedAttributes attributes) {
vec3 rayleighColor;
vec3 mieColor;
float opacity;
vec3 positionWC;
vec3 lightDirection;
if (false) {
positionWC = computeEllipsoidPositionWC(attributes.positionMC);
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
czm_computeGroundAtmosphereScattering(
positionWC,
lightDirection,
rayleighColor,
mieColor,
opacity
);
} else {
positionWC = attributes.positionWC;
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
rayleighColor = v_atmosphereRayleighColor;
mieColor = v_atmosphereMieColor;
opacity = v_atmosphereOpacity;
}
const bool ignoreBlackPixels = true;
rayleighColor = czm_applyHSBShift(rayleighColor, czm_atmosphereHsbShift, ignoreBlackPixels);
mieColor = czm_applyHSBShift(mieColor, czm_atmosphereHsbShift, ignoreBlackPixels);
vec4 groundAtmosphereColor = czm_computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
if (u_isInFog) {
float distanceToCamera = length(attributes.positionEC);
applyFog(color, groundAtmosphereColor, lightDirection, distanceToCamera);
} else {
}
}
`;var wR=`void atmosphereStage(ProcessedAttributes attributes) {
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_positionWC, czm_atmosphereDynamicLighting);
czm_computeGroundAtmosphereScattering(
v_positionWC,
lightDirection,
v_atmosphereRayleighColor,
v_atmosphereMieColor,
v_atmosphereOpacity
);
}
`;var uce={name:"AtmospherePipelineStage"};uce.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_ATMOSPHERE",void 0,ge.BOTH),i.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,ge.BOTH),i.addVarying("vec3","v_atmosphereRayleighColor"),i.addVarying("vec3","v_atmosphereMieColor"),i.addVarying("float","v_atmosphereOpacity"),i.addVertexLines([wR]),i.addFragmentLines([SR]),i.addUniform("bool","u_isInFog",ge.FRAGMENT),e.uniformMap.u_isInFog=function(){let o=d.distance(n.camera.positionWC,t.boundingSphere.center);return O.fog(o,n.fog.density)>O.EPSILON3}};var vR=uce;var DR=`#ifdef DIFFUSE_IBL
vec3 sampleDiffuseEnvironment(vec3 cubeDir)
{
#ifdef CUSTOM_SPHERICAL_HARMONICS
return czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);
#else
return czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
#endif
}
#endif
#ifdef SPECULAR_IBL
vec3 sampleSpecularEnvironment(vec3 cubeDir, float roughness)
{
#ifdef CUSTOM_SPECULAR_IBL
float lod = roughness * model_specularEnvironmentMapsMaximumLOD;
return czm_textureCube(model_specularEnvironmentMaps, cubeDir, lod).rgb;
#else
float lod = roughness * czm_specularEnvironmentMapsMaximumLOD;
return czm_textureCube(czm_specularEnvironmentMaps, cubeDir, lod).rgb;
#endif
}
vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, vec3 f0, float roughness)
{
vec3 f90 = max(vec3(1.0 - roughness), f0);
vec3 F = fresnelSchlick2(f0, f90, NdotV);
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
vec3 specularSample = sampleSpecularEnvironment(cubeDir, roughness);
return specularSample * (F * brdfLut.x + brdfLut.y);
}
#endif
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
vec3 textureIBL(vec3 viewDirectionEC, vec3 normalEC, czm_modelMaterial material) {
vec3 f0 = material.specular;
float roughness = material.roughness;
float specularWeight = 1.0;
#ifdef USE_SPECULAR
specularWeight = material.specularWeight;
#endif
float NdotV = clamp(dot(normalEC, viewDirectionEC), 0.0, 1.0);
vec3 f90 = max(vec3(1.0 - roughness), f0);
vec3 singleScatterFresnel = fresnelSchlick2(f0, f90, NdotV);
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
vec3 FssEss = specularWeight * (singleScatterFresnel * brdfLut.x + brdfLut.y);
#ifdef DIFFUSE_IBL
vec3 normalMC = normalize(model_iblReferenceFrameMatrix * normalEC);
vec3 irradiance = sampleDiffuseEnvironment(normalMC);
vec3 averageFresnel = f0 + (1.0 - f0) / 21.0;
float Ems = specularWeight * (1.0 - brdfLut.x - brdfLut.y);
vec3 FmsEms = FssEss * averageFresnel * Ems / (1.0 - averageFresnel * Ems);
vec3 dielectricScattering = (1.0 - FssEss - FmsEms) * material.diffuse;
vec3 diffuseContribution = irradiance * (FmsEms + dielectricScattering) * model_iblFactor.x;
#else
vec3 diffuseContribution = vec3(0.0);
#endif
#ifdef USE_ANISOTROPY
vec3 anisotropyDirection = material.anisotropicB;
vec3 anisotropicTangent = cross(anisotropyDirection, viewDirectionEC);
vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);
float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - roughness);
float bendFactorPow4 = bendFactor * bendFactor * bendFactor * bendFactor;
vec3 bentNormal = normalize(mix(anisotropicNormal, normalEC, bendFactorPow4));
vec3 reflectEC = reflect(-viewDirectionEC, bentNormal);
#else
vec3 reflectEC = reflect(-viewDirectionEC, normalEC);
#endif
#ifdef SPECULAR_IBL
vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflectEC);
vec3 radiance = sampleSpecularEnvironment(reflectMC, roughness);
vec3 specularContribution = radiance * FssEss * model_iblFactor.y;
#else
vec3 specularContribution = vec3(0.0);
#endif
return diffuseContribution + specularContribution;
}
#endif
`;var fce={name:"ImageBasedLightingPipelineStage"},a5e=new H;fce.process=function(e,t,n){let i=t.imageBasedLighting,o=t.environmentMapManager,r=e.shaderBuilder,s;c(i.specularEnvironmentMaps)||(s=o.radianceCubeMap);let a=i.sphericalHarmonicCoefficients??o.sphericalHarmonicCoefficients;r.addDefine("USE_IBL_LIGHTING",void 0,ge.FRAGMENT),r.addUniform("vec2","model_iblFactor",ge.FRAGMENT),Yd.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&r.addUniform("mat3","model_iblReferenceFrameMatrix",ge.FRAGMENT),c(s)&&r.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,ge.BOTH),c(a)&&c(a[0])?(r.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),r.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,ge.FRAGMENT),r.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",ge.FRAGMENT)):i.useDefaultSphericalHarmonics&&r.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),c(i.specularEnvironmentCubeMap)&&i.specularEnvironmentCubeMap.ready||c(s)?(r.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT),r.addDefine("CUSTOM_SPECULAR_IBL",void 0,ge.FRAGMENT),r.addUniform("samplerCube","model_specularEnvironmentMaps",ge.FRAGMENT),r.addUniform("float","model_specularEnvironmentMapsMaximumLOD",ge.FRAGMENT)):t.useDefaultSpecularMaps&&r.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT)),r.addFragmentLines(DR);let l={model_iblFactor:function(){return H.multiplyByScalar(i.imageBasedLightingFactor,o?.intensity||1,a5e)},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_sphericalHarmonicCoefficients:function(){return a},model_specularEnvironmentMaps:function(){return i.specularEnvironmentCubeMap.texture},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentCubeMap.maximumMipmapLevel}};c(s)&&(l.model_specularEnvironmentMaps=function(){return s},l.model_specularEnvironmentMapsMaximumLOD=function(){return o.maximumMipmapLevel}),e.uniformMap=xt(l,e.uniformMap)};var PR=fce;var c5e=O.EPSILON16;function rW(e){e=e??W.EMPTY_OBJECT;let t=e.stage,n=e.runtimeArticulation;T.typeOf.object("options.stage",t),T.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(rW.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){T.typeOf.number("value",e),e=O.clamp(e,this.minimumValue,this.maximumValue),O.equalsEpsilon(this._currentValue,e,c5e)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});var l5e=new d,oW=new J;rW.prototype.applyStageToMatrix=function(e){T.typeOf.object("result",e);let t=this.type,n=this.currentValue,i=l5e,o;switch(t){case xc.XROTATE:o=J.fromRotationX(O.toRadians(n),oW),e=B.multiplyByMatrix3(e,o,e);break;case xc.YROTATE:o=J.fromRotationY(O.toRadians(n),oW),e=B.multiplyByMatrix3(e,o,e);break;case xc.ZROTATE:o=J.fromRotationZ(O.toRadians(n),oW),e=B.multiplyByMatrix3(e,o,e);break;case xc.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case xc.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case xc.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=B.multiplyByTranslation(e,i,e);break;case xc.XSCALE:i.x=n,i.y=1,i.z=1,e=B.multiplyByScale(e,i,e);break;case xc.YSCALE:i.x=1,i.y=n,i.z=1,e=B.multiplyByScale(e,i,e);break;case xc.ZSCALE:i.x=1,i.y=1,i.z=n,e=B.multiplyByScale(e,i,e);break;case xc.UNIFORMSCALE:e=B.multiplyByUniformScale(e,n,e);break;default:break}return e};var IR=rW;function Dz(e){e=e??W.EMPTY_OBJECT;let t=e.articulation,n=e.sceneGraph;T.typeOf.object("options.articulation",t),T.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,u5e(this)}Object.defineProperties(Dz.prototype,{articulation:{get:function(){return this._articulation}},sceneGraph:{get:function(){return this._sceneGraph}},name:{get:function(){return this._name}},runtimeStages:{get:function(){return this._runtimeStages}},runtimeNodes:{get:function(){return this._runtimeNodes}}});function u5e(e){let n=e.articulation.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s<i;s++){let a=n[s],l=new IR({stage:a,runtimeArticulation:e});o.push(l);let u=a.name;r[u]=l}}Dz.prototype.setArticulationStage=function(e,t){let n=this._runtimeStagesByName[e];c(n)&&(n.currentValue=t)};var f5e=new B,d5e=new B;Dz.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=B.clone(B.IDENTITY,f5e),t,n=this._runtimeStages,i=n.length;for(t=0;t<i;t++)e=n[t].applyStageToMatrix(e);let o=this._runtimeNodes,r=o.length;for(t=0;t<r;t++){let s=o[t],a=B.multiplyTransformation(s.originalTransform,e,d5e);s.transform=a}};var OR=Dz;var RR=`void modelColorStage(inout czm_modelMaterial material)
{
material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);
float highlight = ceil(model_colorBlend);
material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);
material.alpha *= model_color.a;
}
`;var mE={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};mE.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,ge.FRAGMENT),i.addFragmentLines(RR);let o={},r=t.color;r.alpha===0&&!t.hasSilhouette(n)&&(e.renderStateOptions.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),r.alpha<1&&(e.alphaOptions.pass=De.TRANSLUCENT),i.addUniform("vec4",mE.COLOR_UNIFORM_NAME,ge.FRAGMENT),o[mE.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",mE.COLOR_BLEND_UNIFORM_NAME,ge.FRAGMENT),o[mE.COLOR_BLEND_UNIFORM_NAME]=function(){return bc.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=xt(o,e.uniformMap)};var Ry=mE;var MR=`#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE
vec4 getClippingPlane(
highp sampler2D packedClippingPlanes,
int clippingPlaneNumber,
mat4 transform
) {
int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;
int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
vec4 plane = texture(packedClippingPlanes, vec2(u, v));
return czm_transformPlane(plane, transform);
}
#else
vec4 getClippingPlane(
highp sampler2D packedClippingPlanes,
int clippingPlaneNumber,
mat4 transform
) {
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;
int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
float u = (float(pixX) + 0.5) * pixelWidth;
float v = (float(pixY) + 0.5) * pixelHeight;
vec4 oct32 = texture(packedClippingPlanes, vec2(u, v)) * 255.0;
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
vec4 plane;
plane.xyz = czm_octDecode(oct, 65535.0);
plane.w = czm_unpackFloat(texture(packedClippingPlanes, vec2(u + pixelWidth, v)));
return czm_transformPlane(plane, transform);
}
#endif
float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {
vec4 position = czm_windowToEyeCoordinates(fragCoord);
vec3 clipNormal = vec3(0.0);
vec3 clipPosition = vec3(0.0);
float pixelWidth = czm_metersPerPixel(position);
#ifdef UNION_CLIPPING_REGIONS
float clipAmount;
#else
float clipAmount = 0.0;
bool clipped = true;
#endif
for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
clipNormal = clippingPlane.xyz;
clipPosition = -clippingPlane.w * clipNormal;
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
#ifdef UNION_CLIPPING_REGIONS
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
if (amount <= 0.0) {
discard;
}
#else
clipAmount = max(amount, clipAmount);
clipped = clipped && (amount <= 0.0);
#endif
}
#ifndef UNION_CLIPPING_REGIONS
if (clipped) {
discard;
}
#endif
return clipAmount;
}
void modelClippingPlanesStage(inout vec4 color)
{
float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;
float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {
color = clippingPlanesEdgeColor;
}
}
`;var dce={name:"ModelClippingPlanesPipelineStage"},h5e=new H;dce.process=function(e,t,n){let i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,ge.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,ge.FRAGMENT),gs.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,ge.FRAGMENT);let s=gs.getTextureResolution(i,o,h5e);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,ge.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",ge.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",ge.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",ge.FRAGMENT),r.addFragmentLines(MR);let a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){let l=G.clone(i.edgeColor);return l.alpha=i.edgeWidth,l},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=xt(a,e.uniformMap)};var LR=dce;var NR=`void modelClippingPolygonsStage(ProcessedAttributes attributes)
{
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(v_positionWC);
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
vec2 minDistance = vec2(czm_infinity);
v_regionIndex = -1;
v_clippingPosition = vec2(czm_infinity);
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
vec4 extents = czm_unpackClippingExtents(model_clippingExtents, regionIndex);
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
vec2 distance = abs(rectUv - clamped) * extents.wz;
if (minDistance.x > distance.x || minDistance.y > distance.y) {
minDistance = distance;
v_clippingPosition = rectUv;
}
float threshold = 0.01;
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
v_regionIndex = regionIndex;
}
}
}
`;var FR=`void modelClippingPolygonsStage()
{
vec2 clippingPosition = v_clippingPosition;
int regionIndex = v_regionIndex;
czm_clipPolygons(model_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
}
`;var hce={name:"ModelClippingPolygonsPipelineStage"};hce.process=function(e,t,n){let i=t.clippingPolygons,o=e.shaderBuilder;o.addDefine("ENABLE_CLIPPING_POLYGONS",void 0,ge.BOTH),i.inverse&&o.addDefine("CLIPPING_INVERSE",void 0,ge.FRAGMENT),o.addDefine("CLIPPING_POLYGON_REGIONS_LENGTH",i.extentsCount,ge.BOTH),o.addUniform("sampler2D","model_clippingDistance",ge.FRAGMENT),o.addUniform("sampler2D","model_clippingExtents",ge.VERTEX),o.addVarying("vec2","v_clippingPosition"),o.addVarying("int","v_regionIndex","flat"),o.addVertexLines(NR),o.addFragmentLines(FR);let r={model_clippingDistance:function(){return i.clippingTexture},model_clippingExtents:function(){return i.extentsTexture}};e.uniformMap=xt(r,e.uniformMap)};var BR=hce;function mce(e,t){T.typeOf.object("model",e),T.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(mce.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){c(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});var kR=mce;var UR=`mat4 getInstancingTransform()
{
mat4 instancingTransform;
#ifdef HAS_INSTANCE_MATRICES
instancingTransform = mat4(
a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0,
a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0,
a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0,
a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0
);
#else
vec3 translation = vec3(0.0, 0.0, 0.0);
vec3 scale = vec3(1.0, 1.0, 1.0);
#ifdef HAS_INSTANCE_TRANSLATION
translation = a_instanceTranslation;
#endif
#ifdef HAS_INSTANCE_SCALE
scale = a_instanceScale;
#endif
instancingTransform = mat4(
scale.x, 0.0, 0.0, 0.0,
0.0, scale.y, 0.0, 0.0,
0.0, 0.0, scale.z, 0.0,
translation.x, translation.y, translation.z, 1.0
);
#endif
return instancingTransform;
}
#ifdef USE_2D_INSTANCING
mat4 getInstancingTransform2D()
{
mat4 instancingTransform2D;
#ifdef HAS_INSTANCE_MATRICES
instancingTransform2D = mat4(
a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0,
a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0,
a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0,
a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0
);
#else
vec3 translation2D = vec3(0.0, 0.0, 0.0);
vec3 scale = vec3(1.0, 1.0, 1.0);
#ifdef HAS_INSTANCE_TRANSLATION
translation2D = a_instanceTranslation2D;
#endif
#ifdef HAS_INSTANCE_SCALE
scale = a_instanceScale;
#endif
instancingTransform2D = mat4(
scale.x, 0.0, 0.0, 0.0,
0.0, scale.y, 0.0, 0.0,
0.0, 0.0, scale.z, 0.0,
translation2D.x, translation2D.y, translation2D.z, 1.0
);
#endif
return instancingTransform2D;
}
#endif
`;var VR=`void instancingStage(inout ProcessedAttributes attributes)
{
vec3 positionMC = attributes.positionMC;
mat4 instancingTransform = getInstancingTransform();
attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz;
#endif
#ifdef USE_2D_INSTANCING
mat4 instancingTransform2D = getInstancingTransform2D();
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
#endif
}
`;var zR=`void legacyInstancingStage(
inout ProcessedAttributes attributes,
out mat4 instanceModelView,
out mat3 instanceModelViewInverseTranspose)
{
vec3 positionMC = attributes.positionMC;
mat4 instancingTransform = getInstancingTransform();
mat4 instanceModel = instancingTransform * u_instance_nodeTransform;
instanceModelView = u_instance_modifiedModelView;
instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);
attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;
#ifdef USE_2D_INSTANCING
mat4 instancingTransform2D = getInstancingTransform2D();
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
#endif
}
`;var Pz=new B,m5e=new B,p5e=new B,_ce={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:Tce,_transformsToTypedArray:aW};_ce.process=function(e,t,n){let i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(UR);let s=e.model,a=s.sceneGraph,l=e.runtimeNode,u=n.mode!==oe.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,f=s._enablePick&&!n.context.webgl2,h=[];I5e(e,n,i,h,u,f),M5e(e,n,i,h);let p={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",ge.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",ge.VERTEX),p.u_instance_modifiedModelView=function(){let g=B.multiplyTransformation(s.modelMatrix,a.components.transform,Pz);return u?B.multiplyTransformation(n.context.uniformState.view3D,g,Pz):(n.mode!==oe.SCENE3D&&(g=Ot.basisTo2D(n.mapProjection,g,Pz)),B.multiplyTransformation(n.context.uniformState.view,g,Pz))},p.u_instance_nodeTransform=function(){return B.multiplyTransformation(a.axisCorrectionMatrix,l.computedTransform,m5e)},r.addVertexLines(zR)):r.addVertexLines(VR),u){r.addDefine("USE_2D_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_modelView2D",ge.VERTEX);let g=n.context,m=B.fromTranslation(l.instancingReferencePoint2D,new B);p.u_modelView2D=function(){return B.multiplyTransformation(g.uniformState.view,m,p5e)}}e.uniformMap=xt(p,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,h)};var HR=new B,_5e=new d;function g5e(e,t,n,i,o){let r=B.multiplyTransformation(t,e,HR);return r=B.multiplyTransformation(r,n,HR),o=Ot.basisTo2D(i.mapProjection,r,o),o}function y5e(e,t,n,i,o){let r=B.fromTranslation(e,HR),s=B.multiplyTransformation(t,r,HR);s=B.multiplyTransformation(s,n,HR);let a=B.getTranslation(s,_5e);return o=Gi.computeActualEllipsoidPosition(i,a,o),o}function gce(e,t,n){let i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=B.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=B.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=B.clone(o.computedModelMatrix,t),t=B.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=B.clone(B.IDENTITY,n))}var yce=new B,bce=new B,b5e=new B,x5e=new d;function T5e(e,t,n,i){let o=yce,r=bce;gce(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let u=0;u<l;u++){let f=e[u],h=g5e(f,o,r,n,b5e),p=B.getTranslation(h,x5e),g=d.subtract(p,a,p);i[u]=B.setTranslation(h,g,i[u])}return i}function A5e(e,t,n,i){let o=yce,r=bce;gce(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let u=0;u<l;u++){let f=e[u],h=y5e(f,o,r,n,f);i[u]=d.subtract(h,a,i[u])}return i}var C5e=new d,E5e=new d;function xce(e,t){let n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=B.multiplyByPoint(i,n.instancingTranslationMin,C5e),r=Gi.computeActualEllipsoidPosition(t,o,o),s=B.multiplyByPoint(i,n.instancingTranslationMax,E5e),a=Gi.computeActualEllipsoidPosition(t,s,s);n.instancingReferencePoint2D=d.lerp(r,a,.5,new d)}function aW(e){let n=e.length,i=new Float32Array(n*12);for(let o=0;o<n;o++){let r=e[o],s=12*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8],i[s+3]=r[12],i[s+4]=r[1],i[s+5]=r[5],i[s+6]=r[9],i[s+7]=r[13],i[s+8]=r[2],i[s+9]=r[6],i[s+10]=r[10],i[s+11]=r[14]}return i}function S5e(e){let n=e.length,i=new Float32Array(n*3);for(let o=0;o<n;o++){let r=e[o],s=3*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8]}return i}var w5e=new d,v5e=new Le,D5e=new d;function Tce(e,t,n){let i=new Array(t),o=$t.getAttributeBySemantic(e,rs.TRANSLATION),r=$t.getAttributeBySemantic(e,rs.ROTATION),s=$t.getAttributeBySemantic(e,rs.SCALE),a=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=c(o),f=c(r),h=c(s),p=u?o.typedArray:new Float32Array(t*3),g=f?r.typedArray:new Float32Array(t*4);f&&r.normalized&&(g=Ln.dequantize(g,r.componentDatatype,r.type,t));let m;h?m=s.typedArray:(m=new Float32Array(t*3),m.fill(1));for(let b=0;b<t;b++){let x=new d(p[b*3],p[b*3+1],p[b*3+2],w5e);d.maximumByComponent(a,x,a),d.minimumByComponent(l,x,l);let A=new Le(g[b*4],g[b*4+1],g[b*4+2],f?g[b*4+3]:1,v5e),C=new d(m[b*3],m[b*3+1],m[b*3+2],D5e),S=B.fromTranslationQuaternionRotationScale(x,A,C,new B);i[b]=S}let y=n.runtimeNode;return y.instancingTranslationMin=l,y.instancingTranslationMax=a,u&&(o.typedArray=void 0),f&&(r.typedArray=void 0),h&&(s.typedArray=void 0),i}function P5e(e,t,n){let i=new Array(t),o=e.typedArray,r=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let l=0;l<t;l++){let u=new d(o[l*3],o[l*3+1],o[l*3+2]);i[l]=u,d.minimumByComponent(r,u,r),d.maximumByComponent(s,u,s)}let a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function cW(e,t){let n=yt.createVertexBuffer({context:t.context,typedArray:e,usage:Be.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function I5e(e,t,n,i,o,r){let s=$t.getAttributeBySemantic(n,rs.ROTATION);c(s)?O5e(e,n,i,t,o,r):R5e(e,n,i,t,o)}function O5e(e,t,n,i,o,r){let s=e.shaderBuilder,a=t.attributes[0].count,l=e.model,u=e.runtimeNode;s.addDefine("HAS_INSTANCE_MATRICES");let f="Transform",h,p=u.instancingTransformsBuffer;if(!c(p)){h=Tce(t,a,e);let b=aW(h);p=cW(b,i),l._modelResources.push(p),r&&(u.transformsTypedArray=b),u.instancingTransformsBuffer=p}if(pce(e,p,n,f),!o)return;let g=je(i);g.mode=oe.COLUMBUS_VIEW,xce(e,g);let m=u.instancingTransformsBuffer2D;if(!c(m)){let b=T5e(h,e,g,h),x=aW(b);m=cW(x,i),l._modelResources.push(m),u.instancingTransformsBuffer2D=m}pce(e,m,n,"Transform2D")}function R5e(e,t,n,i,o,r){let s=e.shaderBuilder,a=e.runtimeNode,l=$t.getAttributeBySemantic(t,rs.TRANSLATION),u=$t.getAttributeBySemantic(t,rs.SCALE);if(c(u)&&(s.addDefine("HAS_INSTANCE_SCALE"),sW(e,u.buffer,u.byteOffset,u.byteStride,n,"Scale")),!c(l))return;let f,h=l.typedArray;if(c(h)?f=P5e(l,l.count,e):c(a.instancingTranslationMin)||(a.instancingTranslationMin=l.min,a.instancingTranslationMax=l.max),s.addDefine("HAS_INSTANCE_TRANSLATION"),sW(e,l.buffer,l.byteOffset,l.byteStride,n,"Translation"),!o&&!r)return;let g=je(i);g.mode=oe.COLUMBUS_VIEW,xce(e,g);let m=a.instancingTranslationBuffer2D;if(!c(m)){let A=A5e(f,e,g,f),C=S5e(A);r&&(a.transformsTypedArray=C),m=cW(C,i),e.model._modelResources.push(m),a.instancingTranslationBuffer2D=m}if(!o)return;sW(e,m,0,void 0,n,"Translation2D")}function pce(e,t,n,i){let r=$.getSizeInBytes($.FLOAT),s=r*12,a=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:$.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:$.FLOAT,normalize:!1,offsetInBytes:r*4,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:$.FLOAT,normalize:!1,offsetInBytes:r*8,strideInBytes:s,instanceDivisor:1}],l=e.shaderBuilder;l.addAttribute("vec4",`a_instancing${i}Row0`),l.addAttribute("vec4",`a_instancing${i}Row1`),l.addAttribute("vec4",`a_instancing${i}Row2`),n.push.apply(n,a)}function sW(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:$.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1}),e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}function M5e(e,t,n,i){let o=n.attributes,r=e.shaderBuilder;for(let s=0;s<o.length;s++){let a=o[s];a.semantic===rs.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:nn.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}var GR=_ce;var lW={};lW.name="ModelMatrixUpdateStage";lW.update=function(e,t,n){let i=n.mode!==oe.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){let o=i?t._computedModelMatrix2D:t._computedModelMatrix;Ace(e,t,o,e.transformToRoot),e._transformDirty=!1}};function L5e(e,t,n){e.modelMatrix=B.multiplyTransformation(t,n,e.modelMatrix),e.cullFace=$t.getCullFace(e.modelMatrix,e.primitiveType)}function Ace(e,t,n,i){let o;i=B.multiplyTransformation(i,e.transform,new B),e.updateComputedTransform();let r=e.runtimePrimitives.length;for(o=0;o<r;o++){let a=e.runtimePrimitives[o];L5e(a.drawCommand,n,i)}let s=e.children.length;for(o=0;o<s;o++){let a=t._runtimeNodes[e.children[o]];a._transformToRoot=B.clone(i,a._transformToRoot),Ace(a,t,n,i),a._transformDirty=!1}}var jR=lW;var Cce={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:Ece,_countGeneratedBuffers:Sce};Cce.process=function(e,t,n){let i=e.model.statistics,o=t.instances,r=e.runtimeNode;Ece(i,o),Sce(i,r)};function Ece(e,t){if(!c(t))return;let n=t.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];c(r.buffer)&&e.addBuffer(r.buffer,!1)}}function Sce(e,t){c(t.instancingTransformsBuffer)&&e.addBuffer(t.instancingTransformsBuffer,!1),c(t.instancingTransformsBuffer2D)&&e.addBuffer(t.instancingTransformsBuffer2D,!1),c(t.instancingTranslationBuffer2D)&&e.addBuffer(t.instancingTranslationBuffer2D,!1)}var WR=Cce;function pE(e){e=e??W.EMPTY_OBJECT;let t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;T.typeOf.object("options.node",t),T.typeOf.object("options.transform",n),T.typeOf.object("options.transformToRoot",i),T.typeOf.object("options.sceneGraph",o),T.typeOf.object("options.children",r),this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=B.clone(n,this._originalTransform),this._transform=B.clone(n,this._transform),this._transformToRoot=B.clone(i,this._transformToRoot),this._computedTransform=new B,this._transformDirty=!1,this._transformParameters=void 0,this._morphWeights=[],this._runtimeSkin=void 0,this._computedJointMatrices=[],this.show=!0,this.userAnimated=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.instancingTranslationMin=void 0,this.instancingTranslationMax=void 0,this.instancingTransformsBuffer=void 0,this.instancingTransformsBuffer2D=void 0,this.instancingTranslationBuffer2D=void 0,this.instancingReferencePoint2D=void 0,N5e(this)}Object.defineProperties(pE.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){this._transformDirty=!0,this._transform=B.clone(e,this._transform)}},transformToRoot:{get:function(){return this._transformToRoot}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}},translation:{get:function(){return c(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){let t=this._transformParameters;if(!c(t))throw new E("The translation of a node cannot be set if it was defined using a matrix in the model.");let n=t.translation;d.equals(n,e)||(t.translation=d.clone(e,t.translation),uW(this,t))}},rotation:{get:function(){return c(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){let t=this._transformParameters;if(!c(t))throw new E("The rotation of a node cannot be set if it was defined using a matrix in the model.");let n=t.rotation;Le.equals(n,e)||(t.rotation=Le.clone(e,t.rotation),uW(this,t))}},scale:{get:function(){return c(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){let t=this._transformParameters;if(!c(t))throw new E("The scale of a node cannot be set if it was defined using a matrix in the model.");let n=t.scale;d.equals(n,e)||(t.scale=d.clone(e,t.scale),uW(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){let t=e.length;if(this._morphWeights.length!==t)throw new E("value must have the same length as the original weights array.");for(let n=0;n<t;n++)this._morphWeights[n]=e[n]}},runtimeSkin:{get:function(){return this._runtimeSkin}},computedJointMatrices:{get:function(){return this._computedJointMatrices}}});function N5e(e){let t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=B.multiply(n,t,i);let o=e.node;c(o.matrix)||(e._transformParameters=new iy(o.translation,o.rotation,o.scale)),c(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());let r=o.articulationName;if(c(r)){let l=e.sceneGraph._runtimeArticulations[r];c(l)&&l.runtimeNodes.push(e)}}function uW(e,t){e._transformDirty=!0,e._transform=B.fromTranslationRotationScale(t,e._transform)}pE.prototype.getChild=function(e){if(T.typeOf.number("index",e),e<0||e>=this.children.length)throw new E("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]};pE.prototype.configurePipeline=function(){let e=this.node,t=this.pipelineStages;t.length=0;let n=this.updateStages;n.length=0,c(e.instances)&&t.push(GR),t.push(WR),n.push(jR)};pE.prototype.updateComputedTransform=function(){this._computedTransform=B.multiply(this._transformToRoot,this._transform,this._computedTransform)};pE.prototype.updateJointMatrices=function(){let e=this._runtimeSkin;if(!c(e))return;e.updateJointMatrices();let t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){c(t[o])||(t[o]=new B);let r=B.multiplyTransformation(this.transformToRoot,this.transform,t[o]),s=B.inverseTransformation(r,t[o]);t[o]=B.multiplyTransformation(s,n[o],t[o])}};var qR=pE;var wce={name:"AlphaPipelineStage"};wce.process=function(e,t,n){let i=e.alphaOptions,o=e.model;i.pass=i.pass??o.opaquePass;let r=e.renderStateOptions;i.pass===De.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=ln.ALPHA_BLEND);let s=e.shaderBuilder,a=e.uniformMap;c(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,ge.FRAGMENT),s.addUniform("float","u_alphaCutoff",ge.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};var YR=wce;var vce={name:"BatchTexturePipelineStage"};vce.process=function(e,t,n){let i=e.shaderBuilder,o={},r=e.model,s=r.featureTables[r.featureTableId],a=s.featuresLength;i.addUniform("int","model_featuresLength"),o.model_featuresLength=function(){return a};let l=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return l.batchTexture??l.defaultTexture},i.addUniform("vec4","model_textureStep"),o.model_textureStep=function(){return l.textureStep},l.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return l.textureDimensions}),e.uniformMap=xt(o,e.uniformMap)};var XR=vce;var Dce={name:"ClassificationPipelineStage"};Dce.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,ge.BOTH);let o=e.runtimePrimitive;c(o.batchLengths)||F5e(t,o)};function F5e(e,t){let n=$t.getAttributeBySemantic(e,ht.POSITION);if(!c(n))throw new ae("Primitives must have a position attribute to be used for classification.");let i,o=e.indices,r=c(o);r&&(i=o.typedArray,o.typedArray=void 0);let s=r?o.count:n.count,a=$t.getAttributeBySemantic(e,ht.FEATURE_ID,0);if(!c(a)){t.batchLengths=[s],t.batchOffsets=[0];return}let l=a.typedArray;a.typedArray=void 0;let u=[],f=[0],h=r?i[0]:0,p=l[h],g=0;for(let y=1;y<s;y++){let b=r?i[y]:y,x=l[b];if(x!==p){let A=y-g,C=y;u.push(A),f.push(C),g=C,p=x}}let m=s-g;u.push(m),t.batchLengths=u,t.batchOffsets=f}var KR=Dce;var $R=`void filterByPassType(inout vec3 positionMC, vec4 featureColor)
{
bool styleTranslucent = (featureColor.a != 1.0);
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
{
#ifdef HAS_SILHOUETTE
positionMC *= float(model_silhouettePass);
#else
positionMC *= 0.0;
#endif
}
else if (czm_pass != czm_passTranslucent && styleTranslucent)
{
positionMC *= 0.0;
}
}
void cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)
{
float show = ceil(feature.color.a);
positionMC *= show;
#if defined(HAS_SELECTED_FEATURE_ID_ATTRIBUTE) && !defined(HAS_CLASSIFICATION)
filterByPassType(positionMC, feature.color);
#endif
}
`;var ZR=`void filterByPassType(vec4 featureColor)
{
bool styleTranslucent = (featureColor.a != 1.0);
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
{
#ifdef HAS_SILHOUETTE
if(!model_silhouettePass) {
discard;
}
#else
discard;
#endif
}
else if (czm_pass != czm_passTranslucent && styleTranslucent)
{
discard;
}
}
void cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)
{
vec4 featureColor = feature.color;
if (featureColor.a == 0.0)
{
discard;
}
#if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)
filterByPassType(featureColor);
#endif
featureColor = czm_gammaCorrect(featureColor);
#ifdef HAS_CLASSIFICATION
material.diffuse = featureColor.rgb * featureColor.a;
#else
float highlight = ceil(model_colorBlend);
material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);
#endif
material.alpha *= featureColor.a;
}
`;var Pce={name:"CPUStylingPipelineStage"};Pce.process=function(e,t,n){let i=e.model,o=e.shaderBuilder;o.addVertexLines($R),o.addFragmentLines(ZR),o.addDefine("USE_CPU_STYLING",void 0,ge.BOTH),c(i.color)||(o.addUniform("float",Ry.COLOR_BLEND_UNIFORM_NAME,ge.FRAGMENT),e.uniformMap[Ry.COLOR_BLEND_UNIFORM_NAME]=function(){return bc.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",ge.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===De.TRANSLUCENT}};var QR=Pce;var Ice={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};Ice.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};var y_=Object.freeze(Ice);var JR=`void customShaderStage(
inout czm_modelVertexOutput vsOutput,
inout ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass,
MetadataStatistics metadataStatistics
) {
VertexInput vsInput;
initializeInputStruct(vsInput, attributes);
vsInput.featureIds = featureIds;
vsInput.metadata = metadata;
vsInput.metadataClass = metadataClass;
vsInput.metadataStatistics = metadataStatistics;
vertexMain(vsInput, vsOutput);
attributes.positionMC = vsOutput.positionMC;
}
`;var eM=`void customShaderStage(
inout czm_modelMaterial material,
ProcessedAttributes attributes,
FeatureIds featureIds,
Metadata metadata,
MetadataClass metadataClass,
MetadataStatistics metadataStatistics
) {
FragmentInput fsInput;
initializeInputStruct(fsInput, attributes);
fsInput.featureIds = featureIds;
fsInput.metadata = metadata;
fsInput.metadataClass = metadataClass;
fsInput.metadataStatistics = metadataStatistics;
fragmentMain(fsInput, material);
}
`;var tM=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
}
`;var nM=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
{
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
setFeatureIdVaryings();
}
`;var ji={name:"FeatureIdPipelineStage",STRUCT_ID_FEATURE_IDS_VS:"FeatureIdsVS",STRUCT_ID_FEATURE_IDS_FS:"FeatureIdsFS",STRUCT_NAME_FEATURE_IDS:"FeatureIds",FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS:"initializeFeatureIdsVS",FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS:"initializeFeatureIdsFS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS:"initializeFeatureIdAliasesVS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS:"initializeFeatureIdAliasesFS",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS:"void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES:"void initializeFeatureIdAliases(inout FeatureIds featureIds)",FUNCTION_ID_SET_FEATURE_ID_VARYINGS:"setFeatureIdVaryings",FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS:"void setFeatureIdVaryings()"};ji.process=function(e,t,n){let i=e.shaderBuilder;B5e(i);let o=e.runtimeNode.node.instances;c(o)&&k5e(e,o,n),U5e(e,t,n),i.addVertexLines(nM),i.addFragmentLines(tM)};function B5e(e){e.addStruct(ji.STRUCT_ID_FEATURE_IDS_VS,ji.STRUCT_NAME_FEATURE_IDS,ge.VERTEX),e.addStruct(ji.STRUCT_ID_FEATURE_IDS_FS,ji.STRUCT_NAME_FEATURE_IDS,ge.FRAGMENT),e.addFunction(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,ji.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ge.VERTEX),e.addFunction(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,ji.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ge.FRAGMENT),e.addFunction(ji.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,ji.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ge.VERTEX),e.addFunction(ji.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,ji.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ge.FRAGMENT),e.addFunction(ji.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,ji.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,ge.VERTEX)}function k5e(e,t,n){let i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){let s=i[r],a=s.positionalLabel;s instanceof Tn.FeatureIdAttribute?V5e(e,s,a):Oce(e,s,a,o,1,n);let l=s.label;c(l)&&Rce(e,a,l,ge.BOTH)}}function U5e(e,t,n){let i=t.featureIds,r=$t.getAttributeBySemantic(t,ht.POSITION).count;for(let s=0;s<i.length;s++){let a=i[s],l=a.positionalLabel,u=ge.BOTH;a instanceof Tn.FeatureIdAttribute?z5e(e,a,l):a instanceof Tn.FeatureIdImplicitRange?Oce(e,a,l,r,void 0,n):(H5e(e,a,l,s,n),u=ge.FRAGMENT);let f=a.label;c(f)&&Rce(e,l,f,u)}}function V5e(e,t,n){let i=e.shaderBuilder;i.addStructField(ji.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(ji.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,l=`featureIds.${n} = int(czm_round(${s}));`,u=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[l]),i.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(ji.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function z5e(e,t,n){let i=e.shaderBuilder;i.addStructField(ji.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(ji.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function Oce(e,t,n,i,o,r){G5e(e,t,i,o,r);let s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);let l=`v_implicit_${n}`;s.addVarying("float",l),s.addStructField(ji.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(ji.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(ji.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${l} = ${a};`]),s.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${l}));`])}function H5e(e,t,n,i,o){let r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return a.texture??o.context.defaultTexture};let l=a.channels,u=e.shaderBuilder;u.addStructField(ji.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,ge.FRAGMENT);let h=`v_texCoord_${a.texCoord}`,p=h,g=a.transform;if(c(g)&&!J.equals(g,J.IDENTITY)){let b=`${r}Transform`;u.addUniform("mat3",b,ge.FRAGMENT),s[b]=function(){return g},p=`vec2(${b} * vec3(${h}, 1.0))`}let m=`texture(${r}, ${p}).${l}`,y=`featureIds.${n} = czm_unpackUint(${m});`;u.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[y])}function Rce(e,t,n,i){let o=e.shaderBuilder,r=ge.includesVertexShader(i);r&&o.addStructField(ji.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(ji.STRUCT_ID_FEATURE_IDS_FS,"int",n);let s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(ji.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function G5e(e,t,n,i,o){let r=e.model,s,a;if(c(t.repeat)){let u=j5e(t,n);s=yt.createVertexBuffer({context:o.context,typedArray:u,usage:Be.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s),r.statistics.addBuffer(s,!1)}else a=[t.offset];let l={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:$.FLOAT,strideInBytes:$.getSizeInBytes($.FLOAT),offsetInBytes:0};e.attributes.push(l)}function j5e(e,t){let n=e.offset,i=e.repeat,o=new Float32Array(t);for(let r=0;r<t;r++)o[r]=n+Math.floor(r/i);return o}var My=ji;var iM=`void metadataStage(
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
}
`;var oM=`void metadataStage(
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
setMetadataVaryings();
}
`;var Di={name:"MetadataPipelineStage",STRUCT_ID_METADATA_VS:"MetadataVS",STRUCT_ID_METADATA_FS:"MetadataFS",STRUCT_NAME_METADATA:"Metadata",STRUCT_ID_METADATA_CLASS_VS:"MetadataClassVS",STRUCT_ID_METADATA_CLASS_FS:"MetadataClassFS",STRUCT_NAME_METADATA_CLASS:"MetadataClass",STRUCT_ID_METADATA_STATISTICS_VS:"MetadataStatisticsVS",STRUCT_ID_METADATA_STATISTICS_FS:"MetadataStatisticsFS",STRUCT_NAME_METADATA_STATISTICS:"MetadataStatistics",FUNCTION_ID_INITIALIZE_METADATA_VS:"initializeMetadataVS",FUNCTION_ID_INITIALIZE_METADATA_FS:"initializeMetadataFS",FUNCTION_SIGNATURE_INITIALIZE_METADATA:"void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",FUNCTION_ID_SET_METADATA_VARYINGS:"setMetadataVaryings",FUNCTION_SIGNATURE_SET_METADATA_VARYINGS:"void setMetadataVaryings()",METADATA_CLASS_FIELDS:[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}],METADATA_STATISTICS_FIELDS:[{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"},{specName:"mean",shaderName:"mean",type:"float"},{specName:"median",shaderName:"median"},{specName:"standardDeviation",shaderName:"standardDeviation",type:"float"},{specName:"variance",shaderName:"variance",type:"float"},{specName:"sum",shaderName:"sum"}]};Di.process=function(e,t,n){let{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=s?.tileset.metadataExtension?.statistics,l=W5e(r.propertyAttributes,t,a),u=Y5e(r.propertyTextures,a),f=l.concat(u);K5e(i,f),Q5e(i),i.addVertexLines(oM),i.addFragmentLines(iM);for(let h=0;h<l.length;h++){let p=l[h];J5e(e,p)}for(let h=0;h<u.length;h++){let p=u[h];tje(e,p)}};function W5e(e,t,n){return c(e)?e.flatMap(i=>q5e(i,t,n)):[]}function q5e(e,t,n){let{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=$t,s=e.class.id,a=n?.classes[s],l=Object.entries(e.properties),u=new Array(l.length);for(let f=0;f<l.length;f++){let[h,p]=l[f],g=i(t,p.attribute),{glslType:m,variableName:y}=o(g);u[f]={metadataVariable:r(h),property:p,type:p.classProperty.type,glslType:m,variableName:y,propertyStatistics:a?.properties[h],shaderDestination:ge.BOTH}}return u}function Y5e(e,t){return c(e)?e.flatMap(n=>X5e(n,t)):[]}function X5e(e,t){let{sanitizeGlslIdentifier:n}=$t,i=e.class.id,o=t?.classes[i],r=Object.entries(e.properties).filter(([a,l])=>l.isGpuCompatible()),s=new Array(r.length);for(let a=0;a<r.length;a++){let[l,u]=r[a];s[a]={metadataVariable:n(l),property:u,type:u.classProperty.type,glslType:u.getGlslType(),propertyStatistics:o?.properties[l],shaderDestination:ge.FRAGMENT}}return s}function K5e(e,t){let n=new Set,i=new Set;for(let a=0;a<t.length;a++){let{type:l,glslType:u,propertyStatistics:f}=t[a];n.add(u),c(f)&&l!==at.ENUM&&i.add(u)}let o=Di.METADATA_CLASS_FIELDS;for(let a of n){let l=`${a}MetadataClass`;s(l,a,o)}let r=Di.METADATA_STATISTICS_FIELDS;for(let a of i){let l=`${a}MetadataStatistics`;s(l,a,r)}function s(a,l,u){e.addStruct(a,a,ge.BOTH);for(let f=0;f<u.length;f++){let{shaderName:h}=u[f],p=u[f].type==="float"?Z5e(l):l;e.addStructField(a,p,h)}}}var $5e={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function Z5e(e){let t=$5e[e];return c(t)?t:e}function Q5e(e){e.addStruct(Di.STRUCT_ID_METADATA_VS,Di.STRUCT_NAME_METADATA,ge.VERTEX),e.addStruct(Di.STRUCT_ID_METADATA_FS,Di.STRUCT_NAME_METADATA,ge.FRAGMENT),e.addStruct(Di.STRUCT_ID_METADATA_CLASS_VS,Di.STRUCT_NAME_METADATA_CLASS,ge.VERTEX),e.addStruct(Di.STRUCT_ID_METADATA_CLASS_FS,Di.STRUCT_NAME_METADATA_CLASS,ge.FRAGMENT),e.addStruct(Di.STRUCT_ID_METADATA_STATISTICS_VS,Di.STRUCT_NAME_METADATA_STATISTICS,ge.VERTEX),e.addStruct(Di.STRUCT_ID_METADATA_STATISTICS_FS,Di.STRUCT_NAME_METADATA_STATISTICS,ge.FRAGMENT),e.addFunction(Di.FUNCTION_ID_INITIALIZE_METADATA_VS,Di.FUNCTION_SIGNATURE_INITIALIZE_METADATA,ge.VERTEX),e.addFunction(Di.FUNCTION_ID_INITIALIZE_METADATA_FS,Di.FUNCTION_SIGNATURE_INITIALIZE_METADATA,ge.FRAGMENT),e.addFunction(Di.FUNCTION_ID_SET_METADATA_VARYINGS,Di.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,ge.VERTEX)}function J5e(e,t){eje(e,t),Mce(e.shaderBuilder,t),Lce(e.shaderBuilder,t)}function eje(e,t){let{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=Fce({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:ge.BOTH,property:o});n.addStructField(Di.STRUCT_ID_METADATA_VS,r,i),n.addStructField(Di.STRUCT_ID_METADATA_FS,r,i);let a=`metadata.${i} = ${s};`;n.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function tje(e,t){nje(e,t),Mce(e.shaderBuilder,t),Lce(e.shaderBuilder,t)}function nje(e,t){let{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:l,index:u,texture:f,transform:h}=s.textureReader,p=`u_propertyTexture_${u}`;i.hasOwnProperty(p)||(n.addUniform("sampler2D",p,ge.FRAGMENT),i[p]=()=>f),n.addStructField(Di.STRUCT_ID_METADATA_FS,r,o);let g=`attributes.texCoord_${a}`,m=g;if(c(h)&&!J.equals(h,J.IDENTITY)){let C=`${p}Transform`;n.addUniform("mat3",C,ge.FRAGMENT),i[C]=function(){return h},m=`vec2(${C} * vec3(${g}, 1.0))`}let y=`texture(${p}, ${m}).${l}`,b=s.unpackInShader(y),x=Fce({valueExpression:b,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:ge.FRAGMENT,property:s}),A=`metadata.${o} = ${x};`;n.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_FS,[A])}function Mce(e,t){let{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=Nce(Di.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(Di.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_FS,s),ge.includesVertexShader(r)&&(e.addStructField(Di.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function Lce(e,t){let{propertyStatistics:n}=t;if(!c(n))return;let{metadataVariable:i,type:o,glslType:r}=t;if(o===at.ENUM)return;let s=Di.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,l=Nce(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(Di.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_FS,l),ge.includesVertexShader(t.shaderDestination)&&(e.addStructField(Di.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(Di.FUNCTION_ID_INITIALIZE_METADATA_VS,l))}function Nce(e,t,n,i){function o(r){let s=t[r.specName];if(c(s))return`${n}.${r.shaderName} = ${i}(${s});`}return c(t)?e.map(o).filter(c):[]}function Fce(e){let{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;let i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:l,shaderDestination:u}=e;s.addUniform(l,o,u),s.addUniform(l,r,u);let{offset:f,scale:h}=n;return a[o]=()=>f,a[r]=()=>h,`czm_valueTransform(${o}, ${r}, ${t})`}var Uf=Di;var ije={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},Ly=Object.freeze(ije);var ga={name:"CustomShaderPipelineStage",STRUCT_ID_ATTRIBUTES_VS:"AttributesVS",STRUCT_ID_ATTRIBUTES_FS:"AttributesFS",STRUCT_NAME_ATTRIBUTES:"Attributes",STRUCT_ID_VERTEX_INPUT:"VertexInput",STRUCT_NAME_VERTEX_INPUT:"VertexInput",STRUCT_ID_FRAGMENT_INPUT:"FragmentInput",STRUCT_NAME_FRAGMENT_INPUT:"FragmentInput",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS:"initializeInputStructVS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS:"void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS:"initializeInputStructFS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS:"void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",_oneTimeWarning:dt};ga.process=function(e,t,n){let{shaderBuilder:i,model:o,alphaOptions:r}=e,{customShader:s}=o,{lightingModel:a,translucencyMode:l}=s;c(a)&&(e.lightingOptions.lightingModel=a),l===Ly.TRANSLUCENT?r.pass=De.TRANSLUCENT:l===Ly.OPAQUE&&(r.pass=void 0);let u=fje(s,t);if(!u.customShaderEnabled)return;if(pje(i,s,u),u.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,ge.BOTH),c(s.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ge.VERTEX),c(s.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ge.FRAGMENT);let p=y_.getDefineName(s.mode);i.addDefine(p,void 0,ge.FRAGMENT)}let f=s.uniforms;for(let p in f)if(f.hasOwnProperty(p)){let g=f[p];i.addUniform(g.type,p)}let h=s.varyings;for(let p in h)if(h.hasOwnProperty(p)){let g=h[p];i.addVarying(g,p)}e.uniformMap=xt(e.uniformMap,s.uniformMap)};function oje(e){let t={};for(let n=0;n<e.length;n++){let i=$t.getAttributeInfo(e[n]);t[i.variableName]=i}return t}var rje={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},sje={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function Bce(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");let n=rje[t],i=sje[t];if(c(n))return{attributeField:[n,e],value:i}}function aje(e,t){if(!c(e.vertexShaderText))return{enabled:!1};let n=e.usedVariablesVertex.attributeSet,i=kce(t,n,!1),o=Uce(t,n,!1),r,s=[],a=[];for(let l in i){if(!i.hasOwnProperty(l))continue;let f=[i[l].glslType,l];s.push(f),r=`vsInput.attributes.${l} = attributes.${l};`,a.push(r)}for(let l=0;l<o.length;l++){let u=o[l],f=Bce(u);if(!c(f))return ga._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${u}, disabling custom vertex shader`),{enabled:!1};s.push(f.attributeField),r=`vsInput.attributes.${u} = ${f.value};`,a.push(r)}return{enabled:!0,attributeFields:s,initializationLines:a}}function cje(e){let t=[],n=[],i=e.usedVariablesFragment.attributeSet;return i.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),n.push("fsInput.attributes.positionWC = attributes.positionWC;")),i.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),n.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:n}}function lje(e,t){if(!c(e.fragmentShaderText))return{enabled:!1};let n=e.usedVariablesFragment.attributeSet,i=kce(t,n,!0),o=Uce(t,n,!0),r,s=[],a=[];for(let u in i){if(!i.hasOwnProperty(u))continue;let h=[i[u].glslType,u];s.push(h),r=`fsInput.attributes.${u} = attributes.${u};`,a.push(r)}for(let u=0;u<o.length;u++){let f=o[u],h=Bce(f);if(!c(h))return ga._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${f}, disabling custom fragment shader.`),{enabled:!1};s.push(h.attributeField),r=`fsInput.attributes.${f} = ${h.value};`,a.push(r)}let l=cje(e);return{enabled:!0,attributeFields:s.concat(l.attributeFields),initializationLines:l.initializationLines.concat(a)}}var uje={positionWC:!0,positionEC:!0};function kce(e,t,n){let i={};for(let o in e){if(!e.hasOwnProperty(o))continue;let r=e[o],s=o;n&&o==="normalMC"?s="normalEC":n&&o==="tangentMC"&&(s="tangentEC",r.glslType="vec3"),t.hasOwnProperty(s)&&(i[s]=r)}return i}function Uce(e,t,n){let i=[];for(let o in t){if(!t.hasOwnProperty(o)||uje.hasOwnProperty(o))continue;let r=o;n&&o==="normalEC"?r="normalMC":n&&o==="tangentEC"&&(r="tangentMC"),e.hasOwnProperty(r)||i.push(o)}return i}function fje(e,t){let n=oje(t.attributes),i=aje(e,n),o=lje(e,n),s=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&o.enabled;return{vertexLines:i,fragmentLines:o,customShaderEnabled:i.enabled||o.enabled,shouldComputePositionWC:s}}function dje(e,t){let n=ga.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(n,ga.STRUCT_NAME_ATTRIBUTES,ge.VERTEX);let{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){let[a,l]=i[s];e.addStructField(n,a,l)}n=ga.STRUCT_ID_VERTEX_INPUT,e.addStruct(n,ga.STRUCT_NAME_VERTEX_INPUT,ge.VERTEX),e.addStructField(n,ga.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,My.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,Uf.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,Uf.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,Uf.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");let r=ga.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,ga.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,ge.VERTEX),e.addFunctionLines(r,o)}function hje(e,t){let n=ga.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(n,ga.STRUCT_NAME_ATTRIBUTES,ge.FRAGMENT);let{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){let[a,l]=i[s];e.addStructField(n,a,l)}n=ga.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(n,ga.STRUCT_NAME_FRAGMENT_INPUT,ge.FRAGMENT),e.addStructField(n,ga.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,My.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,Uf.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,Uf.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,Uf.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");let r=ga.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(r,ga.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,ge.FRAGMENT),e.addFunctionLines(r,o)}var mje=[];function pje(e,t,n){let{vertexLines:i,fragmentLines:o}=n,r=mje;i.enabled&&(dje(e,i),r.length=0,r.push("#line 0",t.vertexShaderText,JR),e.addVertexLines(r)),o.enabled&&(hje(e,o),r.length=0,r.push("#line 0",t.fragmentShaderText,eM),e.addFragmentLines(r))}var rM=ga;var sM={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};sM.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=c(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,ge.VERTEX),i.addFunction(sM.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,sM.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,ge.VERTEX);let s=t.attributes;for(let a=0;a<s.length;a++){let l=s[a],u=l.quantization;if(!c(u))continue;let f=l.semantic===ht.POSITION,h=l.semantic===ht.TEXCOORD;if(r&&!f&&!h)continue;let p=$t.getAttributeInfo(l);gje(i,p),_je(e,p)}};function _je(e,t){let n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){let s=`model_normalizationRange_${o}`;n.addUniform("float",s,ge.VERTEX),i[s]=function(){return r.normalizationRange}}else{let s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,l=t.glslType;n.addUniform(l,s,ge.VERTEX),n.addUniform(l,a,ge.VERTEX);let u=r.quantizedVolumeOffset,f=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=Vce(u,0),f=Vce(f,1)),i[s]=function(){return u},i[a]=function(){return f}}}function Vce(e,t){return e instanceof se?e:new se(e.x,e.y,e.z,t)}function gje(e,t){let n=t.variableName,i=t.attribute.quantization,o;i.octEncoded?o=yje(n,i):o=bje(n),e.addFunctionLines(sM.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function yje(e,t){let n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}function bje(e){let t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}var aM=sM;var cM=`void geometryStage(out ProcessedAttributes attributes)
{
attributes.positionMC = v_positionMC;
attributes.positionEC = v_positionEC;
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE)
attributes.positionWC = v_positionWC;
#endif
#ifdef HAS_NORMALS
attributes.normalEC = normalize(v_normalEC);
#endif
#ifdef HAS_TANGENTS
attributes.tangentEC = normalize(v_tangentEC);
#endif
#ifdef HAS_BITANGENTS
attributes.bitangentEC = normalize(v_bitangentEC);
#endif
setDynamicVaryings(attributes);
}
`;var lM=`vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)
{
vec4 computedPosition;
vec3 positionMC = attributes.positionMC;
v_positionMC = positionMC;
v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
vec3 position2D = attributes.position2D;
vec3 positionEC = (u_modelView2D * vec4(position2D, 1.0)).xyz;
computedPosition = czm_projection * vec4(positionEC, 1.0);
#else
computedPosition = czm_projection * vec4(v_positionEC, 1.0);
#endif
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE) || defined(ENABLE_CLIPPING_POLYGONS)
v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
#endif
#ifdef HAS_NORMALS
v_normalEC = normalize(normal * attributes.normalMC);
#endif
#ifdef HAS_TANGENTS
v_tangentEC = normalize(normal * attributes.tangentMC);
#endif
#ifdef HAS_BITANGENTS
v_bitangentEC = normalize(normal * attributes.bitangentMC);
#endif
setDynamicVaryings(attributes);
return computedPosition;
}
`;var _E=`vec2 computeSt(float featureId)
{
float stepX = model_textureStep.x;
float centerX = model_textureStep.y;
#ifdef MULTILINE_BATCH_TEXTURE
float stepY = model_textureStep.z;
float centerY = model_textureStep.w;
float xId = mod(featureId, model_textureDimensions.x);
float yId = floor(featureId / model_textureDimensions.x);
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
#else
return vec2(centerX + (featureId * stepX), 0.5);
#endif
}
void selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)
{
int featureId = featureIds.SELECTED_FEATURE_ID;
if (featureId < model_featuresLength)
{
vec2 featureSt = computeSt(float(featureId));
feature.id = featureId;
feature.st = featureSt;
feature.color = texture(model_batchTexture, featureSt);
}
else
{
feature.id = model_featuresLength + 1;
feature.st = vec2(0.0);
feature.color = vec4(1.0);
}
#ifdef HAS_NULL_FEATURE_ID
if (featureId == model_nullFeatureId) {
feature.id = featureId;
feature.st = vec2(0.0);
feature.color = vec4(1.0);
}
#endif
}
`;var uM={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature"};uM.process=function(e,t,n){let i=e.shaderBuilder;e.hasPropertyTable=!0;let o=e.model,r=e.runtimeNode.node,s=xje(o,r,t),a=s.shaderDestination;i.addDefine("HAS_SELECTED_FEATURE_ID",void 0,a),i.addDefine("SELECTED_FEATURE_ID",s.variableName,a),i.addDefine(s.featureIdDefine,void 0,a),Tje(i);let l=s.featureIds.nullFeatureId,u=e.uniformMap;c(l)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),u.model_nullFeatureId=function(){return l}),s.shaderDestination===ge.BOTH&&i.addVertexLines(_E),i.addFragmentLines(_E)};function zce(e){return e instanceof Tn.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function Hce(e){return e instanceof Tn.FeatureIdTexture?ge.FRAGMENT:ge.BOTH}function xje(e,t,n){let i,o;return c(t.instances)&&(o=$t.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(o))?(i=o.label??o.positionalLabel,{featureIds:o,variableName:i,shaderDestination:Hce(o),featureIdDefine:zce(o)}):(o=$t.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=o.label??o.positionalLabel,{featureIds:o,variableName:i,shaderDestination:Hce(o),featureIdDefine:zce(o)})}function Tje(e){e.addStructField(uM.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(uM.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(uM.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}var Ny=uM;var Xs={name:"GeometryPipelineStage",STRUCT_ID_PROCESSED_ATTRIBUTES_VS:"ProcessedAttributesVS",STRUCT_ID_PROCESSED_ATTRIBUTES_FS:"ProcessedAttributesFS",STRUCT_NAME_PROCESSED_ATTRIBUTES:"ProcessedAttributes",FUNCTION_ID_INITIALIZE_ATTRIBUTES:"initializeAttributes",FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES:"void initializeAttributes(out ProcessedAttributes attributes)",FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS:"setDynamicVaryingsVS",FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS:"setDynamicVaryingsFS",FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS:"void setDynamicVaryings(inout ProcessedAttributes attributes)"};Xs.process=function(e,t,n){let{shaderBuilder:i,model:o}=e;i.addStruct(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",ge.VERTEX),i.addStruct(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",ge.FRAGMENT),i.addStruct(Ny.STRUCT_ID_SELECTED_FEATURE,Ny.STRUCT_NAME_SELECTED_FEATURE,ge.BOTH),i.addFunction(Xs.FUNCTION_ID_INITIALIZE_ATTRIBUTES,Xs.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,ge.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(Xs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,Xs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ge.VERTEX),i.addFunction(Xs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,Xs.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ge.FRAGMENT),o.type===pr.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,ge.FRAGMENT);let r=n.mode!==oe.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,s=c(e.runtimeNode.node.instances),a=r&&!s,l=t.attributes.length;for(let u=0;u<l;u++){let f=t.attributes[u],h=nn.getAttributeLocationCount(f.type);if(!c(f.buffer)&&!c(f.constant))throw new E("Attributes must be provided as a Buffer or constant value");let p=f.semantic===ht.POSITION,g;h>1?(g=e.attributeIndex,e.attributeIndex+=h):p&&!a?g=0:g=e.attributeIndex++,Aje(e,f,g,h,r,s)}Oje(i,t.attributes),t.primitiveType===Me.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(lM),i.addFragmentLines(cM)};function Aje(e,t,n,i,o,r){let s=e.shaderBuilder,a=$t.getAttributeInfo(t),l=o&&!r;i>1?Sje(e,t,n,i):Eje(e,t,n,l),vje(s,a,l),wje(s,a),c(t.semantic)&&Cje(s,t),Dje(s,a,o),Pje(s,a,l),Ije(s,a)}function Cje(e,t){let{semantic:n,setIndex:i}=t;switch(n){case ht.NORMAL:e.addDefine("HAS_NORMALS");break;case ht.TANGENT:e.addDefine("HAS_TANGENTS");break;case ht.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case ht.TEXCOORD:case ht.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function Eje(e,t,n,i){let{quantization:o,semantic:r,setIndex:s}=t,{type:a,componentDatatype:l}=c(o)?o:t;r===ht.FEATURE_ID&&s>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=s+1);let u=r===ht.POSITION,f=u?0:n,h=nn.getNumberOfComponents(a),p={index:f,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:h,componentDatatype:l,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(p),!u||!i)return;let g=e.runtimePrimitive.positionBuffer2D,m={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:h,componentDatatype:$.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(m)}function Sje(e,t,n,i){let{quantization:o,normalized:r}=t,{type:s,componentDatatype:a}=c(o)?o:t,u=nn.getNumberOfComponents(s)/i,f=$.getSizeInBytes(a),h=u*f,p=t.byteStride;for(let g=0;g<i;g++){let m=t.byteOffset+g*h,y={index:n+g,vertexBuffer:t.buffer,componentsPerAttribute:u,componentDatatype:a,offsetInBytes:m,strideInBytes:p,normalize:r};e.attributes.push(y)}}function wje(e,t){let n=t.variableName,i=`v_${n}`,o;n==="normalMC"?(i="v_normalEC",o=t.glslType):n==="tangentMC"?(o="vec3",i="v_tangentEC"):o=t.glslType,e.addVarying(o,i)}function vje(e,t,n){let i=t.attribute.semantic,o=t.variableName,r,s;t.isQuantized?(r=`a_quantized_${o}`,s=t.quantizedGlslType):(r=`a_${o}`,s=t.glslType);let a=i===ht.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function Dje(e,t,n){let i=Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,{variableName:r,glslType:s}=t;r==="tangentMC"?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(i,"float","tangentSignMC"),e.addStructField(o,"vec3","tangentEC")):r==="normalMC"?(e.addStructField(i,"vec3","normalMC"),e.addStructField(o,"vec3","normalEC")):(e.addStructField(i,s,r),e.addStructField(o,s,r)),r==="positionMC"&&n&&e.addStructField(i,"vec3","position2D")}function Pje(e,t,n){let i=Xs.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName;if(o==="positionMC"&&n&&e.addFunctionLines(i,["attributes.position2D = a_position2D;"]),t.isQuantized)return;let s=[];o==="tangentMC"?(s.push("attributes.tangentMC = a_tangentMC.xyz;"),s.push("attributes.tangentSignMC = a_tangentMC.w;")):s.push(`attributes.${o} = a_${o};`),e.addFunctionLines(i,s)}function Ije(e,t){let{semantic:n,setIndex:i}=t.attribute;if(c(n)&&!c(i))return;let o=Xs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,r=t.variableName,s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=Xs.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function Oje(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){let r=t[o];r.semantic===ht.NORMAL?n=!0:r.semantic===ht.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(Xs.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}var fM=Xs;var dM=`#ifdef USE_IBL_LIGHTING
vec3 computeIBL(vec3 position, vec3 normal, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
{
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
vec3 viewDirection = -normalize(position);
vec3 iblColor = textureIBL(viewDirection, normal, material);
return iblColor;
#endif
return vec3(0.0);
}
#endif
#ifdef USE_CLEARCOAT
vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
{
vec3 viewDirection = -normalize(position);
vec3 halfwayDirection = normalize(viewDirection + lightDirection);
vec3 normal = material.clearcoatNormal;
float NdotL = clamp(dot(normal, lightDirection), 0.001, 1.0);
vec3 f0 = vec3(0.04);
vec3 f90 = vec3(1.0);
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);
vec3 F = fresnelSchlick2(f0, f90, NdotV);
float roughness = material.clearcoatRoughness;
float alphaRoughness = roughness * roughness;
float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, alphaRoughness);
vec3 directReflection = F * directStrength * NdotL;
vec3 color = lightColorHdr * directReflection;
#ifdef SPECULAR_IBL
vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflect(-viewDirection, normal));
vec3 iblColor = computeSpecularIBL(reflectMC, NdotV, f0, roughness);
color += iblColor * material.occlusion;
#endif
float clearcoatFactor = material.clearcoatFactor;
vec3 clearcoatColor = color * clearcoatFactor;
return baseLayerColor * (1.0 - clearcoatFactor * F) + clearcoatColor;
}
#endif
#if defined(LIGHTING_PBR) && defined(HAS_NORMALS)
vec3 computePbrLighting(in czm_modelMaterial material, in vec3 position)
{
#ifdef USE_CUSTOM_LIGHT_COLOR
vec3 lightColorHdr = model_lightColorHdr;
#else
vec3 lightColorHdr = czm_lightColorHdr;
#endif
vec3 viewDirection = -normalize(position);
vec3 normal = material.normalEC;
vec3 lightDirection = normalize(czm_lightDirectionEC);
vec3 directLighting = czm_pbrLighting(viewDirection, normal, lightDirection, material);
vec3 directColor = lightColorHdr * directLighting;
vec3 color = directColor + material.emissive;
#ifdef USE_IBL_LIGHTING
color += computeIBL(position, normal, lightDirection, lightColorHdr, material);
#endif
#ifdef USE_CLEARCOAT
color = addClearcoatReflection(color, position, lightDirection, lightColorHdr, material);
#endif
return color;
}
#endif
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
{
#ifdef LIGHTING_PBR
#ifdef HAS_NORMALS
vec3 color = computePbrLighting(material, attributes.positionEC);
#else
vec3 color = material.diffuse * material.occlusion + material.emissive;
#endif
#ifndef HDR
color = czm_pbrNeutralTonemapping(color);
#endif
#else // unlit
vec3 color = material.diffuse;
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
color = czm_gammaCorrect(color);
#elif !defined(HDR)
color = czm_linearToSrgb(color);
#endif
material.diffuse = color;
}
`;var Rje={UNLIT:0,PBR:1},Dm=Object.freeze(Rje);var Gce={name:"LightingPipelineStage"};Gce.process=function(e,t){let{model:n,lightingOptions:i,shaderBuilder:o}=e;if(c(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,ge.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",ge.FRAGMENT);let s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}let{lightingModel:r}=i;r===Dm.PBR?o.addDefine("LIGHTING_PBR",void 0,ge.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,ge.FRAGMENT),o.addFragmentLines(dM)};var hM=Gce;var mM=`bool isDefaultStyleColor(vec3 color)
{
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
}
vec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)
{
vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);
vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;
return color;
}
vec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)
{
return vec2(textureTransform * vec3(texCoord, 1.0));
}
#ifdef HAS_NORMAL_TEXTURE
vec2 getNormalTexCoords()
{
vec2 texCoord = TEXCOORD_NORMAL;
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
texCoord = vec2(u_normalTextureTransform * vec3(texCoord, 1.0));
#endif
return texCoord;
}
#endif
#if defined(HAS_NORMAL_TEXTURE) || defined(HAS_CLEARCOAT_NORMAL_TEXTURE)
vec3 computeTangent(in vec3 position, in vec2 normalTexCoords)
{
vec2 tex_dx = dFdx(normalTexCoords);
vec2 tex_dy = dFdy(normalTexCoords);
float determinant = tex_dx.x * tex_dy.y - tex_dy.x * tex_dx.y;
vec3 tangent = tex_dy.t * dFdx(position) - tex_dx.t * dFdy(position);
return tangent / determinant;
}
#endif
#ifdef USE_ANISOTROPY
struct NormalInfo {
vec3 tangent;
vec3 bitangent;
vec3 normal;
vec3 geometryNormal;
};
NormalInfo getNormalInfo(ProcessedAttributes attributes)
{
vec3 geometryNormal = attributes.normalEC;
#ifdef HAS_NORMAL_TEXTURE
vec2 normalTexCoords = getNormalTexCoords();
#endif
#ifdef HAS_BITANGENTS
vec3 tangent = attributes.tangentEC;
vec3 bitangent = attributes.bitangentEC;
#else // Assume HAS_NORMAL_TEXTURE
vec3 tangent = computeTangent(attributes.positionEC, normalTexCoords);
tangent = normalize(tangent - geometryNormal * dot(geometryNormal, tangent));
vec3 bitangent = normalize(cross(geometryNormal, tangent));
#endif
#ifdef HAS_NORMAL_TEXTURE
mat3 tbn = mat3(tangent, bitangent, geometryNormal);
vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_normalTextureScale;
#endif
vec3 normal = normalize(tbn * normalSample);
#else
vec3 normal = geometryNormal;
#endif
#ifdef HAS_DOUBLE_SIDED_MATERIAL
if (czm_backFacing()) {
tangent *= -1.0;
bitangent *= -1.0;
normal *= -1.0;
geometryNormal *= -1.0;
}
#endif
NormalInfo normalInfo;
normalInfo.tangent = tangent;
normalInfo.bitangent = bitangent;
normalInfo.normal = normal;
normalInfo.geometryNormal = geometryNormal;
return normalInfo;
}
#endif
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
vec3 getNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
{
vec2 normalTexCoords = getNormalTexCoords();
#ifdef HAS_BITANGENTS
vec3 t = attributes.tangentEC;
vec3 b = attributes.bitangentEC;
#else
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
t = normalize(t - geometryNormal * dot(geometryNormal, t));
vec3 b = normalize(cross(geometryNormal, t));
#endif
mat3 tbn = mat3(t, b, geometryNormal);
vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_normalTextureScale;
#endif
return normalize(tbn * normalSample);
}
#endif
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
vec3 getClearcoatNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
{
vec2 normalTexCoords = TEXCOORD_CLEARCOAT_NORMAL;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_TRANSFORM
normalTexCoords = vec2(u_clearcoatNormalTextureTransform * vec3(normalTexCoords, 1.0));
#endif
#ifdef HAS_BITANGENTS
vec3 t = attributes.tangentEC;
vec3 b = attributes.bitangentEC;
#else
vec3 t = computeTangent(attributes.positionEC, normalTexCoords);
t = normalize(t - geometryNormal * dot(geometryNormal, t));
vec3 b = normalize(cross(geometryNormal, t));
#endif
mat3 tbn = mat3(t, b, geometryNormal);
vec3 normalSample = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;
normalSample = 2.0 * normalSample - 1.0;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_SCALE
normalSample.xy *= u_clearcoatNormalTextureScale;
#endif
return normalize(tbn * normalSample);
}
#endif
#ifdef HAS_NORMALS
vec3 computeNormal(ProcessedAttributes attributes)
{
vec3 normal = attributes.normalEC;
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
normal = getNormalFromTexture(attributes, normal);
#endif
#ifdef HAS_DOUBLE_SIDED_MATERIAL
if (czm_backFacing()) {
normal = -normal;
}
#endif
return normal;
}
#endif
#ifdef HAS_BASE_COLOR_TEXTURE
vec4 getBaseColorFromTexture()
{
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
#endif
vec4 baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));
#ifdef HAS_BASE_COLOR_FACTOR
baseColorWithAlpha *= u_baseColorFactor;
#endif
return baseColorWithAlpha;
}
#endif
#ifdef HAS_EMISSIVE_TEXTURE
vec3 getEmissiveFromTexture()
{
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
#endif
vec3 emissive = czm_srgbToLinear(texture(u_emissiveTexture, emissiveTexCoords).rgb);
#ifdef HAS_EMISSIVE_FACTOR
emissive *= u_emissiveFactor;
#endif
return emissive;
}
#endif
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
void setSpecularGlossiness(inout czm_modelMaterial material)
{
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE
vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM
specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);
#endif
vec4 specularGlossiness = czm_srgbToLinear(texture(u_specularGlossinessTexture, specularGlossinessTexCoords));
vec3 specular = specularGlossiness.rgb;
float glossiness = specularGlossiness.a;
#ifdef HAS_LEGACY_SPECULAR_FACTOR
specular *= u_legacySpecularFactor;
#endif
#ifdef HAS_GLOSSINESS_FACTOR
glossiness *= u_glossinessFactor;
#endif
#else
#ifdef HAS_LEGACY_SPECULAR_FACTOR
vec3 specular = clamp(u_legacySpecularFactor, vec3(0.0), vec3(1.0));
#else
vec3 specular = vec3(1.0);
#endif
#ifdef HAS_GLOSSINESS_FACTOR
float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
#else
float glossiness = 1.0;
#endif
#endif
#ifdef HAS_DIFFUSE_TEXTURE
vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;
#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM
diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);
#endif
vec4 diffuse = czm_srgbToLinear(texture(u_diffuseTexture, diffuseTexCoords));
#ifdef HAS_DIFFUSE_FACTOR
diffuse *= u_diffuseFactor;
#endif
#elif defined(HAS_DIFFUSE_FACTOR)
vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
#else
vec4 diffuse = vec4(1.0);
#endif
material.diffuse = diffuse.rgb * (1.0 - czm_maximumComponent(specular));
material.alpha = diffuse.a;
material.specular = specular;
material.roughness = 1.0 - glossiness;
}
#elif defined(LIGHTING_PBR)
float setMetallicRoughness(inout czm_modelMaterial material)
{
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
#endif
vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
float roughness = clamp(metallicRoughness.g, 0.0, 1.0);
#ifdef HAS_METALLIC_FACTOR
metalness = clamp(metalness * u_metallicFactor, 0.0, 1.0);
#endif
#ifdef HAS_ROUGHNESS_FACTOR
roughness = clamp(roughness * u_roughnessFactor, 0.0, 1.0);
#endif
#else
#ifdef HAS_METALLIC_FACTOR
float metalness = clamp(u_metallicFactor, 0.0, 1.0);
#else
float metalness = 1.0;
#endif
#ifdef HAS_ROUGHNESS_FACTOR
float roughness = clamp(u_roughnessFactor, 0.0, 1.0);
#else
float roughness = 1.0;
#endif
#endif
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.baseColor.rgb, metalness);
material.specular = f0;
material.diffuse = mix(material.baseColor.rgb, vec3(0.0), metalness);
material.roughness = roughness;
return metalness;
}
#ifdef USE_SPECULAR
void setSpecular(inout czm_modelMaterial material, in float metalness)
{
#ifdef HAS_SPECULAR_TEXTURE
vec2 specularTexCoords = TEXCOORD_SPECULAR;
#ifdef HAS_SPECULAR_TEXTURE_TRANSFORM
specularTexCoords = computeTextureTransform(specularTexCoords, u_specularTextureTransform);
#endif
float specularWeight = texture(u_specularTexture, specularTexCoords).a;
#ifdef HAS_SPECULAR_FACTOR
specularWeight *= u_specularFactor;
#endif
#else
#ifdef HAS_SPECULAR_FACTOR
float specularWeight = u_specularFactor;
#else
float specularWeight = 1.0;
#endif
#endif
#ifdef HAS_SPECULAR_COLOR_TEXTURE
vec2 specularColorTexCoords = TEXCOORD_SPECULAR_COLOR;
#ifdef HAS_SPECULAR_COLOR_TEXTURE_TRANSFORM
specularColorTexCoords = computeTextureTransform(specularColorTexCoords, u_specularColorTextureTransform);
#endif
vec3 specularColorSample = texture(u_specularColorTexture, specularColorTexCoords).rgb;
vec3 specularColorFactor = czm_srgbToLinear(specularColorSample);
#ifdef HAS_SPECULAR_COLOR_FACTOR
specularColorFactor *= u_specularColorFactor;
#endif
#else
#ifdef HAS_SPECULAR_COLOR_FACTOR
vec3 specularColorFactor = u_specularColorFactor;
#else
vec3 specularColorFactor = vec3(1.0);
#endif
#endif
material.specularWeight = specularWeight;
vec3 f0 = material.specular;
vec3 dielectricSpecularF0 = min(f0 * specularColorFactor, vec3(1.0));
material.specular = mix(dielectricSpecularF0, material.baseColor.rgb, metalness);
}
#endif
#ifdef USE_ANISOTROPY
void setAnisotropy(inout czm_modelMaterial material, in NormalInfo normalInfo)
{
mat2 rotation = mat2(u_anisotropy.xy, -u_anisotropy.y, u_anisotropy.x);
float anisotropyStrength = u_anisotropy.z;
vec2 direction = vec2(1.0, 0.0);
#ifdef HAS_ANISOTROPY_TEXTURE
vec2 anisotropyTexCoords = TEXCOORD_ANISOTROPY;
#ifdef HAS_ANISOTROPY_TEXTURE_TRANSFORM
anisotropyTexCoords = computeTextureTransform(anisotropyTexCoords, u_anisotropyTextureTransform);
#endif
vec3 anisotropySample = texture(u_anisotropyTexture, anisotropyTexCoords).rgb;
direction = anisotropySample.rg * 2.0 - vec2(1.0);
anisotropyStrength *= anisotropySample.b;
#endif
direction = rotation * direction;
mat3 tbn = mat3(normalInfo.tangent, normalInfo.bitangent, normalInfo.normal);
vec3 anisotropicT = tbn * normalize(vec3(direction, 0.0));
vec3 anisotropicB = cross(normalInfo.geometryNormal, anisotropicT);
material.anisotropicT = anisotropicT;
material.anisotropicB = anisotropicB;
material.anisotropyStrength = anisotropyStrength;
}
#endif
#ifdef USE_CLEARCOAT
void setClearcoat(inout czm_modelMaterial material, in ProcessedAttributes attributes)
{
#ifdef HAS_CLEARCOAT_TEXTURE
vec2 clearcoatTexCoords = TEXCOORD_CLEARCOAT;
#ifdef HAS_CLEARCOAT_TEXTURE_TRANSFORM
clearcoatTexCoords = computeTextureTransform(clearcoatTexCoords, u_clearcoatTextureTransform);
#endif
float clearcoatFactor = texture(u_clearcoatTexture, clearcoatTexCoords).r;
#ifdef HAS_CLEARCOAT_FACTOR
clearcoatFactor *= u_clearcoatFactor;
#endif
#else
#ifdef HAS_CLEARCOAT_FACTOR
float clearcoatFactor = u_clearcoatFactor;
#else
float clearcoatFactor = 0.0;
#endif
#endif
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE
vec2 clearcoatRoughnessTexCoords = TEXCOORD_CLEARCOAT_ROUGHNESS;
#ifdef HAS_CLEARCOAT_ROUGHNESS_TEXTURE_TRANSFORM
clearcoatRoughnessTexCoords = computeTextureTransform(clearcoatRoughnessTexCoords, u_clearcoatRoughnessTextureTransform);
#endif
float clearcoatRoughness = texture(u_clearcoatRoughnessTexture, clearcoatRoughnessTexCoords).g;
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
clearcoatRoughness *= u_clearcoatRoughnessFactor;
#endif
#else
#ifdef HAS_CLEARCOAT_ROUGHNESS_FACTOR
float clearcoatRoughness = u_clearcoatRoughnessFactor;
#else
float clearcoatRoughness = 0.0;
#endif
#endif
material.clearcoatFactor = clearcoatFactor;
material.clearcoatRoughness = clearcoatRoughness;
#ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
material.clearcoatNormal = getClearcoatNormalFromTexture(attributes, attributes.normalEC);
#else
material.clearcoatNormal = attributes.normalEC;
#endif
}
#endif
#endif
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
{
#ifdef USE_ANISOTROPY
NormalInfo normalInfo = getNormalInfo(attributes);
material.normalEC = normalInfo.normal;
#elif defined(HAS_NORMALS)
material.normalEC = computeNormal(attributes);
#endif
vec4 baseColorWithAlpha = vec4(1.0);
#ifdef HAS_BASE_COLOR_TEXTURE
baseColorWithAlpha = getBaseColorFromTexture();
#elif defined(HAS_BASE_COLOR_FACTOR)
baseColorWithAlpha = u_baseColorFactor;
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
baseColorWithAlpha = v_pointCloudColor;
#elif defined(HAS_COLOR_0)
vec4 color = attributes.color_0;
#ifdef HAS_SRGB_COLOR
color = czm_srgbToLinear(color);
#endif
baseColorWithAlpha *= color;
#endif
#ifdef USE_CPU_STYLING
baseColorWithAlpha.rgb = blend(baseColorWithAlpha.rgb, feature.color.rgb, model_colorBlend);
#endif
material.baseColor = baseColorWithAlpha;
material.diffuse = baseColorWithAlpha.rgb;
material.alpha = baseColorWithAlpha.a;
#ifdef HAS_OCCLUSION_TEXTURE
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
#endif
material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;
#endif
#ifdef HAS_EMISSIVE_TEXTURE
material.emissive = getEmissiveFromTexture();
#elif defined(HAS_EMISSIVE_FACTOR)
material.emissive = u_emissiveFactor;
#endif
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
setSpecularGlossiness(material);
#elif defined(LIGHTING_PBR)
float metalness = setMetallicRoughness(material);
#ifdef USE_SPECULAR
setSpecular(material, metalness);
#endif
#ifdef USE_ANISOTROPY
setAnisotropy(material, normalInfo);
#endif
#ifdef USE_CLEARCOAT
setClearcoat(material, attributes);
#endif
#endif
}
`;var{Material:Mje,MetallicRoughness:fW,SpecularGlossiness:dW,Specular:jce,Clearcoat:Wce}=Tn,qce={name:"MaterialPipelineStage",_processTexture:jl,_processTextureTransform:Yce};qce.process=function(e,t,n){let i=t.material,{model:o,uniformMap:r,shaderBuilder:s}=e,a=c(o.classificationType),l=a,{defaultTexture:u,defaultNormalTexture:f,defaultEmissiveTexture:h}=n.context;Nje(i,r,s,u,f,h,l),c(i.specularGlossiness)?Fje(i.specularGlossiness,r,s,u,l):(c(i.specular)&&$t.supportedExtensions.KHR_materials_specular&&Bje(i.specular,r,s,u,l),c(i.anisotropy)&&$t.supportedExtensions.KHR_materials_anisotropy&&Uje(i.anisotropy,r,s,u,l),c(i.clearcoat)&&$t.supportedExtensions.KHR_materials_clearcoat&&Vje(i.clearcoat,r,s,u,l),zje(i.metallicRoughness,r,s,u,l));let p=$t.getAttributeBySemantic(t,ht.NORMAL),g=e.lightingOptions;i.unlit||!p||a?g.lightingModel=Dm.UNLIT:g.lightingModel=Dm.PBR;let m=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=m;let y=e.alphaOptions;i.alphaMode===Em.BLEND?y.pass=De.TRANSLUCENT:i.alphaMode===Em.MASK&&(y.alphaCutoff=i.alphaCutoff),s.addFragmentLines(mM),i.doubleSided&&s.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,ge.BOTH)};function Yce(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,ge.FRAGMENT);let s=`${i}Transform`;e.addUniform("mat3",s,ge.FRAGMENT),t[s]=function(){return n.transform}}function Lje(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_SCALE`;e.addDefine(r,void 0,ge.FRAGMENT);let s=`${i}Scale`;e.addUniform("float",s,ge.FRAGMENT),t[s]=function(){return n.scale}}function jl(e,t,n,i,o,r){e.addUniform("sampler2D",i,ge.FRAGMENT),t[i]=function(){return n.texture??r};let s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,ge.FRAGMENT);let l=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,l,ge.FRAGMENT);let f=n.transform;c(f)&&!J.equals(f,J.IDENTITY)&&Yce(e,t,n,i,o);let{scale:h}=n;c(h)&&h!==1&&Lje(e,t,n,i,o)}function Nje(e,t,n,i,o,r,s){let{emissiveFactor:a,emissiveTexture:l,normalTexture:u,occlusionTexture:f}=e;c(a)&&!d.equals(a,Mje.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",ge.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,ge.FRAGMENT),c(l)&&!s&&jl(n,t,l,"u_emissiveTexture","EMISSIVE",r)),c(u)&&!s&&jl(n,t,u,"u_normalTexture","NORMAL",o),c(f)&&!s&&jl(n,t,f,"u_occlusionTexture","OCCLUSION",i)}function Fje(e,t,n,i,o){let{diffuseTexture:r,diffuseFactor:s,specularGlossinessTexture:a,specularFactor:l,glossinessFactor:u}=e;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,ge.FRAGMENT),c(r)&&!o&&jl(n,t,r,"u_diffuseTexture","DIFFUSE",i),c(s)&&!se.equals(s,dW.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",ge.FRAGMENT),t.u_diffuseFactor=function(){return e.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,ge.FRAGMENT)),c(a)&&!o&&jl(n,t,a,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i),c(l)&&!d.equals(l,dW.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_legacySpecularFactor",ge.FRAGMENT),t.u_legacySpecularFactor=function(){return e.specularFactor},n.addDefine("HAS_LEGACY_SPECULAR_FACTOR",void 0,ge.FRAGMENT)),c(u)&&u!==dW.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",ge.FRAGMENT),t.u_glossinessFactor=function(){return e.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,ge.FRAGMENT))}function Bje(e,t,n,i,o){let{specularTexture:r,specularFactor:s,specularColorTexture:a,specularColorFactor:l}=e;n.addDefine("USE_SPECULAR",void 0,ge.FRAGMENT),c(r)&&!o&&jl(n,t,r,"u_specularTexture","SPECULAR",i),c(s)&&s!==jce.DEFAULT_SPECULAR_FACTOR&&(n.addUniform("float","u_specularFactor",ge.FRAGMENT),t.u_specularFactor=function(){return e.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,ge.FRAGMENT)),c(a)&&!o&&jl(n,t,a,"u_specularColorTexture","SPECULAR_COLOR",i),c(l)&&!d.equals(l,jce.DEFAULT_SPECULAR_COLOR_FACTOR)&&(n.addUniform("vec3","u_specularColorFactor",ge.FRAGMENT),t.u_specularColorFactor=function(){return e.specularColorFactor},n.addDefine("HAS_SPECULAR_COLOR_FACTOR",void 0,ge.FRAGMENT))}var kje=new d;function Uje(e,t,n,i,o){let{anisotropyStrength:r,anisotropyRotation:s,anisotropyTexture:a}=e;n.addDefine("USE_ANISOTROPY",void 0,ge.FRAGMENT),c(a)&&!o&&jl(n,t,a,"u_anisotropyTexture","ANISOTROPY",i);let l=Math.cos(s),u=Math.sin(s);n.addUniform("vec3","u_anisotropy",ge.FRAGMENT),t.u_anisotropy=function(){return d.fromElements(l,u,r,kje)}}function Vje(e,t,n,i,o){let{clearcoatFactor:r,clearcoatTexture:s,clearcoatRoughnessFactor:a,clearcoatRoughnessTexture:l,clearcoatNormalTexture:u}=e;n.addDefine("USE_CLEARCOAT",void 0,ge.FRAGMENT),c(r)&&r!==Wce.DEFAULT_CLEARCOAT_FACTOR&&(n.addUniform("float","u_clearcoatFactor",ge.FRAGMENT),t.u_clearcoatFactor=function(){return e.clearcoatFactor},n.addDefine("HAS_CLEARCOAT_FACTOR",void 0,ge.FRAGMENT)),c(s)&&!o&&jl(n,t,s,"u_clearcoatTexture","CLEARCOAT",i),c(a)&&r!==Wce.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_clearcoatRoughnessFactor",ge.FRAGMENT),t.u_clearcoatRoughnessFactor=function(){return e.clearcoatRoughnessFactor},n.addDefine("HAS_CLEARCOAT_ROUGHNESS_FACTOR",void 0,ge.FRAGMENT)),c(l)&&!o&&jl(n,t,l,"u_clearcoatRoughnessTexture","CLEARCOAT_ROUGHNESS",i),c(u)&&!o&&jl(n,t,u,"u_clearcoatNormalTexture","CLEARCOAT_NORMAL",i)}function zje(e,t,n,i,o){n.addDefine("USE_METALLIC_ROUGHNESS",void 0,ge.FRAGMENT);let r=e.baseColorTexture;c(r)&&!o&&jl(n,t,r,"u_baseColorTexture","BASE_COLOR",i);let s=e.baseColorFactor;c(s)&&!se.equals(s,fW.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",ge.FRAGMENT),t.u_baseColorFactor=function(){return e.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,ge.FRAGMENT));let a=e.metallicRoughnessTexture;c(a)&&!o&&jl(n,t,a,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);let l=e.metallicFactor;c(l)&&l!==fW.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",ge.FRAGMENT),t.u_metallicFactor=function(){return e.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,ge.FRAGMENT));let u=e.roughnessFactor;c(u)&&u!==fW.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",ge.FRAGMENT),t.u_roughnessFactor=function(){return e.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,ge.FRAGMENT))}var pM=qce;var ol={name:"MetadataPickingPipelineStage",METADATA_PICKING_ENABLED:"METADATA_PICKING_ENABLED",METADATA_PICKING_VALUE_TYPE:"METADATA_PICKING_VALUE_TYPE",METADATA_PICKING_VALUE_STRING:"METADATA_PICKING_VALUE_STRING",METADATA_PICKING_VALUE_COMPONENT_X:"METADATA_PICKING_VALUE_COMPONENT_X",METADATA_PICKING_VALUE_COMPONENT_Y:"METADATA_PICKING_VALUE_COMPONENT_Y",METADATA_PICKING_VALUE_COMPONENT_Z:"METADATA_PICKING_VALUE_COMPONENT_Z",METADATA_PICKING_VALUE_COMPONENT_W:"METADATA_PICKING_VALUE_COMPONENT_W"};ol.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine(ol.METADATA_PICKING_VALUE_TYPE,"float",ge.FRAGMENT),i.addDefine(ol.METADATA_PICKING_VALUE_STRING,"0.0",ge.FRAGMENT),i.addDefine(ol.METADATA_PICKING_VALUE_COMPONENT_X,"0.0",ge.FRAGMENT),i.addDefine(ol.METADATA_PICKING_VALUE_COMPONENT_Y,"0.0",ge.FRAGMENT),i.addDefine(ol.METADATA_PICKING_VALUE_COMPONENT_Z,"0.0",ge.FRAGMENT),i.addDefine(ol.METADATA_PICKING_VALUE_COMPONENT_W,"0.0",ge.FRAGMENT),i.addFunction("metadataPickingStage","void metadataPickingStage(Metadata metadata, MetadataClass metadataClass, inout vec4 metadataValues)",ge.FRAGMENT),i.addFunctionLines("metadataPickingStage",[`${ol.METADATA_PICKING_VALUE_TYPE} value = ${ol.METADATA_PICKING_VALUE_TYPE}(${ol.METADATA_PICKING_VALUE_STRING});`,`metadataValues.x = ${ol.METADATA_PICKING_VALUE_COMPONENT_X};`,`metadataValues.y = ${ol.METADATA_PICKING_VALUE_COMPONENT_Y};`,`metadataValues.z = ${ol.METADATA_PICKING_VALUE_COMPONENT_Z};`,`metadataValues.w = ${ol.METADATA_PICKING_VALUE_COMPONENT_W};`],ge.FRAGMENT)};var Pu=ol;var _M=`void morphTargetsStage(inout ProcessedAttributes attributes)
{
vec3 positionMC = attributes.positionMC;
attributes.positionMC = getMorphedPosition(positionMC);
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = getMorphedNormal(normalMC);
#endif
#ifdef HAS_TANGENTS
vec3 tangentMC = attributes.tangentMC;
attributes.tangentMC = getMorphedTangent(tangentMC);
#endif
}
`;var za={name:"MorphTargetsPipelineStage",FUNCTION_ID_GET_MORPHED_POSITION:"getMorphedPosition",FUNCTION_SIGNATURE_GET_MORPHED_POSITION:"vec3 getMorphedPosition(in vec3 position)",FUNCTION_ID_GET_MORPHED_NORMAL:"getMorphedNormal",FUNCTION_SIGNATURE_GET_MORPHED_NORMAL:"vec3 getMorphedNormal(in vec3 normal)",FUNCTION_ID_GET_MORPHED_TANGENT:"getMorphedTangent",FUNCTION_SIGNATURE_GET_MORPHED_TANGENT:"vec3 getMorphedTangent(in vec3 tangent)"};za.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,ge.VERTEX),Yje(n);let i=t.morphTargets.length;for(let a=0;a<i;a++){let l=t.morphTargets[a].attributes,u=l.length;for(let f=0;f<u;f++){let h=l[f],p=h.semantic;p!==ht.POSITION&&p!==ht.NORMAL&&p!==ht.TANGENT||(Gje(e,h,e.attributeIndex,a),e.attributeIndex++)}}Xje(n);let r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,ge.VERTEX),n.addVertexLines(_M);let s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=xt(s,e.uniformMap)};var Hje={attributeString:void 0,functionId:void 0};function Gje(e,t,n,i){let o=e.shaderBuilder;jje(e,t,n);let r=Wje(t,Hje);qje(o,r,i)}function jje(e,t,n){let i={index:n,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:nn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function Wje(e,t){switch(e.semantic){case ht.POSITION:t.attributeString="Position",t.functionId=za.FUNCTION_ID_GET_MORPHED_POSITION;break;case ht.NORMAL:t.attributeString="Normal",t.functionId=za.FUNCTION_ID_GET_MORPHED_NORMAL;break;case ht.TANGENT:t.attributeString="Tangent",t.functionId=za.FUNCTION_ID_GET_MORPHED_TANGENT;break;default:break}return t}function qje(e,t,n){let i=t.attributeString,o=`a_target${i}_${n}`,r=`morphed${i} += u_morphWeights[${n}] * a_target${i}_${n};`;e.addAttribute("vec3",o),e.addFunctionLines(t.functionId,[r])}function Yje(e){e.addFunction(za.FUNCTION_ID_GET_MORPHED_POSITION,za.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,ge.VERTEX),e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_POSITION,["vec3 morphedPosition = position;"]),e.addFunction(za.FUNCTION_ID_GET_MORPHED_NORMAL,za.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,ge.VERTEX),e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_NORMAL,["vec3 morphedNormal = normal;"]),e.addFunction(za.FUNCTION_ID_GET_MORPHED_TANGENT,za.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,ge.VERTEX),e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_TANGENT,["vec3 morphedTangent = tangent;"])}function Xje(e){e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_POSITION,["return morphedPosition;"]),e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_NORMAL,["return morphedNormal;"]),e.addFunctionLines(za.FUNCTION_ID_GET_MORPHED_TANGENT,["return morphedTangent;"])}var gM=za;var Xce={name:"PickingPipelineStage"};Xce.process=function(e,t,n){let i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)Kje(e,t,a,i);else if(c(a))$je(e,i);else{let l=Kce(e),u=i.createPickId(l);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",ge.FRAGMENT);let f=e.uniformMap;f.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function Kce(e,t){let n=e.model;if(c(n.pickObject))return n.pickObject;let i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive},o;if(pr.is3DTiles(n.type)){let r=n.content;o={content:r,primitive:r.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,c(t)&&(o.instanceId=t),o}function Kje(e,t,n){let i=e.model,o,r,s=i.featureIdLabel,a=i.instanceFeatureIdLabel;c(i.featureTableId)?o=i.featureTableId:c(n)?(r=$t.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=$t.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);let l=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",ge.FRAGMENT);let f=l.batchTexture;e.uniformMap.model_pickTexture=function(){return f.pickTexture??f.defaultTexture},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function $je(e,t){let n=e.instanceCount,i=new Array(n),o=new Uint8Array(n*4),r=e.model,s=r._pipelineResources;for(let h=0;h<n;h++){let p=Kce(e,h),g=t.createPickId(p);s.push(g),i[h]=g;let m=g.color;o[h*4+0]=G.floatToByte(m.red),o[h*4+1]=G.floatToByte(m.green),o[h*4+2]=G.floatToByte(m.blue),o[h*4+3]=G.floatToByte(m.alpha)}r._pickIds=i;let a=yt.createVertexBuffer({context:t,typedArray:o,usage:Be.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.statistics.addBuffer(a,!1),s.push(a);let u={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:$.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(u);let f=e.shaderBuilder;f.addDefine("USE_PICKING",void 0,ge.BOTH),f.addAttribute("vec4","a_pickColor"),f.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}var yM=Xce;var Zje={ADD:0,REPLACE:1},qo=Object.freeze(Zje);var bM=`float getPointSizeFromAttenuation(vec3 positionEC) {
float pointSize = model_pointCloudParameters.x;
float geometricError = model_pointCloudParameters.y;
float depthMultiplier = model_pointCloudParameters.z;
float depth = -positionEC.z;
return min((geometricError / depth) * depthMultiplier, pointSize);
}
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
float pointCloudShowStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return float(getShowFromStyle(attributes, metadata, tiles3d_tileset_time));
}
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
vec4 pointCloudColorStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return getColorFromStyle(attributes, metadata, tiles3d_tileset_time);
}
#endif
#ifdef HAS_POINT_CLOUD_POINT_SIZE_STYLE
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
float tiles3d_tileset_time = model_pointCloudParameters.w;
return float(getPointSizeFromStyle(attributes, metadata, tiles3d_tileset_time));
}
#elif defined(HAS_POINT_CLOUD_ATTENUATION)
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
return getPointSizeFromAttenuation(v_positionEC);
}
#endif
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
float pointCloudBackFaceCullingStage() {
#if defined(HAS_NORMALS) && !defined(HAS_DOUBLE_SIDED_MATERIAL)
return step(-v_normalEC.z, 0.0);
#else
return 1.0;
#endif
}
#endif
`;var Qje=new se,Zce={name:"PointCloudStylingPipelineStage"};Zce.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=c(s)?s.propertyAttributes:void 0,l=c(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,u=!c(a)&&l;if(c(r)&&!u){let y=n6e(a),b=i6e(r,y);o6e(i,b);let A=r6e(b).indexOf("normalMC")>=0,C=$t.getAttributeBySemantic(t,ht.NORMAL);if(A&&!C)throw new ae("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,ge.VERTEX),b.styleTranslucent&&(e.alphaOptions.pass=De.TRANSLUCENT)}let f=o.pointCloudShading;f.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,ge.VERTEX),f.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,ge.VERTEX);let h,p,g;pr.is3DTiles(o.type)&&(p=!0,h=o.content,g=h.tile.refine===qo.ADD),i.addUniform("vec4","model_pointCloudParameters",ge.VERTEX),i.addVertexLines(bM);let m=e.uniformMap;m.model_pointCloudParameters=function(){let y=Qje,b=1;p&&(b=g?5:h.tileset.memoryAdjustedScreenSpaceError),y.x=f.maximumAttenuation??b,y.x*=n.pixelRatio;let x=Jje(e,t,f,h);y.y=x*f.geometricErrorScale;let A=n.context,C=n.camera.frustum,S;return n.mode===oe.SCENE2D||C instanceof on?S=Number.POSITIVE_INFINITY:S=A.drawingBufferHeight/n.camera.frustum.sseDenominator,y.z=S,p&&(y.w=h.tileset.timeSinceLoad),y}};var $ce=new d;function Jje(e,t,n,i){if(c(i)){let f=i.tile.geometricError;if(f>0)return f}if(c(n.baseResolution))return n.baseResolution;let o=$t.getAttributeBySemantic(t,ht.POSITION),r=o.count,s=e.runtimeNode.transform,a=d.subtract(o.max,o.min,$ce);a=B.multiplyByPointAsVector(s,a,$ce);let l=a.x*a.y*a.z;return O.cbrt(l/r)}var e6e={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},t6e={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function n6e(e){let t=je(t6e);if(!c(e))return t;for(let n=0;n<e.length;n++){let o=e[n].properties;for(let r in o)o.hasOwnProperty(r)&&(t[r]=`metadata.${r}`)}return t}var hW="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function i6e(e,t){let n=e6e,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${hW})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${hW})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${hW})`,t,i),n.styleTranslucent=c(n.colorStyleFunction)&&i.translucent,n}function o6e(e,t){let n=t.colorStyleFunction;c(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,ge.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));let i=t.showStyleFunction;c(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,ge.BOTH),e.addVertexLines(i),e.addVarying("float","v_pointCloudShow"));let o=t.pointSizeStyleFunction;c(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,ge.VERTEX),e.addVertexLines(o))}function mW(e,t){let n=/attributes\.(\w+)/g,i=n.exec(e);for(;i!==null;){let o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function r6e(e){let t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return c(t)&&mW(t,o),c(n)&&mW(n,o),c(i)&&mW(i,o),o}var xM=Zce;var TM=`void primitiveOutlineStage() {
v_outlineCoordinates = a_outlineCoordinates;
}
`;var AM=`void primitiveOutlineStage(inout czm_modelMaterial material) {
if (!model_showOutline) {
return;
}
float outlineX =
texture(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
float outlineY =
texture(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
float outlineZ =
texture(model_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r;
float outlineness = max(outlineX, max(outlineY, outlineZ));
material.diffuse = mix(material.diffuse, model_outlineColor.rgb, model_outlineColor.a * outlineness);
}
`;var Qce={name:"PrimitiveOutlinePipelineStage"};Qce.process=function(e,t,n){let i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,ge.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");let r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:nn.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",ge.FRAGMENT);let a=wx.createTexture(n.context);o.model_outlineTexture=function(){return a};let l=e.model;i.addUniform("vec4","model_outlineColor",ge.FRAGMENT),o.model_outlineColor=function(){return l.outlineColor},i.addUniform("bool","model_showOutline",ge.FRAGMENT),o.model_showOutline=function(){return l.showOutline},i.addVertexLines(TM),i.addFragmentLines(AM)};var CM=Qce;var Jce={name:"PrimitiveStatisticsPipelineStage",_countGeometry:ele,_count2DPositions:tle,_countMorphTargetAttributes:nle,_countMaterialTextures:ile,_countFeatureIdTextures:ole,_countBinaryMetadata:rle};Jce.process=function(e,t,n){let i=e.model,o=i.statistics;ele(o,t),tle(o,e.runtimePrimitive),nle(o,t),ile(o,t.material),ole(o,t.featureIds),rle(o,i)};function ele(e,t){let n=c(t.indices)?t.indices.count:$t.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===Me.POINTS?e.pointsLength+=n:Me.isTriangles(i)&&(e.trianglesLength+=s6e(i,n));let o=t.attributes,r=o.length;for(let l=0;l<r;l++){let u=o[l];if(c(u.buffer)){let f=c(u.typedArray);e.addBuffer(u.buffer,f)}}let s=t.outlineCoordinates;c(s)&&c(s.buffer)&&e.addBuffer(s.buffer,!1);let a=t.indices;if(c(a)&&c(a.buffer)){let l=c(a.typedArray);e.addBuffer(a.buffer,l)}}function s6e(e,t){switch(e){case Me.TRIANGLES:return t/3;case Me.TRIANGLE_STRIP:case Me.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function tle(e,t){let n=t.positionBuffer2D;c(n)&&e.addBuffer(n,!0)}function nle(e,t){let n=t.morphTargets;if(!c(n))return;let i=!1,o=n.length;for(let r=0;r<o;r++){let s=n[r].attributes,a=s.length;for(let l=0;l<a;l++){let u=s[l];c(u.buffer)&&e.addBuffer(u.buffer,i)}}}function ile(e,t){let n=a6e(t),i=n.length;for(let o=0;o<i;o++){let r=n[o];c(r)&&c(r.texture)&&e.addTexture(r.texture)}}function a6e(e){let t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return c(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function ole(e,t){let n=t.length;for(let i=0;i<n;i++){let o=t[i];if(o instanceof Tn.FeatureIdTexture){let r=o.textureReader;c(r.texture)&&e.addTexture(r.texture)}}}function rle(e,t){let n=t.structuralMetadata;c(n)&&(c6e(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);let i=t.featureTables;if(!c(i))return;let o=i.length;for(let r=0;r<o;r++){let s=i[r];e.addBatchTexture(s.batchTexture)}}function c6e(e,t){let n=t.propertyTextures;if(!c(n))return;let i=n.length;for(let o=0;o<i;o++){let s=n[o].properties;for(let a in s)if(s.hasOwnProperty(a)){let u=s[a].textureReader;c(u.texture)&&e.addTexture(u.texture)}}}var EM=Jce;var l6e=new B,u6e=new B,sle={name:"SceneMode2DPipelineStage"};sle.process=function(e,t,n){let i=$t.getAttributeBySemantic(t,ht.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,l=B.multiplyTransformation(s,a,l6e),u=h6e(e,l,n),f=e.runtimePrimitive;f.boundingSphere2D=u;let h=e.runtimeNode.node.instances;if(c(h))return;if(c(i.typedArray)){let y=_6e(i,l,u,n);f.positionBuffer2D=y,r._modelResources.push(y),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,ge.VERTEX),o.addUniform("mat4","u_modelView2D",ge.VERTEX);let p=B.fromTranslation(u.center,new B),g=n.context,m={u_modelView2D:function(){return B.multiplyTransformation(g.uniformState.view,p,u6e)}};e.uniformMap=xt(m,e.uniformMap)};var f6e=new d,d6e=new d;function h6e(e,t,n){let i=B.multiplyByPoint(t,e.positionMin,f6e),o=Gi.computeActualEllipsoidPosition(n,i,i),r=B.multiplyByPoint(t,e.positionMax,d6e),s=Gi.computeActualEllipsoidPosition(n,r,r);return le.fromCornerPoints(o,s,new le)}var ale=new d;function m6e(e,t){let n=e.length,i=new Float32Array(n),o=t.quantizedVolumeOffset,r=t.quantizedVolumeStepSize;for(let s=0;s<n;s+=3){let a=d.fromArray(e,s,ale),l=d.multiplyComponents(a,r,a),u=d.add(l,o,l);i[s]=u.x,i[s+1]=u.y,i[s+2]=u.z}return i}function p6e(e,t,n,i){let o;c(e.quantization)?o=m6e(e.typedArray,e.quantization):o=e.typedArray.slice();let r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=c(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let l=r;l<s;l+=a){let u=d.fromArray(o,l,ale);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z))continue;let f=B.multiplyByPoint(t,u,u),h=Gi.computeActualEllipsoidPosition(i,f,f),p=d.subtract(h,n,h);o[l]=p.x,o[l+1]=p.y,o[l+2]=p.z}return o}function _6e(e,t,n,i){let o=je(i);o.mode=oe.COLUMBUS_VIEW;let r=n.center,s=p6e(e,t,r,o),a=yt.createVertexBuffer({context:i.context,typedArray:s,usage:Be.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}var SM=sle;var wM=`void skinningStage(inout ProcessedAttributes attributes)
{
mat4 skinningMatrix = getSkinningMatrix();
mat3 skinningMatrixMat3 = mat3(skinningMatrix);
vec4 positionMC = vec4(attributes.positionMC, 1.0);
attributes.positionMC = vec3(skinningMatrix * positionMC);
#ifdef HAS_NORMALS
vec3 normalMC = attributes.normalMC;
attributes.normalMC = skinningMatrixMat3 * normalMC;
#endif
#ifdef HAS_TANGENTS
vec3 tangentMC = attributes.tangentMC;
attributes.tangentMC = skinningMatrixMat3 * tangentMC;
#endif
}
`;var Ix={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};Ix.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,ge.VERTEX),y6e(n,t);let i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,ge.VERTEX),n.addVertexLines(wM);let r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=xt(r,e.uniformMap)};function g6e(e){let t=-1,n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];(r.semantic===ht.JOINTS||r.semantic===ht.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function y6e(e,t){e.addFunction(Ix.FUNCTION_ID_GET_SKINNING_MATRIX,Ix.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,ge.VERTEX),e.addFunctionLines(Ix.FUNCTION_ID_GET_SKINNING_MATRIX,["mat4 skinnedMatrix = mat4(0);"]);let i,o,r=["x","y","z","w"],s=g6e(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){let l=r[o],u=`skinnedMatrix += a_weights_${i}.${l} * u_jointMatrices[int(a_joints_${i}.${l})];`;e.addFunctionLines(Ix.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}e.addFunctionLines(Ix.FUNCTION_ID_GET_SKINNING_MATRIX,["return skinnedMatrix;"])}var vM=Ix;var DM=`void verticalExaggerationStage(
inout ProcessedAttributes attributes
) {
vec4 vertexPositionENU = czm_modelToEnu * vec4(attributes.positionMC, 1.0);
vec2 vertexAzimuth = normalize(vertexPositionENU.xy);
float azimuthalCurvature = dot(vertexAzimuth * vertexAzimuth, czm_eyeEllipsoidCurvature);
float eyeToCenter = 1.0 / azimuthalCurvature + czm_eyeHeight;
vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;
vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;
vec3 vertexNormal = normalize(centerToVertex);
float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);
float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);
float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);
bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexNormal);
float smallAngleVersine = 0.5 * sinTheta * sinTheta;
float versine = isSmallAngle ? smallAngleVersine : exactVersine;
float dHeight = dot(vertexPositionEC, vertexNormal) - eyeToCenter * versine;
float vertexHeight = czm_eyeHeight + dHeight;
vec3 vertexNormalMC = (czm_inverseModelView * vec4(vertexNormal, 0.0)).xyz;
vertexNormalMC = normalize(vertexNormalMC);
float stretch = u_verticalExaggerationAndRelativeHeight.x;
float shift = u_verticalExaggerationAndRelativeHeight.y;
float exaggeration = (vertexHeight - shift) * (stretch - 1.0);
attributes.positionMC += exaggeration * vertexNormalMC;
}
`;var cle={name:"VerticalExaggerationPipelineStage"},b6e=new H;cle.process=function(e,t,n){let{shaderBuilder:i,uniformMap:o}=e;i.addVertexLines(DM),i.addDefine("HAS_VERTICAL_EXAGGERATION",void 0,ge.VERTEX),i.addUniform("vec2","u_verticalExaggerationAndRelativeHeight",ge.VERTEX),o.u_verticalExaggerationAndRelativeHeight=function(){return H.fromElements(n.verticalExaggeration,n.verticalExaggerationRelativeHeight,b6e)}};var PM=cle;var pW={};function x6e(e){let t=Fe.createTypedArray(e,e*2),n=e,i=0;for(let o=0;o<n;o+=3)t[i++]=o,t[i++]=o+1,t[i++]=o+1,t[i++]=o+2,t[i++]=o+2,t[i++]=o;return t}function T6e(e,t){let n=t.length,i=Fe.createTypedArray(e,n*2),o=0;for(let r=0;r<n;r+=3){let s=t[r],a=t[r+1],l=t[r+2];i[o++]=s,i[o++]=a,i[o++]=a,i[o++]=l,i[o++]=l,i[o++]=s}return i}function A6e(e){let t=e-2,n=2+t*4,i=Fe.createTypedArray(e,n),o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=r;return i}function C6e(e,t){let i=t.length-2,o=2+i*4,r=Fe.createTypedArray(e,o),s=0;r[s++]=t[0],r[s++]=t[1];for(let a=0;a<i;a++){let l=t[a],u=t[a+1],f=t[a+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=l}return r}function E6e(e){let t=e-2,n=2+t*4,i=Fe.createTypedArray(e,n),o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=0;return i}function S6e(e,t){let i=t.length-2,o=2+i*4,r=Fe.createTypedArray(e,o),s=0,a=t[0];r[s++]=a,r[s++]=t[1];for(let l=0;l<i;l++){let u=t[l+1],f=t[l+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=a}return r}pW.createWireframeIndices=function(e,t,n){let i=c(n);if(e===Me.TRIANGLES)return i?T6e(t,n):x6e(t);if(e===Me.TRIANGLE_STRIP)return i?C6e(t,n):A6e(t);if(e===Me.TRIANGLE_FAN)return i?S6e(t,n):E6e(t)};pW.getWireframeIndicesCount=function(e,t){return e===Me.TRIANGLES?t*2:e===Me.TRIANGLE_STRIP||e===Me.TRIANGLE_FAN?2+(t-2)*4:t};var gE=pW;var lle={name:"WireframePipelineStage"};lle.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,ge.FRAGMENT);let o=e.model,r=w6e(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r,o.statistics.addBuffer(r,!1);let a=e.primitiveType,l=e.count;e.primitiveType=Me.LINES,e.count=gE.getWireframeIndicesCount(a,l)};function w6e(e,t,n){let o=$t.getAttributeBySemantic(e,ht.POSITION).count,r=n.context.webgl2,s;if(c(t)){let f=t.buffer,h=t.count;c(f)&&r?(s=f.sizeInBytes===h?new Uint8Array(h):Fe.createTypedArray(o,h),f.getBufferData(s)):s=t.typedArray}let a=e.primitiveType,l=gE.createWireframeIndices(a,o,s),u=Fe.fromSizeInBytes(l.BYTES_PER_ELEMENT);return yt.createIndexBuffer({context:n.context,typedArray:l,usage:Be.STATIC_DRAW,indexDatatype:u})}var IM=lle;function ule(e){e=e??W.EMPTY_OBJECT;let t=e.primitive,n=e.node,i=e.model;T.typeOf.object("options.primitive",t),T.typeOf.object("options.node",n),T.typeOf.object("options.model",i),this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}ule.prototype.configurePipeline=function(e){let t=this.pipelineStages;t.length=0;let n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,u=e.mode!==oe.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,f=e.verticalExaggeration!==1&&o.hasVerticalExaggeration,h=c(n.morphTargets)&&n.morphTargets.length>0,p=c(i.skin),g=c(r),y=!(g&&c(r.fragmentShaderText))||r.mode!==y_.REPLACE_MATERIAL,b=$t.hasQuantizedAttributes(n.attributes),x=o.debugWireframe&&Me.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),A=o.pointCloudShading,C=c(A)&&A.attenuation,S=c(A)&&A.backFaceCulling,v=n.primitiveType===Me.POINTS&&(c(s)||C||S),P=o._enableShowOutline&&c(n.outlineCoordinates),M=v6e(o,i,n),R=c(o.classificationType);u&&t.push(SM),t.push(fM),x&&t.push(IM),R&&t.push(KR),h&&t.push(gM),p&&t.push(vM),v&&t.push(xM),b&&t.push(aM),y&&t.push(pM),t.push(My),t.push(Uf),t.push(Pu),M.hasPropertyTable&&(t.push(Ny),t.push(XR),t.push(QR)),f&&t.push(PM),g&&t.push(rM),t.push(hM),o.allowPicking&&t.push(yM),P&&t.push(CM),t.push(YR),t.push(EM)};function v6e(e,t,n){let i;return c(t.instances)&&(i=$t.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(i))?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:(i=$t.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),c(i)?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}var OM=ule;function _W(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.skin",e.skin),T.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;let t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],D6e(this)}Object.defineProperties(_W.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}});function D6e(e){let t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;let i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let l=0;l<o;l++){let u=i[l].index,f=r[u];s.push(f);let h=n[l],p=fle(f,h,new B);a.push(p)}}function fle(e,t,n){let i=B.multiplyTransformation(e.transformToRoot,e.transform,n);return n=B.multiplyTransformation(i,t,n),n}_W.prototype.updateJointMatrices=function(){let e=this._jointMatrices,t=e.length;for(let n=0;n<t;n++){let i=this.joints[n],o=this.inverseBindMatrices[n];e[n]=fle(i,o,e[n])}};var RM=_W;function P6e(){this.pass=void 0,this.alphaCutoff=void 0}var MM=P6e;function I6e(e){T.typeOf.object("model",e),this.shaderBuilder=new wb,this.model=e,this.uniformMap={},this.alphaOptions=new MM,this.renderStateOptions=Ve.getState(Ve.fromCache({depthTest:{enabled:!0,func:dc.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}var LM=I6e;var NM=`void silhouetteStage(inout vec4 color) {
if(model_silhouettePass) {
color = czm_gammaCorrect(model_silhouetteColor);
}
}
`;var FM=`void silhouetteStage(in ProcessedAttributes attributes, inout vec4 positionClip) {
#ifdef HAS_NORMALS
if(model_silhouettePass) {
vec3 normal = normalize(czm_normal3D * attributes.normalMC);
normal.x *= czm_projection[0][0];
normal.y *= czm_projection[1][1];
positionClip.xy += normal.xy * positionClip.w * model_silhouetteSize * czm_pixelRatio / czm_viewport.z;
}
#endif
}
`;var Iz={name:"ModelSilhouettePipelineStage"};Iz.silhouettesLength=0;Iz.process=function(e,t,n){c(t._silhouetteId)||(t._silhouetteId=++Iz.silhouettesLength);let i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,ge.BOTH),i.addVertexLines(FM),i.addFragmentLines(NM),i.addUniform("vec4","model_silhouetteColor",ge.FRAGMENT),i.addUniform("float","model_silhouetteSize",ge.VERTEX),i.addUniform("bool","model_silhouettePass",ge.BOTH);let o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=xt(o,e.uniformMap),e.hasSilhouette=!0};var BM=Iz;var kM=`void modelSplitterStage()
{
#ifndef SHADOW_MAP
if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
#endif
}
`;var Oz={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};Oz.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,ge.FRAGMENT),i.addFragmentLines(kM);let o={};i.addUniform("float",Oz.SPLIT_DIRECTION_UNIFORM_NAME,ge.FRAGMENT),o[Oz.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=xt(o,e.uniformMap)};var UM=Oz;function O6e(e,t){T.typeOf.object("modelRenderResources",e),T.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=je(e.uniformMap),this.alphaOptions=je(e.alphaOptions),this.renderStateOptions=je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}var VM=O6e;function R6e(e){e=e??W.EMPTY_OBJECT,this.lightingModel=e.lightingModel??Dm.UNLIT}var zM=R6e;function M6e(e,t){T.typeOf.object("nodeRenderResources",e),T.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=je(e.uniformMap),this.alphaOptions=je(e.alphaOptions),this.renderStateOptions=je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;let n=t.primitive;this.count=c(n.indices)?n.indices.count:$t.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;let i=$t.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=d.clone(i.min,new d),this.positionMax=d.clone(i.max,new d),this.boundingSphere=le.fromCornerPoints(this.positionMin,this.positionMax,new le),this.lightingOptions=new zM,this.pickId=void 0}var HM=M6e;function yW(e){e=e??W.EMPTY_OBJECT;let t=e.command,n=e.primitiveRenderResources;T.typeOf.object("options.command",t),T.typeOf.object("options.primitiveRenderResources",n);let i=n.model;this._command=t,this._model=i,this._runtimePrimitive=n.runtimePrimitive,this._modelMatrix=t.modelMatrix,this._boundingVolume=t.boundingVolume,this._cullFace=t.renderState.cull.face;let o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==Un.CESIUM_3D_TILE,this._classifies3DTiles=o!==Un.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],B6e(this)}function L6e(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:ft.KEEP,zFail:ft.DECREMENT_WRAP,zPass:ft.KEEP},backFunction:e,backOperation:{fail:ft.KEEP,zFail:ft.INCREMENT_WRAP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:dc.LESS_OR_EQUAL},depthMask:!1}}var N6e={stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:ln.PRE_MULTIPLIED_ALPHA_BLEND},F6e={stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},backFunction:Vn.NOT_EQUAL,backOperation:{fail:ft.ZERO,zFail:ft.ZERO,zPass:ft.ZERO},reference:0,mask:kt.CLASSIFICATION_MASK},stencilMask:kt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},mle=[];function B6e(e){let t=e._command,n=mle;if(e._useDebugWireframe){t.pass=De.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=GM(e,n,e._commandListDebugWireframe);let r=e._commandListDebugWireframe,s=r.length;for(let a=0;a<s;a++){let l=r[a];l.count*=2,l.offset*=2}return}let o=e.model.allowPicking;if(e._classifiesTerrain){let r=De.TERRAIN_CLASSIFICATION,s=gW(t,r),a=dle(t,r);n.length=0,n.push(s,a),e._commandListTerrain=GM(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=hle(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){let r=De.CESIUM_3D_TILE_CLASSIFICATION,s=gW(t,r),a=dle(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=GM(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=hle(e,n,e._commandList3DTilesPicking))}}function GM(e,t,n){let i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let l=0;l<s;l++){let u=o[l],f=r[l];for(let h=0;h<a;h++){let p=t[h],g=Qe.shallowClone(p);g.count=u,g.offset=f,n.push(g)}}return n}function gW(e,t){let n=Qe.shallowClone(e);n.cull=!1,n.pass=t;let i=t===De.TERRAIN_CLASSIFICATION?Vn.ALWAYS:Vn.EQUAL,o=L6e(i);return n.renderState=Ve.fromCache(o),n}function dle(e,t){let n=Qe.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=Ve.fromCache(N6e),n}var k6e=[];function hle(e,t,n){let i=Ve.fromCache(F6e),o=t[0],r=t[1],s=Qe.shallowClone(o);s.cull=!0,s.pickOnly=!0;let a=Qe.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;let l=k6e;return l.length=0,l.push(s,a),GM(e,l,n)}Object.defineProperties(yW.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},batchLengths:{get:function(){return this._runtimePrimitive.batchLengths}},batchOffsets:{get:function(){return this._runtimePrimitive.batchOffsets}},model:{get:function(){return this._model}},classificationType:{get:function(){return this._classificationType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix);let t=this._runtimePrimitive.boundingSphere;this._boundingVolume=le.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}});yW.prototype.pushCommands=function(e,t){let n=e.passes;if(n.render){if(this._useDebugWireframe){t.push.apply(t,this._commandListDebugWireframe);return}if(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrain),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTiles),e.invertClassification&&this._classifies3DTiles){if(this._commandListIgnoreShow.length===0){let o=De.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=gW(this._command,o),s=mle;s.length=0,s.push(r),this._commandListIgnoreShow=GM(this,s,this._commandListIgnoreShow)}t.push.apply(t,this._commandListIgnoreShow)}}return n.pick&&(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrainPicking),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTilesPicking)),t};var jM=yW;function Rz(e){e=e??W.EMPTY_OBJECT;let t=e.command,n=e.primitiveRenderResources;T.typeOf.object("options.command",t),T.typeOf.object("options.primitiveRenderResources",n);let i=n.model;this._model=i;let o=n.runtimePrimitive;this._runtimePrimitive=o;let r=t.pass===De.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,l=n.hasSilhouette,u=!r&&!l,f=n.hasSkipLevelOfDetail&&!r,h=l;this._command=t,this._modelMatrix=B.clone(t.modelMatrix),this._boundingVolume=le.clone(t.boundingVolume),this._modelMatrix2D=new B,this._boundingVolume2D=new le,this._modelMatrix2DDirty=!1,this._backFaceCulling=t.renderState.cull.enabled,this._cullFace=t.renderState.cull.face,this._shadows=i.shadows,this._debugShowBoundingVolume=t.debugShowBoundingVolume,this._usesBackFaceCulling=a,this._needsTranslucentCommand=u,this._needsSkipLevelOfDetailCommands=f,this._needsSilhouetteCommands=h,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,U6e(this)}function b_(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=e.is2D??!1,this.derivedCommand2D=void 0}b_.clone=function(e){return new b_({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function U6e(e){let t=e._command;t.modelMatrix=e._modelMatrix,t.boundingVolume=e._boundingVolume;let n=e._model,i=e._usesBackFaceCulling,o=e._derivedCommands;e._originalCommand=new b_({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new b_({command:q6e(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new b_({command:Q6e(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new b_({command:J6e(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new b_({command:Y6e(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new b_({command:X6e(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(Rz.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},model:{get:function(){return this._model}},primitiveType:{get:function(){return this._command.primitiveType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=le.transform(this.runtimePrimitive.boundingSphere,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},shadows:{get:function(){return this._shadows},set:function(e){this._shadows=e,z6e(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,H6e(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,G6e(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,j6e(this))}}});function V6e(e,t){let n=e._modelMatrix;e._modelMatrix2D=B.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=O.sign(n[13])*2*O.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=le.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function z6e(e){let t=e.shadows,n=xn.castShadows(t),i=xn.receiveShadows(t),o=e._derivedCommands;for(let r=0;r<o.length;++r){let s=o[r];if(s.updateShadows){let a=s.command;a.castShadows=n,a.receiveShadows=i}}}function H6e(e){let t=e.backFaceCulling,n=e._derivedCommands;for(let i=0;i<n.length;++i){let o=n[i];if(o.updateBackFaceCulling){let r=o.command,s=je(r.renderState,!0);s.cull.enabled=t,r.renderState=Ve.fromCache(s)}}}function G6e(e){let t=e.cullFace,n=e._derivedCommands;for(let i=0;i<n.length;++i){let o=n[i];if(o.updateCullFace){let r=o.command,s=je(r.renderState,!0);s.cull.face=t,r.renderState=Ve.fromCache(s)}}}function j6e(e){let t=e.debugShowBoundingVolume,n=e._derivedCommands;for(let i=0;i<n.length;++i){let o=n[i];if(o.updateDebugShowBoundingVolume){let r=o.command;r.debugShowBoundingVolume=t}}}Rz.prototype.pushCommands=function(e,t){let n=ple(this,e);n&&!this._has2DCommands&&(W6e(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(V6e(this,e),this._modelMatrix2DDirty=!1);let i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&c(i)&&(i!==ch.ALL_OPAQUE&&bE(t,this._translucentCommand,n),i===ch.ALL_TRANSLUCENT))){if(this._needsSkipLevelOfDetailCommands){let{tileset:o,tile:r}=this._model.content;if(o.hasMixedContent){r._finalResolution||bE(o._backfaceCommands,this._skipLodBackfaceCommand,n),K6e(this,r,n),bE(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){bE(t,this._silhouetteModelCommand,n);return}return bE(t,this._originalCommand,n),t}};Rz.prototype.pushSilhouetteCommands=function(e,t){let n=ple(this,e);return bE(t,this._silhouetteColorCommand,n),t};function bE(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function ple(e,t){if(t.mode!==oe.SCENE2D||e.model._projectTo2D)return!1;let i=e.model.sceneGraph._boundingSphere2D,o=i.center.y-i.radius,r=i.center.y+i.radius,s=t.mapProjection.ellipsoid.maximumRadius*O.PI;return o<s&&r>s||o<-s&&r>-s}function yE(e,t){if(!c(t))return;let n=b_.clone(t),i=Qe.shallowClone(t.command);return i.modelMatrix=e._modelMatrix2D,i.boundingVolume=e._boundingVolume2D,n.command=i,n.updateShadows=!1,n.is2D=!0,t.derivedCommand2D=n,e._derivedCommands.push(n),n}function W6e(e){yE(e,e._originalCommand),yE(e,e._translucentCommand),yE(e,e._skipLodBackfaceCommand),yE(e,e._skipLodStencilCommand),yE(e,e._silhouetteModelCommand),yE(e,e._silhouetteColorCommand)}function q6e(e){let t=Qe.shallowClone(e);t.pass=De.TRANSLUCENT;let n=je(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=ln.ALPHA_BLEND,t.renderState=Ve.fromCache(n),t}function Y6e(e,t){let n=t._silhouetteId%255,i=Qe.shallowClone(e),o=je(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:ne.ALWAYS,backFunction:ne.ALWAYS,reference:n,mask:-1,frontOperation:{fail:ne.KEEP,zFail:ne.KEEP,zPass:ne.REPLACE},backOperation:{fail:ne.KEEP,zFail:ne.KEEP,zPass:ne.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=Ve.fromCache(o),i}function X6e(e,t){let n=t._silhouetteId%255,i=Qe.shallowClone(e),o=je(e.renderState,!0);o.cull.enabled=!1,(e.pass===De.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=De.TRANSLUCENT,o.depthMask=!1,o.blending=ln.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:ne.NOTEQUAL,backFunction:ne.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:ne.KEEP,zFail:ne.KEEP,zPass:ne.KEEP},backOperation:{fail:ne.KEEP,zFail:ne.KEEP,zPass:ne.KEEP}};let s=je(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=Ve.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function K6e(e,t,n){let i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=$6e(o);if(r!==s){let a=Z6e(r),l=je(o.renderState,!0);l.stencilTest.reference=a,o.renderState=Ve.fromCache(l),n&&(i.derivedCommand2D.renderState=l)}}function $6e(e){return(e.renderState.stencilTest.reference&kt.SKIP_LOD_MASK)>>>kt.SKIP_LOD_BIT_SHIFT}function Z6e(e){return kt.CESIUM_3D_TILE_MASK|e<<kt.SKIP_LOD_BIT_SHIFT}function Q6e(e){let t=Qe.shallowClone(e),n=je(e.renderState,!0);n.cull.enabled=!0,n.cull.face=xi.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};let i=je(t.uniformMap),o=new H(5,5);return i.u_polygonOffset=function(){return o},t.renderState=Ve.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function J6e(e){let t=Qe.shallowClone(e),n=je(e.renderState,!0),{stencilTest:i}=n;return i.enabled=!0,i.mask=kt.SKIP_LOD_MASK,i.reference=kt.CESIUM_3D_TILE_MASK,i.frontFunction=Vn.GREATER_OR_EQUAL,i.frontOperation.zPass=ft.REPLACE,i.backFunction=Vn.GREATER_OR_EQUAL,i.backOperation.zPass=ft.REPLACE,n.stencilMask=kt.CESIUM_3D_TILE_MASK|kt.SKIP_LOD_MASK,t.renderState=Ve.fromCache(n),t}var WM=Rz;var qM=`precision highp float;
czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {
czm_modelVertexOutput vsOutput;
vsOutput.positionMC = positionMC;
vsOutput.pointSize = 1.0;
return vsOutput;
}
void main()
{
ProcessedAttributes attributes;
initializeAttributes(attributes);
#ifdef USE_DEQUANTIZATION
dequantizationStage(attributes);
#endif
#ifdef HAS_MORPH_TARGETS
morphTargetsStage(attributes);
#endif
#ifdef HAS_SKINNING
skinningStage(attributes);
#endif
#ifdef HAS_PRIMITIVE_OUTLINE
primitiveOutlineStage();
#endif
#ifdef HAS_BITANGENTS
attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);
#endif
FeatureIds featureIds;
featureIdStage(featureIds, attributes);
#ifdef HAS_SELECTED_FEATURE_ID
SelectedFeature feature;
selectedFeatureIdStage(feature, featureIds);
cpuStylingStage(attributes.positionMC, feature);
#endif
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
mat4 modelView = czm_modelView3D;
mat3 normal = czm_normal3D;
#else
mat4 modelView = czm_modelView;
mat3 normal = czm_normal;
#endif
#ifdef HAS_INSTANCING
#ifdef USE_LEGACY_INSTANCING
mat4 instanceModelView;
mat3 instanceModelViewInverseTranspose;
legacyInstancingStage(attributes, instanceModelView, instanceModelViewInverseTranspose);
modelView = instanceModelView;
normal = instanceModelViewInverseTranspose;
#else
instancingStage(attributes);
#endif
#ifdef USE_PICKING
v_pickColor = a_pickColor;
#endif
#endif
Metadata metadata;
MetadataClass metadataClass;
MetadataStatistics metadataStatistics;
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
#ifdef HAS_VERTICAL_EXAGGERATION
verticalExaggerationStage(attributes);
#endif
#ifdef HAS_CUSTOM_VERTEX_SHADER
czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);
#endif
vec4 positionClip = geometryStage(attributes, modelView, normal);
#ifdef HAS_ATMOSPHERE
atmosphereStage(attributes);
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
modelClippingPolygonsStage(attributes);
#endif
#ifdef HAS_SILHOUETTE
silhouetteStage(attributes, positionClip);
#endif
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
float show = pointCloudShowStylingStage(attributes, metadata);
#else
float show = 1.0;
#endif
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
show *= pointCloudBackFaceCullingStage();
#endif
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
v_pointCloudColor = pointCloudColorStylingStage(attributes, metadata);
#endif
#ifdef PRIMITIVE_TYPE_POINTS
#ifdef HAS_CUSTOM_VERTEX_SHADER
gl_PointSize = vsOutput.pointSize;
#elif defined(HAS_POINT_CLOUD_POINT_SIZE_STYLE) || defined(HAS_POINT_CLOUD_ATTENUATION)
gl_PointSize = pointCloudPointSizeStylingStage(attributes, metadata);
#else
gl_PointSize = 1.0;
#endif
gl_PointSize *= show;
#endif
gl_Position = positionClip;
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
v_pointCloudShow = show;
#endif
}
`;var YM=`precision highp float;
czm_modelMaterial defaultModelMaterial()
{
czm_modelMaterial material;
material.diffuse = vec3(0.0);
material.specular = vec3(1.0);
material.roughness = 1.0;
material.occlusion = 1.0;
material.normalEC = vec3(0.0, 0.0, 1.0);
material.emissive = vec3(0.0);
material.alpha = 1.0;
return material;
}
vec4 handleAlpha(vec3 color, float alpha)
{
#ifdef ALPHA_MODE_MASK
if (alpha < u_alphaCutoff) {
discard;
}
#endif
return vec4(color, alpha);
}
SelectedFeature selectedFeature;
void main()
{
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
if (v_pointCloudShow == 0.0)
{
discard;
}
#endif
#ifdef HAS_MODEL_SPLITTER
modelSplitterStage();
#endif
czm_modelMaterial material = defaultModelMaterial();
ProcessedAttributes attributes;
geometryStage(attributes);
FeatureIds featureIds;
featureIdStage(featureIds, attributes);
Metadata metadata;
MetadataClass metadataClass;
MetadataStatistics metadataStatistics;
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
#ifndef METADATA_PICKING_ENABLED
#ifdef HAS_SELECTED_FEATURE_ID
selectedFeatureIdStage(selectedFeature, featureIds);
#endif
#ifndef CUSTOM_SHADER_REPLACE_MATERIAL
materialStage(material, attributes, selectedFeature);
#endif
#ifdef HAS_CUSTOM_FRAGMENT_SHADER
customShaderStage(material, attributes, featureIds, metadata, metadataClass, metadataStatistics);
#endif
lightingStage(material, attributes);
#ifdef HAS_SELECTED_FEATURE_ID
cpuStylingStage(material, selectedFeature);
#endif
#ifdef HAS_MODEL_COLOR
modelColorStage(material);
#endif
#ifdef HAS_PRIMITIVE_OUTLINE
primitiveOutlineStage(material);
#endif
vec4 color = handleAlpha(material.diffuse, material.alpha);
#else
vec4 metadataValues = vec4(0.0, 0.0, 0.0, 0.0);
metadataPickingStage(metadata, metadataClass, metadataValues);
vec4 color = metadataValues;
#endif
#ifdef HAS_CLIPPING_PLANES
modelClippingPlanesStage(color);
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
modelClippingPolygonsStage();
#endif
#ifndef METADATA_PICKING_ENABLED
#if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
silhouetteStage(color);
#endif
#ifdef HAS_ATMOSPHERE
atmosphereStage(color, attributes);
#endif
#endif
out_FragColor = color;
}
`;function _le(){}_le.buildModelDrawCommand=function(e,t){let n=e.shaderBuilder,i=e9e(e,n,t),o=t9e(e,i,t),r=e.model;return c(r.classificationType)?new jM({primitiveRenderResources:e,command:o}):new WM({primitiveRenderResources:e,command:o})};function e9e(e,t,n){t.addVertexLines(qM),t.addFragmentLines(YM);let i=e.model,o=t.buildShaderProgram(n.context);return i._pipelineResources.push(o),o}function t9e(e,t,n){let i=n9e(e),o=new ti({context:n.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);let s=e.alphaOptions.pass,a=r.sceneGraph,l=n.mode===oe.SCENE3D,u,f;if(!l&&!n.scene3DOnly&&r._projectTo2D)u=B.multiplyTransformation(a._computedModelMatrix,e.runtimeNode.computedTransform,new B),f=e.runtimePrimitive.boundingSphere2D;else{let x=l?a._computedModelMatrix:a._computedModelMatrix2D;u=B.multiplyTransformation(x,e.runtimeNode.computedTransform,new B),f=le.transform(e.boundingSphere,u)}let h=je(Ve.fromCache(e.renderStateOptions),!0);h.cull.face=$t.getCullFace(u,e.primitiveType),h=Ve.fromCache(h);let p=c(r.classificationType),g=p?!1:xn.castShadows(r.shadows),m=p?!1:xn.receiveShadows(r.shadows),y=p?void 0:e.pickId;return new Qe({boundingVolume:f,modelMatrix:u,uniformMap:e.uniformMap,renderState:h,vertexArray:o,shaderProgram:t,cull:r.cull,pass:s,count:e.count,owner:r,pickId:y,pickMetadataAllowed:!0,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:g,receiveShadows:m})}function n9e(e){let t=e.wireframeIndexBuffer;if(c(t))return t;let n=e.indices;if(c(n)){if(!c(n.buffer))throw new E("Indices must be provided as a Buffer");return n.buffer}}var XM=_le;function Iu(e){e=e??W.EMPTY_OBJECT;let t=e.modelComponents;T.typeOf.object("options.model",e.model),T.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=B.clone(B.IDENTITY),this._computedModelMatrix2D=B.clone(B.IDENTITY),this._axisCorrectionMatrix=$t.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new B),this._runtimeArticulations={},i9e(this)}Object.defineProperties(Iu.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});function i9e(e){let t=e._components,n=t.scene,o=e._model.modelMatrix;gle(e,o);let r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let A=0;A<s;A++){let C=r[A],S=new OR({articulation:C,sceneGraph:e}),v=S.name;a[v]=S}let l=t.nodes,u=l.length;e._runtimeNodes=new Array(u);let h=n.nodes.length,p=B.IDENTITY;for(let A=0;A<h;A++){let C=n.nodes[A],S=yle(e,C,p);e._rootNodes.push(S)}let g=t.skins,m=e._runtimeSkins,y=g.length;for(let A=0;A<y;A++){let C=g[A];m.push(new RM({skin:C,sceneGraph:e}))}let b=e._skinnedNodes,x=b.length;for(let A=0;A<x;A++){let C=b[A],S=e._runtimeNodes[C],P=l[C].skin.index;S._runtimeSkin=m[P],S.updateJointMatrices()}e.applyArticulations()}function gle(e,t){let n=e._components,i=e._model;e._computedModelMatrix=B.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=B.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=B.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}var o9e=new d;function r9e(e,t){let n=e._computedModelMatrix,i=B.getTranslation(n,o9e);if(!d.equals(i,d.ZERO))e._computedModelMatrix2D=Ot.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{let o=e.boundingSphere.center,r=Ot.ellipsoidTo2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=B.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=le.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function yle(e,t,n){let i=[],o=$t.getNodeTransform(t),r=t.children.length;for(let f=0;f<r;f++){let h=t.children[f],p=B.multiplyTransformation(n,o,new B),g=yle(e,h,p);i.push(g)}let s=new qR({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let f=0;f<a;f++)s.runtimePrimitives.push(new OM({primitive:t.primitives[f],node:t,model:e._model}));let l=t.index;e._runtimeNodes[l]=s,c(t.skin)&&e._skinnedNodes.push(l);let u=t.name;if(c(u)){let f=e._model,h=new kR(f,s);f._nodesByName[u]=h}return l}var s9e=new d,a9e=new d,c9e=new d,l9e=new d;Iu.prototype.buildDrawCommands=function(e){let t=this._model,n=new LM(t);t.statistics.clear(),this.configurePipeline(e);let i=this.modelPipelineStages,o,r,s;for(o=0;o<i.length;o++)i[o].process(n,t,e);let a=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,s9e),l=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,a9e);for(o=0;o<this._runtimeNodes.length;o++){let u=this._runtimeNodes[o];if(!c(u))continue;u.configurePipeline();let f=u.pipelineStages,h=new VM(n,u);for(r=0;r<f.length;r++)f[r].process(h,u.node,e);let p=u.computedTransform;for(r=0;r<u.runtimePrimitives.length;r++){let g=u.runtimePrimitives[r];g.configurePipeline(e);let m=g.pipelineStages,y=new HM(h,g);for(s=0;s<m.length;s++)m[s].process(y,g.primitive,e);g.boundingSphere=le.clone(y.boundingSphere,new le);let b=B.multiplyByPoint(p,y.positionMin,c9e),x=B.multiplyByPoint(p,y.positionMax,l9e);d.minimumByComponent(a,b,a),d.minimumByComponent(a,x,a),d.maximumByComponent(l,x,l),d.maximumByComponent(l,b,l);let A=XM.buildModelDrawCommand(y,e);g.drawCommand=A}}this._boundingSphere=le.fromCornerPoints(a,l,new le),this._boundingSphere=le.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=le.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=le.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale};Iu.prototype.configurePipeline=function(e){let t=this.modelPipelineStages;t.length=0;let n=this._model,i=e.fog.enabled&&e.fog.renderable;c(n.color)&&t.push(Ry),!c(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(PR),n.isClippingEnabled()&&t.push(LR),n.isClippingPolygonsEnabled()&&t.push(BR),n.hasSilhouette(e)&&t.push(BM),c(n.splitDirection)&&n.splitDirection!==Vr.NONE&&t.push(UM),pr.is3DTiles(n.type)&&t.push(ER),i&&t.push(vR))};Iu.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){let r=this._runtimeNodes[n];if(!c(r))continue;for(i=0;i<r.updateStages.length;i++)r.updateStages[i].update(r,this,e);let s=e.mode!==oe.SCENE3D&&this._model._projectTo2D;for(t&&!s&&this.updateJointMatrices(),i=0;i<r.runtimePrimitives.length;i++){let a=r.runtimePrimitives[i];for(o=0;o<a.updateStages.length;o++)a.updateStages[o].update(a,this)}}};Iu.prototype.updateModelMatrix=function(e,t){gle(this,e),t.mode!==oe.SCENE3D&&r9e(this,t);let n=this._rootNodes;for(let i=0;i<n.length;i++){let o=this._runtimeNodes[n[i]];o._transformDirty=!0}};Iu.prototype.updateJointMatrices=function(){let e=this._skinnedNodes,t=e.length;for(let n=0;n<t;n++){let i=e[n];this._runtimeNodes[i].updateJointMatrices()}};function ble(e,t,n,i,o){if(n&&!t.show)return;let r=t.children.length;for(let l=0;l<r;l++){let u=t.getChild(l);ble(e,u,n,i,o)}let s=t.runtimePrimitives,a=s.length;for(let l=0;l<a;l++){let u=s[l];i(u,o)}}function Mz(e,t,n,i){let o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){let a=o[s],l=e._runtimeNodes[a];ble(e,l,t,n,i)}}var u9e={backFaceCulling:void 0};Iu.prototype.updateBackFaceCulling=function(e){let t=u9e;t.backFaceCulling=e,Mz(this,!1,f9e,t)};function f9e(e,t){let n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}var d9e={shadowMode:void 0};Iu.prototype.updateShadows=function(e){let t=d9e;t.shadowMode=e,Mz(this,!1,h9e,t)};function h9e(e,t){let n=e.drawCommand;n.shadows=t.shadowMode}var m9e={debugShowBoundingVolume:void 0};Iu.prototype.updateShowBoundingVolume=function(e){let t=m9e;t.debugShowBoundingVolume=e,Mz(this,!1,p9e,t)};function p9e(e,t){let n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}var xle=[],_9e={frameState:void 0,hasSilhouette:void 0};Iu.prototype.pushDrawCommands=function(e){let t=xle;t.length=0;let n=_9e;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,Mz(this,!0,g9e,n),e.commandList.push.apply(e.commandList,t)};function g9e(e,t){let n=t.frameState,i=t.hasSilhouette,o=n.passes,r=xle,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}Iu.prototype.setArticulationStage=function(e,t){let n=e.split(" ");if(n.length!==2)return;let i=n[0],o=n[1],r=this._runtimeArticulations[i];c(r)&&r.setArticulationStage(o,t)};Iu.prototype.applyArticulations=function(){let e=this._runtimeArticulations;for(let t in e)e.hasOwnProperty(t)&&e[t].apply()};var KM=Iu;function Fy(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdByteLengths={},this._batchTextureIdMap=new Et}Object.defineProperties(Fy.prototype,{batchTexturesByteLength:{get:function(){let e=this._batchTextureIdMap.length,t=this._batchTextureIdMap.values,n=0;for(let i=0;i<e;i++)n+=t[i].byteLength;return n}}});Fy.prototype.clear=function(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdByteLengths={},this._batchTextureIdMap.removeAll()};Fy.prototype.addBuffer=function(e,t){if(T.typeOf.object("buffer",e),T.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){let n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};Fy.prototype.addTexture=function(e){T.typeOf.object("texture",e),this._textureIdByteLengths.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes,this._textureIdByteLengths[e._id]=e.sizeInBytes)};Fy.prototype.getTextureIds=function(){return Object.keys(this._textureIdByteLengths)};Fy.prototype.getTextureByteLengthById=function(e){return this._textureIdByteLengths[e]};Fy.prototype.addBatchTexture=function(e){T.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};var $M=Fy;var Ele=Zo(AU(),1);var Tle={},Ox=Uint32Array.BYTES_PER_ELEMENT;Tle.parse=function(e,t){t=t??0,T.defined("arrayBuffer",e);let n=new Uint8Array(e),i=new DataView(e);t+=Ox;let o=i.getUint32(t,!0);if(o!==1)throw new ae(`Only Point Cloud tile version 1 is supported.  Version ${o} is not.`);t+=Ox,t+=Ox;let r=i.getUint32(t,!0);if(r===0)throw new ae("Feature table must have a byte length greater than zero");t+=Ox;let s=i.getUint32(t,!0);t+=Ox;let a=i.getUint32(t,!0);t+=Ox;let l=i.getUint32(t,!0);t+=Ox;let u=ir(n,t,r);t+=r;let f=new Uint8Array(e,t,s);t+=s;let h,p;a>0&&(h=ir(n,t,a),t+=a,l>0&&(p=new Uint8Array(e,t,l),t+=l));let g=new sh(u,f),m=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=m,!c(m))throw new ae("Feature table global property: POINTS_LENGTH must be defined");let y=g.getGlobalProperty("RTC_CENTER",$.FLOAT,3);c(y)&&(y=d.unpack(y));let b=y9e(g,h);if(b.rtcCenter=y,b.pointsLength=m,!b.hasPositions){let x=b9e(g);b.positions=x,b.hasPositions=b.hasPositions||c(x)}if(!b.hasPositions)throw new ae("Either POSITION or POSITION_QUANTIZED must be defined.");if(!b.hasNormals){let x=T9e(g);b.normals=x,b.hasNormals=b.hasNormals||c(x)}if(!b.hasColors){let x=x9e(g);b.colors=x,b.hasColors=b.hasColors||c(x),b.hasConstantColor=c(b.constantColor),b.isTranslucent=c(x)&&x.isTranslucent}if(!b.hasBatchIds){let x=A9e(g);b.batchIds=x,b.hasBatchIds=b.hasBatchIds||c(x)}if(b.hasBatchIds){let x=g.getGlobalProperty("BATCH_LENGTH");if(!c(x))throw new ae("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");b.batchLength=x}return c(p)&&(p=new Uint8Array(p),b.batchTableJson=h,b.batchTableBinary=p),b};function y9e(e,t){let n=e.json,i,o,r,s=c(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=c(t)&&c(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;c(a)&&(r=a.properties);let l,u,f,h,p;if(c(s)){o=s.properties;let m=s.byteOffset,y=s.byteLength;if(!c(o)||!c(m)||!c(y))throw new ae("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(m,m+y),l=c(o.POSITION),u=c(o.RGB)||c(o.RGBA),f=c(o.NORMAL),h=c(o.BATCH_ID),p=c(o.RGBA)}let g;return c(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:xt(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:l,hasColors:u,isTranslucent:p,hasNormals:f,hasBatchIds:h}}function b9e(e){let t=e.json,n;if(c(t.POSITION))return n=e.getPropertyArray("POSITION",$.FLOAT,3),{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!1,componentDatatype:$.FLOAT,type:nn.VEC3};if(c(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",$.UNSIGNED_SHORT,3);let i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",$.FLOAT,3);if(!c(i))throw new ae("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let o=65535,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",$.FLOAT,3);if(!c(r))throw new ae("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!0,componentDatatype:$.FLOAT,type:nn.VEC3,quantizedRange:o,quantizedVolumeOffset:d.unpack(r),quantizedVolumeScale:d.unpack(i),quantizedComponentDatatype:$.UNSIGNED_SHORT,quantizedType:nn.VEC3}}}function x9e(e){let t=e.json,n;if(c(t.RGBA))return n=e.getPropertyArray("RGBA",$.UNSIGNED_BYTE,4),{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:$.UNSIGNED_BYTE,type:nn.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(c(t.RGB))return n=e.getPropertyArray("RGB",$.UNSIGNED_BYTE,3),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:$.UNSIGNED_BYTE,type:nn.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(c(t.RGB565))return n=e.getPropertyArray("RGB565",$.UNSIGNED_SHORT,1),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:$.FLOAT,type:nn.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(c(t.CONSTANT_RGBA)){let i=e.getGlobalProperty("CONSTANT_RGBA",$.UNSIGNED_BYTE,4),o=i[3],r=G.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,constantColor:r,componentDatatype:$.FLOAT,type:nn.VEC4,isQuantized:!1,isTranslucent:s}}}function T9e(e){let t=e.json,n;if(c(t.NORMAL))return n=e.getPropertyArray("NORMAL",$.FLOAT,3),{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:$.FLOAT,type:nn.VEC3};if(c(t.NORMAL_OCT16P))return n=e.getPropertyArray("NORMAL_OCT16P",$.UNSIGNED_BYTE,2),{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<8)-1,quantizedType:nn.VEC2,quantizedComponentDatatype:$.UNSIGNED_BYTE,componentDatatype:$.FLOAT,type:nn.VEC3}}function A9e(e){let t=e.json;if(c(t.BATCH_ID)){let n=e.getPropertyArray("BATCH_ID",$.UNSIGNED_SHORT,1);return{name:ht.FEATURE_ID,semantic:ht.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:$.fromTypedArray(n),type:nn.SCALAR}}}var Rx=Tle;var C9e=Tn.Components,E9e=Tn.Scene,S9e=Tn.Node,w9e=Tn.Primitive,v9e=Tn.Attribute,Ale=Tn.Quantization,D9e=Tn.FeatureIdAttribute,P9e=Tn.Material,I9e=Tn.MetallicRoughness;function By(e){e=e??W.EMPTY_OBJECT;let t=e.arrayBuffer,n=e.byteOffset??0;T.typeOf.object("options.arrayBuffer",t),this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=e.loadAttributesFor2D??!1,this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=void 0,this._error=void 0,this._state=gt.UNLOADED,this._buffers=[],this._components=void 0,this._transform=B.IDENTITY}c(Object.create)&&(By.prototype=Object.create($i.prototype),By.prototype.constructor=By);Object.defineProperties(By.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});By.prototype.load=function(){if(c(this._promise))return this._promise;this._parsedContent=Rx.parse(this._arrayBuffer,this._byteOffset),this._state=gt.PROCESSING,this._promise=Promise.resolve(this)};By.prototype.process=function(e){if(c(this._error)){let t=this._error;throw this._error=void 0,t}if(this._state===gt.READY)return!0;if(this._state===gt.PROCESSING){if(c(this._decodePromise))return!1;this._decodePromise=O9e(this,e.context)}return!1};function O9e(e,t){let i=e._parsedContent.draco,o;if(c(i)?o=n_.decodePointCloud(i,t):o=Promise.resolve(),!!c(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return c(r)&&R9e(e,i,r),G9e(e,t),e._state=gt.READY,e}).catch(function(r){e.unload(),e._state=gt.FAILED;let s="Failed to load Draco pnts";e._error=e.getError(s,r)})}function R9e(e,t,n){e._state=gt.READY;let i=e._parsedContent,o;if(c(n.POSITION)){if(o={name:"POSITION",semantic:ht.POSITION,typedArray:n.POSITION.array,componentDatatype:$.FLOAT,type:nn.VEC3,isQuantized:!1},c(n.POSITION.data.quantization)){let a=n.POSITION.data.quantization,l=a.range,u=d.fromElements(l,l,l),f=d.unpack(a.minValues),h=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=h,o.quantizedVolumeOffset=f,o.quantizedVolumeScale=u,o.quantizedComponentDatatype=h<=255?$.UNSIGNED_BYTE:$.UNSIGNED_SHORT,o.quantizedType=nn.VEC3}i.positions=o}if(c(n.NORMAL)){if(o={name:"NORMAL",semantic:ht.NORMAL,typedArray:n.NORMAL.array,componentDatatype:$.FLOAT,type:nn.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},c(n.NORMAL.data.quantization)){let a=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=a,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=$.UNSIGNED_BYTE,o.quantizedType=nn.VEC2}i.normals=o}if(c(n.RGBA)?i.colors={name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:$.UNSIGNED_BYTE,type:nn.VEC4,normalized:!0,isTranslucent:!0}:c(n.RGB)&&(i.colors={name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:$.UNSIGNED_BYTE,type:nn.VEC3,normalized:!0,isTranslucent:!1}),c(n.BATCH_ID)){let a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:ht.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:$.fromTypedArray(a),type:nn.SCALAR}}let r=i.batchTableJson,s=t.batchTableProperties;for(let a in s)if(s.hasOwnProperty(a)){let l=n[a];c(r)||(r={}),i.hasDracoBatchTable=!0;let u=l.data;r[a]={byteOffset:u.byteOffset,type:M9e(u.componentsPerAttribute),componentType:L9e(u.componentDatatype),typedArray:l.array}}i.batchTableJson=r}function M9e(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4";default:throw new E("componentsPerAttribute must be a number from 1-4")}}function L9e(e){switch(e){case ne.BYTE:return"BYTE";case ne.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case ne.SHORT:return"SHORT";case ne.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case ne.INT:return"INT";case ne.UNSIGNED_INT:return"UNSIGNED_INT";case ne.DOUBLE:return"DOUBLE";case ne.FLOAT:return"FLOAT";default:throw new E("value is not a valid WebGL constant")}}function ZM(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new Ale,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new Ale;let a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=d.ZERO;let l=t.quantizedVolumeScale;o.quantizedVolumeDimensions=l,o.quantizedVolumeStepSize=d.divideByScalar(l,a,new d),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}let r=new v9e;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=t.normalized??!1,r.min=t.min,r.max=t.max,r.quantization=o,t.isRGB565&&(i=Ln.decodeRGB565(i)),c(t.constantColor)){let a=new Array(4);r.constant=G.pack(t.constantColor,a)}else{let a=yt.createVertexBuffer({typedArray:i,context:n,usage:Be.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}let s=e._loadAttributesFor2D;return r.semantic===ht.POSITION&&s&&(r.typedArray=i),r}var Cle,Lz;function N9e(e){if(!c(Lz)){Cle=new Ele.default(0),Lz=new Array(e);for(let t=0;t<e;++t)Lz[t]=Cle.random()}return Lz}var F9e=new d,B9e=new d,k9e=new d;function U9e(e){let t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=N9e(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE,l=d.fromElements(s,s,s,F9e),u=d.fromElements(a,a,a,B9e),f,h,p;if(e.isQuantized)l=d.ZERO,u=e.quantizedVolumeScale;else for(f=0;f<o;++f)h=Math.floor(r[f]*i),p=d.unpack(t,h*3,k9e),d.minimumByComponent(l,p,l),d.maximumByComponent(u,p,u);e.min=d.clone(l),e.max=d.clone(u)}var V9e={name:ht.COLOR,semantic:ht.COLOR,setIndex:0,constantColor:G.DARKGRAY,componentDatatype:$.FLOAT,type:nn.VEC4,isQuantized:!1,isTranslucent:!1};function z9e(e,t,n){let i=[],o,r=t.positions;return c(r)&&(U9e(r),o=ZM(e,r,n),o.count=t.pointsLength,i.push(o)),c(t.normals)&&(o=ZM(e,t.normals,n),i.push(o)),c(t.colors)?(o=ZM(e,t.colors,n),i.push(o)):(o=ZM(e,V9e,n),i.push(o)),c(t.batchIds)&&(o=ZM(e,t.batchIds,n),i.push(o)),i}function H9e(e,t){let n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!c(e.batchIds);return c(o)||e.hasDracoBatchTable?m_({count:n??i,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t}):new Ys({schema:{},propertyTables:[]})}function G9e(e,t){let n=e._parsedContent,i=new I9e;i.metallicFactor=0,i.roughnessFactor=.9;let o=new P9e;o.metallicRoughness=i;let r=n.colors;c(r)&&r.isTranslucent&&(o.alphaMode=Em.BLEND);let s=!c(n.normals);o.unlit=s;let a=new w9e;if(a.attributes=z9e(e,n,t),a.primitiveType=Me.POINTS,a.material=o,c(n.batchIds)){let g=new D9e;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}let l=new S9e;l.index=0,l.primitives=[a];let u=new E9e;u.nodes=[l],u.upAxis=Fo.Z,u.forwardAxis=Fo.X;let f=new C9e;f.scene=u,f.nodes=[l];let h=[];f.structuralMetadata=H9e(n,h),h.length>0&&j9e(e,a,h,t),c(n.rtcCenter)&&(f.transform=B.multiplyByTranslation(f.transform,n.rtcCenter,f.transform));let p=n.positions;c(p)&&p.isQuantized&&(f.transform=B.multiplyByTranslation(f.transform,p.quantizedVolumeOffset,f.transform)),e._components=f,e._parsedContent=void 0,e._arrayBuffer=void 0}function j9e(e,t,n,i){let o=t.attributes,r=n.length;for(let s=0;s<r;s++){let a=n[s],l=yt.createVertexBuffer({typedArray:a.typedArray,context:i,usage:Be.STATIC_DRAW});l.vertexArrayDestroyable=!1,e._buffers.push(l),a.buffer=l,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}By.prototype.unload=function(){let e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0,this._arrayBuffer=void 0};var QM=By;var W9e=new d,q9e=new d,Y9e=new d,X9e=new B,K9e=new B,$9e=new B,Z9e=new he,Q9e=new le;function xE(e,t,n,i,o,r,s){if(T.typeOf.object("model",e),T.typeOf.object("ray",t),T.typeOf.object("frameState",n),!e._ready||n.mode===oe.MORPHING)return;let a=Number.MAX_VALUE,l=e.sceneGraph,u=l._runtimeNodes;for(let f=0;f<u.length;f++){let h=u[f],p=h.node,g=B.clone(h.computedTransform,X9e),m=B.clone(l.computedModelMatrix,K9e),y=p.instances;c(y)&&y.transformInWorldSpace&&(m=B.multiplyTransformation(e.modelMatrix,l.components.transform,m),g=B.multiplyTransformation(l.axisCorrectionMatrix,h.computedTransform,g));let b=B.multiplyTransformation(m,g,$9e);n.mode!==oe.SCENE3D&&(b=Ot.basisTo2D(n.mapProjection,b,b));let x=[];if(c(y)){let C=y.attributes[0].count,S=y.attributes[0].componentDatatype,v=12,P=h.transformsTypedArray;if(!c(P)){let M=h.instancingTransformsBuffer;c(M)&&n.context.webgl2&&(P=$.createTypedArray(S,C*v),M.getBufferData(P))}if(c(P))for(let M=0;M<C;M++){let R=M*v,L=new B(P[R],P[R+1],P[R+2],P[R+3],P[R+4],P[R+5],P[R+6],P[R+7],P[R+8],P[R+9],P[R+10],P[R+11],0,0,0,1);y.transformInWorldSpace?(B.multiplyTransformation(L,g,L),B.multiplyTransformation(m,L,L)):B.multiplyTransformation(L,b,L),x.push(L)}}x.length===0&&x.push(b);let A=h.runtimePrimitives.length;for(let C=0;C<A;C++){let S=h.runtimePrimitives[C],v=S.primitive;if(c(S.boundingSphere)&&!c(y)){let Y=le.transform(S.boundingSphere,b,Q9e),te=Zn.raySphere(t,Y);if(!c(te))continue}let P=$t.getAttributeBySemantic(v,ht.POSITION),M=P.byteOffset,R=P.byteStride,L=P.count;if(!c(v.indices))continue;let F=v.indices.typedArray;if(!c(F)){let Y=v.indices.buffer,te=v.indices.count,K=v.indices.indexDatatype;c(Y)&&n.context.webgl2&&(K===Fe.UNSIGNED_BYTE?F=new Uint8Array(te):K===Fe.UNSIGNED_SHORT?F=new Uint16Array(te):K===Fe.UNSIGNED_INT&&(F=new Uint32Array(te)),Y.getBufferData(F))}let _=P.typedArray,w=P.componentDatatype,D=P.type,I=P.quantization;c(I)&&(w=P.quantization.componentDatatype,D=P.quantization.type);let N=nn.getNumberOfComponents(D),k=$.getSizeInBytes(w),z=!c(_)&&c(R)&&R!==N*k,V=N,j=0;z&&(V=R/k,j=M/k);let U=L*V;if(!c(_)){let Y=P.buffer;c(Y)&&n.context.webgl2&&(_=$.createTypedArray(w,U),Y.getBufferData(_,z?0:M,0,U)),I&&P.normalized&&(_=Ln.dequantize(_,w,D,L))}if(!c(F)||!c(_))return;r=r??ie.default,i=i??1,o=o??0;let q=F.length;for(let Y=0;Y<q;Y+=3){let te=F[Y],K=F[Y+1],Z=F[Y+2];for(let ee of x){let me=bW(_,te,j,V,I,ee,i,o,r,W9e),Te=bW(_,K,j,V,I,ee,i,o,r,q9e),ue=bW(_,Z,j,V,I,ee,i,o,r,Y9e),ye=Zn.rayTriangleParametric(t,me,Te,ue,e.backFaceCulling??!0);c(ye)&&ye<a&&ye>=0&&(a=ye)}}}}if(a!==Number.MAX_VALUE){if(s=mn.getPoint(t,a,s),n.mode!==oe.SCENE3D){d.fromElements(s.y,s.z,s.x,s);let f=n.mapProjection,h=f.ellipsoid,p=f.unproject(s,Z9e);h.cartographicToCartesian(p,s)}return s}}function bW(e,t,n,i,o,r,s,a,l,u){let f=n+t*i;if(u.x=e[f],u.y=e[f+1],u.z=e[f+2],c(o))if(o.octEncoded){if(u=Ln.octDecodeInRange(u,o.normalizationRange,u),o.octEncodedZXY){let h=u.x;u.x=u.z,u.z=u.y,u.y=h}}else u=d.multiplyComponents(u,o.quantizedVolumeStepSize,u),u=d.add(u,o.quantizedVolumeOffset,u);return u=B.multiplyByPoint(r,u,u),s!==1&&Dr.getPosition(u,l,s,a,u),u}function co(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.loader",e.loader),T.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=e.type??pr.GLTF,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=B.clone(this.modelMatrix),this._scale=e.scale??1,this._minimumPixelSize=e.minimumPixelSize??0,this._maximumScale=e.maximumScale,this._clampedScale=c(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=J.clone(J.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new xR(this),this._clampAnimations=e.clampAnimations??!0,this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=G.clone(e.color),this._colorBlendMode=e.colorBlendMode??bc.HIGHLIGHT,this._colorBlendAmount=e.colorBlendAmount??.5;let t=e.silhouetteColor??G.RED;this._silhouetteColor=G.clone(t),this._silhouetteSize=e.silhouetteSize??0,this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=e.cull??!0,this._opaquePass=e.opaquePass??De.OPAQUE,this._allowPicking=e.allowPicking??!0,this._show=e.show??!0,this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=e.featureIdLabel??"featureId_0";typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=e.instanceFeatureIdLabel??"instanceFeatureId_0";typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._pipelineResources=[],this._modelResources=[],this._pickIds=[],this._boundingSphere=new le,this._initialRadius=void 0,this._heightReference=e.heightReference??We.NONE,this._heightDirty=this._heightReference!==We.NONE,this._removeUpdateHeightCallback=void 0,this._enableVerticalExaggeration=e.enableVerticalExaggeration??!0,this._hasVerticalExaggeration=!1,this._clampedModelMatrix=void 0;let o=e.scene;c(o)&&c(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(()=>{this._heightDirty=!0})),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;let r=new vm(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;let s=e.clippingPlanes;c(s)&&s.owner===void 0?gs.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=B.clone(B.IDENTITY);let a=e.clippingPolygons;c(a)&&a.owner===void 0?th.setOwner(a,this,"_clippingPolygons"):this._clippingPolygons=a,this._clippingPolygonsState=0,this._lightColor=d.clone(e.lightColor),this._imageBasedLighting=c(e.imageBasedLighting)?e.imageBasedLighting:new ex,this._shouldDestroyImageBasedLighting=!c(e.imageBasedLighting),this._environmentMapManager=void 0;let l=new c_(e.environmentMapOptions);c_.setOwner(l,this,"_environmentMapManager"),this._backFaceCulling=e.backFaceCulling??!0,this._backFaceCullingDirty=!1,this._shadows=e.shadows??xn.ENABLED,this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this._enableDebugWireframe=e.enableDebugWireframe??!1,this._enableShowOutline=e.enableShowOutline??!0,this._debugWireframe=e.debugWireframe??!1,this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===pr.GLTF&&dt("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.");let u=e.credit;typeof u=="string"&&(u=new Tt(u)),this._credits=[],this._credit=u,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=e.showCreditsOnScreen??!1,this._showCreditsOnScreenDirty=!0,this._splitDirection=e.splitDirection??Vr.NONE,this._enableShowOutline=e.enableShowOutline??!0,this.showOutline=e.showOutline??!0,this.outlineColor=e.outlineColor??G.BLACK,this._classificationType=e.classificationType,this._statistics=new $M,this._sceneMode=void 0,this._projectTo2D=e.projectTo2D??!1,this._enablePick=e.enablePick??!1,this._fogRenderable=void 0,this._skipLevelOfDetail=!1,this._ignoreCommands=e.ignoreCommands??!1,this._errorEvent=new pe,this._readyEvent=new pe,this._texturesReadyEvent=new pe,this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function xW(e,t){if(e._errorEvent.numberOfListeners>0){e._errorEvent.raiseEvent(t);return}console.log(t)}function J9e(e,t){let n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r<o;r++){let s=i[r],a=new CR({model:e,propertyTable:s});n.push(a)}return n}function eWe(e,t){let n=t._featureIdLabel,i=t._instanceFeatureIdLabel,o,r,s,a;for(o=0;o<e.nodes.length;o++)if(a=e.nodes[o],c(a.instances)&&(s=$t.getFeatureIdsByLabel(a.instances.featureIds,i),c(s)&&c(s.propertyTableId)))return s.propertyTableId;for(o=0;o<e.nodes.length;o++)for(a=e.nodes[o],r=0;r<a.primitives.length;r++){let l=a.primitives[r],u=$t.getFeatureIdsByLabel(l.featureIds,n);if(c(u))return u.propertyTableId}if(t._featureTables.length===1)return 0}function CW(e,t){if(!c(e)&&!c(t))return!1;if(c(e)!==c(t))return!0;let n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}Object.defineProperties(co.prototype,{ready:{get:function(){return this._ready}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},incrementallyLoadTextures:{get:function(){return this._loader.incrementallyLoadTextures??!1}},texturesReadyEvent:{get:function(){return this._texturesReadyEvent}},loader:{get:function(){return this._loader}},statistics:{get:function(){return this._statistics}},activeAnimations:{get:function(){return this._activeAnimations}},clampAnimations:{get:function(){return this._clampAnimations},set:function(e){this._clampAnimations=e}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){T.defined("pointCloudShading",e),e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightDirty=!0),this._heightReference=e}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");this._distanceDisplayCondition=Mt.clone(e,this._distanceDisplayCondition)}},structuralMetadata:{get:function(){return this._sceneGraph.components.structuralMetadata}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},id:{get:function(){return this._id},set:function(e){e!==this._id&&(this._idDirty=!0),this._id=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){this._style=e,this._styleDirty=!0}},color:{get:function(){return this._color},set:function(e){CW(e,this._color)&&this.resetDrawCommands(),this._color=G.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},silhouetteColor:{get:function(){return this._silhouetteColor},set:function(e){if(!G.equals(e,this._silhouetteColor)){let t=CW(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=G.clone(e,this._silhouetteColor)}},silhouetteSize:{get:function(){return this._silhouetteSize},set:function(e){if(e!==this._silhouetteSize){let t=this._silhouetteSize,n=e>0&&t===0||e===0&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");let e=c(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return vle(this,e),this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},debugWireframe:{get:function(){return this._debugWireframe},set:function(e){this._debugWireframe!==e&&this.resetDrawCommands(),this._debugWireframe=e,this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===pr.GLTF&&dt("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltfAsync, otherwise debugWireframe will be ignored.")}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),T.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),T.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(gs.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){e!==this._clippingPolygons&&(th.setOwner(e,this,"_clippingPolygons"),this.resetDrawCommands())}},enableVerticalExaggeration:{get:function(){return this._enableVerticalExaggeration},set:function(e){e!==this._enableVerticalExaggeration&&this.resetDrawCommands(),this._enableVerticalExaggeration=e}},hasVerticalExaggeration:{get:function(){return this._hasVerticalExaggeration}},lightColor:{get:function(){return this._lightColor},set:function(e){c(e)!==c(this._lightColor)&&this.resetDrawCommands(),this._lightColor=d.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){T.typeOf.object("imageBasedLighting",e),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},environmentMapManager:{get:function(){return this._environmentMapManager},set:function(e){T.typeOf.object("environmentMapManager",e),e!==this.environmentMapManager&&(c_.setOwner(e,this,"_environmentMapManager"),this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen!==e&&(this._showCreditsOnScreenDirty=!0),this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}},classificationType:{get:function(){return this._classificationType}},pickIds:{get:function(){return this._pickIds}},styleCommandsNeeded:{get:function(){return this._styleCommandsNeeded}}});co.prototype.getNode=function(e){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return T.typeOf.string("name",e),this._nodesByName[e]};co.prototype.setArticulationStage=function(e,t){if(T.typeOf.number("value",t),!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)};co.prototype.applyArticulations=function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()};co.prototype.getExtension=function(e){if(T.typeOf.string("extensionName",e),!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return this._loader.components.extensions[e]};co.prototype.makeStyleDirty=function(){this._styleDirty=!0};co.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};var tWe=new B,nWe=new J,iWe=new B;co.prototype.update=function(e){let t=!1;try{t=oWe(this,e)}catch(n){if(!this._loader.incrementallyLoadTextures&&n.name==="TextureError")xW(this,n);else{let i=$t.getError("model",this._resource,n);xW(this,i)}}if(rWe(this,e),sWe(this,e),aWe(this,e),!this._resourcesLoaded&&t){this._resourcesLoaded=!0;let n=this._loader.components;if(!c(n)){if(this._loader.isUnloaded())return;let r=$t.getError("model",this._resource,new ae("Failed to load model."));xW(r),this._rejectLoad=this._rejectLoad&&this._rejectLoad(r)}let i=n.structuralMetadata;c(i)&&i.propertyTableCount>0&&J9e(this,i);let o=new KM({model:this,modelComponents:n});this._sceneGraph=o,this._gltfCredits=o.components.asset.credits}if(!(!this._resourcesLoaded||e.mode===oe.MORPHING)){if(cWe(this),lWe(this),uWe(this,e),fWe(this),dWe(this,e),hWe(this,e),mWe(this,e),pWe(this,e),_We(this,e),gWe(this,e),yWe(this,e),this._defaultTexture=e.context.defaultTexture,bWe(this,e),xWe(this,e),TWe(this),AWe(this,e),wWe(this,e),!this._ready){e.afterRender.push(()=>{this._ready=!0,this._readyEvent.raiseEvent(this)});return}this._loader.incrementallyLoadTextures&&!this._texturesLoaded&&this._loader.texturesLoaded&&(this.resetDrawCommands(),this._texturesLoaded=!0,this._texturesReadyEvent.raiseEvent(this)),EWe(this),vWe(this,e),DWe(this),PWe(this,e)}};function oWe(e,t){return!e._resourcesLoaded||e._loader.incrementallyLoadTextures&&!e._texturesLoaded?(t.afterRender.push(()=>!0),e._loader.process(t)):!0}function rWe(e,t){c(e._customShader)&&e._customShader.update(t)}function sWe(e,t){let n=e._environmentMapManager,i=t.passes.pick||t.passes.pickVoxel;e._ready&&n.owner===e&&!i&&(n.position=e._boundingSphere.center,n.shouldUpdate=!c(e._imageBasedLighting.sphericalHarmonicCoefficients)||!c(e._imageBasedLighting.specularEnvironmentMaps),n.update(t),n.shouldRegenerateShaders&&e.resetDrawCommands())}function aWe(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function cWe(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;let t=e._sceneGraph.components,n=t.structuralMetadata;c(n)&&n.propertyTableCount>0&&(e.featureTableId=eWe(t,e),e._styleDirty=!0,e.resetDrawCommands())}function lWe(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function uWe(e,t){let n=e._featureTables,i=n.length,o=!1;for(let r=0;r<i;r++)n[r].update(t),n[r].styleCommandsNeededDirty&&(o=!0);o&&wle(e)}function wle(e){let t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=ch.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function fWe(e){let t=e.pointCloudShading;t.attenuation!==e._attenuation&&(e.resetDrawCommands(),e._attenuation=t.attenuation),t.backFaceCulling!==e._pointCloudBackFaceCulling&&(e.resetDrawCommands(),e._pointCloudBackFaceCulling=t.backFaceCulling)}function dWe(e,t){e._silhouetteDirty&&(Dle(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function hWe(e,t){let n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function mWe(e,t){let n=0;e.isClippingEnabled()&&(e._clippingPlanes.owner===e&&e._clippingPlanes.update(t),n=e._clippingPlanes.clippingPlanesState),n!==e._clippingPlanesState&&(e.resetDrawCommands(),e._clippingPlanesState=n)}function pWe(e,t){let n=0;e.isClippingPolygonsEnabled()&&(e._clippingPolygons.owner===e&&(e._clippingPolygons.update(t),e._clippingPolygons.queueCommands(t)),n=e._clippingPolygons.clippingPolygonsState),n!==e._clippingPolygonsState&&(e.resetDrawCommands(),e._clippingPolygonsState=n)}function _We(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function gWe(e,t){let n=t.fog.enabled&&t.fog.renderable;n!==e._fogRenderable&&(e.resetDrawCommands(),e._fogRenderable=n)}function yWe(e,t){if(e.enableVerticalExaggeration){let n=t.verticalExaggeration!==1;e.hasVerticalExaggeration!==n&&(e.resetDrawCommands(),e._hasVerticalExaggeration=n)}else e.hasVerticalExaggeration&&(e.resetDrawCommands(),e._hasVerticalExaggeration=!1)}function bWe(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function xWe(e,t){if(!B.equals(e.modelMatrix,e._modelMatrix)){if(t.mode!==oe.SCENE3D&&e._projectTo2D)throw new E("Model.modelMatrix cannot be changed in 2D or Columbus View if projectTo2D is true.");e._updateModelMatrix=!0,e._modelMatrix=B.clone(e.modelMatrix,e._modelMatrix)}}var ky=new d,TW=new he;function TWe(e){if(!e._updateModelMatrix&&!e._heightDirty&&e._minimumPixelSize===0)return;c(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);let t=e._scene;if(!c(t)||e.heightReference===We.NONE){if(e.heightReference!==We.NONE)throw new E("Height reference is not supported without a scene.");e._clampedModelMatrix=void 0;return}let n=t.ellipsoid??ie.default,i=e.modelMatrix;ky.x=i[12],ky.y=i[13],ky.z=i[14];let o=n.cartesianToCartographic(ky);c(e._clampedModelMatrix)||(e._clampedModelMatrix=B.clone(i,new B)),e._removeUpdateHeightCallback=t.updateHeight(o,Sle(e,n,o),e.heightReference);let r=t.getHeight(o,e.heightReference);if(c(r)){let s=Sle(e,n,o);he.clone(o,TW),TW.height=r,s(TW)}e._heightDirty=!1,e._updateModelMatrix=!0}function AWe(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;let n=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;vle(e,n),CWe(e,n,t)}function vle(e,t){e._clampedScale=c(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=d.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=le.transform(e._boundingSphere,t,e._boundingSphere)}function CWe(e,t,n){let i=e.scale;if(e.minimumPixelSize!==0&&!e._projectTo2D){let o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);B.getTranslation(t,ky),e._sceneMode!==oe.SCENE3D&&Gi.computeActualEllipsoidPosition(n,ky,ky);let s=e._boundingSphere.radius,a=IWe(ky,s,n),l=1/a;Math.min(l*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=c(e.maximumScale)?Math.min(e.maximumScale,i):i}function EWe(e){if(!e._idDirty)return;e._idDirty=!1;let t=e._id,n=e._pickIds,i=n.length;for(let o=0;o<i;++o)n[o].object.id=t}var SWe=new J(1,0,0,0,0,1,0,-1,0);function wWe(e,t){let n=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=e.referenceMatrix??n,o=t.context,r=nWe,s=tWe;if(s=B.multiply(o.uniformState.view3D,i,s),r=B.getRotation(s,r),r=J.transpose(r,r),e._iblReferenceFrameMatrix=J.multiply(SWe,r,e._iblReferenceFrameMatrix),e.isClippingEnabled()){let a=iWe;a=B.multiply(o.uniformState.view3D,i,a),a=B.multiply(a,e._clippingPlanes.modelMatrix,a),e._clippingPlanesMatrix=B.inverseTranspose(a,e._clippingPlanesMatrix)}}function vWe(e,t){let n=e._sceneGraph;if(e._updateModelMatrix||e._minimumPixelSize!==0){let o=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;n.updateModelMatrix(o,t),e._updateModelMatrix=!1}e._backFaceCullingDirty&&(n.updateBackFaceCulling(e._backFaceCulling),e._backFaceCullingDirty=!1),e._shadowsDirty&&(n.updateShadows(e._shadows),e._shadowsDirty=!1),e._debugShowBoundingVolumeDirty&&(n.updateShowBoundingVolume(e._debugShowBoundingVolume),e._debugShowBoundingVolumeDirty=!1);let i=!1;c(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t)),n.update(t,i),e._userAnimationDirty=!1}function DWe(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1,e._credits.length=0;let t=e._showCreditsOnScreen;if(c(e._credit)){let s=Tt.clone(e._credit);s.showOnScreen=s.showOnScreen||t,e._credits.push(s)}let n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++){let a=Tt.clone(n[s]);a.showOnScreen=a.showOnScreen||t,e._credits.push(a)}let o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++){let a=Tt.clone(o[s]);a.showOnScreen=a.showOnScreen||t,e._credits.push(a)}}function PWe(e,t){let n=RWe(e,t),i=e.isInvisible(),o=e.hasSilhouette(t),r=e._show&&e._computedScale!==0&&n&&(!i||o),s=t.passes,a=s.render||s.pick&&e.allowPicking;r&&!e._ignoreCommands&&a&&(MWe(e,t),e._sceneGraph.pushDrawCommands(t))}var AW=new le;function IWe(e,t,n){return AW.center=e,AW.radius=t,n.camera.getPixelSize(AW,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}var Nz=new d;function Sle(e,t,n){return function(i){e.heightReference===We.CLIP_TO_GROUND?n.height>=i.height&&(i.height=n.height):gC(e.heightReference)&&(i.height+=n.height),t.cartographicToCartesian(i,Nz);let o=e._clampedModelMatrix;B.clone(e.modelMatrix,o),o[12]=Nz.x,o[13]=Nz.y,o[14]=Nz.z,e._heightDirty=!0}}var OWe=new d;function RWe(e,t){let n=e.distanceDisplayCondition;if(!c(n))return!0;let i=n.near*n.near,o=n.far*n.far,r;if(t.mode===oe.SCENE2D){let a=(t.camera.frustum.right-t.camera.frustum.left)*.5;r=a*a}else{let s=B.getTranslation(e.modelMatrix,OWe);Gi.computeActualEllipsoidPosition(t,s,s),r=d.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function MWe(e,t){let n=t.creditDisplay,i=e._credits,o=i.length;for(let r=0;r<o;r++)n.addCreditToNextFrame(i[r])}co.prototype.isTranslucent=function(){let e=this.color;return c(e)&&e.alpha>0&&e.alpha<1};co.prototype.isInvisible=function(){let e=this.color;return c(e)&&e.alpha===0};function Dle(e){return e.context.stencilBuffer}co.prototype.hasSilhouette=function(e){return Dle(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!c(this._classificationType)};co.prototype.hasSkipLevelOfDetail=function(e){if(!pr.is3DTiles(this.type))return!1;let t=e.context.stencilBuffer,n=this._content.tileset;return t&&n.isSkippingLevelOfDetail};co.prototype.isClippingEnabled=function(){let e=this._clippingPlanes;return c(e)&&e.enabled&&e.length!==0};co.prototype.pick=function(e,t,n,i,o){return xE(this,e,t,n,i,o)};co.prototype.isClippingPolygonsEnabled=function(){let e=this._clippingPolygons;return c(e)&&e.enabled&&e.length!==0};co.prototype.isDestroyed=function(){return!1};co.prototype.destroy=function(){let e=this._loader;c(e)&&e.destroy();let t=this._featureTables;if(c(t)){let r=t.length;for(let s=0;s<r;s++)t[s].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),c(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);let n=this._clippingPlanes;c(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0;let i=this._clippingPolygons;c(i)&&!i.isDestroyed()&&i.owner===this&&i.destroy(),this._clippingPolygons=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0;let o=this._environmentMapManager;!o.isDestroyed()&&o.owner===this&&o.destroy(),this._environmentMapManager=void 0,de(this)};co.prototype.destroyPipelineResources=function(){let e=this._pipelineResources;for(let t=0;t<e.length;t++)e[t].destroy();this._pipelineResources.length=0,this._pickIds.length=0};co.prototype.destroyModelResources=function(){let e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0};co.fromGltfAsync=async function(e){if(e=e??W.EMPTY_OBJECT,!c(e.url)&&!c(e.gltf))throw new E("options.url is required.");let t=e.url??e.gltf,n={releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:c(e.classificationType)},i=e.basePath??"",o=we.createIfNeeded(i);c(t.asset)?(n.gltfJson=t,n.baseResource=o,n.gltfResource=o):t instanceof Uint8Array?(n.typedArray=t,n.baseResource=o,n.gltfResource=o):n.gltfResource=we.createIfNeeded(t);let r=new rh(n),a=c(e.content)?pr.TILE_GLTF:pr.GLTF,l=n.gltfResource,u=JM(r,a,e);u.resource=l,u.environmentMapOptions=e.environmentMapOptions;try{await r.load()}catch(g){throw r.destroy(),$t.getError("model",l,g)}let f=e.gltfCallback;c(f)&&(T.typeOf.func("options.gltfCallback",f),f(r.gltfJson));let h=new co(u),p=h._resource.credits;if(c(p)){let g=p.length;for(let m=0;m<g;m++)h._resourceCredits.push(Tt.clone(p[m]))}return h};co.fromB3dm=async function(e){let t={b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:c(e.classificationType)},n=new fR(t);try{await n.load();let i=JM(n,pr.TILE_B3DM,e);return new co(i)}catch(i){throw n.destroy(),i}};co.fromPnts=async function(e){let t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new QM(t);try{await n.load();let i=JM(n,pr.TILE_PNTS,e);return new co(i)}catch(i){throw n.destroy(),i}};co.fromI3dm=async function(e){let t={i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline},n=new mR(t);try{await n.load();let i=JM(n,pr.TILE_I3DM,e);return new co(i)}catch(i){throw n.destroy(),i}};co.fromGeoJson=async function(e){let t={geoJson:e.geoJson},n=new dR(t),i=JM(n,pr.TILE_GEOJSON,e);return new co(i)};var LWe=new G;co.prototype.applyColorAndShow=function(e){let t=G.clone(this._color,LWe),n=c(e)&&c(e.color),i=c(e)&&c(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):G.clone(G.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,CW(t,this._color)&&this.resetDrawCommands()};co.prototype.applyStyle=function(e){let t=this.type===pr.TILE_PNTS,n=c(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=c(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=c(i)&&c(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),wle(this,e)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function JM(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,enableVerticalExaggeration:n.enableVerticalExaggeration,minimumPixelSize:n.minimumPixelSize,maximumScale:n.maximumScale,id:n.id,allowPicking:n.allowPicking,clampAnimations:n.clampAnimations,shadows:n.shadows,debugShowBoundingVolume:n.debugShowBoundingVolume,enableDebugWireframe:n.enableDebugWireframe,debugWireframe:n.debugWireframe,cull:n.cull,opaquePass:n.opaquePass,customShader:n.customShader,content:n.content,heightReference:n.heightReference,scene:n.scene,distanceDisplayCondition:n.distanceDisplayCondition,color:n.color,colorBlendAmount:n.colorBlendAmount,colorBlendMode:n.colorBlendMode,silhouetteColor:n.silhouetteColor,silhouetteSize:n.silhouetteSize,enableShowOutline:n.enableShowOutline,showOutline:n.showOutline,outlineColor:n.outlineColor,clippingPlanes:n.clippingPlanes,clippingPolygons:n.clippingPolygons,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,enablePick:n.enablePick,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}var lh=co;function Wr(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Wr.prototype,{featuresLength:{get:function(){let e=this._model,t=e.featureTables,n=e.featureTableId;return c(t)&&c(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return this._model.statistics.pointsLength}},trianglesLength:{get:function(){return this._model.statistics.trianglesLength}},geometryByteLength:{get:function(){return this._model.statistics.geometryByteLength}},texturesByteLength:{get:function(){return this._model.statistics.texturesByteLength}},batchTableByteLength:{get:function(){let e=this._model.statistics;return e.propertyTablesByteLength+e.batchTexturesByteLength}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){let e=this._model,t=e.featureTables,n=e.featureTableId;if(c(t)&&c(t[n]))return t[n]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});Wr.prototype.getTextureIds=function(){return this._model.statistics.getTextureIds()};Wr.prototype.getTextureByteLengthById=function(e){return this._model.statistics.getTextureByteLengthById(e)};Wr.prototype.getExtension=function(e){return this._model.getExtension(e)};Wr.prototype.getFeature=function(e){let t=this._model,n=t.featureTableId;if(!c(n))throw new E("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");let i=t.featureTables[n];if(!c(i))throw new E("No feature table found for the selected feature ID set");let o=i.featuresLength;if(!c(e)||e<0||e>=o)throw new E(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)};Wr.prototype.hasProperty=function(e,t){let n=this._model,i=n.featureTableId;return c(i)?n.featureTables[i].hasProperty(e,t):!1};Wr.prototype.applyDebugSettings=function(e,t){t=e?t:G.WHITE,this.featuresLength===0?this._model.color=t:c(this.batchTable)&&this.batchTable.setAllColor(t)};Wr.prototype.applyStyle=function(e){this._model.style=e};Wr.prototype.update=function(e,t){let n=this._model,i=this._tile;n.colorBlendAmount=e.colorBlendAmount,n.colorBlendMode=e.colorBlendMode,n.modelMatrix=i.computedTransform,n.customShader=e.customShader,n.featureIdLabel=e.featureIdLabel,n.instanceFeatureIdLabel=e.instanceFeatureIdLabel,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.shadows=e.shadows,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection,n.debugWireframe=e.debugWireframe,n.showOutline=e.showOutline,n.outlineColor=e.outlineColor,n.pointCloudShading=e.pointCloudShading;let o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,c(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0);let r=e.environmentMapManager;n.environmentMapManager!==o&&(n._environmentMapManager=r),c(o)&&c(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0);let s=e.clippingPolygons;c(s)&&i.clippingPolygonsDirty&&(n._clippingPolygons=s.enabled&&i._isClippedByPolygon?s:void 0),c(s)&&c(n._clippingPolygons)&&n._clippingPolygons!==s&&(n._clippingPolygons=s,n._clippingPolygonsState=0),n.update(t),!this._ready&&n.ready&&(n.activeAnimations.addAll({loop:Hl.REPEAT}),this._ready=!0)};Wr.prototype.isDestroyed=function(){return!1};Wr.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),de(this)};Wr.fromGltf=async function(e,t,n,i){let o=new Wr(e,t,n),s=eL(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;let l=await lh.fromGltfAsync(s);return o._model=l,o};Wr.fromB3dm=async function(e,t,n,i,o){let r=new Wr(e,t,n),a=eL(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=l;let u=await lh.fromB3dm(a);return r._model=u,r};Wr.fromI3dm=async function(e,t,n,i,o){let r=new Wr(e,t,n),a=eL(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await lh.fromI3dm(a);return r._model=l,r};Wr.fromPnts=async function(e,t,n,i,o){let r=new Wr(e,t,n),a=eL(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await lh.fromPnts(a);return r._model=l,r};Wr.fromGeoJson=async function(e,t,n,i){let o=new Wr(e,t,n),s=eL(e,t,o,{geoJson:i,resource:n}),a=await lh.fromGeoJson(s);return o._model=a,o};Wr.prototype.pick=function(e,t,n){if(!c(this._model)||!this._ready)return;let i=t.verticalExaggeration,o=t.verticalExaggerationRelativeHeight;return this._model.pick(e,t,i,o,ie.WGS84,n)};function eL(e,t,n,i){let o={cull:!1,releaseGltfJson:!0,opaquePass:De.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._modelUpAxis,forwardAxis:e._modelForwardAxis,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,clippingPlanes:e.clippingPlanes,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection,enableDebugWireframe:e._enableDebugWireframe,debugWireframe:e.debugWireframe,projectTo2D:e._projectTo2D,enablePick:e._enablePick,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor};return xt(i,o)}var Ou=Wr;function Vf(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Vf.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});Vf.fromJson=function(e,t,n,i){let o=new Vf(e,t,n);return o._tileset.loadTileset(o._resource,i,o._tile),o._ready=!0,o};Vf.prototype.hasProperty=function(e,t){return!1};Vf.prototype.getFeature=function(e){};Vf.prototype.applyDebugSettings=function(e,t){};Vf.prototype.applyStyle=function(e){};Vf.prototype.update=function(e,t){};Vf.prototype.pick=function(e,t,n){};Vf.prototype.isDestroyed=function(){return!1};Vf.prototype.destroy=function(){return de(this)};var tL=Vf;var nL=`uniform sampler2D u_atlas;
#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif
in vec2 v_textureCoordinates;
in vec4 v_pickColor;
in vec4 v_color;
in float v_splitDirection;
#ifdef SDF
in vec4 v_outlineColor;
in float v_outlineWidth;
#endif
#ifdef FRAGMENT_DEPTH_CHECK
in vec4 v_textureCoordinateBounds;
in vec4 v_originTextureCoordinateAndTranslate;
in vec4 v_compressed;
in mat2 v_rotationMatrix;
const float SHIFT_LEFT12 = 4096.0;
const float SHIFT_LEFT1 = 2.0;
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
const float SHIFT_RIGHT1 = 1.0 / 2.0;
float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)
{
vec2 lookupVector = imageSize * (depthLookupST - adjustedST);
lookupVector = v_rotationMatrix * lookupVector;
vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y));
vec2 translation = v_originTextureCoordinateAndTranslate.zw;
if (applyTranslate)
{
translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));
}
vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));
if (logDepthOrDepth == 0.0)
{
return 0.0;
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
return eyeCoordinate.z / eyeCoordinate.w;
}
#endif
#ifdef SDF
float getDistance(vec2 position)
{
return texture(u_atlas, position).r;
}
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
{
float distance = getDistance(position);
if (outlineWidth > 0.0)
{
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
return vec4(sdfColor.rgb, sdfColor.a * alpha);
}
else
{
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
return vec4(v_color.rgb, v_color.a * alpha);
}
}
#endif
void main()
{
if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
vec4 color = texture(u_atlas, v_textureCoordinates);
#ifdef SDF
float outlineWidth = v_outlineWidth;
vec4 outlineColor = v_outlineColor;
float distance = getDistance(v_textureCoordinates);
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
float smoothing = fwidth(distance);
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
color = (center + color1 + color2 + color3 + color4)/5.0;
#else
float smoothing = 1.0/32.0;
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
#endif
color = czm_gammaCorrect(color);
#else
color = czm_gammaCorrect(color);
color *= czm_gammaCorrect(v_color);
#endif
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
if (color.a < 0.005)
{
discard;
}
#else
#ifdef OPAQUE
if (color.a < 0.995)
{
discard;
}
#else
if (color.a >= 0.995)
{
discard;
}
#endif
#endif
#ifdef VECTOR_TILE
color *= u_highlightColor;
#endif
out_FragColor = color;
#ifdef LOG_DEPTH
czm_writeLogDepth();
#endif
#ifdef FRAGMENT_DEPTH_CHECK
float temp = v_compressed.y;
temp = temp * SHIFT_RIGHT1;
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
bool enableDepthTest = temp2 != 0.0;
bool applyTranslate = floor(temp) != 0.0;
if (enableDepthTest) {
temp = v_compressed.z;
temp = temp * SHIFT_RIGHT12;
vec2 dimensions;
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
dimensions.x = floor(temp);
temp = v_compressed.w;
temp = temp * SHIFT_RIGHT12;
vec2 imageSize;
imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;
imageSize.x = floor(temp);
vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;
adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);
float epsilonEyeDepth = v_compressed.x + czm_epsilon1;
float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);
if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
{
float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize);
if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
{
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize);
if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
{
discard;
}
}
}
}
#endif
}
`;var iL=`#ifdef INSTANCED
in vec2 direction;
#endif
in vec4 positionHighAndScale;
in vec4 positionLowAndRotation;
in vec4 compressedAttribute0;
in vec4 compressedAttribute1;
in vec4 compressedAttribute2;
in vec4 eyeOffset;
in vec4 scaleByDistance;
in vec4 pixelOffsetScaleByDistance;
in vec4 compressedAttribute3;
in vec2 sdf;
in float splitDirection;
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
in vec4 textureCoordinateBoundsOrLabelTranslate;
#endif
#ifdef VECTOR_TILE
in float a_batchId;
#endif
out vec2 v_textureCoordinates;
#ifdef FRAGMENT_DEPTH_CHECK
out vec4 v_textureCoordinateBounds;
out vec4 v_originTextureCoordinateAndTranslate;
out vec4 v_compressed;
out mat2 v_rotationMatrix;
#endif
out vec4 v_pickColor;
out vec4 v_color;
out float v_splitDirection;
#ifdef SDF
out vec4 v_outlineColor;
out float v_outlineWidth;
#endif
const float UPPER_BOUND = 32768.0;
const float SHIFT_LEFT16 = 65536.0;
const float SHIFT_LEFT12 = 4096.0;
const float SHIFT_LEFT8 = 256.0;
const float SHIFT_LEFT7 = 128.0;
const float SHIFT_LEFT5 = 32.0;
const float SHIFT_LEFT3 = 8.0;
const float SHIFT_LEFT2 = 4.0;
const float SHIFT_LEFT1 = 2.0;
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
const float SHIFT_RIGHT8 = 1.0 / 256.0;
const float SHIFT_RIGHT7 = 1.0 / 128.0;
const float SHIFT_RIGHT5 = 1.0 / 32.0;
const float SHIFT_RIGHT3 = 1.0 / 8.0;
const float SHIFT_RIGHT2 = 1.0 / 4.0;
const float SHIFT_RIGHT1 = 1.0 / 2.0;
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
{
vec2 halfSize = imageSize * scale * 0.5;
halfSize *= ((direction * 2.0) - 1.0);
vec2 originTranslate = origin * abs(halfSize);
#if defined(ROTATION) || defined(ALIGNED_AXIS)
if (validAlignedAxis || rotation != 0.0)
{
float angle = rotation;
if (validAlignedAxis)
{
vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
}
float cosTheta = cos(angle);
float sinTheta = sin(angle);
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
halfSize = rotationMatrix * halfSize;
}
else
{
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
}
#endif
mpp = czm_metersPerPixel(positionEC);
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
positionEC.xy += (translate + pixelOffset) * mpp;
return positionEC;
}
#ifdef VERTEX_DEPTH_CHECK
float getGlobeDepth(vec4 positionEC)
{
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
if (globeDepth == 0.0)
{
return 0.0;
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
return eyeCoordinate.z / eyeCoordinate.w;
}
#endif
void main()
{
vec3 positionHigh = positionHighAndScale.xyz;
vec3 positionLow = positionLowAndRotation.xyz;
float scale = positionHighAndScale.w;
#if defined(ROTATION) || defined(ALIGNED_AXIS)
float rotation = positionLowAndRotation.w;
#else
float rotation = 0.0;
#endif
float compressed = compressedAttribute0.x;
vec2 pixelOffset;
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
compressed -= pixelOffset.x * SHIFT_LEFT7;
pixelOffset.x -= UPPER_BOUND;
vec2 origin;
origin.x = floor(compressed * SHIFT_RIGHT5);
compressed -= origin.x * SHIFT_LEFT5;
origin.y = floor(compressed * SHIFT_RIGHT3);
compressed -= origin.y * SHIFT_LEFT3;
#ifdef FRAGMENT_DEPTH_CHECK
vec2 depthOrigin = origin.xy;
#endif
origin -= vec2(1.0);
float show = floor(compressed * SHIFT_RIGHT2);
compressed -= show * SHIFT_LEFT2;
#ifdef INSTANCED
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
#else
vec2 direction;
direction.x = floor(compressed * SHIFT_RIGHT1);
direction.y = compressed - direction.x * SHIFT_LEFT1;
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);
#endif
float temp = compressedAttribute0.y  * SHIFT_RIGHT8;
pixelOffset.y = -(floor(temp) - UPPER_BOUND);
vec2 translate;
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
temp = compressedAttribute0.z * SHIFT_RIGHT8;
translate.x = floor(temp) - UPPER_BOUND;
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
translate.y -= UPPER_BOUND;
temp = compressedAttribute1.x * SHIFT_RIGHT8;
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
vec2 imageSize = vec2(floor(temp), temp2);
#ifdef FRAGMENT_DEPTH_CHECK
float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
float applyTranslate = 0.0;
if (labelHorizontalOrigin != 0.0)
{
applyTranslate = 1.0;
labelHorizontalOrigin -= 2.0;
depthOrigin.x = labelHorizontalOrigin + 1.0;
}
depthOrigin = vec2(1.0) - (depthOrigin * 0.5);
#endif
#ifdef EYE_DISTANCE_TRANSLUCENCY
vec4 translucencyByDistance;
translucencyByDistance.x = compressedAttribute1.z;
translucencyByDistance.z = compressedAttribute1.w;
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
temp = compressedAttribute1.y * SHIFT_RIGHT8;
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
#endif
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
temp = compressedAttribute3.w;
temp = temp * SHIFT_RIGHT12;
vec2 dimensions;
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
dimensions.x = floor(temp);
#endif
#ifdef ALIGNED_AXIS
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
temp = compressedAttribute2.z * SHIFT_RIGHT5;
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
#else
vec3 alignedAxis = vec3(0.0);
bool validAlignedAxis = false;
#endif
vec4 pickColor;
vec4 color;
temp = compressedAttribute2.y;
temp = temp * SHIFT_RIGHT8;
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor.r = floor(temp);
temp = compressedAttribute2.x;
temp = temp * SHIFT_RIGHT8;
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
color.r = floor(temp);
temp = compressedAttribute2.z * SHIFT_RIGHT8;
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor /= 255.0;
color.a = floor(temp);
color /= 255.0;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)
float eyeDepth = positionEC.z;
#endif
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
positionEC.xyz *= show;
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
lengthSq = dot(positionEC.xyz, positionEC.xyz);
}
#endif
#ifdef EYE_DISTANCE_SCALING
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
scale *= distanceScale;
translate *= distanceScale;
if (scale == 0.0)
{
positionEC.xyz = vec3(0.0);
}
#endif
float translucency = 1.0;
#ifdef EYE_DISTANCE_TRANSLUCENCY
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
if (translucency == 0.0)
{
positionEC.xyz = vec3(0.0);
}
#endif
#ifdef EYE_DISTANCE_PIXEL_OFFSET
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
pixelOffset *= pixelOffsetScale;
#endif
#ifdef DISTANCE_DISPLAY_CONDITION
float nearSq = compressedAttribute3.x;
float farSq = compressedAttribute3.y;
if (lengthSq < nearSq || lengthSq > farSq)
{
positionEC.xyz = vec3(0.0);
}
#endif
mat2 rotationMatrix;
float mpp;
#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = compressedAttribute3.z;
#endif
#ifdef VERTEX_DEPTH_CHECK
if (lengthSq < disableDepthTestDistance) {
float depthsilon = 10.0;
vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth1 = getGlobeDepth(pEC1);
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
{
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth2 = getGlobeDepth(pEC2);
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
{
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
float globeDepth3 = getGlobeDepth(pEC3);
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
{
positionEC.xyz = vec3(0.0);
}
}
}
}
#endif
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
gl_Position = czm_projection * positionEC;
v_textureCoordinates = textureCoordinates;
#ifdef LOG_DEPTH
czm_vertexLogDepth();
#endif
#ifdef DISABLE_DEPTH_DISTANCE
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
{
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
}
if (disableDepthTestDistance != 0.0)
{
float zclip = gl_Position.z / gl_Position.w;
bool clipped = (zclip < -1.0 || zclip > 1.0);
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
{
gl_Position.z = -gl_Position.w;
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = 1.0;
#endif
}
}
#endif
#ifdef FRAGMENT_DEPTH_CHECK
if (sizeInMeters) {
translate /= mpp;
dimensions /= mpp;
imageSize /= mpp;
}
#if defined(ROTATION) || defined(ALIGNED_AXIS)
v_rotationMatrix = rotationMatrix;
#else
v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
#endif
float enableDepthCheck = 0.0;
if (lengthSq < disableDepthTestDistance)
{
enableDepthCheck = 1.0;
}
float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));
float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));
float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));
float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));
v_compressed.x = eyeDepth;
v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;
v_compressed.z = dw * SHIFT_LEFT12 + dh;
v_compressed.w = iw * SHIFT_LEFT12 + ih;
v_originTextureCoordinateAndTranslate.xy = depthOrigin;
v_originTextureCoordinateAndTranslate.zw = translate;
v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;
#endif
#ifdef SDF
vec4 outlineColor;
float outlineWidth;
temp = sdf.x;
temp = temp * SHIFT_RIGHT8;
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.r = floor(temp);
temp = sdf.y;
temp = temp * SHIFT_RIGHT8;
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.a = floor(temp);
outlineColor /= 255.0;
v_outlineWidth = outlineWidth / 255.0;
v_outlineColor = outlineColor;
v_outlineColor.a *= translucency;
#endif
v_pickColor = pickColor;
v_color = color;
v_color.a *= translucency;
v_splitDirection = splitDirection;
}
`;var NWe=Object.freeze({NONE:0,LOADING:2,LOADED:3,ERROR:4,FAILED:5}),ss=NWe;function x_(e){T.defined("billboardCollection",e),this._billboardCollection=e,this._id=void 0,this._loadState=ss.NONE,this._loadError=void 0,this._index=-1,this._width=void 0,this._height=void 0,this._hasSubregion=!1,this.dirty=!1}Object.defineProperties(x_.prototype,{loadError:{get:function(){return this._loadError}},loadState:{get:function(){return this._loadState}},ready:{get:function(){return this._loadState===ss.LOADED}},hasImage:{get:function(){return this._loadState!==ss.NONE}},id:{get:function(){return this._id}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});x_.prototype.unload=async function(){this._loadState!==ss.NONE&&(this._id=void 0,this._loadError=void 0,this._loadState=ss.NONE,this._index=-1,this._width=void 0,this._height=void 0,this.dirty=!0)};x_.prototype.loadImage=async function(e,t){if(this._id===e)return;let n=this._billboardCollection,i=n.billboardTextureCache,o=i.get(e);if(c(o)&&t.loadState===ss.LOADING||t.loadState===ss.LOADED){x_.clone(o,this);return}c(o)||(o=new x_(n),i.set(e,o)),o._id=this._id=e,o._loadState=this._loadState=ss.LOADING,o._loadError=this._loadError=void 0;let r,s=this._billboardCollection.textureAtlas;try{r=await s.addImage(e,t)}catch(l){if(o._loadState=ss.ERROR,o._loadError=l,this._id!==e)return;this._loadState=ss.ERROR,this._loadError=l;return}if(!c(r)||r===-1){if(o._loadState=ss.FAILED,o._index=-1,this._id!==e)return;this._loadState=ss.FAILED,this._index=-1;return}o._index=r,o._loadState=ss.LOADED;let a=s.rectangles[r];o._width=a.width,o._height=a.height,this._id===e&&(this._index=r,this._loadState=ss.LOADED,this._width=a.width,this._height=a.height,this.dirty=!0)};x_.prototype.addImageSubRegion=async function(e,t){this._id=e,this._loadState=ss.LOADING,this._loadError=void 0,this._hasSubregion=!0;let n,i=this._billboardCollection.textureAtlas;try{n=await i.addImageSubRegion(e,t)}catch(o){this._loadState=ss.ERROR,this._loadError=o;return}if(!c(n)||n===-1){this._loadState=ss.FAILED,this._index=-1,this._width=void 0,this._height=void 0;return}this._width=t.width,this._height=t.height,this._index=n,this._loadState=ss.LOADED,this.dirty=!0};x_.prototype.computeTextureCoordinates=function(e){return this._billboardCollection.textureAtlas.computeTextureCoordinates(this._index,e)};x_.clone=function(e,t){if(t._id=e._id,t._loadState=e._loadState,t._loadError=void 0,t._index=e._index,t._width=e._width,t._height=e._height,t._hasSubregion=e._hasSubregion,e.ready){t.dirty=!0;return}return(async()=>{let i=e._id;await e._billboardCollection.textureAtlas._indexPromiseById.get(i),t._id===i&&(e._hasSubregion&&await Promise.resolve(),t._id=i,t._loadState=e._loadState,t._loadError=e._loadError,t._index=e._index,t._width=e._width,t._height=e._height,t.dirty=!0)})(),t};var T_=x_;function mi(e,t){if(e=e??W.EMPTY_OBJECT,c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Bt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Bt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");o=Bt.clone(o)}if(c(r)){if(r.far<=r.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Mt.clone(r)}this._show=e.show??!0,this._position=d.clone(e.position??d.ZERO),this._actualPosition=d.clone(this._position),this._pixelOffset=H.clone(e.pixelOffset??H.ZERO),this._translate=new H(0,0),this._eyeOffset=d.clone(e.eyeOffset??d.ZERO),this._heightReference=e.heightReference??We.NONE,this._verticalOrigin=e.verticalOrigin??Fn.CENTER,this._horizontalOrigin=e.horizontalOrigin??bi.CENTER,this._scale=e.scale??1,this._color=G.clone(e.color??G.WHITE),this._rotation=e.rotation??0,this._alignedAxis=d.clone(e.alignedAxis??d.ZERO),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=e.sizeInMeters??!1,this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=e.collection??t,this._pickId=void 0,this._pickPrimitive=e._pickPrimitive??this,this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageTexture=new T_(t),this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;let s=e.image,a=e.imageId;c(s)&&(c(a)||(typeof s=="string"?a=s:c(s.src)?a=s.src:a=jn()),this._imageTexture.loadImage(a,s)),c(e.imageSubRegion)&&this._imageTexture.addImageSubRegion(a,e.imageSubRegion),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=oe.SCENE3D,this._clusterShow=!0,this._outlineColor=G.clone(e.outlineColor??G.BLACK),this._outlineWidth=e.outlineWidth??0,this._updateClamping(),this._splitDirection=e.splitDirection??Vr.NONE}var Ple=mi.SHOW_INDEX=0,Bz=mi.POSITION_INDEX=1,Lle=mi.PIXEL_OFFSET_INDEX=2,FWe=mi.EYE_OFFSET_INDEX=3,BWe=mi.HORIZONTAL_ORIGIN_INDEX=4,kWe=mi.VERTICAL_ORIGIN_INDEX=5,UWe=mi.SCALE_INDEX=6,Ile=mi.IMAGE_INDEX_INDEX=7,Ole=mi.COLOR_INDEX=8,VWe=mi.ROTATION_INDEX=9,zWe=mi.ALIGNED_AXIS_INDEX=10,HWe=mi.SCALE_BY_DISTANCE_INDEX=11,GWe=mi.TRANSLUCENCY_BY_DISTANCE_INDEX=12,jWe=mi.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,WWe=mi.DISTANCE_DISPLAY_CONDITION=14,qWe=mi.DISABLE_DEPTH_DISTANCE=15;mi.TEXTURE_COORDINATE_BOUNDS=16;var Rle=mi.SDF_INDEX=17,YWe=mi.SPLIT_DIRECTION_INDEX=18;mi.NUMBER_OF_PROPERTIES=19;function sr(e,t){let n=e._billboardCollection;c(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(mi.prototype,{show:{get:function(){return this._show},set:function(e){T.typeOf.bool("value",e),this._show!==e&&(this._show=e,sr(this,Ple))}},position:{get:function(){return this._position},set:function(e){T.typeOf.object("value",e);let t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),this._updateClamping(),sr(this,Bz))}},heightReference:{get:function(){return this._heightReference},set:function(e){T.typeOf.number("value",e);let t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),sr(this,Bz))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){T.typeOf.object("value",e);let t=this._pixelOffset;H.equals(t,e)||(H.clone(e,t),sr(this,Lle))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");let t=this._scaleByDistance;Bt.equals(t,e)||(this._scaleByDistance=Bt.clone(e,t),sr(this,HWe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");let t=this._translucencyByDistance;Bt.equals(t,e)||(this._translucencyByDistance=Bt.clone(e,t),sr(this,GWe))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(c(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");let t=this._pixelOffsetScaleByDistance;Bt.equals(t,e)||(this._pixelOffsetScaleByDistance=Bt.clone(e,t),sr(this,jWe))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){T.typeOf.object("value",e);let t=this._eyeOffset;d.equals(t,e)||(d.clone(e,t),sr(this,FWe))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){T.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,sr(this,BWe))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){T.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,sr(this,kWe))}},scale:{get:function(){return this._scale},set:function(e){T.typeOf.number("value",e),this._scale!==e&&(this._scale=e,sr(this,UWe))}},color:{get:function(){return this._color},set:function(e){T.typeOf.object("value",e);let t=this._color;G.equals(t,e)||(G.clone(e,t),sr(this,Ole))}},rotation:{get:function(){return this._rotation},set:function(e){T.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,sr(this,VWe))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){T.typeOf.object("value",e);let t=this._alignedAxis;d.equals(t,e)||(d.clone(e,t),sr(this,zWe))}},width:{get:function(){return this._width??this._imageTexture.width},set:function(e){c(e)&&T.typeOf.number("width",e),this._width!==e&&(this._width=e,sr(this,Ile))}},height:{get:function(){return this._height??this._imageTexture.height},set:function(e){c(e)&&T.typeOf.number("height",e),this._height!==e&&(this._height=e,sr(this,Ile))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){T.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,sr(this,Ole))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!Mt.equals(e,this._distanceDisplayCondition)){if(c(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");this._distanceDisplayCondition=Mt.clone(e,this._distanceDisplayCondition),sr(this,WWe)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(c(e)&&(T.typeOf.number("value",e),e<0))throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,sr(this,qWe))}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,c(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageTexture.id},set:function(e){if(!c(e)){this._imageTexture.unload();return}let t;typeof e=="string"?t=e:e instanceof we?t=e._url:c(e.src)?t=e.src:t=jn(),this._imageTexture.loadImage(t,e)}},ready:{get:function(){return this._imageTexture.ready}},loadError:{get:function(){return this._imageTexture.loadError}},textureDirty:{get:function(){return this._imageTexture.dirty},set:function(e){this._imageTexture.dirty=e}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition),sr(this,Bz)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,sr(this,Ple))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");let t=this._outlineColor;G.equals(t,e)||(G.clone(e,t),sr(this,Rle))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,sr(this,Rle))}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&(this._splitDirection=e,sr(this,YWe))}}});mi.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};mi.prototype._updateClamping=function(){mi._updateClamping(this._billboardCollection,this)};var oL=new he;mi._updateClamping=function(e,t){if(!c(e)||!c(e._scene)){if(t._heightReference!==We.NONE)throw new E("Height reference is not supported without a scene.");return}let n=e._scene,i=n.ellipsoid??ie.default,o=n.frameState.mode,r=o!==t._mode;if(t._mode=o,(t._heightReference===We.NONE||r)&&c(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===We.NONE||!c(t._position))return;c(t._removeCallbackFunc)&&t._removeCallbackFunc();let s=i.cartesianToCartographic(t._position);if(!c(s)){t._actualClampedPosition=void 0;return}function a(u){let f=i.cartographicToCartesian(u,t._clampedPosition);if(gC(t._heightReference))t._mode===oe.SCENE3D?(u.height+=s.height,i.cartographicToCartesian(u,f)):f.x+=s.height;else if(t._heightReference===We.CLIP_TO_GROUND)if(t._mode===oe.SCENE3D){let h=i.cartesianToCartographic(u,oL);s.height>=h.height&&(h.height=s.height),i.cartographicToCartesian(h,u)}else s.height>=u.x&&(u.x=s.height);t._clampedPosition=f}t._removeCallbackFunc=n.updateHeight(s,a,t._heightReference),he.clone(s,oL);let l=n.getHeight(s,t._heightReference);c(l)&&(oL.height=l),a(oL)};mi.prototype.computeTextureCoordinates=function(e){return this._imageTexture.computeTextureCoordinates(e)};mi.prototype.setImage=function(e,t){T.typeOf.string("id",e),T.defined("image",t),this._imageTexture.loadImage(e,t)};mi.prototype.setImageTexture=function(e){T.defined("billboardTexture",e),T_.clone(e,this._imageTexture)};mi.prototype.setImageSubRegion=function(e,t){T.typeOf.string("id",e),T.defined("subRegion",t),this._imageTexture.addImageSubRegion(e,t)};mi.prototype._setTranslate=function(e){if(!c(e))throw new E("value is required.");let t=this._translate;H.equals(t,e)||(H.clone(e,t),sr(this,Lle))};mi.prototype._getActualPosition=function(){return c(this._clampedPosition)?this._clampedPosition:this._actualPosition};mi.prototype._setActualPosition=function(e){c(this._clampedPosition)||d.clone(e,this._actualPosition),sr(this,Bz)};var Mle=new se;mi._computeActualPosition=function(e,t,n,i){return c(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===oe.SCENE3D?t:(B.multiplyByPoint(i,t,Mle),Gi.computeActualEllipsoidPosition(n,Mle))};var Nle=new d;mi._computeScreenSpacePosition=function(e,t,n,i,o,r){let s=B.multiplyByPoint(e,t,Nle),a=Gi.worldWithEyeOffsetToWindowCoordinates(o,s,n,r);if(c(a))return H.add(a,i,a),a};var Fz=new H(0,0);mi.prototype.computeScreenSpacePosition=function(e,t){let n=this._billboardCollection;if(c(t)||(t=new H),!c(n))throw new E("Billboard must be in a collection.  Was it removed?");if(!c(e))throw new E("scene is required.");H.clone(this._pixelOffset,Fz),H.add(Fz,this._translate,Fz);let i=n.modelMatrix,o=this._position;if(c(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==oe.SCENE3D)){let s=e.mapProjection,a=s.ellipsoid,l=s.unproject(o,oL);o=a.cartographicToCartesian(l,Nle),i=B.IDENTITY}return mi._computeScreenSpacePosition(i,o,this._eyeOffset,Fz,e,t)};mi.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height,r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===bi.RIGHT?s-=i:e.horizontalOrigin===bi.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===Fn.BOTTOM||e.verticalOrigin===Fn.BASELINE?a-=o:e.verticalOrigin===Fn.CENTER&&(a-=o*.5),c(n)||(n=new Ke),n.x=s,n.y=a,n.width=i,n.height=o,n};mi.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.equals(this._position,e._position)&&this.image===e.image&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&G.equals(this._color,e._color)&&H.equals(this._pixelOffset,e._pixelOffset)&&H.equals(this._translate,e._translate)&&d.equals(this._eyeOffset,e._eyeOffset)&&Bt.equals(this._scaleByDistance,e._scaleByDistance)&&Bt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Bt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Mt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._splitDirection===e._splitDirection};mi.prototype._destroy=function(){c(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),c(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};var lo=mi;var XWe={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},wo=Object.freeze(XWe);var KWe={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},Ks=Object.freeze(KWe);var $We=lo.SHOW_INDEX,rL=lo.POSITION_INDEX,Fle=lo.PIXEL_OFFSET_INDEX,Ble=lo.EYE_OFFSET_INDEX,ZWe=lo.HORIZONTAL_ORIGIN_INDEX,QWe=lo.VERTICAL_ORIGIN_INDEX,JWe=lo.SCALE_INDEX,Mx=lo.IMAGE_INDEX_INDEX,kle=lo.COLOR_INDEX,eqe=lo.ROTATION_INDEX,tqe=lo.ALIGNED_AXIS_INDEX,Ule=lo.SCALE_BY_DISTANCE_INDEX,Vle=lo.TRANSLUCENCY_BY_DISTANCE_INDEX,zle=lo.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,Hle=lo.DISTANCE_DISPLAY_CONDITION,nqe=lo.DISABLE_DEPTH_DISTANCE,iqe=lo.TEXTURE_COORDINATE_BOUNDS,Gle=lo.SDF_INDEX,jle=lo.SPLIT_DIRECTION_INDEX,IW=lo.NUMBER_OF_PROPERTIES,uo,oqe={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11,splitDirection:12},rqe={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12,splitDirection:13};function Hf(e){e=e??W.EMPTY_OBJECT,this._scene=e.scene,this._batchTable=e.batchTable;let t=e.textureAtlas;c(t)||(t=new vb),this._textureAtlas=t,this._textureAtlasGUID=t.guid,this._destroyTextureAtlas=!0,this._billboardTextureCache=new Map,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(IW),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new le,this._baseVolumeWC=new le,this._baseVolume2D=new le,this._boundingVolume=new le,this._boundingVolumeDirty=!1,this._colorCommands=[],this._allBillboardsReady=!1,this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.debugShowTextureAtlas=e.debugShowTextureAtlas??!1,this.blendOption=e.blendOption??wo.OPAQUE_AND_TRANSLUCENT,this._blendOption=void 0,this._mode=oe.SCENE3D,this._buffersUsage=[Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW],this._highlightColor=G.clone(G.WHITE),this._uniforms={u_atlas:()=>this.textureAtlas.texture,u_highlightColor:()=>this._highlightColor};let n=this._scene;c(n)&&c(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener(function(){let i=this._billboards,o=i.length;for(let r=0;r<o;++r)c(i[r])&&i[r]._updateClamping()},this))}Object.defineProperties(Hf.prototype,{length:{get:function(){return OW(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){T.defined("textureAtlas",e),this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}},sizeInBytes:{get:function(){return this._textureAtlas.sizeInBytes}},ready:{get:function(){return this._allBillboardsReady}},billboardTextureCache:{get:function(){return this._billboardTextureCache}}});function Wle(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Hf.prototype.add=function(e){let t=new lo(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};Hf.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Hf.prototype.removeAll=function(){Wle(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function OW(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;let t=[],n=e._billboards,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];c(s)&&(s._index=r++,t.push(s))}e._billboards=t}}Hf.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};Hf.prototype.contains=function(e){return c(e)&&e._billboardCollection===this};Hf.prototype.get=function(e){return T.typeOf.number("index",e),OW(this),this._billboards[e]};var EW;function sqe(e){let n=e.cache.billboardCollection_indexBufferBatched;if(c(n))return n;let i=16384*6-6,o=new Uint16Array(i);for(let r=0,s=0;r<i;r+=6,s+=4)o[r]=s,o[r+1]=s+1,o[r+2]=s+2,o[r+3]=s+0,o[r+4]=s+2,o[r+5]=s+3;return n=yt.createIndexBuffer({context:e,typedArray:o,usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function aqe(e){let t=e.cache.billboardCollection_indexBufferInstanced;return c(t)||(t=yt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function cqe(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return c(t)||(t=yt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:Be.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}Hf.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<IW;++i){let o=n[i]===0?Be.STATIC_DRAW:Be.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function lqe(e,t,n,i,o,r){let s=[{index:uo.positionHighAndScale,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[rL]},{index:uo.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[rL]},{index:uo.compressedAttribute0,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Fle]},{index:uo.compressedAttribute1,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Vle]},{index:uo.compressedAttribute2,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[kle]},{index:uo.eyeOffset,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Ble]},{index:uo.scaleByDistance,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Ule]},{index:uo.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[zle]},{index:uo.compressedAttribute3,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Hle]},{index:uo.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[iqe]},{index:uo.splitDirection,componentsPerAttribute:1,componentDatatype:$.FLOAT,usage:n[jle]}];i&&s.push({index:uo.direction,componentsPerAttribute:2,componentDatatype:$.FLOAT,vertexBuffer:cqe(e)}),c(o)&&s.push({index:uo.a_batchId,componentsPerAttribute:1,componentDatatype:$.FLOAT,bufferUsage:Be.STATIC_DRAW}),r&&s.push({index:uo.sdf,componentsPerAttribute:2,componentDatatype:$.FLOAT,usage:n[Gle]});let a=i?t:4*t;return new Mp(e,s,a,i)}var SW=new Hn;function qle(e,t,n,i){let o,r=n[uo.positionHighAndScale],s=n[uo.positionLowAndRotation],a=i._getActualPosition();e._mode===oe.SCENE3D&&(le.expand(e._baseVolume,a,e._baseVolume),e._boundingVolumeDirty=!0),Hn.fromCartesian(a,SW);let l=i.scale,u=i.rotation;u!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);let f=SW.high,h=SW.low;e._instanced?(o=i._index,r(o,f.x,f.y,f.z,l),s(o,h.x,h.y,h.z,u)):(o=i._index*4,r(o+0,f.x,f.y,f.z,l),r(o+1,f.x,f.y,f.z,l),r(o+2,f.x,f.y,f.z,l),r(o+3,f.x,f.y,f.z,l),s(o+0,h.x,h.y,h.z,u),s(o+1,h.x,h.y,h.z,u),s(o+2,h.x,h.y,h.z,u),s(o+3,h.x,h.y,h.z,u))}var Wl=new H,zf=32768,TE=65536,wW=4096,Pm=256,uqe=128,fqe=32,dqe=8,Yle=4,hqe=1/256,Xle=0,Kle=2,$le=3,Zle=1,RW=new Ke;function Qle(e,t,n,i){let o,r=n[uo.compressedAttribute0],s=i.pixelOffset,a=s.x,l=s.y,u=i._translate,f=u.x,h=u.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(a+f),Math.abs(-l+h));let p=i.horizontalOrigin,g=i._verticalOrigin,m=i.show&&i.clusterShow;i.color.alpha===0&&(m=!1),g===Fn.BASELINE&&(g=Fn.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&p===bi.CENTER,e._allVerticalCenter=e._allVerticalCenter&&g===Fn.CENTER;let y=0,b=0,x=0,A=0;if(i.ready){let N=i.computeTextureCoordinates(RW);y=N.x,b=N.y,x=N.width,A=N.height}let C=y+x,S=b+A,v=Math.floor(O.clamp(a,-zf,zf)+zf)*uqe;v+=(p+1)*fqe,v+=(g+1)*dqe,v+=(m?1:0)*Yle;let P=Math.floor(O.clamp(l,-zf,zf)+zf)*Pm,M=Math.floor(O.clamp(f,-zf,zf)+zf)*Pm,R=(O.clamp(h,-zf,zf)+zf)*hqe,L=Math.floor(R),F=Math.floor((R-L)*Pm);P+=L,M+=F,Wl.x=y,Wl.y=b;let _=Ln.compressTextureCoordinates(Wl);Wl.x=C;let w=Ln.compressTextureCoordinates(Wl);Wl.y=S;let D=Ln.compressTextureCoordinates(Wl);Wl.x=y;let I=Ln.compressTextureCoordinates(Wl);e._instanced?(o=i._index,r(o,v,P,M,_)):(o=i._index*4,r(o+0,v+Xle,P,M,_),r(o+1,v+Kle,P,M,w),r(o+2,v+$le,P,M,D),r(o+3,v+Zle,P,M,I))}function Jle(e,t,n,i){let o,r=n[uo.compressedAttribute1],s=i.alignedAxis;d.equals(s,d.ZERO)||(e._shaderAlignedAxis=!0);let a=0,l=1,u=1,f=1,h=i.translucencyByDistance;c(h)&&(a=h.near,l=h.nearValue,u=h.far,f=h.farValue,(l!==1||f!==1)&&(e._shaderTranslucencyByDistance=!0));let p=i.width??0;e._maxSize=Math.max(e._maxSize,p);let g=O.clamp(p,0,TE),m=0;Math.abs(d.magnitudeSquared(s)-1)<O.EPSILON6&&(m=Ln.octEncodeFloat(s)),l=O.clamp(l,0,1),l=l===1?255:l*255|0,g=g*Pm+l,f=O.clamp(f,0,1),f=f===1?255:f*255|0,m=m*Pm+f,e._instanced?(o=i._index,r(o,g,m,a,u)):(o=i._index*4,r(o+0,g,m,a,u),r(o+1,g,m,a,u),r(o+2,g,m,a,u),r(o+3,g,m,a,u))}function DW(e,t,n,i){let o,r=n[uo.compressedAttribute2],s=i.color,a=c(e._batchTable)?G.WHITE:i.getPickId(t.context).color,l=i.sizeInMeters?1:0,u=Math.abs(d.magnitudeSquared(i.alignedAxis)-1)<O.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&l===1;let f=i.height??0;e._maxSize=Math.max(e._maxSize,f);let h=i._labelHorizontalOrigin??-2;h+=2;let p=f*Yle+h,g=G.floatToByte(s.red),m=G.floatToByte(s.green),y=G.floatToByte(s.blue),b=g*TE+m*Pm+y;g=G.floatToByte(a.red),m=G.floatToByte(a.green),y=G.floatToByte(a.blue);let x=g*TE+m*Pm+y,A=G.floatToByte(s.alpha)*TE+G.floatToByte(a.alpha)*Pm;A+=l*2+u,e._instanced?(o=i._index,r(o,b,x,A,p)):(o=i._index*4,r(o+0,b,x,A,p),r(o+1,b,x,A,p),r(o+2,b,x,A,p),r(o+3,b,x,A,p))}function PW(e,t,n,i){let o,r=n[uo.eyeOffset],s=i.eyeOffset,a=s.z;if(i._heightReference!==We.NONE&&(a*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(s.x),Math.abs(s.y),Math.abs(a)),e._instanced){if(Wl.x=0,Wl.y=0,i.ready){let u=i.computeTextureCoordinates(RW);Wl.x=u.width,Wl.y=u.height}let l=Ln.compressTextureCoordinates(Wl);o=i._index,r(o,s.x,s.y,a,l)}else o=i._index*4,r(o+0,s.x,s.y,a,0),r(o+1,s.x,s.y,a,0),r(o+2,s.x,s.y,a,0),r(o+3,s.x,s.y,a,0)}function eue(e,t,n,i){let o,r=n[uo.scaleByDistance],s=0,a=1,l=1,u=1,f=i.scaleByDistance;c(f)&&(s=f.near,a=f.nearValue,l=f.far,u=f.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(o=i._index,r(o,s,a,l,u)):(o=i._index*4,r(o+0,s,a,l,u),r(o+1,s,a,l,u),r(o+2,s,a,l,u),r(o+3,s,a,l,u))}function tue(e,t,n,i){let o,r=n[uo.pixelOffsetScaleByDistance],s=0,a=1,l=1,u=1,f=i.pixelOffsetScaleByDistance;c(f)&&(s=f.near,a=f.nearValue,l=f.far,u=f.farValue,(a!==1||u!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(o=i._index,r(o,s,a,l,u)):(o=i._index*4,r(o+0,s,a,l,u),r(o+1,s,a,l,u),r(o+2,s,a,l,u),r(o+3,s,a,l,u))}function nue(e,t,n,i){let o,r=n[uo.compressedAttribute3],s=0,a=Number.MAX_VALUE,l=i.distanceDisplayCondition;c(l)&&(s=l.near,a=l.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let u=i.disableDepthTestDistance,f=Df(i.heightReference)&&t.context.depthTexture;c(u)||(u=f?5e3:0),u*=u,(f||u>0)&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1));let h,p;c(i._labelDimensions)?(p=i._labelDimensions.x,h=i._labelDimensions.y):(p=i.width??0,h=i.height??0);let g=Math.floor(O.clamp(p,0,wW)),m=Math.floor(O.clamp(h,0,wW)),y=g*wW+m;e._instanced?(o=i._index,r(o,s,a,u,y)):(o=i._index*4,r(o+0,s,a,u,y),r(o+1,s,a,u,y),r(o+2,s,a,u,y),r(o+3,s,a,u,y))}function iue(e,t,n,i){if(Df(i.heightReference)){let p=e._scene,g=t.context,m=t.globeTranslucencyState.translucent,y=c(p.globe)&&p.globe.depthTestAgainstTerrain;e._shaderClampToGround=g.depthTexture&&!m&&y}let o,r=n[uo.textureCoordinateBoundsOrLabelTranslate];if(ut.maximumVertexTextureImageUnits>0){let p=0,g=0;c(i._labelTranslate)&&(p=i._labelTranslate.x,g=i._labelTranslate.y),e._instanced?(o=i._index,r(o,p,g,0,0)):(o=i._index*4,r(o+0,p,g,0,0),r(o+1,p,g,0,0),r(o+2,p,g,0,0),r(o+3,p,g,0,0));return}let s=0,a=0,l=0,u=0;if(i.ready){let p=i.computeTextureCoordinates(RW);s=p.x,a=p.y,l=p.width,u=p.height}let f=s+l,h=a+u;e._instanced?(o=i._index,r(o,s,a,f,h)):(o=i._index*4,r(o+0,s,a,f,h),r(o+1,s,a,f,h),r(o+2,s,a,f,h),r(o+3,s,a,f,h))}function mqe(e,t,n,i){if(!c(e._batchTable))return;let o=n[uo.a_batchId],r=i._batchIndex,s;e._instanced?(s=i._index,o(s,r)):(s=i._index*4,o(s+0,r),o(s+1,r),o(s+2,r),o(s+3,r))}function oue(e,t,n,i){if(!e._sdf)return;let o,r=n[uo.sdf],s=i.outlineColor,a=i.outlineWidth,l=G.floatToByte(s.red),u=G.floatToByte(s.green),f=G.floatToByte(s.blue),h=l*TE+u*Pm+f,p=a/Ks.RADIUS,g=G.floatToByte(s.alpha)*TE+G.floatToByte(p)*Pm;e._instanced?(o=i._index,r(o,h,g)):(o=i._index*4,r(o+0,h+Xle,g),r(o+1,h+Kle,g),r(o+2,h+$le,g),r(o+3,h+Zle,g))}function rue(e,t,n,i){let o=n[uo.splitDirection],r=0,s=i.splitDirection;c(s)&&(r=s);let a;e._instanced?(a=i._index,o(a,r)):(a=i._index*4,o(a+0,r),o(a+1,r),o(a+2,r),o(a+3,r))}function pqe(e,t,n,i){qle(e,t,n,i),Qle(e,t,n,i),Jle(e,t,n,i),DW(e,t,n,i),PW(e,t,n,i),eue(e,t,n,i),tue(e,t,n,i),nue(e,t,n,i),iue(e,t,n,i),mqe(e,t,n,i),oue(e,t,n,i),rue(e,t,n,i)}function vW(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;let a=[];for(let l=0;l<n;++l){let u=t[l],f=u.position,h=lo._computeActualPosition(u,f,i,o);c(h)&&(u._setActualPosition(h),r?a.push(h):le.expand(s,h,s))}r&&le.fromPoints(a,s)}function _qe(e,t){let n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==oe.SCENE3D&&!B.equals(r,e.modelMatrix)?(e._mode=n,B.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===oe.SCENE3D||n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&vW(e,i,i.length,t,r,!0)):n===oe.MORPHING?vW(e,i,i.length,t,r,!0):(n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&vW(e,o,e._billboardsToUpdateIndex,t,r,!1)}function gqe(e,t,n){let i=1;(!e._allSizedInMeters||e._maxPixelOffset!==0)&&(i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let o=i*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(o*=.5);let r=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=o+r}function yqe(e,t){let i=t.createViewportQuadCommand(`uniform sampler2D billboard_texture; 
in vec2 v_textureCoordinates; 
void main() 
{ 
    out_FragColor = texture(billboard_texture, v_textureCoordinates); 
} 
`,{uniformMap:{billboard_texture:function(){return e.textureAtlas.texture}}});return i.pass=De.OVERLAY,i}var bqe=[];Hf.prototype.update=function(e){if(OW(this),!this.show)return;let t=e.context;this._instanced=t.instancedArrays,uo=this._instanced?rqe:oqe,EW=this._instanced?aqe:sqe;let n=this._billboards,i=n.length,o=!0;for(let R=0;R<i;++R){let L=n[R];c(L.loadError)&&(console.error(`Error loading image for billboard: ${L.loadError}`),L.image=void 0),L.textureDirty&&this._updateBillboard(L,Mx),L.show&&(o=o&&L.ready)}let r=this._textureAtlas;if(e.afterRender.push(()=>{if(!this.isDestroyed())return r.update(e.context)}),!c(r.texture))return;_qe(this,e),n=this._billboards,i=n.length;let s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,l=this._propertiesChanged,u=r.guid,f=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let h,p=e.passes,g=p.pick;if(f||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let R=0;R<IW;++R)l[R]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),i>0){this._vaf=lqe(t,i,this._buffersUsage,this._instanced,this._batchTable,this._sdf),h=this._vaf.writers;for(let R=0;R<i;++R){let L=this._billboards[R];L._dirty=!1,L.textureDirty=!1,pqe(this,e,h,L)}this._vaf.commit(EW(t))}this._billboardsToUpdateIndex=0}else if(a>0){let R=bqe;R.length=0,(l[rL]||l[eqe]||l[JWe])&&R.push(qle),(l[Mx]||l[Fle]||l[ZWe]||l[QWe]||l[$We])&&(R.push(Qle),this._instanced&&R.push(PW)),(l[Mx]||l[tqe]||l[Vle])&&(R.push(Jle),R.push(DW)),(l[Mx]||l[kle])&&R.push(DW),(l[Mx]||l[Ble])&&R.push(PW),l[Ule]&&R.push(eue),l[zle]&&R.push(tue),(l[Hle]||l[nqe]||l[Mx]||l[rL])&&R.push(nue),(l[Mx]||l[rL])&&R.push(iue),l[Gle]&&R.push(oue),l[jle]&&R.push(rue);let L=R.length;if(h=this._vaf.writers,a/i>.1){for(let F=0;F<a;++F){let _=s[F];_._dirty=!1,_.textureDirty=!1;for(let w=0;w<L;++w)R[w](this,e,h,_)}this._vaf.commit(EW(t))}else{for(let F=0;F<a;++F){let _=s[F];_._dirty=!1,_.textureDirty=!1;for(let w=0;w<L;++w)R[w](this,e,h,_);this._instanced?this._vaf.subCommit(_._index,1):this._vaf.subCommit(_._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>i*1.5&&(s.length=i),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,le.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m,y=B.IDENTITY;e.mode===oe.SCENE3D?(y=this.modelMatrix,m=le.clone(this._baseVolumeWC,this._boundingVolume)):m=le.clone(this._baseVolume2D,this._boundingVolume),gqe(this,e,m);let b=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,b){this._blendOption===wo.OPAQUE||this._blendOption===wo.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ve.fromCache({depthTest:{enabled:!0,func:ne.LESS},depthMask:!0}):this._rsOpaque=void 0;let R=this._blendOption===wo.TRANSLUCENT;this._blendOption===wo.TRANSLUCENT||this._blendOption===wo.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ve.fromCache({depthTest:{enabled:!0,func:R?ne.LEQUAL:ne.LESS},depthMask:R,blending:ln.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let x,A,C,S,v,P=ut.maximumVertexTextureImageUnits>0;if(b||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){x=iL,A=nL,v=[],c(this._batchTable)&&(v.push("VECTOR_TILE"),x=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(x),A=this._batchTable.getFragmentShaderCallback(!1,void 0)(A)),C=new He({defines:v,sources:[x]}),this._instanced&&C.defines.push("INSTANCED"),this._shaderRotation&&C.defines.push("ROTATION"),this._shaderAlignedAxis&&C.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&C.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&C.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&C.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&C.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&C.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(P?C.defines.push("VERTEX_DEPTH_CHECK"):C.defines.push("FRAGMENT_DEPTH_CHECK"));let R=1-Ks.CUTOFF;this._sdf&&C.defines.push("SDF");let L=c(this._batchTable)?"VECTOR_TILE":"";this._blendOption===wo.OPAQUE_AND_TRANSLUCENT&&(S=new He({defines:["OPAQUE",L],sources:[A]}),this._shaderClampToGround&&(P?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._sp=Jt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:S,attributeLocations:uo}),S=new He({defines:["TRANSLUCENT",L],sources:[A]}),this._shaderClampToGround&&(P?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._spTranslucent=Jt.replaceCache({context:t,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:S,attributeLocations:uo})),this._blendOption===wo.OPAQUE&&(S=new He({defines:[L],sources:[A]}),this._shaderClampToGround&&(P?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._sp=Jt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:C,fragmentShaderSource:S,attributeLocations:uo})),this._blendOption===wo.TRANSLUCENT&&(S=new He({defines:[L],sources:[A]}),this._shaderClampToGround&&(P?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._spTranslucent=Jt.replaceCache({context:t,shaderProgram:this._spTranslucent,vertexShaderSource:C,fragmentShaderSource:S,attributeLocations:uo})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}let M=e.commandList;if(p.render||p.pick){let R=this._colorCommands,L=this._blendOption===wo.OPAQUE,F=this._blendOption===wo.OPAQUE_AND_TRANSLUCENT,_=this._vaf.va,w=_.length,D=this._uniforms,I;c(this._batchTable)?(D=this._batchTable.getUniformMapCallback()(D),I=this._batchTable.getPickId()):I="v_pickColor",R.length=w;let N=F?w*2:w;for(let k=0;k<N;++k){let z=R[k];c(z)||(z=R[k]=new Qe);let V=L||F&&k%2===0;z.pass=V||!F?De.OPAQUE:De.TRANSLUCENT,z.owner=this;let j=F?Math.floor(k/2):k;z.boundingVolume=m,z.modelMatrix=y,z.count=_[j].indicesCount,z.shaderProgram=V?this._sp:this._spTranslucent,z.uniformMap=D,z.vertexArray=_[j].va,z.renderState=V?this._rsOpaque:this._rsTranslucent,z.debugShowBoundingVolume=this.debugShowBoundingVolume,z.pickId=I,this._instanced&&(z.count=6,z.instanceCount=i),M.push(z)}this.debugShowTextureAtlas&&(c(this.debugCommand)||(this.debugCommand=yqe(this,e.context)),M.push(this.debugCommand))}this._allBillboardsReady=o};Hf.prototype.isDestroyed=function(){return!1};Hf.prototype.destroy=function(){return c(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),Wle(this._billboards),de(this)};var Ru=Hf;function xqe(e,t,n,i,o){return function(){let r=document.createElement("canvas"),s=o+2*i;r.height=r.width=s;let a=r.getContext("2d");return a.clearRect(0,0,s,s),i!==0&&(a.beginPath(),a.arc(s/2,s/2,s/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=n,a.fill(),e<1&&(a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle="black",a.fill(),a.restore())),a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=t,a.fill(),r}}var Lx=xqe;function ya(e,t,n,i,o){this._content=e,this._billboard=n,this._label=i,this._polyline=o,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),AE(this)}var Tqe=new he;Object.defineProperties(ya.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=G.clone(e,this._color),AE(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,AE(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=G.clone(e,this._pointOutlineColor),AE(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,AE(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){c(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){let t=this._heightOffset??0,n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,Tqe);i.height=i.height-t+e;let o=n.cartographicToCartesian(i);this._billboard.position=o,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],o],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=G.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){let t=this._billboardImage!==e;this._billboardImage=e,t&&AE(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){let e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}});ya.defaultColor=G.WHITE;ya.defaultPointOutlineColor=G.BLACK;ya.defaultPointOutlineWidth=0;ya.defaultPointSize=8;function AE(e){let t=e._billboard;if(c(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(c(e._billboardImage))return;let n=e._color??ya.defaultColor,i=e._pointOutlineColor??ya.defaultPointOutlineColor,o=e._pointOutlineWidth??ya.defaultPointOutlineWidth,r=e._pointSize??ya.defaultPointSize,s=e._billboardColor,a=e._billboardOutlineColor,l=e._billboardOutlineWidth,u=e._billboardSize;if(G.equals(n,s)&&G.equals(i,a)&&o===l&&r===u)return;e._billboardColor=G.clone(n,e._billboardColor),e._billboardOutlineColor=G.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;let f=n.alpha,h=n.toCssColorString(),p=i.toCssColorString(),g=JSON.stringify([h,r,p,o]);t.setImage(g,Lx(f,h,p,o,r))}ya.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};ya.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};ya.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};ya.prototype.getPropertyInherited=function(e){return Ws.getPropertyInherited(this._content,this._batchId,e)};ya.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};ya.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};ya.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};ya.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var A_=ya;function Aqe(e,t,n,i,o){let r=e.measureText(t);if(!!/\S/.test(t)){let a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),l=document.createElement("canvas"),u=100,f=r.width+u|0,h=3*a,p=h/2;l.width=f,l.height=h;let g=l.getContext("2d");g.font=n,g.fillStyle="white",g.fillRect(0,0,l.width+1,l.height+1),i&&(g.strokeStyle="black",g.lineWidth=e.lineWidth,g.strokeText(t,u/2,p)),o&&(g.fillStyle="black",g.fillText(t,u/2,p));let m=g.getImageData(0,0,f,h).data,y=m.length,b=f*4,x,A,C,S;for(x=0;x<y;++x)if(m[x]!==255){C=x/b|0;break}for(x=y-1;x>=0;--x)if(m[x]!==255){S=x/b|0;break}let v=-1;for(x=0;x<f&&v===-1;++x)for(A=0;A<h;++A){let P=x*4+A*b;if(m[P]!==255||m[P+1]!==255||m[P+2]!==255||m[P+3]!==255){v=x;break}}return{width:r.width,height:S-C,ascent:p-C,descent:S-p,minx:v-u/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}var Nx;function Cqe(e,t){if(!c(e))throw new E("text is required.");if(e==="")return;t=t??W.EMPTY_OBJECT;let n=t.font??"10px sans-serif",i=t.stroke??!1,o=t.fill??!0,r=t.strokeWidth??1,s=t.backgroundColor??G.TRANSPARENT,a=t.padding??0,l=a*2,u=document.createElement("canvas");u.width=1,u.height=1,u.style.font=n;let f=u.getContext("2d",{willReadFrequently:!0});c(Nx)||(c(f.imageSmoothingEnabled)?Nx="imageSmoothingEnabled":c(f.mozImageSmoothingEnabled)?Nx="mozImageSmoothingEnabled":c(f.webkitImageSmoothingEnabled)?Nx="webkitImageSmoothingEnabled":c(f.msImageSmoothingEnabled)&&(Nx="msImageSmoothingEnabled")),f.font=n,f.lineJoin="round",f.lineWidth=r,f[Nx]=!1,u.style.visibility="hidden",document.body.appendChild(u);let h=Aqe(f,e,n,i,o);u.dimensions=h,document.body.removeChild(u),u.style.visibility="";let p=-h.minx,g=Math.ceil(h.width)+p+l,m=h.height+l,y=m-h.ascent+a,b=m-y+l;if(u.width=g,u.height=m,f.font=n,f.lineJoin="round",f.lineWidth=r,f[Nx]=!1,s!==G.TRANSPARENT&&(f.fillStyle=s.toCssColorString(),f.fillRect(0,0,u.width,u.height)),i){let x=t.strokeColor??G.BLACK;f.strokeStyle=x.toCssColorString(),f.strokeText(e,p+a,b)}if(o){let x=t.fillColor??G.WHITE;f.fillStyle=x.toCssColorString(),f.fillText(e,p+a,b)}return u}var Fx=Cqe;var gue=Zo(lue(),1);var Sqe={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},Yo=Object.freeze(Sqe);var uue={},fue=0,wqe=256,vqe=new G(.165,.165,.165,.8),Dqe=new H(7,5),ys=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function Bx(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function aL(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function cL(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function hue(e){let t=uue[e._font];if(!c(t)){let n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(cL(n,"line-height"));isNaN(i)&&(i=void 0),t={family:cL(n,"font-family"),size:cL(n,"font-size").replace("px",""),style:cL(n,"font-style"),weight:cL(n,"font-weight"),lineHeight:i},document.body.removeChild(n),fue<wqe&&(uue[e._font]=t,fue++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function uh(e,t){if(e=e??W.EMPTY_OBJECT,c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Bt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Bt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");o=Bt.clone(o)}if(c(r)){if(r.far<=r.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Mt.clone(r)}this._renderedText=void 0,this._text=void 0,this._show=e.show??!0,this._font=e.font??"30px sans-serif",this._fillColor=G.clone(e.fillColor??G.WHITE),this._outlineColor=G.clone(e.outlineColor??G.BLACK),this._outlineWidth=e.outlineWidth??1,this._showBackground=e.showBackground??!1,this._backgroundColor=G.clone(e.backgroundColor??vqe),this._backgroundPadding=H.clone(e.backgroundPadding??Dqe),this._style=e.style??Yo.FILL,this._verticalOrigin=e.verticalOrigin??Fn.BASELINE,this._horizontalOrigin=e.horizontalOrigin??bi.LEFT,this._pixelOffset=H.clone(e.pixelOffset??H.ZERO),this._eyeOffset=d.clone(e.eyeOffset??d.ZERO),this._position=d.clone(e.position??d.ZERO),this._scale=e.scale??1,this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=e.heightReference??We.NONE,this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=e.text??"",this._relativeSize=1,hue(this),this._updateClamping()}Object.defineProperties(uh.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(this._show!==e){this._show=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i].billboard;c(r)&&(r.show=e)}let n=this._backgroundBillboard;c(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){if(!c(e))throw new E("value is required.");let t=this._position;if(!d.equals(t,e)){d.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o].billboard;c(s)&&(s.position=e)}let i=this._backgroundBillboard;c(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(!c(e))throw new E("value is required.");if(e!==this._heightReference){this._heightReference=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i].billboard;c(r)&&(r.heightReference=e)}let n=this._backgroundBillboard;c(n)&&(n.heightReference=e),aL(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(!c(e))throw new E("value is required.");if(this._text!==e){this._text=e;let t=uh.filterUnsupportedCharacters(e);this._renderedText=uh.enableRightToLeftDetection?Lqe(t):t,Bx(this)}}},font:{get:function(){return this._font},set:function(e){if(!c(e))throw new E("value is required.");this._font!==e&&(this._font=e,Bx(this),hue(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!c(e))throw new E("value is required.");let t=this._fillColor;G.equals(t,e)||(G.clone(e,t),Bx(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");let t=this._outlineColor;G.equals(t,e)||(G.clone(e,t),Bx(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!c(e))throw new E("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,Bx(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){if(!c(e))throw new E("value is required.");this._showBackground!==e&&(this._showBackground=e,Bx(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!c(e))throw new E("value is required.");let t=this._backgroundColor;if(!G.equals(t,e)){G.clone(e,t);let n=this._backgroundBillboard;c(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){if(!c(e))throw new E("value is required.");let t=this._backgroundPadding;H.equals(t,e)||(H.clone(e,t),aL(this))}},style:{get:function(){return this._style},set:function(e){if(!c(e))throw new E("value is required.");this._style!==e&&(this._style=e,Bx(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){if(!c(e))throw new E("value is required.");let t=this._pixelOffset;if(!H.equals(t,e)){H.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];c(s.billboard)&&(s.billboard.pixelOffset=e)}let i=this._backgroundBillboard;c(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");let t=this._translucencyByDistance;if(!Bt.equals(t,e)){this._translucencyByDistance=Bt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];c(s.billboard)&&(s.billboard.translucencyByDistance=e)}let i=this._backgroundBillboard;c(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");let t=this._pixelOffsetScaleByDistance;if(!Bt.equals(t,e)){this._pixelOffsetScaleByDistance=Bt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];c(s.billboard)&&(s.billboard.pixelOffsetScaleByDistance=e)}let i=this._backgroundBillboard;c(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");let t=this._scaleByDistance;if(!Bt.equals(t,e)){this._scaleByDistance=Bt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];c(s.billboard)&&(s.billboard.scaleByDistance=e)}let i=this._backgroundBillboard;c(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){if(!c(e))throw new E("value is required.");let t=this._eyeOffset;if(!d.equals(t,e)){d.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];c(s.billboard)&&(s.billboard.eyeOffset=e)}let i=this._backgroundBillboard;c(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){if(!c(e))throw new E("value is required.");this._horizontalOrigin!==e&&(this._horizontalOrigin=e,aL(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(!c(e))throw new E("value is required.");if(this._verticalOrigin!==e){this._verticalOrigin=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.verticalOrigin=e)}let n=this._backgroundBillboard;c(n)&&(n.verticalOrigin=e),aL(this)}}},scale:{get:function(){return this._scale},set:function(e){if(!c(e))throw new E("value is required.");if(this._scale!==e){this._scale=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.scale=e*this._relativeSize)}let n=this._backgroundBillboard;c(n)&&(n.scale=e*this._relativeSize),aL(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");if(!Mt.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=Mt.clone(e,this._distanceDisplayCondition);let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.distanceDisplayCondition=e)}let n=this._backgroundBillboard;c(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(c(e)&&e<0)throw new E("disableDepthTestDistance must be greater than 0.0.");this._disableDepthTestDistance=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.disableDepthTestDistance=e)}let n=this._backgroundBillboard;c(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.id=e)}let n=this._backgroundBillboard;c(n)&&(n.id=e)}}},pickId:{get:function(){if(!(this._glyphs.length===0||!c(this._glyphs[0].billboard)))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition);let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard._clampedPosition=e)}let n=this._backgroundBillboard;c(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];c(r.billboard)&&(r.billboard.clusterShow=e)}let n=this._backgroundBillboard;c(n)&&(n.clusterShow=e)}}}});uh.prototype._updateClamping=function(){lo._updateClamping(this._labelCollection,this)};uh.prototype.computeScreenSpacePosition=function(e,t){if(!c(e))throw new E("scene is required.");c(t)||(t=new H);let i=this._labelCollection.modelMatrix,o=c(this._actualClampedPosition)?this._actualClampedPosition:this._position;return lo._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};uh.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0,a=e.totalScale,l=e._backgroundBillboard;if(c(l))i=t.x+l._translate.x,o=t.y-l._translate.y,r=l.width*a,s=l.height*a,e.verticalOrigin===Fn.BOTTOM||e.verticalOrigin===Fn.BASELINE?o-=s:e.verticalOrigin===Fn.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let u=0,f=0,h=e._glyphs,p=h.length;for(let g=0;g<p;++g){let m=h[g],y=m.billboard;if(!c(y))continue;let b=t.x+y._translate.x,x=t.y-y._translate.y,A=m.dimensions.width*a,C=m.dimensions.height*a;e.verticalOrigin===Fn.BOTTOM||e.verticalOrigin===Fn.BASELINE?x-=C:e.verticalOrigin===Fn.CENTER&&(x-=C*.5),e._verticalOrigin===Fn.TOP?x+=Ks.PADDING*a:(e._verticalOrigin===Fn.BOTTOM||e._verticalOrigin===Fn.BASELINE)&&(x-=Ks.PADDING*a),i=Math.min(i,b),o=Math.min(o,x),u=Math.max(u,b+A),f=Math.max(f,x+C)}r=u-i,s=f-o}return c(n)||(n=new Ke),n.x=i,n.y=o,n.width=r,n.height=s,n};uh.filterUnsupportedCharacters=function(e){let t=new RegExp(/[\u0000-\u0008\u000E-\u001F\u00ad\u202a-\u206f\u200b-\u200f]/,"g");return e.replace(t,"")};uh.prototype.equals=function(e){return this===e||c(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&d.equals(this._position,e._position)&&G.equals(this._fillColor,e._fillColor)&&G.equals(this._outlineColor,e._outlineColor)&&G.equals(this._backgroundColor,e._backgroundColor)&&H.equals(this._backgroundPadding,e._backgroundPadding)&&H.equals(this._pixelOffset,e._pixelOffset)&&d.equals(this._eyeOffset,e._eyeOffset)&&Bt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Bt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Bt.equals(this._scaleByDistance,e._scaleByDistance)&&Mt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};uh.prototype.isDestroyed=function(){return!1};uh.enableRightToLeftDetection=!1;function Pqe(e,t){let n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[],r="",s=ys.LTR,a="",l=e.length;for(let u=0;u<l;++u){let f=e.charAt(u);t.test(f)?a=ys.RTL:n.test(f)?a=ys.LTR:i.test(f)?a=ys.BRACKETS:a=ys.WEAK,u===0&&(s=a),s===a&&a!==ys.BRACKETS?r+=f:(r!==""&&o.push({Type:s,Word:r}),s=a,r=f)}return o.push({Type:a,Word:r}),o}function Iqe(e){return e.split("").reverse().join("")}function lL(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Oqe(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}var Rqe="\u05D0-\u05EA",Mqe="\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF",due=new RegExp(`[${Rqe}${Mqe}]`);function Lqe(e){let t=e.split(`
`),n="";for(let i=0;i<t.length;i++){let o=t[i],r=due.test(o.charAt(0)),s=Pqe(o,due),a=0,l="";for(let u=0;u<s.length;++u){let f=s[u],h=f.Type===ys.BRACKETS?Oqe(f.Word):Iqe(f.Word);r?f.Type===ys.RTL?(l=h+l,a=0):f.Type===ys.LTR?(l=lL(l,a,f.Word),a+=f.Word.length):(f.Type===ys.WEAK||f.Type===ys.BRACKETS)&&(f.Type===ys.WEAK&&s[u-1].Type===ys.BRACKETS?l=h+l:s[u-1].Type===ys.RTL?(l=h+l,a=0):s.length>u+1?s[u+1].Type===ys.RTL?(l=h+l,a=0):(l=lL(l,a,f.Word),a+=f.Word.length):l=lL(l,0,h)):f.Type===ys.RTL?l=lL(l,a,h):f.Type===ys.LTR?(l+=f.Word,a=l.length):(f.Type===ys.WEAK||f.Type===ys.BRACKETS)&&(u>0&&s[u-1].Type===ys.RTL?s.length>u+1?s[u+1].Type===ys.RTL?l=lL(l,a,h):(l+=f.Word,a=l.length):l+=f.Word:(l+=f.Word,a=l.length))}n+=l,i<t.length-1&&(n+=`
`)}return n}var Uy=uh;var yue=Zo(mue(),1);function Fqe(){this.dimensions=void 0,this.billboardTexture=void 0,this.billboard=void 0}var Bqe=1.2,pue="ID_WHITE_PIXEL",MW=new H(4,4),kqe=new Ke(1,1,1,1);function Uqe(e,t){let n=t._backgroundBillboardTexture;if(!n.hasImage){let o=document.createElement("canvas");o.width=MW.x,o.height=MW.y;let r=o.getContext("2d");r.fillStyle="#fff",r.fillRect(0,0,o.width,o.height),n.loadImage(pue,o),n.addImageSubRegion(pue,kqe)}let i=e.add({collection:t});return i.setImageTexture(n),i}var C_={};function Vqe(e,t,n,i,o,r){return C_.font=t,C_.fillColor=n,C_.strokeColor=i,C_.strokeWidth=o,C_.padding=Ks.PADDING,C_.fill=r===Yo.FILL||r===Yo.FILL_AND_OUTLINE,C_.stroke=r===Yo.OUTLINE||r===Yo.FILL_AND_OUTLINE,C_.backgroundColor=G.BLACK,Fx(e,C_)}function LW(e,t){let n=t.billboard;c(n)&&(n.show=!1,c(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}var zqe=new yue.default,Hqe=/\s/;function Gqe(e,t){let n=t._renderedText,i=zqe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;if(t._relativeSize=t._fontSize/Ks.FONT_SIZE,o<s)for(let g=o;g<s;++g)LW(e,r[g]);r.length=o;let a=t.show&&t._showBackground&&n.split(`
`).join("").length>0,l=t._backgroundBillboard,u=e._backgroundBillboardCollection;a?(c(l)||(l=Uqe(u,e),t._backgroundBillboard=l),l.color=t._backgroundColor,l.show=t._show,l.position=t._position,l.eyeOffset=t._eyeOffset,l.pixelOffset=t._pixelOffset,l.horizontalOrigin=bi.LEFT,l.verticalOrigin=t._verticalOrigin,l.heightReference=t._heightReference,l.scale=t.totalScale,l.pickPrimitive=t,l.id=t._id,l.translucencyByDistance=t._translucencyByDistance,l.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,l.scaleByDistance=t._scaleByDistance,l.distanceDisplayCondition=t._distanceDisplayCondition,l.disableDepthTestDistance=t._disableDepthTestDistance,l.clusterShow=t.clusterShow):c(l)&&(u.remove(l),t._backgroundBillboard=l=void 0);let f=e._glyphBillboardCollection,h=f.billboardTextureCache,p=e._textDimensionsCache;for(let g=0;g<o;++g){let m=i[g],y=t._verticalOrigin,b=JSON.stringify([m,t._fontFamily,t._fontStyle,t._fontWeight,+y]),x=p[b],A=h.get(b);if(!c(A)||!c(x)){A=new T_(f),h.set(b,A);let P=`${t._fontStyle} ${t._fontWeight} ${Ks.FONT_SIZE}px ${t._fontFamily}`,M=Vqe(m,P,G.WHITE,G.WHITE,0,Yo.FILL);if(x=M.dimensions,p[b]=x,M.width>0&&M.height>0&&!Hqe.test(m)){let R=(0,gue.default)(M,{cutoff:Ks.CUTOFF,radius:Ks.RADIUS}),L=M.getContext("2d"),F=M.width,_=M.height,w=L.getImageData(0,0,F,_);for(let D=0;D<F;D++)for(let I=0;I<_;I++){let N=I*F+D,k=R[N]*255,z=N*4;w.data[z+0]=k,w.data[z+1]=k,w.data[z+2]=k,w.data[z+3]=k}L.putImageData(w,0,0),A.loadImage(b,M)}}let C=r[g];if(c(C)||(C=new Fqe,C.dimensions=x,C.billboardTexture=A,r[g]=C),C.billboardTexture.id!==b&&(C.billboardTexture=A,C.dimensions=x),!A.hasImage){LW(e,C);continue}let S=C.billboard,v=e._spareBillboards;c(S)||(v.length>0?S=v.pop():(S=f.add({collection:e}),S._labelDimensions=new H,S._labelTranslate=new H),C.billboard=S),S.setImageTexture(A),S.show=t._show,S.position=t._position,S.eyeOffset=t._eyeOffset,S.pixelOffset=t._pixelOffset,S.horizontalOrigin=bi.LEFT,S.verticalOrigin=t._verticalOrigin,S.heightReference=t._heightReference,S.scale=t.totalScale,S.pickPrimitive=t,S.id=t._id,S.translucencyByDistance=t._translucencyByDistance,S.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,S.scaleByDistance=t._scaleByDistance,S.distanceDisplayCondition=t._distanceDisplayCondition,S.disableDepthTestDistance=t._disableDepthTestDistance,S._batchIndex=t._batchIndex,S.outlineColor=t.outlineColor,t.style===Yo.FILL_AND_OUTLINE?(S.color=t._fillColor,S.outlineWidth=t.outlineWidth):t.style===Yo.FILL?(S.color=t._fillColor,S.outlineWidth=0):t.style===Yo.OUTLINE&&(S.color=G.TRANSPARENT,S.outlineWidth=t.outlineWidth)}t._repositionAllGlyphs=!0}function _ue(e,t,n){return t===bi.CENTER?-e/2:t===bi.RIGHT?-(e+n.x):n.x}var _r=new H,jqe=new H;function Wqe(e){let t=e._glyphs,n=e._renderedText,i=0,o=0,r=[],s=Number.NEGATIVE_INFINITY,a=0,l=1,u=t.length,f=e._backgroundBillboard,h=H.clone(c(f)?e._backgroundPadding:H.ZERO,jqe);h.x/=e._relativeSize,h.y/=e._relativeSize;for(let L=0;L<u;++L){if(n.charAt(L)===`
`){r.push(i),++l,i=0;continue}let _=t[L].dimensions;c(_)&&(a=Math.max(a,_.height-_.descent),s=Math.max(s,_.descent),i+=_.width-_.minx,L<u-1&&(i+=t[L+1].dimensions.minx),o=Math.max(o,i))}r.push(i);let p=a+s,g=e.totalScale,m=e._horizontalOrigin,y=e._verticalOrigin,b=0,x=r[b],A=_ue(x,m,h),C=(c(e._lineHeight)?e._lineHeight:Bqe*e._fontSize)/e._relativeSize,S=C*(l-1),v=o,P=p+S;c(f)&&(v+=h.x*2,P+=h.y*2,f._labelHorizontalOrigin=m),_r.x=A*g,_r.y=0;let M=!0,R=0;for(let L=0;L<u;++L){if(n.charAt(L)===`
`){++b,R+=C,x=r[b],A=_ue(x,m,h),_r.x=A*g,M=!0;continue}let F=t[L],_=F.dimensions;if(c(_)&&(y===Fn.TOP?(_r.y=_.height-a-h.y,_r.y+=Ks.PADDING):y===Fn.CENTER?_r.y=(S+_.height-a)/2:y===Fn.BASELINE?(_r.y=S,_r.y-=Ks.PADDING):(_r.y=S+s+h.y,_r.y-=Ks.PADDING),_r.y=(_r.y-_.descent-R)*g,M&&(_r.x-=Ks.PADDING*g,M=!1),c(F.billboard)&&(F.billboard._setTranslate(_r),F.billboard._labelDimensions.x=v,F.billboard._labelDimensions.y=P,F.billboard._labelHorizontalOrigin=m),L<u-1)){let w=t[L+1];_r.x+=(_.width-_.minx+w.dimensions.minx)*g}}if(c(f)&&n.split(`
`).join("").length>0&&(m===bi.CENTER?A=-o/2-h.x:m===bi.RIGHT?A=-(o+h.x*2):A=0,_r.x=A*g,y===Fn.TOP?_r.y=p-a-s:y===Fn.CENTER?_r.y=(p-a)/2-s:y===Fn.BASELINE?_r.y=-h.y-s:_r.y=0,_r.y=_r.y*g,f.width=v,f.height=P,f._setTranslate(_r),f._labelTranslate=H.clone(_r,f._labelTranslate)),Df(e.heightReference))for(let L=0;L<u;++L){let _=t[L].billboard;c(_)&&(_._labelTranslate=H.clone(_r,_._labelTranslate))}}function bue(e,t){let n=t._glyphs;for(let i=0,o=n.length;i<o;++i)LW(e,n[i]);c(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,c(t._removeCallbackFunc)&&t._removeCallbackFunc(),de(t)}function Im(e){e=e??W.EMPTY_OBJECT,this._scene=e.scene,this._batchTable=e.batchTable;let t=new Ru({scene:this._scene,textureAtlas:new vb({initialSize:MW})});this._backgroundBillboardCollection=t,this._backgroundBillboardTexture=new T_(t),this._glyphBillboardCollection=new Ru({scene:this._scene,batchTable:this._batchTable}),this._glyphBillboardCollection._sdf=!0,this._spareBillboards=[],this._textDimensionsCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=G.clone(G.WHITE),this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.blendOption=e.blendOption??wo.OPAQUE_AND_TRANSLUCENT}Object.defineProperties(Im.prototype,{length:{get:function(){return this._labels.length}},sizeInBytes:{get:function(){return this._glyphBillboardCollection.sizeInBytes+this._backgroundBillboardCollection.sizeInBytes}},ready:{get:function(){let e=this._backgroundBillboardCollection.get(0);return c(e)&&!e.ready?!1:this._glyphBillboardCollection.ready}}});Im.prototype.add=function(e){let t=new Uy(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Im.prototype.remove=function(e){if(c(e)&&e._labelCollection===this){let t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),bue(this,e),!0}return!1};Im.prototype.removeAll=function(){let e=this._labels;for(let t=0,n=e.length;t<n;++t)bue(this,e[t]);e.length=0};Im.prototype.contains=function(e){return c(e)&&e._labelCollection===this};Im.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._labels[e]};Im.prototype.update=function(e){if(!this.show)return;let t=this._glyphBillboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;let i=this._labelsToUpdate.length;for(let r=0;r<i;++r){let s=this._labelsToUpdate[r];if(s.isDestroyed())continue;let a=s._glyphs.length;s._rebindAllGlyphs&&(Gqe(this,s),s._rebindAllGlyphs=!1),s._repositionAllGlyphs&&(Wqe(s),s._repositionAllGlyphs=!1);let l=s._glyphs.length-a;this._totalGlyphCount+=l}let o=n.length>0?wo.TRANSLUCENT:this.blendOption;t.blendOption=o,n.blendOption=o,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Im.prototype.isDestroyed=function(){return!1};Im.prototype.destroy=function(){return this.removeAll(),this._glyphBillboardCollection=this._glyphBillboardCollection.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),de(this)};var Om=Im;var uL=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec3 position2DHigh;
in vec3 position2DLow;
in vec3 prevPosition3DHigh;
in vec3 prevPosition3DLow;
in vec3 prevPosition2DHigh;
in vec3 prevPosition2DLow;
in vec3 nextPosition3DHigh;
in vec3 nextPosition3DLow;
in vec3 nextPosition2DHigh;
in vec3 nextPosition2DLow;
in vec4 texCoordExpandAndBatchIndex;
out vec2  v_st;
out float v_width;
out vec4 v_pickColor;
out float v_polylineAngle;
void main()
{
float texCoord = texCoordExpandAndBatchIndex.x;
float expandDir = texCoordExpandAndBatchIndex.y;
bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;
float batchTableIndex = texCoordExpandAndBatchIndex.w;
vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);
float width = widthAndShow.x + 0.5;
float show = widthAndShow.y;
if (width < 1.0)
{
show = 0.0;
}
vec4 pickColor = batchTable_getPickColor(batchTableIndex);
vec4 p, prev, next;
if (czm_morphTime == 1.0)
{
p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);
prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);
next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);
}
else if (czm_morphTime == 0.0)
{
p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);
next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);
}
else
{
p = czm_columbusViewMorph(
czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),
czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),
czm_morphTime);
prev = czm_columbusViewMorph(
czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),
czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),
czm_morphTime);
next = czm_columbusViewMorph(
czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),
czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),
czm_morphTime);
}
#ifdef DISTANCE_DISPLAY_CONDITION
vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);
vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);
vec3 centerLow = centerLowAndRadius.xyz;
float radius = centerLowAndRadius.w;
vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);
lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);
}
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
if (lengthSq < nearSq || lengthSq > farSq)
{
show = 0.0;
}
#endif
float polylineAngle;
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);
gl_Position = czm_viewportOrthographic * positionWC * show;
v_st.s = texCoord;
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);
v_width = width;
v_pickColor = pickColor;
v_polylineAngle = polylineAngle;
}
`;var rl={};rl.numberOfPoints=function(e,t,n){let i=d.distance(e,t);return Math.ceil(i/n)};rl.numberOfPointsRhumbLine=function(e,t,n){let i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))};var qqe=new he;rl.extractHeights=function(e,t){let n=e.length,i=new Array(n);for(let o=0;o<n;o++){let r=e[o];i[o]=t.cartesianToCartographic(r,qqe).height}return i};var Yqe=new B,Xqe=new d,xue=new d,Kqe=new sn(d.UNIT_X,0),Tue=new d,$qe=new sn(d.UNIT_X,0),Zqe=new d,Qqe=new d,FW=[];function Cue(e,t,n){let i=FW;i.length=e;let o;if(t===n){for(o=0;o<e;o++)i[o]=t;return i}let s=(n-t)/e;for(o=0;o<e;o++){let a=t+o*s;i[o]=a}return i}var Vz=new he,Uz=new he,Vy=new d,BW=new d,Jqe=new d,NW=new kp,fL=new Ba;function e7e(e,t,n,i,o,r,s,a){let l=i.scaleToGeodeticSurface(e,BW),u=i.scaleToGeodeticSurface(t,Jqe),f=rl.numberOfPoints(e,t,n),h=i.cartesianToCartographic(l,Vz),p=i.cartesianToCartographic(u,Uz),g=Cue(f,o,r);NW.setEndPoints(h,p);let m=NW.surfaceDistance/f,y=a;h.height=o;let b=i.cartographicToCartesian(h,Vy);d.pack(b,s,y),y+=3;for(let x=1;x<f;x++){let A=NW.interpolateUsingSurfaceDistance(x*m,Uz);A.height=g[x],b=i.cartographicToCartesian(A,Vy),d.pack(b,s,y),y+=3}return y}function t7e(e,t,n,i,o,r,s,a){let l=i.cartesianToCartographic(e,Vz),u=i.cartesianToCartographic(t,Uz),f=rl.numberOfPointsRhumbLine(l,u,n);l.height=0,u.height=0;let h=Cue(f,o,r);fL.ellipsoid.equals(i)||(fL=new Ba(void 0,void 0,i)),fL.setEndPoints(l,u);let p=fL.surfaceDistance/f,g=a;l.height=o;let m=i.cartographicToCartesian(l,Vy);d.pack(m,s,g),g+=3;for(let y=1;y<f;y++){let b=fL.interpolateUsingSurfaceDistance(y*p,Uz);b.height=h[y],m=i.cartographicToCartesian(b,Vy),d.pack(m,s,g),g+=3}return g}rl.wrapLongitude=function(e,t){let n=[],i=[];if(c(e)&&e.length>0){t=t??B.IDENTITY;let o=B.inverseTransformation(t,Yqe),r=B.multiplyByPoint(o,d.ZERO,Xqe),s=d.normalize(B.multiplyByPointAsVector(o,d.UNIT_Y,xue),xue),a=sn.fromPointNormal(r,s,Kqe),l=d.normalize(B.multiplyByPointAsVector(o,d.UNIT_X,Tue),Tue),u=sn.fromPointNormal(r,l,$qe),f=1;n.push(d.clone(e[0]));let h=n[0],p=e.length;for(let g=1;g<p;++g){let m=e[g];if(sn.getPointDistance(u,h)<0||sn.getPointDistance(u,m)<0){let y=Zn.lineSegmentPlane(h,m,a,Zqe);if(c(y)){let b=d.multiplyByScalar(s,5e-9,Qqe);sn.getPointDistance(a,h)<0&&d.negate(b,b),n.push(d.add(y,b,new d)),i.push(f+1),d.negate(b,b),n.push(d.add(y,b,new d)),f=1}}n.push(d.clone(e[g])),f++,h=m}i.push(f)}return{positions:n,lengths:i}};rl.generateArc=function(e){c(e)||(e={});let t=e.positions;if(!c(t))throw new E("options.positions is required.");let n=t.length,i=e.ellipsoid??ie.default,o=e.height??0,r=Array.isArray(o);if(n<1)return[];if(n===1){let y=i.scaleToGeodeticSurface(t[0],BW);if(o=r?o[0]:o,o!==0){let b=i.geodeticSurfaceNormal(y,Vy);d.multiplyByScalar(b,o,b),d.add(y,b,y)}return[y.x,y.y,y.z]}let s=e.minDistance;if(!c(s)){let y=e.granularity??O.RADIANS_PER_DEGREE;s=O.chordLength(y,i.maximumRadius)}let a=0,l;for(l=0;l<n-1;l++)a+=rl.numberOfPoints(t[l],t[l+1],s);let u=(a+1)*3,f=new Array(u),h=0;for(l=0;l<n-1;l++){let y=t[l],b=t[l+1],x=r?o[l]:o,A=r?o[l+1]:o;h=e7e(y,b,s,i,x,A,f,h)}FW.length=0;let p=t[n-1],g=i.cartesianToCartographic(p,Vz);g.height=r?o[n-1]:o;let m=i.cartographicToCartesian(g,Vy);return d.pack(m,f,u-3),f};var Aue=new he,n7e=new he;rl.generateRhumbArc=function(e){c(e)||(e={});let t=e.positions;if(!c(t))throw new E("options.positions is required.");let n=t.length,i=e.ellipsoid??ie.default,o=e.height??0,r=Array.isArray(o);if(n<1)return[];if(n===1){let x=i.scaleToGeodeticSurface(t[0],BW);if(o=r?o[0]:o,o!==0){let A=i.geodeticSurfaceNormal(x,Vy);d.multiplyByScalar(A,o,A),d.add(x,A,x)}return[x.x,x.y,x.z]}let s=e.granularity??O.RADIANS_PER_DEGREE,a=0,l,u=i.cartesianToCartographic(t[0],Aue),f;for(l=0;l<n-1;l++)f=i.cartesianToCartographic(t[l+1],n7e),a+=rl.numberOfPointsRhumbLine(u,f,s),u=he.clone(f,Aue);let h=(a+1)*3,p=new Array(h),g=0;for(l=0;l<n-1;l++){let x=t[l],A=t[l+1],C=r?o[l]:o,S=r?o[l+1]:o;g=t7e(x,A,s,i,C,S,p,g)}FW.length=0;let m=t[n-1],y=i.cartesianToCartographic(m,Vz);y.height=r?o[n-1]:o;let b=i.cartographicToCartesian(y,Vy);return d.pack(b,p,h-3),p};rl.generateCartesianArc=function(e){let t=rl.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};rl.generateCartesianRhumbArc=function(e){let t=rl.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};var Fi=rl;function Mu(e,t){e=e??W.EMPTY_OBJECT,this._show=e.show??!0,this._width=e.width??1,this._loop=e.loop??!1,this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,c(this._material)||(this._material=Xi.fromType(Xi.ColorType,{color:new G(1,1,1,1)}));let n=e.positions;c(n)||(n=[]),this._positions=n,this._actualPositions=xo(n,d.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(d.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;c(t)&&(i=B.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=Fi.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(Sue),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=le.fromPoints(this._actualPositions),this._boundingVolumeWC=le.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new le}var Eue=Mu.POSITION_INDEX=0,i7e=Mu.SHOW_INDEX=1,o7e=Mu.WIDTH_INDEX=2,r7e=Mu.MATERIAL_INDEX=3,dL=Mu.POSITION_SIZE_INDEX=4,s7e=Mu.DISTANCE_DISPLAY_CONDITION=5,Sue=Mu.NUMBER_OF_PROPERTIES=6;function E_(e,t){++e._propertiesChanged[t];let n=e._polylineCollection;c(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(Mu.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");e!==this._show&&(this._show=e,E_(this,i7e))}},positions:{get:function(){return this._positions},set:function(e){if(!c(e))throw new E("value is required.");let t=xo(e,d.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(d.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&E_(this,dL),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=le.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=le.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),E_(this,Eue),this.update()}},material:{get:function(){return this._material},set:function(e){if(!c(e))throw new E("material is required.");this._material!==e&&(this._material=e,E_(this,r7e))}},width:{get:function(){return this._width},set:function(e){if(!c(e))throw new E("value is required.");let t=this._width;e!==t&&(this._width=e,E_(this,o7e))}},loop:{get:function(){return this._loop},set:function(e){if(!c(e))throw new E("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!d.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(d.clone(t[0]))):t.length>2&&d.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,E_(this,dL)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!c(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");Mt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=Mt.clone(e,this._distanceDisplayCondition),E_(this,s7e))}}});Mu.prototype.update=function(){let e=B.IDENTITY;c(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);let t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[Eue]>0||this._propertiesChanged[dL]>0;if((!B.equals(e,this._modelMatrix)||i)&&(this._segments=Fi.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=le.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=B.clone(e,this._modelMatrix),this._segments.positions.length!==t)E_(this,dL);else{let o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){E_(this,dL);break}}};Mu.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};Mu.prototype._clean=function(){this._dirty=!1;let e=this._propertiesChanged;for(let t=0;t<Sue-1;++t)e[t]=0};Mu.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};var Gf=Mu;var a7e=Gf.SHOW_INDEX,c7e=Gf.WIDTH_INDEX,UW=Gf.POSITION_INDEX,l7e=Gf.MATERIAL_INDEX,wue=Gf.POSITION_SIZE_INDEX,u7e=Gf.DISTANCE_DISPLAY_CONDITION,Mue=Gf.NUMBER_OF_PROPERTIES,ql={texCoordExpandAndBatchIndex:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12};function fh(e){e=e??W.EMPTY_OBJECT,this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(Mue),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:Be.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=G.clone(G.WHITE);let t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(fh.prototype,{length:{get:function(){return VW(this),this._polylines.length}}});fh.prototype.add=function(e){let t=new Gf(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};fh.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,c(e._bucket)){let t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1};fh.prototype.removeAll=function(){zW(this),kue(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};fh.prototype.contains=function(e){return c(e)&&e._polylineCollection===this};fh.prototype.get=function(e){if(!c(e))throw new E("index is required.");return VW(this),this._polylines[e]};function f7e(e,t){c(e._batchTable)&&e._batchTable.destroy();let n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:$.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:$.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:$.FLOAT,componentsPerAttribute:2}];e._batchTable=new Rb(t,n,e._polylines.length)}var Lue=new Hn,Nue=new se,Fue=new H;fh.prototype.update=function(e){if(VW(this),this._polylines.length===0||!this.show)return;g7e(this,e);let t=e.context,n=e.mapProjection,i,o=this._propertiesChanged;if(this._createBatchTable){if(ut.maximumVertexTextureImageUnits===0)throw new ae("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");f7e(this,t),this._createBatchTable=!1}if(this._createVertexArray||h7e(this))Pue(this,t,n);else if(this._polylinesUpdated){let l=this._polylinesToUpdate;if(this._mode!==oe.SCENE3D){let u=l.length;for(let f=0;f<u;++f)i=l[f],i.update()}if(o[wue]||o[l7e])Pue(this,t,n);else{let u=l.length,f=this._polylineBuckets;for(let h=0;h<u;++h){i=l[h],o=i._propertiesChanged;let p=i._bucket,g=0;for(let m in f)if(f.hasOwnProperty(m)){if(f[m]===p){o[UW]&&p.writeUpdate(g,i,this._positionBuffer,n);break}g+=f[m].lengthOfPositions}if((o[a7e]||o[c7e])&&this._batchTable.setBatchedAttribute(i._index,0,new H(i._width,i._show)),this._batchTable.attributes.length>2){if(o[UW]||o[wue]){let m=e.mode===oe.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,y=Hn.fromCartesian(m.center,Lue),b=se.fromElements(y.low.x,y.low.y,y.low.z,m.radius,Nue);this._batchTable.setBatchedAttribute(i._index,2,y.high),this._batchTable.setBatchedAttribute(i._index,3,b)}if(o[u7e]){let m=Fue;m.x=0,m.y=Number.MAX_VALUE;let y=i.distanceDisplayCondition;c(y)&&(m.x=y.near,m.y=y.far),this._batchTable.setBatchedAttribute(i._index,4,m)}}i._clean()}}l.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let l=0;l<Mue;++l)o[l]=0;let r=B.IDENTITY;e.mode===oe.SCENE3D&&(r=this.modelMatrix);let s=e.passes,a=e.morphTime!==0;if((!c(this._opaqueRS)||this._opaqueRS.depthTest.enabled!==a)&&(this._opaqueRS=Ve.fromCache({depthMask:a,depthTest:{enabled:a}})),(!c(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=Ve.fromCache({blending:ln.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){let l=this._colorCommands;d7e(this,e,l,r)}};var hL=new le,vue=new le;function d7e(e,t,n,i){let o=t.context,r=t.commandList,s=n.length,a=0,l=!0,u=e._vertexArrays,f=e.debugShowBoundingVolume,p=e._batchTable.getUniformMapCallback(),g=u.length;for(let m=0;m<g;++m){let y=u[m],b=y.buckets,x=b.length;for(let A=0;A<x;++A){let C=b[A],S=C.offset,v=C.bucket.shaderProgram,P=C.bucket.polylines,M=P.length,R,L,F=0,_,w;for(let D=0;D<M;++D){let I=P[D],N=p7e(I._material);if(N!==R){if(c(R)&&F>0){let j=L.isTranslucent();a>=s?(_=new Qe({owner:e}),n.push(_)):_=n[a],++a,w=xt(p(L._uniforms),e._uniformMap),_.boundingVolume=le.clone(hL,_.boundingVolume),_.modelMatrix=i,_.shaderProgram=v,_.vertexArray=y.va,_.renderState=j?e._translucentRS:e._opaqueRS,_.pass=j?De.TRANSLUCENT:De.OPAQUE,_.debugShowBoundingVolume=f,_.pickId="v_pickColor",_.uniformMap=w,_.count=F,_.offset=S,S+=F,F=0,l=!0,r.push(_)}L=I._material,L.update(o),R=N}let k=I._locatorBuckets,z=k.length;for(let j=0;j<z;++j){let U=k[j];U.locator===C&&(F+=U.count)}let V;t.mode===oe.SCENE3D?V=I._boundingVolumeWC:t.mode===oe.COLUMBUS_VIEW?V=I._boundingVolume2D:t.mode===oe.SCENE2D?c(I._boundingVolume2D)&&(V=le.clone(I._boundingVolume2D,vue),V.center.x=0):c(I._boundingVolumeWC)&&c(I._boundingVolume2D)&&(V=le.union(I._boundingVolumeWC,I._boundingVolume2D,vue)),l?(l=!1,le.clone(V,hL)):le.union(V,hL,hL)}c(R)&&F>0&&(a>=s?(_=new Qe({owner:e}),n.push(_)):_=n[a],++a,w=xt(p(L._uniforms),e._uniformMap),_.boundingVolume=le.clone(hL,_.boundingVolume),_.modelMatrix=i,_.shaderProgram=v,_.vertexArray=y.va,_.renderState=L.isTranslucent()?e._translucentRS:e._opaqueRS,_.pass=L.isTranslucent()?De.TRANSLUCENT:De.OPAQUE,_.debugShowBoundingVolume=f,_.pickId="v_pickColor",_.uniformMap=w,_.count=F,_.offset=S,l=!0,r.push(_)),R=void 0}}n.length=a}fh.prototype.isDestroyed=function(){return!1};fh.prototype.destroy=function(){return Bue(this),zW(this),kue(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),de(this)};function h7e(e){let t=!1,n=e._propertiesChanged,i=e._positionBufferUsage;return n[UW]?(i.bufferUsage!==Be.STREAM_DRAW&&(t=!0,i.bufferUsage=Be.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==Be.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=Be.STATIC_DRAW):i.frameCount--),t}var Due=[0,0,0];function Pue(e,t,n){e._createVertexArray=!1,zW(e),Bue(e),_7e(e);let i=[[]],o=i[0],r=e._batchTable,s=e._useHighlightColor,a=[0],l=0,u=[[]],f=0,h=e._polylineBuckets,p,g;for(p in h)h.hasOwnProperty(p)&&(g=h[p],g.updateShader(t,r,s),f+=g.lengthOfPositions);if(f>0){let m=e._mode,y=new Float32Array(6*f*3),b=new Float32Array(f*4),x,A=0,C=0,S=0;for(p in h)if(h.hasOwnProperty(p)){g=h[p],g.write(y,b,A,C,S,r,t,n),m===oe.MORPHING&&(c(x)||(x=new Float32Array(6*f*3)),g.writeForMorph(x,A));let w=g.lengthOfPositions;A+=6*w*3,C+=w*4,S+=w*4,l=g.updateIndices(i,a,u,l)}let v=e._positionBufferUsage.bufferUsage,P=Be.STATIC_DRAW;e._positionBuffer=yt.createVertexBuffer({context:t,typedArray:y,usage:v});let M;c(x)&&(M=yt.createVertexBuffer({context:t,typedArray:x,usage:v})),e._texCoordExpandAndBatchIndexBuffer=yt.createVertexBuffer({context:t,typedArray:b,usage:P});let R=3*Float32Array.BYTES_PER_ELEMENT,L=4*Float32Array.BYTES_PER_ELEMENT,F=0,_=i.length;for(let w=0;w<_;++w)if(o=i[w],o.length>0){let D=new Uint16Array(o),I=yt.createIndexBuffer({context:t,typedArray:D,usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});F+=a[w];let N=6*(w*(R*O.SIXTY_FOUR_KILOBYTES)-F*R),k=R+N,z=R+k,V=R+z,j=R+V,U=R+j,q=w*(L*O.SIXTY_FOUR_KILOBYTES)-F*L,Y=[{index:ql.position3DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:N,strideInBytes:6*R},{index:ql.position3DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:ql.position2DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:N,strideInBytes:6*R},{index:ql.position2DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:ql.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:z,strideInBytes:6*R},{index:ql.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:ql.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:z,strideInBytes:6*R},{index:ql.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:ql.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:j,strideInBytes:6*R},{index:ql.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:U,strideInBytes:6*R},{index:ql.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:j,strideInBytes:6*R},{index:ql.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:$.FLOAT,offsetInBytes:U,strideInBytes:6*R},{index:ql.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:$.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:q}],te,K,Z,ee;m===oe.SCENE3D?(K=e._positionBuffer,te="vertexBuffer",Z=Due,ee="value"):m===oe.SCENE2D||m===oe.COLUMBUS_VIEW?(K=Due,te="value",Z=e._positionBuffer,ee="vertexBuffer"):(K=M,te="vertexBuffer",Z=e._positionBuffer,ee="vertexBuffer"),Y[0][te]=K,Y[1][te]=K,Y[2][ee]=Z,Y[3][ee]=Z,Y[4][te]=K,Y[5][te]=K,Y[6][ee]=Z,Y[7][ee]=Z,Y[8][te]=K,Y[9][te]=K,Y[10][ee]=Z,Y[11][ee]=Z;let me=new ti({context:t,attributes:Y,indexBuffer:I});e._vertexArrays.push({va:me,buckets:u[w]})}}}function m7e(e,t){return t instanceof Rt?t.id:t}var zz=[];function p7e(e){let t=Xi._uniformList[e.type],n=t.length;zz.length=2*n;let i=0;for(let o=0;o<n;++o){let r=t[o];zz[i]=r,zz[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify(zz,m7e)}`}function _7e(e){let t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},o=e._polylines,r=o.length;for(let s=0;s<r;++s){let a=o[s];if(a._actualPositions.length>1){a.update();let l=a.material,u=i[l.type];c(u)||(u=i[l.type]=new Rm(l,t,n)),u.addPolyline(a)}}}function g7e(e,t){let n=t.mode;(e._mode!==n||!B.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=B.clone(e.modelMatrix),e._createVertexArray=!0)}function VW(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;let t=[],n=[],i=0,o,r=e._polylines.length;for(let s=0;s<r;++s)o=e._polylines[s],o.isDestroyed||(o._index=i++,n.push(o),t.push(o));e._polylines=t,e._polylinesToUpdate=n}}function zW(e){let t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){let o=t[i]._bucket;c(o)&&(o.shaderProgram=o.shaderProgram&&o.shaderProgram.destroy())}}function Bue(e){let t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}fh.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function kue(e){let t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function kW(e,t,n){this.count=e,this.offset=t,this.bucket=n}function Rm(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}Rm.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};Rm.prototype.updateShader=function(e,t,n){if(c(this.shaderProgram))return;let i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&i.push("POLYLINE_DASH"),Vt.isInternetExplorer()||i.push("CLIP_POLYLINE");let o=new He({defines:i,sources:[`in vec4 v_pickColor;
`,this.material.shaderSource,kb]}),r=t.getVertexShaderCallback()(uL),s=new He({defines:i,sources:[xu,r]});this.shaderProgram=Jt.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:ql})};function Uue(e){return d.dot(d.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(sn.ORIGIN_ZX_PLANE)===Wt.INTERSECTING}Rm.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===oe.SCENE3D||!Uue(e))return t=e._actualPositions.length,t*4-4;let n=0,i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=i[o]*4-4;return n};var Ds=new d,jf=new d,Wf=new d,Hz=new d,y7e=new se,b7e=new H;Rm.prototype.write=function(e,t,n,i,o,r,s,a){let l=this.mode,u=a.ellipsoid.maximumRadius*O.PI,f=this.polylines,h=f.length;for(let p=0;p<h;++p){let g=f[p],m=g.width,y=g.show&&m>0,b=g._index,x=this.getSegments(g,a),A=x.positions,C=x.lengths,S=A.length,v=g.getPickId(s).color,P=0,M=0,R;for(let z=0;z<S;++z){z===0?g._loop?R=A[S-2]:(R=Hz,d.subtract(A[0],A[1],R),d.add(A[0],R,R)):R=A[z-1],d.clone(R,jf),d.clone(A[z],Ds),z===S-1?g._loop?R=A[1]:(R=Hz,d.subtract(A[S-1],A[S-2],R),d.add(A[S-1],R,R)):R=A[z+1],d.clone(R,Wf);let V=C[P];z===M+V&&(M+=V,++P);let j=z-M===0,U=z===M+C[P]-1;l===oe.SCENE2D&&(jf.z=0,Ds.z=0,Wf.z=0),(l===oe.SCENE2D||l===oe.MORPHING)&&(j||U)&&u-Math.abs(Ds.x)<1&&((Ds.x<0&&jf.x>0||Ds.x>0&&jf.x<0)&&d.clone(Ds,jf),(Ds.x<0&&Wf.x>0||Ds.x>0&&Wf.x<0)&&d.clone(Ds,Wf));let q=j?2:0,Y=U?2:4;for(let te=q;te<Y;++te){Hn.writeElements(Ds,e,n),Hn.writeElements(jf,e,n+6),Hn.writeElements(Wf,e,n+12);let K=te-2<0?-1:1;t[o]=z/(S-1),t[o+1]=2*(te%2)-1,t[o+2]=K,t[o+3]=b,n+=6*3,o+=4}}let L=y7e;L.x=G.floatToByte(v.red),L.y=G.floatToByte(v.green),L.z=G.floatToByte(v.blue),L.w=G.floatToByte(v.alpha);let F=b7e;F.x=m,F.y=y?1:0;let _=l===oe.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,w=Hn.fromCartesian(_.center,Lue),D=w.high,I=se.fromElements(w.low.x,w.low.y,w.low.z,_.radius,Nue),N=Fue;N.x=0,N.y=Number.MAX_VALUE;let k=g.distanceDisplayCondition;c(k)&&(N.x=k.near,N.y=k.far),r.setBatchedAttribute(b,0,F),r.setBatchedAttribute(b,1,L),r.attributes.length>2&&(r.setBatchedAttribute(b,2,D),r.setBatchedAttribute(b,3,I),r.setBatchedAttribute(b,4,N))}};var x7e=new d,T7e=new d,A7e=new d,Iue=new d;Rm.prototype.writeForMorph=function(e,t){let n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=s._segments.positions,l=s._segments.lengths,u=a.length,f=0,h=0;for(let p=0;p<u;++p){let g;p===0?s._loop?g=a[u-2]:(g=Iue,d.subtract(a[0],a[1],g),d.add(a[0],g,g)):g=a[p-1],g=B.multiplyByPoint(n,g,T7e);let m=B.multiplyByPoint(n,a[p],x7e),y;p===u-1?s._loop?y=a[1]:(y=Iue,d.subtract(a[u-1],a[u-2],y),d.add(a[u-1],y,y)):y=a[p+1],y=B.multiplyByPoint(n,y,A7e);let b=l[f];p===h+b&&(h+=b,++f);let x=p-h===0,A=p===h+l[f]-1,C=x?2:0,S=A?2:4;for(let v=C;v<S;++v)Hn.writeElements(m,e,t),Hn.writeElements(g,e,t+6),Hn.writeElements(y,e,t+12),t+=6*3}}};var C7e=new Array(1);Rm.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new kW(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],l=0;a.length>0&&(l=a[a.length-1]+1);let u=this.polylines,f=u.length;for(let h=0;h<f;++h){let p=u[h];p._locatorBuckets=[];let g;if(this.mode===oe.SCENE3D){g=C7e;let y=p._actualPositions.length;if(y>0)g[0]=y;else continue}else g=p._segments.lengths;let m=g.length;if(m>0){let y=0;for(let b=0;b<m;++b){let x=g[b]-1;for(let A=0;A<x;++A)l+4>O.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:r,count:y}),y=0,t.push(4),a=[],e.push(a),l=0,r.count=s,s=0,i=0,r=new kW(0,0,this),n[++o]=[r]),a.push(l,l+2,l+1),a.push(l+1,l+2,l+3),y+=6,s+=6,i+=6,l+=4}p._locatorBuckets.push({locator:r,count:y}),l+4>O.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),l=0,r.count=s,i=0,s=0,r=new kW(0,0,this),n[++o]=[r])}p._clean()}return r.count=s,i};Rm.prototype.getPolylineStartIndex=function(e){let t=this.polylines,n=0,i=t.length;for(let o=0;o<i;++o){let r=t[o];if(r===e)break;n+=r._actualLength}return n};var CE={positions:void 0,lengths:void 0},Oue=new Array(1),E7e=new d,S7e=new he;Rm.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===oe.SCENE3D)return Oue[0]=n.length,CE.positions=n,CE.lengths=Oue,CE;Uue(e)&&(n=e._segments.positions);let i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length,a,l=E7e;for(let u=0;u<s;++u)a=n[u],l=B.multiplyByPoint(r,a,l),o.push(t.project(i.cartesianToCartographic(l,S7e)));if(o.length>0){e._boundingVolume2D=le.fromPoints(o,e._boundingVolume2D);let u=e._boundingVolume2D.center;e._boundingVolume2D.center=new d(u.z,u.x,u.y)}return CE.positions=o,CE.lengths=e._segments.lengths,CE};var Rue;Rm.prototype.writeUpdate=function(e,t,n,i){let o=this.mode,r=i.ellipsoid.maximumRadius*O.PI,s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=Rue,l=6*s*3;!c(a)||a.length<l?a=Rue=new Float32Array(l):a.length>l&&(a=new Float32Array(a.buffer,0,l));let u=this.getSegments(t,i),f=u.positions,h=u.lengths,p=0,g=0,m=0,y;s=f.length;for(let b=0;b<s;++b){b===0?t._loop?y=f[s-2]:(y=Hz,d.subtract(f[0],f[1],y),d.add(f[0],y,y)):y=f[b-1],d.clone(y,jf),d.clone(f[b],Ds),b===s-1?t._loop?y=f[1]:(y=Hz,d.subtract(f[s-1],f[s-2],y),d.add(f[s-1],y,y)):y=f[b+1],d.clone(y,Wf);let x=h[g];b===m+x&&(m+=x,++g);let A=b-m===0,C=b===m+h[g]-1;o===oe.SCENE2D&&(jf.z=0,Ds.z=0,Wf.z=0),(o===oe.SCENE2D||o===oe.MORPHING)&&(A||C)&&r-Math.abs(Ds.x)<1&&((Ds.x<0&&jf.x>0||Ds.x>0&&jf.x<0)&&d.clone(Ds,jf),(Ds.x<0&&Wf.x>0||Ds.x>0&&Wf.x<0)&&d.clone(Ds,Wf));let S=A?2:0,v=C?2:4;for(let P=S;P<v;++P)Hn.writeElements(Ds,a,p),Hn.writeElements(jf,a,p+6),Hn.writeElements(Wf,a,p+12),p+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};var dh=fh;function zy(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=new Ru({batchTable:e.batchTable}),this._labelCollection=new Om({batchTable:e.batchTable}),this._polylineCollection=new dh,this._polylineCollection._useHighlightColor=!0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(zy.prototype,{ready:{get:function(){return this._ready}},pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){let e=this._billboardCollection.sizeInBytes,t=this._labelCollection.sizeInBytes;return e+t}}});function w7e(e,t){let n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+ce.packedLength+ie.packedLength,s=new Float64Array(r),a=0;return s[a++]=i,s[a++]=o,ce.pack(n,s,a),a+=ce.packedLength,ie.pack(t,s,a),s}var v7e=new yi("createVectorTilePoints",5),D7e=new d;function P7e(e,t){let n=e._positions,i=e._packedBuffer;c(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=w7e(e,t));let o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=v7e.scheduleTask(r,o);if(c(s))return s.then(a=>{if(e.isDestroyed())return;e._positions=new Float64Array(a.positions);let l=e._billboardCollection,u=e._labelCollection,f=e._polylineCollection;n=e._positions;let h=e._batchIds,p=n.length/3;for(let g=0;g<p;++g){let m=h[g],y=d.unpack(n,g*3,D7e),b=l.add();b.position=y,b._batchIndex=m;let x=u.add();x.text=" ",x.position=y,x._batchIndex=m;let A=f.add();A.positions=[d.clone(y),d.clone(y)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}).catch(a=>{e.isDestroyed()||(e._error=a)})}zy.prototype.createFeatures=function(e,t){let n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a<s;++a){let l=r[a],u=n.get(a),f=i.get(a),h=o.get(a);t[l]=new A_(e,l,u,f,h)}};zy.prototype.applyDebugSettings=function(e,t){e?(G.clone(t,this._billboardCollection._highlightColor),G.clone(t,this._labelCollection._highlightColor),G.clone(t,this._polylineCollection._highlightColor)):(G.clone(G.WHITE,this._billboardCollection._highlightColor),G.clone(G.WHITE,this._labelCollection._highlightColor),G.clone(G.WHITE,this._polylineCollection._highlightColor))};function I7e(e,t){let n=e._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.show=!0,s.pointSize=A_.defaultPointSize,s.color=A_.defaultColor,s.pointOutlineColor=A_.defaultPointOutlineColor,s.pointOutlineWidth=A_.defaultPointOutlineWidth,s.labelColor=G.WHITE,s.labelOutlineColor=G.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=Yo.FILL,s.labelText=void 0,s.backgroundColor=new G(.165,.165,.165,.8),s.backgroundPadding=new H(7,5),s.backgroundEnabled=!1,s.scaleByDistance=void 0,s.translucencyByDistance=void 0,s.distanceDisplayCondition=void 0,s.heightOffset=0,s.anchorLineEnabled=!1,s.anchorLineColor=G.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=bi.CENTER,s.verticalOrigin=Fn.CENTER,s.labelHorizontalOrigin=bi.RIGHT,s.labelVerticalOrigin=Fn.BASELINE}}var O7e=new G,R7e=new G,M7e=new G,L7e=new G,N7e=new G,F7e=new G,mL=new Bt,pL=new Bt,HW=new Mt;zy.prototype.applyStyle=function(e,t){if(!c(e)){I7e(this,t);return}let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];if(c(e.show)&&(s.show=e.show.evaluate(s)),c(e.pointSize)&&(s.pointSize=e.pointSize.evaluate(s)),c(e.color)&&(s.color=e.color.evaluateColor(s,O7e)),c(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,R7e)),c(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),c(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,M7e)),c(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,L7e)),c(e.labelOutlineWidth)&&(s.labelOutlineWidth=e.labelOutlineWidth.evaluate(s)),c(e.font)&&(s.font=e.font.evaluate(s)),c(e.labelStyle)&&(s.labelStyle=e.labelStyle.evaluate(s)),c(e.labelText)?s.labelText=e.labelText.evaluate(s):s.labelText=void 0,c(e.backgroundColor)&&(s.backgroundColor=e.backgroundColor.evaluateColor(s,N7e)),c(e.backgroundPadding)&&(s.backgroundPadding=e.backgroundPadding.evaluate(s)),c(e.backgroundEnabled)&&(s.backgroundEnabled=e.backgroundEnabled.evaluate(s)),c(e.scaleByDistance)){let a=e.scaleByDistance.evaluate(s);c(a)?(mL.near=a.x,mL.nearValue=a.y,mL.far=a.z,mL.farValue=a.w,s.scaleByDistance=mL):s.scaleByDistance=void 0}else s.scaleByDistance=void 0;if(c(e.translucencyByDistance)){let a=e.translucencyByDistance.evaluate(s);c(a)?(pL.near=a.x,pL.nearValue=a.y,pL.far=a.z,pL.farValue=a.w,s.translucencyByDistance=pL):s.translucencyByDistance=void 0}else s.translucencyByDistance=void 0;if(c(e.distanceDisplayCondition)){let a=e.distanceDisplayCondition.evaluate(s);c(a)?(HW.near=a.x,HW.far=a.y,s.distanceDisplayCondition=HW):s.distanceDisplayCondition=void 0}else s.distanceDisplayCondition=void 0;c(e.heightOffset)&&(s.heightOffset=e.heightOffset.evaluate(s)),c(e.anchorLineEnabled)&&(s.anchorLineEnabled=e.anchorLineEnabled.evaluate(s)),c(e.anchorLineColor)&&(s.anchorLineColor=e.anchorLineColor.evaluateColor(s,F7e)),c(e.image)?s.image=e.image.evaluate(s):s.image=void 0,c(e.disableDepthTestDistance)&&(s.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(s)),c(e.horizontalOrigin)&&(s.horizontalOrigin=e.horizontalOrigin.evaluate(s)),c(e.verticalOrigin)&&(s.verticalOrigin=e.verticalOrigin.evaluate(s)),c(e.labelHorizontalOrigin)&&(s.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(s)),c(e.labelVerticalOrigin)&&(s.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(s))}};zy.prototype.update=function(e){if(!this._ready&&(c(this._promise)||(this._promise=P7e(this,e.mapProjection.ellipsoid)),c(this._error))){let t=this._error;throw this._error=void 0,t}this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e)};zy.prototype.isDestroyed=function(){return!1};zy.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),de(this)};var _L=zy;function S_(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=e.ellipsoid??ie.WGS84,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=e.center??d.ZERO,this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Un.BOTH}Object.defineProperties(S_.prototype,{trianglesLength:{get:function(){return c(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}});function B7e(e){let t=new Float64Array(3+d.packedLength+ie.packedLength+ce.packedLength),n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,d.pack(e._center,t,n),n+=d.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,ce.pack(e._rectangle,t,n),t}function k7e(e,t){let n=1,i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=Dn.unpack(t,n),n+=Dn.packedLength;let r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){let l=G.unpack(t,n);n+=G.packedLength;let u=t[n++],f=t[n++],h=t[n++],p=new Array(h);for(let g=0;g<h;++g)p[g]=t[n++];s[a]=new bm({color:l,offset:u,count:f,batchIds:p})}}var U7e=new yi("createVectorTilePolygons",5),V7e=new G;function z7e(e){if(c(e._primitive))return;let t=e._positions,n=e._counts,i=e._indexCounts,o=e._indices,r=e._transferrableBatchIds,s=e._batchTableColors,a=e._packedBuffer;if(!c(s)){t=e._positions=e._positions.slice(),n=e._counts=e._counts.slice(),i=e._indexCounts=e._indexCounts.slice(),o=e._indices=e._indices.slice(),e._center=e._ellipsoid.cartographicToCartesian(ce.center(e._rectangle)),r=e._transferrableBatchIds=new Uint32Array(e._batchIds),s=e._batchTableColors=new Uint32Array(r.length);let g=e._batchTable,m=s.length;for(let y=0;y<m;++y){let b=g.getColor(y,V7e);s[y]=b.toRgba()}a=e._packedBuffer=B7e(e)}let l=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],u={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer},f=e._polygonMinimumHeights,h=e._polygonMaximumHeights;c(f)&&c(h)&&(f=f.slice(),h=h.slice(),l.push(f.buffer,h.buffer),u.minimumHeights=f,u.maximumHeights=h);let p=U7e.scheduleTask(u,l);if(c(p))return p.then(g=>{if(e.isDestroyed())return;e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;let m=new Float64Array(g.packedBuffer),y=m[0];k7e(e,m),e._indices=Fe.getSizeInBytes(y)===2?new Uint16Array(g.indices):new Uint32Array(g.indices),e._indexOffsets=new Uint32Array(g.indexOffsets),e._indexCounts=new Uint32Array(g.indexCounts),e._batchedPositions=new Float32Array(g.positions),e._vertexBatchIds=new Uint16Array(g.batchIds),H7e(e),e._ready=!0}).catch(g=>{e.isDestroyed()||(e._error=g)})}function H7e(e){c(e._primitive)||(e._primitive=new rx({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0)}S_.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};S_.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};S_.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};S_.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};S_.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=z7e(this)),c(this._error)){let t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};S_.prototype.isDestroyed=function(){return!1};S_.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),de(this)};var gL=S_;var yL=`in vec4 currentPosition;
in vec4 previousPosition;
in vec4 nextPosition;
in vec2 expandAndWidth;
in float a_batchId;
uniform mat4 u_modifiedModelView;
void main()
{
float expandDir = expandAndWidth.x;
float width = abs(expandAndWidth.y) + 0.5;
bool usePrev = expandAndWidth.y < 0.0;
vec4 p = u_modifiedModelView * currentPosition;
vec4 prev = u_modifiedModelView * previousPosition;
vec4 next = u_modifiedModelView * nextPosition;
float angle;
vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);
gl_Position = czm_viewportOrthographic * positionWC;
}
`;function hh(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=e.ellipsoid??ie.WGS84,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=G.clone(G.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(hh.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function G7e(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ie.packedLength+d.packedLength,a=new Float64Array(s),l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ie.pack(o,a,l),l+=ie.packedLength,d.pack(r,a,l),a}var j7e=new yi("createVectorTilePolylines",5),EE={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function W7e(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=G7e(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=j7e.scheduleTask(l,a);if(c(u))return u.then(function(f){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._currentPositions=new Float32Array(f.currentPositions),e._previousPositions=new Float32Array(f.previousPositions),e._nextPositions=new Float32Array(f.nextPositions),e._expandAndWidth=new Float32Array(f.expandAndWidth),e._vertexBatchIds=new Uint16Array(f.batchIds);let h=f.indexDatatype;e._indices=h===Fe.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),q7e(e,t),e._ready=!0}).catch(f=>{e.isDestroyed()||(e._error=f)})}function q7e(e,t){if(!c(e._va)){let n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices,l=i.byteLength+n.byteLength+o.byteLength;l+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=l;let u=yt.createVertexBuffer({context:t,typedArray:i,usage:Be.STATIC_DRAW}),f=yt.createVertexBuffer({context:t,typedArray:n,usage:Be.STATIC_DRAW}),h=yt.createVertexBuffer({context:t,typedArray:o,usage:Be.STATIC_DRAW}),p=yt.createVertexBuffer({context:t,typedArray:r,usage:Be.STATIC_DRAW}),g=yt.createVertexBuffer({context:t,typedArray:s,usage:Be.STATIC_DRAW}),m=yt.createIndexBuffer({context:t,typedArray:a,usage:Be.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),y=[{index:EE.previousPosition,vertexBuffer:u,componentDatatype:$.FLOAT,componentsPerAttribute:3},{index:EE.currentPosition,vertexBuffer:f,componentDatatype:$.FLOAT,componentsPerAttribute:3},{index:EE.nextPosition,vertexBuffer:h,componentDatatype:$.FLOAT,componentsPerAttribute:3},{index:EE.expandAndWidth,vertexBuffer:p,componentDatatype:$.FLOAT,componentsPerAttribute:2},{index:EE.a_batchId,vertexBuffer:g,componentDatatype:$.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new ti({context:t,attributes:y,indexBuffer:m}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}var bL=new B,Vue=new d;function Y7e(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){let n=t.uniformState.view;return B.clone(n,bL),B.multiplyByPoint(bL,e._center,Vue),B.setTranslation(bL,Vue,bL),bL},u_highlightColor:function(){return e._highlightColor}})}function X7e(e){if(c(e._rs))return;let t={enabled:!0,factor:-5,units:-5};e._rs=Ve.fromCache({blending:ln.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}var K7e=`uniform vec4 u_highlightColor; 
void main()
{
    out_FragColor = u_highlightColor;
}
`;function $7e(e,t){if(c(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(yL),o=n.getFragmentShaderCallback(!1,void 0,!1)(K7e),r=new He({defines:["VECTOR_TILE",Vt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[xu,i]}),s=new He({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:EE})}function Z7e(e,t){if(!c(e._command)){let n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new Qe({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:De.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}hh.getPolylinePositions=function(e,t){let n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!c(n)||!c(i))return;let r,s,a=n.length,l=0,u=0;for(r=0;r<a;++r)n[r]===t&&(l+=o[r+1]-o[r]);if(l===0)return;let f=new Float64Array(l*3);for(r=0;r<a;++r)if(n[r]===t){let h=o[r],p=o[r+1]-h;for(s=0;s<p;++s){let g=(h+s)*3;f[u++]=i[g],f[u++]=i[g+1],f[u++]=i[g+2]}}return f};hh.prototype.getPositions=function(e){return hh.getPolylinePositions(this,e)};hh.prototype.createFeatures=function(e,t){let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o];t[r]=new Ws(e,r)}};hh.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function Q7e(e,t){let n=e._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.show=!0,s.color=G.WHITE}}var J7e=new G,eYe=G.WHITE,tYe=!0;hh.prototype.applyStyle=function(e,t){if(!c(e)){Q7e(this,t);return}let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.color=c(e.color)?e.color.evaluateColor(s,J7e):eYe,s.show=c(e.show)?e.show.evaluate(s):tYe}};hh.prototype.update=function(e){let t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=W7e(this,t)),c(this._error)){let i=this._error;throw this._error=void 0,i}return}Y7e(this,t),$7e(this,t),X7e(this);let n=e.passes;(n.render||n.pick)&&Z7e(this,e)};hh.prototype.isDestroyed=function(){return!1};hh.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),de(this)};var kx=hh;var xL=`in vec3 startEllipsoidNormal;
in vec3 endEllipsoidNormal;
in vec4 startPositionAndHeight;
in vec4 endPositionAndHeight;
in vec4 startFaceNormalAndVertexCorner;
in vec4 endFaceNormalAndHalfWidth;
in float a_batchId;
uniform mat4 u_modifiedModelView;
uniform vec2 u_minimumMaximumVectorHeights;
out vec4 v_startPlaneEC;
out vec4 v_endPlaneEC;
out vec4 v_rightPlaneEC;
out float v_halfWidth;
out vec3 v_volumeUpEC;
void main()
{
float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251);
float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd));
vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;
vec3 right = normalize(cross(forward, startEllipsoidNormal));
vec4 position = vec4(startPositionAndHeight.xyz, 1.0);
position.xyz += forward * isEnd;
v_volumeUpEC = czm_normal * normalize(cross(right, forward));
float offset;
vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);
offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);
offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;
position.xyz += offset * ellipsoidNormal;
position = u_modifiedModelView * position;
right = czm_normal * right;
vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);
scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));
vec3 miterPushNormal = czm_normal * normalize(scratchNormal);
offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position));
offset = offset / dot(miterPushNormal, right);
position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));
gl_Position = czm_depthClamp(czm_projection * position);
position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);
vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;
v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));
v_rightPlaneEC = vec4(right, -dot(right, position.xyz));
position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);
vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;
v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));
v_halfWidth = endFaceNormalAndHalfWidth.w;
}
`;var TL=`in vec4 v_startPlaneEC;
in vec4 v_endPlaneEC;
in vec4 v_rightPlaneEC;
in float v_halfWidth;
in vec3 v_volumeUpEC;
uniform vec4 u_highlightColor;
void main()
{
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
if (logDepthOrDepth == 0.0) {
#ifdef DEBUG_SHOW_VOLUME
out_FragColor = vec4(0.0, 0.0, 1.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
eyeCoordinate /= eyeCoordinate.w;
float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);
halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);
float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
#ifdef DEBUG_SHOW_VOLUME
out_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
return;
#else // DEBUG_SHOW_VOLUME
discard;
#endif // DEBUG_SHOW_VOLUME
}
out_FragColor = u_highlightColor;
czm_writeDepthClamp();
}
`;function w_(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=e.ellipsoid??ie.WGS84,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new H(ui._defaultMinTerrainHeight,ui._defaultMaxTerrainHeight),this._boundingVolume=Dn.fromRectangle(e.rectangle,ui._defaultMinTerrainHeight,ui._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=G.clone(G.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(w_.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function nYe(e,t,n){let i=ui.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;let a=e._boundingVolume,l=e._rectangle;Dn.fromRectangle(l,o,r,n,a)}function iYe(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ie.packedLength+d.packedLength,a=new Float64Array(s),l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ie.pack(o,a,l),l+=ie.packedLength,d.pack(r,a,l),a}var oYe=new yi("createVectorTileClampedPolylines"),Hy={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function rYe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=iYe(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=oYe.scheduleTask(l,a);if(c(u))return u.then(function(f){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(f.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(f.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(f.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(f.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(f.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(f.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(f.vertexBatchIds);let h=f.indexDatatype;e._indices=h===Fe.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),sYe(e,t),e._ready=!0}).catch(f=>{e.isDestroyed()||(e._error=f)})}function sYe(e,t){if(!c(e._va)){let n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,l=e._vertexBatchIds,u=e._indices,f=n.byteLength+i.byteLength;f+=o.byteLength+r.byteLength,f+=s.byteLength+a.byteLength,f+=l.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=f;let h=yt.createVertexBuffer({context:t,typedArray:n,usage:Be.STATIC_DRAW}),p=yt.createVertexBuffer({context:t,typedArray:i,usage:Be.STATIC_DRAW}),g=yt.createVertexBuffer({context:t,typedArray:o,usage:Be.STATIC_DRAW}),m=yt.createVertexBuffer({context:t,typedArray:r,usage:Be.STATIC_DRAW}),y=yt.createVertexBuffer({context:t,typedArray:s,usage:Be.STATIC_DRAW}),b=yt.createVertexBuffer({context:t,typedArray:a,usage:Be.STATIC_DRAW}),x=yt.createVertexBuffer({context:t,typedArray:l,usage:Be.STATIC_DRAW}),A=yt.createIndexBuffer({context:t,typedArray:u,usage:Be.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),C=[{index:Hy.startEllipsoidNormal,vertexBuffer:h,componentDatatype:$.FLOAT,componentsPerAttribute:3},{index:Hy.endEllipsoidNormal,vertexBuffer:p,componentDatatype:$.FLOAT,componentsPerAttribute:3},{index:Hy.startPositionAndHeight,vertexBuffer:g,componentDatatype:$.FLOAT,componentsPerAttribute:4},{index:Hy.endPositionAndHeight,vertexBuffer:m,componentDatatype:$.FLOAT,componentsPerAttribute:4},{index:Hy.startFaceNormalAndVertexCorner,vertexBuffer:y,componentDatatype:$.FLOAT,componentsPerAttribute:4},{index:Hy.endFaceNormalAndHalfWidth,vertexBuffer:b,componentDatatype:$.FLOAT,componentsPerAttribute:4},{index:Hy.a_batchId,vertexBuffer:x,componentDatatype:$.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new ti({context:t,attributes:C,indexBuffer:A}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}var AL=new B,zue=new d;function aYe(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){let n=t.uniformState.view;return B.clone(n,AL),B.multiplyByPoint(AL,e._center,zue),B.setTranslation(AL,zue,AL),AL},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function Hue(e){return Ve.fromCache({cull:{enabled:!0,face:xi.FRONT},blending:ln.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Vn.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:Vn.EQUAL,backOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK}})}function cYe(e){c(e._rs)||(e._rs=Hue(!1),e._rs3DTiles=Hue(!0))}function lYe(e,t){if(c(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(xL),o=n.getFragmentShaderCallback(!1,void 0,!0)(TL),r=new He({defines:["VECTOR_TILE",Vt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[xu,i]}),s=new He({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:Hy})}function uYe(e,t){let n=e._command;if(!c(e._command)){let o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new Qe({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:De.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});let r=Qe.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=De.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}let i=e._classificationType;(i===Un.TERRAIN||i===Un.BOTH)&&t.commandList.push(n),(i===Un.CESIUM_3D_TILE||i===Un.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}w_.prototype.getPositions=function(e){return kx.getPolylinePositions(this,e)};w_.prototype.createFeatures=function(e,t){let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o];t[r]=new Ws(e,r)}};w_.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function fYe(e,t){let n=e._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.show=!0,s.color=G.WHITE}}var dYe=new G,hYe=G.WHITE,mYe=!0;w_.prototype.applyStyle=function(e,t){if(!c(e)){fYe(this,t);return}let n=this._batchIds,i=n.length;for(let o=0;o<i;++o){let r=n[o],s=t[r];s.color=c(e.color)?e.color.evaluateColor(s,dYe):hYe,s.show=c(e.show)?e.show.evaluate(s):mYe}};function pYe(e){return ui.initialize().then(function(){nYe(e,e._rectangle,e._ellipsoid)}).catch(t=>{e.isDestroyed()||(e._error=t)})}w_.prototype.update=function(e){let t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=pYe(this).then(rYe(this,t))),c(this._error)){let i=this._error;throw this._error=void 0,i}return}aYe(this,t),lYe(this,t),cYe(this);let n=e.passes;(n.render||n.pick)&&uYe(this,e)};w_.prototype.isDestroyed=function(){return!1};w_.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),de(this)};var CL=w_;var GW=32767,_Ye=new he,gYe=new d;function yYe(e,t,n,i,o){let r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),l=e.subarray(2*r,3*r);Ln.zigZagDeltaDecode(s,a,l);let u=new Float64Array(e.length);for(let f=0;f<r;++f){let h=s[f],p=a[f],g=l[f],m=O.lerp(t.west,t.east,h/GW),y=O.lerp(t.south,t.north,p/GW),b=O.lerp(n,i,g/GW),x=he.fromRadians(m,y,b,_Ye),A=o.cartographicToCartesian(x,gYe);d.pack(A,u,f*3)}return u}var EL=yYe;function ph(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,CYe(this,i,o)}Object.defineProperties(ph.prototype,{featuresLength:{get:function(){return c(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return c(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return c(this._polygons)&&(e+=this._polygons.trianglesLength),c(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return c(this._polygons)&&(e+=this._polygons.geometryByteLength),c(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return c(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return c(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function bYe(e){return function(t,n){c(e._polygons)&&e._polygons.updateCommands(t,n)}}function xYe(e,t){let n,i,o,r,s=e.POLYGONS_LENGTH??0,a=e.POLYLINES_LENGTH??0,l=e.POINTS_LENGTH??0;if(s>0&&c(e.POLYGON_BATCH_IDS)){let p=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,s)}if(a>0&&c(e.POLYLINE_BATCH_IDS)){let p=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,p,a)}if(l>0&&c(e.POINT_BATCH_IDS)){let p=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,p,l)}let u=c(n)||c(i)||c(o),f=s>0&&!c(n)||a>0&&!c(i)||l>0&&!c(o);if(u&&f)throw new ae("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)){let p=0;if(!c(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=p++;if(!c(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=p++;if(!c(o)&&l>0)for(o=new Uint16Array(l),r=0;r<l;++r)o[r]=p++}return{polygons:n,polylines:i,points:o}}var mh=Uint32Array.BYTES_PER_ELEMENT;function TYe(e){return new kx(e)}function AYe(e){return new CL(e)}function CYe(e,t,n){n=n??0;let i=new Uint8Array(t),o=new DataView(t);n+=mh;let r=o.getUint32(n,!0);if(r!==1)throw new ae(`Only Vector tile version 1 is supported.  Version ${r} is not.`);n+=mh;let s=o.getUint32(n,!0);if(n+=mh,s===0){e._ready=!0;return}let a=o.getUint32(n,!0);if(n+=mh,a===0)throw new ae("Feature table must have a byte length greater than zero");let l=o.getUint32(n,!0);n+=mh;let u=o.getUint32(n,!0);n+=mh;let f=o.getUint32(n,!0);n+=mh;let h=o.getUint32(n,!0);n+=mh;let p=o.getUint32(n,!0);n+=mh;let g=o.getUint32(n,!0);n+=mh;let m=o.getUint32(n,!0);n+=mh;let y=ir(i,n,a);n+=a;let b=new Uint8Array(t,n,l);n+=l;let x,A;u>0&&(x=ir(i,n,u),n+=u,f>0&&(A=new Uint8Array(t,n,f),A=new Uint8Array(A),n+=f));let C=y.POLYGONS_LENGTH??0,S=y.POLYLINES_LENGTH??0,v=y.POINTS_LENGTH??0,P=C+S+v,M=new Kp(e,P,x,A,bYe(e));if(e._batchTable=M,P===0)return;let R=new sh(y,b),L=R.getGlobalProperty("REGION");if(!c(L))throw new ae("Feature table global property: REGION must be defined");let F=ce.unpack(L),_=L[4],w=L[5],D=e._tile.computedTransform,I=R.getGlobalProperty("RTC_CENTER",$.FLOAT,3);c(I)?(I=d.unpack(I),B.multiplyByPoint(D,I,I)):(I=ce.center(F),I.height=O.lerp(_,w,.5),I=ie.WGS84.cartographicToCartesian(I));let N=xYe(y,b);if(n+=(4-n%4)%4,C>0){R.featuresLength=C;let k=R.getPropertyArray("POLYGON_COUNTS",$.UNSIGNED_INT,1)??R.getPropertyArray("POLYGON_COUNT",$.UNSIGNED_INT,1);if(!c(k))throw new ae("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");let z=R.getPropertyArray("POLYGON_INDEX_COUNTS",$.UNSIGNED_INT,1)??R.getPropertyArray("POLYGON_INDEX_COUNT",$.UNSIGNED_INT,1);if(!c(z))throw new ae("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");let V=k.reduce(function(K,Z){return K+Z*2},0),j=z.reduce(function(K,Z){return K+Z},0),U=new Uint32Array(t,n,j);n+=h;let q=new Uint16Array(t,n,V);n+=p;let Y,te;c(y.POLYGON_MINIMUM_HEIGHTS)&&c(y.POLYGON_MAXIMUM_HEIGHTS)&&(Y=R.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",$.FLOAT,1),te=R.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",$.FLOAT,1)),e._polygons=new gL({positions:q,counts:k,indexCounts:z,indices:U,minimumHeight:_,maximumHeight:w,polygonMinimumHeights:Y,polygonMaximumHeights:te,center:I,rectangle:F,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:M,batchIds:N.polygons,modelMatrix:D})}if(S>0){R.featuresLength=S;let k=R.getPropertyArray("POLYLINE_COUNTS",$.UNSIGNED_INT,1)??R.getPropertyArray("POLYLINE_COUNT",$.UNSIGNED_INT,1);if(!c(k))throw new ae("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let z=R.getPropertyArray("POLYLINE_WIDTHS",$.UNSIGNED_SHORT,1);if(!c(z)){z=new Uint16Array(S);for(let te=0;te<S;++te)z[te]=2}let V=k.reduce(function(te,K){return te+K*3},0),j=new Uint16Array(t,n,V);n+=g;let U=e._tileset,q=U.examineVectorLinesFunction;if(c(q)){let te=EL(new Uint16Array(j),F,_,w,ie.WGS84);EYe(te,k,N.polylines,M,e.url,q)}let Y=TYe;c(U.classificationType)&&(Y=AYe),e._polylines=Y({positions:j,widths:z,counts:k,batchIds:N.polylines,minimumHeight:_,maximumHeight:w,center:I,rectangle:F,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:M,classificationType:U.classificationType,keepDecodedPositions:U.vectorKeepDecodedPositions})}if(v>0){let k=new Uint16Array(t,n,v*3);n+=m,e._points=new _L({positions:k,batchIds:N.points,minimumHeight:_,maximumHeight:w,rectangle:F,batchTable:M})}}function jW(e){let t=e.featuresLength;if(!c(e._features)&&t>0){let n=new Array(t);c(e._polygons)&&e._polygons.createFeatures(e,n),c(e._polylines)&&e._polylines.createFeatures(e,n),c(e._points)&&e._points.createFeatures(e,n),e._features=n}}ph.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};ph.prototype.getFeature=function(e){let t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return c(this._features)||jW(this),this._features[e]};ph.prototype.applyDebugSettings=function(e,t){c(this._polygons)&&this._polygons.applyDebugSettings(e,t),c(this._polylines)&&this._polylines.applyDebugSettings(e,t),c(this._points)&&this._points.applyDebugSettings(e,t)};ph.prototype.applyStyle=function(e){c(this._features)||jW(this),c(this._polygons)&&this._polygons.applyStyle(e,this._features),c(this._polylines)&&this._polylines.applyStyle(e,this._features),c(this._points)&&this._points.applyStyle(e,this._features)};ph.prototype.update=function(e,t){let n=!0;c(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons.ready),c(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines.ready),c(this._points)&&(this._points.update(t),n=n&&this._points.ready),c(this._batchTable)&&n&&(c(this._features)||jW(this),this._batchTable.update(e,t),this._ready=!0)};ph.prototype.pick=function(e,t,n){};ph.prototype.getPolylinePositions=function(e){let t=this._polylines;if(c(t))return t.getPositions(e)};ph.prototype.isDestroyed=function(){return!1};ph.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),de(this)};function EYe(e,t,n,i,o,r){let s=t.length,a=0;for(let l=0;l<s;l++){let u=t[l]*3,f=e.slice(a,a+u);a+=u,r(f,n[l],o,i)}}var SL=ph;var Gue={b3dm:function(e,t,n,i,o){return Ou.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return Ou.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return Ou.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return QO.fromTileType(e,t,n,i,o,Gue)},externalTileset:function(e,t,n,i){return tL.fromJson(e,t,n,i)},geom:function(e,t,n,i,o){return new n1(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new SL(e,t,n,i,o)},subt:function(e,t,n,i,o){return XC.fromSubtreeJson(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return XC.fromSubtreeJson(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new ae("Invalid glb content");let a=new DataView(i,o).getUint32(8,!0),l=new Uint8Array(i,o,a);return Ou.fromGltf(e,t,n,l)},gltf:function(e,t,n,i){return Ou.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return Ou.fromGeoJson(e,t,n,i)}},Ux=Gue;var SYe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Xo=Object.freeze(SYe);var _h={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",IMPLICIT_SUBTREE_JSON:"subtreeJson",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",GEOJSON:"geoJson",VOXEL_BINARY:"voxl",VOXEL_JSON:"voxelJson"};_h.isBinaryFormat=function(e){switch(e){case _h.BATCHED_3D_MODEL:case _h.INSTANCED_3D_MODEL:case _h.COMPOSITE:case _h.POINT_CLOUD:case _h.VECTOR:case _h.GEOMETRY:case _h.IMPLICIT_SUBTREE:case _h.VOXEL_BINARY:case _h.GLTF_BINARY:return!0;default:return!1}};var Ps=Object.freeze(_h);var wYe={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},qf=Object.freeze(wYe);var $s={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},v_=new Array($s.NUMBER_OF_PASSES);v_[$s.RENDER]=Object.freeze({pass:$s.RENDER,isRender:!0,requestTiles:!0,ignoreCommands:!1});v_[$s.PICK]=Object.freeze({pass:$s.PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1});v_[$s.SHADOW]=Object.freeze({pass:$s.SHADOW,isRender:!1,requestTiles:!0,ignoreCommands:!1});v_[$s.PRELOAD]=Object.freeze({pass:$s.PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0});v_[$s.PRELOAD_FLIGHT]=Object.freeze({pass:$s.PRELOAD_FLIGHT,isRender:!1,requestTiles:!0,ignoreCommands:!0});v_[$s.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({pass:$s.REQUEST_RENDER_MODE_DEFER_CHECK,isRender:!1,requestTiles:!0,ignoreCommands:!0});v_[$s.MOST_DETAILED_PRELOAD]=Object.freeze({pass:$s.MOST_DETAILED_PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0});v_[$s.MOST_DETAILED_PICK]=Object.freeze({pass:$s.MOST_DETAILED_PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1});$s.getPassOptions=function(e){return v_[e]};var Uo=Object.freeze($s);function Mm(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(Mm.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return!0}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){throw new E("Empty3DTileContent cannot have content metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){throw new E("Empty3DTileContent cannot have group metadata")}}});Mm.prototype.hasProperty=function(e,t){return!1};Mm.prototype.getFeature=function(e){};Mm.prototype.applyDebugSettings=function(e,t){};Mm.prototype.applyStyle=function(e){};Mm.prototype.update=function(e,t){};Mm.prototype.pick=function(e,t,n){};Mm.prototype.isDestroyed=function(){return!1};Mm.prototype.destroy=function(){return de(this)};var SE=Mm;function D_(e){e=e??W.EMPTY_OBJECT;let t=e.content,n=e.class;T.typeOf.object("options.content",t),T.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(D_.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});D_.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};D_.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};D_.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};D_.prototype.getProperty=function(e){return Bn.getProperty(e,this._properties,this._class)};D_.prototype.setProperty=function(e,t){return Bn.setProperty(e,t,this._properties,this._class)};D_.prototype.getPropertyBySemantic=function(e){return Bn.getPropertyBySemantic(e,this._properties,this._class)};D_.prototype.setPropertyBySemantic=function(e,t){return Bn.setPropertyBySemantic(e,t,this._properties,this._class)};var wL=D_;function WW(e,t){let n=oi(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!c(n))return;if(!c(e.schema)){WW._oneTimeWarning("findContentMetadata-missing-root-schema","Could not find a metadata schema for content metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}let i=e.schema.classes??W.EMPTY_OBJECT;if(c(n.class)){let o=i[n.class];return new wL({content:n,class:o})}}WW._oneTimeWarning=dt;var Vx=WW;function vYe(e,t){let n=e.metadataExtension;if(!c(n))return;let i=n.groups,o=oi(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if(typeof o=="number")return i[o];let r=n.groupIds.findIndex(function(s){return s===o});return r>=0?i[r]:void 0}var zx=vYe;function P_(e){e=e??W.EMPTY_OBJECT;let t=e.tile,n=e.class;T.typeOf.object("options.tile",t),T.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(P_.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});P_.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};P_.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};P_.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};P_.prototype.getProperty=function(e){return Bn.getProperty(e,this._properties,this._class)};P_.prototype.setProperty=function(e,t){return Bn.setProperty(e,t,this._properties,this._class)};P_.prototype.getPropertyBySemantic=function(e){return Bn.getPropertyBySemantic(e,this._properties,this._class)};P_.prototype.setPropertyBySemantic=function(e,t){return Bn.setPropertyBySemantic(e,t,this._properties,this._class)};var vL=P_;function qW(e,t){let n=oi(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!c(n))return;if(!c(e.schema)){qW._oneTimeWarning("findTileMetadata-missing-root-schema","Could not find a metadata schema for tile metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}let i=e.schema.classes??W.EMPTY_OBJECT;if(c(n.class)){let o=i[n.class];return new vL({tile:n,class:o})}}qW._oneTimeWarning=dt;var DL=qW;function DYe(e){let t=new Uint8Array(e),n=Kd(t);if(n==="glTF"&&(n="glb"),Ps.isBinaryFormat(n))return{contentType:n,binaryPayload:t};let i=PYe(t);if(c(i.root))return{contentType:Ps.EXTERNAL_TILESET,jsonPayload:i};if(c(i.asset))return{contentType:Ps.GLTF,jsonPayload:i};if(c(i.tileAvailability))return{contentType:Ps.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(c(i.type))return{contentType:Ps.GEOJSON,jsonPayload:i};if(c(i.voxelTable))return{contentType:Ps.VOXEL_JSON,jsonPayload:i};throw new ae("Invalid tile content.")}function PYe(e){let t;try{t=ir(e)}catch{throw new ae("Invalid tile content.")}return t}var I_=DYe;function Yf(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;let o=c(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0,this._externalTilesetCount=0;let r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),this._ready=!1,this._innerContentResources=new Array(r),this._serverKeys=new Array(r);for(let s=0;s<r;s++){let a=n.getDerivedResource({url:o[s].uri}),l=sc.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=l}}Object.defineProperties(Yf.prototype,{featurePropertiesDirty:{get:function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return this._contentsCreated?this._ready:!1}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){throw new E("Multiple3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(){throw new E("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map(function(e){return e.uri})}}});function YW(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function jue(e,t){e._cancelCount++,e._tile._contentState=t;let n=e.tileset.statistics;n.numberOfPendingRequests-=e._requestsInFlight,n.numberOfAttemptedRequests+=e._requestsInFlight,e._requestsInFlight=0;let i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}Yf.prototype.requestInnerContents=function(){if(!IYe(this._serverKeys)){this.tileset.statistics.numberOfAttemptedRequests+=this._serverKeys.length;return}let e=this._innerContentHeaders;YW(this,e.length);let t=this._cancelCount;for(let n=0;n<e.length;n++)this._arrayFetchPromises[n]=OYe(this,n,t,this._tile._contentState);return RYe(this)};function IYe(e){let t={};for(let n=0;n<e.length;n++){let i=e[n];c(t[i])?t[i]++:t[i]=1}for(let n in t)if(t.hasOwnProperty(n)&&!sc.serverHasOpenSlots(n,t[n]))return!1;return sc.heapHasOpenSlots(e.length)}function OYe(e,t,n,i){let o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],l=new Qo({throttle:!0,throttleByServer:!0,type:ms.TILES3D,priorityFunction:s,serverKey:a});o.request=l,e._requests[t]=l;let u=o.fetchArrayBuffer();if(c(u))return u.then(function(f){if(!(n<e._cancelCount)){if(o.request.cancelled||o.request.state===$n.CANCELLED){jue(e,i);return}return YW(e,-1),f}}).catch(function(f){if(!(n<e._cancelCount)){if(o.request.cancelled||o.request.state===$n.CANCELLED){jue(e,i);return}YW(e,-1),Wue(e,t,f)}})}async function RYe(e){let t=e._cancelCount,n=await Promise.all(e._arrayFetchPromises);if(t<e._cancelCount)return;let i=n.map((r,s)=>MYe(e,r,s)),o=await Promise.all(i);if(e._contentsCreated=!0,e._contents=o.filter(c),e._externalTilesetCount===e._contents.length){let r=e._tile;r.hasRenderableContent=!1}return o}async function MYe(e,t,n){if(c(t))try{let i=I_(t),o=e._tileset,r=e._innerContentResources[n],s=e._tile;i.contentType===Ps.EXTERNAL_TILESET&&(e._externalTilesetCount++,s.hasTilesetContent=!0),e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===Ps.GEOMETRY||i.contentType===Ps.VECTOR;let a,l=Ux[i.contentType];c(i.binaryPayload)?a=await Promise.resolve(l(o,s,r,i.binaryPayload.buffer,0)):a=await Promise.resolve(l(o,s,r,i.jsonPayload));let u=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){let h=s.implicitSubtree,p=s.implicitCoordinates;a.metadata=h.getContentMetadataView(p,n)}else s.hasImplicitContent||(a.metadata=Vx(o,u));let f=zx(o,u);return c(f)&&(a.group=new tx({metadata:f})),a}catch(i){Wue(e,n,i)}}function Wue(e,t,n){let i=e._tileset,o=e._innerContentResources[t].url,r=c(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0?i.tileFailed.raiseEvent({url:o,message:r}):(console.log(`A content failed to load: ${o}`),console.log(`Error: ${r}`))}Yf.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){let t=this._requests[e];c(t)&&t.cancel()}};Yf.prototype.hasProperty=function(e,t){return!1};Yf.prototype.getFeature=function(e){};Yf.prototype.applyDebugSettings=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Yf.prototype.applyStyle=function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Yf.prototype.update=function(e,t){let n=this._contents,i=n.length,o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)};Yf.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY,r=this._contents,s=r.length;for(let a=0;a<s;++a){let l=r[a].pick(e,t,n);if(!c(l))continue;let u=d.distance(e.origin,l);u<o&&(i=l,o=u)}if(c(i))return n};Yf.prototype.isDestroyed=function(){return!1};Yf.prototype.destroy=function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return de(this)};var PL=Yf;var que=Math.cos,Yue=Math.sin,LYe=Math.sqrt,XW={};XW.computePosition=function(e,t,n,i,o,r,s){let a=t.radiiSquared,l=e.nwCorner,u=e.boundingRectangle,f=l.latitude-e.granYCos*i+o*e.granXSin,h=que(f),p=Yue(f),g=a.z*p,m=l.longitude+i*e.granYSin+o*e.granXCos,y=h*que(m),b=h*Yue(m),x=a.x*y,A=a.y*b,C=LYe(x*y+A*b+g*p);if(r.x=x/C,r.y=A/C,r.z=g/C,n){let S=e.stNwCorner;c(S)?(f=S.latitude-e.stGranYCos*i+o*e.stGranXSin,m=S.longitude+i*e.stGranYSin+o*e.stGranXCos,s.x=(m-e.stWest)*e.lonScalar,s.y=(f-e.stSouth)*e.latScalar):(s.x=(m-u.west)*e.lonScalar,s.y=(f-u.south)*e.latScalar)}};var NYe=new Ri,Xf=new d,FYe=new he,Gz=new d,IL=new Oi;function Xue(e,t,n,i,o,r,s){let a=Math.cos(t),l=i*a,u=n*a,f=Math.sin(t),h=i*f,p=n*f;IL._ellipsoid=ie.default,Xf=IL.project(e,Xf),Xf=d.subtract(Xf,Gz,Xf);let g=Ri.fromRotation(t,NYe);Xf=Ri.multiplyByVector(g,Xf,Xf),Xf=d.add(Xf,Gz,Xf),e=IL.unproject(Xf,e),r-=1,s-=1;let m=e.latitude,y=m+r*p,b=m-l*s,x=m-l*s+r*p,A=Math.max(m,y,b,x),C=Math.min(m,y,b,x),S=e.longitude,v=S+r*u,P=S+s*h,M=S+s*h+r*u,R=Math.max(S,v,P,M),L=Math.min(S,v,P,M);return{north:A,south:C,east:R,west:L,granYCos:l,granYSin:h,granXCos:u,granXSin:p,nwCorner:e}}XW.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,l=e.west,u=e.north,f=e.south,h=!1,p=!1;u===O.PI_OVER_TWO&&(h=!0),f===-O.PI_OVER_TWO&&(p=!0);let g,m=u-f;l>a?g=O.TWO_PI-l+a:g=a-l;let y=Math.ceil(g/t)+1,b=Math.ceil(m/t)+1,x=g/(y-1),A=m/(b-1),C=ce.northwest(e,r),S=ce.center(e,FYe);(n!==0||i!==0)&&(S.longitude<C.longitude&&(S.longitude+=O.TWO_PI),IL._ellipsoid=ie.default,Gz=IL.project(S,Gz));let v=A,P=x,M=0,R=0,L=ce.clone(e,o),F={granYCos:v,granYSin:M,granXCos:P,granXSin:R,nwCorner:C,boundingRectangle:L,width:y,height:b,northCap:h,southCap:p};if(n!==0){let _=Xue(C,n,x,A,S,y,b);if(u=_.north,f=_.south,a=_.east,l=_.west,u<-O.PI_OVER_TWO||u>O.PI_OVER_TWO||f<-O.PI_OVER_TWO||f>O.PI_OVER_TWO)throw new E("Rotated rectangle is invalid.  It crosses over either the north or south pole.");F.granYCos=_.granYCos,F.granYSin=_.granYSin,F.granXCos=_.granXCos,F.granXSin=_.granXSin,L.north=u,L.south=f,L.east=a,L.west=l}if(i!==0){n=n-i;let _=ce.northwest(L,s),w=Xue(_,n,x,A,S,y,b);F.stGranYCos=w.granYCos,F.stGranXCos=w.granXCos,F.stGranYSin=w.granYSin,F.stGranXSin=w.granXSin,F.stNwCorner=_,F.stWest=w.west,F.stSouth=w.south}return F};var Is=XW;var BYe=new le,kYe=new le,UYe=new d,VYe=new ce;function Kue(e,t){let n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap,a=i,l=2,u=0,f=4;r&&(l-=1,a-=1,u+=1,f-=2),s&&(l-=1,a-=1,u+=1,f-=2),u+=l*o+2*a-f;let h=new Float64Array(u*3),p=0,g=0,m,y=UYe;if(r)Is.computePosition(t,n,!1,g,0,y),h[p++]=y.x,h[p++]=y.y,h[p++]=y.z;else for(m=0;m<o;m++)Is.computePosition(t,n,!1,g,m,y),h[p++]=y.x,h[p++]=y.y,h[p++]=y.z;for(m=o-1,g=1;g<i;g++)Is.computePosition(t,n,!1,g,m,y),h[p++]=y.x,h[p++]=y.y,h[p++]=y.z;if(g=i-1,!s)for(m=o-2;m>=0;m--)Is.computePosition(t,n,!1,g,m,y),h[p++]=y.x,h[p++]=y.y,h[p++]=y.z;for(m=0,g=i-2;g>0;g--)Is.computePosition(t,n,!1,g,m,y),h[p++]=y.x,h[p++]=y.y,h[p++]=y.z;let b=h.length/3*2,x=Fe.createTypedArray(h.length/3,b),A=0;for(let S=0;S<h.length/3-1;S++)x[A++]=S,x[A++]=S+1;x[A++]=h.length/3-1,x[A++]=0;let C=new ct({attributes:new fn,primitiveType:Me.LINES});return C.attributes.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:h}),C.indices=x,C}function zYe(e,t){let n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=Kue(e,t),s=t.height,a=t.width,l=si.scaleToGeodeticHeight(r.attributes.position.values,n,o,!1),u=l.length,f=new Float64Array(u*2);f.set(l);let h=si.scaleToGeodeticHeight(r.attributes.position.values,i,o);f.set(h,u),r.attributes.position.values=f;let p=t.northCap,g=t.southCap,m=4;p&&(m-=1),g&&(m-=1);let y=(f.length/3+m)*2,b=Fe.createTypedArray(f.length/3,y);u=f.length/6;let x=0;for(let C=0;C<u-1;C++)b[x++]=C,b[x++]=C+1,b[x++]=C+u,b[x++]=C+u+1;b[x++]=u-1,b[x++]=0,b[x++]=u+u-1,b[x++]=u,b[x++]=0,b[x++]=u;let A;if(p)A=s-1;else{let C=a-1;b[x++]=C,b[x++]=C+u,A=a+s-2}if(b[x++]=A,b[x++]=A+u,!g){let C=a+A-1;b[x++]=C,b[x]=C+u}return r.indices=b,r}function vE(e){e=e??W.EMPTY_OBJECT;let t=e.rectangle,n=e.granularity??O.RADIANS_PER_DEGREE,i=e.ellipsoid??ie.default,o=e.rotation??0;if(!c(t))throw new E("rectangle is required.");if(ce._validate(t),t.north<t.south)throw new E("options.rectangle.north must be greater than options.rectangle.south");let r=e.height??0,s=e.extrudedHeight??r;this._rectangle=ce.clone(t),this._granularity=n,this._ellipsoid=i,this._surfaceHeight=Math.max(r,s),this._rotation=o,this._extrudedHeight=Math.min(r,s),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}vE.packedLength=ce.packedLength+ie.packedLength+5;vE.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,ce.pack(e._rectangle,t,n),n+=ce.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=e._offsetAttribute??-1,t};var $ue=new ce,Zue=ie.clone(ie.UNIT_SPHERE),wE={rectangle:$ue,ellipsoid:Zue,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};vE.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i=ce.unpack(e,t,$ue);t+=ce.packedLength;let o=ie.unpack(e,t,Zue);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t];return c(n)?(n._rectangle=ce.clone(i,n._rectangle),n._ellipsoid=ie.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=l,n._offsetAttribute=u===-1?void 0:u,n):(wE.granularity=r,wE.height=s,wE.rotation=a,wE.extrudedHeight=l,wE.offsetAttribute=u===-1?void 0:u,new vE(wE))};var HYe=new he;vE.createGeometry=function(e){let t=e._rectangle,n=e._ellipsoid,i=Is.computeOptions(t,e._granularity,e._rotation,0,VYe,HYe),o,r;if(O.equalsEpsilon(t.north,t.south,O.EPSILON10)||O.equalsEpsilon(t.east,t.west,O.EPSILON10))return;let s=e._surfaceHeight,a=e._extrudedHeight,l=!O.equalsEpsilon(s,a,0,O.EPSILON2),u;if(l){if(o=zYe(e,i),c(e._offsetAttribute)){let p=o.attributes.position.values.length/3,g=new Uint8Array(p);e._offsetAttribute===Zt.TOP?g=g.fill(1,0,p/2):(u=e._offsetAttribute===Zt.NONE?0:1,g=g.fill(u)),o.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}let f=le.fromRectangle3D(t,n,s,kYe),h=le.fromRectangle3D(t,n,a,BYe);r=le.union(f,h)}else{if(o=Kue(e,i),o.attributes.position.values=si.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),c(e._offsetAttribute)){let f=o.attributes.position.values.length;u=e._offsetAttribute===Zt.NONE?0:1;let h=new Uint8Array(f/3).fill(u);o.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}r=le.fromRectangle3D(t,n,s)}return new ct({attributes:o.attributes,indices:o.indices,primitiveType:Me.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};var Hx=vE;function PE(e){T.typeOf.object("options",e),T.typeOf.object("options.rectangle",e.rectangle),this.rectangle=ce.clone(e.rectangle),this.minimumHeight=e.minimumHeight??0,this.maximumHeight=e.maximumHeight??0,this.southwestCornerCartesian=new d,this.northeastCornerCartesian=new d,this.westNormal=new d,this.southNormal=new d,this.eastNormal=new d,this.northNormal=new d;let t=e.ellipsoid??ie.WGS84;YYe(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,(e.computeBoundingVolumes??!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(PE.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});PE.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=Dn.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=le.fromOrientedBoundingBox(this._orientedBoundingBox)};var Que=new d,jz=new d,Jue=new d,GYe=new d,jYe=new d,WYe=new d,qYe=new d,Kf=new he,efe=new sn(d.UNIT_X,0),DE=new mn;function YYe(e,t,n){n.cartographicToCartesian(ce.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(ce.northeast(t),e.northeastCornerCartesian),Kf.longitude=t.west,Kf.latitude=(t.south+t.north)*.5,Kf.height=0;let i=n.cartographicToCartesian(Kf,WYe),o=d.cross(i,d.UNIT_Z,GYe);d.normalize(o,e.westNormal),Kf.longitude=t.east;let r=n.cartographicToCartesian(Kf,qYe),s=d.cross(d.UNIT_Z,r,Que);d.normalize(s,e.eastNormal);let a=d.subtract(i,r,Que);d.magnitude(a)===0&&(a=d.clone(o,a));let l=d.normalize(a,jYe),u=t.south,f;if(u>0){Kf.longitude=(t.west+t.east)*.5,Kf.latitude=u;let y=n.cartographicToCartesian(Kf,DE.origin);d.clone(l,DE.direction);let b=sn.fromPointNormal(e.southwestCornerCartesian,e.westNormal,efe);Zn.rayPlane(DE,b,e.southwestCornerCartesian),f=n.geodeticSurfaceNormal(y,jz)}else f=n.geodeticSurfaceNormalCartographic(ce.southeast(t),jz);let h=d.cross(f,a,Jue);d.normalize(h,e.southNormal);let p=t.north,g;if(p<0){Kf.longitude=(t.west+t.east)*.5,Kf.latitude=p;let y=n.cartographicToCartesian(Kf,DE.origin);d.negate(l,DE.direction);let b=sn.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,efe);Zn.rayPlane(DE,b,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(y,jz)}else g=n.geodeticSurfaceNormalCartographic(ce.northwest(t),jz);let m=d.cross(a,g,Jue);d.normalize(m,e.northNormal)}var XYe=new d,KYe=new d,$Ye=new d(0,-1,0),ZYe=new d(0,0,-1),tfe=new d;function QYe(e,t){let n=t.camera,i=n.positionWC,o=n.positionCartographic,r=0;if(!ce.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,f=e.northeastCornerCartesian,h=e.westNormal,p=e.southNormal,g=e.eastNormal,m=e.northNormal;t.mode!==oe.SCENE3D&&(u=t.mapProjection.project(ce.southwest(e.rectangle),XYe),u.z=u.y,u.y=u.x,u.x=0,f=t.mapProjection.project(ce.northeast(e.rectangle),KYe),f.z=f.y,f.y=f.x,f.x=0,h=$Ye,g=d.UNIT_Y,p=ZYe,m=d.UNIT_Z);let y=d.subtract(i,u,tfe),b=d.dot(y,h),x=d.dot(y,p),A=d.subtract(i,f,tfe),C=d.dot(A,g),S=d.dot(A,m);b>0?r+=b*b:C>0&&(r+=C*C),x>0?r+=x*x:S>0&&(r+=S*S)}let s,a,l;if(t.mode===oe.SCENE3D?(s=o.height,a=e.minimumHeight,l=e.maximumHeight):(s=i.x,a=0,l=0),s>l){let u=s-l;r+=u*u}else if(s<a){let u=a-s;r+=u*u}return Math.sqrt(r)}PE.prototype.distanceToCamera=function(e){T.defined("frameState",e);let t=QYe(this,e);if(e.mode===oe.SCENE3D&&c(this._orientedBoundingBox)){let n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t};PE.prototype.intersectPlane=function(e){return T.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};PE.prototype.createDebugVolume=function(e){T.defined("color",e);let t=new B.clone(B.IDENTITY),n=new Hx({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new St({geometry:n,id:"outline",modelMatrix:t,attributes:{color:Gt.fromColor(e)}});return new Pn({geometryInstances:i,appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})};var Lu=PE;var OL={},JYe=new d,nfe=new d,ife=new d,ofe=new d,rfe=new Dn;OL.validOutline=function(e){T.defined("positions",e);let n=Dn.fromPoints(e,rfe).halfAxes,i=J.getColumn(n,0,nfe),o=J.getColumn(n,1,ife),r=J.getColumn(n,2,ofe),s=d.magnitude(i),a=d.magnitude(o),l=d.magnitude(r);return!(s===0&&(a===0||l===0)||a===0&&l===0)};OL.computeProjectTo2DArguments=function(e,t,n,i){T.defined("positions",e),T.defined("centerResult",t),T.defined("planeAxis1Result",n),T.defined("planeAxis2Result",i);let o=Dn.fromPoints(e,rfe),r=o.halfAxes,s=J.getColumn(r,0,nfe),a=J.getColumn(r,1,ife),l=J.getColumn(r,2,ofe),u=d.magnitude(s),f=d.magnitude(a),h=d.magnitude(l),p=Math.min(u,f,h);if(u===0&&(f===0||h===0)||f===0&&h===0)return!1;let g,m;return(p===f||p===h)&&(g=s),p===u?g=a:p===h&&(m=a),(p===u||p===f)&&(m=l),d.normalize(g,n),d.normalize(m,i),d.clone(o.center,t),!0};function sfe(e,t,n,i,o){let r=d.subtract(e,t,JYe),s=d.dot(n,r),a=d.dot(i,r);return H.fromElements(s,a,o)}OL.createProjectPointsTo2DFunction=function(e,t,n){return function(i){let o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=sfe(i[r],e,t,n);return o}};OL.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return sfe(i,e,t,n,o)}};var O_=OL;function eXe(e){let t=e.length,n=new Float64Array(t*3),i=Fe.createTypedArray(t,t*2),o=0,r=0;for(let a=0;a<t;a++){let l=e[a];n[o++]=l.x,n[o++]=l.y,n[o++]=l.z,i[r++]=a,i[r++]=(a+1)%t}let s=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:n})});return new ct({attributes:s,indices:i,primitiveType:Me.LINES})}function Gx(e){e=e??W.EMPTY_OBJECT;let t=e.polygonHierarchy;T.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=zn.computeHierarchyPackedLength(t,d)+1}Gx.fromPositions=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.positions",e.positions);let t={polygonHierarchy:{positions:e.positions}};return new Gx(t)};Gx.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,n=zn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),t[n]=e.packedLength,t};var tXe={polygonHierarchy:{}};Gx.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=zn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;let o=e[t];return c(n)||(n=new Gx(tXe)),n._polygonHierarchy=i,n.packedLength=o,n};Gx.createGeometry=function(e){let t=e._polygonHierarchy,n=t.positions;if(n=xo(n,d.equalsEpsilon,!0),n.length<3||!O_.validOutline(n))return;let o=zn.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;let r=[];for(let l=0;l<o.length;l++){let u=new St({geometry:eXe(o[l])});r.push(u)}let s=Nn.combineInstances(r)[0],a=le.fromPoints(t.positions);return new ct({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};var $f=Gx;var Wz=new he;function RL(e){T.typeOf.object("options",e),T.typeOf.string("options.token",e.token);let t=Qp.fromToken(e.token),n=e.minimumHeight??0,i=e.maximumHeight??0,o=e.ellipsoid??ie.WGS84;this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;let r=uXe(t,n,i,o);this._boundingPlanes=r;let s=mXe(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=nq(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=d.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=nq(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=nq(r[2+a],[s[a%4],s[(a+1)%4],s[4+(a+1)%4],s[4+a]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],a=0;a<4;a++)this._planeVertices.push([this._vertices[a%4],this._vertices[(a+1)%4],this._vertices[4+(a+1)%4],this._vertices[4+a]]);let l=t.getCenter();Wz=o.cartesianToCartographic(l,Wz),Wz.height=(i+n)/2,this.center=o.cartographicToCartesian(Wz,l),this._boundingSphere=le.fromPoints(s)}var nXe=new d,iXe=new he,oXe=new d,rXe=new he,sXe=new d,aXe=new d,cXe=new d,lXe=new d;function uXe(e,t,n,i){let o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,nXe),a=i.cartesianToCartographic(r,iXe);a.height=n;let l=i.cartographicToCartesian(a,oXe),u=sn.fromPointNormal(l,s);o[0]=u;let f=0,h,p=[],g,m;for(h=0;h<4;h++){g=e.getVertex(h),p[h]=g,m=i.cartesianToCartographic(g,rXe),m.height=t;let b=sn.getPointDistance(u,i.cartographicToCartesian(m,sXe));b<f&&(f=b)}let y=sn.clone(u);for(y.normal=d.negate(y.normal,y.normal),y.distance=y.distance*-1+f,o[1]=y,h=0;h<4;h++){g=p[h];let b=p[(h+1)%4],x=i.geodeticSurfaceNormal(g,aXe),A=d.subtract(b,g,lXe),C=d.cross(A,x,cXe);C=d.normalize(C,C),o[2+h]=sn.fromPointNormal(g,C)}return o}var jx=new d,Wx=new d,qx=new d,KW=new d,$W=new d,ZW=new d,fXe=new d,dXe=new d,hXe=new d,QW=new d,JW=new d,eq=new d,Gy=new d,Lm=new J;function afe(e,t,n){jx=e.normal,Wx=t.normal,qx=n.normal,KW=d.multiplyByScalar(e.normal,-e.distance,KW),$W=d.multiplyByScalar(t.normal,-t.distance,$W),ZW=d.multiplyByScalar(n.normal,-n.distance,ZW),QW=d.multiplyByScalar(d.cross(Wx,qx,fXe),d.dot(KW,jx),QW),JW=d.multiplyByScalar(d.cross(qx,jx,dXe),d.dot($W,Wx),JW),eq=d.multiplyByScalar(d.cross(jx,Wx,hXe),d.dot(ZW,qx),eq),Lm[0]=jx.x,Lm[1]=Wx.x,Lm[2]=qx.x,Lm[3]=jx.y,Lm[4]=Wx.y,Lm[5]=qx.y,Lm[6]=jx.z,Lm[7]=Wx.z,Lm[8]=qx.z;let i=J.determinant(Lm);return Gy=d.add(QW,JW,Gy),Gy=d.add(Gy,eq,Gy),new d(Gy.x/i,Gy.y/i,Gy.z/i)}function mXe(e){let t=new Array(8);for(let n=0;n<4;n++)t[n]=afe(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=afe(e[1],e[2+(n+3)%4],e[2+n%4]);return t}var tq=new d,IE=new d;function nq(e,t){let n=[];for(let i=0;i<4;i++)tq=d.subtract(t[(i+1)%4],t[i],tq),IE=d.cross(e.normal,tq,IE),IE=d.normalize(IE,IE),n[i]=d.clone(IE);return n}Object.defineProperties(RL.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});var iq=new d;RL.prototype.distanceToCamera=function(e){T.defined("frameState",e);let t=e.camera.positionWC,n=[],i=[],o;sn.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):sn.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),o=this._edgeNormals[1]);let r,s;for(r=0;r<4;r++)s=2+r,sn.getPointDistance(this._boundingPlanes[s],t)>0&&(n.push(s),i.push(this._planeVertices[s]),o=this._edgeNormals[s]);if(n.length===0)return 0;let a,l;if(n.length===1)return l=this._boundingPlanes[n[0]],a=oq(sn.projectPointOntoPlane(l,t,iq),i[0],l,o),d.distance(a,t);if(n.length===2){if(n[0]===0){let p=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=cfe(t,p[0],p[1]),d.distance(a,t)}let f=Number.MAX_VALUE,h;for(r=0;r<2;r++)l=this._boundingPlanes[n[r]],a=oq(sn.projectPointOntoPlane(l,t,iq),i[r],l,this._edgeNormals[n[r]]),h=d.distanceSquared(a,t),h<f&&(f=h);return Math.sqrt(f)}else if(n.length>3)return a=oq(sn.projectPointOntoPlane(this._boundingPlanes[1],t,iq),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),d.distance(a,t);let u=n[1]===2&&n[2]===5?0:1;return n[0]===0?d.distance(t,this._vertices[(n[1]-2+u)%4]):d.distance(t,this._vertices[4+(n[1]-2+u)%4])};var pXe=new d,_Xe=new d;function cfe(e,t,n){let i=d.subtract(n,t,pXe),o=d.subtract(e,t,_Xe),r=d.dot(i,o);if(r<=0)return t;let s=d.dot(i,i);return r>=s?n:(r=r/s,new d((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}var gXe=new sn(d.UNIT_X,0);function oq(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let l=0;l<t.length;l++){let u=sn.fromPointNormal(t[l],i[l],gXe);sn.getPointDistance(u,e)<0||(a=cfe(e,t[l],t[(l+1)%4]),r=d.distance(e,a),r<o&&(o=r,s=a))}return c(s)?s:e}RL.prototype.intersectPlane=function(e){T.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++)d.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?Wt.INSIDE:n===this._vertices.length?Wt.OUTSIDE:Wt.INTERSECTING};RL.prototype.createDebugVolume=function(e){T.defined("color",e);let t=new B.clone(B.IDENTITY),n=new $f({polygonHierarchy:{positions:this._planeVertices[0]}}),i=$f.createGeometry(n),o=new St({geometry:i,id:"outline",modelMatrix:t,attributes:{color:Gt.fromColor(e)}}),r=new $f({polygonHierarchy:{positions:this._planeVertices[1]}}),s=$f.createGeometry(r),a=new St({geometry:s,id:"outline",modelMatrix:t,attributes:{color:Gt.fromColor(e)}}),l=[];for(let u=0;u<4;u++){let f=new $f({polygonHierarchy:{positions:this._planeVertices[2+u]}}),h=$f.createGeometry(f);l[u]=new St({geometry:h,id:"outline",modelMatrix:t,attributes:{color:Gt.fromColor(e)}})}return new Pn({geometryInstances:[l[0],l[1],l[2],l[3],a,o],appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})};var ML=RL;var yXe=new d(1,1,1),qz=Math.cos,Yz=Math.sin;function OE(e){e=e??W.EMPTY_OBJECT;let t=e.radii??yXe,n=e.innerRadii??t,i=e.minimumClock??0,o=e.maximumClock??O.TWO_PI,r=e.minimumCone??0,s=e.maximumCone??O.PI,a=Math.round(e.stackPartitions??10),l=Math.round(e.slicePartitions??8),u=Math.round(e.subdivisions??128);if(a<1)throw new E("options.stackPartitions cannot be less than 1");if(l<0)throw new E("options.slicePartitions cannot be less than 0");if(u<0)throw new E("options.subdivisions must be greater than or equal to zero.");if(c(e.offsetAttribute)&&e.offsetAttribute===Zt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=l,this._subdivisions=u,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}OE.packedLength=2*d.packedLength+8;OE.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=e._offsetAttribute??-1,t};var lfe=new d,ufe=new d,R_={radii:lfe,innerRadii:ufe,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};OE.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i=d.unpack(e,t,lfe);t+=d.packedLength;let o=d.unpack(e,t,ufe);t+=d.packedLength;let r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++],p=e[t];return c(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=l,n._stackPartitions=u,n._slicePartitions=f,n._subdivisions=h,n._offsetAttribute=p===-1?void 0:p,n):(R_.minimumClock=r,R_.maximumClock=s,R_.minimumCone=a,R_.maximumCone=l,R_.stackPartitions=u,R_.slicePartitions=f,R_.subdivisions=h,R_.offsetAttribute=p===-1?void 0:p,new OE(R_))};OE.createGeometry=function(e){let t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;let n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;let i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._subdivisions,l=ie.fromCartesian3(t),u=e._slicePartitions+1,f=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/O.TWO_PI),f=Math.round(f*Math.abs(s-r)/O.PI),u<2&&(u=2),f<2&&(f=2);let h=0,p=1,g=n.x!==t.x||n.y!==t.y||n.z!==t.z,m=!1,y=!1;g&&(p=2,r>0&&(m=!0,h+=u),s<Math.PI&&(y=!0,h+=u));let b=a*p*(f+u),x=new Float64Array(b*3),A=2*(b+h-(u+f)*p),C=Fe.createTypedArray(b,A),S,v,P,M,R=0,L=new Array(f),F=new Array(f);for(S=0;S<f;S++)M=r+S*(s-r)/(f-1),L[S]=Yz(M),F[S]=qz(M);let _=new Array(a),w=new Array(a);for(S=0;S<a;S++)P=i+S*(o-i)/(a-1),_[S]=Yz(P),w[S]=qz(P);for(S=0;S<f;S++)for(v=0;v<a;v++)x[R++]=t.x*L[S]*w[v],x[R++]=t.y*L[S]*_[v],x[R++]=t.z*F[S];if(g)for(S=0;S<f;S++)for(v=0;v<a;v++)x[R++]=n.x*L[S]*w[v],x[R++]=n.y*L[S]*_[v],x[R++]=n.z*F[S];for(L.length=a,F.length=a,S=0;S<a;S++)M=r+S*(s-r)/(a-1),L[S]=Yz(M),F[S]=qz(M);for(_.length=u,w.length=u,S=0;S<u;S++)P=i+S*(o-i)/(u-1),_[S]=Yz(P),w[S]=qz(P);for(S=0;S<a;S++)for(v=0;v<u;v++)x[R++]=t.x*L[S]*w[v],x[R++]=t.y*L[S]*_[v],x[R++]=t.z*F[S];if(g)for(S=0;S<a;S++)for(v=0;v<u;v++)x[R++]=n.x*L[S]*w[v],x[R++]=n.y*L[S]*_[v],x[R++]=n.z*F[S];for(R=0,S=0;S<f*p;S++){let N=S*a;for(v=0;v<a-1;v++)C[R++]=N+v,C[R++]=N+v+1}let D=f*a*p;for(S=0;S<u;S++)for(v=0;v<a-1;v++)C[R++]=D+S+v*u,C[R++]=D+S+(v+1)*u;if(g)for(D=f*a*p+u*a,S=0;S<u;S++)for(v=0;v<a-1;v++)C[R++]=D+S+v*u,C[R++]=D+S+(v+1)*u;if(g){let N=f*a*p,k=N+a*u;if(m)for(S=0;S<u;S++)C[R++]=N+S,C[R++]=k+S;if(y)for(N+=a*u-u,k+=a*u-u,S=0;S<u;S++)C[R++]=N+S,C[R++]=k+S}let I=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:x})});if(c(e._offsetAttribute)){let N=x.length,k=e._offsetAttribute===Zt.NONE?0:1,z=new Uint8Array(N/3).fill(k);I.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:z})}return new ct({attributes:I,indices:C,primitiveType:Me.LINES,boundingSphere:le.fromEllipsoid(l),offsetAttribute:e._offsetAttribute})};var Nu=OE;function RE(e){let t=e.radius??1,i={radii:new d(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new Nu(i),this._workerName="createSphereOutlineGeometry"}RE.packedLength=Nu.packedLength;RE.pack=function(e,t,n){return T.typeOf.object("value",e),Nu.pack(e._ellipsoidGeometry,t,n)};var bXe=new Nu,Yx={radius:void 0,radii:new d,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};RE.unpack=function(e,t,n){let i=Nu.unpack(e,t,bXe);return Yx.stackPartitions=i._stackPartitions,Yx.slicePartitions=i._slicePartitions,Yx.subdivisions=i._subdivisions,c(n)?(d.clone(i._radii,Yx.radii),n._ellipsoidGeometry=new Nu(Yx),n):(Yx.radius=i._radii.x,new RE(Yx))};RE.createGeometry=function(e){return Nu.createGeometry(e._ellipsoidGeometry)};var M_=RE;function ME(e,t){t===0&&(t=O.EPSILON7),this._boundingSphere=new le(e,t)}Object.defineProperties(ME.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}});ME.prototype.distanceToCamera=function(e){T.defined("frameState",e);let t=this._boundingSphere;return Math.max(0,d.distance(t.center,e.camera.positionWC)-t.radius)};ME.prototype.intersectPlane=function(e){return T.defined("plane",e),le.intersectPlane(this._boundingSphere,e)};ME.prototype.update=function(e,t){d.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};ME.prototype.createDebugVolume=function(e){T.defined("color",e);let t=new M_({radius:this.radius}),n=B.fromTranslation(this.center,new B.clone(B.IDENTITY)),i=new St({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Gt.fromColor(e)}});return new Pn({geometryInstances:i,appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})};var L_=ME;var xXe=new d,TXe=new d,AXe=new d,CXe=new d;function Xx(e,t,n){n=d.cross(e,t,n);let i=d.magnitude(n);return d.multiplyByScalar(n,O.EPSILON7/i,n)}function rq(e,t){let n=d.normalize(e,CXe),i=d.equalsEpsilon(n,d.UNIT_X,O.EPSILON6)?d.UNIT_Y:d.UNIT_X;return Xx(e,i,t)}function ffe(e){let t=J.getColumn(e,0,xXe),n=J.getColumn(e,1,TXe),i=J.getColumn(e,2,AXe),o=d.equals(t,d.ZERO),r=d.equals(n,d.ZERO),s=d.equals(i,d.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=O.EPSILON7,e[4]=O.EPSILON7,e[8]=O.EPSILON7,e):(o&&!r&&!s?t=Xx(n,i,t):!o&&r&&!s?n=Xx(t,i,n):!o&&!r&&s?i=Xx(n,t,i):o?r?s||(t=rq(i,t),n=Xx(i,t,n)):(t=rq(n,t),i=Xx(n,t,i)):(n=rq(t,n),i=Xx(n,t,i)),J.setColumn(e,0,t,e),J.setColumn(e,1,n,e),J.setColumn(e,2,i,e),e)}function LE(e,t){t=ffe(t),this._orientedBoundingBox=new Dn(e,t),this._boundingSphere=le.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(LE.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});LE.prototype.distanceToCamera=function(e){return T.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};LE.prototype.intersectPlane=function(e){return T.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};LE.prototype.update=function(e,t){d.clone(e,this._orientedBoundingBox.center),t=ffe(t),J.clone(t,this._orientedBoundingBox.halfAxes),le.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};LE.prototype.createDebugVolume=function(e){T.defined("color",e);let t=new Ud({minimum:new d(-1,-1,-1),maximum:new d(1,1,1)}),n=B.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new St({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Gt.fromColor(e)}});return new Pn({geometryInstances:i,appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})};var Yl=LE;function ar(e,t,n,i){this._tileset=e,this._header=n;let o=c(n.contents),r=o&&n.contents.length>1||oi(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=c(n.transform)?B.unpack(n.transform):B.clone(B.IDENTITY);let a=c(i)?i.computedTransform:e.modelMatrix,l=B.multiply(a,this.transform,new B),u=c(i)?i._initialTransform:B.IDENTITY;this._initialTransform=B.multiply(u,this.transform,new B),this.computedTransform=l,this.metadata=DL(e,n),this._verticalExaggeration=1,this._verticalExaggerationRelativeHeight=0,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,l),this._boundingVolume2D=void 0;let f;c(s)&&c(s.boundingVolume)&&(f=this.createBoundingVolume(s.boundingVolume,l)),this._contentBoundingVolume=f,this._contentBoundingVolume2D=void 0;let h;c(n.viewerRequestVolume)&&(h=this.createBoundingVolume(n.viewerRequestVolume,l)),this._viewerRequestVolume=h,this.geometricError=n.geometricError,this._geometricError=n.geometricError,c(this._geometricError)||(this._geometricError=c(i)?i._geometricError:e._geometricError,ar._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let p;c(n.refine)?((n.refine==="replace"||n.refine==="add")&&ar._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),p=n.refine.toUpperCase()==="REPLACE"?qo.REPLACE:qo.ADD):c(i)?p=i.refine:p=qo.REPLACE,this.refine=p,this.children=[],this.parent=i;let g,m=!1,y,b,x;if(t=we.createIfNeeded(t),r)y=Xo.UNLOADED,b=t.clone();else if(c(s)){let v=s.uri;c(s.url)&&(ar._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),v=s.url),v===""?(ar._deprecationWarning("contentUriEmpty","content.uri property is an empty string, which creates a circular dependency, making this tileset invalid. Omit the content property instead"),g=new SE(e,this),m=!0,y=Xo.READY):(y=Xo.UNLOADED,b=t.getDerivedResource({url:v}),x=sc.getServerKey(b.getUrlComponent()))}else g=new SE(e,this),m=!0,y=Xo.READY;this._content=g,this._contentResource=b,this._contentState=y,this._expiredContent=void 0,this._serverKey=x,this.hasEmptyContent=m,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasRenderableContent=!m,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.cacheNode=void 0;let A=n.expire,C,S;c(A)&&(C=A.duration,c(A.date)&&(S=Q.fromIso8601(A.date))),this.expireDuration=C,this.expireDate=S,this.lastStyleTime=0,this._optimChildrenWithinParent=qf.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._wasSelectedLastFrame=!1,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._isClippedByPolygon=!1,this._clippingPlanesState=0,this._clippingPolygonsState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=G.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new Q,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}ar._deprecationWarning=ws;Object.defineProperties(ar.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return this._contentBoundingVolume??this._boundingVolume}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},isVisible:{get:function(){return this._visible&&this._inRequestVolume}},extras:{get:function(){return this._header.extras}},color:{get:function(){return c(this._color)||(this._color=new G),G.clone(this._color)},set:function(e){this._color=G.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&this.hasRenderableContent||c(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Xo.READY}},contentUnloaded:{get:function(){return this._contentState===Xo.UNLOADED}},hasUnloadedRenderableContent:{get:function(){return this.hasRenderableContent&&this.contentUnloaded}},contentExpired:{get:function(){return this._contentState===Xo.EXPIRED}},contentFailed:{get:function(){return this._contentState===Xo.FAILED}},commandsLength:{get:function(){return this._commandsLength}}});var jy=new d;function EXe(e,t){let{tileset:n,boundingSphere:i}=e,{radius:o,center:r}=i,{camera:s}=t,a=d.multiplyByScalar(s.directionWC,e._centerZDepth,jy),l=d.add(s.positionWC,a,jy),u=d.subtract(l,r,jy);if(d.magnitude(u)>o){let S=d.normalize(u,jy),v=d.multiplyByScalar(S,o,jy),P=d.add(r,v,jy),M=d.subtract(P,s.positionWC,jy),R=d.normalize(M,jy);e._foveatedFactor=1-Math.abs(d.dot(s.directionWC,R))}else e._foveatedFactor=0;let p=e.refine===qo.REPLACE,g=n.isSkippingLevelOfDetail;if(p&&!g||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&p&&g||n._pass===Uo.PRELOAD_FLIGHT||n._pass===Uo.PRELOAD)return!1;let m=1-Math.cos(s.frustum.fov*.5),y=n.foveatedConeSize*m;if(e._foveatedFactor<=y)return!1;let b=m-y,x=O.clamp((e._foveatedFactor-y)/b,0,1),A=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.memoryAdjustedScreenSpaceError,x),C=e._screenSpaceError===0&&c(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.memoryAdjustedScreenSpaceError-A<=C}var _fe=new Q;ar.prototype.getScreenSpaceError=function(e,t,n){let i=this._tileset,o=n??1,r=c(this.parent)?this.parent.geometricError:i._scaledGeometricError,s=t?r:this.geometricError;if(s===0)return 0;let{camera:a,context:l}=e,u=a.frustum,f=l.drawingBufferWidth,h=l.drawingBufferHeight*o,p;if(e.mode===oe.SCENE2D||u instanceof on){let g=u.offCenterFrustum;c(g)&&(u=g);let m=Math.max(u.top-u.bottom,u.right-u.left)/Math.max(f,h);p=s/m}else{let g=Math.max(this._distanceToCamera,O.EPSILON7),m=u.sseDenominator;if(p=s*h/(g*m),i.dynamicScreenSpaceError){let y=i._dynamicScreenSpaceErrorComputedDensity,b=i.dynamicScreenSpaceErrorFactor,x=O.fog(g,y)*b;p-=x}}return p/=e.pixelRatio,p};function SXe(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let n=e.memoryAdjustedScreenSpaceError,i=t._screenSpaceErrorProgressiveResolution>n;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;let o=t.parent,r=t._screenSpaceErrorProgressiveResolution<=n,s=c(o)&&o._screenSpaceErrorProgressiveResolution>n;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}function wXe(e,t){let n=t.parent,o=c(n)&&(!e.isSkippingLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}ar.prototype.updateVisibility=function(e){let{parent:t,tileset:n}=this;if(this._updatedVisibilityFrame===n._updatedVisibilityFrame)return;let i=c(t)?t.computedTransform:n.modelMatrix,o=c(t)?t._visibilityPlaneMask:_s.MASK_INDETERMINATE;this.updateTransform(i,e),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,n.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,o),this._visible=this._visibilityPlaneMask!==_s.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=wXe(n,this),this._priorityProgressiveResolution=SXe(n,this),this.priorityDeferred=EXe(this,e),this._updatedVisibilityFrame=n._updatedVisibilityFrame};ar.prototype.updateExpiration=function(){if(c(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){let e=Q.now(_fe);Q.lessThan(this.expireDate,e)&&(this._contentState=Xo.EXPIRED,this._expiredContent=this._content)}};function vXe(e){if(!c(e.expireDuration))return;let t=Q.now(_fe);Q.addSeconds(t,e.expireDuration,t),c(e.expireDate)?Q.lessThan(e.expireDate,t)&&Q.clone(t,e.expireDate):e.expireDate=Q.clone(t)}function DXe(e){return function(){return e._priority}}ar.prototype.requestContent=function(){if(!this.hasEmptyContent)return this.hasMultipleContents?PXe(this):OXe(this)};function PXe(e){let t=e._content,n=e._tileset;if(!c(t)){let o=oi(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new PL(n,e,e._contentResource.clone(),o),e._content=t}let i=t.requestInnerContents();if(c(i))return e._contentState=Xo.LOADING,i.then(o=>{if(!e.isDestroyed()&&c(o))return e._contentState=Xo.PROCESSING,t}).catch(o=>{if(!e.isDestroyed())throw e._contentState=Xo.FAILED,o})}async function IXe(e,t,n,i,o){let r=e._contentState;e._contentState=Xo.LOADING,++t.statistics.numberOfPendingRequests;let s;try{s=await o}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;if(n.cancelled||n.state===$n.CANCELLED){e._contentState=r,++t.statistics.numberOfAttemptedRequests;return}throw e._contentState=Xo.FAILED,a}if(e.isDestroyed()){--t.statistics.numberOfPendingRequests;return}if(n.cancelled||n.state===$n.CANCELLED){e._contentState=r,--t.statistics.numberOfPendingRequests,++t.statistics.numberOfAttemptedRequests;return}try{let a=await RXe(e,s);return--t.statistics.numberOfPendingRequests,e.isDestroyed()?void 0:(i&&(e.expireDate=void 0),e._content=a,e._contentState=Xo.PROCESSING,a)}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;throw e._contentState=Xo.FAILED,a}}function OXe(e){let t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});let i=new Qo({throttle:!0,throttleByServer:!0,type:ms.TILES3D,priorityFunction:DXe(e),serverKey:e._serverKey});e._request=i,t.request=i;let o=e._tileset,r=t.fetchArrayBuffer();if(!c(r)){++o.statistics.numberOfAttemptedRequests;return}return IXe(e,o,i,n,r)}async function RXe(e,t){let n=I_(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===Ps.GEOMETRY||n.contentType===Ps.VECTOR,(n.contentType===Ps.IMPLICIT_SUBTREE||n.contentType===Ps.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0,e.hasRenderableContent=!1),n.contentType===Ps.EXTERNAL_TILESET&&(e.hasTilesetContent=!0,e.hasRenderableContent=!1);let o,r=Ux[n.contentType];if(e.isDestroyed())return;c(n.binaryPayload)?o=await Promise.resolve(r(i,e,e._contentResource,n.binaryPayload.buffer,0)):o=await Promise.resolve(r(i,e,e._contentResource,n.jsonPayload));let s=e._contentHeader;if(e.hasImplicitContentMetadata){let l=e.implicitSubtree,u=e.implicitCoordinates;o.metadata=l.getContentMetadataView(u,0)}else e.hasImplicitContent||(o.metadata=Vx(i,s));let a=zx(i,s);return c(a)&&(o.group=new tx({metadata:a})),o}ar.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};ar.prototype.unloadContent=function(){this.hasRenderableContent&&(this._content=this._content&&this._content.destroy(),this._contentState=Xo.UNLOADED,this.lastStyleTime=0,this.clippingPlanesDirty=this._clippingPlanesState===0,this._clippingPlanesState=0,this.clippingPolygonsDirty=this._clippingPolygonsState===0,this._clippingPolygonsState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};var gfe=new le;function aq(e,t){if(t.mode!==oe.SCENE3D&&!c(e._boundingVolume2D)){let n=e._boundingVolume.boundingSphere,i=le.projectTo2D(n,t.mapProjection,gfe);e._boundingVolume2D=new L_(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._boundingVolume2D:e._boundingVolume}function MXe(e,t){if(t.mode!==oe.SCENE3D&&!c(e._contentBoundingVolume2D)){let n=e._contentBoundingVolume.boundingSphere,i=le.projectTo2D(n,t.mapProjection,gfe);e._contentBoundingVolume2D=new L_(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}ar.prototype.visibility=function(e,t){let n=e.cullingVolume,i=aq(this,e),o=this._tileset,r=o.clippingPlanes;if(c(r)&&r.enabled){let a=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=a!==Wt.INSIDE,a===Wt.OUTSIDE)return _s.MASK_OUTSIDE}let s=o.clippingPolygons;if(c(s)&&s.enabled){let a=s.computeIntersectionWithBoundingVolume(i);this._isClippedByPolygon=a!==Wt.OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};ar.prototype.contentVisibility=function(e){if(!c(this._contentBoundingVolume))return Wt.INSIDE;if(this._visibilityPlaneMask===_s.MASK_INSIDE)return Wt.INSIDE;let t=e.cullingVolume,n=MXe(this,e),i=this._tileset,o=i.clippingPlanes;if(c(o)&&o.enabled){let s=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=s!==Wt.INSIDE,s===Wt.OUTSIDE)return Wt.OUTSIDE}let r=i.clippingPolygons;if(c(r)&&r.enabled){let s=r.computeIntersectionWithBoundingVolume(n);if(this._isClippedByPolygon=s!==Wt.OUTSIDE,s===Wt.INSIDE)return Wt.OUTSIDE}return t.computeVisibility(n)};ar.prototype.distanceToTile=function(e){return aq(this,e).distanceToCamera(e)};var LXe=new d;ar.prototype.distanceToTileCenter=function(e){let n=aq(this,e).boundingVolume,i=d.subtract(n.center,e.camera.positionWC,LXe);return d.dot(e.camera.directionWC,i)};ar.prototype.insideViewerRequestVolume=function(e){let t=this._viewerRequestVolume;return!c(t)||t.distanceToCamera(e)===0};var yfe=new J,bfe=new d,NXe=new J,cq=new d,xfe=new ce,Tfe=new Dn,sq=new B;function FXe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],cq),o=J.fromArray(e,3,NXe);i=B.multiplyByPoint(t,i,i);let r=B.getMatrix3(t,yfe);return o=J.multiply(r,o,o),c(n)?(n.update(i,o),n):new Yl(i,o)}function dfe(e,t,n,i){let o=ce.unpack(e,0,xfe),r=e[4],s=e[5],a=Dn.fromRectangle(o,r,s,ie.WGS84,Tfe),l=a.center,u=a.halfAxes;t=B.multiplyTransformation(t,B.inverseTransformation(n,sq),sq),l=B.multiplyByPoint(t,l,l);let f=B.getMatrix3(t,yfe);return u=J.multiply(f,u,u),c(i)&&i instanceof Yl?(i.update(l,u),i):new Yl(l,u)}function BXe(e,t,n,i){if(!B.equalsEpsilon(t,n,O.EPSILON8))return i instanceof Yl?dfe(e,t,n,i):dfe(e,t,n,void 0);let o=ce.unpack(e,0,xfe);return i instanceof Lu?(i.rectangle=ce.clone(o,i.rectangle),i.minimumHeight=e[4],i.maximumHeight=e[5],i.computeBoundingVolumes(ie.WGS84),i):new Lu({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function kXe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],cq),o=e[3];i=B.multiplyByPoint(t,i,i);let r=B.getScale(t,bfe),s=d.maximumComponent(r);return o*=s,c(n)?(n.update(i,o),n):new L_(i,o)}ar.prototype.createBoundingVolume=function(e,t,n){let i=this.metadata,o;if(c(i)&&(o=bx.parseBoundingVolumeSemantic("TILE",i)),c(o)&&(e=o),!c(e))throw new ae("boundingVolume must be defined");if(oi(e,"3DTILES_bounding_volume_S2"))return new ML(e.extensions["3DTILES_bounding_volume_S2"]);let{box:r,region:s,sphere:a}=e;if(c(r)){let l=FXe(r,t,n);return this._verticalExaggeration!==1&&hfe(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l}if(c(s)){let l=BXe(s,t,this._initialTransform,n);return this._verticalExaggeration===1||(l instanceof Yl?hfe(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight):(l.minimumHeight=Dr.getHeight(l.minimumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.maximumHeight=Dr.getHeight(l.maximumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.computeBoundingVolumes(ie.WGS84))),l}if(c(a)){let l=kXe(a,t,n);if(this._verticalExaggeration!==1){let u=Dr.getPosition(l.center,ie.WGS84,this._verticalExaggeration,this._verticalExaggerationRelativeHeight,cq),f=l.radius*this._verticalExaggeration;l.update(u,f)}return l}throw new ae("boundingVolume must contain a sphere, region, or box")};var UXe=d.unpackArray(new Array(8*3).fill(0));function hfe(e,t,n){let i=e.boundingVolume.computeCorners(UXe).map(r=>Dr.getPosition(r,ie.WGS84,t,n,r)),o=Dn.fromPoints(i,Tfe);e.update(o.center,o.halfAxes)}ar.prototype.updateTransform=function(e,t){e=e??B.IDENTITY;let n=B.multiplyTransformation(e,this.transform,sq),i=!B.equals(n,this.computedTransform),o=c(t)&&(this._verticalExaggeration!==t.verticalExaggeration||this._verticalExaggerationRelativeHeight!==t.verticalExaggerationRelativeHeight);if(!i&&!o)return;i&&B.clone(n,this.computedTransform),o&&(this._verticalExaggeration=t.verticalExaggeration,this._verticalExaggerationRelativeHeight=t.verticalExaggerationRelativeHeight);let r=this._header,s=this._contentHeader;this._boundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._boundingVolume),c(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(s.boundingVolume,this.computedTransform,this._contentBoundingVolume)),c(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(r.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()};ar.prototype.updateGeometricErrorScale=function(){let e=B.getScale(this.computedTransform,bfe),t=d.maximumComponent(e);if(this.geometricError=this._geometricError*t,!c(this.parent)){let n=this._tileset;n._scaledGeometricError=n._geometricError*t}};function VXe(e,t,n,i){if(!i.isRender)return;let o=c(e._contentHeader)&&c(e._contentHeader.boundingVolume),r=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(r){let l;e._finalResolution?e.hasRenderableContent?l=G.WHITE:l=G.DARKGRAY:l=G.YELLOW,c(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(l)),e._debugBoundingVolume.update(n);let u=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");u.color=Gt.toValue(l,u.color)}else!r&&c(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(c(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(G.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&c(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&c(e._viewerRequestVolume)?(c(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(G.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&c(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());let s=t.debugColorizeTiles&&!e._debugColorizeTiles||c(t._heatmap.tilePropertyName),a=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):a&&(e._debugColorizeTiles=!1,e.color=G.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),a&&t.makeStyleDirty()}function zXe(e,t,n){let i=e._expiredContent;if(!e.hasMultipleContents&&c(i)){if(!e.contentReady){try{i.update(t,n)}catch{}return}e._expiredContent.destroy(),e._expiredContent=void 0}if(c(e.content))try{e.content.update(t,n)}catch(o){throw e._contentState=Xo.FAILED,o}}function HXe(e,t){let n=t.clippingPlanes,i=0;c(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}function GXe(e,t){let n=t.clippingPolygons,i=0;c(n)&&e._isClippedByPolygon&&n.enabled&&(i=n.clippingPolygonsState),i!==e._clippingPolygonsState&&(e._clippingPolygonsState=i,e.clippingPolygonsDirty=!0)}ar.prototype.update=function(e,t,n){let{commandList:i}=t,o=i.length;HXe(this,e),GXe(this,e),VXe(this,e,t,n),zXe(this,e,t);let r=i.length;this._commandsLength=r-o;for(let s=o;s<r;++s){let a=i[s],l=a.pass===De.TRANSLUCENT;a.depthForTranslucentClassification=l}this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1};var mfe=[];ar.prototype.process=function(e,t){!this.contentExpired&&!this.contentReady&&this._content.ready&&(vXe(this),this._selectedFrame=0,this.lastStyleTime=0,Q.now(this._loadTimestamp),this._contentState=Xo.READY,!this.hasTilesetContent&&!this.hasImplicitContent&&(e._statistics.incrementLoadCounts(this.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(this)));let n=t.commandList;t.commandList=mfe;try{this._content.update(e,t)}catch(i){throw this._contentState=Xo.FAILED,i}mfe.length=0,t.commandList=n};function pfe(e,t,n){let i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function Xz(e,t,n){return Math.max(O.normalize(e,t,n)-O.EPSILON7,0)}ar.prototype.updatePriority=function(){let e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=4,r=1,s=0,a=o,l=s+a,u=o,f=l+u,h=r,p=Math.pow(10,f),g=f+h,m=r,y=Math.pow(10,g),b=g+m,x=Math.pow(10,b),A=Xz(this._depth,n.depth,i.depth);A=t?1-A:A;let S=!e.isSkippingLevelOfDetail&&this.refine===qo.REPLACE?Xz(this._priorityHolder._distanceToCamera,n.distance,i.distance):Xz(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),v=pfe(S,a,s),P=this._priorityProgressiveResolution?0:p,M=Xz(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),R=pfe(M,u,l),L=this.priorityDeferred?y:0,F=e._pass===Uo.PRELOAD_FLIGHT?0:x;this._priority=A+v+P+R+L+F};ar.prototype.isDestroyed=function(){return!1};ar.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),de(this)};var Zf=ar;function N_(e){e=e??W.EMPTY_OBJECT;let t=e.id,n=e.group,i=e.class;T.typeOf.object("options.group",n),T.typeOf.object("options.class",i);let o=c(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}Object.defineProperties(N_.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});N_.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};N_.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};N_.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};N_.prototype.getProperty=function(e){return Bn.getProperty(e,this._properties,this._class)};N_.prototype.setProperty=function(e,t){return Bn.setProperty(e,t,this._properties,this._class)};N_.prototype.getPropertyBySemantic=function(e){return Bn.getPropertyBySemantic(e,this._properties,this._class)};N_.prototype.setPropertyBySemantic=function(e,t){return Bn.setPropertyBySemantic(e,t,this._properties,this._class)};var NE=N_;function F_(e){e=e??W.EMPTY_OBJECT;let t=e.tileset,n=e.class;T.typeOf.object("options.tileset",t),T.typeOf.object("options.class",n);let i=c(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(F_.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});F_.prototype.hasProperty=function(e){return Bn.hasProperty(e,this._properties,this._class)};F_.prototype.hasPropertyBySemantic=function(e){return Bn.hasPropertyBySemantic(e,this._properties,this._class)};F_.prototype.getPropertyIds=function(e){return Bn.getPropertyIds(this._properties,this._class,e)};F_.prototype.getProperty=function(e){return Bn.getProperty(e,this._properties,this._class)};F_.prototype.setProperty=function(e,t){return Bn.setProperty(e,t,this._properties,this._class)};F_.prototype.getPropertyBySemantic=function(e){return Bn.getPropertyBySemantic(e,this._properties,this._class)};F_.prototype.setPropertyBySemantic=function(e,t){return Bn.setPropertyBySemantic(e,t,this._properties,this._class)};var LL=F_;function Afe(e){e=e??W.EMPTY_OBJECT;let t=e.metadataJson,n=e.schema;T.typeOf.object("options.metadataJson",t),T.typeOf.object("options.schema",n);let i=t.metadata??t.tileset,o;c(i)&&(o=new LL({tileset:i,class:n.classes[i.class]}));let r=[],s=[],a=t.groups;if(Array.isArray(a)){let l=a.length;for(let u=0;u<l;u++){let f=a[u];s.push(new NE({group:f,class:n.classes[f.class]}))}}else if(c(a)){r=Object.keys(a).sort();let l=r.length;for(let u=0;u<l;u++){let f=r[u];if(a.hasOwnProperty(f)){let h=a[f];s.push(new NE({id:f,group:a[f],class:n.classes[h.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(Afe.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},groupIds:{get:function(){return this._groupIds}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});var Kx=Afe;var Cfe={},jXe=new d;Cfe.checkChildrenWithinParent=function(e){T.typeOf.object("tile",e);let t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof Yl||i instanceof Lu){let o=i._orientedBoundingBox;e._optimChildrenWithinParent=qf.USE_OPTIMIZATION;for(let r=0;r<n;++r){let a=t[r].boundingVolume;if(!(a instanceof Yl||a instanceof Lu)){e._optimChildrenWithinParent=qf.SKIP_OPTIMIZATION;break}let l=a._orientedBoundingBox,u=d.subtract(l.center,o.center,jXe),f=d.magnitude(u);d.divideByScalar(u,f,u);let h=Math.abs(o.halfAxes[0]*u.x)+Math.abs(o.halfAxes[1]*u.y)+Math.abs(o.halfAxes[2]*u.z)+Math.abs(o.halfAxes[3]*u.x)+Math.abs(o.halfAxes[4]*u.y)+Math.abs(o.halfAxes[5]*u.z)+Math.abs(o.halfAxes[6]*u.x)+Math.abs(o.halfAxes[7]*u.y)+Math.abs(o.halfAxes[8]*u.z),p=Math.abs(l.halfAxes[0]*u.x)+Math.abs(l.halfAxes[1]*u.y)+Math.abs(l.halfAxes[2]*u.z)+Math.abs(l.halfAxes[3]*u.x)+Math.abs(l.halfAxes[4]*u.y)+Math.abs(l.halfAxes[5]*u.z)+Math.abs(l.halfAxes[6]*u.x)+Math.abs(l.halfAxes[7]*u.y)+Math.abs(l.halfAxes[8]*u.z);if(h<=p+f){e._optimChildrenWithinParent=qf.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===qf.USE_OPTIMIZATION};var NL=Cfe;function FL(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(FL.prototype,{length:{get:function(){return this._length}}});function WXe(e,t,n){this.item=e,this.previous=t,this.next=n}FL.prototype.add=function(e){let t=new WXe(e,this.tail,void 0);return c(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t};function Efe(e,t){c(t.previous)&&c(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):c(t.previous)?(t.previous.next=void 0,e.tail=t.previous):c(t.next)?(t.next.previous=void 0,e.head=t.next):(e.head=void 0,e.tail=void 0),t.next=void 0,t.previous=void 0}FL.prototype.remove=function(e){c(e)&&(Efe(this,e),--this._length)};FL.prototype.splice=function(e,t){if(e===t)return;Efe(this,t);let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e};var BL=FL;function $x(){this._list=new BL,this._sentinel=this._list.add(),this._trimTiles=!1}$x.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};$x.prototype.touch=function(e){let t=e.cacheNode;c(t)&&this._list.splice(this._sentinel,t)};$x.prototype.add=function(e){c(e.cacheNode)||(e.cacheNode=this._list.add(e))};$x.prototype.unloadTile=function(e,t,n){let i=t.cacheNode;c(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))};$x.prototype.unloadTiles=function(e,t){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,r=i.head;for(;r!==o&&(e.totalMemoryUsageInBytes>e.cacheBytes||n);){let s=r.item;r=r.next,this.unloadTile(e,s,t)}};$x.prototype.trim=function(){this._trimTiles=!0};var kL=$x;function Kz(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function uq(e,t){let n;return t==="_loadTimestamp"?n=Q.toDate(e).getTime():n=e,n}Kz.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=uq(e,n),this._referenceMaximum[n]=uq(t,n)};function qXe(e,t){let n=e.tilePropertyName;if(c(n)){let i=uq(t[n],n);return c(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}var lq=[new G(.1,.1,.1,1),new G(.153,.278,.878,1),new G(.827,.231,.49,1),new G(.827,.188,.22,1),new G(1,.592,.259,1),new G(1,.843,0,1)];Kz.prototype.colorize=function(e,t){let n=this.tilePropertyName;if(!c(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;let i=qXe(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;let s=r-o+O.EPSILON7,l=O.clamp(i-o,0,s)/s,u=lq.length-1,f=l*u,h=Math.floor(f),p=Math.ceil(f),g=f-h,m=lq[h],y=lq[p],b=G.clone(G.WHITE);b.red=O.lerp(m.red,y.red,g),b.green=O.lerp(m.green,y.green,g),b.blue=O.lerp(m.blue,y.blue,g),e._debugColor=b};Kz.prototype.resetMinimumMaximum=function(){let e=this.tilePropertyName;if(c(e)){let t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=c(t)&&c(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};var UL=Kz;function FE(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.texturesReferenceCounterById={},this.batchTableByteLength=0}FE.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0};FE.prototype.incrementSelectionCounts=function(e){this.numberOfFeaturesSelected+=e.featuresLength,this.numberOfPointsSelected+=e.pointsLength,this.numberOfTrianglesSelected+=e.trianglesLength;let t=e.innerContents;if(c(t)){let n=t.length;for(let i=0;i<n;++i)this.incrementSelectionCounts(t[i])}};FE.prototype.incrementLoadCounts=function(e){if(this.numberOfFeaturesLoaded+=e.featuresLength,this.numberOfPointsLoaded+=e.pointsLength,this.geometryByteLength+=e.geometryByteLength,this.batchTableByteLength+=e.batchTableByteLength,!(e instanceof Ou))this.texturesByteLength+=e.texturesByteLength;else{let n=e.getTextureIds();for(let i of n){let o=this.texturesReferenceCounterById[i]??0;if(o===0){let r=e.getTextureByteLengthById(i);this.texturesByteLength+=r}this.texturesReferenceCounterById[i]=o+1}}let t=e.innerContents;if(c(t)){let n=t.length;for(let i=0;i<n;++i)this.incrementLoadCounts(t[i])}};FE.prototype.decrementLoadCounts=function(e){if(this.numberOfFeaturesLoaded-=e.featuresLength,this.numberOfPointsLoaded-=e.pointsLength,this.geometryByteLength-=e.geometryByteLength,this.batchTableByteLength-=e.batchTableByteLength,!(e instanceof Ou))this.texturesByteLength-=e.texturesByteLength;else{let n=e.getTextureIds();for(let i of n){let o=this.texturesReferenceCounterById[i];if(o===1){delete this.texturesReferenceCounterById[i];let r=e.getTextureByteLengthById(i);this.texturesByteLength-=r}else this.texturesReferenceCounterById[i]=o-1}}let t=e.innerContents;if(c(t)){let n=t.length;for(let i=0;i<n;++i)this.decrementLoadCounts(t[i])}};FE.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.texturesReferenceCounterById={...e.texturesReferenceCounterById},t.batchTableByteLength=e.batchTableByteLength};var gh=FE;function VL(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(VL.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});VL.prototype.makeDirty=function(){this._styleDirty=!0};VL.prototype.resetDirty=function(){this._styleDirty=!1};VL.prototype.applyStyle=function(e){if(!c(e.root)||c(this._style)&&!this._style._ready)return;let t=this._styleDirty;t&&++this._lastStyleTime;let n=this._lastStyleTime,i=e._statistics,o=t?e._selectedTiles:e._selectedTilesToStyle,r=o.length;for(let s=0;s<r;++s){let a=o[s];if(a.lastStyleTime!==n){let l=a.content;a.lastStyleTime=n,l.applyStyle(this._style),i.numberOfFeaturesStyled+=l.featuresLength,++i.numberOfTilesStyled}}};var zL=VL;function YXe(e,t,n){let i=oi(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;T.typeOf.object("implicitTiling",i),this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;let o=t.boundingVolume;if(!c(o.box)&&!c(o.region)&&!oi(o,"3DTILES_bounding_volume_S2")&&!oi(o,"3DTILES_bounding_volume_cylinder"))throw new ae("Only box, region, 3DTILES_bounding_volume_S2, and 3DTILES_bounding_volume_cylinder are supported for implicit tiling");this.boundingVolume=o,this.refine=t.refine,this.subtreeUriTemplate=new we({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];let r=XXe(t);for(let s=0;s<r.length;s++){let a=r[s];this.contentHeaders.push(je(a,!0));let l=new we({url:a.uri});this.contentUriTemplates.push(l)}this.contentCount=this.contentHeaders.length,this.tileHeader=KXe(t),this.subdivisionScheme=or[i.subdivisionScheme],this.branchingFactor=or.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,c(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function XXe(e){if(oi(e,"3DTILES_multiple_contents")){let t=e.extensions["3DTILES_multiple_contents"];return c(t.contents)?t.contents:t.content}return c(e.contents)?e.contents:c(e.content)?[e.content]:[]}function KXe(e){let t=je(e,!0);return c(t.extensions)&&(delete t.extensions["3DTILES_implicit_tiling"],delete t.extensions["3DTILES_multiple_contents"],Object.keys(t.extensions).length===0&&delete t.extensions),delete t.implicitTiling,delete t.contents,delete t.content,t}var Zx=YXe;var HL={};function Sfe(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function fq(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function wfe(e){return e&=1431655765,e=(e^e>>1)&858993459,e=(e^e>>2)&252645135,e=(e^e>>4)&16711935,e=(e^e>>8)&65535,e}function dq(e){return e&=153391689,e=(e^e>>2)&51130563,e=(e^e>>4)&50393103,e=(e^e>>8)&4278190335,e=(e^e>>16)&1023,e}HL.encode2D=function(e,t){if(T.typeOf.number("x",e),T.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new E("inputs must be 16-bit unsigned integers");return(Sfe(e)|Sfe(t)<<1)>>>0};HL.decode2D=function(e,t){if(T.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new E("input must be a 32-bit unsigned integer");return c(t)||(t=new Array(2)),t[0]=wfe(e),t[1]=wfe(e>>1),t};HL.encode3D=function(e,t,n){if(T.typeOf.number("x",e),T.typeOf.number("y",t),T.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new E("inputs must be 10-bit unsigned integers");return fq(e)|fq(t)<<1|fq(n)<<2};HL.decode3D=function(e,t){if(T.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new E("input must be a 30-bit unsigned integer");return c(t)||(t=new Array(3)),t[0]=dq(e),t[1]=dq(e>>1),t[2]=dq(e>>2),t};var Wy=HL;function Ko(e){if(T.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),T.typeOf.number("options.subtreeLevels",e.subtreeLevels),T.typeOf.number("options.level",e.level),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),e.subdivisionScheme===or.OCTREE&&T.typeOf.number("options.z",e.z),e.level<0)throw new E("level must be non-negative");if(e.x<0)throw new E("x must be non-negative");if(e.y<0)throw new E("y must be non-negative");if(e.subdivisionScheme===or.OCTREE&&e.z<0)throw new E("z must be non-negative");let t=1<<e.level;if(e.x>=t)throw new E("x is out of range");if(e.y>=t)throw new E("y is out of range");if(e.subdivisionScheme===or.OCTREE&&e.z>=t)throw new E("z is out of range");this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===or.OCTREE&&(this.z=e.z)}Object.defineProperties(Ko.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===or.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===or.OCTREE?Wy.encode3D(this.x,this.y,this.z):Wy.encode2D(this.x,this.y)}},tileIndex:{get:function(){let e=this.subdivisionScheme===or.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function hq(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new E("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new E("coordinates must have same subtreeLevels")}Ko.prototype.getDescendantCoordinates=function(e){T.typeOf.object("offsetCoordinates",e),hq(this,e);let t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===or.OCTREE){let o=(this.z<<e.level)+e.z;return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};Ko.prototype.getAncestorCoordinates=function(e){if(T.typeOf.number("offsetLevels",e),e<0)throw new E("offsetLevels must be non-negative");if(e>this.level)throw new E("ancestor cannot be above the tileset root");let t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===or.OCTREE){let r=Math.floor(this.z/t);return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};Ko.prototype.getOffsetCoordinates=function(e){if(T.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new E("this is not an ancestor of descendant");hq(this,e);let t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===or.OCTREE){let r=e.z%n;return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})};Ko.prototype.getChildCoordinates=function(e){T.typeOf.number("childIndex",e);let t=or.getBranchingFactor(this.subdivisionScheme);if(e<0||t<=e)throw new E(`childIndex must be at least 0 and less than ${t}`);let n=this.level+1,i=2*this.x+e%2,o=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===or.OCTREE){let r=2*this.z+Math.floor(e/4)%2;return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new Ko({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};Ko.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)};Ko.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)};Ko.prototype.isAncestor=function(e){T.typeOf.object("descendantCoordinates",e),hq(this,e);let t=e.level-this.level;if(t<=0)return!1;let n=e.x>>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===or.OCTREE){let s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};Ko.prototype.isEqual=function(e){return T.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===or.OCTREE?this.z===e.z:!0)};Ko.prototype.isImplicitTilesetRoot=function(){return this.level===0};Ko.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};Ko.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};Ko.prototype.getTemplateValues=function(){let e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===or.OCTREE&&(e.z=this.z),e};var vfe=[0,0,0];Ko.fromMortonIndex=function(e,t,n,i){let o;return e===or.OCTREE?(o=Wy.decode3D(i,vfe),new Ko({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=Wy.decode2D(i,vfe),new Ko({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};Ko.fromTileIndex=function(e,t,n){let i,o,r;return e===or.OCTREE?(i=Math.floor(O.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(O.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),Ko.fromMortonIndex(e,t,i,r)};var Qx=Ko;function B_(){}B_.selectTiles=function(e,t){E.throwInstantiationError()};B_.sortChildrenByDistanceToCamera=function(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera};B_.canTraverse=function(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:e._screenSpaceError>e.tileset.memoryAdjustedScreenSpaceError};B_.selectTile=function(e,t){if(e.contentVisibility(t)===Wt.OUTSIDE)return;e._wasSelectedLastFrame=!0;let{content:n,tileset:i}=e;n.featurePropertiesDirty?(n.featurePropertiesDirty=!1,e.lastStyleTime=0,i._selectedTilesToStyle.push(e)):e._selectedFrame<t.frameNumber-1&&(i._selectedTilesToStyle.push(e),e._wasSelectedLastFrame=!1),e._selectedFrame=t.frameNumber,i._selectedTiles.push(e)};B_.visitTile=function(e,t){++e.tileset._statistics.visited,e._visitedFrame=t.frameNumber};B_.touchTile=function(e,t){e._touchedFrame!==t.frameNumber&&(e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber)};B_.loadTile=function(e,t){let{tileset:n}=e;if(e._requestedFrame===t.frameNumber||!e.hasUnloadedRenderableContent&&!e.contentExpired||!$Xe(e,t))return;let i=t.camera.timeSinceMoved<n.foveatedTimeDelay;e.priorityDeferred&&i||(e._requestedFrame=t.frameNumber,n._requestedTiles.push(e))};function $Xe(e,t){let{tileset:n}=e;if(!n._cullRequestsWhileMoving)return!0;let{positionWCDeltaMagnitude:i,positionWCDeltaMagnitudeLastFrame:o}=t.camera,r=i!==0?i:o,s=Math.max(e.boundingSphere.radius*2,1);return n.cullRequestsWhileMovingMultiplier*r/s<1}B_.updateTile=function(e,t){Dfe(e,t),e.updateExpiration(),e._wasMinPriorityChild=!1,e._priorityHolder=e,JXe(e),e._shouldSelect=!1,e._finalResolution=!0};function Dfe(e,t){if(e.updateVisibility(t),!e.isVisible)return;let n=e.children.length>0;if((e.hasTilesetContent||e.hasImplicitContent)&&n){let r=e.children[0];Dfe(r,t),e._visible=r._visible;return}if(ZXe(e,t)){e._visible=!1;return}let i=e.refine===qo.REPLACE,o=e._optimChildrenWithinParent===qf.USE_OPTIMIZATION;if(i&&o&&n&&!QXe(e,t)){++e.tileset._statistics.numberOfTilesCulledWithChildrenUnion,e._visible=!1;return}}function ZXe(e,t){let{parent:n,tileset:i}=e;return!c(n)||n.hasTilesetContent||n.hasImplicitContent||n.refine!==qo.ADD?!1:e.getScreenSpaceError(t,!0)<=i.memoryAdjustedScreenSpaceError}function QXe(e,t){let n=!1,i=e.children;for(let o=0;o<i.length;++o){let r=i[o];r.updateVisibility(t),n=n||r.isVisible}return n}function JXe(e){let t=e.tileset._minimumPriority,n=e.tileset._maximumPriority,i=e._priorityHolder;n.distance=Math.max(i._distanceToCamera,n.distance),t.distance=Math.min(i._distanceToCamera,t.distance),n.depth=Math.max(e._depth,n.depth),t.depth=Math.min(e._depth,t.depth),n.foveatedFactor=Math.max(i._foveatedFactor,n.foveatedFactor),t.foveatedFactor=Math.min(i._foveatedFactor,t.foveatedFactor),n.reverseScreenSpaceError=Math.max(e._priorityReverseScreenSpaceError,n.reverseScreenSpaceError),t.reverseScreenSpaceError=Math.min(e._priorityReverseScreenSpaceError,t.reverseScreenSpaceError)}var Zs=B_;function Pfe(){}var GL={stack:new Jc,stackMaximumLength:0};Pfe.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e.hasMixedContent=!1;let n=!0,i=e.root;if(i.updateVisibility(t),!i.isVisible)return n;let{touchTile:o,visitTile:r}=Zs,s=GL.stack;for(s.push(i);s.length>0;){GL.stackMaximumLength=Math.max(GL.stackMaximumLength,s.length);let a=s.pop(),l=a.refine===qo.ADD,u=a.refine===qo.REPLACE,f=eKe(a);f&&tKe(a,s,t),(l||u&&!f)&&(nKe(e,a),o(a,t),iKe(a,t),a.hasRenderableContent&&!a.contentAvailable&&(n=!1)),r(a,t)}return GL.stack.trim(GL.stackMaximumLength),n};function eKe(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:(e.hasEmptyContent,!0)}function tKe(e,t,n){let{children:i}=e;for(let o=0;o<i.length;++o){let r=i[o];r.updateVisibility(n),r.isVisible&&t.push(r)}}function nKe(e,t){(t.hasUnloadedRenderableContent||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function iKe(e,t){e.contentAvailable&&e.contentVisibility(t)!==Wt.OUTSIDE&&e.tileset._selectedTiles.push(e)}var jL=Pfe;function Ife(){}var WL={stack:new Jc,stackMaximumLength:0},qL={stack:new Jc,stackMaximumLength:0};Ife.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;let n=e.root;if(Zs.updateTile(n,t),!n.isVisible||n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;rKe(n,t),WL.stack.trim(WL.stackMaximumLength),qL.stack.trim(qL.stackMaximumLength);let i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()};function mq(e,t){e.contentAvailable&&Zs.selectTile(e,t)}function oKe(e,t,n){let i=e.refine===qo.REPLACE,{tileset:o,children:r}=e,{updateTile:s,loadTile:a,touchTile:l}=Zs;for(let m=0;m<r.length;++m)s(r[m],n);r.sort(Zs.sortChildrenByDistanceToCamera);let u=i&&e.hasRenderableContent,f=!0,h=!1,p=-1,g=Number.MAX_VALUE;for(let m=0;m<r.length;++m){let y=r[m];if(y.isVisible?(t.push(y),y._foveatedFactor<g&&(p=m,g=y._foveatedFactor),h=!0):(u||o.loadSiblings)&&(y._foveatedFactor<g&&(p=m,g=y._foveatedFactor),a(y,n),l(y,n)),u){let b;y._inRequestVolume?y.hasRenderableContent?b=y.contentAvailable:b=sKe(y,n):b=!1,f=f&&b}}if(h||(f=!1),p!==-1&&i){let m=r[p];m._wasMinPriorityChild=!0;let y=(e._wasMinPriorityChild||e===o.root)&&g<=e._priorityHolder._foveatedFactor?e._priorityHolder:e;y._foveatedFactor=Math.min(m._foveatedFactor,y._foveatedFactor),y._distanceToCamera=Math.min(m._distanceToCamera,y._distanceToCamera);for(let b=0;b<r.length;++b)r[b]._priorityHolder=y}return f}function rKe(e,t){let{tileset:n}=e,{canTraverse:i,loadTile:o,visitTile:r,touchTile:s}=Zs,a=WL.stack;for(a.push(e);a.length>0;){WL.stackMaximumLength=Math.max(WL.stackMaximumLength,a.length);let l=a.pop(),u=l.parent,f=!c(u)||u._refines;l._refines=i(l)?oKe(l,a,t)&&f:!1;let h=!l._refines&&f;l.hasRenderableContent?l.refine===qo.ADD?(mq(l,t),o(l,t)):l.refine===qo.REPLACE&&(o(l,t),h&&mq(l,t)):(n._emptyTiles.push(l),o(l,t),h&&mq(l,t)),r(l,t),s(l,t)}}function sKe(e,t){let{canTraverse:n,updateTile:i,loadTile:o,touchTile:r}=Zs,s=!0,a=qL.stack;for(a.push(e);a.length>0;){qL.stackMaximumLength=Math.max(qL.stackMaximumLength,a.length);let l=a.pop(),u=l.children,f=u.length,h=!l.hasRenderableContent&&n(l);if(!h&&!l.contentAvailable&&(s=!1),i(l,t),l.isVisible||(o(l,t),r(l,t)),h)for(let p=0;p<f;++p){let g=u[p];a.push(g)}}return e.hasEmptyContent||s}var YL=Ife;function Ofe(){}var XL={stack:new Jc,stackMaximumLength:0},KL={stack:new Jc,stackMaximumLength:0},k_={stack:new Jc,stackMaximumLength:0,ancestorStack:new Jc,ancestorStackMaximumLength:0},aKe=2;Ofe.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;let n=e.root;if(Zs.updateTile(n,t),!n.isVisible||n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;hKe(n,t),mKe(n,t),XL.stack.trim(XL.stackMaximumLength),KL.stack.trim(KL.stackMaximumLength),k_.stack.trim(k_.stackMaximumLength),k_.ancestorStack.trim(k_.ancestorStackMaximumLength);let i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()};function cKe(e,t){let{updateTile:n,touchTile:i,selectTile:o}=Zs,r=KL.stack;for(r.push(e);r.length>0;){KL.stackMaximumLength=Math.max(KL.stackMaximumLength,r.length);let a=r.pop().children;for(let l=0;l<a.length;++l){let u=a[l];u.isVisible&&(u.contentAvailable?(n(u,t),i(u,t),o(u,t)):u._depth-e._depth<aKe&&r.push(u))}}}function $z(e,t){let n=e.contentAvailable?e:e._ancestorWithContentAvailable;c(n)?n._shouldSelect=!0:cKe(e,t)}function lKe(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;let{parent:n}=e;if(!c(n))return;let i=!n.hasUnloadedRenderableContent||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}function uKe(e,t){let n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||c(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function fKe(e,t,n){let{tileset:i,children:o}=e,{updateTile:r,loadTile:s,touchTile:a}=Zs;for(let u=0;u<o.length;++u)r(o[u],n);o.sort(Zs.sortChildrenByDistanceToCamera);let l=!1;for(let u=0;u<o.length;++u){let f=o[u];f.isVisible?(t.push(f),l=!0):i.loadSiblings&&(s(f,n),a(f,n))}return l}function dKe(e,t){let{tileset:n}=e;return n.immediatelyLoadDesiredLevelOfDetail?!1:c(e._ancestorWithContent)?e._screenSpaceError===0?e.parent._screenSpaceError>t:e._screenSpaceError>t:!0}function hKe(e,t){let{tileset:n}=e,i=n.immediatelyLoadDesiredLevelOfDetail?Number.MAX_VALUE:Math.max(n.baseScreenSpaceError,n.memoryAdjustedScreenSpaceError),{canTraverse:o,loadTile:r,visitTile:s,touchTile:a}=Zs,l=XL.stack;for(l.push(e);l.length>0;){XL.stackMaximumLength=Math.max(XL.stackMaximumLength,l.length);let u=l.pop();lKe(u,t);let f=u.parent,h=!c(f)||f._refines;u._refines=o(u)?fKe(u,l,t)&&h:!1;let p=!u._refines&&h;u.hasRenderableContent?u.refine===qo.ADD?($z(u,t),r(u,t)):u.refine===qo.REPLACE&&(dKe(u,i)?(r(u,t),p&&$z(u,t)):p?($z(u,t),r(u,t)):uKe(n,u)&&r(u,t)):(n._emptyTiles.push(u),r(u,t),p&&$z(u,t)),s(u,t),a(u,t)}}function mKe(e,t){let{selectTile:n,canTraverse:i}=Zs,{stack:o,ancestorStack:r}=k_,s;for(o.push(e);o.length>0||r.length>0;){if(k_.stackMaximumLength=Math.max(k_.stackMaximumLength,o.length),k_.ancestorStackMaximumLength=Math.max(k_.ancestorStackMaximumLength,r.length),r.length>0){let u=r.peek();if(u._stackLength===o.length){r.pop(),u!==s&&(u._finalResolution=!1),n(u,t);continue}}let a=o.pop();if(!c(a))continue;let l=i(a);if(a._shouldSelect)if(a.refine===qo.ADD)n(a,t);else{if(a._selectionDepth=r.length,a._selectionDepth>0&&(a.tileset.hasMixedContent=!0),s=a,!l){n(a,t);continue}r.push(a),a._stackLength=o.length}if(l){let u=a.children;for(let f=0;f<u.length;++f){let h=u[f];h.isVisible&&o.push(h)}}}}var $L=Ofe;function cr(e){e=e??W.EMPTY_OBJECT,this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._scaledGeometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._modelUpAxis=void 0,this._modelForwardAxis=void 0,this._cache=new kL,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._showCreditsOnScreen=e.showCreditsOnScreen??!1,this._cullWithChildrenBounds=e.cullWithChildrenBounds??!0,this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new Jc,this._maximumScreenSpaceError=e.maximumScreenSpaceError??16,this._memoryAdjustedScreenSpaceError=this._maximumScreenSpaceError,this._cacheBytes=e.cacheBytes??512*1024*1024,T.typeOf.number.greaterThanOrEquals("cacheBytes",this._cacheBytes,0);let t=e.maximumCacheOverflowBytes??512*1024*1024;T.typeOf.number.greaterThanOrEquals("maximumCacheOverflowBytes",t,0),this._maximumCacheOverflowBytes=t,this._styleEngine=new zL,this._styleApplied=!1,this._modelMatrix=c(e.modelMatrix)?B.clone(e.modelMatrix):B.clone(B.IDENTITY),this._addHeightCallbacks=[],this._statistics=new gh,this._statisticsLast=new gh,this._statisticsPerPass=new Array(Uo.NUMBER_OF_PASSES);for(let o=0;o<Uo.NUMBER_OF_PASSES;++o)this._statisticsPerPass[o]=new gh;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new UL(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=e.cullRequestsWhileMoving??!0,this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=e.cullRequestsWhileMovingMultiplier??60,this.progressiveResolutionHeightFraction=O.clamp(e.progressiveResolutionHeightFraction??.3,0,.5),this.preferLeaves=e.preferLeaves??!1,this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=e.ellipsoid??ie.WGS84,this._initialClippingPlanesOriginMatrix=B.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=e.vectorClassificationOnly??!1,this._vectorKeepDecodedPositions=e.vectorKeepDecodedPositions??!1,this.preloadWhenHidden=e.preloadWhenHidden??!1,this.preloadFlightDestinations=e.preloadFlightDestinations??!0,this._pass=void 0,this.dynamicScreenSpaceError=e.dynamicScreenSpaceError??!0,this.foveatedScreenSpaceError=e.foveatedScreenSpaceError??!0,this._foveatedConeSize=e.foveatedConeSize??.1,this._foveatedMinimumScreenSpaceErrorRelaxation=e.foveatedMinimumScreenSpaceErrorRelaxation??0,this.foveatedInterpolationCallback=e.foveatedInterpolationCallback??O.lerp,this.foveatedTimeDelay=e.foveatedTimeDelay??.2,this.dynamicScreenSpaceErrorDensity=e.dynamicScreenSpaceErrorDensity??2e-4,this.dynamicScreenSpaceErrorFactor=e.dynamicScreenSpaceErrorFactor??24,this.dynamicScreenSpaceErrorHeightFalloff=e.dynamicScreenSpaceErrorHeightFalloff??.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=e.shadows??xn.ENABLED,this.show=e.show??!0,this.colorBlendMode=Bl.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new vm(e.pointCloudShading),this._pointCloudEyeDomeLighting=new f_,this.loadProgress=new pe,this.allTilesLoaded=new pe,this.initialTilesLoaded=new pe,this.tileLoad=new pe,this.tileUnload=new pe,this.tileFailed=new pe,this.tileVisible=new pe,this.skipLevelOfDetail=e.skipLevelOfDetail??!1,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=e.baseScreenSpaceError??1024,this.skipScreenSpaceErrorFactor=e.skipScreenSpaceErrorFactor??16,this.skipLevels=e.skipLevels??1,this.immediatelyLoadDesiredLevelOfDetail=e.immediatelyLoadDesiredLevelOfDetail??!1,this.loadSiblings=e.loadSiblings??!1,this._clippingPlanes=void 0,c(e.clippingPlanes)&&gs.setOwner(e.clippingPlanes,this,"_clippingPlanes"),this._clippingPolygons=void 0,c(e.clippingPolygons)&&th.setOwner(e.clippingPolygons,this,"_clippingPolygons"),c(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new ex,this._shouldDestroyImageBasedLighting=!0),this._environmentMapManager=new c_(e.environmentMapOptions),this.lightColor=e.lightColor,this.backFaceCulling=e.backFaceCulling??!0,this._enableShowOutline=e.enableShowOutline??!0,this.showOutline=e.showOutline??!0,this.outlineColor=e.outlineColor??G.BLACK,this.splitDirection=e.splitDirection??Vr.NONE,this.enableCollision=e.enableCollision??!1,this._projectTo2D=e.projectTo2D??!1,this._enablePick=e.enablePick??!1,this.debugFreezeFrame=e.debugFreezeFrame??!1,this.debugColorizeTiles=e.debugColorizeTiles??!1,this._enableDebugWireframe=e.enableDebugWireframe??!1,this.debugWireframe=e.debugWireframe??!1,this.debugWireframe===!0&&this._enableDebugWireframe===!1&&dt("tileset-debug-wireframe-ignored","enableDebugWireframe must be set to true in the Cesium3DTileset constructor, otherwise debugWireframe will be ignored."),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.debugShowContentBoundingVolume=e.debugShowContentBoundingVolume??!1,this.debugShowViewerRequestVolume=e.debugShowViewerRequestVolume??!1,this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=e.debugShowGeometricError??!1,this.debugShowRenderingStatistics=e.debugShowRenderingStatistics??!1,this.debugShowMemoryUsage=e.debugShowMemoryUsage??!1,this.debugShowUrl=e.debugShowUrl??!1,this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let n=e.featureIdLabel??"featureId_0";typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=e.instanceFeatureIdLabel??"instanceFeatureId_0";typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i}Object.defineProperties(cr.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){gs.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){th.setOwner(e,this,"_clippingPolygons")}},properties:{get:function(){return this._properties}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return ws("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},hasMixedContent:{get:function(){return this._hasMixedContent},set:function(e){T.typeOf.bool("value",e),this._hasMixedContent=e}},isSkippingLevelOfDetail:{get:function(){return this.skipLevelOfDetail&&!c(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(c(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(c(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){T.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e,this._memoryAdjustedScreenSpaceError=e}},cacheBytes:{get:function(){return this._cacheBytes},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._cacheBytes=e}},maximumCacheOverflowBytes:{get:function(){return this._maximumCacheOverflowBytes},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumCacheOverflowBytes=e}},memoryAdjustedScreenSpaceError:{get:function(){return this._memoryAdjustedScreenSpaceError}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){T.defined("pointCloudShading",e),this._pointCloudShading=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){let e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return c(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(B.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):B.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){T.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),T.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){T.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),T.typeOf.number.lessThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,this.maximumScreenSpaceError),this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){T.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},environmentMapManager:{get:function(){return this._environmentMapManager}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e,Ufe(this)}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),T.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),T.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}});cr.fromIonAssetId=async function(e,t){T.defined("assetId",e);let n=await Cu.fromAssetId(e);return cr.fromUrl(n,t)};cr.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT;let n=we.createIfNeeded(e),i;n.extension==="json"?i=n.getBaseUri(!0):n.isDataUri&&(i="");let o=await cr.loadJson(n),r=await pKe(n,o),s=new cr(t);s._resource=n,s._url=n.url,s._basePath=i,s._metadataExtension=r,s._geometricError=o.geometricError,s._scaledGeometricError=o.geometricError;let a=o.asset;s._asset=a,s._extras=o.extras,Ufe(s);let l=c(o.asset.gltfUpAxis)?Fo.fromName(o.asset.gltfUpAxis):Fo.Y,u=t.modelUpAxis??l,f=t.modelForwardAxis??Fo.X;s._properties=o.properties,s._extensionsUsed=o.extensionsUsed,s._extensions=o.extensions,s._modelUpAxis=u,s._modelForwardAxis=f,s._root=s.loadTileset(n,o);let p=s._root.createBoundingVolume(o.root.boundingVolume,B.IDENTITY).boundingSphere.center,g=s._ellipsoid.cartesianToCartographic(p);return c(g)&&g.height>ui._defaultMinTerrainHeight&&(s._initialClippingPlanesOriginMatrix=Ot.eastNorthUpToFixedFrame(p)),s._clippingPlanesOriginMatrix=B.clone(s._initialClippingPlanesOriginMatrix),s};cr.loadJson=function(e){return we.createIfNeeded(e).fetchJson()};cr.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};cr.prototype.loadTileset=function(e,t,n){let i=t.asset;if(!c(i))throw new ae("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new ae("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");c(t.extensionsRequired)&&cr.checkSupportedExtensions(t.extensionsRequired);let o=this._statistics,r=i.tilesetVersion;c(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));let s=Rfe(this,e,t.root,n);c(n)&&(n.children.push(s),s._depth=n._depth+1);let a=[];for(a.push(s);a.length>0;){let l=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&l.refine===qo.ADD;let u=l._header.children;if(c(u))for(let f=0;f<u.length;++f){let h=u[f],p=Rfe(this,e,h,l);l.children.push(p),p._depth=l._depth+1,a.push(p)}this._cullWithChildrenBounds&&NL.checkChildrenWithinParent(l)}return s};function Rfe(e,t,n,i){if(!(c(n.implicitTiling)||oi(n,"3DTILES_implicit_tiling")))return new Zf(e,t,n,i);let r=e.schema,s=new Zx(t,n,r),a=new Qx({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),l=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,f=je(n,!0);f.contents=[{uri:l}],delete f.content,delete f.extensions;let h=new Zf(e,t,f,i);return h.implicitTileset=s,h.implicitCoordinates=a,h}async function pKe(e,t){let n=oi(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t,i;if(c(n.schemaUri))e=e.getDerivedResource({url:n.schemaUri}),i=vi.getSchemaLoader({resource:e});else if(c(n.schema))i=vi.getSchemaLoader({schema:n.schema});else return;await i.load();let o=new Kx({schema:i.schema,metadataJson:n});return vi.unload(i),o}var Mfe=new d,_Ke=new he,gKe=new B,yKe=new d,bKe=new d,xKe=new d,TKe=new d;function AKe(e,t){let n,i,o,r,s,a=t.camera,l=e._root,u=l.contentBoundingVolume;if(u instanceof Lu)n=d.normalize(a.positionWC,Mfe),i=a.directionWC,o=a.positionCartographic.height,r=u.minimumHeight,s=u.maximumHeight;else{let y=B.inverseTransformation(l.computedTransform,gKe),b=t.mapProjection.ellipsoid,x=u.boundingVolume,A=B.multiplyByPoint(y,x.center,yKe);if(d.magnitude(A)>b.minimumRadius){let C=he.fromCartesian(A,b,_Ke);n=d.normalize(a.positionWC,Mfe),i=a.directionWC,o=a.positionCartographic.height,r=0,s=C.height*2}else{let C=B.multiplyByPoint(y,a.positionWC,bKe);if(n=d.UNIT_Z,i=B.multiplyByPointAsVector(y,a.directionWC,xKe),i=d.normalize(i,i),o=C.z,u instanceof Yl){let S=J.getColumn(x.halfAxes,2,TKe),v=d.magnitude(S);r=A.z-v,s=A.z+v}else if(u instanceof L_){let S=x.radius;r=A.z-S,s=A.z+S}}}let f=e.dynamicScreenSpaceErrorHeightFalloff,h=r+(s-r)*f,p=s,g=O.clamp((o-h)/(p-h),0,1),m=1-Math.abs(d.dot(i,n));m=m*(1-g),e._dynamicScreenSpaceErrorComputedDensity=e.dynamicScreenSpaceErrorDensity*m}function CKe(e,t){if(t.hasEmptyContent)return;let{statistics:n}=e,i=t.contentExpired,o=t.requestContent();c(o)&&(o.then(r=>{!c(r)||t.isDestroyed()||e.isDestroyed()||(e._processingQueue.push(t),++n.numberOfTilesProcessing)}).catch(r=>{Ffe(r,e,t)}),i&&(t.hasTilesetContent||t.hasImplicitContent?BKe(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t))}function Nfe(e,t){return e._priority-t._priority}cr.prototype.postPassesUpdate=function(e){c(this._root)&&(EKe(this,e),UKe(this,e),this._cache.unloadTiles(this,kfe),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};cr.prototype.prePassesUpdate=function(e){if(!c(this._root))return;OKe(this,e);let t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,c(t)&&t.enabled&&t.update(e);let n=this._clippingPolygons;c(n)&&n.enabled&&n.update(e),c(this._loadTimestamp)||(this._loadTimestamp=Q.clone(e.time)),this._timeSinceLoad=Math.max(Q.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this.dynamicScreenSpaceError&&AKe(this,e),e.newFrame&&this._cache.reset()};function EKe(e,t){let n=e._requestedTilesInFlight,i=0;for(let o=0;o<n.length;++o){let r=n[o],s=t.frameNumber-r._touchedFrame>=1;if(r._contentState!==Xo.LOADING){++i;continue}else if(s){r.cancelRequests(),++i;continue}i>0&&(n[o-i]=r)}n.length-=i}function SKe(e){let t=e._requestedTiles;t.sort(Nfe);for(let n=0;n<t.length;++n)CKe(e,t[n])}function Ffe(e,t,n){if(t.isDestroyed())return;let i;n.isDestroyed()||(i=n._contentResource.url);let o=c(e.message)?e.message:e.toString();t.tileFailed.numberOfListeners>0?t.tileFailed.raiseEvent({url:i,message:o}):(console.log(`A 3D tile failed to load: ${i}`),console.log(`Error: ${o}`),console.log(e.stack))}function wKe(e){let t=e._processingQueue,n=0;for(let i=0;i<t.length;++i){let o=t[i];if(o.isDestroyed()||o._contentState!==Xo.PROCESSING){++n;continue}n>0&&(t[i-n]=o)}t.length-=n}var vKe=new he,DKe=new he,PKe=new d;function IKe(e,t,n){if(!e.enableCollision||!e.show)return;let i=e._addHeightCallbacks,o=t.boundingSphere;for(let r of i){if(r.invoked||t._wasSelectedLastFrame)continue;let s=r.ellipsoid,a=he.clone(r.positionCartographic,vKe),l=he.fromCartesian(o.center,s,DKe);c(l)&&(a.height=l.height);let u=he.toCartesian(a,s,PKe);d.distance(u,o.center)<=o.radius&&(r.invoked=!0,n.afterRender.push(()=>{c(r.callback)&&r.callback(),r.invoked=!1}))}}function OKe(e,t){wKe(e);let n=e._processingQueue,{cacheBytes:i,maximumCacheOverflowBytes:o,statistics:r}=e,s=i+o,a=!1;for(let l=0;l<n.length;++l){if(e.totalMemoryUsageInBytes>s){a=!0;break}let u=n[l];try{u.process(e,t),u.contentReady&&(--r.numberOfTilesProcessing,e.tileLoad.raiseEvent(u))}catch(f){--r.numberOfTilesProcessing,Ffe(f,e,u)}}e.totalMemoryUsageInBytes<i?MKe(e):a&&n.length>0&&RKe(e)}function RKe(e){dt("increase-screenSpaceError",`The tiles needed to meet maximumScreenSpaceError would use more memory than allocated for this tileset.
    The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError).
    Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`),e._memoryAdjustedScreenSpaceError*=1.02;let t=e._processingQueue;for(let n=0;n<t.length;++n)t[n].updatePriority();t.sort(Nfe)}function MKe(e){e._memoryAdjustedScreenSpaceError=Math.max(e.memoryAdjustedScreenSpaceError/1.02,e.maximumScreenSpaceError)}var Zz=new d,LKe={maximumFractionDigits:3};function Lfe(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,LKe):Math.round(t).toLocaleString()}function pq(e){let{halfAxes:t,radius:n,center:i}=e.boundingVolume.boundingVolume,o=d.clone(i,Zz);if(c(t))o.x+=.75*(t[0]+t[3]+t[6]),o.y+=.75*(t[1]+t[4]+t[7]),o.z+=.75*(t[2]+t[5]+t[8]);else if(c(n)){let r=d.normalize(i,Zz);r=d.multiplyByScalar(r,.75*n,Zz),o=d.add(r,i,Zz)}return o}function _q(e,t,n){let i="",o=0;if(t.debugShowGeometricError&&(i+=`
Geometric error: ${e.geometricError}`,o++),t.debugShowRenderingStatistics&&(i+=`
Commands: ${e.commandsLength}`,o++,e.content.pointsLength>0&&(i+=`
Points: ${e.content.pointsLength}`,o++),e.content.trianglesLength>0&&(i+=`
Triangles: ${e.content.trianglesLength}`,o++),i+=`
Features: ${e.content.featuresLength}`,o++),t.debugShowMemoryUsage&&(i+=`
Texture Memory: ${Lfe(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${Lfe(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=`
Urls:`;let s=e.content.innerContentUrls;for(let a=0;a<s.length;a++)i+=`
- ${s[a]}`;o+=s.length}else i+=`
Url: ${e._contentHeader.uri}`,o++;let r={text:i.substring(1),position:n,font:`${19-o}px sans-serif`,showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(r)}function NKe(e,t){let n=e._selectedTiles,i=n.length,o=e._emptyTiles,r=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(c(e.debugPickedTile)){let s=c(e.debugPickPosition)?e.debugPickPosition:pq(e.debugPickedTile),a=_q(e.debugPickedTile,e,s);a.pixelOffset=new H(15,-15)}}else{for(let s=0;s<i;++s){let a=n[s];_q(a,e,pq(a))}for(let s=0;s<r;++s){let a=o[s];(a.hasTilesetContent||a.hasImplicitContent)&&_q(a,e,pq(a))}}e._tileDebugLabels.update(t)}function FKe(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;let{commandList:i,context:o}=t,r=i.length,s=e._selectedTiles,a=e.isSkippingLevelOfDetail&&e._hasMixedContent&&o.stencilBuffer&&s.length>0;e._backfaceCommands.length=0,a&&(c(e._stencilClearCommand)||(e._stencilClearCommand=new ei({stencil:0,pass:De.CESIUM_3D_TILE,renderState:Ve.fromCache({stencilMask:kt.SKIP_LOD_MASK})})),i.push(e._stencilClearCommand));let{statistics:l,tileVisible:u}=e,f=n.isRender,h=i.length;for(let m=0;m<s.length;++m){let y=s[m];f&&u.raiseEvent(y),IKe(e,y,t),y.update(e,t,n),l.incrementSelectionCounts(y.content),++l.selected}let p=e._emptyTiles;for(let m=0;m<p.length;++m)p[m].update(e,t,n);let g=i.length-h;if(e._backfaceCommands.trim(),a){let m=e._backfaceCommands.values,y=m.length;i.length+=y;for(let b=g-1;b>=0;--b)i[h+y+b]=i[h+b];for(let b=0;b<y;++b)i[h+b]=m[b]}g=i.length-r,l.numberOfCommands=g,f&&(e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&g>0&&e._pointCloudEyeDomeLighting.update(t,r,e.pointCloudShading,e.boundingSphere),e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(c(e._tileDebugLabels)||(e._tileDebugLabels=new Om),NKe(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var Bfe=[];function BKe(e,t){let n=t,i=Bfe;for(i.push(t);i.length>0;){t=i.pop();let o=t.children;for(let r=0;r<o.length;++r)i.push(o[r]);t!==n&&(kKe(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function kfe(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function kKe(e,t){e._cache.unloadTile(e,t,kfe),t.destroy()}cr.prototype.trimLoadedTiles=function(){this._cache.trim()};function UKe(e,t){let n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;gh.clone(n,i);let l=o!==s||r!==a;l&&t.afterRender.push(function(){return e.loadProgress.raiseEvent(o,r),!0}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,l&&e._tilesLoaded&&(t.afterRender.push(function(){return e.allTilesLoaded.raiseEvent(),!0}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){return e.initialTilesLoaded.raiseEvent(),!0})))}function VKe(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function zKe(e,t){t.frameNumber===e._updatedModelMatrixFrame&&c(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!B.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=B.clone(e.modelMatrix,e._previousModelMatrix)))}function HKe(e,t,n,i){if(t.mode===oe.MORPHING||!c(e._root))return!1;let o=e._statistics;o.clear(),++e._updatedVisibilityFrame,VKe(e),zKe(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;let r=e.getTraversal(i).selectTiles(e,t);if(i.requestTiles&&SKe(e),FKe(e,t,i),gh.clone(o,n),i.isRender){let s=e._credits;if(c(s)&&o.selected!==0)for(let a=0;a<s.length;++a){let l=s[a];t.creditDisplay.addCreditToNextFrame(l)}}return r}function Ufe(e){let t=e._credits;c(t)||(t=[]),t.length=0,c(e.resource.credits)&&e.resource.credits.forEach(i=>{t.push(Tt.clone(i))});let n=e.asset.extras;if(c(n)&&c(n.cesium)&&c(n.cesium.credits)){let i=n.cesium.credits;for(let o=0;o<i.length;++o){let r=i[o];t.push(new Tt(r.html))}}t.forEach(i=>i.showOnScreen=i.showOnScreen||e._showCreditsOnScreen),e._credits=t}cr.prototype.getTraversal=function(e){let{pass:t}=e;return t===Uo.MOST_DETAILED_PRELOAD||t===Uo.MOST_DETAILED_PICK?jL:this.isSkippingLevelOfDetail?$L:YL};cr.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};cr.prototype.updateForPass=function(e,t){T.typeOf.object("frameState",e),T.typeOf.object("tilesetPassState",t);let n=t.pass;if(n===Uo.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===Uo.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===Uo.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;let i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;let s=Uo.getPassOptions(n),a=s.ignoreCommands,l=t.commandList??i,u=l.length;if(e.commandList=l,e.camera=t.camera??o,e.cullingVolume=t.cullingVolume??r,s.isRender){let p=this._environmentMapManager;c(this._root)&&(p.position=this.boundingSphere.center),p.update(e)}let f=this._clippingPolygons;c(f)&&f.enabled&&f.queueCommands(e);let h=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=HKe(this,e,h,s)),a&&(l.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};cr.prototype.hasExtension=function(e){return c(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};cr.prototype.isDestroyed=function(){return!1};cr.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),c(this._root)){let e=Bfe;for(e.push(this._root);e.length>0;){let t=e.pop();t.destroy();let n=t.children;for(let i=0;i<n.length;++i)e.push(n[i])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,this._environmentMapManager.isDestroyed()||this._environmentMapManager.destroy(),this._environmentMapManager=void 0,de(this)};cr.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0,MAXAR_content_geojson:!0};cr.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!cr.supportedExtensions[e[t]])throw new ae(`Unsupported 3D Tiles Extension: ${e[t]}`)};var GKe=new mn,jKe=new d,WKe=new he;cr.prototype.getHeight=function(e,t){T.typeOf.object("cartographic",e),T.typeOf.object("scene",t);let n=t.ellipsoid;c(n)||(n=ie.WGS84);let i=GKe,o=n.cartographicToCartesian(e,i.direction);d.normalize(i.direction,i.direction),i.direction=d.normalize(o,i.direction),i.direction=d.negate(o,i.direction),i.origin=d.multiplyByScalar(i.direction,-2*n.maximumRadius,i.origin);let r=this.pick(i,t.frameState,jKe);if(c(r))return n.cartesianToCartographic(r,WKe)?.height};cr.prototype.updateHeight=function(e,t,n){n=n??ie.WGS84;let i={positionCartographic:e,ellipsoid:n,callback:t,invoked:!1},o=()=>{let r=this._addHeightCallbacks,s=r.length;for(let a=0;a<s;++a)if(r[a]===i){r.splice(a,1);break}i.callback&&(i.callback=void 0)};return this._addHeightCallbacks.push(i),o};var qKe=new Ma,YKe=new d;cr.prototype.pick=function(e,t,n){if(!t.context.webgl2&&!this._enablePick)return;let i=this._selectedTiles,o=i.length,r=[];for(let l=0;l<o;++l){let u=i[l],f=Zn.raySphere(e,u.contentBoundingVolume.boundingSphere,qKe);!c(f)||!c(u.content)||r.push(u)}let s=r.length;r.sort((l,u)=>{let f=le.distanceSquaredTo(l.contentBoundingVolume.boundingSphere,e.origin),h=le.distanceSquaredTo(u.contentBoundingVolume.boundingSphere,e.origin);return f-h});let a;for(let l=0;l<s;++l){let f=r[l].content.pick(e,t,YKe);if(c(f))return a=d.clone(f,n),a}};var bs=cr;var XKe=new B;function qy(e,t){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(qy.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new Et,this._onCollectionChanged(t,t.values,[],[])}qy.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){let s=t[o],a=s._tileset,l,u=n[s.id],f=s.isShowing&&s.isAvailable(e)&&X.getValueOrDefault(a._show,e,!0),h;f&&(h=s.computeModelMatrix(e,XKe),l=we.createIfNeeded(X.getValueOrUndefined(a._uri,e)));let p=c(u)?u.tilesetPrimitive:void 0;if(!f){c(p)&&(p.show=!1);continue}(!c(u)||l.url!==u.url)&&(c(p)&&i.removeAndDestroy(p),delete n[s.id],KKe(l,n,s,i)),c(p)&&(p.show=!0,c(h)&&(p.modelMatrix=h),p.maximumScreenSpaceError=X.getValueOrDefault(a.maximumScreenSpaceError,e,p.maximumScreenSpaceError))}return!0};qy.prototype.isDestroyed=function(){return!1};qy.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(qy.prototype._onCollectionChanged,this);let e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)gq(this,e[i],t,n);return de(this)};qy.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");let n=this._tilesetHash[e.id];if(!c(n)||n.loadFail)return lt.FAILED;let i=n.tilesetPrimitive;return c(i)?i.show?(le.clone(i.boundingSphere,t),lt.DONE):lt.FAILED:lt.PENDING};qy.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._entitiesToVisualize,a=this._tilesetHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._tileset)?s.set(r.id,r):(gq(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],gq(this,r,a,l),s.remove(r.id)};function gq(e,t,n,i){let o=n[t.id];c(o)&&(c(o.tilesetPrimitive)&&i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}async function KKe(e,t,n,i){t[n.id]={url:e.url,loadFail:!1};try{let o=await bs.fromUrl(e);if(o.id=n,i.add(o),!c(t[n.id]))return;t[n.id].tilesetPrimitive=o}catch(o){console.error(o),t[n.id].loadFail=!0}}var ZL=qy;var $Ke=G.WHITE,ZKe=G.BLACK,QKe=new H(2,2);function BE(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.repeat=e.repeat}Object.defineProperties(BE.prototype,{isConstant:{get:function(){return X.isConstant(this._evenColor)&&X.isConstant(this._oddColor)&&X.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:fe("evenColor"),oddColor:fe("oddColor"),repeat:fe("repeat")});BE.prototype.getType=function(e){return"Checkerboard"};var JKe=new Q;BE.prototype.getValue=function(e,t){return c(e)||(e=Q.now(JKe)),c(t)||(t={}),t.lightColor=X.getValueOrClonedDefault(this._evenColor,e,$Ke,t.lightColor),t.darkColor=X.getValueOrClonedDefault(this._oddColor,e,ZKe,t.darkColor),t.repeat=X.getValueOrDefault(this._repeat,e,QKe),t};BE.prototype.equals=function(e){return this===e||e instanceof BE&&X.equals(this._evenColor,e._evenColor)&&X.equals(this._oddColor,e._oddColor)&&X.equals(this._repeat,e._repeat)};var kE=BE;var Vfe={id:void 0};function QL(e){if(e._firing){e._refire=!0;return}if(e._suspendCount===0){let t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(i.length!==0||t.length!==0||n.length!==0){e._firing=!0;do{e._refire=!1;let o=t.values.slice(0),r=n.values.slice(0),s=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,o,r,s)}while(e._refire);e._firing=!1}}}function Cc(e){this._owner=e,this._entities=new Et,this._addedEntities=new Et,this._removedEntities=new Et,this._changedEntities=new Et,this._suspendCount=0,this._collectionChanged=new pe,this._id=jn(),this._show=!0,this._firing=!1,this._refire=!1}Cc.prototype.suspendEvents=function(){this._suspendCount++};Cc.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new E("resumeEvents can not be called before suspendEvents.");this._suspendCount--,QL(this)};Object.defineProperties(Cc.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(e===this._show)return;this.suspendEvents();let t,n=[],i=this._entities.values,o=i.length;for(t=0;t<o;t++)n.push(i[t].isShowing);for(this._show=e,t=0;t<o;t++){let r=n[t],s=i[t];r!==s.isShowing&&s.definitionChanged.raiseEvent(s,"isShowing",s.isShowing,r)}this.resumeEvents()}},owner:{get:function(){return this._owner}}});Cc.prototype.computeAvailability=function(){let e=Ge.MAXIMUM_VALUE,t=Ge.MINIMUM_VALUE,n=this._entities.values;for(let i=0,o=n.length;i<o;i++){let s=n[i].availability;if(c(s)){let a=s.start,l=s.stop;Q.lessThan(a,e)&&!a.equals(Ge.MINIMUM_VALUE)&&(e=a),Q.greaterThan(l,t)&&!l.equals(Ge.MAXIMUM_VALUE)&&(t=l)}}return Ge.MAXIMUM_VALUE.equals(e)&&(e=Ge.MINIMUM_VALUE),Ge.MINIMUM_VALUE.equals(t)&&(t=Ge.MAXIMUM_VALUE),new En({start:e,stop:t})};Cc.prototype.add=function(e){if(!c(e))throw new E("entity is required.");e instanceof nr||(e=new nr(e));let t=e.id,n=this._entities;if(n.contains(t))throw new E(`An entity with id ${t} already exists in this collection.`);return e.entityCollection=this,n.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(Cc.prototype._onEntityDefinitionChanged,this),QL(this),e};Cc.prototype.remove=function(e){return c(e)?this.removeById(e.id):!1};Cc.prototype.contains=function(e){if(!c(e))throw new E("entity is required");return this._entities.get(e.id)===e};Cc.prototype.removeById=function(e){if(!c(e))return!1;let n=this._entities.get(e);return this._entities.remove(e)?(this._addedEntities.remove(e)||(this._removedEntities.set(e,n),this._changedEntities.remove(e)),this._entities.remove(e),n.definitionChanged.removeEventListener(Cc.prototype._onEntityDefinitionChanged,this),QL(this),!0):!1};Cc.prototype.removeAll=function(){let e=this._entities,t=e.length,n=e.values,i=this._addedEntities,o=this._removedEntities;for(let r=0;r<t;r++){let s=n[r],a=s.id,l=i.get(a);c(l)||(s.definitionChanged.removeEventListener(Cc.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),QL(this)};Cc.prototype.getById=function(e){if(!c(e))throw new E("id is required.");return this._entities.get(e)};Cc.prototype.getOrCreateEntity=function(e){if(!c(e))throw new E("id is required.");let t=this._entities.get(e);return c(t)||(Vfe.id=e,t=new nr(Vfe),this.add(t)),t};Cc.prototype._onEntityDefinitionChanged=function(e){let t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),QL(this)};var Qs=Cc;var Qz={id:void 0},UE=new Array(2);function yq(e){let t=e.propertyNames,n=t.length;for(let i=0;i<n;i++)e[t[i]]=void 0;e._name=void 0,e._availability=void 0}function zfe(e,t,n,i){UE[0]=n,UE[1]=i.id,t[JSON.stringify(UE)]=i.definitionChanged.addEventListener(qr.prototype._onDefinitionChanged,e)}function Hfe(e,t,n,i){UE[0]=n,UE[1]=i.id;let o=JSON.stringify(UE);t[o](),t[o]=void 0}function Yy(e){if(e._shouldRecomposite=!0,e._suspendCount!==0)return;let t=e._collections,n=t.length,i=e._collectionsCopy,o=i.length,r,s,a,l,u,f=e._composite,h=new Qs(e),p=e._eventHash,g;for(r=0;r<o;r++)for(u=i[r],u.collectionChanged.removeEventListener(qr.prototype._onCollectionChanged,e),a=u.values,g=u.id,l=a.length-1;l>-1;l--)s=a[l],Hfe(e,p,g,s);for(r=n-1;r>=0;r--)for(u=t[r],u.collectionChanged.addEventListener(qr.prototype._onCollectionChanged,e),a=u.values,g=u.id,l=a.length-1;l>-1;l--){s=a[l],zfe(e,p,g,s);let y=h.getById(s.id);c(y)||(y=f.getById(s.id),c(y)?yq(y):(Qz.id=s.id,y=new nr(Qz)),h.add(y)),y.merge(s)}e._collectionsCopy=t.slice(0),f.suspendEvents(),f.removeAll();let m=h.values;for(r=0;r<m.length;r++)f.add(m[r]);f.resumeEvents()}function qr(e,t){this._owner=t,this._composite=new Qs(this),this._suspendCount=0,this._collections=c(e)?e.slice():[],this._collectionsCopy=[],this._id=jn(),this._eventHash={},Yy(this),this._shouldRecomposite=!1}Object.defineProperties(qr.prototype,{collectionChanged:{get:function(){return this._composite._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._composite.values}},owner:{get:function(){return this._owner}}});qr.prototype.addCollection=function(e,t){let n=c(t);if(!c(e))throw new E("collection is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._collections.length)throw new E("index must be less than or equal to the number of collections.")}n?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),Yy(this)};qr.prototype.removeCollection=function(e){let t=this._collections.indexOf(e);return t!==-1?(this._collections.splice(t,1),Yy(this),!0):!1};qr.prototype.removeAllCollections=function(){this._collections.length=0,Yy(this)};qr.prototype.containsCollection=function(e){return this._collections.indexOf(e)!==-1};qr.prototype.contains=function(e){return this._composite.contains(e)};qr.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)};qr.prototype.getCollection=function(e){if(!c(e))throw new E("index is required.","index");return this._collections[e]};qr.prototype.getCollectionsLength=function(){return this._collections.length};function Jz(e,t){if(!c(t))throw new E("collection is required.");let n=e.indexOf(t);if(n===-1)throw new E("collection is not in this composite.");return n}function Gfe(e,t,n){let i=e._collections;if(t=O.clamp(t,0,i.length-1),n=O.clamp(n,0,i.length-1),t===n)return;let o=i[t];i[t]=i[n],i[n]=o,Yy(e)}qr.prototype.raiseCollection=function(e){let t=Jz(this._collections,e);Gfe(this,t,t+1)};qr.prototype.lowerCollection=function(e){let t=Jz(this._collections,e);Gfe(this,t,t-1)};qr.prototype.raiseCollectionToTop=function(e){let t=Jz(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),Yy(this))};qr.prototype.lowerCollectionToBottom=function(e){let t=Jz(this._collections,e);t!==0&&(this._collections.splice(t,1),this._collections.splice(0,0,e),Yy(this))};qr.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()};qr.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new E("resumeEvents can not be called before suspendEvents.");this._suspendCount--,this._shouldRecomposite&&this._suspendCount===0&&(Yy(this),this._shouldRecomposite=!1),this._composite.resumeEvents()};qr.prototype.computeAvailability=function(){return this._composite.computeAvailability()};qr.prototype.getById=function(e){return this._composite.getById(e)};qr.prototype._onCollectionChanged=function(e,t,n){let i=this._collectionsCopy,o=i.length,r=this._composite;r.suspendEvents();let s,a,l,u,f=n.length,h=this._eventHash,p=e.id;for(s=0;s<f;s++){let m=n[s];Hfe(this,h,p,m);let y=m.id;for(a=o-1;a>=0;a--)l=i[a].getById(y),c(l)&&(c(u)||(u=r.getById(y),yq(u)),u.merge(l));c(u)||r.removeById(y),u=void 0}let g=t.length;for(s=0;s<g;s++){let m=t[s];zfe(this,h,p,m);let y=m.id;for(a=o-1;a>=0;a--)l=i[a].getById(y),c(l)&&(c(u)||(u=r.getById(y),c(u)?yq(u):(Qz.id=y,u=new nr(Qz),r.add(u))),u.merge(l));u=void 0}r.resumeEvents()};qr.prototype._onDefinitionChanged=function(e,t,n,i){let o=this._collections,r=this._composite,s=o.length,a=e.id,l=r.getById(a),u=l[t],f=!c(u),h=!0;for(let p=s-1;p>=0;p--){let g=o[p].getById(e.id);if(c(g)){let m=g[t];if(c(m)){if(h)if(h=!1,c(m.merge)&&c(m.clone))u=m.clone(u);else{u=m;break}u.merge(m)}}}f&&l.propertyNames.indexOf(t)===-1&&l.addProperty(t),l[t]=u};var bq=qr;function xq(){this._removalFunctions=[]}xq.prototype.add=function(e,t,n){if(!c(e))throw new E("event is required");let i=e.addEventListener(t,n);this._removalFunctions.push(i);let o=this;return function(){i();let r=o._removalFunctions;r.splice(r.indexOf(i),1)}};xq.prototype.removeAll=function(){let e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};var gr=xq;function Cq(e,t){return Q.compare(e.start,t.start)}function Yr(e){if(this._intervals=[],this._changedEvent=new pe,c(e)){let t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(Yr.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){let e=this._intervals;return e.length===0?void 0:e[0].start}},isStartIncluded:{get:function(){let e=this._intervals;return e.length===0?!1:e[0].isStartIncluded}},stop:{get:function(){let e=this._intervals,t=e.length;return t===0?void 0:e[t-1].stop}},isStopIncluded:{get:function(){let e=this._intervals,t=e.length;return t===0?!1:e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return this._intervals.length===0}}});Yr.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof Yr))return!1;let n=this._intervals,i=e._intervals,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;r++)if(!En.equals(n[r],i[r],t))return!1;return!0};Yr.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._intervals[e]};Yr.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};Yr.prototype.findIntervalContainingDate=function(e){let t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};Yr.prototype.findDataForIntervalContainingDate=function(e){let t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};Yr.prototype.contains=function(e){return this.indexOf(e)>=0};var Tq=new En;Yr.prototype.indexOf=function(e){if(!c(e))throw new E("date is required");let t=this._intervals;Tq.start=e,Tq.stop=e;let n=Lo(t,Tq,Cq);return n>=0?t[n].isStartIncluded?n:n>0&&t[n-1].stop.equals(e)&&t[n-1].isStopIncluded?n-1:~n:(n=~n,n>0&&n-1<t.length&&En.contains(t[n-1],e)?n-1:~n)};Yr.prototype.findInterval=function(e){e=e??W.EMPTY_OBJECT;let t=e.start,n=e.stop,i=e.isStartIncluded,o=e.isStopIncluded,r=this._intervals;for(let s=0,a=r.length;s<a;s++){let l=r[s];if((!c(t)||l.start.equals(t))&&(!c(n)||l.stop.equals(n))&&(!c(i)||l.isStartIncluded===i)&&(!c(o)||l.isStopIncluded===o))return r[s]}};Yr.prototype.addInterval=function(e,t){if(!c(e))throw new E("interval is required");if(e.isEmpty)return;let n=this._intervals;if(n.length===0||Q.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=Lo(n,e,Cq);i<0?i=~i:i>0&&e.isStartIncluded&&n[i-1].isStartIncluded&&n[i-1].start.equals(e.start)?--i:i<n.length&&!e.isStartIncluded&&n[i].isStartIncluded&&n[i].start.equals(e.start)&&++i;let o;for(i>0&&(o=Q.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((c(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?(Q.greaterThan(e.stop,n[i-1].stop)?e=new En({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new En({start:n[i-1].start,stop:n[i-1].stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:n[i-1].isStopIncluded||e.stop.equals(n[i-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(i-1,1),--i):(o=Q.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new En({start:e.stop,stop:n[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i-1].isStopIncluded,data:n[i-1].data})),n[i-1]=new En({start:n[i-1].start,stop:e.start,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[i-1].data}))));i<n.length&&(o=Q.compare(e.stop,n[i].start),o>0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(c(t)?t(n[i].data,e.data):n[i].data===e.data)e=new En({start:e.start,stop:Q.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:Q.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new En({start:e.stop,stop:n[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i].isStopIncluded,data:n[i].data}),n[i].isEmpty)n.splice(i,1);else break;n.splice(i,0,e),this._changedEvent.raiseEvent(this)};Yr.prototype.removeInterval=function(e){if(!c(e))throw new E("interval is required");if(e.isEmpty)return!1;let t=this._intervals,n=Lo(t,e,Cq);n<0&&(n=~n);let i=!1;for(n>0&&(Q.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(Q.greaterThan(t[n-1].stop,e.stop)||t[n-1].isStopIncluded&&!e.isStopIncluded&&t[n-1].stop.equals(e.stop))&&t.splice(n,0,new En({start:e.stop,stop:t[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n-1].isStopIncluded,data:t[n-1].data})),t[n-1]=new En({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n<t.length&&!e.isStartIncluded&&t[n].isStartIncluded&&e.start.equals(t[n].start)&&(i=!0,t.splice(n,0,new En({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&Q.greaterThan(e.stop,t[n].stop);)i=!0,t.splice(n,1);return n<t.length&&e.stop.equals(t[n].stop)&&(i=!0,!e.isStopIncluded&&t[n].isStopIncluded?n+1<t.length&&t[n+1].start.equals(e.stop)&&t[n].data===t[n+1].data?(t.splice(n,1),t[n]=new En({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new En({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(Q.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new En({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};Yr.prototype.intersect=function(e,t,n){if(!c(e))throw new E("other is required.");let i=new Yr,o=0,r=0,s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){let l=s[o],u=a[r];if(Q.lessThan(l.stop,u.start))++o;else if(Q.lessThan(u.stop,l.start))++r;else{if(c(n)||c(t)&&t(l.data,u.data)||!c(t)&&u.data===l.data){let f=En.intersect(l,u,new En,n);f.isEmpty||i.addInterval(f,t)}Q.lessThan(l.stop,u.stop)||l.stop.equals(u.stop)&&!l.isStopIncluded&&u.isStopIncluded?++o:++r}}return i};Yr.fromJulianDateArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.julianDates))throw new E("options.iso8601Array is required.");c(t)||(t=new Yr);let n=e.julianDates,i=n.length,o=e.dataCallback,r=e.isStartIncluded??!0,s=e.isStopIncluded??!0,a=e.leadingInterval??!1,l=e.trailingInterval??!1,u,f=0;a&&(++f,u=new En({start:Ge.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u));for(let h=0;h<i-1;++h){let p=n[h],g=n[h+1];u=new En({start:p,stop:g,isStartIncluded:t.length===f?r:!0,isStopIncluded:h===i-2?s:!1}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u),p=g}return l&&(u=new En({start:n[i-1],stop:Ge.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u)),t};var Ec=new im,JL=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Aq(e,t,n){c(n)||(n=new Q),Q.toGregorianDate(e,Ec);let i=Ec.millisecond+t.millisecond,o=Ec.second+t.second,r=Ec.minute+t.minute,s=Ec.hour+t.hour,a=Ec.day+t.day,l=Ec.month+t.month,u=Ec.year+t.year;for(i>=1e3&&(o+=Math.floor(i/1e3),i=i%1e3),o>=60&&(r+=Math.floor(o/60),o=o%60),r>=60&&(s+=Math.floor(r/60),r=r%60),s>=24&&(a+=Math.floor(s/24),s=s%24),JL[2]=Dd(u)?29:28;a>JL[l]||l>=13;)a>JL[l]&&(a-=JL[l],++l),l>=13&&(--l,u+=Math.floor(l/12),l=l%12,++l),JL[2]=Dd(u)?29:28;return Ec.millisecond=i,Ec.second=o,Ec.minute=r,Ec.hour=s,Ec.day=a,Ec.month=l,Ec.year=u,Q.fromGregorianDate(Ec,n)}var e$e=new Q,t$e=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function jfe(e,t){if(!c(e)||e.length===0)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,e[0]==="P"){let n=e.match(t$e);if(!c(n))return!1;if(c(n[1])&&(t.year=Number(n[1].replace(",","."))),c(n[2])&&(t.month=Number(n[2].replace(",","."))),c(n[3])&&(t.day=Number(n[3].replace(",","."))*7),c(n[4])&&(t.day+=Number(n[4].replace(",","."))),c(n[5])&&(t.hour=Number(n[5].replace(",","."))),c(n[6])&&(t.minute=Number(n[6].replace(",","."))),c(n[7])){let i=Number(n[7].replace(",","."));t.second=Math.floor(i),t.millisecond=i%1*1e3}}else e[e.length-1]!=="Z"&&(e+="Z"),Q.toGregorianDate(Q.fromIso8601(e,e$e),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}var eN=new im;Yr.fromIso8601=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601))throw new E("options.iso8601 is required.");let n=e.iso8601.split("/"),i=Q.fromIso8601(n[0]),o=Q.fromIso8601(n[1]),r=[];if(!jfe(n[2],eN))r.push(i,o);else{let s=Q.clone(i);for(r.push(s);Q.compare(s,o)<0;)s=Aq(s,eN),Q.compare(o,s)<=0&&Q.clone(o,s),r.push(s)}return Yr.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Yr.fromIso8601DateArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601Dates))throw new E("options.iso8601Dates is required.");return Yr.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return Q.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Yr.fromIso8601DurationArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.epoch))throw new E("options.epoch is required.");if(!c(e.iso8601Durations))throw new E("options.iso8601Durations is required.");let n=e.epoch,i=e.iso8601Durations,o=e.relativeToPrevious??!1,r=[],s,a,l=i.length;for(let u=0;u<l;++u)(jfe(i[u],eN)||u===0)&&(o&&c(a)?s=Aq(a,eN):s=Aq(n,eN),r.push(s),a=s);return Yr.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};var Xr=Yr;function n$e(e,t,n,i){function o(){n.raiseEvent(e)}let r=[];t.removeAll();let s=i.length;for(let a=0;a<s;a++){let l=i.get(a);c(l.data)&&r.indexOf(l.data)===-1&&t.add(l.data.definitionChanged,o)}}function Jx(){this._eventHelper=new gr,this._definitionChanged=new pe,this._intervals=new Xr,this._intervals.changedEvent.addEventListener(Jx.prototype._intervalsChanged,this)}Object.defineProperties(Jx.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});var i$e=new Q;Jx.prototype.getValue=function(e,t){c(e)||(e=Q.now(i$e));let n=this._intervals.findDataForIntervalContainingDate(e);if(c(n))return n.getValue(e,t)};Jx.prototype.equals=function(e){return this===e||e instanceof Jx&&this._intervals.equals(e._intervals,X.equals)};Jx.prototype._intervalsChanged=function(){n$e(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};var Sc=Jx;function Xy(){this._definitionChanged=new pe,this._composite=new Sc,this._composite.definitionChanged.addEventListener(Xy.prototype._raiseDefinitionChanged,this)}Object.defineProperties(Xy.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}});Xy.prototype.getType=function(e){if(!c(e))throw new E("time is required");let t=this._composite._intervals.findDataForIntervalContainingDate(e);if(c(t))return t.getType(e)};var o$e=new Q;Xy.prototype.getValue=function(e,t){c(e)||(e=Q.now(o$e));let n=this._composite._intervals.findDataForIntervalContainingDate(e);if(c(n))return n.getValue(e,t)};Xy.prototype.equals=function(e){return this===e||e instanceof Xy&&this._composite.equals(e._composite,X.equals)};Xy.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var VE=Xy;function Ky(e){this._referenceFrame=e??Hi.FIXED,this._definitionChanged=new pe,this._composite=new Sc,this._composite.definitionChanged.addEventListener(Ky.prototype._raiseDefinitionChanged,this)}Object.defineProperties(Ky.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}});var r$e=new Q;Ky.prototype.getValue=function(e,t){return c(e)||(e=Q.now(r$e)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};Ky.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");let i=this._composite._intervals.findDataForIntervalContainingDate(e);if(c(i))return i.getValueInReferenceFrame(e,t,n)};Ky.prototype.equals=function(e){return this===e||e instanceof Ky&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,X.equals)};Ky.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var ba=Ky;var s$e={ROUNDED:0,MITERED:1,BEVELED:2},Bi=Object.freeze(s$e);var xa=[new d,new d],a$e=new d,c$e=new d,l$e=new d,u$e=new d,f$e=new d,d$e=new d,h$e=new d,m$e=new d,p$e=new d,zE=new d,e4=new d,tN={},Eq=new he;function _$e(e,t){let n=new Array(e.length);for(let i=0;i<e.length;i++){let o=e[i];Eq=t.cartesianToCartographic(o,Eq),n[i]=Eq.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function Sq(e,t,n,i){let o=e[0],r=e[1],s=d.angleBetween(o,r),a=Math.ceil(s/i),l=new Array(a),u;if(t===n){for(u=0;u<a;u++)l[u]=t;return l.push(n),l}let h=(n-t)/a;for(u=1;u<a;u++){let p=t+u*h;l[u]=p}return l[0]=t,l.push(n),l}var t4=new d,n4=new d;function g$e(e,t,n,i){let o=new ns(n,i),r=o.projectPointOntoPlane(d.add(n,e,t4),t4),s=o.projectPointOntoPlane(d.add(n,t,n4),n4),a=H.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}var y$e=new d(-1,0,0),eT=new B,b$e=new B,wq=new J,x$e=J.IDENTITY.clone(),T$e=new d,A$e=new se,Wfe=new d;function U_(e,t,n,i,o,r,s,a){let l=T$e,u=A$e;eT=Ot.eastNorthUpToFixedFrame(e,o,eT),l=B.multiplyByPointAsVector(eT,y$e,l),l=d.normalize(l,l);let f=g$e(l,t,e,o);wq=J.fromRotationZ(f,wq),Wfe.z=r,eT=B.multiplyTransformation(eT,B.fromRotationTranslation(wq,Wfe,b$e),eT);let h=x$e;h[0]=s;for(let p=0;p<a;p++)for(let g=0;g<n.length;g+=3)u=d.fromArray(n,g,u),u=J.multiplyByVector(h,u,u),u=B.multiplyByPoint(eT,u,u),i.push(u.x,u.y,u.z);return i}var C$e=new d;function vq(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){let l=d.fromArray(e,a,C$e);i=U_(l,t,n,i,o,r[a/3],s,1)}return i}function E$e(e,t){let n=e.length,i=new Array(n*6),o=0,r=t.x+t.width/2,s=t.y+t.height/2,a=e[0];i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s;for(let l=1;l<n;l++){a=e[l];let u=a.x-r,f=a.y-s;i[o++]=u,i[o++]=0,i[o++]=f,i[o++]=u,i[o++]=0,i[o++]=f}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}function qfe(e,t){let n=e.length,i=new Array(n*3),o=0,r=t.x+t.width/2,s=t.y+t.height/2;for(let a=0;a<n;a++)i[o++]=e[a].x-r,i[o++]=0,i[o++]=e[a].y-s;return i}var Yfe=new Le,Xfe=new d,Kfe=new J;function $fe(e,t,n,i,o,r,s,a,l,u){let f=d.angleBetween(d.subtract(t,e,zE),d.subtract(n,e,e4)),h=i===Bi.BEVELED?0:Math.ceil(f/O.toRadians(5)),p;o?p=J.fromQuaternion(Le.fromAxisAngle(d.negate(e,zE),f/(h+1),Yfe),Kfe):p=J.fromQuaternion(Le.fromAxisAngle(e,f/(h+1),Yfe),Kfe);let g,m;if(t=d.clone(t,Xfe),h>0){let y=u?2:1;for(let b=0;b<h;b++)t=J.multiplyByVector(p,t,t),g=d.subtract(t,e,zE),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(t,e4),s=U_(m,g,a,s,r,l,1,y)}else g=d.subtract(t,e,zE),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(t,e4),s=U_(m,g,a,s,r,l,1,1),n=d.clone(n,Xfe),g=d.subtract(n,e,zE),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(n,e4),s=U_(m,g,a,s,r,l,1,1);return s}tN.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let i=t-1,o=0;o<t;i=o++){let r=e[i],s=e[o];H.equals(r,s)||n.push(s)}return n};tN.angleIsGreaterThanPi=function(e,t,n,i){let o=new ns(n,i),r=o.projectPointOntoPlane(d.add(n,e,t4),t4),s=o.projectPointOntoPlane(d.add(n,t,n4),n4);return s.x*r.y-s.y*r.x>=0};var S$e=new d,w$e=new d;tN.computePositions=function(e,t,n,i,o){let r=i._ellipsoid,s=_$e(e,r),a=i._granularity,l=i._cornerType,u=o?E$e(t,n):qfe(t,n),f=o?qfe(t,n):void 0,h=n.height/2,p=n.width/2,g=e.length,m=[],y=o?[]:void 0,b=a$e,x=c$e,A=l$e,C=u$e,S=f$e,v=d$e,P=h$e,M=m$e,R=p$e,L=e[0],F=e[1];C=r.geodeticSurfaceNormal(L,C),b=d.subtract(F,L,b),b=d.normalize(b,b),M=d.cross(C,b,M),M=d.normalize(M,M);let _=s[0],w=s[1];o&&(y=U_(L,M,f,y,r,_+h,1,1)),R=d.clone(L,R),L=F,x=d.negate(b,x);let D,I;for(let z=1;z<g-1;z++){let V=o?2:1;if(F=e[z+1],L.equals(F)){dt("Positions are too close and are considered equivalent with rounding error.");continue}b=d.subtract(F,L,b),b=d.normalize(b,b),C=r.geodeticSurfaceNormal(L,C);let j=d.multiplyByScalar(C,d.dot(b,C),S$e);d.subtract(b,j,j),d.normalize(j,j);let U=d.multiplyByScalar(C,d.dot(x,C),w$e);if(d.subtract(x,U,U),d.normalize(U,U),!O.equalsEpsilon(Math.abs(d.dot(j,U)),1,O.EPSILON7)){A=d.add(b,x,A),A=d.normalize(A,A),A=d.cross(A,C,A),A=d.cross(C,A,A),A=d.normalize(A,A);let Y=1/Math.max(.25,d.magnitude(d.cross(A,x,zE))),te=tN.angleIsGreaterThanPi(b,x,L,r);te?(S=d.add(L,d.multiplyByScalar(A,Y*p,A),S),v=d.add(S,d.multiplyByScalar(M,p,v),v),xa[0]=d.clone(R,xa[0]),xa[1]=d.clone(v,xa[1]),D=Sq(xa,_+h,w+h,a),I=Fi.generateArc({positions:xa,granularity:a,ellipsoid:r}),m=vq(I,M,u,m,r,D,1),M=d.cross(C,b,M),M=d.normalize(M,M),P=d.add(S,d.multiplyByScalar(M,p,P),P),l===Bi.ROUNDED||l===Bi.BEVELED?$fe(S,v,P,l,te,r,m,u,w+h,o):(A=d.negate(A,A),m=U_(L,A,u,m,r,w+h,Y,V)),R=d.clone(P,R)):(S=d.add(L,d.multiplyByScalar(A,Y*p,A),S),v=d.add(S,d.multiplyByScalar(M,-p,v),v),xa[0]=d.clone(R,xa[0]),xa[1]=d.clone(v,xa[1]),D=Sq(xa,_+h,w+h,a),I=Fi.generateArc({positions:xa,granularity:a,ellipsoid:r}),m=vq(I,M,u,m,r,D,1),M=d.cross(C,b,M),M=d.normalize(M,M),P=d.add(S,d.multiplyByScalar(M,-p,P),P),l===Bi.ROUNDED||l===Bi.BEVELED?$fe(S,v,P,l,te,r,m,u,w+h,o):m=U_(L,A,u,m,r,w+h,Y,V),R=d.clone(P,R)),x=d.negate(b,x)}else m=U_(R,M,u,m,r,_+h,1,1),R=L;_=w,w=s[z+1],L=F}xa[0]=d.clone(R,xa[0]),xa[1]=d.clone(L,xa[1]),D=Sq(xa,_+h,w+h,a),I=Fi.generateArc({positions:xa,granularity:a,ellipsoid:r}),m=vq(I,M,u,m,r,D,1),o&&(y=U_(L,M,f,y,r,w+h,1,1)),g=m.length;let N=o?g+y.length:g,k=new Float64Array(N);return k.set(m),o&&k.set(y,g),k};var yh=tN;var Pq={},HE=new d,tde=new d,v$e=new d,Zfe=new d,sl=[new d,new d],nde=new d,ide=new d,ode=new d,D$e=new d,P$e=new d,I$e=new d,O$e=new d,R$e=new d,M$e=new d,L$e=new d,Qfe=new Le,Jfe=new J;function i4(e,t,n,i,o){let r=d.angleBetween(d.subtract(t,e,HE),d.subtract(n,e,tde)),s=i===Bi.BEVELED?1:Math.ceil(r/O.toRadians(5))+1,a=s*3,l=new Array(a);l[a-3]=n.x,l[a-2]=n.y,l[a-1]=n.z;let u;o?u=J.fromQuaternion(Le.fromAxisAngle(d.negate(e,HE),r/s,Qfe),Jfe):u=J.fromQuaternion(Le.fromAxisAngle(e,r/s,Qfe),Jfe);let f=0;t=d.clone(t,HE);for(let h=0;h<s;h++)t=J.multiplyByVector(u,t,t),l[f++]=t.x,l[f++]=t.y,l[f++]=t.z;return l}function N$e(e){let t=nde,n=ide,i=ode,o=e[1];n=d.fromArray(e[1],o.length-3,n),i=d.fromArray(e[0],0,i),t=d.midpoint(n,i,t);let r=i4(t,n,i,Bi.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=d.fromArray(a,a.length-3,n),i=d.fromArray(o,0,i),t=d.midpoint(n,i,t);let l=i4(t,n,i,Bi.ROUNDED,!1);return[r,l]}function ede(e,t,n,i){let o=HE;return i?o=d.add(e,t,o):(t=d.negate(t,t),o=d.add(e,t,o)),[o.x,o.y,o.z,n.x,n.y,n.z]}function Dq(e,t,n,i){let o=new Array(e.length),r=new Array(e.length),s=d.multiplyByScalar(t,n,HE),a=d.negate(s,tde),l=0,u=e.length-1;for(let f=0;f<e.length;f+=3){let h=d.fromArray(e,f,v$e),p=d.add(h,a,Zfe);o[l++]=p.x,o[l++]=p.y,o[l++]=p.z;let g=d.add(h,s,Zfe);r[u--]=g.z,r[u--]=g.y,r[u--]=g.x}return i.push(o,r),i}Pq.addAttribute=function(e,t,n,i){let o=t.x,r=t.y,s=t.z;c(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),c(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};var F$e=new d,B$e=new d;Pq.computePositions=function(e){let t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes,a=nde,l=ide,u=ode,f=D$e,h=P$e,p=I$e,g=O$e,m=R$e,y=M$e,b=L$e,x=[],A=s?[]:void 0,C=s?[]:void 0,S=n[0],v=n[1];l=d.normalize(d.subtract(v,S,l),l),a=i.geodeticSurfaceNormal(S,a),f=d.normalize(d.cross(a,l,f),f),s&&(A.push(f.x,f.y,f.z),C.push(a.x,a.y,a.z)),g=d.clone(S,g),S=v,u=d.negate(l,u);let P,M=[],R,L=n.length;for(R=1;R<L-1;R++){a=i.geodeticSurfaceNormal(S,a),v=n[R+1],l=d.normalize(d.subtract(v,S,l),l);let _=d.multiplyByScalar(a,d.dot(l,a),F$e);d.subtract(l,_,_),d.normalize(_,_);let w=d.multiplyByScalar(a,d.dot(u,a),B$e);if(d.subtract(u,w,w),d.normalize(w,w),!O.equalsEpsilon(Math.abs(d.dot(_,w)),1,O.EPSILON7)){h=d.normalize(d.add(l,u,h),h),h=d.cross(h,a,h),h=d.cross(a,h,h),h=d.normalize(h,h);let I=o/Math.max(.25,d.magnitude(d.cross(h,u,HE))),N=yh.angleIsGreaterThanPi(l,u,S,i);h=d.multiplyByScalar(h,I,h),N?(m=d.add(S,h,m),b=d.add(m,d.multiplyByScalar(f,o,b),b),y=d.add(m,d.multiplyByScalar(f,o*2,y),y),sl[0]=d.clone(g,sl[0]),sl[1]=d.clone(b,sl[1]),P=Fi.generateArc({positions:sl,granularity:t,ellipsoid:i}),x=Dq(P,f,o,x),s&&(A.push(f.x,f.y,f.z),C.push(a.x,a.y,a.z)),p=d.clone(y,p),f=d.normalize(d.cross(a,l,f),f),y=d.add(m,d.multiplyByScalar(f,o*2,y),y),g=d.add(m,d.multiplyByScalar(f,o,g),g),r===Bi.ROUNDED||r===Bi.BEVELED?M.push({leftPositions:i4(m,p,y,r,N)}):M.push({leftPositions:ede(S,d.negate(h,h),y,N)})):(y=d.add(S,h,y),b=d.add(y,d.negate(d.multiplyByScalar(f,o,b),b),b),m=d.add(y,d.negate(d.multiplyByScalar(f,o*2,m),m),m),sl[0]=d.clone(g,sl[0]),sl[1]=d.clone(b,sl[1]),P=Fi.generateArc({positions:sl,granularity:t,ellipsoid:i}),x=Dq(P,f,o,x),s&&(A.push(f.x,f.y,f.z),C.push(a.x,a.y,a.z)),p=d.clone(m,p),f=d.normalize(d.cross(a,l,f),f),m=d.add(y,d.negate(d.multiplyByScalar(f,o*2,m),m),m),g=d.add(y,d.negate(d.multiplyByScalar(f,o,g),g),g),r===Bi.ROUNDED||r===Bi.BEVELED?M.push({rightPositions:i4(y,p,m,r,N)}):M.push({rightPositions:ede(S,h,m,N)})),u=d.negate(l,u)}S=v}a=i.geodeticSurfaceNormal(S,a),sl[0]=d.clone(g,sl[0]),sl[1]=d.clone(S,sl[1]),P=Fi.generateArc({positions:sl,granularity:t,ellipsoid:i}),x=Dq(P,f,o,x),s&&(A.push(f.x,f.y,f.z),C.push(a.x,a.y,a.z));let F;return r===Bi.ROUNDED&&(F=N$e(x)),{positions:x,corners:M,lefts:A,normals:C,endPositions:F}};var Wi=Pq;var ade=new d,cde=new d,o4=new d,r4=new d,k$e=new d,lde=new d,$y=new d,GE=new d;function ude(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function bh(e,t,n,i,o,r){let s=e.normals,a=e.tangents,l=e.bitangents,u=d.normalize(d.cross(n,t,$y),$y);r.normal&&Wi.addAttribute(s,t,i,o),r.tangent&&Wi.addAttribute(a,u,i,o),r.bitangent&&Wi.addAttribute(l,n,i,o)}function fde(e,t,n){let i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,l=new fn,u,f=0,h=0,p,g=0,m;for(p=0;p<i.length;p+=2)m=i[p].length-3,f+=m,g+=m*2,h+=i[p+1].length-3;for(f+=3,h+=3,p=0;p<o.length;p++){u=o[p];let ee=o[p].leftPositions;c(ee)?(m=ee.length,f+=m,g+=m):(m=o[p].rightPositions.length,h+=m,g+=m)}let y=c(r),b;y&&(b=r[0].length-3,f+=b,h+=b,b/=3,g+=b*6);let x=f+h,A=new Float64Array(x),C=t.normal?new Float32Array(x):void 0,S=t.tangent?new Float32Array(x):void 0,v=t.bitangent?new Float32Array(x):void 0,P={normals:C,tangents:S,bitangents:v},M=0,R=x-1,L,F,_,w,D=ade,I=cde,N,k,z=b/2,V=Fe.createTypedArray(x/3,g),j=0;if(y){k=o4,N=r4;let ee=r[0];for(D=d.fromArray(a,0,D),I=d.fromArray(s,0,I),p=0;p<z;p++)k=d.fromArray(ee,(z-1-p)*3,k),N=d.fromArray(ee,(z+p)*3,N),Wi.addAttribute(A,N,M),Wi.addAttribute(A,k,void 0,R),bh(P,D,I,M,R,t),F=M/3,w=F+1,L=(R-2)/3,_=L-1,V[j++]=L,V[j++]=F,V[j++]=_,V[j++]=_,V[j++]=F,V[j++]=w,M+=3,R-=3}let U=0,q=0,Y=i[U++],te=i[U++];A.set(Y,M),A.set(te,R-te.length+1),I=d.fromArray(s,q,I);let K,Z;for(m=te.length-3,p=0;p<m;p+=3)K=n.geodeticSurfaceNormal(d.fromArray(Y,p,$y),$y),Z=n.geodeticSurfaceNormal(d.fromArray(te,m-p,GE),GE),D=d.normalize(d.add(K,Z,D),D),bh(P,D,I,M,R,t),F=M/3,w=F+1,L=(R-2)/3,_=L-1,V[j++]=L,V[j++]=F,V[j++]=_,V[j++]=_,V[j++]=F,V[j++]=w,M+=3,R-=3;for(K=n.geodeticSurfaceNormal(d.fromArray(Y,m,$y),$y),Z=n.geodeticSurfaceNormal(d.fromArray(te,m,GE),GE),D=d.normalize(d.add(K,Z,D),D),q+=3,p=0;p<o.length;p++){let ee;u=o[p];let me=u.leftPositions,Te=u.rightPositions,ue,ye,Ae=lde,Pe=o4,Ee=r4;if(D=d.fromArray(a,q,D),c(me)){for(bh(P,D,I,void 0,R,t),R-=3,ue=w,ye=_,ee=0;ee<me.length/3;ee++)Ae=d.fromArray(me,ee*3,Ae),V[j++]=ue,V[j++]=ye-ee-1,V[j++]=ye-ee,Wi.addAttribute(A,Ae,void 0,R),Pe=d.fromArray(A,(ye-ee-1)*3,Pe),Ee=d.fromArray(A,ue*3,Ee),I=d.normalize(d.subtract(Pe,Ee,I),I),bh(P,D,I,void 0,R,t),R-=3;Ae=d.fromArray(A,ue*3,Ae),Pe=d.subtract(d.fromArray(A,ye*3,Pe),Ae,Pe),Ee=d.subtract(d.fromArray(A,(ye-ee)*3,Ee),Ae,Ee),I=d.normalize(d.add(Pe,Ee,I),I),bh(P,D,I,M,void 0,t),M+=3}else{for(bh(P,D,I,M,void 0,t),M+=3,ue=_,ye=w,ee=0;ee<Te.length/3;ee++)Ae=d.fromArray(Te,ee*3,Ae),V[j++]=ue,V[j++]=ye+ee,V[j++]=ye+ee+1,Wi.addAttribute(A,Ae,M),Pe=d.fromArray(A,ue*3,Pe),Ee=d.fromArray(A,(ye+ee)*3,Ee),I=d.normalize(d.subtract(Pe,Ee,I),I),bh(P,D,I,M,void 0,t),M+=3;Ae=d.fromArray(A,ue*3,Ae),Pe=d.subtract(d.fromArray(A,(ye+ee)*3,Pe),Ae,Pe),Ee=d.subtract(d.fromArray(A,ye*3,Ee),Ae,Ee),I=d.normalize(d.negate(d.add(Ee,Pe,I),I),I),bh(P,D,I,void 0,R,t),R-=3}for(Y=i[U++],te=i[U++],Y.splice(0,3),te.splice(te.length-3,3),A.set(Y,M),A.set(te,R-te.length+1),m=te.length-3,q+=3,I=d.fromArray(s,q,I),ee=0;ee<te.length;ee+=3)K=n.geodeticSurfaceNormal(d.fromArray(Y,ee,$y),$y),Z=n.geodeticSurfaceNormal(d.fromArray(te,m-ee,GE),GE),D=d.normalize(d.add(K,Z,D),D),bh(P,D,I,M,R,t),w=M/3,F=w-1,_=(R-2)/3,L=_+1,V[j++]=L,V[j++]=F,V[j++]=_,V[j++]=_,V[j++]=F,V[j++]=w,M+=3,R-=3;M-=3,R+=3}if(D=d.fromArray(a,a.length-3,D),bh(P,D,I,M,R,t),y){M+=3,R-=3,k=o4,N=r4;let ee=r[1];for(p=0;p<z;p++)k=d.fromArray(ee,(b-p-1)*3,k),N=d.fromArray(ee,p*3,N),Wi.addAttribute(A,k,void 0,R),Wi.addAttribute(A,N,M),bh(P,D,I,M,R,t),w=M/3,F=w-1,_=(R-2)/3,L=_+1,V[j++]=L,V[j++]=F,V[j++]=_,V[j++]=_,V[j++]=F,V[j++]=w,M+=3,R-=3}if(l.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:A}),t.st){let ee=new Float32Array(x/3*2),me,Te,ue=0;if(y){f/=3,h/=3;let ye=Math.PI/(b+1);Te=1/(f-b+1),me=1/(h-b+1);let Ae,Pe=b/2;for(p=Pe+1;p<b+1;p++)Ae=O.PI_OVER_TWO+ye*p,ee[ue++]=me*(1+Math.cos(Ae)),ee[ue++]=.5*(1+Math.sin(Ae));for(p=1;p<h-b+1;p++)ee[ue++]=p*me,ee[ue++]=0;for(p=b;p>Pe;p--)Ae=O.PI_OVER_TWO-p*ye,ee[ue++]=1-me*(1+Math.cos(Ae)),ee[ue++]=.5*(1+Math.sin(Ae));for(p=Pe;p>0;p--)Ae=O.PI_OVER_TWO-ye*p,ee[ue++]=1-Te*(1+Math.cos(Ae)),ee[ue++]=.5*(1+Math.sin(Ae));for(p=f-b;p>0;p--)ee[ue++]=p*Te,ee[ue++]=1;for(p=1;p<Pe+1;p++)Ae=O.PI_OVER_TWO+ye*p,ee[ue++]=Te*(1+Math.cos(Ae)),ee[ue++]=.5*(1+Math.sin(Ae))}else{for(f/=3,h/=3,Te=1/(f-1),me=1/(h-1),p=0;p<h;p++)ee[ue++]=p*me,ee[ue++]=0;for(p=f;p>0;p--)ee[ue++]=(p-1)*Te,ee[ue++]=1}l.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:ee})}return t.normal&&(l.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:P.normals})),t.tangent&&(l.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:P.tangents})),t.bitangent&&(l.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:P.bitangents})),{attributes:l,indices:V}}function U$e(e,t){if(!t.normal&&!t.tangent&&!t.bitangent&&!t.st)return e;let n=e.position.values,i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);let r=e.position.values.length/18,s=r*3,a=r*2,l=s*2,u;if(t.normal||t.bitangent||t.tangent){let f=t.normal?new Float32Array(s*6):void 0,h=t.tangent?new Float32Array(s*6):void 0,p=t.bitangent?new Float32Array(s*6):void 0,g=ade,m=cde,y=o4,b=r4,x=k$e,A=lde,C=l;for(u=0;u<s;u+=3){let S=C+l;g=d.fromArray(n,u,g),m=d.fromArray(n,u+s,m),y=d.fromArray(n,(u+3)%s,y),m=d.subtract(m,g,m),y=d.subtract(y,g,y),b=d.normalize(d.cross(m,y,b),b),t.normal&&(Wi.addAttribute(f,b,S),Wi.addAttribute(f,b,S+3),Wi.addAttribute(f,b,C),Wi.addAttribute(f,b,C+3)),(t.tangent||t.bitangent)&&(A=d.fromArray(i,u,A),t.bitangent&&(Wi.addAttribute(p,A,S),Wi.addAttribute(p,A,S+3),Wi.addAttribute(p,A,C),Wi.addAttribute(p,A,C+3)),t.tangent&&(x=d.normalize(d.cross(A,b,x),x),Wi.addAttribute(h,x,S),Wi.addAttribute(h,x,S+3),Wi.addAttribute(h,x,C),Wi.addAttribute(h,x,C+3))),C+=6}if(t.normal){for(f.set(i),u=0;u<s;u+=3)f[u+s]=-i[u],f[u+s+1]=-i[u+1],f[u+s+2]=-i[u+2];e.normal.values=f}else e.normal=void 0;if(t.bitangent?(p.set(o),p.set(o,s),e.bitangent.values=p):e.bitangent=void 0,t.tangent){let S=e.tangent.values;h.set(S),h.set(S,s),e.tangent.values=h}}if(t.st){let f=e.st.values,h=new Float32Array(a*6);h.set(f),h.set(f,a);let p=a*2;for(let g=0;g<2;g++){for(h[p++]=f[0],h[p++]=f[1],u=2;u<a;u+=2){let m=f[u],y=f[u+1];h[p++]=m,h[p++]=y,h[p++]=m,h[p++]=y}h[p++]=f[0],h[p++]=f[1]}e.st.values=h}return e}function Iq(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){let o=e[i],r=e[i+1],s=e[i+2];n[t++]=o,n[t++]=r,n[t++]=s,n[t++]=o,n[t++]=r,n[t++]=s}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function V$e(e,t){let n=new Ie({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,o=Wi.computePositions(e),r=fde(o,n,i),s=e.height,a=e.extrudedHeight,l=r.attributes,u=r.indices,f=l.position.values,h=f.length,p=new Float64Array(h*6),g=new Float64Array(h);g.set(f);let m=new Float64Array(h*4);f=si.scaleToGeodeticHeight(f,s,i),m=Iq(f,0,m),g=si.scaleToGeodeticHeight(g,a,i),m=Iq(g,h*2,m),p.set(f),p.set(g,h),p.set(m,h*2),l.position.values=p,l=U$e(l,t);let y,b=h/3;if(e.shadowVolume){let L=l.normal.values;h=L.length;let F=new Float32Array(h*6);for(y=0;y<h;y++)L[y]=-L[y];F.set(L,h),F=Iq(L,h*4,F),l.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:F}),t.normal||(l.normal=void 0)}if(c(e.offsetAttribute)){let L=new Uint8Array(b*6);if(e.offsetAttribute===Zt.TOP)L=L.fill(1,0,b).fill(1,b*2,b*4);else{let F=e.offsetAttribute===Zt.NONE?0:1;L=L.fill(F)}l.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:L})}let x=u.length,A=b+b,C=Fe.createTypedArray(p.length/3,x*2+A*3);C.set(u);let S=x;for(y=0;y<x;y+=3){let L=u[y],F=u[y+1],_=u[y+2];C[S++]=_+b,C[S++]=F+b,C[S++]=L+b}let v,P,M,R;for(y=0;y<A;y+=2)v=y+A,P=v+A,M=v+1,R=P+1,C[S++]=v,C[S++]=P,C[S++]=M,C[S++]=M,C[S++]=P,C[S++]=R;return{attributes:l,indices:C}}var rde=new d,nN=new d,Jf=new he;function sde(e,t,n,i,o,r){let s=d.subtract(t,e,rde);d.normalize(s,s);let a=n.geodeticSurfaceNormal(e,nN),l=d.cross(s,a,rde);d.multiplyByScalar(l,i,l);let u=o.latitude,f=o.longitude,h=r.latitude,p=r.longitude;d.add(e,l,nN),n.cartesianToCartographic(nN,Jf);let g=Jf.latitude,m=Jf.longitude;u=Math.min(u,g),f=Math.min(f,m),h=Math.max(h,g),p=Math.max(p,m),d.subtract(e,l,nN),n.cartesianToCartographic(nN,Jf),g=Jf.latitude,m=Jf.longitude,u=Math.min(u,g),f=Math.min(f,m),h=Math.max(h,g),p=Math.max(p,m),o.latitude=u,o.longitude=f,r.latitude=h,r.longitude=p}var Qf=new d,iN=new d,Xl=new he,Kl=new he;function dde(e,t,n,i,o){e=ude(e,t);let r=xo(e,d.equalsEpsilon),s=r.length;if(s<2||n<=0)return new ce;let a=n*.5;Xl.latitude=Number.POSITIVE_INFINITY,Xl.longitude=Number.POSITIVE_INFINITY,Kl.latitude=Number.NEGATIVE_INFINITY,Kl.longitude=Number.NEGATIVE_INFINITY;let l,u;if(i===Bi.ROUNDED){let p=r[0];d.subtract(p,r[1],Qf),d.normalize(Qf,Qf),d.multiplyByScalar(Qf,a,Qf),d.add(p,Qf,iN),t.cartesianToCartographic(iN,Jf),l=Jf.latitude,u=Jf.longitude,Xl.latitude=Math.min(Xl.latitude,l),Xl.longitude=Math.min(Xl.longitude,u),Kl.latitude=Math.max(Kl.latitude,l),Kl.longitude=Math.max(Kl.longitude,u)}for(let p=0;p<s-1;++p)sde(r[p],r[p+1],t,a,Xl,Kl);let f=r[s-1];d.subtract(f,r[s-2],Qf),d.normalize(Qf,Qf),d.multiplyByScalar(Qf,a,Qf),d.add(f,Qf,iN),sde(f,iN,t,a,Xl,Kl),i===Bi.ROUNDED&&(t.cartesianToCartographic(iN,Jf),l=Jf.latitude,u=Jf.longitude,Xl.latitude=Math.min(Xl.latitude,l),Xl.longitude=Math.min(Xl.longitude,u),Kl.latitude=Math.max(Kl.latitude,l),Kl.longitude=Math.max(Kl.longitude,u));let h=c(o)?o:new ce;return h.north=Kl.latitude,h.south=Xl.latitude,h.east=Kl.longitude,h.west=Xl.longitude,h}function z_(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.width;T.defined("options.positions",t),T.defined("options.width",n);let i=e.height??0,o=e.extrudedHeight??i;this._positions=t,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._vertexFormat=Ie.clone(e.vertexFormat??Ie.DEFAULT),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=e.cornerType??Bi.ROUNDED,this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._shadowVolume=e.shadowVolume??!1,this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*d.packedLength+ie.packedLength+Ie.packedLength+7}z_.pack=function(e,t,n){T.defined("value",e),T.defined("array",t),n=n??0;let i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n++]=e._shadowVolume?1:0,t[n]=e._offsetAttribute??-1,t};var hde=ie.clone(ie.UNIT_SPHERE),mde=new Ie,V_={positions:void 0,ellipsoid:hde,vertexFormat:mde,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};z_.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=e[t++],o=new Array(i);for(let m=0;m<i;++m,t+=d.packedLength)o[m]=d.unpack(e,t);let r=ie.unpack(e,t,hde);t+=ie.packedLength;let s=Ie.unpack(e,t,mde);t+=Ie.packedLength;let a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++],p=e[t++]===1,g=e[t];return c(n)?(n._positions=o,n._ellipsoid=ie.clone(r,n._ellipsoid),n._vertexFormat=Ie.clone(s,n._vertexFormat),n._width=a,n._height=l,n._extrudedHeight=u,n._cornerType=f,n._granularity=h,n._shadowVolume=p,n._offsetAttribute=g===-1?void 0:g,n):(V_.positions=o,V_.width=a,V_.height=l,V_.extrudedHeight=u,V_.cornerType=f,V_.granularity=h,V_.shadowVolume=p,V_.offsetAttribute=g===-1?void 0:g,new z_(V_))};z_.computeRectangle=function(e,t){e=e??W.EMPTY_OBJECT;let n=e.positions,i=e.width;T.defined("options.positions",n),T.defined("options.width",i);let o=e.ellipsoid??ie.default,r=e.cornerType??Bi.ROUNDED;return dde(n,o,i,r,t)};z_.createGeometry=function(e){let t=e._positions,n=e._width,i=e._ellipsoid;t=ude(t,i);let o=xo(t,d.equalsEpsilon);if(o.length<2||n<=0)return;let r=e._height,s=e._extrudedHeight,a=!O.equalsEpsilon(r,s,0,O.EPSILON2),l=e._vertexFormat,u={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0},f;if(a)u.height=r,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,f=V$e(u,l);else{let g=Wi.computePositions(u);if(f=fde(g,l,i),f.attributes.position.values=si.scaleToGeodeticHeight(f.attributes.position.values,r,i),c(e._offsetAttribute)){let m=e._offsetAttribute===Zt.NONE?0:1,y=f.attributes.position.values.length,b=new Uint8Array(y/3).fill(m);f.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}}let h=f.attributes,p=le.fromVertices(h.position.values,void 0,3);return l.position||(f.attributes.position.values=void 0),new ct({attributes:h,indices:f.indices,primitiveType:Me.TRIANGLES,boundingSphere:p,offsetAttribute:e._offsetAttribute})};z_.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new z_({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(z_.prototype,{rectangle:{get:function(){return c(this._rectangle)||(this._rectangle=dde(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var tT=z_;var pde=new d,_de=new d,z$e=new d;function H$e(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function gde(e,t){let n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new fn,a,l=0,u=0,f,h=0,p;for(f=0;f<i.length;f+=2)p=i[f].length-3,l+=p,h+=p/3*4,u+=i[f+1].length-3;for(l+=3,u+=3,f=0;f<o.length;f++){a=o[f];let N=o[f].leftPositions;c(N)?(p=N.length,l+=p,h+=p/3*2):(p=o[f].rightPositions.length,u+=p,h+=p/3*2)}let g=c(r),m;g&&(m=r[0].length-3,l+=m,u+=m,m/=3,h+=m*4);let y=l+u,b=new Float64Array(y),x=0,A=y-1,C,S,v,P,M,R,L=m/2,F=Fe.createTypedArray(y/3,h+4),_=0;if(F[_++]=x/3,F[_++]=(A-2)/3,g){n.push(x/3),R=pde,M=_de;let N=r[0];for(f=0;f<L;f++)R=d.fromArray(N,(L-1-f)*3,R),M=d.fromArray(N,(L+f)*3,M),Wi.addAttribute(b,M,x),Wi.addAttribute(b,R,void 0,A),S=x/3,P=S+1,C=(A-2)/3,v=C-1,F[_++]=C,F[_++]=v,F[_++]=S,F[_++]=P,x+=3,A-=3}let w=0,D=i[w++],I=i[w++];for(b.set(D,x),b.set(I,A-I.length+1),p=I.length-3,n.push(x/3,(A-2)/3),f=0;f<p;f+=3)S=x/3,P=S+1,C=(A-2)/3,v=C-1,F[_++]=C,F[_++]=v,F[_++]=S,F[_++]=P,x+=3,A-=3;for(f=0;f<o.length;f++){let N;a=o[f];let k=a.leftPositions,z=a.rightPositions,V,j=z$e;if(c(k)){for(A-=3,V=v,n.push(P),N=0;N<k.length/3;N++)j=d.fromArray(k,N*3,j),F[_++]=V-N-1,F[_++]=V-N,Wi.addAttribute(b,j,void 0,A),A-=3;n.push(V-Math.floor(k.length/6)),t===Bi.BEVELED&&n.push((A-2)/3+1),x+=3}else{for(x+=3,V=P,n.push(v),N=0;N<z.length/3;N++)j=d.fromArray(z,N*3,j),F[_++]=V+N,F[_++]=V+N+1,Wi.addAttribute(b,j,x),x+=3;n.push(V+Math.floor(z.length/6)),t===Bi.BEVELED&&n.push(x/3-1),A-=3}for(D=i[w++],I=i[w++],D.splice(0,3),I.splice(I.length-3,3),b.set(D,x),b.set(I,A-I.length+1),p=I.length-3,N=0;N<I.length;N+=3)P=x/3,S=P-1,v=(A-2)/3,C=v+1,F[_++]=C,F[_++]=v,F[_++]=S,F[_++]=P,x+=3,A-=3;x-=3,A+=3,n.push(x/3,(A-2)/3)}if(g){x+=3,A-=3,R=pde,M=_de;let N=r[1];for(f=0;f<L;f++)R=d.fromArray(N,(m-f-1)*3,R),M=d.fromArray(N,f*3,M),Wi.addAttribute(b,R,void 0,A),Wi.addAttribute(b,M,x),P=x/3,S=P-1,v=(A-2)/3,C=v+1,F[_++]=C,F[_++]=v,F[_++]=S,F[_++]=P,x+=3,A-=3;n.push(x/3)}else n.push(x/3,(A-2)/3);return F[_++]=x/3,F[_++]=(A-2)/3,s.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:b}),{attributes:s,indices:F,wallIndices:n}}function G$e(e){let t=e.ellipsoid,n=Wi.computePositions(e),i=gde(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,l=i.indices,u=a.position.values,f=u.length,h=new Float64Array(f);h.set(u);let p=new Float64Array(f*2);if(u=si.scaleToGeodeticHeight(u,r,t),h=si.scaleToGeodeticHeight(h,s,t),p.set(u),p.set(h,f),a.position.values=p,f/=3,c(e.offsetAttribute)){let C=new Uint8Array(f*2);if(e.offsetAttribute===Zt.TOP)C=C.fill(1,0,f);else{let S=e.offsetAttribute===Zt.NONE?0:1;C=C.fill(S)}a.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:C})}let g,m=l.length,y=Fe.createTypedArray(p.length/3,(m+o.length)*2);y.set(l);let b=m;for(g=0;g<m;g+=2){let C=l[g],S=l[g+1];y[b++]=C+f,y[b++]=S+f}let x,A;for(g=0;g<o.length;g++)x=o[g],A=x+f,y[b++]=x,y[b++]=A;return{attributes:a,indices:y}}function oN(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.width;T.typeOf.object("options.positions",t),T.typeOf.number("options.width",n);let i=e.height??0,o=e.extrudedHeight??i;this._positions=t,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=e.cornerType??Bi.ROUNDED,this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*d.packedLength+ie.packedLength+6}oN.pack=function(e,t,n){T.typeOf.object("value",e),T.typeOf.object("array",t),n=n??0;let i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=e._offsetAttribute??-1,t};var yde=ie.clone(ie.UNIT_SPHERE),Zy={positions:void 0,ellipsoid:yde,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};oN.unpack=function(e,t,n){T.typeOf.object("array",e),t=t??0;let i=e[t++],o=new Array(i);for(let p=0;p<i;++p,t+=d.packedLength)o[p]=d.unpack(e,t);let r=ie.unpack(e,t,yde);t+=ie.packedLength;let s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t];return c(n)?(n._positions=o,n._ellipsoid=ie.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=l,n._cornerType=u,n._granularity=f,n._offsetAttribute=h===-1?void 0:h,n):(Zy.positions=o,Zy.width=s,Zy.height=a,Zy.extrudedHeight=l,Zy.cornerType=u,Zy.granularity=f,Zy.offsetAttribute=h===-1?void 0:h,new oN(Zy))};oN.createGeometry=function(e){let t=e._positions,n=e._width,i=e._ellipsoid;t=H$e(t,i);let o=xo(t,d.equalsEpsilon);if(o.length<2||n<=0)return;let r=e._height,s=e._extrudedHeight,a=!O.equalsEpsilon(r,s,0,O.EPSILON2),l={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1},u;if(a)l.height=r,l.extrudedHeight=s,l.offsetAttribute=e._offsetAttribute,u=G$e(l);else{let p=Wi.computePositions(l);if(u=gde(p,l.cornerType),u.attributes.position.values=si.scaleToGeodeticHeight(u.attributes.position.values,r,i),c(e._offsetAttribute)){let g=u.attributes.position.values.length,m=e._offsetAttribute===Zt.NONE?0:1,y=new Uint8Array(g/3).fill(m);u.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}}let f=u.attributes,h=le.fromVertices(f.position.values,void 0,3);return new ct({attributes:f,indices:u.indices,primitiveType:Me.LINES,boundingSphere:h,offsetAttribute:e._offsetAttribute})};var rN=oN;var j$e=new Kn(0);function al(e){ii.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}c(Object.create)&&(al.prototype=Object.create(ii.prototype),al.prototype.constructor=al);Object.defineProperties(al.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});al.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!c(t.height)&&!c(t.extrudedHeight)&&jc.isSupported(this._scene)};al.prototype._getIsClosed=function(e){let t=e.height,n=e.extrudedHeight;return t===0||c(n)&&n!==t};al.prototype._computeCenter=E.throwInstantiationError;al.prototype._onEntityPropertyChanged=function(e,t,n,i){if(ii.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!c(o))return;c(o.zIndex)&&(c(o.height)||c(o.extrudedHeight))&&dt(dt.geometryZIndex),this._zIndex=o.zIndex??j$e,c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);let r=o.heightReference,s=o.extrudedHeightReference;if(c(r)||c(s)){let a=new Wd(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new $b(this._scene,a,r,s)}};al.prototype.destroy=function(){c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),ii.prototype.destroy.call(this)};al.getGeometryHeight=function(e,t){if(T.defined("heightReference",t),!c(e)){t!==We.NONE&&dt(dt.geometryHeightReference);return}return Df(t)?0:e};al.getGeometryExtrudedHeight=function(e,t){if(T.defined("extrudedHeightReference",t),!c(e)){t!==We.NONE&&dt(dt.geometryExtrudedHeightReference);return}return Df(t)?al.CLAMP_TO_GROUND:e};al.CLAMP_TO_GROUND="clamp";al.computeGeometryOffsetAttribute=function(e,t,n,i){(!c(e)||!c(t))&&(t=We.NONE),(!c(n)||!c(i))&&(i=We.NONE);let o=0;if(t!==We.NONE&&o++,i===We.RELATIVE_TO_GROUND&&o++,o===2)return Zt.ALL;if(o===1)return Zt.TOP};var Gn=al;var bde=new G,xde=d.ZERO,Tde=new d,Ade=new ce;function W$e(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function xh(e,t){Gn.call(this,{entity:e,scene:t,geometryOptions:new W$e(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}c(Object.create)&&(xh.prototype=Object.create(Gn.prototype),xh.prototype.constructor=xh);xh.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:kn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Ut){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,bde)),c(o)||(o=G.WHITE),i.color=Gt.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,xde,Tde))),new St({id:t,geometry:new tT(this._options),attributes:i})};xh.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,bde),o={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return c(this._options.offsetAttribute)&&(o.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,xde,Tde))),new St({id:t,geometry:new rN(this._options),attributes:o})};xh.prototype._computeCenter=function(e,t){let n=X.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!c(n)||n.length===0))return d.clone(n[Math.floor(n.length/2)],t)};xh.prototype._isHidden=function(e,t){return!c(t.positions)||!c(t.width)||ii.prototype._isHidden.call(this,e,t)};xh.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!X.isConstant(t.height)||!X.isConstant(t.extrudedHeight)||!X.isConstant(t.granularity)||!X.isConstant(t.width)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.cornerType)||!X.isConstant(t.zIndex)||this._onTerrain&&!X.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Ut)};xh.prototype._setStaticOptions=function(e,t){let n=X.getValueOrUndefined(t.height,Ge.MINIMUM_VALUE),i=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),o=X.getValueOrUndefined(t.extrudedHeight,Ge.MINIMUM_VALUE),r=X.getValueOrDefault(t.extrudedHeightReference,Ge.MINIMUM_VALUE,We.NONE);c(o)&&!c(n)&&(n=0);let s=this._options;s.vertexFormat=this._materialProperty instanceof Ut?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(Ge.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(Ge.MINIMUM_VALUE),s.granularity=X.getValueOrUndefined(t.granularity,Ge.MINIMUM_VALUE),s.cornerType=X.getValueOrUndefined(t.cornerType,Ge.MINIMUM_VALUE),s.offsetAttribute=Gn.computeGeometryOffsetAttribute(n,i,o,r),s.height=Gn.getGeometryHeight(n,i),o=Gn.getGeometryExtrudedHeight(o,r),o===Gn.CLAMP_TO_GROUND&&(o=ui.getMinimumMaximumHeights(tT.computeRectangle(s,Ade)).minimumTerrainHeight),s.extrudedHeight=o};xh.DynamicGeometryUpdater=jE;function jE(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(jE.prototype=Object.create(ni.prototype),jE.prototype.constructor=jE);jE.prototype._isHidden=function(e,t,n){let i=this._options;return!c(i.positions)||!c(i.width)||ni.prototype._isHidden.call(this,e,t,n)};jE.prototype._setOptions=function(e,t,n){let i=this._options,o=X.getValueOrUndefined(t.height,n),r=X.getValueOrDefault(t.heightReference,n,We.NONE),s=X.getValueOrUndefined(t.extrudedHeight,n),a=X.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);c(s)&&!c(o)&&(o=0),i.positions=X.getValueOrUndefined(t.positions,n),i.width=X.getValueOrUndefined(t.width,n),i.granularity=X.getValueOrUndefined(t.granularity,n),i.cornerType=X.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=Gn.computeGeometryOffsetAttribute(o,r,s,a),i.height=Gn.getGeometryHeight(o,r),s=Gn.getGeometryExtrudedHeight(s,a),s===Gn.CLAMP_TO_GROUND&&(s=ui.getMinimumMaximumHeights(tT.computeRectangle(i,Ade)).minimumTerrainHeight),i.extrudedHeight=s};var sN=xh;function s4(){E.throwInstantiationError()}Object.defineProperties(s4.prototype,{name:{get:E.throwInstantiationError},clock:{get:E.throwInstantiationError},entities:{get:E.throwInstantiationError},isLoading:{get:E.throwInstantiationError},changedEvent:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError},loadingEvent:{get:E.throwInstantiationError},show:{get:E.throwInstantiationError},clustering:{get:E.throwInstantiationError}});s4.prototype.update=function(e){E.throwInstantiationError()};s4.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};var Kr=s4;function Nm(e,t){T.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new d,this._cameraPositionInScaledSpace=new d,this._distanceToLimbInScaledSpaceSquared=0,c(t)&&(this.cameraPosition=t)}Object.defineProperties(Nm.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){let n=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=d.magnitudeSquared(n)-1;d.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});var Cde=new d;Nm.prototype.isPointVisible=function(e){let n=this._ellipsoid.transformPositionToScaledSpace(e,Cde);return Rq(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};Nm.prototype.isScaledSpacePointVisible=function(e){return Rq(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var q$e=new d;Nm.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){let n=this._ellipsoid,i,o;return c(t)&&t<0&&n.minimumRadius>-t?(o=q$e,o.x=this._cameraPosition.x/(n.radii.x+t),o.y=this._cameraPosition.y/(n.radii.y+t),o.z=this._cameraPosition.z/(n.radii.z+t),i=o.x*o.x+o.y*o.y+o.z*o.z-1):(o=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),Rq(e,o,i)};Nm.prototype.computeHorizonCullingPoint=function(e,t,n){return wde(this._ellipsoid,e,t,n)};var Ede=ie.clone(ie.UNIT_SPHERE);Nm.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){let o=Sde(this._ellipsoid,n,Ede);return wde(o,e,t,i)};Nm.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return vde(this._ellipsoid,e,t,n,i,o)};Nm.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){let s=Sde(this._ellipsoid,o,Ede);return vde(s,e,t,n,i,r)};var Y$e=[];Nm.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){T.typeOf.object("rectangle",e);let i=ce.subsample(e,t,0,Y$e),o=le.fromPoints(i);if(!(d.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};var X$e=new d;function Sde(e,t,n){if(c(t)&&t<0&&e.minimumRadius>-t){let i=d.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,X$e);e=ie.fromCartesian3(i,n)}return e}function wde(e,t,n,i){T.typeOf.object("directionToPoint",t),T.defined("positions",n),c(i)||(i=new d);let o=Ide(e,t),r=0;for(let s=0,a=n.length;s<a;++s){let l=n[s],u=Dde(e,l,o);if(u<0)return;r=Math.max(r,u)}return Pde(o,r,i)}var a4=new d;function vde(e,t,n,i,o,r){T.typeOf.object("directionToPoint",t),T.defined("vertices",n),T.typeOf.number("stride",i),c(r)||(r=new d),i=i??3,o=o??d.ZERO;let s=Ide(e,t),a=0;for(let l=0,u=n.length;l<u;l+=i){a4.x=n[l]+o.x,a4.y=n[l+1]+o.y,a4.z=n[l+2]+o.z;let f=Dde(e,a4,s);if(f<0)return;a=Math.max(a,f)}return Pde(s,a,r)}function Rq(e,t,n){let i=t,o=n,r=d.subtract(e,i,Cde),s=-d.dot(r,i);return!(o<0?s>0:s>o&&s*s/d.magnitudeSquared(r)>o)}var K$e=new d,$$e=new d;function Dde(e,t,n){let i=e.transformPositionToScaledSpace(t,K$e),o=d.magnitudeSquared(i),r=Math.sqrt(o),s=d.divideByScalar(i,r,$$e);o=Math.max(1,o),r=Math.max(1,r);let a=d.dot(s,n),l=d.magnitude(d.cross(s,n,s)),u=1/r,f=Math.sqrt(o-1)*u;return 1/(a*u-l*f)}function Pde(e,t,n){if(!(t<=0||t===1/0||t!==t))return d.multiplyByScalar(e,t,n)}var Oq=new d;function Ide(e,t){return d.equals(t,d.ZERO)?t:(e.transformPositionToScaledSpace(t,Oq),d.normalize(Oq,Oq))}var H_=Nm;function Rr(e,t){if(e=e??W.EMPTY_OBJECT,c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=Bt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");i=Bt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=Mt.clone(o)}this._show=e.show??!0,this._position=d.clone(e.position??d.ZERO),this._actualPosition=d.clone(this._position),this._color=G.clone(e.color??G.WHITE),this._outlineColor=G.clone(e.outlineColor??G.TRANSPARENT),this._outlineWidth=e.outlineWidth??0,this._pixelSize=e.pixelSize??10,this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=e.disableDepthTestDistance??0,this._id=e.id,this._collection=e.collection??t,this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1,this._splitDirection=e.splitDirection??Vr.NONE}var Ode=Rr.SHOW_INDEX=0,Lde=Rr.POSITION_INDEX=1,Z$e=Rr.COLOR_INDEX=2,Q$e=Rr.OUTLINE_COLOR_INDEX=3,J$e=Rr.OUTLINE_WIDTH_INDEX=4,eZe=Rr.PIXEL_SIZE_INDEX=5,tZe=Rr.SCALE_BY_DISTANCE_INDEX=6,nZe=Rr.TRANSLUCENCY_BY_DISTANCE_INDEX=7,iZe=Rr.DISTANCE_DISPLAY_CONDITION_INDEX=8,oZe=Rr.DISABLE_DEPTH_DISTANCE_INDEX=9,rZe=Rr.SPLIT_DIRECTION_INDEX=10;Rr.NUMBER_OF_PROPERTIES=11;function Fu(e,t){let n=e._pointPrimitiveCollection;c(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(Rr.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");this._show!==e&&(this._show=e,Fu(this,Ode))}},position:{get:function(){return this._position},set:function(e){if(!c(e))throw new E("value is required.");let t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),Fu(this,Lde))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");let t=this._scaleByDistance;Bt.equals(t,e)||(this._scaleByDistance=Bt.clone(e,t),Fu(this,tZe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");let t=this._translucencyByDistance;Bt.equals(t,e)||(this._translucencyByDistance=Bt.clone(e,t),Fu(this,nZe))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!c(e))throw new E("value is required.");this._pixelSize!==e&&(this._pixelSize=e,Fu(this,eZe))}},color:{get:function(){return this._color},set:function(e){if(!c(e))throw new E("value is required.");let t=this._color;G.equals(t,e)||(G.clone(e,t),Fu(this,Z$e))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");let t=this._outlineColor;G.equals(t,e)||(G.clone(e,t),Fu(this,Q$e))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!c(e))throw new E("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,Fu(this,J$e))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");Mt.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=Mt.clone(e,this._distanceDisplayCondition),Fu(this,iZe))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!c(e)||e<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,Fu(this,oZe)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,Fu(this,Ode))}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&(this._splitDirection=e,Fu(this,rZe))}}});Rr.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};Rr.prototype._getActualPosition=function(){return this._actualPosition};Rr.prototype._setActualPosition=function(e){d.clone(e,this._actualPosition),Fu(this,Lde)};var Rde=new se;Rr._computeActualPosition=function(e,t,n){return t.mode===oe.SCENE3D?e:(B.multiplyByPoint(n,e,Rde),Gi.computeActualEllipsoidPosition(t,Rde))};var Mde=new se;Rr._computeScreenSpacePosition=function(e,t,n,i){let o=B.multiplyByVector(e,se.fromElements(t.x,t.y,t.z,1,Mde),Mde);return Gi.worldToWindowCoordinates(n,o,i)};Rr.prototype.computeScreenSpacePosition=function(e,t){let n=this._pointPrimitiveCollection;if(c(t)||(t=new H),!c(n))throw new E("PointPrimitive must be in a collection.");if(!c(e))throw new E("scene is required.");let i=n.modelMatrix,o=Rr._computeScreenSpacePosition(i,this._actualPosition,e,t);if(c(o))return o.y=e.canvas.clientHeight-o.y,o};Rr.getScreenSpaceBoundingBox=function(e,t,n){let i=e.pixelSize,o=i*.5,r=t.x-o,s=t.y-o,a=i,l=i;return c(n)||(n=new Ke),n.x=r,n.y=s,n.width=a,n.height=l,n};Rr.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.equals(this._position,e._position)&&G.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&G.equals(this._outlineColor,e._outlineColor)&&Bt.equals(this._scaleByDistance,e._scaleByDistance)&&Bt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Mt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._splitDirection===e._splitDirection};Rr.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var Os=Rr;var Qy=`in vec4 v_color;
in vec4 v_outlineColor;
in float v_innerPercent;
in float v_pixelDistance;
in vec4 v_pickColor;
in float v_splitDirection;
void main()
{
if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
float distanceToCenter = length(gl_PointCoord - vec2(0.5));
float maxDistance = max(0.0, 0.5 - v_pixelDistance);
float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);
float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);
vec4 color = mix(v_outlineColor, v_color, innerAlpha);
color.a *= wholeAlpha;
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
if (color.a < 0.005)
{
discard;
}
#else
#ifdef OPAQUE
if (color.a < 0.995)
{
discard;
}
#else
if (color.a >= 0.995)
{
discard;
}
#endif
#endif
out_FragColor = czm_gammaCorrect(color);
czm_writeLogDepth();
}
`;var aN=`uniform float u_maxTotalPointSize;
in vec4 positionHighAndSize;
in vec4 positionLowAndOutline;
in vec4 compressedAttribute0;
in vec4 compressedAttribute1;
in vec4 scaleByDistance;
in vec4 distanceDisplayConditionAndDisableDepthAndSplitDirection;
out vec4 v_color;
out vec4 v_outlineColor;
out float v_innerPercent;
out float v_pixelDistance;
out vec4 v_pickColor;
out float v_splitDirection;
const float SHIFT_LEFT8 = 256.0;
const float SHIFT_RIGHT8 = 1.0 / 256.0;
void main()
{
vec3 positionHigh = positionHighAndSize.xyz;
vec3 positionLow = positionLowAndOutline.xyz;
float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
float totalSize = positionHighAndSize.w + outlineWidthBothSides;
float outlinePercent = outlineWidthBothSides / totalSize;
totalSize *= czm_pixelRatio;
float temp = compressedAttribute1.x * SHIFT_RIGHT8;
float show = floor(temp);
#ifdef EYE_DISTANCE_TRANSLUCENCY
vec4 translucencyByDistance;
translucencyByDistance.x = compressedAttribute1.z;
translucencyByDistance.z = compressedAttribute1.w;
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
temp = compressedAttribute1.y * SHIFT_RIGHT8;
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
#endif
vec4 color;
vec4 outlineColor;
vec4 pickColor;
temp = compressedAttribute0.z * SHIFT_RIGHT8;
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor.r = floor(temp);
temp = compressedAttribute0.x * SHIFT_RIGHT8;
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
color.r = floor(temp);
temp = compressedAttribute0.y * SHIFT_RIGHT8;
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor.r = floor(temp);
temp = compressedAttribute0.w * SHIFT_RIGHT8;
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
pickColor = pickColor / 255.0;
temp = floor(temp) * SHIFT_RIGHT8;
outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
outlineColor /= 255.0;
color.a = floor(temp);
color /= 255.0;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
float lengthSq;
if (czm_sceneMode == czm_sceneMode2D)
{
lengthSq = czm_eyeHeight2D.y;
}
else
{
lengthSq = dot(positionEC.xyz, positionEC.xyz);
}
#endif
#ifdef EYE_DISTANCE_SCALING
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
#endif
if (totalSize > 0.0) {
totalSize += 3.0;
}
totalSize = min(totalSize, u_maxTotalPointSize);
if (totalSize < 1.0)
{
positionEC.xyz = vec3(0.0);
totalSize = 1.0;
}
float translucency = 1.0;
#ifdef EYE_DISTANCE_TRANSLUCENCY
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
if (translucency < 0.004)
{
positionEC.xyz = vec3(0.0);
}
#endif
#ifdef DISTANCE_DISPLAY_CONDITION
float nearSq = distanceDisplayConditionAndDisableDepthAndSplitDirection.x;
float farSq = distanceDisplayConditionAndDisableDepthAndSplitDirection.y;
if (lengthSq < nearSq || lengthSq > farSq) {
positionEC.xyz = vec3(0.0, 0.0, 1.0);
}
#endif
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepthAndSplitDirection.z;
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
{
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
}
if (disableDepthTestDistance != 0.0)
{
float zclip = gl_Position.z / gl_Position.w;
bool clipped = (zclip < -1.0 || zclip > 1.0);
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
{
gl_Position.z = -gl_Position.w;
#ifdef LOG_DEPTH
czm_vertexLogDepth(vec4(czm_currentFrustum.x));
#endif
}
}
#endif
v_color = color;
v_color.a *= translucency * show;
v_outlineColor = outlineColor;
v_outlineColor.a *= translucency * show;
v_innerPercent = 1.0 - outlinePercent;
v_pixelDistance = 2.0 / totalSize;
gl_PointSize = totalSize * show;
gl_Position *= show;
v_pickColor = pickColor;
v_splitDirection = distanceDisplayConditionAndDisableDepthAndSplitDirection.w;
}
`;var sZe=Os.SHOW_INDEX,Nq=Os.POSITION_INDEX,Nde=Os.COLOR_INDEX,aZe=Os.OUTLINE_COLOR_INDEX,cZe=Os.OUTLINE_WIDTH_INDEX,lZe=Os.PIXEL_SIZE_INDEX,Fde=Os.SCALE_BY_DISTANCE_INDEX,Bde=Os.TRANSLUCENCY_BY_DISTANCE_INDEX,kde=Os.DISTANCE_DISPLAY_CONDITION_INDEX,uZe=Os.DISABLE_DEPTH_DISTANCE_INDEX,fZe=Os.SPLIT_DIRECTION_INDEX,Fq=Os.NUMBER_OF_PROPERTIES,wc={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepthAndSplitDirection:5};function ed(e){e=e??W.EMPTY_OBJECT,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(Fq),this._maxPixelSize=1,this._baseVolume=new le,this._baseVolumeWC=new le,this._baseVolume2D=new le,this._boundingVolume=new le,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.blendOption=e.blendOption??wo.OPAQUE_AND_TRANSLUCENT,this._blendOption=void 0,this._mode=oe.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW,Be.STATIC_DRAW];let t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(ed.prototype,{length:{get:function(){return Bq(this),this._pointPrimitives.length}}});function Ude(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}ed.prototype.add=function(e){let t=new Os(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};ed.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};ed.prototype.removeAll=function(){Ude(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function Bq(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;let t=[],n=e._pointPrimitives,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];s&&(s._index=r++,t.push(s))}e._pointPrimitives=t}}ed.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};ed.prototype.contains=function(e){return c(e)&&e._pointPrimitiveCollection===this};ed.prototype.get=function(e){if(!c(e))throw new E("index is required.");return Bq(this),this._pointPrimitives[e]};ed.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<Fq;++i){let o=n[i]===0?Be.STATIC_DRAW:Be.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function dZe(e,t,n){return new Mp(e,[{index:wc.positionHighAndSize,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Nq]},{index:wc.positionLowAndShow,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Nq]},{index:wc.compressedAttribute0,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Nde]},{index:wc.compressedAttribute1,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Bde]},{index:wc.scaleByDistance,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[Fde]},{index:wc.distanceDisplayConditionAndDisableDepthAndSplitDirection,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:n[kde]}],t)}var Mq=new Hn;function Vde(e,t,n,i){let o=i._index,r=i._getActualPosition();e._mode===oe.SCENE3D&&(le.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),Hn.fromCartesian(r,Mq);let s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);let l=n[wc.positionHighAndSize],u=Mq.high;l(o,u.x,u.y,u.z,s);let f=n[wc.positionLowAndOutline],h=Mq.low;f(o,h.x,h.y,h.z,a)}var c4=65536,cN=256;function zde(e,t,n,i){let o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor,l=G.floatToByte(r.red),u=G.floatToByte(r.green),f=G.floatToByte(r.blue),h=l*c4+u*cN+f;l=G.floatToByte(a.red),u=G.floatToByte(a.green),f=G.floatToByte(a.blue);let p=l*c4+u*cN+f;l=G.floatToByte(s.red),u=G.floatToByte(s.green),f=G.floatToByte(s.blue);let g=l*c4+u*cN+f,m=G.floatToByte(r.alpha)*c4+G.floatToByte(a.alpha)*cN+G.floatToByte(s.alpha),y=n[wc.compressedAttribute0];y(o,h,p,g,m)}function Hde(e,t,n,i){let o=i._index,r=0,s=1,a=1,l=1,u=i.translucencyByDistance;c(u)&&(r=u.near,s=u.nearValue,a=u.far,l=u.farValue,(s!==1||l!==1)&&(e._shaderTranslucencyByDistance=!0));let f=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(f=!1),s=O.clamp(s,0,1),s=s===1?255:s*255|0;let h=(f?1:0)*cN+s;l=O.clamp(l,0,1),l=l===1?255:l*255|0;let p=l,g=n[wc.compressedAttribute1];g(o,h,p,r,a)}function Gde(e,t,n,i){let o=i._index,r=n[wc.scaleByDistance],s=0,a=1,l=1,u=1,f=i.scaleByDistance;c(f)&&(s=f.near,a=f.nearValue,l=f.far,u=f.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,l,u)}function jde(e,t,n,i){let o=i._index,r=n[wc.distanceDisplayConditionAndDisableDepthAndSplitDirection],s=0,a=Number.MAX_VALUE,l=i.distanceDisplayCondition;c(l)&&(s=l.near,a=l.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let u=i.disableDepthTestDistance;u*=u,u>0&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1));let f=0,h=i.splitDirection;c(h)&&(f=h),r(o,s,a,u,f)}function hZe(e,t,n,i){Vde(e,t,n,i),zde(e,t,n,i),Hde(e,t,n,i),Gde(e,t,n,i),jde(e,t,n,i)}function Lq(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;let a=[];for(let l=0;l<n;++l){let u=t[l],f=u.position,h=Os._computeActualPosition(f,i,o);c(h)&&(u._setActualPosition(h),r?a.push(h):le.expand(s,h,s))}r&&le.fromPoints(a,s)}function mZe(e,t){let n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==oe.SCENE3D&&!B.equals(r,e.modelMatrix)?(e._mode=n,B.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===oe.SCENE3D||n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&Lq(e,i,i.length,t,r,!0)):n===oe.MORPHING?Lq(e,i,i.length,t,r,!0):(n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&Lq(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function pZe(e,t,n){let o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}var _Ze=[];ed.prototype.update=function(e){if(Bq(this),!this.show)return;this._maxTotalPointSize=ut.maximumAliasedPointSize,mZe(this,e);let n=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,o=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,s=this._createVertexArray,a,l=e.context,u=e.passes,f=u.pick;if(s||!f&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let v=0;v<Fq;++v)r[v]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=dZe(l,n,this._buffersUsage),a=this._vaf.writers;for(let v=0;v<n;++v){let P=this._pointPrimitives[v];P._dirty=!1,hZe(this,l,a,P)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){let v=_Ze;v.length=0,(r[Nq]||r[cZe]||r[lZe])&&v.push(Vde),(r[Nde]||r[aZe])&&v.push(zde),(r[sZe]||r[Bde])&&v.push(Hde),r[Fde]&&v.push(Gde),(r[kde]||r[uZe]||r[fZe])&&v.push(jde);let P=v.length;if(a=this._vaf.writers,o/n>.1){for(let M=0;M<o;++M){let R=i[M];R._dirty=!1;for(let L=0;L<P;++L)v[L](this,l,a,R)}this._vaf.commit()}else{for(let M=0;M<o;++M){let R=i[M];R._dirty=!1;for(let L=0;L<P;++L)v[L](this,l,a,R);this._vaf.subCommit(R._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(o>n*1.5&&(i.length=n),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,le.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let h,p=B.IDENTITY;e.mode===oe.SCENE3D?(p=this.modelMatrix,h=le.clone(this._baseVolumeWC,this._boundingVolume)):h=le.clone(this._baseVolume2D,this._boundingVolume),pZe(this,e,h);let g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===wo.OPAQUE||this._blendOption===wo.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ve.fromCache({depthTest:{enabled:!0,func:ne.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===wo.TRANSLUCENT||this._blendOption===wo.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ve.fromCache({depthTest:{enabled:!0,func:ne.LEQUAL},depthMask:!1,blending:ln.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let m,y;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(m=new He({sources:[aN]}),this._shaderScaleByDistance&&m.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&m.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&m.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&m.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===wo.OPAQUE_AND_TRANSLUCENT&&(y=new He({defines:["OPAQUE"],sources:[Qy]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:y,attributeLocations:wc}),y=new He({defines:["TRANSLUCENT"],sources:[Qy]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:y,attributeLocations:wc})),this._blendOption===wo.OPAQUE&&(y=new He({sources:[Qy]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:y,attributeLocations:wc})),this._blendOption===wo.TRANSLUCENT&&(y=new He({sources:[Qy]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:y,attributeLocations:wc})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let b,x,A,C,S=e.commandList;if(u.render||f){let v=this._colorCommands,P=this._blendOption===wo.OPAQUE,M=this._blendOption===wo.OPAQUE_AND_TRANSLUCENT;b=this._vaf.va,x=b.length,v.length=x;let R=M?x*2:x;for(C=0;C<R;++C){let L=P||M&&C%2===0;A=v[C],c(A)||(A=v[C]=new Qe),A.primitiveType=Me.POINTS,A.pass=L||!M?De.OPAQUE:De.TRANSLUCENT,A.owner=this;let F=M?Math.floor(C/2):C;A.boundingVolume=h,A.modelMatrix=p,A.shaderProgram=L?this._sp:this._spTranslucent,A.uniformMap=this._uniforms,A.vertexArray=b[F].va,A.renderState=L?this._rsOpaque:this._rsTranslucent,A.debugShowBoundingVolume=this.debugShowBoundingVolume,A.pickId="v_pickColor",S.push(A)}}};ed.prototype.isDestroyed=function(){return!1};ed.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),Ude(this._pointPrimitives),de(this)};var WE=ed;var Wde=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],kq=1,lN=8,fN=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[n,i]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");let o=i>>4;if(o!==kq)throw new Error(`Got v${o} data when expected v${kq}.`);let r=Wde[i&15];if(!r)throw new Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new e(a,s,r,t)}constructor(t,n=64,i=Float64Array,o){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let r=Wde.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,lN,t),this.coords=new this.ArrayType(this.data,lN+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(lN+s+a+l),this.ids=new this.IndexArrayType(this.data,lN,t),this.coords=new this.ArrayType(this.data,lN+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(kq<<4)+r]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=n,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vq(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:r,coords:s,nodeSize:a}=this,l=[0,r.length-1,0],u=[];for(;l.length;){let f=l.pop()||0,h=l.pop()||0,p=l.pop()||0;if(h-p<=a){for(let b=p;b<=h;b++){let x=s[2*b],A=s[2*b+1];x>=t&&x<=i&&A>=n&&A<=o&&u.push(r[b])}continue}let g=p+h>>1,m=s[2*g],y=s[2*g+1];m>=t&&m<=i&&y>=n&&y<=o&&u.push(r[g]),(f===0?t<=m:n<=y)&&(l.push(p),l.push(g-1),l.push(1-f)),(f===0?i>=m:o>=y)&&(l.push(g+1),l.push(h),l.push(1-f))}return u}within(t,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:r,nodeSize:s}=this,a=[0,o.length-1,0],l=[],u=i*i;for(;a.length;){let f=a.pop()||0,h=a.pop()||0,p=a.pop()||0;if(h-p<=s){for(let b=p;b<=h;b++)qde(r[2*b],r[2*b+1],t,n)<=u&&l.push(o[b]);continue}let g=p+h>>1,m=r[2*g],y=r[2*g+1];qde(m,y,t,n)<=u&&l.push(o[g]),(f===0?t-i<=m:n-i<=y)&&(a.push(p),a.push(g-1),a.push(1-f)),(f===0?t+i>=m:n+i>=y)&&(a.push(g+1),a.push(h),a.push(1-f))}return l}};function Vq(e,t,n,i,o,r){if(o-i<=n)return;let s=i+o>>1;Yde(e,t,s,i,o,r),Vq(e,t,n,i,s-1,1-r),Vq(e,t,n,s+1,o,1-r)}function Yde(e,t,n,i,o,r){for(;o>i;){if(o-i>600){let u=o-i+1,f=n-i+1,h=Math.log(u),p=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*p*(u-p)/u)*(f-u/2<0?-1:1),m=Math.max(i,Math.floor(n-f*p/u+g)),y=Math.min(o,Math.floor(n+(u-f)*p/u+g));Yde(e,t,n,m,y,r)}let s=t[2*n+r],a=i,l=o;for(uN(e,t,i,n),t[2*o+r]>s&&uN(e,t,i,o);a<l;){for(uN(e,t,a,l),a++,l--;t[2*a+r]<s;)a++;for(;t[2*l+r]>s;)l--}t[2*i+r]===s?uN(e,t,i,l):(l++,uN(e,t,l,o)),l<=n&&(i=l+1),n<=l&&(o=l-1)}}function uN(e,t,n,i){Uq(e,n,i),Uq(t,2*n,2*i),Uq(t,2*n+1,2*i+1)}function Uq(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function qde(e,t,n,i){let o=e-n,r=t-i;return o*o+r*r}function Th(e){e=e??W.EMPTY_OBJECT,this._enabled=e.enabled??!1,this._pixelRange=e.pixelRange??80,this._minimumClusterSize=e.minimumClusterSize??2,this._clusterBillboards=e.clusterBillboards??!0,this._clusterLabels=e.clusterLabels??!0,this._clusterPoints=e.clusterPoints??!0,this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new pe,this.show=e.show??!0}function Xde(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}var gZe=new Ke;function Kde(e,t,n,i,o){if(c(e._labelCollection)&&i._clusterLabels?o=Uy.getScreenSpaceBoundingBox(e,t,o):c(e._billboardCollection)&&i._clusterBillboards?o=lo.getScreenSpaceBoundingBox(e,t,o):c(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=Os.getScreenSpaceBoundingBox(e,t,o)),Xde(o,n),i._clusterLabels&&!c(e._labelCollection)&&c(e.id)&&Zde(i,e.id.id)&&c(e.id._label)){let r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Uy.getScreenSpaceBoundingBox(s,t,gZe);Xde(a,n),o=Ke.union(o,a,o)}return o}function yZe(e,t){if(e.clusterShow=!0,!c(e._labelCollection)&&c(e.id)&&Zde(t,e.id.id)&&c(e.id._label)){let n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function $de(e,t,n,i){let o={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=n,o.billboard.position=o.label.position=o.point.position=e,i._clusterEvent.raiseEvent(n,o)}function Zde(e,t){return c(e)&&c(e._collectionIndicesByEntity[t])&&c(e._collectionIndicesByEntity[t].labelIndex)}function zq(e,t,n,i,o){if(!c(e))return;let r=e.length;for(let s=0;s<r;++s){let a=e.get(s);if(a.clusterShow=!1,!a.show||o._scene.mode===oe.SCENE3D&&!i.isPointVisible(a.position))continue;let l=o._clusterLabels&&c(a._labelCollection),u=o._clusterBillboards&&c(a.id._billboard),f=o._clusterPoints&&c(a.id._point);if(l&&(f||u))continue;let h=a.computeScreenSpacePosition(n);c(h)&&t.push({index:s,collection:e,clustered:!1,coord:h})}}var bZe=new Ke,xZe=new Ke,TZe=new Ke;function AZe(e){return function(t){if(c(t)&&t<.05||!e.enabled)return;let n=e._scene,i=e._labelCollection,o=e._billboardCollection,r=e._pointCollection;if(!c(i)&&!c(o)&&!c(r)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let s=e._clusterLabelCollection,a=e._clusterBillboardCollection,l=e._clusterPointCollection;c(s)?s.removeAll():s=e._clusterLabelCollection=new Om({scene:n}),c(a)?a.removeAll():a=e._clusterBillboardCollection=new Ru({scene:n}),c(l)?l.removeAll():l=e._clusterPointCollection=new WE;let u=e._pixelRange,f=e._minimumClusterSize,h=e._previousClusters,p=[],g=e._previousHeight,m=n.camera.positionCartographic.height,y=n.ellipsoid,b=n.camera.positionWC,x=new H_(y,b),A=[];e._clusterLabels&&zq(i,A,n,x,e),e._clusterBillboards&&zq(o,A,n,x,e),e._clusterPoints&&zq(r,A,n,x,e);let C,S,v,P,M,R,L,F,_,w,D,I;if(A.length>0){let N=new fN(A.length,64,Uint32Array);for(let k=0;k<A.length;++k)N.add(A[k].coord.x,A[k].coord.y);if(N.finish(),m<g)for(v=h.length,C=0;C<v;++C){let k=h[C];if(!x.isPointVisible(k.position))continue;let z=lo._computeScreenSpacePosition(B.IDENTITY,k.position,d.ZERO,H.ZERO,n);if(!c(z))continue;let V=1-m/g,j=k.width=k.width*V,U=k.height=k.height*V;j=Math.max(j,k.minimumWidth),U=Math.max(U,k.minimumHeight);let q=z.x-j*.5,Y=z.y-U*.5,te=z.x+j,K=z.y+U;for(M=N.range(q,Y,te,K),R=M.length,w=0,_=[],S=0;S<R;++S)L=M[S],F=A[L],F.clustered||(++w,D=F.collection,I=F.index,_.push(D.get(I).id));if(w>=f)for($de(k.position,w,_,e),p.push(k),S=0;S<R;++S)A[M[S]].clustered=!0}for(v=A.length,C=0;C<v;++C){let k=A[C];if(k.clustered)continue;k.clustered=!0,D=k.collection,I=k.index;let z=D.get(I);P=Kde(z,k.coord,u,e,bZe);let V=Ke.clone(P,xZe);M=N.range(P.x,P.y,P.x+P.width,P.y+P.height),R=M.length;let j=d.clone(z.position);for(w=1,_=[z.id],S=0;S<R;++S)if(L=M[S],F=A[L],!F.clustered){let U=F.collection.get(F.index),q=Kde(U,F.coord,u,e,TZe);d.add(U.position,j,j),Ke.union(V,q,V),++w,_.push(U.id)}if(w>=f){let U=d.multiplyByScalar(j,1/w,j);for($de(U,w,_,e),p.push({position:U,width:V.width,height:V.height,minimumWidth:P.width,minimumHeight:P.height}),S=0;S<R;++S)A[M[S]].clustered=!0}else yZe(z,e)}}s.length===0&&(s.destroy(),e._clusterLabelCollection=void 0),a.length===0&&(a.destroy(),e._clusterBillboardCollection=void 0),l.length===0&&(l.destroy(),e._clusterPointCollection=void 0),e._previousClusters=p,e._previousHeight=m}}Th.prototype._initialize=function(e){this._scene=e;let t=AZe(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(Th.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}},ready:{get:function(){return!this._enabledDirty&&!this._clusterDirty&&(!c(this._billboardCollection)||this._billboardCollection.ready)&&(!c(this._labelCollection)||this._labelCollection.ready)}}});function Gq(e,t,n,i){return function(o){let r=this[e];c(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s=this._collectionIndicesByEntity[o.id];if(c(s)||(s=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),c(r)&&c(s[i]))return r.get(s[i]);c(r)||(r=this[e]=new t({scene:this._scene}));let a,l,u=this[n];u.length>0?(a=u.shift(),l=r.get(a)):(l=r.add(),a=r.length-1),s[i]=a;let f=this;return Promise.resolve().then(function(){f._clusterDirty=!0}),l}}function jq(e,t){let n=e._collectionIndicesByEntity[t];!c(n.billboardIndex)&&!c(n.labelIndex)&&!c(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Th.prototype.getLabel=Gq("_labelCollection",Om,"_unusedLabelIndices","labelIndex");Th.prototype.removeLabel=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._labelCollection)||!c(t)||!c(t.labelIndex))return;let n=t.labelIndex;t.labelIndex=void 0,jq(this,e.id);let i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0};Th.prototype.getBillboard=Gq("_billboardCollection",Ru,"_unusedBillboardIndices","billboardIndex");Th.prototype.removeBillboard=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._billboardCollection)||!c(t)||!c(t.billboardIndex))return;let n=t.billboardIndex;t.billboardIndex=void 0,jq(this,e.id);let i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0};Th.prototype.getPoint=Gq("_pointCollection",WE,"_unusedPointIndices","pointIndex");Th.prototype.removePoint=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._pointCollection)||!c(t)||!c(t.pointIndex))return;let n=t.pointIndex;t.pointIndex=void 0,jq(this,e.id);let i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function Hq(e){if(!c(e))return;let t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function CZe(e){e.enabled||(c(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),c(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),c(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,Hq(e._labelCollection),Hq(e._billboardCollection),Hq(e._pointCollection))}Th.prototype.update=function(e){if(!this.show)return;let t,n=this._labelCollection;c(n)&&n.length>0&&!n.ready&&(t=e.commandList,e.commandList=[],n.update(e),e.commandList=t);let i=this._billboardCollection;c(i)&&i.length>0&&!i.ready&&(t=e.commandList,e.commandList=[],i.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,CZe(this),this._clusterDirty=!0),this._clusterDirty&&(this._cluster(),this._clusterDirty=c(n)&&!n.ready||c(i)&&!i.ready),c(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),c(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),c(this._clusterPointCollection)&&this._clusterPointCollection.update(e),c(n)&&n.update(e),c(i)&&i.update(e),c(this._pointCollection)&&this._pointCollection.update(e)};Th.prototype.destroy=function(){c(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};var Bu=Th;function Wq(e){this._name=e,this._clock=void 0,this._changed=new pe,this._error=new pe,this._isLoading=!1,this._loading=new pe,this._entityCollection=new Qs(this),this._entityCluster=new Bu}Object.defineProperties(Wq.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){Kr.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}}});Wq.prototype.update=function(e){return!0};var dN=Wq;var Qde={};Qde.computePositions=function(e,t,n,i,o){let r=e*.5,s=-r,a=i+i,l=o?2*a:a,u=new Float64Array(l*3),f,h=0,p=0,g=o?a*3:0,m=o?(a+i)*3:i*3;for(f=0;f<i;f++){let y=f/i*O.TWO_PI,b=Math.cos(y),x=Math.sin(y),A=b*n,C=x*n,S=b*t,v=x*t;u[p+g]=A,u[p+g+1]=C,u[p+g+2]=s,u[p+m]=S,u[p+m+1]=v,u[p+m+2]=r,p+=3,o&&(u[h++]=A,u[h++]=C,u[h++]=s,u[h++]=S,u[h++]=v,u[h++]=r)}return u};var nT=Qde;var qq=new H,EZe=new d,SZe=new d,wZe=new d,vZe=new d;function G_(e){e=e??W.EMPTY_OBJECT;let t=e.length,n=e.topRadius,i=e.bottomRadius,o=e.vertexFormat??Ie.DEFAULT,r=e.slices??128;if(!c(t))throw new E("options.length must be defined.");if(!c(n))throw new E("options.topRadius must be defined.");if(!c(i))throw new E("options.bottomRadius must be defined.");if(r<3)throw new E("options.slices must be greater than or equal to 3.");if(c(e.offsetAttribute)&&e.offsetAttribute===Zt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Ie.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}G_.packedLength=Ie.packedLength+5;G_.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=e._offsetAttribute??-1,t};var Jde=new Ie,qE={vertexFormat:Jde,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};G_.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i=Ie.unpack(e,t,Jde);t+=Ie.packedLength;let o=e[t++],r=e[t++],s=e[t++],a=e[t++],l=e[t];return c(n)?(n._vertexFormat=Ie.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=l===-1?void 0:l,n):(qE.length=o,qE.topRadius=r,qE.bottomRadius=s,qE.slices=a,qE.offsetAttribute=l===-1?void 0:l,new G_(qE))};G_.createGeometry=function(e){let t=e._length,n=e._topRadius,i=e._bottomRadius,o=e._vertexFormat,r=e._slices;if(t<=0||n<0||i<0||n===0&&i===0)return;let s=r+r,a=r+s,l=s+s,u=nT.computePositions(t,n,i,r,!0),f=o.st?new Float32Array(l*2):void 0,h=o.normal?new Float32Array(l*3):void 0,p=o.tangent?new Float32Array(l*3):void 0,g=o.bitangent?new Float32Array(l*3):void 0,m,y=o.normal||o.tangent||o.bitangent;if(y){let M=o.tangent||o.bitangent,R=0,L=0,F=0,_=Math.atan2(i-n,t),w=EZe;w.z=Math.sin(_);let D=Math.cos(_),I=wZe,N=SZe;for(m=0;m<r;m++){let k=m/r*O.TWO_PI,z=D*Math.cos(k),V=D*Math.sin(k);y&&(w.x=z,w.y=V,M&&(I=d.normalize(d.cross(d.UNIT_Z,w,I),I)),o.normal&&(h[R++]=w.x,h[R++]=w.y,h[R++]=w.z,h[R++]=w.x,h[R++]=w.y,h[R++]=w.z),o.tangent&&(p[L++]=I.x,p[L++]=I.y,p[L++]=I.z,p[L++]=I.x,p[L++]=I.y,p[L++]=I.z),o.bitangent&&(N=d.normalize(d.cross(w,I,N),N),g[F++]=N.x,g[F++]=N.y,g[F++]=N.z,g[F++]=N.x,g[F++]=N.y,g[F++]=N.z))}for(m=0;m<r;m++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=-1),o.tangent&&(p[L++]=1,p[L++]=0,p[L++]=0),o.bitangent&&(g[F++]=0,g[F++]=-1,g[F++]=0);for(m=0;m<r;m++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=1),o.tangent&&(p[L++]=1,p[L++]=0,p[L++]=0),o.bitangent&&(g[F++]=0,g[F++]=1,g[F++]=0)}let b=12*r-12,x=Fe.createTypedArray(l,b),A=0,C=0;for(m=0;m<r-1;m++)x[A++]=C,x[A++]=C+2,x[A++]=C+3,x[A++]=C,x[A++]=C+3,x[A++]=C+1,C+=2;for(x[A++]=s-2,x[A++]=0,x[A++]=1,x[A++]=s-2,x[A++]=1,x[A++]=s-1,m=1;m<r-1;m++)x[A++]=s+m+1,x[A++]=s+m,x[A++]=s;for(m=1;m<r-1;m++)x[A++]=a,x[A++]=a+m,x[A++]=a+m+1;let S=0;if(o.st){let M=Math.max(n,i);for(m=0;m<l;m++){let R=d.fromArray(u,m*3,vZe);f[S++]=(R.x+M)/(2*M),f[S++]=(R.y+M)/(2*M)}}let v=new fn;o.position&&(v.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:u})),o.normal&&(v.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:h})),o.tangent&&(v.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:p})),o.bitangent&&(v.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(v.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:f})),qq.x=t*.5,qq.y=Math.max(i,n);let P=new le(d.ZERO,H.magnitude(qq));if(c(e._offsetAttribute)){t=u.length;let M=e._offsetAttribute===Zt.NONE?0:1,R=new Uint8Array(t/3).fill(M);v.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:R})}return new ct({attributes:v,indices:x,primitiveType:Me.TRIANGLES,boundingSphere:P,offsetAttribute:e._offsetAttribute})};var Yq;G_.getUnitCylinder=function(){return c(Yq)||(Yq=G_.createGeometry(new G_({topRadius:1,bottomRadius:1,length:1,vertexFormat:Ie.POSITION_ONLY}))),Yq};var hN=G_;var Xq=new H;function YE(e){e=e??W.EMPTY_OBJECT;let t=e.length,n=e.topRadius,i=e.bottomRadius,o=e.slices??128,r=Math.max(e.numberOfVerticalLines??16,0);if(T.typeOf.number("options.positions",t),T.typeOf.number("options.topRadius",n),T.typeOf.number("options.bottomRadius",i),T.typeOf.number.greaterThanOrEquals("options.slices",o,3),c(e.offsetAttribute)&&e.offsetAttribute===Zt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}YE.packedLength=6;YE.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=e._offsetAttribute??-1,t};var iT={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};YE.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],l=e[t];return c(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=l===-1?void 0:l,n):(iT.length=i,iT.topRadius=o,iT.bottomRadius=r,iT.slices=s,iT.numberOfVerticalLines=a,iT.offsetAttribute=l===-1?void 0:l,new YE(iT))};YE.createGeometry=function(e){let t=e._length,n=e._topRadius,i=e._bottomRadius,o=e._slices,r=e._numberOfVerticalLines;if(t<=0||n<0||i<0||n===0&&i===0)return;let s=o*2,a=nT.computePositions(t,n,i,o,!1),l=o*2,u;if(r>0){let y=Math.min(r,o);u=Math.round(o/y),l+=y}let f=Fe.createTypedArray(s,l*2),h=0,p;for(p=0;p<o-1;p++)f[h++]=p,f[h++]=p+1,f[h++]=p+o,f[h++]=p+1+o;if(f[h++]=o-1,f[h++]=0,f[h++]=o+o-1,f[h++]=o,r>0)for(p=0;p<o;p+=u)f[h++]=p,f[h++]=p+o;let g=new fn;g.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:a}),Xq.x=t*.5,Xq.y=Math.max(i,n);let m=new le(d.ZERO,H.magnitude(Xq));if(c(e._offsetAttribute)){t=a.length;let y=e._offsetAttribute===Zt.NONE?0:1,b=new Uint8Array(t/3).fill(y);g.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}return new ct({attributes:g,indices:f,primitiveType:Me.LINES,boundingSphere:m,offsetAttribute:e._offsetAttribute})};var mN=YE;var ehe=d.ZERO,the=new d,DZe=new d,nhe=new G;function PZe(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function ku(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new PZe(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}c(Object.create)&&(ku.prototype=Object.create(ii.prototype),ku.prototype.constructor=ku);Object.defineProperties(ku.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});ku.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i=new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=kn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Ut){let a;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,nhe)),c(a)||(a=G.WHITE),s.color=Gt.fromColor(a)}return c(this._options.offsetAttribute)&&(s.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,ehe,the))),new St({id:t,geometry:new hN(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.ellipsoid),attributes:s})};ku.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,nhe),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,ehe,the))),new St({id:t,geometry:new mN(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.ellipsoid),attributes:r})};ku.prototype._computeCenter=function(e,t){return X.getValueOrUndefined(this._entity.position,e,t)};ku.prototype._isHidden=function(e,t){return!c(e.position)||!c(t.length)||!c(t.topRadius)||!c(t.bottomRadius)||ii.prototype._isHidden.call(this,e,t)};ku.prototype._isDynamic=function(e,t){return!e.position.isConstant||!X.isConstant(e.orientation)||!t.length.isConstant||!t.topRadius.isConstant||!t.bottomRadius.isConstant||!X.isConstant(t.slices)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.numberOfVerticalLines)};ku.prototype._setStaticOptions=function(e,t){let n=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Ut?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(Ge.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(Ge.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(Ge.MINIMUM_VALUE),i.slices=X.getValueOrUndefined(t.slices,Ge.MINIMUM_VALUE),i.numberOfVerticalLines=X.getValueOrUndefined(t.numberOfVerticalLines,Ge.MINIMUM_VALUE),i.offsetAttribute=n!==We.NONE?Zt.ALL:void 0};ku.prototype._onEntityPropertyChanged=qp;ku.DynamicGeometryUpdater=XE;function XE(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(XE.prototype=Object.create(ni.prototype),XE.prototype.constructor=XE);XE.prototype._isHidden=function(e,t,n){let i=this._options,o=X.getValueOrUndefined(e.position,n,DZe);return!c(o)||!c(i.length)||!c(i.topRadius)||!c(i.bottomRadius)||ni.prototype._isHidden.call(this,e,t,n)};XE.prototype._setOptions=function(e,t,n){let i=X.getValueOrDefault(t.heightReference,n,We.NONE),o=this._options;o.length=X.getValueOrUndefined(t.length,n),o.topRadius=X.getValueOrUndefined(t.topRadius,n),o.bottomRadius=X.getValueOrUndefined(t.bottomRadius,n),o.slices=X.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=X.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==We.NONE?Zt.ALL:void 0};var pN=ku;var IZe={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},$r=Object.freeze(IZe);var OZe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},mo=Object.freeze(OZe);var RZe={NONE:0,HOLD:1,EXTRAPOLATE:2,LINEAR_EXTRAPOLATE:3},cl=Object.freeze(RZe);var ihe=Zo(du(),1);function MZe(e){if(!c(e))throw new E("uri is required.");let t=new ihe.default(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),n}var j_=MZe;var LZe=O.factorial;function Kq(e,t,n,i,o,r){let s=0,a,l,u;if(i>0){for(l=0;l<o;l++){for(a=!1,u=0;u<r.length&&!a;u++)l===r[u]&&(a=!0);a||(r.push(l),s+=Kq(e,t,n,i-1,o,r),r.splice(r.length-1,1))}return s}for(s=1,l=0;l<o;l++){for(a=!1,u=0;u<r.length&&!a;u++)l===r[u]&&(a=!0);a||(s*=e-n[t[l]])}return s}var l4={type:"Hermite"};l4.getRequiredDataPoints=function(e,t){if(t=t??0,!c(e))throw new E("degree is required.");if(e<0)throw new E("degree must be 0 or greater.");if(t<0)throw new E("inputOrder must be 0 or greater.");return Math.max(Math.floor((e+1)/(t+1)),2)};l4.interpolateOrderZero=function(e,t,n,i,o){c(o)||(o=new Array(i));let r,s,a,l,u,f,h=t.length,p=new Array(i);for(r=0;r<i;r++){o[r]=0;let b=new Array(h);for(p[r]=b,s=0;s<h;s++)b[s]=[]}let g=h,m=new Array(g);for(r=0;r<g;r++)m[r]=r;let y=h-1;for(l=0;l<i;l++){for(s=0;s<g;s++)f=m[s]*i+l,p[l][0].push(n[f]);for(r=1;r<g;r++){let b=!1;for(s=0;s<g-r;s++){let x=t[m[s]],A=t[m[s+r]],C;A-x<=0?(f=m[s]*i+i*r+l,C=n[f],p[l][r].push(C/LZe(r))):(C=p[l][r-1][s+1]-p[l][r-1][s],p[l][r].push(C/(A-x))),b=b||C!==0}b||(y=r-1)}}for(a=0,u=0;a<=u;a++)for(r=a;r<=y;r++){let b=Kq(e,m,t,a,r,[]);for(l=0;l<i;l++){let x=p[l][r][0];o[l+a*i]+=x*b}}return o};var NZe=[];l4.interpolate=function(e,t,n,i,o,r,s){let a=i*(r+1);c(s)||(s=new Array(a));for(let x=0;x<a;x++)s[x]=0;let l=t.length,u=new Array(l*(o+1)),f;for(f=0;f<l;f++)for(let x=0;x<o+1;x++)u[f*(o+1)+x]=f;let h=u.length,p=NZe,g=FZe(p,u,t,n,i,o),m=[],y=h*(h+1)/2,b=Math.min(g,r);for(let x=0;x<=b;x++)for(f=x;f<=g;f++){m.length=0;let A=Kq(e,u,t,x,f,m),C=Math.floor(f*(1-f)/2)+h*f;for(let S=0;S<i;S++){let v=Math.floor(S*y),P=p[v+C];s[S+x*i]+=P*A}}return s};function FZe(e,t,n,i,o,r){let s,a,l=-1,u=t.length,f=u*(u+1)/2;for(let h=0;h<o;h++){let p=Math.floor(h*f);for(s=0;s<u;s++)a=t[s]*o*(r+1)+h,e[p+s]=i[a];for(let g=1;g<u;g++){let m=0,y=Math.floor(g*(1-g)/2)+u*g,b=!1;for(s=0;s<u-g;s++){let x=n[t[s]],A=n[t[s+g]],C,S;if(A-x<=0)a=t[s]*o*(r+1)+o*g+h,C=i[a],S=C/O.factorial(g),e[p+y+m]=S,m++;else{let v=Math.floor((g-1)*(2-g)/2)+u*(g-1);C=e[p+v+s+1]-e[p+v+s],S=C/(A-x),e[p+y+m]=S,m++}b=b||C!==0}b&&(l=Math.max(l,g))}}return l}var _N=l4;var $q={type:"Lagrange"};$q.getRequiredDataPoints=function(e){return Math.max(e+1,2)};$q.interpolateOrderZero=function(e,t,n,i,o){c(o)||(o=new Array(i));let r,s,a=t.length;for(r=0;r<i;r++)o[r]=0;for(r=0;r<a;r++){let l=1;for(s=0;s<a;s++)if(s!==r){let u=t[r]-t[s];l*=(e-t[s])/u}for(s=0;s<i;s++)o[s]+=l*n[r*i+s]}return o};var gN=$q;var Zq={type:"Linear"};Zq.getRequiredDataPoints=function(e){return 2};Zq.interpolateOrderZero=function(e,t,n,i,o){if(t.length!==2)throw new E("The xTable provided to the linear interpolator must have exactly two elements.");if(i<=0)throw new E("There must be at least 1 dependent variable for each independent variable.");c(o)||(o=new Array(i));let r,s,a,l=t[0],u=t[1];if(l===u)throw new E("Divide by zero error: xTable[0] and xTable[1] are equal");for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+u*s-l*a)/(u-l);return o};var Jy=Zq;function vc(e,t,n){this.clock=e??0,this.cone=t??0,this.magnitude=n??1}vc.fromCartesian3=function(e,t){T.typeOf.object("cartesian3",e);let n=e.x,i=e.y,o=e.z,r=n*n+i*i;return c(t)||(t=new vc),t.clock=Math.atan2(i,n),t.cone=Math.atan2(Math.sqrt(r),o),t.magnitude=Math.sqrt(r+o*o),t};vc.clone=function(e,t){if(c(e))return c(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new vc(e.clock,e.cone,e.magnitude)};vc.normalize=function(e,t){return T.typeOf.object("spherical",e),c(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new vc(e.clock,e.cone,1)};vc.equals=function(e,t){return e===t||c(e)&&c(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude};vc.equalsEpsilon=function(e,t,n){return n=n??0,e===t||c(e)&&c(t)&&Math.abs(e.clock-t.clock)<=n&&Math.abs(e.cone-t.cone)<=n&&Math.abs(e.magnitude-t.magnitude)<=n};vc.prototype.equals=function(e){return vc.equals(this,e)};vc.prototype.clone=function(e){return vc.clone(this,e)};vc.prototype.equalsEpsilon=function(e,t){return vc.equalsEpsilon(this,e,t)};vc.prototype.toString=function(){return`(${this.clock}, ${this.cone}, ${this.magnitude})`};var yN=vc;var CN=Zo(du(),1);var Qq;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?Qq=function(){return performance.now()}:Qq=function(){return Date.now()};var Ti=Qq;function Jq(e){e=e??W.EMPTY_OBJECT;let t=e.currentTime,n=e.startTime,i=e.stopTime;if(c(t)?t=Q.clone(t):c(n)?t=Q.clone(n):c(i)?t=Q.addDays(i,-1,new Q):t=Q.now(),c(n)?n=Q.clone(n):n=Q.clone(t),c(i)?i=Q.clone(i):i=Q.addDays(n,1,new Q),Q.greaterThan(n,i))throw new E("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=e.clockRange??$r.UNBOUNDED,this.canAnimate=e.canAnimate??!0,this.onTick=new pe,this.onStop=new pe,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=Ti(),this.currentTime=t,this.multiplier=e.multiplier??1,this.shouldAnimate=e.shouldAnimate??!1,this.clockStep=e.clockStep??mo.SYSTEM_CLOCK_MULTIPLIER}Object.defineProperties(Jq.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){Q.equals(this._currentTime,e)||(this._clockStep===mo.SYSTEM_CLOCK&&(this._clockStep=mo.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===mo.SYSTEM_CLOCK&&(this._clockStep=mo.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===mo.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=Q.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===mo.SYSTEM_CLOCK&&(this._clockStep=mo.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});Jq.prototype.tick=function(){let e=Ti(),t=Q.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){let n=this._clockStep;if(n===mo.SYSTEM_CLOCK)t=Q.now(t);else{let i=this._multiplier;if(n===mo.TICK_DEPENDENT)t=Q.addSeconds(t,i,t);else{let a=e-this._lastSystemTime;t=Q.addSeconds(t,i*(a/1e3),t)}let o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===$r.CLAMPED)Q.lessThan(t,r)?t=Q.clone(r,t):Q.greaterThan(t,s)&&(t=Q.clone(s,t),this.onStop.raiseEvent(this));else if(o===$r.LOOP_STOP)for(Q.lessThan(t,r)&&(t=Q.clone(r,t));Q.greaterThan(t,s);)t=Q.addSeconds(r,Q.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};var Ah=Jq;function oT(){this._definitionChanged=new pe,this._startTime=void 0,this._stopTime=void 0,this._currentTime=void 0,this._clockRange=void 0,this._clockStep=void 0,this._multiplier=void 0}Object.defineProperties(oT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:Yc("startTime"),stopTime:Yc("stopTime"),currentTime:Yc("currentTime"),clockRange:Yc("clockRange"),clockStep:Yc("clockStep"),multiplier:Yc("multiplier")});oT.prototype.clone=function(e){return c(e)||(e=new oT),e.startTime=this.startTime,e.stopTime=this.stopTime,e.currentTime=this.currentTime,e.clockRange=this.clockRange,e.clockStep=this.clockStep,e.multiplier=this.multiplier,e};oT.prototype.equals=function(e){return this===e||c(e)&&Q.equals(this.startTime,e.startTime)&&Q.equals(this.stopTime,e.stopTime)&&Q.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier};oT.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.startTime=this.startTime??e.startTime,this.stopTime=this.stopTime??e.stopTime,this.currentTime=this.currentTime??e.currentTime,this.clockRange=this.clockRange??e.clockRange,this.clockStep=this.clockStep??e.clockStep,this.multiplier=this.multiplier??e.multiplier};oT.prototype.getValue=function(e){return c(e)||(e=new Ah),e.startTime=this.startTime??e.startTime,e.stopTime=this.stopTime??e.stopTime,e.currentTime=this.currentTime??e.currentTime,e.clockRange=this.clockRange??e.clockRange,e.multiplier=this.multiplier??e.multiplier,e.clockStep=this.clockStep??e.clockStep,e};var Ch=oT;var BZe=G.WHITE,kZe=.1,UZe=new H(8,8),VZe=new H(0,0),zZe=new H(1,1);function KE(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this._cellAlpha=void 0,this._cellAlphaSubscription=void 0,this._lineCount=void 0,this._lineCountSubscription=void 0,this._lineThickness=void 0,this._lineThicknessSubscription=void 0,this._lineOffset=void 0,this._lineOffsetSubscription=void 0,this.color=e.color,this.cellAlpha=e.cellAlpha,this.lineCount=e.lineCount,this.lineThickness=e.lineThickness,this.lineOffset=e.lineOffset}Object.defineProperties(KE.prototype,{isConstant:{get:function(){return X.isConstant(this._color)&&X.isConstant(this._cellAlpha)&&X.isConstant(this._lineCount)&&X.isConstant(this._lineThickness)&&X.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color"),cellAlpha:fe("cellAlpha"),lineCount:fe("lineCount"),lineThickness:fe("lineThickness"),lineOffset:fe("lineOffset")});KE.prototype.getType=function(e){return"Grid"};var HZe=new Q;KE.prototype.getValue=function(e,t){return c(e)||(e=Q.now(HZe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,BZe,t.color),t.cellAlpha=X.getValueOrDefault(this._cellAlpha,e,kZe),t.lineCount=X.getValueOrClonedDefault(this._lineCount,e,UZe,t.lineCount),t.lineThickness=X.getValueOrClonedDefault(this._lineThickness,e,zZe,t.lineThickness),t.lineOffset=X.getValueOrClonedDefault(this._lineOffset,e,VZe,t.lineOffset),t};KE.prototype.equals=function(e){return this===e||e instanceof KE&&X.equals(this._color,e._color)&&X.equals(this._cellAlpha,e._cellAlpha)&&X.equals(this._lineCount,e._lineCount)&&X.equals(this._lineThickness,e._lineThickness)&&X.equals(this._lineOffset,e._lineOffset)};var $E=KE;function ZE(e){this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(ZE.prototype,{isConstant:{get:function(){return X.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color")});ZE.prototype.getType=function(e){return"PolylineArrow"};var GZe=new Q;ZE.prototype.getValue=function(e,t){return c(e)||(e=Q.now(GZe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,G.WHITE,t.color),t};ZE.prototype.equals=function(e){return this===e||e instanceof ZE&&X.equals(this._color,e._color)};var QE=ZE;var jZe=G.WHITE,WZe=G.TRANSPARENT,qZe=16,YZe=255;function JE(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this._gapColor=void 0,this._gapColorSubscription=void 0,this._dashLength=void 0,this._dashLengthSubscription=void 0,this._dashPattern=void 0,this._dashPatternSubscription=void 0,this.color=e.color,this.gapColor=e.gapColor,this.dashLength=e.dashLength,this.dashPattern=e.dashPattern}Object.defineProperties(JE.prototype,{isConstant:{get:function(){return X.isConstant(this._color)&&X.isConstant(this._gapColor)&&X.isConstant(this._dashLength)&&X.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color"),gapColor:fe("gapColor"),dashLength:fe("dashLength"),dashPattern:fe("dashPattern")});JE.prototype.getType=function(e){return"PolylineDash"};var XZe=new Q;JE.prototype.getValue=function(e,t){return c(e)||(e=Q.now(XZe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,jZe,t.color),t.gapColor=X.getValueOrClonedDefault(this._gapColor,e,WZe,t.gapColor),t.dashLength=X.getValueOrDefault(this._dashLength,e,qZe,t.dashLength),t.dashPattern=X.getValueOrDefault(this._dashPattern,e,YZe,t.dashPattern),t};JE.prototype.equals=function(e){return this===e||e instanceof JE&&X.equals(this._color,e._color)&&X.equals(this._gapColor,e._gapColor)&&X.equals(this._dashLength,e._dashLength)&&X.equals(this._dashPattern,e._dashPattern)};var eS=JE;var KZe=G.WHITE,$Ze=.25,ZZe=1;function tS(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this._glowPower=void 0,this._glowPowerSubscription=void 0,this._taperPower=void 0,this._taperPowerSubscription=void 0,this.color=e.color,this.glowPower=e.glowPower,this.taperPower=e.taperPower}Object.defineProperties(tS.prototype,{isConstant:{get:function(){return X.isConstant(this._color)&&X.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color"),glowPower:fe("glowPower"),taperPower:fe("taperPower")});tS.prototype.getType=function(e){return"PolylineGlow"};var QZe=new Q;tS.prototype.getValue=function(e,t){return c(e)||(e=Q.now(QZe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,KZe,t.color),t.glowPower=X.getValueOrDefault(this._glowPower,e,$Ze,t.glowPower),t.taperPower=X.getValueOrDefault(this._taperPower,e,ZZe,t.taperPower),t};tS.prototype.equals=function(e){return this===e||e instanceof tS&&X.equals(this._color,e._color)&&X.equals(this._glowPower,e._glowPower)&&X.equals(this._taperPower,e._taperPower)};var nS=tS;var JZe=G.WHITE,eQe=G.BLACK,tQe=1;function iS(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this.color=e.color,this.outlineColor=e.outlineColor,this.outlineWidth=e.outlineWidth}Object.defineProperties(iS.prototype,{isConstant:{get:function(){return X.isConstant(this._color)&&X.isConstant(this._outlineColor)&&X.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:fe("color"),outlineColor:fe("outlineColor"),outlineWidth:fe("outlineWidth")});iS.prototype.getType=function(e){return"PolylineOutline"};var nQe=new Q;iS.prototype.getValue=function(e,t){return c(e)||(e=Q.now(nQe)),c(t)||(t={}),t.color=X.getValueOrClonedDefault(this._color,e,JZe,t.color),t.outlineColor=X.getValueOrClonedDefault(this._outlineColor,e,eQe,t.outlineColor),t.outlineWidth=X.getValueOrDefault(this._outlineWidth,e,tQe),t};iS.prototype.equals=function(e){return this===e||e instanceof iS&&X.equals(this._color,e._color)&&X.equals(this._outlineColor,e._outlineColor)&&X.equals(this._outlineWidth,e._outlineWidth)};var e0=iS;function W_(e,t){this._value=void 0,this._definitionChanged=new pe,this._eventHelper=new gr,this._referenceFrame=t??Hi.FIXED,this.setValue(e)}Object.defineProperties(W_.prototype,{isConstant:{get:function(){let e=this._value;if(!c(e))return!0;let t=e.length;for(let n=0;n<t;n++)if(!X.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});var iQe=new Q;W_.prototype.getValue=function(e,t){return c(e)||(e=Q.now(iQe)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};W_.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");let i=this._value;if(!c(i))return;let o=i.length;c(n)||(n=new Array(o));let r=0,s=0;for(;r<o;){let l=i[r].getValueInReferenceFrame(e,t,n[r]);c(l)&&(n[s]=l,s++),r++}return n.length=s,n};W_.prototype.setValue=function(e){let t=this._eventHelper;if(t.removeAll(),c(e)){this._value=e.slice();let n=e.length;for(let i=0;i<n;i++){let o=e[i];c(o)&&t.add(o.definitionChanged,W_.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)};W_.prototype.equals=function(e){return this===e||e instanceof W_&&this._referenceFrame===e._referenceFrame&&X.arrayEquals(this._value,e._value)};W_.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var q_=W_;function t0(e){this._value=void 0,this._definitionChanged=new pe,this._eventHelper=new gr,this.setValue(e)}Object.defineProperties(t0.prototype,{isConstant:{get:function(){let e=this._value;if(!c(e))return!0;let t=e.length;for(let n=0;n<t;n++)if(!X.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});var oQe=new Q;t0.prototype.getValue=function(e,t){c(e)||(e=Q.now(oQe));let n=this._value;if(!c(n))return;let i=n.length;c(t)||(t=new Array(i));let o=0,r=0;for(;o<i;){let a=this._value[o].getValue(e,t[o]);c(a)&&(t[r]=a,r++),o++}return t.length=r,t};t0.prototype.setValue=function(e){let t=this._eventHelper;if(t.removeAll(),c(e)){this._value=e.slice();let n=e.length;for(let i=0;i<n;i++){let o=e[i];c(o)&&t.add(o.definitionChanged,t0.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)};t0.prototype.equals=function(e){return this===e||e instanceof t0&&X.arrayEquals(this._value,e._value)};t0.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var oS=t0;function rT(e){let t=e._targetProperty;if(!c(t)){let n=e._targetEntity;if(!c(n)){if(n=e._targetCollection.getById(e._targetId),!c(n)){e._targetEntity=e._targetProperty=void 0;return}n.definitionChanged.addEventListener(Uu.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}let i=e._targetPropertyNames;t=e._targetEntity;for(let o=0,r=i.length;o<r&&c(t);++o)t=t[i[o]];e._targetProperty=t}return t}function Uu(e,t,n){if(!c(e))throw new E("targetCollection is required.");if(!c(t)||t==="")throw new E("targetId is required.");if(!c(n)||n.length===0)throw new E("targetPropertyNames is required.");for(let i=0;i<n.length;i++){let o=n[i];if(!c(o)||o==="")throw new E("reference contains invalid properties.")}this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new pe,e.collectionChanged.addEventListener(Uu.prototype._onCollectionChanged,this)}Object.defineProperties(Uu.prototype,{isConstant:{get:function(){return X.isConstant(rT(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){let e=rT(this);return c(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return rT(this)}}});Uu.fromString=function(e,t){if(!c(e))throw new E("targetCollection is required.");if(!c(t))throw new E("referenceString is required.");let n,i=[],o=!0,r=!1,s="";for(let a=0;a<t.length;++a){let l=t.charAt(a);r?(s+=l,r=!1):l==="\\"?r=!0:o&&l==="#"?(n=s,o=!1,s=""):!o&&l==="."?(i.push(s),s=""):s+=l}return i.push(s),new Uu(e,n,i)};var rQe=new Q;Uu.prototype.getValue=function(e,t){let n=rT(this);return c(e)||(e=Q.now(rQe)),c(n)?n.getValue(e,t):void 0};Uu.prototype.getValueInReferenceFrame=function(e,t,n){let i=rT(this);return c(i)?i.getValueInReferenceFrame(e,t,n):void 0};Uu.prototype.getType=function(e){let t=rT(this);return c(t)?t.getType(e):void 0};Uu.prototype.equals=function(e){if(this===e)return!0;let t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;let i=this._targetPropertyNames.length;for(let o=0;o<i;o++)if(t[o]!==n[o])return!1;return!0};Uu.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){c(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};Uu.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;c(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(Uu.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):c(i)||(i=rT(this),c(i)&&this._definitionChanged.raiseEvent(this))};var Y_=Uu;var sQe={packedLength:1,pack:function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,t[n]=e,t},unpack:function(e,t,n){if(!c(e))throw new E("array is required");return t=t??0,e[t]},convertPackedArrayForInterpolation:function(e,t,n,i){if(!c(e))throw new E("packedArray is required");c(i)||(i=[]),t=t??0,n=n??e.length;let o;for(let r=0,s=n-t+1;r<s;r++){let a=e[t+r];r===0||Math.abs(o-a)<Math.PI?i[r]=a:i[r]=a-O.TWO_PI,o=a}},unpackInterpolationResult:function(e,t,n,i,o){if(!c(e))throw new E("array is required");if(!c(t))throw new E("sourceArray is required");return o=e[0],o<0?o+O.TWO_PI:o}},td=sQe;var ohe={packedLength:1,pack:function(e,t,n){n=n??0,t[n]=e},unpack:function(e,t,n){return t=t??0,e[t]}};function rhe(e,t,n){let i,o=e.length,r=n.length,s=o+r;if(e.length=s,o!==t){let a=o-1;for(i=s-1;i>=t;i--)e[i]=e[a--]}for(i=0;i<r;i++)e[t++]=n[i]}function she(e,t){return e instanceof Q?e:typeof e=="string"?Q.fromIso8601(e):Q.addSeconds(t,e,new Q)}var e7=[],t7=[];function u4(e,t,n,i,o){let r=0,s,a,l,u,f,h;for(;r<i.length;){f=she(i[r],e),l=Lo(t,f,Q.compare);let p=0,g=0;if(l<0){for(l=~l,u=l*o,a=void 0,h=t[l];r<i.length&&(f=she(i[r],e),!(c(a)&&Q.compare(a,f)>=0||c(h)&&Q.compare(f,h)>=0));){for(e7[p++]=f,r=r+1,s=0;s<o;s++)t7[g++]=i[r],r=r+1;a=f}p>0&&(t7.length=g,rhe(n,u,t7),e7.length=p,rhe(t,l,e7))}else{for(s=0;s<o;s++)r++,n[l*o+s]=i[r];r++}}}function nd(e,t){T.defined("type",e);let n=e;n===Number&&(n=ohe);let i=n.packedLength,o=n.packedInterpolationLength??i,r=0,s;if(c(t)){let a=t.length;s=new Array(a);for(let l=0;l<a;l++){let u=t[l];u===Number&&(u=ohe);let f=u.packedLength;i+=f,o+=u.packedInterpolationLength??f,s[l]=u}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=Jy,this._lastInterpolationAlgorithm=Jy,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=i,this._packedInterpolationLength=o,this._updateTableLength=!0,this._interpolationResult=new Array(o),this._definitionChanged=new pe,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=cl.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=cl.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(nd.prototype,{isConstant:{get:function(){return this._values.length===0}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}});var aQe=new Q;nd.prototype.getValue=function(e,t){c(e)||(e=Q.now(aQe));let n=this._times,i=n.length;if(i===0)return;let o,r=this._innerType,s=this._values,a=Lo(n,e,Q.compare);var l=!1;if(a<0){if(a=~a,a===0){let P=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===cl.NONE||o!==0&&Q.secondsDifference(P,e)>o)return;if(this._backwardExtrapolationType===cl.HOLD)return r.unpack(s,0,t);l=this._backwardExtrapolationType===cl.LINEAR_EXTRAPOLATE}if(a>=i){a=i-1;let P=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===cl.NONE||o!==0&&Q.secondsDifference(e,P)>o)return;if(this._forwardExtrapolationType===cl.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t);l=this._forwardExtrapolationType===cl.LINEAR_EXTRAPOLATE}let h=this._xTable,p=this._yTable;var u,f;l?(u=Cesium.LinearApproximation,f=1):(u=this._interpolationAlgorithm,f=this._interpolationDegree),this._lastInterpolationAlgorithm!=u&&(this._lastInterpolationAlgorithm=u,this._updateTableLength=!0);let g=this._packedInterpolationLength,m=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;let P=Math.min(u.getRequiredDataPoints(f,m),i);P!==this._numberOfPoints&&(this._numberOfPoints=P,h.length=P,p.length=P*g)}let y=this._numberOfPoints-1;if(y<1)return;let b=0,x=i-1;if(x-b+1>=y+1){let P=a-(y/2|0)-1;P<b&&(P=b);let M=P+y;M>x&&(M=x,P=M-y,P<b&&(P=b)),b=P,x=M}let C=x-b+1;for(let P=0;P<C;++P)h[P]=Q.secondsDifference(n[b+P],n[x]);if(c(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,b,x,p);else{let P=0,M=this._packedLength,R=b*M,L=(x+1)*M;for(;R<L;)p[P]=s[R],R++,P++}let S=Q.secondsDifference(e,n[x]),v;if(m===0||!c(u.interpolate))v=u.interpolateOrderZero(S,h,p,g,this._interpolationResult);else{let P=Math.floor(g/(m+1));v=u.interpolate(S,h,p,P,m,m,this._interpolationResult)}return c(r.unpackInterpolationResult)?r.unpackInterpolationResult(v,s,b,x,t):r.unpack(v,0,t)}return r.unpack(s,a*this._packedLength,t)};nd.prototype.setInterpolationOptions=function(e){if(!c(e))return;let t=!1,n=e.interpolationAlgorithm,i=e.interpolationDegree;c(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),c(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))};nd.prototype.addSample=function(e,t,n){let i=this._innerDerivativeTypes,o=c(i);T.defined("time",e),T.defined("value",t),o&&T.defined("derivatives",n);let r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){let a=i.length;for(let l=0;l<a;l++)i[l].pack(n[l],s,s.length)}u4(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};nd.prototype.addSamples=function(e,t,n){let i=this._innerDerivativeTypes,o=c(i);if(T.defined("times",e),T.defined("values",t),e.length!==t.length)throw new E("times and values must be the same length.");if(o&&(!c(n)||n.length!==e.length))throw new E("times and derivativeValues must be the same length.");let r=this._innerType,s=e.length,a=[];for(let l=0;l<s;l++)if(a.push(e[l]),r.pack(t[l],a,a.length),o){let u=n[l],f=i.length;for(let h=0;h<f;h++)i[h].pack(u[h],a,a.length)}u4(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};nd.prototype.getSample=function(e){T.typeOf.number("index",e);let t=this._times,n=t.length;if(c(n))return e<0&&(e+=n),t[e]};nd.prototype.addSamplesPackedArray=function(e,t){T.defined("packedSamples",e),u4(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};nd.prototype.removeSample=function(e){T.defined("time",e);let t=Lo(this._times,e,Q.compare);return t<0?!1:(ahe(this,t,1),!0)};function ahe(e,t,n){let i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}nd.prototype.removeSamples=function(e){T.defined("timeInterval",e);let t=this._times,n=Lo(t,e.start,Q.compare);n<0?n=~n:e.isStartIncluded||++n;let i=Lo(t,e.stop,Q.compare);i<0?i=~i:e.isStopIncluded&&++i,ahe(this,n,i-n)};nd.prototype.equals=function(e){if(this===e)return!0;if(!c(e)||this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;let t=this._derivativeTypes,n=c(t),i=e._derivativeTypes,o=c(i);if(n!==o)return!1;let r,s;if(n){if(s=t.length,s!==i.length)return!1;for(r=0;r<s;r++)if(t[r]!==i[r])return!1}let a=this._times,l=e._times;if(s=a.length,s!==l.length)return!1;for(r=0;r<s;r++)if(!Q.equals(a[r],l[r]))return!1;let u=this._values,f=e._values;for(s=u.length,r=0;r<s;r++)if(u[r]!==f[r])return!1;return!0};nd._mergeNewSamples=u4;var Vu=nd;function id(e,t){t=t??0;let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=d}this._numberOfDerivatives=t,this._property=new Vu(d,n),this._definitionChanged=new pe,this._referenceFrame=e??Hi.FIXED,this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(id.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}});var cQe=new Q;id.prototype.getValue=function(e,t){return c(e)||(e=Q.now(cQe)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};id.prototype.getValueInReferenceFrame=function(e,t,n){if(T.defined("time",e),T.defined("referenceFrame",t),n=this._property.getValue(e,n),c(n))return zd.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};id.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};id.prototype.addSample=function(e,t,n){let i=this._numberOfDerivatives;if(i>0&&(!c(n)||n.length!==i))throw new E("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)};id.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};id.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};id.prototype.removeSample=function(e){return this._property.removeSample(e)};id.prototype.removeSamples=function(e){this._property.removeSamples(e)};id.prototype.equals=function(e){return this===e||e instanceof id&&X.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};var Ta=id;var lQe={HORIZONTAL:0,VERTICAL:1},Eh=Object.freeze(lQe);var uQe=Eh.HORIZONTAL,fQe=G.WHITE,dQe=G.BLACK,hQe=0,mQe=1;function rS(e){e=e??W.EMPTY_OBJECT,this._definitionChanged=new pe,this._orientation=void 0,this._orientationSubscription=void 0,this._evenColor=void 0,this._evenColorSubscription=void 0,this._oddColor=void 0,this._oddColorSubscription=void 0,this._offset=void 0,this._offsetSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this.orientation=e.orientation,this.evenColor=e.evenColor,this.oddColor=e.oddColor,this.offset=e.offset,this.repeat=e.repeat}Object.defineProperties(rS.prototype,{isConstant:{get:function(){return X.isConstant(this._orientation)&&X.isConstant(this._evenColor)&&X.isConstant(this._oddColor)&&X.isConstant(this._offset)&&X.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:fe("orientation"),evenColor:fe("evenColor"),oddColor:fe("oddColor"),offset:fe("offset"),repeat:fe("repeat")});rS.prototype.getType=function(e){return"Stripe"};var pQe=new Q;rS.prototype.getValue=function(e,t){return c(e)||(e=Q.now(pQe)),c(t)||(t={}),t.horizontal=X.getValueOrDefault(this._orientation,e,uQe)===Eh.HORIZONTAL,t.evenColor=X.getValueOrClonedDefault(this._evenColor,e,fQe,t.evenColor),t.oddColor=X.getValueOrClonedDefault(this._oddColor,e,dQe,t.oddColor),t.offset=X.getValueOrDefault(this._offset,e,hQe),t.repeat=X.getValueOrDefault(this._repeat,e,mQe),t};rS.prototype.equals=function(e){return this===e||e instanceof rS&&X.equals(this._orientation,e._orientation)&&X.equals(this._evenColor,e._evenColor)&&X.equals(this._oddColor,e._oddColor)&&X.equals(this._offset,e._offset)&&X.equals(this._repeat,e._repeat)};var sS=rS;function n0(e){this._definitionChanged=new pe,this._intervals=new Xr,this._intervals.changedEvent.addEventListener(n0.prototype._intervalsChanged,this),this._referenceFrame=e??Hi.FIXED}Object.defineProperties(n0.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}});var _Qe=new Q;n0.prototype.getValue=function(e,t){return c(e)||(e=Q.now(_Qe)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};n0.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");let i=this._intervals.findDataForIntervalContainingDate(e);if(c(i))return zd.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};n0.prototype.equals=function(e){return this===e||e instanceof n0&&this._intervals.equals(e._intervals,X.equals)&&this._referenceFrame===e._referenceFrame};n0.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};var X_=n0;function sT(){this._definitionChanged=new pe,this._intervals=new Xr,this._intervals.changedEvent.addEventListener(sT.prototype._intervalsChanged,this)}Object.defineProperties(sT.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});var gQe=new Q;sT.prototype.getValue=function(e,t){c(e)||(e=Q.now(gQe));let n=this._intervals.findDataForIntervalContainingDate(e);return c(n)&&typeof n.clone=="function"?n.clone(t):n};sT.prototype.equals=function(e){return this===e||e instanceof sT&&this._intervals.equals(e._intervals,X.equals)};sT.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};var K_=sT;function aS(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new pe,this._normalize=t??!0,this.position=e}Object.defineProperties(aS.prototype,{isConstant:{get:function(){return X.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){let t=this._position;t!==e&&(c(t)&&this._subscription(),this._position=e,c(e)&&(this._subscription=e._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)),this._definitionChanged.raiseEvent(this))}},normalize:{get:function(){return this._normalize},set:function(e){this._normalize!==e&&(this._normalize=e,this._definitionChanged.raiseEvent(this))}}});var yQe=new d,che=new d,lhe=new Q,bQe=new Q,n7=1/60;aS.prototype.getValue=function(e,t){return this._getValue(e,t)};aS.prototype._getValue=function(e,t,n){c(e)||(e=Q.now(bQe)),c(t)||(t=new d);let i=this._position;if(X.isConstant(i))return this._normalize?void 0:d.clone(d.ZERO,t);let o=i.getValue(e,yQe),r=i.getValue(Q.addSeconds(e,n7,lhe),che);if(!c(o)||!c(r)&&(r=o,o=i.getValue(Q.addSeconds(e,-n7,lhe),che),!c(o)))return;if(d.equals(o,r))return this._normalize?void 0:d.clone(d.ZERO,t);c(n)&&o.clone(n);let s=d.subtract(r,o,t);return this._normalize?d.normalize(s,t):d.divideByScalar(s,n7,t)};aS.prototype.equals=function(e){return this===e||e instanceof aS&&X.equals(this._position,e._position)};var $_=aS;function bN(e,t){this._velocityVectorProperty=new $_(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new pe,this.ellipsoid=t??ie.default;let n=this;this._velocityVectorProperty.definitionChanged.addEventListener(function(){n._definitionChanged.raiseEvent(n)})}Object.defineProperties(bN.prototype,{isConstant:{get:function(){return X.isConstant(this._velocityVectorProperty)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._velocityVectorProperty.position},set:function(e){this._velocityVectorProperty.position=e}},ellipsoid:{get:function(){return this._ellipsoid},set:function(e){this._ellipsoid!==e&&(this._ellipsoid=e,this._definitionChanged.raiseEvent(this))}}});var uhe=new d,xQe=new d,fhe=new J,TQe=new Q;bN.prototype.getValue=function(e,t){c(e)||(e=Q.now(TQe));let n=this._velocityVectorProperty._getValue(e,xQe,uhe);if(c(n))return Ot.rotationMatrixFromPositionVelocity(uhe,n,this._ellipsoid,fhe),Le.fromRotationMatrix(fhe,t)};bN.prototype.equals=function(e){return this===e||e instanceof bN&&X.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))};var xN=bN;var Z_={COMPLETE:0,BELOW_ELLIPSOID_HORIZON:1,ABOVE_ELLIPSOID_HORIZON:2};Z_.validate=function(e){return e===Z_.COMPLETE||e===Z_.BELOW_ELLIPSOID_HORIZON||e===Z_.ABOVE_ELLIPSOID_HORIZON};Z_.toString=function(e){switch(e){case Z_.COMPLETE:return"COMPLETE";case Z_.BELOW_ELLIPSOID_HORIZON:return"BELOW_ELLIPSOID_HORIZON";case Z_.ABOVE_ELLIPSOID_HORIZON:return"ABOVE_ELLIPSOID_HORIZON";default:throw new E("SensorVolumePortionToDisplay value is not valid and cannot be converted to a String.")}};var cS=Z_;function i0(){}i0.packedLength=d.packedLength;i0.unpack=d.unpack;i0.pack=d.pack;var i7;function TN(e,t){return t[0]==="#"&&(t=i7+t),Y_.fromString(e,t)}function dhe(e,t,n){if(c(n.reference))return TN(t,n.reference);if(c(n.velocityReference)){let i=TN(t,n.velocityReference);switch(e){case d:case i0:return new $_(i,e===i0);case Le:return new xN(i)}}throw new ae(`${JSON.stringify(n)} is not valid CZML.`)}function AQe(e,t){return new Wd(function(n,i){return t(e.getValue(n,i))},e.isConstant)}var qi=new d,ll=new yN,Dc=new he,aT=new En,f4=new Le;function CQe(e){let t=e.rgbaf;if(c(t))return t;let n=e.rgba;if(!c(n))return;let i=n.length;if(i===G.packedLength)return[G.byteToFloat(n[0]),G.byteToFloat(n[1]),G.byteToFloat(n[2]),G.byteToFloat(n[3])];t=new Array(i);for(let o=0;o<i;o+=5)t[o]=n[o],t[o+1]=G.byteToFloat(n[o+1]),t[o+2]=G.byteToFloat(n[o+2]),t[o+3]=G.byteToFloat(n[o+3]),t[o+4]=G.byteToFloat(n[o+4]);return t}function hhe(e,t){let n=e.uri??e;return c(t)?t.getDerivedResource({url:n}):we.createIfNeeded(n)}function EQe(e){let t=e.wsen;if(c(t))return t;let n=e.wsenDegrees;if(!c(n))return;let i=n.length;if(i===ce.packedLength)return[O.toRadians(n[0]),O.toRadians(n[1]),O.toRadians(n[2]),O.toRadians(n[3])];t=new Array(i);for(let o=0;o<i;o+=5)t[o]=n[o],t[o+1]=O.toRadians(n[o+1]),t[o+2]=O.toRadians(n[o+2]),t[o+3]=O.toRadians(n[o+3]),t[o+4]=O.toRadians(n[o+4]);return t}function SQe(e){let t=e.length;if(ll.magnitude=1,t===2)return ll.clock=e[0],ll.cone=e[1],d.fromSpherical(ll,qi),[qi.x,qi.y,qi.z];let n=new Array(t/3*4);for(let i=0,o=0;i<t;i+=3,o+=4)n[o]=e[i],ll.clock=e[i+1],ll.cone=e[i+2],d.fromSpherical(ll,qi),n[o+1]=qi.x,n[o+2]=qi.y,n[o+3]=qi.z;return n}function wQe(e){let t=e.length;if(t===3)return ll.clock=e[0],ll.cone=e[1],ll.magnitude=e[2],d.fromSpherical(ll,qi),[qi.x,qi.y,qi.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],ll.clock=e[i+1],ll.cone=e[i+2],ll.magnitude=e[i+3],d.fromSpherical(ll,qi),n[i+1]=qi.x,n[i+2]=qi.y,n[i+3]=qi.z;return n}function vQe(e){let t=e.length;if(t===3)return Dc.longitude=e[0],Dc.latitude=e[1],Dc.height=e[2],ie.default.cartographicToCartesian(Dc,qi),[qi.x,qi.y,qi.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],Dc.longitude=e[i+1],Dc.latitude=e[i+2],Dc.height=e[i+3],ie.default.cartographicToCartesian(Dc,qi),n[i+1]=qi.x,n[i+2]=qi.y,n[i+3]=qi.z;return n}function DQe(e){let t=e.length;if(t===3)return Dc.longitude=O.toRadians(e[0]),Dc.latitude=O.toRadians(e[1]),Dc.height=e[2],ie.default.cartographicToCartesian(Dc,qi),[qi.x,qi.y,qi.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],Dc.longitude=O.toRadians(e[i+1]),Dc.latitude=O.toRadians(e[i+2]),Dc.height=e[i+3],ie.default.cartographicToCartesian(Dc,qi),n[i+1]=qi.x,n[i+2]=qi.y,n[i+3]=qi.z;return n}function o7(e){let t=e.cartesian;if(c(t))return t;let n=e.cartesianVelocity;if(c(n))return n;let i=e.unitCartesian;if(c(i))return i;let o=e.unitSpherical;if(c(o))return SQe(o);let r=e.spherical;if(c(r))return wQe(r);let s=e.cartographicRadians;if(c(s))return vQe(s);let a=e.cartographicDegrees;if(c(a))return DQe(a);throw new ae(`${JSON.stringify(e)} is not a valid CZML interval.`)}function mhe(e,t){d.unpack(e,t,qi),d.normalize(qi,qi),d.pack(qi,e,t)}function PQe(e){let t=o7(e);if(t.length===3)return mhe(t,0),t;for(let n=1;n<t.length;n+=4)mhe(t,n);return t}function phe(e,t){Le.unpack(e,t,f4),Le.normalize(f4,f4),Le.pack(f4,e,t)}function IQe(e){let t=e.unitQuaternion;if(c(t)){if(t.length===4)return phe(t,0),t;for(let n=1;n<t.length;n+=5)phe(t,n)}return t}function _he(e){return typeof e=="boolean"?Boolean:typeof e=="number"?Number:typeof e=="string"?String:e.hasOwnProperty("array")?Array:e.hasOwnProperty("boolean")?Boolean:e.hasOwnProperty("boundingRectangle")?Ke:e.hasOwnProperty("cartesian2")?H:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?d:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?i0:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?G:e.hasOwnProperty("arcType")?qt:e.hasOwnProperty("classificationType")?Un:e.hasOwnProperty("colorBlendMode")?bc:e.hasOwnProperty("cornerType")?Bi:e.hasOwnProperty("heightReference")?We:e.hasOwnProperty("horizontalOrigin")?bi:e.hasOwnProperty("date")?Q:e.hasOwnProperty("labelStyle")?Yo:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?Bt:e.hasOwnProperty("distanceDisplayCondition")?Mt:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Le:e.hasOwnProperty("shadowMode")?xn:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?Eh:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?ce:e.hasOwnProperty("uri")?CN.default:e.hasOwnProperty("verticalOrigin")?Fn:Object}function OQe(e,t,n){switch(e){case qt:return qt[t.arcType??t];case Array:return t.array;case Boolean:return t.boolean??t;case Ke:return t.boundingRectangle;case H:return t.cartesian2;case d:return o7(t);case i0:return PQe(t);case G:return CQe(t);case Un:return Un[t.classificationType??t];case bc:return bc[t.colorBlendMode??t];case Bi:return Bi[t.cornerType??t];case We:return We[t.heightReference??t];case bi:return bi[t.horizontalOrigin??t];case Image:return hhe(t,n);case Q:return Q.fromIso8601(t.date??t);case Yo:return Yo[t.labelStyle??t];case Number:return t.number??t;case Bt:return t.nearFarScalar;case Mt:return t.distanceDisplayCondition;case Object:return t.object??t.value??t;case Le:return IQe(t);case td:return t.number??t;case cS:return cS[t.portionToDisplay??t];case xn:return xn[t.shadowMode??t.shadows??t];case String:return t.string??t;case Eh:return Eh[t.stripeOrientation??t];case ce:return EQe(t);case CN.default:return hhe(t,n);case Fn:return Fn[t.verticalOrigin??t];default:throw new ae(`Unknown CzmlDataSource interval type: ${e}`)}}var RQe={HERMITE:_N,LAGRANGE:gN,LINEAR:Jy};function d4(e,t){let n=e.interpolationAlgorithm,i=e.interpolationDegree;(c(n)||c(i))&&t.setInterpolationOptions({interpolationAlgorithm:RQe[n],interpolationDegree:i});let o=e.forwardExtrapolationType;c(o)&&(t.forwardExtrapolationType=cl[o]);let r=e.forwardExtrapolationDuration;c(r)&&(t.forwardExtrapolationDuration=r);let s=e.backwardExtrapolationType;c(s)&&(t.backwardExtrapolationType=cl[s]);let a=e.backwardExtrapolationDuration;c(a)&&(t.backwardExtrapolationDuration=a)}var ghe={iso8601:void 0};function yr(e){if(c(e))return ghe.iso8601=e,En.fromIso8601(ghe)}function r7(e){let t=Ge.MAXIMUM_INTERVAL.clone();return t.data=e,t}function yhe(e){let t=new Sc;return t.intervals.addInterval(r7(e)),t}function bhe(e){let t=new ba(e.referenceFrame);return t.intervals.addInterval(r7(e)),t}function h4(e,t,n,i,o,r,s){let a=yr(i.interval);c(o)&&(c(a)?a=En.intersect(a,o,aT):a=o);let l,u,f,h=!c(i.reference)&&!c(i.velocityReference),p=c(a)&&!a.equals(Ge.MAXIMUM_INTERVAL);if(i.delete===!0){if(!p){t[n]=void 0;return}return Ihe(t[n],a)}let g=!1;if(h){if(u=OQe(e,i,r),!c(u))return;l=e.packedLength??1,f=u.length??1,g=!c(i.array)&&typeof u!="string"&&f>l&&e!==Object}let m=typeof e.unpack=="function"&&e!==td;if(!g&&!p){h?t[n]=new Kn(m?e.unpack(u,0):u):t[n]=dhe(e,s,i);return}let y=t[n],b,x=i.epoch;if(c(x)&&(b=Q.fromIso8601(x)),g&&!p){y instanceof Vu||(t[n]=y=new Vu(e)),y.addSamplesPackedArray(u,b),d4(i,y);return}let A;if(!g&&p){a=a.clone(),h?a.data=m?e.unpack(u,0):u:a.data=dhe(e,s,i),c(y)||(t[n]=y=h?new K_:new Sc),h&&y instanceof K_?y.intervals.addInterval(a):y instanceof Sc?(h&&(a.data=new Kn(a.data)),y.intervals.addInterval(a)):(t[n]=y=yhe(y),h&&(a.data=new Kn(a.data)),y.intervals.addInterval(a));return}c(y)||(t[n]=y=new Sc),y instanceof Sc||(t[n]=y=yhe(y));let C=y.intervals;A=C.findInterval(a),(!c(A)||!(A.data instanceof Vu))&&(A=a.clone(),A.data=new Vu(e),C.addInterval(A)),A.data.addSamplesPackedArray(u,b),d4(i,A.data)}function Ihe(e,t){if(e instanceof Vu){e.removeSamples(t);return}else if(e instanceof K_){e.intervals.removeInterval(t);return}else if(e instanceof Sc){let n=e.intervals;for(let i=0;i<n.length;++i){let o=En.intersect(n.get(i),t,aT);o.isEmpty||Ihe(o.data,t)}n.removeInterval(t);return}}function be(e,t,n,i,o,r,s){if(c(i))if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)h4(e,t,n,i[a],o,r,s);else h4(e,t,n,i,o,r,s)}function xhe(e,t,n,i,o,r){let s=yr(n.interval);c(i)&&(c(s)?s=En.intersect(s,i,aT):s=i);let a=c(n.cartesianVelocity)?1:0,l=d.packedLength*(a+1),u,f,h=!c(n.reference),p=c(s)&&!s.equals(Ge.MAXIMUM_INTERVAL);if(n.delete===!0){if(!p){e[t]=void 0;return}return Ohe(e[t],s)}let g,m=!1;if(h&&(c(n.referenceFrame)&&(g=Hi[n.referenceFrame]),g=g??Hi.FIXED,u=o7(n),f=u.length??1,m=f>l),!m&&!p){h?e[t]=new qc(d.unpack(u),g):e[t]=TN(r,n.reference);return}let y=e[t],b,x=n.epoch;if(c(x)&&(b=Q.fromIso8601(x)),m&&!p){(!(y instanceof Ta)||c(g)&&y.referenceFrame!==g)&&(e[t]=y=new Ta(g,a)),y.addSamplesPackedArray(u,b),d4(n,y);return}let A;if(!m&&p){s=s.clone(),h?s.data=d.unpack(u):s.data=TN(r,n.reference),c(y)||(h?y=new X_(g):y=new ba(g),e[t]=y),h&&y instanceof X_&&c(g)&&y.referenceFrame===g?y.intervals.addInterval(s):y instanceof ba?(h&&(s.data=new qc(s.data,g)),y.intervals.addInterval(s)):(e[t]=y=bhe(y),h&&(s.data=new qc(s.data,g)),y.intervals.addInterval(s));return}c(y)?y instanceof ba||(e[t]=y=bhe(y)):e[t]=y=new ba(g);let C=y.intervals;A=C.findInterval(s),(!c(A)||!(A.data instanceof Ta)||c(g)&&A.data.referenceFrame!==g)&&(A=s.clone(),A.data=new Ta(g,a),C.addInterval(A)),A.data.addSamplesPackedArray(u,b),d4(n,A.data)}function Ohe(e,t){if(e instanceof Ta){e.removeSamples(t);return}else if(e instanceof X_){e.intervals.removeInterval(t);return}else if(e instanceof ba){let n=e.intervals;for(let i=0;i<n.length;++i){let o=En.intersect(n.get(i),t,aT);o.isEmpty||Ohe(o.data,t)}n.removeInterval(t);return}}function Rhe(e,t,n,i,o,r){if(c(n))if(Array.isArray(n))for(let s=0,a=n.length;s<a;++s)xhe(e,t,n[s],i,o,r);else xhe(e,t,n,i,o,r)}function The(e,t,n,i){c(n.references)?m4(e,t,n.references,n.interval,i,oS,Sc):(c(n.cartesian2)?n.array=H.unpackArray(n.cartesian2):c(n.cartesian)&&(n.array=H.unpackArray(n.cartesian)),c(n.array)&&be(Array,e,t,n,void 0,void 0,i))}function Ahe(e,t,n,i,o,r){let s=yr(n.interval);c(i)&&(c(s)?s=En.intersect(s,i,aT):s=i);let a=e[t],l,u;if(c(s)){a instanceof VE||(a=new VE,e[t]=a);let h=a.intervals;u=h.findInterval({start:s.start,stop:s.stop}),c(u)?l=u.data:(u=s.clone(),h.addInterval(u))}else l=a;let f;c(n.solidColor)?(l instanceof Ut||(l=new Ut),f=n.solidColor,be(G,l,"color",f.color,void 0,void 0,r)):c(n.grid)?(l instanceof $E||(l=new $E),f=n.grid,be(G,l,"color",f.color,void 0,o,r),be(Number,l,"cellAlpha",f.cellAlpha,void 0,o,r),be(H,l,"lineCount",f.lineCount,void 0,o,r),be(H,l,"lineThickness",f.lineThickness,void 0,o,r),be(H,l,"lineOffset",f.lineOffset,void 0,o,r)):c(n.image)?(l instanceof ny||(l=new ny),f=n.image,be(Image,l,"image",f.image,void 0,o,r),be(H,l,"repeat",f.repeat,void 0,o,r),be(G,l,"color",f.color,void 0,o,r),be(Boolean,l,"transparent",f.transparent,void 0,o,r)):c(n.stripe)?(l instanceof sS||(l=new sS),f=n.stripe,be(Eh,l,"orientation",f.orientation,void 0,o,r),be(G,l,"evenColor",f.evenColor,void 0,o,r),be(G,l,"oddColor",f.oddColor,void 0,o,r),be(Number,l,"offset",f.offset,void 0,o,r),be(Number,l,"repeat",f.repeat,void 0,o,r)):c(n.polylineOutline)?(l instanceof e0||(l=new e0),f=n.polylineOutline,be(G,l,"color",f.color,void 0,o,r),be(G,l,"outlineColor",f.outlineColor,void 0,o,r),be(Number,l,"outlineWidth",f.outlineWidth,void 0,o,r)):c(n.polylineGlow)?(l instanceof nS||(l=new nS),f=n.polylineGlow,be(G,l,"color",f.color,void 0,o,r),be(Number,l,"glowPower",f.glowPower,void 0,o,r),be(Number,l,"taperPower",f.taperPower,void 0,o,r)):c(n.polylineArrow)?(l instanceof QE||(l=new QE),f=n.polylineArrow,be(G,l,"color",f.color,void 0,void 0,r)):c(n.polylineDash)?(l instanceof eS||(l=new eS),f=n.polylineDash,be(G,l,"color",f.color,void 0,void 0,r),be(G,l,"gapColor",f.gapColor,void 0,void 0,r),be(Number,l,"dashLength",f.dashLength,void 0,o,r),be(Number,l,"dashPattern",f.dashPattern,void 0,o,r)):c(n.checkerboard)&&(l instanceof kE||(l=new kE),f=n.checkerboard,be(G,l,"evenColor",f.evenColor,void 0,o,r),be(G,l,"oddColor",f.oddColor,void 0,o,r),be(H,l,"repeat",f.repeat,void 0,o,r)),c(u)?u.data=l:e[t]=l}function zu(e,t,n,i,o,r){if(c(n))if(Array.isArray(n))for(let s=0,a=n.length;s<a;++s)Ahe(e,t,n[s],i,o,r);else Ahe(e,t,n,i,o,r)}function MQe(e,t,n,i){let o=t.name;c(o)&&(e.name=t.name)}function LQe(e,t,n,i){let o=t.description;c(o)&&be(String,e,"description",o,void 0,i,n)}function NQe(e,t,n,i){let o=t.position;c(o)&&Rhe(e,"position",o,void 0,i,n)}function FQe(e,t,n,i){let o=t.viewFrom;c(o)&&be(d,e,"viewFrom",o,void 0,i,n)}function BQe(e,t,n,i){let o=t.orientation;c(o)&&be(Le,e,"orientation",o,void 0,i,n)}function kQe(e,t,n,i){let o=t.properties;if(c(o)){c(e.properties)||(e.properties=new Xc);for(let r in o)if(o.hasOwnProperty(r)){e.properties.hasProperty(r)||e.properties.addProperty(r);let s=o[r];if(Array.isArray(s))for(let a=0,l=s.length;a<l;++a)h4(_he(s[a]),e.properties,r,s[a],void 0,i,n);else h4(_he(s),e.properties,r,s,void 0,i,n)}}}function m4(e,t,n,i,o,r,s){let a=n.map(function(l){return TN(o,l)});if(c(i)){i=yr(i);let l=e[t];if(!(l instanceof s)){let u=new s;u.intervals.addInterval(r7(l)),e[t]=l=u}i.data=new r(a),l.intervals.addInterval(i)}else e[t]=new r(a)}function Che(e,t,n,i){let o=n.references;c(o)?m4(e,t,o,n.interval,i,oS,Sc):be(Array,e,t,n,void 0,void 0,i)}function Ehe(e,t,n,i){if(c(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)Che(e,t,n[o],i);else Che(e,t,n,i)}function She(e,t,n,i){let o=n.references;c(o)?m4(e,t,o,n.interval,i,q_,ba):(c(n.cartesian)?n.array=d.unpackArray(n.cartesian):c(n.cartographicRadians)?n.array=d.fromRadiansArrayHeights(n.cartographicRadians,ie.default):c(n.cartographicDegrees)&&(n.array=d.fromDegreesArrayHeights(n.cartographicDegrees,ie.default)),c(n.array)&&be(Array,e,t,n,void 0,void 0,i))}function EN(e,t,n,i){if(c(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)She(e,t,n[o],i);else She(e,t,n,i)}function UQe(e){return d.unpackArray(e)}function VQe(e){return d.fromRadiansArrayHeights(e,ie.default)}function zQe(e){return d.fromDegreesArrayHeights(e,ie.default)}function whe(e,t,n,i){let o=n.references;if(c(o)){let r=o.map(function(s){let a={};return m4(a,"positions",s,n.interval,i,q_,ba),a.positions});e[t]=new q_(r)}else c(n.cartesian)?n.array=n.cartesian.map(UQe):c(n.cartographicRadians)?n.array=n.cartographicRadians.map(VQe):c(n.cartographicDegrees)&&(n.array=n.cartographicDegrees.map(zQe)),c(n.array)&&be(Array,e,t,n,void 0,void 0,i)}function HQe(e,t,n,i){if(c(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)whe(e,t,n[o],i);else whe(e,t,n,i)}function GQe(e,t,n,i){if(c(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;o++)The(e,t,n[o],i);else The(e,t,n,i)}function jQe(e,t,n,i){let o=t.availability;if(!c(o))return;let r;if(Array.isArray(o))for(let s=0,a=o.length;s<a;++s)c(r)||(r=new Xr),r.addInterval(yr(o[s]));else r=new Xr,r.addInterval(yr(o));e.availability=r}function WQe(e,t,n,i,o){c(t)&&be(i0,e,"alignedAxis",t,n,i,o)}function qQe(e,t,n,i){let o=t.billboard;if(!c(o))return;let r=yr(o.interval),s=e.billboard;c(s)||(e.billboard=s=new fc),be(Boolean,s,"show",o.show,r,i,n),be(Image,s,"image",o.image,r,i,n),be(Number,s,"scale",o.scale,r,i,n),be(H,s,"pixelOffset",o.pixelOffset,r,i,n),be(d,s,"eyeOffset",o.eyeOffset,r,i,n),be(bi,s,"horizontalOrigin",o.horizontalOrigin,r,i,n),be(Fn,s,"verticalOrigin",o.verticalOrigin,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(G,s,"color",o.color,r,i,n),be(td,s,"rotation",o.rotation,r,i,n),WQe(s,o.alignedAxis,r,i,n),be(Boolean,s,"sizeInMeters",o.sizeInMeters,r,i,n),be(Number,s,"width",o.width,r,i,n),be(Number,s,"height",o.height,r,i,n),be(Bt,s,"scaleByDistance",o.scaleByDistance,r,i,n),be(Bt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),be(Bt,s,"pixelOffsetScaleByDistance",o.pixelOffsetScaleByDistance,r,i,n),be(Ke,s,"imageSubRegion",o.imageSubRegion,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function YQe(e,t,n,i){let o=t.box;if(!c(o))return;let r=yr(o.interval),s=e.box;c(s)||(e.box=s=new Vb),be(Boolean,s,"show",o.show,r,i,n),be(d,s,"dimensions",o.dimensions,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function XQe(e,t,n,i){let o=t.corridor;if(!c(o))return;let r=yr(o.interval),s=e.corridor;c(s)||(e.corridor=s=new Hb),be(Boolean,s,"show",o.show,r,i,n),EN(s,"positions",o.positions,n),be(Number,s,"width",o.width,r,i,n),be(Number,s,"height",o.height,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),be(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),be(Bi,s,"cornerType",o.cornerType,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Un,s,"classificationType",o.classificationType,r,i,n),be(Number,s,"zIndex",o.zIndex,r,i,n)}function KQe(e,t,n,i){let o=t.cylinder;if(!c(o))return;let r=yr(o.interval),s=e.cylinder;c(s)||(e.cylinder=s=new Gb),be(Boolean,s,"show",o.show,r,i,n),be(Number,s,"length",o.length,r,i,n),be(Number,s,"topRadius",o.topRadius,r,i,n),be(Number,s,"bottomRadius",o.bottomRadius,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Number,s,"numberOfVerticalLines",o.numberOfVerticalLines,r,i,n),be(Number,s,"slices",o.slices,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function $Qe(e,t){let n=e.version;if(c(n)&&typeof n=="string"){let r=n.split(".");if(r.length===2){if(r[0]!=="1")throw new ae("Cesium only supports CZML version 1.");t._version=n}}if(!c(t._version))throw new ae("CZML version information invalid.  It is expected to be a property on the document object in the <Major>.<Minor> version format.");let i=t._documentPacket;c(e.name)&&(i.name=e.name);let o=e.clock;if(c(o)){let r=i.clock;c(r)?(r.interval=o.interval??r.interval,r.currentTime=o.currentTime??r.currentTime,r.range=o.range??r.range,r.step=o.step??r.step,r.multiplier=o.multiplier??r.multiplier):i.clock={interval:o.interval,currentTime:o.currentTime,range:o.range,step:o.step,multiplier:o.multiplier}}}function ZQe(e,t,n,i){let o=t.ellipse;if(!c(o))return;let r=yr(o.interval),s=e.ellipse;c(s)||(e.ellipse=s=new jb),be(Boolean,s,"show",o.show,r,i,n),be(Number,s,"semiMajorAxis",o.semiMajorAxis,r,i,n),be(Number,s,"semiMinorAxis",o.semiMinorAxis,r,i,n),be(Number,s,"height",o.height,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),be(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),be(td,s,"rotation",o.rotation,r,i,n),be(td,s,"stRotation",o.stRotation,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Number,s,"numberOfVerticalLines",o.numberOfVerticalLines,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Un,s,"classificationType",o.classificationType,r,i,n),be(Number,s,"zIndex",o.zIndex,r,i,n)}function QQe(e,t,n,i){let o=t.ellipsoid;if(!c(o))return;let r=yr(o.interval),s=e.ellipsoid;c(s)||(e.ellipsoid=s=new Wb),be(Boolean,s,"show",o.show,r,i,n),be(d,s,"radii",o.radii,r,i,n),be(d,s,"innerRadii",o.innerRadii,r,i,n),be(Number,s,"minimumClock",o.minimumClock,r,i,n),be(Number,s,"maximumClock",o.maximumClock,r,i,n),be(Number,s,"minimumCone",o.minimumCone,r,i,n),be(Number,s,"maximumCone",o.maximumCone,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Number,s,"stackPartitions",o.stackPartitions,r,i,n),be(Number,s,"slicePartitions",o.slicePartitions,r,i,n),be(Number,s,"subdivisions",o.subdivisions,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function JQe(e,t,n,i){let o=t.label;if(!c(o))return;let r=yr(o.interval),s=e.label;c(s)||(e.label=s=new Hd),be(Boolean,s,"show",o.show,r,i,n),be(String,s,"text",o.text,r,i,n),be(String,s,"font",o.font,r,i,n),be(Yo,s,"style",o.style,r,i,n),be(Number,s,"scale",o.scale,r,i,n),be(Boolean,s,"showBackground",o.showBackground,r,i,n),be(G,s,"backgroundColor",o.backgroundColor,r,i,n),be(H,s,"backgroundPadding",o.backgroundPadding,r,i,n),be(H,s,"pixelOffset",o.pixelOffset,r,i,n),be(d,s,"eyeOffset",o.eyeOffset,r,i,n),be(bi,s,"horizontalOrigin",o.horizontalOrigin,r,i,n),be(Fn,s,"verticalOrigin",o.verticalOrigin,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(G,s,"fillColor",o.fillColor,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Bt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),be(Bt,s,"pixelOffsetScaleByDistance",o.pixelOffsetScaleByDistance,r,i,n),be(Bt,s,"scaleByDistance",o.scaleByDistance,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function eJe(e,t,n,i){let o=t.model;if(!c(o))return;let r=yr(o.interval),s=e.model;c(s)||(e.model=s=new Gp),be(Boolean,s,"show",o.show,r,i,n),be(CN.default,s,"uri",o.gltf,r,i,n),be(Number,s,"scale",o.scale,r,i,n),be(Number,s,"minimumPixelSize",o.minimumPixelSize,r,i,n),be(Number,s,"maximumScale",o.maximumScale,r,i,n),be(Boolean,s,"incrementallyLoadTextures",o.incrementallyLoadTextures,r,i,n),be(Boolean,s,"runAnimations",o.runAnimations,r,i,n),be(Boolean,s,"clampAnimations",o.clampAnimations,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(G,s,"silhouetteColor",o.silhouetteColor,r,i,n),be(Number,s,"silhouetteSize",o.silhouetteSize,r,i,n),be(G,s,"color",o.color,r,i,n),be(bc,s,"colorBlendMode",o.colorBlendMode,r,i,n),be(Number,s,"colorBlendAmount",o.colorBlendAmount,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n);let a,l,u=o.nodeTransformations;if(c(u))if(Array.isArray(u))for(a=0,l=u.length;a<l;++a)vhe(s,u[a],r,i,n);else vhe(s,u,r,i,n);let f=o.articulations;if(c(f))if(Array.isArray(f))for(a=0,l=f.length;a<l;++a)Dhe(s,f[a],r,i,n);else Dhe(s,f,r,i,n)}function vhe(e,t,n,i,o){let r=yr(t.interval);c(n)&&(c(r)?r=En.intersect(r,n,aT):r=n);let s=e.nodeTransformations,a=Object.keys(t);for(let l=0,u=a.length;l<u;++l){let f=a[l];if(f==="interval")continue;let h=t[f];if(!c(h))continue;c(s)||(e.nodeTransformations=s=new Xc),s.hasProperty(f)||s.addProperty(f);let p=s[f];c(p)||(s[f]=p=new qb),be(d,p,"translation",h.translation,r,i,o),be(Le,p,"rotation",h.rotation,r,i,o),be(d,p,"scale",h.scale,r,i,o)}}function Dhe(e,t,n,i,o){let r=yr(t.interval);c(n)&&(c(r)?r=En.intersect(r,n,aT):r=n);let s=e.articulations,a=Object.keys(t);for(let l=0,u=a.length;l<u;++l){let f=a[l];if(f==="interval")continue;let h=t[f];c(h)&&(c(s)||(e.articulations=s=new Xc),s.hasProperty(f)||s.addProperty(f),be(Number,s,f,h,r,i,o))}}function tJe(e,t,n,i){let o=t.path;if(!c(o))return;let r=yr(o.interval),s=e.path;c(s)||(e.path=s=new jp),be(Boolean,s,"show",o.show,r,i,n),be(Number,s,"leadTime",o.leadTime,r,i,n),be(Number,s,"trailTime",o.trailTime,r,i,n),be(Number,s,"width",o.width,r,i,n),be(Number,s,"resolution",o.resolution,r,i,n),zu(s,"material",o.material,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function nJe(e,t,n,i){let o=t.point;if(!c(o))return;let r=yr(o.interval),s=e.point;c(s)||(e.point=s=new Xb),be(Boolean,s,"show",o.show,r,i,n),be(Number,s,"pixelSize",o.pixelSize,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(G,s,"color",o.color,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Bt,s,"scaleByDistance",o.scaleByDistance,r,i,n),be(Bt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function AN(e){this.polygon=e,this._definitionChanged=new pe}Object.defineProperties(AN.prototype,{isConstant:{get:function(){let e=this.polygon._positions,t=this.polygon._holes;return(!c(e)||e.isConstant)&&(!c(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}});AN.prototype.getValue=function(e,t){let n;c(this.polygon._positions)&&(n=this.polygon._positions.getValue(e));let i;return c(this.polygon._holes)&&(i=this.polygon._holes.getValue(e),c(i)&&(i=i.map(function(o){return new ka(o)}))),c(t)?(t.positions=n,t.holes=i,t):new ka(n,i)};AN.prototype.equals=function(e){return this===e||e instanceof AN&&X.equals(this.polygon._positions,e.polygon._positions)&&X.equals(this.polygon._holes,e.polygon._holes)};function iJe(e,t,n,i){let o=t.polygon;if(!c(o))return;let r=yr(o.interval),s=e.polygon;c(s)||(e.polygon=s=new Gd),be(Boolean,s,"show",o.show,r,i,n),EN(s,"_positions",o.positions,n),HQe(s,"_holes",o.holes,n),(c(s._positions)||c(s._holes))&&(s.hierarchy=new AN(s)),be(Number,s,"height",o.height,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),be(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),be(td,s,"stRotation",o.stRotation,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Boolean,s,"perPositionHeight",o.perPositionHeight,r,i,n),be(Boolean,s,"closeTop",o.closeTop,r,i,n),be(Boolean,s,"closeBottom",o.closeBottom,r,i,n),be(qt,s,"arcType",o.arcType,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Un,s,"classificationType",o.classificationType,r,i,n),be(Number,s,"zIndex",o.zIndex,r,i,n)}function oJe(e){return e?qt.GEODESIC:qt.NONE}function rJe(e,t,n,i){let o=t.polyline;if(!c(o))return;let r=yr(o.interval),s=e.polyline;if(c(s)||(e.polyline=s=new mc),be(Boolean,s,"show",o.show,r,i,n),EN(s,"positions",o.positions,n),be(Number,s,"width",o.width,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),zu(s,"material",o.material,r,i,n),zu(s,"depthFailMaterial",o.depthFailMaterial,r,i,n),be(qt,s,"arcType",o.arcType,r,i,n),be(Boolean,s,"clampToGround",o.clampToGround,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Un,s,"classificationType",o.classificationType,r,i,n),be(Number,s,"zIndex",o.zIndex,r,i,n),c(o.followSurface)&&!c(o.arcType)){let a={};be(Boolean,a,"followSurface",o.followSurface,r,i,n),s.arcType=AQe(a.followSurface,oJe)}}function sJe(e,t,n,i){let o=t.polylineVolume;if(!c(o))return;let r=yr(o.interval),s=e.polylineVolume;c(s)||(e.polylineVolume=s=new Kb),EN(s,"positions",o.positions,n),GQe(s,"shape",o.shape,n),be(Boolean,s,"show",o.show,r,i,n),be(Bi,s,"cornerType",o.cornerType,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function aJe(e,t,n,i){let o=t.rectangle;if(!c(o))return;let r=yr(o.interval),s=e.rectangle;c(s)||(e.rectangle=s=new jd),be(Boolean,s,"show",o.show,r,i,n),be(ce,s,"coordinates",o.coordinates,r,i,n),be(Number,s,"height",o.height,r,i,n),be(We,s,"heightReference",o.heightReference,r,i,n),be(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),be(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),be(td,s,"rotation",o.rotation,r,i,n),be(td,s,"stRotation",o.stRotation,r,i,n),be(Number,s,"granularity",o.granularity,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),be(Un,s,"classificationType",o.classificationType,r,i,n),be(Number,s,"zIndex",o.zIndex,r,i,n)}function cJe(e,t,n,i){let o=t.tileset;if(!c(o))return;let r=yr(o.interval),s=e.tileset;c(s)||(e.tileset=s=new Yb),be(Boolean,s,"show",o.show,r,i,n),be(CN.default,s,"uri",o.uri,r,i,n),be(Number,s,"maximumScreenSpaceError",o.maximumScreenSpaceError,r,i,n)}function lJe(e,t,n,i){let o=t.wall;if(!c(o))return;let r=yr(o.interval),s=e.wall;c(s)||(e.wall=s=new Wp),be(Boolean,s,"show",o.show,r,i,n),EN(s,"positions",o.positions,n),Ehe(s,"minimumHeights",o.minimumHeights,n),Ehe(s,"maximumHeights",o.maximumHeights,n),be(Number,s,"granularity",o.granularity,r,i,n),be(Boolean,s,"fill",o.fill,r,i,n),zu(s,"material",o.material,r,i,n),be(Boolean,s,"outline",o.outline,r,i,n),be(G,s,"outlineColor",o.outlineColor,r,i,n),be(Number,s,"outlineWidth",o.outlineWidth,r,i,n),be(xn,s,"shadows",o.shadows,r,i,n),be(Mt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function Phe(e,t,n,i,o){let r=e.id;if(c(r)||(r=jn()),i7=r,!c(o._version)&&r!=="document")throw new ae("The first CZML packet is required to be the document object.");if(e.delete===!0)t.removeById(r);else if(r==="document")$Qe(e,o);else{let s=t.getOrCreateEntity(r),a=e.parent;c(a)&&(s.parent=t.getOrCreateEntity(a));for(let l=n.length-1;l>-1;l--)n[l](s,e,t,i)}i7=void 0}function uJe(e){let t,n=e._documentPacket.clock;if(!c(n)){if(!c(e._clock)){let o=e._entityCollection.computeAvailability();if(!o.start.equals(Ge.MINIMUM_VALUE)){let r=o.start,s=o.stop,a=Q.secondsDifference(s,r),l=Math.round(a/120);return t=new Ch,t.startTime=Q.clone(r),t.stopTime=Q.clone(s),t.clockRange=$r.LOOP_STOP,t.multiplier=l,t.currentTime=Q.clone(r),t.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}c(e._clock)?t=e._clock.clone():(t=new Ch,t.startTime=Ge.MINIMUM_VALUE.clone(),t.stopTime=Ge.MAXIMUM_VALUE.clone(),t.currentTime=Ge.MINIMUM_VALUE.clone(),t.clockRange=$r.LOOP_STOP,t.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);let i=yr(n.interval);return c(i)&&(t.startTime=i.start,t.stopTime=i.stop),c(n.currentTime)&&(t.currentTime=Q.fromIso8601(n.currentTime)),c(n.range)&&(t.clockRange=$r[n.range]??$r.LOOP_STOP),c(n.step)&&(t.clockStep=mo[n.step]??mo.SYSTEM_CLOCK_MULTIPLIER),c(n.multiplier)&&(t.multiplier=n.multiplier),t.equals(e._clock)?!1:(e._clock=t.clone(e._clock),!0)}function Mhe(e,t,n,i){if(!c(t))throw new E("czml is required.");n=n??W.EMPTY_OBJECT;let o=t,r=n.sourceUri,s=n.credit;if(typeof s=="string"&&(s=new Tt(s)),e._credit=s,typeof t=="string"||t instanceof we){t=we.createIfNeeded(t),o=t.fetchJson(),r=r??t.clone();let a=e._resourceCredits,l=t.credits;if(c(l)){let u=l.length;for(let f=0;f<u;f++)a.push(l[f])}}return r=we.createIfNeeded(r),Kr.setLoading(e,!0),Promise.resolve(o).then(function(a){return fJe(e,a,r,i)}).catch(function(a){return Kr.setLoading(e,!1),e._error.raiseEvent(e,a),console.log(a),Promise.reject(a)})}function fJe(e,t,n,i){Kr.setLoading(e,!0);let o=e._entityCollection;i&&(e._version=void 0,e._documentPacket=new Lhe,o.removeAll()),xs._processCzml(t,o,n,void 0,e);let r=uJe(e),s=e._documentPacket;return c(s.name)&&e._name!==s.name?(e._name=s.name,r=!0):!c(e._name)&&c(n)&&(e._name=j_(n.getUrlComponent()),r=!0),Kr.setLoading(e,!1),r&&e._changed.raiseEvent(e),e}function Lhe(){this.name=void 0,this.clock=void 0}function xs(e){this._name=e,this._changed=new pe,this._error=new pe,this._isLoading=!1,this._loading=new pe,this._clock=void 0,this._documentPacket=new Lhe,this._version=void 0,this._entityCollection=new Qs(this),this._entityCluster=new Bu,this._credit=void 0,this._resourceCredits=[]}xs.load=function(e,t){return new xs().load(e,t)};Object.defineProperties(xs.prototype,{name:{get:function(){return this._name}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}},credit:{get:function(){return this._credit}}});xs.updaters=[qQe,YQe,XQe,KQe,ZQe,QQe,JQe,eJe,MQe,LQe,tJe,nJe,iJe,rJe,sJe,kQe,aJe,NQe,cJe,FQe,lJe,BQe,jQe];xs.registerUpdater=function(e){xs.updaters.includes(e)||xs.updaters.push(e)};xs.unregisterUpdater=function(e){if(xs.updaters.includes(e)){let t=xs.updaters.indexOf(e);xs.updaters.splice(t,1)}};xs.prototype.process=function(e,t){return Mhe(this,e,t,!1)};xs.prototype.load=function(e,t){return Mhe(this,e,t,!0)};xs.prototype.update=function(e){return!0};xs.processPacketData=be;xs.processPositionPacketData=Rhe;xs.processMaterialPacketData=zu;xs._processCzml=function(e,t,n,i,o){if(i=i??xs.updaters,Array.isArray(e))for(let r=0,s=e.length;r<s;++r)Phe(e[r],t,i,n,o);else Phe(e,t,i,n,o)};var SN=xs;function ul(){this._dataSources=[],this._dataSourceAdded=new pe,this._dataSourceRemoved=new pe,this._dataSourceMoved=new pe}Object.defineProperties(ul.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}});ul.prototype.add=function(e){if(!c(e))throw new E("dataSource is required.");let t=this,n=this._dataSources;return Promise.resolve(e).then(function(i){return n===t._dataSources&&(t._dataSources.push(i),t._dataSourceAdded.raiseEvent(t,i)),i})};ul.prototype.remove=function(e,t){t=t??!1;let n=this._dataSources.indexOf(e);return n!==-1?(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&typeof e.destroy=="function"&&e.destroy(),!0):!1};ul.prototype.removeAll=function(e){e=e??!1;let t=this._dataSources;for(let n=0,i=t.length;n<i;++n){let o=t[n];this._dataSourceRemoved.raiseEvent(this,o),e&&typeof o.destroy=="function"&&o.destroy()}this._dataSources=[]};ul.prototype.contains=function(e){return this.indexOf(e)!==-1};ul.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};ul.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._dataSources[e]};ul.prototype.getByName=function(e){if(!c(e))throw new E("name is required.");return this._dataSources.filter(function(t){return t.name===e})};function p4(e,t){if(!c(t))throw new E("dataSource is required.");let n=e.indexOf(t);if(n===-1)throw new E("dataSource is not in this collection.");return n}function Nhe(e,t,n){let i=e._dataSources,o=i.length-1;if(t=O.clamp(t,0,o),n=O.clamp(n,0,o),t===n)return;let r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}ul.prototype.raise=function(e){let t=p4(this._dataSources,e);Nhe(this,t,t+1)};ul.prototype.lower=function(e){let t=p4(this._dataSources,e);Nhe(this,t,t-1)};ul.prototype.raiseToTop=function(e){let t=p4(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))};ul.prototype.lowerToBottom=function(e){let t=p4(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};ul.prototype.isDestroyed=function(){return!1};ul.prototype.destroy=function(){return this.removeAll(!0),de(this)};var wN=ul;function Aa(e){e=e??W.EMPTY_OBJECT,this._primitives=[],this._guid=jn(),this._primitiveAdded=new pe,this._primitiveRemoved=new pe,this._zIndex=void 0,this.show=e.show??!0,this.destroyPrimitives=e.destroyPrimitives??!0}Object.defineProperties(Aa.prototype,{length:{get:function(){return this._primitives.length}},primitiveAdded:{get:function(){return this._primitiveAdded}},primitiveRemoved:{get:function(){return this._primitiveRemoved}}});Aa.prototype.add=function(e,t){let n=c(t);if(!c(e))throw new E("primitive is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._primitives.length)throw new E("index must be less than or equal to the number of primitives.")}let i=e._external=e._external||{},o=i._composites=i._composites||{};return o[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),this._primitiveAdded.raiseEvent(e),e};Aa.prototype.remove=function(e){if(this.contains(e)){let t=this._primitives.indexOf(e);if(t!==-1)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),this._primitiveRemoved.raiseEvent(e),!0}return!1};Aa.prototype.removeAndDestroy=function(e){let t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};Aa.prototype.removeAll=function(){let e=this._primitives,t=e.length;for(let n=0;n<t;++n)delete e[n]._external._composites[this._guid],this.destroyPrimitives&&e[n].destroy(),this._primitiveRemoved.raiseEvent(e[n]);this._primitives=[]};Aa.prototype.contains=function(e){return!!(c(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function _4(e,t){if(!e.contains(t))throw new E("primitive is not in this collection.");return e._primitives.indexOf(t)}Aa.prototype.raise=function(e){if(c(e)){let t=_4(this,e),n=this._primitives;if(t!==n.length-1){let i=n[t];n[t]=n[t+1],n[t+1]=i}}};Aa.prototype.raiseToTop=function(e){if(c(e)){let t=_4(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};Aa.prototype.lower=function(e){if(c(e)){let t=_4(this,e),n=this._primitives;if(t!==0){let i=n[t];n[t]=n[t-1],n[t-1]=i}}};Aa.prototype.lowerToBottom=function(e){if(c(e)){let t=_4(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};Aa.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._primitives[e]};Aa.prototype.update=function(e){if(!this.show)return;let t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};Aa.prototype.prePassesUpdate=function(e){let t=this._primitives;for(let n=0;n<t.length;++n){let i=t[n];c(i.prePassesUpdate)&&i.prePassesUpdate(e)}};Aa.prototype.updateForPass=function(e,t){let n=this._primitives;for(let i=0;i<n.length;++i){let o=n[i];c(o.updateForPass)&&o.updateForPass(e,t)}};Aa.prototype.postPassesUpdate=function(e){let t=this._primitives;for(let n=0;n<t.length;++n){let i=t[n];c(i.postPassesUpdate)&&i.postPassesUpdate(e)}};Aa.prototype.isDestroyed=function(){return!1};Aa.prototype.destroy=function(){return this.removeAll(),de(this)};var fl=Aa;function Fm(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties(Fm.prototype,{length:{get:function(){return this._length}}});Fm.prototype.add=function(e,t){T.defined("primitive",e),c(t)&&T.typeOf.number("zIndex",t),t=t??0;let n=this._collections[t];if(!c(n)){n=new fl({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;let i=this._collectionsArray,o=0;for(;o<i.length&&i[o]._zIndex<t;)o++;i.splice(o,0,n)}return n.add(e),this._length++,e._zIndex=t,e};Fm.prototype.set=function(e,t){return T.defined("primitive",e),T.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};Fm.prototype.remove=function(e,t){if(this.contains(e)){let n=e._zIndex,i=this._collections[n],o;return t?o=i.remove(e):o=i.removeAndDestroy(e),o&&this._length--,i.length===0&&(this._collectionsArray.splice(this._collectionsArray.indexOf(i),1),this._collections[n]=void 0,i.destroy()),o}return!1};Fm.prototype.removeAll=function(){let e=this._collectionsArray;for(let t=0;t<e.length;t++){let n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0};Fm.prototype.contains=function(e){if(!c(e))return!1;let t=this._collections[e._zIndex];return c(t)&&t.contains(e)};Fm.prototype.update=function(e){if(!this.show)return;let t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};Fm.prototype.isDestroyed=function(){return!1};Fm.prototype.destroy=function(){return this.removeAll(),de(this)};var vN=Fm;function lS(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new Et}lS.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};lS.prototype.remove=function(e){let t=e.id,n=this._dynamicUpdaters.get(t);c(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};lS.prototype.update=function(e){let t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0};lS.prototype.removeAllPrimitives=function(){let e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};lS.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),c(e)&&c(e.getBoundingSphere)?e.getBoundingSphere(t):lt.FAILED};var cT=lS;var a7={},g4=new d,Fhe=new d,Bhe=new Le,khe=new J;function uS(e,t,n,i,o,r,s,a,l,u){let f=e+t;d.multiplyByScalar(i,Math.cos(f),g4),d.multiplyByScalar(n,Math.sin(f),Fhe),d.add(g4,Fhe,g4);let h=Math.cos(e);h=h*h;let p=Math.sin(e);p=p*p;let m=r/Math.sqrt(s*h+o*p)/a;return Le.fromAxisAngle(g4,m,Bhe),J.fromQuaternion(Bhe,khe),J.multiplyByVector(khe,l,u),d.normalize(u,u),d.multiplyByScalar(u,a,u),u}var Uhe=new d,Vhe=new d,s7=new d,dJe=new d;a7.raisePositionsToHeight=function(e,t,n){let i=t.ellipsoid,o=t.height,r=t.extrudedHeight,s=n?e.length/3*2:e.length/3,a=new Float64Array(s*3),l=e.length,u=n?l:0;for(let f=0;f<l;f+=3){let h=f+1,p=f+2,g=d.fromArray(e,f,Uhe);i.scaleToGeodeticSurface(g,g);let m=d.clone(g,Vhe),y=i.geodeticSurfaceNormal(g,dJe),b=d.multiplyByScalar(y,o,s7);d.add(g,b,g),n&&(d.multiplyByScalar(y,r,b),d.add(m,b,m),a[f+u]=m.x,a[h+u]=m.y,a[p+u]=m.z),a[f]=g.x,a[h]=g.y,a[p]=g.z}return a};var hJe=new d,mJe=new d,pJe=new d;a7.computeEllipsePositions=function(e,t,n){let i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=e.granularity*8,l=i*i,u=o*o,f=o*i,h=d.magnitude(s),p=d.normalize(s,hJe),g=d.cross(d.UNIT_Z,s,mJe);g=d.normalize(g,g);let m=d.cross(p,g,pJe),y=1+Math.ceil(O.PI_OVER_TWO/a),b=O.PI_OVER_TWO/(y-1),x=O.PI_OVER_TWO-y*b;x<0&&(y-=Math.ceil(Math.abs(x)/b));let A=2*(y*(y+2)),C=t?new Array(A*3):void 0,S=0,v=Uhe,P=Vhe,M=y*4*3,R=M-1,L=0,F=n?new Array(M):void 0,_,w,D,I,N;for(x=O.PI_OVER_TWO,v=uS(x,r,m,g,l,f,u,h,p,v),t&&(C[S++]=v.x,C[S++]=v.y,C[S++]=v.z),n&&(F[R--]=v.z,F[R--]=v.y,F[R--]=v.x),x=O.PI_OVER_TWO-b,_=1;_<y+1;++_){if(v=uS(x,r,m,g,l,f,u,h,p,v),P=uS(Math.PI-x,r,m,g,l,f,u,h,p,P),t){for(C[S++]=v.x,C[S++]=v.y,C[S++]=v.z,D=2*_+2,w=1;w<D-1;++w)I=w/(D-1),N=d.lerp(v,P,I,s7),C[S++]=N.x,C[S++]=N.y,C[S++]=N.z;C[S++]=P.x,C[S++]=P.y,C[S++]=P.z}n&&(F[R--]=v.z,F[R--]=v.y,F[R--]=v.x,F[L++]=P.x,F[L++]=P.y,F[L++]=P.z),x=O.PI_OVER_TWO-(_+1)*b}for(_=y;_>1;--_){if(x=O.PI_OVER_TWO-(_-1)*b,v=uS(-x,r,m,g,l,f,u,h,p,v),P=uS(x+Math.PI,r,m,g,l,f,u,h,p,P),t){for(C[S++]=v.x,C[S++]=v.y,C[S++]=v.z,D=2*(_-1)+2,w=1;w<D-1;++w)I=w/(D-1),N=d.lerp(v,P,I,s7),C[S++]=N.x,C[S++]=N.y,C[S++]=N.z;C[S++]=P.x,C[S++]=P.y,C[S++]=P.z}n&&(F[R--]=v.z,F[R--]=v.y,F[R--]=v.x,F[L++]=P.x,F[L++]=P.y,F[L++]=P.z)}x=O.PI_OVER_TWO,v=uS(-x,r,m,g,l,f,u,h,p,v);let k={};return t&&(C[S++]=v.x,C[S++]=v.y,C[S++]=v.z,k.positions=C,k.numPts=y),n&&(F[R--]=v.z,F[R--]=v.y,F[R--]=v.x,k.outerPositions=F),k};var $l=a7;var fS=new d,c7=new d,l7=new d,zhe=new d,Rs=new H,Hhe=new J,_Je=new J,u7=new Le,Ghe=new d,jhe=new d,Whe=new d,x4=new he,qhe=new d,Yhe=new H,Xhe=new H;function Khe(e,t,n){let i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,l=t.stRotation,u=n?e.length/3*2:e.length/3,f=t.shadowVolume,h=i.st?new Float32Array(u*2):void 0,p=i.normal?new Float32Array(u*3):void 0,g=i.tangent?new Float32Array(u*3):void 0,m=i.bitangent?new Float32Array(u*3):void 0,y=f?new Float32Array(u*3):void 0,b=0,x=Ghe,A=jhe,C=Whe,S=new Oi(a),v=S.project(a.cartesianToCartographic(o,x4),qhe),P=a.scaleToGeodeticSurface(o,fS);a.geodeticSurfaceNormal(P,P);let M=Hhe,R=_Je;if(l!==0){let N=Le.fromAxisAngle(P,l,u7);M=J.fromQuaternion(N,M),N=Le.fromAxisAngle(P,-l,u7),R=J.fromQuaternion(N,R)}else M=J.clone(J.IDENTITY,M),R=J.clone(J.IDENTITY,R);let L=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Yhe),F=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Xhe),_=e.length,w=n?_:0,D=w/3*2;for(let N=0;N<_;N+=3){let k=N+1,z=N+2,V=d.fromArray(e,N,fS);if(i.st){let j=J.multiplyByVector(M,V,c7),U=S.project(a.cartesianToCartographic(j,x4),l7);d.subtract(U,v,U),Rs.x=(U.x+r)/(2*r),Rs.y=(U.y+s)/(2*s),L.x=Math.min(Rs.x,L.x),L.y=Math.min(Rs.y,L.y),F.x=Math.max(Rs.x,F.x),F.y=Math.max(Rs.y,F.y),n&&(h[b+D]=Rs.x,h[b+1+D]=Rs.y),h[b++]=Rs.x,h[b++]=Rs.y}(i.normal||i.tangent||i.bitangent||f)&&(x=a.geodeticSurfaceNormal(V,x),f&&(y[N+w]=-x.x,y[k+w]=-x.y,y[z+w]=-x.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(A=d.normalize(d.cross(d.UNIT_Z,x,A),A),J.multiplyByVector(R,A,A)),i.normal&&(p[N]=x.x,p[k]=x.y,p[z]=x.z,n&&(p[N+w]=-x.x,p[k+w]=-x.y,p[z+w]=-x.z)),i.tangent&&(g[N]=A.x,g[k]=A.y,g[z]=A.z,n&&(g[N+w]=-A.x,g[k+w]=-A.y,g[z+w]=-A.z)),i.bitangent&&(C=d.normalize(d.cross(x,A,C),C),m[N]=C.x,m[k]=C.y,m[z]=C.z,n&&(m[N+w]=C.x,m[k+w]=C.y,m[z+w]=C.z))))}if(i.st){_=h.length;for(let N=0;N<_;N+=2)h[N]=(h[N]-L.x)/(F.x-L.x),h[N+1]=(h[N+1]-L.y)/(F.y-L.y)}let I=new fn;if(i.position){let N=$l.raisePositionsToHeight(e,t,n);I.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:N})}if(i.st&&(I.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&(I.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:p})),i.tangent&&(I.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(I.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:m})),f&&(I.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:y})),n&&c(t.offsetAttribute)){let N=new Uint8Array(u);if(t.offsetAttribute===Zt.TOP)N=N.fill(1,0,u/2);else{let k=t.offsetAttribute===Zt.NONE?0:1;N=N.fill(k)}I.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:N})}return I}function $he(e){let t=new Array(12*(e*(e+1))-6),n=0,i,o,r,s,a;for(i=0,r=1,s=0;s<3;s++)t[n++]=r++,t[n++]=i,t[n++]=r;for(s=2;s<e+1;++s){for(r=s*(s+1)-1,i=(s-1)*s-1,t[n++]=r++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=r++,t[n++]=i,t[n++]=r}for(o=e*2,++r,++i,s=0;s<o-1;++s)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;for(t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i++,t[n++]=i,++i,s=e-1;s>1;--s){for(t[n++]=i++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=i++,t[n++]=i++,t[n++]=r++}for(s=0;s<3;s++)t[n++]=i++,t[n++]=i,t[n++]=r;return t}var lT=new d;function gJe(e){let t=e.center;lT=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,lT),e.height,lT),lT=d.add(t,lT,lT);let n=new le(lT,e.semiMajorAxis),i=$l.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=Khe(o,e,!1),a=$he(r);return a=Fe.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function yJe(e,t){let n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,l=t.extrudedHeight,u=t.stRotation,f=e.length/3*2,h=new Float64Array(f*3),p=n.st?new Float32Array(f*2):void 0,g=n.normal?new Float32Array(f*3):void 0,m=n.tangent?new Float32Array(f*3):void 0,y=n.bitangent?new Float32Array(f*3):void 0,b=t.shadowVolume,x=b?new Float32Array(f*3):void 0,A=0,C=Ghe,S=jhe,v=Whe,P=new Oi(s),M=P.project(s.cartesianToCartographic(i,x4),qhe),R=s.scaleToGeodeticSurface(i,fS);s.geodeticSurfaceNormal(R,R);let L=Le.fromAxisAngle(R,u,u7),F=J.fromQuaternion(L,Hhe),_=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Yhe),w=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Xhe),D=e.length,I=D/3*2;for(let k=0;k<D;k+=3){let z=k+1,V=k+2,j=d.fromArray(e,k,fS),U;if(n.st){let Y=J.multiplyByVector(F,j,c7),te=P.project(s.cartesianToCartographic(Y,x4),l7);d.subtract(te,M,te),Rs.x=(te.x+o)/(2*o),Rs.y=(te.y+r)/(2*r),_.x=Math.min(Rs.x,_.x),_.y=Math.min(Rs.y,_.y),w.x=Math.max(Rs.x,w.x),w.y=Math.max(Rs.y,w.y),p[A+I]=Rs.x,p[A+1+I]=Rs.y,p[A++]=Rs.x,p[A++]=Rs.y}j=s.scaleToGeodeticSurface(j,j),U=d.clone(j,c7),C=s.geodeticSurfaceNormal(j,C),b&&(x[k+D]=-C.x,x[z+D]=-C.y,x[V+D]=-C.z);let q=d.multiplyByScalar(C,a,zhe);if(j=d.add(j,q,j),q=d.multiplyByScalar(C,l,q),U=d.add(U,q,U),n.position&&(h[k+D]=U.x,h[z+D]=U.y,h[V+D]=U.z,h[k]=j.x,h[z]=j.y,h[V]=j.z),n.normal||n.tangent||n.bitangent){v=d.clone(C,v);let Y=d.fromArray(e,(k+3)%D,zhe);d.subtract(Y,j,Y);let te=d.subtract(U,j,l7);C=d.normalize(d.cross(te,Y,C),C),n.normal&&(g[k]=C.x,g[z]=C.y,g[V]=C.z,g[k+D]=C.x,g[z+D]=C.y,g[V+D]=C.z),n.tangent&&(S=d.normalize(d.cross(v,C,S),S),m[k]=S.x,m[z]=S.y,m[V]=S.z,m[k+D]=S.x,m[k+1+D]=S.y,m[k+2+D]=S.z),n.bitangent&&(y[k]=v.x,y[z]=v.y,y[V]=v.z,y[k+D]=v.x,y[z+D]=v.y,y[V+D]=v.z)}}if(n.st){D=p.length;for(let k=0;k<D;k+=2)p[k]=(p[k]-_.x)/(w.x-_.x),p[k+1]=(p[k+1]-_.y)/(w.y-_.y)}let N=new fn;if(n.position&&(N.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:h})),n.st&&(N.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:p})),n.normal&&(N.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(N.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:m})),n.bitangent&&(N.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:y})),b&&(N.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:x})),c(t.offsetAttribute)){let k=new Uint8Array(f);if(t.offsetAttribute===Zt.TOP)k=k.fill(1,0,f/2);else{let z=t.offsetAttribute===Zt.NONE?0:1;k=k.fill(z)}N.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:k})}return N}function bJe(e){let t=e.length/3,n=Fe.createTypedArray(t,t*6),i=0;for(let o=0;o<t;o++){let r=o,s=o+t,a=(r+1)%t,l=a+t;n[i++]=r,n[i++]=s,n[i++]=a,n[i++]=a,n[i++]=s,n[i++]=l}return n}var y4=new le,b4=new le;function xJe(e){let t=e.center,n=e.ellipsoid,i=e.semiMajorAxis,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,fS),e.height,fS);y4.center=d.add(t,o,y4.center),y4.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),b4.center=d.add(t,o,b4.center),b4.radius=i;let r=$l.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,l=r.outerPositions,u=le.union(y4,b4),f=Khe(s,e,!0),h=$he(a),p=h.length;h.length=p*2;let g=s.length/3;for(let S=0;S<p;S+=3)h[S+p]=h[S+2]+g,h[S+1+p]=h[S+1]+g,h[S+2+p]=h[S]+g;let m=Fe.createTypedArray(g*2/3,h),y=new ct({attributes:f,indices:m,primitiveType:Me.TRIANGLES}),b=yJe(l,e);h=bJe(l);let x=Fe.createTypedArray(l.length*2/3,h),A=new ct({attributes:b,indices:x,primitiveType:Me.TRIANGLES}),C=Nn.combineInstances([new St({geometry:y}),new St({geometry:A})]);return{boundingSphere:u,attributes:C[0].attributes,indices:C[0].indices}}function Zhe(e,t,n,i,o,r,s){let l=$l.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,u=l.length/3,f=new Array(u);for(let p=0;p<u;++p)f[p]=d.fromArray(l,p*3);let h=ce.fromCartesianArray(f,r,s);return h.width>O.PI&&(h.north=h.north>0?O.PI_OVER_TWO-O.EPSILON7:h.north,h.south=h.south<0?O.EPSILON7-O.PI_OVER_TWO:h.south,h.east=O.PI,h.west=-O.PI),h}function km(e){e=e??W.EMPTY_OBJECT;let t=e.center,n=e.ellipsoid??ie.default,i=e.semiMajorAxis,o=e.semiMinorAxis,r=e.granularity??O.RADIANS_PER_DEGREE,s=e.vertexFormat??Ie.DEFAULT;if(T.defined("options.center",t),T.typeOf.number("options.semiMajorAxis",i),T.typeOf.number("options.semiMinorAxis",o),i<o)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new E("granularity must be greater than zero.");let a=e.height??0,l=e.extrudedHeight??a;this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ie.clone(n),this._rotation=e.rotation??0,this._stRotation=e.stRotation??0,this._height=Math.max(l,a),this._granularity=r,this._vertexFormat=Ie.clone(s),this._extrudedHeight=Math.min(l,a),this._shadowVolume=e.shadowVolume??!1,this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}km.packedLength=d.packedLength+ie.packedLength+Ie.packedLength+9;km.pack=function(e,t,n){return T.defined("value",e),T.defined("array",t),n=n??0,d.pack(e._center,t,n),n+=d.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=e._offsetAttribute??-1,t};var Qhe=new d,Jhe=new ie,eme=new Ie,Bm={center:Qhe,ellipsoid:Jhe,vertexFormat:eme,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};km.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=d.unpack(e,t,Qhe);t+=d.packedLength;let o=ie.unpack(e,t,Jhe);t+=ie.packedLength;let r=Ie.unpack(e,t,eme);t+=Ie.packedLength;let s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++],p=e[t++],g=e[t++]===1,m=e[t];return c(n)?(n._center=d.clone(i,n._center),n._ellipsoid=ie.clone(o,n._ellipsoid),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=l,n._stRotation=u,n._height=f,n._granularity=h,n._extrudedHeight=p,n._shadowVolume=g,n._offsetAttribute=m===-1?void 0:m,n):(Bm.height=f,Bm.extrudedHeight=p,Bm.granularity=h,Bm.stRotation=u,Bm.rotation=l,Bm.semiMajorAxis=s,Bm.semiMinorAxis=a,Bm.shadowVolume=g,Bm.offsetAttribute=m===-1?void 0:m,new km(Bm))};km.computeRectangle=function(e,t){e=e??W.EMPTY_OBJECT;let n=e.center,i=e.ellipsoid??ie.default,o=e.semiMajorAxis,r=e.semiMinorAxis,s=e.granularity??O.RADIANS_PER_DEGREE,a=e.rotation??0;if(T.defined("options.center",n),T.typeOf.number("options.semiMajorAxis",o),T.typeOf.number("options.semiMinorAxis",r),o<r)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(s<=0)throw new E("granularity must be greater than zero.");return Zhe(n,o,r,a,s,i,t)};km.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;let t=e._height,n=e._extrudedHeight,i=!O.equalsEpsilon(t,n,0,O.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);let o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation},r;if(i)o.extrudedHeight=n,o.shadowVolume=e._shadowVolume,o.offsetAttribute=e._offsetAttribute,r=xJe(o);else if(r=gJe(o),c(e._offsetAttribute)){let s=r.attributes.position.values.length,a=e._offsetAttribute===Zt.NONE?0:1,l=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:l})}return new ct({attributes:r.attributes,indices:r.indices,primitiveType:Me.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};km.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new km({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0})};function TJe(e){let t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];let i=$l.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,o=i.length/3,r=new Array(o);for(let l=0;l<o;++l)r[l]=d.fromArray(i,l*3);let s=e._ellipsoid,a=e.rectangle;return ct._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(km.prototype,{rectangle:{get:function(){return c(this._rectangle)||(this._rectangle=Zhe(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=TJe(this)),this._textureCoordinateRotationPoints}}});var dl=km;var tme=new d,uT=new d;function AJe(e){let t=e.center;uT=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,uT),e.height,uT),uT=d.add(t,uT,uT);let n=new le(uT,e.semiMajorAxis),i=$l.computeEllipsePositions(e,!1,!0).outerPositions,o=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:$l.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=Fe.createTypedArray(r,r*2),a=0;for(let l=0;l<r;++l)s[a++]=l,s[a++]=(l+1)%r;return{boundingSphere:n,attributes:o,indices:s}}var T4=new le,A4=new le;function CJe(e){let t=e.center,n=e.ellipsoid,i=e.semiMajorAxis,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,tme),e.height,tme);T4.center=d.add(t,o,T4.center),T4.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),A4.center=d.add(t,o,A4.center),A4.radius=i;let r=$l.computeEllipsePositions(e,!1,!0).outerPositions,s=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:$l.raisePositionsToHeight(r,e,!0)})});r=s.position.values;let a=le.union(T4,A4),l=r.length/3;if(c(e.offsetAttribute)){let m=new Uint8Array(l);if(e.offsetAttribute===Zt.TOP)m=m.fill(1,0,l/2);else{let y=e.offsetAttribute===Zt.NONE?0:1;m=m.fill(y)}s.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}let u=e.numberOfVerticalLines??16;u=O.clamp(u,0,l/2);let f=Fe.createTypedArray(l,l*2+u*2);l/=2;let h=0,p;for(p=0;p<l;++p)f[h++]=p,f[h++]=(p+1)%l,f[h++]=p+l,f[h++]=(p+1)%l+l;let g;if(u>0){let m=Math.min(u,l);g=Math.round(l/m);let y=Math.min(g*u,l);for(p=0;p<y;p+=g)f[h++]=p,f[h++]=p+l}return{boundingSphere:a,attributes:s,indices:f}}function dS(e){e=e??W.EMPTY_OBJECT;let t=e.center,n=e.ellipsoid??ie.default,i=e.semiMajorAxis,o=e.semiMinorAxis,r=e.granularity??O.RADIANS_PER_DEGREE;if(!c(t))throw new E("center is required.");if(!c(i))throw new E("semiMajorAxis is required.");if(!c(o))throw new E("semiMinorAxis is required.");if(i<o)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new E("granularity must be greater than zero.");let s=e.height??0,a=e.extrudedHeight??s;this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ie.clone(n),this._rotation=e.rotation??0,this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(e.numberOfVerticalLines??16,0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}dS.packedLength=d.packedLength+ie.packedLength+8;dS.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,d.pack(e._center,t,n),n+=d.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._numberOfVerticalLines,t[n]=e._offsetAttribute??-1,t};var nme=new d,ime=new ie,Q_={center:nme,ellipsoid:ime,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};dS.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i=d.unpack(e,t,nme);t+=d.packedLength;let o=ie.unpack(e,t,ime);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++],p=e[t];return c(n)?(n._center=d.clone(i,n._center),n._ellipsoid=ie.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=l,n._granularity=u,n._extrudedHeight=f,n._numberOfVerticalLines=h,n._offsetAttribute=p===-1?void 0:p,n):(Q_.height=l,Q_.extrudedHeight=f,Q_.granularity=u,Q_.rotation=a,Q_.semiMajorAxis=r,Q_.semiMinorAxis=s,Q_.numberOfVerticalLines=h,Q_.offsetAttribute=p===-1?void 0:p,new dS(Q_))};dS.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;let t=e._height,n=e._extrudedHeight,i=!O.equalsEpsilon(t,n,0,O.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);let o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines},r;if(i)o.extrudedHeight=n,o.offsetAttribute=e._offsetAttribute,r=CJe(o);else if(r=AJe(o),c(e._offsetAttribute)){let s=r.attributes.position.values.length,a=e._offsetAttribute===Zt.NONE?0:1,l=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:l})}return new ct({attributes:r.attributes,indices:r.indices,primitiveType:Me.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};var Hu=dS;var ome=new G,rme=d.ZERO,sme=new d,ame=new ce;function EJe(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function Sh(e,t){Gn.call(this,{entity:e,scene:t,geometryOptions:new EJe(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}c(Object.create)&&(Sh.prototype=Object.create(Gn.prototype),Sh.prototype.constructor=Sh);Sh.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:kn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Ut){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,ome)),c(o)||(o=G.WHITE),i.color=Gt.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,rme,sme))),new St({id:t,geometry:new dl(this._options),attributes:i})};Sh.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,ome),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,rme,sme))),new St({id:t,geometry:new Hu(this._options),attributes:r})};Sh.prototype._computeCenter=function(e,t){return X.getValueOrUndefined(this._entity.position,e,t)};Sh.prototype._isHidden=function(e,t){let n=e.position;return!c(n)||!c(t.semiMajorAxis)||!c(t.semiMinorAxis)||ii.prototype._isHidden.call(this,e,t)};Sh.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!X.isConstant(t.rotation)||!X.isConstant(t.height)||!X.isConstant(t.extrudedHeight)||!X.isConstant(t.granularity)||!X.isConstant(t.stRotation)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.numberOfVerticalLines)||!X.isConstant(t.zIndex)||this._onTerrain&&!X.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Ut)};Sh.prototype._setStaticOptions=function(e,t){let n=X.getValueOrUndefined(t.height,Ge.MINIMUM_VALUE),i=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),o=X.getValueOrUndefined(t.extrudedHeight,Ge.MINIMUM_VALUE),r=X.getValueOrDefault(t.extrudedHeightReference,Ge.MINIMUM_VALUE,We.NONE);c(o)&&!c(n)&&(n=0);let s=this._options;s.vertexFormat=this._materialProperty instanceof Ut?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(Ge.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(Ge.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(Ge.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=X.getValueOrUndefined(t.rotation,Ge.MINIMUM_VALUE),s.granularity=X.getValueOrUndefined(t.granularity,Ge.MINIMUM_VALUE),s.stRotation=X.getValueOrUndefined(t.stRotation,Ge.MINIMUM_VALUE),s.numberOfVerticalLines=X.getValueOrUndefined(t.numberOfVerticalLines,Ge.MINIMUM_VALUE),s.offsetAttribute=Gn.computeGeometryOffsetAttribute(n,i,o,r),s.height=Gn.getGeometryHeight(n,i),o=Gn.getGeometryExtrudedHeight(o,r),o===Gn.CLAMP_TO_GROUND&&(o=ui.getMinimumMaximumHeights(dl.computeRectangle(s,ame)).minimumTerrainHeight),s.extrudedHeight=o};Sh.DynamicGeometryUpdater=hS;function hS(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(hS.prototype=Object.create(ni.prototype),hS.prototype.constructor=hS);hS.prototype._isHidden=function(e,t,n){let i=this._options;return!c(i.center)||!c(i.semiMajorAxis)||!c(i.semiMinorAxis)||ni.prototype._isHidden.call(this,e,t,n)};hS.prototype._setOptions=function(e,t,n){let i=this._options,o=X.getValueOrUndefined(t.height,n),r=X.getValueOrDefault(t.heightReference,n,We.NONE),s=X.getValueOrUndefined(t.extrudedHeight,n),a=X.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);c(s)&&!c(o)&&(o=0),i.center=X.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=X.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=X.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=X.getValueOrUndefined(t.rotation,n),i.granularity=X.getValueOrUndefined(t.granularity,n),i.stRotation=X.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=X.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=Gn.computeGeometryOffsetAttribute(o,r,s,a),i.height=Gn.getGeometryHeight(o,r),s=Gn.getGeometryExtrudedHeight(s,a),s===Gn.CLAMP_TO_GROUND&&(s=ui.getMinimumMaximumHeights(dl.computeRectangle(i,ame)).minimumTerrainHeight),i.extrudedHeight=s};var DN=Sh;var SJe=new d,wJe=new d,vJe=new d,DJe=new d,PJe=new d,IJe=new d(1,1,1),cme=Math.cos,lme=Math.sin;function J_(e){e=e??W.EMPTY_OBJECT;let t=e.radii??IJe,n=e.innerRadii??t,i=e.minimumClock??0,o=e.maximumClock??O.TWO_PI,r=e.minimumCone??0,s=e.maximumCone??O.PI,a=Math.round(e.stackPartitions??64),l=Math.round(e.slicePartitions??64),u=e.vertexFormat??Ie.DEFAULT;if(l<3)throw new E("options.slicePartitions cannot be less than three.");if(a<3)throw new E("options.stackPartitions cannot be less than three.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=l,this._vertexFormat=Ie.clone(u),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}J_.packedLength=2*d.packedLength+Ie.packedLength+7;J_.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=n??0,d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n]=e._offsetAttribute??-1,t};var ume=new d,fme=new d,dme=new Ie,o0={radii:ume,innerRadii:fme,vertexFormat:dme,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};J_.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i=d.unpack(e,t,ume);t+=d.packedLength;let o=d.unpack(e,t,fme);t+=d.packedLength;let r=Ie.unpack(e,t,dme);t+=Ie.packedLength;let s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++],p=e[t];return c(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=l,n._maximumCone=u,n._stackPartitions=f,n._slicePartitions=h,n._offsetAttribute=p===-1?void 0:p,n):(o0.minimumClock=s,o0.maximumClock=a,o0.minimumCone=l,o0.maximumCone=u,o0.stackPartitions=f,o0.slicePartitions=h,o0.offsetAttribute=p===-1?void 0:p,new J_(o0))};J_.createGeometry=function(e){let t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;let n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;let i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._vertexFormat,l=e._slicePartitions+1,u=e._stackPartitions+1;l=Math.round(l*Math.abs(o-i)/O.TWO_PI),u=Math.round(u*Math.abs(s-r)/O.PI),l<2&&(l=2),u<2&&(u=2);let f,h,p=0,g=[r],m=[i];for(f=0;f<u;f++)g.push(r+f*(s-r)/(u-1));for(g.push(s),h=0;h<l;h++)m.push(i+h*(o-i)/(l-1));m.push(o);let y=g.length,b=m.length,x=0,A=1,C=n.x!==t.x||n.y!==t.y||n.z!==t.z,S=!1,v=!1,P=!1;C&&(A=2,r>0&&(S=!0,x+=l-1),s<Math.PI&&(v=!0,x+=l-1),(o-i)%O.TWO_PI?(P=!0,x+=(u-1)*2+1):x+=1);let M=b*y*A,R=new Float64Array(M*3),L=new Array(M).fill(!1),F=new Array(M).fill(!1),_=l*u*A,w=6*(_+x+1-(l+u)*A),D=Fe.createTypedArray(_,w),I=a.normal?new Float32Array(M*3):void 0,N=a.tangent?new Float32Array(M*3):void 0,k=a.bitangent?new Float32Array(M*3):void 0,z=a.st?new Float32Array(M*2):void 0,V=new Array(y),j=new Array(y);for(f=0;f<y;f++)V[f]=lme(g[f]),j[f]=cme(g[f]);let U=new Array(b),q=new Array(b);for(h=0;h<b;h++)q[h]=cme(m[h]),U[h]=lme(m[h]);for(f=0;f<y;f++)for(h=0;h<b;h++)R[p++]=t.x*V[f]*q[h],R[p++]=t.y*V[f]*U[h],R[p++]=t.z*j[f];let Y=M/2;if(C)for(f=0;f<y;f++)for(h=0;h<b;h++)R[p++]=n.x*V[f]*q[h],R[p++]=n.y*V[f]*U[h],R[p++]=n.z*j[f],L[Y]=!0,f>0&&f!==y-1&&h!==0&&h!==b-1&&(F[Y]=!0),Y++;p=0;let te,K;for(f=1;f<y-2;f++)for(te=f*b,K=(f+1)*b,h=1;h<b-2;h++)D[p++]=K+h,D[p++]=K+h+1,D[p++]=te+h+1,D[p++]=K+h,D[p++]=te+h+1,D[p++]=te+h;if(C){let it=y*b;for(f=1;f<y-2;f++)for(te=it+f*b,K=it+(f+1)*b,h=1;h<b-2;h++)D[p++]=K+h,D[p++]=te+h,D[p++]=te+h+1,D[p++]=K+h,D[p++]=te+h+1,D[p++]=K+h+1}let Z,ee;if(C){if(S)for(ee=y*b,f=1;f<b-2;f++)D[p++]=f,D[p++]=f+1,D[p++]=ee+f+1,D[p++]=f,D[p++]=ee+f+1,D[p++]=ee+f;if(v)for(Z=y*b-b,ee=y*b*A-b,f=1;f<b-2;f++)D[p++]=Z+f+1,D[p++]=Z+f,D[p++]=ee+f,D[p++]=Z+f+1,D[p++]=ee+f,D[p++]=ee+f+1}if(P){for(f=1;f<y-2;f++)ee=b*y+b*f,Z=b*f,D[p++]=ee,D[p++]=Z+b,D[p++]=Z,D[p++]=ee,D[p++]=ee+b,D[p++]=Z+b;for(f=1;f<y-2;f++)ee=b*y+b*(f+1)-1,Z=b*(f+1)-1,D[p++]=Z+b,D[p++]=ee,D[p++]=Z,D[p++]=Z+b,D[p++]=ee+b,D[p++]=ee}let me=new fn;a.position&&(me.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:R}));let Te=0,ue=0,ye=0,Ae=0,Pe=M/2,Ee,ze=ie.fromCartesian3(t),qe=ie.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(f=0;f<M;f++){Ee=L[f]?qe:ze;let it=d.fromArray(R,f*3,SJe),Dt=Ee.geodeticSurfaceNormal(it,wJe);if(F[f]&&d.negate(Dt,Dt),a.st){let jt=H.negate(Dt,PJe);z[Te++]=Math.atan2(jt.y,jt.x)/O.TWO_PI+.5,z[Te++]=Math.asin(Dt.z)/Math.PI+.5}if(a.normal&&(I[ue++]=Dt.x,I[ue++]=Dt.y,I[ue++]=Dt.z),a.tangent||a.bitangent){let jt=vJe,$e=0,un;if(L[f]&&($e=Pe),!S&&f>=$e&&f<$e+b*2?un=d.UNIT_X:un=d.UNIT_Z,d.cross(un,Dt,jt),d.normalize(jt,jt),a.tangent&&(N[ye++]=jt.x,N[ye++]=jt.y,N[ye++]=jt.z),a.bitangent){let zt=d.cross(Dt,jt,DJe);d.normalize(zt,zt),k[Ae++]=zt.x,k[Ae++]=zt.y,k[Ae++]=zt.z}}}a.st&&(me.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:z})),a.normal&&(me.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:I})),a.tangent&&(me.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:N})),a.bitangent&&(me.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:k}))}if(c(e._offsetAttribute)){let it=R.length,Dt=e._offsetAttribute===Zt.NONE?0:1,jt=new Uint8Array(it/3).fill(Dt);me.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:jt})}return new ct({attributes:me,indices:D,primitiveType:Me.TRIANGLES,boundingSphere:le.fromEllipsoid(ze),offsetAttribute:e._offsetAttribute})};var f7;J_.getUnitEllipsoid=function(){return c(f7)||(f7=J_.createGeometry(new J_({radii:new d(1,1,1),vertexFormat:Ie.POSITION_ONLY}))),f7};var Js=J_;var OJe=new Ut(G.WHITE),d7=d.ZERO,h7=new d,RJe=new d,MJe=new d,m7=new G,LJe=new d(1,1,1);function NJe(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function Gu(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new NJe(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}c(Object.create)&&(Gu.prototype=Object.create(ii.prototype),Gu.prototype.constructor=Gu);Object.defineProperties(Gu.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Gu.prototype.createFillGeometryInstance=function(e,t,n){T.defined("time",e);let i=this._entity,o=i.isAvailable(e),r,s=new bn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),l=kn.fromDistanceDisplayCondition(a),u={show:s,distanceDisplayCondition:l,color:void 0,offset:void 0};if(this._materialProperty instanceof Ut){let f;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(f=this._materialProperty.color.getValue(e,m7)),c(f)||(f=G.WHITE),r=Gt.fromColor(f),u.color=r}return c(this._options.offsetAttribute)&&(u.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,d7,h7))),new St({id:i,geometry:new Js(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.ellipsoid,n),attributes:u})};Gu.prototype.createOutlineGeometryInstance=function(e,t,n){T.defined("time",e);let i=this._entity,o=i.isAvailable(e),r=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,m7),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new bn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(r),distanceDisplayCondition:kn.fromDistanceDisplayCondition(s),offset:void 0};return c(this._options.offsetAttribute)&&(a.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,d7,h7))),new St({id:i,geometry:new Nu(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.ellipsoid,n),attributes:a})};Gu.prototype._computeCenter=function(e,t){return X.getValueOrUndefined(this._entity.position,e,t)};Gu.prototype._isHidden=function(e,t){return!c(e.position)||!c(t.radii)||ii.prototype._isHidden.call(this,e,t)};Gu.prototype._isDynamic=function(e,t){return!e.position.isConstant||!X.isConstant(e.orientation)||!t.radii.isConstant||!X.isConstant(t.innerRadii)||!X.isConstant(t.stackPartitions)||!X.isConstant(t.slicePartitions)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.minimumClock)||!X.isConstant(t.maximumClock)||!X.isConstant(t.minimumCone)||!X.isConstant(t.maximumCone)||!X.isConstant(t.subdivisions)};Gu.prototype._setStaticOptions=function(e,t){let n=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Ut?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(Ge.MINIMUM_VALUE,i.radii),i.innerRadii=X.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=X.getValueOrUndefined(t.minimumClock,Ge.MINIMUM_VALUE),i.maximumClock=X.getValueOrUndefined(t.maximumClock,Ge.MINIMUM_VALUE),i.minimumCone=X.getValueOrUndefined(t.minimumCone,Ge.MINIMUM_VALUE),i.maximumCone=X.getValueOrUndefined(t.maximumCone,Ge.MINIMUM_VALUE),i.stackPartitions=X.getValueOrUndefined(t.stackPartitions,Ge.MINIMUM_VALUE),i.slicePartitions=X.getValueOrUndefined(t.slicePartitions,Ge.MINIMUM_VALUE),i.subdivisions=X.getValueOrUndefined(t.subdivisions,Ge.MINIMUM_VALUE),i.offsetAttribute=n!==We.NONE?Zt.ALL:void 0};Gu.prototype._onEntityPropertyChanged=qp;Gu.DynamicGeometryUpdater=PN;function PN(e,t,n){ni.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new B,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new d,this._material={}}c(Object.create)&&(PN.prototype=Object.create(ni.prototype),PN.prototype.constructor=PN);PN.prototype.update=function(e){T.defined("time",e);let t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!X.getValueOrDefault(n.show,e,!0)){c(this._primitive)&&(this._primitive.show=!1),c(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}let i=X.getValueOrUndefined(n.radii,e,RJe),o=c(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,i.z*.5,this._scene.ellipsoid,this._modelMatrix):void 0;if(!c(o)||!c(i)){c(this._primitive)&&(this._primitive.show=!1),c(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}let r=X.getValueOrDefault(n.fill,e,!0),s=X.getValueOrDefault(n.outline,e,!1),a=X.getValueOrClonedDefault(n.outlineColor,e,G.BLACK,m7),l=tr.getValue(e,n.material??OJe,this._material),u=X.getValueOrUndefined(n.innerRadii,e,MJe),f=X.getValueOrUndefined(n.minimumClock,e),h=X.getValueOrUndefined(n.maximumClock,e),p=X.getValueOrUndefined(n.minimumCone,e),g=X.getValueOrUndefined(n.maximumCone,e),m=X.getValueOrUndefined(n.stackPartitions,e),y=X.getValueOrUndefined(n.slicePartitions,e),b=X.getValueOrUndefined(n.subdivisions,e),x=X.getValueOrDefault(n.outlineWidth,e,1),A=X.getValueOrDefault(n.heightReference,e,We.NONE),C=A!==We.NONE?Zt.ALL:void 0,S=this._scene.mode,v=S===oe.SCENE3D&&A===We.NONE,P=this._options,M=this._geometryUpdater.shadowsProperty.getValue(e),L=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),F=X.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,d7,h7);if(!v||this._lastSceneMode!==S||!c(this._primitive)||P.stackPartitions!==m||P.slicePartitions!==y||c(u)&&!d.equals(P.innerRadii!==u)||P.minimumClock!==f||P.maximumClock!==h||P.minimumCone!==p||P.maximumCone!==g||P.subdivisions!==b||this._lastOutlineWidth!==x||P.offsetAttribute!==C){let w=this._primitives;w.removeAndDestroy(this._primitive),w.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=S,this._lastOutlineWidth=x,P.stackPartitions=m,P.slicePartitions=y,P.subdivisions=b,P.offsetAttribute=C,P.radii=d.clone(v?LJe:i,P.radii),c(u)?v?P.innerRadii=d.fromElements(u.x/i.x,u.y/i.y,u.z/i.z,P.innerRadii):P.innerRadii=d.clone(u,P.innerRadii):P.innerRadii=void 0,P.minimumClock=f,P.maximumClock=h,P.minimumCone=p,P.maximumCone=g;let D=new ao({material:l,translucent:l.isTranslucent(),closed:!0});P.vertexFormat=D.vertexFormat;let I=this._geometryUpdater.createFillGeometryInstance(e,v,this._modelMatrix);this._primitive=w.add(new Pn({geometryInstances:I,appearance:D,asynchronous:!1,shadows:M}));let N=this._geometryUpdater.createOutlineGeometryInstance(e,v,this._modelMatrix);this._outlinePrimitive=w.add(new Pn({geometryInstances:N,appearance:new rn({flat:!0,translucent:N.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(x)}}),asynchronous:!1,shadows:M})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=G.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=L,this._lastOffset=d.clone(F,this._lastOffset)}else if(this._primitive.ready){let w=this._primitive,D=this._outlinePrimitive;w.show=!0,D.show=!0,w.appearance.material=l;let I=this._attributes;c(I)||(I=w.getGeometryInstanceAttributes(t),this._attributes=I),r!==this._lastShow&&(I.show=bn.toValue(r,I.show),this._lastShow=r);let N=this._outlineAttributes;c(N)||(N=D.getGeometryInstanceAttributes(t),this._outlineAttributes=N),s!==this._lastOutlineShow&&(N.show=bn.toValue(s,N.show),this._lastOutlineShow=s),G.equals(a,this._lastOutlineColor)||(N.color=Gt.toValue(a,N.color),G.clone(a,this._lastOutlineColor)),Mt.equals(L,this._lastDistanceDisplayCondition)||(I.distanceDisplayCondition=kn.toValue(L,I.distanceDisplayCondition),N.distanceDisplayCondition=kn.toValue(L,N.distanceDisplayCondition),Mt.clone(L,this._lastDistanceDisplayCondition)),d.equals(F,this._lastOffset)||(I.offset=eo.toValue(F,I.offset),N.offset=eo.toValue(F,I.offset),d.clone(F,this._lastOffset))}v&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=B.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)};var IN=Gu;function mS(e){e=e??W.EMPTY_OBJECT;let t=e.vertexFormat??Ie.DEFAULT;this._vertexFormat=t,this._workerName="createPlaneGeometry"}mS.packedLength=Ie.packedLength;mS.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,Ie.pack(e._vertexFormat,t,n),t};var hme=new Ie,FJe={vertexFormat:hme};mS.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=Ie.unpack(e,t,hme);return c(n)?(n._vertexFormat=Ie.clone(i,n._vertexFormat),n):new mS(FJe)};var C4=new d(-.5,-.5,0),E4=new d(.5,.5,0);mS.createGeometry=function(e){let t=e._vertexFormat,n=new fn,i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=C4.x,o[1]=C4.y,o[2]=0,o[3]=E4.x,o[4]=C4.y,o[5]=0,o[6]=E4.x,o[7]=E4.y,o[8]=0,o[9]=C4.x,o[10]=E4.y,o[11]=0,n.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:o}),t.normal){let r=new Float32Array(12);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=1,r[9]=0,r[10]=0,r[11]=1,n.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:r})}if(t.st){let r=new Float32Array(8);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=1,r[5]=1,r[6]=0,r[7]=1,n.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:r})}if(t.tangent){let r=new Float32Array(12);r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=1,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,n.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:r})}if(t.bitangent){let r=new Float32Array(12);r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=1,r[8]=0,r[9]=0,r[10]=1,r[11]=0,n.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:r})}i=new Uint16Array(2*3),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3}return new ct({attributes:n,indices:i,primitiveType:Me.TRIANGLES,boundingSphere:new le(d.ZERO,Math.sqrt(2))})};var ON=mS;function pS(){this._workerName="createPlaneOutlineGeometry"}pS.packedLength=0;pS.pack=function(e,t){return T.defined("value",e),T.defined("array",t),t};pS.unpack=function(e,t,n){return T.defined("array",e),c(n)?n:new pS};var r0=new d(-.5,-.5,0),S4=new d(.5,.5,0);pS.createGeometry=function(){let e=new fn,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=r0.x,n[1]=r0.y,n[2]=r0.z,n[3]=S4.x,n[4]=r0.y,n[5]=r0.z,n[6]=S4.x,n[7]=S4.y,n[8]=r0.z,n[9]=r0.x,n[10]=S4.y,n[11]=r0.z,e.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:n}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new ct({attributes:e,indices:t,primitiveType:Me.LINES,boundingSphere:new le(d.ZERO,Math.sqrt(2))})};var RN=pS;var BJe=new d,mme=new G;function kJe(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function od(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new kJe(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}c(Object.create)&&(od.prototype=Object.create(ii.prototype),od.prototype.constructor=od);od.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i,o,r=new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=kn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Ut){let g;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,mme)),c(g)||(g=G.WHITE),o=Gt.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};let l=t.plane,u=this._options,f=t.computeModelMatrix(e),h=X.getValueOrDefault(l.plane,e,u.plane),p=X.getValueOrUndefined(l.dimensions,e,u.dimensions);return u.plane=h,u.dimensions=p,f=p7(h,p,f,f),new St({id:t,geometry:new ON(this._options),modelMatrix:f,attributes:i})};od.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,mme),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options,a=t.computeModelMatrix(e),l=X.getValueOrDefault(r.plane,e,s.plane),u=X.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=l,s.dimensions=u,a=p7(l,u,a,a),new St({id:t,geometry:new RN,modelMatrix:a,attributes:{show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o)}})};od.prototype._isHidden=function(e,t){return!c(t.plane)||!c(t.dimensions)||!c(e.position)||ii.prototype._isHidden.call(this,e,t)};od.prototype._getIsClosed=function(e){return!1};od.prototype._isDynamic=function(e,t){return!e.position.isConstant||!X.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!X.isConstant(t.outlineWidth)};od.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Ut,i=this._options;i.vertexFormat=n?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(Ge.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(Ge.MINIMUM_VALUE,i.dimensions)};od.DynamicGeometryUpdater=_S;function _S(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(_S.prototype=Object.create(ni.prototype),_S.prototype.constructor=_S);_S.prototype._isHidden=function(e,t,n){let i=this._options,o=X.getValueOrUndefined(e.position,n,BJe);return!c(o)||!c(i.plane)||!c(i.dimensions)||ni.prototype._isHidden.call(this,e,t,n)};_S.prototype._setOptions=function(e,t,n){let i=this._options;i.plane=X.getValueOrDefault(t.plane,n,i.plane),i.dimensions=X.getValueOrUndefined(t.dimensions,n,i.dimensions)};var UJe=new d,VJe=new d,zJe=new d,HJe=new d,GJe=new J,jJe=new J,WJe=new B;function p7(e,t,n,i){let o=e.normal,r=e.distance,s=d.multiplyByScalar(o,-r,zJe),a=d.clone(d.UNIT_Z,VJe);O.equalsEpsilon(Math.abs(d.dot(a,o)),1,O.EPSILON8)&&(a=d.clone(d.UNIT_Y,a));let l=d.cross(a,o,UJe);a=d.cross(o,l,a),d.normalize(l,l),d.normalize(a,a);let u=GJe;J.setColumn(u,0,l,u),J.setColumn(u,1,a,u),J.setColumn(u,2,o,u);let f=d.fromElements(t.x,t.y,1,HJe),h=J.multiplyByScale(u,f,jJe),p=B.fromRotationTranslation(h,s,WJe);return B.multiplyTransformation(n,p,i)}od.createPrimitiveMatrix=p7;var MN=od;var qJe=new d,YJe=new Ke,XJe=new H,KJe=new H,$Je=new d,ZJe=new d,QJe=new d,LN=new d,JJe=new d,eet=new d,pme=new Le,tet=new J,net=new J,iet=new d;function oet(e,t,n,i,o,r,s,a,l){let u=e.positions,f=si.triangulate(e.positions2D,e.holes);f.length<3&&(f=[0,1,2]);let h=Fe.createTypedArray(u.length,f.length);h.set(f);let p=tet;if(i!==0){let _=Le.fromAxisAngle(s,i,pme);if(p=J.fromQuaternion(_,p),t.tangent||t.bitangent){_=Le.fromAxisAngle(s,-i,pme);let w=J.fromQuaternion(_,net);a=d.normalize(J.multiplyByVector(w,a,a),a),t.bitangent&&(l=d.normalize(d.cross(s,a,l),l))}}else p=J.clone(J.IDENTITY,p);let g=KJe;t.st&&(g.x=n.x,g.y=n.y);let m=u.length,y=m*3,b=new Float64Array(y),x=t.normal?new Float32Array(y):void 0,A=t.tangent?new Float32Array(y):void 0,C=t.bitangent?new Float32Array(y):void 0,S=t.st?new Float32Array(m*2):void 0,v=0,P=0,M=0,R=0,L=0;for(let _=0;_<m;_++){let w=u[_];if(b[v++]=w.x,b[v++]=w.y,b[v++]=w.z,t.st)if(c(o)&&o.positions.length===m)S[L++]=o.positions[_].x,S[L++]=o.positions[_].y;else{let D=J.multiplyByVector(p,w,qJe),I=r(D,XJe);H.subtract(I,g,I);let N=O.clamp(I.x/n.width,0,1),k=O.clamp(I.y/n.height,0,1);S[L++]=N,S[L++]=k}t.normal&&(x[P++]=s.x,x[P++]=s.y,x[P++]=s.z),t.tangent&&(A[R++]=a.x,A[R++]=a.y,A[R++]=a.z),t.bitangent&&(C[M++]=l.x,C[M++]=l.y,C[M++]=l.z)}let F=new fn;return t.position&&(F.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:b})),t.normal&&(F.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:x})),t.tangent&&(F.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:A})),t.bitangent&&(F.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:C})),t.st&&(F.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:S})),new ct({attributes:F,indices:h,primitiveType:Me.TRIANGLES})}function fT(e){e=e??W.EMPTY_OBJECT;let t=e.polygonHierarchy,n=e.textureCoordinates;T.defined("options.polygonHierarchy",t);let i=e.vertexFormat??Ie.DEFAULT;this._vertexFormat=Ie.clone(i),this._polygonHierarchy=t,this._stRotation=e.stRotation??0,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=zn.computeHierarchyPackedLength(t,d)+Ie.packedLength+ie.packedLength+(c(n)?zn.computeHierarchyPackedLength(n,H):1)+2}fT.fromPositions=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.positions",e.positions);let t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new fT(t)};fT.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,n=zn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._stRotation,c(e._textureCoordinates)?n=zn.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};var ret=ie.clone(ie.UNIT_SPHERE),set=new Ie,aet={polygonHierarchy:{}};fT.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=zn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,ret);t+=ie.packedLength;let r=Ie.unpack(e,t,set);t+=Ie.packedLength;let s=e[t++],a=e[t]===-1?void 0:zn.unpackPolygonHierarchy(e,t,H);c(a)?(t=a.startingIndex,delete a.startingIndex):t++;let l=e[t++];return c(n)||(n=new fT(aet)),n._polygonHierarchy=i,n._ellipsoid=ie.clone(o,n._ellipsoid),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=l,n};fT.createGeometry=function(e){let t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=c(o),s=n.positions;if(s=xo(s,d.equalsEpsilon,!0),s.length<3)return;let a=$Je,l=ZJe,u=QJe,f=JJe,h=eet;if(!O_.computeProjectTo2DArguments(s,LN,f,h))return;if(a=d.cross(f,h,a),a=d.normalize(a,a),!d.equalsEpsilon(LN,d.ZERO,O.EPSILON6)){let L=e._ellipsoid.geodeticSurfaceNormal(LN,iet);d.dot(a,L)<0&&(a=d.negate(a,a),f=d.negate(f,f))}let g=O_.createProjectPointsTo2DFunction(LN,f,h),m=O_.createProjectPointTo2DFunction(LN,f,h);t.tangent&&(l=d.clone(f,l)),t.bitangent&&(u=d.clone(h,u));let y=zn.polygonsFromHierarchy(n,r,g,!1),b=y.hierarchy,x=y.polygons,A=function(L){return L},C=r?zn.polygonsFromHierarchy(o,!0,A,!1).polygons:void 0;if(b.length===0)return;s=b[0].outerRing;let S=le.fromPoints(s),v=zn.computeBoundingRectangle(a,m,s,i,YJe),P=[];for(let L=0;L<x.length;L++){let F=new St({geometry:oet(x[L],t,v,i,r?C[L]:void 0,m,a,l,u)});P.push(F)}let M=Nn.combineInstances(P)[0];M.attributes.position.values=new Float64Array(M.attributes.position.values),M.indices=Fe.createTypedArray(M.attributes.position.values.length/3,M.indices);let R=M.attributes;return t.position||delete R.position,new ct({attributes:R,indices:M.indices,primitiveType:M.primitiveType,boundingSphere:S})};var NN=fT;var _me=[],w4=[];function cet(e,t,n,i,o){let s=ns.fromPoints(t,e).projectPointsOntoPlane(t,_me);si.computeWindingOrder2D(s)===ts.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let l,u,f=t.length,h=0;if(i)for(l=new Float64Array(f*2*3),u=0;u<f;u++){let m=t[u],y=t[(u+1)%f];l[h++]=m.x,l[h++]=m.y,l[h++]=m.z,l[h++]=y.x,l[h++]=y.y,l[h++]=y.z}else{let m=0;if(o===qt.GEODESIC)for(u=0;u<f;u++)m+=zn.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===qt.RHUMB)for(u=0;u<f;u++)m+=zn.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(l=new Float64Array(m*3),u=0;u<f;u++){let y;o===qt.GEODESIC?y=zn.subdivideLine(t[u],t[(u+1)%f],n,w4):o===qt.RHUMB&&(y=zn.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,w4));let b=y.length;for(let x=0;x<b;++x)l[h++]=y[x]}}f=l.length/3;let p=f*2,g=Fe.createTypedArray(f,p);for(h=0,u=0;u<f-1;u++)g[h++]=u,g[h++]=u+1;return g[h++]=f-1,g[h++]=0,new St({geometry:new ct({attributes:new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:l})}),indices:g,primitiveType:Me.LINES})})}function uet(e,t,n,i,o){let s=ns.fromPoints(t,e).projectPointsOntoPlane(t,_me);si.computeWindingOrder2D(s)===ts.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let l,u,f=t.length,h=new Array(f),p=0;if(i)for(l=new Float64Array(f*2*3*2),u=0;u<f;++u){h[u]=p/3;let b=t[u],x=t[(u+1)%f];l[p++]=b.x,l[p++]=b.y,l[p++]=b.z,l[p++]=x.x,l[p++]=x.y,l[p++]=x.z}else{let b=0;if(o===qt.GEODESIC)for(u=0;u<f;u++)b+=zn.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===qt.RHUMB)for(u=0;u<f;u++)b+=zn.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(l=new Float64Array(b*3*2),u=0;u<f;++u){h[u]=p/3;let x;o===qt.GEODESIC?x=zn.subdivideLine(t[u],t[(u+1)%f],n,w4):o===qt.RHUMB&&(x=zn.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,w4));let A=x.length;for(let C=0;C<A;++C)l[p++]=x[C]}}f=l.length/(3*2);let g=h.length,m=(f*2+g)*2,y=Fe.createTypedArray(f+g,m);for(p=0,u=0;u<f;++u)y[p++]=u,y[p++]=(u+1)%f,y[p++]=u+f,y[p++]=(u+1)%f+f;for(u=0;u<g;u++){let b=h[u];y[p++]=b,y[p++]=b+f}return new St({geometry:new ct({attributes:new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:l})}),indices:y,primitiveType:Me.LINES})})}function dT(e){if(T.typeOf.object("options",e),T.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),e.perPositionHeight&&c(e.height))throw new E("Cannot use both options.perPositionHeight and options.height");if(c(e.arcType)&&e.arcType!==qt.GEODESIC&&e.arcType!==qt.RHUMB)throw new E("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");let t=e.polygonHierarchy,n=e.ellipsoid??ie.default,i=e.granularity??O.RADIANS_PER_DEGREE,o=e.perPositionHeight??!1,r=o&&c(e.extrudedHeight),s=e.arcType??qt.GEODESIC,a=e.height??0,l=e.extrudedHeight??a;if(!r){let u=Math.max(a,l);l=Math.min(a,l),a=u}this._ellipsoid=ie.clone(n),this._granularity=i,this._height=a,this._extrudedHeight=l,this._arcType=s,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=zn.computeHierarchyPackedLength(t,d)+ie.packedLength+8}dT.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,n=zn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._arcType,t[n++]=e._offsetAttribute??-1,t[n]=e.packedLength,t};var fet=ie.clone(ie.UNIT_SPHERE),det={polygonHierarchy:{}};dT.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=zn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,fet);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],l=e[t++]===1,u=e[t++]===1,f=e[t++],h=e[t++],p=e[t];return c(n)||(n=new dT(det)),n._polygonHierarchy=i,n._ellipsoid=ie.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=u,n._perPositionHeightExtrude=l,n._arcType=f,n._offsetAttribute=h===-1?void 0:h,n.packedLength=p,n};dT.fromPositions=function(e){e=e??W.EMPTY_OBJECT,T.defined("options.positions",e.positions);let t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute};return new dT(t)};dT.createGeometry=function(e){let t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=zn.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a,l=[],u=O.chordLength(n,t.maximumRadius),f=e._height,h=e._extrudedHeight,p=e._perPositionHeightExtrude||!O.equalsEpsilon(f,h,0,O.EPSILON2),g,m;if(p)for(m=0;m<s.length;m++){if(a=uet(t,s[m],u,o,r),a.geometry=zn.scaleToGeodeticHeightExtruded(a.geometry,f,h,t,o),c(e._offsetAttribute)){let x=a.geometry.attributes.position.values.length/3,A=new Uint8Array(x);e._offsetAttribute===Zt.TOP?A=A.fill(1,0,x/2):(g=e._offsetAttribute===Zt.NONE?0:1,A=A.fill(g)),a.geometry.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}l.push(a)}else for(m=0;m<s.length;m++){if(a=cet(t,s[m],u,o,r),a.geometry.attributes.position.values=si.scaleToGeodeticHeight(a.geometry.attributes.position.values,f,t,!o),c(e._offsetAttribute)){let x=a.geometry.attributes.position.values.length;g=e._offsetAttribute===Zt.NONE?0:1;let A=new Uint8Array(x/3).fill(g);a.geometry.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}l.push(a)}let y=Nn.combineInstances(l)[0],b=le.fromVertices(y.attributes.position.values);return new ct({attributes:y.attributes,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:b,offsetAttribute:e._offsetAttribute})};var FN=dT;var gme="Entity polygons cannot have both height and perPositionHeight.  height will be ignored",yme="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",bme=new G,xme=d.ZERO,Tme=new d,Ame=new ce,het=[],met=new H;function pet(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0,this.textureCoordinates=void 0}function ju(e,t){Gn.call(this,{entity:e,scene:t,geometryOptions:new pet(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}c(Object.create)&&(ju.prototype=Object.create(Gn.prototype),ju.prototype.constructor=ju);ju.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:kn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Ut){let s;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,bme)),c(s)||(s=G.WHITE),o.color=Gt.fromColor(s)}c(i.offsetAttribute)&&(o.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,xme,Tme)));let r;return i.perPositionHeight&&!c(i.extrudedHeight)?r=new NN(i):r=new s_(i),new St({id:t,geometry:r,attributes:o})};ju.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=this._options,o=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,bme),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(o),distanceDisplayCondition:kn.fromDistanceDisplayCondition(r),offset:void 0};c(i.offsetAttribute)&&(s.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,xme,Tme)));let a;return i.perPositionHeight&&!c(i.extrudedHeight)?a=new $f(i):a=new FN(i),new St({id:t,geometry:a,attributes:s})};ju.prototype._computeCenter=function(e,t){let n=X.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!c(n))return;let i=n.positions;if(i.length===0)return;let o=this._scene.ellipsoid,r=ns.fromPoints(i,o),s=r.projectPointsOntoPlane(i,het),a=s.length,l=0,u=a-1,f=new H;for(let p=0;p<a;u=p++){let g=s[p],m=s[u],y=g.x*m.y-m.x*g.y,b=H.add(g,m,met);b=H.multiplyByScalar(b,y,b),f=H.add(f,b,f),l+=y}let h=1/(l*3);return f=H.multiplyByScalar(f,h,f),r.projectPointOntoEllipsoid(f,t)};ju.prototype._isHidden=function(e,t){return!c(t.hierarchy)||ii.prototype._isHidden.call(this,e,t)};ju.prototype._isOnTerrain=function(e,t){let n=Gn.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=c(i)&&(i.isConstant?i.getValue(Ge.MINIMUM_VALUE):!0);return n&&!o};ju.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!X.isConstant(t.height)||!X.isConstant(t.extrudedHeight)||!X.isConstant(t.granularity)||!X.isConstant(t.stRotation)||!X.isConstant(t.textureCoordinates)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.perPositionHeight)||!X.isConstant(t.closeTop)||!X.isConstant(t.closeBottom)||!X.isConstant(t.zIndex)||!X.isConstant(t.arcType)||this._onTerrain&&!X.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Ut)};ju.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Ut,i=this._options;i.vertexFormat=n?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat;let o=t.hierarchy.getValue(Ge.MINIMUM_VALUE),r=X.getValueOrUndefined(t.height,Ge.MINIMUM_VALUE),s=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),a=X.getValueOrUndefined(t.extrudedHeight,Ge.MINIMUM_VALUE),l=X.getValueOrDefault(t.extrudedHeightReference,Ge.MINIMUM_VALUE,We.NONE),u=X.getValueOrDefault(t.perPositionHeight,Ge.MINIMUM_VALUE,!1);r=Gn.getGeometryHeight(r,s);let f;if(u?(c(r)&&(r=void 0,dt(gme)),s!==We.NONE&&u&&(r=void 0,dt(yme))):(c(a)&&!c(r)&&(r=0),f=Gn.computeGeometryOffsetAttribute(r,s,a,l)),i.polygonHierarchy=o,i.granularity=X.getValueOrUndefined(t.granularity,Ge.MINIMUM_VALUE),i.stRotation=X.getValueOrUndefined(t.stRotation,Ge.MINIMUM_VALUE),i.perPositionHeight=u,i.closeTop=X.getValueOrDefault(t.closeTop,Ge.MINIMUM_VALUE,!0),i.closeBottom=X.getValueOrDefault(t.closeBottom,Ge.MINIMUM_VALUE,!0),i.offsetAttribute=f,i.height=r,i.arcType=X.getValueOrDefault(t.arcType,Ge.MINIMUM_VALUE,qt.GEODESIC),i.textureCoordinates=X.getValueOrUndefined(t.textureCoordinates,Ge.MINIMUM_VALUE),a=Gn.getGeometryExtrudedHeight(a,l),a===Gn.CLAMP_TO_GROUND){let h=s_.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,Ame);a=ui.getMinimumMaximumHeights(h).minimumTerrainHeight}i.extrudedHeight=a};ju.prototype._getIsClosed=function(e){let t=e.height,n=e.extrudedHeight,i=c(n)&&n!==t;return!e.perPositionHeight&&(!i&&t===0||i&&e.closeTop&&e.closeBottom)};ju.DynamicGeometryUpdater=gS;function gS(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(gS.prototype=Object.create(ni.prototype),gS.prototype.constructor=gS);gS.prototype._isHidden=function(e,t,n){return!c(this._options.polygonHierarchy)||ni.prototype._isHidden.call(this,e,t,n)};gS.prototype._setOptions=function(e,t,n){let i=this._options;i.polygonHierarchy=X.getValueOrUndefined(t.hierarchy,n);let o=X.getValueOrUndefined(t.height,n),r=X.getValueOrDefault(t.heightReference,n,We.NONE),s=X.getValueOrDefault(t.extrudedHeightReference,n,We.NONE),a=X.getValueOrUndefined(t.extrudedHeight,n),l=X.getValueOrUndefined(t.perPositionHeight,n);o=Gn.getGeometryHeight(o,s);let u;if(l?(c(o)&&(o=void 0,dt(gme)),r!==We.NONE&&l&&(o=void 0,dt(yme))):(c(a)&&!c(o)&&(o=0),u=Gn.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=X.getValueOrUndefined(t.granularity,n),i.stRotation=X.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=X.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=X.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=X.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=X.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=u,i.height=o,i.arcType=X.getValueOrDefault(t.arcType,n,qt.GEODESIC),a=Gn.getGeometryExtrudedHeight(a,s),a===Gn.CLAMP_TO_GROUND){let f=s_.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,Ame);a=ui.getMinimumMaximumHeights(f).minimumTerrainHeight}i.extrudedHeight=a};var BN=ju;function _et(e,t,n,i){let o=new fn;i.position&&(o.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:e}));let r=t.length,s=e.length/3,a=(s-r*2)/(r*2),l=si.triangulate(t),u=(a-1)*r*6+l.length*2,f=Fe.createTypedArray(s,u),h,p,g,m,y,b,x=r*2,A=0;for(h=0;h<a-1;h++){for(p=0;p<r-1;p++)g=p*2+h*r*2,b=g+x,m=g+1,y=m+x,f[A++]=m,f[A++]=g,f[A++]=y,f[A++]=y,f[A++]=g,f[A++]=b;g=r*2-2+h*r*2,m=g+1,y=m+x,b=g+x,f[A++]=m,f[A++]=g,f[A++]=y,f[A++]=y,f[A++]=g,f[A++]=b}if(i.st||i.tangent||i.bitangent){let v=new Float32Array(s*2),P=1/(a-1),M=1/n.height,R=n.height/2,L,F,_=0;for(h=0;h<a;h++){for(L=h*P,F=M*(t[0].y+R),v[_++]=L,v[_++]=F,p=1;p<r;p++)F=M*(t[p].y+R),v[_++]=L,v[_++]=F,v[_++]=L,v[_++]=F;F=M*(t[0].y+R),v[_++]=L,v[_++]=F}for(p=0;p<r;p++)L=0,F=M*(t[p].y+R),v[_++]=L,v[_++]=F;for(p=0;p<r;p++)L=(a-1)*P,F=M*(t[p].y+R),v[_++]=L,v[_++]=F;o.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:new Float32Array(v)})}let C=s-r*2;for(h=0;h<l.length;h+=3){let v=l[h]+C,P=l[h+1]+C,M=l[h+2]+C;f[A++]=v,f[A++]=P,f[A++]=M,f[A++]=M+r,f[A++]=P+r,f[A++]=v+r}let S=new ct({attributes:o,indices:f,boundingSphere:le.fromVertices(e),primitiveType:Me.TRIANGLES});if(i.normal&&(S=Nn.computeNormal(S)),i.tangent||i.bitangent){try{S=Nn.computeTangentAndBitangent(S)}catch{dt("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}i.tangent||(S.attributes.tangent=void 0),i.bitangent||(S.attributes.bitangent=void 0),i.st||(S.attributes.st=void 0)}return S}function UN(e){e=e??W.EMPTY_OBJECT;let t=e.polylinePositions,n=e.shapePositions;if(!c(t))throw new E("options.polylinePositions is required.");if(!c(n))throw new E("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._cornerType=e.cornerType??Bi.ROUNDED,this._vertexFormat=Ie.clone(e.vertexFormat??Ie.DEFAULT),this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._workerName="createPolylineVolumeGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ie.packedLength+Ie.packedLength+2}UN.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(s[i],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var Cme=ie.clone(ie.UNIT_SPHERE),Eme=new Ie,kN={polylinePositions:void 0,shapePositions:void 0,ellipsoid:Cme,vertexFormat:Eme,cornerType:void 0,granularity:void 0};UN.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)s[i]=H.unpack(e,t);let a=ie.unpack(e,t,Cme);t+=ie.packedLength;let l=Ie.unpack(e,t,Eme);t+=Ie.packedLength;let u=e[t++],f=e[t];return c(n)?(n._positions=r,n._shape=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._vertexFormat=Ie.clone(l,n._vertexFormat),n._cornerType=u,n._granularity=f,n):(kN.polylinePositions=r,kN.shapePositions=s,kN.cornerType=u,kN.granularity=f,new UN(kN))};var get=new Ke;UN.createGeometry=function(e){let t=e._positions,n=xo(t,d.equalsEpsilon),i=e._shape;if(i=yh.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;si.computeWindingOrder2D(i)===ts.CLOCKWISE&&i.reverse();let o=Ke.fromPoints(i,get),r=yh.computePositions(n,i,o,e,!0);return _et(r,i,o,e._vertexFormat)};var VN=UN;function yet(e,t){let n=new fn;n.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:e});let i=t.length,o=n.position.values.length/3,s=e.length/3/i,a=Fe.createTypedArray(o,2*i*(s+1)),l,u,f=0;l=0;let h=l*i;for(u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,l=s-1,h=l*i,u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,l=0;l<s-1;l++){let g=i*l,m=g+i;for(u=0;u<i;u++)a[f++]=u+g,a[f++]=u+m}return new ct({attributes:n,indices:Fe.createTypedArray(o,a),boundingSphere:le.fromVertices(e),primitiveType:Me.LINES})}function HN(e){e=e??W.EMPTY_OBJECT;let t=e.polylinePositions,n=e.shapePositions;if(!c(t))throw new E("options.polylinePositions is required.");if(!c(n))throw new E("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._cornerType=e.cornerType??Bi.ROUNDED,this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ie.packedLength+2}HN.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(s[i],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};var Sme=ie.clone(ie.UNIT_SPHERE),zN={polylinePositions:void 0,shapePositions:void 0,ellipsoid:Sme,height:void 0,cornerType:void 0,granularity:void 0};HN.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)s[i]=H.unpack(e,t);let a=ie.unpack(e,t,Sme);t+=ie.packedLength;let l=e[t++],u=e[t];return c(n)?(n._positions=r,n._shape=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._cornerType=l,n._granularity=u,n):(zN.polylinePositions=r,zN.shapePositions=s,zN.cornerType=l,zN.granularity=u,new HN(zN))};var bet=new Ke;HN.createGeometry=function(e){let t=e._positions,n=xo(t,d.equalsEpsilon),i=e._shape;if(i=yh.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;si.computeWindingOrder2D(i)===ts.CLOCKWISE&&i.reverse();let o=Ke.fromPoints(i,bet),r=yh.computePositions(n,i,o,e,!1);return yet(r,i)};var GN=HN;var wme=new G;function xet(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function Um(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new xet(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}c(Object.create)&&(Um.prototype=Object.create(ii.prototype),Um.prototype.constructor=Um);Um.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i,o,r=new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=kn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Ut){let l;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(l=this._materialProperty.color.getValue(e,wme)),c(l)||(l=G.WHITE),o=Gt.fromColor(l),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new St({id:t,geometry:new VN(this._options),attributes:i})};Um.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,wme),o=this._distanceDisplayConditionProperty.getValue(e);return new St({id:t,geometry:new GN(this._options),attributes:{show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o)}})};Um.prototype._isHidden=function(e,t){return!c(t.positions)||!c(t.shape)||ii.prototype._isHidden.call(this,e,t)};Um.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!X.isConstant(t.granularity)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.cornerType)};Um.prototype._setStaticOptions=function(e,t){let n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof Ut;o.vertexFormat=r?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(Ge.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(Ge.MINIMUM_VALUE,o.shape),o.granularity=c(n)?n.getValue(Ge.MINIMUM_VALUE):void 0,o.cornerType=c(i)?i.getValue(Ge.MINIMUM_VALUE):void 0};Um.DynamicGeometryUpdater=yS;function yS(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(yS.prototype=Object.create(ni.prototype),yS.prototype.constructor=yS);yS.prototype._isHidden=function(e,t,n){let i=this._options;return!c(i.polylinePositions)||!c(i.shapePositions)||ni.prototype._isHidden.call(this,e,t,n)};yS.prototype._setOptions=function(e,t,n){let i=this._options;i.polylinePositions=X.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=X.getValueOrUndefined(t.shape,n),i.granularity=X.getValueOrUndefined(t.granularity,n),i.cornerType=X.getValueOrUndefined(t.cornerType,n)};var jN=Um;var _7=new d,Pme=new d,Ime=new d,Ome=new d,Rme=new ce,Tet=new H,Aet=new le,Cet=new le;function Mme(e,t){let n=new ct({attributes:new fn,primitiveType:Me.TRIANGLES});return n.attributes.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function Eet(e,t,n,i){let o=e.length,r=t.normal?new Float32Array(o):void 0,s=t.tangent?new Float32Array(o):void 0,a=t.bitangent?new Float32Array(o):void 0,l=0,u=Ome,f=Ime,h=Pme;if(t.normal||t.tangent||t.bitangent)for(let p=0;p<o;p+=3){let g=d.fromArray(e,p,_7),m=l+1,y=l+2;h=n.geodeticSurfaceNormal(g,h),(t.tangent||t.bitangent)&&(d.cross(d.UNIT_Z,h,f),J.multiplyByVector(i,f,f),d.normalize(f,f),t.bitangent&&d.normalize(d.cross(h,f,u),u)),t.normal&&(r[l]=h.x,r[m]=h.y,r[y]=h.z),t.tangent&&(s[l]=f.x,s[m]=f.y,s[y]=f.z),t.bitangent&&(a[l]=u.x,a[m]=u.y,a[y]=u.z),l+=3}return Mme(t,{positions:e,normals:r,tangents:s,bitangents:a})}var g7=new d,Lme=new d;function wet(e,t,n){let i=e.length,o=t.normal?new Float32Array(i):void 0,r=t.tangent?new Float32Array(i):void 0,s=t.bitangent?new Float32Array(i):void 0,a=0,l=0,u=0,f=!0,h=Ome,p=Ime,g=Pme;if(t.normal||t.tangent||t.bitangent)for(let m=0;m<i;m+=6){let y=d.fromArray(e,m,_7),b=d.fromArray(e,(m+6)%i,g7);if(f){let x=d.fromArray(e,(m+3)%i,Lme);d.subtract(b,y,b),d.subtract(x,y,x),g=d.normalize(d.cross(x,b,g),g),f=!1}d.equalsEpsilon(b,y,O.EPSILON10)&&(f=!0),(t.tangent||t.bitangent)&&(h=n.geodeticSurfaceNormal(y,h),t.tangent&&(p=d.normalize(d.cross(h,g,p),p))),t.normal&&(o[a++]=g.x,o[a++]=g.y,o[a++]=g.z,o[a++]=g.x,o[a++]=g.y,o[a++]=g.z),t.tangent&&(r[l++]=p.x,r[l++]=p.y,r[l++]=p.z,r[l++]=p.x,r[l++]=p.y,r[l++]=p.z),t.bitangent&&(s[u++]=h.x,s[u++]=h.y,s[u++]=h.z,s[u++]=h.x,s[u++]=h.y,s[u++]=h.z)}return Mme(t,{positions:e,normals:o,tangents:r,bitangents:s})}function Nme(e,t){let n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap,l=0,u=o,f=o,h=0;s&&(l=1,f-=1,h+=1),a&&(u-=1,f-=1,h+=1),h+=r*f;let p=n.position?new Float64Array(h*3):void 0,g=n.st?new Float32Array(h*2):void 0,m=0,y=0,b=_7,x=Tet,A=Number.MAX_VALUE,C=Number.MAX_VALUE,S=-Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let w=l;w<u;++w)for(let D=0;D<r;++D)Is.computePosition(t,i,n.st,w,D,b,x),p[m++]=b.x,p[m++]=b.y,p[m++]=b.z,n.st&&(g[y++]=x.x,g[y++]=x.y,A=Math.min(A,x.x),C=Math.min(C,x.y),S=Math.max(S,x.x),v=Math.max(v,x.y));if(s&&(Is.computePosition(t,i,n.st,0,0,b,x),p[m++]=b.x,p[m++]=b.y,p[m++]=b.z,n.st&&(g[y++]=x.x,g[y++]=x.y,A=x.x,C=x.y,S=x.x,v=x.y)),a&&(Is.computePosition(t,i,n.st,o-1,0,b,x),p[m++]=b.x,p[m++]=b.y,p[m]=b.z,n.st&&(g[y++]=x.x,g[y]=x.y,A=Math.min(A,x.x),C=Math.min(C,x.y),S=Math.max(S,x.x),v=Math.max(v,x.y))),n.st&&(A<0||C<0||S>1||v>1))for(let w=0;w<g.length;w+=2)g[w]=(g[w]-A)/(S-A),g[w+1]=(g[w+1]-C)/(v-C);let P=Eet(p,n,i,t.tangentRotationMatrix),M=6*(r-1)*(f-1);s&&(M+=3*(r-1)),a&&(M+=3*(r-1));let R=Fe.createTypedArray(h,M),L=0,F=0,_;for(_=0;_<f-1;++_){for(let w=0;w<r-1;++w){let D=L,I=D+r,N=I+1,k=D+1;R[F++]=D,R[F++]=I,R[F++]=k,R[F++]=k,R[F++]=I,R[F++]=N,++L}++L}if(s||a){let w=h-1,D=h-1;s&&a&&(w=h-2);let I,N;if(L=0,s)for(_=0;_<r-1;_++)I=L,N=I+1,R[F++]=w,R[F++]=I,R[F++]=N,++L;if(a)for(L=(f-1)*r,_=0;_<r-1;_++)I=L,N=I+1,R[F++]=I,R[F++]=D,R[F++]=N,++L}return P.indices=R,n.st&&(P.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:g})),P}function bS(e,t,n,i,o){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n+2],e[t++]=o[n],e[t++]=o[n+1],e[t]=o[n+2],e}function xS(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}var y7=new Ie;function vet(e,t){let n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,l=t.height,u=t.width,f;if(n){let $e=Ie.clone(o,y7);$e.normal=!0,e._vertexFormat=$e}let h=Nme(e,t);n&&(e._vertexFormat=o);let p=si.scaleToGeodeticHeight(h.attributes.position.values,s,a,!1);p=new Float64Array(p);let g=p.length,m=g*2,y=new Float64Array(m);y.set(p);let b=si.scaleToGeodeticHeight(h.attributes.position.values,r,a);y.set(b,g),h.attributes.position.values=y;let x=o.normal?new Float32Array(m):void 0,A=o.tangent?new Float32Array(m):void 0,C=o.bitangent?new Float32Array(m):void 0,S=o.st?new Float32Array(m/3*2):void 0,v,P;if(o.normal){for(P=h.attributes.normal.values,x.set(P),f=0;f<g;f++)P[f]=-P[f];x.set(P,g),h.attributes.normal.values=x}if(n){P=h.attributes.normal.values,o.normal||(h.attributes.normal=void 0);let $e=new Float32Array(m);for(f=0;f<g;f++)P[f]=-P[f];$e.set(P,g),h.attributes.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:$e})}let M,R=c(i);if(R){let $e=g/3*2,un=new Uint8Array($e);i===Zt.TOP?un=un.fill(1,0,$e/2):(M=i===Zt.NONE?0:1,un=un.fill(M)),h.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:un})}if(o.tangent){let $e=h.attributes.tangent.values;for(A.set($e),f=0;f<g;f++)$e[f]=-$e[f];A.set($e,g),h.attributes.tangent.values=A}if(o.bitangent){let $e=h.attributes.bitangent.values;C.set($e),C.set($e,g),h.attributes.bitangent.values=C}o.st&&(v=h.attributes.st.values,S.set(v),S.set(v,g/3*2),h.attributes.st.values=S);let L=h.indices,F=L.length,_=g/3,w=Fe.createTypedArray(m/3,F*2);for(w.set(L),f=0;f<F;f+=3)w[f+F]=L[f+2]+_,w[f+1+F]=L[f+1]+_,w[f+2+F]=L[f]+_;h.indices=w;let D=t.northCap,I=t.southCap,N=l,k=2,z=0,V=4,j=4;D&&(k-=1,N-=1,z+=1,V-=2,j-=1),I&&(k-=1,N-=1,z+=1,V-=2,j-=1),z+=k*u+2*N-V;let U=(z+j)*2,q=new Float64Array(U*3),Y=n?new Float32Array(U*3):void 0,te=R?new Uint8Array(U):void 0,K=o.st?new Float32Array(U*2):void 0,Z=i===Zt.TOP;R&&!Z&&(M=i===Zt.ALL?1:0,te=te.fill(M));let ee=0,me=0,Te=0,ue=0,ye=u*N,Ae;for(f=0;f<ye;f+=u)Ae=f*3,q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,f*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1);if(I){let $e=D?ye+1:ye;for(Ae=$e*3,f=0;f<2;f++)q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,$e*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1)}else for(f=ye-u;f<ye;f++)Ae=f*3,q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,f*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1);for(f=ye-1;f>0;f-=u)Ae=f*3,q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,f*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1);if(D){let $e=ye;for(Ae=$e*3,f=0;f<2;f++)q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,$e*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1)}else for(f=u-1;f>=0;f--)Ae=f*3,q=bS(q,ee,Ae,p,b),ee+=6,o.st&&(K=xS(K,me,f*2,v),me+=4),n&&(Te+=3,Y[Te++]=P[Ae],Y[Te++]=P[Ae+1],Y[Te++]=P[Ae+2]),Z&&(te[ue++]=1,ue+=1);let Pe=wet(q,o,a);o.st&&(Pe.attributes.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:K})),n&&(Pe.attributes.extrudeDirection=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:Y})),R&&(Pe.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:te}));let Ee=Fe.createTypedArray(U,z*6),ze,qe,it,Dt;g=q.length/3;let jt=0;for(f=0;f<g-1;f+=2){ze=f,Dt=(ze+2)%g;let $e=d.fromArray(q,ze*3,g7),un=d.fromArray(q,Dt*3,Lme);d.equalsEpsilon($e,un,O.EPSILON10)||(qe=(ze+1)%g,it=(qe+2)%g,Ee[jt++]=ze,Ee[jt++]=qe,Ee[jt++]=Dt,Ee[jt++]=Dt,Ee[jt++]=qe,Ee[jt++]=it)}return Pe.indices=Ee,Pe=Nn.combineInstances([new St({geometry:h}),new St({geometry:Pe})]),Pe[0]}var Det=[new d,new d,new d,new d],Fme=new he,Pet=new he;function b7(e,t,n,i,o){if(n===0)return ce.clone(e,o);let r=Is.computeOptions(e,t,n,0,Rme,Fme),s=r.height,a=r.width,l=Det;return Is.computePosition(r,i,!1,0,0,l[0]),Is.computePosition(r,i,!1,0,a-1,l[1]),Is.computePosition(r,i,!1,s-1,0,l[2]),Is.computePosition(r,i,!1,s-1,a-1,l[3]),ce.fromCartesianArray(l,i,o)}function Vm(e){e=e??W.EMPTY_OBJECT;let t=e.rectangle;if(T.typeOf.object("rectangle",t),ce._validate(t),t.north<t.south)throw new E("options.rectangle.north must be greater than or equal to options.rectangle.south");let n=e.height??0,i=e.extrudedHeight??n;this._rectangle=ce.clone(t),this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._surfaceHeight=Math.max(n,i),this._rotation=e.rotation??0,this._stRotation=e.stRotation??0,this._vertexFormat=Ie.clone(e.vertexFormat??Ie.DEFAULT),this._extrudedHeight=Math.min(n,i),this._shadowVolume=e.shadowVolume??!1,this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Vm.packedLength=ce.packedLength+ie.packedLength+Ie.packedLength+7;Vm.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,ce.pack(e._rectangle,t,n),n+=ce.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=e._offsetAttribute??-1,t};var Bme=new ce,kme=ie.clone(ie.UNIT_SPHERE),s0={rectangle:Bme,ellipsoid:kme,vertexFormat:y7,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Vm.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=ce.unpack(e,t,Bme);t+=ce.packedLength;let o=ie.unpack(e,t,kme);t+=ie.packedLength;let r=Ie.unpack(e,t,y7);t+=Ie.packedLength;let s=e[t++],a=e[t++],l=e[t++],u=e[t++],f=e[t++],h=e[t++]===1,p=e[t];return c(n)?(n._rectangle=ce.clone(i,n._rectangle),n._ellipsoid=ie.clone(o,n._ellipsoid),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=l,n._stRotation=u,n._extrudedHeight=f,n._shadowVolume=h,n._offsetAttribute=p===-1?void 0:p,n):(s0.granularity=s,s0.height=a,s0.rotation=l,s0.stRotation=u,s0.extrudedHeight=f,s0.shadowVolume=h,s0.offsetAttribute=p===-1?void 0:p,new Vm(s0))};Vm.computeRectangle=function(e,t){e=e??W.EMPTY_OBJECT;let n=e.rectangle;if(T.typeOf.object("rectangle",n),ce._validate(n),n.north<n.south)throw new E("options.rectangle.north must be greater than or equal to options.rectangle.south");let i=e.granularity??O.RADIANS_PER_DEGREE,o=e.ellipsoid??ie.default,r=e.rotation??0;return b7(n,i,r,o,t)};var Iet=new J,vme=new Le,Oet=new he;Vm.createGeometry=function(e){if(O.equalsEpsilon(e._rectangle.north,e._rectangle.south,O.EPSILON10)||O.equalsEpsilon(e._rectangle.east,e._rectangle.west,O.EPSILON10))return;let t=e._rectangle,n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=Is.computeOptions(t,e._granularity,i,o,Rme,Fme,Pet),a=Iet;if(o!==0||i!==0){let g=ce.center(t,Oet),m=n.geodeticSurfaceNormalCartographic(g,g7);Le.fromAxisAngle(m,-o,vme),J.fromQuaternion(vme,a)}else J.clone(J.IDENTITY,a);let l=e._surfaceHeight,u=e._extrudedHeight,f=!O.equalsEpsilon(l,u,0,O.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let h,p;if(t=e._rectangle,f){h=vet(e,s);let g=le.fromRectangle3D(t,n,l,Cet),m=le.fromRectangle3D(t,n,u,Aet);p=le.union(g,m)}else{if(h=Nme(e,s),h.attributes.position.values=si.scaleToGeodeticHeight(h.attributes.position.values,l,n,!1),c(e._offsetAttribute)){let g=h.attributes.position.values.length,m=e._offsetAttribute===Zt.NONE?0:1,y=new Uint8Array(g/3).fill(m);h.attributes.applyOffset=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}p=le.fromRectangle3D(t,n,l)}return r.position||delete h.attributes.position,new ct({attributes:h.attributes,indices:h.indices,primitiveType:h.primitiveType,boundingSphere:p,offsetAttribute:e._offsetAttribute})};Vm.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Vm({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0})};var Dme=new ce,Ret=[new H,new H,new H],Met=new Ri,Let=new he;function Net(e){if(e._stRotation===0)return[0,0,0,1,1,0];let t=ce.clone(e._rectangle,Dme),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=b7(t,n,o,i,Dme),s=Ret;s[0].x=r.west,s[0].y=r.south,s[1].x=r.west,s[1].y=r.north,s[2].x=r.east,s[2].y=r.south;let a=e.rectangle,l=Ri.fromRotation(e._stRotation,Met),u=ce.center(a,Let);for(let m=0;m<3;++m){let y=s[m];y.x-=u.longitude,y.y-=u.latitude,Ri.multiplyByVector(l,y,y),y.x+=u.longitude,y.y+=u.latitude,y.x=(y.x-a.west)/a.width,y.y=(y.y-a.south)/a.height}let f=s[0],h=s[1],p=s[2],g=new Array(6);return H.pack(f,g),H.pack(h,g,2),H.pack(p,g,4),g}Object.defineProperties(Vm.prototype,{rectangle:{get:function(){return c(this._rotatedRectangle)||(this._rotatedRectangle=b7(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=Net(this)),this._textureCoordinateRotationPoints}}});var hT=Vm;var Ume=new G,Vme=d.ZERO,zme=new d,Hme=new ce,Fet=new ce,Bet=new he;function ket(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function wh(e,t){Gn.call(this,{entity:e,scene:t,geometryOptions:new ket(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}c(Object.create)&&(wh.prototype=Object.create(Gn.prototype),wh.prototype.constructor=wh);wh.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:kn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Ut){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Ume)),c(o)||(o=G.WHITE),i.color=Gt.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,Vme,zme))),new St({id:t,geometry:new hT(this._options),attributes:i})};wh.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,Ume),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=eo.fromCartesian3(X.getValueOrDefault(this._terrainOffsetProperty,e,Vme,zme))),new St({id:t,geometry:new Hx(this._options),attributes:r})};wh.prototype._computeCenter=function(e,t){let n=X.getValueOrUndefined(this._entity.rectangle.coordinates,e,Fet);if(!c(n))return;let i=ce.center(n,Bet);return he.toCartesian(i,ie.default,t)};wh.prototype._isHidden=function(e,t){return!c(t.coordinates)||ii.prototype._isHidden.call(this,e,t)};wh.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!X.isConstant(t.height)||!X.isConstant(t.extrudedHeight)||!X.isConstant(t.granularity)||!X.isConstant(t.stRotation)||!X.isConstant(t.rotation)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.zIndex)||this._onTerrain&&!X.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Ut)};wh.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Ut,i=X.getValueOrUndefined(t.height,Ge.MINIMUM_VALUE),o=X.getValueOrDefault(t.heightReference,Ge.MINIMUM_VALUE,We.NONE),r=X.getValueOrUndefined(t.extrudedHeight,Ge.MINIMUM_VALUE),s=X.getValueOrDefault(t.extrudedHeightReference,Ge.MINIMUM_VALUE,We.NONE);c(r)&&!c(i)&&(i=0);let a=this._options;a.vertexFormat=n?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(Ge.MINIMUM_VALUE,a.rectangle),a.granularity=X.getValueOrUndefined(t.granularity,Ge.MINIMUM_VALUE),a.stRotation=X.getValueOrUndefined(t.stRotation,Ge.MINIMUM_VALUE),a.rotation=X.getValueOrUndefined(t.rotation,Ge.MINIMUM_VALUE),a.offsetAttribute=Gn.computeGeometryOffsetAttribute(i,o,r,s),a.height=Gn.getGeometryHeight(i,o),r=Gn.getGeometryExtrudedHeight(r,s),r===Gn.CLAMP_TO_GROUND&&(r=ui.getMinimumMaximumHeights(hT.computeRectangle(a,Hme)).minimumTerrainHeight),a.extrudedHeight=r};wh.DynamicGeometryUpdater=TS;function TS(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(TS.prototype=Object.create(ni.prototype),TS.prototype.constructor=TS);TS.prototype._isHidden=function(e,t,n){return!c(this._options.rectangle)||ni.prototype._isHidden.call(this,e,t,n)};TS.prototype._setOptions=function(e,t,n){let i=this._options,o=X.getValueOrUndefined(t.height,n),r=X.getValueOrDefault(t.heightReference,n,We.NONE),s=X.getValueOrUndefined(t.extrudedHeight,n),a=X.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);c(s)&&!c(o)&&(o=0),i.rectangle=X.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=X.getValueOrUndefined(t.granularity,n),i.stRotation=X.getValueOrUndefined(t.stRotation,n),i.rotation=X.getValueOrUndefined(t.rotation,n),i.offsetAttribute=Gn.computeGeometryOffsetAttribute(o,r,s,a),i.height=Gn.getGeometryHeight(o,r),s=Gn.getGeometryExtrudedHeight(s,a),s===Gn.CLAMP_TO_GROUND&&(s=ui.getMinimumMaximumHeights(hT.computeRectangle(i,Hme)).minimumTerrainHeight),i.extrudedHeight=s};var WN=wh;var Gme={};function Uet(e,t){return O.equalsEpsilon(e.latitude,t.latitude,O.EPSILON10)&&O.equalsEpsilon(e.longitude,t.longitude,O.EPSILON10)}var Vet=new he,zet=new he;function Het(e,t,n,i){t=xo(t,d.equalsEpsilon);let o=t.length;if(o<2)return;let r=c(i),s=c(n),a=new Array(o),l=new Array(o),u=new Array(o),f=t[0];a[0]=f;let h=e.cartesianToCartographic(f,Vet);s&&(h.height=n[0]),l[0]=h.height,r?u[0]=i[0]:u[0]=0;let p=l[0],g=u[0],m=p===g,y=1;for(let b=1;b<o;++b){let x=t[b],A=e.cartesianToCartographic(x,zet);s&&(A.height=n[b]),m=m&&A.height===0,Uet(h,A)?h.height<A.height&&(l[y-1]=A.height):(a[y]=x,l[y]=A.height,r?u[y]=i[b]:u[y]=0,m=m&&l[y]===u[y],he.clone(A,h),++y)}if(!(m||y<2))return a.length=y,l.length=y,u.length=y,{positions:a,topHeights:l,bottomHeights:u}}var Get=new Array(2),jet=new Array(2),Wet={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};Gme.computePositions=function(e,t,n,i,o,r){let s=Het(e,t,n,i);if(!c(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;let a=t.length,l=a-2,u,f,h=O.chordLength(o,e.maximumRadius),p=Wet;if(p.minDistance=h,p.ellipsoid=e,r){let g=0,m;for(m=0;m<a-1;m++)g+=Fi.numberOfPoints(t[m],t[m+1],h)+1;u=new Float64Array(g*3),f=new Float64Array(g*3);let y=Get,b=jet;p.positions=y,p.height=b;let x=0;for(m=0;m<a-1;m++){y[0]=t[m],y[1]=t[m+1],b[0]=n[m],b[1]=n[m+1];let A=Fi.generateArc(p);u.set(A,x),b[0]=i[m],b[1]=i[m+1],f.set(Fi.generateArc(p),x),x+=A.length}}else p.positions=t,p.height=n,u=new Float64Array(Fi.generateArc(p)),p.height=i,f=new Float64Array(Fi.generateArc(p));return{bottomPositions:f,topPositions:u,numCorners:l}};var mT=Gme;var x7=new d,v4=new d,qet=new d,jme=new d,Yet=new d,Xet=new d,Ket=new d;function pT(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!c(t))throw new E("options.positions is required.");if(c(n)&&n.length!==t.length)throw new E("options.positions and options.maximumHeights must have the same length.");if(c(i)&&i.length!==t.length)throw new E("options.positions and options.minimumHeights must have the same length.");let o=e.vertexFormat??Ie.DEFAULT,r=e.granularity??O.RADIANS_PER_DEGREE,s=e.ellipsoid??ie.default;this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Ie.clone(o),this._granularity=r,this._ellipsoid=ie.clone(s),this._workerName="createWallGeometry";let a=1+t.length*d.packedLength+2;c(i)&&(a+=i.length),c(n)&&(a+=n.length),this.packedLength=a+ie.packedLength+Ie.packedLength+1}pT.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._minimumHeights;if(r=c(s)?s.length:0,t[n++]=r,c(s))for(i=0;i<r;++i)t[n++]=s[i];let a=e._maximumHeights;if(r=c(a)?a.length:0,t[n++]=r,c(a))for(i=0;i<r;++i)t[n++]=a[i];return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n]=e._granularity,t};var Wme=ie.clone(ie.UNIT_SPHERE),qme=new Ie,qN={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:Wme,vertexFormat:qme,granularity:void 0};pT.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];let l=ie.unpack(e,t,Wme);t+=ie.packedLength;let u=Ie.unpack(e,t,qme);t+=Ie.packedLength;let f=e[t];return c(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ie.clone(l,n._ellipsoid),n._vertexFormat=Ie.clone(u,n._vertexFormat),n._granularity=f,n):(qN.positions=r,qN.minimumHeights=s,qN.maximumHeights=a,qN.granularity=f,new pT(qN))};pT.fromConstantHeights=function(e){e=e??W.EMPTY_OBJECT;let t=e.positions;if(!c(t))throw new E("options.positions is required.");let n,i,o=e.minimumHeight,r=e.maximumHeight,s=c(o),a=c(r);if(s||a){let u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=r)}let l={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new pT(l)};pT.createGeometry=function(e){let t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=mT.computePositions(s,t,i,n,r,!0);if(!c(a))return;let l=a.bottomPositions,u=a.topPositions,f=a.numCorners,h=u.length,p=h*2,g=o.position?new Float64Array(p):void 0,m=o.normal?new Float32Array(p):void 0,y=o.tangent?new Float32Array(p):void 0,b=o.bitangent?new Float32Array(p):void 0,x=o.st?new Float32Array(p/3*2):void 0,A=0,C=0,S=0,v=0,P=0,M=Ket,R=Xet,L=Yet,F=!0;h/=3;let _,w=0,D=1/(h-f-1);for(_=0;_<h;++_){let V=_*3,j=d.fromArray(u,V,x7),U=d.fromArray(l,V,v4);if(o.position&&(g[A++]=U.x,g[A++]=U.y,g[A++]=U.z,g[A++]=j.x,g[A++]=j.y,g[A++]=j.z),o.st&&(x[P++]=w,x[P++]=0,x[P++]=w,x[P++]=1),o.normal||o.tangent||o.bitangent){let q=d.clone(d.ZERO,jme),Y=d.subtract(j,s.geodeticSurfaceNormal(j,v4),v4);if(_+1<h&&(q=d.fromArray(u,V+3,jme)),F){let te=d.subtract(q,j,qet),K=d.subtract(Y,j,x7);M=d.normalize(d.cross(K,te,M),M),F=!1}d.equalsEpsilon(j,q,O.EPSILON10)?F=!0:(w+=D,o.tangent&&(R=d.normalize(d.subtract(q,j,R),R)),o.bitangent&&(L=d.normalize(d.cross(M,R,L),L))),o.normal&&(m[C++]=M.x,m[C++]=M.y,m[C++]=M.z,m[C++]=M.x,m[C++]=M.y,m[C++]=M.z),o.tangent&&(y[v++]=R.x,y[v++]=R.y,y[v++]=R.z,y[v++]=R.x,y[v++]=R.y,y[v++]=R.z),o.bitangent&&(b[S++]=L.x,b[S++]=L.y,b[S++]=L.z,b[S++]=L.x,b[S++]=L.y,b[S++]=L.z)}}let I=new fn;o.position&&(I.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(I.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:m})),o.tangent&&(I.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:y})),o.bitangent&&(I.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:b})),o.st&&(I.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:x}));let N=p/3;p-=6*(f+1);let k=Fe.createTypedArray(N,p),z=0;for(_=0;_<N-2;_+=2){let V=_,j=_+2,U=d.fromArray(g,V*3,x7),q=d.fromArray(g,j*3,v4);if(d.equalsEpsilon(U,q,O.EPSILON10))continue;let Y=_+1,te=_+3;k[z++]=Y,k[z++]=V,k[z++]=te,k[z++]=te,k[z++]=V,k[z++]=j}return new ct({attributes:I,indices:k,primitiveType:Me.TRIANGLES,boundingSphere:new le.fromVertices(g)})};var YN=pT;var Yme=new d,Xme=new d;function _T(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!c(t))throw new E("options.positions is required.");if(c(n)&&n.length!==t.length)throw new E("options.positions and options.maximumHeights must have the same length.");if(c(i)&&i.length!==t.length)throw new E("options.positions and options.minimumHeights must have the same length.");let o=e.granularity??O.RADIANS_PER_DEGREE,r=e.ellipsoid??ie.default;this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=ie.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*d.packedLength+2;c(i)&&(s+=i.length),c(n)&&(s+=n.length),this.packedLength=s+ie.packedLength+1}_T.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._minimumHeights;if(r=c(s)?s.length:0,t[n++]=r,c(s))for(i=0;i<r;++i)t[n++]=s[i];let a=e._maximumHeights;if(r=c(a)?a.length:0,t[n++]=r,c(a))for(i=0;i<r;++i)t[n++]=a[i];return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n]=e._granularity,t};var Kme=ie.clone(ie.UNIT_SPHERE),XN={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:Kme,granularity:void 0};_T.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];let l=ie.unpack(e,t,Kme);t+=ie.packedLength;let u=e[t];return c(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ie.clone(l,n._ellipsoid),n._granularity=u,n):(XN.positions=r,XN.minimumHeights=s,XN.maximumHeights=a,XN.granularity=u,new _T(XN))};_T.fromConstantHeights=function(e){e=e??W.EMPTY_OBJECT;let t=e.positions;if(!c(t))throw new E("options.positions is required.");let n,i,o=e.minimumHeight,r=e.maximumHeight,s=c(o),a=c(r);if(s||a){let u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=r)}let l={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid};return new _T(l)};_T.createGeometry=function(e){let t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=mT.computePositions(r,t,i,n,o,!1);if(!c(s))return;let a=s.bottomPositions,l=s.topPositions,u=l.length,f=u*2,h=new Float64Array(f),p=0;u/=3;let g;for(g=0;g<u;++g){let A=g*3,C=d.fromArray(l,A,Yme),S=d.fromArray(a,A,Xme);h[p++]=S.x,h[p++]=S.y,h[p++]=S.z,h[p++]=C.x,h[p++]=C.y,h[p++]=C.z}let m=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:h})}),y=f/3;f=2*y-4+y;let b=Fe.createTypedArray(y,f),x=0;for(g=0;g<y-2;g+=2){let A=g,C=g+2,S=d.fromArray(h,A*3,Yme),v=d.fromArray(h,C*3,Xme);if(d.equalsEpsilon(S,v,O.EPSILON10))continue;let P=g+1,M=g+3;b[x++]=P,b[x++]=A,b[x++]=P,b[x++]=M,b[x++]=A,b[x++]=C}return b[x++]=y-2,b[x++]=y-1,new ct({attributes:m,indices:b,primitiveType:Me.LINES,boundingSphere:new le.fromVertices(h)})};var KN=_T;var $me=new G;function $et(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function vh(e,t){ii.call(this,{entity:e,scene:t,geometryOptions:new $et(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}c(Object.create)&&(vh.prototype=Object.create(ii.prototype),vh.prototype.constructor=vh);vh.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i,o,r=new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=kn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Ut){let l;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(l=this._materialProperty.color.getValue(e,$me)),c(l)||(l=G.WHITE),o=Gt.fromColor(l),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new St({id:t,geometry:new YN(this._options),attributes:i})};vh.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");let t=this._entity,n=t.isAvailable(e),i=X.getValueOrDefault(this._outlineColorProperty,e,G.BLACK,$me),o=this._distanceDisplayConditionProperty.getValue(e);return new St({id:t,geometry:new KN(this._options),attributes:{show:new bn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Gt.fromColor(i),distanceDisplayCondition:kn.fromDistanceDisplayCondition(o)}})};vh.prototype._isHidden=function(e,t){return!c(t.positions)||ii.prototype._isHidden.call(this,e,t)};vh.prototype._getIsClosed=function(e){return!1};vh.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!X.isConstant(t.minimumHeights)||!X.isConstant(t.maximumHeights)||!X.isConstant(t.outlineWidth)||!X.isConstant(t.granularity)};vh.prototype._setStaticOptions=function(e,t){let n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof Ut,s=this._options;s.vertexFormat=r?rn.VERTEX_FORMAT:ao.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(Ge.MINIMUM_VALUE,s.positions),s.minimumHeights=c(n)?n.getValue(Ge.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=c(i)?i.getValue(Ge.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=c(o)?o.getValue(Ge.MINIMUM_VALUE):void 0};vh.DynamicGeometryUpdater=AS;function AS(e,t,n){ni.call(this,e,t,n)}c(Object.create)&&(AS.prototype=Object.create(ni.prototype),AS.prototype.constructor=AS);AS.prototype._isHidden=function(e,t,n){return!c(this._options.positions)||ni.prototype._isHidden.call(this,e,t,n)};AS.prototype._setOptions=function(e,t,n){let i=this._options;i.positions=X.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=X.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=X.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=X.getValueOrUndefined(t.granularity,n)};var $N=vh;var gT=[HO,pN,sN,DN,IN,MN,BN,jN,WN,$N];function yT(e,t){this.entity=e,this.scene=t;let n=new Array(gT.length),i=new pe,o=new gr;for(let r=0;r<n.length;r++){let s=new gT[r](e,t);o.add(s.geometryChanged,a=>{i.raiseEvent(a)}),n[r]=s}this.updaters=n,this.geometryChanged=i,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(yT.prototype._onEntityPropertyChanged,this)}yT.prototype._onEntityPropertyChanged=function(e,t,n,i){let o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)};yT.prototype.forEach=function(e){let t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};yT.prototype.destroy=function(){this.eventHelper.removeAll();let e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),de(this)};yT.registerUpdater=function(e){gT.includes(e)||gT.push(e)};yT.unregisterUpdater=function(e){if(gT.includes(e)){let t=gT.indexOf(e);gT.splice(t,1)}};var bT=yT;var Zme=new G,Zet=new Mt,Qet=new Mt,Jet=d.ZERO,ett=new d;function Dh(e,t,n,i,o,r,s){this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.updaters=new Et,this.updatersWithAttributes=new Et,this.attributes=new Et,this.subscriptions=new Et,this.showsUpdated=new Et,this.itemsToRemove=[],this.invalidated=!1;let a;c(o)&&(a=o.definitionChanged.addEventListener(Dh.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}Dh.prototype.onMaterialChanged=function(){this.invalidated=!0};Dh.prototype.isMaterial=function(e){let t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:c(t)?t.equals(n):!1};Dh.prototype.add=function(e,t){let n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!X.isConstant(e.distanceDisplayConditionProperty)||!X.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{let i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Dh.prototype.remove=function(e){let t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);let n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Dh.prototype.update=function(e){let t=!0,n=0,i=this.primitive,o=this.primitives,r;if(this.createPrimitive){let s=this.geometry.values;if(s.length>0){c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let l;c(this.depthFailAppearanceType)&&(c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=tr.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),l=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Pn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:l,shadows:this.shadows}),o.add(i),t=!1}else{c(i)&&(o.remove(i),i=void 0);let l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof Ut)&&(this.depthFailMaterial=tr.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);let s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){let u=s[r],f=this.geometry.get(u.id),h=this.attributes.get(f.id.id);if(c(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||l){let b=u.fillMaterialProperty.color,x=X.getValueOrDefault(b,e,G.WHITE,Zme);G.equals(h._lastColor,x)||(h._lastColor=G.clone(x,h._lastColor),h.color=Gt.toValue(x,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}if(c(this.depthFailAppearanceType)&&u.depthFailMaterialProperty instanceof Ut&&(!u.depthFailMaterialProperty.isConstant||l)){let b=u.depthFailMaterialProperty.color,x=X.getValueOrDefault(b,e,G.WHITE,Zme);G.equals(h._lastDepthFailColor,x)||(h._lastDepthFailColor=G.clone(x,h._lastDepthFailColor),h.depthFailColor=Gt.toValue(x,h.depthFailColor))}let p=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=u.distanceDisplayConditionProperty;if(!X.isConstant(m)){let b=X.getValueOrDefault(m,e,Qet,Zet);Mt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(b,h.distanceDisplayCondition))}let y=u.terrainOffsetProperty;if(!X.isConstant(y)){let b=X.getValueOrDefault(y,e,Jet,ett);d.equals(b,h._lastOffset)||(h._lastOffset=d.clone(b,h._lastOffset),h.offset=eo.toValue(b,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Dh.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=this.geometry.get(o.id),s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=bn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Dh.prototype.contains=function(e){return this.updaters.contains(e.id)};Dh.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?lt.FAILED:(i.boundingSphere.clone(t),lt.DONE)};Dh.prototype.destroy=function(){let e=this.primitive,t=this.primitives;c(e)&&t.remove(e);let n=this.oldPrimitive;c(n)&&t.remove(n),c(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};function CS(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}CS.prototype.add=function(e,t){let n,i,o=t.createFillGeometryInstance(e);o.attributes.color.value[3]===255?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);let r=n.length;for(let a=0;a<r;a++){let l=n[a];if(l.isMaterial(t)){l.add(t,o);return}}let s=new Dh(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function Qme(e,t){let n=e.length;for(let i=n-1;i>=0;i--){let o=e[i];if(o.remove(t))return o.updaters.length===0&&(e.splice(i,1),o.destroy()),!0}return!1}CS.prototype.remove=function(e){Qme(this._solidItems,e)||Qme(this._translucentItems,e)};function Jme(e,t,n){let i=!1,o=t.length;for(let r=0;r<o;++r){let s=t[r],a=s.itemsToRemove,l=a.length;if(l>0)for(r=0;r<l;r++){let u=a[r];s.remove(u),e.add(n,u),i=!0}}return i}function D4(e,t,n,i){let o=t.length,r;for(r=o-1;r>=0;r--){let s=t[r];if(s.invalidated){t.splice(r,1);let a=s.updaters.values,l=a.length;for(let u=0;u<l;u++)e.add(n,a[u]);s.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}CS.prototype.update=function(e){let t=D4(this,this._solidItems,e,!0);t=D4(this,this._translucentItems,e,t)&&t;let n=Jme(this,this._solidItems,e),i=Jme(this,this._translucentItems,e);return(n||i)&&(t=D4(this,this._solidItems,e,t)&&t,t=D4(this,this._translucentItems,e,t)&&t),t};function epe(e,t,n){let i=e.length;for(let o=0;o<i;o++){let r=e[o];if(r.contains(t))return r.getBoundingSphere(t,n)}return lt.FAILED}CS.prototype.getBoundingSphere=function(e,t){let n=epe(this._solidItems,e,t);return n===lt.FAILED?epe(this._translucentItems,e,t):n};function tpe(e){let t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}CS.prototype.removeAllPrimitives=function(){tpe(this._solidItems),tpe(this._translucentItems)};var rd=CS;var ttt=new Mt,ntt=new Mt,itt=d.ZERO,ott=new d;function Ph(e,t,n,i,o,r,s){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.closed=r,this.shadows=s,this.updaters=new Et,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new Et,this.attributes=new Et,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Ph.prototype.onMaterialChanged,this),this.subscriptions=new Et,this.showsUpdated=new Et}Ph.prototype.onMaterialChanged=function(){this.invalidated=!0};Ph.prototype.isMaterial=function(e){let t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,o=e.depthFailMaterialProperty;if(n===t&&o===i)return!0;let r=c(t)&&t.equals(n);return r=(!c(i)&&!c(o)||c(i)&&i.equals(o))&&r,r};Ph.prototype.add=function(e,t){let n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!X.isConstant(t.distanceDisplayConditionProperty)||!X.isConstant(t.terrainOffsetProperty))this.updatersWithAttributes.set(n,t);else{let i=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Ph.prototype.remove=function(e){let t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);let n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};var rtt=new G;Ph.prototype.update=function(e){let t=!0,n=this.primitive,i=this.primitives,o=this.geometry.values,r;if(this.createPrimitive){if(o.length>0){c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=tr.getValue(e,this.materialProperty,this.material);let a;c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=tr.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Pn({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:a,shadows:this.shadows}),i.add(n),t=!1}else{c(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=tr.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof Ut)&&(this.depthFailMaterial=tr.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);let s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){let l=s[r],u=l.entity,f=this.geometry.get(l.id),h=this.attributes.get(f.id.id);if(c(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),c(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof Ut&&!l.depthFailMaterialProperty.isConstant){let b=l.depthFailMaterialProperty.color,x=X.getValueOrDefault(b,e,G.WHITE,rtt);G.equals(h._lastDepthFailColor,x)||(h._lastDepthFailColor=G.clone(x,h._lastDepthFailColor),h.depthFailColor=Gt.toValue(x,h.depthFailColor))}let p=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=l.distanceDisplayConditionProperty;if(!X.isConstant(m)){let b=X.getValueOrDefault(m,e,ntt,ttt);Mt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(b,h.distanceDisplayCondition))}let y=l.terrainOffsetProperty;if(!X.isConstant(y)){let b=X.getValueOrDefault(y,e,itt,ott);d.equals(b,h._lastOffset)||(h._lastOffset=d.clone(b,h._lastOffset),h.offset=eo.toValue(b,h.offset))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};Ph.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=o.entity,s=this.geometry.get(o.id),a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=bn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Ph.prototype.contains=function(e){return this.updaters.contains(e.id)};Ph.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?lt.FAILED:(i.boundingSphere.clone(t),lt.DONE)};Ph.prototype.destroy=function(){let e=this.primitive,t=this.primitives;c(e)&&t.remove(e);let n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function ES(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}ES.prototype.add=function(e,t){let n=this._items,i=n.length;for(let r=0;r<i;r++){let s=n[r];if(s.isMaterial(t)){s.add(e,t);return}}let o=new Ph(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};ES.prototype.remove=function(e){let t=this._items,n=t.length;for(let i=n-1;i>=0;i--){let o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};ES.prototype.update=function(e){let t,n=this._items,i=n.length;for(t=i-1;t>=0;t--){let r=n[t];if(r.invalidated){n.splice(t,1);let s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};ES.prototype.getBoundingSphere=function(e,t){let n=this._items,i=n.length;for(let o=0;o<i;o++){let r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return lt.FAILED};ES.prototype.removeAllPrimitives=function(){let e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};var sd=ES;var ipe=Zo(npe(),1);function P4(){this._tree=new ipe.default}function xT(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}xT.fromRectangleAndId=function(e,t,n){return n.minX=t.west,n.minY=t.south,n.maxX=t.east,n.maxY=t.north,n.id=e,n};P4.prototype.insert=function(e,t){T.typeOf.string("id",e),T.typeOf.object("rectangle",t);let n=xT.fromRectangleAndId(e,t,new xT);this._tree.insert(n)};function stt(e,t){return e.id===t.id}var att=new xT;P4.prototype.remove=function(e,t){T.typeOf.string("id",e),T.typeOf.object("rectangle",t);let n=xT.fromRectangleAndId(e,t,att);this._tree.remove(n,stt)};var ctt=new xT;P4.prototype.collides=function(e){T.typeOf.object("rectangle",e);let t=xT.fromRectangleAndId("",e,ctt);return this._tree.collides(t)};var TT=P4;var ltt=new G,utt=new Mt,ftt=new Mt;function eg(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.updaters=new Et,this.updatersWithAttributes=new Et,this.attributes=new Et,this.subscriptions=new Et,this.showsUpdated=new Et,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new TT}eg.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};eg.prototype.add=function(e,t){let n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),this.rectangleCollisionCheck.insert(n,t.geometry.rectangle),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!X.isConstant(e.distanceDisplayConditionProperty))this.updatersWithAttributes.set(n,e);else{let i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};eg.prototype.remove=function(e){let t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);let i=this.subscriptions.get(t);return c(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};eg.prototype.update=function(e){let t=!0,n=0,i=this.primitive,o=this.primitives,r;if(this.createPrimitive){let s=this.geometry.values;if(s.length>0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new jc({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{c(i)&&(o.remove(i),i=void 0);let l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);let s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){let u=s[r],f=this.geometry.get(u.id),h=this.attributes.get(f.id.id);if(c(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||l){let y=u.fillMaterialProperty.color,b=X.getValueOrDefault(y,e,G.WHITE,ltt);G.equals(h._lastColor,b)||(h._lastColor=G.clone(b,h._lastColor),h.color=Gt.toValue(b,h.color))}let p=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=u.distanceDisplayConditionProperty;if(!X.isConstant(m)){let y=X.getValueOrDefault(m,e,ftt,utt);Mt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(y,h.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};eg.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=this.geometry.get(o.id),s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=bn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};eg.prototype.contains=function(e){return this.updaters.contains(e.id)};eg.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getBoundingSphere(e.entity);return c(i)?(i.clone(t),lt.DONE):lt.FAILED};eg.prototype.removeAllPrimitives=function(){let e=this.primitives,t=this.primitive;c(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());let n=this.oldPrimitive;c(n)&&(e.remove(n),this.oldPrimitive=void 0)};function SS(e,t){this._batches=[],this._primitives=e,this._classificationType=t}SS.prototype.add=function(e,t){let n=t.createFillGeometryInstance(e),i=this._batches,o=X.getValueOrDefault(t.zIndex,0),r,s=i.length;for(let a=0;a<s;++a){let l=i[a];if(l.zIndex===o&&!l.overlapping(n.geometry.rectangle)){r=l;break}}return c(r)||(r=new eg(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};SS.prototype.remove=function(e){let t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};SS.prototype.update=function(e){let t,n,i=!0,o=this._batches,r=o.length;for(t=0;t<r;++t)i=o[t].update(e)&&i;for(t=0;t<r;++t){let s=o[t],a=s.itemsToRemove,l=a.length;for(let u=0;u<l;u++){n=a[u],s.remove(n);let f=this.add(e,n);s.isDirty=!0,f.isDirty=!0}}for(t=r-1;t>=0;--t){let s=o[t];s.isDirty&&(i=o[t].update(e)&&i,s.isDirty=!1),s.geometry.length===0&&o.splice(t,1)}return i};SS.prototype.getBoundingSphere=function(e,t){let n=this._batches,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return lt.FAILED};SS.prototype.removeAllPrimitives=function(){let e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};var wS=SS;var dtt=new Mt,htt=new Mt;function ad(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new Et,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.material=void 0,this.updatersWithAttributes=new Et,this.attributes=new Et,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(ad.prototype.onMaterialChanged,this),this.subscriptions=new Et,this.showsUpdated=new Et,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new TT}ad.prototype.onMaterialChanged=function(){this.invalidated=!0};ad.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};ad.prototype.isMaterial=function(e){let t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Ut&&t instanceof Ut?!0:c(t)&&t.equals(n)};ad.prototype.add=function(e,t,n){let i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),this.rectangleCollisionCheck.insert(i,n.geometry.rectangle),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!X.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{let o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,l){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};ad.prototype.remove=function(e){let t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);let i=this.subscriptions.get(t);return c(i)&&(i(),this.subscriptions.remove(t)),!0}return!1};ad.prototype.update=function(e){let t=!0,n=this.primitive,i=this.primitives,o=this.geometry.values,r;if(this.createPrimitive){if(o.length>0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=tr.getValue(e,this.materialProperty,this.material),n=new jc({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=tr.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;let s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){let l=s[r],u=l.entity,f=this.geometry.get(l.id),h=this.attributes.get(f.id.id);c(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h));let p=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=l.distanceDisplayConditionProperty;if(!X.isConstant(m)){let y=X.getValueOrDefault(m,e,htt,dtt);Mt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};ad.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=o.entity,s=this.geometry.get(o.id),a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=bn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};ad.prototype.contains=function(e){return this.updaters.contains(e.id)};ad.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?lt.FAILED:(i.boundingSphere.clone(t),lt.DONE)};ad.prototype.destroy=function(){let e=this.primitive,t=this.primitives;c(e)&&t.remove(e);let n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function vS(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}vS.prototype.add=function(e,t){let n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=bu.shouldUseSphericalCoordinates(o.geometry.rectangle),s=X.getValueOrDefault(t.zIndex,0);for(let l=0;l<i;++l){let u=n[l];if(u.isMaterial(t)&&u.usingSphericalTextureCoordinates===r&&u.zIndex===s&&!u.overlapping(o.geometry.rectangle)){u.add(e,t,o);return}}let a=new ad(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};vS.prototype.remove=function(e){let t=this._items,n=t.length;for(let i=n-1;i>=0;i--){let o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};vS.prototype.update=function(e){let t,n=this._items,i=n.length;for(t=i-1;t>=0;t--){let r=n[t];if(r.invalidated){n.splice(t,1);let s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};vS.prototype.getBoundingSphere=function(e,t){let n=this._items,i=n.length;for(let o=0;o<i;o++){let r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return lt.FAILED};vS.prototype.removeAllPrimitives=function(){let e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};var ZN=vS;var mtt=new G,ptt=new Mt,_tt=new Mt,gtt=d.ZERO,ytt=new d;function tg(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.updaters=new Et,this.updatersWithAttributes=new Et,this.attributes=new Et,this.itemsToRemove=[],this.subscriptions=new Et,this.showsUpdated=new Et}tg.prototype.add=function(e,t){let n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantOutline||!e.outlineColorProperty.isConstant||!X.isConstant(e.distanceDisplayConditionProperty)||!X.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{let i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};tg.prototype.remove=function(e){let t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);let n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};tg.prototype.update=function(e){let t=!0,n=0,i=this.primitive,o=this.primitives,r;if(this.createPrimitive){let s=this.geometry.values;if(s.length>0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Pn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new rn({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{c(i)&&(o.remove(i),i=void 0);let l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);let s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){let u=s[r],f=this.geometry.get(u.id),h=this.attributes.get(f.id.id);if(c(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.outlineColorProperty.isConstant||l){let b=u.outlineColorProperty,x=X.getValueOrDefault(b,e,G.WHITE,mtt);G.equals(h._lastColor,x)||(h._lastColor=G.clone(x,h._lastColor),h.color=Gt.toValue(x,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}let p=u.entity.isShowing&&(u.hasConstantOutline||u.isOutlineVisible(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=u.distanceDisplayConditionProperty;if(!X.isConstant(m)){let b=X.getValueOrDefault(m,e,_tt,ptt);Mt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(b,h.distanceDisplayCondition))}let y=u.terrainOffsetProperty;if(!X.isConstant(y)){let b=X.getValueOrDefault(y,e,gtt,ytt);d.equals(b,h._lastOffset)||(h._lastOffset=d.clone(b,h._lastOffset),h.offset=eo.toValue(b,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};tg.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=this.geometry.get(o.id),s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=bn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};tg.prototype.contains=function(e){return this.updaters.contains(e.id)};tg.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?lt.FAILED:(i.boundingSphere.clone(t),lt.DONE)};tg.prototype.removeAllPrimitives=function(){let e=this.primitives,t=this.primitive;c(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());let n=this.oldPrimitive;c(n)&&(e.remove(n),this.oldPrimitive=void 0)};function DS(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new Et,this._translucentBatches=new Et}DS.prototype.add=function(e,t){let n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth),o,r;n.attributes.color.value[3]===255?(o=this._solidBatches,r=o.get(i),c(r)||(r=new tg(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),c(r)||(r=new tg(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};DS.prototype.remove=function(e){let t,n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;let o=this._translucentBatches.values,r=o.length;for(t=0;t<r;t++)if(o[t].remove(e))return};DS.prototype.update=function(e){let t,n,i,o,r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,l=a.length,u,f=!0,h=!1;do{for(h=!1,n=0;n<s;n++){o=r[n],f=o.update(e),u=o.itemsToRemove;let p=u.length;if(p>0)for(h=!0,t=0;t<p;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n<l;n++){o=a[n],f=o.update(e),u=o.itemsToRemove;let p=u.length;if(p>0)for(h=!0,t=0;t<p;t++)i=u[t],o.remove(i),this.add(e,i)}}while(h);return f};DS.prototype.getBoundingSphere=function(e,t){let n,i=this._solidBatches.values,o=i.length;for(n=0;n<o;n++){let a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}let r=this._translucentBatches.values,s=r.length;for(n=0;n<s;n++){let a=r[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return lt.FAILED};DS.prototype.removeAllPrimitives=function(){let e,t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();let i=this._translucentBatches.values,o=i.length;for(e=0;e<o;e++)i[e].removeAllPrimitives()};var PS=DS;var btt=[];function Zl(e,t,n,i){T.defined("scene",e),T.defined("entityCollection",t),n=n??e.primitives,i=i??e.groundPrimitives,this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new Et,this._removedObjects=new Et,this._changedObjects=new Et;let o=xn.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(o*2),this._closedColorBatches=new Array(o*2),this._closedMaterialBatches=new Array(o*2),this._openColorBatches=new Array(o*2),this._openMaterialBatches=new Array(o*2);let r=nr.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new PS(n,e,s,!1),this._outlineBatches[o+s]=new PS(n,e,s,!0),this._closedColorBatches[s]=new rd(n,rn,void 0,!0,s,!0),this._closedColorBatches[o+s]=new rd(n,rn,void 0,!0,s,!1),this._closedMaterialBatches[s]=new sd(n,ao,void 0,!0,s,!0),this._closedMaterialBatches[o+s]=new sd(n,ao,void 0,!0,s,!1),this._openColorBatches[s]=new rd(n,rn,void 0,!1,s,!0),this._openColorBatches[o+s]=new rd(n,rn,void 0,!1,s,!1),this._openMaterialBatches[s]=new sd(n,ao,void 0,!1,s,!0),this._openMaterialBatches[o+s]=new sd(n,ao,void 0,!1,s,!1);let a=Un.NUMBER_OF_CLASSIFICATION_TYPES,l=new Array(a),u=[];if(r)for(s=0;s<a;++s)u.push(new ZN(i,s,ao)),l[s]=new wS(i,s);else for(s=0;s<a;++s)l[s]=new wS(i,s);this._groundColorBatches=l,this._groundMaterialBatches=u,this._dynamicBatch=new cT(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new Et,this._updaterSets=new Et,this._entityCollection=t,t.collectionChanged.addEventListener(Zl.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,btt)}Zl.registerUpdater=function(e){bT.registerUpdater(e)};Zl.unregisterUpdater=function(e){bT.unregisterUpdater(e)};Zl.prototype.update=function(e){T.defined("time",e);let t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values,a,l,u,f,h=this;for(a=s.length-1;a>-1;a--)l=s[a],u=l.id,f=this._updaterSets.get(u),f.entity===l?f.forEach(function(y){h._removeUpdater(y),h._insertUpdaterIntoBatch(e,y)}):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,f=this._updaterSets.get(u),f.forEach(this._removeUpdater.bind(this)),f.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,f=new bT(l,this._scene),this._updaterSets.set(u,f),f.forEach(function(y){h._insertUpdaterIntoBatch(e,y)}),this._subscriptions.set(u,f.geometryChanged.addEventListener(Zl._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let p=!0,g=this._batches,m=g.length;for(a=0;a<m;a++)p=g[a].update(e)&&p;return p};var xtt=[],Ttt=new le;Zl.prototype.getBoundingSphere=function(e,t){T.defined("entity",e),T.defined("result",t);let n=xtt,i=Ttt,o=0,r=lt.DONE,s=this._batches,a=s.length,l=e.id,u=this._updaterSets.get(l).updaters;for(let f=0;f<u.length;f++){let h=u[f];for(let p=0;p<a;p++){if(r=s[p].getBoundingSphere(h,i),r===lt.PENDING)return lt.PENDING;r===lt.DONE&&(n[o]=le.clone(i,n[o]),o++)}}return o===0?lt.FAILED:(n.length=o,le.fromBoundingSpheres(n,t),lt.DONE)};Zl.prototype.isDestroyed=function(){return!1};Zl.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Zl.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e,t=this._batches,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();let i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();let o=this._updaterSets.values;for(n=o.length,e=0;e<n;e++)o[e].destroy();return this._updaterSets.removeAll(),de(this)};Zl.prototype._removeUpdater=function(e){let t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};Zl.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic){this._dynamicBatch.add(e,t);return}let n;(t.outlineEnabled||t.fillEnabled)&&(n=t.shadowsProperty.getValue(e));let i=xn.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(c(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){let o=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof Ut?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof Ut?c(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):c(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof Ut?c(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):c(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)};Zl._onGeometryChanged=function(e){let t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!c(t.get(o))&&!c(n.get(o))&&n.set(o,i)};Zl.prototype._onCollectionChanged=function(e,t,n){let i=this._addedObjects,o=this._removedObjects,r=this._changedObjects,s,a,l;for(s=n.length-1;s>-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};var QN=Zl;var Att=1,Ctt="30px sans-serif",Ett=Yo.FILL,Stt=G.WHITE,wtt=G.BLACK,vtt=1,Dtt=!1,Ptt=new G(.165,.165,.165,.8),Itt=new H(7,5),Ott=H.ZERO,Rtt=d.ZERO,Mtt=We.NONE,Ltt=bi.CENTER,Ntt=Fn.CENTER,Ftt=new d,Btt=new G,ktt=new G,Utt=new G,Vtt=new H,ztt=new d,Htt=new H,Gtt=new Bt,jtt=new Bt,Wtt=new Bt,qtt=new Mt;function ope(e){this.entity=e,this.label=void 0,this.index=void 0}function a0(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(a0.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Et,this._onCollectionChanged(t,t.values,[],[])}a0.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){let r=t[i],s=r.entity,a=s._label,l,u=r.label,f=s.isShowing&&s.isAvailable(e)&&X.getValueOrDefault(a._show,e,!0),h;if(f&&(h=X.getValueOrUndefined(s._position,e,Ftt),l=X.getValueOrUndefined(a._text,e),f=c(h)&&c(l)),!f){C7(r,s,n);continue}X.isConstant(s._position)||(n._clusterDirty=!0);let p=!1,g=X.getValueOrDefault(a._heightReference,e,Mtt);c(u)||(u=n.getLabel(s),u.id=s,r.label=u,p=d.equals(u.position,h)&&u.heightReference===g),u.show=!0,u.position=h,u.text=l,u.scale=X.getValueOrDefault(a._scale,e,Att),u.font=X.getValueOrDefault(a._font,e,Ctt),u.style=X.getValueOrDefault(a._style,e,Ett),u.fillColor=X.getValueOrDefault(a._fillColor,e,Stt,Btt),u.outlineColor=X.getValueOrDefault(a._outlineColor,e,wtt,ktt),u.outlineWidth=X.getValueOrDefault(a._outlineWidth,e,vtt),u.showBackground=X.getValueOrDefault(a._showBackground,e,Dtt),u.backgroundColor=X.getValueOrDefault(a._backgroundColor,e,Ptt,Utt),u.backgroundPadding=X.getValueOrDefault(a._backgroundPadding,e,Itt,Vtt),u.pixelOffset=X.getValueOrDefault(a._pixelOffset,e,Ott,Htt),u.eyeOffset=X.getValueOrDefault(a._eyeOffset,e,Rtt,ztt),u.heightReference=g,u.horizontalOrigin=X.getValueOrDefault(a._horizontalOrigin,e,Ltt),u.verticalOrigin=X.getValueOrDefault(a._verticalOrigin,e,Ntt),u.translucencyByDistance=X.getValueOrUndefined(a._translucencyByDistance,e,Gtt),u.pixelOffsetScaleByDistance=X.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,jtt),u.scaleByDistance=X.getValueOrUndefined(a._scaleByDistance,e,Wtt),u.distanceDisplayCondition=X.getValueOrUndefined(a._distanceDisplayCondition,e,qtt),u.disableDepthTestDistance=X.getValueOrUndefined(a._disableDepthTestDistance,e),p&&u._updateClamping()}return!0};a0.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");let n=this._items.get(e.id);if(!c(n)||!c(n.label))return lt.FAILED;let i=n.label;return t.center=d.clone(i._clampedPosition??i.position,t.center),t.radius=0,lt.DONE};a0.prototype.isDestroyed=function(){return!1};a0.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(a0.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return de(this)};a0.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._label)&&c(r._position)&&s.set(r.id,new ope(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._label)&&c(r._position)?s.contains(r.id)||s.set(r.id,new ope(r)):(C7(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],C7(s.get(r.id),r,a),s.remove(r.id)};function C7(e,t,n){c(e)&&(e.label=void 0,n.removeLabel(t))}var JN=a0;var Ytt=1,Xtt=!0,Ktt=0,$tt=!0,Ztt=!0,Qtt=xn.ENABLED,Jtt=We.NONE,ent=G.RED,tnt=0,nnt=G.WHITE,int=bc.HIGHLIGHT,ont=.5,rnt=new H(1,1),rpe={maximumPositionEpsilon:Number.POSITIVE_INFINITY},snt=new B,ant=new B,spe=new G,ape=new Array(4),cnt=new d;function c0(e,t){T.typeOf.object("scene",e),T.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(c0.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new Et,this._onCollectionChanged(t,t.values,[],[])}async function lnt(e,t,n,i,o){let r=e._primitives,s=e._modelHash;try{let a=await lh.fromGltfAsync({url:n,incrementallyLoadTextures:i,scene:e._scene,environmentMapOptions:o});if(e.isDestroyed()||!c(s[t.id]))return;a.id=t,r.add(a),s[t.id].modelPrimitive=a,a.errorEvent.addEventListener(l=>{c(s[t.id])&&(console.log(l),l.name!=="TextureError"&&a.incrementallyLoadTextures&&(s[t.id].loadFailed=!0))})}catch(a){if(e.isDestroyed()||!c(s[t.id]))return;console.log(a),s[t.id].loadFailed=!0}}c0.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){let s=t[o],a=s._model,l,u=n[s.id],f=s.isShowing&&s.isAvailable(e)&&X.getValueOrDefault(a._show,e,!0),h;if(f&&(h=s.computeModelMatrix(e,snt),l=we.createIfNeeded(X.getValueOrUndefined(a._uri,e)),f=c(h)&&c(l)),!f){c(u)&&u.modelPrimitive&&(u.modelPrimitive.show=!1);continue}if(!c(u)||l.url!==u.url){c(u?.modelPrimitive)&&(i.removeAndDestroy(u.modelPrimitive),delete n[s.id]),u={modelPrimitive:void 0,url:l.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFailed:!1,modelUpdated:!1,environmentMapOptionsScratch:{...rpe}},n[s.id]=u;let m=X.getValueOrDefault(a._incrementallyLoadTextures,e,$tt),y=X.getValueOrDefault(a._environmentMapOptions,e,rpe,u.environmentMapOptionsScratch);lnt(this,s,l,m,y)}let p=u.modelPrimitive;if(!c(p))continue;p.show=!0,p.scale=X.getValueOrDefault(a._scale,e,Ytt),p.enableVerticalExaggeration=X.getValueOrDefault(a._enableVerticalExaggeration,e,Xtt),p.minimumPixelSize=X.getValueOrDefault(a._minimumPixelSize,e,Ktt),p.maximumScale=X.getValueOrUndefined(a._maximumScale,e),p.modelMatrix=B.clone(h,p.modelMatrix),p.shadows=X.getValueOrDefault(a._shadows,e,Qtt),p.heightReference=X.getValueOrDefault(a._heightReference,e,Jtt),p.distanceDisplayCondition=X.getValueOrUndefined(a._distanceDisplayCondition,e),p.silhouetteColor=X.getValueOrDefault(a._silhouetteColor,e,ent,spe),p.silhouetteSize=X.getValueOrDefault(a._silhouetteSize,e,tnt),p.color=X.getValueOrDefault(a._color,e,nnt,spe),p.colorBlendMode=X.getValueOrDefault(a._colorBlendMode,e,int),p.colorBlendAmount=X.getValueOrDefault(a._colorBlendAmount,e,ont),p.clippingPlanes=X.getValueOrUndefined(a._clippingPlanes,e),p.clampAnimations=X.getValueOrDefault(a._clampAnimations,e,Ztt),p.imageBasedLighting.imageBasedLightingFactor=X.getValueOrDefault(a._imageBasedLightingFactor,e,rnt);let g=X.getValueOrUndefined(a._lightColor,e);if(c(g)&&(G.pack(g,ape,0),g=d.unpack(ape,0,cnt)),p.lightColor=g,p.customShader=X.getValueOrUndefined(a._customShader,e),n[s.id].modelUpdated=!0,p.ready){let m=X.getValueOrDefault(a._runAnimations,e,!0);u.animationsRunning!==m&&(m?p.activeAnimations.addAll({loop:Hl.REPEAT}):p.activeAnimations.removeAll(),u.animationsRunning=m);let y=X.getValueOrUndefined(a._nodeTransformations,e,u.nodeTransformationsScratch);if(c(y)){let A=Object.keys(y);for(let C=0,S=A.length;C<S;++C){let v=A[C],P=y[v];if(!c(P))continue;let M=p.getNode(v);if(!c(M))continue;let R=B.fromTranslationRotationScale(P,ant);M.matrix=B.multiply(M.originalMatrix,R,R)}}let b=!1,x=X.getValueOrUndefined(a._articulations,e,u.articulationsScratch);if(c(x)){let A=Object.keys(x);for(let C=0,S=A.length;C<S;++C){let v=A[C],P=x[v];c(P)&&(b=!0,p.setArticulationStage(v,P))}}b&&p.applyArticulations()}}return!0};c0.prototype.isDestroyed=function(){return!1};c0.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(c0.prototype._onCollectionChanged,this);let e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)E7(this,e[i],t,n);return de(this)};var I4=new d,unt=new he;c0.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");let n=this._modelHash[e.id];if(!c(n))return lt.FAILED;if(n.loadFailed)return lt.FAILED;let i=n.modelPrimitive;if(!c(i)||!i.show)return lt.PENDING;if(!i.ready||!n.modelUpdated)return lt.PENDING;let o=this._scene,r=o.ellipsoid??ie.default;if(i.heightReference!==We.NONE){let a=i.modelMatrix;I4.x=a[12],I4.y=a[13],I4.z=a[14];let l=r.cartesianToCartographic(I4,unt),u=o.getHeight(l,i.heightReference);return c(u)&&(Df(i.heightReference)?l.height=u:l.height+=u),le.clone(i.boundingSphere,t),t.center=r.cartographicToCartesian(l),lt.DONE}return le.clone(i.boundingSphere,t),lt.DONE};c0.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._entitiesToVisualize,a=this._modelHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._model)&&c(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._model)&&c(r._position)?(fnt(r,a),s.set(r.id,r)):(E7(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],E7(this,r,a,l),s.remove(r.id)};function E7(e,t,n,i){let o=n[t.id];c(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function fnt(e,t){let n=t[e.id];c(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}var eF=c0;function l0(e){this._definitionChanged=new pe,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(l0.prototype,{isConstant:{get:function(){return X.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return c(this._value)?this._value.referenceFrame:Hi.FIXED}}});var dnt=new Q;l0.prototype.getValue=function(e,t){return c(e)||(e=Q.now(dnt)),this.getValueInReferenceFrame(e,Hi.FIXED,t)};l0.prototype.setValue=function(e){this._value!==e&&(this._value=e,c(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),c(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};l0.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");if(c(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),c(n)?ie.default.scaleToGeodeticSurface(n,n):void 0};l0.prototype.equals=function(e){return this===e||e instanceof l0&&this._value===e._value};l0.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var zm=l0;var hnt=60,mnt=1,lpe=new En,S7=new En,w7=new En;function cpe(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function pnt(e,t,n,i,o,r,s,a,l){let u=a,f;f=e.getValueInReferenceFrame(t,r,l[u]),c(f)&&(l[u++]=f);let h=!c(o)||Q.lessThanOrEquals(o,t)||Q.greaterThanOrEquals(o,n),p=0,g=i.length,m=i[p],y=n,b=!1,x,A,C;for(;p<g;){if(!h&&Q.greaterThanOrEquals(m,o)&&(f=e.getValueInReferenceFrame(o,r,l[u]),c(f)&&(l[u++]=f),h=!0),Q.greaterThan(m,t)&&Q.lessThan(m,y)&&!m.equals(o)&&(f=e.getValueInReferenceFrame(m,r,l[u]),c(f)&&(l[u++]=f)),p<g-1){if(s>0&&!b){let S=i[p+1],v=Q.secondsDifference(S,m);b=v>s,b&&(x=Math.ceil(v/s),A=0,C=v/Math.max(x,2),x=Math.max(x-1,1))}if(b&&A<x){m=Q.addSeconds(m,C,new Q),A++;continue}}b=!1,p++,m=i[p]}return f=e.getValueInReferenceFrame(n,r,l[u]),c(f)&&(l[u++]=f),u}function _nt(e,t,n,i,o,r,s,a){let l,u=0,f=s,h=t,p=!c(i)||Q.lessThanOrEquals(i,t)||Q.greaterThanOrEquals(i,n);for(;Q.lessThan(h,n);)!p&&Q.greaterThanOrEquals(h,i)&&(p=!0,l=e.getValueInReferenceFrame(i,o,a[f]),c(l)&&(a[f]=l,f++)),l=e.getValueInReferenceFrame(h,o,a[f]),c(l)&&(a[f]=l,f++),u++,h=Q.addSeconds(t,r*u,new Q);return l=e.getValueInReferenceFrame(n,o,a[f]),c(l)&&(a[f]=l,f++),f}function gnt(e,t,n,i,o,r,s,a){let l,u=0,f=s,h=t,p=Math.max(r,60),g=!c(i)||Q.lessThanOrEquals(i,t)||Q.greaterThanOrEquals(i,n);for(;Q.lessThan(h,n);)!g&&Q.greaterThanOrEquals(h,i)&&(g=!0,l=e.getValueInReferenceFrame(i,o,a[f]),c(l)&&(a[f]=l,f++)),l=e.getValueInReferenceFrame(h,o,a[f]),c(l)&&(a[f]=l,f++),u++,h=Q.addSeconds(t,p*u,new Q);return l=e.getValueInReferenceFrame(n,o,a[f]),c(l)&&(a[f]=l,f++),f}function ynt(e,t,n,i,o,r,s,a){w7.start=t,w7.stop=n;let l=s,u=e.intervals;for(let f=0;f<u.length;f++){let h=u.get(f);if(!En.intersect(h,w7,lpe).isEmpty){let p=h.start;h.isStartIncluded||(h.isStopIncluded?p=h.stop:p=Q.addSeconds(h.start,Q.secondsDifference(h.stop,h.start)/2,new Q));let g=e.getValueInReferenceFrame(p,o,a[l]);c(g)&&(a[l]=g,l++)}}return l}function bnt(e,t,n,i,o,r,s,a){let l=e.getValueInReferenceFrame(t,o,a[s]);return c(l)&&(a[s++]=l),s}function xnt(e,t,n,i,o,r,s,a){S7.start=t,S7.stop=n;let l=s,u=e.intervals;for(let f=0;f<u.length;f++){let h=u.get(f);if(!En.intersect(h,S7,lpe).isEmpty){let p=h.start,g=h.stop,m=t;Q.greaterThan(p,m)&&(m=p);let y=n;Q.lessThan(g,y)&&(y=g),l=upe(h.data,m,y,i,o,r,l,a)}}return l}function upe(e,t,n,i,o,r,s,a){for(;e instanceof Y_;)e=e.resolvedProperty;if(e instanceof Ta){let l=e._property._times;s=pnt(e,t,n,l,i,o,r,s,a)}else e instanceof GO?s=_nt(e,t,n,i,o,r,s,a):e instanceof ba?s=xnt(e,t,n,i,o,r,s,a):e instanceof X_?s=ynt(e,t,n,i,o,r,s,a):e instanceof qc||e instanceof zm&&X.isConstant(e)?s=bnt(e,t,n,i,o,r,s,a):s=gnt(e,t,n,i,o,r,s,a);return s}function fpe(e,t,n,i,o,r,s){c(s)||(s=[]);let a=upe(e,t,n,i,o,r,0,s);return s.length=a,s}var Tnt=new J;function tF(e,t){this._unusedIndexes=[],this._polylineCollection=new dh,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}tF.prototype.update=function(e){if(this._referenceFrame===Hi.INERTIAL){let t=Ot.computeIcrfToCentralBodyFixedMatrix(e,Tnt);B.fromRotationTranslation(t,d.ZERO,this._polylineCollection.modelMatrix)}};tF.prototype.updateObject=function(e,t){let n=t.entity,i=n._path,o=n._position,r,s,a=i._show,l=t.polyline,u=n.isShowing&&n.isAvailable(e)&&(!c(a)||a.getValue(e));if(u){let h=X.getValueOrUndefined(i._leadTime,e),p=X.getValueOrUndefined(i._trailTime,e),g=n._availability,m=c(g),y=c(h),b=c(p);if(u=m||y&&b,u){if(b&&(r=Q.addSeconds(e,-p,new Q)),y&&(s=Q.addSeconds(e,h,new Q)),m){let x=g.start,A=g.stop;(!b||Q.greaterThan(x,r))&&(r=x),(!y||Q.lessThan(A,s))&&(s=A)}u=Q.lessThan(r,s)}}if(!u){c(l)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,l.show=!1,t.index=void 0);return}if(!c(l)){let h=this._unusedIndexes;if(h.length>0){let g=h.pop();l=this._polylineCollection.get(g),t.index=g}else t.index=this._polylineCollection.length,l=this._polylineCollection.add();l.id=n,t.polyline=l}let f=X.getValueOrDefault(i._resolution,e,hnt);l.show=!0,l.positions=fpe(o,r,s,e,this._referenceFrame,f,l.positions.slice()),l.material=tr.getValue(e,i._material,l.material),l.width=X.getValueOrDefault(i._width,e,mnt),l.distanceDisplayCondition=X.getValueOrUndefined(i._distanceDisplayCondition,e,l.distanceDisplayCondition)};tF.prototype.removeObject=function(e){let t=e.polyline;c(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};tF.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),de(this)};function u0(e,t){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(u0.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new Et,this._onCollectionChanged(t,t.values,[],[])}u0.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._updaters;for(let i in t)t.hasOwnProperty(i)&&t[i].update(e);let n=this._items.values;if(n.length===0&&c(this._updaters)&&Object.keys(this._updaters).length>0){for(let i in t)t.hasOwnProperty(i)&&t[i].destroy();this._updaters={}}for(let i=0,o=n.length;i<o;i++){let r=n[i],a=r.entity._position,l=r.updater,u=Hi.FIXED;this._scene.mode===oe.SCENE3D&&(u=a.referenceFrame);let f=this._updaters[u];if(l===f&&c(f)){f.updateObject(e,r);continue}c(l)&&l.removeObject(r),c(f)||(f=new tF(this._scene,u),f.update(e),this._updaters[u]=f),r.updater=f,c(f)&&f.updateObject(e,r)}return!0};u0.prototype.isDestroyed=function(){return!1};u0.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(u0.prototype._onCollectionChanged,this);let e=this._updaters;for(let t in e)e.hasOwnProperty(t)&&e[t].destroy();return de(this)};u0.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s,a=this._items;for(o=t.length-1;o>-1;o--)r=t[o],c(r._path)&&c(r._position)&&a.set(r.id,new cpe(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._path)&&c(r._position)?a.contains(r.id)||a.set(r.id,new cpe(r)):(s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id)));for(o=n.length-1;o>-1;o--)r=n[o],s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};u0._subSample=fpe;var nF=u0;var dpe=G.WHITE,hpe=G.BLACK,mpe=0,ppe=1,_pe=0,gpe=Vr.NONE,ype=new G,Ant=new d,bpe=new G,xpe=new Bt,Tpe=new Bt,Ape=new Mt;function Cpe(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function f0(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(f0.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new Et,this._onCollectionChanged(t,t.values,[],[])}f0.prototype.update=function(e){if(!c(e))throw new E("time is required.");let t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){let r=t[i],s=r.entity,a=s._point,l=r.pointPrimitive,u=r.billboard,f=X.getValueOrDefault(a._heightReference,e,We.NONE),h=s.isShowing&&s.isAvailable(e)&&X.getValueOrDefault(a._show,e,!0),p;if(h&&(p=X.getValueOrUndefined(s._position,e,Ant),h=c(p)),!h){iF(r,s,n);continue}X.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,m=!1;if(f!==We.NONE&&!c(u)?(c(l)&&(iF(r,s,n),l=void 0),u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u,g=!0,m=d.equals(u.position,p)&&u.heightReference===f):f===We.NONE&&!c(l)&&(c(u)&&(iF(r,s,n),u=void 0),l=n.getPoint(s),l.id=s,r.pointPrimitive=l),c(l))l.show=!0,l.position=p,l.scaleByDistance=X.getValueOrUndefined(a._scaleByDistance,e,xpe),l.translucencyByDistance=X.getValueOrUndefined(a._translucencyByDistance,e,Tpe),l.color=X.getValueOrDefault(a._color,e,dpe,ype),l.outlineColor=X.getValueOrDefault(a._outlineColor,e,hpe,bpe),l.outlineWidth=X.getValueOrDefault(a._outlineWidth,e,mpe),l.pixelSize=X.getValueOrDefault(a._pixelSize,e,ppe),l.distanceDisplayCondition=X.getValueOrUndefined(a._distanceDisplayCondition,e,Ape),l.disableDepthTestDistance=X.getValueOrDefault(a._disableDepthTestDistance,e,_pe),l.splitDirection=X.getValueOrDefault(a._splitDirection,e,gpe);else if(c(u)){u.show=!0,u.position=p,u.scaleByDistance=X.getValueOrUndefined(a._scaleByDistance,e,xpe),u.translucencyByDistance=X.getValueOrUndefined(a._translucencyByDistance,e,Tpe),u.distanceDisplayCondition=X.getValueOrUndefined(a._distanceDisplayCondition,e,Ape),u.disableDepthTestDistance=X.getValueOrDefault(a._disableDepthTestDistance,e,_pe),u.splitDirection=X.getValueOrDefault(a._splitDirection,e,gpe),u.heightReference=f;let y=X.getValueOrDefault(a._color,e,dpe,ype),b=X.getValueOrDefault(a._outlineColor,e,hpe,bpe),x=Math.round(X.getValueOrDefault(a._outlineWidth,e,mpe)),A=Math.max(1,Math.round(X.getValueOrDefault(a._pixelSize,e,ppe)));if(x>0?(u.scale=1,g=g||x!==r.outlineWidth||A!==r.pixelSize||!G.equals(y,r.color)||!G.equals(b,r.outlineColor)):(u.scale=A/50,A=50,g=g||x!==r.outlineWidth||!G.equals(y,r.color)||!G.equals(b,r.outlineColor)),g){r.color=G.clone(y,r.color),r.outlineColor=G.clone(b,r.outlineColor),r.pixelSize=A,r.outlineWidth=x;let C=y.alpha,S=y.toCssColorString(),v=b.toCssColorString(),P=JSON.stringify([S,A,v,x]);u.setImage(P,Lx(C,S,v,x,A))}m&&u._updateClamping()}}return!0};f0.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");let n=this._items.get(e.id);if(!c(n)||!(c(n.pointPrimitive)||c(n.billboard)))return lt.FAILED;if(c(n.pointPrimitive))t.center=d.clone(n.pointPrimitive.position,t.center);else{let i=n.billboard;if(!c(i._clampedPosition))return lt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,lt.DONE};f0.prototype.isDestroyed=function(){return!1};f0.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(f0.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return de(this)};f0.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._point)&&c(r._position)&&s.set(r.id,new Cpe(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._point)&&c(r._position)?s.contains(r.id)||s.set(r.id,new Cpe(r)):(iF(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],iF(s.get(r.id),r,a),s.remove(r.id)};function iF(e,t,n){if(c(e)){let i=e.pointPrimitive;if(c(i)){e.pointPrimitive=void 0,n.removePoint(t);return}let o=e.billboard;c(o)&&(e.billboard=void 0,n.removeBillboard(t))}}var oF=f0;var Dpe=[];function Cnt(e,t,n,i,o){let r=Dpe;r.length=o;let s,a=n.red,l=n.green,u=n.blue,f=n.alpha,h=i.red,p=i.green,g=i.blue,m=i.alpha;if(G.equals(n,i)){for(s=0;s<o;s++)r[s]=G.clone(n);return r}let y=(h-a)/o,b=(p-l)/o,x=(g-u)/o,A=(m-f)/o;for(s=0;s<o;s++)r[s]=new G(a+s*y,l+s*b,u+s*x,f+s*A);return r}function rF(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.colors,i=e.width??1,o=e.colorsPerVertex??!1;if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(typeof i!="number")throw new E("width must be a number");if(c(n)&&(o&&n.length<t.length||!o&&n.length<t.length-1))throw new E("colors has an invalid length.");this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Ie.clone(e.vertexFormat??Ie.DEFAULT),this._arcType=e.arcType??qt.GEODESIC,this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._ellipsoid=ie.clone(e.ellipsoid??ie.default),this._workerName="createPolylineGeometry";let r=1+t.length*d.packedLength;r+=c(n)?1+n.length*G.packedLength:1,this.packedLength=r+ie.packedLength+Ie.packedLength+4}rF.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._colors;for(r=c(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=G.packedLength)G.pack(s[i],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};var Ppe=ie.clone(ie.UNIT_SPHERE),Ipe=new Ie,AT={positions:void 0,colors:void 0,ellipsoid:Ppe,vertexFormat:Ipe,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};rF.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=G.packedLength)s[i]=G.unpack(e,t);let a=ie.unpack(e,t,Ppe);t+=ie.packedLength;let l=Ie.unpack(e,t,Ipe);t+=Ie.packedLength;let u=e[t++],f=e[t++]===1,h=e[t++],p=e[t];return c(n)?(n._positions=r,n._colors=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._vertexFormat=Ie.clone(l,n._vertexFormat),n._width=u,n._colorsPerVertex=f,n._arcType=h,n._granularity=p,n):(AT.positions=r,AT.colors=s,AT.width=u,AT.colorsPerVertex=f,AT.arcType=h,AT.granularity=p,new rF(AT))};var Epe=new d,Spe=new d,wpe=new d,vpe=new d;rF.createGeometry=function(e){let t=e._width,n=e._vertexFormat,i=e._colors,o=e._colorsPerVertex,r=e._arcType,s=e._granularity,a=e._ellipsoid,l,u,f,h=[],p=xo(e._positions,d.equalsEpsilon,!1,h);if(c(i)&&h.length>0){let N=0,k=h[0];i=i.filter(function(z,V){let j=!1;return o?j=V===k||V===0&&k===1:j=V+1===k,j?(N++,k=h[N],!1):!0})}let g=p.length;if(g<2||t<=0)return;if(r===qt.GEODESIC||r===qt.RHUMB){let N,k;r===qt.GEODESIC?(N=O.chordLength(s,a.maximumRadius),k=Fi.numberOfPoints):(N=s,k=Fi.numberOfPointsRhumbLine);let z=Fi.extractHeights(p,a);if(c(i)){let V=1;for(l=0;l<g-1;++l)V+=k(p[l],p[l+1],N);let j=new Array(V),U=0;for(l=0;l<g-1;++l){let q=p[l],Y=p[l+1],te=i[l],K=k(q,Y,N);if(o&&l<V){let Z=i[l+1],ee=Cnt(q,Y,te,Z,K),me=ee.length;for(u=0;u<me;++u)j[U++]=ee[u]}else for(u=0;u<K;++u)j[U++]=G.clone(te)}j[U]=G.clone(i[i.length-1]),i=j,Dpe.length=0}r===qt.GEODESIC?p=Fi.generateCartesianArc({positions:p,minDistance:N,ellipsoid:a,height:z}):p=Fi.generateCartesianRhumbArc({positions:p,granularity:N,ellipsoid:a,height:z})}g=p.length;let m=g*4-4,y=new Float64Array(m*3),b=new Float64Array(m*3),x=new Float64Array(m*3),A=new Float32Array(m*2),C=n.st?new Float32Array(m*2):void 0,S=c(i)?new Uint8Array(m*4):void 0,v=0,P=0,M=0,R=0,L;for(u=0;u<g;++u){u===0?(L=Epe,d.subtract(p[0],p[1],L),d.add(p[0],L,L)):L=p[u-1],d.clone(L,wpe),d.clone(p[u],Spe),u===g-1?(L=Epe,d.subtract(p[g-1],p[g-2],L),d.add(p[g-1],L,L)):L=p[u+1],d.clone(L,vpe);let N,k;c(S)&&(u!==0&&!o?N=i[u-1]:N=i[u],u!==g-1&&(k=i[u]));let z=u===0?2:0,V=u===g-1?2:4;for(f=z;f<V;++f){d.pack(Spe,y,v),d.pack(wpe,b,v),d.pack(vpe,x,v),v+=3;let j=f-2<0?-1:1;if(A[P++]=2*(f%2)-1,A[P++]=j*t,n.st&&(C[M++]=u/(g-1),C[M++]=Math.max(A[P-2],0)),c(S)){let U=f<2?N:k;S[R++]=G.floatToByte(U.red),S[R++]=G.floatToByte(U.green),S[R++]=G.floatToByte(U.blue),S[R++]=G.floatToByte(U.alpha)}}}let F=new fn;F.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:y}),F.prevPosition=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:b}),F.nextPosition=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:x}),F.expandAndWidth=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:A}),n.st&&(F.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:C})),c(S)&&(F.color=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:4,values:S,normalize:!0}));let _=Fe.createTypedArray(m,g*6-6),w=0,D=0,I=g-1;for(u=0;u<I;++u)_[D++]=w,_[D++]=w+2,_[D++]=w+1,_[D++]=w+1,_[D++]=w+2,_[D++]=w+3,w+=4;return new ct({attributes:F,indices:_,primitiveType:Me.TRIANGLES,boundingSphere:le.fromPoints(p),geometryType:xf.POLYLINES})};var ng=rF;var Ent=new Kn(0),O4={},Ope=new G,Snt=new Ut(G.WHITE),wnt=new Kn(!0),vnt=new Kn(xn.DISABLED),Dnt=new Kn(new Mt),Pnt=new Kn(Un.BOTH);function Int(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Ont(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Ih(e,t){if(!c(e))throw new E("entity is required");if(!c(t))throw new E("scene is required");this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Ih.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new pe,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new Int,this._groundGeometryOptions=new Ont,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=nr.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Ih.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!c(this._entity.availability)&&X.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}});Ih.prototype.isOutlineVisible=function(e){return!1};Ih.prototype.isFilled=function(e){let t=this._entity;return(this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e))??!1};Ih.prototype.createFillGeometryInstance=function(e){if(!c(e))throw new E("time is required.");if(!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");let t=this._entity,n=t.isAvailable(e),i=new bn(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=kn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r},a;return this._materialProperty instanceof Ut&&(c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,Ope)),c(a)||(a=G.WHITE),s.color=Gt.fromColor(a)),this.clampToGround?new St({id:t,geometry:new Fb(this._groundGeometryOptions),attributes:s}):(c(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof Ut&&(c(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,Ope)),c(a)||(a=G.WHITE),s.depthFailColor=Gt.fromColor(a)),new St({id:t,geometry:new ng(this._geometryOptions),attributes:s}))};Ih.prototype.createOutlineGeometryInstance=function(e){throw new E("This instance does not represent an outlined geometry.")};Ih.prototype.isDestroyed=function(){return!1};Ih.prototype.destroy=function(){this._entitySubscription(),de(this)};Ih.prototype._onEntityPropertyChanged=function(e,t,n,i){if(!(t==="availability"||t==="polyline"))return;let o=this._entity.polyline;if(!c(o)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let r=o.positions,s=o.show;if(c(s)&&s.isConstant&&!s.getValue(Ge.MINIMUM_VALUE)||!c(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let a=o.zIndex,l=o.material??Snt,u=l instanceof Ut;this._materialProperty=l,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=s??wnt,this._shadowsProperty=o.shadows??vnt,this._distanceDisplayConditionProperty=o.distanceDisplayCondition??Dnt,this._classificationTypeProperty=o.classificationType??Pnt,this._fillEnabled=!0,this._zIndex=a??Ent;let f=o.width,h=o.arcType,p=o.clampToGround,g=o.granularity;if(!r.isConstant||!X.isConstant(f)||!X.isConstant(h)||!X.isConstant(g)||!X.isConstant(p)||!X.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{let m=this._geometryOptions,y=r.getValue(Ge.MINIMUM_VALUE,m.positions);if(!c(y)||y.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let b;u&&(!c(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof Ut)?b=is.VERTEX_FORMAT:b=ha.VERTEX_FORMAT,m.vertexFormat=b,m.positions=y,m.width=c(f)?f.getValue(Ge.MINIMUM_VALUE):void 0,m.arcType=c(h)?h.getValue(Ge.MINIMUM_VALUE):void 0,m.granularity=c(g)?g.getValue(Ge.MINIMUM_VALUE):void 0;let x=this._groundGeometryOptions;x.positions=y,x.width=m.width,x.arcType=m.arcType,x.granularity=m.granularity,this._clampToGround=c(p)?p.getValue(Ge.MINIMUM_VALUE):!1,!this._clampToGround&&c(a)&&dt("Entity polylines must have clampToGround: true when using zIndex.  zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Ih.prototype.createDynamicUpdater=function(e,t){if(T.defined("primitives",e),T.defined("groundPrimitives",t),!this._dynamic)throw new E("This instance does not represent dynamic geometry.");return new sF(e,t,this)};var IS={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function sF(e,t,n){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=n,this._positions=[]}function Rpe(e){if(c(e._line))return e._line;let t=e._primitives,n=e._geometryUpdater._scene.id+t._guid,i=O4[n];!c(i)||i.isDestroyed()?(i=new dh,O4[n]=i,t.add(i)):t.contains(i)||t.add(i);let o=i.add();return o.id=e._geometryUpdater._entity,e._line=o,o}sF.prototype.update=function(e){let t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions,r=X.getValueOrUndefined(o,e,this._positions);t._clampToGround=X.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=X.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=X.getValueOrDefault(i._arcType,e,qt.GEODESIC),t._groundGeometryOptions.granularity=X.getValueOrDefault(i._granularity,e,9999);let s=this._groundPrimitives;if(c(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!X.getValueOrDefault(i._show,e,!0)||!c(r)||r.length<2)return;let h=t.fillMaterialProperty,p;if(h instanceof Ut)p=new is;else{let g=tr.getValue(e,h,this._material);p=new ha({material:g,translucent:g.isTranslucent()}),this._material=g}this._groundPolylinePrimitive=s.add(new Vd({geometryInstances:t.createFillGeometryInstance(e),appearance:p,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),X.getValueOrUndefined(t.zIndex,e)),c(this._line)&&(this._line.show=!1);return}let a=Rpe(this);if(!n.isShowing||!n.isAvailable(e)||!X.getValueOrDefault(i._show,e,!0)){a.show=!1;return}if(!c(r)||r.length<2){a.show=!1;return}let l=qt.GEODESIC;l=X.getValueOrDefault(i._arcType,e,l);let u=t._scene.globe,f=t._scene.ellipsoid;l!==qt.NONE&&c(u)&&(IS.ellipsoid=f,IS.positions=r,IS.granularity=X.getValueOrUndefined(i._granularity,e),IS.height=Fi.extractHeights(r,f),l===qt.GEODESIC?r=Fi.generateCartesianArc(IS):r=Fi.generateCartesianRhumbArc(IS)),a.show=!0,a.positions=r.slice(),a.material=tr.getValue(e,t.fillMaterialProperty,a.material),a.width=X.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=X.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};sF.prototype.getBoundingSphere=function(e){if(T.defined("result",e),this._geometryUpdater.clampToGround){let t=this._groundPolylinePrimitive;if(c(t)&&t.show&&t.ready){let n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(c(n)&&c(n.boundingSphere))return le.clone(n.boundingSphere,e),lt.DONE}return c(t)&&!t.ready?lt.PENDING:lt.DONE}else{let t=Rpe(this);if(t.show&&t.positions.length>0)return le.fromPoints(t.positions,e),lt.DONE}return lt.FAILED};sF.prototype.isDestroyed=function(){return!1};sF.prototype.destroy=function(){let t=this._geometryUpdater._scene.id+this._primitives._guid,n=O4[t];c(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete O4[t])),c(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),de(this)};var aF=Ih;var Rnt=new G,Mnt=new Mt,Lnt=new Mt;function Oh(e,t,n,i,o){let r;n instanceof Ut?r=is:r=ha,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new Et,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new Et,this.material=void 0,this.updatersWithAttributes=new Et,this.attributes=new Et,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Oh.prototype.onMaterialChanged,this),this.subscriptions=new Et,this.showsUpdated=new Et,this.zIndex=i,this._asynchronous=o}Oh.prototype.onMaterialChanged=function(){this.invalidated=!0};Oh.prototype.isMaterial=function(e){let t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Ut&&t instanceof Ut?!0:c(t)&&t.equals(n)};Oh.prototype.add=function(e,t,n){let i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!X.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{let o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,l){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Oh.prototype.remove=function(e){let t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);let n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};Oh.prototype.update=function(e){let t=!0,n=this.primitive,i=this.orderedGroundPrimitives,o=this.geometry.values,r;if(this.createPrimitive){if(o.length>0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new Vd({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===ha&&(this.material=tr.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===ha&&(this.material=tr.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);let s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){let l=s[r],u=l.entity,f=this.geometry.get(l.id),h=this.attributes.get(f.id.id);if(c(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!l.fillMaterialProperty.isConstant){let y=l.fillMaterialProperty.color,b=X.getValueOrDefault(y,e,G.WHITE,Rnt);G.equals(h._lastColor,b)||(h._lastColor=G.clone(b,h._lastColor),h.color=Gt.toValue(b,h.color))}let p=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=h.show[0]===1;p!==g&&(h.show=bn.toValue(p,h.show));let m=l.distanceDisplayConditionProperty;if(!X.isConstant(m)){let y=X.getValueOrDefault(m,e,Lnt,Mnt);Mt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Mt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=kn.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};Oh.prototype.updateShows=function(e){let t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){let o=t[i],r=o.entity,s=this.geometry.get(o.id),a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=bn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Oh.prototype.contains=function(e){return this.updaters.contains(e.id)};Oh.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return lt.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?lt.FAILED:(i.boundingSphere.clone(t),lt.DONE)};Oh.prototype.destroy=function(){let e=this.primitive,t=this.orderedGroundPrimitives;c(e)&&t.remove(e);let n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function OS(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=n??!0}OS.prototype.add=function(e,t){let n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=X.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){let l=n[a];if(l.isMaterial(t)&&l.zIndex===r){l.add(e,t,o);return}}let s=new Oh(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};OS.prototype.remove=function(e){let t=this._items,n=t.length;for(let i=n-1;i>=0;i--){let o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};OS.prototype.update=function(e){let t,n=this._items,i=n.length;for(t=i-1;t>=0;t--){let r=n[t];if(r.invalidated){n.splice(t,1);let s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};OS.prototype.getBoundingSphere=function(e,t){let n=this._items,i=n.length;for(let o=0;o<i;o++){let r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return lt.FAILED};OS.prototype.removeAllPrimitives=function(){let e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};var cF=OS;var Nnt=[];function Mpe(e,t){let n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function Lpe(e,t,n){if(n.isDynamic){e._dynamicBatch.add(t,n);return}if(n.clampToGround&&n.fillEnabled){let s=n.classificationTypeProperty.getValue(t);e._groundBatches[s].add(t,n);return}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let o=0;c(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof Ut?1:2);let r;c(i)&&(r=i+o*xn.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof Ut?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function Hm(e,t,n,i){T.defined("scene",e),T.defined("entityCollection",t),i=i??e.groundPrimitives,n=n??e.primitives,this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new Et,this._removedObjects=new Et,this._changedObjects=new Et;let o,r=xn.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(r*3),this._materialBatches=new Array(r*3),o=0;o<r;++o)this._colorBatches[o]=new rd(n,is,void 0,!1,o),this._materialBatches[o]=new sd(n,ha,void 0,!1,o),this._colorBatches[o+r]=new rd(n,is,is,!1,o),this._materialBatches[o+r]=new sd(n,ha,is,!1,o),this._colorBatches[o+r*2]=new rd(n,is,ha,!1,o),this._materialBatches[o+r*2]=new sd(n,ha,ha,!1,o);this._dynamicBatch=new cT(n,i);let s=Un.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new cF(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new Et,this._updaters=new Et,this._entityCollection=t,t.collectionChanged.addEventListener(Hm.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,Nnt)}Hm.prototype.update=function(e){T.defined("time",e);let t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values,a,l,u,f;for(a=s.length-1;a>-1;a--)l=s[a],u=l.id,f=this._updaters.get(u),f.entity===l?(Mpe(this,f),Lpe(this,e,f)):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,f=this._updaters.get(u),Mpe(this,f),f.destroy(),this._updaters.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,f=new aF(l,this._scene),this._updaters.set(u,f),Lpe(this,e,f),this._subscriptions.set(u,f.geometryChanged.addEventListener(Hm._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let h=!0,p=this._batches,g=p.length;for(a=0;a<g;a++)h=p[a].update(e)&&h;return h};var Fnt=[],Bnt=new le;Hm.prototype.getBoundingSphere=function(e,t){T.defined("entity",e),T.defined("result",t);let n=Fnt,i=Bnt,o=0,r=lt.DONE,s=this._batches,a=s.length,l=this._updaters.get(e.id);for(let u=0;u<a;u++){if(r=s[u].getBoundingSphere(l,i),r===lt.PENDING)return lt.PENDING;r===lt.DONE&&(n[o]=le.clone(i,n[o]),o++)}return o===0?lt.FAILED:(n.length=o,le.fromBoundingSpheres(n,t),lt.DONE)};Hm.prototype.isDestroyed=function(){return!1};Hm.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Hm.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e,t=this._batches,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();let i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),de(this)};Hm._onGeometryChanged=function(e){let t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!c(t.get(o))&&!c(n.get(o))&&n.set(o,i)};Hm.prototype._onCollectionChanged=function(e,t,n){let i=this._addedObjects,o=this._removedObjects,r=this._changedObjects,s,a,l;for(s=n.length-1;s>-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};var lF=Hm;function Ql(e){T.typeOf.object("options",e),T.typeOf.object("options.scene",e.scene),T.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),jc.initializeTerrainHeights(),Vd.initializeTerrainHeights();let t=e.scene,n=e.dataSourceCollection;this._eventHelper=new gr,this._eventHelper.add(n.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(n.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(n.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=n,this._scene=t,this._visualizersCallback=e.visualizersCallback??Ql.defaultVisualizersCallback;let i=!1,o=new fl,r=new fl;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,f=n.length;u<f;u++)this._onDataSourceAdded(n,n.get(u));let s=new dN;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,l;if(!i){let u=this,f=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),l(),u._removeDefaultDataSourceListener=void 0,u._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(f),l=n.dataSourceAdded.addEventListener(f)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=l,this._ready=!1}var RS=[];Ql.registerVisualizer=function(e){RS.includes(e)||RS.push(e)};Ql.unregisterVisualizer=function(e){if(RS.includes(e)){let t=RS.indexOf(e);RS.splice(t,1)}};Ql.defaultVisualizersCallback=function(e,t,n){let i=n.entities;return[new II(t,i),new QN(e,i,n._primitives,n._groundPrimitives),new JN(t,i),new eF(e,i),new ZL(e,i),new oF(t,i),new nF(e,i),new lF(e,i,n._primitives,n._groundPrimitives),...RS.map(o=>new o(e,i))]};Object.defineProperties(Ql.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}});Ql.prototype.isDestroyed=function(){return!1};Ql.prototype.destroy=function(){this._eventHelper.removeAll();let e=this._dataSourceCollection;for(let t=0,n=e.length;t<n;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),c(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),de(this)};Ql.prototype.update=function(e){if(T.defined("time",e),!ui.initialized)return this._ready=!1,!1;let t=!0,n,i,o,r,s=this._dataSourceCollection,a=s.length;for(n=0;n<a;n++){let l=s.get(n);for(c(l.update)&&(t=l.update(e)&&t),o=l._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t}for(o=this._defaultDataSource._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t;return!this._ready&&t&&this._scene.requestRender(),this._ready=this._ready||t,t};Ql.prototype._postRender=function(){let e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){let o=t.get(i),r=o.credit;c(r)&&e.creditDisplay.addCreditToNextFrame(r);let s=o._resourceCredits;if(c(s)){let a=s.length;for(let l=0;l<a;l++)e.creditDisplay.addCreditToNextFrame(s[l])}}};var knt=[],Unt=new le;Ql.prototype.getBoundingSphere=function(e,t,n){if(T.defined("entity",e),T.typeOf.bool("allowPartial",t),T.defined("result",n),!this._ready)return lt.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;let p=this._dataSourceCollection;for(o=p.length,i=0;i<o;i++){let g=p.get(i);if(g.entities.contains(e)){r=g;break}}}if(!c(r))return lt.FAILED;let s=knt,a=Unt,l=0,u=lt.DONE,f=r._visualizers,h=f.length;for(i=0;i<h;i++){let p=f[i];if(c(p.getBoundingSphere)){if(u=f[i].getBoundingSphere(e,a),!t&&u===lt.PENDING)return lt.PENDING;u===lt.DONE&&(s[l]=le.clone(a,s[l]),l++)}}return l===0?lt.FAILED:(s.length=l,le.fromBoundingSpheres(s,n),lt.DONE)};Ql.prototype._onDataSourceAdded=function(e,t){let n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new fl),s=o.add(new vN);t._primitives=r,t._groundPrimitives=s;let a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};Ql.prototype._onDataSourceRemoved=function(e,t){let n=this._primitives,i=this._groundPrimitives,o=t._primitives,r=t._groundPrimitives,s=t.clustering;o.remove(s);let a=t._visualizers,l=a.length;for(let u=0;u<l;u++)a[u].destroy();n.remove(o),i.remove(r),t._visualizers=void 0};Ql.prototype._onDataSourceMoved=function(e,t,n){let i=this._primitives,o=this._groundPrimitives,r=e._primitives,s=e._groundPrimitives;t===n+1?(i.raise(r),o.raise(s)):t===n-1?(i.lower(r),o.lower(s)):t===0?(i.lowerToBottom(r),o.lowerToBottom(s),i.raise(r),o.raise(s)):(i.raiseToTop(r),o.raiseToTop(s))};var uF=Ql;function v7(e,t,n){this.heading=e??0,this.pitch=t??0,this.range=n??0}v7.clone=function(e,t){if(c(e))return c(t)||(t=new v7),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};var cd=v7;var Npe=new J,Fpe=new J,Bpe=new J,Vnt=new B,R4=new d,kpe=new d,D7=new d,P7=new d,Upe=new d,Vpe=new d,znt=new Le,Hnt=new d,Gnt=new J,MS=new Q,jnt=1.25;function Wnt(e,t,n,i,o,r,s,a,l,u){let f=e.scene.mode,h=o.getValue(l,e._lastCartesian);if(c(h)){let p=!1,g=!1,m,y,b;if(f===oe.SCENE3D){Q.addSeconds(l,.001,MS);let M=o.getValue(MS,R4);if(c(M)||(Q.addSeconds(l,-.001,MS),M=o.getValue(MS,R4),g=!0),c(M)){let R=Ot.computeFixedToIcrfMatrix(l,Npe),L=Ot.computeFixedToIcrfMatrix(MS,Fpe),F;!c(R)||!c(L)?(F=Ot.computeTemeToPseudoFixedMatrix(l,Bpe),R=J.transpose(F,Npe),L=Ot.computeTemeToPseudoFixedMatrix(MS,Fpe),J.transpose(L,L)):F=J.transpose(R,Bpe);let _=J.multiplyByVector(R,h,Upe),w=J.multiplyByVector(L,M,Vpe);d.subtract(_,w,P7);let D=d.magnitude(P7)*1e3,I=O.GRAVITATIONALPARAMETER,N=-I/(D*D-2*I/d.magnitude(_));N<0||N>jnt*u.maximumRadius?(m=kpe,d.normalize(h,m),d.negate(m,m),b=d.clone(d.UNIT_Z,D7),y=d.cross(b,m,R4),d.magnitude(y)>O.EPSILON7&&(d.normalize(m,m),d.normalize(y,y),b=d.cross(m,y,D7),d.normalize(b,b),p=!0)):d.equalsEpsilon(h,M,O.EPSILON7)||(b=kpe,d.normalize(_,b),d.normalize(w,w),y=d.cross(b,w,D7),g&&(y=d.multiplyByScalar(y,-1,y)),d.equalsEpsilon(y,d.ZERO,O.EPSILON7)||(m=d.cross(y,b,R4),J.multiplyByVector(F,m,m),J.multiplyByVector(F,y,y),J.multiplyByVector(F,b,b),d.normalize(m,m),d.normalize(y,y),d.normalize(b,b),p=!0))}}c(e.boundingSphere)&&(h=e.boundingSphere.center);let x,A,C;i&&(x=d.clone(t.position,P7),A=d.clone(t.direction,Upe),C=d.clone(t.up,Vpe));let S=Vnt,v;c(s)&&(v=s.getValue(l,znt));let P=r.getValue(l,Hnt);if(a===Bp.INERTIAL&&c(v))B.fromTranslationQuaternionRotationScale(h,v,d.ONE,S);else if(a===Bp.VELOCITY&&c(P)){let M=Ot.rotationMatrixFromPositionVelocity(h,P,u,Gnt);B.fromRotationTranslation(M,h,S)}else a===Bp.ENU||!p?Ot.eastNorthUpToFixedFrame(h,u,S):(S[0]=m.x,S[1]=m.y,S[2]=m.z,S[3]=0,S[4]=y.x,S[5]=y.y,S[6]=y.z,S[7]=0,S[8]=b.x,S[9]=b.y,S[10]=b.z,S[11]=0,S[12]=h.x,S[13]=h.y,S[14]=h.z,S[15]=0);t._setTransform(S),i&&(d.clone(x,t.position),d.clone(A,t.direction),d.clone(C,t.up),d.cross(A,C,t.right))}if(n){let p=f===oe.SCENE2D||d.equals(e._offset3D,d.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,p)}}function fF(e,t,n){T.defined("entity",e),T.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=n??ie.default,this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new d,this._defaultOffset3D=void 0,this._velocityProperty=new $_(e.position,!0),this._offset3D=new d}Object.defineProperties(fF,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=d.clone(e,new d)}}});fF.defaultOffset3D=new d(-14e3,3500,3500);var M4=new cd,qnt=new d;fF.prototype.update=function(e,t){T.defined("time",e);let n=this.scene,i=this.ellipsoid,o=n.mode;if(o===oe.MORPHING)return;let r=this.entity,s=r.trackingReferenceFrame,a=r.position;if(!c(a))return;let l=this._velocityProperty,u=r.orientation,f=r!==this._lastEntity,h=o!==this._mode,p=n.camera,g=f||h,m=!0;if(f){let y=r.viewFrom,b=c(y);if(!b&&c(t)){M4.pitch=-O.PI_OVER_FOUR,M4.range=0;let x=a.getValue(e,qnt);if(c(x)){let A=2-1/Math.max(1,d.magnitude(x)/i.maximumRadius);M4.pitch*=A}p.viewBoundingSphere(t,M4),this.boundingSphere=t,g=!1,m=!1}else(!b||!c(y.getValue(e,this._offset3D)))&&d.clone(fF._defaultOffset3D,this._offset3D)}else!h&&this._mode!==oe.SCENE2D&&d.clone(p.position,this._offset3D);this._lastEntity=r,this._mode=o,Wnt(this,p,g,m,a,l,u,s,e,i)};var dF=fF;function V4(e){return z4(e.map(([t,n])=>new Array(t).fill(n,0,t)))}function z4(e){return e.reduce((t,n)=>t.concat(Array.isArray(n)?z4(n):n),[])}var zpe=[0,1,2,3].concat(...V4([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function br(){let e=this;function t(o){let r=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,u=e.stat_desc.max_length,f,h,p,g,m,y,b=0;for(g=0;g<=15;g++)o.bl_count[g]=0;for(r[o.heap[o.heap_max]*2+1]=0,f=o.heap_max+1;f<573;f++)h=o.heap[f],g=r[r[h*2+1]*2+1]+1,g>u&&(g=u,b++),r[h*2+1]=g,!(h>e.max_code)&&(o.bl_count[g]++,m=0,h>=l&&(m=a[h-l]),y=r[h*2],o.opt_len+=y*(g+m),s&&(o.static_len+=y*(s[h*2+1]+m)));if(b!==0){do{for(g=u-1;o.bl_count[g]===0;)g--;o.bl_count[g]--,o.bl_count[g+1]+=2,o.bl_count[u]--,b-=2}while(b>0);for(g=u;g!==0;g--)for(h=o.bl_count[g];h!==0;)p=o.heap[--f],!(p>e.max_code)&&(r[p*2+1]!=g&&(o.opt_len+=(g-r[p*2+1])*r[p*2],r[p*2+1]=g),h--)}}function n(o,r){let s=0;do s|=o&1,o>>>=1,s<<=1;while(--r>0);return s>>>1}function i(o,r,s){let a=[],l=0,u,f,h;for(u=1;u<=15;u++)a[u]=l=l+s[u-1]<<1;for(f=0;f<=r;f++)h=o[f*2+1],h!==0&&(o[f*2]=n(a[h]++,h))}e.build_tree=function(o){let r=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.elems,l,u,f=-1,h;for(o.heap_len=0,o.heap_max=573,l=0;l<a;l++)r[l*2]!==0?(o.heap[++o.heap_len]=f=l,o.depth[l]=0):r[l*2+1]=0;for(;o.heap_len<2;)h=o.heap[++o.heap_len]=f<2?++f:0,r[h*2]=1,o.depth[h]=0,o.opt_len--,s&&(o.static_len-=s[h*2+1]);for(e.max_code=f,l=Math.floor(o.heap_len/2);l>=1;l--)o.pqdownheap(r,l);h=a;do l=o.heap[1],o.heap[1]=o.heap[o.heap_len--],o.pqdownheap(r,1),u=o.heap[1],o.heap[--o.heap_max]=l,o.heap[--o.heap_max]=u,r[h*2]=r[l*2]+r[u*2],o.depth[h]=Math.max(o.depth[l],o.depth[u])+1,r[l*2+1]=r[u*2+1]=h,o.heap[1]=h++,o.pqdownheap(r,1);while(o.heap_len>=2);o.heap[--o.heap_max]=o.heap[1],t(o),i(r,e.max_code,o.bl_count)}}br._length_code=[0,1,2,3,4,5,6,7].concat(...V4([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]]));br.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0];br.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576];br.d_code=function(e){return e<256?zpe[e]:zpe[256+(e>>>7)]};br.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];br.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];br.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];br.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Ha(e,t,n,i,o){let r=this;r.static_tree=e,r.extra_bits=t,r.extra_base=n,r.elems=i,r.max_length=o}var Ynt=[12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227],Xnt=V4([[144,8],[112,9],[24,7],[8,8]]);Ha.static_ltree=z4(Ynt.map((e,t)=>[e,Xnt[t]]));var Knt=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23],$nt=V4([[30,5]]);Ha.static_dtree=z4(Knt.map((e,t)=>[e,$nt[t]]));Ha.static_l_desc=new Ha(Ha.static_ltree,br.extra_lbits,257,286,15);Ha.static_d_desc=new Ha(Ha.static_dtree,br.extra_dbits,0,30,15);Ha.static_bl_desc=new Ha(null,br.extra_blbits,0,19,7);var Znt=9,Qnt=8;function Gm(e,t,n,i,o){let r=this;r.good_length=e,r.max_lazy=t,r.nice_length=n,r.max_chain=i,r.func=o}var Gpe=0,k4=1,CT=2,Rh=[new Gm(0,0,0,0,Gpe),new Gm(4,4,8,4,k4),new Gm(4,5,16,8,k4),new Gm(4,6,32,32,k4),new Gm(4,4,16,16,CT),new Gm(8,16,32,32,CT),new Gm(8,16,128,128,CT),new Gm(8,32,128,256,CT),new Gm(32,128,258,1024,CT),new Gm(32,258,258,4096,CT)],L4=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],ld=0,N4=1,hF=2,F4=3,Jnt=32,I7=42,B4=113,mF=666,O7=8,eit=0,R7=1,tit=2,Mr=3,U4=258,Wu=U4+Mr+1;function Hpe(e,t,n,i){let o=e[t*2],r=e[n*2];return o<r||o==r&&i[t]<=i[n]}function nit(){let e=this,t,n,i,o,r,s,a,l,u,f,h,p,g,m,y,b,x,A,C,S,v,P,M,R,L,F,_,w,D,I,N,k,z,V=new br,j=new br,U=new br;e.depth=[];let q,Y,te,K,Z,ee;e.bl_count=[],e.heap=[],N=[],k=[],z=[];function me(){u=2*r,h[g-1]=0;for(let Ne=0;Ne<g-1;Ne++)h[Ne]=0;F=Rh[_].max_lazy,D=Rh[_].good_length,I=Rh[_].nice_length,L=Rh[_].max_chain,v=0,x=0,M=0,A=R=Mr-1,S=0,p=0}function Te(){let Ne;for(Ne=0;Ne<286;Ne++)N[Ne*2]=0;for(Ne=0;Ne<30;Ne++)k[Ne*2]=0;for(Ne=0;Ne<19;Ne++)z[Ne*2]=0;N[256*2]=1,e.opt_len=e.static_len=0,Y=te=0}function ue(){V.dyn_tree=N,V.stat_desc=Ha.static_l_desc,j.dyn_tree=k,j.stat_desc=Ha.static_d_desc,U.dyn_tree=z,U.stat_desc=Ha.static_bl_desc,Z=0,ee=0,K=8,Te()}e.pqdownheap=function(Ne,ot){let Xe=e.heap,Ze=Xe[ot],pt=ot<<1;for(;pt<=e.heap_len&&(pt<e.heap_len&&Hpe(Ne,Xe[pt+1],Xe[pt],e.depth)&&pt++,!Hpe(Ne,Ze,Xe[pt],e.depth));)Xe[ot]=Xe[pt],ot=pt,pt<<=1;Xe[ot]=Ze};function ye(Ne,ot){let Xe=-1,Ze,pt=Ne[0*2+1],Ht=0,Cn=7,Mo=4;pt===0&&(Cn=138,Mo=3),Ne[(ot+1)*2+1]=65535;for(let Ao=0;Ao<=ot;Ao++)Ze=pt,pt=Ne[(Ao+1)*2+1],!(++Ht<Cn&&Ze==pt)&&(Ht<Mo?z[Ze*2]+=Ht:Ze!==0?(Ze!=Xe&&z[Ze*2]++,z[16*2]++):Ht<=10?z[17*2]++:z[18*2]++,Ht=0,Xe=Ze,pt===0?(Cn=138,Mo=3):Ze==pt?(Cn=6,Mo=3):(Cn=7,Mo=4))}function Ae(){let Ne;for(ye(N,V.max_code),ye(k,j.max_code),U.build_tree(e),Ne=18;Ne>=3&&z[br.bl_order[Ne]*2+1]===0;Ne--);return e.opt_len+=3*(Ne+1)+5+5+4,Ne}function Pe(Ne){e.pending_buf[e.pending++]=Ne}function Ee(Ne){Pe(Ne&255),Pe(Ne>>>8&255)}function ze(Ne){Pe(Ne>>8&255),Pe(Ne&255&255)}function qe(Ne,ot){let Xe,Ze=ot;ee>16-Ze?(Xe=Ne,Z|=Xe<<ee&65535,Ee(Z),Z=Xe>>>16-ee,ee+=Ze-16):(Z|=Ne<<ee&65535,ee+=Ze)}function it(Ne,ot){let Xe=Ne*2;qe(ot[Xe]&65535,ot[Xe+1]&65535)}function Dt(Ne,ot){let Xe,Ze=-1,pt,Ht=Ne[0*2+1],Cn=0,Mo=7,Ao=4;for(Ht===0&&(Mo=138,Ao=3),Xe=0;Xe<=ot;Xe++)if(pt=Ht,Ht=Ne[(Xe+1)*2+1],!(++Cn<Mo&&pt==Ht)){if(Cn<Ao)do it(pt,z);while(--Cn!==0);else pt!==0?(pt!=Ze&&(it(pt,z),Cn--),it(16,z),qe(Cn-3,2)):Cn<=10?(it(17,z),qe(Cn-3,3)):(it(18,z),qe(Cn-11,7));Cn=0,Ze=pt,Ht===0?(Mo=138,Ao=3):pt==Ht?(Mo=6,Ao=3):(Mo=7,Ao=4)}}function jt(Ne,ot,Xe){let Ze;for(qe(Ne-257,5),qe(ot-1,5),qe(Xe-4,4),Ze=0;Ze<Xe;Ze++)qe(z[br.bl_order[Ze]*2+1],3);Dt(N,Ne-1),Dt(k,ot-1)}function $e(){ee==16?(Ee(Z),Z=0,ee=0):ee>=8&&(Pe(Z&255),Z>>>=8,ee-=8)}function un(){qe(R7<<1,3),it(256,Ha.static_ltree),$e(),1+K+10-ee<9&&(qe(R7<<1,3),it(256,Ha.static_ltree),$e()),K=7}function zt(Ne,ot){let Xe,Ze,pt;if(e.dist_buf[Y]=Ne,e.lc_buf[Y]=ot&255,Y++,Ne===0?N[ot*2]++:(te++,Ne--,N[(br._length_code[ot]+256+1)*2]++,k[br.d_code(Ne)*2]++),!(Y&8191)&&_>2){for(Xe=Y*8,Ze=v-x,pt=0;pt<30;pt++)Xe+=k[pt*2]*(5+br.extra_dbits[pt]);if(Xe>>>=3,te<Math.floor(Y/2)&&Xe<Math.floor(Ze/2))return!0}return Y==q-1}function Ct(Ne,ot){let Xe,Ze,pt=0,Ht,Cn;if(Y!==0)do Xe=e.dist_buf[pt],Ze=e.lc_buf[pt],pt++,Xe===0?it(Ze,Ne):(Ht=br._length_code[Ze],it(Ht+256+1,Ne),Cn=br.extra_lbits[Ht],Cn!==0&&(Ze-=br.base_length[Ht],qe(Ze,Cn)),Xe--,Ht=br.d_code(Xe),it(Ht,ot),Cn=br.extra_dbits[Ht],Cn!==0&&(Xe-=br.base_dist[Ht],qe(Xe,Cn)));while(pt<Y);it(256,Ne),K=Ne[256*2+1]}function Ei(){ee>8?Ee(Z):ee>0&&Pe(Z&255),Z=0,ee=0}function an(Ne,ot,Xe){Ei(),K=8,Xe&&(Ee(ot),Ee(~ot)),e.pending_buf.set(l.subarray(Ne,Ne+ot),e.pending),e.pending+=ot}function _e(Ne,ot,Xe){qe((eit<<1)+(Xe?1:0),3),an(Ne,ot,!0)}function Ce(Ne,ot,Xe){let Ze,pt,Ht=0;_>0?(V.build_tree(e),j.build_tree(e),Ht=Ae(),Ze=e.opt_len+3+7>>>3,pt=e.static_len+3+7>>>3,pt<=Ze&&(Ze=pt)):Ze=pt=ot+5,ot+4<=Ze&&Ne!=-1?_e(Ne,ot,Xe):pt==Ze?(qe((R7<<1)+(Xe?1:0),3),Ct(Ha.static_ltree,Ha.static_dtree)):(qe((tit<<1)+(Xe?1:0),3),jt(V.max_code+1,j.max_code+1,Ht+1),Ct(N,k)),Te(),Xe&&Ei()}function pn(Ne){Ce(x>=0?x:-1,v-x,Ne),x=v,t.flush_pending()}function mt(){let Ne,ot,Xe,Ze;do{if(Ze=u-M-v,Ze===0&&v===0&&M===0)Ze=r;else if(Ze==-1)Ze--;else if(v>=r+r-Wu){l.set(l.subarray(r,r+r),0),P-=r,v-=r,x-=r,Ne=g,Xe=Ne;do ot=h[--Xe]&65535,h[Xe]=ot>=r?ot-r:0;while(--Ne!==0);Ne=r,Xe=Ne;do ot=f[--Xe]&65535,f[Xe]=ot>=r?ot-r:0;while(--Ne!==0);Ze+=r}if(t.avail_in===0)return;Ne=t.read_buf(l,v+M,Ze),M+=Ne,M>=Mr&&(p=l[v]&255,p=(p<<b^l[v+1]&255)&y)}while(M<Wu&&t.avail_in!==0)}function so(Ne){let ot=65535,Xe;for(ot>i-5&&(ot=i-5);;){if(M<=1){if(mt(),M===0&&Ne==0)return ld;if(M===0)break}if(v+=M,M=0,Xe=x+ot,(v===0||v>=Xe)&&(M=v-Xe,v=Xe,pn(!1),t.avail_out===0)||v-x>=r-Wu&&(pn(!1),t.avail_out===0))return ld}return pn(Ne==4),t.avail_out===0?Ne==4?hF:ld:Ne==4?F4:N4}function Ro(Ne){let ot=L,Xe=v,Ze,pt,Ht=R,Cn=v>r-Wu?v-(r-Wu):0,Mo=I,Ao=a,Za=v+U4,Qa=l[Xe+Ht-1],Si=l[Xe+Ht];R>=D&&(ot>>=2),Mo>M&&(Mo=M);do if(Ze=Ne,!(l[Ze+Ht]!=Si||l[Ze+Ht-1]!=Qa||l[Ze]!=l[Xe]||l[++Ze]!=l[Xe+1])){Xe+=2,Ze++;do;while(l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&l[++Xe]==l[++Ze]&&Xe<Za);if(pt=U4-(Za-Xe),Xe=Za-U4,pt>Ht){if(P=Ne,Ht=pt,pt>=Mo)break;Qa=l[Xe+Ht-1],Si=l[Xe+Ht]}}while((Ne=f[Ne&Ao]&65535)>Cn&&--ot!==0);return Ht<=M?Ht:M}function aa(Ne){let ot=0,Xe;for(;;){if(M<Wu){if(mt(),M<Wu&&Ne==0)return ld;if(M===0)break}if(M>=Mr&&(p=(p<<b^l[v+(Mr-1)]&255)&y,ot=h[p]&65535,f[v&a]=h[p],h[p]=v),ot!==0&&(v-ot&65535)<=r-Wu&&w!=2&&(A=Ro(ot)),A>=Mr)if(Xe=zt(v-P,A-Mr),M-=A,A<=F&&M>=Mr){A--;do v++,p=(p<<b^l[v+(Mr-1)]&255)&y,ot=h[p]&65535,f[v&a]=h[p],h[p]=v;while(--A!==0);v++}else v+=A,A=0,p=l[v]&255,p=(p<<b^l[v+1]&255)&y;else Xe=zt(0,l[v]&255),M--,v++;if(Xe&&(pn(!1),t.avail_out===0))return ld}return pn(Ne==4),t.avail_out===0?Ne==4?hF:ld:Ne==4?F4:N4}function Nr(Ne){let ot=0,Xe,Ze;for(;;){if(M<Wu){if(mt(),M<Wu&&Ne==0)return ld;if(M===0)break}if(M>=Mr&&(p=(p<<b^l[v+(Mr-1)]&255)&y,ot=h[p]&65535,f[v&a]=h[p],h[p]=v),R=A,C=P,A=Mr-1,ot!==0&&R<F&&(v-ot&65535)<=r-Wu&&(w!=2&&(A=Ro(ot)),A<=5&&(w==1||A==Mr&&v-P>4096)&&(A=Mr-1)),R>=Mr&&A<=R){Ze=v+M-Mr,Xe=zt(v-1-C,R-Mr),M-=R-1,R-=2;do++v<=Ze&&(p=(p<<b^l[v+(Mr-1)]&255)&y,ot=h[p]&65535,f[v&a]=h[p],h[p]=v);while(--R!==0);if(S=0,A=Mr-1,v++,Xe&&(pn(!1),t.avail_out===0))return ld}else if(S!==0){if(Xe=zt(0,l[v-1]&255),Xe&&pn(!1),v++,M--,t.avail_out===0)return ld}else S=1,v++,M--}return S!==0&&(Xe=zt(0,l[v-1]&255),S=0),pn(Ne==4),t.avail_out===0?Ne==4?hF:ld:Ne==4?F4:N4}function Cs(Ne){return Ne.total_in=Ne.total_out=0,Ne.msg=null,e.pending=0,e.pending_out=0,n=B4,o=0,ue(),me(),0}e.deflateInit=function(Ne,ot,Xe,Ze,pt,Ht){return Ze||(Ze=O7),pt||(pt=Qnt),Ht||(Ht=0),Ne.msg=null,ot==-1&&(ot=6),pt<1||pt>Znt||Ze!=O7||Xe<9||Xe>15||ot<0||ot>9||Ht<0||Ht>2?-2:(Ne.dstate=e,s=Xe,r=1<<s,a=r-1,m=pt+7,g=1<<m,y=g-1,b=Math.floor((m+Mr-1)/Mr),l=new Uint8Array(r*2),f=[],h=[],q=1<<pt+6,e.pending_buf=new Uint8Array(q*4),i=q*4,e.dist_buf=new Uint16Array(q),e.lc_buf=new Uint8Array(q),_=ot,w=Ht,Cs(Ne))},e.deflateEnd=function(){return n!=I7&&n!=B4&&n!=mF?-2:(e.lc_buf=null,e.dist_buf=null,e.pending_buf=null,h=null,f=null,l=null,e.dstate=null,n==B4?-3:0)},e.deflateParams=function(Ne,ot,Xe){let Ze=0;return ot==-1&&(ot=6),ot<0||ot>9||Xe<0||Xe>2?-2:(Rh[_].func!=Rh[ot].func&&Ne.total_in!==0&&(Ze=Ne.deflate(1)),_!=ot&&(_=ot,F=Rh[_].max_lazy,D=Rh[_].good_length,I=Rh[_].nice_length,L=Rh[_].max_chain),w=Xe,Ze)},e.deflateSetDictionary=function(Ne,ot,Xe){let Ze=Xe,pt,Ht=0;if(!ot||n!=I7)return-2;if(Ze<Mr)return 0;for(Ze>r-Wu&&(Ze=r-Wu,Ht=Xe-Ze),l.set(ot.subarray(Ht,Ht+Ze),0),v=Ze,x=Ze,p=l[0]&255,p=(p<<b^l[1]&255)&y,pt=0;pt<=Ze-Mr;pt++)p=(p<<b^l[pt+(Mr-1)]&255)&y,f[pt&a]=h[p],h[p]=pt;return 0},e.deflate=function(Ne,ot){let Xe,Ze,pt,Ht,Cn;if(ot>4||ot<0)return-2;if(!Ne.next_out||!Ne.next_in&&Ne.avail_in!==0||n==mF&&ot!=4)return Ne.msg=L4[4],-2;if(Ne.avail_out===0)return Ne.msg=L4[7],-5;if(t=Ne,Ht=o,o=ot,n==I7&&(Ze=O7+(s-8<<4)<<8,pt=(_-1&255)>>1,pt>3&&(pt=3),Ze|=pt<<6,v!==0&&(Ze|=Jnt),Ze+=31-Ze%31,n=B4,ze(Ze)),e.pending!==0){if(t.flush_pending(),t.avail_out===0)return o=-1,0}else if(t.avail_in===0&&ot<=Ht&&ot!=4)return t.msg=L4[7],-5;if(n==mF&&t.avail_in!==0)return Ne.msg=L4[7],-5;if(t.avail_in!==0||M!==0||ot!=0&&n!=mF){switch(Cn=-1,Rh[_].func){case Gpe:Cn=so(ot);break;case k4:Cn=aa(ot);break;case CT:Cn=Nr(ot);break;default:}if((Cn==hF||Cn==F4)&&(n=mF),Cn==ld||Cn==hF)return t.avail_out===0&&(o=-1),0;if(Cn==N4){if(ot==1)un();else if(_e(0,0,!1),ot==3)for(Xe=0;Xe<g;Xe++)h[Xe]=0;if(t.flush_pending(),t.avail_out===0)return o=-1,0}}return ot!=4?0:1}}function jpe(){let e=this;e.next_in_index=0,e.next_out_index=0,e.avail_in=0,e.total_in=0,e.avail_out=0,e.total_out=0}jpe.prototype={deflateInit(e,t){let n=this;return n.dstate=new nit,t||(t=15),n.dstate.deflateInit(n,e,t)},deflate(e){let t=this;return t.dstate?t.dstate.deflate(t,e):-2},deflateEnd(){let e=this;if(!e.dstate)return-2;let t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams(e,t){let n=this;return n.dstate?n.dstate.deflateParams(n,e,t):-2},deflateSetDictionary(e,t){let n=this;return n.dstate?n.dstate.deflateSetDictionary(n,e,t):-2},read_buf(e,t,n){let i=this,o=i.avail_in;return o>n&&(o=n),o===0?0:(i.avail_in-=o,e.set(i.next_in.subarray(i.next_in_index,i.next_in_index+o),t),i.next_in_index+=o,i.total_in+=o,o)},flush_pending(){let e=this,t=e.dstate.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.next_out.set(e.dstate.pending_buf.subarray(e.dstate.pending_out,e.dstate.pending_out+t),e.next_out_index),e.next_out_index+=t,e.dstate.pending_out+=t,e.total_out+=t,e.avail_out-=t,e.dstate.pending-=t,e.dstate.pending===0&&(e.dstate.pending_out=0))}};function Wpe(e){let t=this,n=new jpe,i=iit(e&&e.chunkSize?e.chunkSize:64*1024),o=0,r=new Uint8Array(i),s=e?e.level:-1;typeof s>"u"&&(s=-1),n.deflateInit(s),n.next_out=r,t.append=function(a,l){let u,f,h=0,p=0,g=0,m=[];if(a.length){n.next_in_index=0,n.next_in=a,n.avail_in=a.length;do{if(n.next_out_index=0,n.avail_out=i,u=n.deflate(o),u!=0)throw new Error("deflating: "+n.msg);n.next_out_index&&(n.next_out_index==i?m.push(new Uint8Array(r)):m.push(r.subarray(0,n.next_out_index))),g+=n.next_out_index,l&&n.next_in_index>0&&n.next_in_index!=h&&(l(n.next_in_index),h=n.next_in_index)}while(n.avail_in>0||n.avail_out===0);return m.length>1?(f=new Uint8Array(g),m.forEach(function(y){f.set(y,p),p+=y.length})):f=m[0]?new Uint8Array(m[0]):new Uint8Array,f}},t.flush=function(){let a,l,u=0,f=0,h=[];do{if(n.next_out_index=0,n.avail_out=i,a=n.deflate(4),a!=1&&a!=0)throw new Error("deflating: "+n.msg);i-n.avail_out>0&&h.push(r.slice(0,n.next_out_index)),f+=n.next_out_index}while(n.avail_in>0||n.avail_out===0);return n.deflateEnd(),l=new Uint8Array(f),h.forEach(function(p){l.set(p,u),u+=p.length}),l}}function iit(e){return e+5*(Math.floor(e/16383)+1)}var qu=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],f_e=1440,oit=0,rit=4,sit=9,ait=5,cit=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],lit=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],uit=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],fit=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,112,112],dit=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],hit=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],d0=15;function F7(){let e=this,t,n,i,o,r,s;function a(u,f,h,p,g,m,y,b,x,A,C){let S,v,P,M,R,L,F,_,w,D,I,N,k,z,V;D=0,R=h;do i[u[f+D]]++,D++,R--;while(R!==0);if(i[0]==h)return y[0]=-1,b[0]=0,0;for(_=b[0],L=1;L<=d0&&i[L]===0;L++);for(F=L,_<L&&(_=L),R=d0;R!==0&&i[R]===0;R--);for(P=R,_>R&&(_=R),b[0]=_,z=1<<L;L<R;L++,z<<=1)if((z-=i[L])<0)return-3;if((z-=i[R])<0)return-3;for(i[R]+=z,s[1]=L=0,D=1,k=2;--R!==0;)s[k]=L+=i[D],k++,D++;R=0,D=0;do(L=u[f+D])!==0&&(C[s[L]++]=R),D++;while(++R<h);for(h=s[P],s[0]=R=0,D=0,M=-1,N=-_,r[0]=0,I=0,V=0;F<=P;F++)for(S=i[F];S--!==0;){for(;F>N+_;){if(M++,N+=_,V=P-N,V=V>_?_:V,(v=1<<(L=F-N))>S+1&&(v-=S+1,k=F,L<V))for(;++L<V&&!((v<<=1)<=i[++k]);)v-=i[k];if(V=1<<L,A[0]+V>f_e)return-3;r[M]=I=A[0],A[0]+=V,M!==0?(s[M]=R,o[0]=L,o[1]=_,L=R>>>N-_,o[2]=I-r[M-1]-L,x.set(o,(r[M-1]+L)*3)):y[0]=I}for(o[1]=F-N,D>=h?o[0]=192:C[D]<p?(o[0]=C[D]<256?0:96,o[2]=C[D++]):(o[0]=m[C[D]-p]+16+64,o[2]=g[C[D++]-p]),v=1<<F-N,L=R>>>N;L<V;L+=v)x.set(o,(I+L)*3);for(L=1<<F-1;R&L;L>>>=1)R^=L;for(R^=L,w=(1<<N)-1;(R&w)!=s[M];)M--,N-=_,w=(1<<N)-1}return z!==0&&P!=1?-5:0}function l(u){let f;for(t||(t=[],n=[],i=new Int32Array(d0+1),o=[],r=new Int32Array(d0),s=new Int32Array(d0+1)),n.length<u&&(n=[]),f=0;f<u;f++)n[f]=0;for(f=0;f<d0+1;f++)i[f]=0;for(f=0;f<3;f++)o[f]=0;r.set(i.subarray(0,d0),0),s.set(i.subarray(0,d0+1),0)}e.inflate_trees_bits=function(u,f,h,p,g){let m;return l(19),t[0]=0,m=a(u,0,19,19,null,null,h,f,p,t,n),m==-3?g.msg="oversubscribed dynamic bit lengths tree":(m==-5||f[0]===0)&&(g.msg="incomplete dynamic bit lengths tree",m=-3),m},e.inflate_trees_dynamic=function(u,f,h,p,g,m,y,b,x){let A;return l(288),t[0]=0,A=a(h,0,u,257,uit,fit,m,p,b,t,n),A!=0||p[0]===0?(A==-3?x.msg="oversubscribed literal/length tree":A!=-4&&(x.msg="incomplete literal/length tree",A=-3),A):(l(288),A=a(h,u,f,0,dit,hit,y,g,b,t,n),A!=0||g[0]===0&&u>257?(A==-3?x.msg="oversubscribed distance tree":A==-5?(x.msg="incomplete distance tree",A=-3):A!=-4&&(x.msg="empty distance tree with lengths",A=-3),A):0)}}F7.inflate_trees_fixed=function(e,t,n,i){return e[0]=sit,t[0]=ait,n[0]=cit,i[0]=lit,0};var H4=0,qpe=1,Ype=2,Xpe=3,Kpe=4,$pe=5,Zpe=6,M7=7,Qpe=8,G4=9;function mit(){let e=this,t,n=0,i,o=0,r=0,s=0,a=0,l=0,u=0,f=0,h,p=0,g,m=0;function y(b,x,A,C,S,v,P,M){let R,L,F,_,w,D,I,N,k,z,V,j,U,q,Y,te;I=M.next_in_index,N=M.avail_in,w=P.bitb,D=P.bitk,k=P.write,z=k<P.read?P.read-k-1:P.end-k,V=qu[b],j=qu[x];do{for(;D<20;)N--,w|=(M.read_byte(I++)&255)<<D,D+=8;if(R=w&V,L=A,F=C,te=(F+R)*3,(_=L[te])===0){w>>=L[te+1],D-=L[te+1],P.win[k++]=L[te+2],z--;continue}do{if(w>>=L[te+1],D-=L[te+1],_&16){for(_&=15,U=L[te+2]+(w&qu[_]),w>>=_,D-=_;D<15;)N--,w|=(M.read_byte(I++)&255)<<D,D+=8;R=w&j,L=S,F=v,te=(F+R)*3,_=L[te];do if(w>>=L[te+1],D-=L[te+1],_&16){for(_&=15;D<_;)N--,w|=(M.read_byte(I++)&255)<<D,D+=8;if(q=L[te+2]+(w&qu[_]),w>>=_,D-=_,z-=U,k>=q)Y=k-q,k-Y>0&&2>k-Y?(P.win[k++]=P.win[Y++],P.win[k++]=P.win[Y++],U-=2):(P.win.set(P.win.subarray(Y,Y+2),k),k+=2,Y+=2,U-=2);else{Y=k-q;do Y+=P.end;while(Y<0);if(_=P.end-Y,U>_){if(U-=_,k-Y>0&&_>k-Y)do P.win[k++]=P.win[Y++];while(--_!==0);else P.win.set(P.win.subarray(Y,Y+_),k),k+=_,Y+=_,_=0;Y=0}}if(k-Y>0&&U>k-Y)do P.win[k++]=P.win[Y++];while(--U!==0);else P.win.set(P.win.subarray(Y,Y+U),k),k+=U,Y+=U,U=0;break}else if(!(_&64))R+=L[te+2],R+=w&qu[_],te=(F+R)*3,_=L[te];else return M.msg="invalid distance code",U=M.avail_in-N,U=D>>3<U?D>>3:U,N+=U,I-=U,D-=U<<3,P.bitb=w,P.bitk=D,M.avail_in=N,M.total_in+=I-M.next_in_index,M.next_in_index=I,P.write=k,-3;while(!0);break}if(_&64)return _&32?(U=M.avail_in-N,U=D>>3<U?D>>3:U,N+=U,I-=U,D-=U<<3,P.bitb=w,P.bitk=D,M.avail_in=N,M.total_in+=I-M.next_in_index,M.next_in_index=I,P.write=k,1):(M.msg="invalid literal/length code",U=M.avail_in-N,U=D>>3<U?D>>3:U,N+=U,I-=U,D-=U<<3,P.bitb=w,P.bitk=D,M.avail_in=N,M.total_in+=I-M.next_in_index,M.next_in_index=I,P.write=k,-3);if(R+=L[te+2],R+=w&qu[_],te=(F+R)*3,(_=L[te])===0){w>>=L[te+1],D-=L[te+1],P.win[k++]=L[te+2],z--;break}}while(!0)}while(z>=258&&N>=10);return U=M.avail_in-N,U=D>>3<U?D>>3:U,N+=U,I-=U,D-=U<<3,P.bitb=w,P.bitk=D,M.avail_in=N,M.total_in+=I-M.next_in_index,M.next_in_index=I,P.write=k,0}e.init=function(b,x,A,C,S,v){t=H4,u=b,f=x,h=A,p=C,g=S,m=v,i=null},e.proc=function(b,x,A){let C,S,v,P=0,M=0,R=0,L,F,_,w;for(R=x.next_in_index,L=x.avail_in,P=b.bitb,M=b.bitk,F=b.write,_=F<b.read?b.read-F-1:b.end-F;;)switch(t){case H4:if(_>=258&&L>=10&&(b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,A=y(u,f,h,p,g,m,b,x),R=x.next_in_index,L=x.avail_in,P=b.bitb,M=b.bitk,F=b.write,_=F<b.read?b.read-F-1:b.end-F,A!=0)){t=A==1?M7:G4;break}r=u,i=h,o=p,t=qpe;case qpe:for(C=r;M<C;){if(L!==0)A=0;else return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);L--,P|=(x.read_byte(R++)&255)<<M,M+=8}if(S=(o+(P&qu[C]))*3,P>>>=i[S+1],M-=i[S+1],v=i[S],v===0){s=i[S+2],t=Zpe;break}if(v&16){a=v&15,n=i[S+2],t=Ype;break}if(!(v&64)){r=v,o=S/3+i[S+2];break}if(v&32){t=M7;break}return t=G4,x.msg="invalid literal/length code",A=-3,b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);case Ype:for(C=a;M<C;){if(L!==0)A=0;else return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);L--,P|=(x.read_byte(R++)&255)<<M,M+=8}n+=P&qu[C],P>>=C,M-=C,r=f,i=g,o=m,t=Xpe;case Xpe:for(C=r;M<C;){if(L!==0)A=0;else return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);L--,P|=(x.read_byte(R++)&255)<<M,M+=8}if(S=(o+(P&qu[C]))*3,P>>=i[S+1],M-=i[S+1],v=i[S],v&16){a=v&15,l=i[S+2],t=Kpe;break}if(!(v&64)){r=v,o=S/3+i[S+2];break}return t=G4,x.msg="invalid distance code",A=-3,b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);case Kpe:for(C=a;M<C;){if(L!==0)A=0;else return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);L--,P|=(x.read_byte(R++)&255)<<M,M+=8}l+=P&qu[C],P>>=C,M-=C,t=$pe;case $pe:for(w=F-l;w<0;)w+=b.end;for(;n!==0;){if(_===0&&(F==b.end&&b.read!==0&&(F=0,_=F<b.read?b.read-F-1:b.end-F),_===0&&(b.write=F,A=b.inflate_flush(x,A),F=b.write,_=F<b.read?b.read-F-1:b.end-F,F==b.end&&b.read!==0&&(F=0,_=F<b.read?b.read-F-1:b.end-F),_===0)))return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);b.win[F++]=b.win[w++],_--,w==b.end&&(w=0),n--}t=H4;break;case Zpe:if(_===0&&(F==b.end&&b.read!==0&&(F=0,_=F<b.read?b.read-F-1:b.end-F),_===0&&(b.write=F,A=b.inflate_flush(x,A),F=b.write,_=F<b.read?b.read-F-1:b.end-F,F==b.end&&b.read!==0&&(F=0,_=F<b.read?b.read-F-1:b.end-F),_===0)))return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);A=0,b.win[F++]=s,_--,t=H4;break;case M7:if(M>7&&(M-=8,L++,R--),b.write=F,A=b.inflate_flush(x,A),F=b.write,_=F<b.read?b.read-F-1:b.end-F,b.read!=b.write)return b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);t=Qpe;case Qpe:return A=1,b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);case G4:return A=-3,b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A);default:return A=-2,b.bitb=P,b.bitk=M,x.avail_in=L,x.total_in+=R-x.next_in_index,x.next_in_index=R,b.write=F,b.inflate_flush(x,A)}},e.free=function(){}}var Jpe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],LS=0,L7=1,e_e=2,t_e=3,n_e=4,i_e=5,j4=6,W4=7,o_e=8,ET=9;function pit(e,t){let n=this,i=LS,o=0,r=0,s=0,a,l=[0],u=[0],f=new mit,h=0,p=new Int32Array(f_e*3),g=0,m=new F7;n.bitk=0,n.bitb=0,n.win=new Uint8Array(t),n.end=t,n.read=0,n.write=0,n.reset=function(y,b){b&&(b[0]=g),i==j4&&f.free(y),i=LS,n.bitk=0,n.bitb=0,n.read=n.write=0},n.reset(e,null),n.inflate_flush=function(y,b){let x,A,C;return A=y.next_out_index,C=n.read,x=(C<=n.write?n.write:n.end)-C,x>y.avail_out&&(x=y.avail_out),x!==0&&b==-5&&(b=0),y.avail_out-=x,y.total_out+=x,y.next_out.set(n.win.subarray(C,C+x),A),A+=x,C+=x,C==n.end&&(C=0,n.write==n.end&&(n.write=0),x=n.write-C,x>y.avail_out&&(x=y.avail_out),x!==0&&b==-5&&(b=0),y.avail_out-=x,y.total_out+=x,y.next_out.set(n.win.subarray(C,C+x),A),A+=x,C+=x),y.next_out_index=A,n.read=C,b},n.proc=function(y,b){let x,A,C,S,v,P,M,R;for(S=y.next_in_index,v=y.avail_in,A=n.bitb,C=n.bitk,P=n.write,M=P<n.read?n.read-P-1:n.end-P;;){let L,F,_,w,D,I,N,k;switch(i){case LS:for(;C<3;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}switch(x=A&7,h=x&1,x>>>1){case 0:A>>>=3,C-=3,x=C&7,A>>>=x,C-=x,i=L7;break;case 1:L=[],F=[],_=[[]],w=[[]],F7.inflate_trees_fixed(L,F,_,w),f.init(L[0],F[0],_[0],0,w[0],0),A>>>=3,C-=3,i=j4;break;case 2:A>>>=3,C-=3,i=t_e;break;case 3:return A>>>=3,C-=3,i=ET,y.msg="invalid block type",b=-3,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b)}break;case L7:for(;C<32;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}if((~A>>>16&65535)!=(A&65535))return i=ET,y.msg="invalid stored block lengths",b=-3,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);o=A&65535,A=C=0,i=o!==0?e_e:h!==0?W4:LS;break;case e_e:if(v===0||M===0&&(P==n.end&&n.read!==0&&(P=0,M=P<n.read?n.read-P-1:n.end-P),M===0&&(n.write=P,b=n.inflate_flush(y,b),P=n.write,M=P<n.read?n.read-P-1:n.end-P,P==n.end&&n.read!==0&&(P=0,M=P<n.read?n.read-P-1:n.end-P),M===0)))return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);if(b=0,x=o,x>v&&(x=v),x>M&&(x=M),n.win.set(y.read_buf(S,x),P),S+=x,v-=x,P+=x,M-=x,(o-=x)!==0)break;i=h!==0?W4:LS;break;case t_e:for(;C<14;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}if(r=x=A&16383,(x&31)>29||(x>>5&31)>29)return i=ET,y.msg="too many length or distance symbols",b=-3,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);if(x=258+(x&31)+(x>>5&31),!a||a.length<x)a=[];else for(R=0;R<x;R++)a[R]=0;A>>>=14,C-=14,s=0,i=n_e;case n_e:for(;s<4+(r>>>10);){for(;C<3;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}a[Jpe[s++]]=A&7,A>>>=3,C-=3}for(;s<19;)a[Jpe[s++]]=0;if(l[0]=7,x=m.inflate_trees_bits(a,l,u,p,y),x!=0)return b=x,b==-3&&(a=null,i=ET),n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);s=0,i=i_e;case i_e:for(;x=r,!(s>=258+(x&31)+(x>>5&31));){let z,V;for(x=l[0];C<x;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}if(x=p[(u[0]+(A&qu[x]))*3+1],V=p[(u[0]+(A&qu[x]))*3+2],V<16)A>>>=x,C-=x,a[s++]=V;else{for(R=V==18?7:V-14,z=V==18?11:3;C<x+R;){if(v!==0)b=0;else return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);v--,A|=(y.read_byte(S++)&255)<<C,C+=8}if(A>>>=x,C-=x,z+=A&qu[R],A>>>=R,C-=R,R=s,x=r,R+z>258+(x&31)+(x>>5&31)||V==16&&R<1)return a=null,i=ET,y.msg="invalid bit length repeat",b=-3,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);V=V==16?a[R-1]:0;do a[R++]=V;while(--z!==0);s=R}}if(u[0]=-1,D=[],I=[],N=[],k=[],D[0]=9,I[0]=6,x=r,x=m.inflate_trees_dynamic(257+(x&31),1+(x>>5&31),a,D,I,N,k,p,y),x!=0)return x==-3&&(a=null,i=ET),b=x,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);f.init(D[0],I[0],p,N[0],p,k[0]),i=j4;case j4:if(n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,(b=f.proc(n,y,b))!=1)return n.inflate_flush(y,b);if(b=0,f.free(y),S=y.next_in_index,v=y.avail_in,A=n.bitb,C=n.bitk,P=n.write,M=P<n.read?n.read-P-1:n.end-P,h===0){i=LS;break}i=W4;case W4:if(n.write=P,b=n.inflate_flush(y,b),P=n.write,M=P<n.read?n.read-P-1:n.end-P,n.read!=n.write)return n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);i=o_e;case o_e:return b=1,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);case ET:return b=-3,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b);default:return b=-2,n.bitb=A,n.bitk=C,y.avail_in=v,y.total_in+=S-y.next_in_index,y.next_in_index=S,n.write=P,n.inflate_flush(y,b)}}},n.free=function(y){n.reset(y,null),n.win=null,p=null},n.set_dictionary=function(y,b,x){n.win.set(y.subarray(b,b+x),0),n.read=n.write=x},n.sync_point=function(){return i==L7?1:0}}var _it=32,git=8,yit=0,r_e=1,s_e=2,a_e=3,c_e=4,l_e=5,N7=6,pF=7,u_e=12,h0=13,bit=[0,0,255,255];function xit(){let e=this;e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0;function t(n){return!n||!n.istate?-2:(n.total_in=n.total_out=0,n.msg=null,n.istate.mode=pF,n.istate.blocks.reset(n,null),0)}e.inflateEnd=function(n){return e.blocks&&e.blocks.free(n),e.blocks=null,0},e.inflateInit=function(n,i){return n.msg=null,e.blocks=null,i<8||i>15?(e.inflateEnd(n),-2):(e.wbits=i,n.istate.blocks=new pit(n,1<<i),t(n),0)},e.inflate=function(n,i){let o,r;if(!n||!n.istate||!n.next_in)return-2;let s=n.istate;for(i=i==rit?-5:0,o=-5;;)switch(s.mode){case yit:if(n.avail_in===0)return o;if(o=i,n.avail_in--,n.total_in++,((s.method=n.read_byte(n.next_in_index++))&15)!=git){s.mode=h0,n.msg="unknown compression method",s.marker=5;break}if((s.method>>4)+8>s.wbits){s.mode=h0,n.msg="invalid win size",s.marker=5;break}s.mode=r_e;case r_e:if(n.avail_in===0)return o;if(o=i,n.avail_in--,n.total_in++,r=n.read_byte(n.next_in_index++)&255,((s.method<<8)+r)%31!==0){s.mode=h0,n.msg="incorrect header check",s.marker=5;break}if(!(r&_it)){s.mode=pF;break}s.mode=s_e;case s_e:if(n.avail_in===0)return o;o=i,n.avail_in--,n.total_in++,s.need=(n.read_byte(n.next_in_index++)&255)<<24&4278190080,s.mode=a_e;case a_e:if(n.avail_in===0)return o;o=i,n.avail_in--,n.total_in++,s.need+=(n.read_byte(n.next_in_index++)&255)<<16&16711680,s.mode=c_e;case c_e:if(n.avail_in===0)return o;o=i,n.avail_in--,n.total_in++,s.need+=(n.read_byte(n.next_in_index++)&255)<<8&65280,s.mode=l_e;case l_e:return n.avail_in===0?o:(o=i,n.avail_in--,n.total_in++,s.need+=n.read_byte(n.next_in_index++)&255,s.mode=N7,2);case N7:return s.mode=h0,n.msg="need dictionary",s.marker=0,-2;case pF:if(o=s.blocks.proc(n,o),o==-3){s.mode=h0,s.marker=0;break}if(o==0&&(o=i),o!=1)return o;o=i,s.blocks.reset(n,s.was),s.mode=u_e;case u_e:return n.avail_in=0,1;case h0:return-3;default:return-2}},e.inflateSetDictionary=function(n,i,o){let r=0,s=o;if(!n||!n.istate||n.istate.mode!=N7)return-2;let a=n.istate;return s>=1<<a.wbits&&(s=(1<<a.wbits)-1,r=o-s),a.blocks.set_dictionary(i,r,s),a.mode=pF,0},e.inflateSync=function(n){let i,o,r,s,a;if(!n||!n.istate)return-2;let l=n.istate;if(l.mode!=h0&&(l.mode=h0,l.marker=0),(i=n.avail_in)===0)return-5;for(o=n.next_in_index,r=l.marker;i!==0&&r<4;)n.read_byte(o)==bit[r]?r++:n.read_byte(o)!==0?r=0:r=4-r,o++,i--;return n.total_in+=o-n.next_in_index,n.next_in_index=o,n.avail_in=i,l.marker=r,r!=4?-3:(s=n.total_in,a=n.total_out,t(n),n.total_in=s,n.total_out=a,l.mode=pF,0)},e.inflateSyncPoint=function(n){return!n||!n.istate||!n.istate.blocks?-2:n.istate.blocks.sync_point()}}function d_e(){}d_e.prototype={inflateInit(e){let t=this;return t.istate=new xit,e||(e=15),t.istate.inflateInit(t,e)},inflate(e){let t=this;return t.istate?t.istate.inflate(t,e):-2},inflateEnd(){let e=this;if(!e.istate)return-2;let t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync(){let e=this;return e.istate?e.istate.inflateSync(e):-2},inflateSetDictionary(e,t){let n=this;return n.istate?n.istate.inflateSetDictionary(n,e,t):-2},read_byte(e){return this.next_in[e]},read_buf(e,t){return this.next_in.subarray(e,e+t)}};function h_e(e){let t=this,n=new d_e,i=e&&e.chunkSize?Math.floor(e.chunkSize*2):128*1024,o=oit,r=new Uint8Array(i),s=!1;n.inflateInit(),n.next_out=r,t.append=function(a,l){let u=[],f,h,p=0,g=0,m=0;if(a.length!==0){n.next_in_index=0,n.next_in=a,n.avail_in=a.length;do{if(n.next_out_index=0,n.avail_out=i,n.avail_in===0&&!s&&(n.next_in_index=0,s=!0),f=n.inflate(o),s&&f===-5){if(n.avail_in!==0)throw new Error("inflating: bad input")}else if(f!==0&&f!==1)throw new Error("inflating: "+n.msg);if((s||f===1)&&n.avail_in===a.length)throw new Error("inflating: bad input");n.next_out_index&&(n.next_out_index===i?u.push(new Uint8Array(r)):u.push(r.subarray(0,n.next_out_index))),m+=n.next_out_index,l&&n.next_in_index>0&&n.next_in_index!=p&&(l(n.next_in_index),p=n.next_in_index)}while(n.avail_in>0||n.avail_out===0);return u.length>1?(h=new Uint8Array(m),u.forEach(function(y){h.set(y,g),g+=y.length})):h=u[0]?new Uint8Array(u[0]):new Uint8Array,h}},t.flush=function(){n.inflateEnd()}}var NS="/",B7=new Date(2107,11,31),k7=new Date(1980,0,1),Pi=void 0,Yu="undefined",ig="function";var _F=class{constructor(t){return class extends null{constructor(n,i){let o=new t(i);super({transform(r,s){s.enqueue(o.append(r))},flush(r){let s=o.flush();s&&r.enqueue(s)}})}}}};var Tit=64,m_e=2;try{typeof navigator!=Yu&&navigator.hardwareConcurrency&&(m_e=navigator.hardwareConcurrency)}catch{}var Ait={chunkSize:512*1024,maxWorkers:m_e,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:Pi,CompressionStreamNative:typeof CompressionStream!=Yu&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=Yu&&DecompressionStream},p0=Object.assign({},Ait);function gF(){return p0}function q4(e){return Math.max(e.chunkSize,Tit)}function FS(e){let{baseURL:t,chunkSize:n,maxWorkers:i,terminateWorkerTimeout:o,useCompressionStream:r,useWebWorkers:s,Deflate:a,Inflate:l,CompressionStream:u,DecompressionStream:f,workerScripts:h}=e;if(m0("baseURL",t),m0("chunkSize",n),m0("maxWorkers",i),m0("terminateWorkerTimeout",o),m0("useCompressionStream",r),m0("useWebWorkers",s),a&&(p0.CompressionStream=new _F(a)),l&&(p0.DecompressionStream=new _F(l)),m0("CompressionStream",u),m0("DecompressionStream",f),h!==Pi){let{deflate:p,inflate:g}=h;if((p||g)&&(p0.workerScripts||(p0.workerScripts={})),p){if(!Array.isArray(p))throw new Error("workerScripts.deflate must be an array");p0.workerScripts.deflate=p}if(g){if(!Array.isArray(g))throw new Error("workerScripts.inflate must be an array");p0.workerScripts.inflate=g}}}function m0(e,t){t!==Pi&&(p0[e]=t)}var p_e=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=t>>>1^3988292384:t=t>>>1;p_e[e]=t}var og=class{constructor(t){this.crc=t||-1}append(t){let n=this.crc|0;for(let i=0,o=t.length|0;i<o;i++)n=n>>>8^p_e[(n^t[i])&255];this.crc=n}get(){return~this.crc}};var yF=class extends null{constructor(){let t,n=new og;super({transform(i,o){n.append(i),o.enqueue(i)},flush(){let i=new Uint8Array(4);new DataView(i.buffer).setUint32(0,n.get()),t.value=i}}),t=this}};function BS(e){if(typeof TextEncoder==Yu){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}else return new TextEncoder().encode(e)}var hl={concat(e,t){if(e.length===0||t.length===0)return e.concat(t);let n=e[e.length-1],i=hl.getPartial(n);return i===32?e.concat(t):hl._shiftRight(t,i,n|0,e.slice(0,e.length-1))},bitLength(e){let t=e.length;if(t===0)return 0;let n=e[t-1];return(t-1)*32+hl.getPartial(n)},clamp(e,t){if(e.length*32<t)return e;e=e.slice(0,Math.ceil(t/32));let n=e.length;return t=t&31,n>0&&t&&(e[n-1]=hl.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial(e,t,n){return e===32?t:(n?t|0:t<<32-e)+e*1099511627776},getPartial(e){return Math.round(e/1099511627776)||32},_shiftRight(e,t,n,i){for(i===void 0&&(i=[]);t>=32;t-=32)i.push(n),n=0;if(t===0)return i.concat(e);for(let s=0;s<e.length;s++)i.push(n|e[s]>>>t),n=e[s]<<32-t;let o=e.length?e[e.length-1]:0,r=hl.getPartial(o);return i.push(hl.partial(t+r&31,t+r>32?n:i.pop(),1)),i}},bF={bytes:{fromBits(e){let n=hl.bitLength(e)/8,i=new Uint8Array(n),o;for(let r=0;r<n;r++)r&3||(o=e[r/4]),i[r]=o>>>24,o<<=8;return i},toBits(e){let t=[],n,i=0;for(n=0;n<e.length;n++)i=i<<8|e[n],(n&3)===3&&(t.push(i),i=0);return n&3&&t.push(hl.partial(8*(n&3),i)),t}}},__e={};__e.sha1=class{constructor(e){let t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){let e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){let t=this;typeof e=="string"&&(e=bF.utf8String.toBits(e));let n=t._buffer=hl.concat(t._buffer,e),i=t._length,o=t._length=i+hl.bitLength(e);if(o>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");let r=new Uint32Array(n),s=0;for(let a=t.blockSize+i-(t.blockSize+i&t.blockSize-1);a<=o;a+=t.blockSize)t._block(r.subarray(16*s,16*(s+1))),s+=1;return n.splice(0,16*s),t}finalize(){let e=this,t=e._buffer,n=e._h;t=hl.concat(t,[hl.partial(1,1)]);for(let i=t.length+2;i&15;i++)t.push(0);for(t.push(Math.floor(e._length/4294967296)),t.push(e._length|0);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,i){if(e<=19)return t&n|~t&i;if(e<=39)return t^n^i;if(e<=59)return t&n|t&i|n&i;if(e<=79)return t^n^i}_S(e,t){return t<<e|t>>>32-e}_block(e){let t=this,n=t._h,i=Array(80);for(let u=0;u<16;u++)i[u]=e[u];let o=n[0],r=n[1],s=n[2],a=n[3],l=n[4];for(let u=0;u<=79;u++){u>=16&&(i[u]=t._S(1,i[u-3]^i[u-8]^i[u-14]^i[u-16]));let f=t._S(5,o)+t._f(u,r,s,a)+l+i[u]+t._key[Math.floor(u/20)]|0;l=a,a=s,s=t._S(30,r),r=o,o=f}n[0]=n[0]+o|0,n[1]=n[1]+r|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+l|0}};var U7={};U7.aes=class{constructor(e){let t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();let n=t._tables[0][4],i=t._tables[1],o=e.length,r,s,a,l=1;if(o!==4&&o!==6&&o!==8)throw new Error("invalid aes key size");for(t._key=[s=e.slice(0),a=[]],r=o;r<4*o+28;r++){let u=s[r-1];(r%o===0||o===8&&r%o===4)&&(u=n[u>>>24]<<24^n[u>>16&255]<<16^n[u>>8&255]<<8^n[u&255],r%o===0&&(u=u<<8^u>>>24^l<<24,l=l<<1^(l>>7)*283)),s[r]=s[r-o]^u}for(let u=0;r;u++,r--){let f=s[u&3?r:r-4];r<=4||u<4?a[u]=f:a[u]=i[0][n[f>>>24]]^i[1][n[f>>16&255]]^i[2][n[f>>8&255]]^i[3][n[f&255]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){let e=this._tables[0],t=this._tables[1],n=e[4],i=t[4],o=[],r=[],s,a,l,u;for(let f=0;f<256;f++)r[(o[f]=f<<1^(f>>7)*283)^f]=f;for(let f=s=0;!n[f];f^=a||1,s=r[s]||1){let h=s^s<<1^s<<2^s<<3^s<<4;h=h>>8^h&255^99,n[f]=h,i[h]=f,u=o[l=o[a=o[f]]];let p=u*16843009^l*65537^a*257^f*16843008,g=o[h]*257^h*16843008;for(let m=0;m<4;m++)e[m][f]=g=g<<24^g>>>8,t[m][h]=p=p<<24^p>>>8}for(let f=0;f<5;f++)e[f]=e[f].slice(0),t[f]=t[f].slice(0)}_crypt(e,t){if(e.length!==4)throw new Error("invalid aes block size");let n=this._key[t],i=n.length/4-2,o=[0,0,0,0],r=this._tables[t],s=r[0],a=r[1],l=r[2],u=r[3],f=r[4],h=e[0]^n[0],p=e[t?3:1]^n[1],g=e[2]^n[2],m=e[t?1:3]^n[3],y=4,b,x,A;for(let C=0;C<i;C++)b=s[h>>>24]^a[p>>16&255]^l[g>>8&255]^u[m&255]^n[y],x=s[p>>>24]^a[g>>16&255]^l[m>>8&255]^u[h&255]^n[y+1],A=s[g>>>24]^a[m>>16&255]^l[h>>8&255]^u[p&255]^n[y+2],m=s[m>>>24]^a[h>>16&255]^l[p>>8&255]^u[g&255]^n[y+3],y+=4,h=b,p=x,g=A;for(let C=0;C<4;C++)o[t?3&-C:C]=f[h>>>24]<<24^f[p>>16&255]<<16^f[g>>8&255]<<8^f[m&255]^n[y++],b=h,h=p,p=g,g=m,m=b;return o}};var g_e={getRandomValues(e){let t=new Uint32Array(e.buffer),n=i=>{let o=987654321,r=4294967295;return function(){return o=36969*(o&65535)+(o>>16)&r,i=18e3*(i&65535)+(i>>16)&r,(((o<<16)+i&r)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let i=0,o;i<e.length;i+=4){let r=n((o||Math.random())*4294967296);o=r()*987654071,t[i/4]=r()*4294967296|0}return e}},V7={};V7.ctrGladman=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if((e>>24&255)===255){let t=e>>16&255,n=e>>8&255,i=e&255;t===255?(t=0,n===255?(n=0,i===255?i=0:++i):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=i}else e+=1<<24;return e}incCounter(e){(e[0]=this.incWord(e[0]))===0&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let i;if(!(i=t.length))return[];let o=hl.bitLength(t);for(let r=0;r<i;r+=4){this.incCounter(n);let s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return hl.clamp(t,o)}};var _0={importKey(e){return new _0.hmacSha1(bF.bytes.toBits(e))},pbkdf2(e,t,n,i){if(n=n||1e4,i<0||n<0)throw new Error("invalid params to pbkdf2");let o=(i>>5)+1<<2,r,s,a,l,u,f=new ArrayBuffer(o),h=new DataView(f),p=0,g=hl;for(t=bF.bytes.toBits(t),u=1;p<(o||1);u++){for(r=s=e.encrypt(g.concat(t,[u])),a=1;a<n;a++)for(s=e.encrypt(s),l=0;l<s.length;l++)r[l]^=s[l];for(a=0;p<(o||1)&&a<r.length;a++)h.setInt32(p,r[a]),p+=4}return f.slice(0,i/8)}};_0.hmacSha1=class{constructor(e){let t=this,n=t._hash=__e.sha1,i=[[],[]];t._baseHash=[new n,new n];let o=t._baseHash[0].blockSize/32;e.length>o&&(e=new n().update(e).finalize());for(let r=0;r<o;r++)i[0][r]=e[r]^909522486,i[1][r]=e[r]^1549556828;t._baseHash[0].update(i[0]),t._baseHash[1].update(i[1]),t._resultHash=new n(t._baseHash[0])}reset(){let e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){let t=this;t._updated=!0,t._resultHash.update(e)}digest(){let e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}};var Cit=typeof crypto!=Yu&&typeof crypto.getRandomValues==ig,g0="Invalid password",ST="Invalid signature",rg="zipjs-abort-check-password";function Y4(e){return Cit?crypto.getRandomValues(e):g_e.getRandomValues(e)}var kS=16,Eit="raw",x_e={name:"PBKDF2"},Sit={name:"HMAC"},wit="SHA-1",vit=Object.assign({hash:Sit},x_e),z7=Object.assign({iterations:1e3,hash:{name:wit}},x_e),Dit=["deriveBits"],TF=[8,12,16],xF=[16,24,32],y0=10,Pit=[0,0,0,0],$4=typeof crypto!=Yu,EF=$4&&crypto.subtle,T_e=$4&&typeof EF!=Yu,jm=bF.bytes,Iit=U7.aes,Oit=V7.ctrGladman,Rit=_0.hmacSha1,y_e=$4&&T_e&&typeof EF.importKey==ig,b_e=$4&&T_e&&typeof EF.deriveBits==ig,X4=class extends null{constructor({password:t,rawPassword:n,signed:i,encryptionStrength:o,checkPasswordOnly:r}){super({start(){Object.assign(this,{ready:new Promise(s=>this.resolveReady=s),password:E_e(t,n),signed:i,strength:o-1,pending:new Uint8Array})},async transform(s,a){let l=this,{password:u,strength:f,resolveReady:h,ready:p}=l;u?(await Mit(l,f,u,ud(s,0,TF[f]+2)),s=ud(s,TF[f]+2),r?a.error(new Error(rg)):h()):await p;let g=new Uint8Array(s.length-y0-(s.length-y0)%kS);a.enqueue(A_e(l,s,g,0,y0,!0))},async flush(s){let{signed:a,ctr:l,hmac:u,pending:f,ready:h}=this;if(u&&l){await h;let p=ud(f,0,f.length-y0),g=ud(f,f.length-y0),m=new Uint8Array;if(p.length){let y=CF(jm,p);u.update(y);let b=l.update(y);m=AF(jm,b)}if(a){let y=ud(AF(jm,u.digest()),0,y0);for(let b=0;b<y0;b++)if(y[b]!=g[b])throw new Error(ST)}s.enqueue(m)}}})}},K4=class extends null{constructor({password:t,rawPassword:n,encryptionStrength:i}){let o;super({start(){Object.assign(this,{ready:new Promise(r=>this.resolveReady=r),password:E_e(t,n),strength:i-1,pending:new Uint8Array})},async transform(r,s){let a=this,{password:l,strength:u,resolveReady:f,ready:h}=a,p=new Uint8Array;l?(p=await Lit(a,u,l),f()):await h;let g=new Uint8Array(p.length+r.length-r.length%kS);g.set(p,0),s.enqueue(A_e(a,r,g,p.length,0))},async flush(r){let{ctr:s,hmac:a,pending:l,ready:u}=this;if(a&&s){await u;let f=new Uint8Array;if(l.length){let h=s.update(CF(jm,l));a.update(h),f=AF(jm,h)}o.signature=AF(jm,a.digest()).slice(0,y0),r.enqueue(H7(f,o.signature))}}}),o=this}};function A_e(e,t,n,i,o,r){let{ctr:s,hmac:a,pending:l}=e,u=t.length-o;l.length&&(t=H7(l,t),n=Bit(n,u-u%kS));let f;for(f=0;f<=u-kS;f+=kS){let h=CF(jm,ud(t,f,f+kS));r&&a.update(h);let p=s.update(h);r||a.update(p),n.set(AF(jm,p),f+i)}return e.pending=ud(t,f),n}async function Mit(e,t,n,i){let o=await C_e(e,t,n,ud(i,0,TF[t])),r=ud(i,TF[t]);if(o[0]!=r[0]||o[1]!=r[1])throw new Error(g0)}async function Lit(e,t,n){let i=Y4(new Uint8Array(TF[t])),o=await C_e(e,t,n,i);return H7(i,o)}async function C_e(e,t,n,i){e.password=null;let o=await Nit(Eit,n,vit,!1,Dit),r=await Fit(Object.assign({salt:i},z7),o,8*(xF[t]*2+2)),s=new Uint8Array(r),a=CF(jm,ud(s,0,xF[t])),l=CF(jm,ud(s,xF[t],xF[t]*2)),u=ud(s,xF[t]*2);return Object.assign(e,{keys:{key:a,authentication:l,passwordVerification:u},ctr:new Oit(new Iit(a),Array.from(Pit)),hmac:new Rit(l)}),u}async function Nit(e,t,n,i,o){if(y_e)try{return await EF.importKey(e,t,n,i,o)}catch{return y_e=!1,_0.importKey(t)}else return _0.importKey(t)}async function Fit(e,t,n){if(b_e)try{return await EF.deriveBits(e,t,n)}catch{return b_e=!1,_0.pbkdf2(t,e.salt,z7.iterations,n)}else return _0.pbkdf2(t,e.salt,z7.iterations,n)}function E_e(e,t){return t===Pi?BS(e):t}function H7(e,t){let n=e;return e.length+t.length&&(n=new Uint8Array(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function Bit(e,t){if(t&&t>e.length){let n=e;e=new Uint8Array(t),e.set(n,0)}return e}function ud(e,t,n){return e.subarray(t,n)}function AF(e,t){return e.fromBits(t)}function CF(e,t){return e.toBits(t)}var US=12,Z4=class extends null{constructor({password:t,passwordVerification:n,checkPasswordOnly:i}){super({start(){Object.assign(this,{password:t,passwordVerification:n}),D_e(this,t)},transform(o,r){let s=this;if(s.password){let a=S_e(s,o.subarray(0,US));if(s.password=null,a[US-1]!=s.passwordVerification)throw new Error(g0);o=o.subarray(US)}i?r.error(new Error(rg)):r.enqueue(S_e(s,o))}})}},Q4=class extends null{constructor({password:t,passwordVerification:n}){super({start(){Object.assign(this,{password:t,passwordVerification:n}),D_e(this,t)},transform(i,o){let r=this,s,a;if(r.password){r.password=null;let l=Y4(new Uint8Array(US));l[US-1]=r.passwordVerification,s=new Uint8Array(i.length+l.length),s.set(w_e(r,l),0),a=US}else s=new Uint8Array(i.length),a=0;s.set(w_e(r,i),a),o.enqueue(s)}})}};function S_e(e,t){let n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=P_e(e)^t[i],G7(e,n[i]);return n}function w_e(e,t){let n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=P_e(e)^t[i],G7(e,t[i]);return n}function D_e(e,t){let n=[305419896,591751049,878082192];Object.assign(e,{keys:n,crcKey0:new og(n[0]),crcKey2:new og(n[2])});for(let i=0;i<t.length;i++)G7(e,t.charCodeAt(i))}function G7(e,t){let[n,i,o]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),i=v_e(Math.imul(v_e(i+I_e(n)),134775813)+1),e.crcKey2.append([i>>>24]),o=~e.crcKey2.get(),e.keys=[n,i,o]}function P_e(e){let t=e.keys[2]|2;return I_e(Math.imul(t,t^1)>>>8)}function I_e(e){return e&255}function v_e(e){return e&4294967295}var O_e="deflate-raw",J4=class extends null{constructor(t,{chunkSize:n,CompressionStream:i,CompressionStreamNative:o}){super({});let{compressed:r,encrypted:s,useCompressionStream:a,zipCrypto:l,signed:u,level:f}=t,h=this,p,g,m=R_e(super.readable);(!s||l)&&u&&(p=new yF,m=Wm(m,p)),r&&(m=L_e(m,a,{level:f,chunkSize:n},o,i)),s&&(l?m=Wm(m,new Q4(t)):(g=new K4(t),m=Wm(m,g))),M_e(h,m,()=>{let y;s&&!l&&(y=g.signature),(!s||l)&&u&&(y=new DataView(p.value.buffer).getUint32(0)),h.signature=y})}},e8=class extends null{constructor(t,{chunkSize:n,DecompressionStream:i,DecompressionStreamNative:o}){super({});let{zipCrypto:r,encrypted:s,signed:a,signature:l,compressed:u,useCompressionStream:f}=t,h,p,g=R_e(super.readable);s&&(r?g=Wm(g,new Z4(t)):(p=new X4(t),g=Wm(g,p))),u&&(g=L_e(g,f,{chunkSize:n},o,i)),(!s||r)&&a&&(h=new yF,g=Wm(g,h)),M_e(this,g,()=>{if((!s||r)&&a){let m=new DataView(h.value.buffer);if(l!=m.getUint32(0,!1))throw new Error(ST)}})}};function R_e(e){return Wm(e,new null({transform(t,n){t&&t.length&&n.enqueue(t)}}))}function M_e(e,t,n){t=Wm(t,new null({flush:n})),Object.defineProperty(e,"readable",{get(){return t}})}function L_e(e,t,n,i,o){try{let r=t&&i?i:o;e=Wm(e,new r(O_e,n))}catch{if(t)try{e=Wm(e,new o(O_e,n))}catch{return e}else return e}return e}function Wm(e,t){return e.pipeThrough(t)}var N_e="message",F_e="start",B_e="pull",j7="data",k_e="ack",W7="close",i8="deflate",o8="inflate";var t8=class extends null{constructor(t,n){super({});let i=this,{codecType:o}=t,r;o.startsWith(i8)?r=J4:o.startsWith(o8)&&(r=e8);let s=0,a=0,l=new r(t,n),u=super.readable,f=new null({transform(p,g){p&&p.length&&(a+=p.length,g.enqueue(p))},flush(){Object.assign(i,{inputSize:a})}}),h=new null({transform(p,g){p&&p.length&&(s+=p.length,g.enqueue(p))},flush(){let{signature:p}=l;Object.assign(i,{signature:p,outputSize:s,inputSize:a})}});Object.defineProperty(i,"readable",{get(){return u.pipeThrough(f).pipeThrough(l).pipeThrough(h)}})}},n8=class extends null{constructor(t){let n;super({transform:i,flush(o){n&&n.length&&o.enqueue(n)}});function i(o,r){if(n){let s=new Uint8Array(n.length+o.length);s.set(n),s.set(o,n.length),o=s,n=null}o.length>t?(r.enqueue(o.slice(0,t)),i(o.slice(t),r)):n=o}}};var z_e=typeof Worker!=Yu;var VS=class{constructor(t,{readable:n,writable:i},{options:o,config:r,streamOptions:s,useWebWorkers:a,transferStreams:l,scripts:u},f){let{signal:h}=s;return Object.assign(t,{busy:!0,readable:n.pipeThrough(new n8(r.chunkSize)).pipeThrough(new Y7(n,s),{signal:h}),writable:i,options:Object.assign({},o),scripts:u,transferStreams:l,terminate(){return new Promise(p=>{let{worker:g,busy:m}=t;g?(m?t.resolveTerminated=p:(g.terminate(),p()),t.interface=null):p()})},onTaskFinished(){let{resolveTerminated:p}=t;p&&(t.resolveTerminated=null,t.terminated=!0,t.worker.terminate(),p()),t.busy=!1,f(t)}}),(a&&z_e?kit:H_e)(t,r)}},Y7=class extends null{constructor(t,{onstart:n,onprogress:i,size:o,onend:r}){let s=0;super({async start(){n&&await q7(n,o)},async transform(a,l){s+=a.length,i&&await q7(i,s,o),l.enqueue(a)},async flush(){t.size=s,r&&await q7(r,s)}})}};async function q7(e,...t){try{await e(...t)}catch{}}function H_e(e,t){return{run:()=>Uit(e,t)}}function kit(e,t){let{baseURL:n,chunkSize:i}=t;if(!e.interface){let o;try{o=Hit(e.scripts[0],n,e)}catch{return z_e=!1,H_e(e,t)}Object.assign(e,{worker:o,interface:{run:()=>Vit(e,{chunkSize:i})}})}return e.interface}async function Uit({options:e,readable:t,writable:n,onTaskFinished:i},o){try{let r=new t8(e,o);await t.pipeThrough(r).pipeTo(n,{preventClose:!0,preventAbort:!0});let{signature:s,inputSize:a,outputSize:l}=r;return{signature:s,inputSize:a,outputSize:l}}finally{i()}}async function Vit(e,t){let n,i,o=new Promise((p,g)=>{n=p,i=g});Object.assign(e,{reader:null,writer:null,resolveResult:n,rejectResult:i,result:o});let{readable:r,options:s,scripts:a}=e,{writable:l,closed:u}=zit(e.writable),f=r8({type:F_e,scripts:a.slice(1),options:s,config:t,readable:r,writable:l},e);f||Object.assign(e,{reader:r.getReader(),writer:l.getWriter()});let h=await o;return f||await l.getWriter().close(),await u,h}function zit(e){let t,n=new Promise(o=>t=o);return{writable:new WritableStream({async write(o){let r=e.getWriter();await r.ready,await r.write(o),r.releaseLock()},close(){t()},abort(o){return e.getWriter().abort(o)}}),closed:n}}var U_e=!0,V_e=!0;function Hit(e,t,n){let i={type:"module"},o,r;typeof e==ig&&(e=e());try{o=new URL(e,t)}catch{o=e}if(U_e)try{r=new Worker(o)}catch{U_e=!1,r=new Worker(o,i)}else r=new Worker(o,i);return r.addEventListener(N_e,s=>Git(s,n)),r}function r8(e,{worker:t,writer:n,onTaskFinished:i,transferStreams:o}){try{let{value:r,readable:s,writable:a}=e,l=[];if(r&&(r.byteLength<r.buffer.byteLength?e.value=r.buffer.slice(0,r.byteLength):e.value=r.buffer,l.push(e.value)),o&&V_e?(s&&l.push(s),a&&l.push(a)):e.readable=e.writable=null,l.length)try{return t.postMessage(e,l),!0}catch{V_e=!1,e.readable=e.writable=null,t.postMessage(e)}else t.postMessage(e)}catch(r){throw n&&n.releaseLock(),i(),r}}async function Git({data:e},t){let{type:n,value:i,messageId:o,result:r,error:s}=e,{reader:a,writer:l,resolveResult:u,rejectResult:f,onTaskFinished:h}=t;try{if(s){let{message:g,stack:m,code:y,name:b}=s,x=new Error(g);Object.assign(x,{stack:m,code:y,name:b}),p(x)}else{if(n==B_e){let{value:g,done:m}=await a.read();r8({type:j7,value:g,done:m,messageId:o},t)}n==j7&&(await l.ready,await l.write(new Uint8Array(i)),r8({type:k_e,messageId:o},t)),n==W7&&p(null,r)}}catch(g){r8({type:W7,messageId:o},t),p(g)}function p(g,m){g?f(g):u(m),l&&l.releaseLock(),h()}}var wT=[],X7=[];var G_e=0;async function s8(e,t){let{options:n,config:i}=t,{transferStreams:o,useWebWorkers:r,useCompressionStream:s,codecType:a,compressed:l,signed:u,encrypted:f}=n,{workerScripts:h,maxWorkers:p}=i;t.transferStreams=o||o===Pi;let g=!l&&!u&&!f&&!t.transferStreams;return t.useWebWorkers=!g&&(r||r===Pi&&i.useWebWorkers),t.scripts=t.useWebWorkers&&h?h[a]:[],n.useCompressionStream=s||s===Pi&&i.useCompressionStream,(await m()).run();async function m(){let b=wT.find(x=>!x.busy);if(b)return j_e(b),new VS(b,e,t,y);if(wT.length<p){let x={indexWorker:G_e};return G_e++,wT.push(x),new VS(x,e,t,y)}else return new Promise(x=>X7.push({resolve:x,stream:e,workerOptions:t}))}function y(b){if(X7.length){let[{resolve:x,stream:A,workerOptions:C}]=X7.splice(0,1);x(new VS(b,A,C,y))}else b.worker?(j_e(b),jit(b,t)):wT=wT.filter(x=>x!=b)}}function jit(e,t){let{config:n}=t,{terminateWorkerTimeout:i}=n;Number.isFinite(i)&&i>=0&&(e.terminated?e.terminated=!1:e.terminateTimeout=setTimeout(async()=>{wT=wT.filter(o=>o!=e);try{await e.terminate()}catch{}},i))}function j_e(e){let{terminateTimeout:t}=e;t&&(clearTimeout(t),e.terminateTimeout=null)}var Wit="Writer iterator completed too soon",qit="text/plain";var Yit="Content-Type";var Xit=64*1024,Z7="writable",zS=class{constructor(){this.size=0}init(){this.initialized=!0}},a8=class extends zS{get readable(){let t=this,{chunkSize:n=Xit}=t,i=new ReadableStream({start(){this.chunkOffset=0},async pull(o){let{offset:r=0,size:s,diskNumberStart:a}=i,{chunkOffset:l}=this;o.enqueue(await Ga(t,r+l,Math.min(n,s-l),a)),l+n>s?o.close():this.chunkOffset+=n}});return i}},K7=class extends zS{constructor(){super();let t=this,n=new WritableStream({write(i){return t.writeUint8Array(i)}});Object.defineProperty(t,Z7,{get(){return n}})}writeUint8Array(){}};var c8=class extends K7{constructor(t){super(),Object.assign(this,{data:"data:"+(t||"")+";base64,",pending:[]})}writeUint8Array(t){let n=this,i=0,o=n.pending,r=n.pending.length;for(n.pending="",i=0;i<Math.floor((r+t.length)/3)*3-r;i++)o+=String.fromCharCode(t[i]);for(;i<t.length;i++)n.pending+=String.fromCharCode(t[i]);o.length>2?n.data+=btoa(o):n.pending=o}getData(){return this.data+btoa(this.pending)}},sg=class extends a8{constructor(t){super(),Object.assign(this,{blob:t,size:t.size})}async readUint8Array(t,n){let i=this,o=t+n,s=await(t||o<i.size?i.blob.slice(t,o):i.blob).arrayBuffer();return s.byteLength>n&&(s=s.slice(t,o)),new Uint8Array(s)}},SF=class extends zS{constructor(t){super();let n=this,i=new null,o=[];t&&o.push([Yit,t]),Object.defineProperty(n,Z7,{get(){return i.writable}}),n.blob=new Response(i.readable,{headers:o}).blob()}getData(){return this.blob}},l8=class extends sg{constructor(t){super(new Blob([t],{type:qit}))}},u8=class extends SF{constructor(t){super(t),Object.assign(this,{encoding:t,utf8:!t||t.toLowerCase()=="utf-8"})}async getData(){let{encoding:t,utf8:n}=this,i=await super.getData();if(i.text&&n)return i.text();{let o=new FileReader;return new Promise((r,s)=>{Object.assign(o,{onload:({target:a})=>r(a.result),onerror:()=>s(o.error)}),o.readAsText(i,t)})}}};var $7=class extends a8{constructor(t){super(),this.readers=t}async init(){let t=this,{readers:n}=t;t.lastDiskNumber=0,t.lastDiskOffset=0,await Promise.all(n.map(async(i,o)=>{await i.init(),o!=n.length-1&&(t.lastDiskOffset+=i.size),t.size+=i.size})),super.init()}async readUint8Array(t,n,i=0){let o=this,{readers:r}=this,s,a=i;a==-1&&(a=r.length-1);let l=t;for(;l>=r[a].size;)l-=r[a].size,a++;let u=r[a],f=u.size;if(l+n<=f)s=await Ga(u,l,n);else{let h=f-l;s=new Uint8Array(n),s.set(await Ga(u,l,h)),s.set(await o.readUint8Array(t+h,n-h,i),h)}return o.lastDiskNumber=Math.max(a,o.lastDiskNumber),s}},f8=class extends zS{constructor(t,n=4294967295){super();let i=this;Object.assign(i,{diskNumber:0,diskOffset:0,size:0,maxSize:n,availableSize:n});let o,r,s,a=new WritableStream({async write(f){let{availableSize:h}=i;if(s)f.length>=h?(await l(f.slice(0,h)),await u(),i.diskOffset+=o.size,i.diskNumber++,s=null,await this.write(f.slice(h))):await l(f);else{let{value:p,done:g}=await t.next();if(g&&!p)throw new Error(Wit);o=p,o.size=0,o.maxSize&&(i.maxSize=o.maxSize),i.availableSize=i.maxSize,await Ym(o),r=p.writable,s=r.getWriter(),await this.write(f)}},async close(){await s.ready,await u()}});Object.defineProperty(i,Z7,{get(){return a}});async function l(f){let h=f.length;h&&(await s.ready,await s.write(f),o.size+=h,i.size+=h,i.availableSize-=h)}async function u(){r.size=o.size,await s.close()}}};async function Ym(e,t){if(e.init&&!e.initialized)await e.init(t);else return Promise.resolve()}function d8(e){return Array.isArray(e)&&(e=new $7(e)),e instanceof ReadableStream&&(e={readable:e}),e}function h8(e){e.writable===Pi&&typeof e.next==ig&&(e=new f8(e)),e instanceof WritableStream&&(e={writable:e});let{writable:t}=e;return t.size===Pi&&(t.size=0),e instanceof f8||Object.assign(e,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),e}function Ga(e,t,n,i){return e.readUint8Array(t,n,i)}var W_e="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ".split(""),Kit=W_e.length==256;function q_e(e){if(Kit){let t="";for(let n=0;n<e.length;n++)t+=W_e[e[n]];return t}else return new TextDecoder().decode(e)}function wF(e,t){return t&&t.trim().toLowerCase()=="cp437"?q_e(e):new TextDecoder(t).decode(e)}var Q7="filename",J7="rawFilename",eY="comment",tY="rawComment",nY="uncompressedSize",iY="compressedSize",oY="offset",m8="diskNumberStart",HS="lastModDate",p8="rawLastModDate",vF="lastAccessDate",Y_e="rawLastAccessDate",DF="creationDate",X_e="rawCreationDate",rY="internalFileAttribute",sY="externalFileAttribute",aY="msDosCompatible",_8="zip64",cY="encrypted",lY="version",uY="versionMadeBy",fY="zipCrypto",$it=[Q7,J7,iY,nY,HS,p8,eY,tY,vF,DF,oY,m8,m8,rY,sY,aY,_8,cY,lY,uY,fY,"directory","bitFlag","signature","filenameUTF8","commentUTF8","compressionMethod","extraField","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"],b0=class{constructor(t){$it.forEach(n=>this[n]=t[n])}};var dY="File format is not recognized",eot="End of central directory not found",tot="End of Zip64 central directory locator not found",not="Central directory header not found",iot="Local file header not found",oot="Zip64 extra field not found",rot="File contains encrypted entry",sot="Encryption method not supported",K_e="Compression method not supported",$_e="Split zip file",Z_e="utf-8",Q_e="cp437",aot=[[nY,4294967295],[iY,4294967295],[oY,4294967295],[m8,65535]],cot={[65535]:{getValue:Ts,bytes:4},[4294967295]:{getValue:g8,bytes:8}},E8=class{constructor(t,n={}){Object.assign(this,{reader:d8(t),options:n,config:gF()})}async*getEntriesGenerator(t={}){let n=this,{reader:i}=n,{config:o}=n;if(await Ym(i),(i.size===Pi||!i.readUint8Array)&&(i=new sg(await new Response(i.readable).blob()),await Ym(i)),i.size<22)throw new Error(dY);i.chunkSize=q4(o);let r=await hot(i,101010256,i.size,22,65535*16);if(!r){let F=await Ga(i,0,4),_=Ea(F);throw Ts(_)==134695760?new Error($_e):new Error(eot)}let s=Ea(r),a=Ts(s,12),l=Ts(s,16),u=r.offset,f=Ca(s,20),h=u+22+f,p=Ca(s,4),g=i.lastDiskNumber||0,m=Ca(s,6),y=Ca(s,8),b=0,x=0;if(l==4294967295||a==4294967295||y==65535||m==65535){let F=await Ga(i,r.offset-20,20),_=Ea(F);if(Ts(_,0)==117853008){l=g8(_,8);let w=await Ga(i,l,56,-1),D=Ea(w),I=r.offset-20-56;if(Ts(D,0)!=101075792&&l!=I){let N=l;l=I,b=l-N,w=await Ga(i,l,56,-1),D=Ea(w)}if(Ts(D,0)!=101075792)throw new Error(tot);p==65535&&(p=Ts(D,16)),m==65535&&(m=Ts(D,20)),y==65535&&(y=g8(D,32)),a==4294967295&&(a=g8(D,40)),l-=a}}if(l>=i.size&&(b=i.size-l-a-22,l=i.size-a-22),g!=p)throw new Error($_e);if(l<0)throw new Error(dY);let A=0,C=await Ga(i,l,a,m),S=Ea(C);if(a){let F=r.offset-a;if(Ts(S,A)!=33639248&&l!=F){let _=l;l=F,b+=l-_,C=await Ga(i,l,a,m),S=Ea(C)}}let v=r.offset-l-(i.lastDiskOffset||0);if(a!=v&&v>=0&&(a=v,C=await Ga(i,l,a,m),S=Ea(C)),l<0||l>=i.size)throw new Error(dY);let P=ml(n,t,"filenameEncoding"),M=ml(n,t,"commentEncoding");for(let F=0;F<y;F++){let _=new mY(i,o,n.options);if(Ts(S,A)!=33639248)throw new Error(not);ege(_,S,A+6);let w=!!_.bitFlag.languageEncodingFlag,D=A+46,I=D+_.filenameLength,N=I+_.extraFieldLength,k=Ca(S,A+4),z=(k&0)==0,V=C.subarray(D,I),j=Ca(S,A+32),U=N+j,q=C.subarray(N,U),Y=w,te=w,K=z&&(GS(S,A+38)&16)==16,Z=Ts(S,A+42)+b;Object.assign(_,{versionMadeBy:k,msDosCompatible:z,compressedSize:0,uncompressedSize:0,commentLength:j,directory:K,offset:Z,diskNumberStart:Ca(S,A+34),internalFileAttribute:Ca(S,A+36),externalFileAttribute:Ts(S,A+38),rawFilename:V,filenameUTF8:Y,commentUTF8:te,rawExtraField:C.subarray(I,N)});let ee=ml(n,t,"decodeText")||wF,me=Y?Z_e:P||Q_e,Te=te?Z_e:M||Q_e,ue=ee(V,me);ue===Pi&&(ue=wF(V,me));let ye=ee(q,Te);ye===Pi&&(ye=wF(q,Te)),Object.assign(_,{rawComment:q,filename:ue,comment:ye,directory:K||ue.endsWith(NS)}),x=Math.max(Z,x),tge(_,_,S,A+6),_.zipCrypto=_.encrypted&&!_.extraFieldAES;let Ae=new b0(_);Ae.getData=(Ee,ze)=>_.getData(Ee,Ae,ze),A=U;let{onprogress:Pe}=t;if(Pe)try{await Pe(F+1,y,new b0(_))}catch{}yield Ae}let R=ml(n,t,"extractPrependedData"),L=ml(n,t,"extractAppendedData");return R&&(n.prependedData=x>0?await Ga(i,0,x):new Uint8Array),n.comment=f?await Ga(i,u+22,f):new Uint8Array,L&&(n.appendedData=h<i.size?await Ga(i,h,i.size-h):new Uint8Array),!0}async getEntries(t={}){let n=[];for await(let i of this.getEntriesGenerator(t))n.push(i);return n}async close(){}};var mY=class{constructor(t,n,i){Object.assign(this,{reader:t,config:n,options:i})}async getData(t,n,i={}){let o=this,{reader:r,offset:s,diskNumberStart:a,extraFieldAES:l,compressionMethod:u,config:f,bitFlag:h,signature:p,rawLastModDate:g,uncompressedSize:m,compressedSize:y}=o,b=n.localDirectory={},x=await Ga(r,s,30,a),A=Ea(x),C=ml(o,i,"password"),S=ml(o,i,"rawPassword"),v=ml(o,i,"passThrough");if(C=C&&C.length&&C,S=S&&S.length&&S,l&&l.originalCompressionMethod!=99)throw new Error(K_e);if(u!=0&&u!=8&&!v)throw new Error(K_e);if(Ts(A,0)!=67324752)throw new Error(iot);ege(b,A,4),b.rawExtraField=b.extraFieldLength?await Ga(r,s+30+b.filenameLength,b.extraFieldLength,a):new Uint8Array,tge(o,b,A,4,!0),Object.assign(n,{lastAccessDate:b.lastAccessDate,creationDate:b.creationDate});let P=o.encrypted&&b.encrypted&&!v,M=P&&!l;if(v||(n.zipCrypto=M),P){if(!M&&l.strength===Pi)throw new Error(sot);if(!C&&!S)throw new Error(rot)}let R=s+30+b.filenameLength+b.extraFieldLength,L=y,F=r.readable;Object.assign(F,{diskNumberStart:a,offset:R,size:L});let _=ml(o,i,"signal"),w=ml(o,i,"checkPasswordOnly");w&&(t=new WritableStream),t=h8(t),await Ym(t,v?y:m);let{writable:D}=t,{onstart:I,onprogress:N,onend:k}=i,z={options:{codecType:o8,password:C,rawPassword:S,zipCrypto:M,encryptionStrength:l&&l.strength,signed:ml(o,i,"checkSignature")&&!v,passwordVerification:M&&(h.dataDescriptor?g>>>8&255:p>>>24&255),signature:p,compressed:u!=0&&!v,encrypted:o.encrypted&&!v,useWebWorkers:ml(o,i,"useWebWorkers"),useCompressionStream:ml(o,i,"useCompressionStream"),transferStreams:ml(o,i,"transferStreams"),checkPasswordOnly:w},config:f,streamOptions:{signal:_,size:L,onstart:I,onprogress:N,onend:k}},V=0;try{({outputSize:V}=await s8({readable:F,writable:D},z))}catch(j){if(!w||j.message!=rg)throw j}finally{let j=ml(o,i,"preventClose");D.size+=V,!j&&!D.locked&&await D.getWriter().close()}return w?Pi:t.getData?t.getData():D}};function ege(e,t,n){let i=e.rawBitFlag=Ca(t,n+2),o=(i&1)==1,r=Ts(t,n+6);Object.assign(e,{encrypted:o,version:Ca(t,n),bitFlag:{level:(i&6)>>1,dataDescriptor:(i&8)==8,languageEncodingFlag:(i&2048)==2048},rawLastModDate:r,lastModDate:mot(r),filenameLength:Ca(t,n+22),extraFieldLength:Ca(t,n+24)})}function tge(e,t,n,i,o){let{rawExtraField:r}=t,s=t.extraField=new Map,a=Ea(new Uint8Array(r)),l=0;try{for(;l<r.length;){let x=Ca(a,l),A=Ca(a,l+2);s.set(x,{type:x,data:r.slice(l+4,l+4+A)}),l+=4+A}}catch{}let u=Ca(n,i+4);Object.assign(t,{signature:Ts(n,i+10),uncompressedSize:Ts(n,i+18),compressedSize:Ts(n,i+14)});let f=s.get(1);f&&(lot(f,t),t.extraFieldZip64=f);let h=s.get(28789);h&&(J_e(h,Q7,J7,t,e),t.extraFieldUnicodePath=h);let p=s.get(25461);p&&(J_e(p,eY,tY,t,e),t.extraFieldUnicodeComment=p);let g=s.get(39169);g?(uot(g,t,u),t.extraFieldAES=g):t.compressionMethod=u;let m=s.get(10);m&&(fot(m,t),t.extraFieldNTFS=m);let y=s.get(21589);y&&(dot(y,t,o),t.extraFieldExtendedTimestamp=y);let b=s.get(6534);b&&(t.extraFieldUSDZ=b)}function lot(e,t){t.zip64=!0;let n=Ea(e.data),i=aot.filter(([o,r])=>t[o]==r);for(let o=0,r=0;o<i.length;o++){let[s,a]=i[o];if(t[s]==a){let l=cot[a];t[s]=e[s]=l.getValue(n,r),r+=l.bytes}else if(e[s])throw new Error(oot)}}function J_e(e,t,n,i,o){let r=Ea(e.data),s=new og;s.append(o[n]);let a=Ea(new Uint8Array(4));a.setUint32(0,s.get(),!0);let l=Ts(r,1);Object.assign(e,{version:GS(r,0),[t]:wF(e.data.subarray(5)),valid:!o.bitFlag.languageEncodingFlag&&l==Ts(a,0)}),e.valid&&(i[t]=e[t],i[t+"UTF8"]=!0)}function uot(e,t,n){let i=Ea(e.data),o=GS(i,4);Object.assign(e,{vendorVersion:GS(i,0),vendorId:GS(i,2),strength:o,originalCompressionMethod:n,compressionMethod:Ca(i,5)}),t.compressionMethod=e.compressionMethod}function fot(e,t){let n=Ea(e.data),i=4,o;try{for(;i<e.data.length&&!o;){let r=Ca(n,i),s=Ca(n,i+2);r==1&&(o=e.data.slice(i+4,i+4+s)),i+=4+s}}catch{}try{if(o&&o.length==24){let r=Ea(o),s=r.getBigUint64(0,!0),a=r.getBigUint64(8,!0),l=r.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:s,rawLastAccessDate:a,rawCreationDate:l});let u=hY(s),f=hY(a),h=hY(l),p={lastModDate:u,lastAccessDate:f,creationDate:h};Object.assign(e,p),Object.assign(t,p)}}catch{}}function dot(e,t,n){let i=Ea(e.data),o=GS(i,0),r=[],s=[];n?((o&1)==1&&(r.push(HS),s.push(p8)),(o&2)==2&&(r.push(vF),s.push(Y_e)),(o&4)==4&&(r.push(DF),s.push(X_e))):e.data.length>=5&&(r.push(HS),s.push(p8));let a=1;r.forEach((l,u)=>{if(e.data.length>=a+4){let f=Ts(i,a);t[l]=e[l]=new Date(f*1e3);let h=s[u];e[h]=f}a+=4})}async function hot(e,t,n,i,o){let r=new Uint8Array(4),s=Ea(r);pot(s,0,t);let a=i+o;return await l(i)||await l(Math.min(a,n));async function l(u){let f=n-u,h=await Ga(e,f,u);for(let p=h.length-i;p>=0;p--)if(h[p]==r[0]&&h[p+1]==r[1]&&h[p+2]==r[2]&&h[p+3]==r[3])return{offset:f+p,buffer:h.slice(p,p+i).buffer}}}function ml(e,t,n){return t[n]===Pi?e.options[n]:t[n]}function mot(e){let t=(e&4294901760)>>16,n=e&65535;try{return new Date(1980+((t&65024)>>9),((t&480)>>5)-1,t&31,(n&63488)>>11,(n&2016)>>5,(n&31)*2,0)}catch{}}function hY(e){return new Date(Number(e/BigInt(1e4)-BigInt(116444736e5)))}function GS(e,t){return e.getUint8(t)}function Ca(e,t){return e.getUint16(t,!0)}function Ts(e,t){return e.getUint32(t,!0)}function g8(e,t){return Number(e.getBigUint64(t,!0))}function pot(e,t,n){e.setUint32(t,n,!0)}function Ea(e){return new DataView(e.buffer)}var bot="File already exists",xot="Zip file comment exceeds 64KB",Tot="File entry comment exceeds 64KB",Aot="File entry name exceeds 64KB",oge="Version exceeds 65535",Cot="The strength must equal 1, 2, or 3",Eot="Extra field type exceeds 65535",Sot="Extra field data exceeds 64KB",DY="Zip64 is not supported (make sure 'keepOrder' is set to 'true')",wot="Undefined uncompressed size",rge=new Uint8Array([7,0,2,0,65,69,3,0,0]),wY=0,sge=[],v8=class{constructor(t,n={}){t=h8(t);let i=t.availableSize!==Pi&&t.availableSize>0&&t.availableSize!==1/0&&t.maxSize!==Pi&&t.maxSize>0&&t.maxSize!==1/0;Object.assign(this,{writer:t,addSplitZipSignature:i,options:n,config:gF(),files:new Map,filenames:new Set,offset:n.offset===Pi?t.writable.size:n.offset,pendingEntriesSize:0,pendingAddFileCalls:new Set,bufferedWrites:0})}async add(t="",n,i={}){let o=this,{pendingAddFileCalls:r,config:s}=o;wY<s.maxWorkers?wY++:await new Promise(l=>sge.push(l));let a;try{if(t=t.trim(),o.filenames.has(t))throw new Error(bot);return o.filenames.add(t),a=vot(o,t,n,i),r.add(a),await a}catch(l){throw o.filenames.delete(t),l}finally{r.delete(a);let l=sge.shift();l?l():wY--}}async close(t=new Uint8Array,n={}){let i=this,{pendingAddFileCalls:o,writer:r}=this,{writable:s}=r;for(;o.size;)await Promise.allSettled(Array.from(o));return await Fot(this,t,n),po(i,n,"preventClose")||await s.getWriter().close(),r.getData?r.getData():s}};async function vot(e,t,n,i){t=t.trim(),i.directory&&!t.endsWith(NS)?t+=NS:i.directory=t.endsWith(NS);let o=po(e,i,"encodeText",BS),r=o(t);if(r===Pi&&(r=BS(t)),Qi(r)>65535)throw new Error(Aot);let s=i.comment||"",a=o(s);if(a===Pi&&(a=BS(s)),Qi(a)>65535)throw new Error(Tot);let l=po(e,i,lY,20);if(l>65535)throw new Error(oge);let u=po(e,i,uY,20);if(u>65535)throw new Error(oge);let f=po(e,i,HS,new Date),h=po(e,i,vF),p=po(e,i,DF),g=po(e,i,aY,!0),m=po(e,i,rY,0),y=po(e,i,sY,0),b=po(e,i,"passThrough"),x,A;b||(x=po(e,i,"password"),A=po(e,i,"rawPassword"));let C=po(e,i,"encryptionStrength",3),S=po(e,i,fY),v=po(e,i,"extendedTimestamp",!0),P=po(e,i,"keepOrder",!0),M=po(e,i,"level"),R=po(e,i,"useWebWorkers"),L=po(e,i,"bufferedWrite"),F=po(e,i,"dataDescriptorSignature",!1),_=po(e,i,"signal"),w=po(e,i,"useUnicodeFileNames",!0),D=po(e,i,"useCompressionStream"),I=po(e,i,"compressionMethod"),N=po(e,i,"dataDescriptor",!0),k=po(e,i,_8);if(!S&&(x!==Pi||A!==Pi)&&!(C>=1&&C<=3))throw new Error(Cot);let z=new Uint8Array,{extraField:V}=i;if(V){let Dt=0,jt=0;V.forEach($e=>Dt+=4+Qi($e)),z=new Uint8Array(Dt),V.forEach(($e,un)=>{if(un>65535)throw new Error(Eot);if(Qi($e)>65535)throw new Error(Sot);Ms(z,new Uint16Array([un]),jt),Ms(z,new Uint16Array([Qi($e)]),jt+2),Ms(z,$e,jt+4),jt+=4+Qi($e)})}let j=0,U=0,q=0;if(b&&({uncompressedSize:q}=i,q===Pi))throw new Error(wot);let Y=k===!0;n&&(n=d8(n),await Ym(n),b?j=age(q):n.size===Pi?(N=!0,(k||k===Pi)&&(k=!0,q=j=4294967296)):(q=n.size,j=age(q)));let{diskOffset:te,diskNumber:K,maxSize:Z}=e.writer,ee=Y||q>4294967295,me=Y||j>4294967295,Te=Y||e.offset+e.pendingEntriesSize-te>4294967295,ye=po(e,i,"supportZip64SplitFile",!0)&&Y||K+Math.ceil(e.pendingEntriesSize/Z)>65535;if(Te||ee||me||ye){if(k===!1||!P)throw new Error(DY);k=!0}k=k||!1;let Ae=po(e,i,cY),{signature:Pe}=i;i=Object.assign({},i,{rawFilename:r,rawComment:a,version:l,versionMadeBy:u,lastModDate:f,lastAccessDate:h,creationDate:p,rawExtraField:z,zip64:k,zip64UncompressedSize:ee,zip64CompressedSize:me,zip64Offset:Te,zip64DiskNumberStart:ye,password:x,rawPassword:A,level:!D&&e.config.CompressionStream===Pi&&e.config.CompressionStreamNative===Pi?0:M,useWebWorkers:R,encryptionStrength:C,extendedTimestamp:v,zipCrypto:S,bufferedWrite:L,keepOrder:P,useUnicodeFileNames:w,dataDescriptor:N,dataDescriptorSignature:F,signal:_,msDosCompatible:g,internalFileAttribute:m,externalFileAttribute:y,useCompressionStream:D,passThrough:b,encrypted:!!(x&&Qi(x)||A&&Qi(A))||b&&Ae,signature:Pe,compressionMethod:I});let Ee=Iot(i),ze=Rot(i),qe=Qi(Ee.localHeaderArray,ze.dataDescriptorArray);U=qe+j,e.options.usdz&&(U+=U+64),e.pendingEntriesSize+=U;let it;try{it=await Dot(e,t,n,{headerInfo:Ee,dataDescriptorInfo:ze,metadataSize:qe},i)}finally{e.pendingEntriesSize-=U}return Object.assign(it,{name:t,comment:s,extraField:V}),new b0(it)}async function Dot(e,t,n,i,o){let{files:r,writer:s}=e,{keepOrder:a,dataDescriptor:l,signal:u}=o,{headerInfo:f}=i,{usdz:h}=e.options,p=Array.from(r.values()).pop(),g={},m,y,b,x,A,C,S;r.set(t,g);try{let R;a&&(R=p&&p.lock,v()),(o.bufferedWrite||e.writerLocked||e.bufferedWrites&&a||!l)&&!h?(C=new null,S=new Response(C.readable).blob(),C.writable.size=0,m=!0,e.bufferedWrites++,await Ym(s)):(C=s,await P()),await Ym(C);let{writable:L}=s,{diskOffset:F}=s;if(e.addSplitZipSignature){delete e.addSplitZipSignature;let w=new Uint8Array(4),D=ja(w);Zi(D,0,134695760),await Xm(L,w),e.offset+=4}h&&Oot(i,e.offset-F),m||(await R,await M(L));let{diskNumber:_}=s;if(A=!0,g.diskNumberStart=_,g=await Pot(n,C,g,i,e.config,o),A=!1,r.set(t,g),g.filename=t,m){await C.writable.getWriter().close();let w=await S;await R,await P(),x=!0,l||(w=await Lot(g,w,L,o)),await M(L),g.diskNumberStart=s.diskNumber,F=s.diskOffset,await w.stream().pipeTo(L,{preventClose:!0,preventAbort:!0,signal:u}),L.size+=w.size,x=!1}if(g.offset=e.offset-F,g.zip64)Not(g,o);else if(g.offset>4294967295)throw new Error(DY);return e.offset+=g.size,g}catch(R){if(m&&x||!m&&A){if(e.hasCorruptedEntries=!0,R)try{R.corruptedEntry=!0}catch{}m?e.offset+=C.writable.size:e.offset=C.writable.size}throw r.delete(t),R}finally{m&&e.bufferedWrites--,b&&b(),y&&y()}function v(){g.lock=new Promise(R=>b=R)}async function P(){e.writerLocked=!0;let{lockWriter:R}=e;e.lockWriter=new Promise(L=>y=()=>{e.writerLocked=!1,L()}),await R}async function M(R){Qi(f.localHeaderArray)>s.availableSize&&(s.availableSize=0,await Xm(R,new Uint8Array))}}async function Pot(e,t,{diskNumberStart:n,lock:i},o,r,s){let{headerInfo:a,dataDescriptorInfo:l,metadataSize:u}=o,{localHeaderArray:f,headerArray:h,lastModDate:p,rawLastModDate:g,encrypted:m,compressed:y,version:b,compressionMethod:x,rawExtraFieldExtendedTimestamp:A,extraFieldExtendedTimestampFlag:C,rawExtraFieldNTFS:S,rawExtraFieldAES:v}=a,{dataDescriptorArray:P}=l,{rawFilename:M,lastAccessDate:R,creationDate:L,password:F,rawPassword:_,level:w,zip64:D,zip64UncompressedSize:I,zip64CompressedSize:N,zip64Offset:k,zip64DiskNumberStart:z,zipCrypto:V,dataDescriptor:j,directory:U,versionMadeBy:q,rawComment:Y,rawExtraField:te,useWebWorkers:K,onstart:Z,onprogress:ee,onend:me,signal:Te,encryptionStrength:ue,extendedTimestamp:ye,msDosCompatible:Ae,internalFileAttribute:Pe,externalFileAttribute:Ee,useCompressionStream:ze,passThrough:qe}=s,it={lock:i,versionMadeBy:q,zip64:D,directory:!!U,filenameUTF8:!0,rawFilename:M,commentUTF8:!0,rawComment:Y,rawExtraFieldExtendedTimestamp:A,rawExtraFieldNTFS:S,rawExtraFieldAES:v,rawExtraField:te,extendedTimestamp:ye,msDosCompatible:Ae,internalFileAttribute:Pe,externalFileAttribute:Ee,diskNumberStart:n},{signature:Dt,uncompressedSize:jt}=s,$e=0;qe||(jt=0);let{writable:un}=t;if(e){e.chunkSize=q4(r),await Xm(un,f);let Ct=e.readable,Ei=Ct.size=e.size,an={options:{codecType:i8,level:w,rawPassword:_,password:F,encryptionStrength:ue,zipCrypto:m&&V,passwordVerification:m&&V&&g>>8&255,signed:!qe,compressed:y&&!qe,encrypted:m&&!qe,useWebWorkers:K,useCompressionStream:ze,transferStreams:!1},config:r,streamOptions:{signal:Te,size:Ei,onstart:Z,onprogress:ee,onend:me}},_e=await s8({readable:Ct,writable:un},an);$e=_e.outputSize,qe||(jt=_e.inputSize,Dt=_e.signature),un.size+=jt}else await Xm(un,f);let zt;if(D){let Ct=4;I&&(Ct+=8),N&&(Ct+=8),k&&(Ct+=8),z&&(Ct+=4),zt=new Uint8Array(Ct)}else zt=new Uint8Array;return Mot({signature:Dt,rawExtraFieldZip64:zt,compressedSize:$e,uncompressedSize:jt,headerInfo:a,dataDescriptorInfo:l},s),j&&await Xm(un,P),Object.assign(it,{uncompressedSize:jt,compressedSize:$e,lastModDate:p,rawLastModDate:g,creationDate:L,lastAccessDate:R,encrypted:m,zipCrypto:V,size:u+$e,compressionMethod:x,version:b,headerArray:h,signature:Dt,rawExtraFieldZip64:zt,extraFieldExtendedTimestampFlag:C,zip64UncompressedSize:I,zip64CompressedSize:N,zip64Offset:k,zip64DiskNumberStart:z}),it}function Iot(e){let{rawFilename:t,lastModDate:n,lastAccessDate:i,creationDate:o,level:r,zip64:s,zipCrypto:a,useUnicodeFileNames:l,dataDescriptor:u,directory:f,rawExtraField:h,encryptionStrength:p,extendedTimestamp:g,encrypted:m}=e,{version:y,compressionMethod:b}=e,x=!f&&(r>0||r===Pi&&b!==0),A;if(m&&!a){A=new Uint8Array(Qi(rge)+2);let k=ja(A);oo(k,0,39169),Ms(A,rge,2),D8(k,8,p)}else A=new Uint8Array;let C,S,v;if(g){S=new Uint8Array(9+(i?4:0)+(o?4:0));let k=ja(S);oo(k,0,21589),oo(k,2,Qi(S)-4),v=1+(i?2:0)+(o?4:0),D8(k,4,v);let z=5;Zi(k,z,Math.floor(n.getTime()/1e3)),z+=4,i&&(Zi(k,z,Math.floor(i.getTime()/1e3)),z+=4),o&&Zi(k,z,Math.floor(o.getTime()/1e3));try{C=new Uint8Array(36);let V=ja(C),j=vY(n);oo(V,0,10),oo(V,2,32),oo(V,8,1),oo(V,10,24),Jl(V,12,j),Jl(V,20,vY(i)||j),Jl(V,28,vY(o)||j)}catch{C=new Uint8Array}}else C=S=new Uint8Array;let P=0;l&&(P=P|2048),u&&(P=P|8),b===Pi&&(b=x?8:0),b==8&&(r>=1&&r<3&&(P=P|6),r>=3&&r<5&&(P=P|1),r===9&&(P=P|2)),s&&(y=y>45?y:45),m&&(P=P|1,a||(y=y>51?y:51,A[9]=b,b=99));let M=new Uint8Array(26),R=ja(M);oo(R,0,y),oo(R,2,P),oo(R,4,b);let L=new Uint32Array(1),F=ja(L),_;n<k7?_=k7:n>B7?_=B7:_=n,oo(F,0,(_.getHours()<<6|_.getMinutes())<<5|_.getSeconds()/2),oo(F,2,(_.getFullYear()-1980<<4|_.getMonth()+1)<<5|_.getDate());let w=L[0];Zi(R,6,w),oo(R,22,Qi(t));let D=Qi(A,S,C,h);oo(R,24,D);let I=new Uint8Array(30+Qi(t)+D),N=ja(I);return Zi(N,0,67324752),Ms(I,M,4),Ms(I,t,30),Ms(I,A,30+Qi(t)),Ms(I,S,30+Qi(t,A)),Ms(I,C,30+Qi(t,A,S)),Ms(I,h,30+Qi(t,A,S,C)),{localHeaderArray:I,headerArray:M,headerView:R,lastModDate:n,rawLastModDate:w,encrypted:m,compressed:x,version:y,compressionMethod:b,extraFieldExtendedTimestampFlag:v,rawExtraFieldExtendedTimestamp:S,rawExtraFieldNTFS:C,rawExtraFieldAES:A,extraFieldLength:D}}function Oot(e,t){let{headerInfo:n}=e,{localHeaderArray:i,extraFieldLength:o}=n,r=ja(i),s=64-(t+Qi(i))%64;s<4&&(s+=64);let a=new Uint8Array(s),l=ja(a);oo(l,0,6534),oo(l,2,s-2);let u=i;n.localHeaderArray=i=new Uint8Array(Qi(u)+s),Ms(i,u),Ms(i,a,Qi(u)),r=ja(i),oo(r,28,o+s),e.metadataSize+=s}function Rot(e){let{zip64:t,dataDescriptor:n,dataDescriptorSignature:i}=e,o=new Uint8Array,r,s=0;return n&&(o=new Uint8Array(t?i?24:20:i?16:12),r=ja(o),i&&(s=4,Zi(r,0,134695760))),{dataDescriptorArray:o,dataDescriptorView:r,dataDescriptorOffset:s}}function Mot(e,t){let{signature:n,rawExtraFieldZip64:i,compressedSize:o,uncompressedSize:r,headerInfo:s,dataDescriptorInfo:a}=e,{headerView:l,encrypted:u}=s,{dataDescriptorView:f,dataDescriptorOffset:h}=a,{zip64:p,zip64UncompressedSize:g,zip64CompressedSize:m,zipCrypto:y,dataDescriptor:b}=t;if((!u||y)&&n!==Pi&&(Zi(l,10,n),b&&Zi(f,h,n)),p){let x=ja(i);oo(x,0,1),oo(x,2,Qi(i)-4);let A=4;g&&(Zi(l,18,4294967295),Jl(x,A,BigInt(r)),A+=8),m&&(Zi(l,14,4294967295),Jl(x,A,BigInt(o))),b&&(Jl(f,h+4,BigInt(o)),Jl(f,h+12,BigInt(r)))}else Zi(l,14,o),Zi(l,18,r),b&&(Zi(f,h+4,o),Zi(f,h+8,r))}async function Lot(e,t,n,{zipCrypto:i}){let o;o=await t.slice(0,26).arrayBuffer(),o.byteLength!=26&&(o=o.slice(0,26));let r=new DataView(o);return(!e.encrypted||i)&&Zi(r,14,e.signature),e.zip64?(Zi(r,18,4294967295),Zi(r,22,4294967295)):(Zi(r,18,e.compressedSize),Zi(r,22,e.uncompressedSize)),await Xm(n,new Uint8Array(o)),t.slice(o.byteLength)}function Not(e,t){let{rawExtraFieldZip64:n,offset:i,diskNumberStart:o}=e,{zip64UncompressedSize:r,zip64CompressedSize:s,zip64Offset:a,zip64DiskNumberStart:l}=t,u=ja(n),f=4;r&&(f+=8),s&&(f+=8),a&&(Jl(u,f,BigInt(i)),f+=8),l&&Zi(u,f,o)}async function Fot(e,t,n){let{files:i,writer:o}=e,{diskOffset:r,writable:s}=o,{diskNumber:a}=o,l=0,u=0,f=e.offset-r,h=i.size;for(let[,v]of i){let{rawFilename:P,rawExtraFieldZip64:M,rawExtraFieldAES:R,rawComment:L,rawExtraFieldNTFS:F,rawExtraField:_,extendedTimestamp:w,extraFieldExtendedTimestampFlag:D,lastModDate:I}=v,N;if(w){N=new Uint8Array(9);let k=ja(N);oo(k,0,21589),oo(k,2,5),D8(k,4,D),Zi(k,5,Math.floor(I.getTime()/1e3))}else N=new Uint8Array;v.rawExtraFieldCDExtendedTimestamp=N,u+=46+Qi(P,L,M,R,F,N,_)}let p=new Uint8Array(u),g=ja(p);await Ym(o);let m=0;for(let[v,P]of Array.from(i.values()).entries()){let{offset:M,rawFilename:R,rawExtraFieldZip64:L,rawExtraFieldAES:F,rawExtraFieldCDExtendedTimestamp:_,rawExtraFieldNTFS:w,rawExtraField:D,rawComment:I,versionMadeBy:N,headerArray:k,directory:z,zip64:V,zip64UncompressedSize:j,zip64CompressedSize:U,zip64DiskNumberStart:q,zip64Offset:Y,msDosCompatible:te,internalFileAttribute:K,externalFileAttribute:Z,diskNumberStart:ee,uncompressedSize:me,compressedSize:Te}=P,ue=Qi(L,F,_,w,D);Zi(g,l,33639248),oo(g,l+4,N);let ye=ja(k);j||Zi(ye,18,me),U||Zi(ye,14,Te),Ms(p,k,l+6),oo(g,l+30,ue),oo(g,l+32,Qi(I)),oo(g,l+34,V&&q?65535:ee),oo(g,l+36,K),Z?Zi(g,l+38,Z):z&&te&&D8(g,l+38,16),Zi(g,l+42,V&&Y?4294967295:M),Ms(p,R,l+46),Ms(p,L,l+46+Qi(R)),Ms(p,F,l+46+Qi(R,L)),Ms(p,_,l+46+Qi(R,L,F)),Ms(p,w,l+46+Qi(R,L,F,_)),Ms(p,D,l+46+Qi(R,L,F,_,w)),Ms(p,I,l+46+Qi(R)+ue);let Ae=46+Qi(R,I)+ue;if(l-m>o.availableSize&&(o.availableSize=0,await Xm(s,p.slice(m,l)),m=l),l+=Ae,n.onprogress)try{await n.onprogress(v+1,i.size,new b0(P))}catch{}}await Xm(s,m?p.slice(m):p);let y=o.diskNumber,{availableSize:b}=o;b<22&&y++;let x=po(e,n,_8);if(f>4294967295||u>4294967295||h>65535||y>65535){if(x===!1)throw new Error(DY);x=!0}let A=new Uint8Array(x?98:22),C=ja(A);l=0,x&&(Zi(C,0,101075792),Jl(C,4,BigInt(44)),oo(C,12,45),oo(C,14,45),Zi(C,16,y),Zi(C,20,a),Jl(C,24,BigInt(h)),Jl(C,32,BigInt(h)),Jl(C,40,BigInt(u)),Jl(C,48,BigInt(f)),Zi(C,56,117853008),Jl(C,64,BigInt(f)+BigInt(u)),Zi(C,72,y+1),po(e,n,"supportZip64SplitFile",!0)&&(y=65535,a=65535),h=65535,f=4294967295,u=4294967295,l+=76),Zi(C,l,101010256),oo(C,l+4,y),oo(C,l+6,a),oo(C,l+8,h),oo(C,l+10,h),Zi(C,l+12,u),Zi(C,l+16,f);let S=Qi(t);if(S)if(S<=65535)oo(C,l+20,S);else throw new Error(xot);await Xm(s,A),S&&await Xm(s,t)}async function Xm(e,t){let n=e.getWriter();try{await n.ready,e.size+=Qi(t),await n.write(t)}finally{n.releaseLock()}}function vY(e){if(e)return(BigInt(e.getTime())+BigInt(116444736e5))*BigInt(1e4)}function po(e,t,n,i){let o=t[n]===Pi?e.options[n]:t[n];return o===Pi?i:o}function age(e){return e+5*(Math.floor(e/16383)+1)}function D8(e,t,n){e.setUint8(t,n)}function oo(e,t,n){e.setUint16(t,n,!0)}function Zi(e,t,n){e.setUint32(t,n,!0)}function Jl(e,t,n){e.setBigUint64(t,n,!0)}function Ms(e,t,n){e.set(t,n)}function ja(e){return new DataView(e.buffer)}function Qi(...e){let t=0;return e.forEach(n=>n&&(t+=n.length)),t}FS({Deflate:Wpe,Inflate:h_e});var PY=32,Bot="http://www.opengis.net/kml/2.2",Lh="http://www.google.com/kml/ext/2.2",kot="http://www.w3.org/2000/xmlns/";function P8(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}var Uot=/^data:image\/([^,;]+)/;P8.prototype.texture=function(e){let t=this,n;if(typeof e=="string"||e instanceof we){if(e=we.createIfNeeded(e),!e.isDataUri)return e.url;let i=e.url.match(Uot);n=`texture_${++this._count}`,c(i)&&(n+=`.${i[1]}`);let o=e.fetchBlob().then(function(r){t._files[n]=r});return this._promises.push(o),n}if(e instanceof HTMLCanvasElement){n=`texture_${++this._count}.png`;let i=new Promise(o=>{e.toBlob(function(r){t._files[n]=r,o()})});return this._promises.push(i),n}return""};function Vot(e,t){return function(n){e._files[t]=n}}P8.prototype.model=function(e,t){let n=this._modelCallback;if(!c(n))throw new ae("Encountered a model entity while exporting to KML, but no model callback was supplied.");let i={},o=n(e,t,i);for(let r in i)if(i.hasOwnProperty(r)){let s=Promise.resolve(i[r]);this._promises.push(s),s.then(Vot(this,r))}return o};Object.defineProperties(P8.prototype,{promise:{get:function(){return Promise.all(this._promises)}},files:{get:function(){return this._files}}});function I8(e){this._time=e}I8.prototype.get=function(e,t,n){let i;return c(e)&&(i=c(e.getValue)?e.getValue(this._time,n):e),i??t};I8.prototype.getColor=function(e,t){let n=this.get(e,t);if(c(n))return DT(n)};I8.prototype.getMaterialType=function(e){if(c(e))return e.getType(this._time)};function IY(){this._ids={},this._styles={},this._count=0}IY.prototype.get=function(e){let t=this._ids,n=e.innerHTML;if(c(t[n]))return t[n];let i=`style-${++this._count}`;return e.setAttribute("id",i),i=`#${i}`,t[n]=i,this._styles[n]=e,i};IY.prototype.save=function(e){let t=this._styles,n=e.childNodes[0];for(let i in t)t.hasOwnProperty(i)&&e.insertBefore(t[i],n)};function fge(){this._ids={}}fge.prototype.get=function(e){if(!c(e))return this.get(jn());let t=this._ids;return c(t[e])?`${e.toString()}-${++t[e]}`:(t[e]=0,e)};function OY(e){e=e??W.EMPTY_OBJECT;let t=e.entities,n=e.kmz??!1;if(!c(t))throw new E("entities is required.");let i=OY._createState(e),o=t.values.filter(function(u){return!c(u.parent)}),r=i.kmlDoc,s=r.documentElement;s.setAttributeNS(kot,"xmlns:gx",Lh);let a=r.createElement("Document");s.appendChild(a),hge(i,a,o),i.styleCache.save(a);let l=i.externalFileHandler;return l.promise.then(function(){let f=new XMLSerializer().serializeToString(i.kmlDoc);return n?zot(f,l.files):{kml:f,externalFiles:l.files}})}function zot(e,t){let n=tn("ThirdParty/Workers/z-worker-pako.js");FS({workerScripts:{deflate:[n,"./pako_deflate.min.js"],inflate:[n,"./pako_inflate.min.js"]}});let i=new SF,o=new v8(i);return o.add("doc.kml",new l8(e)).then(function(){let r=Object.keys(t);return dge(o,r,t,0)}).then(function(){return o.close()}).then(function(r){return{kmz:r}})}function dge(e,t,n,i){if(t.length===i)return;let o=t[i];return e.add(o,new sg(n[o])).then(function(){return dge(e,t,n,i+1)})}OY._createState=function(e){let t=e.entities,n=new IY,i=t.computeAvailability(),o=c(e.time)?e.time:i.start,r=e.defaultAvailability??i,s=e.sampleDuration??60;r.start===Ge.MINIMUM_VALUE?r.stop===Ge.MAXIMUM_VALUE?r=new En:Q.addSeconds(r.stop,-10*s,r.start):r.stop===Ge.MAXIMUM_VALUE&&Q.addSeconds(r.start,10*s,r.stop);let a=new P8(e.modelCallback);return{kmlDoc:document.implementation.createDocument(Bot,"kml"),ellipsoid:e.ellipsoid??ie.default,idManager:new fge,styleCache:n,externalFileHandler:a,time:o,valueGetter:new I8(o),sampleDuration:s,defaultAvailability:new Xr([r])}};function hge(e,t,n){let i=e.kmlDoc,o=e.styleCache,r=e.valueGetter,s=e.idManager,a=n.length,l,u,f;for(let h=0;h<a;++h){let p=n[h];l=[],u=[],f=[],Hot(e,p,u,f),Got(e,p.polyline,u,f),uge(e,p.rectangle,u,f,l),uge(e,p.polygon,u,f,l),Yot(e,p,p.model,u,f);let g,m=p.availability;c(m)&&(g=i.createElement("TimeSpan"),Q.equals(m.start,Ge.MINIMUM_VALUE)||g.appendChild(dn(i,"begin",Q.toIso8601(m.start))),Q.equals(m.stop,Ge.MAXIMUM_VALUE)||g.appendChild(dn(i,"end",Q.toIso8601(m.stop))));for(let x=0;x<l.length;++x){let A=l[x];A.setAttribute("id",s.get(p.id)),A.appendChild(dn(i,"name",p.name)),A.appendChild(dn(i,"visibility",p.show)),A.appendChild(dn(i,"description",p.description)),c(g)&&A.appendChild(g),t.appendChild(A)}let y=u.length;if(y>0){let x=i.createElement("Placemark");x.setAttribute("id",s.get(p.id));let A=p.name,C=p.label;if(c(C)){let v=i.createElement("LabelStyle"),P=r.get(C.text);A=c(P)&&P.length>0?P:A;let M=r.getColor(C.fillColor);c(M)&&(v.appendChild(dn(i,"color",M)),v.appendChild(dn(i,"colorMode","normal")));let R=r.get(C.scale);c(R)&&v.appendChild(dn(i,"scale",R)),f.push(v)}x.appendChild(dn(i,"name",A)),x.appendChild(dn(i,"visibility",p.show)),x.appendChild(dn(i,"description",p.description)),c(g)&&x.appendChild(g),t.appendChild(x);let S=f.length;if(S>0){let v=i.createElement("Style");for(let P=0;P<S;++P)v.appendChild(f[P]);x.appendChild(dn(i,"styleUrl",o.get(v)))}if(u.length===1)x.appendChild(u[0]);else if(u.length>1){let v=i.createElement("MultiGeometry");for(let P=0;P<y;++P)v.appendChild(u[P]);x.appendChild(v)}}let b=p._children;if(b.length>0){let x=i.createElement("Folder");x.setAttribute("id",s.get(p.id)),x.appendChild(dn(i,"name",p.name)),x.appendChild(dn(i,"visibility",p.show)),x.appendChild(dn(i,"description",p.description)),t.appendChild(x),hge(e,x,b)}}}var eu=new d,pl=new he,Mh=new Q;function Hot(e,t,n,i){let o=e.kmlDoc,r=e.ellipsoid,s=e.valueGetter,a=t.billboard??t.point;if(!c(a)&&!c(t.path))return;let l=t.position;if(!l.isConstant){mge(e,t,a,n,i);return}s.get(l,void 0,eu);let u=dn(o,"coordinates",vT(eu,r)),f=o.createElement("Point"),h=o.createElement("altitudeMode");h.appendChild(PT(e,a.heightReference)),f.appendChild(h),f.appendChild(u),n.push(f);let p=a instanceof fc?_ge(e,a):pge(e,a);i.push(p)}function mge(e,t,n,i,o){let r=e.kmlDoc,s=e.ellipsoid,a=e.valueGetter,l,u=t.position,f=!0;u instanceof ba?(l=u.intervals,f=!1):l=t.availability??e.defaultAvailability;let h=n instanceof Gp,p,g,m,y=[];for(p=0;p<l.length;++p){let x=l.get(p),A=f?u:x.data,C=r.createElement("altitudeMode");A instanceof zm?(A=A._value,C.appendChild(PT(e,We.CLAMP_TO_GROUND))):c(n)?C.appendChild(PT(e,n.heightReference)):C.appendChild(PT(e,We.NONE));let S=[],v=[];if(A.isConstant){a.get(A,void 0,eu);let M=dn(r,"coordinates",vT(eu,s));S.push(Q.toIso8601(x.start)),v.push(M),S.push(Q.toIso8601(x.stop)),v.push(M)}else if(A instanceof Ta)for(m=A._property._times,g=0;g<m.length;++g)S.push(Q.toIso8601(m[g])),A.getValueInReferenceFrame(m[g],Hi.FIXED,eu),v.push(vT(eu,s));else if(A instanceof Vu){m=A._times;let M=A._values;for(g=0;g<m.length;++g)S.push(Q.toIso8601(m[g])),d.fromArray(M,g*3,eu),v.push(vT(eu,s))}else{let M=e.sampleDuration;x.start.clone(Mh),x.isStartIncluded||Q.addSeconds(Mh,M,Mh);let R=x.stop;for(;Q.lessThan(Mh,R);)A.getValue(Mh,eu),S.push(Q.toIso8601(Mh)),v.push(vT(eu,s)),Q.addSeconds(Mh,M,Mh);x.isStopIncluded&&Q.equals(Mh,R)&&(A.getValue(Mh,eu),S.push(Q.toIso8601(Mh)),v.push(vT(eu,s)))}let P=r.createElementNS(Lh,"Track");P.appendChild(C);for(let M=0;M<S.length;++M){let R=dn(r,"when",S[M]),L=dn(r,"coord",v[M],Lh);P.appendChild(R),P.appendChild(L)}h&&P.appendChild(gge(e,n)),y.push(P)}if(y.length===1)i.push(y[0]);else if(y.length>1){let x=r.createElementNS(Lh,"MultiTrack");for(p=0;p<y.length;++p)x.appendChild(y[p]);i.push(x)}if(c(n)&&!h){let x=n instanceof fc?_ge(e,n):pge(e,n);o.push(x)}let b=t.path;if(c(b)){let x=a.get(b.width),A=b.material;if(c(A)||c(x)){let C=r.createElement("LineStyle");c(x)&&C.appendChild(dn(r,"width",x)),RY(e,A,C),o.push(C)}}}function pge(e,t){let n=e.kmlDoc,i=e.valueGetter,o=n.createElement("IconStyle"),r=i.getColor(t.color);c(r)&&(o.appendChild(dn(n,"color",r)),o.appendChild(dn(n,"colorMode","normal")));let s=i.get(t.pixelSize);return c(s)&&o.appendChild(dn(n,"scale",s/PY)),o}function _ge(e,t){let n=e.kmlDoc,i=e.valueGetter,o=e.externalFileHandler,r=n.createElement("IconStyle"),s=i.get(t.image);if(c(s)){s=o.texture(s);let p=n.createElement("Icon");p.appendChild(dn(n,"href",s));let g=i.get(t.imageSubRegion);c(g)&&(p.appendChild(dn(n,"x",g.x,Lh)),p.appendChild(dn(n,"y",g.y,Lh)),p.appendChild(dn(n,"w",g.width,Lh)),p.appendChild(dn(n,"h",g.height,Lh))),r.appendChild(p)}let a=i.getColor(t.color);c(a)&&(r.appendChild(dn(n,"color",a)),r.appendChild(dn(n,"colorMode","normal")));let l=i.get(t.scale);c(l)&&r.appendChild(dn(n,"scale",l));let u=i.get(t.pixelOffset);if(c(u)){l=l??1,H.divideByScalar(u,l,u);let p=i.get(t.width,PY),g=i.get(t.height,PY),m=i.get(t.horizontalOrigin,bi.CENTER);m===bi.CENTER?u.x-=p*.5:m===bi.RIGHT&&(u.x-=p);let y=i.get(t.verticalOrigin,Fn.CENTER);y===Fn.TOP?u.y+=g:y===Fn.CENTER&&(u.y+=g*.5);let b=n.createElement("hotSpot");b.setAttribute("x",-u.x),b.setAttribute("y",u.y),b.setAttribute("xunits","pixels"),b.setAttribute("yunits","pixels"),r.appendChild(b)}let f=i.get(t.rotation),h=i.get(t.alignedAxis);return c(f)&&d.equals(d.UNIT_Z,h)&&(f=O.toDegrees(-f),f===0&&(f=360),r.appendChild(dn(n,"heading",f))),r}function Got(e,t,n,i){let o=e.kmlDoc,r=e.ellipsoid,s=e.valueGetter;if(!c(t))return;let a=o.createElement("LineString"),l=o.createElement("altitudeMode"),u=s.get(t.clampToGround,!1),f;u?(a.appendChild(dn(o,"tessellate",!0)),f=o.createTextNode("clampToGround")):f=o.createTextNode("absolute"),l.appendChild(f),a.appendChild(l);let h=t.positions,p=s.get(h),g=dn(o,"coordinates",vT(p,r));a.appendChild(g);let m=s.get(t.zIndex);u&&c(m)&&a.appendChild(dn(o,"drawOrder",m,Lh)),n.push(a);let y=o.createElement("LineStyle"),b=s.get(t.width);c(b)&&y.appendChild(dn(o,"width",b)),RY(e,t.material,y),i.push(y)}function jot(e,t,n){let i=e.kmlDoc,o=e.valueGetter,r=o.get(t.height,0);n>0&&(r=n);let s=t.coordinates,a=o.get(s),l=[],u=[ce.northeast,ce.southeast,ce.southwest,ce.northwest];for(let g=0;g<4;++g)u[g](a,pl),l.push(`${O.toDegrees(pl.longitude)},${O.toDegrees(pl.latitude)},${r}`);let f=dn(i,"coordinates",l.join(" ")),h=i.createElement("outerBoundaryIs"),p=i.createElement("LinearRing");return p.appendChild(f),h.appendChild(p),[h]}function lge(e,t,n,i){let o=e.kmlDoc,r=e.ellipsoid,s=[],a=t.length;for(let f=0;f<a;++f)he.fromCartesian(t[f],r,pl),s.push(`${O.toDegrees(pl.longitude)},${O.toDegrees(pl.latitude)},${i?pl.height:n}`);let l=dn(o,"coordinates",s.join(" ")),u=o.createElement("LinearRing");return u.appendChild(l),u}function Wot(e,t,n){let i=e.kmlDoc,o=e.valueGetter,r=o.get(t.height,0),s=o.get(t.perPositionHeight,!1);!s&&n>0&&(r=n);let a=[],l=t.hierarchy,u=o.get(l),f=Array.isArray(u)?u:u.positions,h=i.createElement("outerBoundaryIs");h.appendChild(lge(e,f,r,s)),a.push(h);let p=u.holes;if(c(p)){let g=p.length;for(let m=0;m<g;++m){let y=i.createElement("innerBoundaryIs");y.appendChild(lge(e,p[m].positions,r,s)),a.push(y)}}return a}function uge(e,t,n,i,o){let r=e.kmlDoc,s=e.valueGetter;if(!c(t))return;let a=t instanceof jd;if(a&&s.getMaterialType(t.material)==="Image"){qot(e,t,o);return}let l=r.createElement("Polygon"),u=s.get(t.extrudedHeight,0);u>0&&l.appendChild(dn(r,"extrude",!0));let f=a?jot(e,t,u):Wot(e,t,u),h=f.length;for(let b=0;b<h;++b)l.appendChild(f[b]);let p=r.createElement("altitudeMode");p.appendChild(PT(e,t.heightReference)),l.appendChild(p),n.push(l);let g=r.createElement("PolyStyle"),m=s.get(t.fill,!1);m&&g.appendChild(dn(r,"fill",m)),RY(e,t.material,g);let y=s.get(t.outline,!1);if(y){g.appendChild(dn(r,"outline",y));let b=r.createElement("LineStyle"),x=s.get(t.outlineWidth,1);b.appendChild(dn(r,"width",x));let A=s.getColor(t.outlineColor,G.BLACK);b.appendChild(dn(r,"color",A)),b.appendChild(dn(r,"colorMode","normal")),i.push(b)}i.push(g)}function qot(e,t,n){let i=e.kmlDoc,o=e.valueGetter,r=e.externalFileHandler,s=i.createElement("GroundOverlay"),a=i.createElement("altitudeMode");a.appendChild(PT(e,t.heightReference)),s.appendChild(a);let l=o.get(t.height);c(l)&&s.appendChild(dn(i,"altitude",l));let u=o.get(t.coordinates),f=i.createElement("LatLonBox");f.appendChild(dn(i,"north",O.toDegrees(u.north))),f.appendChild(dn(i,"south",O.toDegrees(u.south))),f.appendChild(dn(i,"east",O.toDegrees(u.east))),f.appendChild(dn(i,"west",O.toDegrees(u.west))),s.appendChild(f);let h=o.get(t.material),p=r.texture(h.image),g=i.createElement("Icon");g.appendChild(dn(i,"href",p)),s.appendChild(g);let m=h.color;c(m)&&s.appendChild(dn(i,"color",DT(h.color))),n.push(s)}function gge(e,t){let n=e.kmlDoc,i=e.valueGetter,o=e.externalFileHandler,r=n.createElement("Model"),s=i.get(t.scale);if(c(s)){let u=n.createElement("scale");u.appendChild(dn(n,"x",s)),u.appendChild(dn(n,"y",s)),u.appendChild(dn(n,"z",s)),r.appendChild(u)}let a=n.createElement("Link"),l=o.model(t,e.time);return a.appendChild(dn(n,"href",l)),r.appendChild(a),r}function Yot(e,t,n,i,o){let r=e.kmlDoc,s=e.ellipsoid,a=e.valueGetter;if(!c(n))return;let l=t.position;if(!l.isConstant){mge(e,t,n,i,o);return}let u=gge(e,n),f=r.createElement("altitudeMode");f.appendChild(PT(e,n.heightReference)),u.appendChild(f),a.get(l,void 0,eu),he.fromCartesian(eu,s,pl);let h=r.createElement("Location");h.appendChild(dn(r,"longitude",O.toDegrees(pl.longitude))),h.appendChild(dn(r,"latitude",O.toDegrees(pl.latitude))),h.appendChild(dn(r,"altitude",pl.height)),u.appendChild(h),i.push(u)}function RY(e,t,n){let i=e.kmlDoc,o=e.valueGetter;if(!c(t))return;let r=o.get(t);if(!c(r))return;let s,a=o.getMaterialType(t),l,u;switch(a){case"Image":s=DT(G.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":s=DT(r.color);break;case"PolylineOutline":s=DT(r.color),l=DT(r.outlineColor),u=r.outlineWidth,n.appendChild(dn(i,"outerColor",l,Lh)),n.appendChild(dn(i,"outerWidth",u,Lh));break;case"Stripe":s=DT(r.oddColor);break}c(s)&&(n.appendChild(dn(i,"color",s)),n.appendChild(dn(i,"colorMode","normal")))}function PT(e,t){let n=e.kmlDoc,o=e.valueGetter.get(t,We.NONE),r;switch(o){case We.NONE:r=n.createTextNode("absolute");break;case We.CLAMP_TO_GROUND:r=n.createTextNode("clampToGround");break;case We.RELATIVE_TO_GROUND:r=n.createTextNode("relativeToGround");break}return r}function vT(e,t){Array.isArray(e)||(e=[e]);let n=e.length,i=[];for(let o=0;o<n;++o)he.fromCartesian(e[o],t,pl),i.push(`${O.toDegrees(pl.longitude)},${O.toDegrees(pl.latitude)},${pl.height}`);return i.join(" ")}function dn(e,t,n,i){n=n??"",typeof n=="boolean"&&(n=n?"1":"0");let o=c(i)?e.createElementNS(i,t):e.createElement(t),r=n==="string"&&n.indexOf("<")!==-1?e.createCDATASection(n):e.createTextNode(n);return o.appendChild(r),o}function DT(e){let t="",n=e.toBytes();for(let i=3;i>=0;--i)t+=n[i]<16?`0${n[i].toString(16)}`:n[i].toString(16);return t}var MY=OY;function RF(){this._cache={}}RF.prototype.fromColor=function(e,t){if(!c(e))throw new E("color is required");if(!c(t))throw new E("size is required");return O8(void 0,void 0,e,t,this._cache)};RF.prototype.fromUrl=function(e,t,n){if(!c(e))throw new E("url is required");if(!c(t))throw new E("color is required");if(!c(n))throw new E("size is required");return O8(e,void 0,t,n,this._cache)};RF.prototype.fromMakiIconId=function(e,t,n){if(!c(e))throw new E("id is required");if(!c(t))throw new E("color is required");if(!c(n))throw new E("size is required");return O8(tn(`Assets/Textures/maki/${encodeURIComponent(e)}.png`),void 0,t,n,this._cache)};RF.prototype.fromText=function(e,t,n){if(!c(e))throw new E("text is required");if(!c(t))throw new E("color is required");if(!c(n))throw new E("size is required");return O8(void 0,e,t,n,this._cache)};var Xot=new G;function Kot(e,t,n){e.save(),e.scale(n/24,n/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,Xot).toCssColorString(),e.lineWidth=.846,e.beginPath(),e.moveTo(6.72,.422),e.lineTo(17.28,.422),e.bezierCurveTo(18.553,.422,19.577,1.758,19.577,3.415),e.lineTo(19.577,10.973),e.bezierCurveTo(19.577,12.63,18.553,13.966,17.282,13.966),e.lineTo(14.386,14.008),e.lineTo(11.826,23.578),e.lineTo(9.614,14.008),e.lineTo(6.719,13.965),e.bezierCurveTo(5.446,13.983,4.422,12.629,4.422,10.972),e.lineTo(4.422,3.416),e.bezierCurveTo(4.423,1.76,5.447,.423,6.718,.423),e.closePath(),e.fill(),e.stroke(),e.restore()}function yge(e,t,n){let i=n/2.5,o=i,r=i;t.width>t.height?r=i*(t.height/t.width):t.width<t.height&&(o=i*(t.width/t.height));let s=Math.round((n-o)/2),a=Math.round(7/24*n-r/2);e.globalCompositeOperation="destination-out",e.drawImage(t,s-1,a,o,r),e.drawImage(t,s,a-1,o,r),e.drawImage(t,s+1,a,o,r),e.drawImage(t,s,a+1,o,r),e.globalCompositeOperation="destination-over",e.fillStyle=G.BLACK.toCssColorString(),e.fillRect(s-1,a-1,o+2,r+2),e.globalCompositeOperation="destination-out",e.drawImage(t,s,a,o,r),e.globalCompositeOperation="destination-over",e.fillStyle=G.WHITE.toCssColorString(),e.fillRect(s-1,a-2,o+2,r+2)}var OF=new Array(4);function O8(e,t,n,i,o){OF[0]=e,OF[1]=t,OF[2]=n,OF[3]=i;let r=JSON.stringify(OF),s=o[r];if(c(s))return s;let a=document.createElement("canvas");a.width=i,a.height=i;let l=a.getContext("2d");if(Kot(l,n,i),c(e)){let f=we.createIfNeeded(e).fetchImage().then(function(h){return yge(l,h,i),o[r]=a,a});return o[r]=f,f}else if(c(t)){let u=Fx(t,{font:`bold ${i}px sans-serif`});yge(l,u,i)}return o[r]=a,a}var ag=RF;var Tge=Zo(xge(),1);function M8(e){return d.fromDegrees(e[0],e[1],e[2])}var LY={"urn:ogc:def:crs:OGC:1.3:CRS84":M8,"EPSG:4326":M8,"urn:ogc:def:crs:EPSG::4326":M8},Age={},Cge={},NY=48,FY,BY=G.ROYALBLUE,kY=G.YELLOW,UY=2,VY=G.fromBytes(255,255,0,100),zY=!1,$ot={small:24,medium:48,large:64},Zot=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function Ege(e,t){let n="";for(let i in e)if(e.hasOwnProperty(i)){if(i===t||Zot.indexOf(i)!==-1)continue;let o=e[i];c(o)&&(typeof o=="object"?n+=`<tr><th>${i}</th><td>${Ege(o)}</td></tr>`:n+=`<tr><th>${i}</th><td>${o}</td></tr>`)}return n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function Qot(e,t,n){let i;return function(o,r){return c(i)||(i=e(t,n)),i}}function Jot(e,t){return new Wd(Qot(Ege,e,t),!0)}function L8(e,t,n){let i=e.id;if(!c(i)||e.type!=="Feature")i=jn();else{let s=2,a=i;for(;c(t.getById(a));)a=`${i}_${s}`,s++;i=a}let o=t.getOrCreateEntity(i),r=e.properties;if(c(r)){o.properties=r;let s,a=r.title;if(c(a))o.name=a,s="title";else{let u=Number.MAX_VALUE;for(let f in r)if(r.hasOwnProperty(f)&&r[f]){let h=f.toLowerCase();if(u>1&&h==="title"){u=1,s=f;break}else u>2&&h==="name"?(u=2,s=f):u>3&&/title/i.test(f)?(u=3,s=f):u>4&&/name/i.test(f)&&(u=4,s=f)}c(s)&&(o.name=r[s])}let l=r.description;l!==null&&(o.description=c(l)?new Kn(l):n(r,s))}return o}function HY(e,t){let n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=t(e[i]);return n}var Sge={Feature:vge,FeatureCollection:ert,GeometryCollection:Dge,LineString:Mge,MultiLineString:Lge,MultiPoint:Oge,MultiPolygon:Bge,Point:Ige,Polygon:Fge,Topology:kge},wge={GeometryCollection:Dge,LineString:Mge,MultiLineString:Lge,MultiPoint:Oge,MultiPolygon:Bge,Point:Ige,Polygon:Fge,Topology:kge};function vge(e,t,n,i,o){if(t.geometry===null){L8(t,e._entityCollection,o.describe);return}if(!c(t.geometry))throw new ae("feature.geometry is required.");let r=t.geometry.type,s=wge[r];if(!c(s))throw new ae(`Unknown geometry type: ${r}`);s(e,t,t.geometry,i,o)}function ert(e,t,n,i,o){let r=t.features;for(let s=0,a=r.length;s<a;s++)vge(e,r[s],void 0,i,o)}function Dge(e,t,n,i,o){let r=n.geometries;for(let s=0,a=r.length;s<a;s++){let l=r[s],u=l.type,f=wge[u];if(!c(f))throw new ae(`Unknown geometry type: ${u}`);f(e,t,l,i,o)}}function Pge(e,t,n,i,o){let r=o.markerSymbol,s=o.markerColor,a=o.markerSize,l=t.properties;if(c(l)){let g=l["marker-color"];c(g)&&(s=G.fromCssColorString(g)),a=$ot[l["marker-size"]]??a;let m=l["marker-symbol"];c(m)&&(r=m)}let u;c(r)?r.length===1?u=e._pinBuilder.fromText(r.toUpperCase(),s,a):u=e._pinBuilder.fromMakiIconId(r,s,a):u=e._pinBuilder.fromColor(s,a);let f=new fc;f.verticalOrigin=new Kn(Fn.BOTTOM),i.length===2&&o.clampToGround&&(f.heightReference=We.CLAMP_TO_GROUND);let h=L8(t,e._entityCollection,o.describe);h.billboard=f,h.position=new qc(n(i));let p=Promise.resolve(u).then(function(g){f.image=new Kn(g)}).catch(function(){f.image=new Kn(e._pinBuilder.fromColor(s,a))});e._promises.push(p)}function Ige(e,t,n,i,o){Pge(e,t,i,n.coordinates,o)}function Oge(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Pge(e,t,i,r[s],o)}function Rge(e,t,n,i,o){let r=o.strokeMaterialProperty,s=o.strokeWidthProperty,a=t.properties;if(c(a)){let f=a["stroke-width"];c(f)&&(s=new Kn(f));let h,p=a.stroke;c(p)&&(h=G.fromCssColorString(p));let g=a["stroke-opacity"];c(g)&&g!==1&&(c(h)||(h=r.color.getValue().clone()),h.alpha=g),c(h)&&(r=new Ut(h))}let l=L8(t,e._entityCollection,o.describe),u=new mc;l.polyline=u,u.clampToGround=o.clampToGround,u.material=r,u.width=s,u.positions=new Kn(HY(i,n)),u.arcType=qt.RHUMB}function Mge(e,t,n,i,o){Rge(e,t,i,n.coordinates,o)}function Lge(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Rge(e,t,i,r[s],o)}function Nge(e,t,n,i,o){if(i.length===0||i[0].length===0)return;let r=o.strokeMaterialProperty.color,s=o.fillMaterialProperty,a=o.strokeWidthProperty,l=t.properties;if(c(l)){let g=l["stroke-width"];c(g)&&(a=new Kn(g));let m,y=l.stroke;c(y)&&(m=G.fromCssColorString(y));let b=l["stroke-opacity"];c(b)&&b!==1&&(c(m)||(m=r.getValue().clone()),m.alpha=b),c(m)&&(r=new Kn(m));let x,A=l.fill,C=s.color.getValue();c(A)&&(x=G.fromCssColorString(A),x.alpha=C.alpha),b=l["fill-opacity"],c(b)&&b!==C.alpha&&(c(x)||(x=C.clone()),x.alpha=b),c(x)&&(s=new Ut(x))}let u=new Gd;u.outline=new Kn(!0),u.outlineColor=r,u.outlineWidth=a,u.material=s,u.arcType=qt.RHUMB;let f=[];for(let g=1,m=i.length;g<m;g++)f.push(new ka(HY(i[g],n)));let h=i[0];u.hierarchy=new Kn(new ka(HY(h,n),f)),h[0].length>2?u.perPositionHeight=new Kn(!0):o.clampToGround||(u.height=0);let p=L8(t,e._entityCollection,o.describe);p.polygon=u}function Fge(e,t,n,i,o){Nge(e,t,i,n.coordinates,o)}function Bge(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Nge(e,t,i,r[s],o)}function kge(e,t,n,i,o){for(let r in n.objects)if(n.objects.hasOwnProperty(r)){let s=Tge.feature(n,n.objects[r]),a=Sge[s.type];a(e,s,s,i,o)}}function x0(e){this._name=e,this._changed=new pe,this._error=new pe,this._isLoading=!1,this._loading=new pe,this._entityCollection=new Qs(this),this._promises=[],this._pinBuilder=new ag,this._entityCluster=new Bu,this._credit=void 0,this._resourceCredits=[]}x0.load=function(e,t){return new x0().load(e,t)};Object.defineProperties(x0,{markerSize:{get:function(){return NY},set:function(e){NY=e}},markerSymbol:{get:function(){return FY},set:function(e){FY=e}},markerColor:{get:function(){return BY},set:function(e){BY=e}},stroke:{get:function(){return kY},set:function(e){kY=e}},strokeWidth:{get:function(){return UY},set:function(e){UY=e}},fill:{get:function(){return VY},set:function(e){VY=e}},clampToGround:{get:function(){return zY},set:function(e){zY=e}},crsNames:{get:function(){return LY}},crsLinkHrefs:{get:function(){return Age}},crsLinkTypes:{get:function(){return Cge}}});Object.defineProperties(x0.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{value:void 0,writable:!1},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}},credit:{get:function(){return this._credit}}});x0.prototype.load=function(e,t){return Uge(this,e,t,!0)};x0.prototype.process=function(e,t){return Uge(this,e,t,!1)};function Uge(e,t,n,i){if(!c(t))throw new E("data is required.");Kr.setLoading(e,!0),n=n??W.EMPTY_OBJECT;let o=n.credit;typeof o=="string"&&(o=new Tt(o)),e._credit=o;let r=t,s=n.sourceUri;if(typeof t=="string"||t instanceof we){t=we.createIfNeeded(t),r=t.fetchJson(),s=s??t.getUrlComponent();let a=e._resourceCredits,l=t.credits;if(c(l)){let u=l.length;for(let f=0;f<u;f++)a.push(l[f])}}return n={describe:n.describe??Jot,markerSize:n.markerSize??NY,markerSymbol:n.markerSymbol??FY,markerColor:n.markerColor??BY,strokeWidthProperty:new Kn(n.strokeWidth??UY),strokeMaterialProperty:new Ut(n.stroke??kY),fillMaterialProperty:new Ut(n.fill??VY),clampToGround:n.clampToGround??zY},Promise.resolve(r).then(function(a){return trt(e,a,n,s,i)}).catch(function(a){throw Kr.setLoading(e,!1),e._error.raiseEvent(e,a),a})}x0.prototype.update=function(e){return!0};function trt(e,t,n,i,o){let r;c(i)&&(r=j_(i)),c(r)&&e._name!==r&&(e._name=r,e._changed.raiseEvent(e));let s=Sge[t.type];if(!c(s))throw new ae(`Unsupported GeoJSON object type: ${t.type}`);let a=t.crs,l=a!==null?M8:null;if(c(a)){if(!c(a.properties))throw new ae("crs.properties is undefined.");let u=a.properties;if(a.type==="name"){if(l=LY[u.name],!c(l))throw new ae(`Unknown crs name: ${u.name}`)}else if(a.type==="link"){let f=Age[u.href];if(c(f)||(f=Cge[u.type]),!c(f))throw new ae(`Unable to resolve crs link: ${JSON.stringify(u)}`);l=f(u)}else if(a.type==="EPSG"){if(l=LY[`EPSG:${u.code}`],!c(l))throw new ae(`Unknown crs EPSG code: ${u.code}`)}else throw new ae(`Unknown crs type: ${a.type}`)}return Promise.resolve(l).then(function(u){return o&&e._entityCollection.removeAll(),u!==null&&s(e,t,t,u,n),Promise.all(e._promises).then(function(){return e._promises.length=0,Kr.setLoading(e,!1),e})})}var T0=x0;function nrt(e){if(typeof e=="string"){let t=document.getElementById(e);if(t===null)throw new E(`Element with id "${e}" does not exist in the document.`);e=t}return e}var In=nrt;var Hye=Zo(fX(),1);var Gye;typeof DOMParser<"u"&&(Gye=new DOMParser);var Qst=new Hye.default({stripPrefix:!1,email:!1,replaceFn:function(e,t){return t.urlMatchType==="scheme"||t.urlMatchType==="www"}}),J8=32,Lye=2414016,Nye=1,Fye=16093e3,Bye=.1,Jst=[null,void 0,"http://www.topografix.com/GPX/1/1"],Do={gpx:Jst};function eat(e){return new Promise((t,n)=>{let i=new FileReader;i.addEventListener("load",function(){t(i.result)}),i.addEventListener("error",function(){n(i.error)}),i.readAsText(e)})}function dX(e,t){let n=FF(e,"id");return n=c(n)?n:jn(),t.getOrCreateEntity(n)}function hX(e){let t=kye(e,"lon"),n=kye(e,"lat"),i=LF(e,"ele",Do.gpx);return d.fromDegrees(t,n,i)}function kye(e,t){if(!c(e))return;let n=e.getAttribute(t);if(n!==null){let i=parseFloat(n);return isNaN(i)?void 0:i}}function FF(e,t){if(!c(e))return;let n=e.getAttribute(t);return n!==null?n:void 0}function A0(e,t,n){if(!c(e))return;let i=e.childNodes,o=i.length;for(let r=0;r<o;r++){let s=i[r];if(s.localName===t&&n.indexOf(s.namespaceURI)!==-1)return s}}function mX(e,t,n){if(!c(e))return;let i=[],o=e.getElementsByTagName(t),r=o.length;for(let s=0;s<r;s++){let a=o[s];a.localName===t&&n.indexOf(a.namespaceURI)!==-1&&i.push(a)}return i}function LF(e,t,n){let i=A0(e,t,n);if(c(i)){let o=parseFloat(i.textContent);return isNaN(o)?void 0:o}}function tu(e,t,n){let i=A0(e,t,n);if(c(i))return i.textContent.trim()}function jye(e){let t=new fc;return t.width=J8,t.height=J8,t.scaleByDistance=new Bt(Lye,Nye,Fye,Bye),t.pixelOffsetScaleByDistance=new Bt(Lye,Nye,Fye,Bye),t.verticalOrigin=new Kn(Fn.BOTTOM),t.image=e,t}function tat(){let e=new Hd;return e.translucencyByDistance=new Bt(3e6,1,5e6,0),e.pixelOffset=new H(17,0),e.horizontalOrigin=bi.LEFT,e.font="16px sans-serif",e.style=Yo.FILL_AND_OUTLINE,e}function Wye(e){let t=new mc;return t.width=4,t.material=new e0,t.material.color=c(e)?e:G.RED,t.material.outlineWidth=2,t.material.outlineColor=G.BLACK,t}var Uye={time:{text:"Time",tag:"time"},comment:{text:"Comment",tag:"cmt"},description:{text:"Description",tag:"desc"},source:{text:"Source",tag:"src"},number:{text:"GPS track/route number",tag:"number"},type:{text:"Type",tag:"type"}},NF;typeof document<"u"&&(NF=document.createElement("div"));function pX(e,t){let n,i="",o=Object.keys(Uye),r=o.length;for(n=0;n<r;n++){let f=o[n],h=Uye[f];h.value=tu(e,h.tag,Do.gpx)??"",c(h.value)&&h.value!==""&&(i=`${i}<p>${h.text}: ${h.value}</p>`)}if(!c(i)||i==="")return;i=Qst.link(i),NF.innerHTML=i;let s=NF.querySelectorAll("a");for(n=0;n<s.length;n++)s[n].setAttribute("target","_blank");let a=G.WHITE,l=G.BLACK,u='<div class="cesium-infoBox-description-lighter" style="';return u+="overflow:auto;",u+="word-wrap:break-word;",u+=`background-color:${a.toCssColorString()};`,u+=`color:${l.toCssColorString()};`,u+='">',u+=`${NF.innerHTML}</div>`,NF.innerHTML="",u}function qye(e,t,n,i){let o=hX(t),r=dX(t,n);r.position=o;let s=c(i.waypointImage)?i.waypointImage:e._pinBuilder.fromMakiIconId("marker",G.RED,J8);r.billboard=jye(s);let a=tu(t,"name",Do.gpx);r.name=a,r.label=tat(),r.label.text=a,r.description=pX(t,r),i.clampToGround&&(r.billboard.heightReference=We.CLAMP_TO_GROUND,r.label.heightReference=We.CLAMP_TO_GROUND)}function nat(e,t,n,i){let o=dX(t,n);o.description=pX(t,o);let r=mX(t,"rtept",Do.gpx),s=new Array(r.length);for(let a=0;a<r.length;a++)qye(e,r[a],n,i),s[a]=hX(r[a]);o.polyline=Wye(i.routeColor),i.clampToGround&&(o.polyline.clampToGround=!0),o.polyline.positions=s}function iat(e,t,n,i){let o=dX(t,n);o.description=pX(t,o);let r=mX(t,"trkseg",Do.gpx),s=[],a=[],l,u=!0,f=new Ta;for(let h=0;h<r.length;h++)l=oat(r[h]),s=s.concat(l.positions),l.times.length>0?(a=a.concat(l.times),f.addSamples(a,s),u=u&&!0):u=!1;if(u){let h=c(i.waypointImage)?i.waypointImage:e._pinBuilder.fromMakiIconId("marker",G.RED,J8);o.billboard=jye(h),o.position=f,i.clampToGround&&(o.billboard.heightReference=We.CLAMP_TO_GROUND),o.availability=new Xr,o.availability.addInterval(new En({start:a[0],stop:a[a.length-1]}))}o.polyline=Wye(i.trackColor),o.polyline.positions=s,i.clampToGround&&(o.polyline.clampToGround=!0)}function oat(e){let t={positions:[],times:[]},n=mX(e,"trkpt",Do.gpx),i;for(let o=0;o<n.length;o++){let r=hX(n[o]);t.positions.push(r),i=tu(n[o],"time",Do.gpx),c(i)&&t.times.push(Q.fromIso8601(i))}return t}function rat(e){let t=A0(e,"metadata",Do.gpx);if(c(t)){let n={name:tu(t,"name",Do.gpx),desc:tu(t,"desc",Do.gpx),author:sat(t),copyright:cat(t),link:Yye(t),time:tu(t,"time",Do.gpx),keywords:tu(t,"keywords",Do.gpx),bounds:lat(t)};if(c(n.name)||c(n.desc)||c(n.author)||c(n.copyright)||c(n.link)||c(n.time)||c(n.keywords)||c(n.bounds))return n}}function sat(e){let t=A0(e,"author",Do.gpx);if(c(t)){let n={name:tu(t,"name",Do.gpx),email:aat(t),link:Yye(t)};if(c(n.name)||c(n.email)||c(n.link))return n}}function aat(e){let t=A0(e,"email",Do.gpx);if(c(t)){let n=tu(t,"id",Do.gpx),i=tu(t,"domain",Do.gpx);return`${n}@${i}`}}function Yye(e){let t=A0(e,"link",Do.gpx);if(c(t)){let n={href:FF(t,"href"),text:tu(t,"text",Do.gpx),mimeType:tu(t,"type",Do.gpx)};if(c(n.href)||c(n.text)||c(n.mimeType))return n}}function cat(e){let t=A0(e,"copyright",Do.gpx);if(c(t)){let n={author:FF(t,"author"),year:tu(t,"year",Do.gpx),license:tu(t,"license",Do.gpx)};if(c(n.author)||c(n.year)||c(n.license))return n}}function lat(e){let t=A0(e,"bounds",Do.gpx);if(c(t)){let n={minLat:LF(t,"minlat",Do.gpx),maxLat:LF(t,"maxlat",Do.gpx),minLon:LF(t,"minlon",Do.gpx),maxLon:LF(t,"maxlon",Do.gpx)};if(c(n.minLat)||c(n.maxLat)||c(n.minLon)||c(n.maxLon))return n}}var Vye={wpt:qye,rte:nat,trk:iat};function uat(e,t,n,i){let o=Object.keys(Vye),r=o.length;for(let s=0;s<r;s++){let a=o[s],l=Vye[a],u=t.childNodes,f=u.length;for(let h=0;h<f;h++){let p=u[h];p.localName===a&&Do.gpx.indexOf(p.namespaceURI)!==-1&&l(e,p,n,i)}}}function zye(e,t,n){let i=e._entityCollection;i.removeAll();let o=t.documentElement,r=FF(o,"version"),s=FF(o,"creator"),a,l=rat(o);c(l)&&(a=l.name),o.localName==="gpx"?uat(e,o,i,n):console.log(`GPX - Unsupported node: ${o.localName}`);let u,f=i.computeAvailability(),h=f.start,p=f.stop,g=Q.equals(h,Ge.MINIMUM_VALUE),m=Q.equals(p,Ge.MAXIMUM_VALUE);if(!g||!m){let b;g&&(b=new Date,b.setHours(0,0,0,0),h=Q.fromDate(b)),m&&(b=new Date,b.setHours(24,0,0,0),p=Q.fromDate(b)),u=new Ch,u.startTime=h,u.stopTime=p,u.currentTime=Q.clone(h),u.clockRange=$r.LOOP_STOP,u.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,u.multiplier=Math.round(Math.min(Math.max(Q.secondsDifference(p,h)/60,1),31556900))}let y=!1;return e._name!==a&&(e._name=a,y=!0),e._creator!==s&&(e._creator=s,y=!0),fat(e._metadata,l)&&(e._metadata=l,y=!0),e._version!==r&&(e._version=r,y=!0),u!==e._clock&&(y=!0,e._clock=u),y&&e._changed.raiseEvent(e),Kr.setLoading(e,!1),e}function fat(e,t){return!c(e)&&!c(t)?!1:c(e)&&c(t)?e.name!==t.name||e.dec!==t.desc||e.src!==t.src||e.author!==t.author||e.copyright!==t.copyright||e.link!==t.link||e.time!==t.time||e.bounds!==t.bounds:!0}function dat(e,t,n,i){i=i??W.EMPTY_OBJECT;let o=n;if(typeof n=="string"||n instanceof we){n=we.createIfNeeded(n),o=n.fetchBlob();let r=e._resourceCredits,s=n.credits;if(c(s)){let a=s.length;for(let l=0;l<a;l++)r.push(s[l])}}return Promise.resolve(o).then(function(r){return r instanceof Blob?eat(r).then(function(s){let a,l;try{a=Gye.parseFromString(s,"application/xml")}catch(u){l=u.toString()}if(c(l)||a.body||a.documentElement.tagName==="parsererror"){let u=c(l)?l:a.documentElement.firstChild.nodeValue;throw u||(u=a.body.innerText),new ae(u)}return zye(e,a,i)}):zye(e,r,i)}).catch(function(r){return e._error.raiseEvent(e,r),console.log(r),Promise.reject(r)})}function $S(){this._changed=new pe,this._error=new pe,this._loading=new pe,this._clock=void 0,this._entityCollection=new Qs(this),this._entityCluster=new Bu,this._name=void 0,this._version=void 0,this._creator=void 0,this._metadata=void 0,this._isLoading=!1,this._pinBuilder=new ag}$S.load=function(e,t){return new $S().load(e,t)};Object.defineProperties($S.prototype,{name:{get:function(){return this._name}},version:{get:function(){return this._version}},creator:{get:function(){return this._creator}},metadata:{get:function(){return this._metadata}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}}});$S.prototype.update=function(e){return!0};$S.prototype.load=function(e,t){if(!c(e))throw new E("data is required.");t=t??W.EMPTY_OBJECT,Kr.setLoading(this,!0);let n=this._name,i=this;return dat(this,this._entityCollection,e,t).then(function(){let o,r=i._entityCollection.computeAvailability(),s=r.start,a=r.stop,l=Q.equals(s,Ge.MINIMUM_VALUE),u=Q.equals(a,Ge.MAXIMUM_VALUE);if(!l||!u){let h;l&&(h=new Date,h.setHours(0,0,0,0),s=Q.fromDate(h)),u&&(h=new Date,h.setHours(24,0,0,0),a=Q.fromDate(h)),o=new Ch,o.startTime=s,o.stopTime=a,o.currentTime=Q.clone(s),o.clockRange=$r.LOOP_STOP,o.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,o.multiplier=Math.round(Math.min(Math.max(Q.secondsDifference(a,s)/60,1),31556900))}let f=!1;return o!==i._clock&&(i._clock=o,f=!0),n!==i._name&&(f=!0),f&&i._changed.raiseEvent(i),Kr.setLoading(i,!1),i}).catch(function(o){return Kr.setLoading(i,!1),i._error.raiseEvent(i,o),console.log(o),Promise.reject(o)})};var BF=$S;function hat(e,t){this.position=e,this.headingPitchRoll=t}var kF=hat;var a0e=Zo(fX(),1),jF=Zo(du(),1);function mat(e,t){this.position=e,this.headingPitchRange=t}var UF=mat;function eH(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new pe,this.tourEnd=new pe,this.entryStart=new pe,this.entryEnd=new pe,this._activeEntries=[]}eH.prototype.addPlaylistEntry=function(e){this.playlist.push(e)};eH.prototype.play=function(e,t){this.tourStart.raiseEvent();let n=this;Kye.call(this,e,t,function(i){n.playlistIndex=0,i||Xye(n._activeEntries),n.tourEnd.raiseEvent(i)})};eH.prototype.stop=function(){Xye(this._activeEntries)};function Xye(e){for(let t=e.pop();t!==void 0;t=e.pop())t.stop()}function Kye(e,t,n){let i=this.playlist[this.playlistIndex];if(i){let o=pat.bind(this,e,t,n);if(this._activeEntries.push(i),this.entryStart.raiseEvent(i),i.blocking)i.play(o,e.scene.camera,t);else{let r=this;i.play(function(){r.entryEnd.raiseEvent(i);let s=r._activeEntries.indexOf(i);s>=0&&r._activeEntries.splice(s,1)}),o(e,t,n)}}else c(n)&&n(!1)}function pat(e,t,n,i){let o=this.playlist[this.playlistIndex];if(this.entryEnd.raiseEvent(o,i),i)n(i);else{let r=this._activeEntries.indexOf(o);r>=0&&this._activeEntries.splice(r,1),this.playlistIndex++,Kye.call(this,e,t,n)}}var VF=eH;var ki=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ki.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?ki.Bounce.In(e*2)*.5:ki.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),zF=function(){return performance.now()},_at=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];for(var o=0,r=n;o<r.length;o++){var s=r[o];(t=s._group)===null||t===void 0||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++){var r=o[i];r._group=void 0,delete this._tweens[r.getId()],delete this._tweensAddedDuringUpdate[r.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=zF()),n===void 0&&(n=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var r=this._tweens[i[o]],s=!n;r&&r.update(t,s)===!1&&!n&&this.remove(r)}i=Object.keys(this._tweensAddedDuringUpdate)}},e}(),ZS={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=ZS.Utils.Linear;return t<0?r(e[0],e[1],i):t>1?r(e[n],e[n-1],n-i):r(e[o],e[o+1>n?n:o+1],i-o)},Bezier:function(e,t){for(var n=0,i=e.length-1,o=Math.pow,r=ZS.Utils.Bernstein,s=0;s<=i;s++)n+=o(1-t,i-s)*o(t,s)*e[s]*r(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=ZS.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(i=n*(1+t))),r(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],i-o)):t<0?e[0]-(r(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(r(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):r(e[o?o-1:0],e[o],e[n<o+1?n:o+1],e[n<o+2?n:o+2],i-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=ZS.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var i=t;i>1;i--)n*=i;return e[t]=n,n}}(),CatmullRom:function(e,t,n,i,o){var r=(n-e)*.5,s=(i-t)*.5,a=o*o,l=o*a;return(2*t-2*n+r+s)*l+(-3*t+3*n-2*r-s)*a+r*o+t}}},$ye=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),_X=new _at,Zye=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ki.Linear.None,this._interpolationFunction=ZS.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=$ye.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=_X,_X.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=zF()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var r in this._valuesEnd)o[r]=this._valuesEnd[r];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,i,o,r){for(var s in i){var a=t[s],l=Array.isArray(a),u=l?"array":typeof a,f=!l&&Array.isArray(i[s]);if(!(u==="undefined"||u==="function")){if(f){var h=i[s];if(h.length===0)continue;for(var p=[a],g=0,m=h.length;g<m;g+=1){var y=this._handleRelativeValue(a,h[g]);if(isNaN(y)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(y)}f&&(i[s]=p)}if((u==="object"||l)&&a&&!f){n[s]=l?[]:{};var b=a;for(var x in b)n[s][x]=b[x];o[s]=l?[]:{};var h=i[s];if(!this._isDynamic){var A={};for(var x in h)A[x]=h[x];i[s]=h=A}this._setupProperties(b,n[s],h,o[s],r)}else(typeof n[s]>"u"||r)&&(n[s]=a),l||(n[s]*=1),f?o[s]=i[s].slice().reverse():o[s]=n[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=zF()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=zF()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=ki.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=ZS.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var i=this,o;if(t===void 0&&(t=zF()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var r;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=t-this._startTime,a=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*a,u=function(){if(i._duration===0||s>l)return 1;var y=Math.trunc(s/a),b=s-y*a,x=Math.min(b/i._duration,1);return x===0&&s===i._duration?1:x},f=u(),h=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,h),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||s>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((s-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(r in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[r]=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,m=this._chainedTweens.length;g<m;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,i,o){for(var r in i)if(n[r]!==void 0){var s=n[r]||0,a=i[r],l=Array.isArray(t[r]),u=Array.isArray(a),f=!l&&u;f?t[r]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[r],s,a,o):(a=this._handleRelativeValue(s,a),typeof a=="number"&&(t[r]=s+(a-s)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();var Yli=$ye.nextId,Qm=_X,Xli=Qm.getAll.bind(Qm),Kli=Qm.removeAll.bind(Qm),$li=Qm.add.bind(Qm),Zli=Qm.remove.bind(Qm),Qli=Qm.update.bind(Qm);var gat={LINEAR_NONE:ki.Linear.None,QUADRATIC_IN:ki.Quadratic.In,QUADRATIC_OUT:ki.Quadratic.Out,QUADRATIC_IN_OUT:ki.Quadratic.InOut,CUBIC_IN:ki.Cubic.In,CUBIC_OUT:ki.Cubic.Out,CUBIC_IN_OUT:ki.Cubic.InOut,QUARTIC_IN:ki.Quartic.In,QUARTIC_OUT:ki.Quartic.Out,QUARTIC_IN_OUT:ki.Quartic.InOut,QUINTIC_IN:ki.Quintic.In,QUINTIC_OUT:ki.Quintic.Out,QUINTIC_IN_OUT:ki.Quintic.InOut,SINUSOIDAL_IN:ki.Sinusoidal.In,SINUSOIDAL_OUT:ki.Sinusoidal.Out,SINUSOIDAL_IN_OUT:ki.Sinusoidal.InOut,EXPONENTIAL_IN:ki.Exponential.In,EXPONENTIAL_OUT:ki.Exponential.Out,EXPONENTIAL_IN_OUT:ki.Exponential.InOut,CIRCULAR_IN:ki.Circular.In,CIRCULAR_OUT:ki.Circular.Out,CIRCULAR_IN_OUT:ki.Circular.InOut,ELASTIC_IN:ki.Elastic.In,ELASTIC_OUT:ki.Elastic.Out,ELASTIC_IN_OUT:ki.Elastic.InOut,BACK_IN:ki.Back.In,BACK_OUT:ki.Back.Out,BACK_IN_OUT:ki.Back.InOut,BOUNCE_IN:ki.Bounce.In,BOUNCE_OUT:ki.Bounce.Out,BOUNCE_IN_OUT:ki.Bounce.InOut},Qr=Object.freeze(gat);function tH(e,t,n){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=n,this.flyToMode=t}tH.prototype.play=function(e,t,n){if(this.activeCamera=t,c(e)&&e!==null){let o=this;this.activeCallback=function(r){delete o.activeCallback,delete o.activeCamera,e(c(r)?!1:r)}}let i=this.getCameraOptions(n);if(this.view.headingPitchRoll)t.flyTo(i);else if(this.view.headingPitchRange){let o=new le(this.view.position);t.flyToBoundingSphere(o,i)}};tH.prototype.stop=function(){c(this.activeCamera)&&this.activeCamera.cancelFlight(),c(this.activeCallback)&&this.activeCallback(!0)};tH.prototype.getCameraOptions=function(e){let t={duration:this.duration};return c(this.activeCallback)&&(t.complete=this.activeCallback),this.flyToMode==="smooth"&&(t.easingFunction=Qr.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),c(e)&&(t=xt(t,e)),t};var HF=tH;function gX(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}gX.prototype.play=function(e){let t=this;this.activeCallback=e,this.timeout=setTimeout(function(){delete t.activeCallback,e(!1)},this.duration*1e3)};gX.prototype.stop=function(){clearTimeout(this.timeout),c(this.activeCallback)&&this.activeCallback(!0)};var GF=gX;var c0e={avi:"video/x-msvideo",bmp:"image/bmp",bz2:"application/x-bzip2",chm:"application/vnd.ms-htmlhelp",css:"text/css",csv:"text/csv",doc:"application/msword",dvi:"application/x-dvi",eps:"application/postscript",flv:"video/x-flv",gif:"image/gif",gz:"application/x-gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",jnlp:"application/x-java-jnlp-file",jpeg:"image/jpeg",jpg:"image/jpeg",m3u:"audio/x-mpegurl",m4v:"video/mp4",mathml:"application/mathml+xml",mid:"audio/midi",midi:"audio/midi",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",mp4v:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",ogg:"application/ogg",pdf:"application/pdf",png:"image/png",pps:"application/vnd.ms-powerpoint",ppt:"application/vnd.ms-powerpoint",ps:"application/postscript",qt:"video/quicktime",rdf:"application/rdf+xml",rss:"application/rss+xml",rtf:"application/rtf",svg:"image/svg+xml",swf:"application/x-shockwave-flash",text:"text/plain",tif:"image/tiff",tiff:"image/tiff",txt:"text/plain",wav:"audio/x-wav",wma:"audio/x-ms-wma",wmv:"video/x-ms-wmv",xml:"application/xml",zip:"application/zip",detectFromFilename:function(e){let t=e.toLowerCase();return t=rb(t),c0e[t]}},EX;typeof DOMParser<"u"&&(EX=new DOMParser);var yat=new a0e.default({stripPrefix:!1,email:!1,replaceFn:function(e){return e.urlMatchType==="scheme"||e.urlMatchType==="www"}}),C0=32,Qye=2414016,Jye=1,e0e=16093e3,t0e=.1,n0e=[null,void 0,"http://www.opengis.net/kml/2.2","http://earth.google.com/kml/2.2","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.0"],i0e=["http://www.google.com/kml/ext/2.2"],bat=["http://www.w3.org/2005/Atom"],Re={kml:n0e,gx:i0e,atom:bat,kmlgx:n0e.concat(i0e)},SX={Document:y0e,Folder:kat,Placemark:Uat,NetworkLink:Xat,GroundOverlay:Wat,PhotoOverlay:T0e,ScreenOverlay:jat,Tour:zat};function Jm(e){this._dataSource=e,this._deferred=Dl(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}Object.defineProperties(Jm.prototype,{dataSource:{get:function(){return this._dataSource}}});Jm.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0};Jm.prototype.addPromise=function(e){this._promises.push(e)};Jm.prototype.wait=function(){let e=this._deferred;return this._used||e.resolve(),Promise.all([e.promise,Promise.all(this._promises)])};Jm.prototype.process=function(){let e=this._stack.length===1;return e&&(this._started=$u._getTimestamp()),this._process(e)};Jm.prototype._giveUpTime=function(){if(this._timeoutSet)return;this._timeoutSet=!0,this._timeThreshold=50;let e=this;setTimeout(function(){e._timeoutSet=!1,e._started=$u._getTimestamp(),e._process(!0)},0)};Jm.prototype._nextNode=function(){let e=this._stack,t=e[e.length-1],n=t.index,i=t.nodes;if(n!==i.length)return++t.index,i[n]};Jm.prototype._pop=function(){let e=this._stack;return e.pop(),e.length===0?(this._deferred.resolve(),!1):!0};Jm.prototype._process=function(e){let t=this.dataSource,n=this._stack[this._stack.length-1].processingData,i=this._nextNode();for(;c(i);){let o=SX[i.localName];if(c(o)&&(Re.kml.indexOf(i.namespaceURI)!==-1||Re.gx.indexOf(i.namespaceURI)!==-1)&&(o(t,i,n,this),this._timeoutSet||$u._getTimestamp()>this._started+this._timeThreshold)){this._giveUpTime();return}i=this._nextNode()}this._pop()&&e&&this._process(!0)};function xat(e){let t=e.slice(0,Math.min(4,e.size)),n=Dl(),i=new FileReader;return i.addEventListener("load",function(){n.resolve(new DataView(i.result).getUint32(0,!1)===1347093252)}),i.addEventListener("error",function(){n.reject(i.error)}),i.readAsArrayBuffer(t),n.promise}function Tat(e){let t=Dl(),n=new FileReader;return n.addEventListener("load",function(){t.resolve(n.result)}),n.addEventListener("error",function(){t.reject(n.error)}),n.readAsText(e),t.promise}function l0e(e){let t={xsi:"http://www.w3.org/2001/XMLSchema-instance"},n,i,o,r;for(let s in t)t.hasOwnProperty(s)&&(o=RegExp(`[< ]${s}:`),r=`xmlns:${s}=`,o.test(e)&&e.indexOf(r)===-1&&(c(n)||(n=e.substr(0,e.indexOf("<kml")+4),i=e.substr(n.length)),n+=` ${r}"${t[s]}"`));return c(n)&&(e=n+i),e}function u0e(e){let t=e.indexOf("xmlns:"),n=e.indexOf(">",t),i,o,r;for(;t!==-1&&t<n;)i=e.slice(t,e.indexOf('"',t)),o=t,t=e.indexOf(i,t+1),t!==-1?(r=e.indexOf('"',e.indexOf('"',t)+1),e=e.slice(0,t-1)+e.slice(r+1,e.length),t=e.indexOf("xmlns:",o-1)):t=e.indexOf("xmlns:",o+1);return e}function Aat(e,t){return Promise.resolve(e.getData(new u8)).then(function(n){n=l0e(n),n=u0e(n),t.kml=EX.parseFromString(n,"application/xml")})}function yX(e,t){let n=c0e.detectFromFilename(e.filename)??"application/octet-stream";return Promise.resolve(e.getData(new c8(n))).then(function(i){t[e.filename]=i})}function Xu(e,t,n,i){let o=i.keys,r=new jF.default("."),s=e.querySelectorAll(t);for(let a=0;a<s.length;a++){let l=s[a],u=l.getAttribute(n);if(c(u)){let h=new jF.default(u).absoluteTo(r).toString(),p=o.indexOf(h);if(p!==-1){let g=o[p];l.setAttribute(n,i[g]),t==="a"&&l.getAttribute("download")===null&&l.setAttribute("download",g)}}}}function Ku(e,t,n,i){let o=e.querySelectorAll(t);for(let r=0;r<o.length;r++){let s=o[r],a=s.getAttribute(n),l=wX(a,i);c(l)&&s.setAttribute(n,l.url)}}function f0e(e,t,n){let i=Ns(e,"id");i=c(i)&&i.length!==0?i:jn(),c(n)&&(i=n+i);let o=t.getById(i);return c(o)&&(i=jn(),c(n)&&(i=n+i)),o=t.add(new nr({id:i})),c(o.kml)||(o.addProperty("kml"),o.kml=new Qat),o}function WF(e,t){return e==="absolute"||e==="relativeToGround"||t==="relativeToSeaFloor"}function rH(e,t){if(!c(e))return d.fromDegrees(0,0,0,t);let n=e.match(/[^\s,\n]+/g);if(!c(n))return d.fromDegrees(0,0,0,t);let i=parseFloat(n[0]),o=parseFloat(n[1]),r=parseFloat(n[2]);return i=isNaN(i)?0:i,o=isNaN(o)?0:o,r=isNaN(r)?0:r,d.fromDegrees(i,o,r,t)}function nH(e,t){if(!c(e))return;let n=e.textContent.match(/[^\s\n]+/g);if(!c(n))return;let i=n.length,o=new Array(i),r=0;for(let s=0;s<i;s++)o[r++]=rH(n[s],t);return o}function E0(e,t){if(!c(e))return;let n=e.getAttribute(t);if(n!==null){let i=parseFloat(n);return isNaN(i)?void 0:i}}function Ns(e,t){if(!c(e))return;let n=e.getAttribute(t);return n!==null?n:void 0}function Ui(e,t,n){if(!c(e))return;let i=e.childNodes,o=i.length;for(let r=0;r<o;r++){let s=i[r];if(s.localName===t&&n.indexOf(s.namespaceURI)!==-1)return s}}function o0e(e,t,n){if(!c(e))return;let i=[],o=e.getElementsByTagNameNS("*",t),r=o.length;for(let s=0;s<r;s++){let a=o[s];a.localName===t&&n.indexOf(a.namespaceURI)!==-1&&i.push(a)}return i}function Fh(e,t,n){if(!c(e))return[];let i=[],o=e.childNodes,r=o.length;for(let s=0;s<r;s++){let a=o[s];a.localName===t&&n.indexOf(a.namespaceURI)!==-1&&i.push(a)}return i}function Jn(e,t,n){let i=Ui(e,t,n);if(c(i)){let o=parseFloat(i.textContent);return isNaN(o)?void 0:o}}function On(e,t,n){let i=Ui(e,t,n);if(c(i))return i.textContent.trim()}function Bh(e,t,n){let i=Ui(e,t,n);if(c(i)){let o=i.textContent.trim();return o==="1"||/^true$/i.test(o)}}function wX(e,t,n){if(!c(e))return;let i;if(c(n)){e=e.replace(/\\/g,"/");let o=n[e];if(c(o))i=new we({url:o});else{let r=new jF.default(t.getUrlComponent()),s=new jF.default(e);o=n[s.absoluteTo(r)],c(o)&&(i=new we({url:o}))}}return c(i)||(i=t.getDerivedResource({url:e})),i}var nu={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function AX(e,t){if(!c(e)||/^\s*$/gm.test(e))return;e[0]==="#"&&(e=e.substring(1));let n=parseInt(e.substring(0,2),16)/255,i=parseInt(e.substring(2,4),16)/255,o=parseInt(e.substring(4,6),16)/255,r=parseInt(e.substring(6,8),16)/255;return t?(r>0?(nu.maximumRed=r,nu.red=void 0):(nu.maximumRed=void 0,nu.red=0),o>0?(nu.maximumGreen=o,nu.green=void 0):(nu.maximumGreen=void 0,nu.green=0),i>0?(nu.maximumBlue=i,nu.blue=void 0):(nu.maximumBlue=void 0,nu.blue=0),nu.alpha=n,G.fromRandom(nu)):new G(r,o,i,n)}function BT(e,t,n){let i=On(e,t,n);if(c(i))return AX(i,On(e,"colorMode",n)==="random")}function Cat(e){let t=Ui(e,"TimeStamp",Re.kmlgx),n=On(t,"when",Re.kmlgx);if(!c(t)||!c(n)||n.length===0)return;let i=Q.fromIso8601(n),o=new Xr;return o.addInterval(new En({start:i,stop:Ge.MAXIMUM_VALUE})),o}function Eat(e){let t=Ui(e,"TimeSpan",Re.kmlgx);if(!c(t))return;let n,i=Ui(t,"begin",Re.kmlgx),o=c(i)?Q.fromIso8601(i.textContent):void 0,r=Ui(t,"end",Re.kmlgx),s=c(r)?Q.fromIso8601(r.textContent):void 0;if(c(o)&&c(s)){if(Q.lessThan(s,o)){let a=o;o=s,s=a}n=new Xr,n.addInterval(new En({start:o,stop:s}))}else c(o)?(n=new Xr,n.addInterval(new En({start:o,stop:Ge.MAXIMUM_VALUE}))):c(s)&&(n=new Xr,n.addInterval(new En({start:Ge.MINIMUM_VALUE,stop:s})));return n}function d0e(){let e=new fc;return e.width=C0,e.height=C0,e.scaleByDistance=new Bt(Qye,Jye,e0e,t0e),e.pixelOffsetScaleByDistance=new Bt(Qye,Jye,e0e,t0e),e}function vX(){let e=new Gd;return e.outline=!0,e.outlineColor=G.WHITE,e}function h0e(){let e=new Hd;return e.translucencyByDistance=new Bt(3e6,1,5e6,0),e.pixelOffset=new H(17,0),e.horizontalOrigin=bi.LEFT,e.font="16px sans-serif",e.style=Yo.FILL_AND_OUTLINE,e}function DX(e,t,n,i,o){let r=On(e,"href",Re.kml);if(!c(r)||r.length===0)return;if(r.indexOf("root://icons/palette-")===0){let a=r.charAt(21),l=Jn(e,"x",Re.gx)??0,u=Jn(e,"y",Re.gx)??0;l=Math.min(l/32,7),u=7-Math.min(u/32,7);let f=8*u+l;r=`https://maps.google.com/mapfiles/kml/pal${a}/icon${f}.png`}let s=wX(r,n,i);if(o){let a=On(e,"refreshMode",Re.kml),l=On(e,"viewRefreshMode",Re.kml);a==="onInterval"||a==="onExpire"?dt(`kml-refreshMode-${a}`,`KML - Unsupported Icon refreshMode: ${a}`):(l==="onStop"||l==="onRegion")&&dt(`kml-refreshMode-${l}`,`KML - Unsupported Icon viewRefreshMode: ${l}`);let u=On(e,"viewBoundScale",Re.kml)??1,f=l==="onStop"?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",h=On(e,"viewFormat",Re.kml)??f,p=On(e,"httpQuery",Re.kml);c(h)&&s.setQueryParameters(hu(oH(h))),c(p)&&s.setQueryParameters(hu(oH(p)));let g=t._ellipsoid;return IX(s,t.camera,t.canvas,u,t._lastCameraView.bbox,g),s}return s}function Sat(e,t,n,i,o){let r=Jn(t,"scale",Re.kml),s=Jn(t,"heading",Re.kml),a=BT(t,"color",Re.kml),l=Ui(t,"Icon",Re.kml),u=DX(l,e,i,o,!1);c(l)&&!c(u)&&(u=!1);let f=Jn(l,"x",Re.gx),h=Jn(l,"y",Re.gx),p=Jn(l,"w",Re.gx),g=Jn(l,"h",Re.gx),m=Ui(t,"hotSpot",Re.kml),y=E0(m,"x"),b=E0(m,"y"),x=Ns(m,"xunits"),A=Ns(m,"yunits"),C=n.billboard;c(C)||(C=d0e(),n.billboard=C),C.image=u,C.scale=r,C.color=a,(c(f)||c(h)||c(p)||c(g))&&(C.imageSubRegion=new Ke(f,h,p,g)),c(s)&&s!==0&&(C.rotation=O.toRadians(-s),C.alignedAxis=d.UNIT_Z),r=r??1;let S,v;c(y)&&(x==="pixels"?S=-y*r:x==="insetPixels"?S=(y-C0)*r:x==="fraction"&&(S=-y*C0*r),S+=C0*.5*r),c(b)&&(A==="pixels"?v=b*r:A==="insetPixels"?v=(-b+C0)*r:A==="fraction"&&(v=b*C0*r),v-=C0*.5*r),(c(S)||c(v))&&(C.pixelOffset=new H(S,v))}function iH(e,t,n,i,o){for(let r=0,s=t.childNodes.length;r<s;r++){let a=t.childNodes.item(r);if(a.localName==="IconStyle")Sat(e,a,n,i,o);else if(a.localName==="LabelStyle"){let l=n.label;c(l)||(l=h0e(),n.label=l),l.scale=Jn(a,"scale",Re.kml)??l.scale,l.fillColor=BT(a,"color",Re.kml)??l.fillColor,l.text=n.name}else if(a.localName==="LineStyle"){let l=n.polyline;c(l)||(l=new mc,n.polyline=l),l.width=Jn(a,"width",Re.kml),l.material=BT(a,"color",Re.kml),c(BT(a,"outerColor",Re.gx))&&dt("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),c(Jn(a,"outerWidth",Re.gx))&&dt("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),c(Jn(a,"physicalWidth",Re.gx))&&dt("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),c(Bh(a,"labelVisibility",Re.gx))&&dt("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if(a.localName==="PolyStyle"){let l=n.polygon;c(l)||(l=vX(),n.polygon=l),l.material=BT(a,"color",Re.kml)??l.material,l.fill=Bh(a,"fill",Re.kml)??l.fill,l.outline=Bh(a,"outline",Re.kml)??l.outline}else if(a.localName==="BalloonStyle"){let l=AX(On(a,"bgColor",Re.kml))??G.WHITE,u=AX(On(a,"textColor",Re.kml))??G.BLACK,f=On(a,"text",Re.kml);n.addProperty("balloonStyle"),n.balloonStyle={bgColor:l,textColor:u,text:f}}else if(a.localName==="ListStyle"){let l=On(a,"listItemType",Re.kml);(l==="radioFolder"||l==="checkOffOnly")&&dt(`kml-listStyle-${l}`,`KML - Unsupported ListStyle with listItemType: ${l}`)}}}function wat(e,t,n,i,o){let r=new nr,s,a=-1,l=t.childNodes,u=l.length;for(let h=0;h<u;h++){let p=l[h];(p.localName==="Style"||p.localName==="StyleMap")&&(a=h)}if(a!==-1){let h=l[a];if(h.localName==="Style")iH(e,h,r,i,o);else{let p=Fh(h,"Pair",Re.kml);for(let g=0;g<p.length;g++){let m=p[g],y=On(m,"key",Re.kml);if(y==="normal"){let b=On(m,"styleUrl",Re.kml);if(c(b))s=n.getById(b),c(s)||(s=n.getById(`#${b}`)),c(s)&&r.merge(s);else{let x=Ui(m,"Style",Re.kml);iH(e,x,r,i,o)}}else dt(`kml-styleMap-${y}`,`KML - Unsupported StyleMap key: ${y}`)}}}let f=On(t,"styleUrl",Re.kml);if(c(f)){let h=f;if(f[0]!=="#"&&f.indexOf("#")!==-1){let p=f.split("#"),g=p[0];h=`${i.getDerivedResource({url:g}).getUrlComponent()}#${p[1]}`}s=n.getById(h),c(s)||(s=n.getById(`#${h}`)),c(s)&&r.merge(s)}return r}function vat(e,t,n){return t.fetchXML().then(function(i){return m0e(e,i,n,t,!0)})}function m0e(e,t,n,i,o,r){let s,a,l,u,f=o0e(t,"Style",Re.kml);if(c(f)){let y=f.length;for(s=0;s<y;s++)u=f[s],a=Ns(u,"id"),c(a)&&(a=`#${a}`,o&&c(i)&&(a=i.getUrlComponent()+a),c(n.getById(a))||(l=new nr({id:a}),n.add(l),iH(e,u,l,i,r)))}let h=o0e(t,"StyleMap",Re.kml);if(c(h)){let y=h.length;for(s=0;s<y;s++){let b=h[s];if(a=Ns(b,"id"),c(a)){let x=Fh(b,"Pair",Re.kml);for(let A=0;A<x.length;A++){let C=x[A],S=On(C,"key",Re.kml);if(S==="normal"){if(a=`#${a}`,o&&c(i)&&(a=i.getUrlComponent()+a),!c(n.getById(a))){l=n.getOrCreateEntity(a);let v=On(C,"styleUrl",Re.kml);if(c(v)){v[0]!=="#"&&(v=`#${v}`),o&&c(i)&&(v=i.getUrlComponent()+v);let P=n.getById(v);c(P)&&l.merge(P)}else u=Ui(C,"Style",Re.kml),iH(e,u,l,i,r)}}else dt(`kml-styleMap-${S}`,`KML - Unsupported StyleMap key: ${S}`)}}}}let p=[],g=t.getElementsByTagName("styleUrl"),m=g.length;for(s=0;s<m;s++){let y=g[s].textContent;if(y[0]!=="#"){let b=y.split("#");if(b.length===2){let x=b[0],A=i.getDerivedResource({url:x});p.push(vat(e,A,n))}}}return p}function PX(e,t,n){let i=new Y_(e,t.id,["position"]),o=new zm(t.position);t.polyline=c(n.polyline)?n.polyline.clone():new mc,t.polyline.positions=new q_([i,o])}function p0e(e,t){return!c(e)&&!c(t)||e==="clampToGround"?We.CLAMP_TO_GROUND:e==="relativeToGround"?We.RELATIVE_TO_GROUND:e==="absolute"?We.NONE:t==="clampToSeaFloor"?(dt("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),We.CLAMP_TO_GROUND):t==="relativeToSeaFloor"?(dt("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),We.RELATIVE_TO_GROUND):(c(e)?dt("kml-altitudeMode-unknown",`KML - Unknown <kml:altitudeMode>:${e}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`):dt("kml-gx:altitudeMode-unknown",`KML - Unknown <gx:altitudeMode>:${t}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`),We.CLAMP_TO_GROUND)}function Dat(e,t,n){return n==="relativeToSeaFloor"||t==="absolute"||t==="relativeToGround"?e:((c(t)&&t!=="clampToGround"||c(n)&&n!=="clampToSeaFloor")&&dt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${t??n}`),new zm(e))}function Pat(e,t,n,i){if(!c(e))return;if(n==="relativeToSeaFloor"||t==="absolute"||t==="relativeToGround")return e;(c(t)&&t!=="clampToGround"||c(n)&&n!=="clampToSeaFloor")&&dt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${t??n}`);let o=e.length;for(let r=0;r<o;r++){let s=e[r];i.scaleToGeodeticSurface(s,s)}return e}function sH(e,t,n,i){let o=t.label;c(o)||(o=c(n.label)?n.label.clone():h0e(),t.label=o),o.text=t.name;let r=t.billboard;c(r)||(r=c(n.billboard)?n.billboard.clone():d0e(),t.billboard=r),c(r.image)?r.image.getValue()||(r.image=void 0):r.image=e._pinBuilder.fromColor(G.YELLOW,64);let s=1;c(r.scale)&&(s=r.scale.getValue(),s!==0?o.pixelOffset=new H(s*16+1,0):(o.pixelOffset=void 0,o.horizontalOrigin=void 0)),c(i)&&e._clampToGround&&(r.heightReference=i,o.heightReference=i)}function _0e(e,t){let n=e.path;c(n)||(n=new jp,n.leadTime=0,e.path=n);let i=t.polyline;c(i)&&(n.material=i.material,n.width=i.width)}function Iat(e,t,n,i,o){let r=On(n,"coordinates",Re.kml),s=On(n,"altitudeMode",Re.kml),a=On(n,"altitudeMode",Re.gx),l=Bh(n,"extrude",Re.kml),u=e._ellipsoid,f=rH(r,u);return i.position=f,sH(e,i,o,p0e(s,a)),l&&WF(s,a)&&PX(t,i,o),!0}function r0e(e,t,n,i,o){let r=Ui(n,"coordinates",Re.kml),s=On(n,"altitudeMode",Re.kml),a=On(n,"altitudeMode",Re.gx),l=Bh(n,"extrude",Re.kml),u=Bh(n,"tessellate",Re.kml),f=WF(s,a),h=Jn(n,"drawOrder",Re.gx),p=e._ellipsoid,g=nH(r,p),m=o.polyline;if(f&&l){let y=new Wp;i.wall=y,y.positions=g;let b=o.polygon;c(b)&&(y.fill=b.fill,y.material=b.material),y.outline=!0,c(m)?(y.outlineColor=c(m.material)?m.material.color:G.WHITE,y.outlineWidth=m.width):c(b)&&(y.outlineColor=c(b.material)?b.material.color:G.WHITE)}else if(e._clampToGround&&!f&&u){let y=new mc;y.clampToGround=!0,i.polyline=y,y.positions=g,c(m)?(y.material=c(m.material)?m.material.color.getValue(Ge.MINIMUM_VALUE):G.WHITE,y.width=m.width??1):(y.material=G.WHITE,y.width=1),y.zIndex=h}else c(h)&&dt("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),e._clampToGround&&!u&&dt("kml-line-tesselate","Ignoring clampToGround for KML lines without the tessellate flag."),m=c(m)?m.clone():new mc,i.polyline=m,m.positions=Pat(g,s,a,p),(!u||f)&&(m.arcType=qt.NONE);return!0}function Oat(e,t,n,i,o){let r=Ui(n,"outerBoundaryIs",Re.kml),s=Ui(r,"LinearRing",Re.kml),a=Ui(s,"coordinates",Re.kml),l=e._ellipsoid,u=nH(a,l),f=Bh(n,"extrude",Re.kml),h=On(n,"altitudeMode",Re.kml),p=On(n,"altitudeMode",Re.gx),g=WF(h,p),m=c(o.polygon)?o.polygon.clone():vX(),y=o.polyline;if(c(y)&&(m.outlineColor=c(y.material)?y.material.color:G.WHITE,m.outlineWidth=y.width),i.polygon=m,g?(m.perPositionHeight=!0,m.extrudedHeight=f?0:void 0):e._clampToGround||(m.height=0),c(u)){let b=new ka(u),x=Fh(n,"innerBoundaryIs",Re.kml);for(let A=0;A<x.length;A++){s=Fh(x[A],"LinearRing",Re.kml);for(let C=0;C<s.length;C++)a=Ui(s[C],"coordinates",Re.kml),u=nH(a,l),c(u)&&b.holes.push(new ka(u))}m.hierarchy=b}return!0}function Rat(e,t,n,i,o){let r=On(n,"altitudeMode",Re.kml),s=On(n,"altitudeMode",Re.gx),a=Fh(n,"coord",Re.gx),l=Fh(n,"angles",Re.gx),u=Fh(n,"when",Re.kml),f=Bh(n,"extrude",Re.kml),h=WF(r,s),p=e._ellipsoid;l.length>0&&dt("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");let g=Math.min(a.length,u.length),m=[],y=[];for(let x=0;x<g;x++){let A=rH(a[x].textContent,p);m.push(A),y.push(Q.fromIso8601(u[x].textContent))}let b=new Ta;return b.addSamples(y,m),i.position=b,sH(e,i,o,p0e(r,s)),_0e(i,o),i.availability=new Xr,u.length>0&&i.availability.addInterval(new En({start:y[0],stop:y[y.length-1]})),h&&f&&PX(t,i,o),!0}function s0e(e,t,n,i,o,r,s,a,l){let u=e[0],f=e[e.length-1],h=new Ta;h.addSamples(e,t),n.intervals.addInterval(new En({start:u,stop:f,isStartIncluded:l,isStopIncluded:l,data:Dat(h,s,a)})),i.addInterval(new En({start:u,stop:f,isStartIncluded:l,isStopIncluded:l})),o.intervals.addInterval(new En({start:u,stop:f,isStartIncluded:l,isStopIncluded:l,data:r}))}function Mat(e,t,n,i,o){let r=Bh(n,"interpolate",Re.gx),s=Fh(n,"Track",Re.gx),a,l,u,f=!1,h=new K_,p=new Xr,g=new ba,m=e._ellipsoid;for(let y=0,b=s.length;y<b;y++){let x=s[y],A=Fh(x,"when",Re.kml),C=Fh(x,"coord",Re.gx),S=On(x,"altitudeMode",Re.kml),v=On(x,"altitudeMode",Re.gx),P=WF(S,v),M=Bh(x,"extrude",Re.kml),R=Math.min(C.length,A.length),L=[];a=[];for(let F=0;F<R;F++){let _=rH(C[F].textContent,m);L.push(_),a.push(Q.fromIso8601(A[F].textContent))}r&&(c(l)&&s0e([l,a[0]],[u,L[0]],g,p,h,!1,"absolute",void 0,!1),l=a[R-1],u=L[L.length-1]),s0e(a,L,g,p,h,P&&M,S,v,!0),f=f||P&&M}return i.availability=p,i.position=g,sH(e,i,o),_0e(i,o),f&&(PX(t,i,o),i.polyline.show=h),!0}var g0e={Point:Iat,LineString:r0e,LinearRing:r0e,Polygon:Oat,Track:Rat,MultiTrack:Mat,MultiGeometry:Lat,Model:Nat};function Lat(e,t,n,i,o,r){let s=n.childNodes,a=!1;for(let l=0,u=s.length;l<u;l++){let f=s.item(l),h=g0e[f.localName];if(c(h)){let p=f0e(f,t,r);p.parent=i,p.name=i.name,p.availability=i.availability,p.description=i.description,p.kml=i.kml,h(e,t,f,p,o)&&(a=!0)}}return a}function Nat(e,t,n,i,o){return dt("kml-unsupportedGeometry",`KML - Unsupported geometry: ${n.localName}`),!1}function Fat(e,t){let n=Ui(e,"ExtendedData",Re.kml);if(!c(n))return;c(Ui(n,"SchemaData",Re.kml))&&dt("kml-schemaData","KML - SchemaData is unsupported"),c(Ns(n,"xmlns:prefix"))&&dt("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");let i={},o=Fh(n,"Data",Re.kml);if(c(o)){let r=o.length;for(let s=0;s<r;s++){let a=o[s],l=Ns(a,"name");c(l)&&(i[l]={displayName:On(a,"displayName",Re.kml),value:On(a,"value",Re.kml)})}}t.kml.extendedData=i}var _o;typeof document<"u"&&(_o=document.createElement("div"));function Bat(e,t,n,i,o){let r,s,a,l=t.kml,u=l.extendedData,f=On(e,"description",Re.kml),h=t.balloonStyle??n.balloonStyle,p=G.WHITE,g=G.BLACK,m=f;c(h)&&(p=h.bgColor??G.WHITE,g=h.textColor??G.BLACK,m=h.text??f);let y;if(c(m)){if(m=m.replace("$[name]",t.name??""),m=m.replace("$[description]",f??""),m=m.replace("$[address]",l.address??""),m=m.replace("$[Snippet]",l.snippet??""),m=m.replace("$[id]",t.id),m=m.replace("$[geDirections]",""),c(u)){let A=m.match(/\$\[.+?\]/g);if(A!==null)for(r=0;r<A.length;r++){let C=A[r],S=C.substr(2,C.length-3),v=/\/displayName$/.test(S);S=S.replace(/\/displayName$/,""),y=u[S],c(y)&&(y=v?y.displayName:y.value),c(y)&&(m=m.replace(C,y??""))}}}else if(c(u)&&(a=Object.keys(u),a.length>0)){for(m='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',r=0;r<a.length;r++)s=a[r],y=u[s],m+=`<tr><th>${y.displayName??s}</th><td>${y.value??""}</td></tr>`;m+="</tbody></table>"}if(!c(m))return;m=yat.link(m),_o.innerHTML=m;let b=_o.querySelectorAll("a");for(r=0;r<b.length;r++)b[r].setAttribute("target","_blank");c(i)&&i.keys.length>1&&(Xu(_o,"a","href",i),Xu(_o,"link","href",i),Xu(_o,"area","href",i),Xu(_o,"img","src",i),Xu(_o,"iframe","src",i),Xu(_o,"video","src",i),Xu(_o,"audio","src",i),Xu(_o,"source","src",i),Xu(_o,"track","src",i),Xu(_o,"input","src",i),Xu(_o,"embed","src",i),Xu(_o,"script","src",i),Xu(_o,"video","poster",i)),Ku(_o,"a","href",o),Ku(_o,"link","href",o),Ku(_o,"area","href",o),Ku(_o,"img","src",o),Ku(_o,"iframe","src",o),Ku(_o,"video","src",o),Ku(_o,"audio","src",o),Ku(_o,"source","src",o),Ku(_o,"track","src",o),Ku(_o,"input","src",o),Ku(_o,"embed","src",o),Ku(_o,"script","src",o),Ku(_o,"video","poster",o);let x='<div class="cesium-infoBox-description-lighter" style="';x+="overflow:auto;",x+="word-wrap:break-word;",x+=`background-color:${p.toCssColorString()};`,x+=`color:${g.toCssColorString()};`,x+='">',x+=`${_o.innerHTML}</div>`,_o.innerHTML="",t.description=x}function aH(e,t,n){let i=n.entityCollection,o=n.parentEntity,r=n.sourceResource,s=n.uriResolver,a=f0e(t,i,n.context),l=a.kml,u=wat(e,t,n.styleCollection,r,s),f=On(t,"name",Re.kml);a.name=f,a.parent=o;let h=Eat(t);c(h)||(h=Cat(t)),a.availability=h,RX(a);function p(C){return C?C.show&&p(C.parent):!0}let g=Bh(t,"visibility",Re.kml);a.show=p(o)&&(g??!0);let m=Ui(t,"author",Re.atom),y=l.author;y.name=On(m,"name",Re.atom),y.uri=On(m,"uri",Re.atom),y.email=On(m,"email",Re.atom);let b=Ui(t,"link",Re.atom),x=l.link;x.href=Ns(b,"href"),x.hreflang=Ns(b,"hreflang"),x.rel=Ns(b,"rel"),x.type=Ns(b,"type"),x.title=Ns(b,"title"),x.length=Ns(b,"length"),l.address=On(t,"address",Re.kml),l.phoneNumber=On(t,"phoneNumber",Re.kml),l.snippet=On(t,"Snippet",Re.kml),Fat(t,a),Bat(t,a,u,s,r);let A=e._ellipsoid;return x0e(t,a,A),b0e(t,a,A),c(Ui(t,"Region",Re.kml))&&dt("kml-region","KML - Placemark Regions are unsupported"),{entity:a,styleEntity:u}}function y0e(e,t,n,i){i.addNodes(t.childNodes,n),i.process()}function kat(e,t,n,i){let o=aH(e,t,n),r=je(n);r.parentEntity=o.entity,y0e(e,t,r,i)}function Uat(e,t,n,i){let o=aH(e,t,n),r=o.entity,s=o.styleEntity,a=!1,l=t.childNodes;for(let u=0,f=l.length;u<f&&!a;u++){let h=l.item(u),p=g0e[h.localName];c(p)&&(p(e,n.entityCollection,h,r,s,r.id),a=!0)}a||(r.merge(s),sH(e,r,s))}var Vat={FlyTo:Gat,Wait:Hat,SoundCue:bX,AnimatedUpdate:bX,TourControl:bX};function zat(e,t,n,i){let o=On(t,"name",Re.kml),r=Ns(t,"id"),s=new VF(o,r),a=Ui(t,"Playlist",Re.gx);if(a){let l=e._ellipsoid,u=a.childNodes;for(let f=0;f<u.length;f++){let h=u[f];if(h.localName){let p=Vat[h.localName];p?p(s,h,l):console.log(`Unknown KML Tour playlist entry type ${h.localName}`)}}}e._kmlTours.push(s)}function bX(e,t){dt(`KML Tour unsupported node ${t.localName}`)}function Hat(e,t){let n=Jn(t,"duration",Re.gx);e.addPlaylistEntry(new GF(n))}function Gat(e,t,n){let i=Jn(t,"duration",Re.gx),o=On(t,"flyToMode",Re.gx),r={kml:{}};x0e(t,r,n),b0e(t,r,n);let s=r.kml.lookAt||r.kml.camera,a=new HF(i,o,s);e.addPlaylistEntry(a)}function b0e(e,t,n){let i=Ui(e,"Camera",Re.kml);if(c(i)){let o=Jn(i,"longitude",Re.kml)??0,r=Jn(i,"latitude",Re.kml)??0,s=Jn(i,"altitude",Re.kml)??0,a=Jn(i,"heading",Re.kml)??0,l=Jn(i,"tilt",Re.kml)??0,u=Jn(i,"roll",Re.kml)??0,f=d.fromDegrees(o,r,s,n),h=Oa.fromDegrees(a,l-90,u);t.kml.camera=new kF(f,h)}}function x0e(e,t,n){let i=Ui(e,"LookAt",Re.kml);if(c(i)){let o=Jn(i,"longitude",Re.kml)??0,r=Jn(i,"latitude",Re.kml)??0,s=Jn(i,"altitude",Re.kml)??0,a=Jn(i,"heading",Re.kml),l=Jn(i,"tilt",Re.kml),u=Jn(i,"range",Re.kml)??0;l=O.toRadians(l??0),a=O.toRadians(a??0);let f=new cd(a,l-O.PI_OVER_TWO,u),h=d.fromDegrees(o,r,s,n);t.kml.lookAt=new UF(h,f)}}function jat(e,t,n,i){let o=n.screenOverlayContainer;if(!c(o))return;let r=n.sourceResource,s=n.uriResolver,a=Ui(t,"Icon",Re.kml),l=DX(a,e,r,s,!1);if(!c(l))return;let u=document.createElement("img");e._screenOverlays.push(u),u.src=l.url,u.onload=function(){let f=["position: absolute"],h=Ui(t,"screenXY",Re.kml),p=Ui(t,"overlayXY",Re.kml),g=Ui(t,"size",Re.kml),m,y,b,x,A,C;c(g)&&(m=E0(g,"x"),y=E0(g,"y"),b=Ns(g,"xunits"),x=Ns(g,"yunits"),c(m)&&m!==-1&&m!==0&&(b==="fraction"?A=`width: ${Math.floor(m*100)}%`:b==="pixels"&&(A=`width: ${m}px`),f.push(A)),c(y)&&y!==-1&&y!==0&&(x==="fraction"?C=`height: ${Math.floor(y*100)}%`:x==="pixels"&&(C=`height: ${y}px`),f.push(C))),u.style=f.join(";");let S=0,v=u.height;c(p)&&(m=E0(p,"x"),y=E0(p,"y"),b=Ns(p,"xunits"),x=Ns(p,"yunits"),c(m)&&(b==="fraction"?S=m*u.width:(b==="pixels"||b==="insetPixels")&&(S=m)),c(y)&&(x==="fraction"?v=y*u.height:(x==="pixels"||x==="insetPixels")&&(v=y))),c(h)&&(m=E0(h,"x"),y=E0(h,"y"),b=Ns(h,"xunits"),x=Ns(h,"yunits"),c(m)&&(b==="fraction"?A=`left: calc(${Math.floor(m*100)}% - ${S}px)`:b==="pixels"?A=`left: ${m-S}px`:b==="insetPixels"&&(A=`right: ${m-S}px`),f.push(A)),c(y)&&(x==="fraction"?C=`bottom: calc(${Math.floor(y*100)}% - ${v}px)`:x==="pixels"?C=`bottom: ${y-v}px`:x==="insetPixels"&&(C=`top: ${y-v}px`),f.push(C))),u.style=f.join(";")},o.appendChild(u)}function Wat(e,t,n,i){let r=aH(e,t,n).entity,s,a=!1,l=e._ellipsoid,u=nH(Ui(t,"LatLonQuad",Re.gx),l),f=Jn(t,"drawOrder",Re.kml);if(c(u))s=vX(),s.hierarchy=new ka(u),s.zIndex=f,r.polygon=s,a=!0;else{s=new jd,s.zIndex=f,r.rectangle=s;let m=Ui(t,"LatLonBox",Re.kml);if(c(m)){let y=Jn(m,"west",Re.kml),b=Jn(m,"south",Re.kml),x=Jn(m,"east",Re.kml),A=Jn(m,"north",Re.kml);c(y)&&(y=O.negativePiToPi(O.toRadians(y))),c(b)&&(b=O.clampToLatitudeRange(O.toRadians(b))),c(x)&&(x=O.negativePiToPi(O.toRadians(x))),c(A)&&(A=O.clampToLatitudeRange(O.toRadians(A))),s.coordinates=new ce(y,b,x,A);let C=Jn(m,"rotation",Re.kml);if(c(C)){let S=O.toRadians(C);s.rotation=S,s.stRotation=S}}}let h=Ui(t,"Icon",Re.kml),p=DX(h,e,n.sourceResource,n.uriResolver,!0);if(c(p)){a&&dt("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");let m=Jn(h,"x",Re.gx),y=Jn(h,"y",Re.gx),b=Jn(h,"w",Re.gx),x=Jn(h,"h",Re.gx);(c(m)||c(y)||c(b)||c(x))&&dt("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),s.material=p,s.material.color=BT(t,"color",Re.kml),s.material.transparent=!0}else s.material=BT(t,"color",Re.kml);let g=On(t,"altitudeMode",Re.kml);c(g)?g==="absolute"?(s.height=Jn(t,"altitude",Re.kml),s.zIndex=void 0):g!=="clampToGround"&&dt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${g}`):(g=On(t,"altitudeMode",Re.gx),g==="relativeToSeaFloor"?(dt("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),s.height=Jn(t,"altitude",Re.kml),s.zIndex=void 0):g==="clampToSeaFloor"?dt("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):c(g)&&dt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${g}`))}function T0e(e,t,n,i){e._unsupportedNode.raiseEvent(e,n.parentEntity,t,n.entityCollection,n.styleCollection,n.sourceResource,n.uriResolver),dt(`kml-unsupportedFeature-${t.nodeName}`,`KML - Unsupported feature: ${t.nodeName}`)}var S0={INTERVAL:0,EXPIRE:1,STOP:2};function oH(e){if(!c(e)||e.length===0)return"";let t=e[0];return(t==="&"||t==="?")&&(e=e.substring(1)),e}var qat=new ce,QS=new he,xX=new H,Yat=new d;function IX(e,t,n,i,o,r){function s(u){return u<-O.PI_OVER_TWO?-O.PI_OVER_TWO:u>O.PI_OVER_TWO?O.PI_OVER_TWO:u}function a(u){return u>O.PI?u-O.TWO_PI:u<-O.PI?u+O.TWO_PI:u}let l=cb(e.queryParameters);if(l=l.replace(/%5B/g,"[").replace(/%5D/g,"]"),c(t)&&t._mode!==oe.MORPHING){let u,f;if(o=o??qat,c(n)&&(xX.x=n.clientWidth*.5,xX.y=n.clientHeight*.5,u=t.pickEllipsoid(xX,r,Yat)),c(u)?f=r.cartesianToCartographic(u,QS):(f=ce.center(o,QS),u=r.cartographicToCartesian(f)),c(i)&&!O.equalsEpsilon(i,1,O.EPSILON9)){let x=o.width*i*.5,A=o.height*i*.5;o=new ce(a(f.longitude-x),s(f.latitude-A),a(f.longitude+x),s(f.latitude+A))}l=l.replace("[bboxWest]",O.toDegrees(o.west).toString()),l=l.replace("[bboxSouth]",O.toDegrees(o.south).toString()),l=l.replace("[bboxEast]",O.toDegrees(o.east).toString()),l=l.replace("[bboxNorth]",O.toDegrees(o.north).toString());let h=O.toDegrees(f.longitude).toString(),p=O.toDegrees(f.latitude).toString();l=l.replace("[lookatLon]",h),l=l.replace("[lookatLat]",p),l=l.replace("[lookatTilt]",O.toDegrees(t.pitch).toString()),l=l.replace("[lookatHeading]",O.toDegrees(t.heading).toString()),l=l.replace("[lookatRange]",d.distance(t.positionWC,u)),l=l.replace("[lookatTerrainLon]",h),l=l.replace("[lookatTerrainLat]",p),l=l.replace("[lookatTerrainAlt]",f.height.toString()),r.cartesianToCartographic(t.positionWC,QS),l=l.replace("[cameraLon]",O.toDegrees(QS.longitude).toString()),l=l.replace("[cameraLat]",O.toDegrees(QS.latitude).toString()),l=l.replace("[cameraAlt]",O.toDegrees(QS.height).toString());let g=t.frustum,m=g.aspectRatio,y="",b="";if(c(m)){let x=O.toDegrees(g.fov);m>1?(y=x,b=x/m):(b=x,y=x*m)}l=l.replace("[horizFov]",y.toString()),l=l.replace("[vertFov]",b.toString())}else l=l.replace("[bboxWest]","-180"),l=l.replace("[bboxSouth]","-90"),l=l.replace("[bboxEast]","180"),l=l.replace("[bboxNorth]","90"),l=l.replace("[lookatLon]",""),l=l.replace("[lookatLat]",""),l=l.replace("[lookatRange]",""),l=l.replace("[lookatTilt]",""),l=l.replace("[lookatHeading]",""),l=l.replace("[lookatTerrainLon]",""),l=l.replace("[lookatTerrainLat]",""),l=l.replace("[lookatTerrainAlt]",""),l=l.replace("[cameraLon]",""),l=l.replace("[cameraLat]",""),l=l.replace("[cameraAlt]",""),l=l.replace("[horizFov]",""),l=l.replace("[vertFov]","");c(n)?(l=l.replace("[horizPixels]",n.clientWidth),l=l.replace("[vertPixels]",n.clientHeight)):(l=l.replace("[horizPixels]",""),l=l.replace("[vertPixels]","")),l=l.replace("[terrainEnabled]","1"),l=l.replace("[clientVersion]","1"),l=l.replace("[kmlVersion]","2.2"),l=l.replace("[clientName]","Cesium"),l=l.replace("[language]","English"),e.setQueryParameters(hu(l))}function Xat(e,t,n,i){let r=aH(e,t,n).entity,s=n.sourceResource,a=n.uriResolver,l=Ui(t,"Link",Re.kml);if(c(l)||(l=Ui(t,"Url",Re.kml)),c(l)){let u=On(l,"href",Re.kml),f,h;if(c(u)){let p=u;if(u=wX(u,s,n.uriResolver),/^data:/.test(u.getUrlComponent()))/\.kmz/i.test(s.getUrlComponent())||(p=s.getDerivedResource({url:p}));else{if(p=u.clone(),f=On(l,"viewRefreshMode",Re.kml),f==="onRegion"){dt("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion");return}h=On(l,"viewBoundScale",Re.kml)??1;let b=f==="onStop"?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",x=On(l,"viewFormat",Re.kml)??b,A=On(l,"httpQuery",Re.kml);c(x)&&u.setQueryParameters(hu(oH(x))),c(A)&&u.setQueryParameters(hu(oH(A)));let C=e._ellipsoid;IX(u,e.camera,e.canvas,h,e._lastCameraView.bbox,C)}let g={sourceUri:p,uriResolver:a,context:r.id,screenOverlayContainer:n.screenOverlayContainer},m=new Qs,y=OX(e,m,u,g).then(function(b){let x=e._entityCollection,A=m.values;x.suspendEvents();for(let v=0;v<A.length;v++){let P=A[v];c(P.parent)||(P.parent=r,RX(P)),x.add(P)}x.resumeEvents();let C=On(l,"refreshMode",Re.kml),S=Jn(l,"refreshInterval",Re.kml)??0;if(C==="onInterval"&&S>0||C==="onExpire"||f==="onStop"){let v=Ui(b,"NetworkLinkControl",Re.kml),P=c(v),M=Q.now(),R={id:jn(),href:u,cookie:{},lastUpdated:M,updating:!1,entity:r,viewBoundScale:h,needsUpdate:!1,cameraUpdateTime:M},L=0;if(P&&(R.cookie=hu(On(v,"cookie",Re.kml)??""),L=Jn(v,"minRefreshPeriod",Re.kml)??0),C==="onInterval")P&&(S=Math.max(L,S)),R.refreshMode=S0.INTERVAL,R.time=S;else if(C==="onExpire"){let F;if(P&&(F=On(v,"expires",Re.kml)),c(F))try{let _=Q.fromIso8601(F),w=Q.secondsDifference(_,M);w>0&&w<L&&Q.addSeconds(M,L,_),R.refreshMode=S0.EXPIRE,R.time=_}catch{dt("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else dt("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else c(e.camera)?(R.refreshMode=S0.STOP,R.time=Jn(l,"viewRefreshTime",Re.kml)??0):dt("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined.");c(R.refreshMode)&&e._networkLinks.set(R.id,R)}}).catch(function(b){dt(`An error occured during loading ${u.url}`),e._error.raiseEvent(e,b)});i.addPromise(y)}}}function Kat(e,t,n,i){let o=SX[t.localName];return c(o)?o(e,t,n,i):T0e(e,t,n,i)}function CX(e,t,n,i,o,r,s){t.removeAll();let a=n.documentElement,l=a.localName==="Document"?a:Ui(a,"Document",Re.kml),u=On(l,"name",Re.kml);c(u)||(u=j_(i.getUrlComponent())),c(e._name)||(e._name=u);let f=new $u._DeferredLoading(e),h=new Qs(e);return Promise.all(m0e(e,n,h,i,!1,o)).then(function(){let p=n.documentElement;if(p.localName==="kml"){let m=p.childNodes;for(let y=0;y<m.length;y++){let b=m[y];if(c(SX[b.localName])){p=b;break}}}let g={parentEntity:void 0,entityCollection:t,styleCollection:h,sourceResource:i,uriResolver:o,context:s,screenOverlayContainer:r};return t.suspendEvents(),Kat(e,p,g,f),t.resumeEvents(),f.wait().then(function(){return n.documentElement})})}function $at(e,t,n,i,o){let r=tn("ThirdParty/Workers/z-worker-pako.js");FS({workerScripts:{deflate:[r,"./pako_deflate.min.js"],inflate:[r,"./pako_inflate.min.js"]}});let s=new E8(new sg(n));return Promise.resolve(s.getEntries()).then(function(a){let l=[],u={},f;for(let h=0;h<a.length;h++){let p=a[h];p.directory||(/\.kml$/i.test(p.filename)&&(!c(f)||!/\//i.test(p.filename))?(c(f)&&l.push(yX(f,u)),f=p):l.push(yX(p,u)))}return c(f)&&l.push(Aat(f,u)),Promise.all(l).then(function(){if(s.close(),!c(u.kml))throw new ae("KMZ file does not contain a KML document.");return u.keys=Object.keys(u),CX(e,t,u.kml,i,u,o)})})}function OX(e,t,n,i){i=i??W.EMPTY_OBJECT;let o=i.sourceUri,r=i.uriResolver,s=i.context,a=i.screenOverlayContainer,l=n;if(typeof n=="string"||n instanceof we){n=we.createIfNeeded(n),l=n.fetchBlob(),o=o??n.clone();let u=e._resourceCredits,f=n.credits;if(c(f)){let h=f.length;for(let p=0;p<h;p++)u.push(f[p])}}else o=o??we.DEFAULT.clone();return o=we.createIfNeeded(o),c(a)&&(a=In(a)),Promise.resolve(l).then(function(u){return u instanceof Blob?xat(u).then(function(f){return f?$at(e,t,u,o,a):Tat(u).then(function(h){h=l0e(h),h=u0e(h);let p,g;try{p=EX.parseFromString(h,"application/xml")}catch(m){g=m.toString()}if(c(g)||p.body||p.documentElement.tagName==="parsererror"){let m=c(g)?g:p.documentElement.firstChild.nodeValue;throw m||(m=p.body.innerText),new ae(m)}return CX(e,t,p,o,r,a,s)})}):CX(e,t,u,o,r,a,s)}).catch(function(u){return e._error.raiseEvent(e,u),console.log(u),Promise.reject(u)})}function $u(e){e=e??W.EMPTY_OBJECT;let t=e.camera,n=e.canvas;this._changed=new pe,this._error=new pe,this._loading=new pe,this._refresh=new pe,this._unsupportedNode=new pe,this._clock=void 0,this._entityCollection=new Qs(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new ag,this._networkLinks=new Et,this._entityCluster=new Bu,this.canvas=n,this.camera=t,this._lastCameraView={position:c(t)?d.clone(t.positionWC):void 0,direction:c(t)?d.clone(t.directionWC):void 0,up:c(t)?d.clone(t.upWC):void 0,bbox:c(t)?t.computeViewRectangle():ce.clone(ce.MAX_VALUE)},this._ellipsoid=e.ellipsoid??ie.default;let i=e.credit;typeof i=="string"&&(i=new Tt(i)),this._credit=i,this._resourceCredits=[],this._kmlTours=[],this._screenOverlays=[]}$u.load=function(e,t){return t=t??W.EMPTY_OBJECT,new $u(t).load(e,t)};Object.defineProperties($u.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},refreshEvent:{get:function(){return this._refresh}},unsupportedNodeEvent:{get:function(){return this._unsupportedNode}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}},credit:{get:function(){return this._credit}},kmlTours:{get:function(){return this._kmlTours}}});$u.prototype.load=function(e,t){if(!c(e))throw new E("data is required.");t=t??W.EMPTY_OBJECT,Kr.setLoading(this,!0);let n=this._name;this._name=void 0,this._clampToGround=t.clampToGround??!1;let i=this;return OX(this,this._entityCollection,e,t).then(function(){let o,r=i._entityCollection.computeAvailability(),s=r.start,a=r.stop,l=Q.equals(s,Ge.MINIMUM_VALUE),u=Q.equals(a,Ge.MAXIMUM_VALUE);if(!l||!u){let h;l&&(h=new Date,h.setHours(0,0,0,0),s=Q.fromDate(h)),u&&(h=new Date,h.setHours(24,0,0,0),a=Q.fromDate(h)),o=new Ch,o.startTime=s,o.stopTime=a,o.currentTime=Q.clone(s),o.clockRange=$r.LOOP_STOP,o.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,o.multiplier=Math.round(Math.min(Math.max(Q.secondsDifference(a,s)/60,1),31556900))}let f=!1;return o!==i._clock&&(i._clock=o,f=!0),n!==i._name&&(f=!0),f&&i._changed.raiseEvent(i),Kr.setLoading(i,!1),i}).catch(function(o){return Kr.setLoading(i,!1),i._error.raiseEvent(i,o),console.log(o),Promise.reject(o)})};$u.prototype.destroy=function(){for(;this._screenOverlays.length>0;)this._screenOverlays.pop().remove()};function RX(e){let t=e.parent;if(c(t)){let n=t.availability;if(c(n)){let i=e.availability;c(i)?i.intersect(n):e.availability=n}}}function Zat(e,t,n,i,o){return function(r){if(!i.contains(t.id))return;let s=!1,a=Ui(r,"NetworkLinkControl",Re.kml),l=c(a),u=0;if(l){if(c(Ui(a,"Update",Re.kml))){dt("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),t.updating=!1,i.remove(t.id);return}t.cookie=hu(On(a,"cookie",Re.kml)??""),u=Jn(a,"minRefreshPeriod",Re.kml)??0}let f=Q.now(),h=t.refreshMode;if(h===S0.INTERVAL)c(a)&&(t.time=Math.max(u,t.time));else if(h===S0.EXPIRE){let M;if(c(a)&&(M=On(a,"expires",Re.kml)),c(M))try{let R=Q.fromIso8601(M),L=Q.secondsDifference(R,f);L>0&&L<u&&Q.addSeconds(f,u,R),t.time=R}catch{dt("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),s=!0}else dt("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"),s=!0}let p=t.entity,g=e._entityCollection,m=n.values;function y(M){g.remove(M);let R=M._children,L=R.length;for(let F=0;F<L;++F)y(R[F])}g.suspendEvents();let b=g.values.slice(),x;for(x=0;x<b.length;++x){let M=b[x];M.parent===p&&(M.parent=void 0,y(M))}for(g.resumeEvents(),g.suspendEvents(),x=0;x<m.length;x++){let M=m[x];c(M.parent)||(M.parent=p,RX(M)),g.add(M)}g.resumeEvents(),s?i.remove(t.id):t.lastUpdated=f;let A=g.computeAvailability(),C=A.start,S=A.stop,v=Q.equals(C,Ge.MINIMUM_VALUE),P=Q.equals(S,Ge.MAXIMUM_VALUE);if(!v||!P){let M=e._clock;(M.startTime!==C||M.stopTime!==S)&&(M.startTime=C,M.stopTime=S,e._changed.raiseEvent(e))}t.updating=!1,t.needsUpdate=!1,e._refresh.raiseEvent(e,o.getUrlComponent(!0))}}var TX=new Et;$u.prototype.update=function(e){let t=this._networkLinks;if(t.length===0)return!0;let n=Q.now(),i=this;TX.removeAll();function o(f){let h=f._children,p=h.length;for(let g=0;g<p;++g){let m=h[g];TX.set(m.id,m),o(m)}}let r=!1,s=this._lastCameraView,a=this.camera;c(a)&&!(a.positionWC.equalsEpsilon(s.position,O.EPSILON7)&&a.directionWC.equalsEpsilon(s.direction,O.EPSILON7)&&a.upWC.equalsEpsilon(s.up,O.EPSILON7))&&(s.position=d.clone(a.positionWC),s.direction=d.clone(a.directionWC),s.up=d.clone(a.upWC),s.bbox=a.computeViewRectangle(),r=!0);let l=new Et,u=!1;return t.values.forEach(function(f){let h=f.entity;if(!TX.contains(h.id)){if(!f.updating){let p=!1;if(f.refreshMode===S0.INTERVAL?Q.secondsDifference(n,f.lastUpdated)>f.time&&(p=!0):f.refreshMode===S0.EXPIRE?Q.greaterThan(n,f.time)&&(p=!0):f.refreshMode===S0.STOP&&(r&&(f.needsUpdate=!0,f.cameraUpdateTime=n),f.needsUpdate&&Q.secondsDifference(n,f.cameraUpdateTime)>=f.time&&(p=!0)),p){o(h),f.updating=!0;let g=new Qs,m=f.href.clone();m.setQueryParameters(f.cookie);let y=i._ellipsoid??ie.default;IX(m,i.camera,i.canvas,f.viewBoundScale,s.bbox,y),OX(i,g,m,{context:h.id}).then(Zat(i,f,g,l,m)).catch(function(b){let x=`NetworkLink ${f.href} refresh failed: ${b}`;console.log(x),i._error.raiseEvent(i,x)}),u=!0}}l.set(f.id,f)}}),u&&(this._networkLinks=l,this._changed.raiseEvent(this)),!0};function Qat(){this.author={name:void 0,uri:void 0,email:void 0},this.link={href:void 0,hreflang:void 0,rel:void 0,type:void 0,title:void 0,length:void 0},this.address=void 0,this.phoneNumber=void 0,this.snippet=void 0,this.extendedData=void 0}$u._DeferredLoading=Jm;$u._getTimestamp=Ti;var kT=$u;function qF(){E.throwInstantiationError()}qF.prototype.update=E.throwInstantiationError;qF.prototype.getBoundingSphere=E.throwInstantiationError;qF.prototype.isDestroyed=E.throwInstantiationError;qF.prototype.destroy=E.throwInstantiationError;var MX=qF;var JS=`#ifdef MRT
layout (location = 0) out vec4 out_FragData_0;
layout (location = 1) out vec4 out_FragData_1;
#else
layout (location = 0) out vec4 out_FragColor;
#endif
uniform vec4 u_bgColor;
uniform sampler2D u_depthTexture;
in vec2 v_textureCoordinates;
void main()
{
if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)
{
#ifdef MRT
out_FragData_0 = u_bgColor;
out_FragData_1 = vec4(u_bgColor.a);
#else
out_FragColor = u_bgColor;
#endif
return;
}
discard;
}
`;var YF=`in vec2 v_textureCoordinates;
const float M_PI = 3.141592653589793;
float vdcRadicalInverse(int i)
{
float r;
float base = 2.0;
float value = 0.0;
float invBase = 1.0 / base;
float invBi = invBase;
for (int x = 0; x < 100; x++)
{
if (i <= 0)
{
break;
}
r = mod(float(i), base);
value += r * invBi;
invBi *= invBase;
i = int(float(i) * invBase);
}
return value;
}
vec2 hammersley2D(int i, int N)
{
return vec2(float(i) / float(N), vdcRadicalInverse(i));
}
vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)
{
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
float phi = 2.0 * M_PI * xi.x;
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 tangentX = normalize(cross(upVector, N));
vec3 tangentY = cross(N, tangentX);
return tangentX * H.x + tangentY * H.y + N * H.z;
}
float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
{
float alphaRoughnessSq = alphaRoughness * alphaRoughness;
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0)
{
return 0.5 / GGX;
}
return 0.0;
}
vec2 integrateBrdf(float roughness, float NdotV)
{
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);
float A = 0.0;
float B = 0.0;
const int NumSamples = 1024;
float alphaRoughness = roughness * roughness;
for (int i = 0; i < NumSamples; i++)
{
vec2 xi = hammersley2D(i, NumSamples);
vec3 H = importanceSampleGGX(xi, alphaRoughness, vec3(0.0, 0.0, 1.0));
vec3 L = 2.0 * dot(V, H) * H - V;
float NdotL = clamp(L.z, 0.0, 1.0);
float NdotH = clamp(H.z, 0.0, 1.0);
float VdotH = clamp(dot(V, H), 0.0, 1.0);
if (NdotL > 0.0)
{
float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;
float Fc = pow(1.0 - VdotH, 5.0);
A += (1.0 - Fc) * G_Vis;
B += Fc * G_Vis;
}
}
return vec2(A, B) / float(NumSamples);
}
void main()
{
out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
}
`;var XF=`uniform sampler2D u_noiseTexture;
uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
in vec2 v_offset;
in vec3 v_maximumSize;
in vec4 v_color;
in float v_slice;
in float v_brightness;
float wrap(float value, float rangeLength) {
if(value < 0.0) {
float absValue = abs(value);
float modValue = mod(absValue, rangeLength);
return mod(rangeLength - modValue, rangeLength);
}
return mod(value, rangeLength);
}
vec3 wrapVec(vec3 value, float rangeLength) {
return vec3(wrap(value.x, rangeLength),
wrap(value.y, rangeLength),
wrap(value.z, rangeLength));
}
vec2 voxelToUV(vec3 voxelIndex) {
float textureSliceWidth = u_noiseTextureDimensions.x;
float noiseTextureRows = u_noiseTextureDimensions.y;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
float textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;
vec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,
inverseNoiseTextureRows / textureSliceWidth);
vec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);
float column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);
float row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);
float xPixelCoord = wrappedIndex.x + column * textureSliceWidth;
float yPixelCoord = wrappedIndex.y + row * textureSliceWidth;
return vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;
}
vec4 lerpSamplesX(vec3 voxelIndex, float x) {
vec2 uv0 = voxelToUV(voxelIndex);
vec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));
vec4 sample0 = texture(u_noiseTexture, uv0);
vec4 sample1 = texture(u_noiseTexture, uv1);
return mix(sample0, sample1, x);
}
vec4 sampleNoiseTexture(vec3 position) {
float textureSliceWidth = u_noiseTextureDimensions.x;
vec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);
vec3 lerpValue = fract(recenteredPos);
vec3 voxelIndex = floor(recenteredPos);
vec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);
vec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);
vec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);
vec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);
vec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);
vec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);
return mix(yLerp0, yLerp1, lerpValue.z);
}
bool intersectSphere(vec3 origin, vec3 dir, float slice,
out vec3 point, out vec3 normal) {
float A = dot(dir, dir);
float B = dot(origin, dir);
float C = dot(origin, origin) - 0.25;
float discriminant = (B * B) - (A * C);
if(discriminant < 0.0) {
return false;
}
float root = sqrt(discriminant);
float t = (-B - root) / A;
if(t < 0.0) {
t = (-B + root) / A;
}
point = origin + t * dir;
if(slice >= 0.0) {
point.z = (slice / 2.0) - 0.5;
if(length(point) > 0.5) {
return false;
}
}
normal = normalize(point);
point -= czm_epsilon2 * normal;
return true;
}
bool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,
out vec3 point, out vec3 normal) {
if(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {
return false;
}
vec3 o = (origin - center) / scale;
vec3 d = dir / scale;
vec3 p, n;
bool intersected = intersectSphere(o, d, slice, p, n);
if(intersected) {
point = (p * scale) + center;
normal = n;
}
return intersected;
}
vec2 phaseShift2D(vec2 p, vec2 freq) {
return (czm_pi / 2.0) * sin(freq.yx * p.yx);
}
vec2 phaseShift3D(vec3 p, vec2 freq) {
return phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));
}
const float T0    = 0.6;
const float k     = 0.1;
const float C0    = 0.8;
const float FX0   = 0.6;
const float FY0   = 0.6;
const int octaves = 5;
float T(vec3 point) {
vec2 sum = vec2(0.0);
float Ci = C0;
vec2 FXY = vec2(FX0, FY0);
vec2 PXY = vec2(0.0);
for(int i = 1; i <= octaves; i++) {
PXY = phaseShift3D(point, FXY);
Ci *= 0.707;
FXY *= 2.0;
vec2 sinTerm = sin(FXY * point.xy + PXY);
sum += Ci * sinTerm + vec2(T0);
}
return k * sum.x * sum.y;
}
const float a = 0.5;
const float t = 0.4;
const float s = 0.25;
float I(float Id, float Is, float It) {
return (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;
}
const vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));
vec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,
float brightness) {
vec3 cloudPoint, cloudNormal;
if(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,
cloudPoint, cloudNormal)) {
return vec4(0.0);
}
float Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0);
float Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);
float It = T(cloudPoint);
float intensity = I(Id, Is, It);
vec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));
vec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);
float W = noise.x;
float W2 = noise.y;
float W3 = noise.z;
float ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);
float TR = pow(ndDot, 3.0) - W;
TR *= 1.3;
float minusDot = 0.5 - ndDot;
TR -= min(minusDot * W2, 0.0);
TR -= 0.8 * (minusDot + 0.25) * W3;
float shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);
shading = clamp(shading + 0.2, 0.3, 1.0);
vec3 finalColor = mix(vec3(0.5), shading * color, 1.15);
return vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;
}
void main() {
#ifdef DEBUG_BILLBOARDS
out_FragColor = vec4(0.0, 0.5, 0.5, 1.0);
#endif
vec2 coordinate = v_maximumSize.xy * v_offset;
vec3 ellipsoidScale = 0.82 * v_maximumSize;
vec3 ellipsoidCenter = vec3(0.0);
float zOffset = max(ellipsoidScale.z - 10.0, 0.0);
vec3 eye = vec3(0, 0, -10.0 - zOffset);
vec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);
vec3 rayOrigin = eye;
#ifdef DEBUG_ELLIPSOIDS
vec3 point, normal;
if(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,
point, normal)) {
out_FragColor = v_brightness * v_color;
}
#else
#ifndef DEBUG_BILLBOARDS
vec4 cloud = drawCloud(rayOrigin, rayDir,
ellipsoidCenter, ellipsoidScale, v_slice, v_brightness);
if(cloud.w < 0.01) {
discard;
}
out_FragColor = cloud;
#endif
#endif
}
`;var KF=`#ifdef INSTANCED
in vec2 direction;
#endif
in vec4 positionHighAndScaleX;
in vec4 positionLowAndScaleY;
in vec4 packedAttribute0;
in vec4 packedAttribute1;
in vec4 color;
out vec2 v_offset;
out vec3 v_maximumSize;
out vec4 v_color;
out float v_slice;
out float v_brightness;
void main() {
vec3 positionHigh = positionHighAndScaleX.xyz;
vec3 positionLow = positionLowAndScaleY.xyz;
vec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);
float show = packedAttribute0.x;
float brightness = packedAttribute0.y;
vec2 coordinates = packedAttribute0.wz;
vec3 maximumSize = packedAttribute1.xyz;
float slice = packedAttribute1.w;
#ifdef INSTANCED
vec2 dir = direction;
#else
vec2 dir = coordinates;
#endif
vec2 offset = dir - vec2(0.5, 0.5);
vec2 scaledOffset = scale * offset;
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
vec4 positionEC = czm_modelViewRelativeToEye * p;
positionEC.xy += scaledOffset;
positionEC.xyz *= show;
gl_Position = czm_projection * positionEC;
v_offset = offset;
v_maximumSize = maximumSize;
v_color = color;
v_slice = slice;
v_brightness = brightness;
}
`;var $F=`uniform vec3 u_noiseTextureDimensions;
uniform float u_noiseDetail;
uniform vec3 u_noiseOffset;
in vec2 v_position;
float wrap(float value, float rangeLength) {
if(value < 0.0) {
float absValue = abs(value);
float modValue = mod(absValue, rangeLength);
return mod(rangeLength - modValue, rangeLength);
}
return mod(value, rangeLength);
}
vec3 wrapVec(vec3 value, float rangeLength) {
return vec3(wrap(value.x, rangeLength),
wrap(value.y, rangeLength),
wrap(value.z, rangeLength));
}
vec3 random3(vec3 p) {
float dot1 = dot(p, vec3(127.1, 311.7, 932.8));
float dot2 = dot(p, vec3(269.5, 183.3, 421.4));
return fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));
}
vec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {
float textureSliceWidth = u_noiseTextureDimensions.x;
vec3 cell = centerCell + offset;
cell = wrapVec(cell, textureSliceWidth / u_noiseDetail);
cell += floor(u_noiseOffset / u_noiseDetail);
vec3 p = offset + random3(cell);
return p;
}
float worleyNoise(vec3 p, float freq) {
vec3 centerCell = floor(p * freq);
vec3 pointInCell = fract(p * freq);
float shortestDistance = 1000.0;
for(float z = -1.0; z <= 1.0; z++) {
for(float y = -1.0; y <= 1.0; y++) {
for(float x = -1.0; x <= 1.0; x++) {
vec3 offset = vec3(x, y, z);
vec3 point = getWorleyCellPoint(centerCell, offset, freq);
float distance = length(pointInCell - point);
if(distance < shortestDistance) {
shortestDistance = distance;
}
}
}
}
return shortestDistance;
}
const float MAX_FBM_ITERATIONS = 10.0;
float worleyFBMNoise(vec3 p, float octaves, float scale) {
float noise = 0.0;
float freq = 1.0;
float persistence = 0.625;
for(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {
if(i >= octaves) {
break;
}
noise += worleyNoise(p * scale, freq * scale) * persistence;
persistence *= 0.5;
freq *= 2.0;
}
return noise;
}
void main() {
float textureSliceWidth = u_noiseTextureDimensions.x;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
float x = mod(v_position.x, textureSliceWidth);
float y = mod(v_position.y, textureSliceWidth);
float sliceRow = floor(v_position.y / textureSliceWidth);
float z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;
vec3 position = vec3(x, y, z);
position /= u_noiseDetail;
float worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);
float worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);
float worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);
out_FragColor = vec4(worley0, worley1, worley2, 1.0);
}
`;var ZF=`uniform vec3 u_noiseTextureDimensions;
in vec2 position;
out vec2 v_position;
void main()
{
gl_Position = vec4(position, 0.1, 1.0);
float textureSliceWidth = u_noiseTextureDimensions.x;
float noiseTextureRows = u_noiseTextureDimensions.y;
float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
vec2 transformedPos = (position * 0.5) + vec2(0.5);
transformedPos *= textureSliceWidth;
transformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;
transformedPos.y *= noiseTextureRows;
v_position = transformedPos;
}
`;var QF=`uniform sampler2D u_opaqueDepthTexture;
uniform sampler2D u_translucentDepthTexture;
in vec2 v_textureCoordinates;
void main()
{
float opaqueDepth = texture(u_opaqueDepthTexture, v_textureCoordinates).r;
float translucentDepth = texture(u_translucentDepthTexture, v_textureCoordinates).r;
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
out_FragColor = czm_packDepth(translucentDepth);
}
`;var JF=`uniform sampler2D u_opaque;
uniform sampler2D u_accumulation;
uniform sampler2D u_revealage;
in vec2 v_textureCoordinates;
void main()
{
vec4 opaque = texture(u_opaque, v_textureCoordinates);
vec4 accum = texture(u_accumulation, v_textureCoordinates);
float r = texture(u_revealage, v_textureCoordinates).r;
#ifdef MRT
vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);
#else
vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);
#endif
out_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
if (opaque != czm_backgroundColor)
{
out_FragColor.a = 1.0;
}
}
`;var e2=`in vec4 positionEC;
void main()
{
vec3 position;
vec3 direction;
if (czm_orthographicIn3D == 1.0)
{
vec2 uv = (gl_FragCoord.xy -  czm_viewport.xy) / czm_viewport.zw;
vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y);
vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x);
position = vec3(mix(minPlane, maxPlane, uv), 0.0);
direction = vec3(0.0, 0.0, -1.0);
}
else
{
position = vec3(0.0);
direction = normalize(positionEC.xyz);
}
czm_ray ray = czm_ray(position, direction);
vec3 ellipsoid_center = czm_view[3].xyz;
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
if (!czm_isEmpty(intersection))
{
out_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
else
{
discard;
}
czm_writeLogDepth();
}
`;var t2=`in vec4 position;
out vec4 positionEC;
void main()
{
positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
}
`;var ew=`uniform vec3 u_radii;
uniform vec3 u_oneOverEllipsoidRadiiSquared;
in vec3 v_positionEC;
vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)
{
vec3 positionEC = czm_pointAlongRay(ray, intersection);
vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;
vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));
vec3 sphericalNormal = normalize(positionMC / u_radii);
vec3 normalMC = geodeticNormal * side;
vec3 normalEC = normalize(czm_normal * normalMC);
vec2 st = czm_ellipsoidTextureCoordinates(sphericalNormal);
vec3 positionToEyeEC = -positionEC;
czm_materialInput materialInput;
materialInput.s = st.s;
materialInput.st = st;
materialInput.str = (positionMC + u_radii) / u_radii;
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef ONLY_SUN_LIGHTING
return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);
#else
return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
void main()
{
float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;
vec3 direction = normalize(v_positionEC);
vec3 ellipsoidCenter = czm_modelView[3].xyz;
float t1 = -1.0;
float t2 = -1.0;
float b = -2.0 * dot(direction, ellipsoidCenter);
float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;
float discriminant = b * b - 4.0 * c;
if (discriminant >= 0.0) {
t1 = (-b - sqrt(discriminant)) * 0.5;
t2 = (-b + sqrt(discriminant)) * 0.5;
}
if (t1 < 0.0 && t2 < 0.0) {
discard;
}
float t = min(t1, t2);
if (t < 0.0) {
t = 0.0;
}
czm_ray ray = czm_ray(t * direction, direction);
vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
if (czm_isEmpty(intersection))
{
discard;
}
vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);
vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);
out_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
out_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
#if (defined(WRITE_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
t = (intersection.start != 0.0) ? intersection.start : intersection.stop;
vec3 positionEC = czm_pointAlongRay(ray, t);
vec4 positionCC = czm_projection * vec4(positionEC, 1.0);
#ifdef LOG_DEPTH
czm_writeLogDepth(1.0 + positionCC.w);
#else
float z = positionCC.z / positionCC.w;
float n = czm_depthRange.near;
float f = czm_depthRange.far;
gl_FragDepth = (z * (f - n) + f + n) * 0.5;
#endif
#endif
}
`;var tw=`in vec3 position;
uniform vec3 u_radii;
out vec3 v_positionEC;
void main()
{
vec4 p = vec4(u_radii * position, 1.0);
v_positionEC = (czm_modelView * p).xyz;
gl_Position = czm_modelViewProjection * p;
gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);
czm_vertexLogDepth();
}
`;/**
 * @license
 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  * Neither the name of NVIDIA CORPORATION nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */var n2=`#if (FXAA_QUALITY_PRESET == 10)
#define FXAA_QUALITY_PS 3
#define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY_P1 3.0
#define FXAA_QUALITY_P2 12.0
#endif
#if (FXAA_QUALITY_PRESET == 11)
#define FXAA_QUALITY_PS 4
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 3.0
#define FXAA_QUALITY_P3 12.0
#endif
#if (FXAA_QUALITY_PRESET == 12)
#define FXAA_QUALITY_PS 5
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY_P4 12.0
#endif
#if (FXAA_QUALITY_PRESET == 13)
#define FXAA_QUALITY_PS 6
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 4.0
#define FXAA_QUALITY_P5 12.0
#endif
#if (FXAA_QUALITY_PRESET == 14)
#define FXAA_QUALITY_PS 7
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 4.0
#define FXAA_QUALITY_P6 12.0
#endif
#if (FXAA_QUALITY_PRESET == 15)
#define FXAA_QUALITY_PS 8
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY_P7 12.0
#endif
#if (FXAA_QUALITY_PRESET == 20)
#define FXAA_QUALITY_PS 3
#define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY_P1 2.0
#define FXAA_QUALITY_P2 8.0
#endif
#if (FXAA_QUALITY_PRESET == 21)
#define FXAA_QUALITY_PS 4
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 8.0
#endif
#if (FXAA_QUALITY_PRESET == 22)
#define FXAA_QUALITY_PS 5
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 8.0
#endif
#if (FXAA_QUALITY_PRESET == 23)
#define FXAA_QUALITY_PS 6
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 8.0
#endif
#if (FXAA_QUALITY_PRESET == 24)
#define FXAA_QUALITY_PS 7
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 3.0
#define FXAA_QUALITY_P6 8.0
#endif
#if (FXAA_QUALITY_PRESET == 25)
#define FXAA_QUALITY_PS 8
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY_P7 8.0
#endif
#if (FXAA_QUALITY_PRESET == 26)
#define FXAA_QUALITY_PS 9
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 4.0
#define FXAA_QUALITY_P8 8.0
#endif
#if (FXAA_QUALITY_PRESET == 27)
#define FXAA_QUALITY_PS 10
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 4.0
#define FXAA_QUALITY_P9 8.0
#endif
#if (FXAA_QUALITY_PRESET == 28)
#define FXAA_QUALITY_PS 11
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 4.0
#define FXAA_QUALITY_P10 8.0
#endif
#if (FXAA_QUALITY_PRESET == 29)
#define FXAA_QUALITY_PS 12
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY_P11 8.0
#endif
#if (FXAA_QUALITY_PRESET == 39)
#define FXAA_QUALITY_PS 12
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.0
#define FXAA_QUALITY_P2 1.0
#define FXAA_QUALITY_P3 1.0
#define FXAA_QUALITY_P4 1.0
#define FXAA_QUALITY_P5 1.5
#define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY_P11 8.0
#endif
#define FxaaBool bool
#define FxaaFloat float
#define FxaaFloat2 vec2
#define FxaaFloat3 vec3
#define FxaaFloat4 vec4
#define FxaaHalf float
#define FxaaHalf2 vec2
#define FxaaHalf3 vec3
#define FxaaHalf4 vec4
#define FxaaInt2 vec2
#define FxaaTex sampler2D
#define FxaaSat(x) clamp(x, 0.0, 1.0)
#define FxaaTexTop(t, p) texture(t, p)
#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
FxaaFloat4 FxaaPixelShader(
FxaaFloat2 pos,
FxaaTex tex,
FxaaFloat2 fxaaQualityRcpFrame,
FxaaFloat fxaaQualitySubpix,
FxaaFloat fxaaQualityEdgeThreshold,
FxaaFloat fxaaQualityEdgeThresholdMin
) {
FxaaFloat2 posM;
posM.x = pos.x;
posM.y = pos.y;
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
#define lumaM rgbyM.y
FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
FxaaFloat maxSM = max(lumaS, lumaM);
FxaaFloat minSM = min(lumaS, lumaM);
FxaaFloat maxESM = max(lumaE, maxSM);
FxaaFloat minESM = min(lumaE, minSM);
FxaaFloat maxWN = max(lumaN, lumaW);
FxaaFloat minWN = min(lumaN, lumaW);
FxaaFloat rangeMax = max(maxWN, maxESM);
FxaaFloat rangeMin = min(minWN, minESM);
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
FxaaFloat range = rangeMax - rangeMin;
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
FxaaBool earlyExit = range < rangeMaxClamped;
if(earlyExit)
return rgbyM;
FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
FxaaFloat lumaNS = lumaN + lumaS;
FxaaFloat lumaWE = lumaW + lumaE;
FxaaFloat subpixRcpRange = 1.0/range;
FxaaFloat subpixNSWE = lumaNS + lumaWE;
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
FxaaFloat lumaNESE = lumaNE + lumaSE;
FxaaFloat lumaNWNE = lumaNW + lumaNE;
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
FxaaFloat lumaNWSW = lumaNW + lumaSW;
FxaaFloat lumaSWSE = lumaSW + lumaSE;
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
FxaaBool horzSpan = edgeHorz >= edgeVert;
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
if(!horzSpan) lumaN = lumaW;
if(!horzSpan) lumaS = lumaE;
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
FxaaFloat gradientN = lumaN - lumaM;
FxaaFloat gradientS = lumaS - lumaM;
FxaaFloat lumaNN = lumaN + lumaM;
FxaaFloat lumaSS = lumaS + lumaM;
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
if(pairN) lengthSign = -lengthSign;
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
FxaaFloat2 posB;
posB.x = posM.x;
posB.y = posM.y;
FxaaFloat2 offNP;
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
if(!horzSpan) posB.x += lengthSign * 0.5;
if( horzSpan) posB.y += lengthSign * 0.5;
FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC;
FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
if(!pairN) lumaNN = lumaSS;
FxaaFloat gradientScaled = gradient * 1.0/4.0;
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
FxaaFloat subpixF = subpixD * subpixE;
FxaaBool lumaMLTZero = lumaMM < 0.0;
lumaEndN -= lumaNN * 0.5;
lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
#if (FXAA_QUALITY_PS > 3)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
#if (FXAA_QUALITY_PS > 4)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
#if (FXAA_QUALITY_PS > 5)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
#if (FXAA_QUALITY_PS > 6)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
#if (FXAA_QUALITY_PS > 7)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
#if (FXAA_QUALITY_PS > 8)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
#if (FXAA_QUALITY_PS > 9)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
#if (FXAA_QUALITY_PS > 10)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
#if (FXAA_QUALITY_PS > 11)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
#if (FXAA_QUALITY_PS > 12)
if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
#endif
}
FxaaFloat dstN = posM.x - posN.x;
FxaaFloat dstP = posP.x - posM.x;
if(!horzSpan) dstN = posM.y - posN.y;
if(!horzSpan) dstP = posP.y - posM.y;
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
FxaaFloat spanLength = (dstP + dstN);
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
FxaaFloat spanLengthRcp = 1.0/spanLength;
FxaaBool directionN = dstN < dstP;
FxaaFloat dst = min(dstN, dstP);
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
FxaaFloat subpixG = subpixF * subpixF;
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
}
`;var i2=`uniform vec4 u_initialColor;
#if TEXTURE_UNITS > 0
uniform sampler2D u_dayTextures[TEXTURE_UNITS];
uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];
uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];
#ifdef APPLY_ALPHA
uniform float u_dayTextureAlpha[TEXTURE_UNITS];
#endif
#ifdef APPLY_DAY_NIGHT_ALPHA
uniform float u_dayTextureNightAlpha[TEXTURE_UNITS];
uniform float u_dayTextureDayAlpha[TEXTURE_UNITS];
#endif
#ifdef APPLY_SPLIT
uniform float u_dayTextureSplit[TEXTURE_UNITS];
#endif
#ifdef APPLY_BRIGHTNESS
uniform float u_dayTextureBrightness[TEXTURE_UNITS];
#endif
#ifdef APPLY_CONTRAST
uniform float u_dayTextureContrast[TEXTURE_UNITS];
#endif
#ifdef APPLY_HUE
uniform float u_dayTextureHue[TEXTURE_UNITS];
#endif
#ifdef APPLY_SATURATION
uniform float u_dayTextureSaturation[TEXTURE_UNITS];
#endif
#ifdef APPLY_GAMMA
uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];
#endif
#ifdef APPLY_IMAGERY_CUTOUT
uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];
#endif
#ifdef APPLY_COLOR_TO_ALPHA
uniform vec4 u_colorsToAlpha[TEXTURE_UNITS];
#endif
uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];
#endif
#if defined(HAS_WATER_MASK) && (defined(SHOW_REFLECTIVE_OCEAN) || defined(APPLY_MATERIAL))
uniform sampler2D u_waterMask;
uniform vec4 u_waterMaskTranslationAndScale;
uniform float u_zoomedOutOceanSpecularIntensity;
#endif
#ifdef SHOW_OCEAN_WAVES
uniform sampler2D u_oceanNormalMap;
#endif
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
uniform vec2 u_lightingFadeDistance;
#endif
#ifdef TILE_LIMIT_RECTANGLE
uniform vec4 u_cartographicLimitRectangle;
#endif
#ifdef GROUND_ATMOSPHERE
uniform vec2 u_nightFadeDistance;
#endif
#ifdef ENABLE_CLIPPING_PLANES
uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
uniform highp sampler2D u_clippingDistance;
in vec2 v_clippingPosition;
flat in int v_regionIndex;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
uniform float u_minimumBrightness;
#endif
#ifdef COLOR_CORRECT
uniform vec3 u_hsbShift;
#endif
#ifdef HIGHLIGHT_FILL_TILE
uniform vec4 u_fillHighlightColor;
#endif
#ifdef TRANSLUCENT
uniform vec4 u_frontFaceAlphaByDistance;
uniform vec4 u_backFaceAlphaByDistance;
uniform vec4 u_translucencyRectangle;
#endif
#ifdef UNDERGROUND_COLOR
uniform vec4 u_undergroundColor;
uniform vec4 u_undergroundColorAlphaByDistance;
#endif
#ifdef ENABLE_VERTEX_LIGHTING
uniform float u_lambertDiffuseMultiplier;
uniform float u_vertexShadowDarkness;
#endif
in vec3 v_positionMC;
in vec3 v_positionEC;
in vec3 v_textureCoordinates;
in vec3 v_normalMC;
in vec3 v_normalEC;
#ifdef APPLY_MATERIAL
in float v_height;
in float v_slope;
in float v_aspect;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
in float v_distance;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
in vec3 v_atmosphereRayleighColor;
in vec3 v_atmosphereMieColor;
in float v_atmosphereOpacity;
#endif
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
float interpolateByDistance(vec4 nearFarScalar, float distance)
{
float startDistance = nearFarScalar.x;
float startValue = nearFarScalar.y;
float endDistance = nearFarScalar.z;
float endValue = nearFarScalar.w;
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
return mix(startValue, endValue, t);
}
#endif
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)
vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
{
return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
}
#endif
#ifdef TRANSLUCENT
bool inTranslucencyRectangle()
{
return
v_textureCoordinates.x > u_translucencyRectangle.x &&
v_textureCoordinates.x < u_translucencyRectangle.z &&
v_textureCoordinates.y > u_translucencyRectangle.y &&
v_textureCoordinates.y < u_translucencyRectangle.w;
}
#endif
vec4 sampleAndBlend(
vec4 previousColor,
sampler2D textureToSample,
vec2 tileTextureCoordinates,
vec4 textureCoordinateRectangle,
vec4 textureCoordinateTranslationAndScale,
float textureAlpha,
float textureNightAlpha,
float textureDayAlpha,
float textureBrightness,
float textureContrast,
float textureHue,
float textureSaturation,
float textureOneOverGamma,
float split,
vec4 colorToAlpha,
float nightBlend)
{
vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);
#endif
vec2 translation = textureCoordinateTranslationAndScale.xy;
vec2 scale = textureCoordinateTranslationAndScale.zw;
vec2 textureCoordinates = tileTextureCoordinates * scale + translation;
vec4 value = texture(textureToSample, textureCoordinates);
vec3 color = value.rgb;
float alpha = value.a;
#ifdef APPLY_COLOR_TO_ALPHA
vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
colorDiff.r = czm_maximumComponent(colorDiff);
alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);
#endif
#if !defined(APPLY_GAMMA)
vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));
color = tempColor.rgb;
alpha = tempColor.a;
#else
color = pow(color, vec3(textureOneOverGamma));
#endif
#ifdef APPLY_SPLIT
float splitPosition = czm_splitPosition;
if (split < 0.0 && gl_FragCoord.x > splitPosition) {
alpha = 0.0;
}
else if (split > 0.0 && gl_FragCoord.x < splitPosition) {
alpha = 0.0;
}
#endif
#ifdef APPLY_BRIGHTNESS
color = mix(vec3(0.0), color, textureBrightness);
#endif
#ifdef APPLY_CONTRAST
color = mix(vec3(0.5), color, textureContrast);
#endif
#ifdef APPLY_HUE
color = czm_hue(color, textureHue);
#endif
#ifdef APPLY_SATURATION
color = czm_saturation(color, textureSaturation);
#endif
float sourceAlpha = alpha * textureAlpha;
float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);
outAlpha += sign(outAlpha) - 1.0;
vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;
return vec4(outColor, max(outAlpha, 0.0));
}
vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);
const float fExposure = 2.0;
vec3 computeEllipsoidPosition()
{
float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);
vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);
xy *= czm_viewport.zw * mpp * 0.5;
vec3 direction;
if (czm_orthographicIn3D == 1.0)
{
direction = vec3(0.0, 0.0, -1.0);
}
else
{
direction = normalize(vec3(xy, -czm_currentFrustum.x));
}
czm_ray ray = czm_ray(vec3(0.0), direction);
vec3 ellipsoid_center = czm_view[3].xyz;
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);
return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;
}
void main()
{
#ifdef TILE_LIMIT_RECTANGLE
if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||
v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)
{
discard;
}
#endif
#ifdef ENABLE_CLIPPING_PLANES
float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);
#endif
#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)
vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0));
vec3 normalEC = czm_normal3D * normalMC;
#endif
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);
#else
float nightBlend = 0.0;
#endif
vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);
#ifdef SHOW_TILE_BOUNDARIES
if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||
v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))
{
color = vec4(1.0, 0.0, 0.0, 1.0);
}
#endif
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
float cameraDist;
if (czm_sceneMode == czm_sceneMode2D)
{
cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;
}
else if (czm_sceneMode == czm_sceneModeColumbusView)
{
cameraDist = -czm_view[3].z;
}
else
{
cameraDist = length(czm_view[3]);
}
float fadeOutDist = u_lightingFadeDistance.x;
float fadeInDist = u_lightingFadeDistance.y;
if (czm_sceneMode != czm_sceneMode3D) {
vec3 radii = czm_ellipsoidRadii;
float maxRadii = max(radii.x, max(radii.y, radii.z));
fadeOutDist -= maxRadii;
fadeInDist -= maxRadii;
}
float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);
#else
float fade = 0.0;
#endif
#if defined(HAS_WATER_MASK) && (defined(SHOW_REFLECTIVE_OCEAN) || defined(APPLY_MATERIAL))
vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;
vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;
vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;
waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;
float mask = texture(u_waterMask, waterMaskTextureCoordinates).r;
#ifdef SHOW_REFLECTIVE_OCEAN
if (mask > 0.0)
{
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
vec2 ellipsoidTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC);
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC.zyx);
vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);
}
#endif
#endif
#ifdef APPLY_MATERIAL
czm_materialInput materialInput;
materialInput.st = v_textureCoordinates.st;
materialInput.normalEC = normalize(v_normalEC);
materialInput.positionToEyeEC = -v_positionEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));
materialInput.slope = v_slope;
materialInput.height = v_height;
materialInput.aspect = v_aspect;
#ifdef HAS_WATER_MASK
materialInput.waterMask = mask;
#endif
czm_material material = czm_getMaterial(materialInput);
vec4 materialColor = vec4(material.diffuse, material.alpha);
color = alphaBlend(materialColor, color);
#endif
#ifdef ENABLE_VERTEX_LIGHTING
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
#elif defined(ENABLE_DAYNIGHT_SHADING)
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
diffuseIntensity = mix(1.0, diffuseIntensity, fade);
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
#else
vec4 finalColor = color;
#endif
#ifdef ENABLE_CLIPPING_PLANES
vec4 clippingPlanesEdgeColor = vec4(1.0);
clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;
float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;
if (clipDistance < clippingPlanesEdgeWidth)
{
finalColor = clippingPlanesEdgeColor;
}
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
vec2 clippingPosition = v_clippingPosition;
int regionIndex = v_regionIndex;
clipPolygons(u_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
#endif
#ifdef HIGHLIGHT_FILL_TILE
finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);
#endif
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
vec3 atmosphereLightDirection = czm_sunDirectionWC;
#else
vec3 atmosphereLightDirection = czm_lightDirectionWC;
#endif
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
if (!czm_backFacing())
{
bool dynamicLighting = false;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
dynamicLighting = true;
#endif
vec3 rayleighColor;
vec3 mieColor;
float opacity;
vec3 positionWC;
vec3 lightDirection;
#ifdef PER_FRAGMENT_GROUND_ATMOSPHERE
positionWC = computeEllipsoidPosition();
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
computeAtmosphereScattering(
positionWC,
lightDirection,
rayleighColor,
mieColor,
opacity
);
#else
positionWC = v_positionMC;
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
rayleighColor = v_atmosphereRayleighColor;
mieColor = v_atmosphereMieColor;
opacity = v_atmosphereOpacity;
#endif
#ifdef COLOR_CORRECT
const bool ignoreBlackPixels = true;
rayleighColor = czm_applyHSBShift(rayleighColor, u_hsbShift, ignoreBlackPixels);
mieColor = czm_applyHSBShift(mieColor, u_hsbShift, ignoreBlackPixels);
#endif
vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
#ifdef FOG
vec3 fogColor = groundAtmosphereColor.rgb;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
fogColor *= darken;
#endif
#ifndef HDR
fogColor.rgb = czm_pbrNeutralTonemapping(fogColor.rgb);
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
#endif
finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, czm_fogVisualDensityScalar), finalColor.a);
#else
const float transmittanceModifier = 0.5;
float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);
vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
float fadeInDist = u_nightFadeDistance.x;
float fadeOutDist = u_nightFadeDistance.y;
float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);
float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);
vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);
finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);
#endif
#ifndef HDR
finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);
#else
finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);
#endif
finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);
#endif
}
#endif
#ifdef UNDERGROUND_COLOR
if (czm_backFacing())
{
float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);
float distance = max(v_distance - distanceFromEllipsoid, 0.0);
float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);
vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);
finalColor = alphaBlend(undergroundColor, finalColor);
}
#endif
#ifdef TRANSLUCENT
if (inTranslucencyRectangle())
{
vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;
finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);
}
#endif
out_FragColor =  finalColor;
}
#ifdef SHOW_REFLECTIVE_OCEAN
float waveFade(float edge0, float edge1, float x)
{
float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return pow(1.0 - y, 5.0);
}
float linearFade(float edge0, float edge1, float x)
{
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
}
const float oceanFrequencyLowAltitude = 825000.0;
const float oceanAnimationSpeedLowAltitude = 0.004;
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
const float oceanSpecularIntensity = 0.5;
const float oceanFrequencyHighAltitude = 125000.0;
const float oceanAnimationSpeedHighAltitude = 0.008;
const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)
{
vec3 positionToEyeEC = -positionEyeCoordinates;
float positionToEyeECLength = length(positionToEyeEC);
vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));
float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);
#ifdef SHOW_OCEAN_WAVES
float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;
vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);
vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);
time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);
float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);
float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);
vec3 normalTangentSpace =
(highAltitudeFade * normalTangentSpaceHighAltitude) +
(lowAltitudeFade * normalTangentSpaceLowAltitude);
normalTangentSpace = normalize(normalTangentSpace);
normalTangentSpace.xy *= waveIntensity;
normalTangentSpace = normalize(normalTangentSpace);
#else
vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);
#endif
vec3 normalEC = enuToEye * normalTangentSpace;
const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);
float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);
#ifdef SHOW_OCEAN_WAVES
float tsPerturbationRatio = normalTangentSpace.z;
vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
#else
vec3 nonDiffuseHighlight = vec3(0.0);
#endif
float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
float specular = specularIntensity * surfaceReflectance;
#ifdef HDR
specular *= 1.4;
float e = 0.2;
float d = 3.3;
float c = 1.7;
vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));
#else
vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;
#endif
return vec4(color, imageryColor.a);
}
#endif // #ifdef SHOW_REFLECTIVE_OCEAN
`;var o2=`#ifdef QUANTIZATION_BITS12
in vec4 compressed0;
in float compressed1;
#else
in vec4 position3DAndHeight;
in vec4 textureCoordAndEncodedNormals;
#endif
#ifdef GEODETIC_SURFACE_NORMALS
in vec3 geodeticSurfaceNormal;
#endif
#ifdef EXAGGERATION
uniform vec2 u_verticalExaggerationAndRelativeHeight;
#endif
uniform vec3 u_center3D;
uniform mat4 u_modifiedModelView;
uniform mat4 u_modifiedModelViewProjection;
uniform vec4 u_tileRectangle;
uniform vec2 u_southAndNorthLatitude;
uniform vec2 u_southMercatorYAndOneOverHeight;
out vec3 v_positionMC;
out vec3 v_positionEC;
out vec3 v_textureCoordinates;
out vec3 v_normalMC;
out vec3 v_normalEC;
#ifdef APPLY_MATERIAL
out float v_slope;
out float v_aspect;
out float v_height;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
out float v_distance;
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
out vec3 v_atmosphereRayleighColor;
out vec3 v_atmosphereMieColor;
out float v_atmosphereOpacity;
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
uniform highp sampler2D u_clippingExtents;
out vec2 v_clippingPosition;
flat out int v_regionIndex;
#endif
vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);
float get2DYPositionFraction(vec2 textureCoordinates);
vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)
{
return u_modifiedModelViewProjection * vec4(position, 1.0);
}
float get2DMercatorYPositionFraction(vec2 textureCoordinates)
{
const float maxTileWidth = 0.003068;
float positionFraction = textureCoordinates.y;
float southLatitude = u_southAndNorthLatitude.x;
float northLatitude = u_southAndNorthLatitude.y;
if (northLatitude - southLatitude > maxTileWidth)
{
float southMercatorY = u_southMercatorYAndOneOverHeight.x;
float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;
float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);
currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);
positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);
}
return positionFraction;
}
float get2DGeographicYPositionFraction(vec2 textureCoordinates)
{
return textureCoordinates.y;
}
vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)
{
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
return u_modifiedModelViewProjection * rtcPosition2D;
}
vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)
{
return getPositionPlanarEarth(position, 0.0, textureCoordinates);
}
vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)
{
return getPositionPlanarEarth(position, height, textureCoordinates);
}
vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)
{
vec3 position3DWC = position + u_center3D;
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);
return czm_modelViewProjection * morphPosition;
}
#ifdef QUANTIZATION_BITS12
uniform vec2 u_minMaxHeight;
uniform mat4 u_scaleAndBias;
#endif
void main()
{
#ifdef QUANTIZATION_BITS12
vec2 xy = czm_decompressTextureCoordinates(compressed0.x);
vec2 zh = czm_decompressTextureCoordinates(compressed0.y);
vec3 position = vec3(xy, zh.x);
float height = zh.y;
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);
height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;
position = (u_scaleAndBias * vec4(position, 1.0)).xyz;
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y) || defined(APPLY_MATERIAL)
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
float encodedNormal = compressed1;
#elif defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
float encodedNormal = 0.0;
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)
float webMercatorT = textureCoordinates.y;
float encodedNormal = compressed0.w;
#else
float webMercatorT = textureCoordinates.y;
float encodedNormal = 0.0;
#endif
#else
vec3 position = position3DAndHeight.xyz;
float height = position3DAndHeight.w;
vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = textureCoordAndEncodedNormals.z;
float encodedNormal = textureCoordAndEncodedNormals.w;
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
float webMercatorT = textureCoordinates.y;
float encodedNormal = textureCoordAndEncodedNormals.z;
#elif defined(INCLUDE_WEB_MERCATOR_Y)
float webMercatorT = textureCoordAndEncodedNormals.z;
float encodedNormal = 0.0;
#else
float webMercatorT = textureCoordinates.y;
float encodedNormal = 0.0;
#endif
#endif
vec3 position3DWC = position + u_center3D;
#ifdef GEODETIC_SURFACE_NORMALS
vec3 ellipsoidNormal = geodeticSurfaceNormal;
#else
vec3 ellipsoidNormal = normalize(position3DWC);
#endif
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
float exaggeration = u_verticalExaggerationAndRelativeHeight.x;
float relativeHeight = u_verticalExaggerationAndRelativeHeight.y;
float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;
float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);
newHeight = max(newHeight, -minRadius);
vec3 offset = ellipsoidNormal * (newHeight - height);
position += offset;
position3DWC += offset;
height = newHeight;
#endif
gl_Position = getPosition(position, height, textureCoordinates);
v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;
v_positionMC = position3DWC;
v_textureCoordinates = vec3(textureCoordinates, webMercatorT);
#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
vec3 normalMC = czm_octDecode(encodedNormal);
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;
vec3 rejection = normalMC - projection;
normalMC = normalize(projection + rejection * exaggeration);
#endif
v_normalMC = normalMC;
v_normalEC = czm_normal3D * v_normalMC;
#endif
#ifdef ENABLE_CLIPPING_POLYGONS
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC);
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
vec2 minDistance = vec2(czm_infinity);
v_clippingPosition = vec2(czm_infinity);
v_regionIndex = -1;
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex);
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
vec2 distance = abs(rectUv - clamped) * extents.wz;
float threshold = 0.01;
if (minDistance.x > distance.x || minDistance.y > distance.y) {
minDistance = distance;
v_clippingPosition = rectUv;
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
v_regionIndex = regionIndex;
}
}
}
#endif
#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))
bool dynamicLighting = false;
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
dynamicLighting = true;
#endif
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
vec3 atmosphereLightDirection = czm_sunDirectionWC;
#else
vec3 atmosphereLightDirection = czm_lightDirectionWC;
#endif
vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));
computeAtmosphereScattering(
position3DWC,
lightDirection,
v_atmosphereRayleighColor,
v_atmosphereMieColor,
v_atmosphereOpacity
);
#endif
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);
#endif
#ifdef APPLY_MATERIAL
float northPoleZ = czm_ellipsoidRadii.z;
vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);
vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));
float dotProd = abs(dot(ellipsoidNormal, v_normalMC));
v_slope = acos(dotProd);
vec3 normalRejected = ellipsoidNormal * dotProd;
vec3 normalProjected = v_normalMC - normalRejected;
vec3 aspectVector = normalize(normalProjected);
v_aspect = acos(dot(aspectVector, vectorEastMC));
float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);
v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);
v_height = height;
#endif
}
`;var nw=`void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
float atmosphereInnerRadius = length(positionWC);
computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
}
`;var r2=`uniform sampler2D u_texture;
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = texture(u_texture, v_textureCoordinates);
}
`;var s2=`in vec4 position;
in float webMercatorT;
uniform vec2 u_textureDimensions;
out vec2 v_textureCoordinates;
void main()
{
v_textureCoordinates = vec2(position.x, webMercatorT);
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
}
`;var iw=`float interpolateByDistance(vec4 nearFarScalar, float distance)
{
float startDistance = nearFarScalar.x;
float startValue = nearFarScalar.y;
float endDistance = nearFarScalar.z;
float endValue = nearFarScalar.w;
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
return mix(startValue, endValue, t);
}
void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)
{
float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;
float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;
float distanceAdjustMax = czm_ellipsoidRadii.x;
float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;
float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);
float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;
float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
underTranslucentGlobe = 0.0;
#if defined(GLOBE_TRANSLUCENT)
czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);
if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {
vec3 direction = normalize(positionWC);
czm_ray ellipsoidRay = czm_ray(positionWC, -direction);
czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);
vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);
float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));
opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));
vec3 horizonColor = vec3(0.1, 0.2, 0.3);
vec3 nearColor = vec3(0.0);
rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);
underTranslucentGlobe = 1.0;
return;
}
#endif
computeScattering(
primaryRay,
length(cameraToPositionWC),
lightDirection,
atmosphereInnerRadius,
rayleighColor,
mieColor,
opacity
);
float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);
float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;
opacity *= pow(nightAlpha, 0.5);
}
`;var a2=`in vec3 v_outerPositionWC;
uniform vec3 u_hsbShift;
#ifndef PER_FRAGMENT_ATMOSPHERE
in vec3 v_mieColor;
in vec3 v_rayleighColor;
in float v_opacity;
in float v_translucent;
#endif
void main (void)
{
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_outerPositionWC, lightEnum);
vec3 mieColor;
vec3 rayleighColor;
float opacity;
float translucent;
#ifdef PER_FRAGMENT_ATMOSPHERE
computeAtmosphereScattering(
v_outerPositionWC,
lightDirection,
rayleighColor,
mieColor,
opacity,
translucent
);
#else
mieColor = v_mieColor;
rayleighColor = v_rayleighColor;
opacity = v_opacity;
translucent = v_translucent;
#endif
vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);
#ifndef HDR
color.rgb = czm_pbrNeutralTonemapping(color.rgb);
color.rgb = czm_inverseGamma(color.rgb);
#endif
#ifdef COLOR_CORRECT
const bool ignoreBlackPixels = true;
color.rgb = czm_applyHSBShift(color.rgb, u_hsbShift, ignoreBlackPixels);
#endif
if (translucent == 0.0) {
color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
}
out_FragColor = color;
}
`;var c2=`in vec4 position;
out vec3 v_outerPositionWC;
#ifndef PER_FRAGMENT_ATMOSPHERE
out vec3 v_mieColor;
out vec3 v_rayleighColor;
out float v_opacity;
out float v_translucent;
#endif
void main(void)
{
vec4 positionWC = czm_model * position;
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC.xyz, lightEnum);
#ifndef PER_FRAGMENT_ATMOSPHERE
computeAtmosphereScattering(
positionWC.xyz,
lightDirection,
v_rayleighColor,
v_mieColor,
v_opacity,
v_translucent
);
#endif
v_outerPositionWC = positionWC.xyz;
gl_Position = czm_modelViewProjection * position;
}
`;var l2=`uniform samplerCube u_cubeMap;
in vec3 v_texCoord;
void main()
{
vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord));
out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
}
`;var u2=`in vec3 position;
out vec3 v_texCoord;
void main()
{
vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
gl_Position = czm_projection * vec4(p, 1.0);
v_texCoord = position.xyz;
}
`;var f2=`uniform sampler2D u_texture;
in vec2 v_textureCoordinates;
void main()
{
vec4 color = texture(u_texture, v_textureCoordinates);
out_FragColor = czm_gammaCorrect(color);
}
`;var d2=`uniform float u_radiusTS;
in vec2 v_textureCoordinates;
vec2 rotate(vec2 p, vec2 direction)
{
return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);
}
vec4 addBurst(vec2 position, vec2 direction, float lengthScalar)
{
vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);
float radius = length(rotatedPosition) * lengthScalar;
float burst = 1.0 - smoothstep(0.0, 0.55, radius);
return vec4(burst);
}
void main()
{
float lengthScalar = 2.0 / sqrt(2.0);
vec2 position = v_textureCoordinates - vec2(0.5);
float radius = length(position) * lengthScalar;
float surface = step(radius, u_radiusTS);
vec4 color = vec4(vec2(1.0), surface + 0.2, surface);
float glow = 1.0 - smoothstep(0.0, 0.55, radius);
color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;
vec4 burst = vec4(0.0);
burst += 0.4 * addBurst(position, vec2(0.38942,  0.92106), lengthScalar);
burst += 0.4 * addBurst(position, vec2(0.99235,  0.12348), lengthScalar);
burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.31457,  0.94924), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.97931,  0.20239), lengthScalar);
burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar);
color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;
out_FragColor = clamp(color, vec4(0.0), vec4(1.0));
}
`;var h2=`in vec2 direction;
uniform float u_size;
out vec2 v_textureCoordinates;
void main()
{
vec4 position;
if (czm_morphTime == 1.0)
{
position = vec4(czm_sunPositionWC, 1.0);
}
else
{
position = vec4(czm_sunPositionColumbusView.zxy, 1.0);
}
vec4 positionEC = czm_view * position;
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
vec2 halfSize = vec2(u_size * 0.5);
halfSize *= ((direction * 2.0) - 1.0);
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);
v_textureCoordinates = direction;
}
`;var m2=`in vec2 v_textureCoordinates;
void main()
{
czm_materialInput materialInput;
materialInput.s = v_textureCoordinates.s;
materialInput.st = v_textureCoordinates;
materialInput.str = vec3(v_textureCoordinates, 0.0);
materialInput.normalEC = vec3(0.0, 0.0, -1.0);
czm_material material = czm_getMaterial(materialInput);
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
}
`;function Jat(e){let t,n=e.name,i=e.message;c(n)&&c(i)?t=`${n}: ${i}`:t=e.toString();let o=e.stack;return c(o)&&(t+=`
${o}`),t}var ep=Jat;async function ect(e,t,n,i){return c(i)||(i=!1),T.typeOf.object("terrainProvider",e),T.typeOf.number("level",t),T.typeOf.bool("rejectOnTileFail",i),T.defined("positions",n),ict(e,t,n,i)}function tct(e,t,n){let i=e[0],o=i.terrainProvider.requestTileGeometry(i.x,i.y,i.level);if(!o)return!1;let r;return n?r=o.then(C0e(i)):r=o.then(C0e(i)).catch(oct(i)),e.shift(),t.push(r),!0}function nct(e){return new Promise(function(t){setTimeout(t,e)})}function LX(e,t,n){return e.length?tct(e,t,n)?LX(e,t,n):nct(100).then(()=>LX(e,t,n)):Promise.resolve()}function ict(e,t,n,i){let o=e.tilingScheme,r,s=[],a={};for(r=0;r<n.length;++r){let u=o.positionToTileXY(n[r],t);if(!c(u))continue;let f=u.toString();if(!a.hasOwnProperty(f)){let h={x:u.x,y:u.y,level:t,tilingScheme:o,terrainProvider:e,positions:[]};a[f]=h,s.push(h)}a[f].positions.push(n[r])}let l=[];return LX(s,l,i).then(function(){return Promise.all(l).then(function(){return n})})}function A0e(e,t,n){let i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function C0e(e){let t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let r=0;r<t.length;++r){let s=t[r];if(!A0e(s,i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then(function(){for(let r=0;r<t.length;++r){let s=t[r];A0e(s,i,n)}}):Promise.resolve()}}function oct(e){let t=e.positions;return function(){for(let n=0;n<t.length;++n){let i=t[n];i.height=void 0}}}var p2=ect;var NX=new H;async function E0e(e,t,n){if(c(n)||(n=!1),!c(e))throw new E("terrainProvider is required.");if(!c(t))throw new E("positions is required.");let i=[],o=[],r=e.availability;if(!c(r))throw new E("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");let s=[];for(let l=0;l<t.length;++l){let u=t[l],f=r.computeMaximumLevelAtPosition(u);if(o[l]=f,f===0){e.tilingScheme.positionToTileXY(u,1,NX);let p=e.loadTileDataAvailability(NX.x,NX.y,1);c(p)&&s.push(p)}let h=i[f];c(h)||(i[f]=h=[]),h.push(u)}await Promise.all(s),await Promise.all(i.map(function(l,u){if(c(l))return p2(e,u,l,n)}));let a=[];for(let l=0;l<t.length;++l){let u=t[l];r.computeMaximumLevelAtPosition(u)!==o[l]&&a.push(u)}return a.length>0&&await E0e(e,a,n),t}var UT=E0e;async function FX(e,t){let n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid,r,s=t.camera.getRectangleCameraCoordinates(e);if(t.mode===oe.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),!c(n))return r;let a=n.availability;if(!c(a)||t.mode===oe.SCENE2D)return r;let l=[ce.center(e),ce.southeast(e),ce.southwest(e),ce.northeast(e),ce.northwest(e)],u=await FX._sampleTerrainMostDetailed(n,l),f=!1,h=u.reduce(function(g,m){return c(m.height)?(f=!0,Math.max(m.height,g)):g},-Number.MAX_VALUE),p=r;return f&&(p.height+=h),p}FX._sampleTerrainMostDetailed=UT;var VT=FX;var rct={NONE:0,LERC:1},fd=Object.freeze(rct);var sct={NONE:0,BITS12:1},ea=Object.freeze(sct);var zT=new d,act=new d,dd=new H,cH=new B,cct=new B,lct=Math.pow(2,12);function Ic(e,t,n,i,o,r,s,a,l,u){let f=ea.NONE,h,p;if(c(t)&&c(n)&&c(i)&&c(o)){let g=t.minimum,m=t.maximum,y=d.subtract(m,g,act),b=i-n;Math.max(d.maximumComponent(y),b)<lct-1?f=ea.BITS12:f=ea.NONE,h=B.inverseTransformation(o,new B);let A=d.negate(g,zT);B.multiply(B.fromTranslation(A,cH),h,h);let C=zT;C.x=1/y.x,C.y=1/y.y,C.z=1/y.z,B.multiply(B.fromScale(C,cH),h,h),p=B.clone(o),B.setTranslation(p,d.ZERO,p),o=B.clone(o,new B);let S=B.fromTranslation(g,cH),v=B.fromScale(y,cct),P=B.multiply(S,v,cH);B.multiply(o,P,o),B.multiply(p,P,p)}this.quantization=f,this.minimumHeight=n,this.maximumHeight=i,this.center=d.clone(e),this.toScaledENU=h,this.fromScaledENU=o,this.matrix=p,this.hasVertexNormals=r,this.hasWebMercatorT=s??!1,this.hasGeodeticSurfaceNormals=a??!1,this.exaggeration=l??1,this.exaggerationRelativeHeight=u??0,this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}Ic.prototype.encode=function(e,t,n,i,o,r,s,a){let l=i.x,u=i.y;if(this.quantization===ea.BITS12){n=B.multiplyByPoint(this.toScaledENU,n,zT),n.x=O.clamp(n.x,0,1),n.y=O.clamp(n.y,0,1),n.z=O.clamp(n.z,0,1);let f=this.maximumHeight-this.minimumHeight,h=O.clamp((o-this.minimumHeight)/f,0,1);H.fromElements(n.x,n.y,dd);let p=Ln.compressTextureCoordinates(dd);H.fromElements(n.z,h,dd);let g=Ln.compressTextureCoordinates(dd);H.fromElements(l,u,dd);let m=Ln.compressTextureCoordinates(dd);if(e[t++]=p,e[t++]=g,e[t++]=m,this.hasWebMercatorT){H.fromElements(s,0,dd);let y=Ln.compressTextureCoordinates(dd);e[t++]=y}}else d.subtract(n,this.center,zT),e[t++]=zT.x,e[t++]=zT.y,e[t++]=zT.z,e[t++]=o,e[t++]=l,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=Ln.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};var uct=new d,S0e=new d;Ic.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;let i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();let r=this.stride;for(let s=0;s<o;s++){for(let f=0;f<i;f++){let h=s*i+f,p=s*r+f;t[p]=e[h]}let a=this.decodePosition(t,s,uct),l=n.geodeticSurfaceNormal(a,S0e),u=s*r+this._offsetGeodeticSurfaceNormal;t[u]=l.x,t[u+1]=l.y,t[u+2]=l.z}};Ic.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;let n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();let o=this.stride;for(let r=0;r<i;r++)for(let s=0;s<o;s++){let a=r*n+s,l=r*o+s;t[l]=e[a]}};Ic.prototype.decodePosition=function(e,t,n){if(c(n)||(n=new d),t*=this.stride,this.quantization===ea.BITS12){let i=Ln.decompressTextureCoordinates(e[t],dd);n.x=i.x,n.y=i.y;let o=Ln.decompressTextureCoordinates(e[t+1],dd);return n.z=o.x,B.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],d.add(n,this.center,n)};Ic.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);let i=this.exaggeration,o=this.exaggerationRelativeHeight;if(i!==1&&this.hasGeodeticSurfaceNormals){let s=this.decodeGeodeticSurfaceNormal(e,t,S0e),a=this.decodeHeight(e,t),l=Dr.getHeight(a,i,o)-a;n.x+=s.x*l,n.y+=s.y*l,n.z+=s.z*l}return n};Ic.prototype.decodeTextureCoordinates=function(e,t,n){return c(n)||(n=new H),t*=this.stride,this.quantization===ea.BITS12?Ln.decompressTextureCoordinates(e[t+2],n):H.fromElements(e[t+4],e[t+5],n)};Ic.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===ea.BITS12?Ln.decompressTextureCoordinates(e[t+1],dd).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};Ic.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===ea.BITS12?Ln.decompressTextureCoordinates(e[t+3],dd).x:e[t+6]};Ic.prototype.getOctEncodedNormal=function(e,t,n){t=t*this.stride+this._offsetVertexNormal;let i=e[t]/256,o=Math.floor(i),r=(i-o)*256;return H.fromElements(o,r,n)};Ic.prototype.decodeGeodeticSurfaceNormal=function(e,t,n){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,n.x=e[t],n.y=e[t+1],n.z=e[t+2],n};Ic.prototype._calculateStrideAndOffsets=function(){let e=0;switch(this.quantization){case ea.BITS12:e+=3;break;default:e+=6}this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};var lH={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},uH={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};Ic.prototype.getAttributes=function(e){let t=$.FLOAT,n=$.getSizeInBytes(t),i=this.stride*n,o=0,r=[];function s(a,l){r.push({index:a,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:l,offsetInBytes:o,strideInBytes:i}),o+=l*n}if(this.quantization===ea.NONE){s(lH.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(lH.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(lH.geodeticSurfaceNormal,3)}else{let a=this.hasWebMercatorT||this.hasVertexNormals,l=this.hasWebMercatorT&&this.hasVertexNormals;s(uH.compressed0,a?4:3),l&&s(uH.compressed1,1),this.hasGeodeticSurfaceNormals&&s(uH.geodeticSurfaceNormal,3)}return r};Ic.prototype.getAttributeLocations=function(){return this.quantization===ea.NONE?lH:uH};Ic.clone=function(e,t){if(c(e))return c(t)||(t=new Ic),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=d.clone(e.center),t.toScaledENU=B.clone(e.toScaledENU),t.fromScaledENU=B.clone(e.fromScaledENU),t.matrix=B.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};var Oc=Ic;var tp={};tp.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var BX=new d,fct=new B,dct=new d,hct=new d;tp.computeVertices=function(e){if(!c(e)||!c(e.heightmap))throw new E("options.heightmap is required.");if(!c(e.width)||!c(e.height))throw new E("options.width and options.height are required.");if(!c(e.nativeRectangle))throw new E("options.nativeRectangle is required.");if(!c(e.skirtHeight))throw new E("options.skirtHeight is required.");let t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=O.PI_OVER_TWO,a=O.toRadians,l=e.heightmap,u=e.width,f=e.height,h=e.skirtHeight,p=h>0,g=e.isGeographic??!0,m=e.ellipsoid??ie.default,y=1/m.maximumRadius,b=ce.clone(e.nativeRectangle),x=ce.clone(e.rectangle),A,C,S,v;c(x)?(A=x.west,C=x.south,S=x.east,v=x.north):g?(A=a(b.west),C=a(b.south),S=a(b.east),v=a(b.north)):(A=b.west*y,C=s-2*o(r(-b.south*y)),S=b.east*y,v=s-2*o(r(-b.north*y)));let P=e.relativeToCenter,M=c(P);P=M?P:d.ZERO;let R=e.includeWebMercatorT??!1,L=e.exaggeration??1,F=e.exaggerationRelativeHeight??0,w=L!==1,D=e.structure??tp.DEFAULT_STRUCTURE,I=D.heightScale??tp.DEFAULT_STRUCTURE.heightScale,N=D.heightOffset??tp.DEFAULT_STRUCTURE.heightOffset,k=D.elementsPerHeight??tp.DEFAULT_STRUCTURE.elementsPerHeight,z=D.stride??tp.DEFAULT_STRUCTURE.stride,V=D.elementMultiplier??tp.DEFAULT_STRUCTURE.elementMultiplier,j=D.isBigEndian??tp.DEFAULT_STRUCTURE.isBigEndian,U=ce.computeWidth(b),q=ce.computeHeight(b),Y=U/(u-1),te=q/(f-1);g||(U*=y,q*=y);let K=m.radiiSquared,Z=K.x,ee=K.y,me=K.z,Te=65536,ue=-65536,ye=Ot.eastNorthUpToFixedFrame(P,m),Ae=B.inverseTransformation(ye,fct),Pe,Ee;R&&(Pe=Mi.geodeticLatitudeToMercatorAngle(C),Ee=1/(Mi.geodeticLatitudeToMercatorAngle(v)-Pe));let ze=dct;ze.x=Number.POSITIVE_INFINITY,ze.y=Number.POSITIVE_INFINITY,ze.z=Number.POSITIVE_INFINITY;let qe=hct;qe.x=Number.NEGATIVE_INFINITY,qe.y=Number.NEGATIVE_INFINITY,qe.z=Number.NEGATIVE_INFINITY;let it=Number.POSITIVE_INFINITY,Dt=u*f,jt=h>0?u*2+f*2:0,$e=Dt+jt,un=new Array($e),zt=new Array($e),Ct=new Array($e),Ei=R?new Array($e):[],an=w?new Array($e):[],_e=0,Ce=f,pn=0,mt=u;p&&(--_e,++Ce,--pn,++mt);let so=1e-5;for(let Ze=_e;Ze<Ce;++Ze){let pt=Ze;pt<0&&(pt=0),pt>=f&&(pt=f-1);let Ht=b.north-te*pt;g?Ht=a(Ht):Ht=s-2*o(r(-Ht*y));let Cn=(Ht-C)/(v-C);Cn=O.clamp(Cn,0,1);let Mo=Ze===_e,Ao=Ze===Ce-1;h>0&&(Mo?Ht+=so*q:Ao&&(Ht-=so*q));let Za=t(Ht),Qa=n(Ht),Si=me*Qa,_i;R&&(_i=(Mi.geodeticLatitudeToMercatorAngle(Ht)-Pe)*Ee);for(let ca=pn;ca<mt;++ca){let Jr=ca;Jr<0&&(Jr=0),Jr>=u&&(Jr=u-1);let El=pt*(u*z)+Jr*z,yo;if(k===1)yo=l[El];else{yo=0;let Vo;if(j)for(Vo=0;Vo<k;++Vo)yo=yo*V+l[El+Vo];else for(Vo=k-1;Vo>=0;--Vo)yo=yo*V+l[El+Vo]}yo=yo*I+N,ue=Math.max(ue,yo),Te=Math.min(Te,yo);let Fr=b.west+Y*Jr;g?Fr=a(Fr):Fr=Fr*y;let xp=(Fr-A)/(S-A);xp=O.clamp(xp,0,1);let es=pt*u+Jr;if(h>0){let Vo=ca===pn,cn=ca===mt-1,Se=Mo||Ao||Vo||cn;if((Mo||Ao)&&(Vo||cn))continue;Se&&(yo-=h,Vo?(es=Dt+(f-pt-1),Fr-=so*U):Ao?es=Dt+f+(u-Jr-1):cn?(es=Dt+f+u+pt,Fr+=so*U):Mo&&(es=Dt+f+u+f+Jr))}let hf=Za*t(Fr),Ja=Za*n(Fr),tb=Z*hf,la=ee*Ja,ec=1/i(tb*hf+la*Ja+Si*Qa),hs=tb*ec,mf=la*ec,pf=Si*ec,_f=new d;_f.x=hs+hf*yo,_f.y=mf+Ja*yo,_f.z=pf+Qa*yo,B.multiplyByPoint(Ae,_f,BX),d.minimumByComponent(BX,ze,ze),d.maximumByComponent(BX,qe,qe),it=Math.min(it,yo),un[es]=_f,Ct[es]=new H(xp,Cn),zt[es]=yo,R&&(Ei[es]=_i),w&&(an[es]=m.geodeticSurfaceNormal(_f))}}let Ro=le.fromPoints(un),aa;c(x)&&(aa=Dn.fromRectangle(x,Te,ue,m));let Nr;M&&(Nr=new H_(m).computeHorizonCullingPointPossiblyUnderEllipsoid(P,un,Te));let Cs=new Qg(ze,qe,P),Ne=new Oc(P,Cs,it,ue,ye,!1,R,w,L,F),ot=new Float32Array($e*Ne.stride),Xe=0;for(let Ze=0;Ze<$e;++Ze)Xe=Ne.encode(ot,Xe,un[Ze],Ct[Ze],zt[Ze],void 0,Ei[Ze],an[Ze]);return{vertices:ot,maximumHeight:ue,minimumHeight:Te,encoding:Ne,boundingSphere3D:Ro,orientedBoundingBox:aa,occludeePointInScaledSpace:Nr}};var ow=tp;function w0(){E.throwInstantiationError()}Object.defineProperties(w0.prototype,{credits:{get:E.throwInstantiationError},waterMask:{get:E.throwInstantiationError}});w0.prototype.interpolateHeight=E.throwInstantiationError;w0.prototype.isChildAvailable=E.throwInstantiationError;w0.prototype.createMesh=E.throwInstantiationError;w0.prototype.upsample=E.throwInstantiationError;w0.prototype.wasCreatedByUpsampling=E.throwInstantiationError;w0.maximumAsynchronousTasks=5;var kh=w0;function mct(e,t,n,i,o,r,s,a,l,u,f,h,p,g,m,y){this.center=e,this.vertices=t,this.stride=u??6,this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=l,this.orientedBoundingBox=f,this.encoding=h,this.westIndicesSouthToNorth=p,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=m,this.northIndicesWestToEast=y}var hd=mct;function gl(){E.throwInstantiationError()}Object.defineProperties(gl.prototype,{errorEvent:{get:E.throwInstantiationError},credit:{get:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},hasWaterMask:{get:E.throwInstantiationError},hasVertexNormals:{get:E.throwInstantiationError},availability:{get:E.throwInstantiationError}});var w0e=[];gl.getRegularGridIndices=function(e,t){if(e*t>=O.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=w0e[e];c(n)||(w0e[e]=n=[]);let i=n[t];return c(i)||(e*t<O.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),I0e(e,t,i,0)),i};var v0e=[];gl.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=O.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=v0e[e];c(n)||(v0e[e]=n=[]);let i=n[t];if(!c(i)){let o=gl.getRegularGridIndices(e,t),r=P0e(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,l=r.eastIndicesNorthToSouth,u=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:l,northIndicesWestToEast:u}}return i};var D0e=[];gl.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=O.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=D0e[e];c(n)||(D0e[e]=n=[]);let i=n[t];if(!c(i)){let o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,l=o+s,u=r+a,f=P0e(e,t),h=f.westIndicesSouthToNorth,p=f.southIndicesEastToWest,g=f.eastIndicesNorthToSouth,m=f.northIndicesWestToEast,y=Fe.createTypedArray(l,u);I0e(e,t,y,0),gl.addSkirtIndices(h,p,g,m,o,y,r),i=n[t]={indices:y,westIndicesSouthToNorth:h,southIndicesEastToWest:p,eastIndicesNorthToSouth:g,northIndicesWestToEast:m,indexCountWithoutSkirts:r}}return i};gl.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=fH(e,a,r,s),a+=e.length,s=fH(t,a,r,s),a+=t.length,s=fH(n,a,r,s),a+=n.length,fH(i,a,r,s)};function P0e(e,t){let n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e),s;for(s=0;s<e;++s)r[s]=s,i[s]=e*t-1-s;for(s=0;s<t;++s)o[s]=(s+1)*e-1,n[s]=(t-s-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:o,northIndicesWestToEast:r}}function I0e(e,t,n,i){let o=0;for(let r=0;r<t-1;++r){for(let s=0;s<e-1;++s){let a=o,l=a+e,u=l+1,f=a+1;n[i++]=a,n[i++]=l,n[i++]=f,n[i++]=f,n[i++]=l,n[i++]=u,++o}++o}}function fH(e,t,n,i){let o=e[0],r=e.length;for(let s=1;s<r;++s){let a=e[s];n[i++]=o,n[i++]=a,n[i++]=t,n[i++]=t,n[i++]=a,n[i++]=t+1,o=a,++t}return i}gl.heightmapTerrainQuality=.25;gl.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*gl.heightmapTerrainQuality/(t*n)};gl.prototype.requestTileGeometry=E.throwInstantiationError;gl.prototype.getLevelMaximumGeometricError=E.throwInstantiationError;gl.prototype.getTileDataAvailable=E.throwInstantiationError;gl.prototype.loadTileDataAvailability=E.throwInstantiationError;var cs=gl;function ug(e){if(!c(e)||!c(e.buffer))throw new E("options.buffer is required.");if(!c(e.width))throw new E("options.width is required.");if(!c(e.height))throw new E("options.height is required.");this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=e.childTileMask??15,this._encoding=e.encoding??fd.NONE;let t=ow.DEFAULT_STRUCTURE,n=e.structure;c(n)?n!==t&&(n.heightScale=n.heightScale??t.heightScale,n.heightOffset=n.heightOffset??t.heightOffset,n.elementsPerHeight=n.elementsPerHeight??t.elementsPerHeight,n.stride=n.stride??t.stride,n.elementMultiplier=n.elementMultiplier??t.elementMultiplier,n.isBigEndian=n.isBigEndian??t.isBigEndian):n=t,this._structure=n,this._createdByUpsampling=e.createdByUpsampling??!1,this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===fd.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties(ug.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});var O0e="createVerticesFromHeightmap",pct=new yi(O0e),_ct=new yi(O0e,kh.maximumAsynchronousTasks);ug.prototype.createMesh=function(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=e.exaggeration??1,s=e.exaggerationRelativeHeight??0,a=e.throttle??!0,l=t.ellipsoid,u=t.tileXYToNativeRectangle(n,i,o),f=t.tileXYToRectangle(n,i,o),h=l.cartographicToCartesian(ce.center(f)),p=this._structure,m=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(l,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(m*4,1e3);let b=(a?_ct:pct).scheduleTask({heightmap:this._buffer,structure:p,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:u,rectangle:f,relativeToCenter:h,ellipsoid:l,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Oi,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!c(b))return;let x=this;return Promise.resolve(b).then(function(A){let C;x._skirtHeight>0?C=cs.getRegularGridAndSkirtIndicesAndEdgeIndices(A.gridWidth,A.gridHeight):C=cs.getRegularGridIndicesAndEdgeIndices(A.gridWidth,A.gridHeight);let S=A.gridWidth*A.gridHeight;return x._mesh=new hd(h,new Float32Array(A.vertices),C.indices,C.indexCountWithoutSkirts,S,A.minimumHeight,A.maximumHeight,le.clone(A.boundingSphere3D),d.clone(A.occludeePointInScaledSpace),A.numberOfAttributes,Dn.clone(A.orientedBoundingBox),Oc.clone(A.encoding),C.westIndicesSouthToNorth,C.southIndicesEastToWest,C.eastIndicesNorthToSouth,C.northIndicesWestToEast),x._buffer=void 0,x._mesh})};ug.prototype._createMeshSync=function(e){T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=e.exaggeration??1,s=e.exaggerationRelativeHeight??0,a=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),f=a.cartographicToCartesian(ce.center(u)),h=this._structure,g=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);let m=ow.computeVertices({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:u,relativeToCenter:f,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Oi,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let y;this._skirtHeight>0?y=cs.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):y=cs.getRegularGridIndicesAndEdgeIndices(this._width,this._height);let b=m.gridWidth*m.gridHeight;return this._mesh=new hd(f,m.vertices,y.indices,y.indexCountWithoutSkirts,b,m.minimumHeight,m.maximumHeight,m.boundingSphere3D,m.occludeePointInScaledSpace,m.encoding.stride,m.orientedBoundingBox,m.encoding,y.westIndicesSouthToNorth,y.southIndicesEastToWest,y.eastIndicesNorthToSouth,y.northIndicesWestToEast),this._mesh};ug.prototype.interpolateHeight=function(e,t,n){let i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,l=r.elementMultiplier,u=r.isBigEndian,f=r.heightOffset,h=r.heightScale,p=c(this._mesh),g=this._encoding===fd.LERC;if(!p&&g)return;let y;if(p){let b=this._mesh.vertices,x=this._mesh.encoding;y=R0e(b,x,f,h,e,i,o,t,n)}else y=gct(this._buffer,a,l,s,u,e,i,o,t,n),y=y*h+f;return y};ug.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");let l=this._mesh;if(!c(l))return;let u=this._width,f=this._height,h=this._structure,p=h.stride,g=new this._bufferType(u*f*p),m=l.vertices,y=l.encoding,b=e.tileXYToRectangle(t,n,i),x=e.tileXYToRectangle(o,r,s),A=h.heightOffset,C=h.heightScale,S=h.elementsPerHeight,v=h.elementMultiplier,P=h.isBigEndian,M=Math.pow(v,S-1);for(let R=0;R<f;++R){let L=O.lerp(x.north,x.south,R/(f-1));for(let F=0;F<u;++F){let _=O.lerp(x.west,x.east,F/(u-1)),w=R0e(m,y,A,C,b,u,f,_,L);w=w<h.lowestEncodedHeight?h.lowestEncodedHeight:w,w=w>h.highestEncodedHeight?h.highestEncodedHeight:w,yct(g,S,v,M,p,P,R*u+F,w)}}return Promise.resolve(new ug({buffer:g,width:u,height:f,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};ug.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};ug.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function gct(e,t,n,i,o,r,s,a,l,u){let f=(l-r.west)*(s-1)/(r.east-r.west),h=(u-r.south)*(a-1)/(r.north-r.south),p=f|0,g=p+1;g>=s&&(g=s-1,p=s-2);let m=h|0,y=m+1;y>=a&&(y=a-1,m=a-2);let b=f-p,x=h-m;m=a-1-m,y=a-1-y;let A=dH(e,t,n,i,o,m*s+p),C=dH(e,t,n,i,o,m*s+g),S=dH(e,t,n,i,o,y*s+p),v=dH(e,t,n,i,o,y*s+g);return M0e(b,x,A,C,S,v)}function R0e(e,t,n,i,o,r,s,a,l){let u=(a-o.west)*(r-1)/(o.east-o.west),f=(l-o.south)*(s-1)/(o.north-o.south),h=u|0,p=h+1;p>=r&&(p=r-1,h=r-2);let g=f|0,m=g+1;m>=s&&(m=s-1,g=s-2);let y=u-h,b=f-g;g=s-1-g,m=s-1-m;let x=(t.decodeHeight(e,g*r+h)-n)/i,A=(t.decodeHeight(e,g*r+p)-n)/i,C=(t.decodeHeight(e,m*r+h)-n)/i,S=(t.decodeHeight(e,m*r+p)-n)/i;return M0e(y,b,x,A,C,S)}function M0e(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function dH(e,t,n,i,o,r){r*=i;let s=0,a;if(o)for(a=0;a<t;++a)s=s*n+e[r+a];else for(a=t-1;a>=0;--a)s=s*n+e[r+a];return s}function yct(e,t,n,i,o,r,s,a){s*=o;let l;if(r)for(l=0;l<t-1;++l)e[s+l]=a/i|0,a-=e[s+l]*i,i/=n;else for(l=t-1;l>0;--l)e[s+l]=a/i|0,a-=e[s+l]*i,i/=n;e[s+l]=a}var qa=ug;function rw(e){e=e??W.EMPTY_OBJECT,this._tilingScheme=e.tilingScheme,c(this._tilingScheme)||(this._tilingScheme=new Ki({ellipsoid:e.ellipsoid??ie.default})),this._levelZeroMaximumGeometricError=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new pe}Object.defineProperties(rw.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});rw.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new qa({buffer:new Uint8Array(16*16),width:16,height:16}))};rw.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};rw.prototype.getTileDataAvailable=function(e,t,n){};rw.prototype.loadTileDataAvailability=function(e,t,n){};var np=rw;var bct=new H;function xct(e,t){T.typeOf.object("clippingPlaneCollection",e),T.typeOf.object("context",t);let n=e.unionClippingRegions,i=e.length,o=gs.useFloatTexture(t),r=gs.getTextureResolution(e,t,bct),s=r.x,a=r.y,l=o?Cct(s,a):Ect(s,a);return l+=`
`,l+=n?Tct(i):Act(i),l}function Tct(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
{
    vec4 position = czm_windowToEyeCoordinates(fragCoord);
    vec3 clipNormal = vec3(0.0);
    vec3 clipPosition = vec3(0.0);
    float clipAmount;
    float pixelWidth = czm_metersPerPixel(position);
    bool breakAndDiscard = false;
    for (int i = 0; i < ${e}; ++i)
    {
        vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
        clipNormal = clippingPlane.xyz;
        clipPosition = -clippingPlane.w * clipNormal;
        float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
        clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
        if (amount <= 0.0)
        {
           breakAndDiscard = true;
           break;
        }
    }
    if (breakAndDiscard) {
        discard;
    }
    return clipAmount;
}
`}function Act(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
{
    bool clipped = true;
    vec4 position = czm_windowToEyeCoordinates(fragCoord);
    vec3 clipNormal = vec3(0.0);
    vec3 clipPosition = vec3(0.0);
    float clipAmount = 0.0;
    float pixelWidth = czm_metersPerPixel(position);
    for (int i = 0; i < ${e}; ++i)
    {
        vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
        clipNormal = clippingPlane.xyz;
        clipPosition = -clippingPlane.w * clipNormal;
        float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
        clipAmount = max(amount, clipAmount);
        clipped = clipped && (amount <= 0.0);
    }
    if (clipped)
    {
        discard;
    }
    return clipAmount;
}
`}function Cct(e,t){let n=1/e,i=1/t,o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
{
    int pixY = clippingPlaneNumber / ${e};
    int pixX = clippingPlaneNumber - (pixY * ${e});
    float u = (float(pixX) + 0.5) * ${o};
    float v = (float(pixY) + 0.5) * ${r};
    vec4 plane = texture(packedClippingPlanes, vec2(u, v));
    return czm_transformPlane(plane, transform);
}
`}function Ect(e,t){let n=1/e,i=1/t,o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
{
    int clippingPlaneStartIndex = clippingPlaneNumber * 2;
    int pixY = clippingPlaneStartIndex / ${e};
    int pixX = clippingPlaneStartIndex - (pixY * ${e});
    float u = (float(pixX) + 0.5) * ${o};
    float v = (float(pixY) + 0.5) * ${r};
    vec4 oct32 = texture(packedClippingPlanes, vec2(u, v)) * 255.0;
    vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
    vec4 plane;
    plane.xyz = czm_octDecode(oct, 65535.0);
    plane.w = czm_unpackFloat(texture(packedClippingPlanes, vec2(u + ${o}, v)));
    return czm_transformPlane(plane, transform);
}
`}var fg=xct;function Sct(e,t,n,i,o,r){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o,this.clippingPolygonShaderState=r}function kX(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function wct(e){let t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",n="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }",o;switch(e){case oe.SCENE3D:o=t;break;case oe.SCENE2D:case oe.COLUMBUS_VIEW:o=n;break;case oe.MORPHING:o=i;break}return o}function vct(e){return e.webgl2?`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
    czm_clipPolygons(clippingDistance, regionsLength, clippingPosition, regionIndex);
  }`:`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
    }`}function Dct(e){return e.webgl2?`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
    return czm_unpackClippingExtents(extentsTexture, index);
  }`:`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
      return vec4();
    }`}function Pct(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}kX.prototype.getShaderProgram=function(e){let t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,l=e.applyGamma,u=e.applyAlpha,f=e.applyDayNightAlpha,h=e.applySplit,p=e.hasWaterMask,g=e.showReflectiveOcean,m=e.showOceanWaves,y=e.enableLighting,b=e.dynamicAtmosphereLighting,x=e.dynamicAtmosphereLightingFromSun,A=e.showGroundAtmosphere,C=e.perFragmentGroundAtmosphere,S=e.hasVertexNormals,v=e.useWebMercatorProjection,P=e.enableFog,M=e.enableClippingPlanes,R=e.clippingPlanes,L=e.enableClippingPolygons,F=e.clippingPolygons,_=e.clippedByBoundaries,w=e.hasImageryLayerCutout,D=e.colorCorrect,I=e.highlightFillTile,N=e.colorToAlpha,k=e.hasGeodeticSurfaceNormals,z=e.hasExaggeration,V=e.showUndergroundColor,j=e.translucent,U=0,q="",te=n.renderedMesh.encoding;te.quantization===ea.BITS12&&(U=1,q="QUANTIZATION_BITS12");let Z=0,ee="";_&&(Z=1,ee="TILE_LIMIT_RECTANGLE");let me=0,Te="";w&&(me=1,Te="APPLY_IMAGERY_CUTOUT");let ue=t.mode,ye=ue|o<<2|r<<3|s<<4|a<<5|l<<6|u<<7|p<<8|g<<9|m<<10|y<<11|b<<12|x<<13|A<<14|C<<15|S<<16|v<<17|P<<18|U<<19|h<<20|M<<21|L<<22|Z<<23|me<<24|D<<25|I<<26|N<<27|k<<28|z<<29|V<<30|j<<31|f<<32,Ae=0;c(R)&&R.length>0&&(Ae=M?R.clippingPlanesState:0);let Pe=0;c(F)&&F.length>0&&(Pe=L?F.clippingPolygonsState:0);let Ee=n.surfaceShader;if(c(Ee)&&Ee.numberOfDayTextures===i&&Ee.flags===ye&&Ee.material===this.material&&Ee.clippingShaderState===Ae&&Ee.clippingPolygonShaderState===Pe)return Ee.shaderProgram;let ze=this._shadersByTexturesFlags[i];if(c(ze)||(ze=this._shadersByTexturesFlags[i]=[]),Ee=ze[ye],!c(Ee)||Ee.material!==this.material||Ee.clippingShaderState!==Ae||Ee.clippingPolygonShaderState!==Pe){let qe=this.baseVertexShaderSource.clone(),it=this.baseFragmentShaderSource.clone();Ae!==0&&it.sources.unshift(fg(R,t.context)),Pe!==0&&(it.sources.unshift(vct(t.context)),qe.sources.unshift(Dct(t.context))),qe.defines.push(q),it.defines.push(`TEXTURE_UNITS ${i}`,ee,Te),o&&it.defines.push("APPLY_BRIGHTNESS"),r&&it.defines.push("APPLY_CONTRAST"),s&&it.defines.push("APPLY_HUE"),a&&it.defines.push("APPLY_SATURATION"),l&&it.defines.push("APPLY_GAMMA"),u&&it.defines.push("APPLY_ALPHA"),f&&it.defines.push("APPLY_DAY_NIGHT_ALPHA"),p&&it.defines.push("HAS_WATER_MASK"),g&&(it.defines.push("SHOW_REFLECTIVE_OCEAN"),qe.defines.push("SHOW_REFLECTIVE_OCEAN")),m&&it.defines.push("SHOW_OCEAN_WAVES"),N&&it.defines.push("APPLY_COLOR_TO_ALPHA"),V&&(qe.defines.push("UNDERGROUND_COLOR"),it.defines.push("UNDERGROUND_COLOR")),j&&(qe.defines.push("TRANSLUCENT"),it.defines.push("TRANSLUCENT")),y&&(S?(qe.defines.push("ENABLE_VERTEX_LIGHTING"),it.defines.push("ENABLE_VERTEX_LIGHTING")):(qe.defines.push("ENABLE_DAYNIGHT_SHADING"),it.defines.push("ENABLE_DAYNIGHT_SHADING"))),b&&(qe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),it.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),x&&(qe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),it.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),A&&(qe.defines.push("GROUND_ATMOSPHERE"),it.defines.push("GROUND_ATMOSPHERE"),C&&(qe.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),it.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),qe.defines.push("INCLUDE_WEB_MERCATOR_Y"),it.defines.push("INCLUDE_WEB_MERCATOR_Y"),P&&(qe.defines.push("FOG"),it.defines.push("FOG")),h&&it.defines.push("APPLY_SPLIT"),M&&it.defines.push("ENABLE_CLIPPING_PLANES"),L&&(it.defines.push("ENABLE_CLIPPING_POLYGONS"),qe.defines.push("ENABLE_CLIPPING_POLYGONS"),F.inverse&&it.defines.push("CLIPPING_INVERSE"),it.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${F.extentsCount}`),qe.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${F.extentsCount}`)),D&&it.defines.push("COLOR_CORRECT"),I&&it.defines.push("HIGHLIGHT_FILL_TILE"),k&&qe.defines.push("GEODETIC_SURFACE_NORMALS"),z&&qe.defines.push("EXAGGERATION");let Dt=`    vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
    {
        vec4 color = initialColor;
`;w&&(Dt+=`        vec4 cutoutAndColorResult;
        bool texelUnclipped;
`);for(let $e=0;$e<i;++$e)w?Dt+=`        cutoutAndColorResult = u_dayTextureCutoutRectangles[${$e}];
        texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
        cutoutAndColorResult = sampleAndBlend(
`:Dt+=`        color = sampleAndBlend(
`,Dt+=`            color,
            u_dayTextures[${$e}],
            u_dayTextureUseWebMercatorT[${$e}] ? textureCoordinates.xz : textureCoordinates.xy,
            u_dayTextureTexCoordsRectangle[${$e}],
            u_dayTextureTranslationAndScale[${$e}],
            ${u?`u_dayTextureAlpha[${$e}]`:"1.0"},
            ${f?`u_dayTextureNightAlpha[${$e}]`:"1.0"},
${f?`u_dayTextureDayAlpha[${$e}]`:"1.0"},
${o?`u_dayTextureBrightness[${$e}]`:"0.0"},
            ${r?`u_dayTextureContrast[${$e}]`:"0.0"},
            ${s?`u_dayTextureHue[${$e}]`:"0.0"},
            ${a?`u_dayTextureSaturation[${$e}]`:"0.0"},
            ${l?`u_dayTextureOneOverGamma[${$e}]`:"0.0"},
            ${h?`u_dayTextureSplit[${$e}]`:"0.0"},
            ${N?`u_colorsToAlpha[${$e}]`:"vec4(0.0)"},
        nightBlend        );
`,w&&(Dt+=`        color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);Dt+=`        return color;
    }`,it.sources.push(Dt),qe.sources.push(wct(ue)),qe.sources.push(Pct(v));let jt=Jt.fromCache({context:t.context,vertexShaderSource:qe,fragmentShaderSource:it,attributeLocations:te.getAttributeLocations()});Ee=ze[ye]=new Sct(i,ye,this.material,jt,Ae,Pe)}return n.surfaceShader=Ee,Ee.shaderProgram};kX.prototype.destroy=function(){let e,t,n=this._shadersByTexturesFlags;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];if(!c(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],c(t)&&t.shaderProgram.destroy())}return de(this)};var _2=kX;var Ict={NONE:-1,PARTIAL:0,FULL:1},xr=Object.freeze(Ict);function hH(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=r??0,this.retry=!1,this.error=s}hH.reportError=function(e,t,n,i,o,r,s,a){let l=e;return c(e)?(l.provider=t,l.message=i,l.x=o,l.y=r,l.level=s,l.retry=!1,l.error=a,++l.timesRetried):l=new hH(t,i,o,r,s,0,a),c(n)&&n.numberOfListeners>0?n.raiseEvent(l):c(t)&&console.log(`An error occurred in "${t.constructor.name}": ${ep(i)}`),l};hH.reportSuccess=function(e){c(e)&&(e.timesRetried=-1)};var Po=hH;var Oct={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ai=Object.freeze(Oct);var Rct={START:0,LOADING:1,DONE:2,FAILED:3},ta=Object.freeze(Rct);var Mct={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},fo=Object.freeze(Mct);function lr(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new se(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new d,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=fo.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new le,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(lr.prototype,{eligibleForUnloading:{get:function(){let e=this.terrainState,n=!(e===fo.RECEIVING||e===fo.TRANSFORMING),i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){let s=i[o];n=!c(s.loadingImagery)||s.loadingImagery.state!==ai.TRANSITIONING}return n}},renderedMesh:{get:function(){if(c(this.vertexArray))return this.mesh;if(c(this.fill))return this.fill.mesh}}});var Lct=new he;function UX(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(c(t)&&t!==oe.SCENE3D){let l=n.ellipsoid.cartesianToCartographic(s,Lct);s=n.project(l,r),s=d.fromElements(s.z,s.x,s.y,r)}return s}var Nct=new d,Fct=new d,Bct=new d;lr.prototype.pick=function(e,t,n,i,o){let r=this.renderedMesh;if(!c(r))return;let s=r.vertices,a=r.indices,l=r.encoding,u=a.length,f=Number.MAX_VALUE;for(let h=0;h<u;h+=3){let p=a[h],g=a[h+1],m=a[h+2],y=UX(l,t,n,s,p,Nct),b=UX(l,t,n,s,g,Fct),x=UX(l,t,n,s,m,Bct),A=Zn.rayTriangleParametric(e,y,b,x,i);c(A)&&A<f&&A>=0&&(f=A)}return f!==Number.MAX_VALUE?mn.getPoint(e,f,o):void 0};lr.prototype.freeResources=function(){c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=fo.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();let e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()};lr.prototype.freeVertexArray=function(){lr._freeVertexArray(this.vertexArray),this.vertexArray=void 0,lr._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};lr.initialize=function(e,t,n){let i=e.data;c(i)||(i=e.data=new lr),e.state===ta.START&&(kct(e,t,n),e.state=ta.LOADING)};lr.processStateMachine=function(e,t,n,i,o,r,s){lr.initialize(e,n,i);let a=e.data;if(e.state===ta.LOADING&&Uct(e,t,n,i,o,r),s)return;let l=e.renderable;e.renderable=c(a.vertexArray);let u=a.terrainState===fo.READY;e.upsampledFromParent=c(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();let f=a.processImagery(e,n,t);if(u&&f){let h=e._loadedCallbacks,p={};for(let g in h)h.hasOwnProperty(g)&&(h[g](e)||(p[g]=h[g]));e._loadedCallbacks=p,e.state=ta.DONE}l&&(e.renderable=!0)};lr.prototype.processImagery=function(e,t,n,i){let o=e.data,r=e.upsampledFromParent,s=!1,a=!0,l=o.imagery,u,f;for(u=0,f=l.length;u<f;++u){let h=l[u];if(!c(h.loadingImagery)){r=!1;continue}if(h.loadingImagery.state===ai.PLACEHOLDER){let g=h.loadingImagery.imageryLayer;if(g.ready){h.freeResources(),l.splice(u,1),g._createTileImagerySkeletons(e,t,u),--u,f=l.length;continue}else r=!1}let p=h.processStateMachine(e,n,i);a=a&&p,s=s||p||c(h.readyImagery),r=r&&c(h.loadingImagery)&&(h.loadingImagery.state===ai.FAILED||h.loadingImagery.state===ai.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a};function L0e(e,t,n,i){let o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride,l=Oc.clone(s);l.hasGeodeticSurfaceNormals=t,l=Oc.clone(l);let u=l.stride,f=new Float32Array(a*u);t?s.addGeodeticSurfaceNormals(r,f,n):s.removeGeodeticSurfaceNormals(r,f),o.vertices=f,o.stride=u,o!==e.mesh?(lr._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=lr._createVertexArrayForMesh(i.context,o)):(lr._freeVertexArray(e.vertexArray),e.vertexArray=lr._createVertexArrayForMesh(i.context,o)),lr._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}lr.prototype.addGeodeticSurfaceNormals=function(e,t){L0e(this,!0,e,t)};lr.prototype.removeGeodeticSurfaceNormals=function(e){L0e(this,!1,void 0,e)};lr.prototype.updateExaggeration=function(e,t,n){let i=this,o=i.renderedMesh;if(o===void 0)return;let r=t.verticalExaggeration,s=t.verticalExaggerationRelativeHeight,a=r!==1,l=o.encoding,u=l.exaggeration!==r,f=l.exaggerationRelativeHeight!==s;if(u||f){if(u)if(a&&!l.hasGeodeticSurfaceNormals){let h=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(h,t)}else!a&&l.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(l.exaggeration=r,l.exaggerationRelativeHeight=s,n!==void 0){n._tileToUpdateHeights.push(e);let h=e.customData,p=h.length;for(let g=0;g<p;g++){let m=h[g];m.level=-1}}}};function kct(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!c(i)&&c(e.parent)){let o=e.parent,r=o.data;c(r)&&c(r.terrainData)&&(i=r.terrainData.isChildAvailable(o.x,o.y,e.x,e.y))}i===!1&&(e.data.terrainState=fo.FAILED);for(let o=0,r=n.length;o<r;++o){let s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function Uct(e,t,n,i,o,r){let s=e.data,a=e.parent;if(s.terrainState===fo.FAILED&&a!==void 0&&(a.data!==void 0&&a.data.terrainData!==void 0&&a.data.terrainData.canUpsample!==!1||lr.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===fo.FAILED&&Vct(s,e,t,n,e.x,e.y,e.level),s.terrainState===fo.UNLOADED&&zct(s,n,e.x,e.y,e.level),s.terrainState===fo.RECEIVED&&Gct(s,t,n,e.x,e.y,e.level),s.terrainState===fo.TRANSFORMED&&(jct(s,t.context,n,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o)),s.terrainState>=fo.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)qct(t.context,s);else{let u=s._findAncestorTileWithTerrainData(e);c(u)&&c(u.data.waterMaskTexture)&&(s.waterMaskTexture=u.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,u,s.waterMaskTranslationAndScale))}}function Vct(e,t,n,i,o,r,s){let a=t.parent;if(!a){t.state=ta.FAILED;return}let l=a.data.terrainData,u=a.x,f=a.y,h=a.level;if(!c(l))return;let p=l.upsample(i.tilingScheme,u,f,h,o,r,s);c(p)&&(e.terrainState=fo.RECEIVING,Promise.resolve(p).then(function(g){c(g)&&(e.terrainData=g,e.terrainState=fo.RECEIVED)}).catch(function(){e.terrainState=fo.FAILED}))}function zct(e,t,n,i,o){function r(l){if(!c(l)){e.terrainState=fo.UNLOADED,e.request=void 0;return}e.terrainData=l,e.terrainState=fo.RECEIVED,e.request=void 0}function s(l){if(e.request.state===$n.CANCELLED){e.terrainData=void 0,e.terrainState=fo.UNLOADED,e.request=void 0;return}e.terrainState=fo.FAILED,e.request=void 0;let u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${l}"`;t._requestError=Po.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){let l=new Qo({throttle:!1,throttleByServer:!0,type:ms.TERRAIN});e.request=l;let u=t.requestTileGeometry(n,i,o,l);c(u)?(e.terrainState=fo.RECEIVING,Promise.resolve(u).then(function(f){r(f)}).catch(function(f){s(f)})):(e.terrainState=fo.UNLOADED,e.request=void 0)}a()}var Hct={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function Gct(e,t,n,i,o,r){let s=n.tilingScheme,a=Hct;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.verticalExaggeration,a.exaggerationRelativeHeight=t.verticalExaggerationRelativeHeight,a.throttle=!0;let u=e.terrainData.createMesh(a);c(u)&&(e.terrainState=fo.TRANSFORMING,Promise.resolve(u).then(function(f){e.mesh=f,e.terrainState=fo.TRANSFORMED}).catch(function(){e.terrainState=fo.FAILED}))}lr._createVertexArrayForMesh=function(e,t){let n=t.vertices,i=yt.createVertexBuffer({context:e,typedArray:n,usage:Be.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{},s=r[e.id];if(!c(s)||s.isDestroyed()){let a=t.indices;s=yt.createIndexBuffer({context:e,typedArray:a,usage:Be.STATIC_DRAW,indexDatatype:Fe.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new ti({context:e,attributes:o,indexBuffer:s})};lr._freeVertexArray=function(e){if(c(e)){let t=e.indexBuffer;e.isDestroyed()||e.destroy(),c(t)&&!t.isDestroyed()&&c(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function jct(e,t,n,i,o,r,s){e.vertexArray=lr._createVertexArrayForMesh(t,e.mesh),e.terrainState=fo.READY,e.fill=e.fill&&e.fill.destroy(s)}function Wct(e){let t=e.cache.tile_waterMaskData;if(!c(t)){let n=Rt.create({context:e,pixelFormat:ke.LUMINANCE,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;let i=new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR,magnificationFilter:li.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function qct(e,t){let n=t.terrainData.waterMask,i=Wct(e),o,r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{let s=Math.sqrt(r);o=Rt.create({context:e,pixelFormat:ke.LUMINANCE,pixelDatatype:Ue.UNSIGNED_BYTE,source:{width:s,height:s,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,se.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}lr.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;c(t)&&(!c(t.data)||!c(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};lr.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){let i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,l=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=l*(o.south-i.south)/s,n.z=a,n.w=l,n};var md=lr;function v0(e){if(e=e??W.EMPTY_OBJECT,this._ellipsoid=e.ellipsoid??ie.default,this._numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX??1,this._numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY??1,this._projection=new Mi(this._ellipsoid),c(e.rectangleSouthwestInMeters)&&c(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{let i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new H(-i,-i),this._rectangleNortheastInMeters=new H(i,i)}let t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new ce(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(v0.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});v0.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};v0.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};v0.prototype.rectangleToNativeRectangle=function(e,t){let n=this._projection,i=n.project(ce.southwest(e)),o=n.project(ce.northeast(e));return c(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new ce(i.x,i.y,o.x,o.y)};v0.prototype.tileXYToNativeRectangle=function(e,t,n,i){let o=this.getNumberOfXTilesAtLevel(n),r=this.getNumberOfYTilesAtLevel(n),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=this._rectangleSouthwestInMeters.x+e*s,l=this._rectangleSouthwestInMeters.x+(e+1)*s,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,f=this._rectangleNortheastInMeters.y-t*u,h=this._rectangleNortheastInMeters.y-(t+1)*u;return c(i)?(i.west=a,i.south=h,i.east=l,i.north=f,i):new ce(a,h,l,f)};v0.prototype.tileXYToRectangle=function(e,t,n,i){let o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new H(o.west,o.south)),a=r.unproject(new H(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o};v0.prototype.positionToTileXY=function(e,t,n){let i=this._rectangle;if(!ce.contains(i,e))return;let o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,h=this._projection.project(e),p=h.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-h.y,m=p/a|0;m>=o&&(m=o-1);let y=g/u|0;return y>=r&&(y=r-1),c(n)?(n.x=m,n.y=y,n):new H(m,y)};var ls=v0;var VX,N0e="AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmRwxo7rIWoXrG5RJkAAlrdL0n_Ha7z7WbgHT-DpRd_LxLSeba-Kg8HsK3kJVUF2iiOVOza8OZ-DIdJzjyBZ9IIc5W0JagV3wyuZ9CKE3RHRSADOw-9FbeeUyfJA8iS2mKcK8768q4g11vlHUzVYFhWoKctRWWeG3Amwm6ez2n3vMc1fTSqDdbFP2O6x5eslQDE.AT1_SOxgo20E",sw={};sw.defaultAccessToken=N0e;sw.defaultWorldImageryServer=new we({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"});sw.defaultWorldHillshadeServer=new we({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"});sw.defaultWorldOceanServer=new we({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"});sw.getDefaultTokenCredit=function(e){if(e===N0e){if(!c(VX)){let t='<b>             This application is using a default ArcGIS access token. Please assign <i>Cesium.ArcGisMapService.defaultAccessToken</i>             with an API key from your ArcGIS Developer account before using the ArcGIS tile services.             You can sign up for a free ArcGIS Developer account at <a href="https://developers.arcgis.com/">https://developers.arcgis.com/</a>.</b>';VX=new Tt(t,!0)}return VX}};var Zu=sw;function zX(e){if(e=e??W.EMPTY_OBJECT,!c(e.missingImageUrl))throw new E("options.missingImageUrl is required.");if(!c(e.pixelsToCheck))throw new E("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;let t=we.createIfNeeded(e.missingImageUrl),n=this;function i(r){c(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=Id(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0,l=r.width,u=e.pixelsToCheck;for(let f=0,h=u.length;a&&f<h;++f){let p=u[f],g=p.x*4+p.y*l;s[g+3]>0&&(a=!1)}a&&(s=void 0)}n._missingImagePixels=s,n._isReady=!0}function o(){n._missingImagePixels=void 0,n._isReady=!0}t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then(i).catch(o)}zX.prototype.isReady=function(){return this._isReady};zX.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new E("shouldDiscardImage must not be called before the discard policy is ready.");let t=this._pixelsToCheck,n=this._missingImagePixels;if(!c(n)||c(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;let i=Id(e),o=e.width;for(let r=0,s=t.length;r<s;++r){let a=t[r],l=a.x*4+a.y*o;for(let u=0;u<4;++u){let f=l+u;if(i[f]!==n[f])return!1}}return!0};var g2=zX;function HX(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}HX.prototype.configureNameFromProperties=function(e){let t=10,n;for(let i in e)if(e.hasOwnProperty(i)&&e[i]){let o=i.toLowerCase();t>1&&o==="name"?(t=1,n=i):t>2&&o==="title"?(t=2,n=i):t>3&&/name/i.test(i)?(t=3,n=i):t>4&&/title/i.test(i)&&(t=4,n=i)}c(n)&&(this.name=e[n])};HX.prototype.configureDescriptionFromProperties=function(e){function t(n){let i='<table class="cesium-infoBox-defaultTable">';for(let o in n)if(n.hasOwnProperty(o)){let r=n[o];c(r)&&(typeof r=="object"?i+=`<tr><td>${o}</td><td>${t(r)}</td></tr>`:i+=`<tr><td>${o}</td><td>${r}</td></tr>`)}return i+="</table>",i}this.description=t(e)};var Uh=HX;function aw(){E.throwInstantiationError()}Object.defineProperties(aw.prototype,{rectangle:{get:E.throwInstantiationError},tileWidth:{get:E.throwInstantiationError},tileHeight:{get:E.throwInstantiationError},maximumLevel:{get:E.throwInstantiationError},minimumLevel:{get:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},tileDiscardPolicy:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError},credit:{get:E.throwInstantiationError},proxy:{get:E.throwInstantiationError},hasAlphaChannel:{get:E.throwInstantiationError}});aw.prototype.getTileCredits=function(e,t,n){E.throwInstantiationError()};aw.prototype.requestImage=function(e,t,n,i){E.throwInstantiationError()};aw.prototype.pickFeatures=function(e,t,n,i,o){E.throwInstantiationError()};var Yct=/\.ktx2$/i;aw.loadImage=function(e,t){T.defined("url",t);let n=we.createIfNeeded(t);return Yct.test(n.url)?Il(n):c(e)&&c(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};var yl=aw;var Xct={SATELLITE:1,OCEANS:2,HILLSHADE:3},Vh=Object.freeze(Xct);function F0e(e){this.useTiles=e.usePreCachedTilesIfAvailable??!0;let t=e.ellipsoid;this.tilingScheme=e.tilingScheme??new Ki({ellipsoid:t}),this.rectangle=e.rectangle??this.tilingScheme.rectangle,this.ellipsoid=t;let n=e.credit;typeof n=="string"&&(n=new Tt(n)),this.credit=n,this.tileCredits=void 0,this.tileDiscardPolicy=e.tileDiscardPolicy,this.tileWidth=e.tileWidth??256,this.tileHeight=e.tileHeight??256,this.maximumLevel=e.maximumLevel}F0e.prototype.build=function(e){e._useTiles=this.useTiles,e._tilingScheme=this.tilingScheme,e._rectangle=this.rectangle,e._credit=this.credit,e._tileCredits=this.tileCredits,e._tileDiscardPolicy=this.tileDiscardPolicy,e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,this.useTiles&&!c(this.tileDiscardPolicy)&&(e._tileDiscardPolicy=new g2({missingImageUrl:B0e(e,0,0,this.maximumLevel).url,pixelsToCheck:[new H(0,0),new H(200,20),new H(20,200),new H(80,110),new H(160,130)],disableCheckIfAllPixelsAreTransparent:!0}))};function Kct(e,t){let n=e.tileInfo;if(!c(n))t.useTiles=!1;else{if(t.tileWidth=n.rows,t.tileHeight=n.cols,n.spatialReference.wkid===102100||n.spatialReference.wkid===102113)t.tilingScheme=new ls({ellipsoid:t.ellipsoid});else if(e.tileInfo.spatialReference.wkid===4326)t.tilingScheme=new Ki({ellipsoid:t.ellipsoid});else{let i=`Tile spatial reference WKID ${e.tileInfo.spatialReference.wkid} is not supported.`;throw new ae(i)}if(t.maximumLevel=e.tileInfo.lods.length-1,c(e.fullExtent)){if(c(e.fullExtent.spatialReference)&&c(e.fullExtent.spatialReference.wkid))if(e.fullExtent.spatialReference.wkid===102100||e.fullExtent.spatialReference.wkid===102113){let i=new Mi,o=e.fullExtent,r=i.unproject(new d(Math.max(o.xmin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(o.ymin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),s=i.unproject(new d(Math.min(o.xmax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(o.ymax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0));t.rectangle=new ce(r.longitude,r.latitude,s.longitude,s.latitude)}else if(e.fullExtent.spatialReference.wkid===4326)t.rectangle=ce.fromDegrees(e.fullExtent.xmin,e.fullExtent.ymin,e.fullExtent.xmax,e.fullExtent.ymax);else{let i=`fullExtent.spatialReference WKID ${e.fullExtent.spatialReference.wkid} is not supported.`;throw new ae(i)}}else t.rectangle=t.tilingScheme.rectangle;t.useTiles=!0}c(e.copyrightText)&&e.copyrightText.length>0&&(c(t.credit)?t.tileCredits=[new Tt(e.copyrightText)]:t.credit=new Tt(e.copyrightText))}function $ct(e,t){let n=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(n+=`: ${t.message}`),new ae(n)}async function Zct(e,t){let n=e.getDerivedResource({queryParameters:{f:"json"}});try{let i=await n.fetchJson();Kct(i,t)}catch(i){$ct(e,i)}}function ip(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=e.tileWidth??256,this._tileHeight=e.tileHeight??256,this._maximumLevel=e.maximumLevel,this._tilingScheme=e.tilingScheme??new Ki({ellipsoid:e.ellipsoid}),this._useTiles=e.usePreCachedTilesIfAvailable??!0,this._rectangle=e.rectangle??this._tilingScheme.rectangle,this._layers=e.layers,this._credit=e.credit,this._tileCredits=void 0;let t=e.credit;typeof t=="string"&&(t=new Tt(t)),this.enablePickFeatures=e.enablePickFeatures??!0,this._errorEvent=new pe}ip.fromBasemapType=async function(e,t){T.defined("style",e),t=t??W.EMPTY_OBJECT;let n,i,o;switch(e){case Vh.SATELLITE:{n=t.token??Zu.defaultAccessToken,i=we.createIfNeeded(Zu.defaultWorldImageryServer),i.appendForwardSlash();let r=Zu.getDefaultTokenCredit(n);c(r)&&(o=Tt.clone(r))}break;case Vh.OCEANS:{n=t.token??Zu.defaultAccessToken,i=we.createIfNeeded(Zu.defaultWorldOceanServer),i.appendForwardSlash();let r=Zu.getDefaultTokenCredit(n);c(r)&&(o=Tt.clone(r))}break;case Vh.HILLSHADE:{n=t.token??Zu.defaultAccessToken,i=we.createIfNeeded(Zu.defaultWorldHillshadeServer),i.appendForwardSlash();let r=Zu.getDefaultTokenCredit(n);c(r)&&(o=Tt.clone(r))}break;default:throw new E(`Unsupported basemap type: ${e}`)}return ip.fromUrl(i,{...t,token:n,credit:o,usePreCachedTilesIfAvailable:!0})};function B0e(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{let s=e._tilingScheme.tileXYToNativeRectangle(t,n,i),l={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof Oi?(l.bboxSR=4326,l.imageSR=4326):(l.bboxSR=3857,l.imageSR=3857),e.layers&&(l.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:l})}return r}Object.defineProperties(ip.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}});ip.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT;let n=we.createIfNeeded(e);n.appendForwardSlash(),c(t.token)&&n.setQueryParameters({token:t.token});let i=new ip(t);i._resource=n;let o=new F0e(t);return(t.usePreCachedTilesIfAvailable??!0)&&await Zct(n,o),o.build(i),i};ip.prototype.getTileCredits=function(e,t,n){return this._tileCredits};ip.prototype.requestImage=function(e,t,n,i){return yl.loadImage(this,B0e(this,e,t,n,i))};ip.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures)return;let r=this._tilingScheme.tileXYToNativeRectangle(e,t,n),s,a,l;if(this._tilingScheme.projection instanceof Oi)s=O.toDegrees(i),a=O.toDegrees(o),l="4326";else{let p=this._tilingScheme.projection.project(new he(i,o,0));s=p.x,a=p.y,l="3857"}let u="visible";c(this._layers)&&(u+=`:${this._layers}`);let f={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:l,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:f}).fetchJson().then(function(p){let g=[],m=p.results;if(!c(m))return g;for(let y=0;y<m.length;++y){let b=m[y],x=new Uh;if(x.data=b,x.name=b.value,x.properties=b.attributes,x.configureDescriptionFromProperties(b.attributes),b.geometryType==="esriGeometryPoint"&&b.geometry){let A=b.geometry.spatialReference&&b.geometry.spatialReference.wkid?b.geometry.spatialReference.wkid:4326;if(A===4326||A===4283)x.position=he.fromDegrees(b.geometry.x,b.geometry.y,b.geometry.z);else if(A===102100||A===900913||A===3857){let C=new Mi;x.position=C.unproject(new d(b.geometry.x,b.geometry.y,b.geometry.z))}}g.push(x)}return g})};ip._metadataCache={};var dg=ip;var Qct={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"},cw=Object.freeze(Qct);function y2(e){}y2.prototype.isReady=function(){return!0};y2.prototype.shouldDiscardImage=function(e){return y2.EMPTY_IMAGE===e};var mH;Object.defineProperties(y2,{EMPTY_IMAGE:{get:function(){return c(mH)||(mH=new Image,mH.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),mH}}});var lw=y2;function k0e(e){this.tileWidth=void 0,this.tileHeight=void 0,this.maximumLevel=void 0,this.imageUrlSubdomains=void 0,this.imageUrlTemplate=void 0,this.attributionList=void 0}k0e.prototype.build=function(e){e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,e._imageUrlSubdomains=this.imageUrlSubdomains,e._imageUrlTemplate=this.imageUrlTemplate;let t=e._attributionList=this.attributionList;t||(t=[]),e._attributionList=t;for(let n=0,i=t.length;n<i;++n){let o=t[n];if(o.credit instanceof Tt)break;o.credit=new Tt(o.attribution);let r=o.coverageAreas;for(let s=0,a=o.coverageAreas.length;s<a;++s){let l=r[s],u=l.bbox;l.bbox=new ce(O.toRadians(u[1]),O.toRadians(u[0]),O.toRadians(u[3]),O.toRadians(u[2]))}}};function Jct(e,t){if(e.resourceSets.length!==1)throw new ae("metadata does not specify one resource in resourceSets");let n=e.resourceSets[0].resources[0];t.tileWidth=n.imageWidth,t.tileHeight=n.imageHeight,t.maximumLevel=n.zoomMax-1,t.imageUrlSubdomains=n.imageUrlSubdomains,t.imageUrlTemplate=n.imageUrl;let i=n.imageryProviders;c(n.imageryProviders)&&(i=n.imageryProviders.filter(o=>o.coverageAreas?.some(r=>c(r.bbox)))),t.attributionList=i}function elt(e,t,n){let i=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(i+=`: ${t.message}`),Po.reportError(void 0,n,c(n)?n._errorEvent:void 0,i,void 0,void 0,void 0,t),new ae(i)}async function tlt(e,t,n){let i=e.url,o=Fs._metadataCache[i];c(o)||(o=e.fetchJsonp("jsonp"),Fs._metadataCache[i]=o);try{let r=await o;return Jct(r,t)}catch(r){elt(e,r,n)}}function Fs(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._mapStyle=e.mapStyle??cw.AERIAL,this._mapLayer=e.mapLayer,this._culture=e.culture??"",this._key=e.key,this._tileDiscardPolicy=e.tileDiscardPolicy,c(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new lw),this._proxy=e.proxy,this._credit=new Tt(`<a href="https://www.microsoft.com/en-us/maps/bing-maps/product"><img src="${Fs.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new ls({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._attributionList=void 0,this._errorEvent=new pe}Object.defineProperties(Fs.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},mapLayer:{get:function(){return this._mapLayer}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return c(this.mapLayer)}}});Fs.fromUrl=async function(e,t){t=t??W.EMPTY_OBJECT,T.defined("url",e),T.defined("options.key",t.key);let n=t.tileProtocol;c(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";let i=t.mapStyle??cw.AERIAL,o=we.createIfNeeded(e);o.appendForwardSlash();let r={incl:"ImageryProviders",key:t.key,uriScheme:n};c(t.mapLayer)&&(r.mapLayer=t.mapLayer),c(t.culture)&&(r.culture=t.culture);let s=o.getDerivedResource({url:`REST/v1/Imagery/Metadata/${i}`,queryParameters:r}),a=new Fs(t);a._resource=o;let l=new k0e(t);return await tlt(s,l),l.build(a),a};var nlt=new ce;Fs.prototype.getTileCredits=function(e,t,n){let i=this._tilingScheme.tileXYToRectangle(e,t,n,nlt);return rlt(this._attributionList,n,i)};Fs.prototype.requestImage=function(e,t,n,i){let o=yl.loadImage(this,ilt(this,e,t,n,i));if(c(o))return o.catch(function(r){return c(r.blob)&&r.blob.size===0?lw.EMPTY_IMAGE:Promise.reject(r)})};Fs.prototype.pickFeatures=function(e,t,n,i,o){};Fs.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;e&r&&(s|=1),t&r&&(s|=2),i+=s}return i};Fs.quadKeyToTileXY=function(e){let t=0,n=0,i=e.length-1;for(let o=i;o>=0;--o){let r=1<<o,s=+e[i-o];s&1&&(t|=r),s&2&&(n|=r)}return{x:t,y:n,level:i}};Fs._logoUrl=void 0;Object.defineProperties(Fs,{logoUrl:{get:function(){return c(Fs._logoUrl)||(Fs._logoUrl=tn("Assets/Images/bing_maps_credit.png")),Fs._logoUrl},set:function(e){T.defined("value",e),Fs._logoUrl=e}}});function ilt(e,t,n,i,o){let r=e._imageUrlTemplate,s=e._imageUrlSubdomains,a=(t+n+i)%s.length;return e._resource.getDerivedResource({url:r,request:o,templateValues:{quadkey:Fs.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}var olt=new ce;function rlt(e,t,n){++t;let i=[];for(let o=0,r=e.length;o<r;++o){let s=e[o],a=s.coverageAreas,l=!1;for(let u=0,f=s.coverageAreas.length;!l&&u<f;++u){let h=a[u];if(t>=h.zoomMin&&t<=h.zoomMax){let p=ce.intersection(n,h.bbox,olt);c(p)&&(l=!0)}}l&&i.push(s.credit)}return i}Fs._metadataCache={};var b2=Fs;var U0e=/{[^}]+}/g,V0e={x:llt,y:flt,z:mlt,s:plt,reverseX:ult,reverseY:dlt,reverseZ:hlt,westDegrees:_lt,southDegrees:glt,eastDegrees:ylt,northDegrees:blt,westProjected:xlt,southProjected:Tlt,eastProjected:Alt,northProjected:Clt,width:Elt,height:Slt},slt=xt(V0e,{i:wlt,j:vlt,reverseI:Dlt,reverseJ:Plt,longitudeDegrees:Olt,latitudeDegrees:Rlt,longitudeProjected:Mlt,latitudeProjected:Llt,format:Flt});function x2(e){e=e??W.EMPTY_OBJECT,this._errorEvent=new pe,T.defined("options.url",e.url);let t=we.createIfNeeded(e.url),n=we.createIfNeeded(e.pickFeaturesUrl);this._resource=t,this._urlSchemeZeroPadding=e.urlSchemeZeroPadding,this._getFeatureInfoFormats=e.getFeatureInfoFormats,this._pickFeaturesResource=n;let i=e.subdomains;Array.isArray(i)?i=i.slice():c(i)&&i.length>0?i=i.split(""):i=["a","b","c"],this._subdomains=i,this._tileWidth=e.tileWidth??256,this._tileHeight=e.tileHeight??256,this._minimumLevel=e.minimumLevel??0,this._maximumLevel=e.maximumLevel,this._tilingScheme=e.tilingScheme??new ls({ellipsoid:e.ellipsoid}),this._rectangle=e.rectangle??this._tilingScheme.rectangle,this._rectangle=ce.intersection(this._rectangle,this._tilingScheme.rectangle),this._tileDiscardPolicy=e.tileDiscardPolicy;let o=e.credit;typeof o=="string"&&(o=new Tt(o)),this._credit=o,this._hasAlphaChannel=e.hasAlphaChannel??!0;let r=e.customTags,s=xt(V0e,r),a=xt(slt,r);this._tags=s,this._pickFeaturesTags=a,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this.enablePickFeatures=e.enablePickFeatures??!0}Object.defineProperties(x2.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}});x2.prototype.getTileCredits=function(e,t,n){};x2.prototype.requestImage=function(e,t,n,i){return yl.loadImage(this,alt(this,e,t,n,i))};x2.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures||!c(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0,s=this;function a(u,f){return u.callback(f)}function l(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);let u=s._getFeatureInfoFormats[r],f=clt(s,e,t,n,i,o,u.format);return++r,u.type==="json"?f.fetchJson().then(u.callback).catch(l):u.type==="xml"?f.fetchXML().then(u.callback).catch(l):u.type==="text"||u.type==="html"?f.fetchText().then(u.callback).catch(l):f.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(l)}return l()};var pH=!1,Qu=new ce,_H=!1,T2=new ce;function alt(e,t,n,i,o){pH=!1,_H=!1;let r=e._resource,s=r.getUrlComponent(!0),a=e._tags,l={},u=s.match(U0e);return c(u)&&u.forEach(function(f){let h=f.substring(1,f.length-1);c(a[h])&&(l[h]=a[h](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:l})}var GX=!1,fw=new H,jX=!1;function clt(e,t,n,i,o,r,s){pH=!1,_H=!1,GX=!1,jX=!1;let a=e._pickFeaturesResource,l=a.getUrlComponent(!0),u=e._pickFeaturesTags,f={},h=l.match(U0e);return c(h)&&h.forEach(function(p){let g=p.substring(1,p.length-1);c(u[g])&&(f[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:f})}function dw(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){let i=e.urlSchemeZeroPadding[t];if(typeof i=="string"){let o=i.length;o>1&&(n=n.length>=o?n:new Array(o-n.toString().length+1).join("0")+n)}}return n}function llt(e,t,n,i){return dw(e,"{x}",t)}function ult(e,t,n,i){let o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return dw(e,"{reverseX}",o)}function flt(e,t,n,i){return dw(e,"{y}",n)}function dlt(e,t,n,i){let o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return dw(e,"{reverseY}",o)}function hlt(e,t,n,i){let o=e.maximumLevel,r=c(o)&&i<o?o-i-1:i;return dw(e,"{reverseZ}",r)}function mlt(e,t,n,i){return dw(e,"{z}",i)}function plt(e,t,n,i){let o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function gH(e,t,n,i){pH||(e.tilingScheme.tileXYToRectangle(t,n,i,Qu),Qu.west=O.toDegrees(Qu.west),Qu.south=O.toDegrees(Qu.south),Qu.east=O.toDegrees(Qu.east),Qu.north=O.toDegrees(Qu.north),pH=!0)}function _lt(e,t,n,i){return gH(e,t,n,i),Qu.west}function glt(e,t,n,i){return gH(e,t,n,i),Qu.south}function ylt(e,t,n,i){return gH(e,t,n,i),Qu.east}function blt(e,t,n,i){return gH(e,t,n,i),Qu.north}function yH(e,t,n,i){_H||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,T2),_H=!0)}function xlt(e,t,n,i){return yH(e,t,n,i),T2.west}function Tlt(e,t,n,i){return yH(e,t,n,i),T2.south}function Alt(e,t,n,i){return yH(e,t,n,i),T2.east}function Clt(e,t,n,i){return yH(e,t,n,i),T2.north}function Elt(e,t,n,i){return e.tileWidth}function Slt(e,t,n,i){return e.tileHeight}function wlt(e,t,n,i,o,r,s){return bH(e,t,n,i,o,r),fw.x}function vlt(e,t,n,i,o,r,s){return bH(e,t,n,i,o,r),fw.y}function Dlt(e,t,n,i,o,r,s){return bH(e,t,n,i,o,r),e.tileWidth-fw.x-1}function Plt(e,t,n,i,o,r,s){return bH(e,t,n,i,o,r),e.tileHeight-fw.y-1}var Ilt=new ce,uw=new d;function bH(e,t,n,i,o,r,s){if(GX)return;WX(e,t,n,i,o,r);let a=uw,l=e.tilingScheme.tileXYToNativeRectangle(t,n,i,Ilt);fw.x=e.tileWidth*(a.x-l.west)/l.width|0,fw.y=e.tileHeight*(l.north-a.y)/l.height|0,GX=!0}function Olt(e,t,n,i,o,r,s){return O.toDegrees(o)}function Rlt(e,t,n,i,o,r,s){return O.toDegrees(r)}function Mlt(e,t,n,i,o,r,s){return WX(e,t,n,i,o,r),uw.x}function Llt(e,t,n,i,o,r,s){return WX(e,t,n,i,o,r),uw.y}var Nlt=new he;function WX(e,t,n,i,o,r,s){if(!jX){if(e.tilingScheme.projection instanceof Oi)uw.x=O.toDegrees(o),uw.y=O.toDegrees(r);else{let a=Nlt;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,uw)}jX=!0}}function Flt(e,t,n,i,o,r,s){return s}var Ya=x2;function pd(e){Ya.call(this,e)}pd._requestMetadata=async function(e,t,n,i){try{let o=await n.fetchXML();return pd._metadataSuccess(o,e,t,n,i)}catch(o){if(o instanceof sm)return pd._metadataFailure(e,t);throw o}};pd.fromUrl=async function(e,t){T.defined("url",e);let n=we.createIfNeeded(e);n.appendForwardSlash();let i=n,o=n.getDerivedResource({url:"tilemapresource.xml"});t=t??W.EMPTY_OBJECT;let r=await pd._requestMetadata(t,i,o);return new pd(r)};c(Object.create)&&(pd.prototype=Object.create(Ya.prototype),pd.prototype.constructor=pd);function z0e(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function H0e(e,t,n){let i=e.positionToTileXY(ce.southwest(t),n),o=e.positionToTileXY(ce.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}pd._metadataSuccess=function(e,t,n,i,o){let r=/tileformat/i,s=/tileset/i,a=/tilesets/i,l=/boundingbox/i,u,f,h,p=[],g=e.childNodes[0].childNodes;for(let R=0;R<g.length;R++)if(r.test(g.item(R).nodeName))u=g.item(R);else if(a.test(g.item(R).nodeName)){h=g.item(R);let L=g.item(R).childNodes;for(let F=0;F<L.length;F++)s.test(L.item(F).nodeName)&&p.push(L.item(F))}else l.test(g.item(R).nodeName)&&(f=g.item(R));let m;if(!c(h)||!c(f))throw m=`Unable to find expected tilesets or bbox attributes in ${i.url}.`,c(o)&&Po.reportError(void 0,o,o.errorEvent,m),new ae(m);let y=t.fileExtension??u.getAttribute("extension"),b=t.tileWidth??parseInt(u.getAttribute("width"),10),x=t.tileHeight??parseInt(u.getAttribute("height"),10),A=t.minimumLevel??parseInt(p[0].getAttribute("order"),10),C=t.maximumLevel??parseInt(p[p.length-1].getAttribute("order"),10),S=h.getAttribute("profile"),v=t.tilingScheme;if(!c(v))if(S==="geodetic"||S==="global-geodetic")v=new Ki({ellipsoid:t.ellipsoid});else if(S==="mercator"||S==="global-mercator")v=new ls({ellipsoid:t.ellipsoid});else throw m=`${i.url} specifies an unsupported profile attribute, ${S}.`,c(o)&&Po.reportError(void 0,o,o.errorEvent,m),new ae(m);let P=ce.clone(t.rectangle);if(!c(P)){let R,L,F,_;t.flipXY??!1?(F=new H(parseFloat(f.getAttribute("miny")),parseFloat(f.getAttribute("minx"))),_=new H(parseFloat(f.getAttribute("maxy")),parseFloat(f.getAttribute("maxx")))):(F=new H(parseFloat(f.getAttribute("minx")),parseFloat(f.getAttribute("miny"))),_=new H(parseFloat(f.getAttribute("maxx")),parseFloat(f.getAttribute("maxy"))));let D=S==="geodetic"||S==="mercator";if(v.projection instanceof Oi||D)R=he.fromDegrees(F.x,F.y),L=he.fromDegrees(_.x,_.y);else{let I=v.projection;R=I.unproject(F),L=I.unproject(_)}P=new ce(R.longitude,R.latitude,L.longitude,L.latitude)}return P=z0e(P,v),A=H0e(v,P,A),{url:n.getDerivedResource({url:`{z}/{x}/{reverseY}.${y}`}),tilingScheme:v,rectangle:P,tileWidth:b,tileHeight:x,minimumLevel:A,maximumLevel:C,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit}};pd._metadataFailure=function(e,t){let n=e.fileExtension??"png",i=e.tileWidth??256,o=e.tileHeight??256,r=e.maximumLevel,s=c(e.tilingScheme)?e.tilingScheme:new ls({ellipsoid:e.ellipsoid}),a=e.rectangle??s.rectangle;a=z0e(a,s);let l=H0e(s,a,e.minimumLevel);return{url:t.getDerivedResource({url:`{z}/{x}/{reverseY}.${n}`}),tilingScheme:s,rectangle:a,tileWidth:i,tileHeight:o,minimumLevel:l,maximumLevel:r,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit}};var D0=pd;function G0e(e){this.channel=e.channel,this.ellipsoid=e.ellipsoid,this.tilingScheme=void 0,this.version=void 0}G0e.prototype.build=function(e){e._channel=this.channel,e._version=this.version,e._tilingScheme=this.tilingScheme};function Blt(e,t){let n;try{n=JSON.parse(e)}catch{n=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let i;for(let o=0;o<n.layers.length;o++)if(n.layers[o].id===t.channel){i=n.layers[o];break}if(!c(i)){let o=`Could not find layer with channel (id) of ${t.channel}.`;throw new ae(o)}if(!c(i.version)){let o=`Could not find a version in channel (id) ${t.channel}.`;throw new ae(o)}if(t.version=i.version,c(n.projection)&&n.projection==="flat")t.tilingScheme=new Ki({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:t.ellipsoid});else if(!c(n.projection)||n.projection==="mercator")t.tilingScheme=new ls({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:t.ellipsoid});else{let o=`Unsupported projection ${n.projection}.`;throw new ae(o)}return!0}function klt(e,t,n){let i=`An error occurred while accessing ${t.url}.`;throw c(e)&&c(e.message)&&(i+=`: ${e.message}`),Po.reportError(void 0,n,c(n)?n._errorEvent:void 0,i),new ae(i)}async function Ult(e,t,n){try{let i=await e.fetchText();Blt(i,t)}catch(i){klt(i,e,n)}}function iu(e){e=e??{},this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1.9,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Tt(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${iu.logoUrl}" title="Google Imagery"/></a>`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new pe}Object.defineProperties(iu.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});iu.fromUrl=async function(e,t,n){T.defined("url",e),T.defined("channel",t),n=n??{};let i=n.path??"/default_map",o=we.createIfNeeded(e).getDerivedResource({url:i[0]==="/"?i.substring(1):i});o.appendForwardSlash();let r=o.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),s=new G0e(n);s.channel=t,await Ult(r,s);let a=new iu(n);return s.build(a),a._resource=o,a._url=e,a._path=i,a};iu.prototype.getTileCredits=function(e,t,n){};iu.prototype.requestImage=function(e,t,n,i){let o=this._resource.getDerivedResource({url:"query",request:i,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:n+1}});return yl.loadImage(this,o)};iu.prototype.pickFeatures=function(e,t,n,i,o){};iu._logoUrl=void 0;Object.defineProperties(iu,{logoUrl:{get:function(){return c(iu._logoUrl)||(iu._logoUrl=tn("Assets/Images/google_earth_credit.png")),iu._logoUrl},set:function(e){T.defined("value",e),iu._logoUrl=e}}});var A2=iu;var Vlt=/\/$/,j0e=new Tt('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function hw(e){e=e??W.EMPTY_OBJECT;let t=e.mapId;if(!c(t))throw new E("options.mapId is required.");let n=e.accessToken;if(!c(n))throw new E("options.accessToken is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;let i=we.createIfNeeded(e.url??"https://{s}.tiles.mapbox.com/v4/");this._mapId=t,this._accessToken=n;let o=e.format??"png";/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();Vlt.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;c(e.credit)?(s=e.credit,typeof s=="string"&&(s=new Tt(s))):s=j0e,this._resource=i,this._imageryProvider=new Ya({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(hw.prototype,{url:{get:function(){return this._imageryProvider.url}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}});hw.prototype.getTileCredits=function(e,t,n){};hw.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};hw.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};hw._defaultCredit=j0e;var C2=hw;function HT(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;let t=e.rectangle??ce.MAX_VALUE,n=new Ki({rectangle:t,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=n,this._image=void 0,this._texture=void 0,this._hasError=!1,this._errorEvent=new pe;let i=e.credit;typeof i=="string"&&(i=new Tt(i)),this._credit=i,T.defined("options.url",e.url);let o=we.createIfNeeded(e.url);this._resource=o,T.typeOf.number("options.tileWidth",e.tileWidth),T.typeOf.number("options.tileHeight",e.tileHeight),this._tileWidth=e.tileWidth,this._tileHeight=e.tileHeight}Object.defineProperties(HT.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});function zlt(e,t,n,i){let o=`Failed to load image ${e.url}`;c(t)&&c(t.message)&&(o+=`: ${t.message}`);let r=Po.reportError(i,n,c(n)?n._errorEvent:void 0,o,0,0,0,t);if(r.retry)return qX(e,n,r);throw c(n)&&(n._hasError=!0),new ae(o)}async function qX(e,t,n){try{return await yl.loadImage(null,e)}catch(i){return zlt(e,i,t,n)}}HT.fromUrl=async function(e,t){T.defined("url",e);let n=we.createIfNeeded(e),i=await qX(n);t=t??W.EMPTY_OBJECT;let o=new HT({...t,url:e,tileWidth:i.width,tileHeight:i.height});return o._image=i,o};HT.prototype.getTileCredits=function(e,t,n){};HT.prototype.requestImage=async function(e,t,n,i){if(!this._hasError&&!c(this._image)){let o=await qX(this._resource,this);return this._image=o,Po.reportSuccess(this._errorEvent),o}return this._image};HT.prototype.pickFeatures=function(e,t,n,i,o){};var E2=HT;function Hlt(e,t,n){if(!c(e))throw new E("type is required.");if(this.type=e,!c(t))if(e==="json")t="application/json";else if(e==="xml")t="text/xml";else if(e==="html")t="text/html";else if(e==="text")t="text/plain";else throw new E('format is required when type is not "json", "xml", "html", or "text".');if(this.format=t,!c(n))if(e==="json")n=Glt;else if(e==="xml")n=Ylt;else if(e==="html")n=W0e;else if(e==="text")n=W0e;else throw new E('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function Glt(e){let t=[],n=e.features;for(let i=0;i<n.length;++i){let o=n[i],r=new Uh;if(r.data=o,r.properties=o.properties,r.configureNameFromProperties(o.properties),r.configureDescriptionFromProperties(o.properties),c(o.geometry)&&o.geometry.type==="Point"){let s=o.geometry.coordinates[0],a=o.geometry.coordinates[1];r.position=he.fromDegrees(s,a)}t.push(r)}return t}var YX="http://www.mapinfo.com/mxp",jlt="http://www.esri.com/wms",Wlt="http://www.opengis.net/wfs",qlt="http://www.opengis.net/gml";function Ylt(e){let t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===YX)return Xlt(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===jlt)return Klt(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===Wlt)return $lt(e);if(t.localName==="ServiceExceptionReport")throw new ae(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?Zlt(e):Qlt(e)}function Xlt(e){let t=[],i=e.documentElement.getElementsByTagNameNS(YX,"Feature");for(let o=0;o<i.length;++o){let r=i[o],s={},a=r.getElementsByTagNameNS(YX,"Val");for(let u=0;u<a.length;++u){let f=a[u];if(f.hasAttribute("ref")){let h=f.getAttribute("ref"),p=f.textContent.trim();s[h]=p}}let l=new Uh;l.data=r,l.properties=s,l.configureNameFromProperties(s),l.configureDescriptionFromProperties(s),t.push(l)}return t}function Klt(e){let t=e.documentElement,n=[],i,o=t.getElementsByTagNameNS("*","FIELDS");if(o.length>0)for(let r=0;r<o.length;++r){let s=o[r];i={};let a=s.attributes;for(let l=0;l<a.length;++l){let u=a[l];i[u.name]=u.value}n.push(xH(s,i))}else{let r=t.getElementsByTagNameNS("*","FeatureInfo");for(let s=0;s<r.length;++s){let a=r[s];i={};let l=a.childNodes;for(let u=0;u<l.length;++u){let f=l[u];f.nodeType===Node.ELEMENT_NODE&&(i[f.localName]=f.textContent)}n.push(xH(a,i))}}return n}function $lt(e){let t=[],i=e.documentElement.getElementsByTagNameNS(qlt,"featureMember");for(let o=0;o<i.length;++o){let r=i[o],s={};XX(r,s),t.push(xH(r,s))}return t}function Zlt(e){let t=[],n,i=e.documentElement.childNodes;for(let r=0;r<i.length;r++)if(i[r].nodeType===Node.ELEMENT_NODE){n=i[r];break}if(!c(n))throw new ae("Unable to find first child of the feature info xml document");let o=n.childNodes;for(let r=0;r<o.length;++r){let s=o[r];if(s.nodeType===Node.ELEMENT_NODE){let a={};XX(s,a),t.push(xH(s,a))}}return t}function XX(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){let o=e.childNodes[i];o.nodeType===Node.ELEMENT_NODE&&(n=!1),!(o.localName==="Point"||o.localName==="LineString"||o.localName==="Polygon"||o.localName==="boundedBy")&&o.hasChildNodes()&&XX(o,t)&&(t[o.localName]=o.textContent)}return n}function xH(e,t){let n=new Uh;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function Qlt(e){let t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);let o=new Uh;return o.data=e,o.description=n.innerHTML,[o]}var Jlt=/<body>\s*<\/body>/im,eut=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,tut=/<title>([\s\S]*)<\/title>/im;function W0e(e){if(Jlt.test(e)||eut.test(e))return;let t,n=tut.exec(e);n&&n.length>1&&(t=n[1]);let i=new Uh;return i.name=t,i.description=e,i.data=e,[i]}var GT=Hlt;function S2(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.clock",e.clock),T.typeOf.object("options.times",e.times),T.typeOf.func("options.requestImageFunction",e.requestImageFunction),T.typeOf.func("options.reloadFunction",e.reloadFunction),this._tileCache={},this._tilesRequestedForInterval=[];let t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}Object.defineProperties(S2.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!c(e))throw new E("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!c(e))throw new E("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});S2.prototype.getFromCache=function(e,t,n,i){let o=q0e(e,t,n),r,s=this._tileCache[this._currentIntervalIndex];if(c(s)&&c(s[o])){let a=s[o];r=a.promise.catch(function(l){throw i.state=a.request.state,l}),delete s[o]}return r};S2.prototype.checkApproachingInterval=function(e,t,n,i){let o=q0e(e,t,n),r=this._tilesRequestedForInterval,s=Y0e(this),a={key:o,priorityFunction:i.priorityFunction};(!c(s)||!X0e(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};S2.prototype._clockOnTick=function(e){let t=e.currentTime,i=this._times.indexOf(t),o=this._currentIntervalIndex;if(i!==o){let s=this._tileCache[o];for(let a in s)s.hasOwnProperty(a)&&s[a].request.cancel();delete this._tileCache[o],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,this._reloadFunction();return}let r=Y0e(this);if(c(r)){let s=this._tilesRequestedForInterval,a=!0;for(;a&&s.length!==0;){let l=s.pop();a=X0e(this,l,r),a||s.push(l)}}};function q0e(e,t,n){return`${e}-${t}-${n}`}function nut(e){let t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function Y0e(e){let t=e._times;if(!c(t))return;let n=e._clock,i=n.currentTime,o=n.canAnimate&&n.shouldAnimate,r=n.multiplier;if(!o&&r!==0)return;let s,a=t.indexOf(i);if(a<0)return;let l=t.get(a);return r>0?(s=Q.secondsDifference(l.stop,i),++a):(s=Q.secondsDifference(l.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function X0e(e,t,n){let i=e._times.indexOf(n.start),o=e._tileCache,r=o[i];c(r)||(r=o[i]={});let s=t.key;if(c(r[s]))return!0;let a=nut(s),l=new Qo({throttle:!1,throttleByServer:!0,type:ms.IMAGERY,priorityFunction:t.priorityFunction}),u=e._requestImageFunction(a.x,a.y,a.level,l,n);return c(u)?(r[s]={promise:u,request:l},!0):!1}var jT=S2;var iut=[3034,3035,3042,3043,3044],out=[4471,4559];function zh(e){if(e=e??W.EMPTY_OBJECT,!c(e.url))throw new E("options.url is required.");if(!c(e.layers))throw new E("options.layers is required.");if(c(e.times)&&!c(e.clock))throw new E("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=e.getFeatureInfoUrl??e.url;let t=we.createIfNeeded(e.url),n=we.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(zh.DefaultParameters,!0),n.setQueryParameters(zh.GetFeatureInfoDefaultParameters,!0),c(e.parameters)&&t.setQueryParameters(K0e(e.parameters)),c(e.getFeatureInfoParameters)&&n.setQueryParameters(K0e(e.getFeatureInfoParameters));let i=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new jT({clock:e.clock,times:e.times,requestImageFunction:function(s,a,l,u,f){return $0e(i,s,a,l,u,f)},reloadFunction:function(){c(i._reload)&&i._reload()}}));let o={};if(o.layers=e.layers,o.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",o.width="{width}",o.height="{height}",parseFloat(t.queryParameters.version)>=1.3){o.crs=e.crs??(e.tilingScheme&&e.tilingScheme.projection instanceof Mi?"EPSG:3857":"CRS:84");let s=o.crs.split(":");if(s[0]==="EPSG"&&s.length===2){let a=Number(s[1]);(a>=4e3&&a<5e3&&!out.includes(a)||iut.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=e.srs??(e.tilingScheme&&e.tilingScheme.projection instanceof Mi?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);let r={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(r.i="{i}",r.j="{j}"):(r.x="{i}",r.y="{j}"),n.setQueryParameters(r,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new Ya({url:t,pickFeaturesUrl:n,tilingScheme:e.tilingScheme??new Ki({ellipsoid:e.ellipsoid}),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:e.getFeatureInfoFormats??zh.DefaultGetFeatureInfoFormats,enablePickFeatures:e.enablePickFeatures})}function $0e(e,t,n,i,o,r){let s=c(r)?r.data:void 0,a=e._tileProvider;return c(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function rut(e,t,n,i,o,r,s){let a=c(s)?s.data:void 0,l=e._tileProvider;return c(a)&&l._pickFeaturesResource.setQueryParameters(a),l.pickFeatures(t,n,i,o,r)}Object.defineProperties(zh.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}});zh.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};zh.prototype.requestImage=function(e,t,n,i){let o,r=this._timeDynamicImagery,s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=$0e(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};zh.prototype.pickFeatures=function(e,t,n,i,o){let r=this._timeDynamicImagery,s=c(r)?r.currentInterval:void 0;return rut(this,e,t,n,i,o,s)};zh.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});zh.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});zh.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new GT("json","application/json")),Object.freeze(new GT("xml","text/xml")),Object.freeze(new GT("text","text/html"))]);function K0e(e){let t={};for(let n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}var w2=zh;var sut=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function v2(e){if(e=e??W.EMPTY_OBJECT,!c(e.url))throw new E("options.url is required.");if(!c(e.layer))throw new E("options.layer is required.");if(!c(e.style))throw new E("options.style is required.");if(!c(e.tileMatrixSetID))throw new E("options.tileMatrixSetID is required.");if(c(e.times)&&!c(e.clock))throw new E("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;let t=we.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!c(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(sut),this._useKvp=!0;else{let h={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(h),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=e.format??"image/jpeg",this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=c(e.tilingScheme)?e.tilingScheme:new ls({ellipsoid:e.ellipsoid}),this._tileWidth=e.tileWidth??256,this._tileHeight=e.tileHeight??256,this._minimumLevel=e.minimumLevel??0,this._maximumLevel=e.maximumLevel,this._rectangle=e.rectangle??this._tilingScheme.rectangle,this._dimensions=e.dimensions;let s=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new jT({clock:e.clock,times:e.times,requestImageFunction:function(h,p,g,m,y){return Z0e(s,h,p,g,m,y)},reloadFunction:function(){c(s._reload)&&s._reload()}}));let a=this._tilingScheme.positionToTileXY(ce.southwest(this._rectangle),this._minimumLevel),l=this._tilingScheme.positionToTileXY(ce.northeast(this._rectangle),this._minimumLevel),u=(Math.abs(l.x-a.x)+1)*(Math.abs(l.y-a.y)+1);if(u>4)throw new E(`The imagery provider's rectangle and minimumLevel indicate that there are ${u} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new pe;let f=e.credit;this._credit=typeof f=="string"?new Tt(f):f,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():c(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function Z0e(e,t,n,i,o,r){let s=e._tileMatrixLabels,a=c(s)?s[i]:i.toString(),l=e._subdomains,u=e._dimensions,f=c(r)?r.data:void 0,h,p;if(!e._useKvp)p={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:l[(t+n+i)%l.length]},h=e._resource.getDerivedResource({request:o}),h.setTemplateValues(p),c(u)&&h.setTemplateValues(u),c(f)&&h.setTemplateValues(f);else{let g={};g.tilematrix=a,g.layer=e._layer,g.style=e._style,g.tilerow=n,g.tilecol=t,g.tilematrixset=e._tileMatrixSetID,g.format=e._format,c(u)&&(g=xt(g,u)),c(f)&&(g=xt(g,f)),p={s:l[(t+n+i)%l.length]},h=e._resource.getDerivedResource({queryParameters:g,request:o}),h.setTemplateValues(p)}return yl.loadImage(e,h)}Object.defineProperties(v2.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,c(this._reload)&&this._reload())}}});v2.prototype.getTileCredits=function(e,t,n){};v2.prototype.requestImage=function(e,t,n,i){let o,r=this._timeDynamicImagery,s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=Z0e(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};v2.prototype.pickFeatures=function(e,t,n,i,o){};var D2=v2;var aut={ARCGIS_MAPSERVER:dg.fromUrl,BING:async(e,t)=>b2.fromUrl(e,t),GOOGLE_EARTH:async(e,t)=>{let n=t.channel;return delete t.channel,A2.fromUrl(e,n,t)},MAPBOX:(e,t)=>new C2({url:e,...t}),SINGLE_TILE:E2.fromUrl,TMS:D0.fromUrl,URL_TEMPLATE:(e,t)=>new Ya({url:e,...t}),WMS:(e,t)=>new w2({url:e,...t}),WMTS:(e,t)=>new D2({url:e,...t})};function op(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileCredits=void 0,this._errorEvent=new pe}Object.defineProperties(op.prototype,{rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}},proxy:{get:function(){}}});op.fromAssetId=async function(e,t){T.typeOf.number("assetId",e),t=t??W.EMPTY_OBJECT;let n=Cu._createEndpointResource(e,t),i=e.toString()+t.accessToken+t.server,o=op._endpointCache[i];c(o)||(o=n.fetchJson(),op._endpointCache[i]=o);let r=await o;if(r.type!=="IMAGERY")throw new ae(`Cesium ion asset ${e} is not an imagery asset.`);let s,a=r.externalType;if(!c(a))s=await D0.fromUrl(new Cu(r,n));else{let u=aut[a];if(!c(u))throw new ae(`Unrecognized Cesium ion imagery type: ${a}`);let f={...r.options},h=f.url;delete f.url,s=await u(h,f)}let l=new op(t);return s.errorEvent.addEventListener(function(u){u.provider=l,l._errorEvent.raiseEvent(u)}),l._tileCredits=Cu.getCreditsFromEndpoint(r,n),l._imageryProvider=s,l};op.prototype.getTileCredits=function(e,t,n){let i=this._imageryProvider.getTileCredits(e,t,n);return c(i)?this._tileCredits.concat(i):this._tileCredits};op.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};op.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};op._endpointCache={};var hg=op;var cut={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},mg=Object.freeze(cut);function lut(e){e=e??W.EMPTY_OBJECT;let t=e.style??mg.AERIAL;return hg.fromAssetId(t)}var pg=lut;function mw(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){let r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=ai.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!c(o)&&e.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}mw.createPlaceholder=function(e){let t=new mw(e,0,0,0);return t.addReference(),t.state=ai.PLACEHOLDER,t};mw.prototype.addReference=function(){++this.referenceCount};mw.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),c(this.parent)&&this.parent.releaseReference(),c(this.image)&&c(this.image.destroy)&&this.image.destroy(),c(this.texture)&&this.texture.destroy(),c(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),de(this),0):this.referenceCount};mw.prototype.processStateMachine=function(e,t,n){this.state===ai.UNLOADED&&!n&&(this.state=ai.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ai.RECEIVED&&(this.state=ai.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));let i=this.state===ai.READY&&t&&!this.texture;(this.state===ai.TEXTURE_LOADED||i)&&(this.state=ai.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};var pw=mw;function KX(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}KX.prototype.freeResources=function(){c(this.readyImagery)&&this.readyImagery.releaseReference(),c(this.loadingImagery)&&this.loadingImagery.releaseReference()};KX.prototype.processStateMachine=function(e,t,n){let i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===ai.READY)return c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r=i.parent,s;for(;c(r)&&(r.state!==ai.READY||!this.useWebMercatorT&&!c(r.texture));)r.state!==ai.FAILED&&r.state!==ai.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,c(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===ai.FAILED||i.state===ai.INVALID?c(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};var _w=KX;function Ai(e,t){this._imageryProvider=e,this._readyEvent=new pe,this._errorEvent=new pe,t=t??W.EMPTY_OBJECT,e=e??W.EMPTY_OBJECT,this.alpha=t.alpha??e._defaultAlpha??1,this.nightAlpha=t.nightAlpha??e._defaultNightAlpha??1,this.dayAlpha=t.dayAlpha??e._defaultDayAlpha??1,this.brightness=t.brightness??e._defaultBrightness??Ai.DEFAULT_BRIGHTNESS,this.contrast=t.contrast??e._defaultContrast??Ai.DEFAULT_CONTRAST,this.hue=t.hue??e._defaultHue??Ai.DEFAULT_HUE,this.saturation=t.saturation??e._defaultSaturation??Ai.DEFAULT_SATURATION,this.gamma=t.gamma??e._defaultGamma??Ai.DEFAULT_GAMMA,this.splitDirection=t.splitDirection??Ai.DEFAULT_SPLIT,this.minificationFilter=t.minificationFilter??e._defaultMinificationFilter??Ai.DEFAULT_MINIFICATION_FILTER,this.magnificationFilter=t.magnificationFilter??e._defaultMagnificationFilter??Ai.DEFAULT_MAGNIFICATION_FILTER,this.show=t.show??!0,this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=t.rectangle??ce.MAX_VALUE,this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new _w(pw.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=t.colorToAlphaThreshold??Ai.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD}Object.defineProperties(Ai.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},ready:{get:function(){return c(this._imageryProvider)}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},rectangle:{get:function(){return this._rectangle}}});Ai.DEFAULT_BRIGHTNESS=1;Ai.DEFAULT_CONTRAST=1;Ai.DEFAULT_HUE=0;Ai.DEFAULT_SATURATION=1;Ai.DEFAULT_GAMMA=1;Ai.DEFAULT_SPLIT=Vr.NONE;Ai.DEFAULT_MINIFICATION_FILTER=Yt.LINEAR;Ai.DEFAULT_MAGNIFICATION_FILTER=li.LINEAR;Ai.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;Ai.fromProviderAsync=function(e,t){T.typeOf.object("imageryProviderPromise",e);let n=new Ai(void 0,t);return mut(n,Promise.resolve(e)),n};Ai.fromWorldImagery=function(e){return e=e??W.EMPTY_OBJECT,Ai.fromProviderAsync(pg({style:e.style}),e)};Ai.prototype.isBaseLayer=function(){return this._isBaseLayer};Ai.prototype.isDestroyed=function(){return!1};Ai.prototype.destroy=function(){return de(this)};var ebe=new ce,Q0e=new ce,$X=new ce,tbe=new ce;Ai.prototype.getImageryRectangle=function(){let e=this._imageryProvider,t=this._rectangle;return ce.intersection(e.rectangle,t)};Ai.prototype._createTileImagerySkeletons=function(e,t,n){let i=e.data;if(!c(t)||c(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||c(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;c(n)||(n=i.imagery.length);let o=this._imageryProvider;if(!this.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;let r=o.tilingScheme.projection instanceof Mi&&e.rectangle.north<Mi.MaximumLatitude&&e.rectangle.south>-Mi.MaximumLatitude,s=ce.intersection(o.rectangle,this._rectangle,ebe),a=ce.intersection(e.rectangle,s,Q0e);if(!c(a)){if(!this.isBaseLayer())return!1;let D=s,I=e.rectangle;a=Q0e,I.south>=D.north?a.north=a.south=D.north:I.north<=D.south?a.north=a.south=D.south:(a.south=Math.max(I.south,D.south),a.north=Math.min(I.north,D.north)),I.west>=D.east?a.west=a.east=D.east:I.east<=D.west?a.west=a.east=D.west:(a.west=Math.max(I.west,D.west),a.east=Math.min(I.east,D.east))}let l=0;a.south>0?l=a.south:a.north<0&&(l=a.north);let f=1*t.getLevelMaximumGeometricError(e.level),h=dut(this,f,l);h=Math.max(0,h);let p=o.maximumLevel;if(h>p&&(h=p),c(o.minimumLevel)){let D=o.minimumLevel;h<D&&(h=D)}let g=o.tilingScheme,m=g.positionToTileXY(ce.northwest(a),h),y=g.positionToTileXY(ce.southeast(a),h),b=e.rectangle.width/512,x=e.rectangle.height/512,A=g.tileXYToRectangle(m.x,m.y,h);Math.abs(A.south-e.rectangle.north)<x&&m.y<y.y&&++m.y,Math.abs(A.east-e.rectangle.west)<b&&m.x<y.x&&++m.x;let C=g.tileXYToRectangle(y.x,y.y,h);Math.abs(C.north-e.rectangle.south)<x&&y.y>m.y&&--y.y,Math.abs(C.west-e.rectangle.east)<b&&y.x>m.x&&--y.x;let S=ce.clone(e.rectangle,tbe),v=g.tileXYToRectangle(m.x,m.y,h),P=ce.intersection(v,s,$X),M;r?(g.rectangleToNativeRectangle(S,S),g.rectangleToNativeRectangle(v,v),g.rectangleToNativeRectangle(P,P),g.rectangleToNativeRectangle(s,s),M=g.tileXYToNativeRectangle.bind(g),b=S.width/512,x=S.height/512):M=g.tileXYToRectangle.bind(g);let R,L=0,F=1,_;!this.isBaseLayer()&&Math.abs(P.west-S.west)>=b&&(L=Math.min(1,(P.west-S.west)/S.width)),!this.isBaseLayer()&&Math.abs(P.north-S.north)>=x&&(F=Math.max(0,(P.north-S.south)/S.height));let w=F;for(let D=m.x;D<=y.x;D++)if(R=L,v=M(D,m.y,h),P=ce.simpleIntersection(v,s,$X),!!c(P)){L=Math.min(1,(P.east-S.west)/S.width),D===y.x&&(this.isBaseLayer()||Math.abs(P.east-S.east)<b)&&(L=1),F=w;for(let I=m.y;I<=y.y;I++){if(_=F,v=M(D,I,h),P=ce.simpleIntersection(v,s,$X),!c(P))continue;F=Math.max(0,(P.south-S.south)/S.height),I===y.y&&(this.isBaseLayer()||Math.abs(P.south-S.south)<x)&&(F=0);let N=new se(R,F,L,_),k=this.getImageryFromCache(D,I,h);i.imagery.splice(n,0,new _w(k,N,r)),++n}}return!0};Ai.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){let l=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=l.rectangleToNativeRectangle(n,ebe),i=l.rectangleToNativeRectangle(i,tbe)}let o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new se(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)};Ai.prototype._requestImagery=function(e){let t=this._imageryProvider,n=this;function i(s){if(!c(s))return o();e.image=s,e.state=ai.RECEIVED,e.request=void 0,Po.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===$n.CANCELLED){e.state=ai.UNLOADED,e.request=void 0;return}e.state=ai.FAILED,e.request=void 0;let a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=Po.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){let s=new Qo({throttle:!1,throttleByServer:!0,type:ms.IMAGERY});e.request=s,e.state=ai.TRANSITIONING;let a=t.requestImage(e.x,e.y,e.level,s);if(!c(a)){e.state=ai.UNLOADED,e.request=void 0;return}c(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(l){i(l)}).catch(function(l){o(l)})}r()};Ai.prototype._createTextureWebGL=function(e,t){let n=new Qt({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return c(i.internalFormat)?new Rt({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new Rt({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?ke.RGBA:ke.RGB,sampler:n})};Ai.prototype._createTexture=function(e,t){let n=this._imageryProvider,i=t.image;if(c(n.tileDiscardPolicy)){let r=n.tileDiscardPolicy;if(c(r)){if(!r.isReady()){t.state=ai.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=ai.INVALID;return}}}if(this.minificationFilter!==Yt.NEAREST&&this.minificationFilter!==Yt.LINEAR)throw new E("ImageryLayer minification filter must be NEAREST or LINEAR");let o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof Mi?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=ai.TEXTURE_LOADED};function J0e(e,t,n){return`${e}:${t}:${n}`}Ai.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter,i=this.magnificationFilter;if(n===Yt.LINEAR&&i===li.LINEAR&&!ke.isCompressedFormat(t.pixelFormat)&&O.isPowerOfTwo(t.width)&&O.isPowerOfTwo(t.height)){n=Yt.LINEAR_MIPMAP_LINEAR;let r=ut.maximumTextureFilterAnisotropy,s=Math.min(r,this._maximumAnisotropy??r),a=J0e(n,i,s),l=e.cache.imageryLayerMipmapSamplers;c(l)||(l={},e.cache.imageryLayerMipmapSamplers=l);let u=l[a];c(u)||(u=l[a]=new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(Cf.NICEST),t.sampler=u}else{let r=J0e(n,i,0),s=e.cache.imageryLayerNonMipmapSamplers;c(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];c(a)||(a=s[r]=new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};Ai.prototype._reprojectTexture=function(e,t,n){let i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=n??!0,n&&!(this._imageryProvider.tilingScheme.projection instanceof Oi)&&o.width/i.width>1e-5){let s=this;t.addReference();let a=new Uc({persists:!0,owner:this,preExecute:function(l){fut(l,r,i,t.rectangle)},postExecute:function(l){t.texture=l,s._finalizeReprojectTexture(r,l),t.state=ai.READY,t.releaseReference()},canceled:function(){t.state=ai.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=ai.READY};Ai.prototype.queueReprojectionCommands=function(e){let t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0};Ai.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){c(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};Ai.prototype.getImageryFromCache=function(e,t,n,i){let o=nbe(e,t,n),r=this._imageryCache[o];return c(r)||(r=new pw(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};Ai.prototype.removeImageryFromCache=function(e){let t=nbe(e.x,e.y,e.level);delete this._imageryCache[t]};function nbe(e,t,n){return JSON.stringify([e,t,n])}var TH={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new H,texture:void 0},uut=Vt.supportsTypedArrays()?new Float32Array(2*64):void 0;function fut(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!c(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){c(this.framebuffer)&&this.framebuffer.destroy(),c(this.vertexArray)&&this.vertexArray.destroy(),c(this.shaderProgram)&&this.shaderProgram.destroy()}};let b=new Float32Array(2*64*2),x=0;for(let P=0;P<64;++P){let M=P/63;b[x++]=0,b[x++]=M,b[x++]=1,b[x++]=M}let A={position:0,webMercatorT:1},C=cs.getRegularGridIndices(2,64),S=yt.createIndexBuffer({context:t,typedArray:C,usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});o.vertexArray=new ti({context:t,attributes:[{index:A.position,vertexBuffer:yt.createVertexBuffer({context:t,typedArray:b,usage:Be.STATIC_DRAW}),componentsPerAttribute:2},{index:A.webMercatorT,vertexBuffer:yt.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:Be.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:S});let v=new He({sources:[s2]});o.shaderProgram=Jt.fromCache({context:t,vertexShaderSource:v,fragmentShaderSource:r2,attributeLocations:A}),o.sampler=new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR,magnificationFilter:li.LINEAR})}n.sampler=o.sampler;let r=n.width,s=n.height;TH.textureDimensions.x=r,TH.textureDimensions.y=s,TH.texture=n;let a=Math.sin(i.south),l=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);let f=1/(.5*Math.log((1+a)/(1-a))-l),h=new Rt({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});O.isPowerOfTwo(r)&&O.isPowerOfTwo(s)&&h.generateMipmap(Cf.NICEST);let p=i.south,g=i.north,m=uut,y=0;for(let b=0;b<64;++b){let x=b/63,A=O.lerp(p,g,x);a=Math.sin(A);let S=(.5*Math.log((1+a)/(1-a))-l)*f;m[y++]=S,m[y++]=S}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(m),e.shaderProgram=o.shaderProgram,e.outputTexture=h,e.uniformMap=TH,e.vertexArray=o.vertexArray}function dut(e,t,n){let i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof Oi?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,f=Math.log(u)/Math.log(2);return Math.round(f)|0}function hut(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function mut(e,t){let n;try{if(n=await Promise.resolve(t),e.isDestroyed())return;e._imageryProvider=n,e._readyEvent.raiseEvent(n)}catch(i){hut(e._errorEvent,i)}}var Xa=Ai;var put={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},yn=put;var ibe={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=ibe.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},Yn=ibe;function yw(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new se}yw.prototype.update=function(e,t,n){this.changedThisFrame&&(ube(e,t,this.tile,n),this.changedThisFrame=!1)};yw.prototype.destroy=function(e){this._destroyVertexArray(e),c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};yw.prototype._destroyVertexArray=function(e){c(this.vertexArray)&&(c(e)?e.push(this.vertexArray):md._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};var _ut=new Cy;yw.updateFillTiles=function(e,t,n,i){let o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=_ut;a.clear();for(let u=0;u<t.length;++u){let f=t[u];c(f.data.vertexArray)&&a.enqueue(t[u])}let l=a.dequeue();for(;l!==void 0;){let u=l.findTileToWest(r),f=l.findTileToSouth(r),h=l.findTileToEast(r),p=l.findTileToNorth(r);Bs(e,n,l,u,s,yn.EAST,!1,a,i),Bs(e,n,l,f,s,yn.NORTH,!1,a,i),Bs(e,n,l,h,s,yn.WEST,!1,a,i),Bs(e,n,l,p,s,yn.SOUTH,!1,a,i);let g=u.findTileToNorth(r),m=u.findTileToSouth(r),y=h.findTileToNorth(r),b=h.findTileToSouth(r);Bs(e,n,l,g,s,yn.SOUTHEAST,!1,a,i),Bs(e,n,l,y,s,yn.SOUTHWEST,!1,a,i),Bs(e,n,l,m,s,yn.NORTHEAST,!1,a,i),Bs(e,n,l,b,s,yn.NORTHWEST,!1,a,i),l=a.dequeue()}};function Bs(e,t,n,i,o,r,s,a,l){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||Yn.wasKicked(u._lastSelectionResult)||Yn.originalResult(u._lastSelectionResult)===Yn.CULLED);){if(s)return;let f=u.parent;if(r>=yn.NORTHWEST&&f!==void 0)switch(r){case yn.NORTHWEST:u=u===f.northwestChild?f:void 0;break;case yn.NORTHEAST:u=u===f.northeastChild?f:void 0;break;case yn.SOUTHWEST:u=u===f.southwestChild?f:void 0;break;case yn.SOUTHEAST:u=u===f.southeastChild?f:void 0;break}else u=f}if(u!==void 0){if(u._lastSelectionResult===Yn.RENDERED){if(c(u.data.vertexArray))return;gut(e,t,n,u,r,o,a,l);return}if(Yn.originalResult(i._lastSelectionResult)!==Yn.CULLED)switch(r){case yn.WEST:Bs(e,t,n,i.northwestChild,o,r,!0,a,l),Bs(e,t,n,i.southwestChild,o,r,!0,a,l);break;case yn.EAST:Bs(e,t,n,i.southeastChild,o,r,!0,a,l),Bs(e,t,n,i.northeastChild,o,r,!0,a,l);break;case yn.SOUTH:Bs(e,t,n,i.southwestChild,o,r,!0,a,l),Bs(e,t,n,i.southeastChild,o,r,!0,a,l);break;case yn.NORTH:Bs(e,t,n,i.northeastChild,o,r,!0,a,l),Bs(e,t,n,i.northwestChild,o,r,!0,a,l);break;case yn.NORTHWEST:Bs(e,t,n,i.northwestChild,o,r,!0,a,l);break;case yn.NORTHEAST:Bs(e,t,n,i.northeastChild,o,r,!0,a,l);break;case yn.SOUTHWEST:Bs(e,t,n,i.southwestChild,o,r,!0,a,l);break;case yn.SOUTHEAST:Bs(e,t,n,i.southeastChild,o,r,!0,a,l);break;default:throw new E("Invalid edge")}}}function gut(e,t,n,i,o,r,s,a){let l=i.data;if(l.fill===void 0)l.fill=new yw(i);else if(l.fill.visitedFrame===r)return;l.fill.enqueuedFrame!==r&&(l.fill.enqueuedFrame=r,l.fill.changedThisFrame=!1,s.enqueue(i)),yut(e,t,n,i,o,a)}function yut(e,t,n,i,o,r){let s=i.data.fill,a,l=n.data.fill;c(l)?(l.visitedFrame=t.frameNumber,l.changedThisFrame&&(ube(e,t,n,r),l.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,f;switch(o){case yn.WEST:u=s.westMeshes,f=s.westTiles;break;case yn.SOUTH:u=s.southMeshes,f=s.southTiles;break;case yn.EAST:u=s.eastMeshes,f=s.eastTiles;break;case yn.NORTH:u=s.northMeshes,f=s.northTiles;break;case yn.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case yn.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case yn.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case yn.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||u[0]!==a||u.length!==1,u[0]=a,f[0]=n,u.length=1,f.length=1;return}let h,p,g,m,y=n.rectangle,b,x=i.rectangle;switch(o){case yn.WEST:for(b=(x.north-x.south)*O.EPSILON5,h=0;h<f.length&&(g=f[h],m=g.rectangle,!O.greaterThan(y.north,m.south,b));++h);for(p=h;p<f.length&&(g=f[p],m=g.rectangle,!O.greaterThanOrEquals(y.south,m.north,b));++p);break;case yn.SOUTH:for(b=(x.east-x.west)*O.EPSILON5,h=0;h<f.length&&(g=f[h],m=g.rectangle,!O.lessThan(y.west,m.east,b));++h);for(p=h;p<f.length&&(g=f[p],m=g.rectangle,!O.lessThanOrEquals(y.east,m.west,b));++p);break;case yn.EAST:for(b=(x.north-x.south)*O.EPSILON5,h=0;h<f.length&&(g=f[h],m=g.rectangle,!O.lessThan(y.south,m.north,b));++h);for(p=h;p<f.length&&(g=f[p],m=g.rectangle,!O.lessThanOrEquals(y.north,m.south,b));++p);break;case yn.NORTH:for(b=(x.east-x.west)*O.EPSILON5,h=0;h<f.length&&(g=f[h],m=g.rectangle,!O.greaterThan(y.east,m.west,b));++h);for(p=h;p<f.length&&(g=f[p],m=g.rectangle,!O.greaterThanOrEquals(y.west,m.east,b));++p);break}p-h===1?(s.changedThisFrame=s.changedThisFrame||u[h]!==a,u[h]=a,f[h]=n):(s.changedThisFrame=!0,u.splice(h,p-h,a),f.splice(h,p-h,n))}var WT=new he,but=new he,gw=new d,eK=new d,ZX=new H,QX=new H,Ju=new H;function DH(){this.height=0,this.encodedNormal=new H}function AH(e,t,n,i,o,r,s,a,l){if(c(o))return o;let u;if(c(r)&&c(s))u=(r.height+s.height)*.5;else if(c(r))u=r.height;else if(c(s))u=s.height;else if(c(a))u=a.height;else{let h=e.tile.data.tileBoundingRegion,p=0,g=0;c(h)&&(p=h.minimumHeight,g=h.maximumHeight),u=(p+g)*.5}return fbe(e,t,n,i,u,l),l}var xut={minimumHeight:0,maximumHeight:0},Tut=new d,obe=new DH,rbe=new DH,sbe=new DH,abe=new DH,Aut=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,Cut={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function ube(e,t,n,i){md.initialize(n,e.terrainProvider,e._imageryLayers);let o=n.data,r=o.fill,s=n.rectangle,a=t.verticalExaggeration,l=t.verticalExaggerationRelativeHeight,u=a!==1,f=n.tilingScheme.ellipsoid,h=EH(r,f,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,sbe),p=EH(r,f,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,obe),g=EH(r,f,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,rbe),m=EH(r,f,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,abe);h=AH(r,f,0,1,h,p,m,g,sbe),p=AH(r,f,0,0,p,h,g,m,obe),g=AH(r,f,1,1,g,p,m,h,rbe),m=AH(r,f,1,1,m,g,h,p,abe);let y=p.height,b=g.height,x=h.height,A=m.height,C=Math.min(y,b,x,A),S=Math.max(y,b,x,A),v=(C+S)*.5,P,M,R=e.getLevelMaximumGeometricError(n.level),L=f.maximumRadius-R,F=Math.acos(L/f.maximumRadius)*4;if(F*=1.5,s.width>F&&S-C<=R){let D=new qa({width:9,height:9,buffer:Aut,structure:{heightOffset:S}}),I=Cut;I.tilingScheme=n.tilingScheme,I.x=n.x,I.y=n.y,I.level=n.level,I.exaggeration=a,I.exaggerationRelativeHeight=l,r.mesh=D._createMeshSync(I)}else{let D=u,I=ce.center(s,but);I.height=v;let N=f.cartographicToCartesian(I,Tut),k=new Oc(N,void 0,void 0,void 0,void 0,!0,!0,D,a,l),z=5,V;for(V=r.westMeshes,P=0,M=V.length;P<M;++P)z+=V[P].eastIndicesNorthToSouth.length;for(V=r.southMeshes,P=0,M=V.length;P<M;++P)z+=V[P].northIndicesWestToEast.length;for(V=r.eastMeshes,P=0,M=V.length;P<M;++P)z+=V[P].westIndicesSouthToNorth.length;for(V=r.northMeshes,P=0,M=V.length;P<M;++P)z+=V[P].southIndicesEastToWest.length;let j=xut;j.minimumHeight=C,j.maximumHeight=S;let U=k.stride,q=new Float32Array(z*U),Y=0,te=Y;Y=CH(f,s,k,q,Y,0,1,h.height,h.encodedNormal,1,j),Y=wH(r,f,k,q,Y,r.westTiles,r.westMeshes,yn.EAST,j);let K=Y;Y=CH(f,s,k,q,Y,0,0,p.height,p.encodedNormal,0,j),Y=wH(r,f,k,q,Y,r.southTiles,r.southMeshes,yn.NORTH,j);let Z=Y;Y=CH(f,s,k,q,Y,1,0,g.height,g.encodedNormal,0,j),Y=wH(r,f,k,q,Y,r.eastTiles,r.eastMeshes,yn.WEST,j);let ee=Y;Y=CH(f,s,k,q,Y,1,1,m.height,m.encodedNormal,1,j),Y=wH(r,f,k,q,Y,r.northTiles,r.northMeshes,yn.SOUTH,j),C=j.minimumHeight,S=j.maximumHeight;let me=Dn.fromRectangle(s,C,S,n.tilingScheme.ellipsoid),Te=Mi.geodeticLatitudeToMercatorAngle(s.south),ue=1/(Mi.geodeticLatitudeToMercatorAngle(s.north)-Te),ye=(Mi.geodeticLatitudeToMercatorAngle(I.latitude)-Te)*ue,Ae=f.geodeticSurfaceNormalCartographic(WT,eK),Pe=Ln.octEncode(Ae,ZX),Ee=Y;k.encode(q,Y*U,me.center,H.fromElements(.5,.5,Ju),v,Pe,ye,Ae),++Y;let ze=Y,qe=ze<256?1:2,it=(ze-1)*3,Dt=it*qe,jt=(q.length-ze*U)*Float32Array.BYTES_PER_ELEMENT,$e;if(jt>=Dt){let _e=ze*U*Float32Array.BYTES_PER_ELEMENT;$e=ze<256?new Uint8Array(q.buffer,_e,it):new Uint16Array(q.buffer,_e,it)}else $e=ze<256?new Uint8Array(it):new Uint16Array(it);q=new Float32Array(q.buffer,0,ze*U);let un=0;for(P=0;P<ze-2;++P)$e[un++]=Ee,$e[un++]=P,$e[un++]=P+1;$e[un++]=Ee,$e[un++]=P,$e[un++]=0;let zt=[];for(P=K;P>=te;--P)zt.push(P);let Ct=[];for(P=Z;P>=K;--P)Ct.push(P);let Ei=[];for(P=ee;P>=Z;--P)Ei.push(P);let an=[];for(an.push(0),P=Ee-1;P>=ee;--P)an.push(P);r.mesh=new hd(k.center,q,$e,it,ze,C,S,le.fromOrientedBoundingBox(me),Iut(e,me.center,s,C,S),k.stride,me,k,zt,Ct,Ei,an)}let _=t.context;r._destroyVertexArray(i),r.vertexArray=md._createVertexArrayForMesh(_,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);let w=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){let D=o._findAncestorTileWithTerrainData(n);c(D)&&c(D.data.waterMaskTexture)&&(r.waterMaskTexture=D.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,D,r.waterMaskTranslationAndScale))}c(w)&&(--w.referenceCount,w.referenceCount===0&&w.destroy())}function CH(e,t,n,i,o,r,s,a,l,u,f){let h=WT;h.longitude=O.lerp(t.west,t.east,r),h.latitude=O.lerp(t.south,t.north,s),h.height=a;let p=e.cartographicToCartesian(h,gw),g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(p,eK));let m=QX;return m.x=r,m.y=s,n.encode(i,o*n.stride,p,m,a,l,u,g),f.minimumHeight=Math.min(f.minimumHeight,a),f.maximumHeight=Math.max(f.maximumHeight,a),o+1}var vH=new ce;function P2(e,t,n,i){let o=e.rectangle,r=t.rectangle;t.x===0&&n.x===1&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=ce.clone(e.rectangle,vH),o.west-=O.TWO_PI,o.east-=O.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=ce.clone(e.rectangle,vH),o.west+=O.TWO_PI,o.east+=O.TWO_PI);let s=o.east-o.west,a=(r.west-o.west)/s,l=(r.east-o.west)/s,u=o.north-o.south,f=(r.south-o.south)/u,h=(r.north-o.south)/u,p=(n.x-a)/(l-a),g=(n.y-f)/(h-f);return Math.abs(p)<Math.EPSILON5?p=0:Math.abs(p-1)<Math.EPSILON5&&(p=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=p,i.y=g,i}var Eut=new H;function JX(e,t,n,i,o){let r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{let a=o.encodedNormal;a.x=0,a.y=0}}var Sut=new H,wut=new d;function vut(e,t,n,i,o,r,s,a,l,u){let f=i.encoding,h=i.vertices,p=P2(t,n,f.decodeTextureCoordinates(h,o,Ju),Ju),g=P2(t,n,f.decodeTextureCoordinates(h,r,QX),QX),m;l?m=(s-p.x)/(g.x-p.x):m=(a-p.y)/(g.y-p.y);let y=f.decodeHeight(h,o),b=f.decodeHeight(h,r),x=n.rectangle;WT.longitude=O.lerp(x.west,x.east,s),WT.latitude=O.lerp(x.south,x.north,a),u.height=WT.height=O.lerp(y,b,m);let A;if(f.hasVertexNormals){let C=f.getOctEncodedNormal(h,o,Eut),S=f.getOctEncodedNormal(h,r,Sut),v=Ln.octDecode(C.x,C.y,gw),P=Ln.octDecode(S.x,S.y,wut);A=d.lerp(v,P,m,gw),d.normalize(A,A),Ln.octEncode(A,u.encodedNormal)}else A=e.geodeticSurfaceNormalCartographic(WT,gw),Ln.octEncode(A,u.encodedNormal)}function fbe(e,t,n,i,o,r){r.height=o;let s=t.geodeticSurfaceNormalCartographic(WT,gw);Ln.octEncode(s,r.encodedNormal)}function EH(e,t,n,i,o,r,s,a,l,u,f){if(lbe(e,t,a,s,!1,n,i,f)||lbe(e,t,u,l,!0,n,i,f))return f;let p;if(tK(o,r))return n===0?i===0?p=r.eastIndicesNorthToSouth[0]:p=r.southIndicesEastToWest[0]:i===0?p=r.northIndicesWestToEast[0]:p=r.westIndicesSouthToNorth[0],JX(r,p,n,i,f),f;let g;if(n===0?i===0?g=SH(e.westMeshes,e.westTiles,yn.EAST,e.southMeshes,e.southTiles,yn.NORTH,n,i):g=SH(e.northMeshes,e.northTiles,yn.SOUTH,e.westMeshes,e.westTiles,yn.EAST,n,i):i===0?g=SH(e.southMeshes,e.southTiles,yn.NORTH,e.eastMeshes,e.eastTiles,yn.WEST,n,i):g=SH(e.eastMeshes,e.eastTiles,yn.WEST,e.northMeshes,e.northTiles,yn.SOUTH,n,i),c(g))return fbe(e,t,n,i,g,f),f}function SH(e,t,n,i,o,r,s,a){let l=cbe(e,t,!1,n,s,a),u=cbe(i,o,!0,r,s,a);return c(l)&&c(u)?(l+u)*.5:c(l)?l:u}function wH(e,t,n,i,o,r,s,a,l){for(let u=0;u<r.length;++u)o=Dut(e,t,n,i,o,r[u],s[u],a,l);return o}function Dut(e,t,n,i,o,r,s,a,l){let u=r.rectangle;a===yn.EAST&&e.tile.x===0?(u=ce.clone(r.rectangle,vH),u.west-=O.TWO_PI,u.east-=O.TWO_PI):a===yn.WEST&&r.x===0&&(u=ce.clone(r.rectangle,vH),u.west+=O.TWO_PI,u.east+=O.TWO_PI);let f=e.tile.rectangle,h,p;o>0&&(n.decodeTextureCoordinates(i,o-1,Ju),h=Ju.x,p=Ju.y);let g,m;switch(a){case yn.WEST:g=s.westIndicesSouthToNorth,m=!1;break;case yn.NORTH:g=s.northIndicesWestToEast,m=!0;break;case yn.EAST:g=s.eastIndicesNorthToSouth,m=!1;break;case yn.SOUTH:g=s.southIndicesEastToWest,m=!0;break}let y=r,b=e.tile,x=s.encoding,A=s.vertices,C=n.stride,S,v;x.hasWebMercatorT&&(S=Mi.geodeticLatitudeToMercatorAngle(f.south),v=1/(Mi.geodeticLatitudeToMercatorAngle(f.north)-S));for(let P=0;P<g.length;++P){let M=g[P],R=x.decodeTextureCoordinates(A,M,Ju);P2(y,b,R,R);let L=R.x,F=R.y,_=m?L:F;if(_<0||_>1||Math.abs(L-h)<O.EPSILON5&&Math.abs(F-p)<O.EPSILON5)continue;let w=Math.abs(L)<O.EPSILON5||Math.abs(L-1)<O.EPSILON5,D=Math.abs(F)<O.EPSILON5||Math.abs(F-1)<O.EPSILON5;if(w&&D)continue;let I=x.decodePosition(A,M,gw),N=x.decodeHeight(A,M),k;x.hasVertexNormals?k=x.getOctEncodedNormal(A,M,ZX):(k=ZX,k.x=0,k.y=0);let z=F;if(x.hasWebMercatorT){let j=O.lerp(f.south,f.north,F);z=(Mi.geodeticLatitudeToMercatorAngle(j)-S)*v}let V;n.hasGeodeticSurfaceNormals&&(V=t.geodeticSurfaceNormal(I,eK)),n.encode(i,o*C,I,R,N,k,z,V),l.minimumHeight=Math.min(l.minimumHeight,N),l.maximumHeight=Math.max(l.maximumHeight,N),++o}return o}function cbe(e,t,n,i,o,r){let s,a,l;n?(s=0,a=e.length,l=1):(s=e.length-1,a=-1,l=-1);for(let u=s;u!==a;u+=l){let f=e[u],h=t[u];if(!tK(h,f))continue;let p;switch(i){case yn.WEST:p=f.westIndicesSouthToNorth;break;case yn.SOUTH:p=f.southIndicesEastToWest;break;case yn.EAST:p=f.eastIndicesNorthToSouth;break;case yn.NORTH:p=f.northIndicesWestToEast;break}let g=p[n?0:p.length-1];if(c(g))return f.encoding.decodeHeight(f.vertices,g)}}function tK(e,t){return c(t)&&(!c(e.data.fill)||!e.data.fill.changedThisFrame)}function lbe(e,t,n,i,o,r,s,a){let l,u,f,h,p,g=i[o?0:n.length-1],m=n[o?0:n.length-1];if(tK(g,m)&&(r===0?s===0?(l=o?m.northIndicesWestToEast:m.eastIndicesNorthToSouth,u=o,f=o):(l=o?m.eastIndicesNorthToSouth:m.southIndicesEastToWest,u=!o,f=!1):s===0?(l=o?m.westIndicesSouthToNorth:m.northIndicesWestToEast,u=!o,f=!0):(l=o?m.southIndicesEastToWest:m.westIndicesSouthToNorth,u=o,f=!o),l.length>0)){h=o?0:l.length-1,p=l[h],m.encoding.decodeTextureCoordinates(m.vertices,p,Ju);let y=P2(g,e.tile,Ju,Ju);if(y.x===r&&y.y===s)return JX(m,p,r,s,a),!0;if(h=Lo(l,u?r:s,function(b,x){m.encoding.decodeTextureCoordinates(m.vertices,b,Ju);let A=P2(g,e.tile,Ju,Ju);return f?u?A.x-r:A.y-s:u?r-A.x:s-A.y}),h<0){if(h=~h,h>0&&h<l.length)return vut(t,g,e.tile,m,l[h-1],l[h],r,s,u,a),!0}else return JX(m,l[h],r,s,a),!0}return!1}var Put=[new d,new d,new d,new d];function Iut(e,t,n,i,o,r){let s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=Put;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}var bw=yw;function ur(e){if(!c(e))throw new E("options is required.");if(c(e.terrainProvider))if(c(e.imageryLayers)){if(!c(e.surfaceShaderSet))throw new E("options.surfaceShaderSet is required.")}else throw new E("options.imageryLayers is required.");else throw new E("options.terrainProvider is required.");this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.showWaterEffect=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=xn.RECEIVE_ONLY,this.vertexShadowDarkness=.3,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new pe,this._removeLayerAddedListener=this._imageryLayers.layerAdded.addEventListener(ur.prototype._onLayerAdded,this),this._removeLayerRemovedListener=this._imageryLayers.layerRemoved.addEventListener(ur.prototype._onLayerRemoved,this),this._removeLayerMovedListener=this._imageryLayers.layerMoved.addEventListener(ur.prototype._onLayerMoved,this),this._removeLayerShownListener=this._imageryLayers.layerShownOrHidden.addEventListener(ur.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new pe,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new G(0,0,.5,1),this._clippingPlanes=void 0,this._clippingPolygons=void 0,this.cartographicLimitRectangle=ce.clone(ce.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldVerticalExaggeration=void 0,this._oldVerticalExaggerationRelativeHeight=void 0}Object.defineProperties(ur.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!c(e))throw new E("value is required.");this._baseColor=e,this._firstPassInitialColor=se.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!c(e))throw new E("value is required.");this._quadtree=e}},tilingScheme:{get:function(){if(c(this._terrainProvider))return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,c(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){gs.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){th.setOwner(e,this,"_clippingPolygons")}}});function Out(e,t){let n=e.loadingImagery;c(n)||(n=e.readyImagery);let i=t.loadingImagery;return c(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}ur.prototype.update=function(e){this._imageryLayers._update()};function Rut(e,t){let n=t.creditDisplay,i=e._terrainProvider;c(i)&&c(i.credit)&&n.addCreditToNextFrame(i.credit);let o=e._imageryLayers;for(let r=0,s=o.length;r<s;++r){let a=o.get(r);a.ready&&a.show&&c(a.imageryProvider.credit)&&n.addCreditToNextFrame(a.imageryProvider.credit)}}ur.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(Out)})),Rut(this,e);let t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)md._freeVertexArray(t[i]);t.length=0};ur.prototype.beginUpdate=function(e){let t=this._tilesToRenderByTextureCount;for(let o=0,r=t.length;o<r;++o){let s=t[o];c(s)&&(s.length=0)}let n=this._clippingPlanes;c(n)&&n.enabled&&n.update(e);let i=this._clippingPolygons;c(i)&&i.enabled&&(i.update(e),i.queueCommands(e)),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};ur.prototype.endUpdate=function(e){if(!c(this._renderState)){this._renderState=Ve.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:dc.LESS}}),this._blendRenderState=Ve.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:dc.LESS_OR_EQUAL},blending:ln.ALPHA_BLEND});let s=je(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=Ve.fromCache(s),s=je(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=Ve.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&bw.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);let t=this.quadtree,n=e.verticalExaggeration,i=e.verticalExaggerationRelativeHeight,o=this._oldVerticalExaggeration!==n||this._oldVerticalExaggerationRelativeHeight!==i;this._oldVerticalExaggeration=n,this._oldVerticalExaggerationRelativeHeight=i,o&&t.forEachLoadedTile(function(s){s.data.updateExaggeration(s,e,t)});let r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){let l=r[s];if(c(l))for(let u=0,f=l.length;u<f;++u){let h=l[u],p=h.data.tileBoundingRegion;nft(this,h,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,p.minimumHeight)}}};function _be(e,t){let n=t.globeTranslucencyState;if(n.translucent){let i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}ur.prototype.updateForPick=function(e){let t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)_be(t[n],e)};ur.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};ur.prototype.getLevelMaximumGeometricError=function(e){return c(this._terrainProvider)?this._terrainProvider.getLevelMaximumGeometricError(e):0};ur.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;c(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===Yn.CULLED_BUT_NEEDED,o=n.terrainState),md.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i),n=t.data,i&&o!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==xr.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,md.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};var Mut=new le,gbe=new ce,Lut=new ce,Nut=new he;function IH(e,t){if(t.west<t.east)return t;let n=ce.clone(t,Lut);return ce.center(e,Nut).longitude>0?n.east=O.PI:n.west=-O.PI,n}function ybe(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;let n=e._clippingPlanes;if(c(n)&&n.enabled)return!0;let i=e._clippingPolygons;return!!(c(i)&&i.enabled||!ce.equals(e.cartographicLimitRectangle,ce.MAX_VALUE))}ur.prototype.computeTileVisibility=function(e,t,n){let i=this.computeDistanceToTile(e,t);e._distance=i;let o=ybe(this,t);if(t.fog.enabled&&!o&&O.fog(i,t.fog.density)>=1)return xr.NONE;let r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return xr.PARTIAL;let a=t.cullingVolume,l=s.boundingVolume;c(l)||(l=s.boundingSphere),r.clippedByBoundaries=!1;let u=IH(e.rectangle,this.cartographicLimitRectangle),f=ce.simpleIntersection(u,e.rectangle,gbe);if(!c(f))return xr.NONE;if(ce.equals(f,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==oe.SCENE3D&&(l=Mut,le.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,l),d.fromElements(l.center.z,l.center.x,l.center.y,l.center),t.mode===oe.MORPHING&&c(r.renderedMesh)&&(l=le.union(s.boundingSphere,l,l))),!c(l))return xr.PARTIAL;let h=this._clippingPlanes;if(c(h)&&h.enabled){let b=h.computeIntersectionWithBoundingVolume(l);if(e.isClipped=b!==Wt.INSIDE,b===Wt.OUTSIDE)return xr.NONE}let p=this._clippingPolygons;if(c(p)&&p.enabled){let b=p.computeIntersectionWithBoundingVolume(s);e.isClipped=b!==Wt.OUTSIDE}let g,m=a.computeVisibility(l);if(m===Wt.OUTSIDE?g=xr.NONE:m===Wt.INTERSECTING?g=xr.PARTIAL:m===Wt.INSIDE&&(g=xr.FULL),g===xr.NONE)return g;let y=t.mode===oe.SCENE3D&&t.camera.frustum instanceof on;if(t.mode===oe.SCENE3D&&!y&&c(n)&&!o){let b=r.occludeePointInScaledSpace;return!c(b)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(b,s.minimumHeight)?g:xr.NONE}return g};ur.prototype.canRefine=function(e){return c(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};var Fut=[],But=[];ur.prototype.canRenderWithoutLosingDetail=function(e,t){let n=e.data,i=Fut;i.length=this._imageryLayers.length;let o=!1,r=!1,s;c(n)&&(o=n.terrainState===fo.READY,r=!0,s=n.imagery);let a,l;for(a=0,l=i.length;a<l;++a)i[a]=r;if(c(s))for(a=0,l=s.length;a<l;++a){let h=s[a],p=h.loadingImagery,g=!c(p)||p.state===ai.FAILED||p.state===ai.INVALID,m=(h.loadingImagery||h.readyImagery).imageryLayer._layerIndex;i[m]=g&&i[m]}let u=this.quadtree._lastSelectionFrameNumber,f=But;for(f.length=0,f.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);f.length>0;){let h=f.pop(),p=h._lastSelectionResultFrame===u?h._lastSelectionResult:Yn.NONE;if(p===Yn.RENDERED){let g=h.data;if(!c(g))continue;if(!o&&h.data.terrainState===fo.READY)return!1;let m=h.data.imagery;for(a=0,l=m.length;a<l;++a){let y=m[a],b=y.loadingImagery,x=!c(b)||b.state===ai.FAILED||b.state===ai.INVALID,A=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(x&&!i[A])return!1}}else p===Yn.REFINED&&f.push(h.southwestChild,h.southeastChild,h.northwestChild,h.northeastChild)}return!0};var kut=new d;ur.prototype.computeTileLoadPriority=function(e,t){let n=e.data;if(n===void 0)return 0;let i=n.tileBoundingRegion.boundingVolume;if(i===void 0)return 0;let o=t.camera.positionWC,r=t.camera.directionWC,s=d.subtract(i.center,o,kut),a=d.magnitude(s);return a<O.EPSILON5?0:(d.divideByScalar(s,a,s),(1-d.dot(s,r))*e._distance)};var dbe=new B,PH=new B,Uut=new se,Vut=new se,zut=new se,Hut=new d,hbe=new d,Gut=new d,jut=new d;ur.prototype.showTileThisFrame=function(e,t){let n=0,i=e.data.imagery;for(let a=0,l=i.length;a<l;++a){let u=i[a];c(u.readyImagery)&&u.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];c(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);let r=e.data;c(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;let s=this._debug;++s.tilesRendered,s.texturesRendered+=n};var Wut=[new d,new d,new d,new d];function mbe(e,t,n,i,o,r){let s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=Wut;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}ur.prototype.computeDistanceToTile=function(e,t){qut(e,this,t);let n=e.data;if(n.boundingVolumeSourceTile===void 0)return 9999999999;let o=n.tileBoundingRegion,r=o.minimumHeight,s=o.maximumHeight;if(n.boundingVolumeSourceTile!==e){let l=t.camera.positionCartographic.height,u=Math.abs(l-r),f=Math.abs(l-s);u>f?(o.minimumHeight=r,o.maximumHeight=r):(o.minimumHeight=s,o.maximumHeight=s)}let a=o.distanceToCamera(t);return o.minimumHeight=r,o.maximumHeight=s,a};function qut(e,t,n){let i=e.data;i===void 0&&(i=e.data=new md);let o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new Lu({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));let r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight,l=!1,u=e,f=i.mesh,h=i.terrainData;if(f!==void 0&&f.minimumHeight!==void 0&&f.maximumHeight!==void 0)r.minimumHeight=f.minimumHeight,r.maximumHeight=f.maximumHeight,l=!0;else if(h!==void 0&&h._minimumHeight!==void 0&&h._maximumHeight!==void 0)r.minimumHeight=h._minimumHeight,r.maximumHeight=h._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let p=e.parent;for(;p!==void 0;){let g=p.data;if(g!==void 0){let m=g.mesh,y=g.terrainData;if(m!==void 0&&m.minimumHeight!==void 0&&m.maximumHeight!==void 0){r.minimumHeight=m.minimumHeight,r.maximumHeight=m.maximumHeight;break}else if(y!==void 0&&y._minimumHeight!==void 0&&y._maximumHeight!==void 0){r.minimumHeight=y._minimumHeight,r.maximumHeight=y._maximumHeight;break}}p=p.parent}u=p}if(u!==void 0){let p=n.verticalExaggeration,g=n.verticalExaggerationRelativeHeight;if(p!==1&&(l=!1,r.minimumHeight=Dr.getHeight(r.minimumHeight,p,g),r.maximumHeight=Dr.getHeight(r.maximumHeight,p,g)),l)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Dn.clone(f.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=le.clone(f.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=d.clone(f.occludeePointInScaledSpace,i.occludeePointInScaledSpace),c(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=mbe(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{let y=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||y)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=mbe(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=u,i.boundingVolumeIsFromMesh=l}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}ur.prototype.isDestroyed=function(){return!1};ur.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),this._removeLayerAddedListener=this._removeLayerAddedListener&&this._removeLayerAddedListener(),this._removeLayerRemovedListener=this._removeLayerRemovedListener&&this._removeLayerRemovedListener(),this._removeLayerMovedListener=this._removeLayerMovedListener&&this._removeLayerMovedListener(),this._removeLayerShownListener=this._removeLayerShownListener&&this._removeLayerShownListener(),de(this)};function Yut(e,t,n){return function(i){let o,r,s=-1,a=i.data.imagery,l=a.length,u;for(u=0;u<l;++u)if(o=a[u],r=o.readyImagery??o.loadingImagery,r.imageryLayer===t){s=u;break}if(s!==-1){let f=s+e;if(o=a[f],r=c(o)?o.readyImagery??o.loadingImagery:void 0,!c(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,f);for(u=s;u<f;++u)a[u].freeResources();a.splice(s,e)}return!0}}ur.prototype._onLayerAdded=function(e,t){if(!this.isDestroyed()&&e.show){let n=this._terrainProvider,i=this,o=this._imageryLayersUpdatedEvent,r=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(c(s._loadedCallbacks[e._layerIndex]))return;let a,l=s.data.imagery,u=l.length,f=-1,h=0;for(a=0;a<u;++a){let g=l[a];if((g.readyImagery??g.loadingImagery).imageryLayer===e)f===-1&&(f=a),++h;else if(f!==-1)break}if(f===-1)return;let p=f+h;e._createTileImagerySkeletons(s,n,p)&&(s._loadedCallbacks[e._layerIndex]=Yut(h,e,n),s.state=ta.LOADING)})};if(e.ready){let s=e.imageryProvider;s._reload=r}this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=ta.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==Yn.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,o.raiseEvent()}};ur.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(n){let i=n.data.imagery,o=-1,r=0;for(let s=0,a=i.length;s<a;++s){let l=i[s],u=l.loadingImagery;if(c(u)||(u=l.readyImagery),u.imageryLayer===e)o===-1&&(o=s),l.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),c(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};ur.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};ur.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var Xut=new B,Kut=new B;function pbe(e,t){let n={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_atmosphereLightIntensity:function(){return this.properties.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return this.properties.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return this.properties.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return this.properties.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return this.properties.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return this.properties.atmosphereMieAnisotropy},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_verticalExaggerationAndRelativeHeight:function(){return this.properties.verticalExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){let i=e.context.uniformState.view,o=B.multiplyByPoint(i,this.properties.rtc,hbe);return B.setTranslation(i,o,dbe),dbe},u_modifiedModelViewProjection:function(){let i=e.context.uniformState.view,o=e.context.uniformState.projection,r=B.multiplyByPoint(i,this.properties.rtc,hbe);return B.setTranslation(i,r,PH),B.multiply(o,PH,PH),PH},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_clippingPlanes:function(){let i=t._clippingPlanes;return c(i)&&c(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){let i=t._clippingPlanes,o=c(i)?B.multiply(e.context.uniformState.view,i.modelMatrix,Xut):B.IDENTITY;return B.inverseTranspose(o,Kut)},u_clippingPlanesEdgeStyle:function(){let i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},u_clippingDistance:function(){let i=t._clippingPolygons.clippingTexture;return c(i)?i:e.context.defaultTexture},u_clippingExtents:function(){let i=t._clippingPolygons.extentsTexture;return c(i)?i:e.context.defaultTexture},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},u_vertexShadowDarkness:function(){return this.properties.vertexShadowDarkness},properties:{initialColor:new se(0,0,.5,1),fillHighlightColor:new G(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new H(65e5,9e6),nightFadeDistance:new H(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new d(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new d(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new d,center3D:void 0,rtc:new d,modifiedModelView:new B,tileRectangle:new se,verticalExaggerationAndRelativeHeight:new H(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new H,southMercatorYAndOneOverHeight:new H,waterMask:void 0,waterMaskTranslationAndScale:new se,minMaxHeight:new H,scaleAndBias:new B,clippingPlanesEdgeColor:G.clone(G.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new se,frontFaceAlphaByDistance:new se,backFaceAlphaByDistance:new se,localizedTranslucencyRectangle:new se,undergroundColor:G.clone(G.TRANSPARENT),undergroundColorAlphaByDistance:new se,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return c(t.materialUniformMap)?xt(n,t.materialUniformMap):n}function $ut(e,t,n){let i=n.data,o,r;if(c(i.vertexArray)?(o=i.mesh,r=i.vertexArray):c(i.fill)&&c(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!c(o)||!c(r))){if(c(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=Zut(e,r,o),i.wireframeVertexArray.mesh=o}}function Zut(e,t,n){let o={indices:n.indices,primitiveType:Me.TRIANGLES};Nn.toWireframe(o);let r=o.indices,s=yt.createIndexBuffer({context:e,typedArray:r,usage:Be.STATIC_DRAW,indexDatatype:Fe.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new ti({context:e,attributes:t._attributes,indexBuffer:s})}var bbe,xbe,OH;(function(){let e=new St({geometry:Ud.fromDimensions({dimensions:new d(2,2,2)})}),t=new St({geometry:new M_({radius:1})}),n=new B,i,o;function r(s){return new Pn({geometryInstances:s,appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})}bbe=function(s,a){return s===i||(OH(),i=s,n=B.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=Gt.fromColor(a),o=r(e)),o},xbe=function(s,a){return s===i||(OH(),i=s,n=B.fromTranslation(s.center,n),n=B.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=Gt.fromColor(a),o=r(t)),o},OH=function(){c(o)&&(o.destroy(),o=void 0,i=void 0)}})();var Qut=new se(0,0,0,0),Jut={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,enableClippingPolygons:void 0,clippingPolygons:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},eft=G.TRANSPARENT,tft=new Bt;function nft(e,t,n){let i=t.data;c(i.vertexArray)||(i.fill===void 0&&(i.fill=new bw(t)),i.fill.update(e,n));let o=n.creditDisplay,r=i.terrainData;if(c(r)&&c(r.credits)){let _e=r.credits;for(let Ce=0,pn=_e.length;Ce<pn;++Ce)o.addCreditToNextFrame(_e[Ce])}let s=ut.maximumTextureImageUnits,a=i.waterMaskTexture,l=i.waterMaskTranslationAndScale;!c(a)&&c(i.fill)&&(a=i.fill.waterMaskTexture,l=i.fill.waterMaskTranslationAndScale);let u=n.cameraUnderground,f=n.globeTranslucencyState,h=f.translucent,p=f.frontFaceAlphaByDistance,g=f.backFaceAlphaByDistance,m=f.rectangle,y=e.undergroundColor??eft,b=e.undergroundColorAlphaByDistance??tft,x=ybe(e,n)&&n.mode===oe.SCENE3D&&y.alpha>0&&(b.nearValue>0||b.farValue>0),A=e.lambertDiffuseMultiplier,C=e.vertexShadowDarkness,S=e.hasWaterMask&&c(a),v=S&&e.showWaterEffect,P=e.oceanNormalMap,M=v&&c(P),R=e.terrainProvider,L=c(R)&&e.terrainProvider.hasVertexNormals,F=n.fog.enabled&&n.fog.renderable&&!u,_=e.showGroundAtmosphere&&n.mode===oe.SCENE3D,w=xn.castShadows(e.shadows)&&!h,D=xn.receiveShadows(e.shadows)&&!h,I=e.hueShift,N=e.saturationShift,k=e.brightnessShift,z=!(O.equalsEpsilon(I,0,O.EPSILON7)&&O.equalsEpsilon(N,0,O.EPSILON7)&&O.equalsEpsilon(k,0,O.EPSILON7)),V=!1;if(_){let _e=d.magnitude(n.camera.positionWC),Ce=e.nightFadeOutDistance;V=_e>Ce}S&&--s,M&&--s,c(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,c(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,c(e.clippingPolygons)&&e.clippingPolygons.enabled&&(--s,--s),s-=f.numberOfTextureUniforms;let j=i.renderedMesh,U=j.center,q=j.encoding,Y=i.tileBoundingRegion,te=n.verticalExaggeration,K=n.verticalExaggerationRelativeHeight,Z=te!==1,ee=q.hasGeodeticSurfaceNormals,me=Uut,Te=0,ue=0,ye=0,Ae=0,Pe=!1;if(n.mode!==oe.SCENE3D){let _e=n.mapProjection,Ce=_e.project(ce.southwest(t.rectangle),Gut),pn=_e.project(ce.northeast(t.rectangle),jut);if(me.x=Ce.x,me.y=Ce.y,me.z=pn.x,me.w=pn.y,n.mode!==oe.MORPHING&&(U=Hut,U.x=0,U.y=(me.z+me.x)*.5,U.z=(me.w+me.y)*.5,me.x-=U.y,me.y-=U.z,me.z-=U.y,me.w-=U.z),n.mode===oe.SCENE2D&&q.quantization===ea.BITS12){let mt=1/(Math.pow(2,12)-1)*.5,so=(me.z-me.x)*mt,Ro=(me.w-me.y)*mt;me.x-=so,me.y-=Ro,me.z+=so,me.w+=Ro}_e instanceof Mi&&(Te=t.rectangle.south,ue=t.rectangle.north,ye=Mi.geodeticLatitudeToMercatorAngle(Te),Ae=1/(Mi.geodeticLatitudeToMercatorAngle(ue)-ye),Pe=!0)}let Ee=Jut;Ee.frameState=n,Ee.surfaceTile=i,Ee.hasWaterMask=S,Ee.showReflectiveOcean=v,Ee.showOceanWaves=M,Ee.enableLighting=e.enableLighting,Ee.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,Ee.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,Ee.showGroundAtmosphere=_,Ee.atmosphereLightIntensity=e.atmosphereLightIntensity,Ee.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,Ee.atmosphereMieCoefficient=e.atmosphereMieCoefficient,Ee.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,Ee.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,Ee.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,Ee.perFragmentGroundAtmosphere=V,Ee.hasVertexNormals=L,Ee.useWebMercatorProjection=Pe,Ee.clippedByBoundaries=i.clippedByBoundaries,Ee.hasGeodeticSurfaceNormals=ee,Ee.hasExaggeration=Z;let ze=i.imagery,qe=0,it=ze.length,Dt=e.showSkirts&&!u&&!h,jt=e.backFaceCulling&&!u&&!h,$e=jt?e._renderState:e._disableCullingRenderState,un=jt?e._blendRenderState:e._disableCullingBlendRenderState,zt=$e,Ct=e._firstPassInitialColor,Ei=n.context;if(c(e._debug.boundingSphereTile)||OH(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;let _e=e._drawCommands.length;for(let Ce=0;Ce<_e;++Ce)e._uniformMaps[Ce]=pbe(n,e)}do{let _e=0,Ce,pn;if(e._drawCommands.length<=e._usedDrawCommands?(Ce=new Qe,Ce.owner=t,Ce.cull=!1,Ce.boundingVolume=new le,Ce.orientedBoundingBox=void 0,pn=pbe(n,e),e._drawCommands.push(Ce),e._uniformMaps.push(pn)):(Ce=e._drawCommands[e._usedDrawCommands],pn=e._uniformMaps[e._usedDrawCommands]),Ce.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){let la=Y.boundingVolume,Sl=Y.boundingSphere;c(la)?bbe(la,G.RED).update(n):c(Sl)&&xbe(Sl,G.RED).update(n)}let mt=pn.properties;se.clone(Ct,mt.initialColor),mt.oceanNormalMap=P,mt.lightingFadeDistance.x=e.lightingFadeOutDistance,mt.lightingFadeDistance.y=e.lightingFadeInDistance,mt.nightFadeDistance.x=e.nightFadeOutDistance,mt.nightFadeDistance.y=e.nightFadeInDistance,mt.atmosphereLightIntensity=e.atmosphereLightIntensity,mt.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,mt.atmosphereMieCoefficient=e.atmosphereMieCoefficient,mt.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,mt.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,mt.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,mt.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;let so=u?g:p,Ro=u?p:g;c(so)&&(se.fromElements(so.near,so.nearValue,so.far,so.farValue,mt.frontFaceAlphaByDistance),se.fromElements(Ro.near,Ro.nearValue,Ro.far,Ro.farValue,mt.backFaceAlphaByDistance)),se.fromElements(b.near,b.nearValue,b.far,b.farValue,mt.undergroundColorAlphaByDistance),G.clone(y,mt.undergroundColor),mt.lambertDiffuseMultiplier=A,mt.vertexShadowDarkness=C;let aa=!c(i.vertexArray)&&c(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;aa&&G.clone(e.fillHighlightColor,mt.fillHighlightColor),mt.verticalExaggerationAndRelativeHeight.x=te,mt.verticalExaggerationAndRelativeHeight.y=K,mt.center3D=j.center,d.clone(U,mt.rtc),se.clone(me,mt.tileRectangle),mt.southAndNorthLatitude.x=Te,mt.southAndNorthLatitude.y=ue,mt.southMercatorYAndOneOverHeight.x=ye,mt.southMercatorYAndOneOverHeight.y=Ae;let Nr=Vut,Cs=IH(t.rectangle,e.cartographicLimitRectangle),Ne=zut,ot=IH(t.rectangle,m);d.fromElements(I,N,k,mt.hsbShift);let Xe=t.rectangle,Ze=1/Xe.width,pt=1/Xe.height;Nr.x=(Cs.west-Xe.west)*Ze,Nr.y=(Cs.south-Xe.south)*pt,Nr.z=(Cs.east-Xe.west)*Ze,Nr.w=(Cs.north-Xe.south)*pt,se.clone(Nr,mt.localizedCartographicLimitRectangle),Ne.x=(ot.west-Xe.west)*Ze,Ne.y=(ot.south-Xe.south)*pt,Ne.z=(ot.east-Xe.west)*Ze,Ne.w=(ot.north-Xe.south)*pt,se.clone(Ne,mt.localizedTranslucencyRectangle);let Ht=F&&O.fog(t._distance,n.fog.density)>O.EPSILON3;z=z&&(Ht||_);let Cn=!1,Mo=!1,Ao=!1,Za=!1,Qa=!1,Si=!1,_i=!1,ca=!1,Jr=!1,El=!1;for(;_e<s&&qe<it;){let la=ze[qe],Sl=la.readyImagery;if(++qe,!c(Sl)||Sl.imageryLayer.alpha===0)continue;let ec=la.useWebMercatorT?Sl.textureWebMercator:Sl.texture;if(!c(ec))throw new E("readyImagery is not actually ready!");let hs=Sl.imageryLayer;c(la.textureTranslationAndScale)||(la.textureTranslationAndScale=hs._calculateTextureTranslationAndScale(t,la)),mt.dayTextures[_e]=ec,mt.dayTextureTranslationAndScale[_e]=la.textureTranslationAndScale,mt.dayTextureTexCoordsRectangle[_e]=la.textureCoordinateRectangle,mt.dayTextureUseWebMercatorT[_e]=la.useWebMercatorT,mt.dayTextureAlpha[_e]=hs.alpha,Si=Si||mt.dayTextureAlpha[_e]!==1,mt.dayTextureNightAlpha[_e]=hs.nightAlpha,_i=_i||mt.dayTextureNightAlpha[_e]!==1,mt.dayTextureDayAlpha[_e]=hs.dayAlpha,_i=_i||mt.dayTextureDayAlpha[_e]!==1,mt.dayTextureBrightness[_e]=hs.brightness,Cn=Cn||mt.dayTextureBrightness[_e]!==Xa.DEFAULT_BRIGHTNESS,mt.dayTextureContrast[_e]=hs.contrast,Mo=Mo||mt.dayTextureContrast[_e]!==Xa.DEFAULT_CONTRAST,mt.dayTextureHue[_e]=hs.hue,Ao=Ao||mt.dayTextureHue[_e]!==Xa.DEFAULT_HUE,mt.dayTextureSaturation[_e]=hs.saturation,Za=Za||mt.dayTextureSaturation[_e]!==Xa.DEFAULT_SATURATION,mt.dayTextureOneOverGamma[_e]=1/hs.gamma,Qa=Qa||mt.dayTextureOneOverGamma[_e]!==1/Xa.DEFAULT_GAMMA,mt.dayTextureSplit[_e]=hs.splitDirection,ca=ca||mt.dayTextureSplit[_e]!==0;let mf=mt.dayTextureCutoutRectangles[_e];if(c(mf)||(mf=mt.dayTextureCutoutRectangles[_e]=new se),se.clone(se.ZERO,mf),c(hs.cutoutRectangle)){let Vo=IH(Xe,hs.cutoutRectangle),cn=ce.simpleIntersection(Vo,Xe,gbe);Jr=c(cn)||Jr,mf.x=(Vo.west-Xe.west)*Ze,mf.y=(Vo.south-Xe.south)*pt,mf.z=(Vo.east-Xe.west)*Ze,mf.w=(Vo.north-Xe.south)*pt}let pf=mt.colorsToAlpha[_e];c(pf)||(pf=mt.colorsToAlpha[_e]=new se);let _f=c(hs.colorToAlpha)&&hs.colorToAlphaThreshold>0;if(El=El||_f,_f){let Vo=hs.colorToAlpha;pf.x=Vo.red,pf.y=Vo.green,pf.z=Vo.blue,pf.w=hs.colorToAlphaThreshold}else pf.w=-1;if(c(Sl.credits)){let Vo=Sl.credits;for(let cn=0,Se=Vo.length;cn<Se;++cn)o.addCreditToNextFrame(Vo[cn])}++_e}mt.dayTextures.length=_e,mt.waterMask=a,se.clone(l,mt.waterMaskTranslationAndScale),mt.minMaxHeight.x=q.minimumHeight,mt.minMaxHeight.y=q.maximumHeight,B.clone(q.matrix,mt.scaleAndBias);let yo=e._clippingPlanes,Fr=c(yo)&&yo.enabled&&t.isClipped;Fr&&(mt.clippingPlanesEdgeColor=G.clone(yo.edgeColor,mt.clippingPlanesEdgeColor),mt.clippingPlanesEdgeWidth=yo.edgeWidth);let xp=e._clippingPolygons,es=c(xp)&&xp.enabled&&t.isClipped;Ee.numberOfDayTextures=_e,Ee.applyBrightness=Cn,Ee.applyContrast=Mo,Ee.applyHue=Ao,Ee.applySaturation=Za,Ee.applyGamma=Qa,Ee.applyAlpha=Si,Ee.applyDayNightAlpha=_i,Ee.applySplit=ca,Ee.enableFog=Ht,Ee.enableClippingPlanes=Fr,Ee.clippingPlanes=yo,Ee.enableClippingPolygons=es,Ee.clippingPolygons=xp,Ee.hasImageryLayerCutout=Jr,Ee.colorCorrect=z,Ee.highlightFillTile=aa,Ee.colorToAlpha=El,Ee.showUndergroundColor=x,Ee.translucent=h;let hf=i.renderedMesh.indices.length;Dt||(hf=i.renderedMesh.indexCountWithoutSkirts),Ce.shaderProgram=e._surfaceShaderSet.getShaderProgram(Ee),Ce.castShadows=w,Ce.receiveShadows=D,Ce.renderState=zt,Ce.primitiveType=Me.TRIANGLES,Ce.vertexArray=i.vertexArray||i.fill.vertexArray,Ce.count=hf,Ce.uniformMap=pn,Ce.pass=De.GLOBE,e._debug.wireframe&&($ut(Ei,e,t),c(i.wireframeVertexArray)&&(Ce.vertexArray=i.wireframeVertexArray,Ce.primitiveType=Me.LINES,Ce.count=hf*2));let Ja=Ce.boundingVolume,tb=Ce.orientedBoundingBox;n.mode!==oe.SCENE3D?(le.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,Y.minimumHeight,Y.maximumHeight,Ja),d.fromElements(Ja.center.z,Ja.center.x,Ja.center.y,Ja.center),n.mode===oe.MORPHING&&(Ja=le.union(Y.boundingSphere,Ja,Ja))):(Ce.boundingVolume=le.clone(Y.boundingSphere,Ja),Ce.orientedBoundingBox=Dn.clone(Y.boundingVolume,tb)),Ce.dirty=!0,h&&f.updateDerivedCommands(Ce,n),_be(Ce,n),zt=un,Ct=Qut}while(qe<it)}var I2=ur;function Tbe(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=ce.clone(ce.MAX_VALUE)}Object.defineProperties(Tbe.prototype,{enabled:{get:function(){return this._enabled},set:function(e){T.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){T.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),T.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=Bt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){T.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),T.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._backFaceAlphaByDistance=Bt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){c(e)||(e=ce.clone(ce.MAX_VALUE)),ce.clone(e,this._rectangle)}}});var O2=Tbe;function ks(){this._layers=[],this.layerAdded=new pe,this.layerRemoved=new pe,this.layerMoved=new pe,this.layerShownOrHidden=new pe}Object.defineProperties(ks.prototype,{length:{get:function(){return this._layers.length}}});ks.prototype.add=function(e,t){let n=c(t);if(!c(e))throw new E("layer is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._layers.length)throw new E("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t);let i=e.readyEvent.addEventListener(()=>{this.layerShownOrHidden.raiseEvent(e,e._layerIndex,e.show),i()})};ks.prototype.addImageryProvider=function(e,t){if(!c(e))throw new E("imageryProvider is required.");let n=new Xa(e);return this.add(n,t),n};ks.prototype.remove=function(e,t){t=t??!0;let n=this._layers.indexOf(e);return n!==-1?(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0):!1};ks.prototype.removeAll=function(e){e=e??!0;let t=this._layers;for(let n=0,i=t.length;n<i;n++){let o=t[n];this.layerRemoved.raiseEvent(o,n),e&&o.destroy()}this._layers=[]};ks.prototype.contains=function(e){return this.indexOf(e)!==-1};ks.prototype.indexOf=function(e){return this._layers.indexOf(e)};ks.prototype.get=function(e){if(!c(e))throw new E("index is required.","index");return this._layers[e]};function RH(e,t){if(!c(t))throw new E("layer is required.");let n=e.indexOf(t);if(n===-1)throw new E("layer is not in this collection.");return n}function Abe(e,t,n){let i=e._layers;if(t=O.clamp(t,0,i.length-1),n=O.clamp(n,0,i.length-1),t===n)return;let o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}ks.prototype.raise=function(e){let t=RH(this._layers,e);Abe(this,t,t+1)};ks.prototype.lower=function(e){let t=RH(this._layers,e);Abe(this,t,t-1)};ks.prototype.raiseToTop=function(e){let t=RH(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))};ks.prototype.lowerToBottom=function(e){let t=RH(this._layers,e);t!==0&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};var ift=new ce;function Cbe(e,t,n,i){let o=e.globe._surface._tilesToRender,r;for(let a=0;!c(r)&&a<o.length;++a){let l=o[a];ce.contains(l.rectangle,t)&&(r=l)}if(!c(r))return;let s=r.data.imagery;for(let a=s.length-1;a>=0;--a){let l=s[a],u=l.readyImagery;if(!c(u)||!u.imageryLayer.ready)continue;let f=u.imageryLayer.imageryProvider;if(n&&!c(f.pickFeatures)||!ce.contains(u.rectangle,t))continue;let h=ift,p=1/1024;h.west=O.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.x-p),h.east=O.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.z+p),h.south=O.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.y-p),h.north=O.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.w+p),ce.contains(h,t)&&i(u)}}ks.prototype.pickImageryLayers=function(e,t){let n=t.globe.pick(e,t);if(!c(n))return;let i=t.ellipsoid.cartesianToCartographic(n),o=[];if(Cbe(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};ks.prototype.pickImageryLayerFeatures=function(e,t){let n=t.globe.pick(e,t);if(!c(n))return;let i=t.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(Cbe(t,i,!0,function(s){if(!s.imageryLayer.ready)return;let l=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);c(l)&&(o.push(l),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){let a=[];for(let l=0;l<s.length;++l){let u=s[l],f=r[l];if(c(u)&&u.length>0)for(let h=0;h<u.length;++h){let p=u[h];p.imageryLayer=f,c(p.position)||(p.position=i),a.push(p)}}return a})};ks.prototype.queueReprojectionCommands=function(e){let t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};ks.prototype.cancelReprojections=function(){let e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};ks.prototype.isDestroyed=function(){return!1};ks.prototype.destroy=function(){return this.removeAll(!0),de(this)};ks.prototype._update=function(){let e=!0,t=this._layers,n,i,o,r;for(o=0,r=t.length;o<r;++o)i=t[o],i._layerIndex=o,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(c(i._show)&&(c(n)||(n=[]),n.push(i)),i._show=i.show);if(c(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};var R2=ks;function Ebe(e){this._ellipsoid=new H_(e.ellipsoid,d.ZERO)}Object.defineProperties(Ebe.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var M2=Ebe;var nK=class{constructor(t){this.maxSize=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;let n=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,n),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){let i=this.cache.keys().next().value;this.cache.delete(i)}this.cache.set(t,n)}clear(){this.cache.clear()}},oft=1e3;function na(e){if(!c(e))throw new E("options is required.");if(c(e.x))if(c(e.y)){if(e.x<0||e.y<0)throw new E("options.x and options.y must be greater than or equal to zero.")}else throw new E("options.y is required.");else throw new E("options.x is required.");if(!c(e.level))throw new E("options.level is required and must be greater than or equal to zero.");if(!c(e.tilingScheme))throw new E("options.tilingScheme is required.");this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=Yn.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this._positionCache=new nK(oft),this.state=ta.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}na.createLevelZeroTiles=function(e){if(!c(e))throw new E("tilingScheme is required.");let t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n),o=0;for(let r=0;r<n;++r)for(let s=0;s<t;++s)i[o++]=new na({tilingScheme:e,x:s,y:r,level:0});return i};var rft=256;function sft(e,t,n,i){let o=n.width/rft*i,r=Math.floor(e/o)*o,s=Math.floor(t/o)*o;return`${r.toFixed(10)},${s.toFixed(10)}`}na.prototype._getCacheKey=function(e,t){return sft(e.longitude,e.latitude,this._rectangle,t)};na.prototype.getPositionCacheEntry=function(e,t){return this._positionCache.get(this._getCacheKey(e,t))};na.prototype.setPositionCacheEntry=function(e,t,n){this._positionCache.set(this._getCacheKey(e,t),n)};na.prototype.clearPositionCache=function(){this._positionCache.size>0&&this._positionCache.clear()};na.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(c(t)&&c(n)){for(i=i.filter(function(a){return n.indexOf(a)===-1}),this._customData=i,s=this._rectangle,o=0;o<t.length;++o)r=t[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=e}else{let a=this._parent;if(c(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;let l=a.customData;for(o=0;o<l.length;++o)r=l[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(na.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return c(this._southwestChild)||(this._southwestChild=new na({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return c(this._southeastChild)||(this._southeastChild=new na({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return c(this._northwestChild)||(this._northwestChild=new na({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return c(this._northeastChild)||(this._northeastChild=new na({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<ta.DONE}},eligibleForUnloading:{get:function(){let e=!0;return c(this.data)&&(e=this.data.eligibleForUnloading,c(e)||(e=!0)),e}}});na.prototype.findLevelZeroTile=function(e,t,n){let i=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=i:t>=i&&(t-=i),!(n<0||n>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter(function(o){return o.x===t&&o.y===n})[0]};na.prototype.findTileToWest=function(e){let t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;let n=t.findTileToWest(e);if(n!==void 0)return t.southwestChild===this?n.southeastChild:n.northeastChild};na.prototype.findTileToEast=function(e){let t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;let n=t.findTileToEast(e);if(n!==void 0)return t.southeastChild===this?n.southwestChild:n.northwestChild};na.prototype.findTileToSouth=function(e){let t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;let n=t.findTileToSouth(e);if(n!==void 0)return t.southwestChild===this?n.northwestChild:n.northeastChild};na.prototype.findTileToNorth=function(e){let t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;let n=t.findTileToNorth(e);if(n!==void 0)return t.northwestChild===this?n.southwestChild:n.southeastChild};na.prototype.freeResources=function(){this.clearPositionCache(),this.state=ta.START,this.renderable=!1,this.upsampledFromParent=!1,c(this.data)&&c(this.data.freeResources)&&this.data.freeResources(),MH(this._southwestChild),this._southwestChild=void 0,MH(this._southeastChild),this._southeastChild=void 0,MH(this._northwestChild),this._northwestChild=void 0,MH(this._northeastChild),this._northeastChild=void 0};function MH(e){c(e)&&e.freeResources()}var L2=na;function LH(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}LH.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};LH.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&c(this._lastBeforeStartOfFrame)&&this.count>e&&c(t);){n=t!==this._lastBeforeStartOfFrame;let i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),Sbe(this,t)),t=i}};function Sbe(e,t){let n=t.replacementPrevious,i=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=i),t===e.head?e.head=i:n.replacementNext=i,t===e.tail?e.tail=n:i.replacementPrevious=n,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}LH.prototype.markTileRendered=function(e){let t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!c(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(c(e.replacementPrevious)||c(e.replacementNext))&&Sbe(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};var N2=LH;function _d(e){if(!c(e)||!c(e.tileProvider))throw new E("options.tileProvider is required.");if(c(e.tileProvider.quadtree))throw new E("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};let n=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new N2,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=e.maximumScreenSpaceError??2,this.tileCacheSize=e.tileCacheSize??100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new M2({ellipsoid:n}),this._tileLoadProgressEvent=new pe,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(_d.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});_d.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function aft(e){let t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,vbe(e);let n=e._levelZeroTiles;if(c(n))for(let i=0;i<n.length;++i){let r=n[i].customData,s=r.length;for(let a=0;a<s;++a){let l=r[a];l.level=0,e._addHeightCallbacks.push(l)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}_d.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;c(t);)t.state!==ta.START&&e(t),t=t.replacementNext};_d.prototype.forEachRenderedTile=function(e){let t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};_d.prototype.updateHeight=function(e,t){let n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t};return i.removeFunc=function(){let o=n._addHeightCallbacks,r=o.length;for(let s=0;s<r;++s)if(o[s]===i){o.splice(s,1);break}n._removeHeightCallbacks.push(i),i.callback&&(i.callback=void 0)},n._addHeightCallbacks.push(i),i.removeFunc};_d.prototype.update=function(e){c(this._tileProvider.update)&&this._tileProvider.update(e)};function vbe(e){let t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}_d.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(aft(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),vbe(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};_d.prototype.render=function(e){let t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),fft(this,e),Tft(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function cft(e,t){let n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){let o=pe.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push(()=>(o(),!0)),e._lastTileLoadQueueLength=n}let i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce(function(o,r){return Math.max(o,r.level)},-1),i.tilesRendered=e._tilesToRender.length,(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren||i.maxDepthVisited!==i.lastMaxDepthVisited)&&(console.log(`Visited ${i.tilesVisited}, Rendered: ${i.tilesRendered}, Culled: ${i.tilesCulled}, Max Depth Rendered: ${i.maxDepth}, Max Depth Visited: ${i.maxDepthVisited}, Waiting for children: ${i.tilesWaitingForChildren}`),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren,i.lastMaxDepthVisited=i.maxDepthVisited))}_d.prototype.endFrame=function(e){!e.passes.render||e.mode===oe.MORPHING||(gft(this,e),xft(this,e),cft(this,e))};_d.prototype.isDestroyed=function(){return!1};_d.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var B2,wbe=new he;function lft(e,t){let n=ce.center(e.rectangle,wbe),i=n.longitude-B2.longitude,o=n.latitude-B2.latitude;n=ce.center(t.rectangle,wbe);let r=n.longitude-B2.longitude,s=n.latitude-B2.latitude;return i*i+o*o-(r*r+s*s)}var uft=new d,F2=[];function fft(e,t){let n=e._debug;if(n.suspendLodUpdate)return;let i=e._tilesToRender;i.length=0;let o,r=e._tileProvider;if(!c(e._levelZeroTiles)){let y=r.tilingScheme;if(c(y)){let b=r.tilingScheme;e._levelZeroTiles=L2.createLevelZeroTiles(b);let x=e._levelZeroTiles.length;if(F2.length<x)for(F2=new Array(x),o=0;o<x;++o)F2[o]===void 0&&(F2[o]=new k2)}else return}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s,a=e._levelZeroTiles,l=a.length>1?e._occluders:void 0;B2=t.camera.positionCartographic,a.sort(lft);let u=e._addHeightCallbacks,f=e._removeHeightCallbacks,h=t.frameNumber,p;if(u.length>0||f.length>0){for(o=0,p=a.length;o<p;++o)s=a[o],s._updateCustomData(h,u,f);u.length=0,f.length=0}let g=t.camera;e._cameraPositionCartographic=g.positionCartographic;let m=B.getTranslation(g.transform,uft);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),o=0,p=a.length;o<p;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?Ka(e,s,r,t,l,!1,F2[o]):(_g(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=h}function _g(e,t,n,i){n.needsLoading&&(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function k2(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function Dbe(){this.southwest=new k2,this.southeast=new k2,this.northwest=new k2,this.northeast=new k2}Dbe.prototype.combine=function(e){let t=this.southwest,n=this.southeast,i=this.northwest,o=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&o.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||o.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+o.notYetRenderableCount};var oK=new Array(31);for(let e=0;e<oK.length;++e)oK[e]=new Dbe;function dft(e,t,n,i,o){let r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);let s=pft(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,l=n.southeastChild,u=n.northwestChild,f=n.northeastChild,h=e._lastSelectionFrameNumber,p=n._lastSelectionResultFrame===h?n._lastSelectionResult:Yn.NONE,g=e.tileProvider;if(s||i){let m=Yn.originalResult(p)===Yn.RENDERED,y=Yn.originalResult(p)===Yn.CULLED||p===Yn.NONE,b=n.state===ta.DONE,x=m||y||b;if(x||c(g.canRenderWithoutLosingDetail)&&(x=g.canRenderWithoutLosingDetail(n)),x){s&&_g(e,e._tileLoadQueueMedium,n,t),NH(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===Yn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Yn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&_g(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent&&f.upsampledFromParent){NH(e,n),_g(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(f),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===Yn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Yn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Yn.REFINED;let y=e._tilesToRender.length,b=e._tileLoadQueueLow.length,x=e._tileLoadQueueMedium.length,A=e._tileLoadQueueHigh.length,C=e._tileToUpdateHeights.length;if(hft(e,a,l,u,f,t,i,o),y!==e._tilesToRender.length){let S=o.allAreRenderable,v=o.anyWereRenderedLastFrame,P=o.notYetRenderableCount,M=!1;if(!S&&!v){let R=e._tilesToRender;for(let F=y;F<R.length;++F){let _=R[F];for(;_!==void 0&&_._lastSelectionResult!==Yn.KICKED&&_!==n;)_._lastSelectionResult=Yn.kick(_._lastSelectionResult),_=_.parent}e._tilesToRender.length=y,e._tileToUpdateHeights.length=C,NH(e,n),n._lastSelectionResult=Yn.RENDERED;let L=p===Yn.RENDERED;!L&&P>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=b,e._tileLoadQueueMedium.length=x,e._tileLoadQueueHigh.length=A,_g(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,M=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=L,L||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!M&&_g(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Yn.RENDERED,NH(e,n),_g(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===Yn.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function hft(e,t,n,i,o,r,s,a){let l=r.camera.positionCartographic,u=e._tileProvider,f=e._occluders,h=oK[t.level],p=h.southwest,g=h.southeast,m=h.northwest,y=h.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(Ka(e,t,u,r,f,s,p),Ka(e,n,u,r,f,s,g),Ka(e,i,u,r,f,s,m),Ka(e,o,u,r,f,s,y)):(Ka(e,i,u,r,f,s,m),Ka(e,t,u,r,f,s,p),Ka(e,o,u,r,f,s,y),Ka(e,n,u,r,f,s,g)):l.latitude<t.rectangle.north?(Ka(e,n,u,r,f,s,g),Ka(e,t,u,r,f,s,p),Ka(e,o,u,r,f,s,y),Ka(e,i,u,r,f,s,m)):(Ka(e,o,u,r,f,s,y),Ka(e,i,u,r,f,s,m),Ka(e,n,u,r,f,s,g),Ka(e,t,u,r,f,s,p)),h.combine(a)}function mft(e,t){let n=t.rectangle;return c(e._cameraPositionCartographic)&&ce.contains(n,e._cameraPositionCartographic)||c(e._cameraReferenceFrameOriginCartographic)&&ce.contains(n,e._cameraReferenceFrameOriginCartographic)}function Ka(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==xr.NONE)return dft(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,mft(e,t)){(!c(t.data)||!c(t.data.vertexArray))&&_g(e,e._tileLoadQueueMedium,t,i);let a=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===a?t._lastSelectionResult:Yn.NONE;l!==Yn.CULLED_BUT_NEEDED&&l!==Yn.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=Yn.CULLED_BUT_NEEDED}else e.preloadSiblings||t.level===0?(_g(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=Yn.CULLED):t._lastSelectionResult=Yn.CULLED;t._lastSelectionResultFrame=i.frameNumber}function pft(e,t,n){if(t.mode===oe.SCENE2D||t.camera.frustum instanceof on||t.camera.frustum instanceof jo)return _ft(e,t,n);let i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator,a=i*r/(o*s);return t.fog.enabled&&(a-=O.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function _ft(e,t,n){let o=t.camera.frustum,r=o.offCenterFrustum;c(r)&&(o=r);let s=t.context,a=s.drawingBufferWidth,l=s.drawingBufferHeight,u=e._tileProvider.getLevelMaximumGeometricError(n.level),f=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(a,l),h=u/f;return t.fog.enabled&&t.mode!==oe.SCENE2D&&(h-=O.fog(n._distance,t.fog.density)*t.fog.sse),h/=t.pixelRatio,h}function NH(e,t){e._tilesToRender.push(t)}function gft(e,t){let n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,o=e._tileLoadQueueLow;if(n.length===0&&i.length===0&&o.length===0)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);let r=Ti()+e._loadQueueTimeSlice,s=e._tileProvider,a=iK(e,t,s,r,n,!1);a=iK(e,t,s,r,i,a),iK(e,t,s,r,o,a)}function yft(e,t){return e._loadPriority-t._loadPriority}function iK(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(yft);for(let s=0,a=o.length;s<a&&(Ti()<i||!r);++s){let l=o[s];e._tileReplacementQueue.markTileRendered(l),n.loadTile(t,l),r=!0}return r}var xw=new mn,FH=new he,P0=new d,bft=[];function xft(e,t){if(!c(e.tileProvider.tilingScheme))return;let n=bft;n.length=0;let i=e._tileToUpdateHeights,o=Ti(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,l=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid,f;for(;i.length>0;){let h=i[0];if(!c(h.data)||!c(h.data.mesh)){let y=h._lastSelectionResultFrame===e._lastSelectionFrameNumber?h._lastSelectionResult:Yn.NONE;(y===Yn.RENDERED||y===Yn.CULLED_BUT_NEEDED)&&n.push(h),h.clearPositionCache(),i.shift(),e._lastTileIndex=0;continue}let p=h.customData,g=p.length,m=!1;for(f=e._lastTileIndex;f<g;++f){let y=p[f],b=h.data.terrainData,x=c(b)&&b.wasCreatedByUpsampling();if(h.level>y.level&&!x){let A,C=h.getPositionCacheEntry(y.positionCartographic,e.maximumScreenSpaceError);if(c(C))A=C;else{if(c(y.positionOnEllipsoidSurface)||(y.positionOnEllipsoidSurface=d.fromRadians(y.positionCartographic.longitude,y.positionCartographic.latitude,0,u)),a===oe.SCENE3D){let S=u.geodeticSurfaceNormal(y.positionOnEllipsoidSurface,xw.direction),v=u.getSurfaceNormalIntersectionWithZAxis(y.positionOnEllipsoidSurface,11500,xw.origin);if(!c(v)){let P=0;c(h.data.tileBoundingRegion)&&(P=h.data.tileBoundingRegion.minimumHeight);let M=Math.min(P,-11500),R=d.multiplyByScalar(S,Math.abs(M)+1,P0);d.subtract(y.positionOnEllipsoidSurface,R,xw.origin)}}else he.clone(y.positionCartographic,FH),FH.height=-11500,l.project(FH,P0),d.fromElements(P0.z,P0.x,P0.y,P0),d.clone(P0,xw.origin),d.clone(d.UNIT_X,xw.direction);A=h.data.pick(xw,a,l,!1,P0),c(A)&&h.setPositionCacheEntry(y.positionCartographic,e.maximumScreenSpaceError,A)}if(c(A)){if(c(y.callback)){let S=u.cartesianToCartographic(A,FH);y.callback(S)}y.level=h.level}}if(Ti()>=s){m=!0;break}}if(m){e._lastTileIndex=f;break}else e._lastTileIndex=0,i.shift()}for(f=0;f<n.length;f++)i.push(n[f])}function Tft(e,t){let n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){let s=i[o];n.showTileThisFrame(s,t)}}var U2=_d;function Hh(e){e=e??ie.default;let t=new np({ellipsoid:e}),n=new R2;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new _2,this._material=void 0,this._surface=new U2({tileProvider:new I2({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new pe,this._undergroundColor=G.clone(G.BLACK),this._undergroundColorAlphaByDistance=new Bt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new O2,sK(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new we({url:tn("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=ie.WGS84.equals(e),this.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=O.PI_OVER_TWO*e.minimumRadius,this.lightingFadeInDistance=O.PI*e.minimumRadius,this.nightFadeOutDistance=O.PI_OVER_TWO*e.minimumRadius,this.nightFadeInDistance=5*O.PI_OVER_TWO*e.minimumRadius,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=xn.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}Object.defineProperties(Hh.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return c(this._surface)?this._surface._tileLoadQueueHigh.length===0&&this._surface._tileLoadQueueMedium.length===0&&this._surface._tileLoadQueueLow.length===0:!0}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},clippingPolygons:{get:function(){return this._surface.tileProvider.clippingPolygons},set:function(e){this._surface.tileProvider.clippingPolygons=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){c(e)||(e=ce.clone(ce.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),c(this._material)&&sK(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,sK(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=G.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=Bt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function sK(e){let t=[],n=c(e._material)&&(c(e._material.shaderSource.match(/slope/))||c(e._material.shaderSource.match("normalEC"))),i=[nh,nw];c(e._material)&&(!n||e._terrainProvider.requestVertexNormals)?(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms):e._surface._tileProvider.materialUniformMap=void 0,i.push(i2),e._surfaceShaderSet.baseVertexShaderSource=new He({sources:[nh,nw,o2],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new He({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function Aft(e){return function(t,n){let i=le.distanceSquaredTo(t.pickBoundingSphere,e),o=le.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}var Cft=[],Eft={start:0,stop:0};Hh.prototype.pickWorldCoordinates=function(e,t,n,i){if(!c(e))throw new E("ray is required");if(!c(t))throw new E("scene is required");n=n??!0;let o=t.mode,r=t.mapProjection,s=Cft;s.length=0;let a=this._surface._tilesToRender,l=a.length,u,f;for(f=0;f<l;++f){u=a[f];let p=u.data;if(!c(p))continue;let g=p.pickBoundingSphere;if(o!==oe.SCENE3D)p.pickBoundingSphere=g=le.fromRectangleWithHeights2D(u.rectangle,r,p.tileBoundingRegion.minimumHeight,p.tileBoundingRegion.maximumHeight,g),d.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(c(p.renderedMesh))le.clone(p.tileBoundingRegion.boundingSphere,g);else continue;let m=Zn.raySphere(e,g,Eft);c(m)&&s.push(p)}s.sort(Aft(e.origin));let h;for(l=s.length,f=0;f<l&&(h=s[f].pick(e,t.mode,t.mapProjection,n,i),!c(h));++f);return h};var Sft=new he;Hh.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),c(n)&&t.mode!==oe.SCENE3D){n=d.fromElements(n.y,n.z,n.x,n);let i=t.mapProjection.unproject(n,Sft);n=this._ellipsoid.cartographicToCartesian(i,n)}return n};var wft=new d,Pbe=new d,vft=new he,Dft=new mn;function rK(e,t){return c(e)&&ce.contains(e.rectangle,t)?e:void 0}Hh.prototype.getHeight=function(e){if(!c(e))throw new E("cartographic is required");let t=this._surface._levelZeroTiles;if(!c(t))return;let n,i,o=t.length;for(i=0;i<o&&(n=t[i],!ce.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;c(n);)n=rK(n._southwestChild,e)||rK(n._southeastChild,e)||rK(n._northwestChild,e)||n._northeastChild,c(n)&&c(n.data)&&c(n.data.renderedMesh)&&(r=n);if(n=r,!c(n)||!c(n.data)||!c(n.data.renderedMesh))return;let s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,l=d.fromRadians(e.longitude,e.latitude,0,a,wft),u=Dft,f=a.geodeticSurfaceNormal(l,u.direction),h=a.getSurfaceNormalIntersectionWithZAxis(l,11500,u.origin);if(!c(h)){let g;c(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);let m=Math.min(g??0,-11500),y=d.multiplyByScalar(f,Math.abs(m)+1,Pbe);d.subtract(l,y,u.origin)}let p=n.data.pick(u,void 0,s,!1,Pbe);if(c(p))return a.cartesianToCartographic(p,vft).height};Hh.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)};Hh.prototype.beginFrame=function(e){let t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=c(i)&&i.hasWaterMask&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;let a=this._oceanNormalMapResource,l=a.url;if(c(l)){let u=this;a.fetchImage().then(function(f){l===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new Rt({context:e.context,source:f}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}let r=e.passes,s=e.mode;r.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,n.terrainProvider=this.terrainProvider,n.lightingFadeOutDistance=this.lightingFadeOutDistance,n.lightingFadeInDistance=this.lightingFadeInDistance,n.nightFadeOutDistance=this.nightFadeOutDistance,n.nightFadeInDistance=this.nightFadeInDistance,n.zoomedOutOceanSpecularIntensity=s===oe.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,n.showWaterEffect=this.showWaterEffect,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.atmosphereLightIntensity=this.atmosphereLightIntensity,n.atmosphereRayleighCoefficient=this.atmosphereRayleighCoefficient,n.atmosphereMieCoefficient=this.atmosphereMieCoefficient,n.atmosphereRayleighScaleHeight=this.atmosphereRayleighScaleHeight,n.atmosphereMieScaleHeight=this.atmosphereMieScaleHeight,n.atmosphereMieAnisotropy=this.atmosphereMieAnisotropy,n.shadows=this.shadows,n.hueShift=this.atmosphereHueShift,n.saturationShift=this.atmosphereSaturationShift,n.brightnessShift=this.atmosphereBrightnessShift,n.fillHighlightColor=this.fillHighlightColor,n.showSkirts=this.showSkirts,n.backFaceCulling=this.backFaceCulling,n.vertexShadowDarkness=this.vertexShadowDarkness,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))};Hh.prototype.render=function(e){this.show&&(c(this._material)&&this._material.update(e.context),this._surface.render(e))};Hh.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)};Hh.prototype.isDestroyed=function(){return!1};Hh.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),de(this)};var V2=Hh;function Pft(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}var z2=Pft;var Gbe={},Ift=32.184,Oft=2451545,Ibe=-.0529921,Obe=-.1059842,Rbe=13.0120009,Mbe=13.3407154,Lbe=.9856003,Nbe=26.4057084,Fbe=13.064993,Bbe=.3287146,kbe=1.7484877,Ube=-.1589763,Vbe=.0036096,zbe=.1643573,Hbe=12.9590088,aK=new Q;Gbe.ComputeMoon=function(e,t){c(e)||(e=Q.now()),aK=Q.addSeconds(e,Ift,aK);let n=Q.totalDays(aK)-Oft,i=n/qn.DAYS_PER_JULIAN_CENTURY,o=(125.045+Ibe*n)*O.RADIANS_PER_DEGREE,r=(250.089+Obe*n)*O.RADIANS_PER_DEGREE,s=(260.008+Rbe*n)*O.RADIANS_PER_DEGREE,a=(176.625+Mbe*n)*O.RADIANS_PER_DEGREE,l=(357.529+Lbe*n)*O.RADIANS_PER_DEGREE,u=(311.589+Nbe*n)*O.RADIANS_PER_DEGREE,f=(134.963+Fbe*n)*O.RADIANS_PER_DEGREE,h=(276.617+Bbe*n)*O.RADIANS_PER_DEGREE,p=(34.226+kbe*n)*O.RADIANS_PER_DEGREE,g=(15.134+Ube*n)*O.RADIANS_PER_DEGREE,m=(119.743+Vbe*n)*O.RADIANS_PER_DEGREE,y=(239.961+zbe*n)*O.RADIANS_PER_DEGREE,b=(25.053+Hbe*n)*O.RADIANS_PER_DEGREE,x=Math.sin(o),A=Math.sin(r),C=Math.sin(s),S=Math.sin(a),v=Math.sin(l),P=Math.sin(u),M=Math.sin(f),R=Math.sin(h),L=Math.sin(p),F=Math.sin(g),_=Math.sin(m),w=Math.sin(y),D=Math.sin(b),I=Math.cos(o),N=Math.cos(r),k=Math.cos(s),z=Math.cos(a),V=Math.cos(l),j=Math.cos(u),U=Math.cos(f),q=Math.cos(h),Y=Math.cos(p),te=Math.cos(g),K=Math.cos(m),Z=Math.cos(y),ee=Math.cos(b),me=(269.9949+.0031*i-3.8787*x-.1204*A+.07*C-.0172*S+.0072*P-.0052*F+.0043*D)*O.RADIANS_PER_DEGREE,Te=(66.5392+.013*i+1.5419*I+.0239*N-.0278*k+.0068*z-.0029*j+9e-4*U+8e-4*te-9e-4*ee)*O.RADIANS_PER_DEGREE,ue=(38.3213+13.17635815*n-14e-13*n*n+3.561*x+.1208*A-.0642*C+.0158*S+.0252*v-.0066*P-.0047*M-.0046*R+.0028*L+.0052*F+.004*_+.0019*w-.0044*D)*O.RADIANS_PER_DEGREE,ye=(13.17635815-14e-13*(2*n)+3.561*I*Ibe+.1208*N*Obe-.0642*k*Rbe+.0158*z*Mbe+.0252*V*Lbe-.0066*j*Nbe-.0047*U*Fbe-.0046*q*Bbe+.0028*Y*kbe+.0052*te*Ube+.004*K*Vbe+.0019*Z*zbe-.0044*ee*Hbe)/86400*O.RADIANS_PER_DEGREE;return c(t)||(t=new z2),t.rightAscension=me,t.declination=Te,t.rotation=ue,t.rotationRate=ye,t};var H2=Gbe;function jbe(e){(!c(e)||typeof e!="function")&&(e=H2.ComputeMoon),this._computeFunction=e}var Rft=new d,Mft=new d,Lft=new d;function Nft(e,t,n){let i=Rft;i.x=Math.cos(e+O.PI_OVER_TWO),i.y=Math.sin(e+O.PI_OVER_TWO),i.z=0;let o=Math.cos(t),r=Lft;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);let s=d.cross(r,i,Mft);return c(n)||(n=new J),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}var Fft=new J,Bft=new Le;jbe.prototype.evaluate=function(e,t){c(e)||(e=Q.now());let n=this._computeFunction(e),i=Nft(n.rightAscension,n.declination,t),o=O.zeroToTwoPi(n.rotation),r=Le.fromAxisAngle(d.UNIT_Z,o,Bft),s=J.fromQuaternion(Le.conjugate(r,r),Fft);return J.multiply(s,i,i)};var G2=jbe;var cK={position:0};function BH(e){e=e??W.EMPTY_OBJECT,this.center=d.clone(e.center??d.ZERO),this._center=new d,this.radii=d.clone(e.radii),this._radii=new d,this._oneOverEllipsoidRadiiSquared=new d,this._boundingSphere=new le,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=new B,this._computedModelMatrix=new B,this.show=e.show??!0,this.material=e.material??Xi.fromType(Xi.ColorType),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=e.debugShowBoundingVolume??!1,this.onlySunLighting=e.onlySunLighting??!1,this._onlySunLighting=!1,this._depthTestEnabled=e.depthTestEnabled??!0,this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new Qe({owner:e._owner??this}),this._pickCommand=new Qe({owner:e._owner??this,pickOnly:!0});let t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function kft(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(c(t))return t;let n=La.createGeometry(La.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ie.POSITION_ONLY}));return t=ti.fromGeometry({context:e,geometry:n,attributeLocations:cK,bufferUsage:Be.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}BH.prototype.update=function(e){if(!this.show||e.mode!==oe.SCENE3D||!c(this.center)||!c(this.radii))return;if(!c(this.material))throw new E("this.material must be defined.");let t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!c(this._rs)||i)&&(this._translucent=n,this._rs=Ve.fromCache({cull:{enabled:!0,face:xi.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?ln.ALPHA_BLEND:void 0})),c(this._va)||(this._va=kft(t));let o=!1,r=this.radii;if(!d.equals(this._radii,r)){d.clone(r,this._radii);let y=this._oneOverEllipsoidRadiiSquared;y.x=1/(r.x*r.x),y.y=1/(r.y*r.y),y.z=1/(r.z*r.z),o=!0}(!B.equals(this.modelMatrix,this._modelMatrix)||!d.equals(this.center,this._center))&&(B.clone(this.modelMatrix,this._modelMatrix),d.clone(this.center,this._center),B.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(d.clone(d.ZERO,this._boundingSphere.center),this._boundingSphere.radius=d.maximumComponent(r),le.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));let s=this._material!==this.material;this._material=this.material,this._material.update(t);let a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;let l=e.useLogDepth,u=this._useLogDepth!==l;this._useLogDepth=l;let f=this._colorCommand,h,p;(s||a||i||u)&&(h=new He({sources:[tw]}),p=new He({sources:[this.material.shaderSource,ew]}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:h,fragmentShaderSource:p,attributeLocations:cK}),f.vertexArray=this._va,f.renderState=this._rs,f.shaderProgram=this._sp,f.uniformMap=xt(this._uniforms,this.material._uniforms),f.executeInClosestFrustum=n);let g=e.commandList,m=e.passes;if(m.render&&(f.boundingVolume=this._boundingSphere,f.debugShowBoundingVolume=this.debugShowBoundingVolume,f.modelMatrix=this._computedModelMatrix,f.pass=n?De.TRANSLUCENT:De.OPAQUE,g.push(f)),m.pick){let y=this._pickCommand;(!c(this._pickId)||this._id!==this.id)&&(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||a||!c(this._pickSP)||u)&&(h=new He({sources:[tw]}),p=new He({sources:[this.material.shaderSource,ew],pickColorQualifier:"uniform"}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH")),this._pickSP=Jt.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:h,fragmentShaderSource:p,attributeLocations:cK}),y.vertexArray=this._va,y.renderState=this._rs,y.shaderProgram=this._pickSP,y.uniformMap=xt(xt(this._uniforms,this._pickUniforms),this.material._uniforms),y.executeInClosestFrustum=n),y.boundingVolume=this._boundingSphere,y.modelMatrix=this._computedModelMatrix,y.pass=n?De.TRANSLUCENT:De.OPAQUE,g.push(y)}};BH.prototype.isDestroyed=function(){return!1};BH.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),de(this)};var j2=BH;function W2(e){e=e??W.EMPTY_OBJECT;let t=e.textureUrl;c(t)||(t=tn("Assets/Textures/moonSmall.jpg")),this.show=e.show??!0,this.textureUrl=t,this._ellipsoid=e.ellipsoid??ie.MOON,this.onlySunLighting=e.onlySunLighting??!0,this._ellipsoidPrimitive=new j2({radii:this.ellipsoid.radii,material:Xi.fromType(Xi.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new G2}Object.defineProperties(W2.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var kH=new J,Uft=new J,Vft=new d,UH=[];W2.prototype.update=function(e){if(!this.show)return;let t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;let n=e.time;c(Ot.computeIcrfToFixedMatrix(n,kH))||Ot.computeTemeToPseudoFixedMatrix(n,kH);let i=this._axes.evaluate(n,Uft);J.transpose(i,i),J.multiply(kH,i,i);let o=Xg.computeMoonPositionInEarthInertialFrame(n,Vft);J.multiplyByVector(kH,o,o),B.fromRotationTranslation(i,o,t.modelMatrix);let r=e.commandList;return e.commandList=UH,UH.length=0,t.update(e),e.commandList=r,UH.length===1?UH[0]:void 0};W2.prototype.isDestroyed=function(){return!1};W2.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),de(this)};var q2=W2;var lK=[],uK=[];function zft(e,t,n,i,o,r){let s=o-i+1,a=r-o,l=lK,u=uK,f,h;for(f=0;f<s;++f)l[f]=e[i+f];for(h=0;h<a;++h)u[h]=e[o+h+1];f=0,h=0;for(let p=i;p<=r;++p){let g=l[f],m=u[h];f<s&&(h>=a||t(g,m,n)<=0)?(e[p]=g,++f):h<a&&(e[p]=m,++h)}}function fK(e,t,n,i,o){if(i>=o)return;let r=Math.floor((i+o)*.5);fK(e,t,n,i,r),fK(e,t,n,r+1,o),zft(e,t,n,i,r,o)}function Hft(e,t,n){if(!c(e))throw new E("array is required.");if(!c(t))throw new E("comparator is required.");let i=e.length,o=Math.ceil(i*.5);lK.length=o,uK.length=o,fK(e,t,n,0,i-1),lK.length=0,uK.length=0}var gg=Hft;function Rc(e,t){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");this._occluderPosition=d.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}var VH=new d;Object.defineProperties(Rc.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!c(e))throw new E("cameraPosition is required.");e=d.clone(e,this._cameraPosition);let t=d.subtract(this._occluderPosition,e,VH),n=d.magnitudeSquared(t),i=this._occluderRadius*this._occluderRadius,o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=d.multiplyByScalar(t,n,VH);let a=o*o*n;s=d.add(e,d.multiplyByScalar(r,a,VH),VH)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});Rc.fromBoundingSphere=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");return c(n)?(d.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new Rc(e,t)};var qbe=new d;Rc.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=d.subtract(e,this._occluderPosition,qbe),n=this._occluderRadius;if(n=d.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=d.subtract(e,this._cameraPosition,t),n*n>d.magnitudeSquared(t)}return!1};var Gft=new d;Rc.prototype.isBoundingSphereVisible=function(e){let t=d.clone(e.center,Gft),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,qbe),o=this._occluderRadius-n;if(o=d.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i),o*o+n*n>d.magnitudeSquared(i)):!1;if(o>0){i=d.subtract(t,this._cameraPosition,i);let r=d.magnitudeSquared(i),s=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+s)*a>r*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+a>r)}return!0}return!1};var jft=new d;Rc.prototype.computeVisibility=function(e){if(!c(e))throw new E("occludeeBS is required.");let t=d.clone(e.center),n=e.radius;if(n>this._occluderRadius)return xr.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,jft),o=this._occluderRadius-n,r=d.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i);let s=d.magnitudeSquared(i);return o*o+n*n<s?xr.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?xr.FULL:xr.PARTIAL):(i=d.subtract(t,this._horizonPlanePosition,i),d.dot(i,this._horizonPlaneNormal)>-n?xr.PARTIAL:xr.FULL))}}return xr.NONE};var zH=new d;Rc.computeOccludeePoint=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(n))throw new E("positions is required.");if(n.length===0)throw new E("positions must contain at least one element");let i=d.clone(t),o=d.clone(e.center),r=e.radius,s=n.length;if(d.equals(o,t))throw new E("occludeePosition must be different than occluderBoundingSphere.center");let a=d.normalize(d.subtract(i,o,zH),zH),l=-d.dot(a,o),u=Rc._anyRotationVector(o,a,l),f=Rc._horizonToPlaneNormalDotProduct(e,a,l,u,n[0]);if(!f)return;let h;for(let g=1;g<s;++g){if(h=Rc._horizonToPlaneNormalDotProduct(e,a,l,u,n[g]),!h)return;h<f&&(f=h)}if(f<.0017453283658983088)return;let p=r/f;return d.add(o,d.multiplyByScalar(a,p,zH),zH)};var Wft=[];Rc.computeOccludeePointFromRectangle=function(e,t){if(!c(e))throw new E("rectangle is required.");t=t??ie.default;let n=ce.subsample(e,t,0,Wft),i=le.fromPoints(n),o=d.ZERO;if(!d.equals(o,i.center))return Rc.computeOccludeePoint(new le(o,t.minimumRadius),i.center,n)};var qft=new d;Rc._anyRotationVector=function(e,t,n){let i=d.abs(t,qft),o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);let r=new d,s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=d.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=d.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=d.UNIT_Z);let a=(d.dot(t,i)+n)/-d.dot(t,s);return d.normalize(d.subtract(d.add(i,d.multiplyByScalar(s,a,r),i),e,i),i)};var Yft=new d;Rc._rotationVector=function(e,t,n,i,o){let r=d.subtract(i,e,Yft);if(r=d.normalize(r,r),d.dot(t,r)<.9999999847691291){let s=d.cross(t,r,r);if(d.magnitude(s)>O.EPSILON13)return d.normalize(s,new d)}return o};var dK=new d,Xft=new d,HH=new d,Wbe=new d;Rc._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){let r=d.clone(o,dK),s=d.clone(e.center,Xft),a=e.radius,l=d.subtract(s,r,HH),u=d.magnitudeSquared(l),f=a*a;if(u<f)return!1;let h=u-f,p=Math.sqrt(h),m=1/Math.sqrt(u),b=p*m*p;l=d.normalize(l,l);let x=d.add(r,d.multiplyByScalar(l,b,Wbe),Wbe),A=Math.sqrt(h-b*b),C=this._rotationVector(s,t,n,r,i),S=d.fromElements(C.x*C.x*l.x+(C.x*C.y-C.z)*l.y+(C.x*C.z+C.y)*l.z,(C.x*C.y+C.z)*l.x+C.y*C.y*l.y+(C.y*C.z-C.x)*l.z,(C.x*C.z-C.y)*l.x+(C.y*C.z+C.x)*l.y+C.z*C.z*l.z,dK);S=d.normalize(S,S);let v=d.multiplyByScalar(S,A,dK);C=d.normalize(d.subtract(d.add(x,v,HH),s,HH),HH);let P=d.dot(t,C);C=d.normalize(d.subtract(d.subtract(x,v,C),s,C),C);let M=d.dot(t,C);return P<M?P:M};var Y2=Rc;function rp(e){e=e??W.EMPTY_OBJECT,this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=e.near??1,this._near=this.near,this.far=e.far??5e8,this._far=this.far,this._cullingVolume=new _s,this._perspectiveMatrix=new B,this._infinitePerspective=new B}function hK(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new E("right, left, top, bottom, near, or far parameters are not set.");let{top:t,bottom:n,right:i,left:o,near:r,far:s}=e;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=B.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=B.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Object.defineProperties(rp.prototype,{projectionMatrix:{get:function(){return hK(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return hK(this),this._infinitePerspective}}});var Kft=new d,$ft=new d,Zft=new d,Qft=new d;rp.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");let i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,f=d.cross(t,n,Kft),h=$ft;d.multiplyByScalar(t,l,h),d.add(e,h,h);let p=Zft;d.multiplyByScalar(t,u,p),d.add(e,p,p);let g=Qft;d.multiplyByScalar(f,a,g),d.add(h,g,g),d.subtract(g,e,g),d.normalize(g,g),d.cross(g,n,g),d.normalize(g,g);let m=i[0];return c(m)||(m=i[0]=new se),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(f,s,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(n,g,g),d.normalize(g,g),m=i[1],c(m)||(m=i[1]=new se),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,r,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(f,g,g),d.normalize(g,g),m=i[2],c(m)||(m=i[2]=new se),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,o,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(g,f,g),d.normalize(g,g),m=i[3],c(m)||(m=i[3]=new se),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),m=i[4],c(m)||(m=i[4]=new se),m.x=t.x,m.y=t.y,m.z=t.z,m.w=-d.dot(t,h),d.negate(t,g),m=i[5],c(m)||(m=i[5]=new se),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,p),this._cullingVolume};rp.prototype.getPixelDimensions=function(e,t,n,i,o){if(hK(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");let r=1/this.near,s=this.top*r,a=2*i*n*s/t;s=this.right*r;let l=2*i*n*s/e;return o.x=l,o.y=a,o};rp.prototype.clone=function(e){return c(e)||(e=new rp),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};rp.prototype.equals=function(e){return c(e)&&e instanceof rp&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};rp.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof rp&&O.equalsEpsilon(this.right,e.right,t,n)&&O.equalsEpsilon(this.left,e.left,t,n)&&O.equalsEpsilon(this.top,e.top,t,n)&&O.equalsEpsilon(this.bottom,e.bottom,t,n)&&O.equalsEpsilon(this.near,e.near,t,n)&&O.equalsEpsilon(this.far,e.far,t,n)};var bl=rp;function ou(e){e=e??W.EMPTY_OBJECT,this._offCenterFrustum=new bl,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=e.near??1,this._near=this.near,this.far=e.far??5e8,this._far=this.far,this.xOffset=e.xOffset??0,this._xOffset=this.xOffset,this.yOffset=e.yOffset??0,this._yOffset=this.yOffset}ou.packedLength=6;ou.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=n??0,t[n++]=e.fov,t[n++]=e.aspectRatio,t[n++]=e.near,t[n++]=e.far,t[n++]=e.xOffset,t[n]=e.yOffset,t};ou.unpack=function(e,t,n){return T.defined("array",e),t=t??0,c(n)||(n=new ou),n.fov=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t++],n.xOffset=e[t++],n.yOffset=e[t],n};function Gh(e){if(!c(e.fov)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("fov, aspectRatio, near, or far parameters are not set.");if(!(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset))return;if(T.typeOf.number.greaterThanOrEquals("fov",e.fov,0),T.typeOf.number.lessThan("fov",e.fov,Math.PI),T.typeOf.number.greaterThanOrEquals("aspectRatio",e.aspectRatio,0),T.typeOf.number.greaterThanOrEquals("near",e.near,0),e.near>e.far)throw new E("near must be less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset;let n=e._offCenterFrustum;n.top=e.near*Math.tan(.5*e._fovy),n.bottom=-n.top,n.right=e.aspectRatio*n.top,n.left=-n.right,n.near=e.near,n.far=e.far,n.right+=e.xOffset,n.left+=e.xOffset,n.top+=e.yOffset,n.bottom+=e.yOffset}Object.defineProperties(ou.prototype,{projectionMatrix:{get:function(){return Gh(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return Gh(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return Gh(this),this._fovy}},sseDenominator:{get:function(){return Gh(this),this._sseDenominator}},offCenterFrustum:{get:function(){return Gh(this),this._offCenterFrustum}}});ou.prototype.computeCullingVolume=function(e,t,n){return Gh(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};ou.prototype.getPixelDimensions=function(e,t,n,i,o){return Gh(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};ou.prototype.clone=function(e){return c(e)||(e=new ou),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};ou.prototype.equals=function(e){return!c(e)||!(e instanceof ou)?!1:(Gh(this),Gh(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};ou.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof ou)?!1:(Gh(this),Gh(e),O.equalsEpsilon(this.fov,e.fov,t,n)&&O.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};var Ci=ou;function X2(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(X2.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function Jft(e,t,n){let i=t.createViewportQuadCommand(YF,{framebuffer:n,renderState:Ve.fromCache({viewport:new Ke(0,0,256,256)})});e._drawCommand=i}X2.prototype.update=function(e){if(!c(this._colorTexture)){let t=e.context,n=new Rt({context:t,width:256,height:256,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,sampler:Qt.NEAREST});this._colorTexture=n;let i=new Ur({context:t,colorTextures:[n],destroyAttachments:!1});Jft(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};X2.prototype.isDestroyed=function(){return!1};X2.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),de(this)};var K2=X2;var $be={};function edt(e,t,n){let i,o,r;if(e instanceof Ci){let s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}else if(e instanceof bl)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}var tdt=new d,Ybe=new d;function Zbe(e,t,n,i){if(c(i)&&n(.5)>i){let o=n(0),r=n(1),s=n(.5),a=s-o,l=s-r;return function(u){let f=n(u);if(u<=.5){let p=(f-o)/a;return O.lerp(e,-O.PI_OVER_TWO,p)}let h=(f-r)/l;return O.lerp(-O.PI_OVER_TWO,t,1-h)}}return function(o){return O.lerp(e,t,o)}}function pK(e,t,n,i,o){let r=o,s=Math.max(n,i);if(!c(r)){let a=e.position,l=t,u=e.up,f=e.right,h=e.frustum,p=d.subtract(a,l,tdt),g=d.magnitude(d.multiplyByScalar(u,d.dot(p,u),Ybe)),m=d.magnitude(d.multiplyByScalar(f,d.dot(p,f),Ybe));r=Math.min(edt(h,g,m)*.2,1e9)}if(s<r){let u=-Math.pow((r-n)*1e6,.125),f=Math.pow((r-i)*1e6,1/8);return function(h){let p=h*(f-u)+u;return-Math.pow(p,8)/1e6+r}}return function(a){return O.lerp(n,i,a)}}function $2(e,t){return O.equalsEpsilon(e,O.TWO_PI,O.EPSILON11)&&(e=0),t>e+Math.PI?e+=O.TWO_PI:t<e-Math.PI&&(e-=O.TWO_PI),e}var Qbe=new d;function ndt(e,t,n,i,o,r,s,a){let l=e.camera,u=d.clone(l.position,Qbe),f=l.pitch,h=$2(l.heading,i),p=$2(l.roll,r),g=pK(l,n,u.z,n.z,s),m=Zbe(f,o,g,a);function y(b){let x=b.time/t;l.setView({orientation:{heading:O.lerp(h,i,x),pitch:m(x),roll:O.lerp(p,r,x)}}),H.lerp(u,n,x,l.position),l.position.z=g(x)}return y}function idt(e,t){e.longitude<t.longitude?e.longitude+=O.TWO_PI:t.longitude+=O.TWO_PI}function odt(e,t){let n=e.longitude-t.longitude;n<-O.PI?e.longitude+=O.TWO_PI:n>O.PI&&(t.longitude+=O.TWO_PI)}var rdt=new he,sdt=new he;function adt(e,t,n,i,o,r,s,a,l,u){let f=e.camera,p=e.mapProjection.ellipsoid,g=he.clone(f.positionCartographic,rdt),m=f.pitch,y=$2(f.heading,i),b=$2(f.roll,r),x=p.cartesianToCartographic(n,sdt);g.longitude=O.zeroToTwoPi(g.longitude),x.longitude=O.zeroToTwoPi(x.longitude);let A=!1;if(c(a)){let P=O.zeroToTwoPi(a),M=Math.min(g.longitude,x.longitude),R=Math.max(g.longitude,x.longitude),L=P>=M&&P<=R;if(c(l)){let F=Math.abs(g.longitude-x.longitude),_=O.TWO_PI-F;(L?F:_)<(L?_:F)*l&&!L&&(A=!0)}else L||(A=!0)}A?idt(g,x):odt(g,x);let C=pK(f,n,g.height,x.height,s),S=Zbe(m,o,C,u);function v(){let P=g.longitude,M=x.longitude,R=g.latitude,L=x.latitude;return function(_){let w=_.time/t,D=d.fromRadians(O.lerp(P,M,w),O.lerp(R,L,w),C(w),p);f.setView({destination:D,orientation:{heading:O.lerp(y,i,w),pitch:S(w),roll:O.lerp(b,r,w)}})}}return v()}function cdt(e,t,n,i,o,r,s){let a=e.camera,l=d.clone(a.position,Qbe),u=$2(a.heading,i),f=a.frustum.right-a.frustum.left,h=pK(a,n,f,n.z,s);function p(g){let m=g.time/t;a.setView({orientation:{heading:O.lerp(u,i,m)}}),H.lerp(l,n,m,a.position);let y=h(m),b=a.frustum,x=b.top/b.right,A=(y-(b.right-b.left))*.5;b.right+=A,b.left-=A,b.top=x*b.right,b.bottom=-b.top}return p}var Xbe=new he,ldt=new d;function mK(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function Kbe(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}$be.createTween=function(e,t){t=t??W.EMPTY_OBJECT;let n=t.destination;if(!c(e))throw new E("scene is required.");if(!c(n))throw new E("destination is required.");let i=e.mode;if(i===oe.MORPHING)return mK();let o=t.convert??!0,r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,l=t.flyOverLongitude,u=t.flyOverLongitudeWeight,f=t.pitchAdjustHeight,h=t.easingFunction;o&&i!==oe.SCENE3D&&(s.cartesianToCartographic(n,Xbe),n=r.project(Xbe,ldt));let p=e.camera,g=t.endTransform;c(g)&&p._setTransform(g);let m=t.duration;c(m)||(m=Math.ceil(d.distance(p.position,n)/1e6)+2,m=Math.min(m,3));let y=t.heading??0,b=t.pitch??-O.PI_OVER_TWO,x=t.roll??0,A=e.screenSpaceCameraController;A.enableInputs=!1;let C=Kbe(A,t.complete),S=Kbe(A,t.cancel),v=p.frustum,P=e.mode===oe.SCENE2D;if(P=P&&H.equalsEpsilon(p.position,n,O.EPSILON6),P=P&&O.equalsEpsilon(Math.max(v.right-v.left,v.top-v.bottom),n.z,O.EPSILON6),P=P||e.mode!==oe.SCENE2D&&d.equalsEpsilon(n,p.position,O.EPSILON10),P=P&&O.equalsEpsilon(O.negativePiToPi(y),O.negativePiToPi(p.heading),O.EPSILON10)&&O.equalsEpsilon(O.negativePiToPi(b),O.negativePiToPi(p.pitch),O.EPSILON10)&&O.equalsEpsilon(O.negativePiToPi(x),O.negativePiToPi(p.roll),O.EPSILON10),P)return mK(C,S);let M=new Array(4);if(M[oe.SCENE2D]=cdt,M[oe.SCENE3D]=adt,M[oe.COLUMBUS_VIEW]=ndt,m<=0)return mK(function(){M[i](e,1,n,y,b,x,a,l,u,f)({time:1}),typeof C=="function"&&C()},S);let R=M[i](e,m,n,y,b,x,a,l,u,f);if(!c(h)){let L=p.positionCartographic.height,F=i===oe.SCENE3D?s.cartesianToCartographic(n).height:n.z;L>F&&L>11500?h=Qr.CUBIC_OUT:h=Qr.QUINTIC_IN_OUT}return{duration:m,easingFunction:h,startObject:{time:0},stopObject:{time:m},update:R,complete:C,cancel:S}};var Z2=$be;var udt={ROTATE:0,INFINITE_SCROLL:1},ru=Object.freeze(udt);function en(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._transform=B.clone(B.IDENTITY),this._invTransform=B.clone(B.IDENTITY),this._actualTransform=B.clone(B.IDENTITY),this._actualInvTransform=B.clone(B.IDENTITY),this._transformChanged=!1,this.position=new d,this._position=new d,this._positionWC=new d,this._positionCartographic=new he,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new d,this._direction=new d,this._directionWC=new d,this.up=new d,this._up=new d,this._upWC=new d,this.right=new d,this._right=new d,this._rightWC=new d,this.frustum=new Ci,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=O.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new pe,this._moveEnd=new pe,this._changed=new pe,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this._changedRoll=void 0,this.percentageChanged=.5,this._viewMatrix=new B,this._invViewMatrix=new B,sxe(this),this._mode=oe.SCENE3D,this._modeChanged=!0;let t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new he(Math.PI,O.PI_OVER_TWO)),this._max2Dfrustum=void 0,yxe(this,en.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=d.magnitude(this.position);n+=n*en.DEFAULT_VIEW_FACTOR,d.normalize(this.position,this.position),d.multiplyByScalar(this.position,n,this.position)}en.TRANSFORM_2D=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);en.TRANSFORM_2D_INVERSE=B.inverseTransformation(en.TRANSFORM_2D,new B);en.DEFAULT_VIEW_RECTANGLE=ce.fromDegrees(-95,-20,-70,90);en.DEFAULT_VIEW_FACTOR=.5;en.DEFAULT_OFFSET=new cd(0,-O.PI_OVER_FOUR,0);function sxe(e){B.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),B.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),B.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function fdt(e){if(!c(e._oldPositionWC))e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;let t=d.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=d.magnitude(t),e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=Ti()):e.timeSinceMoved=Math.max(Ti()-e._lastMovedTimestamp,0)/1e3}}en.prototype.canPreloadFlight=function(){return c(this._currentFlight)&&this._mode!==oe.SCENE2D};en.prototype._updateCameraChanged=function(){let e=this;if(fdt(e),e._changed.numberOfListeners===0)return;let t=e.percentageChanged,n=e.heading;c(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%O.TWO_PI;i=i>O.PI?O.TWO_PI-i:i;let o=i/Math.PI;o>t&&(e._changedHeading=n);let r=e.roll;c(e._changedRoll)||(e._changedRoll=r);let s=Math.abs(e._changedRoll-r)%O.TWO_PI;s=s>O.PI?O.TWO_PI-s:s;let a=s/Math.PI;if(a>t&&(e._changedRoll=r),(a>t||o>t)&&e._changed.raiseEvent(Math.max(a,o)),e._mode===oe.SCENE2D){if(!c(e._changedFrustum)){e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}let p=e.position,g=e._changedPosition,m=e.frustum,y=e._changedFrustum,b=p.x+m.left,x=p.x+m.right,A=g.x+y.left,C=g.x+y.right,S=p.y+m.bottom,v=p.y+m.top,P=g.y+y.bottom,M=g.y+y.top,R=Math.max(b,A),L=Math.min(x,C),F=Math.max(S,P),_=Math.min(v,M),w;if(R>=L||F>=v)w=1;else{let D=y;b<A&&x>C&&S<P&&v>M&&(D=m),w=1-(L-R)*(_-F)/((D.right-D.left)*(D.top-D.bottom))}w>t&&(e._changed.raiseEvent(w),e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!c(e._changedDirection)){e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection);return}let l=O.acosClamped(d.dot(e.directionWC,e._changedDirection)),u;c(e.frustum.fovy)?u=l/(e.frustum.fovy*.5):u=l;let h=d.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(u>t||h>t)&&(e._changed.raiseEvent(Math.max(u,h)),e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection))};function ddt(e){Ot.basisTo2D(e._projection,e._transform,e._actualTransform)}var hdt=new he,mdt=new d,GH=new d,pdt=new se,_dt=new se,gdt=new se,ydt=new se,bdt=new se;function xdt(e){let t=e._projection,n=t.ellipsoid,i=B.getColumn(e._transform,3,pdt),o=n.cartesianToCartographic(i,hdt),r=t.project(o,mdt),s=_dt;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;let a=se.clone(se.UNIT_X,bdt),l=se.add(B.getColumn(e._transform,0,GH),i,GH);n.cartesianToCartographic(l,o),t.project(o,r);let u=gdt;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,d.subtract(u,s,u),u.x=0;let f=ydt;if(d.magnitudeSquared(u)>O.EPSILON10)d.cross(a,u,f);else{let h=se.add(B.getColumn(e._transform,1,GH),i,GH);n.cartesianToCartographic(h,o),t.project(o,r),f.x=r.z,f.y=r.x,f.z=r.y,f.w=0,d.subtract(f,s,f),f.x=0,d.magnitudeSquared(f)<O.EPSILON10&&(se.clone(se.UNIT_Y,u),se.clone(se.UNIT_Z,f))}d.cross(f,a,u),d.normalize(u,u),d.cross(a,u,f),d.normalize(f,f),B.setColumn(e._actualTransform,0,u,e._actualTransform),B.setColumn(e._actualTransform,1,f,e._actualTransform),B.setColumn(e._actualTransform,2,a,e._actualTransform),B.setColumn(e._actualTransform,3,s,e._actualTransform)}var _K=new d;function Lc(e){let t=e._mode,n=!1,i=0;t===oe.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position,r=!d.equals(o,e.position)||n;r&&(o=d.clone(e.position,e._position));let s=e._direction,a=!d.equals(s,e.direction);a&&(d.normalize(e.direction,e.direction),s=d.clone(e.direction,e._direction));let l=e._up,u=!d.equals(l,e.up);u&&(d.normalize(e.up,e.up),l=d.clone(e.up,e._up));let f=e._right,h=!d.equals(f,e.right);h&&(d.normalize(e.right,e.right),f=d.clone(e.right,e._right));let p=e._transformChanged||e._modeChanged;e._transformChanged=!1,p&&(B.inverseTransformation(e._transform,e._invTransform),e._mode===oe.COLUMBUS_VIEW||e._mode===oe.SCENE2D?B.equals(B.IDENTITY,e._transform)?B.clone(en.TRANSFORM_2D,e._actualTransform):e._mode===oe.COLUMBUS_VIEW?ddt(e):xdt(e):B.clone(e._transform,e._actualTransform),B.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);let g=e._actualTransform;if(r||p)if(e._positionWC=B.multiplyByPoint(g,o,e._positionWC),t===oe.SCENE3D||t===oe.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{let m=_K;m.x=e._positionWC.y,m.y=e._positionWC.z,m.z=e._positionWC.x,t===oe.SCENE2D&&(m.z=i),e._projection.unproject(m,e._positionCartographic)}if(a||u||h){let m=d.dot(s,d.cross(l,f,_K));if(Math.abs(1-m)>O.EPSILON2){let y=1/d.magnitudeSquared(l),b=d.dot(l,s)*y,x=d.multiplyByScalar(s,b,_K);l=d.normalize(d.subtract(l,x,e._up),e._up),d.clone(l,e.up),f=d.cross(s,l,e._right),d.clone(f,e.right)}}(a||p)&&(e._directionWC=B.multiplyByPointAsVector(g,s,e._directionWC),d.normalize(e._directionWC,e._directionWC)),(u||p)&&(e._upWC=B.multiplyByPointAsVector(g,l,e._upWC),d.normalize(e._upWC,e._upWC)),(h||p)&&(e._rightWC=B.multiplyByPointAsVector(g,f,e._rightWC),d.normalize(e._rightWC,e._rightWC)),(r||a||u||h||p)&&sxe(e)}function axe(e,t){let n;return O.equalsEpsilon(Math.abs(e.z),1,O.EPSILON3)?n=Math.atan2(t.y,t.x)-O.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-O.PI_OVER_TWO,O.TWO_PI-O.zeroToTwoPi(n)}function cxe(e){return O.PI_OVER_TWO-O.acosClamped(e.z)}function lxe(e,t,n){let i=0;return O.equalsEpsilon(Math.abs(e.z),1,O.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=O.zeroToTwoPi(i+O.TWO_PI)),i}var qH=new B,YH=new B;Object.defineProperties(en.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return Lc(this),this._invTransform}},viewMatrix:{get:function(){return Lc(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return Lc(this),this._invViewMatrix}},positionCartographic:{get:function(){return Lc(this),this._positionCartographic}},positionWC:{get:function(){return Lc(this),this._positionWC}},directionWC:{get:function(){return Lc(this),this._directionWC}},upWC:{get:function(){return Lc(this),this._upWC}},rightWC:{get:function(){return Lc(this),this._rightWC}},heading:{get:function(){if(this._mode!==oe.MORPHING){let e=this._projection.ellipsoid,t=B.clone(this._transform,qH),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,YH);this._setTransform(n);let i=axe(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==oe.MORPHING){let e=this._projection.ellipsoid,t=B.clone(this._transform,qH),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,YH);this._setTransform(n);let i=cxe(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==oe.MORPHING){let e=this._projection.ellipsoid,t=B.clone(this._transform,qH),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,YH);this._setTransform(n);let i=lxe(this.direction,this.up,this.right);return this._setTransform(t),i}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}});en.prototype.update=function(e){if(!c(e))throw new E("mode is required.");if(e===oe.SCENE2D&&!(this.frustum instanceof jo))throw new E("An OrthographicOffCenterFrustum is required in 2D.");if((e===oe.SCENE3D||e===oe.COLUMBUS_VIEW)&&!(this.frustum instanceof Ci)&&!(this.frustum instanceof on))throw new E("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==oe.MORPHING,t=this._mode===oe.SCENE2D),t){let n=this._max2Dfrustum=this.frustum.clone();if(!(n instanceof jo))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");let i=2,o=n.top/n.right;n.right=this._maxCoord.x*i,n.left=-n.right,n.top=o*n.right,n.bottom=-n.top}this._mode===oe.SCENE2D&&hxe(this,this.position)};var Tdt=new d,Adt=new d,Cdt=new d;en.prototype._setTransform=function(e){let t=d.clone(this.positionWC,Tdt),n=d.clone(this.upWC,Adt),i=d.clone(this.directionWC,Cdt);B.clone(e,this._transform),this._transformChanged=!0,Lc(this);let o=this._actualInvTransform;B.multiplyByPoint(o,t,this.position),B.multiplyByPointAsVector(o,i,this.direction),B.multiplyByPointAsVector(o,n,this.up),d.cross(this.direction,this.up,this.right),Lc(this)};var Edt=new H,Sdt=new mn,wdt=new d,vdt=new d;function uxe(e){if(!B.equals(B.IDENTITY,e.transform))return d.magnitude(e.position);let t=e._scene,n=t.globe,i=Edt;i.x=t.drawingBufferWidth/t.pixelRatio/2,i.y=t.drawingBufferHeight/t.pixelRatio/2;let o;if(c(n)){let a=e.getPickRay(i,Sdt);o=n.pickWorldCoordinates(a,t,!0,wdt)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,vdt));let s;if(c(o)||c(r)){let a=c(r)?d.distance(r,e.positionWC):Number.POSITIVE_INFINITY,l=c(o)?d.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,l)}else s=Math.max(e.positionCartographic.height,0);return s}en.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof on&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=uxe(this)))};var XH=new d,TK=new B,Ddt=new B,AK=new Le,CK=new J,fxe=new he;function Pdt(e,t,n){if(isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new E("position has a NaN component");let i=B.clone(e.transform,TK),o=Ot.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,Ddt);e._setTransform(o),d.clone(d.ZERO,e.position),n.heading=n.heading-O.PI_OVER_TWO;let r=Le.fromHeadingPitchRoll(n,AK),s=J.fromQuaternion(r,CK);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function Idt(e,t,n,i){let o=B.clone(e.transform,TK);if(e._setTransform(B.IDENTITY),!d.equals(t,e.positionWC)){if(i){let a=e._projection,l=a.ellipsoid.cartesianToCartographic(t,fxe);t=a.project(l,XH)}d.clone(t,e.position)}n.heading=n.heading-O.PI_OVER_TWO;let r=Le.fromHeadingPitchRoll(n,AK),s=J.fromQuaternion(r,CK);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function Odt(e,t,n,i){let o=B.clone(e.transform,TK);if(e._setTransform(B.IDENTITY),!d.equals(t,e.positionWC)){if(i){let l=e._projection,u=l.ellipsoid.cartesianToCartographic(t,fxe);t=l.project(u,XH)}H.clone(t,e.position);let r=-t.z*.5,s=-r,a=e.frustum;if(s>r){let l=a.top/a.right;a.right=s,a.left=r,a.top=a.right*l,a.bottom=-a.top}}if(e._scene.mapMode2D===ru.ROTATE){n.heading=n.heading-O.PI_OVER_TWO,n.pitch=-O.PI_OVER_TWO,n.roll=0;let r=Le.fromHeadingPitchRoll(n,AK),s=J.fromQuaternion(r,CK);J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right)}e._setTransform(o)}var Rdt=new d,Mdt=new d,Ldt=new d;function dxe(e,t,n,i){let o=d.clone(n.direction,Rdt),r=d.clone(n.up,Mdt);if(e._scene.mode===oe.SCENE3D){let a=e._projection.ellipsoid,l=Ot.eastNorthUpToFixedFrame(t,a,qH),u=B.inverseTransformation(l,YH);B.multiplyByPointAsVector(u,o,o),B.multiplyByPointAsVector(u,r,r)}let s=d.cross(o,r,Ldt);return i.heading=axe(o,r),i.pitch=cxe(o),i.roll=lxe(o,r,s),i}var xK={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},Tw=new Oa;en.prototype.setView=function(e){e=e??W.EMPTY_OBJECT;let t=e.orientation??W.EMPTY_OBJECT,n=this._mode;if(n===oe.MORPHING)return;c(e.endTransform)&&this._setTransform(e.endTransform);let i=e.convert??!0,o=e.destination??d.clone(this.positionWC,XH);if(c(o)&&c(o.west)){if(o=this.getRectangleCameraCoordinates(o,XH),isNaN(o.x)||isNaN(o.y))throw new E("destination has a NaN component");i=!1}c(t.direction)&&(t=dxe(this,o,t,xK.orientation)),Tw.heading=t.heading??0,Tw.pitch=t.pitch??-O.PI_OVER_TWO,Tw.roll=t.roll??0,n===oe.SCENE3D?Pdt(this,o,Tw):n===oe.SCENE2D?Odt(this,o,Tw,i):Idt(this,o,Tw,i)};var Ndt=new d;en.prototype.flyHome=function(e){let t=this._mode;if(t===oe.MORPHING&&this._scene.completeMorph(),t===oe.SCENE2D)this.flyTo({destination:en.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:B.IDENTITY});else if(t===oe.SCENE3D){let n=this.getRectangleCameraCoordinates(en.DEFAULT_VIEW_RECTANGLE),i=d.magnitude(n);i+=i*en.DEFAULT_VIEW_FACTOR,d.normalize(n,n),d.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:B.IDENTITY})}else if(t===oe.COLUMBUS_VIEW){let n=this._projection.ellipsoid.maximumRadius,i=new d(0,-1,1);i=d.multiplyByScalar(d.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(d.normalize(i,Ndt).z),roll:0},endTransform:B.IDENTITY,convert:!1})}};en.prototype.worldToCameraCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new se),Lc(this),B.multiplyByVector(this._actualInvTransform,e,t)};en.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),Lc(this),B.multiplyByPoint(this._actualInvTransform,e,t)};en.prototype.worldToCameraCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),Lc(this),B.multiplyByPointAsVector(this._actualInvTransform,e,t)};en.prototype.cameraToWorldCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new se),Lc(this),B.multiplyByVector(this._actualTransform,e,t)};en.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),Lc(this),B.multiplyByPoint(this._actualTransform,e,t)};en.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),Lc(this),B.multiplyByPointAsVector(this._actualTransform,e,t)};function hxe(e,t){let n=e._scene.mapMode2D===ru.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y,r,s;n?(s=i,r=-s):(s=t.x-i*2,r=t.x+i*2),t.x>i&&(t.x=s),t.x<-i&&(t.x=r),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}var Jbe=new d;en.prototype.move=function(e,t){if(!c(e))throw new E("direction is required.");let n=this.position;d.multiplyByScalar(e,t,Jbe),d.add(n,Jbe,n),this._mode===oe.SCENE2D&&hxe(this,n),this._adjustOrthographicFrustum(!0)};en.prototype.moveForward=function(e){e=e??this.defaultMoveAmount,this._mode===oe.SCENE2D?KH(this,e):this.move(this.direction,e)};en.prototype.moveBackward=function(e){e=e??this.defaultMoveAmount,this._mode===oe.SCENE2D?KH(this,-e):this.move(this.direction,-e)};en.prototype.moveUp=function(e){e=e??this.defaultMoveAmount,this.move(this.up,e)};en.prototype.moveDown=function(e){e=e??this.defaultMoveAmount,this.move(this.up,-e)};en.prototype.moveRight=function(e){e=e??this.defaultMoveAmount,this.move(this.right,e)};en.prototype.moveLeft=function(e){e=e??this.defaultMoveAmount,this.move(this.right,-e)};en.prototype.lookLeft=function(e){e=e??this.defaultLookAmount,this._mode!==oe.SCENE2D&&this.look(this.up,-e)};en.prototype.lookRight=function(e){e=e??this.defaultLookAmount,this._mode!==oe.SCENE2D&&this.look(this.up,e)};en.prototype.lookUp=function(e){e=e??this.defaultLookAmount,this._mode!==oe.SCENE2D&&this.look(this.right,-e)};en.prototype.lookDown=function(e){e=e??this.defaultLookAmount,this._mode!==oe.SCENE2D&&this.look(this.right,e)};var Fdt=new Le,Bdt=new J;en.prototype.look=function(e,t){if(!c(e))throw new E("axis is required.");let n=t??this.defaultLookAmount,i=Le.fromAxisAngle(e,-n,Fdt),o=J.fromQuaternion(i,Bdt),r=this.direction,s=this.up,a=this.right;J.multiplyByVector(o,r,r),J.multiplyByVector(o,s,s),J.multiplyByVector(o,a,a)};en.prototype.twistLeft=function(e){e=e??this.defaultLookAmount,this.look(this.direction,e)};en.prototype.twistRight=function(e){e=e??this.defaultLookAmount,this.look(this.direction,-e)};var kdt=new Le,Udt=new J;en.prototype.rotate=function(e,t){if(!c(e))throw new E("axis is required.");let n=t??this.defaultRotateAmount,i=Le.fromAxisAngle(e,-n,kdt),o=J.fromQuaternion(i,Udt);J.multiplyByVector(o,this.position,this.position),J.multiplyByVector(o,this.direction,this.direction),J.multiplyByVector(o,this.up,this.up),d.cross(this.direction,this.up,this.right),d.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};en.prototype.rotateDown=function(e){e=e??this.defaultRotateAmount,mxe(this,e)};en.prototype.rotateUp=function(e){e=e??this.defaultRotateAmount,mxe(this,-e)};var Vdt=new d,zdt=new d,Hdt=new d,exe=new d;function mxe(e,t){let n=e.position;if(c(e.constrainedAxis)&&!d.equalsEpsilon(e.position,d.ZERO,O.EPSILON2)){let i=d.normalize(n,Vdt),o=d.equalsEpsilon(i,e.constrainedAxis,O.EPSILON2),r=d.equalsEpsilon(i,d.negate(e.constrainedAxis,exe),O.EPSILON2);if(!o&&!r){let s=d.normalize(e.constrainedAxis,zdt),a=d.dot(i,s),l=O.acosClamped(a);t>0&&t>l&&(t=l-O.EPSILON4),a=d.dot(i,d.negate(s,exe)),l=O.acosClamped(a),t<0&&-t>l&&(t=-l+O.EPSILON4);let u=d.cross(s,i,Hdt);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}en.prototype.rotateRight=function(e){e=e??this.defaultRotateAmount,pxe(this,-e)};en.prototype.rotateLeft=function(e){e=e??this.defaultRotateAmount,pxe(this,e)};function pxe(e,t){c(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function KH(e,t){let n=e.frustum;if(!(n instanceof jo)||!c(n.left)||!c(n.right)||!c(n.bottom)||!c(n.top))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t=t*.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===ru.ROTATE&&(s*=e.maximumZoomFactor),r>s&&(r=s,o=-s),o<=r&&(o=1,r=-1),i=n.right/n.top,n.top=o,n.bottom=r,n.right=n.top*i,n.left=-n.right}else{let o=n.right-t,r=n.left+t,s=e._maxCoord.x;e._scene.mapMode2D===ru.ROTATE&&(s*=e.maximumZoomFactor),o>s&&(o=s,r=-s),o<=r&&(o=1,r=-1),i=n.top/n.right,n.right=o,n.left=r,n.top=n.right*i,n.bottom=-n.top}}function _xe(e,t){e.move(e.direction,t)}en.prototype.zoomIn=function(e){e=e??this.defaultZoomAmount,this._mode===oe.SCENE2D?KH(this,e):_xe(this,e)};en.prototype.zoomOut=function(e){e=e??this.defaultZoomAmount,this._mode===oe.SCENE2D?KH(this,-e):_xe(this,-e)};en.prototype.getMagnitude=function(){if(this._mode===oe.SCENE3D)return d.magnitude(this.position);if(this._mode===oe.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===oe.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};var Gdt=new B;en.prototype.lookAt=function(e,t){if(!c(e))throw new E("target is required");if(!c(t))throw new E("offset is required");if(this._mode===oe.MORPHING)throw new E("lookAt is not supported while morphing.");let i=this._scene.ellipsoid??ie.default,o=Ot.eastNorthUpToFixedFrame(e,i,Gdt);this.lookAtTransform(o,t)};var jdt=new d,Wdt=new Le,qdt=new Le,Ydt=new J;function gxe(e,t,n){t=O.clamp(t,-O.PI_OVER_TWO,O.PI_OVER_TWO),e=O.zeroToTwoPi(e)-O.PI_OVER_TWO;let i=Le.fromAxisAngle(d.UNIT_Y,-t,Wdt),o=Le.fromAxisAngle(d.UNIT_Z,-e,qdt),r=Le.multiply(o,i,o),s=J.fromQuaternion(r,Ydt),a=d.clone(d.UNIT_X,jdt);return J.multiplyByVector(s,a,a),d.negate(a,a),d.multiplyByScalar(a,n,a),a}en.prototype.lookAtTransform=function(e,t){if(!c(e))throw new E("transform is required");if(this._mode===oe.MORPHING)throw new E("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!c(t))return;let n;if(c(t.heading)?n=gxe(t.heading,t.pitch,t.range):n=t,this._mode===oe.SCENE2D){H.clone(H.ZERO,this.position),d.negate(n,this.up),this.up.z=0,d.magnitudeSquared(this.up)<O.EPSILON10&&d.clone(d.UNIT_Y,this.up),d.normalize(this.up,this.up),this._setTransform(B.IDENTITY),d.negate(d.UNIT_Z,this.direction),d.cross(this.direction,this.up,this.right),d.normalize(this.right,this.right);let i=this.frustum,o=i.top/i.right;i.right=d.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}d.clone(n,this.position),d.negate(this.position,this.direction),d.normalize(this.direction,this.direction),d.cross(this.direction,d.UNIT_Z,this.right),d.magnitudeSquared(this.right)<O.EPSILON10&&d.clone(d.UNIT_X,this.right),d.normalize(this.right,this.right),d.cross(this.right,this.direction,this.up),d.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};var Q2=new he,Xdt=new he,Kdt=new d,$dt=new d,Zdt=new d,Qdt=new d,Jdt=new d,eht=new d,tht=new d,gK=new d,nht={direction:new d,right:new d,up:new d},txe;function Mc(e,t,n,i){return Math.abs(d.dot(t,n))/i-d.dot(e,n)}function yxe(e,t,n,i){let o=e._projection.ellipsoid,r=i?e:nht,{north:s,south:a,west:l}=t,{east:u}=t;l>u&&(u+=O.TWO_PI);let f=(l+u)*.5,h;if(a<-O.PI_OVER_TWO+O.RADIANS_PER_DEGREE&&s>O.PI_OVER_TWO-O.RADIANS_PER_DEGREE)h=0;else{let L=Q2;L.longitude=f,L.latitude=s,L.height=0;let F=Xdt;F.longitude=f,F.latitude=a,F.height=0;let _=txe;(!c(_)||_.ellipsoid!==o)&&(txe=_=new kp(void 0,void 0,o)),_.setEndPoints(L,F),h=_.interpolateUsingFraction(.5,Q2).latitude}let p=Q2;p.longitude=f,p.latitude=h,p.height=0;let g=o.cartographicToCartesian(p,tht),m=Q2;m.longitude=u,m.latitude=s;let y=o.cartographicToCartesian(m,Kdt);m.longitude=l;let b=o.cartographicToCartesian(m,Zdt);m.longitude=f;let x=o.cartographicToCartesian(m,Jdt);m.latitude=a;let A=o.cartographicToCartesian(m,eht);m.longitude=u;let C=o.cartographicToCartesian(m,Qdt);m.longitude=l;let S=o.cartographicToCartesian(m,$dt);d.subtract(b,g,b),d.subtract(C,g,C),d.subtract(y,g,y),d.subtract(S,g,S),d.subtract(x,g,x),d.subtract(A,g,A);let v=o.geodeticSurfaceNormal(g,r.direction);d.negate(v,v);let P=d.cross(v,d.UNIT_Z,r.right);d.normalize(P,P);let M=d.cross(P,v,r.up),R;if(e.frustum instanceof on){let L=Math.max(d.distance(y,b),d.distance(C,S)),F=Math.max(d.distance(y,C),d.distance(b,S)),_,w,D=e.frustum._offCenterFrustum,I=D.right/D.top,N=F*I;L>N?(_=L,w=_/I):(w=F,_=N),R=Math.max(_,w)}else{let L=Math.tan(e.frustum.fovy*.5),F=e.frustum.aspectRatio*L;if(R=Math.max(Mc(v,M,b,L),Mc(v,M,C,L),Mc(v,M,y,L),Mc(v,M,S,L),Mc(v,M,x,L),Mc(v,M,A,L),Mc(v,P,b,F),Mc(v,P,C,F),Mc(v,P,y,F),Mc(v,P,S,F),Mc(v,P,x,F),Mc(v,P,A,F)),a<0&&s>0){let _=Q2;_.longitude=l,_.latitude=0,_.height=0;let w=o.cartographicToCartesian(_,gK);d.subtract(w,g,w),R=Math.max(R,Mc(v,M,w,L),Mc(v,P,w,F)),_.longitude=u,w=o.cartographicToCartesian(_,gK),d.subtract(w,g,w),R=Math.max(R,Mc(v,M,w,L),Mc(v,P,w,F))}}return d.add(g,d.multiplyByScalar(v,-R,gK),n)}var iht=new he,oht=new d,rht=new d;function sht(e,t,n){let i=e._projection;t.west>t.east&&(t=ce.MAX_VALUE);let o=e._actualTransform,r=e._actualInvTransform,s=iht;s.longitude=t.east,s.latitude=t.north;let a=i.project(s,oht);B.multiplyByPoint(o,a,a),B.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;let l=i.project(s,rht);if(B.multiplyByPoint(o,l,l),B.multiplyByPoint(r,l,l),n.x=(a.x-l.x)*.5+l.x,n.y=(a.y-l.y)*.5+l.y,c(e.frustum.fovy)){let u=Math.tan(e.frustum.fovy*.5),f=e.frustum.aspectRatio*u;n.z=Math.max((a.x-l.x)/f,(a.y-l.y)/u)*.5}else{let u=a.x-l.x,f=a.y-l.y;n.z=Math.max(u,f)}return n}var aht=new he,cht=new d,lht=new d;function uht(e,t,n){let i=e._projection,o=t.east;t.west>t.east&&(e._scene.mapMode2D===ru.INFINITE_SCROLL?o+=O.TWO_PI:(t=ce.MAX_VALUE,o=t.east));let r=aht;r.longitude=o,r.latitude=t.north;let s=i.project(r,cht);r.longitude=t.west,r.latitude=t.south;let a=i.project(r,lht),l=Math.abs(s.x-a.x)*.5,u=Math.abs(s.y-a.y)*.5,f,h,p=e.frustum.right/e.frustum.top,g=u*p;return l>g?(f=l,h=f/p):(h=u,f=g),u=Math.max(2*f,2*h),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}en.prototype.getRectangleCameraCoordinates=function(e,t){if(!c(e))throw new E("rectangle is required");let n=this._mode;if(c(t)||(t=new d),n===oe.SCENE3D)return yxe(this,e,t);if(n===oe.COLUMBUS_VIEW)return sht(this,e,t);if(n===oe.SCENE2D)return uht(this,e,t)};var fht=new mn;function dht(e,t,n,i){n=n??ie.default;let o=e.getPickRay(t,fht),r=Zn.rayEllipsoid(o,n);if(!r)return;let s=r.start>0?r.start:r.stop;return mn.getPoint(o,s,i)}var hht=new mn;function mht(e,t,n,i){let r=e.getPickRay(t,hht).origin;r=d.fromElements(r.y,r.z,0,r);let s=n.unproject(r);if(!(s.latitude<-O.PI_OVER_TWO||s.latitude>O.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}var pht=new mn;function _ht(e,t,n,i){let o=e.getPickRay(t,pht),r=-o.origin.x/o.direction.x;mn.getPoint(o,r,i);let s=n.unproject(new d(i.y,i.z,0));if(!(s.latitude<-O.PI_OVER_TWO||s.latitude>O.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}en.prototype.pickEllipsoid=function(e,t,n){if(!c(e))throw new E("windowPosition is required.");let i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(c(n)||(n=new d),t=t??ie.default,this._mode===oe.SCENE3D)n=dht(this,e,t,n);else if(this._mode===oe.SCENE2D)n=mht(this,e,this._projection,n);else if(this._mode===oe.COLUMBUS_VIEW)n=_ht(this,e,this._projection,n);else return;return n}};var ght=new d,yht=new d,bht=new d;function xht(e,t,n){let i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=Math.tan(e.frustum.fovy*.5),a=e.frustum.aspectRatio*s,l=e.frustum.near,u=2/o*t.x-1,f=2/r*(r-t.y)-1,h=e.positionWC;d.clone(h,n.origin);let p=d.multiplyByScalar(e.directionWC,l,ght);d.add(h,p,p);let g=d.multiplyByScalar(e.rightWC,u*l*a,yht),m=d.multiplyByScalar(e.upWC,f*l*s,bht),y=d.add(p,g,n.direction);return d.add(y,m,y),d.subtract(y,h,y),d.normalize(y,y),n}var jH=new d;function Tht(e,t,n){let i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=e.frustum,a=s.offCenterFrustum;c(a)&&(s=a);let l=2/o*t.x-1;l*=(s.right-s.left)*.5;let u=2/r*(r-t.y)-1;u*=(s.top-s.bottom)*.5;let f=n.origin;return d.clone(e.positionWC,f),d.multiplyByScalar(e.rightWC,l,jH),d.add(jH,f,f),d.multiplyByScalar(e.upWC,u,jH),d.add(jH,f,f),d.clone(e.directionWC,n.direction),n}en.prototype.getPickRay=function(e,t){if(!c(e))throw new E("windowPosition is required.");c(t)||(t=new mn);let n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;let i=this.frustum;return c(i.aspectRatio)&&c(i.fov)&&c(i.near)?xht(this,e,t):Tht(this,e,t)};var Aht=new d,Cht=new d;en.prototype.distanceToBoundingSphere=function(e){if(!c(e))throw new E("boundingSphere is required.");let t=d.subtract(this.positionWC,e.center,Aht),n=d.multiplyByScalar(this.directionWC,d.dot(t,this.directionWC),Cht);return Math.max(0,d.magnitude(n)-e.radius)};var Eht=new H;en.prototype.getPixelSize=function(e,t,n){if(!c(e))throw new E("boundingSphere is required.");if(!c(t))throw new E("drawingBufferWidth is required.");if(!c(n))throw new E("drawingBufferHeight is required.");let i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,Eht);return Math.max(o.x,o.y)};function Sht(e,t,n,i,o,r){let s=d.clone(t);n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z);function a(l){let u=d.lerp(t,s,l.time,new d);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:Qr.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}var wht=new d,nxe=new d,vht=new d,Dht=new d;function Pht(e,t){let n=e.position,i=e.direction,o=e.worldToCameraCoordinatesVector(d.UNIT_X,wht),r=-d.dot(o,n)/d.dot(o,i),s=d.add(n,d.multiplyByScalar(i,r,nxe),nxe);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,vht);let a=Math.tan(e.frustum.fovy*.5),l=e.frustum.aspectRatio*a,u=d.magnitude(d.subtract(n,s,Dht)),f=l*u,h=a*u,p=e._maxCoord.x,g=e._maxCoord.y,m=Math.max(f-p,p),y=Math.max(h-g,g);if(n.z<-m||n.z>m||n.y<-y||n.y>y){let b=s.y<-m||s.y>m,x=s.z<-y||s.z>y;if(b||x)return Sht(e,n,s,m,y,t)}}en.prototype.createCorrectPositionTween=function(e){if(!c(e))throw new E("duration is required.");if(this._mode===oe.COLUMBUS_VIEW)return Pht(this,e)};var Iht=new d,ia={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};en.prototype.cancelFlight=function(){c(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};en.prototype.completeFlight=function(){if(c(this._currentFlight)){this._currentFlight.cancelTween();let e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=ia.destination,e.orientation.heading=ia.heading,e.orientation.pitch=ia.pitch,e.orientation.roll=ia.roll,this.setView(e),c(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};en.prototype.flyTo=function(e){e=e??W.EMPTY_OBJECT;let t=e.destination;if(!c(t))throw new E("destination is required.");if(this._mode===oe.MORPHING)return;this.cancelFlight();let i=t instanceof ce;i&&(t=this.getRectangleCameraCoordinates(t,Iht));let o=e.orientation??W.EMPTY_OBJECT;if(c(o.direction)&&(o=dxe(this,t,o,xK.orientation)),c(e.duration)&&e.duration<=0){let f=xK;f.destination=e.destination,f.orientation.heading=o.heading,f.orientation.pitch=o.pitch,f.orientation.roll=o.roll,f.convert=e.convert,f.endTransform=e.endTransform,this.setView(f),typeof e.complete=="function"&&e.complete();return}let r=this,s;ia.destination=t,ia.heading=o.heading,ia.pitch=o.pitch,ia.roll=o.roll,ia.duration=e.duration,ia.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),c(e.complete)&&e.complete()},ia.cancel=e.cancel,ia.endTransform=e.endTransform,ia.convert=i?!1:e.convert,ia.maximumHeight=e.maximumHeight,ia.pitchAdjustHeight=e.pitchAdjustHeight,ia.flyOverLongitude=e.flyOverLongitude,ia.flyOverLongitudeWeight=e.flyOverLongitudeWeight,ia.easingFunction=e.easingFunction;let a=this._scene,l=Z2.createTween(a,ia);if(l.duration===0){typeof l.complete=="function"&&l.complete();return}s=a.tweens.add(l),this._currentFlight=s;let u=this._scene.preloadFlightCamera;this._mode!==oe.SCENE2D&&(c(u)||(u=en.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function Oht(e,t){let n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function Rht(e,t){let n=e.frustum,i=n.offCenterFrustum;c(i)&&(n=i);let o,r,s=n.right/n.top,a=t*s;return t>a?(o=t,r=o/s):(r=t,o=a),Math.max(o,r)*1.5}var Mht=100;function bxe(e,t,n){n=cd.clone(c(n)?n:en.DEFAULT_OFFSET);let i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!c(r)||r===0){let s=t.radius;s===0?n.range=Mht:e.frustum instanceof on||e._mode===oe.SCENE2D?n.range=Rht(e,s):n.range=Oht(e,s),n.range=O.clamp(n.range,i,o)}return n}en.prototype.viewBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");if(this._mode===oe.MORPHING)throw new E("viewBoundingSphere is not supported while morphing.");t=bxe(this,e,t),this.lookAt(e.center,t)};var Lht=new B,Nht=new d,Fht=new d,Bht=new d,kht=new d,Uht=new se,Vht=new Le,zht=new J;en.prototype.flyToBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");t=t??W.EMPTY_OBJECT;let n=this._mode===oe.SCENE2D||this._mode===oe.COLUMBUS_VIEW;this._setTransform(B.IDENTITY);let i=bxe(this,e,t.offset),o;n?o=d.multiplyByScalar(d.UNIT_Z,i.range,Nht):o=gxe(i.heading,i.pitch,i.range);let s=this._scene.ellipsoid??ie.default,a=Ot.eastNorthUpToFixedFrame(e.center,s,Lht);B.multiplyByPoint(a,o,o);let l,u;if(!n){if(l=d.subtract(e.center,o,Fht),d.normalize(l,l),u=B.multiplyByPointAsVector(a,d.UNIT_Z,Bht),1-Math.abs(d.dot(l,u))<O.EPSILON6){let h=Le.fromAxisAngle(l,i.heading,Vht),p=J.fromQuaternion(h,zht);d.fromCartesian4(B.getColumn(a,1,Uht),u),J.multiplyByVector(p,u,u)}let f=d.cross(l,u,kht);d.cross(f,l,u),d.normalize(u,u)}this.flyTo({destination:o,orientation:{direction:l,up:u},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};var ixe=new d,oxe=new d,yK=new d,rxe=new d,J2=[new d,new d,new d,new d];function Hht(e,t){let n=t.radii,i=e.positionWC,o=d.multiplyComponents(t.oneOverRadii,i,ixe),r=d.magnitude(o),s=d.normalize(o,oxe),a,l;d.equalsEpsilon(s,d.UNIT_Z,O.EPSILON10)?(a=new d(0,1,0),l=new d(0,0,1)):(a=d.normalize(d.cross(d.UNIT_Z,s,yK),yK),l=d.normalize(d.cross(s,a,rxe),rxe));let u=Math.sqrt(d.magnitudeSquared(o)-1),f=d.multiplyByScalar(s,1/r,ixe),h=u/r,p=d.multiplyByScalar(a,h,oxe),g=d.multiplyByScalar(l,h,yK),m=d.add(f,g,J2[0]);d.subtract(m,p,m),d.multiplyComponents(n,m,m);let y=d.subtract(f,g,J2[1]);d.subtract(y,p,y),d.multiplyComponents(n,y,y);let b=d.subtract(f,g,J2[2]);d.add(b,p,b),d.multiplyComponents(n,b,b);let x=d.add(f,g,J2[3]);return d.add(x,p,x),d.multiplyComponents(n,x,x),J2}var bK=new H,Ght=new d,I0=[new he,new he,new he,new he];function WH(e,t,n,i,o,r){bK.x=e,bK.y=t;let s=i.pickEllipsoid(bK,o,Ght);return c(s)?(I0[n]=o.cartesianToCartographic(s,I0[n]),1):(I0[n]=o.cartesianToCartographic(r[n],I0[n]),0)}en.prototype.computeViewRectangle=function(e,t){e=e??ie.default;let n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new le(d.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Wt.OUTSIDE)return;let r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight,l=0,u=Hht(this,e);if(l+=WH(0,0,0,this,e,u),l+=WH(0,a,1,this,e,u),l+=WH(s,a,2,this,e,u),l+=WH(s,0,3,this,e,u),l<2)return ce.MAX_VALUE;t=ce.fromCartographicArray(I0,t);let f=0,h=I0[3].longitude;for(let p=0;p<4;++p){let g=I0[p].longitude,m=Math.abs(g-h);m>O.PI?f+=O.TWO_PI-m:f+=m,h=g}return O.equalsEpsilon(Math.abs(f),O.TWO_PI,O.EPSILON9)&&(t.west=-O.PI,t.east=O.PI,I0[0].latitude>=0?t.north=O.PI_OVER_TWO:t.south=-O.PI_OVER_TWO),t};en.prototype.switchToPerspectiveFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof Ci)return;let e=this._scene;this.frustum=new Ci,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=O.toRadians(60)};en.prototype.switchToOrthographicFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof on)return;let e=uxe(this),t=this._scene;this.frustum=new on,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};en.clone=function(e,t){return c(t)||(t=new en(e._scene)),d.clone(e.position,t.position),d.clone(e.direction,t.direction),d.clone(e.up,t.up),d.clone(e.right,t.right),B.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};var ro=en;function jht(e){T.typeOf.object("options",e),T.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}var gd=jht;var Exe=Zo(du(),1),xxe=576,Wht=100,eB="#ffffff",$H="#48b";function Sxe(e,t){this.credit=e,this.count=t??1}function qht(e,t){let n=e.length;for(let i=0;i<n;i++){let o=e[i];if(Tt.equals(o,t))return!0}return!1}function Yht(e){let t=e._previousCesiumCredit,n=e._currentCesiumCredit;Tt.equals(n,t)||(c(t)&&e._cesiumCreditContainer.removeChild(t.element),c(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}var wxe="cesium-credit-delimiter";function Txe(e){let t=document.createElement("span");return t.textContent=e,t.className=wxe,t}function Axe(e,t){if(c(t)){let n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function Cxe(e,t,n,i){let o=e.childNodes,r=-1;t.sort(function(s,a){return a.count-s.count});for(let s=0;s<t.length;++s){let a=t[s].credit;if(c(a)){if(r=s,c(n)&&(r*=2,s>0)){let u=r-1;if(o.length<=u)e.appendChild(Txe(n));else{let f=o[u];f.className!==wxe&&e.replaceChild(Txe(n),f)}}let l=a.element;if(o.length<=r)e.appendChild(Axe(l,i));else{let u=o[r];u._creditId!==a._id&&e.replaceChild(Axe(l,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function Xht(e){let t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<xxe?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`),e._lastViewportWidth=n),n>=xxe&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function Kht(e){let t=`
.cesium-credit-lightbox-overlay {
  display: none;
  z-index: 1;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(80, 80, 80, 0.8);
}

.cesium-credit-lightbox {
  background-color: #303336;
  color: ${eB};
  position: relative;
  min-height: ${Wht}px;
  margin: auto;
}
.cesium-credit-lightbox > ul > li a,
.cesium-credit-lightbox > ul > li a:visited,
.cesium-credit-wrapper a,
.cesium-credit-wrapper a:visited {
  color: ${eB};
}
.cesium-credit-lightbox > ul > li a:hover {
  color: ${$H};
}
.cesium-credit-lightbox.cesium-credit-lightbox-expanded {
  border: 1px solid #444;
  border-radius: 5px;
  max-width: 370px;
}
.cesium-credit-lightbox.cesium-credit-lightbox-mobile {
  height: 100%;
  width: 100%;
}
.cesium-credit-lightbox-title {
  padding: 20px 20px 0 20px;
}
.cesium-credit-lightbox-close {
  font-size: 18pt;
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 6px;
  color: ${eB};
}
.cesium-credit-lightbox-close:hover {
  color: ${$H};
}
.cesium-credit-lightbox > ul {
  margin: 0;
  padding: 12px 20px 12px 40px;
  font-size: 13px;
}
.cesium-credit-lightbox > ul > li {
  padding-bottom: 6px;
}
.cesium-credit-lightbox > ul > li * {
  padding: 0;
  margin: 0;
}

.cesium-credit-expand-link {
  padding-left: 5px;
  cursor: pointer;
  text-decoration: underline;
  color: ${eB};
}
.cesium-credit-expand-link:hover {
  color: ${$H};
}

.cesium-credit-text {
  color: ${eB};
}

.cesium-credit-delimiter {
  padding: 0 5px;
}

.cesium-credit-textContainer *,
.cesium-credit-logoContainer * {
  display: inline;
}

.cesium-credit-textContainer a:hover {
  color: ${$H}
}

.cesium-credit-textContainer .cesium-credit-wrapper:first-of-type {
  padding-left: 5px;
}
`;function n(r){if(r.shadowRoot)return r.shadowRoot;if(r.getRootNode){let s=r.getRootNode();if(s instanceof ShadowRoot)return s}}let i=n(e)??document.head,o=document.createElement("style");o.innerHTML=t,i.appendChild(o)}function Tr(e,t,n){T.defined("container",e);let i=this;n=n??document.body;let o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);let r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(m){r.contains(m.target)||i.hideLightbox()}o.addEventListener("click",s,!1);let a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);let l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="&times;",l.className="cesium-credit-lightbox-close",r.appendChild(l);let u=document.createElement("ul");r.appendChild(u);let f=document.createElement("div");f.className="cesium-credit-logoContainer",f.style.display="inline",e.appendChild(f);let h=document.createElement("div");h.className="cesium-credit-textContainer",h.style.display="inline",e.appendChild(h);let p=document.createElement("a");p.className="cesium-credit-expand-link",p.onclick=this.showLightbox.bind(this),p.textContent="Data attribution",e.appendChild(p),Kht(e);let g=Tt.clone(Tr.cesiumCredit);this._delimiter=t??"\u2022",this._screenContainer=h,this._cesiumCreditContainer=f,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=p,this._expanded=!1,this._staticCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new Et,lightboxCredits:new Et},this._defaultCredit=void 0,this.viewport=n,this.container=e}function vxe(e,t,n,i){i=i??1;let o=t.get(n.id);if(c(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{let r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new Sxe(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}Tr.prototype.addCreditToNextFrame=function(e){if(T.defined("credit",e),e.isIon()){c(this._defaultCredit)||(this._defaultCredit=Tt.clone(Dxe())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,vxe(this,t,e)};Tr.prototype.addStaticCredit=function(e){T.defined("credit",e);let t=this._staticCredits;qht(t,e)||t.push(e)};Tr.prototype.removeStaticCredit=function(e){T.defined("credit",e);let t=this._staticCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};Tr.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};Tr.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};Tr.prototype.update=function(){this._expanded&&Xht(this)};Tr.prototype.beginFrame=function(){let e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;let t=e.screenCredits,n=e.lightboxCredits;t.removeAll(),n.removeAll();let i=this._staticCredits;for(let o=0;o<i.length;++o){let r=i[o],s=r.showOnScreen?t:n;r.isIon()&&Tt.equals(Tr.cesiumCredit,this._cesiumCredit)||vxe(this,s,r,Number.MAX_VALUE)}Tt.equals(Tr.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Tt.clone(Tr.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};Tr.prototype.endFrame=function(){let e=this._currentFrameCredits.screenCredits.values;Cxe(this._screenContainer,e,this._delimiter,void 0);let t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",Cxe(this._creditList,t,void 0,"li"),Yht(this)};Tr.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),de(this)};Tr.prototype.isDestroyed=function(){return!1};Tr._cesiumCredit=void 0;Tr._cesiumCreditInitialized=!1;var ZH;function Dxe(){if(!c(ZH)){let e=tn("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new Exe.default(e).path()),ZH=new Tt(`<a href="https://cesium.com/" target="_blank"><img src="${e}" style="vertical-align: -7px" title="Cesium ion"/></a>`,!0)}return Tr._cesiumCreditInitialized||(Tr._cesiumCredit=ZH,Tr._cesiumCreditInitialized=!0),ZH}Object.defineProperties(Tr,{cesiumCredit:{get:function(){return Dxe(),Tr._cesiumCredit},set:function(e){Tr._cesiumCredit=e,Tr._cesiumCreditInitialized=!0}}});Tr.CreditDisplayElement=Sxe;var tB=Tr;var QH=0,$ht=1;function qT(e){T.typeOf.object("options",e),T.typeOf.object("options.frustum",e.frustum),T.typeOf.object("options.origin",e.origin),T.typeOf.object("options.orientation",e.orientation);let t=e.frustum,n=e.orientation,i=e.origin,o=e.vertexFormat??Ie.DEFAULT,r=e._drawNearPlane??!0,s,a;t instanceof Ci?(s=QH,a=Ci.packedLength):t instanceof on&&(s=$ht,a=on.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=Le.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+d.packedLength+Le.packedLength+Ie.packedLength}qT.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=n??0;let i=e._frustumType,o=e._frustum;return t[n++]=i,i===QH?(Ci.pack(o,t,n),n+=Ci.packedLength):(on.pack(o,t,n),n+=on.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,Le.pack(e._orientation,t,n),n+=Le.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n]=e._drawNearPlane?1:0,t};var Zht=new Ci,Qht=new on,Jht=new Le,emt=new d,tmt=new Ie;qT.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=e[t++],o;i===QH?(o=Ci.unpack(e,t,Zht),t+=Ci.packedLength):(o=on.unpack(e,t,Qht),t+=on.packedLength);let r=d.unpack(e,t,emt);t+=d.packedLength;let s=Le.unpack(e,t,Jht);t+=Le.packedLength;let a=Ie.unpack(e,t,tmt);t+=Ie.packedLength;let l=e[t]===1;if(!c(n))return new qT({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:l});let u=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(u),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=Le.clone(s,n._orientation),n._vertexFormat=Ie.clone(a,n._vertexFormat),n._drawNearPlane=l,n};function Aw(e,t,n,i,o,r,s,a){let l=e/3*2;for(let u=0;u<4;++u)c(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),c(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),c(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[l]=0,o[l+1]=0,o[l+2]=1,o[l+3]=0,o[l+4]=1,o[l+5]=1,o[l+6]=0,o[l+7]=1}var nmt=new J,imt=new B,EK=new B,Pxe=new d,Ixe=new d,Oxe=new d,omt=new d,rmt=new d,smt=new d,O0=new Array(3),nB=new Array(4);nB[0]=new se(-1,-1,1,1);nB[1]=new se(1,-1,1,1);nB[2]=new se(1,1,1,1);nB[3]=new se(-1,1,1,1);var Rxe=new Array(4);for(let e=0;e<4;++e)Rxe[e]=new se;qT._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){let l=J.fromQuaternion(t,nmt),u=r??Pxe,f=s??Ixe,h=a??Oxe;u=J.getColumn(l,0,u),f=J.getColumn(l,1,f),h=J.getColumn(l,2,h),d.normalize(u,u),d.normalize(f,f),d.normalize(h,h),d.negate(u,u);let p=B.computeView(e,h,f,u,imt),g,m,y=i.projectionMatrix;if(n===QH){let b=B.multiply(y,p,EK);m=B.inverse(b,EK)}else g=B.inverseTransformation(p,EK);c(m)?(O0[0]=i.near,O0[1]=i.far):(O0[0]=0,O0[1]=i.near,O0[2]=i.far);for(let b=0;b<2;++b)for(let x=0;x<4;++x){let A=se.clone(nB[x],Rxe[x]);if(c(m)){A=B.multiplyByVector(m,A,A);let C=1/A.w;d.multiplyByScalar(A,C,A),d.subtract(A,e,A),d.normalize(A,A);let S=d.dot(h,A);d.multiplyByScalar(A,O0[b]/S,A),d.add(A,e,A)}else{let C=i.offCenterFrustum;c(C)&&(i=C);let S=O0[b],v=O0[b+1];A.x=(A.x*(i.right-i.left)+i.left+i.right)*.5,A.y=(A.y*(i.top-i.bottom)+i.bottom+i.top)*.5,A.z=(A.z*(S-v)-S-v)*.5,A.w=1,B.multiplyByVector(g,A,A)}o[12*b+x*3]=A.x,o[12*b+x*3+1]=A.y,o[12*b+x*3+2]=A.z}};qT.createGeometry=function(e){let t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5,l=new Float64Array(3*4*6);qT._computeNearFarPlanes(i,o,t,n,l);let u=3*4*2;l[u]=l[3*4],l[u+1]=l[3*4+1],l[u+2]=l[3*4+2],l[u+3]=l[0],l[u+4]=l[1],l[u+5]=l[2],l[u+6]=l[3*3],l[u+7]=l[3*3+1],l[u+8]=l[3*3+2],l[u+9]=l[3*7],l[u+10]=l[3*7+1],l[u+11]=l[3*7+2],u+=3*4,l[u]=l[3*5],l[u+1]=l[3*5+1],l[u+2]=l[3*5+2],l[u+3]=l[3],l[u+4]=l[4],l[u+5]=l[5],l[u+6]=l[0],l[u+7]=l[1],l[u+8]=l[2],l[u+9]=l[3*4],l[u+10]=l[3*4+1],l[u+11]=l[3*4+2],u+=3*4,l[u]=l[3],l[u+1]=l[4],l[u+2]=l[5],l[u+3]=l[3*5],l[u+4]=l[3*5+1],l[u+5]=l[3*5+2],l[u+6]=l[3*6],l[u+7]=l[3*6+1],l[u+8]=l[3*6+2],l[u+9]=l[3*2],l[u+10]=l[3*2+1],l[u+11]=l[3*2+2],u+=3*4,l[u]=l[3*2],l[u+1]=l[3*2+1],l[u+2]=l[3*2+2],l[u+3]=l[3*6],l[u+4]=l[3*6+1],l[u+5]=l[3*6+2],l[u+6]=l[3*7],l[u+7]=l[3*7+1],l[u+8]=l[3*7+2],l[u+9]=l[3*3],l[u+10]=l[3*3+1],l[u+11]=l[3*3+2],r||(l=l.subarray(3*4));let f=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:l})});if(c(s.normal)||c(s.tangent)||c(s.bitangent)||c(s.st)){let p=c(s.normal)?new Float32Array(12*a):void 0,g=c(s.tangent)?new Float32Array(3*4*a):void 0,m=c(s.bitangent)?new Float32Array(3*4*a):void 0,y=c(s.st)?new Float32Array(2*4*a):void 0,b=Pxe,x=Ixe,A=Oxe,C=d.negate(b,omt),S=d.negate(x,rmt),v=d.negate(A,smt);u=0,r&&(Aw(u,p,g,m,y,v,b,x),u+=3*4),Aw(u,p,g,m,y,A,C,x),u+=3*4,Aw(u,p,g,m,y,C,v,x),u+=3*4,Aw(u,p,g,m,y,S,v,C),u+=3*4,Aw(u,p,g,m,y,b,A,x),u+=3*4,Aw(u,p,g,m,y,x,A,C),c(p)&&(f.normal=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:p})),c(g)&&(f.tangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:g})),c(m)&&(f.bitangent=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:m})),c(y)&&(f.st=new ve({componentDatatype:$.FLOAT,componentsPerAttribute:2,values:y}))}let h=new Uint16Array(6*a);for(let p=0;p<a;++p){let g=p*6,m=p*4;h[g]=m,h[g+1]=m+1,h[g+2]=m+2,h[g+3]=m,h[g+4]=m+2,h[g+5]=m+3}return new ct({attributes:f,indices:h,primitiveType:Me.TRIANGLES,boundingSphere:le.fromVertices(l)})};var YT=qT;var SK=0,amt=1;function iB(e){T.typeOf.object("options",e),T.typeOf.object("options.frustum",e.frustum),T.typeOf.object("options.origin",e.origin),T.typeOf.object("options.orientation",e.orientation);let t=e.frustum,n=e.orientation,i=e.origin,o=e._drawNearPlane??!0,r,s;t instanceof Ci?(r=SK,s=Ci.packedLength):t instanceof on&&(r=amt,s=on.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=Le.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+d.packedLength+Le.packedLength}iB.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=n??0;let i=e._frustumType,o=e._frustum;return t[n++]=i,i===SK?(Ci.pack(o,t,n),n+=Ci.packedLength):(on.pack(o,t,n),n+=on.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,Le.pack(e._orientation,t,n),n+=Le.packedLength,t[n]=e._drawNearPlane?1:0,t};var cmt=new Ci,lmt=new on,umt=new Le,fmt=new d;iB.unpack=function(e,t,n){T.defined("array",e),t=t??0;let i=e[t++],o;i===SK?(o=Ci.unpack(e,t,cmt),t+=Ci.packedLength):(o=on.unpack(e,t,lmt),t+=on.packedLength);let r=d.unpack(e,t,fmt);t+=d.packedLength;let s=Le.unpack(e,t,umt);t+=Le.packedLength;let a=e[t]===1;if(!c(n))return new iB({frustum:o,origin:r,orientation:s,_drawNearPlane:a});let l=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(l),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=Le.clone(s,n._orientation),n._drawNearPlane=a,n};iB.createGeometry=function(e){let t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(3*4*2);YT._computeNearFarPlanes(i,o,t,n,s);let a=new fn({position:new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:s})}),l,u,f=r?2:1,h=new Uint16Array(8*(f+1)),p=r?0:1;for(;p<2;++p)l=r?p*8:0,u=p*4,h[l]=u,h[l+1]=u+1,h[l+2]=u+1,h[l+3]=u+2,h[l+4]=u+2,h[l+5]=u+3,h[l+6]=u+3,h[l+7]=u;for(p=0;p<2;++p)l=(f+p)*8,u=p*4,h[l]=u,h[l+1]=u+4,h[l+2]=u+1,h[l+3]=u+5,h[l+4]=u+2,h[l+5]=u+6,h[l+6]=u+3,h[l+7]=u+7;return new ct({attributes:a,indices:h,primitiveType:Me.LINES,boundingSphere:le.fromVertices(s)})};var oB=iB;function JH(e){if(e=e??W.EMPTY_OBJECT,!c(e.camera))throw new E("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=e.color??G.CYAN,this._updateOnChange=e.updateOnChange??!0,this.show=e.show??!0,this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}var dmt=new d,hmt=new J,mmt=new Le,pmt=new Ci,_mt=new bl,gmt=new on,ymt=new jo,bmt=new G,xmt=[1,1e5];JH.prototype.update=function(e){if(!this.show)return;let t=this._planesPrimitives,n=this._outlinePrimitives,i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(t.length===0){let r=this._camera,s=r.frustum,a;s instanceof Ci?a=pmt:s instanceof bl?a=_mt:s instanceof on?a=gmt:a=ymt,a=s.clone(a);let l,u=this._frustumSplits;!c(u)||u.length<=1?(u=xmt,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,l=1):l=u.length-1;let f=r.positionWC,h=r.directionWC,p=r.upWC,g=r.rightWC;g=d.negate(g,dmt);let m=hmt;J.setColumn(m,0,g,m),J.setColumn(m,1,p,m),J.setColumn(m,2,h,m);let y=Le.fromRotationMatrix(m,mmt);for(t.length=n.length=l,i=0;i<l;++i)a.near=u[i],a.far=u[i+1],t[i]=new Pn({geometryInstances:new St({geometry:new YT({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:Gt.fromColor(G.fromAlpha(this._color,.1,bmt))},id:this.id,pickPrimitive:this}),appearance:new rn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Pn({geometryInstances:new St({geometry:new oB({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:Gt.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};JH.prototype.isDestroyed=function(){return!1};JH.prototype.destroy=function(){let e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return de(this)};var sp=JH;function sB(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=e??0}var rB=Vt.supportsTypedArrays()?new Float32Array(12):[],Mxe=new d,Lxe=new d,wK=new d,Nxe=new d,eG=new d;function Tmt(e,t){let n=e.radii,i=t.camera,o,r,s;if(i.frustum instanceof on)o=d.ZERO,r=i.rightWC,s=i.upWC;else{let h=i.positionWC,p=d.multiplyComponents(e.oneOverRadii,h,Mxe),g=d.normalize(p,Lxe),m=d.normalize(d.cross(d.UNIT_Z,p,wK),wK),y=d.normalize(d.cross(g,m,Nxe),Nxe),b=d.magnitude(p),x=Math.sqrt(b*b-1);o=d.multiplyByScalar(g,1/b,Mxe);let A=x/b;r=d.multiplyByScalar(m,A,Lxe),s=d.multiplyByScalar(y,A,wK)}let a=d.add(o,s,eG);d.subtract(a,r,a),d.multiplyComponents(n,a,a),d.pack(a,rB,0);let l=d.subtract(o,s,eG);d.subtract(l,r,l),d.multiplyComponents(n,l,l),d.pack(l,rB,3);let u=d.add(o,s,eG);d.add(u,r,u),d.multiplyComponents(n,u,u),d.pack(u,rB,6);let f=d.subtract(o,s,eG);return d.add(f,r,f),d.multiplyComponents(n,f,f),d.pack(f,rB,9),rB}sB.prototype.update=function(e){if(this._mode=e.mode,e.mode!==oe.SCENE3D)return;let t=e.context,n=e.mapProjection.ellipsoid.radii,i=new ie(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(c(this._command)||(this._rs=Ve.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new Qe({renderState:this._rs,boundingVolume:new le(d.ZERO,i.maximumRadius),pass:De.OPAQUE,owner:this})),!c(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;let s=new He({sources:[t2]}),a=new He({sources:[e2]});o&&(a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}let r=Tmt(i,e);if(c(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{let s=new ct({attributes:{position:new ve({componentDatatype:$.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:Me.TRIANGLES});this._va=ti.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:Be.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};sB.prototype.execute=function(e,t){this._mode===oe.SCENE3D&&this._command.execute(e,t)};sB.prototype.isDestroyed=function(){return!1};sB.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var aB=sB;function Ew(){}var Amt=/\bgl_FragDepth\b/,Cmt=/\bdiscard\b/;function Emt(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(c(n))return n;let i=t.fragmentShaderSource,o=!1,r=i.sources;for(let a=0;a<r.length;++a)if(Amt.test(r[a])||Cmt.test(r[a])){o=!0;break}let s=i.defines.indexOf("LOG_DEPTH")>=0;if(!o&&!s){let a=`void main()
{
    out_FragColor = vec4(1.0);
}
`;i=new He({sources:[a]})}else if(!o&&s){let a=`void main()
{
    out_FragColor = vec4(1.0);
    czm_writeLogDepth();
}
`;i=new He({defines:["LOG_DEPTH"],sources:[a]})}return e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}function Smt(e,t){let n=e._depthOnlyRenderStateCache,i=n[t.id];if(c(i))return i;let o=Ve.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1};let r=Ve.fromCache(o);return n[t.id]=r,r}Ew.createDepthOnlyDerivedCommand=function(e,t,n,i){c(i)||(i={});let o=i.depthOnlyCommand?.shaderProgram,r=i.depthOnlyCommand?.renderState;return i.depthOnlyCommand=Qe.shallowClone(t,i.depthOnlyCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=Emt(n,t.shaderProgram),i.depthOnlyCommand.renderState=Smt(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};var wmt=/\s+czm_writeLogDepth\(/,vmt=/\s+czm_vertexLogDepth\(/;function Dmt(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(c(i))return i;let o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=c(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a=!1,l=r.sources;for(let f=0;f<l.length;++f)if(vmt.test(l[f])){a=!0;break}if(!a){for(let h=0;h<l.length;++h)l[h]=He.replaceMain(l[h],"czm_log_depth_main");l.push(`

void main()
{
    czm_log_depth_main();
    czm_vertexLogDepth();
}
`)}l=s.sources,a=!1;for(let f=0;f<l.length;++f)wmt.test(l[f])&&(a=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(a=!0);let u="";if(!a){for(let f=0;f<l.length;f++)l[f]=He.replaceMain(l[f],"czm_log_depth_main");u=`
void main()
{
    czm_log_depth_main();
    czm_writeLogDepth();
}
`}return l.push(u),e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}Ew.createLogDepthCommand=function(e,t,n){c(n)||(n={});let i=n.command?.shaderProgram;return n.command=Qe.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=Dmt(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function Pmt(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(c(i))return i;let o=t._attributeLocations,{sources:r,defines:s}=t.fragmentShaderSource,l=r.some(g=>g.includes("out_FragData"))?"out_FragData_0":"out_FragColor",u=`void main () 
{ 
    czm_non_pick_main(); 
    if (${l}.a == 0.0) { 
        discard; 
    } 
    ${l} = ${n}; 
} `,f=r.length,h=new Array(f+1);for(let g=0;g<f;++g)h[g]=He.replaceMain(r[g],"czm_non_pick_main");h[f]=u;let p=new He({sources:h,defines:s});return e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:p,attributeLocations:o})}function Fxe(e,t){let n=e.picking.pickRenderStateCache,i=n[t.id];if(c(i))return i;let o=Ve.getState(t);o.blending.enabled=!1,o.depthMask=!0;let r=Ve.fromCache(o);return n[t.id]=r,r}Ew.createPickDerivedCommand=function(e,t,n,i){c(i)||(i={});let o=i.pickCommand?.shaderProgram,r=i.pickCommand?.renderState;return i.pickCommand=Qe.shallowClone(t,i.pickCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=Pmt(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=Fxe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function Cw(e,t,n){let i=e.length;for(let o=0;o<i;o++)e[o].trimStart().split(/\s+/)[0]===t&&(e[o]=`${t} ${n}`)}function Bxe(e){return e.isArray?e.arrayLength:at.getComponentCount(e.type)}function Imt(e){let t=Bxe(e);return e.normalized?t===1?"float":`vec${t}`:t===1?"int":`ivec${t}`}function kxe(e,t,n){return`((${e} - float(${t})) / float(${n}))`}function Uxe(e,t){let n=Nt.getMaximum(t);return`(${e}) / float(${n})`}function Omt(e,t){let n="float(value)";if(t.hasValueTransform){let i=t.offset,o=t.scale;n=kxe(n,i,o)}return e.normalized||(n=Uxe(n,e.componentType)),n}function Rmt(e,t,n){let o=`float(${`value.${n}`})`;if(t.hasValueTransform){let r=t.offset[n],s=t.scale[n];o=kxe(o,r,s)}return e.normalized||(o=Uxe(o,e.componentType)),o}function Mmt(e,t,n){let i=n.schemaId,o=n.className,r=n.propertyName,s=`pickMetadata-${i}-${o}-${r}`,a=e.shaderCache.getDerivedShaderProgram(t,s);if(c(a))return a;let l=n.metadataProperty,u=n.classProperty,f=Imt(u),h=["0.0","0.0","0.0","0.0"],p=Bxe(u);if(p===1)h[0]=Omt(u,l);else{let b=["x","y","z","w"];for(let x=0;x<p;x++)h[x]=Rmt(u,l,b[x])}let g=t.fragmentShaderSource.defines.slice();g.push(Pu.METADATA_PICKING_ENABLED),Cw(g,Pu.METADATA_PICKING_VALUE_TYPE,f),Cw(g,Pu.METADATA_PICKING_VALUE_STRING,`metadata.${r}`),Cw(g,Pu.METADATA_PICKING_VALUE_COMPONENT_X,h[0]),Cw(g,Pu.METADATA_PICKING_VALUE_COMPONENT_Y,h[1]),Cw(g,Pu.METADATA_PICKING_VALUE_COMPONENT_Z,h[2]),Cw(g,Pu.METADATA_PICKING_VALUE_COMPONENT_W,h[3]);let m=new He({sources:t.fragmentShaderSource.sources,defines:g});return e.shaderCache.createDerivedShaderProgram(t,s,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:m,attributeLocations:t._attributeLocations})}Ew.createPickMetadataDerivedCommand=function(e,t,n,i){return c(i)||(i={}),i.pickMetadataCommand=Qe.shallowClone(t,i.pickMetadataCommand),i.pickMetadataCommand.shaderProgram=Mmt(n,t.shaderProgram,t.pickedMetadataInfo),i.pickMetadataCommand.renderState=Fxe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id,i};function Lmt(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(c(n))return n;let i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();return o.defines=c(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}Ew.createHdrCommand=function(e,t,n){c(n)||(n={});let i=n.command?.shaderProgram;return n.command=Qe.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=Lmt(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};var ap=Ew;function tG(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;let t=this;function n(i){let o=i.alpha;if(!c(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=O.toRadians(o),t._beta=O.toRadians(i.beta),t._gamma=O.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}var Nmt=new Le,Vxe=new Le,Fmt=new J;function Bmt(e,t,n,i){let o=e.direction,r=e.right,s=e.up,a=Le.fromAxisAngle(o,n,Vxe),l=Le.fromAxisAngle(r,i,Nmt),u=Le.multiply(l,a,l),f=Le.fromAxisAngle(s,t,Vxe);Le.multiply(f,u,u);let h=J.fromQuaternion(u,Fmt);J.multiplyByVector(h,r,r),J.multiplyByVector(h,s,s),J.multiplyByVector(h,o,o)}tG.prototype.update=function(){if(!c(this._alpha))return;c(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);let e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;Bmt(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};tG.prototype.isDestroyed=function(){return!1};tG.prototype.destroy=function(){return this._removeListener(),de(this)};var cB=tG;function vK(){this.enabled=!0,this.renderable=!0,this.density=6e-4,this.heightScalar=.001,this._heightFalloff=.59,this.maxHeight=8e5,this.visualDensityScalar=.15,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}Object.defineProperties(vK.prototype,{heightFalloff:{get:function(){return this._heightFalloff},set:function(e){if(c(e)&&e<0)throw new E("value must be positive.");this._heightFalloff=e}}});var kmt=new d;vK.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;let n=e.camera,i=n.positionCartographic;if(!c(i)||i.height>this.maxHeight||e.mode!==oe.SCENE3D){e.fog.enabled=!1,e.fog.density=0;return}let o=i.height,r=this.density*this.heightScalar*Math.pow(Math.max(o/this.maxHeight,O.EPSILON4),-Math.max(this._heightFalloff,0)),s=d.normalize(n.positionWC,kmt),a=Math.abs(d.dot(n.directionWC,s));r*=1-a,e.fog.density=r,e.fog.visualDensityScalar=this.visualDensityScalar,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};var lB=vK;function Umt(e,t,n){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=oe.SCENE3D,this.morphTime=oe.getMorphTime(oe.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=n,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,pickVoxel:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,renderable:!1,density:void 0,visualDensityScalar:void 0,sse:void 0,minimumBrightness:void 0},this.atmosphere=void 0,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0,this.pickingMetadata=!1,this.pickedMetadataInfo=void 0}var uB=Umt;var Sa={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},XT=Sa.DERIVED_COMMANDS_MAXIMUM_LENGTH,$xe=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function KT(){this._frontFaceAlphaByDistance=new Bt(0,1,0,1),this._backFaceAlphaByDistance=new Bt(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=ce.clone(ce.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(XT),this._derivedBlendCommandTypes=new Array(XT),this._derivedPickCommandTypes=new Array(XT),this._derivedCommandTypesToUpdate=new Array(XT),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(KT.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}});KT.prototype.update=function(e){let t=e.globe;if(!c(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=zxe(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=zxe(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=Hxe(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=Hxe(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=Gmt(this,e,t),this._sunVisibleThroughGlobe=Vmt(this,e),this._environmentVisible=zmt(this,e),this._useDepthPlane=Hmt(this,e),this._numberOfTextureUniforms=jmt(this),this._rectangle=ce.clone(t.translucency.rectangle,this._rectangle),Wmt(this,e)};function zxe(e,t,n,i){return e?c(n)?(Bt.clone(n,i),i.nearValue*=t,i.farValue*=t,i):(i.nearValue=t,i.farValue=t,i):(i.nearValue=1,i.farValue=1,i)}function Hxe(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function Vmt(e,t){let n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function zmt(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function Hmt(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function Gmt(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==oe.SCENE2D&&t.context.depthTexture}function jmt(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function Wmt(e,t){e._derivedCommandsLength=DK(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=DK(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=DK(e,t,!1,!0,e._derivedPickCommandTypes);let n,i=0;for(n=0;n<e._derivedCommandsLength;++n)i|=1<<e._derivedCommandTypes[n];for(n=0;n<e._derivedBlendCommandsLength;++n)i|=1<<e._derivedBlendCommandTypes[n];for(n=0;n<e._derivedPickCommandsLength;++n)i|=1<<e._derivedPickCommandTypes[n];let o=0;for(n=0;n<XT;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;let r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!c(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=spt())}function DK(e,t,n,i,o){let r=0,s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;let l=t.cameraUnderground,u=e._requiresManualDepthTest,f=i?Sa.PICK_FRONT_FACE:u?Sa.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:Sa.TRANSLUCENT_FRONT_FACE,h=i?Sa.PICK_BACK_FACE:u?Sa.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:Sa.TRANSLUCENT_BACK_FACE;return t.mode===oe.SCENE2D?(o[r++]=Sa.DEPTH_ONLY_FRONT_FACE,o[r++]=f,r):(a?(n||(o[r++]=Sa.DEPTH_ONLY_FRONT_AND_BACK_FACE),l?(o[r++]=f,o[r++]=h):(o[r++]=h,o[r++]=f)):l?(n||(o[r++]=Sa.DEPTH_ONLY_BACK_FACE),o[r++]=Sa.OPAQUE_FRONT_FACE,o[r++]=h):(n||(o[r++]=Sa.DEPTH_ONLY_FRONT_FACE),o[r++]=Sa.OPAQUE_BACK_FACE,o[r++]=f),r)}function yd(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}function Gxe(e,t){return e.indexOf(t)>-1}function qmt(e,t){yd(e.defines,"TRANSLUCENT"),yd(t.defines,"TRANSLUCENT")}function Ymt(e,t){yd(e.defines,"GROUND_ATMOSPHERE"),yd(t.defines,"GROUND_ATMOSPHERE"),yd(e.defines,"FOG"),yd(t.defines,"FOG"),yd(e.defines,"TRANSLUCENT"),yd(t.defines,"TRANSLUCENT")}function PK(e,t){if(Gxe(t.defines,"TILE_LIMIT_RECTANGLE")||Gxe(t.defines,"ENABLE_CLIPPING_PLANES"))return;let n=`void main() 
{ 
    out_FragColor = vec4(1.0); 
} 
`;t.sources=[n]}function IK(e,t){let n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=He.replaceMain(n[r],"czm_globe_translucency_main");n.push(`

uniform sampler2D u_classificationTexture; 
void main() 
{ 
    vec2 st = gl_FragCoord.xy / czm_viewport.zw; 
#ifdef MANUAL_DEPTH_TEST 
    float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st)); 
    if (logDepthOrDepth != 0.0) 
    { 
        vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); 
        float depthEC = eyeCoordinate.z / eyeCoordinate.w; 
        if (v_positionEC.z < depthEC) 
        { 
            discard; 
        } 
    } 
#endif 
    czm_globe_translucency_main(); 
    vec4 classificationColor = texture(u_classificationTexture, st); 
    if (classificationColor.a > 0.0) 
    { 
        // Reverse premultiplication process to get the correct composited result of the classification primitives 
        classificationColor.rgb /= classificationColor.a; 
    } 
    out_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + out_FragColor * (1.0 - classificationColor.a); 
} 
`)}function Zxe(e,t){IK(e,t),yd(e.defines,"GROUND_ATMOSPHERE"),yd(t.defines,"GROUND_ATMOSPHERE"),yd(e.defines,"FOG"),yd(t.defines,"FOG")}function Xmt(e,t){IK(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Kmt(e,t){Zxe(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function jxe(e,t){let n=`uniform sampler2D u_classificationTexture; 
void main() 
{ 
    vec2 st = gl_FragCoord.xy / czm_viewport.zw; 
    vec4 pickColor = texture(u_classificationTexture, st); 
    if (pickColor == vec4(0.0)) 
    { 
        discard; 
    } 
    out_FragColor = pickColor; 
} 
`;t.sources=[n]}function $mt(e,t,n,i,o,r){if(!c(o))return t;if(!i&&c(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!c(s)){let a=t._attributeLocations,l=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();l.defines=c(l.defines)?l.defines.slice(0):[],u.defines=c(u.defines)?u.defines.slice(0):[],o(l,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:a})}return s}function Zmt(e){e.cull.face=xi.BACK,e.cull.enabled=!0}function Qmt(e){e.cull.face=xi.FRONT,e.cull.enabled=!0}function Jmt(e){e.cull.face=xi.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function ept(e){e.cull.face=xi.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function tpt(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Wxe(e){e.cull.face=xi.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=ln.ALPHA_BLEND}function qxe(e){e.cull.face=xi.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=ln.ALPHA_BLEND}function npt(e){e.cull.face=xi.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function ipt(e){e.cull.face=xi.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function opt(e,t,n,i,o){if(!c(i))return e;if(!n&&c(t))return t;let r=o[e.id];if(!c(r)){let s=Ve.getState(e);i(s),r=Ve.fromCache(s),o[e.id]=r}return r}function Sw(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function rpt(e,t,n,i,o){return c(o)?!i&&c(n)?n:xt(t,o(e),!1):t}function jh(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function spt(){return[new jh({pass:De.GLOBE,pickOnly:!1,getShaderProgramFunction:qmt,getRenderStateFunction:Zmt,getUniformMapFunction:void 0}),new jh({pass:De.GLOBE,pickOnly:!1,getShaderProgramFunction:Ymt,getRenderStateFunction:Qmt,getUniformMapFunction:void 0}),new jh({pass:De.GLOBE,pickOnly:!1,getShaderProgramFunction:PK,getRenderStateFunction:Jmt,getUniformMapFunction:void 0}),new jh({pass:De.GLOBE,pickOnly:!1,getShaderProgramFunction:PK,getRenderStateFunction:ept,getUniformMapFunction:void 0}),new jh({pass:De.GLOBE,pickOnly:!1,getShaderProgramFunction:PK,getRenderStateFunction:tpt,getUniformMapFunction:void 0}),new jh({pass:De.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:IK,getRenderStateFunction:Wxe,getUniformMapFunction:Sw}),new jh({pass:De.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Zxe,getRenderStateFunction:qxe,getUniformMapFunction:Sw}),new jh({pass:De.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Xmt,getRenderStateFunction:Wxe,getUniformMapFunction:Sw}),new jh({pass:De.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Kmt,getRenderStateFunction:qxe,getUniformMapFunction:Sw}),new jh({pass:De.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:jxe,getRenderStateFunction:npt,getUniformMapFunction:Sw}),new jh({pass:De.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:jxe,getRenderStateFunction:ipt,getUniformMapFunction:Sw})]}var Yxe=new Array(XT),Xxe=new Array(XT);KT.prototype.updateDerivedCommands=function(e,t){let n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)Xxe[o]=this._derivedCommandPacks[n[o]],Yxe[o]=$xe[n[o]];apt(this,e,i,n,Yxe,Xxe,t)}};function apt(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency,l=e._derivedCommandsDirty;if(t.dirty||!c(a)||l){t.dirty=!1,c(a)||(a={},t.derivedCommands.globeTranslucency=a);let u=s.frameNumber,f=a.uniformMapDirtyFrame??0,h=a.shaderProgramDirtyFrame??0,p=a.renderStateDirtyFrame??0,g=a.uniformMap!==t.uniformMap,m=a.shaderProgramId!==t.shaderProgram.id,y=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=u),m&&(a.shaderProgramDirtyFrame=u),y&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let b=0;b<n;++b){let x=r[b],A=i[b],C=o[b],S=a[C],v,P,M;c(S)?(v=S.uniformMap,P=S.shaderProgram,M=S.renderState):(v=void 0,P=void 0,M=void 0),S=Qe.shallowClone(t,S),a[C]=S;let R=S.derivedCommands.uniformMapDirtyFrame??0,L=S.derivedCommands.shaderProgramDirtyFrame??0,F=S.derivedCommands.renderStateDirtyFrame??0,_=g||R<f,w=m||L<h,D=y||F<p;_&&(S.derivedCommands.uniformMapDirtyFrame=u),w&&(S.derivedCommands.shaderProgramDirtyFrame=u),D&&(S.derivedCommands.renderStateDirtyFrame=u),S.derivedCommands.type=A,S.pass=x.pass,S.pickOnly=x.pickOnly,S.uniformMap=rpt(e,t.uniformMap,v,_,x.getUniformMapFunction),S.shaderProgram=$mt(s.context,t.shaderProgram,P,w,x.getShaderProgramFunction,C),S.renderState=opt(t.renderState,M,D,x.getRenderStateFunction,x.renderStateCache)}}}KT.prototype.pushDerivedCommands=function(e,t,n){let i=n.passes.pick||n.passes.pickVoxel;if(i&&t)return;let o=this._derivedCommandTypes,r=this._derivedCommandsLength;if(i?(o=this._derivedPickCommandTypes,r=this._derivedPickCommandsLength):t&&(o=this._derivedBlendCommandTypes,r=this._derivedBlendCommandsLength),r===0){n.commandList.push(e);return}let s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){let l=$xe[o[a]];n.commandList.push(s[l])}};function Qxe(e,t,n,i,o,r){for(let s=0;s<t;++s){let a=e[s],l=a.derivedCommands.type;(!c(r)||r.indexOf(l)>-1)&&n(a,i,o)}}function Kxe(e,t,n,i,o){for(let r=0;r<t;++r)n(e[r],i,o)}var cpt=[Sa.OPAQUE_FRONT_FACE,Sa.OPAQUE_BACK_FACE],lpt=[Sa.DEPTH_ONLY_FRONT_FACE,Sa.DEPTH_ONLY_BACK_FACE,Sa.DEPTH_ONLY_FRONT_AND_BACK_FACE];KT.prototype.executeGlobeCommands=function(e,t,n,i,o){let r=i.context,s=e.commands[De.GLOBE],a=e.indices[De.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),Qxe(s,a,t,i,o,cpt))};KT.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){let{context:r}=i,{uniformState:s}=r,a=e.commands[De.GLOBE],l=e.indices[De.GLOBE],u=e.commands[De.TERRAIN_CLASSIFICATION],f=e.indices[De.TERRAIN_CLASSIFICATION];if(l===0||f===0)return;let h=this._frontFaceTranslucent,p=this._backFaceTranslucent;if((!h||!p)&&Kxe(u,f,t,i,o),!h&&!p)return;this._globeTranslucencyFramebuffer=n;let g=s.globeDepthTexture,m=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,Qxe(a,l,t,i,o,lpt),r.depthTexture){let y=n.packDepth(r,o);s.globeDepthTexture=y}Kxe(u,f,t,i,o),s.globeDepthTexture=g,o.framebuffer=m};var fB=KT;var su=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = texture(colorTexture, v_textureCoordinates);
}
`;function cp(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new hi({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new hi({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new ei({color:new G(0,0,0,0),owner:this}),this._clearCommand=new ei({color:new G(0,0,0,0),depth:1,stencil:0});let e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(cp.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});cp.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};var upt={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Vn.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:Vn.NEVER,reference:0,mask:kt.CLASSIFICATION_MASK},blending:ln.ALPHA_BLEND},fpt={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Vn.NOT_EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:Vn.NEVER,reference:0,mask:kt.CLASSIFICATION_MASK},blending:ln.ALPHA_BLEND},dpt={depthMask:!0,depthTest:{enabled:!0},stencilTest:kt.setCesium3DTileBit(),stencilMask:kt.CESIUM_3D_TILE_MASK,blending:ln.ALPHA_BLEND},hpt=`uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform sampler2D classifiedTexture;
in vec2 v_textureCoordinates;
void main()
{
    vec4 color = texture(colorTexture, v_textureCoordinates);
    if (color.a == 0.0)
    {
        discard;
    }
    bool isClassified = all(equal(texture(classifiedTexture, v_textureCoordinates), vec4(0.0)));
#ifdef UNCLASSIFIED
    vec4 highlightColor = czm_invertClassificationColor;
    if (isClassified)
    {
        discard;
    }
#else
    vec4 highlightColor = vec4(1.0);
    if (!isClassified)
    {
        discard;
    }
#endif
    out_FragColor = color * highlightColor;
    gl_FragDepth = texture(depthTexture, v_textureCoordinates).r;
}
`,mpt=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
void main()
{
    vec4 color = texture(colorTexture, v_textureCoordinates);
    if (color.a == 0.0)
    {
        discard;
    }
#ifdef UNCLASSIFIED
    out_FragColor = color * czm_invertClassificationColor;
#else
    out_FragColor = color;
#endif
}
`;cp.prototype.update=function(e,t,n){let i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;let r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,l=!c(i)||i.width!==s||i.height!==a;if((l||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._previousFramebuffer)||(this._depthStencilTexture=new Rt({context:e,width:s,height:a,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new _u({context:e,width:s,height:a,format:uc.DEPTH24_STENCIL8,numSamples:t})))),!c(this._fbo.framebuffer)||l||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,f;c(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),f=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,f=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),c(f)&&this._fbo.setDepthStencilRenderbuffer(f),this._fbo.update(e,s,a,t),c(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(c(this._rsUnclassified)||(this._rsUnclassified=Ve.fromCache(upt),this._rsClassified=Ve.fromCache(fpt),this._rsDefault=Ve.fromCache(dpt)),!c(this._unclassifiedCommand)||o||r){c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());let u=c(this._previousFramebuffer)?mpt:hpt,f=new He({defines:["UNCLASSIFIED"],sources:[u]}),h=new He({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(f,{renderState:c(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(h,{renderState:c(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),c(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),c(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(su,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};cp.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};cp.prototype.clear=function(e,t){c(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};cp.prototype.executeClassified=function(e,t){if(!c(this._previousFramebuffer)){let n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)};cp.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};cp.prototype.isDestroyed=function(){return!1};cp.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),de(this)};var ww=cp;function nG(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(nG.prototype,{total:{get:function(){return this._total}}});function R0(e){if(c(e)&&e.length!==pa.NUMBER_OF_JOB_TYPES)throw new E("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");let t=new Array(pa.NUMBER_OF_JOB_TYPES);t[pa.TEXTURE]=new nG(c(e)?e[pa.TEXTURE]:10),t[pa.PROGRAM]=new nG(c(e)?e[pa.PROGRAM]:10),t[pa.BUFFER]=new nG(c(e)?e[pa.BUFFER]:30);let n=t.length,i,o=0;for(i=0;i<n;++i)o+=t[i].total;let r=new Array(n);for(i=0;i<n;++i)r[i]=!1;this._totalBudget=o,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=r}R0.getTimestamp=Ti;Object.defineProperties(R0.prototype,{totalBudget:{get:function(){return this._totalBudget}}});R0.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};R0.prototype.resetBudgets=function(){let e=this._budgets,t=e.length;for(let n=0;n<t;++n){let i=e[n];i.starvedLastFrame=i.starvedThisFrame,i.starvedThisFrame=!1,i.usedThisFrame=0,i.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0};R0.prototype.execute=function(e,t){let n=this._budgets,i=n[t],o=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&o)return i.starvedThisFrame=!0,!1;let r;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){let l=n.length,u;for(u=0;u<l&&(r=n[u],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++u);if(u===l&&o)return!1;o&&(i.starvedThisFrame=!0)}let s=R0.getTimestamp();e.execute();let a=R0.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};var dB=R0;function iG(e){e=e??W.EMPTY_OBJECT;let t=In(e.container);if(!c(t))throw new E("container is required");this._container=t;let n=document.createElement("div");n.className="cesium-performanceDisplay";let i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);let o=document.createElement("div");o.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),o.appendChild(this._msText),n.appendChild(o),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=Ti(),this._lastMsSampleTime=Ti(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;let r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}Object.defineProperties(iG.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});iG.prototype.update=function(e){let t=Ti(),n=e??!0;this._fpsFrameCount++;let i=t-this._lastFpsSampleTime;if(i>1e3){let r="N/A";n&&(r=this._fpsFrameCount*1e3/i|0),this._fpsText.nodeValue=`${r} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;let o=t-this._lastMsSampleTime;if(o>200){let r="N/A";n&&(r=(o/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${r} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}};iG.prototype.destroy=function(){return de(this)};var yg=iG;var wa={};wa.decodeRawMetadataValue=function(e,t,n){switch(e){case Nt.INT8:return t.getInt8(n);case Nt.UINT8:return t.getUint8(n);case Nt.INT16:return t.getInt16(n,!0);case Nt.UINT16:return t.getUint16(n,!0);case Nt.INT32:return t.getInt32(n,!0);case Nt.UINT32:return t.getUint32(n,!0);case Nt.INT64:return t.getBigInt64(n,!0);case Nt.UINT64:return t.getBigUint64(n,!0);case Nt.FLOAT32:return t.getFloat32(n,!0);case Nt.FLOAT64:return t.getFloat64(n,!0)}throw new ae(`Invalid component type: ${e}`)};wa.decodeRawMetadataValueComponent=function(e,t,n){let i=e.componentType,o=wa.decodeRawMetadataValue(i,t,n);return e.normalized?Nt.normalize(o,i):o};wa.decodeRawMetadataValueElement=function(e,t,n){let i=e.componentType,o=Nt.getSizeInBytes(i),r=e.type,s=at.getComponentCount(r),a=o*s;if(s>1){let f=Array(s);for(let h=0;h<s;h++){let p=n*a+h*o,g=wa.decodeRawMetadataValueComponent(e,t,p);f[h]=g}return f}let l=n*a;return wa.decodeRawMetadataValueComponent(e,t,l)};wa.decodeRawMetadataValues=function(e,t){let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.isArray){let o=e.arrayLength,r=Array(o);for(let s=0;s<o;s++){let a=wa.decodeRawMetadataValueElement(e,n,s);r[s]=a}return r}return wa.decodeRawMetadataValueElement(e,n,0)};wa.convertToObjectType=function(e,t){if(!c(t)||e===at.SCALAR||e===at.STRING||e===at.BOOLEAN||e===at.ENUM)return t;let n=t.map(i=>Number(i));switch(e){case at.VEC2:return H.unpack(n,0,new H);case at.VEC3:return d.unpack(n,0,new d);case at.VEC4:return se.unpack(n,0,new se);case at.MAT2:return Ri.unpack(n,0,new Ri);case at.MAT3:return J.unpack(n,0,new J);case at.MAT4:return B.unpack(n,0,new B)}throw new ae(`Invalid metadata object type: ${e}`)};wa.convertFromObjectType=function(e,t){if(!c(t)||e===at.SCALAR||e===at.STRING||e===at.BOOLEAN||e===at.ENUM)return t;switch(e){case at.VEC2:return H.pack(t,Array(2));case at.VEC3:return d.pack(t,Array(3));case at.VEC4:return se.pack(t,Array(4));case at.MAT2:return Ri.pack(t,Array(4));case at.MAT3:return J.pack(t,Array(9));case at.MAT4:return B.pack(t,Array(16))}throw new ae(`Invalid metadata object type: ${e}`)};wa.decodeMetadataValues=function(e,t,n){let i=wa.decodeRawMetadataValues(e,n);if(t.hasValueTransform){let r=wa.convertFromObjectType(e.type,t.offset),s=wa.convertFromObjectType(e.type,t.scale);i=Tm.valueTransformInPlace(i,r,s,Nt.applyValueTransform)}if(e.isArray){let r=e.arrayLength,s=Array(r);for(let a=0;a<r;a++){let l=i[a],u=wa.convertToObjectType(e.type,l);s[a]=u}return s}return wa.convertToObjectType(e.type,i)};var hB=Object.freeze(wa);function $T(){this._framebuffer=new hi,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties($T.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function ppt(e,t,n){let{width:i,height:o}=n;e._framebuffer.update(t,i,o)}function _pt(e,t,n){c(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(`uniform highp sampler2D colorTexture;

in vec2 v_textureCoordinates;

void main()
{
  vec4 globeDepthPacked = texture(czm_globeDepthTexture, v_textureCoordinates);
  float globeDepth = czm_unpackDepth(globeDepthPacked);
  float depth = texture(colorTexture, v_textureCoordinates).r;
  out_FragColor = czm_branchFreeTernary(globeDepth <= 0.0 || globeDepth >= 1.0 || depth < globeDepth && depth > 0.0 && depth < 1.0,
    czm_packDepth(depth), globeDepthPacked);
}
`,{renderState:Ve.fromCache(),uniformMap:{colorTexture:function(){return e._textureToCopy}},owner:e})),e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}$T.prototype.update=function(e,t){ppt(this,e,t),_pt(this,e,t)};var gpt=new se,ypt=new se(1,1/255,1/65025,1/16581375);$T.prototype.getDepth=function(e,t,n){if(!c(this.framebuffer))return;let i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=se.unpack(i,0,gpt);return se.divideByScalar(o,255,o),se.dot(o,ypt)};$T.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};$T.prototype.isDestroyed=function(){return!1};$T.prototype.destroy=function(){return this._framebuffer.destroy(),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=c(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),de(this)};var mB=$T;function bpt(e,t){this.near=e??0,this.far=t??0;let n=De.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}var pB=bpt;var M0=`uniform highp sampler2D u_depthTexture;
in vec2 v_textureCoordinates;
void main()
{
out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r);
}
`;function lp(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new hi,this._tempCopyDepthFramebuffer=new hi,this._updateDepthFramebuffer=new hi({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new Ke,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}Object.defineProperties(lp.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}});function Jxe(e,t,n,i,o){let r=e._viewport;r.width=n,r.height=i;let s=!Ke.equals(r,o.viewport),a=s!==e._useScissorTest;e._useScissorTest=s,Ke.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ke.clone(o.viewport,e._scissorRectangle),a=!0),(!c(e._rs)||!Ke.equals(r,e._rs.viewport)||a)&&(e._rs=Ve.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Ve.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:ln.ALPHA_BLEND}),e._rsUpdate=Ve.fromCache({viewport:r,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Vn.EQUAL,frontOperation:{fail:ft.KEEP,zFail:ft.KEEP,zPass:ft.KEEP},backFunction:Vn.NEVER,reference:kt.CESIUM_3D_TILE_MASK,mask:kt.CESIUM_3D_TILE_MASK}})),c(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(M0,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,c(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(su,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,c(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(M0,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,c(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(su,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,c(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ei({color:new G(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}lp.prototype.update=function(e,t,n,i,o,r){let{width:s,height:a}=n,l=o?e.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT:Ue.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,l),this._copyDepthFramebuffer.update(e,s,a),Jxe(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._clearGlobeDepth=r};lp.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};lp.prototype.executeCopyDepth=function(e,t){c(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};lp.prototype.executeUpdateDepth=function(e,t,n){let i=c(n)?n:t.framebuffer.depthStencilTexture;if(!this._clearGlobeDepth&&i===this.colorFramebufferManager.getDepthStencilTexture()){c(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t);return}if(!c(this._updateDepthCommand))return;let o=this._updateDepthFramebuffer;if(!c(o.framebuffer)||o.getDepthStencilTexture()!==i||o.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){let r=this._copyDepthFramebuffer.getColorTexture(),{width:s,height:a}=r;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,s,a),o.setColorTexture(r,0),o.setDepthStencilTexture(i),o.update(e,s,a),Jxe(this,e,s,a,t)}this._tempCopyDepthTexture=i,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)};lp.prototype.executeCopyColor=function(e,t){c(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};lp.prototype.clear=function(e,t,n){let i=this._clearGlobeColorCommand;c(i)&&(G.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};lp.prototype.isDestroyed=function(){return!1};lp.prototype.destroy=function(){return this._pickColorFramebuffer.destroy(),this._outputFramebuffer.destroy(),this._copyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.destroy(),this._updateDepthFramebuffer.destroy(),c(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),c(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),c(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),de(this)};var _B=lp;function ZT(){this._framebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new hi,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new Ke,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(ZT.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}});function xpt(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function Tpt(e,t,n,i,o){let r=o?t.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT:Ue.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function Apt(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;let r=!Ke.equals(e._viewport,o.viewport),s=r!==e._useScissorTest;e._useScissorTest=r,Ke.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ke.clone(o.viewport,e._scissorRectangle),s=!0),(!c(e._renderState)||!Ke.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=Ve.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(M0,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),c(e._clearCommand)||(e._clearCommand=new ei({color:new G(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}ZT.prototype.updateAndClear=function(e,t,n,i){let o=t.width,r=t.height;Tpt(this,n,o,r,e),Apt(this,n,o,r,i),this._useHdr=e};ZT.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};ZT.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};ZT.prototype.isDestroyed=function(){return!1};ZT.prototype.destroy=function(){return xpt(this),de(this)};var gB=ZT;function bg(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;let t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new hi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new hi({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new hi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new hi({createColorAttachments:!1}),this._opaqueClearCommand=new ei({color:new G(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ei({color:new G(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ei({color:new G(0,0,0,0),owner:this}),this._alphaClearCommand=new ei({color:new G(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new Ke,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function eTe(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function OK(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function tTe(e){eTe(e),OK(e)}function Cpt(e,t,n,i){eTe(e),e._accumulationTexture=new Rt({context:t,width:n,height:i,pixelFormat:ke.RGBA,pixelDatatype:Ue.FLOAT}),e._revealageTexture=new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.FLOAT,width:n,height:i,flipY:!1})}function Ept(e,t){OK(e);let n=ne.FRAMEBUFFER_COMPLETE,i=!0,{width:o,height:r}=e._accumulationTexture;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),(e._translucentFBO.status!==n||e._adjustTranslucentFBO.status!==n)&&(OK(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);let s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,l=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!l||!u)&&(tTe(e),e._translucentMultipassSupport=!1,i=!1)}return i}bg.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();let{width:r,height:s}=this._opaqueTexture,a=this._accumulationTexture,l=!c(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((l||u)&&(this._numSamples=o,Cpt(this,e,r,s)),(!c(this._translucentFBO.framebuffer)||l||u)&&!Ept(this,e))return;this._useHDR=i;let f=this,h,p;c(this._compositeCommand)||(h=new He({sources:[JF]}),this._translucentMRTSupport&&h.defines.push("MRT"),p={u_opaque:function(){return f._opaqueTexture},u_accumulation:function(){return f._accumulationTexture},u_revealage:function(){return f._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(h,{uniformMap:p,owner:this})),c(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(h=new He({defines:["MRT"],sources:[JS]}),p={u_bgColor:function(){return f._translucentMRTClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:p,owner:this})):this._translucentMultipassSupport&&(h=new He({sources:[JS]}),p={u_bgColor:function(){return f._translucentMultipassClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:p,owner:this}),p={u_bgColor:function(){return f._alphaClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(h,{uniformMap:p,owner:this}))),this._viewport.width=r,this._viewport.height=s;let g=!Ke.equals(this._viewport,t.viewport),m=g!==this._useScissorTest;this._useScissorTest=g,Ke.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Ke.clone(t.viewport,this._scissorRectangle),m=!0),(!c(this._rs)||!Ke.equals(this._viewport,this._rs.viewport)||m)&&(this._rs=Ve.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),c(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};var Spt={enabled:!0,color:new G(0,0,0,0),equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.ONE,functionDestinationRgb:Eo.ONE,functionSourceAlpha:Eo.ZERO,functionDestinationAlpha:Eo.ONE_MINUS_SOURCE_ALPHA},wpt={enabled:!0,color:new G(0,0,0,0),equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.ONE,functionDestinationRgb:Eo.ONE,functionSourceAlpha:Eo.ONE,functionDestinationAlpha:Eo.ONE},vpt={enabled:!0,color:new G(0,0,0,0),equationRgb:Fa.ADD,equationAlpha:Fa.ADD,functionSourceRgb:Eo.ZERO,functionDestinationRgb:Eo.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:Eo.ZERO,functionDestinationAlpha:Eo.ONE_MINUS_SOURCE_ALPHA};function RK(e,t,n,i){let o=n[i.id];if(!c(o)){let r=Ve.getState(i);r.depthMask=!1,r.blending=t,o=Ve.fromCache(r),n[i.id]=o}return o}function Dpt(e,t,n){return RK(t,Spt,e._translucentRenderStateCache,n)}function Ppt(e,t,n){return RK(t,wpt,e._translucentRenderStateCache,n)}function Ipt(e,t,n){return RK(t,vpt,e._alphaRenderStateCache,n)}var Opt=`    vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;
    float ai = czm_out_FragColor.a;
    float wzi = czm_alphaWeight(ai);
    out_FragData_0 = vec4(Ci * wzi, ai);
    out_FragData_1 = vec4(ai * wzi);
`,Rpt=`    vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;
    float ai = czm_out_FragColor.a;
    float wzi = czm_alphaWeight(ai);
    out_FragColor = vec4(Ci, ai) * wzi;
`,Mpt=`    float ai = czm_out_FragColor.a;
    out_FragColor = vec4(ai);
`;function MK(e,t,n,i){let{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(c(r))return r;let s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map(function(f){return He.replaceMain(f,"czm_translucent_main").replace(/out_FragColor/g,"czm_out_FragColor").replace(/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,"").replace(/\bdiscard\b/g,"czm_discard = true").replace(/czm_phong/g,"czm_translucentPhong")}),a.sources.splice(0,0,`vec4 czm_out_FragColor;
bool czm_discard = false;
`);let l=[...i.matchAll(/out_FragData_(\d+)/g)],u="";for(let f=0;f<l.length;f++){let h=l[f];u=`layout (location = ${h[1]}) out vec4 ${h[0]};
${u}`}return a.sources.push(u),a.sources.push(`void main()
{
    czm_translucent_main();
    if (czm_discard)
    {
        discard;
    }
${i}}
`),o.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:s})}function Lpt(e,t){return MK(e,t,"translucentMRT",Opt)}function Npt(e,t){return MK(e,t,"translucentMultipass",Rpt)}function Fpt(e,t){return MK(e,t,"alphaMultipass",Mpt)}bg.prototype.createDerivedCommands=function(e,t,n){if(c(n)||(n={}),this._translucentMRTSupport){let a,l;return c(n.translucentCommand)&&(a=n.translucentCommand.shaderProgram,l=n.translucentCommand.renderState),n.translucentCommand=Qe.shallowClone(e,n.translucentCommand),!c(a)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Lpt(t,e.shaderProgram),n.translucentCommand.renderState=Dpt(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=a,n.translucentCommand.renderState=l),n}let i,o,r,s;return c(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=Qe.shallowClone(e,n.translucentCommand),n.alphaCommand=Qe.shallowClone(e,n.alphaCommand),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Npt(t,e.shaderProgram),n.translucentCommand.renderState=Ppt(this,t,e.renderState),n.alphaCommand.shaderProgram=Fpt(t,e.shaderProgram),n.alphaCommand.renderState=Ipt(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o,n.alphaCommand.shaderProgram=r,n.alphaCommand.renderState=s),n};function Bpt(e,t,n,i,o,r){let{context:s,frameState:a}=t,{useLogDepth:l,shadowState:u}=a,f=t._hdr,h=i.framebuffer,p=u.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(s,i);let g=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;for(let m=0;m<o.length;++m){let y=o[m];y=l?y.derivedCommands.logDepth.command:y,y=f?y.derivedCommands.hdr.command:y;let b=p&&y.receiveShadows?y.derivedCommands.oit.shadows.translucentCommand:y.derivedCommands.oit.translucentCommand;n(b,t,i,g)}if(c(r)){let m=r.unclassifiedCommand,y=p&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand;n(y,t,i,g)}i.framebuffer=e._alphaFBO.framebuffer;for(let m=0;m<o.length;++m){let y=o[m];y=l?y.derivedCommands.logDepth.command:y,y=f?y.derivedCommands.hdr.command:y;let b=p&&y.receiveShadows?y.derivedCommands.oit.shadows.alphaCommand:y.derivedCommands.oit.alphaCommand;n(b,t,i,g)}if(c(r)){let m=r.unclassifiedCommand,y=p&&m.receiveShadows?m.derivedCommands.oit.shadows.alphaCommand:m.derivedCommands.oit.alphaCommand;n(y,t,i,g)}i.framebuffer=h}function kpt(e,t,n,i,o,r){let{context:s,frameState:a}=t,{useLogDepth:l,shadowState:u}=a,f=t._hdr,h=i.framebuffer,p=u.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);let g=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;for(let m=0;m<o.length;++m){let y=o[m];y=l?y.derivedCommands.logDepth.command:y,y=f?y.derivedCommands.hdr.command:y;let b=p&&y.receiveShadows?y.derivedCommands.oit.shadows.translucentCommand:y.derivedCommands.oit.translucentCommand;n(b,t,i,g)}if(c(r)){let m=r.unclassifiedCommand,y=p&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand;n(y,t,i,g)}i.framebuffer=h}bg.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){kpt(this,e,t,n,i,o);return}Bpt(this,e,t,n,i,o)};bg.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};bg.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,G.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=i};bg.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};bg.prototype.isDestroyed=function(){return!1};bg.prototype.destroy=function(){return tTe(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),de(this)};var yB=bg;function bB(){this._framebuffer=new hi({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(bB.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function Upt(e){e._framebuffer.destroy()}function Vpt(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);let o=new lc(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Ke},o.viewport=new Ke,e._passState=o}bB.prototype.update=function(e,t,n){let i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&Vpt(this,e);let r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s};bB.prototype.isDestroyed=function(){return!1};bB.prototype.destroy=function(){return Upt(this),de(this)};var xB=bB;function vw(e){let t=new lc(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Ke},t.viewport=new Ke,this._context=e,this._fb=new hi({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}vw.prototype.begin=function(e,t){let n=this._context,{width:i,height:o}=t;return Ke.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};var TB=new G;vw.prototype.end=function(e){let t=e.width??1,n=e.height??1,i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(t*.5),l=Math.floor(n*.5),u=0,f=0,h=0,p=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-l<=f&&f<=l){let m=4*((l-f)*t+u+a);TB.red=G.byteToFloat(o[m]),TB.green=G.byteToFloat(o[m+1]),TB.blue=G.byteToFloat(o[m+2]),TB.alpha=G.byteToFloat(o[m+3]);let y=i.getObjectByPickColor(TB);if(c(y))return y}if(u===f||u<0&&-u===f||u>0&&u===1-f){let m=h;h=-p,p=m}u+=h,f+=p}};vw.prototype.readCenterPixel=function(e){let t=e.width??1,n=e.height??1,o=this._context.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.floor(t*.5),a=4*(Math.floor(n*.5)*t+r);return o.slice(a,a+4)};vw.prototype.isDestroyed=function(){return!1};vw.prototype.destroy=function(){return this._fb.destroy(),de(this)};var AB=vw;function xg(){this._numSamples=1,this._colorFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new hi({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new G(0,0,0,0),this._clearCommand=new ei({color:new G(0,0,0,0),depth:1,owner:this})}function zpt(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(xg.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});xg.prototype.update=function(e,t,n,i){let o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT:Ue.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};xg.prototype.clear=function(e,t,n){G.clone(n,this._clearCommand.color),G.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};xg.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};xg.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};xg.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};xg.prototype.isDestroyed=function(){return!1};xg.prototype.destroy=function(){return zpt(this),de(this)};var QT=xg;function JT(){}JT.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};JT.createShadowCastVertexShader=function(e,t,n){let i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");let r=He.findPositionVarying(e),s=c(r);if(t&&!s){let a=o.length;for(let u=0;u<a;++u)o[u]=He.replaceMain(o[u],"czm_shadow_cast_main");o.push(`out vec3 v_positionEC; 
void main() 
{ 
    czm_shadow_cast_main(); 
    v_positionEC = (czm_inverseProjection * gl_Position).xyz; 
}`)}return new He({defines:i,sources:o})};JT.createShadowCastFragmentShader=function(e,t,n,i){let o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=He.findPositionVarying(e),a=c(s);a||(s="v_positionEC");let l=r.length;for(let f=0;f<l;++f)r[f]=He.replaceMain(r[f],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`in vec3 v_positionEC; 
`),u+=`uniform vec4 shadowMap_lightPositionEC; 
`),i?u+=`void main() 
{ 
`:u+=`void main() 
{ 
    czm_shadow_cast_main(); 
    if (out_FragColor.a == 0.0) 
    { 
       discard; 
    } 
`,t?u+=`    float distance = length(${s}); 
    if (distance >= shadowMap_lightPositionEC.w) 
    { 
        discard; 
    } 
    distance /= shadowMap_lightPositionEC.w; // radius 
    out_FragColor = czm_packDepth(distance); 
`:n?u+=`    out_FragColor = vec4(1.0); 
`:u+=`    out_FragColor = czm_packDepth(gl_FragCoord.z); 
`,u+=`} 
`,r.push(u),new He({defines:o,sources:r})};JT.getShadowReceiveShaderKeyword=function(e,t,n,i){let o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,l=e._numberOfCascades>1,u=e.debugCascadeColors,f=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${l}${u}${f}${t}${n}${i}`};JT.createShadowReceiveVertexShader=function(e,t,n){let i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new He({defines:i,sources:o})};JT.createShadowReceiveFragmentShader=function(e,t,n,i,o){let r=He.findNormalVarying(e),s=!i&&c(r)||i&&o,a=He.findPositionVarying(e),l=c(a),u=t._usesDepthTexture,f=t._polygonOffsetSupported,h=t._isPointLight,p=t._isSpotLight,g=t._numberOfCascades>1,m=t.debugCascadeColors,y=t.softShadows,b=h?t._pointBias:i?t._terrainBias:t._primitiveBias,x=e.defines.slice(0),A=e.sources.slice(0),C=A.length;for(let P=0;P<C;++P)A[P]=He.replaceMain(A[P],"czm_shadow_receive_main");h?x.push("USE_CUBE_MAP_SHADOW"):u&&x.push("USE_SHADOW_DEPTH_TEXTURE"),y&&!h&&x.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?x.push("ENABLE_VERTEX_LIGHTING"):x.push("ENABLE_DAYNIGHT_SHADING")),n&&b.normalShading&&s&&(x.push("USE_NORMAL_SHADING"),b.normalShadingSmooth>0&&x.push("USE_NORMAL_SHADING_SMOOTH"));let S="";h?S+=`uniform samplerCube shadowMap_textureCube; 
`:S+=`uniform sampler2D shadowMap_texture; 
`;let v;return l?v=`    return vec4(${a}, 1.0); 
`:v=`#ifndef LOG_DEPTH 
    return czm_windowToEyeCoordinates(gl_FragCoord); 
#else 
    return vec4(v_logPositionEC, 1.0); 
#endif 
`,S+=`uniform mat4 shadowMap_matrix; 
uniform vec3 shadowMap_lightDirectionEC; 
uniform vec4 shadowMap_lightPositionEC; 
uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; 
uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; 
#ifdef LOG_DEPTH 
in vec3 v_logPositionEC; 
#endif 
vec4 getPositionEC() 
{ 
${v}} 
vec3 getNormalEC() 
{ 
${s?`    return normalize(${r}); 
`:`    return vec3(1.0); 
`}} 
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) 
{ 
${b.normalOffset&&s?`    float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; 
    float normalOffsetScale = 1.0 - nDotL; 
    vec3 offset = normalOffset * normalOffsetScale * normalEC; 
    positionEC.xyz += offset; 
`:""}} 
`,S+=`void main() 
{ 
    czm_shadow_receive_main(); 
    vec4 positionEC = getPositionEC(); 
    vec3 normalEC = getNormalEC(); 
    float depth = -positionEC.z; 
`,S+=`    czm_shadowParameters shadowParameters; 
    shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; 
    shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; 
    shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; 
    shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; 
`,i?S+=`    shadowParameters.depthBias *= max(depth * 0.01, 1.0); 
`:f||(S+=`    shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); 
`),h?S+=`    vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; 
    float distance = length(directionEC); 
    directionEC = normalize(directionEC); 
    float radius = shadowMap_lightPositionEC.w; 
    // Stop early if the fragment is beyond the point light radius 
    if (distance > radius) 
    { 
        return; 
    } 
    vec3 directionWC  = czm_inverseViewRotation * directionEC; 
    shadowParameters.depth = distance / radius; 
    shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); 
    shadowParameters.texCoords = directionWC; 
    float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); 
`:p?S+=`    vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); 
    float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); 
    applyNormalOffset(positionEC, normalEC, nDotL); 
    vec4 shadowPosition = shadowMap_matrix * positionEC; 
    // Spot light uses a perspective projection, so perform the perspective divide 
    shadowPosition /= shadowPosition.w; 
    // Stop early if the fragment is not in the shadow bounds 
    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) 
    { 
        return; 
    } 
    shadowParameters.texCoords = shadowPosition.xy; 
    shadowParameters.depth = shadowPosition.z; 
    shadowParameters.nDotL = nDotL; 
    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); 
`:g?S+=`    float maxDepth = shadowMap_cascadeSplits[1].w; 
    // Stop early if the eye depth exceeds the last cascade 
    if (depth > maxDepth) 
    { 
        return; 
    } 
    // Get the cascade based on the eye-space depth 
    vec4 weights = czm_cascadeWeights(depth); 
    // Apply normal offset 
    float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); 
    applyNormalOffset(positionEC, normalEC, nDotL); 
    // Transform position into the cascade 
    vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; 
    // Get visibility 
    shadowParameters.texCoords = shadowPosition.xy; 
    shadowParameters.depth = shadowPosition.z; 
    shadowParameters.nDotL = nDotL; 
    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); 
    // Fade out shadows that are far away 
    float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; 
    float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); 
    visibility = mix(visibility, 1.0, fade); 
${m?`    // Draw cascade colors for debugging 
    out_FragColor *= czm_cascadeColor(weights); 
`:""}`:S+=`    float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); 
    applyNormalOffset(positionEC, normalEC, nDotL); 
    vec4 shadowPosition = shadowMap_matrix * positionEC; 
    // Stop early if the fragment is not in the shadow bounds 
    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) 
    { 
        return; 
    } 
    shadowParameters.texCoords = shadowPosition.xy; 
    shadowParameters.depth = shadowPosition.z; 
    shadowParameters.nDotL = nDotL; 
    float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); 
`,S+=`    out_FragColor.rgb *= visibility; 
} 
`,A.push(S),new He({defines:x,sources:A})};var up=JT;function fp(e){e=e??W.EMPTY_OBJECT;let t=e.context;if(!c(t))throw new E("context is required.");if(!c(e.lightCamera))throw new E("lightCamera is required.");if(c(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new E("Only one or four cascades are supported.");this._enabled=e.enabled??!0,this._softShadows=e.softShadows??!1,this._normalOffset=e.normalOffset??!0,this.dirty=!0,this.fromLightSource=e.fromLightSource??!0,this.darkness=e.darkness??.3,this._darkness=this.darkness,this.fadingEnabled=e.fadingEnabled??!0,this.maximumDistance=e.maximumDistance??5e3,this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Vt.isInternetExplorer()||Vt.isEdge()||(Vt.isChrome()||Vt.isFirefox())&&Vt.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new B,this._shadowMapTexture=void 0,this._lightDirectionEC=new d,this._lightPositionEC=new se,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new oG,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new le,this._isPointLight=e.isPointLight??!1,this._pointLightRadius=e.pointLightRadius??100,this._cascadesEnabled=this._isPointLight?!1:e.cascadesEnabled??!0,this._numberOfCascades=this._cascadesEnabled?e.numberOfCascades??4:0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new H,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new jo:c(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new se,new se],this._cascadeMatrices=[new B,new B,new B,new B],this._cascadeDistances=new se;let i;this._isPointLight?i=6:this._cascadesEnabled?i=this._numberOfCascades:i=1,this._passes=new Array(i);for(let o=0;o<i;++o)this._passes[o]=new Hpt(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,NK(this),this._clearCommand=new ei({depth:1,color:new G}),this._clearPassState=new lc(t),this._size=e.size??2048,this.size=this._size}fp.MAXIMUM_DISTANCE=2e4;function Hpt(e){this.camera=new oG,this.passState=new lc(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function LK(e,t){return Ve.fromCache({cull:{enabled:!0,face:xi.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function NK(e){let t=!e._usesDepthTexture;e._primitiveRenderState=LK(t,e._primitiveBias),e._terrainRenderState=LK(t,e._terrainBias),e._pointRenderState=LK(t,e._pointBias)}fp.prototype.debugCreateRenderStates=function(){NK(this)};Object.defineProperties(fp.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){Xpt(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});function FK(e){let t=e._passes.length;for(let n=0;n<t;++n){let i=e._passes[n],o=i.framebuffer;c(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function Gpt(e,t){let n=new _u({context:t,width:e._textureSize.x,height:e._textureSize.y,format:uc.DEPTH_COMPONENT16}),i=new Rt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,sampler:Qt.NEAREST}),o=new Ur({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){let a=e._passes[s];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function jpt(e,t){let n=new Rt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8,sampler:Qt.NEAREST}),i=new Ur({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){let s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function Wpt(e,t){let n=new _u({context:t,width:e._textureSize.x,height:e._textureSize.y,format:uc.DEPTH_COMPONENT16}),i=new Go({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,sampler:Qt.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){let s=new Ur({context:t,depthRenderbuffer:n,colorTextures:[o[r]],destroyAttachments:!1}),a=e._passes[r];a.framebuffer=s,a.passState.framebuffer=s}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function oTe(e,t){e._isPointLight?Wpt(e,t):e._usesDepthTexture?jpt(e,t):Gpt(e,t)}function qpt(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==ne.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,NK(e),FK(e),oTe(e,t))}function Ypt(e,t){(!c(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(FK(e),oTe(e,t),qpt(e,t),rTe(e,t))}function rTe(e,t,n){n=n??0,(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function Xpt(e,t){e._size=t;let n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=ut.maximumCubeMapSize>=t?t:ut.maximumCubeMapSize,o.x=t,o.y=t;let r=new Ke(0,0,t,t);n[0].passState.viewport=r,n[1].passState.viewport=r,n[2].passState.viewport=r,n[3].passState.viewport=r,n[4].passState.viewport=r,n[5].passState.viewport=r}else i===1?(t=ut.maximumTextureSize>=t?t:ut.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Ke(0,0,t,t)):i===4&&(t=ut.maximumTextureSize>=t*2?t:ut.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new Ke(0,0,t,t),n[1].passState.viewport=new Ke(t,0,t,t),n[2].passState.viewport=new Ke(0,t,t,t),n[3].passState.viewport=new Ke(t,t,t,t));e._clearPassState.viewport=new Ke(0,0,o.x,o.y);for(let r=0;r<i;++r){let s=n[r],a=s.passState.viewport,l=a.x/o.x,u=a.y/o.y,f=a.width/o.x,h=a.height/o.y;s.textureOffsets=new B(f,0,0,l,0,h,0,u,0,0,1,0,0,0,0,1)}}var Kpt=new Ke;function $pt(e,t){let n;e._isPointLight?n=`uniform samplerCube shadowMap_textureCube; 
in vec2 v_textureCoordinates; 
void main() 
{ 
    vec2 uv = v_textureCoordinates; 
    vec3 dir; 
 
    if (uv.y < 0.5) 
    { 
        if (uv.x < 0.333) 
        { 
            dir.x = -1.0; 
            dir.y = uv.x * 6.0 - 1.0; 
            dir.z = uv.y * 4.0 - 1.0; 
        } 
        else if (uv.x < 0.666) 
        { 
            dir.y = -1.0; 
            dir.x = uv.x * 6.0 - 3.0; 
            dir.z = uv.y * 4.0 - 1.0; 
        } 
        else 
        { 
            dir.z = -1.0; 
            dir.x = uv.x * 6.0 - 5.0; 
            dir.y = uv.y * 4.0 - 1.0; 
        } 
    } 
    else 
    { 
        if (uv.x < 0.333) 
        { 
            dir.x = 1.0; 
            dir.y = uv.x * 6.0 - 1.0; 
            dir.z = uv.y * 4.0 - 3.0; 
        } 
        else if (uv.x < 0.666) 
        { 
            dir.y = 1.0; 
            dir.x = uv.x * 6.0 - 3.0; 
            dir.z = uv.y * 4.0 - 3.0; 
        } 
        else 
        { 
            dir.z = 1.0; 
            dir.x = uv.x * 6.0 - 5.0; 
            dir.y = uv.y * 4.0 - 3.0; 
        } 
    } 
 
    float shadow = czm_unpackDepth(czm_textureCube(shadowMap_textureCube, dir)); 
    out_FragColor = vec4(vec3(shadow), 1.0); 
} 
`:n=`uniform sampler2D shadowMap_texture; 
in vec2 v_textureCoordinates; 
void main() 
{ 
${e._usesDepthTexture?`    float shadow = texture(shadowMap_texture, v_textureCoordinates).r; 
`:`    float shadow = czm_unpackDepth(texture(shadowMap_texture, v_textureCoordinates)); 
`}    out_FragColor = vec4(vec3(shadow), 1.0); 
} 
`;let i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=De.OVERLAY,i}function Zpt(e,t){let n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=Kpt;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;c(a)||(a=$pt(e,n),e._debugShadowViewCommand=a),(!c(a.renderState)||!Ke.equals(a.renderState.viewport,s))&&(a.renderState=Ve.fromCache({viewport:Ke.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}var dp=new Array(8);dp[0]=new se(-1,-1,-1,1);dp[1]=new se(1,-1,-1,1);dp[2]=new se(1,1,-1,1);dp[3]=new se(-1,1,-1,1);dp[4]=new se(-1,-1,1,1);dp[5]=new se(1,-1,1,1);dp[6]=new se(1,1,1,1);dp[7]=new se(-1,1,1,1);var L0=new B,BK=new Array(8);for(let e=0;e<8;++e)BK[e]=new se;function Qpt(e,t){let n=new St({geometry:new Ud({minimum:new d(-.5,-.5,-.5),maximum:new d(.5,.5,.5)}),attributes:{color:Gt.fromColor(t)}}),i=new St({geometry:new M_({radius:.5}),attributes:{color:Gt.fromColor(t)}});return new Pn({geometryInstances:[n,i],appearance:new rn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var Jpt=[G.RED,G.GREEN,G.BLUE,G.MAGENTA],e_t=new d;function t_t(e,t){Zpt(e,t);let n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new sp({camera:e._sceneCamera,color:G.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new sp({camera:e._shadowMapCamera,color:G.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new sp({camera:e._passes[i].camera,color:Jpt[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!c(e._debugLightFrustum)||e._needsUpdate){let i=e._shadowMapCamera.positionWC,o=Le.IDENTITY,r=e._pointLightRadius*2,s=d.fromElements(r,r,r,e_t),a=B.fromTranslationQuaternionRotationScale(i,o,s,L0);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=Qpt(a,G.YELLOW)}e._debugLightFrustum.update(t)}else(!c(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new sp({camera:e._shadowMapCamera,color:G.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function oG(){this.viewMatrix=new B,this.inverseViewMatrix=new B,this.frustum=void 0,this.positionCartographic=new he,this.positionWC=new d,this.directionWC=d.clone(d.UNIT_Z),this.upWC=d.clone(d.UNIT_Y),this.rightWC=d.clone(d.UNIT_X),this.viewProjectionMatrix=new B}oG.prototype.clone=function(e){B.clone(e.viewMatrix,this.viewMatrix),B.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),he.clone(e.positionCartographic,this.positionCartographic),d.clone(e.positionWC,this.positionWC),d.clone(e.directionWC,this.directionWC),d.clone(e.upWC,this.upWC),d.clone(e.rightWC,this.rightWC)};var n_t=new B(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);oG.prototype.getViewProjection=function(){let e=this.viewMatrix,t=this.frustum.projectionMatrix;return B.multiply(t,e,this.viewProjectionMatrix),B.multiply(n_t,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var i_t=new Array(5),o_t=new Ci,r_t=new Array(4),sTe=new d,aTe=new d;function s_t(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades,a,l=r-o,u=r/o,f=.9,h=!1;t.shadowState.closestObjectSize<200&&(h=!0,f=.9);let p=r_t,g=i_t;for(g[0]=o,g[s]=r,a=0;a<s;++a){let F=(a+1)/s,_=o*Math.pow(u,F),w=o+l*F,D=O.lerp(w,_,f);g[a+1]=D,p[a]=D-g[a]}if(h){for(a=0;a<s;++a)p[a]=Math.min(p[a],e._maximumCascadeDistances[a]);let F=g[0];for(a=0;a<s-1;++a)F+=p[a],g[a+1]=F}se.unpack(g,0,e._cascadeSplits[0]),se.unpack(g,1,e._cascadeSplits[1]),se.unpack(p,0,e._cascadeDistances);let m=n.frustum,y=m.left,b=m.right,x=m.bottom,A=m.top,C=m.near,S=m.far,v=n.positionWC,P=n.directionWC,M=n.upWC,R=i.frustum.clone(o_t),L=n.getViewProjection();for(a=0;a<s;++a){R.near=g[a],R.far=g[a+1];let F=B.multiply(R.projectionMatrix,i.viewMatrix,L0),_=B.inverse(F,L0),w=B.multiply(L,_,L0),D=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,sTe),I=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,aTe);for(let j=0;j<8;++j){let U=se.clone(dp[j],BK[j]);B.multiplyByVector(w,U,U),d.divideByScalar(U,U.w,U),d.minimumByComponent(U,D,D),d.maximumByComponent(U,I,I)}D.x=Math.max(D.x,0),D.y=Math.max(D.y,0),D.z=0,I.x=Math.min(I.x,1),I.y=Math.min(I.y,1),I.z=Math.min(I.z,1);let N=e._passes[a],k=N.camera;k.clone(n);let z=k.frustum;z.left=y+D.x*(b-y),z.right=y+I.x*(b-y),z.bottom=x+D.y*(A-x),z.top=x+I.y*(A-x),z.near=C+D.z*(S-C),z.far=C+I.z*(S-C),N.cullingVolume=k.frustum.computeCullingVolume(v,P,M);let V=e._cascadeMatrices[a];B.multiply(k.getViewProjection(),i.inverseViewMatrix,V),B.multiply(N.textureOffsets,V,V)}}var a_t=new B,c_t=new d,l_t=new d,nTe=new d;function u_t(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=B.multiply(i.frustum.projectionMatrix,i.viewMatrix,L0),r=B.inverse(o,L0),s=n.directionWC,a=i.directionWC;d.equalsEpsilon(s,a,O.EPSILON10)&&(a=i.upWC);let l=d.cross(s,a,c_t);a=d.cross(l,s,l_t),d.normalize(a,a),d.normalize(l,l);let u=d.fromElements(0,0,0,nTe),f=B.computeView(u,s,a,l,a_t),h=B.multiply(f,r,L0),p=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,sTe),g=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,aTe);for(let S=0;S<8;++S){let v=se.clone(dp[S],BK[S]);B.multiplyByVector(h,v,v),d.divideByScalar(v,v.w,v),d.minimumByComponent(v,p,p),d.maximumByComponent(v,g,g)}g.z+=1e3,p.z-=10;let m=nTe;m.x=-(.5*(p.x+g.x)),m.y=-(.5*(p.y+g.y)),m.z=-g.z;let y=B.fromTranslation(m,L0);f=B.multiply(y,f,f);let b=.5*(g.x-p.x),x=.5*(g.y-p.y),A=g.z-p.z,C=n.frustum;C.left=-b,C.right=b,C.bottom=-x,C.top=x,C.near=.01,C.far=A,B.clone(f,n.viewMatrix),B.inverse(f,n.inverseViewMatrix),B.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),d.clone(s,n.directionWC),d.clone(a,n.upWC),d.clone(l,n.rightWC)}var f_t=[new d(-1,0,0),new d(0,-1,0),new d(0,0,-1),new d(1,0,0),new d(0,1,0),new d(0,0,1)],d_t=[new d(0,-1,0),new d(0,0,-1),new d(0,-1,0),new d(0,-1,0),new d(0,0,1),new d(0,-1,0)],h_t=[new d(0,0,1),new d(1,0,0),new d(-1,0,0),new d(0,0,-1),new d(1,0,0),new d(1,0,0)];function m_t(e,t){let n=new Ci;n.fov=O.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){let o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=f_t[i],o.upWC=d_t[i],o.rightWC=h_t[i],B.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),B.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}var p_t=new d,__t=new d,cTe=new le,iTe=cTe.center;function g_t(e,t){let n=e._sceneCamera,i=e._shadowMapCamera,o=cTe;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}let r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,p_t),s=d.negate(i.directionWC,__t),a=d.dot(r,s);if(e.fadingEnabled){let l=O.clamp(a/.1,0,1);e._darkness=O.lerp(1,e.darkness,l)}else e._darkness=e.darkness;if(a<0){e._outOfView=!0,e._needsUpdate=!1;return}e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)o.center=i.positionWC,o.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(o)===Wt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),le.clone(o,e._boundingSphere);else{let r=i.frustum.far/2,s=d.add(i.positionWC,d.multiplyByScalar(i.directionWC,r,iTe),iTe);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===Wt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),le.clone(o,e._boundingSphere)}}function y_t(e,t){let n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?d.clone(i.directionWC,r.directionWC):e._isPointLight?d.clone(i.positionWC,r.positionWC):r.clone(i);let s=e._lightDirectionEC;B.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),d.normalize(s,s),d.negate(s,s),B.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,l;e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),l=Math.min(t.shadowState.farPlane,e.maximumDistance),l=Math.max(l,a+1)):(a=n.frustum.near,l=e.maximumDistance),e._sceneCamera=ro.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=l,e._distance=l-a,g_t(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}fp.prototype.update=function(e){if(y_t(this,e),this._needsUpdate)if(Ypt(this,e.context),this._isPointLight&&m_t(this,e),this._cascadesEnabled&&(u_t(this,e),this._numberOfCascades>1&&s_t(this,e)),this._isPointLight)this._shadowMapCullingVolume=_s.fromBoundingSphere(this._boundingSphere);else{let t=this._shadowMapCamera,n=t.positionWC,i=t.directionWC,o=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(n,i,o),this._passes.length===1&&this._passes[0].camera.clone(t)}if(this._passes.length===1){let t=this._sceneCamera.inverseViewMatrix;B.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&t_t(this,e)};fp.prototype.updatePass=function(e,t){rTe(this,e,t)};var b_t=new H;function lTe(e,t,n){let i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias,o={shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){let r=b_t;return r.x=1/e._textureSize.x,r.y=1/e._textureSize.y,se.fromElements(r.x,r.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return se.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new se,combinedUniforms2:new se};return xt(t,o,!1)}function x_t(e,t,n,i,o,r){let s,a,l;if(c(r)&&(s=r.shaderProgram,a=r.renderState,l=r.uniformMap),r=Qe.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!c(s)||o!==n.shaderProgram.id||t){let u=n.shaderProgram,f=n.pass===De.GLOBE,h=n.pass!==De.TRANSLUCENT,p=e._isPointLight,g=e._usesDepthTexture,m=up.getShadowCastShaderKeyword(p,f,g,h);if(s=i.shaderCache.getDerivedShaderProgram(u,m),!c(s)){let b=u.vertexShaderSource,x=u.fragmentShaderSource,A=up.createShadowCastVertexShader(b,p,f),C=up.createShadowCastFragmentShader(x,p,g,h);s=i.shaderCache.createDerivedShaderProgram(u,m,{vertexShaderSource:A,fragmentShaderSource:C,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,p?a=e._pointRenderState:f&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=je(a,!1),a.cull=je(a.cull,!1),a.cull.enabled=!1,a=Ve.fromCache(a)),l=lTe(e,n.uniformMap,f)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=l,r}fp.createReceiveDerivedCommand=function(e,t,n,i,o){c(o)||(o={});let r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,l=s.fragmentShaderSource,u=t.pass===De.GLOBE,f=!1;if(u&&(f=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let h,p;c(o.receiveCommand)&&(h=o.receiveCommand.shaderProgram,p=o.receiveCommand.uniformMap),o.receiveCommand=Qe.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;let g=o.receiveShaderCastShadows!==t.castShadows,m=o.receiveShaderProgramId!==t.shaderProgram.id;if(!c(h)||m||n||g){let y=up.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,f);if(h=i.shaderCache.getDerivedShaderProgram(s,y),!c(h)){let b=up.createShadowReceiveVertexShader(a,u,f),x=up.createShadowReceiveFragmentShader(l,e[0],t.castShadows,u,f);h=i.shaderCache.createDerivedShaderProgram(s,y,{vertexShaderSource:b,fragmentShaderSource:x,attributeLocations:s._attributeLocations})}p=lTe(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=h,o.receiveCommand.uniformMap=p,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};fp.createCastDerivedCommand=function(e,t,n,i,o){if(c(o)||(o={}),t.castShadows){let r=o.castCommands;c(r)||(r=o.castCommands=[]);let s=o.castShaderProgramId,a=e.length;r.length=a;for(let l=0;l<a;++l)r[l]=x_t(e[l],n,t,i,s,r[l]);o.castShaderProgramId=t.shaderProgram.id}return o};fp.prototype.isDestroyed=function(){return!1};fp.prototype.destroy=function(){FK(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return de(this)};var Tg=fp;var eA=`uniform sampler2D colorTexture;
#ifdef DEBUG_SHOW_DEPTH
uniform sampler2D u_packedTranslucentDepth;
#endif
in vec2 v_textureCoordinates;
void main()
{
#ifdef DEBUG_SHOW_DEPTH
if (v_textureCoordinates.x < 0.5)
{
out_FragColor.rgb = vec3(czm_unpackDepth(texture(u_packedTranslucentDepth, v_textureCoordinates)));
out_FragColor.a = 1.0;
}
#else
vec4 color = texture(colorTexture, v_textureCoordinates);
#ifdef PICK
if (color == vec4(0.0))
{
discard;
}
#else
color.rgb /= color.a;
#endif
out_FragColor = color;
#endif
}
`;var T_t=!1;function N0(e){this._drawClassificationFBO=new hi({createDepthAttachments:!1}),this._accumulationFBO=new hi({createDepthAttachments:!1}),this._packFBO=new hi,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new ei({color:new G(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ei({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new Ke,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}Object.defineProperties(N0.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function uTe(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function fTe(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function A_t(e,t,n,i){uTe(e),e._translucentDepthStencilTexture=new Rt({context:t,width:n,height:i,pixelFormat:ke.DEPTH_STENCIL,pixelDatatype:Ue.UNSIGNED_INT_24_8,sampler:Qt.NEAREST})}function C_t(e,t,n,i){fTe(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}function E_t(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;let o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(A_t(e,t,o,r),C_t(e,t,o,r));let s,a;if(c(e._packDepthCommand)||(s=new He({sources:[QF]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!c(e._compositeCommand)){s=new He({sources:[eA]}),a={colorTexture:function(){return e._textureToComposite}},T_t&&(s.defines=["DEBUG_SHOW_DEPTH"],a.u_packedTranslucentDepth=function(){return e._packFBO.getColorTexture()}),e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});let f=e._compositeCommand,h=f.shaderProgram,p=t.shaderCache.createDerivedShaderProgram(h,"pick",{vertexShaderSource:h.vertexShaderSource,fragmentShaderSource:new He({sources:s.sources,defines:["PICK"]}),attributeLocations:h._attributeLocations}),g=Qe.shallowClone(f);g.shaderProgram=p,f.derivedCommands.pick=g}c(e._copyCommand)||(s=new He({sources:[eA]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),c(e._accumulateCommand)||(s=new He({sources:[eA]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;let l=!Ke.equals(e._viewport,n.viewport),u=l!==e._useScissorTest;e._useScissorTest=l,Ke.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Ke.clone(n.viewport,e._scissorRectangle),u=!0),(!c(e._rsDepth)||!Ke.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=Ve.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!c(e._rsAccumulate)||!Ke.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=Ve.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Vn.EQUAL,reference:kt.CESIUM_3D_TILE_MASK}})),c(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!c(e._rsComp)||!Ke.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=Ve.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:ln.ALPHA_BLEND})),c(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}N0.prototype.executeTranslucentCommands=function(e,t,n,i,o){let r=e.frameState.useLogDepth,s=e.context,a=n.framebuffer;for(let l=0;l<i.length;++l){let u=i[l];if(u=r?u.derivedCommands.logDepth.command:u,u.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}}if(this._hasTranslucentDepth){E_t(this,s,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(s,n);for(let l=0;l<i.length;++l){let u=i[l];if(u=r?u.derivedCommands.logDepth.command:u,!u.depthForTranslucentClassification)continue;let f=u.derivedCommands.depth.depthOnlyCommand;t(f,e,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(s,n)),n.framebuffer=a}};N0.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;let o=e.context,r=o.uniformState,s=n.framebuffer;n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(De.CESIUM_3D_TILE_CLASSIFICATION);let a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();let l=i.commands[De.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[De.CESIUM_3D_TILE_CLASSIFICATION];for(let f=0;f<u;++f)t(l[f],e,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};N0.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;this._frustumsDrawn===1?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture(),(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),S_t(this,e,t)};function S_t(e,t,n){if(!e._hasTranslucentDepth)return;let i=n.framebuffer;n.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,n),n.framebuffer=i,e._frustumsDrawn>1&&(n.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,n)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}N0.prototype.isSupported=function(){return this._supported};N0.prototype.isDestroyed=function(){return!1};N0.prototype.destroy=function(){return uTe(this),fTe(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),de(this)};var CB=N0;function w_t(){this.command=void 0,this.near=void 0,this.far=void 0}function rG(e,t,n){let i=e.context,o;i.depthTexture&&(o=new _B);let r;e._useOIT&&i.depthTexture&&(r=new yB(i));let s=new lc(i);s.viewport=Ke.clone(n),this.camera=t,this._cameraClone=ro.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new AB(i),this.pickDepthFramebuffer=new xB,this.sceneFramebuffer=new QT,this.globeDepth=o,this.globeTranslucencyFramebuffer=new gB,this.oit=r,this.translucentTileClassification=new CB(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}var kK=new d,UK=new d;function v_t(e,t,n){let i=Math.max(d.maximumComponent(d.abs(e.position,kK)),d.maximumComponent(d.abs(t.position,UK))),o=1/Math.max(1,i);return d.multiplyByScalar(e.position,o,kK),d.multiplyByScalar(t.position,o,UK),d.equalsEpsilon(kK,UK,n)&&d.equalsEpsilon(e.direction,t.direction,n)&&d.equalsEpsilon(e.up,t.up,n)&&d.equalsEpsilon(e.right,t.right,n)&&B.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}rG.prototype.checkForCameraUpdates=function(e){let t=this.camera,n=this._cameraClone;return v_t(t,n,O.EPSILON15)?(this._cameraStartFired&&Ti()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=Ti(),ro.clone(t,n),!0)};function D_t(e,t,n,i){let{frameState:o}=t,{camera:r,useLogDepth:s}=o,a=s?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,l=t.mode===oe.SCENE2D,u=t.nearToFarDistance2D;i*=1+O.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let f;l?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),f=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):f=Math.ceil(Math.log(i/n)/Math.log(a));let{frustumCommandsList:h}=e;h.length=f;for(let p=0;p<f;++p){let g,m;l?(g=Math.min(i-u,n+p*u),m=Math.min(i,g+u)):(g=Math.max(n,Math.pow(a,p)*n),m=Math.min(i,a*g));let y=h[p];c(y)?(y.near=g,y.far=m):y=h[p]=new pB(g,m)}}function P_t(e,t,n){let{command:i,near:o,far:r}=n;t.debugShowFrustums&&(i.debugOverlappingFrustums=0);let{frustumCommandsList:s}=e;for(let a=0;a<s.length;++a){let l=s[a];if(o>l.far)continue;if(r<l.near)break;let u=i.pass,f=l.indices[u]++;if(l.commands[u][f]=i,t.debugShowFrustums&&(i.debugOverlappingFrustums|=1<<a),i.executeInClosestFrustum)break}if(t.debugShowFrustums){let{debugFrustumStatistics:a}=e,{debugOverlappingFrustums:l}=i,u=a.commandsInFrustums;u[l]=c(u[l])?u[l]+1:1,++a.totalCommands}t.updateDerivedCommands(i)}var dTe=new _s,I_t=new Ma;rG.prototype.createPotentiallyVisibleSet=function(e){let{frameState:t}=e,{camera:n,commandList:i,shadowState:o}=t,{positionWC:r,directionWC:s,frustum:a}=n,l=e._computeCommandList,u=e._overlayCommandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});let f=this.frustumCommandsList;for(let L=0;L<f.length;++L)for(let F=0;F<De.NUMBER_OF_PASSES;++F)f[L].indices[F]=0;l.length=0,u.length=0;let h=this._commandExtents,p=h.length,g=0,m=+Number.MAX_VALUE,y=-Number.MAX_VALUE,{shadowsEnabled:b}=o,x=+Number.MAX_VALUE,A=-Number.MAX_VALUE,C=Number.MAX_VALUE,S=t.mode===oe.SCENE3D?t.occluder:void 0,{cullingVolume:v}=t,P=dTe.planes;for(let L=0;L<5;++L)P[L]=v.planes[L];v=dTe;for(let L=0;L<i.length;++L){let F=i[L],{pass:_,boundingVolume:w}=F;if(_===De.COMPUTE)l.push(F);else if(_===De.OVERLAY)u.push(F);else{let D,I;if(c(w)){if(!e.isVisible(v,F,S))continue;let k=w.computePlaneDistances(r,s,I_t);if(D=k.start,I=k.stop,m=Math.min(m,D),y=Math.max(y,I),b&&F.receiveShadows&&D<Tg.MAXIMUM_DISTANCE&&!(_===De.GLOBE&&D<-100&&I>100)){let z=I-D;_!==De.GLOBE&&D<100&&(C=Math.min(C,z)),x=Math.min(x,D),A=Math.max(A,I)}}else F instanceof ei?(D=a.near,I=a.far):(D=a.near,I=a.far,m=Math.min(m,D),y=Math.max(y,I));let N=h[g];c(N)||(N=h[g]=new w_t),N.command=F,N.near=D,N.far=I,g++}}b&&(x=Math.min(Math.max(x,a.near),a.far),A=Math.max(Math.min(A,a.far),x),o.nearPlane=x,o.farPlane=A,o.closestObjectSize=C),D_t(this,e,m,y);for(let L=0;L<g;L++)P_t(this,e,h[L]);if(g<p)for(let L=g;L<p;L++){let F=h[L];if(!c(F.command))break;F.command=void 0}let M=f.length,{frustumSplits:R}=t;R.length=M+1;for(let L=0;L<M;++L)R[L]=f[L].near,L===M-1&&(R[L+1]=f[L].far)};rG.prototype.destroy=function(){this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();let e=this.pickDepths;for(let t=0;t<e.length;++t)e[t].destroy()};var tA=rG;var mTe=.1,O_t=new gd({pass:Uo.MOST_DETAILED_PRELOAD}),R_t=new gd({pass:Uo.MOST_DETAILED_PICK}),EB=new gd({pass:Uo.PICK});function oa(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;let t=new Ke(0,0,1,1),n=new ro(e);n.frustum=new on({width:mTe,aspectRatio:1,near:.1}),this._pickOffscreenView=new tA(e,n,t)}oa.prototype.update=function(){this._pickPositionCacheDirty=!0};oa.prototype.getPickDepth=function(e,t){let n=e.view.pickDepths,i=n[t];return c(i)||(i=new mB,n[t]=i),i};var M_t=new jo,L_t=new d,sG=new d,N_t=new H,F_t=new B;function B_t(e,t,n,i,o){let r=e.camera,s=r.frustum,a=s.offCenterFrustum;c(a)&&(s=a);let l=2*(t.x-o.x)/o.width-1;l*=(s.right-s.left)*.5;let u=2*(o.height-t.y-o.y)/o.height-1;u*=(s.top-s.bottom)*.5;let f=B.clone(r.transform,F_t);r._setTransform(B.IDENTITY);let h=d.clone(r.position,L_t);d.multiplyByScalar(r.right,l,sG),d.add(sG,h,h),d.multiplyByScalar(r.up,u,sG),d.add(sG,h,h),r._setTransform(f),e.mode===oe.SCENE2D&&d.fromElements(h.z,h.x,h.y,h);let p=s.getPixelDimensions(o.width,o.height,1,1,N_t),g=M_t;return g.right=p.x*.5,g.left=-g.right,g.top=p.y*.5,g.bottom=-g.top,g.near=s.near,g.far=s.far,g.computeCullingVolume(h,r.directionWC,r.upWC)}var k_t=new bl,U_t=new H;function V_t(e,t,n,i,o){let r=e.camera,s=r.frustum,a=s.near,l=Math.tan(s.fovy*.5),u=s.aspectRatio*l,f=2*(t.x-o.x)/o.width-1,h=2*(o.height-t.y-o.y)/o.height-1,p=f*a*u,g=h*a*l,m=s.getPixelDimensions(o.width,o.height,1,1,U_t),y=m.x*n*.5,b=m.y*i*.5,x=k_t;return x.top=g+b,x.bottom=g-b,x.right=p+y,x.left=p-y,x.near=a,x.far=s.far,x.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function aG(e,t,n,i,o){let r=e.camera.frustum;return r instanceof on||r instanceof jo?B_t(e,t,n,i,o):V_t(e,t,n,i,o)}var cG=new Ke(0,0,3,3),lG=new H,SB=new G(0,0,0,0);function VK(e,t,n,i,o){return o.width=n??3,o.height=i??o.width,o.x=t.x-(o.width-1)*.5,o.y=e-t.y-(o.height-1)*.5,o}oa.prototype.pick=function(e,t,n,i){T.defined("windowPosition",t);let{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Ke.clone(a,u.viewport);let f=Gi.transformWindowToDrawingBuffer(e,t,lG),h=VK(o.drawingBufferHeight,f,n,i,cG);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=aG(e,f,h.width,h.height,a),r.invertClassification=!1,r.passes.pick=!0,r.tilesetPassState=EB,o.uniformState.update(r),e.updateEnvironment(),u=l.begin(h,a),e.updateAndExecuteCommands(u,SB),e.resolveFramebuffers(u);let p=l.end(h);return o.endFrame(),p};oa.prototype.pickVoxelCoordinate=function(e,t,n,i){T.defined("windowPosition",t);let{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Ke.clone(a,u.viewport);let f=Gi.transformWindowToDrawingBuffer(e,t,lG),h=VK(o.drawingBufferHeight,f,n,i,cG);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=aG(e,f,h.width,h.height,a),r.invertClassification=!1,r.passes.pickVoxel=!0,r.tilesetPassState=EB,o.uniformState.update(r),e.updateEnvironment(),u=l.begin(h,a),e.updateAndExecuteCommands(u,SB),e.resolveFramebuffers(u);let p=l.readCenterPixel(h);return o.endFrame(),p};oa.prototype.pickMetadata=function(e,t,n){T.typeOf.object("windowPosition",t),T.typeOf.object("pickedMetadataInfo",n);let{context:i,frameState:o,defaultView:r}=e,{viewport:s,pickFramebuffer:a}=r;e.view=r,s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;let l=r.passState;l.viewport=Ke.clone(s,l.viewport);let u=Gi.transformWindowToDrawingBuffer(e,t,lG),f=VK(i.drawingBufferHeight,u,1,1,cG);e.jobScheduler.disableThisFrame(),e.updateFrameState(),o.cullingVolume=aG(e,u,f.width,f.height,s),o.invertClassification=!1,o.passes.pick=!0,o.tilesetPassState=EB,o.pickingMetadata=!0,o.pickedMetadataInfo=n,i.uniformState.update(o),e.updateEnvironment(),l=a.begin(f,s),e.updateAndExecuteCommands(l,SB);let h=e._environmentState.useOIT;e._environmentState.useOIT=!1,e.resolveFramebuffers(l),e._environmentState.useOIT=h;let p=a.readCenterPixel(f);return i.endFrame(),o.pickingMetadata=!1,hB.decodeMetadataValues(n.classProperty,n.metadataProperty,p)};function z_t(e,t){let{defaultView:n,context:i,frameState:o,environmentState:r}=e,{viewport:s,pickDepthFramebuffer:a}=n;e.view=n,s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;let l=n.passState;l.viewport=Ke.clone(s,l.viewport),e.clearPasses(o.passes),o.passes.pick=!0,o.passes.depth=!0,o.cullingVolume=aG(e,t,1,1,s),o.tilesetPassState=EB,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,l=a.update(i,t,s),e.updateAndExecuteCommands(l,SB),e.resolveFramebuffers(l),i.endFrame()}var H_t=new Ci,G_t=new bl,j_t=new on,W_t=new jo;oa.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(T.defined("windowPosition",t),!e.context.depthTexture)throw new E("Picking from the depth buffer is not supported. Check pickPositionSupported.");let i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return d.clone(this._pickPositionCache[i],n);let{context:o,frameState:r,camera:s,defaultView:a}=e,{uniformState:l}=o;e.view=a;let u=Gi.transformWindowToDrawingBuffer(e,t,lG);e.pickTranslucentDepth?z_t(e,u):(e.updateFrameState(),l.update(r),e.updateEnvironment()),u.y=e.drawingBufferHeight-u.y;let f;c(s.frustum.fov)?f=s.frustum.clone(H_t):c(s.frustum.infiniteProjectionMatrix)?f=s.frustum.clone(G_t):c(s.frustum.width)?f=s.frustum.clone(j_t):f=s.frustum.clone(W_t);let{frustumCommandsList:h}=a,p=h.length;for(let g=0;g<p;++g){let y=this.getPickDepth(e,g).getDepth(o,u.x,u.y);if(c(y)&&y>0&&y<1){let b=h[g],x;return e.mode===oe.SCENE2D?(x=s.position.z,s.position.z=x-b.near+1,f.far=Math.max(1,b.far-b.near),f.near=1,l.update(r),l.updateFrustum(f)):(f.near=b.near*(g!==0?e.opaqueFrustumNearOffset:1),f.far=b.far,l.updateFrustum(f)),n=Gi.drawingBufferToWorldCoordinates(e,u,y,n),e.mode===oe.SCENE2D&&(s.position.z=x,l.update(r)),this._pickPositionCache[i]=d.clone(n),n}}this._pickPositionCache[i]=void 0};var q_t=new he;oa.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),c(n)&&e.mode!==oe.SCENE3D){d.fromElements(n.y,n.z,n.x,n);let i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,q_t);o.cartographicToCartesian(r,n)}return n};function pTe(e,t){let n,i,o=[],r=[],s=[],a=[];c(e)||(e=Number.MAX_VALUE);let l=t();for(;c(l);){let u=l.object,f=l.position,h=l.exclude;if(c(f)&&!c(u)){o.push(l);break}if(!c(u)||!c(u.primitive)||!h&&(o.push(l),0>=--e))break;let p=u.primitive,g=!1;typeof p.getGeometryInstanceAttributes=="function"&&c(u.id)&&(i=p.getGeometryInstanceAttributes(u.id),c(i)&&c(i.show)&&(g=!0,i.show=bn.toValue(!1,i.show),s.push(i))),u instanceof Ws&&(g=!0,u.show=!1,a.push(u)),g||(p.show=!1,r.push(p)),l=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=bn.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}oa.prototype.drillPick=function(e,t,n,i,o){let r=this;return pTe(n,function(){let l=r.pick(e,t,i,o);if(c(l))return{object:l,position:void 0,exclude:!1}}).map(function(l){return l.object})};var hTe=new d,Y_t=new d;function X_t(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;let i=this;this.promise=new Promise(o=>{i._completePick=()=>{o()}})}function _Te(e,t,n,i){let o=t.direction,r=d.mostOrthogonalAxis(o,hTe),s=d.cross(o,r,hTe),a=d.cross(o,s,Y_t);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=n??mTe,i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function K_t(e,t,n){let i=t.frameState,{ray:o,width:r,tilesets:s}=n,a=e._pickOffscreenView.camera,l=_Te(e,o,r,a),u=O_t;u.camera=a,u.cullingVolume=l;let f=!0,h=s.length;for(let p=0;p<h;++p){let g=s[p];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),f=f&&u.ready)}return f&&n._completePick(),f}oa.prototype.updateMostDetailedRayPicks=function(e){let t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)K_t(this,e,t[n])&&t.splice(n--,1)};function gTe(e,t,n){for(let i=0;i<e.length;++i){let o=e.get(i);o.show&&(c(o.isCesium3DTileset)?(!c(t)||t.indexOf(o)===-1)&&n.push(o):o instanceof fl&&gTe(o,t,n))}}function uG(e,t,n,i,o,r){let s=[];if(gTe(t.primitives,i,s),s.length===0)return Promise.resolve(r());let a=new X_t(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function $_t(e,t){return!c(e)||!c(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function Z_t(e,t,n,i,o,r,s){let{context:a,frameState:l}=t,u=a.uniformState,f=e._pickOffscreenView;t.view=f,_Te(e,n,o,f.camera);let h=Ke.clone(f.viewport,cG),p=f.pickFramebuffer.begin(h,f.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,s?l.tilesetPassState=R_t:l.tilesetPassState=EB,u.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(p,SB),t.resolveFramebuffers(p);let g,m=f.pickFramebuffer.end(h);if(t.context.depthTexture){let{frustumCommandsList:y}=f,b=y.length;for(let x=0;x<b;++x){let C=e.getPickDepth(t,x).getDepth(a,0,0);if(c(C)&&C>0&&C<1){let S=y[x],v=S.near*(x!==0?t.opaqueFrustumNearOffset:1),P=S.far,M=v+C*(P-v);g=mn.getPoint(n,M);break}}}if(t.view=t.defaultView,a.endFrame(),c(m)||c(g))return{object:m,position:g,exclude:!c(g)&&r||$_t(m,i)}}function yTe(e,t,n,i,o,r,s,a){return pTe(i,function(){return Z_t(e,t,n,o,r,s,a)})}function Dw(e,t,n,i,o,r,s){let a=yTe(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function bTe(e,t,n,i,o,r,s,a){return yTe(e,t,n,i,o,r,s,a)}function fG(e,t){return new Promise((n,i)=>{t.then(function(o){let r=e.postRender.addEventListener(function(){r(),n(o)});e.requestRender()}).catch(function(o){i(o)})})}oa.prototype.pickFromRay=function(e,t,n,i){if(T.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return Dw(this,e,t,n,i,!1,!1)};oa.prototype.drillPickFromRay=function(e,t,n,i,o){if(T.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return bTe(this,e,t,n,i,o,!1,!1)};oa.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(T.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");let o=this;return t=mn.clone(t),n=c(n)?n.slice():n,fG(e,uG(o,e,t,n,i,function(){return Dw(o,e,t,n,i,!1,!0)}))};oa.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(T.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");let r=this;return t=mn.clone(t),i=c(i)?i.slice():i,fG(e,uG(r,e,t,i,o,function(){return bTe(r,e,t,n,i,o,!1,!0)}))};var Q_t=new d,J_t=new d,egt=new mn,xTe=new he;function zK(e,t){let n=e.ellipsoid,i=ui._defaultMaxTerrainHeight,o=n.geodeticSurfaceNormalCartographic(t,J_t),r=he.toCartesian(t,n,Q_t),s=egt;s.origin=r,s.direction=o;let a=new mn;return mn.getPoint(s,i,a.origin),d.negate(o,a.direction),a}function TTe(e,t){let n=e.ellipsoid,i=he.fromCartesian(t,n,xTe);return zK(e,i)}function ATe(e,t){let n=e.ellipsoid;return he.fromCartesian(t,n,xTe).height}function tgt(e,t,n,i,o){let r=zK(t,n);return uG(e,t,r,i,o,function(){let s=Dw(e,t,r,i,o,!0,!0);if(c(s))return ATe(t,s.position)})}function ngt(e,t,n,i,o,r){let s=TTe(t,n);return uG(e,t,s,i,o,function(){let a=Dw(e,t,s,i,o,!0,!0);if(c(a))return d.clone(a.position,r)})}oa.prototype.sampleHeight=function(e,t,n,i){if(T.defined("position",t),e.mode!==oe.SCENE3D)throw new E("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeight requires depth texture support. Check sampleHeightSupported.");let o=zK(e,t),r=Dw(this,e,o,n,i,!0,!1);if(c(r))return ATe(e,r.position)};oa.prototype.clampToHeight=function(e,t,n,i,o){if(T.defined("cartesian",t),e.mode!==oe.SCENE3D)throw new E("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeight requires depth texture support. Check clampToHeightSupported.");let r=TTe(e,t),s=Dw(this,e,r,n,i,!0,!1);if(c(s))return d.clone(s.position,o)};oa.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(T.defined("positions",t),e.mode!==oe.SCENE3D)throw new E("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=c(n)?n.slice():n;let o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=tgt(this,e,t[s],n,i);return fG(e,Promise.all(r).then(function(s){let a=s.length;for(let l=0;l<a;++l)t[l].height=s[l];return t}))};oa.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(T.defined("cartesians",t),e.mode!==oe.SCENE3D)throw new E("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=c(n)?n.slice():n;let o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=ngt(this,e,t[s],n,i,t[s]);return fG(e,Promise.all(r).then(function(s){let a=s.length;for(let l=0;l<a;++l)t[l]=s[l];return t}))};oa.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};var wB=oa;var vB=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
color /= texture(autoExposure, vec2(0.5)).r;
#else
color *= vec3(exposure);
#endif
color = czm_acesTonemapping(color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var DB=`precision highp float;
uniform sampler2D randomTexture;
uniform sampler2D depthTexture;
uniform float intensity;
uniform float bias;
uniform float lengthCap;
uniform int stepCount;
uniform int directionCount;
vec4 pixelToEye(vec2 screenCoordinate)
{
vec2 uv = screenCoordinate / czm_viewport.zw;
float depth = czm_readDepth(depthTexture, uv);
vec2 xy = 2.0 * uv - vec2(1.0);
vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
posEC = posEC / posEC.w;
if (depth >= 1.0) {
posEC.z = czm_currentFrustum.y;
}
return posEC;
}
vec3 getNormalXEdge(vec3 positionEC)
{
vec2 centerCoord = gl_FragCoord.xy;
vec3 positionLeft = pixelToEye(centerCoord + vec2(-1.0, 0.0)).xyz;
vec3 positionRight = pixelToEye(centerCoord + vec2(1.0, 0.0)).xyz;
vec3 positionUp = pixelToEye(centerCoord + vec2(0.0, 1.0)).xyz;
vec3 positionDown = pixelToEye(centerCoord + vec2(0.0, -1.0)).xyz;
vec3 dx0 = positionEC - positionLeft;
vec3 dx1 = positionRight - positionEC;
vec3 dy0 = positionEC - positionDown;
vec3 dy1 = positionUp - positionEC;
vec3 dx = length(dx0) < length(dx1) ? dx0 : dx1;
vec3 dy = length(dy0) < length(dy1) ? dy0 : dy1;
return normalize(cross(dx, dy));
}
const float sqrtTwoPi = sqrt(czm_twoPi);
float gaussian(float x, float standardDeviation) {
float argument = x / standardDeviation;
return exp(-0.5 * argument * argument) / (sqrtTwoPi * standardDeviation);
}
void main(void)
{
vec4 positionEC = pixelToEye(gl_FragCoord.xy);
float maxValidDepth = czm_currentFrustum.y - lengthCap;
if (-positionEC.z > maxValidDepth)
{
out_FragColor = vec4(1.0);
return;
}
vec3 normalEC = getNormalXEdge(positionEC.xyz);
float gaussianVariance = lengthCap * sqrt(-positionEC.z);
float stepLength = 3.0 * gaussianVariance / (float(stepCount) + 1.0);
float metersPerPixel = czm_metersPerPixel(positionEC, 1.0);
float pixelsPerStep = max(stepLength / metersPerPixel, 1.0);
stepLength = pixelsPerStep * metersPerPixel;
float angleStepScale = 1.0 / float(directionCount);
float angleStep = angleStepScale * czm_twoPi;
float cosStep = cos(angleStep);
float sinStep = sin(angleStep);
mat2 rotateStep = mat2(cosStep, sinStep, -sinStep, cosStep);
const float randomTextureSize = 255.0;
vec2 randomTexCoord = fract(gl_FragCoord.xy / randomTextureSize);
float randomVal = texture(randomTexture, randomTexCoord).x;
vec2 sampleDirection = vec2(cos(angleStep * randomVal), sin(angleStep * randomVal));
float ao = 0.0;
#if __VERSION__ == 300
for (int i = 0; i < directionCount; i++)
{
#else
for (int i = 0; i < 16; i++)
{
if (i >= directionCount) {
break;
}
#endif
sampleDirection = rotateStep * sampleDirection;
float localAO = 0.0;
vec2 radialStep = pixelsPerStep * sampleDirection;
#if __VERSION__ == 300
for (int j = 0; j < stepCount; j++)
{
#else
for (int j = 0; j < 64; j++)
{
if (j >= stepCount) {
break;
}
#endif
vec2 samplePixel = floor(gl_FragCoord.xy + float(j + 1) * radialStep) + vec2(0.5);
if (clamp(samplePixel, vec2(0.0), czm_viewport.zw) != samplePixel) {
break;
}
vec4 samplePositionEC = pixelToEye(samplePixel);
vec3 stepVector = samplePositionEC.xyz - positionEC.xyz;
float dotVal = clamp(dot(normalEC, normalize(stepVector)), 0.0, 1.0);
dotVal = czm_branchFreeTernary(dotVal > bias, dotVal, 0.0);
dotVal = czm_branchFreeTernary(-samplePositionEC.z <= maxValidDepth, dotVal, 0.0);
float sampleDistance = length(stepVector);
float weight = gaussian(sampleDistance, gaussianVariance);
localAO += weight * dotVal;
}
ao += localAO;
}
ao *= angleStepScale * stepLength;
ao = 1.0 - clamp(ao, 0.0, 1.0);
ao = pow(ao, intensity);
out_FragColor = vec4(vec3(ao), 1.0);
}
`;var PB=`uniform sampler2D colorTexture;
uniform sampler2D ambientOcclusionTexture;
uniform bool ambientOcclusionOnly;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 color = texture(colorTexture, v_textureCoordinates);
vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);
out_FragColor = ambientOcclusionOnly ? ao : ao * color;
}
`;var IB=`uniform sampler2D colorTexture;
uniform float gradations;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
out_FragColor = vec4(rgb, 1.0);
return;
}
#endif
float luminance = czm_luminance(rgb);
float darkness = luminance * gradations;
darkness = (darkness - fract(darkness)) / gradations;
out_FragColor = vec4(vec3(darkness), 1.0);
}
`;var OB=`uniform sampler2D colorTexture;
uniform sampler2D bloomTexture;
uniform bool glowOnly;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 color = texture(colorTexture, v_textureCoordinates);
#ifdef CZM_SELECTED_FEATURE
if (czm_selected()) {
out_FragColor = color;
return;
}
#endif
vec4 bloom = texture(bloomTexture, v_textureCoordinates);
out_FragColor = glowOnly ? bloom : bloom + color;
}
`;var RB=`uniform sampler2D colorTexture;
uniform float brightness;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
vec3 target = vec3(0.0);
out_FragColor = vec4(mix(target, rgb, brightness), 1.0);
}
`;var MB=`uniform sampler2D colorTexture;
uniform float contrast;
uniform float brightness;
in vec2 v_textureCoordinates;
void main(void)
{
vec3 sceneColor = texture(colorTexture, v_textureCoordinates).xyz;
sceneColor = czm_RGBToHSB(sceneColor);
sceneColor.z += brightness;
sceneColor = czm_HSBToRGB(sceneColor);
float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));
sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);
out_FragColor = vec4(sceneColor, 1.0);
}
`;var LB=`uniform sampler2D colorTexture;
uniform sampler2D blurTexture;
uniform sampler2D depthTexture;
uniform float focalDistance;
in vec2 v_textureCoordinates;
vec4 toEye(vec2 uv, float depth)
{
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
posInCamera = posInCamera / posInCamera.w;
return posInCamera;
}
float computeDepthBlur(float depth)
{
float f;
if (depth < focalDistance)
{
f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);
}
else
{
f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);
f = pow(f, 0.1);
}
f *= f;
f = clamp(f, 0.0, 1.0);
return pow(f, 0.5);
}
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
vec4 posInCamera = toEye(v_textureCoordinates, depth);
float d = computeDepthBlur(-posInCamera.z);
out_FragColor = mix(texture(colorTexture, v_textureCoordinates), texture(blurTexture, v_textureCoordinates), d);
}
`;var NB=`uniform sampler2D depthTexture;
in vec2 v_textureCoordinates;
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
out_FragColor = vec4(vec3(depth), 1.0);
}
`;var FB=`uniform sampler2D depthTexture;
uniform float length;
uniform vec4 color;
in vec2 v_textureCoordinates;
void main(void)
{
float directions[3];
directions[0] = -1.0;
directions[1] = 0.0;
directions[2] = 1.0;
float scalars[3];
scalars[0] = 3.0;
scalars[1] = 10.0;
scalars[2] = 3.0;
float padx = czm_pixelRatio / czm_viewport.z;
float pady = czm_pixelRatio / czm_viewport.w;
#ifdef CZM_SELECTED_FEATURE
bool selected = false;
for (int i = 0; i < 3; ++i)
{
float dir = directions[i];
selected = selected || czm_selected(vec2(-padx, dir * pady));
selected = selected || czm_selected(vec2(padx, dir * pady));
selected = selected || czm_selected(vec2(dir * padx, -pady));
selected = selected || czm_selected(vec2(dir * padx, pady));
if (selected)
{
break;
}
}
if (!selected)
{
out_FragColor = vec4(color.rgb, 0.0);
return;
}
#endif
float horizEdge = 0.0;
float vertEdge = 0.0;
for (int i = 0; i < 3; ++i)
{
float dir = directions[i];
float scale = scalars[i];
horizEdge -= texture(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
horizEdge += texture(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
vertEdge -= texture(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
vertEdge += texture(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
}
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
out_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
}
`;var BB=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(exposure);
#endif
const float A = 0.22;
const float B = 0.30;
const float C = 0.10;
const float D = 0.20;
const float E = 0.01;
const float F = 0.30;
const float white = 11.2;
vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;
float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;
c = czm_inverseGamma(c / w);
out_FragColor = vec4(c, fragmentColor.a);
}
`;var kB=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
color /= texture(autoExposure, vec2(0.5)).r;
#else
color *= vec3(exposure);
#endif
color = czm_pbrNeutralTonemapping(color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var UB=`in vec2 v_textureCoordinates;
uniform sampler2D colorTexture;
const float fxaaQualitySubpix = 0.5;
const float fxaaQualityEdgeThreshold = 0.125;
const float fxaaQualityEdgeThresholdMin = 0.0833;
void main()
{
vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;
vec4 color = FxaaPixelShader(
v_textureCoordinates,
colorTexture,
fxaaQualityRcpFrame,
fxaaQualitySubpix,
fxaaQualityEdgeThreshold,
fxaaQualityEdgeThresholdMin);
float alpha = texture(colorTexture, v_textureCoordinates).a;
out_FragColor = vec4(color.rgb, alpha);
}
`;var F0=`#define SAMPLES 8
uniform float delta;
uniform float sigma;
uniform float direction;
uniform sampler2D colorTexture;
#ifdef USE_STEP_SIZE
uniform float stepSize;
#else
uniform vec2 step;
#endif
in vec2 v_textureCoordinates;
void main()
{
vec2 st = v_textureCoordinates;
vec2 dir = vec2(1.0 - direction, direction);
#ifdef USE_STEP_SIZE
vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));
#else
vec2 step = step;
#endif
vec3 g;
g.x = 1.0 / (sqrt(czm_twoPi) * sigma);
g.y = exp((-0.5 * delta * delta) / (sigma * sigma));
g.z = g.y * g.y;
vec4 result = texture(colorTexture, st) * g.x;
for (int i = 1; i < SAMPLES; ++i)
{
g.xy *= g.yz;
vec2 offset = float(i) * dir * step;
result += texture(colorTexture, st - offset) * g.x;
result += texture(colorTexture, st + offset) * g.x;
}
out_FragColor = result;
}
`;var VB=`uniform sampler2D colorTexture;
uniform sampler2D dirtTexture;
uniform sampler2D starTexture;
uniform vec2 dirtTextureDimensions;
uniform float distortion;
uniform float ghostDispersal;
uniform float haloWidth;
uniform float dirtAmount;
uniform float earthRadius;
uniform float intensity;
in vec2 v_textureCoordinates;
#define DISTANCE_TO_SPACE 6500000.0
vec4 getNDCFromWC(vec3 WC, float earthRadius)
{
vec4 positionEC = czm_view * vec4(WC, 1.0);
positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
}
float isInEarth(vec2 texcoord, vec2 sceneSize)
{
vec2 NDC = texcoord * 2.0 - 1.0;
vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);
vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);
NDC.xy -= earthPosSC.xy;
float X = abs(NDC.x) * sceneSize.x;
float Y = abs(NDC.y) * sceneSize.y;
return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));
}
vec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)
{
vec2 sceneSize = czm_viewport.zw;
vec3 color;
if(isSpace)
{
color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture(tex, texcoord + direction * distortion.r).r;
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture(tex, texcoord + direction * distortion.g).g;
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture(tex, texcoord + direction * distortion.b).b;
}
else
{
color.r = texture(tex, texcoord + direction * distortion.r).r;
color.g = texture(tex, texcoord + direction * distortion.g).g;
color.b = texture(tex, texcoord + direction * distortion.b).b;
}
return vec4(clamp(color, 0.0, 1.0), 0.0);
}
void main(void)
{
vec4 originalColor = texture(colorTexture, v_textureCoordinates);
vec3 rgb = originalColor.rgb;
bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;
vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);
vec4 sunPositionEC = czm_view * sunPos;
vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);
sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);
if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))
{
out_FragColor = originalColor;
return;
}
vec2 texcoord = vec2(1.0) - v_textureCoordinates;
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
vec2 invPixelSize = 1.0 / pixelSize;
vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);
vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;
vec3 direction = normalize(vec3(ghostVec, 0.0));
vec4 result = vec4(0.0);
vec4 ghost = vec4(0.0);
for (int i = 0; i < 4; ++i)
{
vec2 offset = fract(texcoord + ghostVec * float(i));
ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);
}
result += ghost;
vec2 haloVec = normalize(ghostVec) * haloWidth;
float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));
weightForHalo = pow(1.0 - weightForHalo, 5.0);
result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;
vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;
if (dirtTexCoords.x > 1.0)
{
dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) :  fract(dirtTexCoords.x);
}
if (dirtTexCoords.y > 1.0)
{
dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) :  fract(dirtTexCoords.y);
}
result += dirtAmount * texture(dirtTexture, dirtTexCoords);
float camrot = czm_view[0].z + czm_view[1].y;
float cosValue = cos(camrot);
float sinValue = sin(camrot);
mat3 rotation = mat3(
cosValue, -sinValue, 0.0,
sinValue, cosValue, 0.0,
0.0, 0.0, 1.0
);
vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);
vec3 st2 = vec3((rotation * st1).xy, 1.0);
vec3 st3 = st2 * 0.5 + vec3(0.5);
vec2 lensStarTexcoord = st3.xy;
float weightForLensFlare = length(vec3(sunPos.xy, 0.0));
float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);
if (!isSpace)
{
result *= oneMinusWeightForLensFlare * intensity * 0.2;
}
else
{
result *= oneMinusWeightForLensFlare * intensity;
result *= texture(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
}
result += texture(colorTexture, v_textureCoordinates);
out_FragColor = result;
}
`;var zB=`uniform sampler2D colorTexture;
uniform vec3 white;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(exposure);
#endif
color = (color * (1.0 + color / white)) / (1.0 + color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var HB=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
float rand(vec2 co)
{
return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
}
void main(void)
{
float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
vec3 green = vec3(0.0, 1.0, 0.0);
out_FragColor = vec4((noiseValue + rgb) * green, 1.0);
}
`;var GB=`uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#else
uniform float exposure;
#endif
void main()
{
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture(autoExposure, vec2(0.5)).r;
color /= exposure;
#else
color *= vec3(exposure);
#endif
color = color / (1.0 + color);
color = czm_inverseGamma(color);
out_FragColor = vec4(color, fragmentColor.a);
}
`;var jB=`uniform sampler2D colorTexture;
uniform sampler2D silhouetteTexture;
in vec2 v_textureCoordinates;
void main(void)
{
vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);
vec4 color = texture(colorTexture, v_textureCoordinates);
out_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
}
`;function nA(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new hi,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new H,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties(nA.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){let e=this._framebuffers;if(c(e))return e[e.length-1].getColorTexture(0)}}});function CTe(e){let t=e._framebuffers;if(!c(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function igt(e,t){CTe(e);let n=e._width,i=e._height,o=t.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let l=0;l<r;++l)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[l]=new hi,s[l].update(t,n,i,1,o);let a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function ETe(e){let t=e._commands;if(!c(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function ogt(e,t){let n;if(t===0)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{let i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function rgt(e,t){let n=`uniform sampler2D colorTexture; 
in vec2 v_textureCoordinates; 
float sampleTexture(vec2 offset) { 
`;return e===0?n+=`    vec4 color = texture(colorTexture, v_textureCoordinates + offset); 
    return czm_luminance(color.rgb); 
`:n+=`    return texture(colorTexture, v_textureCoordinates + offset).r; 
`,n+=`}

`,n+=`uniform vec2 colorTextureDimensions; 
uniform vec2 minMaxLuminance; 
uniform sampler2D previousLuminance; 
void main() { 
    float color = 0.0; 
    float xStep = 1.0 / colorTextureDimensions.x; 
    float yStep = 1.0 / colorTextureDimensions.y; 
    int count = 0; 
    for (int i = 0; i < 3; ++i) { 
        for (int j = 0; j < 3; ++j) { 
            vec2 offset; 
            offset.x = -xStep + float(i) * xStep; 
            offset.y = -yStep + float(j) * yStep; 
            if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { 
                continue; 
            } 
            color += sampleTexture(offset); 
            ++count; 
        } 
    } 
    if (count > 0) { 
        color /= float(count); 
    } 
`,e===t-1&&(n+=`    float previous = texture(previousLuminance, vec2(0.5)).r; 
    color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); 
    color = previous + (color - previous) / (60.0 * 1.5); 
    color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); 
`),n+=`    out_FragColor = vec4(color); 
} 
`,n}function sgt(e,t){ETe(e);let n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(rgt(r,i),{framebuffer:n[r].framebuffer,uniformMap:ogt(e,r)});e._commands=o}nA.prototype.clear=function(e){let t=this._framebuffers;if(!c(t))return;let n=this._clearCommand;c(n)||(n=this._clearCommand=new ei({color:new G(0,0,0,0),framebuffer:void 0}));let i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};nA.prototype.update=function(e){let t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,igt(this,e),sgt(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;let i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o};nA.prototype.execute=function(e,t){this._colorTexture=t;let n=this._commands;if(!c(n))return;let i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};nA.prototype.isDestroyed=function(){return!1};nA.prototype.destroy=function(){return CTe(this),ETe(this),de(this)};var WB=nA;var agt={NEAREST:0,LINEAR:1},ef=agt;function iA(e){e=e??W.EMPTY_OBJECT;let{name:t=jn(),fragmentShader:n,uniforms:i,textureScale:o=1,forcePowerOfTwo:r=!1,sampleMode:s=ef.NEAREST,pixelFormat:a=ke.RGBA,pixelDatatype:l=Ue.UNSIGNED_BYTE,clearColor:u=G.BLACK,scissorRectangle:f}=e;if(T.typeOf.string("options.fragmentShader",n),T.typeOf.number.greaterThan("options.textureScale",o,0),T.typeOf.number.lessThanOrEquals("options.textureScale",o,1),!ke.isColorFormat(a))throw new E("options.pixelFormat must be a color format.");this._fragmentShader=n,this._uniforms=i,this._textureScale=o,this._forcePowerOfTwo=r,this._sampleMode=s,this._pixelFormat=a,this._pixelDatatype=l,this._clearColor=u,this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;let h=new lc;h.scissorTest={enabled:!0,rectangle:c(f)?Ke.clone(f):new Ke},this._passState=h,this._ready=!1,this._name=t,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(iA.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(c(this._textureCache)){let e=this._textureCache.getFramebuffer(this._name);if(c(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});var cgt=/uniform\s+sampler2D\s+depthTexture/g;iA.prototype._isSupported=function(e){return!cgt.test(this._fragmentShader)||e.depthTexture};function lgt(e,t,n){let i=t[n];return(typeof i=="string"||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(o){let r=t[n];t[n]=o;let s=e._actualUniforms,a=s[n];c(a)&&a!==r&&a instanceof Rt&&!c(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof Rt&&e._texturesToRelease.push(r),typeof o=="string"||o instanceof HTMLCanvasElement||o instanceof HTMLImageElement||o instanceof HTMLVideoElement||o instanceof ImageData?e._dirtyUniforms.push(n):s[n]=o}}}function ugt(e,t){return function(){let n=e._actualUniforms[t];return typeof n=="function"?n():n}}function fgt(e,t){return function(){let n=e[t]();if(c(n))return n.dimensions}}function dgt(e){if(c(e._uniformMap))return;let t={},n={},i=e._uniforms,o=e._actualUniforms;for(let r in i){if(!i.hasOwnProperty(r))continue;typeof i[r]!="function"?(t[r]=ugt(e,r),n[r]=lgt(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];let s=t[r]();(typeof s=="string"||s instanceof Rt||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=fgt(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=xt(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}function hgt(e,t){return e=e.replace(/in\s+vec2\s+v_textureCoordinates;/g,""),`#define CZM_SELECTED_FEATURE
uniform sampler2D czm_idTexture;
uniform sampler2D czm_selectedIdTexture;
uniform float czm_selectedIdTextureStep;
in vec2 v_textureCoordinates;
bool czm_selected(vec2 offset)
{
    bool selected = false;
    vec4 id = texture(czm_idTexture, v_textureCoordinates + offset);
    for (int i = 0; i < ${t}; ++i)
    {
        vec4 selectedId = texture(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5));
        if (all(equal(id, selectedId)))
        {
            return true;
        }
    }
    return false;
}
bool czm_selected()
{
    return czm_selected(vec2(0.0));
}

${e}`}function mgt(e,t){if(c(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(c(e._selectedIdTexture)){let o=e._selectedIdTexture.width;n=hgt(n,o)}let i=new He({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function pgt(e){let t=e._sampleMode,n,i;t===ef.LINEAR?(n=Yt.LINEAR,i=li.LINEAR):(n=Yt.NEAREST,i=li.NEAREST);let o=e._sampler;(!c(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function _gt(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function ggt(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function ygt(e,t){let n=e._texturesToRelease;for(let a=0;a<n.length;++a){let l=n[a];l=l&&l.destroy()}n.length=0;let i=e._texturesToCreate;for(let a=0;a<i.length;++a){let{name:l,source:u}=i[a];e._actualUniforms[l]=new Rt({context:t,source:u})}i.length=0;let o=e._dirtyUniforms;if(o.length===0&&!c(e._texturePromise)){e._ready=!0;return}if(o.length===0||c(e._texturePromise))return;let r=e._uniforms,s=[];for(let a=0;a<o.length;++a){let l=o[a],u=r[l],f=e._textureCache.getStageByName(u);if(c(f))e._actualUniforms[l]=ggt(e,u);else if(typeof u=="string"){let h=new we({url:u});s.push(h.fetchImage().then(_gt(e,l)))}else e._texturesToCreate.push({name:l,source:u})}o.length=0,s.length>0?(e._ready=!1,e._texturePromise=Promise.all(s).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function STe(e){c(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();let t=e._textureCache;if(!c(t))return;let n=e._uniforms,i=e._actualUniforms;for(let o in i){if(!i.hasOwnProperty(o))continue;let r=i[o];r instanceof Rt&&(c(t.getStageByName(n[o]))||r.destroy(),e._dirtyUniforms.push(o))}}function bgt(e){let t=c(e._selected)?e._selected.length:0,n=c(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength;if(c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;for(let o=0;o<e._combinedSelected.length;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function xgt(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;let n=e._combinedSelected;if(!c(n))return;let i=0;for(let s=0;s<n.length;++s){let a=n[s];c(a.pickIds)?i+=a.pickIds.length:c(a.pickId)&&++i}if(n.length===0||i===0){let s=new Uint8Array([255,255,255,255]);e._selectedIdTexture=new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:s,width:1,height:1},sampler:Qt.NEAREST});return}let o=0,r=new Uint8Array(i*4);for(let s=0;s<n.length;++s){let a=n[s];if(c(a.pickIds)){let l=a.pickIds,u=l.length;for(let f=0;f<u;++f){let h=l[f].color;r[o]=G.floatToByte(h.red),r[o+1]=G.floatToByte(h.green),r[o+2]=G.floatToByte(h.blue),r[o+3]=G.floatToByte(h.alpha),o+=4}}else if(c(a.pickId)){let l=a.pickId.color;r[o]=G.floatToByte(l.red),r[o+1]=G.floatToByte(l.green),r[o+2]=G.floatToByte(l.blue),r[o+3]=G.floatToByte(l.alpha),o+=4}}e._selectedIdTexture=new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:r,width:i,height:1},sampler:Qt.NEAREST})}iA.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&STe(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=bgt(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0,xgt(this,e),dgt(this),ygt(this,e),mgt(this,e),pgt(this),this._selectedDirty=!1,!this._ready))return;let n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!c(n))return;let i=n.getColorTexture(0),o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!c(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=Ve.fromCache({viewport:new Ke(0,0,i.width,i.height)}))),this._command.renderState=o};iA.prototype.execute=function(e,t,n,i){if(!c(this._command)||!c(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,Qt.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);let o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;c(o)&&(o.context=e),this._command.execute(e,o)};iA.prototype.isDestroyed=function(){return!1};iA.prototype.destroy=function(){return STe(this),de(this)};var ho=iA;function oA(e){e=e??W.EMPTY_OBJECT,T.defined("options.stages",e.stages),T.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=e.inputPreviousStageTexture??!0;let t=e.name;c(t)||(t=jn()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}Object.defineProperties(oA.prototype,{ready:{get:function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){let t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});oA.prototype._isSupported=function(e){let t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0};oA.prototype.get=function(e){return T.typeOf.number.greaterThanOrEquals("index",e,0),T.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function Tgt(e){let t=c(e._selected)?e._selected.length:0,n=c(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}oA.prototype.update=function(e,t){this._selectedDirty=Tgt(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0;let n=this._stages,i=n.length;for(let o=0;o<i;++o){let r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};oA.prototype.isDestroyed=function(){return!1};oA.prototype.destroy=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return de(this)};var au=oA;var Lr={};function HK(e){let o=`#define USE_STEP_SIZE
${F0}`,r=new ho({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:ef.LINEAR}),s=new ho({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:ef.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(l){let u=r.uniforms,f=s.uniforms;u.delta=f.delta=l}},sigma:{get:function(){return r.uniforms.sigma},set:function(l){let u=r.uniforms,f=s.uniforms;u.sigma=f.sigma=l}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(l){let u=r.uniforms,f=s.uniforms;u.stepSize=f.stepSize=l}}}),new au({name:e,stages:[r,s],uniforms:a})}Lr.createBlurStage=function(){return HK("czm_blur")};Lr.createDepthOfFieldStage=function(){let e=HK("czm_depth_of_field_blur"),t=new ho({name:"czm_depth_of_field_composite",fragmentShader:LB,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(i){t.uniforms.focalDistance=i}},delta:{get:function(){return e.uniforms.delta},set:function(i){e.uniforms.delta=i}},sigma:{get:function(){return e.uniforms.sigma},set:function(i){e.uniforms.sigma=i}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(i){e.uniforms.stepSize=i}}}),new au({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};Lr.isDepthOfFieldSupported=function(e){return e.context.depthTexture};Lr.createEdgeDetectionStage=function(){let e=jn();return new ho({name:`czm_edge_detection_${e}`,fragmentShader:FB,uniforms:{length:.25,color:G.clone(G.BLACK)}})};Lr.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function Agt(e){if(!c(e))return Lr.createEdgeDetectionStage();let t=new au({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={},i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a}; 
`,o+=`        vec4 edge${a} = texture(edgeTexture${a}, v_textureCoordinates); 
        if (edge${a}.a > 0.0) 
        { 
            color = edge${a}; 
            break; 
        } 
`,n[`edgeTexture${a}`]=e[a].name;let r=`${i}in vec2 v_textureCoordinates; 
void main() { 
    vec4 color = vec4(0.0); 
    for (int i = 0; i < ${e.length}; i++) 
    { 
${o}    } 
    out_FragColor = color; 
} 
`,s=new ho({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new au({name:"czm_edge_detection_composite",stages:[t,s]})}Lr.createSilhouetteStage=function(e){let t=Agt(e),n=new ho({name:"czm_silhouette_color_edges",fragmentShader:jB,uniforms:{silhouetteTexture:t.name}});return new au({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};Lr.isSilhouetteSupported=function(e){return e.context.depthTexture};Lr.createBloomStage=function(){let e=new ho({name:"czm_bloom_contrast_bias",fragmentShader:MB,uniforms:{contrast:128,brightness:-.3}}),t=HK("czm_bloom_blur"),n=new au({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new ho({name:"czm_bloom_generate_composite",fragmentShader:OB,uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(r){i.uniforms.glowOnly=r}},contrast:{get:function(){return e.uniforms.contrast},set:function(r){e.uniforms.contrast=r}},brightness:{get:function(){return e.uniforms.brightness},set:function(r){e.uniforms.brightness=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}}}),new au({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Lr.createAmbientOcclusionStage=function(){let e=new ho({name:"czm_ambient_occlusion_generate",fragmentShader:DB,uniforms:{intensity:3,bias:.1,lengthCap:.26,directionCount:8,stepCount:32,randomTexture:void 0}}),t=new ho({name:"czm_ambient_occlusion_composite",fragmentShader:PB,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:e.name}}),n={};return Object.defineProperties(n,{intensity:{get:function(){return e.uniforms.intensity},set:function(i){e.uniforms.intensity=i}},bias:{get:function(){return e.uniforms.bias},set:function(i){e.uniforms.bias=i}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(i){e.uniforms.lengthCap=i}},directionCount:{get:function(){return e.uniforms.directionCount},set:function(i){e.uniforms.directionCount=i}},stepCount:{get:function(){return e.uniforms.stepCount},set:function(i){e.uniforms.stepCount=i}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(i){e.uniforms.randomTexture=i}},ambientOcclusionOnly:{get:function(){return t.uniforms.ambientOcclusionOnly},set:function(i){t.uniforms.ambientOcclusionOnly=i}}}),new au({name:"czm_ambient_occlusion",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};Lr.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var Cgt=`#define FXAA_QUALITY_PRESET 39 
${n2}
${UB}`;Lr.createFXAAStage=function(){return new ho({name:"czm_FXAA",fragmentShader:Cgt,sampleMode:ef.LINEAR})};Lr.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=vB,new ho({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Lr.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=BB,new ho({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Lr.createPbrNeutralTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=kB,new ho({name:"czm_pbr_neutral",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Lr.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=GB,new ho({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0,exposure:1}})};Lr.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=zB,new ho({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:G.WHITE,autoExposure:void 0,exposure:1}})};Lr.createAutoExposureStage=function(){return new WB};Lr.createBlackAndWhiteStage=function(){return new ho({name:"czm_black_and_white",fragmentShader:IB,uniforms:{gradations:5}})};Lr.createBrightnessStage=function(){return new ho({name:"czm_brightness",fragmentShader:RB,uniforms:{brightness:.5}})};Lr.createNightVisionStage=function(){return new ho({name:"czm_night_vision",fragmentShader:HB})};Lr.createDepthViewStage=function(){return new ho({name:"czm_depth_view",fragmentShader:NB})};Lr.createLensFlareStage=function(){return new ho({name:"czm_lens_flare",fragmentShader:VB,uniforms:{dirtTexture:tn("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:tn("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:ie.WGS84.maximumRadius}})};var tf=Lr;function Ag(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function YB(e){for(;c(e.length);)e=e.get(e.length-1);return e.name}function GK(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;let r=n[i.name]={};if(c(o)){let a=e.getStageByName(o);r[YB(a)]=!0}let s=i.uniforms;if(c(s)){let a=Object.getOwnPropertyNames(s),l=a.length;for(let u=0;u<l;++u){let f=s[a[u]];if(typeof f=="string"){let h=e.getStageByName(f);c(h)&&(r[YB(h)]=!0)}}}return i.name}function qB(e,t,n,i,o){if(c(i.enabled)&&!i.enabled||c(i._isSupported)&&!i._isSupported(t))return o;let r=o,s=!c(i.inputPreviousStageTexture)||i.inputPreviousStageTexture,a=o,l=i.length;for(let h=0;h<l;++h){let p=i.get(h);c(p.length)?a=qB(e,t,n,p,o):a=GK(e,t,n,p,o),s&&(o=a)}let u,f;if(s)for(u=1;u<l;++u)f=YB(i.get(u)),c(n[f])||(n[f]={}),n[f][r]=!0;else for(u=1;u<l;++u){f=YB(i.get(u));let h=n[f];for(let p=0;p<u;++p)h[YB(i.get(p))]=!0}return a}function Egt(e,t){let n={};if(c(e.ambientOcclusion)){let i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa,a=qB(e,t,n,i,void 0);a=qB(e,t,n,o,a),a=GK(e,t,n,r,a),a=qB(e,t,n,e,a),GK(e,t,n,s,a)}else qB(e,t,n,e,void 0);return n}function Sgt(e,t,n){let o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,l=o._pixelDatatype,u=o._clearColor,f,h,p=e._framebuffers,g=p.length;for(f=0;f<g;++f){if(h=p[f],r!==h.textureScale||s!==h.forcePowerOfTwo||a!==h.pixelFormat||l!==h.pixelDatatype||!G.equals(u,h.clearColor))continue;let m=h.stages,y=m.length,b=!1;for(let x=0;x<y;++x)if(n[m[x]]){b=!0;break}if(!b)break}return c(h)&&f<g?(h.stages.push(t),h):(h={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:l,clearColor:u,stages:[t],buffer:new hi({pixelFormat:a,pixelDatatype:l}),clear:void 0},p.push(h),h)}function wgt(e,t){let n=Egt(e._collection,t);for(let i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=Sgt(e,i,n[i]))}function jK(e){let t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function vgt(e,t){let n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){let a=o[s],l=a.textureScale,u=Math.ceil(n*l),f=Math.ceil(i*l),h=Math.min(u,f);a.forcePowerOfTwo&&(O.isPowerOfTwo(h)||(h=O.nextPowerOfTwo(h)),u=h,f=h),a.buffer.update(t,u,f),a.clear=new ei({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}Ag.prototype.updateDependencies=function(){this._updateDependencies=!0};Ag.prototype.update=function(e){let t=this._collection,n=this._updateDependencies,i=c(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=c(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=c(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=c(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!c(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(jK(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&wgt(this,e);let l=e.drawingBufferWidth,u=e.drawingBufferHeight,f=this._width!==l||this._height!==u;!n&&!f||(this._width=l,this._height=u,this._updateDependencies=!1,jK(this),vgt(this,e))};Ag.prototype.clear=function(e){let t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};Ag.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};Ag.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};Ag.prototype.getFramebuffer=function(e){let t=this._stageNameToFramebuffer[e];if(c(t))return t.buffer.framebuffer};Ag.prototype.isDestroyed=function(){return!1};Ag.prototype.destroy=function(){return jK(this),de(this)};var rA=Ag;var Pw={REINHARD:"REINHARD",MODIFIED_REINHARD:"MODIFIED_REINHARD",FILMIC:"FILMIC",ACES:"ACES",PBR_NEUTRAL:"PBR_NEUTRAL"};function wTe(e){return e===Pw.REINHARD||e===Pw.MODIFIED_REINHARD||e===Pw.FILMIC||e===Pw.ACES||e===Pw.PBR_NEUTRAL}var Cg=Object.freeze(Pw);var WK=[];function xl(){let e=tf.createFXAAStage(),t=tf.createAmbientOcclusionStage(),n=tf.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=tf.createAutoExposureStage(),this._exposure=1,this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Cg.PBR_NEUTRAL;let i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;let o=new rA(this),r={},s=WK;for(s.push(e,t,n,i);s.length>0;){let l=s.pop();r[l.name]=l,l._textureCache=o;let u=l.length;if(c(u))for(let f=0;f<u;++f)s.push(l.get(f))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;let a=this;t.uniforms.randomTexture=function(){return a._randomTexture},this._ao=t,this._bloom=n,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=r,this._textureCache=o}Object.defineProperties(xl.prototype,{ready:{get:function(){let e=!1,t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){let l=t[a];e=e||l.ready&&l.enabled}let i=this._fxaa,o=this._ao,r=this._bloom,s=this._tonemapping;return e=e||i.ready&&i.enabled,e=e||o.ready&&o.enabled,e=e||r.ready&&r.enabled,e=e||s.ready&&s.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return qK(this),this._stages.length}},outputTexture:{get:function(){let e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);let t=this._stages,n=t.length;for(let s=n-1;s>=0;--s){let a=t[s];if(c(a)&&a.ready&&a.enabled)return this.getOutputTexture(a.name)}let i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);let o=this._bloom;if(o.enabled&&o.ready)return this.getOutputTexture(o.name);let r=this._ao;if(r.enabled&&r.ready)return this.getOutputTexture(r.name)}},hasSelected:{get:function(){let e=this._stages.slice();for(;e.length>0;){let t=e.pop();if(!c(t))continue;if(c(t.selected))return!0;let n=t.length;if(c(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;if(!wTe(e))throw new E("tonemapper was set to an invalid value.");c(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());let t=this._autoExposureEnabled,n;switch(e){case Cg.REINHARD:n=tf.createReinhardTonemappingStage(t);break;case Cg.MODIFIED_REINHARD:n=tf.createModifiedReinhardTonemappingStage(t);break;case Cg.FILMIC:n=tf.createFilmicTonemappingStage(t);break;case Cg.PBR_NEUTRAL:n=tf.createPbrNeutralTonemappingStage(t);break;default:n=tf.createAcesTonemappingStage(t);break}if(t){let i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}else n.uniforms.exposure=this._exposure;this._tonemapper=e,this._tonemapping=n,c(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}},exposure:{get:function(){return this._exposure},set:function(e){this._tonemapping.uniforms.exposure=e,this._exposure=e}}});function qK(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;let t=[],n=e._stages;for(let i=0,o=0;i<n.length;++i){let r=n[i];r&&(r._index=o++,t.push(r))}e._stages=t}xl.prototype.add=function(e){T.typeOf.object("stage",e);let t=this._stageNames,n=WK;for(n.push(e);n.length>0;){let o=n.pop();if(c(t[o.name]))throw new E(`${o.name} has already been added to the collection or does not have a unique name.`);t[o.name]=o,o._textureCache=this._textureCache;let r=o.length;if(c(r))for(let s=0;s<r;++s)n.push(o.get(s))}let i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e};xl.prototype.remove=function(e){if(!this.contains(e))return!1;let t=this._stageNames,n=WK;for(n.push(e);n.length>0;){let i=n.pop();delete t[i.name];let o=i.length;if(c(o))for(let r=0;r<o;++r)n.push(i.get(r))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0};xl.prototype.contains=function(e){return c(e)&&c(e._index)&&e._textureCache===this._textureCache};xl.prototype.get=function(e){qK(this);let t=this._stages,n=t.length;return T.typeOf.number.greaterThanOrEquals("stages length",n,0),T.typeOf.number.greaterThanOrEquals("index",e,0),T.typeOf.number.lessThan("index",e,n),t[e]};xl.prototype.removeAll=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};xl.prototype.getStageByName=function(e){return this._stageNames[e]};xl.prototype.update=function(e,t,n){qK(this);let i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;let r=this._stages;o.length=r.length;let s=0;for(let x=0;x<r.length;++x){let A=r[x];A.ready&&A.enabled&&A._isSupported(e)&&(o[s++]=A)}o.length=s;let a=s!==i.length;if(!a){for(let x=0;x<s;++x)if(o[x]!==i[x]){a=!0;break}}let l=this._ao,u=this._bloom,f=this._autoExposure,h=this._tonemapping,p=this._fxaa;h.enabled=n;let g=l.enabled&&l._isSupported(e),m=u.enabled&&u._isSupported(e),y=h.enabled&&h._isSupported(e),b=p.enabled&&p._isSupported(e);if((a||this._textureCacheDirty||g!==this._aoEnabled||m!==this._bloomEnabled||y!==this._tonemappingEnabled||b!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=g,this._bloomEnabled=m,this._tonemappingEnabled=y,this._fxaaEnabled=b,this._textureCacheDirty=!1),c(this._randomTexture)&&!g&&(this._randomTexture.destroy(),this._randomTexture=void 0),!c(this._randomTexture)&&g){let A=new Uint8Array(196608);for(let C=0;C<196608;C+=3)A[C]=Math.floor(Math.random()*255);this._randomTexture=new Rt({context:e,pixelFormat:ke.RGB,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:A,width:256,height:256},sampler:new Qt({wrapS:gn.REPEAT,wrapT:gn.REPEAT,minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST})})}this._textureCache.update(e),p.update(e,t),l.update(e,t),u.update(e,t),h.update(e,t),this._autoExposureEnabled&&f.update(e,t);for(let x=0;x<r.length;++x)r[x].update(e,t);s=0;for(let x=0;x<r.length;++x){let A=r[x];A.ready&&A.enabled&&A._isSupported(e)&&s++}a=s!==o.length,a&&this.update(e,t,n)};xl.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function sA(e){for(;c(e.length);)e=e.get(e.length-1);return e.outputTexture}xl.prototype.getOutputTexture=function(e){let t=this.getStageByName(e);if(c(t))return sA(t)};function hp(e,t,n,i,o){if(c(e.execute)){e.execute(t,n,i,o);return}if(e.inputPreviousStageTexture){hp(e.get(0),t,n,i,o);for(let r=1;r<e.length;++r)hp(e.get(r),t,sA(e.get(r-1)),i,o)}else for(let r=0;r<e.length;++r)hp(e.get(r),t,n,i,o)}xl.prototype.execute=function(e,t,n,i){let o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,l=this._bloom,u=this._autoExposure,f=this._tonemapping,h=a.enabled&&a._isSupported(e),p=l.enabled&&l._isSupported(e),g=this._autoExposureEnabled,m=f.enabled&&f._isSupported(e),y=s.enabled&&s._isSupported(e);if(!y&&!h&&!p&&!m&&r===0)return;let b=t;h&&a.ready&&(hp(a,e,b,n,i),b=sA(a)),p&&l.ready&&(hp(l,e,b,n,i),b=sA(l)),g&&u.ready&&hp(u,e,b,n,i),m&&f.ready&&(hp(f,e,b,n,i),b=sA(f));let x=b;if(r>0){hp(o[0],e,b,n,i);for(let A=1;A<r;++A)hp(o[A],e,sA(o[A-1]),n,i);x=sA(o[r-1])}y&&s.ready&&hp(s,e,x,n,i)};xl.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(su,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};xl.prototype.isDestroyed=function(){return!1};xl.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),de(this)};var XB=xl;var Dgt={SHIFT:0,CTRL:1,ALT:2},ra=Object.freeze(Dgt);var Pgt={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19},An=Object.freeze(Pgt);function B0(e,t,n){let i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;let o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function QK(e,t){let n=e;return c(t)&&(n+=`+${t}`),n}function aA(e){if(e.shiftKey)return ra.SHIFT;if(e.ctrlKey)return ra.CTRL;if(e.altKey)return ra.ALT}var Us={LEFT:0,MIDDLE:1,RIGHT:2};function nf(e,t,n,i){function o(r){i(e,r)}Vt.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function Igt(e){let t=e._element,n=c(t.disableRootEvents)?t:document;Vt.supportsPointerEvents()?(nf(e,"pointerdown",t,Fgt),nf(e,"pointerup",t,FTe),nf(e,"pointermove",t,Bgt),nf(e,"pointercancel",t,FTe)):(nf(e,"mousedown",t,BTe),nf(e,"mouseup",n,kTe),nf(e,"mousemove",n,UTe),nf(e,"touchstart",t,Lgt),nf(e,"touchend",n,OTe),nf(e,"touchmove",n,Ngt),nf(e,"touchcancel",n,OTe)),nf(e,"dblclick",t,Rgt);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",nf(e,i,t,Mgt)}function Ogt(e){let t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}var vTe={position:new H};function JK(e){e._lastSeenTouchEvent=Ti()}function e$(e){return Ti()-e._lastSeenTouchEvent>Wh.mouseEmulationIgnoreMilliseconds}function ZK(e,t,n){let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function BTe(e,t){if(!e$(e))return;let n=t.button;e._buttonDown[n]=!0;let i;if(n===Us.LEFT)i=An.LEFT_DOWN;else if(n===Us.MIDDLE)i=An.MIDDLE_DOWN;else if(n===Us.RIGHT)i=An.RIGHT_DOWN;else return;let o=B0(e,t,e._primaryPosition);H.clone(o,e._primaryStartPosition),H.clone(o,e._primaryPreviousPosition);let r=aA(t),s=e.getInputAction(i,r);c(s)&&(H.clone(o,vTe.position),s(vTe),t.preventDefault())}var DTe={position:new H},PTe={position:new H};function YK(e,t,n,i){let o=aA(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(c(r)||c(s)){let a=B0(e,i,e._primaryPosition);if(c(r)&&(H.clone(a,DTe.position),r(DTe)),c(s)){let l=e._primaryStartPosition;ZK(l,a,e._clickPixelTolerance)&&(H.clone(a,PTe.position),s(PTe))}}}function kTe(e,t){if(!e$(e))return;let n=t.button;n!==Us.LEFT&&n!==Us.MIDDLE&&n!==Us.RIGHT||(e._buttonDown[Us.LEFT]&&(YK(e,An.LEFT_UP,An.LEFT_CLICK,t),e._buttonDown[Us.LEFT]=!1),e._buttonDown[Us.MIDDLE]&&(YK(e,An.MIDDLE_UP,An.MIDDLE_CLICK,t),e._buttonDown[Us.MIDDLE]=!1),e._buttonDown[Us.RIGHT]&&(YK(e,An.RIGHT_UP,An.RIGHT_CLICK,t),e._buttonDown[Us.RIGHT]=!1))}var XK={startPosition:new H,endPosition:new H};function UTe(e,t){if(!e$(e))return;let n=aA(t),i=B0(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(An.MOUSE_MOVE,n);c(r)&&(H.clone(o,XK.startPosition),H.clone(i,XK.endPosition),r(XK)),H.clone(i,o),(e._buttonDown[Us.LEFT]||e._buttonDown[Us.MIDDLE]||e._buttonDown[Us.RIGHT])&&t.preventDefault()}var ITe={position:new H};function Rgt(e,t){let n=t.button,i;if(n===Us.LEFT)i=An.LEFT_DOUBLE_CLICK;else return;let o=aA(t),r=e.getInputAction(i,o);c(r)&&(B0(e,t,ITe.position),r(ITe))}function Mgt(e,t){let n;if(c(t.deltaY)){let r=t.deltaMode;r===t.DOM_DELTA_PIXEL?n=-t.deltaY:r===t.DOM_DELTA_LINE?n=-t.deltaY*40:n=-t.deltaY*120}else t.detail>0?n=t.detail*-120:n=t.wheelDelta;if(!c(n))return;let i=aA(t),o=e.getInputAction(An.WHEEL,i);c(o)&&(o(n),t.preventDefault())}function Lgt(e,t){JK(e);let n=t.changedTouches,i,o=n.length,r,s,a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,B0(e,r,new H));dG(e,t);let l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.set(s,H.clone(a.get(s)))}function OTe(e,t){JK(e);let n=t.changedTouches,i,o=n.length,r,s,a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);dG(e,t);let l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.remove(s)}var RTe={position:new H},KK={position1:new H,position2:new H},MTe={position:new H},LTe={position:new H},NTe={position:new H};function dG(e,t){let n=aA(t),i=e._positions,o=i.length,r,s,a=e._isPinching;if(o!==1&&e._buttonDown[Us.LEFT]){if(e._buttonDown[Us.LEFT]=!1,c(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(An.LEFT_UP,n),c(r)&&(H.clone(e._primaryPosition,MTe.position),r(MTe)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(An.LEFT_CLICK,n),c(s))){let l=e._primaryStartPosition,u=e._previousPositions.values[0];ZK(l,u,e._clickPixelTolerance)&&(H.clone(e._primaryPosition,LTe.position),s(LTe))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(An.PINCH_END,n),c(r)&&r()),o===1&&!a){let l=i.values[0];H.clone(l,e._primaryPosition),H.clone(l,e._primaryStartPosition),H.clone(l,e._primaryPreviousPosition),e._buttonDown[Us.LEFT]=!0,r=e.getInputAction(An.LEFT_DOWN,n),c(r)&&(H.clone(l,RTe.position),r(RTe)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(An.RIGHT_CLICK,n),c(s))){let u=e._primaryStartPosition,f=e._previousPositions.values[0];ZK(u,f,e._holdPixelTolerance)&&(H.clone(e._primaryPosition,NTe.position),s(NTe))}},Wh.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(An.PINCH_START,n),c(r)&&(H.clone(i.values[0],KK.position1),H.clone(i.values[1],KK.position2),r(KK),t.preventDefault()))}function Ngt(e,t){JK(e);let n=t.changedTouches,i,o=n.length,r,s,a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;let u=a.get(s);c(u)&&B0(e,r,u)}VTe(e,t);let l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,H.clone(a.get(s),l.get(s))}var $K={startPosition:new H,endPosition:new H},KB={distance:{startPosition:new H,endPosition:new H},angleAndHeight:{startPosition:new H,endPosition:new H}};function VTe(e,t){let n=aA(t),i=e._positions,o=e._previousPositions,r=i.length,s;if(r===1&&e._buttonDown[Us.LEFT]){let a=i.values[0];H.clone(a,e._primaryPosition);let l=e._primaryPreviousPosition;s=e.getInputAction(An.MOUSE_MOVE,n),c(s)&&(H.clone(l,$K.startPosition),H.clone(a,$K.endPosition),s($K)),H.clone(a,l),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(An.PINCH_MOVE,n),c(s))){let a=i.values[0],l=i.values[1],u=o.values[0],f=o.values[1],h=l.x-a.x,p=l.y-a.y,g=Math.sqrt(h*h+p*p)*.25,m=f.x-u.x,y=f.y-u.y,b=Math.sqrt(m*m+y*y)*.25,x=(l.y+a.y)*.125,A=(f.y+u.y)*.125,C=Math.atan2(p,h),S=Math.atan2(y,m);H.fromElements(0,b,KB.distance.startPosition),H.fromElements(0,g,KB.distance.endPosition),H.fromElements(S,A,KB.angleAndHeight.startPosition),H.fromElements(C,x,KB.angleAndHeight.endPosition),s(KB)}}function Fgt(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){let n=e._positions,i=t.pointerId;n.set(i,B0(e,t,new H)),dG(e,t),e._previousPositions.set(i,H.clone(n.get(i)))}else BTe(e,t)}function FTe(e,t){if(t.pointerType==="touch"){let n=e._positions,i=t.pointerId;n.remove(i),dG(e,t),e._previousPositions.remove(i)}else kTe(e,t)}function Bgt(e,t){if(t.pointerType==="touch"){let n=e._positions,i=t.pointerId,o=n.get(i);if(!c(o))return;B0(e,t,o),VTe(e,t);let r=e._previousPositions;H.clone(n.get(i),r.get(i))}else UTe(e,t)}function Wh(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-Wh.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new H,this._primaryPosition=new H,this._primaryPreviousPosition=new H,this._positions=new Et,this._previousPositions=new Et,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=e??document,Igt(this)}Wh.prototype.setInputAction=function(e,t,n){if(!c(e))throw new E("action is required.");if(!c(t))throw new E("type is required.");let i=QK(t,n);this._inputEvents[i]=e};Wh.prototype.getInputAction=function(e,t){if(!c(e))throw new E("type is required.");let n=QK(e,t);return this._inputEvents[n]};Wh.prototype.removeInputAction=function(e,t){if(!c(e))throw new E("type is required.");let n=QK(e,t);delete this._inputEvents[n]};Wh.prototype.isDestroyed=function(){return!1};Wh.prototype.destroy=function(){return Ogt(this),de(this)};Wh.mouseEmulationIgnoreMilliseconds=800;Wh.touchHoldDelayMilliseconds=1500;var of=Wh;function cA(e){T.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}cA.prototype.completeMorph=function(){c(this._completeMorph)&&this._completeMorph()};cA.prototype.morphTo2D=function(e,t){c(this._completeMorph)&&this._completeMorph();let n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof on,!(this._previousMode===oe.SCENE2D||this._previousMode===oe.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE2D,!0),n._mode=oe.MORPHING,n.camera._setTransform(B.IDENTITY),this._previousMode===oe.COLUMBUS_VIEW?_yt(this,e):Cyt(this,e,t),e===0&&c(this._completeMorph)&&this._completeMorph())};var kgt=new d,Ugt=new d,Vgt=new d,zgt=new d,Hgt=new d,Ggt=new d,jgt=new d,Wgt=new he,qgt=new B,Ygt=new Ci,Xgt=new on,Kgt={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};cA.prototype.morphToColumbusView=function(e,t){c(this._completeMorph)&&this._completeMorph();let n=this._scene;if(this._previousMode=n.mode,this._previousMode===oe.COLUMBUS_VIEW||this._previousMode===oe.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,oe.COLUMBUS_VIEW,!0),n.camera._setTransform(B.IDENTITY);let i=kgt,o=Ugt,r=Vgt;if(e>0)i.x=0,i.y=-1,i.z=1,i=d.multiplyByScalar(d.normalize(i,i),5*t.maximumRadius,i),d.negate(d.normalize(i,o),o),d.cross(d.UNIT_X,o,r);else{let u=n.camera;if(this._previousMode===oe.SCENE2D)d.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,d.negate(d.UNIT_Z,o),d.clone(d.UNIT_Y,r);else{d.clone(u.positionWC,i),d.clone(u.directionWC,o),d.clone(u.upWC,r);let f=t.scaleToGeodeticSurface(i,jgt),h=Ot.eastNorthUpToFixedFrame(f,t,qgt);B.inverseTransformation(h,h),n.mapProjection.project(t.cartesianToCartographic(i,Wgt),i),B.multiplyByPointAsVector(h,o,o),B.multiplyByPointAsVector(h,r,r)}}let s;this._morphToOrthographic?(s=Xgt,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=Ygt,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=O.toRadians(60));let a=Kgt;a.position=i,a.direction=o,a.up=r,a.frustum=s;let l=Syt(a);$B(this,l),this._previousMode===oe.SCENE2D?Eyt(this,e,a,l):(a.position2D=B.multiplyByPoint(ro.TRANSFORM_2D,i,zgt),a.direction2D=B.multiplyByPointAsVector(ro.TRANSFORM_2D,o,Hgt),a.up2D=B.multiplyByPointAsVector(ro.TRANSFORM_2D,r,Ggt),n._mode=oe.MORPHING,ZTe(this,e,a,l)),e===0&&c(this._completeMorph)&&this._completeMorph()};var i$={position:new d,direction:new d,up:new d,frustum:void 0},HTe=new Ci;cA.prototype.morphTo3D=function(e,t){c(this._completeMorph)&&this._completeMorph();let n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===oe.SCENE3D||this._previousMode===oe.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE3D,!0),n._mode=oe.MORPHING,n.camera._setTransform(B.IDENTITY),this._previousMode===oe.SCENE2D)syt(this,e,t);else{let i;e>0?(i=i$,d.fromDegrees(0,0,5*t.maximumRadius,t,i.position),d.negate(i.position,i.direction),d.normalize(i.direction,i.direction),d.clone(d.UNIT_Z,i.up)):i=GTe(this,t);let o,r=n.camera;r.frustum instanceof on?o=r.frustum.clone():(o=HTe,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=O.toRadians(60)),i.frustum=o;let s=JTe(i);$B(this,s),n$(this,e,i,s)}e===0&&c(this._completeMorph)&&this._completeMorph()}};cA.prototype.isDestroyed=function(){return!1};cA.prototype.destroy=function(){return hG(this),de(this)};function $B(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new of(e._scene.canvas);let n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,An.LEFT_DOWN),e._morphHandler.setInputAction(n,An.MIDDLE_DOWN),e._morphHandler.setInputAction(n,An.RIGHT_DOWN),e._morphHandler.setInputAction(n,An.WHEEL)}}function hG(e){let t=e._currentTweens;for(let n=0;n<t.length;++n)t[n].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}var $gt=new he,Zgt=new d,Qgt=new B;function GTe(e,t){let n=e._scene,i=n.camera,o=i$,r=o.position,s=o.direction,a=o.up,l=n.mapProjection.unproject(i.position,$gt);t.cartographicToCartesian(l,r);let u=t.scaleToGeodeticSurface(r,Zgt),f=Ot.eastNorthUpToFixedFrame(u,t,Qgt);return B.multiplyByPointAsVector(f,i.direction,s),B.multiplyByPointAsVector(f,i.up,a),o}var Jgt=new d,eyt=new d,tyt=new d,nyt=new d,iyt=new d,oyt=new d;function n$(e,t,n,i){t*=.5;let o=e._scene,r=o.camera,s=d.clone(r.position,Jgt),a=d.clone(r.direction,eyt),l=d.clone(r.up,tyt),u=B.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,n.position,nyt),f=B.multiplyByPointAsVector(ro.TRANSFORM_2D_INVERSE,n.direction,iyt),h=B.multiplyByPointAsVector(ro.TRANSFORM_2D_INVERSE,n.up,oyt);function p(m){bd(s,u,m.time,r.position),bd(a,f,m.time,r.direction),bd(l,h,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}let g=o.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){QTe(e,o,0,1,t,i)}});e._currentTweens.push(g)}var ryt=new on,jTe=new d,WTe=new d,qTe=new d,o$=new d,YTe=new d,XTe=new d;function syt(e,t,n){t/=3;let i=e._scene,o=i.camera,r;t>0?(r=i$,d.fromDegrees(0,0,5*n.maximumRadius,n,r.position),d.negate(r.position,r.direction),d.normalize(r.direction,r.direction),d.clone(d.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=GTe(e,n));let s;e._morphToOrthographic?(s=ryt,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=HTe,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=O.toRadians(60)),r.frustum=s;let a=JTe(r);$B(e,a);let l;e._morphToOrthographic?l=function(){n$(e,t,r,a)}:l=function(){$Te(e,t,r,function(){n$(e,t,r,a)})},t>0?(i._mode=oe.SCENE2D,o.flyTo({duration:t,destination:d.fromDegrees(0,0,5*n.maximumRadius,n,o$),complete:function(){i._mode=oe.MORPHING,l()}})):l()}function bd(e,t,n,i){return d.lerp(e,t,n,i)}function KTe(e,t,n,i,o){let r=e._scene,s=r.camera;if(s.frustum instanceof on)return;let a=s.frustum.fov,l=O.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(l*.5)+1e7;function f(p){s.frustum.fov=O.lerp(a,l,p.time);let g=u/Math.tan(s.frustum.fov*.5);i(s,g)}let h=r.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(h)}var ayt=new d,cyt=new d,lyt=new d,t$=new d,uyt=new d,fyt=new d,dyt=new jo,hyt=new mn,myt=new d,pyt={position:void 0,direction:void 0,up:void 0,frustum:void 0};function _yt(e,t){t*=.5;let n=e._scene,i=n.camera,o=d.clone(i.position,ayt),r=d.clone(i.direction,cyt),s=d.clone(i.up,lyt),a=d.negate(d.UNIT_Z,uyt),l=d.clone(d.UNIT_Y,fyt),u=t$;if(t>0)d.clone(d.ZERO,t$),u.z=5*n.ellipsoid.maximumRadius;else{d.clone(o,t$);let b=hyt;B.multiplyByPoint(ro.TRANSFORM_2D,o,b.origin),B.multiplyByPointAsVector(ro.TRANSFORM_2D,r,b.direction);let x=n.globe;if(c(x)){let A=x.pickWorldCoordinates(b,n,!0,myt);c(A)&&(B.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,A,u),u.z+=d.distance(o,u))}}let f=dyt;f.right=u.z*.5,f.left=-f.right,f.top=f.right*(n.drawingBufferHeight/n.drawingBufferWidth),f.bottom=-f.top;let h=pyt;h.position=u,h.direction=a,h.up=l,h.frustum=f;let p=eAe(h);$B(e,p);function g(b){bd(o,u,b.time,i.position),bd(r,a,b.time,i.direction),bd(s,l,b.time,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function m(b,x){b.position.z=x}let y=n.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){KTe(e,t,h,m,p)}});e._currentTweens.push(y)}var zTe=new he,gyt={position:new d,direction:new d,up:new d,position2D:new d,direction2D:new d,up2D:new d,frustum:new jo},yyt={position:new d,direction:new d,up:new d,frustum:void 0},byt=new d,xyt=new mn,Tyt=new B,Ayt=new d;function Cyt(e,t,n){t*=.5;let i=e._scene,o=i.camera,r=gyt;if(t>0)d.clone(d.ZERO,r.position),r.position.z=5*n.maximumRadius,d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,zTe),i.mapProjection.project(zTe,r.position),d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);let h=xyt;d.clone(r.position2D,h.origin);let p=d.clone(o.directionWC,h.direction),g=n.scaleToGeodeticSurface(o.positionWC,Ayt),m=Ot.eastNorthUpToFixedFrame(g,n,Tyt);B.inverseTransformation(m,m),B.multiplyByPointAsVector(m,p,p),B.multiplyByPointAsVector(ro.TRANSFORM_2D,p,p);let y=i.globe;if(c(y)){let b=y.pickWorldCoordinates(h,i,!0,byt);if(c(b)){let x=d.distance(r.position2D,b);b.x+=x,d.clone(b,r.position2D)}}}function s(h,p){h.position.x=p}B.multiplyByPoint(ro.TRANSFORM_2D,r.position,r.position2D),B.multiplyByPointAsVector(ro.TRANSFORM_2D,r.direction,r.direction2D),B.multiplyByPointAsVector(ro.TRANSFORM_2D,r.up,r.up2D);let a=r.frustum;a.right=r.position.z*.5,a.left=-a.right,a.top=a.right*(i.drawingBufferHeight/i.drawingBufferWidth),a.bottom=-a.top;let l=yyt;B.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,r.position2D,l.position),d.clone(r.direction,l.direction),d.clone(r.up,l.up),l.frustum=a;let u=eAe(l);$B(e,u);function f(){KTe(e,t,r,s,u)}ZTe(e,t,r,f)}function $Te(e,t,n,i){let o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();let a=r.frustum.fov,l=O.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(l*.5)+1e7,r.frustum.fov=l;function f(p){r.frustum.fov=O.lerp(l,a,p.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}let h=o.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){i(e)}});e._currentTweens.push(h)}function Eyt(e,t,n,i){t*=.5;let o=e._scene,r=o.camera,s=d.clone(n.position,o$),a=d.clone(n.direction,YTe),l=d.clone(n.up,XTe);o._mode=oe.MORPHING;function u(){r.frustum=n.frustum.clone();let f=d.clone(r.position,jTe),h=d.clone(r.direction,WTe),p=d.clone(r.up,qTe);f.z=s.z;function g(y){bd(f,s,y.time,r.position),bd(h,a,y.time,r.direction),bd(p,l,y.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}let m=o.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(m)}e._morphToOrthographic?u():$Te(e,0,n,u)}function ZTe(e,t,n,i){let o=e._scene,r=o.camera,s=d.clone(r.position,jTe),a=d.clone(r.direction,WTe),l=d.clone(r.up,qTe),u=d.clone(n.position2D,o$),f=d.clone(n.direction2D,YTe),h=d.clone(n.up2D,XTe);function p(m){bd(s,u,m.time,r.position),bd(a,f,m.time,r.direction),bd(l,h,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}let g=o.tweens.add({duration:t,easingFunction:Qr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){QTe(e,o,1,0,t,i)}});e._currentTweens.push(g)}function QTe(e,t,n,i,o,r){let s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:Qr.QUARTIC_OUT};c(r)&&(s.complete=function(){r(e)});let a=t.tweens.addProperty(s);e._currentTweens.push(a)}function JTe(e){return function(t){let n=t._scene;n._mode=oe.SCENE3D,n.morphTime=oe.getMorphTime(oe.SCENE3D),hG(t);let i=n.camera;(t._previousMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone());let o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);let r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE3D,r)}}function eAe(e){return function(t){let n=t._scene;n._mode=oe.SCENE2D,n.morphTime=oe.getMorphTime(oe.SCENE2D),hG(t);let i=n.camera;d.clone(e.position,i.position),i.position.z=n.ellipsoid.maximumRadius*2,d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone();let o=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE2D,o)}}function Syt(e){return function(t){let n=t._scene;n._mode=oe.COLUMBUS_VIEW,n.morphTime=oe.getMorphTime(oe.COLUMBUS_VIEW),hG(t);let i=n.camera;(t._previousModeMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right));let o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);let r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.COLUMBUS_VIEW,r)}}var ZB=cA;var wyt={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Vi=Object.freeze(wyt);function sa(e,t){let n=`${e}`;return c(t)&&(n+=`+${t}`),n}function vyt(e,t){H.clone(e.distance.startPosition,t.distance.startPosition),H.clone(e.distance.endPosition,t.distance.endPosition),H.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),H.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function tAe(e,t,n){let i=sa(Vi.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,l=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new H;let u=e._movement[i];c(u)||(u=e._movement[i]={}),u.distance={startPosition:new H,endPosition:new H},u.angleAndHeight={startPosition:new H,endPosition:new H},u.prevAngle=0,e._eventHandler.setInputAction(function(f){e._buttonsDown++,r[i]=!0,a[i]=new Date,H.lerp(f.position1,f.position2,.5,s[i])},An.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,l[i]=new Date},An.PINCH_END,t),e._eventHandler.setInputAction(function(f){if(r[i]){o[i]?(vyt(f,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):(H.clone(f.distance.endPosition,u.distance.endPosition),H.clone(f.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let h=u.angleAndHeight.endPosition.x,p=u.prevAngle,g=Math.PI*2;for(;h>=p+Math.PI;)h-=g;for(;h<p-Math.PI;)h+=g;u.angleAndHeight.endPosition.x=-h*n.clientWidth/12,u.angleAndHeight.startPosition.x=-p*n.clientWidth/12}},An.PINCH_MOVE,t)}function nAe(e,t){let n=sa(Vi.WHEEL,t),i=e._pressTime,o=e._releaseTime,r=e._update;r[n]=!0;let s=e._movement[n];c(s)||(s=e._movement[n]={});let a=e._lastMovement[n];c(a)||(a=e._lastMovement[n]={startPosition:new H,endPosition:new H,valid:!1}),s.startPosition=new H,H.clone(H.ZERO,s.startPosition),s.endPosition=new H,e._eventHandler.setInputAction(function(l){let u=7.5*O.toRadians(l);i[n]=o[n]=new Date,s.endPosition.x=0,s.endPosition.y=u,H.clone(s.endPosition,a.endPosition),a.valid=!0,r[n]=!1},An.WHEEL,t)}function Iw(e,t,n){let i=sa(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime;o[i]=!1,r[i]=new H;let a=e._lastMovement[i];c(a)||(a=e._lastMovement[i]={startPosition:new H,endPosition:new H,valid:!1});let l,u;n===Vi.LEFT_DRAG?(l=An.LEFT_DOWN,u=An.LEFT_UP):n===Vi.RIGHT_DRAG?(l=An.RIGHT_DOWN,u=An.RIGHT_UP):n===Vi.MIDDLE_DRAG&&(l=An.MIDDLE_DOWN,u=An.MIDDLE_UP),e._eventHandler.setInputAction(function(f){e._buttonsDown++,a.valid=!1,o[i]=!0,s[i]=new Date,H.clone(f.position,r[i])},l,t),e._eventHandler.setInputAction(function(){r$(sa(n,void 0),e);for(let f of Object.values(ra)){let h=sa(n,f);r$(h,e)}},u,t)}function r$(e,t){let n=t._releaseTime,i=t._isDown;i[e]&&(t._buttonsDown=Math.max(t._buttonsDown-1,0)),i[e]=!1,n[e]=new Date}function iAe(e,t){H.clone(e.startPosition,t.startPosition),H.clone(e.endPosition,t.endPosition)}function Dyt(e,t,n){let i=n._isDown,o=!1,r=sa(e,t);for(let[l,u]of Object.entries(i))l.startsWith(e)&&u&&l!==r&&(o=!0,r$(l,n));if(!o)return;let s=n._pressTime,a=n._lastMovement[r];c(a)||(a=n._lastMovement[r]={startPosition:new H,endPosition:new H,valid:!1}),n._buttonsDown++,a.valid=!1,i[r]=!0,s[r]=new Date}function oAe(e,t){let n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(let s in Vi)if(Vi.hasOwnProperty(s)){let a=Vi[s];if(c(a)){let l=sa(a,t);n[l]=!0,c(e._lastMovement[l])||(e._lastMovement[l]={startPosition:new H,endPosition:new H,valid:!1}),c(e._movement[l])||(e._movement[l]={startPosition:new H,endPosition:new H})}}e._eventHandler.setInputAction(function(s){for(let a in Vi)if(Vi.hasOwnProperty(a)){let l=Vi[a];if(c(l)){let u=sa(l,t);Dyt(l,t,e),r[u]&&(n[u]?(iAe(i[u],o[u]),o[u].valid=!0,iAe(s,i[u]),n[u]=!1):H.clone(s.endPosition,i[u].endPosition))}}H.clone(s.endPosition,e._currentMousePosition)},An.MOUSE_MOVE,t)}function xd(e){if(!c(e))throw new E("canvas is required.");this._eventHandler=new of(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new H,nAe(this,void 0),tAe(this,void 0,e),Iw(this,void 0,Vi.LEFT_DRAG),Iw(this,void 0,Vi.RIGHT_DRAG),Iw(this,void 0,Vi.MIDDLE_DRAG),oAe(this,void 0);for(let t in ra)if(ra.hasOwnProperty(t)){let n=ra[t];c(n)&&(nAe(this,n),tAe(this,n,e),Iw(this,n,Vi.LEFT_DRAG),Iw(this,n,Vi.RIGHT_DRAG),Iw(this,n,Vi.MIDDLE_DRAG),oAe(this,n))}}Object.defineProperties(xd.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){let e=!this._update[sa(Vi.WHEEL)]||!this._update[sa(Vi.WHEEL,ra.SHIFT)]||!this._update[sa(Vi.WHEEL,ra.CTRL)]||!this._update[sa(Vi.WHEEL,ra.ALT)];return this._buttonsDown>0||e}}});xd.prototype.isMoving=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t);return!this._update[n]};xd.prototype.getMovement=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t);return this._movement[n]};xd.prototype.getLastMovement=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t),i=this._lastMovement[n];if(i.valid)return i};xd.prototype.isButtonDown=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t);return this._isDown[n]};xd.prototype.getStartMousePosition=function(e,t){if(!c(e))throw new E("type is required.");if(e===Vi.WHEEL)return this._currentMousePosition;let n=sa(e,t);return this._eventStartPosition[n]};xd.prototype.getButtonPressTime=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t);return this._pressTime[n]};xd.prototype.getButtonReleaseTime=function(e,t){if(!c(e))throw new E("type is required.");let n=sa(e,t);return this._releaseTime[n]};xd.prototype.reset=function(){for(let e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};xd.prototype.isDestroyed=function(){return!1};xd.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),de(this)};var QB=xd;function mG(e,t,n,i,o,r,s,a,l,u){this._tweens=e,this._tweenjs=t,this._startObject=je(n),this._stopObject=je(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=l,this.cancel=u,this.needsStart=!0}Object.defineProperties(mG.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}});mG.prototype.cancelTween=function(){this._tweens.remove(this)};function qh(){this._tweens=[]}Object.defineProperties(qh.prototype,{length:{get:function(){return this._tweens.length}}});qh.prototype.add=function(e){if(e=e??W.EMPTY_OBJECT,!c(e.startObject)||!c(e.stopObject))throw new E("options.startObject and options.stopObject are required.");if(!c(e.duration)||e.duration<0)throw new E("options.duration is required and must be positive.");if(e.duration===0)return c(e.complete)&&e.complete(),new mG(this);let t=e.duration/qn.SECONDS_PER_MILLISECOND,n=e.delay??0,i=n/qn.SECONDS_PER_MILLISECOND,o=e.easingFunction??Qr.LINEAR_NONE,r=e.startObject,s=new Zye(r);s.to(je(e.stopObject),t),s.delay(i),s.easing(o),c(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(e.complete??null),s.repeat(e._repeat??0);let a=new mG(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};qh.prototype.addProperty=function(e){e=e??W.EMPTY_OBJECT;let t=e.object,n=e.property,i=e.startValue,o=e.stopValue;if(!c(t)||!c(e.property))throw new E("options.object and options.property are required.");if(!c(t[n]))throw new E("options.object must have the specified property.");if(!c(i)||!c(o))throw new E("options.startValue and options.stopValue are required.");function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:e.duration??3,delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};qh.prototype.addAlpha=function(e){e=e??W.EMPTY_OBJECT;let t=e.material;if(!c(t))throw new E("options.material is required.");let n=[];for(let o in t.uniforms)t.uniforms.hasOwnProperty(o)&&c(t.uniforms[o])&&c(t.uniforms[o].alpha)&&n.push(o);if(n.length===0)throw new E("material has no properties with alpha components.");function i(o){let r=n.length;for(let s=0;s<r;++s)t.uniforms[n[s]].alpha=o.alpha}return this.add({startObject:{alpha:e.startValue??0},stopObject:{alpha:e.stopValue??1},duration:e.duration??3,delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};qh.prototype.addOffsetIncrement=function(e){e=e??W.EMPTY_OBJECT;let t=e.material;if(!c(t))throw new E("material is required.");if(!c(t.uniforms.offset))throw new E("material.uniforms must have an offset property.");let n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})};qh.prototype.remove=function(e){if(!c(e))return!1;let t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),c(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};qh.prototype.removeAll=function(){let e=this._tweens;for(let t=0;t<e.length;++t){let n=e[t];n.tweenjs.stop(),c(n.cancel)&&n.cancel()}e.length=0};qh.prototype.contains=function(e){return c(e)&&this._tweens.indexOf(e)!==-1};qh.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._tweens[e]};qh.prototype.update=function(e){let t=this._tweens,n=0;for(e=c(e)?e/qn.SECONDS_PER_MILLISECOND:Ti();n<t.length;){let i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};var lA=qh;function e3(e){if(!c(e))throw new E("scene is required.");this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.zoomFactor=5,this.translateEventTypes=Vi.LEFT_DRAG,this.zoomEventTypes=[Vi.RIGHT_DRAG,Vi.WHEEL,Vi.PINCH],this.rotateEventTypes=Vi.LEFT_DRAG,this.tiltEventTypes=[Vi.MIDDLE_DRAG,Vi.PINCH,{eventType:Vi.LEFT_DRAG,modifier:ra.CTRL},{eventType:Vi.RIGHT_DRAG,modifier:ra.CTRL}],this.lookEventTypes={eventType:Vi.LEFT_DRAG,modifier:ra.SHIFT};let t=e.ellipsoid??ie.default;this.minimumPickingTerrainHeight=ie.WGS84.equals(t)?15e4:t.minimumRadius*.025,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumPickingTerrainDistanceWithInertia=ie.WGS84.equals(t)?4e3:t.minimumRadius*63e-5,this.minimumCollisionTerrainHeight=ie.WGS84.equals(t)?15e3:t.minimumRadius*.0025,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=ie.WGS84.equals(t)?75e5:t.minimumRadius*1.175,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this.maximumTiltAngle=void 0,this._scene=e,this._globe=void 0,this._ellipsoid=t,this._lastGlobeHeight=0,this._aggregator=new QB(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new lA,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new H(-1,-1),this._tiltCenter=new d,this._rotateMousePosition=new H(-1,-1),this._rotateStartPosition=new d,this._strafeStartPosition=new d,this._strafeMousePosition=new H,this._strafeEndMousePosition=new H,this._zoomMouseStart=new H(-1,-1),this._zoomWorldPosition=new d,this._useZoomWorldPosition=!1,this._panLastMousePosition=new H,this._panLastWorldPosition=new d,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;let n=e.mapProjection;this._maxCoord=n.project(new he(Math.PI,O.PI_OVER_TWO)),this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=1/5e3,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function Pyt(e,t){if(e<0)return 0;let n=(1-t)*25;return Math.exp(-n*e)}function Iyt(e){return H.equalsEpsilon(e.startPosition,e.endPosition,O.EPSILON14)}var Oyt=.4;function Ryt(e,t,n,i,o,r,s){let a=r[s];c(a)||(a=r[s]={startPosition:new H,endPosition:new H,motion:new H,inertiaEnabled:!0});let l=e.getButtonPressTime(t,n),u=e.getButtonReleaseTime(t,n),f=l&&u&&(u.getTime()-l.getTime())/1e3,p=u&&(new Date().getTime()-u.getTime())/1e3;if(l&&u&&f<Oyt){let g=Pyt(p,i),m=e.getLastMovement(t,n);if(!c(m)||Iyt(m)||!a.inertiaEnabled||(a.motion.x=(m.endPosition.x-m.startPosition.x)*.5,a.motion.y=(m.endPosition.y-m.startPosition.y)*.5,a.startPosition=H.clone(m.startPosition,a.startPosition),a.endPosition=H.multiplyByScalar(a.motion,g,a.endPosition),a.endPosition=H.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||H.distance(a.startPosition,a.endPosition)<.5))return;if(!e.isButtonDown(t,n)){let y=e.getStartMousePosition(t,n);o(r,y,a)}}}function Myt(e,t){if(c(t)){let n=e[t];c(n)&&(n.inertiaEnabled=!0);let i=e._inertiaDisablers[t];if(c(i)){let o=i.length;for(let r=0;r<o;++r)n=e[i[r]],c(n)&&(n.inertiaEnabled=!1)}}}var rAe=[];function Tl(e,t,n,i,o,r){if(!c(n))return;let s=e._aggregator;Array.isArray(n)||(rAe[0]=n,n=rAe);let a=n.length;for(let l=0;l<a;++l){let u=n[l],f=c(u.eventType)?u.eventType:u,h=u.modifier,p=s.isMoving(f,h)&&s.getMovement(f,h),g=s.getStartMousePosition(f,h);e.enableInputs&&t&&(p?(i(e,g,p),Myt(e,r)):o<1&&Ryt(s,f,h,o,i,e,r))}}var pG=new mn,Lyt=new d,Nyt=new H,Fyt=new d,Byt=new H,kyt=new d,Uyt=new d,Vyt=new d,zyt=new d,gAe=new d,Hyt=new d,Gyt=new d,jyt=new d,Wyt=new d,qyt=new d,Yyt=new d,Xyt=new d,Kyt=new d,$yt=new d,Zyt=new d,uA=new d,sAe=new d,aAe=new d,s$={orientation:new Oa};function m$(e,t,n,i,o,r){let s=1;c(r)&&(s=O.clamp(Math.abs(r),.25,1));let a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,f=e.maximumZoomDistance,h=o-u,p=i*h;p=O.clamp(p,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let m=p*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!c(e._globe)){if(m>0&&Math.abs(o-u)<1||m<0&&Math.abs(o-f)<1)return;o-m<u?m=o-u-1:o-m>f&&(m=o-f)}let y=e._scene,b=y.camera,x=y.mode,A=s$.orientation;A.heading=b.heading,A.pitch=b.pitch,A.roll=b.roll;let C=n.inertiaEnabled??H.equals(t,e._zoomMouseStart),S=e._zoomingOnVector,v=e._rotatingZoom,P;if(C||(e._zoomMouseStart=H.clone(t,e._zoomMouseStart),c(e._globe)&&x===oe.SCENE2D?(P=b.getPickRay(t,pG).origin,P=d.fromElements(P.y,P.z,P.x)):c(e._globe)&&(P=Eg(e,t,Lyt)),c(P)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=d.clone(P,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,S=e._zoomingOnVector=!1,v=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){b.zoomIn(m);return}let M=x===oe.COLUMBUS_VIEW;if(b.positionCartographic.height<2e6&&(v=!0),!C||v){if(x===oe.SCENE2D){let R=e._zoomWorldPosition,L=b.position;if(!d.equals(R,L)&&b.positionCartographic.height<e._maxCoord.x*2){let F=b.position.x,_=d.subtract(R,L,Fyt);d.normalize(_,_);let w=d.distance(R,L)*m/(b.getMagnitude()*.5);b.move(_,w*.5),(b.position.x<0&&F>0||b.position.x>0&&F<0)&&(P=b.getPickRay(t,pG).origin,P=d.fromElements(P.y,P.z,P.x),e._zoomWorldPosition=d.clone(P,e._zoomWorldPosition))}}else if(x===oe.SCENE3D){let R=d.normalize(b.position,gAe);if(e._cameraUnderground||e._zoomingUnderground||b.positionCartographic.height<3e3&&Math.abs(d.dot(b.direction,R))<.6)M=!0;else{let L=y.canvas,F=Byt;F.x=L.clientWidth/2,F.y=L.clientHeight/2;let _=Eg(e,F,kyt);if(!c(_))M=!0;else if(b.positionCartographic.height<1e6)if(d.dot(b.direction,R)>=-.5)M=!0;else{let w=Gyt;d.clone(b.position,w);let D=e._zoomWorldPosition,I=Hyt;if(I=d.normalize(D,I),d.dot(I,R)<0)return;let N=Zyt,k=qyt;d.clone(b.direction,k),d.add(w,d.multiplyByScalar(k,1e3,uA),N);let z=Yyt,V=Xyt;d.subtract(D,w,z),d.normalize(z,V);let j=d.dot(R,V);if(j>=0){e._zoomMouseStart.x=-1;return}let U=Math.acos(-j),q=d.magnitude(w),Y=d.magnitude(D),te=q-m,K=d.magnitude(z),Z=Math.asin(O.clamp(K/Y*Math.sin(U),-1,1)),ee=Math.asin(O.clamp(te/Y*Math.sin(U),-1,1)),me=Z-ee+U,Te=jyt;d.normalize(w,Te);let ue=Wyt;ue=d.cross(V,Te,ue),ue=d.normalize(ue,ue),d.normalize(d.cross(Te,ue,uA),k),d.multiplyByScalar(d.normalize(N,uA),d.magnitude(N)-m,N),d.normalize(w,w),d.multiplyByScalar(w,te,w);let ye=Kyt;d.multiplyByScalar(d.add(d.multiplyByScalar(Te,Math.cos(me)-1,sAe),d.multiplyByScalar(k,Math.sin(me),aAe),uA),te,ye),d.add(w,ye,w),d.normalize(N,Te),d.normalize(d.cross(Te,ue,uA),k);let Ae=$yt;d.multiplyByScalar(d.add(d.multiplyByScalar(Te,Math.cos(me)-1,sAe),d.multiplyByScalar(k,Math.sin(me),aAe),uA),d.magnitude(N),Ae),d.add(N,Ae,N),d.clone(w,b.position),d.normalize(d.subtract(N,w,uA),b.direction),d.clone(b.direction,b.direction),d.cross(b.direction,b.up,b.right),d.cross(b.right,b.direction,b.up),b.setView(s$);return}else{let w=d.normalize(_,Uyt),D=d.normalize(e._zoomWorldPosition,Vyt),I=d.dot(D,w);if(I>0&&I<1){let N=O.acosClamped(I),k=d.cross(D,w,zyt),z=Math.abs(N)>O.toRadians(20)?b.positionCartographic.height*.75:b.positionCartographic.height-m,V=m/z;b.rotate(k,N*V)}}}}e._rotatingZoom=!M}if(!C&&M||S){let R,L=Gi.worldToWindowCoordinates(y,e._zoomWorldPosition,Nyt);x!==oe.COLUMBUS_VIEW&&H.equals(t,e._zoomMouseStart)&&c(L)?R=b.getPickRay(L,pG):R=b.getPickRay(t,pG);let F=R.direction;(x===oe.COLUMBUS_VIEW||x===oe.SCENE2D)&&d.fromElements(F.y,F.z,F.x,F),b.move(F,m),e._zoomingOnVector=!0}else b.zoomIn(m);e._cameraUnderground||b.setView(s$)}var Qyt=new mn,Jyt=new mn,e0t=new d;function t0t(e,t,n){let o=e._scene.camera,r=o.getPickRay(n.startPosition,Qyt).origin,s=o.getPickRay(n.endPosition,Jyt).origin;r=d.fromElements(r.y,r.z,r.x,r),s=d.fromElements(s.y,s.z,s.x,s);let a=d.subtract(r,s,e0t),l=d.magnitude(a);l>0&&(d.normalize(a,a),o.move(a,l))}function cAe(e,t,n){c(n.distance)&&(n=n.distance);let o=e._scene.camera;m$(e,t,n,e.zoomFactor,o.getMagnitude())}var n0t=new H,i0t=new H;function lAe(e,t,n){if(c(n.angleAndHeight)){o0t(e,t,n.angleAndHeight);return}let i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight,l=n0t;l.x=2/s*n.startPosition.x-1,l.y=2/a*(a-n.startPosition.y)-1,l=H.normalize(l,l);let u=i0t;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=H.normalize(u,u);let f=O.acosClamped(l.x);l.y<0&&(f=O.TWO_PI-f);let h=O.acosClamped(u.x);u.y<0&&(h=O.TWO_PI-h);let p=h-f;o.twistRight(p)}function o0t(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);let o=e._scene,r=o.camera,s=o.canvas,a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);let l=i*a*Math.PI*4;r.twistRight(l)}function r0t(e){let t=e._scene.mapMode2D===ru.ROTATE;B.equals(B.IDENTITY,e._scene.camera.transform)?(Tl(e,e.enableTranslate,e.translateEventTypes,t0t,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Tl(e,e.enableZoom,e.zoomEventTypes,cAe,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Tl(e,e.enableRotate,e.tiltEventTypes,lAe,e.inertiaSpin,"_lastInertiaTiltMovement")):(Tl(e,e.enableZoom,e.zoomEventTypes,cAe,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Tl(e,e.enableRotate,e.translateEventTypes,lAe,e.inertiaSpin,"_lastInertiaSpinMovement"))}var yAe=new mn,s0t=new d,a0t=new d;function Eg(e,t,n){let i=e._scene,o=e._globe,r=i.camera,s;if(i.pickPositionSupported&&(s=i.pickPositionWorldCoordinates(t,s0t)),!c(o))return d.clone(s,n);let a=!e._cameraUnderground,l=r.getPickRay(t,yAe),u=o.pickWorldCoordinates(l,i,a,a0t),f=c(s)?d.distance(s,r.positionWC):Number.POSITIVE_INFINITY,h=c(u)?d.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return f<h?d.clone(s,n):d.clone(u,n)}var c0t=new he;function AG(e){let t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode,r=0;if(o===oe.SCENE3D){let l=t.cartesianToCartographic(i.position,c0t);c(l)&&(r=l.height)}else r=i.position.z;let s=e._scene.globeHeight??0;return Math.abs(s-r)}var l0t=new d;function bAe(e,t){let n=t.origin,i=t.direction,o=AG(e),r=d.normalize(n,l0t),s=Math.abs(d.dot(r,i));return s=Math.max(s,.5)*2,o*s}function xAe(e,t,n,i){let o=d.distance(t.origin,n),r=AG(e),s=O.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),mn.getPoint(t,o,i)}function TAe(e,t,n,i){let o;return c(n)?(o=d.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=AG(e))):o=AG(e),mn.getPoint(t,o,i)}var u0t=new H;function AAe(e,t){let n=t.endPosition,i=H.subtract(t.endPosition,t.startPosition,u0t),o=e._strafeEndMousePosition;H.add(o,i,o),t.endPosition=o,p$(e,t,e._strafeStartPosition),t.endPosition=n}var uAe=new mn,f0t=new mn,a$=new d,d0t=new d,h0t=new d,m0t=new d,p0t=new sn(d.UNIT_X,0),_0t=new H,g0t=new H;function y0t(e,t,n){if(d.equals(t,e._translateMousePosition)||(e._looking=!1),d.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){sf(e,t,n);return}if(e._strafing){AAe(e,n);return}let o=e._scene.camera,r=e._cameraUnderground,s=H.clone(n.startPosition,_0t),a=H.clone(n.endPosition,g0t),l=o.getPickRay(s,uAe),u=d.clone(d.ZERO,m0t),f=d.UNIT_X,h;if(o.position.z<e._minimumPickingTerrainHeight&&(h=Eg(e,s,a$),c(h)&&(u.x=h.x)),r||u.x>o.position.z&&c(h)){let C=h;r&&(C=TAe(e,l,h,a$)),H.clone(t,e._strafeMousePosition),H.clone(t,e._strafeEndMousePosition),d.clone(C,e._strafeStartPosition),e._strafing=!0,p$(e,n,e._strafeStartPosition);return}let p=sn.fromPointNormal(u,f,p0t);l=o.getPickRay(s,uAe);let g=Zn.rayPlane(l,p,a$),m=o.getPickRay(a,f0t),y=Zn.rayPlane(m,p,d0t);if(!c(g)||!c(y)){e._looking=!0,sf(e,t,n),H.clone(t,e._translateMousePosition);return}let b=d.subtract(g,y,h0t),x=b.x;b.x=b.y,b.y=b.z,b.z=x;let A=d.magnitude(b);A>O.EPSILON6&&(d.normalize(b,b),o.move(b,A))}var CAe=new H,yG=new mn,bG=new d,b0t=new d,EAe=new B,x0t=new B,T0t=new d,A0t=new sn(d.UNIT_X,0),c$=new d,f$=new he,SAe=new B,C0t=new Le,E0t=new J,xG=new d;function S0t(e,t,n){if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){sf(e,t,n);return}let o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,w0t(e,t,n)):v0t(e,t,n)}function w0t(e,t,n){let i=e._scene,o=i.camera,r=i.canvas,s=CAe;s.x=r.clientWidth/2,s.y=r.clientHeight/2;let a=o.getPickRay(s,yG),l=d.UNIT_X,u=a.origin,f=a.direction,h,p=d.dot(l,f);if(Math.abs(p)>O.EPSILON6&&(h=-d.dot(l,u)/p),!c(h)||h<=0){e._looking=!0,sf(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}let g=d.multiplyByScalar(f,h,bG);d.add(u,g,g);let m=i.mapProjection,y=m.ellipsoid;d.fromElements(g.y,g.z,g.x,g);let b=m.unproject(g,f$);y.cartographicToCartesian(b,g);let x=Ot.eastNorthUpToFixedFrame(g,y,EAe),A=e._globe,C=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=B.clone(o.transform,SAe);o._setTransform(x),rf(e,t,n,d.UNIT_Z),o._setTransform(S),e._globe=A,e._ellipsoid=C;let v=C.maximumRadius;e._rotateFactor=1/v,e._rotateRateRangeAdjustment=v}function v0t(e,t,n){let i=e._scene,o=i.camera,r=e._cameraUnderground,s,a,l=d.UNIT_X;if(H.equals(t,e._tiltCenterMousePosition))s=d.clone(e._tiltCenter,bG);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=Eg(e,t,bG)),!c(s)){a=o.getPickRay(t,yG);let _=a.origin,w=a.direction,D,I=d.dot(l,w);if(Math.abs(I)>O.EPSILON6&&(D=-d.dot(l,_)/I),!c(D)||D<=0){e._looking=!0,sf(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}s=d.multiplyByScalar(w,D,bG),d.add(_,s,s)}r&&(c(a)||(a=o.getPickRay(t,yG)),xAe(e,a,s,s)),H.clone(t,e._tiltCenterMousePosition),d.clone(s,e._tiltCenter)}let u=i.canvas,f=CAe;f.x=u.clientWidth/2,f.y=e._tiltCenterMousePosition.y,a=o.getPickRay(f,yG);let h=d.clone(d.ZERO,T0t);h.x=s.x;let p=sn.fromPointNormal(h,l,A0t),g=Zn.rayPlane(a,p,b0t),m=o._projection,y=m.ellipsoid;d.fromElements(s.y,s.z,s.x,s);let b=m.unproject(s,f$);y.cartographicToCartesian(b,s);let x=Ot.eastNorthUpToFixedFrame(s,y,EAe),A;c(g)?(d.fromElements(g.y,g.z,g.x,g),b=m.unproject(g,f$),y.cartographicToCartesian(b,g),A=Ot.eastNorthUpToFixedFrame(g,y,x0t)):A=x;let C=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let v=d.UNIT_Z,P=B.clone(o.transform,SAe);o._setTransform(x);let M=d.cross(d.UNIT_Z,d.normalize(o.position,c$),c$),R=d.dot(o.right,M);if(rf(e,t,n,v,!1,!0),o._setTransform(A),R<0){let _=n.startPosition.y-n.endPosition.y;(r&&_<0||!r&&_>0)&&(v=void 0);let w=o.constrainedAxis;o.constrainedAxis=void 0,rf(e,t,n,v,!0,!1),o.constrainedAxis=w}else rf(e,t,n,v,!0,!1);if(c(o.constrainedAxis)){let _=d.cross(o.direction,o.constrainedAxis,xG);d.equalsEpsilon(_,d.ZERO,O.EPSILON6)||(d.dot(_,o.right)<0&&d.negate(_,_),d.cross(_,o.direction,o.up),d.cross(o.direction,o.up,o.right),d.normalize(o.up,o.up),d.normalize(o.right,o.right))}o._setTransform(P),e._globe=C,e._ellipsoid=S;let L=S.maximumRadius;e._rotateFactor=1/L,e._rotateRateRangeAdjustment=L;let F=d.clone(o.positionWC,c$);if(e.enableCollisionDetection&&y$(e,!0),!d.equals(o.positionWC,F)){o._setTransform(A),o.worldToCameraCoordinatesPoint(F,F);let _=d.magnitudeSquared(F);d.magnitudeSquared(o.position)>_&&(d.normalize(o.position,o.position),d.multiplyByScalar(o.position,Math.sqrt(_),o.position));let w=d.angleBetween(F,o.position),D=d.cross(F,o.position,F);d.normalize(D,D);let I=Le.fromAxisAngle(D,w,C0t),N=J.fromQuaternion(I,E0t);J.multiplyByVector(N,o.direction,o.direction),J.multiplyByVector(N,o.up,o.up),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up),o._setTransform(P)}}var wAe=new H,vAe=new mn,DAe=new d;function D0t(e,t,n){c(n.distance)&&(n=n.distance);let i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground,a;s?a=t:(a=wAe,a.x=r.clientWidth/2,a.y=r.clientHeight/2);let l=o.getPickRay(a,vAe),u=l.origin,f=l.direction,h=o.position.z,p;h<e._minimumPickingTerrainHeight&&(p=Eg(e,a,DAe));let g;if(c(p)&&(g=d.distance(u,p)),s){let m=bAe(e,l,h);c(g)?g=Math.min(g,m):g=m}if(!c(g)){let m=d.UNIT_X;g=-d.dot(m,u)/d.dot(m,f)}m$(e,t,n,e.zoomFactor,g)}function P0t(e){let n=e._scene.camera;if(!B.equals(B.IDENTITY,n.transform))Tl(e,e.enableRotate,e.rotateEventTypes,rf,e.inertiaSpin,"_lastInertiaSpinMovement"),Tl(e,e.enableZoom,e.zoomEventTypes,IAe,e.inertiaZoom,"_lastInertiaZoomMovement");else{let i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),Tl(e,e.enableTilt,e.tiltEventTypes,S0t,e.inertiaSpin,"_lastInertiaTiltMovement"),Tl(e,e.enableTranslate,e.translateEventTypes,y0t,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Tl(e,e.enableZoom,e.zoomEventTypes,D0t,e.inertiaZoom,"_lastInertiaZoomMovement"),Tl(e,e.enableLook,e.lookEventTypes,sf),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){let o=n.createCorrectPositionTween(e.bounceAnimationTime);c(o)&&(e._tween=i.add(o))}i.update()}}var I0t=new mn,O0t=new sn(d.UNIT_X,0),R0t=new d,M0t=new d;function p$(e,t,n){let i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,I0t),s=d.clone(o.direction,M0t);i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.z,s.x,s.y,s);let a=sn.fromPointNormal(n,s,O0t),l=Zn.rayPlane(r,a,R0t);c(l)&&(s=d.subtract(n,l,s),i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.y,s.z,s.x,s),d.add(o.position,s,o.position))}var fAe=new d,PAe=new he,d$=new d,h$=new ie,L0t=new d,N0t=new d,F0t=new d;function B0t(e,t,n){let o=e._scene.camera,r=e._cameraUnderground,s=e._ellipsoid;if(!B.equals(o.transform,B.IDENTITY)){rf(e,t,n);return}let a,l,u=s.geodeticSurfaceNormal(o.position,L0t);if(H.equals(t,e._rotateMousePosition)){if(e._looking)sf(e,t,n,u);else if(e._rotating)rf(e,t,n);else if(e._strafing)AAe(e,n);else{if(d.magnitude(o.position)<d.magnitude(e._rotateStartPosition))return;a=d.magnitude(e._rotateStartPosition),l=d$,l.x=l.y=l.z=a,s=ie.fromCartesian3(l,h$),u$(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;let f=s.cartesianToCartographic(o.positionWC,PAe).height,h=e._globe;if(c(h)&&f<e._minimumPickingTerrainHeight){let p=Eg(e,n.startPosition,F0t);if(c(p)){let g=!1,m=o.getPickRay(n.startPosition,yAe);if(r)g=!0,TAe(e,m,p,p);else{let y=s.geodeticSurfaceNormal(p,N0t);Math.abs(d.dot(m.direction,y))<.05?g=!0:g=d.magnitude(o.position)<d.magnitude(p)}g?(H.clone(t,e._strafeEndMousePosition),d.clone(p,e._strafeStartPosition),e._strafing=!0,p$(e,n,e._strafeStartPosition)):(a=d.magnitude(p),l=d$,l.x=l.y=l.z=a,s=ie.fromCartesian3(l,h$),u$(e,t,n,s),d.clone(p,e._rotateStartPosition))}else e._looking=!0,sf(e,t,n,u)}else c(o.pickEllipsoid(n.startPosition,e._ellipsoid,fAe))?(u$(e,t,n,e._ellipsoid),d.clone(fAe,e._rotateStartPosition)):f>e._minimumTrackBallHeight?(e._rotating=!0,rf(e,t,n)):(e._looking=!0,sf(e,t,n,u));H.clone(t,e._rotateMousePosition)}function rf(e,t,n,i,o,r){o=o??!1,r=r??!1;let s=e._scene,a=s.camera,l=s.canvas,u=a.constrainedAxis;c(i)&&(a.constrainedAxis=i);let f=d.magnitude(a.position),h=e._rotateFactor*(f-e._rotateRateRangeAdjustment);h>e._maximumRotateRate&&(h=e._maximumRotateRate),h<e._minimumRotateRate&&(h=e._minimumRotateRate);let p=(n.startPosition.x-n.endPosition.x)/l.clientWidth,g=(n.startPosition.y-n.endPosition.y)/l.clientHeight;p=Math.min(p,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);let m=h*p*Math.PI*2,y=h*g*Math.PI;if(c(i)&&c(e.maximumTiltAngle)){let b=e.maximumTiltAngle,x=d.dot(a.direction,i),A=Math.PI-Math.acos(x)+y;A>b&&(y-=A-b)}o||a.rotateRight(m),r||a.rotateUp(y),a.constrainedAxis=u}var l$=se.clone(se.UNIT_W),dAe=se.clone(se.UNIT_W),_G=new d,Ow=new d,gG=new d,hAe=new d,k0t=new H,U0t=new H,V0t=new H,z0t=new H,H0t=new mn;function u$(e,t,n,i){let o=e._scene,r=o.camera,s=H.clone(n.startPosition,k0t),a=H.clone(n.endPosition,U0t),l=i.cartesianToCartographic(r.positionWC,PAe).height,u,f;if(!n.inertiaEnabled&&l<e._minimumPickingTerrainHeight&&(u=d.clone(e._panLastWorldPosition,l$),!c(e._globe)&&!H.equalsEpsilon(s,e._panLastMousePosition)&&(u=Eg(e,s,l$)),!c(e._globe)&&c(u))){let h=d.subtract(u,r.positionWC,Ow),p=d.multiplyByScalar(r.directionWC,d.dot(r.directionWC,h),Ow),g=d.magnitude(p),m=r.frustum.getPixelDimensions(o.drawingBufferWidth,o.drawingBufferHeight,g,o.pixelRatio,z0t),y=H.subtract(a,s,V0t),b=d.multiplyByScalar(r.rightWC,y.x*m.x,Ow),x=d.normalize(r.positionWC,gAe),A=r.getPickRay(a,H0t).direction,C=d.subtract(A,d.projectVector(A,r.rightWC,gG),gG),S=d.angleBetween(C,r.directionWC),v=1;c(r.frustum.fov)&&(v=Math.max(Math.tan(S),.1));let P=Math.abs(d.dot(r.directionWC,x)),M=-y.y*m.y*2/Math.sqrt(v)*(1-P),R=d.multiplyByScalar(A,M,gG);P=Math.abs(d.dot(r.upWC,x));let L=d.multiplyByScalar(r.upWC,-y.y*(1-P)*m.y,hAe);f=d.add(u,b,dAe),f=d.add(f,R,f),f=d.add(f,L,f),d.clone(f,e._panLastWorldPosition),H.clone(a,e._panLastMousePosition)}if((!c(u)||!c(f))&&(u=r.pickEllipsoid(s,i,l$),f=r.pickEllipsoid(a,i,dAe)),!c(u)||!c(f)){e._rotating=!0,rf(e,t,n);return}if(u=r.worldToCameraCoordinates(u,u),f=r.worldToCameraCoordinates(f,f),c(r.constrainedAxis)){let h=r.constrainedAxis,p=d.mostOrthogonalAxis(h,_G);d.cross(p,h,p),d.normalize(p,p);let g=d.cross(h,p,Ow),m=d.magnitude(u),y=d.dot(h,u),b=Math.acos(y/m),x=d.multiplyByScalar(h,y,gG);d.subtract(u,x,x),d.normalize(x,x);let A=d.magnitude(f),C=d.dot(h,f),S=Math.acos(C/A),v=d.multiplyByScalar(h,C,hAe);d.subtract(f,v,v),d.normalize(v,v);let P=Math.acos(d.dot(x,p));d.dot(x,g)<0&&(P=O.TWO_PI-P);let M=Math.acos(d.dot(v,p));d.dot(v,g)<0&&(M=O.TWO_PI-M);let R=P-M,L;d.equalsEpsilon(h,r.position,O.EPSILON2)?L=r.right:L=d.cross(h,r.position,_G);let F=d.cross(h,L,_G),_=d.dot(F,d.subtract(u,h,Ow)),w=d.dot(F,d.subtract(f,h,Ow)),D;_>0&&w>0?D=S-b:_>0&&w<=0?d.dot(r.position,h)>0?D=-b-S:D=b+S:D=b-S,r.rotateRight(R),r.rotateUp(D)}else{d.normalize(u,u),d.normalize(f,f);let h=d.dot(u,f),p=d.cross(u,f,_G);if(h<1&&!d.equalsEpsilon(p,d.ZERO,O.EPSILON14)){let g=Math.acos(h);r.rotate(p,g)}}}var G0t=new d,j0t=new he,mAe=0;function IAe(e,t,n){c(n.distance)&&(n=n.distance);let i=n.inertiaEnabled,o=e._ellipsoid,r=e._scene,s=r.camera,a=r.canvas,l=e._cameraUnderground,u;l?u=t:(u=wAe,u.x=a.clientWidth/2,u.y=a.clientHeight/2);let f=s.getPickRay(u,vAe),h,p=o.cartesianToCartographic(s.position,j0t).height,g=Math.abs(mAe)<e.minimumPickingTerrainDistanceWithInertia;(i?g:p<e._minimumPickingTerrainHeight)&&(h=Eg(e,u,DAe));let y;if(c(h)&&(y=d.distance(f.origin,h),mAe=y),l){let x=bAe(e,f,p);c(y)?y=Math.min(y,x):y=x}c(y)||(y=p);let b=d.normalize(s.position,G0t);m$(e,t,n,e.zoomFactor,y,d.dot(b,s.direction))}var OAe=new H,TG=new mn,JB=new d,W0t=new d,RAe=new B,q0t=new B,MAe=new B,Y0t=new Le,X0t=new J,_$=new he,g$=new d;function K0t(e,t,n){let o=e._scene.camera;if(!B.equals(o.transform,B.IDENTITY))return;if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){let a=e._ellipsoid.geodeticSurfaceNormal(o.position,g$);sf(e,t,n,a);return}let s=e._ellipsoid.cartesianToCartographic(o.position,_$);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,Z0t(e,t,n)):Q0t(e,t,n)}var $0t=new he;function Z0t(e,t,n){let i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,$0t).height;if(a-s-1<O.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;let l=o.canvas,u=OAe;u.x=l.clientWidth/2,u.y=l.clientHeight/2;let f=r.getPickRay(u,TG),h,p=Zn.rayEllipsoid(f,i);if(c(p))h=mn.getPoint(f,p.start,JB);else if(a>e._minimumTrackBallHeight){let A=Zn.grazingAltitudeLocation(f,i);if(!c(A))return;let C=i.cartesianToCartographic(A,_$);C.height=0,h=i.cartographicToCartesian(C,JB)}else{e._looking=!0;let A=e._ellipsoid.geodeticSurfaceNormal(r.position,g$);sf(e,t,n,A),H.clone(t,e._tiltCenterMousePosition);return}let g=Ot.eastNorthUpToFixedFrame(h,i,RAe),m=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let b=B.clone(r.transform,MAe);r._setTransform(g),rf(e,t,n,d.UNIT_Z),r._setTransform(b),e._globe=m,e._ellipsoid=y;let x=y.maximumRadius;e._rotateFactor=1/x,e._rotateRateRangeAdjustment=x}function Q0t(e,t,n){let i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground,a,l,u;if(H.equals(t,e._tiltCenterMousePosition))a=d.clone(e._tiltCenter,JB);else{if(a=Eg(e,t,JB),!c(a)){if(l=r.getPickRay(t,TG),u=Zn.rayEllipsoid(l,i),!c(u)){if(i.cartesianToCartographic(r.position,_$).height<=e._minimumTrackBallHeight){e._looking=!0;let w=e._ellipsoid.geodeticSurfaceNormal(r.position,g$);sf(e,t,n,w),H.clone(t,e._tiltCenterMousePosition)}return}a=mn.getPoint(l,u.start,JB)}s&&(c(l)||(l=r.getPickRay(t,TG)),xAe(e,l,a,a)),H.clone(t,e._tiltCenterMousePosition),d.clone(a,e._tiltCenter)}let f=o.canvas,h=OAe;h.x=f.clientWidth/2,h.y=e._tiltCenterMousePosition.y,l=r.getPickRay(h,TG);let p=d.magnitude(a),g=d.fromElements(p,p,p,d$),m=ie.fromCartesian3(g,h$);if(u=Zn.rayEllipsoid(l,m),!c(u))return;let y=d.magnitude(l.origin)>p?u.start:u.stop,b=mn.getPoint(l,y,W0t),x=Ot.eastNorthUpToFixedFrame(a,i,RAe),A=Ot.eastNorthUpToFixedFrame(b,m,q0t),C=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let v=d.UNIT_Z,P=B.clone(r.transform,MAe);r._setTransform(A);let M=d.cross(b,r.positionWC,xG);if(d.dot(r.rightWC,M)<0){let _=n.startPosition.y-n.endPosition.y;(s&&_<0||!s&&_>0)&&(v=void 0);let w=r.constrainedAxis;r.constrainedAxis=void 0,rf(e,t,n,v,!0,!1),r.constrainedAxis=w}else rf(e,t,n,v,!0,!1);if(r._setTransform(x),rf(e,t,n,v,!1,!0),c(r.constrainedAxis)){let _=d.cross(r.direction,r.constrainedAxis,xG);d.equalsEpsilon(_,d.ZERO,O.EPSILON6)||(d.dot(_,r.right)<0&&d.negate(_,_),d.cross(_,r.direction,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.up,r.up),d.normalize(r.right,r.right))}r._setTransform(P),e._globe=C,e._ellipsoid=S;let L=S.maximumRadius;e._rotateFactor=1/L,e._rotateRateRangeAdjustment=L;let F=d.clone(r.positionWC,xG);if(e.enableCollisionDetection&&y$(e,!0),!d.equals(r.positionWC,F)){r._setTransform(A),r.worldToCameraCoordinatesPoint(F,F);let _=d.magnitudeSquared(F);d.magnitudeSquared(r.position)>_&&(d.normalize(r.position,r.position),d.multiplyByScalar(r.position,Math.sqrt(_),r.position));let w=d.angleBetween(F,r.position),D=d.cross(F,r.position,F);d.normalize(D,D);let I=Le.fromAxisAngle(D,w,Y0t),N=J.fromQuaternion(I,X0t);J.multiplyByVector(N,r.direction,r.direction),J.multiplyByVector(N,r.up,r.up),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up),r._setTransform(P)}}var J0t=new H,ebt=new H,pAe=new mn,_Ae=new mn,tbt=new d,nbt=new d;function sf(e,t,n,i){let r=e._scene.camera,s=J0t;s.x=n.startPosition.x,s.y=0;let a=ebt;a.x=n.endPosition.x,a.y=0;let l=r.getPickRay(s,pAe),u=r.getPickRay(a,_Ae),f=0,h,p;r.frustum instanceof on?(h=l.origin,p=u.origin,d.add(r.direction,h,h),d.add(r.direction,p,p),d.subtract(h,r.position,h),d.subtract(p,r.position,p),d.normalize(h,h),d.normalize(p,p)):(h=l.direction,p=u.direction);let g=d.dot(h,p);g<1&&(f=Math.acos(g)),f=n.startPosition.x>n.endPosition.x?-f:f;let m=e._horizontalRotationAxis;if(c(i)?r.look(i,-f):c(m)?r.look(m,-f):r.lookLeft(f),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(s,pAe),u=r.getPickRay(a,_Ae),f=0,r.frustum instanceof on?(h=l.origin,p=u.origin,d.add(r.direction,h,h),d.add(r.direction,p,p),d.subtract(h,r.position,h),d.subtract(p,r.position,p),d.normalize(h,h),d.normalize(p,p)):(h=l.direction,p=u.direction),g=d.dot(h,p),g<1&&(f=Math.acos(g)),f=n.startPosition.y>n.endPosition.y?-f:f,i=i??m,c(i)){let y=r.direction,b=d.negate(i,tbt),x=d.equalsEpsilon(y,i,O.EPSILON2),A=d.equalsEpsilon(y,b,O.EPSILON2);if(!x&&!A){g=d.dot(y,i);let C=O.acosClamped(g);f>0&&f>C&&(f=C-O.EPSILON4),g=d.dot(y,b),C=O.acosClamped(g),f<0&&-f>C&&(f=-C+O.EPSILON4);let S=d.cross(i,y,nbt);r.look(S,f)}else(x&&f<0||A&&f>0)&&r.look(r.right,-f)}else r.lookUp(f)}function ibt(e){Tl(e,e.enableRotate,e.rotateEventTypes,B0t,e.inertiaSpin,"_lastInertiaSpinMovement"),Tl(e,e.enableZoom,e.zoomEventTypes,IAe,e.inertiaZoom,"_lastInertiaZoomMovement"),Tl(e,e.enableTilt,e.tiltEventTypes,K0t,e.inertiaSpin,"_lastInertiaTiltMovement"),Tl(e,e.enableLook,e.lookEventTypes,sf)}var obt=new B,rbt=new he;function y$(e,t){e._adjustedHeightForTerrain=!0;let n=e._scene,i=n.mode;if(i===oe.SCENE2D||i===oe.MORPHING)return;let o=n.camera,r=n.ellipsoid??ie.WGS84,s=n.mapProjection,a,l;B.equals(o.transform,B.IDENTITY)||(a=B.clone(o.transform,obt),l=d.magnitude(o.position),o._setTransform(B.IDENTITY));let u=rbt;i===oe.SCENE3D?r.cartesianToCartographic(o.position,u):s.unproject(o.position,u);let f=!1;if(u.height<e._minimumCollisionTerrainHeight){let h=e._scene.globeHeight;if(c(h)){let p=h+e.minimumZoomDistance,g=h-e._lastGlobeHeight,m=g/e._lastGlobeHeight;u.height<p&&(t||Math.abs(m)<=.1)&&(u.height=p,i===oe.SCENE3D?r.cartographicToCartesian(u,o.position):s.project(u,o.position),f=!0),t||Math.abs(m)<=.1?e._lastGlobeHeight=h:e._lastGlobeHeight+=g*.1}}c(a)&&(o._setTransform(a),f&&(d.normalize(o.position,o.position),d.negate(o.position,o.direction),d.multiplyByScalar(o.position,Math.max(l,e.minimumZoomDistance),o.position),d.normalize(o.direction,o.direction),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up)))}e3.prototype.onMap=function(){let e=this._scene,t=e.mode,n=e.camera;return t===oe.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};var sbt=new d,abt=new d;e3.prototype.update=function(){let e=this._scene,{camera:t,globe:n,mode:i}=e;B.equals(t.transform,B.IDENTITY)?(this._globe=n,this._ellipsoid=e.ellipsoid??ie.default):(this._globe=void 0,this._ellipsoid=ie.UNIT_SPHERE);let{verticalExaggeration:o,verticalExaggerationRelativeHeight:r}=e;this._minimumCollisionTerrainHeight=Dr.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=Dr.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=Dr.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&c(this._globe);let s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;let a=d.clone(t.positionWC,sbt),l=d.clone(t.directionWC,abt);if(i===oe.SCENE2D?r0t(this):i===oe.COLUMBUS_VIEW?(this._horizontalRotationAxis=d.UNIT_Z,P0t(this)):i===oe.SCENE3D&&(this._horizontalRotationAxis=void 0,ibt(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){let u=!d.equals(a,t.positionWC)||!d.equals(l,t.directionWC);y$(this,u)}this._aggregator.reset()};e3.prototype.isDestroyed=function(){return!1};e3.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),de(this)};var t3=e3;var n3=`uniform sampler2D colorTexture;
uniform sampler2D colorTexture2;
uniform vec2 center;
uniform float radius;
in vec2 v_textureCoordinates;
void main()
{
vec4 color0 = texture(colorTexture, v_textureCoordinates);
vec4 color1 = texture(colorTexture2, v_textureCoordinates);
float x = length(gl_FragCoord.xy - center) / radius;
float t = smoothstep(0.5, 0.8, x);
out_FragColor = mix(color0 + color1, color1, t);
}
`;var i3=`uniform sampler2D colorTexture;
uniform float avgLuminance;
uniform float threshold;
uniform float offset;
in vec2 v_textureCoordinates;
float key(float avg)
{
float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));
return max(0.0, guess) + 0.1;
}
void main()
{
vec4 color = texture(colorTexture, v_textureCoordinates);
vec3 xyz = czm_RGBToXYZ(color.rgb);
float luminance = xyz.r;
float scaledLum = key(avgLuminance) * luminance / avgLuminance;
float brightLum = max(scaledLum - threshold, 0.0);
float brightness = brightLum / (offset + brightLum);
xyz.r = brightness;
out_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
}
`;function Sg(){this._sceneFramebuffer=new QT;let e=.125,t=new Array(6);t[0]=new ho({fragmentShader:su,textureScale:e,forcePowerOfTwo:!0,sampleMode:ef.LINEAR});let n=t[1]=new ho({fragmentShader:i3,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new H,t[2]=new ho({fragmentShader:F0,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new ho({fragmentShader:F0,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new ho({fragmentShader:su,sampleMode:ef.LINEAR}),this._uCenter=new H,this._uRadius=void 0,t[5]=new ho({fragmentShader:n3,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new au({stages:t});let o=new rA(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Sg.prototype.get=function(e){return this._stages.get(e)};Sg.prototype.getStageByName=function(e){let t=this._stages.length;for(let n=0;n<t;++n){let i=this._stages.get(n);if(i.name===e)return i}};var cbt=new se,LAe=new H,lbt=new H,NAe=new B;function ubt(e,t,n){let i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection,l=B.computeViewportTransformation(n,0,1,NAe),u=B.multiplyByPoint(r,o,cbt),f=Ot.pointToGLWindowCoordinates(s,l,o,LAe);u.x+=O.SOLAR_RADIUS;let h=Ot.pointToGLWindowCoordinates(a,l,u,u),p=H.magnitude(H.subtract(h,f,h))*30*2,g=lbt;g.x=p,g.y=p,e._uCenter=H.clone(f,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;let m=t.drawingBufferWidth,y=t.drawingBufferHeight,b=e._stages,x=b.get(0),A=x.outputTexture.width,C=x.outputTexture.height,S=new Ke;S.width=A,S.height=C,l=B.computeViewportTransformation(S,0,1,NAe),f=Ot.pointToGLWindowCoordinates(s,l,o,LAe),g.x*=A/m,g.y*=C/y;let v=x.scissorRectangle;v.x=Math.max(f.x-g.x*.5,0),v.y=Math.max(f.y-g.y*.5,0),v.width=Math.min(g.x,m),v.height=Math.min(g.y,y);for(let P=1;P<4;++P)Ke.clone(v,b.get(P).scissorRectangle)}Sg.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};Sg.prototype.update=function(e){let t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);let o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),ubt(this,t,n),o};Sg.prototype.execute=function(e){let t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)};Sg.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(su,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Sg.prototype.isDestroyed=function(){return!1};Sg.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),de(this)};var o3=Sg;function FAe(){this._cachedShowFrustumsShaders={}}function fbt(e){let t={},n=e.vertexAttributes;for(let i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function dbt(e,t){let n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(f){f=He.replaceMain(f,"czm_Debug_main");let h=/out_FragData_(\d+)/g,p;for(;(p=h.exec(f))!==null;)r.indexOf(p[1])===-1&&r.push(p[1]);return f});let s=r.length,a="";a+=`uniform vec3 debugShowCommandsColor;
`,a+=`uniform vec3 debugShowFrustumsColor;
`,a+=`void main() 
{ 
    czm_Debug_main(); 
`;let l;if(s>0)for(l=0;l<s;++l)a+=`    out_FragData_${r[l]}.rgb *= debugShowCommandsColor;
`,a+=`    out_FragData_${r[l]}.rgb *= debugShowFrustumsColor;
`;else a+=`    out_FragColor.rgb *= debugShowCommandsColor;
`,a+=`    out_FragColor.rgb *= debugShowFrustumsColor;
`;a+="}",o.sources.push(a);let u=fbt(i);return Jt.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}var r3=new G;function hbt(e,t){let n;return c(t.uniformMap)?n=t.uniformMap:n={},c(n.debugShowCommandsColor)||c(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(c(t._debugColor)||(t._debugColor=G.fromRandom()),t._debugColor):G.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(r3.red=t.debugOverlappingFrustums&1?1:0,r3.green=t.debugOverlappingFrustums&2?1:0,r3.blue=t.debugOverlappingFrustums&4?1:0,r3.alpha=1,r3):G.WHITE}),n}var mbt=new Qe;FAe.prototype.executeDebugShowFrustumsCommand=function(e,t,n){let i=t.shaderProgram.id,o=this._cachedShowFrustumsShaders[i];c(o)||(o=dbt(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);let r=Qe.shallowClone(t,mbt);r.shaderProgram=o,r.uniformMap=hbt(e,t),r.execute(e.context,n)};var s3=FAe;function fA(e,t,n){this._primitive=e,this._tileIndex=t,this._sampleIndex=n,this._metadata={},this._orientedBoundingBox=new Dn}fA.fromKeyframeNode=function(e,t,n,i){T.typeOf.object("primitive",e),T.typeOf.number("tileIndex",t),T.typeOf.number("sampleIndex",n),T.typeOf.object("keyframeNode",i);let o=new fA(e,t,n),{spatialNode:r,content:s}=i;return o._metadata=pbt(e,s,n),o._orientedBoundingBox=gbt(e,r,n,o._orientedBoundingBox),o};function pbt(e,t,n){if(!c(t)||!c(t.metadata))return;let{names:i,types:o}=e.provider,{metadata:r}=t,s={};for(let a=0;a<i.length;a++){let l=i[a],u=at.getComponentCount(o[a]),f=r[a].slice(n*u,(n+1)*u);s[l]=f}return s}var BAe=new d,_bt=new d;function gbt(e,t,n,i){let o=t.dimensions,r=o.x*o.y,s=Math.floor(n/r),a=n-s*r,l=Math.floor(a/o.x),u=a-l*o.x,f=d.fromElements(u,l,s,BAe),h=d.divideComponents(d.subtract(f,e._paddingBefore,BAe),e.dimensions,_bt);return e._shape.computeOrientedBoundingBoxForSample(t,e.dimensions,h,i)}Object.defineProperties(fA.prototype,{metadata:{get:function(){return this._metadata}},primitive:{get:function(){return this._primitive}},sampleIndex:{get:function(){return this._sampleIndex}},tileIndex:{get:function(){return this._tileIndex}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox.clone()}}});fA.prototype.hasProperty=function(e){return c(this._metadata[e])};fA.prototype.getNames=function(){return Object.keys(this._metadata)};fA.prototype.getProperty=function(e){return this._metadata[e]};var a3=fA;var c3=`struct Ray {
vec3 pos;
vec3 dir;
vec3 rawDir;
};
#if defined(JITTER)
float hash(vec2 p)
{
vec3 p3 = fract(vec3(p.xyx) * 50.0);
p3 += dot(p3, p3.yzx + 19.19);
return fract((p3.x + p3.y) * p3.z);
}
#endif
float minComponent(in vec3 v) {
return min(min(v.x, v.y), v.z);
}
float maxComponent(in vec3 v) {
return max(max(v.x, v.y), v.z);
}
struct PointJacobianT {
vec3 point;
mat3 jacobianT;
};
`;var l3=`#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops
#if defined(PICKING_VOXEL)
#define ALPHA_ACCUM_MAX 0.1
#else
#define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0
#endif
uniform mat3 u_transformDirectionViewToLocal;
uniform vec3 u_cameraPositionUv;
uniform float u_stepSize;
#if defined(PICKING)
uniform vec4 u_pickColor;
#endif
vec3 getSampleSize(in int level) {
vec3 sampleCount = exp2(float(level)) * vec3(u_dimensions);
vec3 sampleSizeUv = 1.0 / sampleCount;
return scaleShapeUvToShapeSpace(sampleSizeUv);
}
#define MINIMUM_STEP_SCALAR (0.02)
#define SHIFT_FRACTION (0.001)
RayShapeIntersection getVoxelIntersection(in vec3 tileUv, in vec3 sampleSizeAlongRay) {
vec3 voxelCoord = tileUv * vec3(u_dimensions);
vec3 directions = sign(sampleSizeAlongRay);
vec3 positiveDirections = max(directions, 0.0);
vec3 entryCoord = mix(ceil(voxelCoord), floor(voxelCoord), positiveDirections);
vec3 exitCoord = entryCoord + directions;
vec3 distanceFromEntry = -abs((entryCoord - voxelCoord) * sampleSizeAlongRay);
float lastEntry = maxComponent(distanceFromEntry);
bvec3 isLastEntry = equal(distanceFromEntry, vec3(lastEntry));
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
vec4 entry = vec4(entryNormal, lastEntry);
vec3 distanceToExit = abs((exitCoord - voxelCoord) * sampleSizeAlongRay);
float firstExit = minComponent(distanceToExit);
bvec3 isFirstExit = equal(distanceToExit, vec3(firstExit));
vec3 exitNormal = vec3(isFirstExit) * directions;
vec4 exit = vec4(exitNormal, firstExit);
return RayShapeIntersection(entry, exit);
}
vec4 getStepSize(in SampleData sampleData, in Ray viewRay, in RayShapeIntersection shapeIntersection, in mat3 jacobianT, in float currentT) {
vec3 gradient = 2.0 * viewRay.rawDir * jacobianT;
vec3 sampleSizeAlongRay = getSampleSize(sampleData.tileCoords.w) / gradient;
RayShapeIntersection voxelIntersection = getVoxelIntersection(sampleData.tileUv, sampleSizeAlongRay);
vec3 voxelNormal = normalize(jacobianT * voxelIntersection.entry.xyz);
vec4 voxelEntry = vec4(voxelNormal, currentT + voxelIntersection.entry.w);
vec4 entry = intersectionMax(shapeIntersection.entry, voxelEntry);
float fixedStep = minComponent(abs(sampleSizeAlongRay)) * u_stepSize;
float shift = fixedStep * SHIFT_FRACTION;
float dt = voxelIntersection.exit.w + shift;
if ((currentT + dt) > shapeIntersection.exit.w) {
dt = shapeIntersection.exit.w - currentT + shift;
}
float stepSize = clamp(dt, fixedStep * MINIMUM_STEP_SCALAR, fixedStep + shift);
return vec4(entry.xyz, stepSize);
}
vec2 packIntToVec2(int value) {
float shifted = float(value) / 255.0;
float lowBits = fract(shifted);
float highBits = floor(shifted) / 255.0;
return vec2(highBits, lowBits);
}
vec2 packFloatToVec2(float value) {
float lowBits = fract(value);
float highBits = floor(value) / 255.0;
return vec2(highBits, lowBits);
}
int getSampleIndex(in SampleData sampleData) {
vec3 maxCoordinate = vec3(u_inputDimensions) - vec3(0.5);
vec3 inputCoordinate = clamp(sampleData.inputCoordinate, vec3(0.0), maxCoordinate);
ivec3 sampleIndex = ivec3(floor(inputCoordinate));
return sampleIndex.x + u_inputDimensions.x * (sampleIndex.y + u_inputDimensions.y * sampleIndex.z);
}
void main()
{
vec4 fragCoord = gl_FragCoord;
vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);
vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection);
vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection);
vec3 viewPosUv = u_cameraPositionUv;
#if defined(SHAPE_ELLIPSOID)
vec3 rawDir = viewDirUv * u_ellipsoidRadiiUv;
Ray viewRayUv = Ray(viewPosUv, viewDirUv, rawDir);
#else
Ray viewRayUv = Ray(viewPosUv, viewDirUv, viewDirUv);
#endif
Intersections ix;
RayShapeIntersection shapeIntersection = intersectScene(screenCoord, viewRayUv, ix);
if (shapeIntersection.entry.w == NO_HIT) {
discard;
}
float currentT = shapeIntersection.entry.w;
float endT = shapeIntersection.exit.w;
vec3 positionUv = viewPosUv + currentT * viewDirUv;
PointJacobianT pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
TraversalData traversalData;
SampleData sampleDatas[SAMPLE_COUNT];
traverseOctreeFromBeginning(pointJacobian.point, traversalData, sampleDatas);
vec4 step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
#if defined(JITTER)
float noise = hash(screenCoord);
currentT += noise * step.w;
positionUv += noise * step.w * viewDirUv;
#endif
FragmentInput fragmentInput;
#if defined(STATISTICS)
setStatistics(fragmentInput.metadata.statistics);
#endif
vec4 colorAccum = vec4(0.0);
for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) {
Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);
copyPropertiesToMetadata(properties, fragmentInput.metadata);
fragmentInput.voxel.positionUv = positionUv;
fragmentInput.voxel.positionShapeUv = pointJacobian.point;
fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;
fragmentInput.voxel.viewDirUv = viewDirUv;
fragmentInput.voxel.viewDirWorld = viewDirWorld;
fragmentInput.voxel.surfaceNormal = step.xyz;
fragmentInput.voxel.travelDistance = step.w;
fragmentInput.voxel.stepCount = stepCount;
fragmentInput.voxel.tileIndex = sampleDatas[0].megatextureIndex;
fragmentInput.voxel.sampleIndex = getSampleIndex(sampleDatas[0]);
czm_modelMaterial materialOutput;
fragmentMain(fragmentInput, materialOutput);
vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);
color.rgb = max(color.rgb, vec3(0.0));
color.a = clamp(color.a, 0.0, 1.0);
colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);
if (colorAccum.a > ALPHA_ACCUM_MAX) {
colorAccum.a = ALPHA_ACCUM_MAX;
break;
}
if (step.w == 0.0) {
step.w == 0.00001;
}
currentT += step.w;
positionUv = viewPosUv + currentT * viewDirUv;
if (currentT > endT) {
#if (INTERSECTION_COUNT == 1)
break;
#else
shapeIntersection = nextIntersection(ix);
if (shapeIntersection.entry.w == NO_HIT) {
break;
} else {
currentT = shapeIntersection.entry.w;
endT = shapeIntersection.exit.w;
positionUv = viewPosUv + currentT * viewDirUv;
}
#endif
}
pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
traverseOctreeFromExisting(pointJacobian.point, traversalData, sampleDatas);
step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
}
colorAccum.a /= ALPHA_ACCUM_MAX;
#if defined(PICKING)
if (colorAccum.a == 0.0) {
discard;
}
out_FragColor = u_pickColor;
#elif defined(PICKING_VOXEL)
if (colorAccum.a == 0.0) {
discard;
}
vec2 megatextureId = packIntToVec2(sampleDatas[0].megatextureIndex);
vec2 sampleIndex = packIntToVec2(getSampleIndex(sampleDatas[0]));
out_FragColor = vec4(megatextureId, sampleIndex);
#else
out_FragColor = colorAccum;
#endif
}
`;var u3=`in vec2 position;
uniform vec4 u_ndcSpaceAxisAlignedBoundingBox;
void main() {
vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy;
vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw;
vec2 translation = 0.5 * (aabbMax + aabbMin);
vec2 scale = 0.5 * (aabbMax - aabbMin);
gl_Position = vec4(position * scale + translation, 0.0, 1.0);
}
`;var f3=`#define NO_HIT (-czm_infinity)
#define INF_HIT (czm_infinity * 0.5)
struct RayShapeIntersection {
vec4 entry;
vec4 exit;
};
vec4 intersectionMin(in vec4 intersect0, in vec4 intersect1)
{
if (intersect0.w == NO_HIT) {
return intersect1;
} else if (intersect1.w == NO_HIT) {
return intersect0;
}
return (intersect0.w <= intersect1.w) ? intersect0 : intersect1;
}
vec4 intersectionMax(in vec4 intersect0, in vec4 intersect1)
{
return (intersect0.w >= intersect1.w) ? intersect0 : intersect1;
}
RayShapeIntersection intersectIntersections(in Ray ray, in RayShapeIntersection intersect0, in RayShapeIntersection intersect1)
{
bool missed = (intersect0.entry.w == NO_HIT) ||
(intersect1.entry.w == NO_HIT) ||
(intersect0.exit.w < intersect1.entry.w) ||
(intersect0.entry.w > intersect1.exit.w);
if (missed) {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
return RayShapeIntersection(miss, miss);
}
vec4 entry = intersectionMax(intersect0.entry, intersect1.entry);
vec4 exit = intersectionMin(intersect0.exit, intersect1.exit);
return RayShapeIntersection(entry, exit);
}
struct Intersections {
vec4 intersections[INTERSECTION_COUNT * 2];
#if (INTERSECTION_COUNT > 1)
int index;
int surroundCount;
bool surroundIsPositive;
#endif
};
RayShapeIntersection getFirstIntersection(in Intersections ix)
{
return RayShapeIntersection(ix.intersections[0], ix.intersections[1]);
}
vec4 encodeIntersectionType(vec4 intersection, int index, bool entry)
{
float scale = float(index > 0) * 2.0 + float(!entry) + 1.0;
return vec4(intersection.xyz * scale, intersection.w);
}
#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = vec4(0.0, float(!positive) * 2.0 + float(!enter) + 1.0, 0.0, (t))
#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec4(0.0, float((index) > 0) * 2.0 + 1.0, 0.0, (entryExit).x); (ix).intersections[(index) * 2 + 1] = vec4(0.0, float((index) > 0) * 2.0 + 2.0, 0.0, (entryExit).y)
#define setSurfaceIntersection(/*inout Intersections*/ ix, /*int*/ index, /*vec4*/ intersection, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = encodeIntersectionType((intersection), int(!positive), (enter))
#define setShapeIntersection(/*inout Intersections*/ ix, /*int*/ index, /*RayShapeIntersection*/ intersection) (ix).intersections[(index) * 2 + 0] = encodeIntersectionType((intersection).entry, (index), true); (ix).intersections[(index) * 2 + 1] = encodeIntersectionType((intersection).exit, (index), false)
#if (INTERSECTION_COUNT > 1)
void initializeIntersections(inout Intersections ix) {
const int sortPasses = INTERSECTION_COUNT * 2 - 1;
for (int n = sortPasses; n > 0; --n) {
for (int i = 0; i < sortPasses; ++i) {
if (i >= n) { break; }
vec4 intersect0 = ix.intersections[i + 0];
vec4 intersect1 = ix.intersections[i + 1];
bool inOrder = intersect0.w <= intersect1.w;
ix.intersections[i + 0] = inOrder ? intersect0 : intersect1;
ix.intersections[i + 1] = inOrder ? intersect1 : intersect0;
}
}
ix.index = 0;
ix.surroundCount = 0;
ix.surroundIsPositive = false;
}
#endif
#if (INTERSECTION_COUNT > 1)
RayShapeIntersection nextIntersection(inout Intersections ix) {
vec4 surfaceIntersection = vec4(0.0, 0.0, 0.0, NO_HIT);
RayShapeIntersection shapeIntersection = RayShapeIntersection(surfaceIntersection, surfaceIntersection);
const int passCount = INTERSECTION_COUNT * 2;
if (ix.index == passCount) {
return shapeIntersection;
}
for (int i = 0; i < passCount; ++i) {
if (i < ix.index) {
continue;
}
ix.index = i + 1;
surfaceIntersection = ix.intersections[i];
int intersectionType = int(length(surfaceIntersection.xyz) - 0.5);
bool currShapeIsPositive = intersectionType < 2;
bool enter = intMod(intersectionType, 2) == 0;
ix.surroundCount += enter ? +1 : -1;
ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;
if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {
shapeIntersection.entry = surfaceIntersection;
}
bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;
bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;
if (exitPositive || enterNegativeFromPositive) {
shapeIntersection.exit = surfaceIntersection;
if (exitPositive) {
ix.index = passCount;
}
break;
}
}
return shapeIntersection;
}
#endif
`;var d3=`uniform mat4 u_transformPositionViewToUv;
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));
if (logDepthOrDepth != 0.0) {
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);
eyeCoordinateDepth /= eyeCoordinateDepth.w;
vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth);
float t = dot(depthPositionUv - ray.pos, ray.dir);
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT));
} else {
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));
}
}
`;var h3=`uniform sampler2D u_clippingPlanesTexture;
uniform mat4 u_clippingPlanesMatrix;
vec4 intersectPlane(in Ray ray, in vec4 plane) {
vec3 n = plane.xyz;
float w = plane.w;
float a = dot(ray.pos, n);
float b = dot(ray.dir, n);
float t = -(w + a) / b;
return vec4(n, t);
}
void intersectClippingPlanes(in Ray ray, inout Intersections ix) {
vec4 backSide = vec4(-ray.dir, -INF_HIT);
vec4 farSide = vec4(ray.dir, +INF_HIT);
RayShapeIntersection clippingVolume;
#if (CLIPPING_PLANES_COUNT == 1)
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
bool reflects = dot(ray.dir, intersection.xyz) < 0.0;
clippingVolume.entry = reflects ? backSide : intersection;
clippingVolume.exit = reflects ? intersection : farSide;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
#elif defined(CLIPPING_PLANES_UNION)
vec4 firstTransmission = vec4(ray.dir, +INF_HIT);
vec4 lastReflection = vec4(-ray.dir, -INF_HIT);
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
if (dot(ray.dir, planeUv.xyz) > 0.0) {
firstTransmission = intersection.w <= firstTransmission.w ? intersection : firstTransmission;
} else {
lastReflection = intersection.w >= lastReflection.w ? intersection : lastReflection;
}
}
clippingVolume.entry = backSide;
clippingVolume.exit = lastReflection;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, clippingVolume);
clippingVolume.entry = firstTransmission;
clippingVolume.exit = farSide;
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, clippingVolume);
#else // intersection
vec4 lastTransmission = vec4(ray.dir, -INF_HIT);
vec4 firstReflection = vec4(-ray.dir, +INF_HIT);
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
vec4 intersection = intersectPlane(ray, planeUv);
if (dot(ray.dir, planeUv.xyz) > 0.0) {
lastTransmission = intersection.w > lastTransmission.w ? intersection : lastTransmission;
} else {
firstReflection = intersection.w < firstReflection.w ? intersection: firstReflection;
}
}
if (lastTransmission.w < firstReflection.w) {
clippingVolume.entry = lastTransmission;
clippingVolume.exit = firstReflection;
} else {
clippingVolume.entry = vec4(-ray.dir, NO_HIT);
clippingVolume.exit = vec4(ray.dir, NO_HIT);
}
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
#endif
}
`;var Rw=`vec4 intersectLongitude(in Ray ray, in float angle, in bool positiveNormal) {
float normalSign = positiveNormal ? 1.0 : -1.0;
vec2 planeNormal = vec2(-sin(angle), cos(angle)) * normalSign;
vec2 position = ray.pos.xy;
vec2 direction = ray.dir.xy;
float approachRate = dot(direction, planeNormal);
float distance = -dot(position, planeNormal);
float t = (approachRate == 0.0)
? NO_HIT
: distance / approachRate;
return vec4(planeNormal, 0.0, t);
}
RayShapeIntersection intersectHalfSpace(in Ray ray, in float angle, in bool positiveNormal)
{
vec4 intersection = intersectLongitude(ray, angle, positiveNormal);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
bool hitFront = (intersection.w > 0.0) == (dot(ray.pos.xy, intersection.xy) > 0.0);
if (!hitFront) {
return RayShapeIntersection(intersection, farSide);
} else {
return RayShapeIntersection(-1.0 * farSide, intersection);
}
}
void intersectFlippedWedge(in Ray ray, in vec2 minMaxAngle, out RayShapeIntersection intersections[2])
{
intersections[0] = intersectHalfSpace(ray, minMaxAngle.x, false);
intersections[1] = intersectHalfSpace(ray, minMaxAngle.y, true);
}
bool hitPositiveHalfPlane(in Ray ray, in vec4 intersection, in bool positiveNormal) {
float normalSign = positiveNormal ? 1.0 : -1.0;
vec2 planeDirection = vec2(intersection.y, -intersection.x) * normalSign;
vec2 hit = ray.pos.xy + intersection.w * ray.dir.xy;
return dot(hit, planeDirection) > 0.0;
}
void intersectHalfPlane(in Ray ray, in float angle, out RayShapeIntersection intersections[2]) {
vec4 intersection = intersectLongitude(ray, angle, true);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (hitPositiveHalfPlane(ray, intersection, true)) {
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = vec4(-1.0 * intersection.xy, 0.0, intersection.w);
intersections[1].entry = intersection;
intersections[1].exit = farSide;
} else {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = farSide;
intersections[1].entry = miss;
intersections[1].exit = miss;
}
}
RayShapeIntersection intersectRegularWedge(in Ray ray, in vec2 minMaxAngle)
{
vec4 intersect1 = intersectLongitude(ray, minMaxAngle.x, false);
vec4 intersect2 = intersectLongitude(ray, minMaxAngle.y, true);
bool inOrder = intersect1.w <= intersect2.w;
vec4 first = inOrder ? intersect1 : intersect2;
vec4 last = inOrder ? intersect2 : intersect1;
bool firstIsAhead = first.w >= 0.0;
bool startedInsideFirst = dot(ray.pos.xy, first.xy) < 0.0;
bool exitFromInside = firstIsAhead == startedInsideFirst;
bool lastIsAhead = last.w > 0.0;
bool startedOutsideLast = dot(ray.pos.xy, last.xy) >= 0.0;
bool enterFromOutside = lastIsAhead == startedOutsideLast;
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
if (exitFromInside && enterFromOutside) {
return RayShapeIntersection(first, last);
} else if (!exitFromInside && enterFromOutside) {
return RayShapeIntersection(-1.0 * farSide, first);
} else if (exitFromInside && !enterFromOutside) {
return RayShapeIntersection(last, farSide);
} else {
return RayShapeIntersection(miss, miss);
}
}
`;var m3=`uniform vec3 u_renderMinBounds;
uniform vec3 u_renderMaxBounds;
RayShapeIntersection intersectBox(in Ray ray, in vec3 minBound, in vec3 maxBound)
{
vec3 t0 = (minBound - ray.pos) / ray.dir;
vec3 t1 = (maxBound - ray.pos) / ray.dir;
vec3 entries = min(t0, t1);
vec3 exits = max(t0, t1);
vec3 directions = sign(ray.dir);
float lastEntry = maxComponent(entries);
bvec3 isLastEntry = equal(entries, vec3(lastEntry));
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
vec4 entry = vec4(entryNormal, lastEntry);
float firstExit = minComponent(exits);
bvec3 isFirstExit = equal(exits, vec3(firstExit));
vec3 exitNormal = vec3(isLastEntry) * directions;
vec4 exit = vec4(exitNormal, firstExit);
if (entry.w > exit.w) {
entry.w = NO_HIT;
exit.w = NO_HIT;
}
return RayShapeIntersection(entry, exit);
}
void intersectShape(in Ray ray, inout Intersections ix)
{
RayShapeIntersection intersection = intersectBox(ray, u_renderMinBounds, u_renderMaxBounds);
setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);
}
`;var p3=`uniform vec2 u_cylinderRenderRadiusMinMax;
uniform vec2 u_cylinderRenderHeightMinMax;
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
uniform vec2 u_cylinderRenderAngleMinMax;
#endif
RayShapeIntersection intersectHeightBounds(in Ray ray, in vec2 minMaxHeight, in bool convex)
{
float zPosition = ray.pos.z;
float zDirection = ray.dir.z;
float tmin = (minMaxHeight.x - zPosition) / zDirection;
float tmax = (minMaxHeight.y - zPosition) / zDirection;
float signFlip = convex ? 1.0 : -1.0;
vec4 intersectMin = vec4(0.0, 0.0, -1.0 * signFlip, tmin);
vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);
bool topEntry = zDirection < 0.0;
vec4 entry = topEntry ? intersectMax : intersectMin;
vec4 exit = topEntry ? intersectMin : intersectMax;
return RayShapeIntersection(entry, exit);
}
RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool convex)
{
vec2 position = ray.pos.xy;
vec2 direction = ray.dir.xy;
float a = dot(direction, direction);
float b = dot(position, direction);
float c = dot(position, position) - radius * radius;
float determinant = b * b - a * c;
if (determinant < 0.0) {
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
return RayShapeIntersection(miss, miss);
}
determinant = sqrt(determinant);
float t1 = (-b - determinant) / a;
float t2 = (-b + determinant) / a;
float signFlip = convex ? 1.0 : -1.0;
vec4 intersect1 = vec4(normalize(position + t1 * direction) * signFlip, 0.0, t1);
vec4 intersect2 = vec4(normalize(position + t2 * direction) * signFlip, 0.0, t2);
return RayShapeIntersection(intersect1, intersect2);
}
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in float radius, in vec2 minMaxHeight)
{
RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);
RayShapeIntersection heightBoundsIntersection = intersectHeightBounds(ray, minMaxHeight, true);
return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);
}
void intersectShape(Ray ray, inout Intersections ix)
{
ray.pos = ray.pos * 2.0 - 1.0;
ray.dir *= 2.0;
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);
if (outerIntersect.entry.w == NO_HIT) {
return;
}
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
RayShapeIntersection innerIntersect = intersectCylinder(ray, 1.0, false);
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true);
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true);
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false);
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)
RayShapeIntersection innerIntersect = intersectCylinder(ray, u_cylinderRenderRadiusMinMax.x, false);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);
#endif
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)
RayShapeIntersection wedgeIntersects[2];
intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax, wedgeIntersects);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
RayShapeIntersection wedgeIntersects[2];
intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x, wedgeIntersects);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
#endif
}
`;var _3=`#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
uniform vec2 u_ellipsoidRenderLongitudeMinMax;
#endif
uniform float u_eccentricitySquared;
uniform vec2 u_ellipsoidRenderLatitudeSinMinMax;
uniform vec2 u_clipMinMaxHeight;
RayShapeIntersection intersectZPlane(in Ray ray, in float z) {
float t = -ray.pos.z / ray.dir.z;
bool startsOutside = sign(ray.pos.z) == sign(z);
bool entry = (t >= 0.0) != startsOutside;
vec4 intersect = vec4(0.0, 0.0, z, t);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (entry) {
return RayShapeIntersection(intersect, farSide);
} else {
return RayShapeIntersection(-1.0 * farSide, intersect);
}
}
RayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex)
{
vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight);
vec3 position = ray.pos * radiiCorrection;
vec3 direction = ray.dir * radiiCorrection;
float a = dot(direction, direction);
float b = dot(direction, position);
float c = dot(position, position) - 1.0;
float determinant = b * b - a * c;
if (determinant < 0.0) {
vec4 miss = vec4(normalize(direction), NO_HIT);
return RayShapeIntersection(miss, miss);
}
determinant = sqrt(determinant);
float signB = b < 0.0 ? -1.0 : 1.0;
float t1 = (-b - signB * determinant) / a;
float t2 = c / (a * t1);
float tmin = min(t1, t2);
float tmax = max(t1, t2);
float directionScale = convex ? 1.0 : -1.0;
vec3 d1 = directionScale * normalize(position + tmin * direction);
vec3 d2 = directionScale * normalize(position + tmax * direction);
return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax));
}
vec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle)
{
vec3 o = ray.pos;
vec3 d = ray.dir;
float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle;
float aSin = d.z * d.z * sinSqrHalfAngle;
float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle;
float a = aSin + aCos;
float bSin = d.z * o.z * sinSqrHalfAngle;
float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle;
float b = bSin + bCos;
float cSin = o.z * o.z * sinSqrHalfAngle;
float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle;
float c = cSin + cCos;
float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos;
if (determinant < 0.0) {
return vec2(NO_HIT);
} else if (a == 0.0) {
return (b == 0.0)
? vec2(NO_HIT)
: vec2(-0.5 * c / b, NO_HIT);
}
determinant = sqrt(determinant);
float signB = b < 0.0 ? -1.0 : 1.0;
float t1 = (-b - signB * determinant) / a;
float t2 = c / (a * t1);
float tmin = min(t1, t2);
float tmax = max(t1, t2);
return vec2(tmin, tmax);
}
vec3 getConeNormal(in vec3 p, in bool convex) {
vec2 radial = -abs(p.z) * normalize(p.xy);
float zSign = (p.z < 0.0) ? -1.0 : 1.0;
float z = length(p.xy) * zSign;
float flip = (convex) ? -1.0 : 1.0;
return normalize(vec3(radial, z) * flip);
}
float getLatitudeConeShift(in float sinLatitude) {
float x2 = u_eccentricitySquared * sinLatitude * sinLatitude;
float primeVerticalRadius = inversesqrt(1.0 - x2);
return primeVerticalRadius * u_eccentricitySquared * sinLatitude;
}
void intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) {
ray.pos = ray.pos * u_ellipsoidRadiiUv;
ray.dir = ray.dir * u_ellipsoidRadiiUv;
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
intersections[0].entry = -1.0 * farSide;
intersections[0].exit = farSide;
intersections[1].entry = miss;
intersections[1].exit = miss;
if (intersect.x == NO_HIT) {
return;
}
float tmin = intersect.x;
float tmax = intersect.y;
vec3 p0 = ray.pos + tmin * ray.dir;
vec3 p1 = ray.pos + tmax * ray.dir;
vec4 intersect0 = vec4(getConeNormal(p0, true), tmin);
vec4 intersect1 = vec4(getConeNormal(p1, true), tmax);
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
if (p0InShadowCone && p1InShadowCone) {
} else if (p0InShadowCone) {
intersections[0].exit = intersect1;
} else if (p1InShadowCone) {
intersections[0].entry = intersect0;
} else {
intersections[0].exit = intersect0;
intersections[1].entry = intersect1;
intersections[1].exit = farSide;
}
}
RayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) {
ray.pos = ray.pos * u_ellipsoidRadiiUv;
ray.dir = ray.dir * u_ellipsoidRadiiUv;
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
if (intersect.x == NO_HIT) {
return RayShapeIntersection(miss, miss);
}
float tmin = intersect.x;
float tmax = intersect.y;
vec3 p0 = ray.pos + tmin * ray.dir;
vec3 p1 = ray.pos + tmax * ray.dir;
vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin);
vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax);
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
if (p0InShadowCone && p1InShadowCone) {
return RayShapeIntersection(miss, miss);
} else if (p0InShadowCone) {
return RayShapeIntersection(intersect1, farSide);
} else if (p1InShadowCone) {
return RayShapeIntersection(-1.0 * farSide, intersect0);
} else {
return RayShapeIntersection(intersect0, intersect1);
}
}
void intersectShape(in Ray ray, inout Intersections ix) {
ray.pos = ray.pos * 2.0 - 1.0;
ray.dir *= 2.0;
RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
if (outerIntersect.entry.w == NO_HIT) {
return;
}
RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false);
if (innerIntersect.entry.w == NO_HIT) {
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
} else {
innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w);
innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w);
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true);
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true);
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false);
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false);
}
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
RayShapeIntersection bottomConeIntersections[2];
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
RayShapeIntersection topConeIntersections[2];
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
RayShapeIntersection wedgeIntersects[2];
intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
RayShapeIntersection wedgeIntersects[2];
intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
#endif
}
`;var dA=`RayShapeIntersection intersectScene(in vec2 screenCoord, in Ray ray, out Intersections ix) {
intersectShape(ray, ix);
RayShapeIntersection intersection = getFirstIntersection(ix);
if (intersection.entry.w == NO_HIT) {
return intersection;
}
#if defined(CLIPPING_PLANES)
intersectClippingPlanes(ray, ix);
#endif
#if defined(DEPTH_TEST)
intersectDepth(screenCoord, ray, ix);
#endif
#if (INTERSECTION_COUNT > 1)
initializeIntersections(ix);
for (int i = 0; i < INTERSECTION_COUNT; ++i) {
intersection = nextIntersection(ix);
if (intersection.exit.w > 0.0) {
intersection.entry.w = max(intersection.entry.w, 0.0);
break;
}
}
#else
intersection.entry.w = max(intersection.entry.w, 0.0);
#endif
return intersection;
}
`;var g3=`#if defined(BOX_HAS_SHAPE_BOUNDS)
uniform vec3 u_boxUvToShapeUvScale;
uniform vec3 u_boxUvToShapeUvTranslate;
#endif
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
return PointJacobianT(positionUv, mat3(0.5));
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return positionShape * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;
#else
return positionShape;
#endif
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 convertShapeUvToUvSpace(in vec3 shapeUv) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return (shapeUv - u_boxUvToShapeUvTranslate) / u_boxUvToShapeUvScale;
#else
return shapeUv;
#endif
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
#if defined(BOX_HAS_SHAPE_BOUNDS)
return shapeUv / u_boxUvToShapeUvScale;
#else
return shapeUv;
#endif
}
`;var y3=`#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
uniform vec2 u_cylinderUvToShapeUvRadius;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
uniform vec2 u_cylinderUvToShapeUvHeight;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
uniform vec2 u_cylinderUvToShapeUvAngle;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
uniform vec2 u_cylinderShapeUvAngleMinMax;
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
uniform float u_cylinderShapeUvAngleRangeZeroMid;
#endif
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
vec3 position = positionUv * 2.0 - 1.0;
float radius = length(position.xy);
vec3 radial = normalize(vec3(position.xy, 0.0));
float height = positionUv.z;
vec3 z = vec3(0.0, 0.0, 1.0);
float angle = atan(position.y, position.x);
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
vec3 point = vec3(radius, angle, height);
mat3 jacobianT = mat3(radial, z, east / length(position.xy));
return PointJacobianT(point, jacobianT);
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
float radius = positionShape.x;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y;
#endif
float angle = (positionShape.y + czm_pi) / czm_twoPi;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY)
angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle;
#elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle;
#endif
angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y;
#endif
float height = positionShape.z;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y;
#endif
return vec3(radius, angle, height);
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
float radius = shapeUv.x;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
radius /= u_cylinderUvToShapeUvRadius.x;
#endif
float angle = shapeUv.y * czm_twoPi;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
angle /= u_cylinderUvToShapeUvAngle.x;
#endif
float height = shapeUv.z;
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
height /= u_cylinderUvToShapeUvHeight.x;
#endif
return vec3(radius, angle, height);
}
`;var b3=`uniform vec3 u_ellipsoidRadiiUv;
uniform vec2 u_evoluteScale;
uniform vec3 u_ellipsoidInverseRadiiSquaredUv;
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
uniform vec2 u_ellipsoidUvToShapeUvLongitude;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
uniform vec2 u_ellipsoidUvToShapeUvLatitude;
#endif
uniform float u_ellipsoidInverseHeightDifferenceUv;
vec3 nearestPointAndRadiusOnEllipse(vec2 pos, vec2 radii) {
vec2 p = abs(pos);
vec2 inverseRadii = 1.0 / radii;
vec2 tTrigs = vec2(0.7071067811865476);
vec2 v = radii * tTrigs;
vec2 evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
const int iterations = 3;
for (int i = 0; i < iterations; ++i) {
vec2 q = normalize(p - evolute) * length(v - evolute);
tTrigs = (q + evolute) * inverseRadii;
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
v = radii * tTrigs;
evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
}
return vec3(v * sign(pos), length(v - evolute));
}
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
vec3 position = positionUv * 2.0 - 1.0;
position = position * u_ellipsoidRadiiUv;
float longitude = atan(position.y, position.x);
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
float distanceFromZAxis = length(position.xy);
vec2 posEllipse = vec2(distanceFromZAxis, position.z);
vec3 surfacePointAndRadius = nearestPointAndRadiusOnEllipse(posEllipse, u_ellipsoidRadiiUv.xz);
vec2 surfacePoint = surfacePointAndRadius.xy;
vec2 normal2d = normalize(surfacePoint * u_ellipsoidInverseRadiiSquaredUv.xz);
float latitude = atan(normal2d.y, normal2d.x);
vec3 north = vec3(-normal2d.y * normalize(position.xy), abs(normal2d.x));
float heightSign = length(posEllipse) < length(surfacePoint) ? -1.0 : 1.0;
float height = heightSign * length(posEllipse - surfacePoint);
vec3 up = normalize(cross(east, north));
vec3 point = vec3(longitude, latitude, height);
mat3 jacobianT = mat3(east / distanceFromZAxis, north / (surfacePointAndRadius.z + height), up);
return PointJacobianT(point, jacobianT);
}
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
float longitude = (positionShape.x + czm_pi) / czm_twoPi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY)
longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude;
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY)
longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude;
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y;
#endif
float latitude = (positionShape.y + czm_piOverTwo) / czm_pi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;
#endif
float height = 1.0 + positionShape.z * u_ellipsoidInverseHeightDifferenceUv;
return vec3(longitude, latitude, height);
}
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
return pointJacobian;
}
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
float longitude = shapeUv.x * czm_twoPi;
#if defined (ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
longitude /= u_ellipsoidUvToShapeUvLongitude.x;
#endif
float latitude = shapeUv.y * czm_pi;
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
latitude /= u_ellipsoidUvToShapeUvLatitude.x;
#endif
float height = shapeUv.z / u_ellipsoidInverseHeightDifferenceUv;
return vec3(longitude, latitude, height);
}
`;var x3=`#define OCTREE_FLAG_INTERNAL 0
#define OCTREE_FLAG_LEAF 1
#define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2
#define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops
uniform sampler2D u_octreeInternalNodeTexture;
uniform vec2 u_octreeInternalNodeTexelSizeUv;
uniform int u_octreeInternalNodeTilesPerRow;
#if (SAMPLE_COUNT > 1)
uniform sampler2D u_octreeLeafNodeTexture;
uniform vec2 u_octreeLeafNodeTexelSizeUv;
uniform int u_octreeLeafNodeTilesPerRow;
#endif
uniform ivec3 u_dimensions;
uniform ivec3 u_inputDimensions;
#if defined(PADDING)
uniform ivec3 u_paddingBefore;
#endif
struct OctreeNodeData {
int data;
int flag;
};
struct TraversalData {
ivec4 octreeCoords;
int parentOctreeIndex;
};
struct SampleData {
int megatextureIndex;
ivec4 tileCoords;
vec3 tileUv;
vec3 inputCoordinate;
#if (SAMPLE_COUNT > 1)
float weight;
#endif
};
int intMod(in int a, in int b) {
return a - (b * (a / b));
}
int normU8_toInt(in float value) {
return int(value * 255.0);
}
int normU8x2_toInt(in vec2 value) {
return int(value.x * 255.0) + 256 * int(value.y * 255.0);
}
float normU8x2_toFloat(in vec2 value) {
return float(normU8x2_toInt(value)) / 65535.0;
}
OctreeNodeData getOctreeNodeData(in vec2 octreeUv) {
vec4 texData = texture(u_octreeInternalNodeTexture, octreeUv);
OctreeNodeData data;
data.data = normU8x2_toInt(texData.xy);
data.flag = normU8x2_toInt(texData.zw);
return data;
}
OctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) {
int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x;
int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex;
int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow;
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
return getOctreeNodeData(octreeUv);
}
int getOctreeParentIndex(in int octreeIndex) {
int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9;
int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow;
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
vec4 parentData = texture(u_octreeInternalNodeTexture, octreeUv);
int parentOctreeIndex = normU8x2_toInt(parentData.xy);
return parentOctreeIndex;
}
vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
float dimAtLevel = exp2(float(octreeCoords.w));
return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);
}
vec3 getClampedTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
return clamp(tileUv, vec3(0.0), vec3(1.0));
}
void addSampleCoordinates(in vec3 shapePosition, inout SampleData sampleData) {
vec3 tileUv = getClampedTileUv(shapePosition, sampleData.tileCoords);
vec3 inputCoordinate = tileUv * vec3(u_dimensions);
#if defined(PADDING)
inputCoordinate += vec3(u_paddingBefore);
#endif
#if defined(Y_UP_METADATA_ORDER)
#if defined(SHAPE_BOX)
float inputY = inputCoordinate.y;
inputCoordinate.y = float(u_inputDimensions.y) - inputCoordinate.z;
inputCoordinate.z = inputY;
#elif defined(SHAPE_CYLINDER)
float angle = inputCoordinate.y;
float height = inputCoordinate.z;
#if (!defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE))
if (sampleData.tileCoords.w == 0) {
float angleCount = float(u_inputDimensions.z);
angle = mod(angle + angleCount / 2.0, angleCount);
}
#endif
inputCoordinate.y = height;
inputCoordinate.z = angle;
#endif
#endif
sampleData.tileUv = tileUv;
sampleData.inputCoordinate = inputCoordinate;
}
void getOctreeLeafSampleData(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleData) {
sampleData.megatextureIndex = data.data;
sampleData.tileCoords = (data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
}
#if (SAMPLE_COUNT > 1)
void getOctreeLeafSampleDatas(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleDatas[SAMPLE_COUNT]) {
int leafIndex = data.data;
int leafNodeTexelCount = 2;
float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5;
float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5;
vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY);
vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0);
float lerp = normU8x2_toFloat(leafData0.xy);
sampleDatas[0].weight = 1.0 - lerp;
sampleDatas[1].weight = lerp;
sampleDatas[0].tileCoords = (normU8_toInt(leafData0.z) == 1)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
sampleDatas[1].tileCoords = (normU8_toInt(leafData0.w) == 1)
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
: octreeCoords;
vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);
vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1);
sampleDatas[0].megatextureIndex = normU8x2_toInt(leafData1.xy);
sampleDatas[1].megatextureIndex = normU8x2_toInt(leafData1.zw);
}
#endif
OctreeNodeData traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData) {
float sizeAtLevel = exp2(-1.0 * float(traversalData.octreeCoords.w));
vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;
vec3 end = start + vec3(sizeAtLevel);
OctreeNodeData childData;
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
vec3 center = 0.5 * (start + end);
vec3 childCoord = step(center, shapePosition);
ivec4 octreeCoords = traversalData.octreeCoords;
traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);
childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));
if (childData.flag != OCTREE_FLAG_INTERNAL) {
break;
}
start = mix(start, center, childCoord);
end = mix(center, end, childCoord);
traversalData.parentOctreeIndex = childData.data;
}
return childData;
}
void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
traversalData.octreeCoords = ivec4(0);
traversalData.parentOctreeIndex = 0;
OctreeNodeData nodeData = getOctreeNodeData(vec2(0.0));
if (nodeData.flag != OCTREE_FLAG_LEAF) {
nodeData = traverseOctreeDownwards(shapePosition, traversalData);
}
#if (SAMPLE_COUNT == 1)
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[0]);
#else
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
addSampleCoordinates(shapePosition, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[1]);
#endif
}
bool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) {
return clamp(v, minVal, maxVal) == v;
}
bool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) {
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
bool inside = inRange(tileUv, vec3(0.0), vec3(1.0));
return inside || octreeCoords.w == 0;
}
void traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) {
if (insideTile(shapePosition, traversalData.octreeCoords)) {
for (int i = 0; i < SAMPLE_COUNT; i++) {
addSampleCoordinates(shapePosition, sampleDatas[i]);
}
return;
}
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
traversalData.octreeCoords.xyz /= 2;
traversalData.octreeCoords.w -= 1;
if (insideTile(shapePosition, traversalData.octreeCoords)) {
break;
}
traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);
}
OctreeNodeData nodeData = traverseOctreeDownwards(shapePosition, traversalData);
#if (SAMPLE_COUNT == 1)
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[0]);
#else
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
addSampleCoordinates(shapePosition, sampleDatas[0]);
addSampleCoordinates(shapePosition, sampleDatas[1]);
#endif
}
`;var T3=`uniform ivec2 u_megatextureSliceDimensions;
uniform ivec2 u_megatextureTileDimensions;
uniform vec2 u_megatextureVoxelSizeUv;
uniform vec2 u_megatextureSliceSizeUv;
uniform vec2 u_megatextureTileSizeUv;
int intMin(int a, int b) {
return a <= b ? a : b;
}
int intMax(int a, int b) {
return a >= b ? a : b;
}
int intClamp(int v, int minVal, int maxVal) {
return intMin(intMax(v, minVal), maxVal);
}
vec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale)
{
int indexX = intMod(index, dimensions.x);
int indexY = index / dimensions.x;
return vec2(indexX, indexY) * uvScale;
}
Properties getPropertiesFromMegatexture(in SampleData sampleData) {
int tileIndex = sampleData.megatextureIndex;
vec3 voxelCoord = sampleData.inputCoordinate;
#if defined(NEAREST_SAMPLING)
voxelCoord = floor(voxelCoord) + vec3(0.5);
#endif
vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);
float slice = voxelCoord.z - 0.5;
int sliceIndex = int(floor(slice));
int sliceIndex0 = intClamp(sliceIndex, 0, u_inputDimensions.z - 1);
vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(u_inputDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;
vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;
#if defined(NEAREST_SAMPLING)
return getPropertiesFromMegatextureAtUv(uv0);
#else
float sliceLerp = fract(slice);
int sliceIndex1 = intMin(sliceIndex + 1, u_inputDimensions.z - 1);
vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset;
Properties properties0 = getPropertiesFromMegatextureAtUv(uv0);
Properties properties1 = getPropertiesFromMegatextureAtUv(uv1);
return mixProperties(properties0, properties1, sliceLerp);
#endif
}
Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {
#if (SAMPLE_COUNT == 1)
return getPropertiesFromMegatexture(sampleDatas[0]);
#else
Properties properties = clearProperties();
for (int i = 0; i < SAMPLE_COUNT; ++i) {
float weight = sampleDatas[i].weight;
if (weight > 0.0) {
Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);
tempProperties = scaleProperties(tempProperties, weight);
properties = sumProperties(properties, tempProperties);
}
}
return properties;
#endif
}
`;var ybt={Z_UP:0,Y_UP:1},Td=Object.freeze(ybt);function bbt(e){let t=new wb;this.shaderBuilder=t;let n=e._customShader,i=xt(e._uniformMap,n.uniformMap);e._uniformMap=i;let o=n.uniforms;for(let p in o)if(o.hasOwnProperty(p)){let g=o[p];t.addUniform(g.type,p,ge.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",ge.FRAGMENT),this.uniformMap=i;let r=e._clippingPlanes,s=c(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([u3]),e.provider.metadataOrder===Td.Y_UP&&t.addDefine("Y_UP_METADATA_ORDER",void 0,ge.FRAGMENT);let a=e._provider.shape;a==="BOX"?t.addDefine("SHAPE_BOX",void 0,ge.FRAGMENT):a==="CYLINDER"?t.addDefine("SHAPE_CYLINDER",void 0,ge.FRAGMENT):a==="ELLIPSOID"&&t.addDefine("SHAPE_ELLIPSOID",void 0,ge.FRAGMENT),t.addFragmentLines([n.fragmentShaderText,"#line 0",x3,c3,f3,T3]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,ge.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,ge.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,ge.FRAGMENT),t.addFragmentLines([h3])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,ge.FRAGMENT),t.addFragmentLines([d3])),a==="BOX"?t.addFragmentLines([g3,m3,dA]):a==="CYLINDER"?t.addFragmentLines([y3,Rw,p3,dA]):a==="ELLIPSOID"&&t.addFragmentLines([b3,Rw,_3,dA]),t.addFragmentLines([l3]);let l=e._shape,u=l.shaderDefines;for(let p in u)if(u.hasOwnProperty(p)){let g=u[p];c(g)&&(g=g===!0?void 0:g,t.addDefine(p,g,ge.FRAGMENT))}let f=l.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",f,ge.FRAGMENT),s===1?f+=1:r.unionClippingRegions?f+=2:f+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",f,ge.FRAGMENT),f+=1),t.addDefine("INTERSECTION_COUNT",f,ge.FRAGMENT),(!d.equals(e.paddingBefore,d.ZERO)||!d.equals(e.paddingAfter,d.ZERO))&&t.addDefine("PADDING",void 0,ge.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,ge.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,ge.FRAGMENT);let h=e._traversal;t.addDefine("SAMPLE_COUNT",`${h._sampleCount}`,ge.FRAGMENT)}var A3=bbt;function xbt(e,t){let{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,l=o.length,u=c(s)&&c(a);n.addDefine("METADATA_COUNT",l,ge.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,ge.FRAGMENT);for(let R=0;R<l;R++){let L=i[R],F=o[R],_=`PropertyStatistics_${L}`,w=`PropertyStatistics_${L}`;n.addStruct(_,w,ge.FRAGMENT);let D=CG(F);n.addStructField(_,D,"min"),n.addStructField(_,D,"max")}let f="Statistics",h="Statistics",p="statistics";n.addStruct(f,h,ge.FRAGMENT);for(let R=0;R<l;R++){let L=i[R],F=`PropertyStatistics_${L}`,_=L;n.addStructField(f,F,_)}let g="Metadata",m="Metadata",y="metadata";n.addStruct(g,m,ge.FRAGMENT),n.addStructField(g,h,p);for(let R=0;R<l;R++){let L=i[R],F=o[R],_=CG(F);n.addStructField(g,_,L)}for(let R=0;R<l;R++){let L=i[R],F=o[R],_=Abt(F),w=`VoxelProperty_${L}`,D=`VoxelProperty_${L}`;n.addStruct(w,D,ge.FRAGMENT),n.addStructField(w,_,"partialDerivativeLocal"),n.addStructField(w,_,"partialDerivativeWorld"),n.addStructField(w,_,"partialDerivativeView"),n.addStructField(w,_,"partialDerivativeValid")}let b="Voxel",x="Voxel",A="voxel";n.addStruct(b,x,ge.FRAGMENT);for(let R=0;R<l;R++){let L=i[R],F=`VoxelProperty_${L}`;n.addStructField(b,F,L)}n.addStructField(b,"vec3","positionEC"),n.addStructField(b,"vec3","positionUv"),n.addStructField(b,"vec3","positionShapeUv"),n.addStructField(b,"vec3","positionUvLocal"),n.addStructField(b,"vec3","viewDirUv"),n.addStructField(b,"vec3","viewDirWorld"),n.addStructField(b,"vec3","surfaceNormal"),n.addStructField(b,"float","travelDistance"),n.addStructField(b,"int","stepCount"),n.addStructField(b,"int","tileIndex"),n.addStructField(b,"int","sampleIndex");let C="FragmentInput";n.addStruct(C,"FragmentInput",ge.FRAGMENT),n.addStructField(C,m,y),n.addStructField(C,x,A);let v="Properties",P="Properties",M="properties";n.addStruct(v,P,ge.FRAGMENT);for(let R=0;R<l;R++){let L=i[R],F=o[R],_=CG(F);n.addStructField(v,_,L)}{let R="clearProperties";n.addFunction(R,`${P} clearProperties()`,ge.FRAGMENT),n.addFunctionLines(R,[`${P} ${M};`]);for(let L=0;L<l;L++){let F=i[L],_=o[L],w=r[L],D=CG(_,w);n.addFunctionLines(R,[`${M}.${F} = ${D}(0.0);`])}n.addFunctionLines(R,[`return ${M};`])}{let R="sumProperties";n.addFunction(R,`${P} sumProperties(${P} propertiesA, ${P} propertiesB)`,ge.FRAGMENT),n.addFunctionLines(R,[`${P} ${M};`]);for(let L=0;L<l;L++){let F=i[L];n.addFunctionLines(R,[`${M}.${F} = propertiesA.${F} + propertiesB.${F};`])}n.addFunctionLines(R,[`return ${M};`])}{let R="scaleProperties";n.addFunction(R,`${P} scaleProperties(${P} ${M}, float scale)`,ge.FRAGMENT),n.addFunctionLines(R,[`${P} scaledProperties = ${M};`]);for(let L=0;L<l;L++){let F=i[L];n.addFunctionLines(R,[`scaledProperties.${F} *= scale;`])}n.addFunctionLines(R,["return scaledProperties;"])}{let R="mixProperties";n.addFunction(R,`${P} mixProperties(${P} propertiesA, ${P} propertiesB, float mixFactor)`,ge.FRAGMENT),n.addFunctionLines(R,[`${P} ${M};`]);for(let L=0;L<l;L++){let F=i[L];n.addFunctionLines(R,[`${M}.${F} = mix(propertiesA.${F}, propertiesB.${F}, mixFactor);`])}n.addFunctionLines(R,[`return ${M};`])}{let R="copyPropertiesToMetadata";n.addFunction(R,`void copyPropertiesToMetadata(in ${P} ${M}, inout ${m} ${y})`,ge.FRAGMENT);for(let L=0;L<l;L++){let F=i[L];n.addFunctionLines(R,[`${y}.${F} = ${M}.${F};`])}}if(u){let R="setStatistics";n.addFunction(R,`void setStatistics(inout ${h} ${p})`,ge.FRAGMENT);for(let L=0;L<l;L++){let F=i[L],_=o[L],w=at.getComponentCount(_);for(let D=0;D<w;D++){let I=Cbt(_,D),N=s[L][D],k=a[L][D];!c(N)||!c(k)||n.addFunctionLines(R,[`${p}.${F}.min${I} = ${kAe(N)};`,`${p}.${F}.max${I} = ${kAe(k)};`])}}}{let R="getPropertiesFromMegatextureAtUv";n.addFunction(R,`${P} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,ge.FRAGMENT),n.addFunctionLines(R,[`${P} ${M};`]);for(let L=0;L<l;L++){let F=i[L],_=o[L],w=r[L],D=Tbt(_,w);n.addFunctionLines(R,[`properties.${F} = texture(u_megatextureTextures[${L}], texcoord)${D};`])}n.addFunctionLines(R,[`return ${M};`])}}function CG(e){if(e===at.SCALAR)return"float";if(e===at.VEC2)return"vec2";if(e===at.VEC3)return"vec3";if(e===at.VEC4)return"vec4"}function Tbt(e){if(e===at.SCALAR)return".r";if(e===at.VEC2)return".ra";if(e===at.VEC3)return".rgb";if(e===at.VEC4)return""}function Abt(e){if(e===at.SCALAR)return"vec3";if(e===at.VEC2)return"mat2";if(e===at.VEC3)return"mat3";if(e===at.VEC4)return"mat4"}function kAe(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function Cbt(e,t){return e===at.SCALAR?"":`[${t}]`}var C3=xbt;function Ebt(e,t){let n=new A3(e);C3(n,e);let{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){let x="getClippingPlane",A=fg(o,t),C=0,S=A.indexOf(")")+1,v=A.indexOf("{",S)+1,P=A.indexOf("}",v),M=A.slice(C,S),R=A.slice(v,P);i.addFunction(x,M,ge.FRAGMENT),i.addFunctionLines(x,[R])}let s=i.clone();s.addDefine("PICKING",void 0,ge.FRAGMENT);let a=i.clone();a.addDefine("PICKING_VOXEL",void 0,ge.FRAGMENT);let l=i.buildShaderProgram(t),u=s.buildShaderProgram(t),f=a.buildShaderProgram(t),h=Ve.fromCache({cull:{enabled:!0,face:xi.BACK},depthTest:{enabled:!1},depthMask:!1,blending:ln.PRE_MULTIPLIED_ALPHA_BLEND}),p=t.getViewportQuadVertexArray(),g=e._depthTest,m=new Qe({vertexArray:p,primitiveType:Me.TRIANGLES,renderState:h,shaderProgram:l,uniformMap:n.uniformMap,modelMatrix:e._compoundModelMatrix,pass:De.VOXELS,executeInClosestFrustum:!0,owner:this,cull:g,occlude:g}),y=Qe.shallowClone(m,new Qe);y.shaderProgram=u,y.pickOnly=!0;let b=Qe.shallowClone(m,new Qe);if(b.shaderProgram=f,b.pickOnly=!0,c(e._drawCommand)){let x=e._drawCommand;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPick)){let x=e._drawCommandPick;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPickVoxel)){let x=e._drawCommandPickVoxel;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}e._drawCommand=m,e._drawCommandPick=y,e._drawCommandPickVoxel=b}var E3=Ebt;var Sbt={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",MAT2:"mat2",MAT3:"mat3",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},hA=Object.freeze(Sbt);function wbt(e,t,n){let i=new Uint8ClampedArray(e.buffer),o=new ImageData(i,t,n),r=document.createElement("canvas");return r.width=t,r.height=n,r.getContext("2d").putImageData(o,0,0),r}var S3=wbt;function Mw(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}Mw.prototype.getTexture=function(e){return this._textures[e]};function vbt(e,t,n){n.resource.fetchImage().then(function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})}).catch(function(){let i=e._textures[t];c(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}Mw.prototype.loadTexture2D=function(e,t){c(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):vbt(this,e,t)};function Dbt(e,t,n){let{id:i,textureUniform:o,image:r}=t,s=n.webgl2?EG(o,r,n):Pbt(o,r,n),a=e._textures[i];c(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function EG(e,t,n){let{typedArray:i,sampler:o}=e,r=c(i)?VAe(e,n):new Rt({context:n,source:t,sampler:o});return UAe(o)&&r.generateMipmap(),r}function Pbt(e,t,n){let{typedArray:i,sampler:o}=e,r=UAe(o),s=o.wrapS===gn.REPEAT||o.wrapS===gn.MIRRORED_REPEAT||o.wrapT===gn.REPEAT||o.wrapT===gn.MIRRORED_REPEAT,{width:a,height:l}=c(i)?e:t,u=[a,l].every(O.isPowerOfTwo);if((r||s)&&!u)if(c(i)){if(e.pixelDatatype===Ue.UNSIGNED_BYTE){let h=S3(i,a,l),p=yy(h);return EG({sampler:o},p,n)}}else{let h=yy(t);return EG(e,h,n)}else return EG(e,t,n);return r?console.warn("Texture requires resizing for mipmaps but pixelDataType cannot be resized. The texture may be rendered incorrectly."):s&&console.warn("Texture requires resizing for wrapping but pixelDataType cannot be resized. The texture may be rendered incorrectly."),VAe(e,n)}function UAe(e){return[Yt.NEAREST_MIPMAP_NEAREST,Yt.NEAREST_MIPMAP_LINEAR,Yt.LINEAR_MIPMAP_NEAREST,Yt.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function VAe(e,t){let{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new Rt({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}Mw.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;let t=e.context;this._defaultTexture=t.defaultTexture;let n=this._loadedImages;for(let i=0;i<n.length;i++){let o=n[i];Dbt(this,o,t)}n.length=0};Mw.prototype.isDestroyed=function(){return!1};Mw.prototype.destroy=function(){let e=this._textures;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];n!==this._defaultTexture&&n.destroy()}return de(this)};var w3=Mw;function v3(e){e=e??W.EMPTY_OBJECT,this.mode=e.mode??y_.MODIFY_MATERIAL,this.lightingModel=e.lightingModel,this.uniforms=e.uniforms??W.EMPTY_OBJECT,this.varyings=e.varyings??W.EMPTY_OBJECT,this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=e.translucencyMode??Ly.INHERIT,this._textureManager=new w3,this._defaultTexture=void 0,this.uniformMap=Ibt(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},Mbt(this),Lbt(this)}function Ibt(e){let t=e.uniforms,n={};for(let i in t)if(t.hasOwnProperty(i)){let o=t[i],r=o.type;if(r===hA.SAMPLER_CUBE)throw new E("CustomShader does not support samplerCube uniforms");r===hA.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=Obt(e,i)):n[i]=Rbt(e,i)}return n}function Obt(e,t){return function(){return e._textureManager.getTexture(t)??e._defaultTexture}}function Rbt(e,t){return function(){return e.uniforms[t].value}}function mA(e,t,n){let i;for(;(i=t.exec(e))!==null;){let o=i[1];n[o]=!0}}function Mbt(e){let t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g,o,r=e.vertexShaderText;c(r)&&(o=e.usedVariablesVertex.attributeSet,mA(r,t,o),o=e.usedVariablesVertex.featureIdSet,mA(r,n,o),o=e.usedVariablesVertex.metadataSet,mA(r,i,o));let s=e.fragmentShaderText;if(c(s)){o=e.usedVariablesFragment.attributeSet,mA(s,t,o),o=e.usedVariablesFragment.featureIdSet,mA(s,n,o),o=e.usedVariablesFragment.metadataSet,mA(s,i,o);let a=/material\.(\w+)/g,l=e.usedVariablesFragment.materialSet;mA(s,a,l)}}function zAe(e){let t=/^.*MC$/,n=/^.*WC$/,i=/^.*EC$/;return t.test(e)?`${e} (model coordinates)`:n.test(e)?`${e} (Cartesian world coordinates)`:i.test(e)?`${e} (eye coordinates)`:e}function Nc(e,t,n,i){if(e.hasOwnProperty(t)){let o=`${zAe(t)} is not available in the ${i} shader. Did you mean ${zAe(n)} instead?`;throw new E(o)}}function Lbt(e){let t=e.usedVariablesVertex.attributeSet;Nc(t,"position","positionMC","vertex"),Nc(t,"normal","normalMC","vertex"),Nc(t,"tangent","tangentMC","vertex"),Nc(t,"bitangent","bitangentMC","vertex"),Nc(t,"positionWC","positionMC","vertex"),Nc(t,"positionEC","positionMC","vertex"),Nc(t,"normalEC","normalMC","vertex"),Nc(t,"tangentEC","tangentMC","vertex"),Nc(t,"bitangentEC","bitangentMC","vertex");let n=e.usedVariablesFragment.attributeSet;Nc(n,"position","positionEC","fragment"),Nc(n,"normal","normalEC","fragment"),Nc(n,"tangent","tangentEC","fragment"),Nc(n,"bitangent","bitangentEC","fragment"),Nc(n,"normalMC","normalEC","fragment"),Nc(n,"tangentMC","tangentEC","fragment"),Nc(n,"bitangentMC","bitangentEC","fragment")}v3.prototype.setUniform=function(e,t){if(T.typeOf.string("uniformName",e),T.defined("value",t),!c(this.uniforms[e]))throw new E(`Uniform ${e} must be declared in the CustomShader constructor.`);let n=this.uniforms[e];n.type===hA.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):c(t.clone)?n.value=t.clone(n.value):n.value=t};v3.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};v3.prototype.isDestroyed=function(){return!1};v3.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),de(this)};var pA=v3;function wg(e){if(T.typeOf.object("options",e),!c(e.loader)){if(!c(e.metadata))throw new E("One of loader and metadata must be defined.");if(!Array.isArray(e.metadata))throw new E("metadata must be an array of TypedArrays.")}let{loader:t,metadata:n}=e;this._loader=t,this._metadata=n,this._resourcesLoaded=!1,this._ready=!1}Object.defineProperties(wg.prototype,{ready:{get:function(){return this._ready}},metadata:{get:function(){return this._metadata}}});wg.fromMetadataArray=function(e){if(T.typeOf.object("metadata",e),!Array.isArray(e))throw new E("metadata must be an array of TypedArrays.");return new wg({metadata:e})};wg.fromGltf=async function(e){T.typeOf.object("resource",e);let t=new rh({gltfResource:e,releaseGltfJson:!1,loadAttributesAsTypedArray:!0});try{await t.load()}catch(n){throw t.destroy(),n}return new wg({loader:t})};wg.prototype.update=function(e,t){let n=this._loader;if(!this._ready){if(t.afterRender.push(()=>!0),!c(n)){this._ready=!0;return}if(this._resourcesLoaded){let{structuralMetadata:i,scene:o}=n.components,{attributes:r}=o.nodes[0].primitives[0];this._metadata=Nbt(r,i,e),this._ready=!0;return}this._resourcesLoaded=n.process(t)}};function Nbt(e,t,n){let{className:i,names:o,types:r,componentTypes:s}=n.provider,a=t.propertyAttributes.find(f=>f.class.id===i),{properties:l}=a,u=new Array(o.length);for(let f=0;f<e.length;f++){let h=l[o[f]].attribute,p=e.find(b=>b.name===h);if(!c(p))continue;let g=Nt.toComponentDatatype(s[f]),m=at.getComponentCount(r[f]),y=p.count*m;u[f]=$.createArrayBufferView(g,p.typedArray.buffer,p.typedArray.byteOffset+p.byteOffset,y)}return u}wg.prototype.isDestroyed=function(){return!1};wg.prototype.destroy=function(){return this._loader=this._loader&&this._loader.destroy(),de(this)};var _A=wg;function mp(){this.orientedBoundingBox=new Dn,this.boundingSphere=new le,this.boundTransform=new B,this.shapeTransform=new B,this._minBounds=mp.DefaultMinBounds.clone(),this._maxBounds=mp.DefaultMaxBounds.clone(),this.shaderUniforms={renderMinBounds:new d,renderMaxBounds:new d,boxUvToShapeUvScale:new d,boxUvToShapeUvTranslate:new d},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_SHAPE_BOUNDS:void 0},this.shaderMaximumIntersectionsLength=0}var Fbt=new d,b$=new d,Bbt=new J,kbt=new d,Ubt=new d,Vbt=new d,zbt=new d,HAe=B.fromRotationTranslation(J.fromUniformScale(.5,new J),new d(.5,.5,.5),new B);mp.prototype.update=function(e,t,n,i,o){T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n),i=i??t.clone(kbt),o=o??n.clone(Ubt),t=d.clone(t,this._minBounds),n=d.clone(n,this._maxBounds);let r=d.clamp(t,i,o,Vbt),s=d.clamp(n,i,o,zbt),a=B.getScale(e,b$);if(r.x>s.x||r.y>s.y||r.z>s.z||(r.x===s.x)+(r.y===s.y)+(r.z===s.z)>=2||a.x===0||a.y===0||a.z===0)return!1;this.shapeTransform=B.clone(e,this.shapeTransform),this.orientedBoundingBox=T$(r,s,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=le.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let{shaderUniforms:l,shaderDefines:u}=this;for(let g in u)u.hasOwnProperty(g)&&(u[g]=void 0);let f=0;u.BOX_INTERSECTION_INDEX=f,f+=1,l.renderMinBounds=B.multiplyByPoint(HAe,r,l.renderMinBounds),l.renderMaxBounds=B.multiplyByPoint(HAe,s,l.renderMaxBounds),u.BOX_HAS_SHAPE_BOUNDS=!0;let h=t,p=n;return l.boxUvToShapeUvScale=d.fromElements(2/(h.x===p.x?1:p.x-h.x),2/(h.y===p.y?1:p.y-h.y),2/(h.z===p.z?1:p.z-h.z),l.boxUvToShapeUvScale),l.boxUvToShapeUvTranslate=d.fromElements(-l.boxUvToShapeUvScale.x*(h.x*.5+.5),-l.boxUvToShapeUvScale.y*(h.y*.5+.5),-l.boxUvToShapeUvScale.z*(h.z*.5+.5),l.boxUvToShapeUvTranslate),this.shaderMaximumIntersectionsLength=f,!0};var SG=new d,x$=new d;mp.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);let r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),l=d.fromElements(O.lerp(r.x,s.x,a*t),O.lerp(r.y,s.y,a*n),O.lerp(r.z,s.z,a*i),SG),u=d.fromElements(O.lerp(r.x,s.x,a*(t+1)),O.lerp(r.y,s.y,a*(n+1)),O.lerp(r.z,s.z,a*(i+1)),x$);return T$(l,u,this.shapeTransform,o)};var GAe=new d;mp.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){T.typeOf.object("spatialNode",e),T.typeOf.object("tileDimensions",t),T.typeOf.object("tileUv",n),T.typeOf.object("result",i);let o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,GAe),s=d.multiplyByScalar(r,o,GAe),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,SG),o,SG),l=d.add(a,s,x$),u=this._minBounds,f=this._maxBounds,h=d.fromElements(O.lerp(u.x,f.x,a.x),O.lerp(u.y,f.y,a.y),O.lerp(u.z,f.z,a.z),SG),p=d.fromElements(O.lerp(u.x,f.x,l.x),O.lerp(u.y,f.y,l.y),O.lerp(u.z,f.z,l.z),x$);return T$(h,p,this.shapeTransform,i)};mp.DefaultMinBounds=Object.freeze(new d(-1,-1,-1));mp.DefaultMaxBounds=Object.freeze(new d(1,1,1));function T$(e,t,n,i){let o=mp.DefaultMinBounds,r=mp.DefaultMaxBounds;if(d.equals(e,o)&&d.equals(t,r))i.center=B.getTranslation(n,i.center),i.halfAxes=B.getMatrix3(n,i.halfAxes);else{let a=B.getScale(n,b$),l=d.midpoint(e,t,Fbt);i.center=B.multiplyByPoint(n,l,i.center),a=d.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),b$);let u=B.getRotation(n,Bbt);i.halfAxes=J.setScale(u,a,i.halfAxes)}return i}var gA=mp;function vg(){this.orientedBoundingBox=new Dn,this.boundingSphere=new le,this.boundTransform=new B,this.shapeTransform=new B,this._minBounds=vg.DefaultMinBounds.clone(),this._maxBounds=vg.DefaultMaxBounds.clone(),this.shaderUniforms={cylinderRenderRadiusMinMax:new H,cylinderRenderAngleMinMax:new H,cylinderRenderHeightMinMax:new H,cylinderUvToShapeUvRadius:new H,cylinderUvToShapeUvAngle:new H,cylinderUvToShapeUvHeight:new H,cylinderShapeUvAngleMinMax:new H,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MAX:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MIN:void 0,CYLINDER_INTERSECTION_INDEX_ANGLE:void 0},this.shaderMaximumIntersectionsLength=0}var qAe=new d,Hbt=new d,Gbt=new d,jbt=new d,Wbt=new d;vg.prototype.update=function(e,t,n,i,o){T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n),i=i??t.clone(Hbt),o=o??n.clone(Gbt),t=d.clone(t,this._minBounds),n=d.clone(n,this._maxBounds);let{DefaultMinBounds:r,DefaultMaxBounds:s}=vg,a=s.y-r.y,l=.5*a,u=O.EPSILON10,f=O.EPSILON3,h=O.EPSILON10;t.x=Math.max(0,t.x),n.x=Math.max(0,n.x),t.y=O.negativePiToPi(t.y),n.y=O.negativePiToPi(n.y),i.y=O.negativePiToPi(i.y),o.y=O.negativePiToPi(o.y);let p=d.maximumByComponent(t,i,jbt),g=d.minimumByComponent(n,o,Wbt),m=B.getScale(e,qAe);if(g.x===0||p.x>g.x||p.z>g.z||O.equalsEpsilon(m.x,0,void 0,u)||O.equalsEpsilon(m.y,0,void 0,u)||O.equalsEpsilon(m.z,0,void 0,u))return!1;this.shapeTransform=B.clone(e,this.shapeTransform),this.orientedBoundingBox=E$(p,g,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=le.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let y=t.x===r.x&&n.x===s.x,b=n.y<t.y,x=n.y-t.y+b*a,A=x>l+h&&x<a-h,C=x<l-h,S=x>=l-h&&x<=l+h,v=A||C||S,P=O.equalsEpsilon(t.y,r.y,void 0,f),M=O.equalsEpsilon(n.y,s.y,void 0,f),R=t.z===r.z&&n.z===s.z,L=p.x===r.x,F=g.y<p.y,_=g.y-p.y+F*a,w=_>=l-h&&_<a-h,D=_>h&&_<l-h,I=_<=h,N=w||D||I,{shaderUniforms:k,shaderDefines:z}=this;for(let j in z)z.hasOwnProperty(j)&&(z[j]=void 0);let V=0;if(z.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=V,V+=1,L||(z.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,z.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=V,V+=1),k.cylinderRenderRadiusMinMax=H.fromElements(p.x,g.x,k.cylinderRenderRadiusMinMax),p.x===g.x&&(z.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),!y){z.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;let j=n.x-t.x,U=0,q=1;j!==0&&(U=1/j,q=-t.x/j),k.cylinderUvToShapeUvRadius=H.fromElements(U,q,k.cylinderUvToShapeUvRadius)}if(!R){z.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;let j=n.z-t.z,U=0,q=1;j!==0&&(U=2/j,q=-(t.z+1)/j),k.cylinderUvToShapeUvHeight=H.fromElements(U,q,k.cylinderUvToShapeUvHeight)}if(k.cylinderRenderHeightMinMax=H.fromElements(p.z,g.z,k.cylinderRenderHeightMinMax),b&&(z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),N&&(z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,z.CYLINDER_INTERSECTION_INDEX_ANGLE=V,w?(z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,V+=1):D?(z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,V+=2):I&&(z.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,V+=2),k.cylinderRenderAngleMinMax=H.fromElements(p.y,g.y,k.cylinderRenderAngleMinMax)),v){z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,P&&(z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),M&&(z.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);let j=(t.y-r.y)/a,U=(n.y-r.y)/a,q=1-x/a;if(k.cylinderShapeUvAngleMinMax=H.fromElements(j,U,k.cylinderShapeUvAngleMinMax),k.cylinderShapeUvAngleRangeZeroMid=(U+.5*q)%1,x<=h)k.cylinderUvToShapeUvAngle=H.fromElements(0,1,k.cylinderUvToShapeUvAngle);else{let Y=a/x,te=-(t.y-r.y)/x;k.cylinderUvToShapeUvAngle=H.fromElements(Y,te,k.cylinderUvToShapeUvAngle)}}return this.shaderMaximumIntersectionsLength=V,!0};var wG=new d,C$=new d;vg.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);let r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),l=d.fromElements(O.lerp(r.x,s.x,t*a),O.lerp(r.y,s.y,n*a),O.lerp(r.z,s.z,i*a),wG),u=d.fromElements(O.lerp(r.x,s.x,(t+1)*a),O.lerp(r.y,s.y,(n+1)*a),O.lerp(r.z,s.z,(i+1)*a),C$);return E$(l,u,this.shapeTransform,o)};var jAe=new d;vg.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){T.typeOf.object("spatialNode",e),T.typeOf.object("tileDimensions",t),T.typeOf.object("tileUv",n),T.typeOf.object("result",i);let o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,jAe),s=d.multiplyByScalar(r,o,jAe),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,wG),o,wG),l=d.add(a,s,C$),u=this._minBounds,f=this._maxBounds,h=d.fromElements(O.lerp(u.x,f.x,a.x),O.lerp(u.y,f.y,a.y),O.lerp(u.z,f.z,a.z),wG),p=d.fromElements(O.lerp(u.x,f.x,l.x),O.lerp(u.y,f.y,l.y),O.lerp(u.z,f.z,l.z),C$);return E$(h,p,this.shapeTransform,i)};vg.DefaultMinBounds=Object.freeze(new d(0,-O.PI,-1));vg.DefaultMaxBounds=Object.freeze(new d(1,+O.PI,1));var qbt=5,Ybt=new Array(qbt),Xbt=new d,Kbt=new J,$bt=new B,Zbt=new B,Qbt=new B,A$=new B,Jbt=new d,ext=new d,txt=new d,YAe=new Array(8);for(let e=0;e<8;e++)YAe[e]=new d;function WAe(e,t,n){return Math.abs(se.dot(e,t))<n}function nxt(e){let t=B.getColumn(e,0,Jbt),n=B.getColumn(e,1,ext),i=B.getColumn(e,2,txt),o=O.EPSILON4;return WAe(t,n,o)&&WAe(n,i,o)}function ixt(e,t){let n=YAe;d.fromElements(-.5,-.5,-.5,n[0]),d.fromElements(-.5,-.5,.5,n[1]),d.fromElements(-.5,.5,-.5,n[2]),d.fromElements(-.5,.5,.5,n[3]),d.fromElements(.5,-.5,-.5,n[4]),d.fromElements(.5,-.5,.5,n[5]),d.fromElements(.5,.5,-.5,n[6]),d.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)B.multiplyByPoint(e,n[i],n[i]);return Dn.fromPoints(n,t)}function E$(e,t,n,i){let o=e.x,r=t.x,s=e.y,a=t.y<s?t.y+O.TWO_PI:t.y,l=e.z,u=t.z,f=a-s,h=s+f*.5,p=Ybt,g=0;p[g++]=s,p[g++]=a,p[g++]=h,f>O.PI&&(p[g++]=h-O.PI_OVER_TWO,p[g++]=h+O.PI_OVER_TWO);let m=Number.POSITIVE_INFINITY,y=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,x=Number.NEGATIVE_INFINITY;for(let k=0;k<g;++k){let z=p[k]-h,V=Math.cos(z),j=Math.sin(z),U=V*o,q=j*o,Y=V*r,te=j*r;m=Math.min(m,U,Y),y=Math.min(y,q,te),b=Math.max(b,U,Y),x=Math.max(x,q,te)}let A=b-m,C=x-y,S=u-l,v=(m+b)*.5,P=(y+x)*.5,M=(l+u)*.5,R=d.fromElements(v,P,M,Xbt),L=J.fromRotationZ(h,Kbt),F=d.fromElements(A,C,S,qAe),_=B.fromScale(F,Qbt),w=B.fromRotation(L,Zbt),D=B.fromTranslation(R,$bt),I=B.multiplyTransformation(w,B.multiplyTransformation(D,_,A$),A$),N=B.multiplyTransformation(n,I,A$);return nxt(N)?Dn.fromTransformation(N,i):ixt(N,i)}var yA=vg;function Dg(){this.orientedBoundingBox=new Dn,this.boundingSphere=new le,this.boundTransform=new B,this.shapeTransform=new B,this._rectangle=new ce,this._minimumHeight=Dg.DefaultMinBounds.z,this._maximumHeight=Dg.DefaultMaxBounds.z,this._ellipsoid=new ie,this._translation=new d,this._rotation=new J,this.shaderUniforms={ellipsoidRadiiUv:new d,eccentricitySquared:0,evoluteScale:new H,ellipsoidInverseRadiiSquaredUv:new d,ellipsoidRenderLongitudeMinMax:new H,ellipsoidShapeUvLongitudeMinMaxMid:new d,ellipsoidUvToShapeUvLongitude:new H,ellipsoidUvToShapeUvLatitude:new H,ellipsoidRenderLatitudeSinMinMax:new H,ellipsoidInverseHeightDifferenceUv:0,clipMinMaxHeight:new H},this.shaderDefines={ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LONGITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN:void 0},this.shaderMaximumIntersectionsLength=0}var oxt=new d,rxt=new d,sxt=new d,axt=new d,cxt=new d,lxt=new d,uxt=new d,fxt=new d,dxt=new J,XAe=new d,KAe=new d,hxt=new ce;Dg.prototype.update=function(e,t,n,i,o){let{DefaultMinBounds:r,DefaultMaxBounds:s}=Dg;i=i??r,o=o??s,T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n);let a=O.EPSILON10,l=O.EPSILON3,u=O.EPSILON10,f=O.EPSILON10,h=O.EPSILON3,p=B.getScale(e,fxt),g=d.clone(r,oxt);g.z=-d.minimumComponent(p);let m=d.clamp(t,g,s,rxt),y=d.clamp(n,g,s,sxt),b=d.clamp(i,g,s,axt),x=d.clamp(o,g,s,cxt),A=d.maximumByComponent(m,b,lxt),C=d.minimumByComponent(y,x,uxt),S=d.add(p,d.fromElements(y.z,y.z,y.z,XAe),XAe),v=d.maximumComponent(S),P=d.add(p,d.fromElements(C.z,C.z,C.z,KAe),KAe);if(A.y>C.y||A.y===s.y||C.y===r.y||A.z>C.z||O.equalsEpsilon(P,d.ZERO,void 0,a))return!1;this._rectangle=ce.fromRadians(m.x,m.y,y.x,y.y),this._translation=B.getTranslation(e,this._translation),this._rotation=B.getRotation(e,this._rotation),this._ellipsoid=ie.fromCartesian3(p,this._ellipsoid),this._minimumHeight=m.z,this._maximumHeight=y.z;let M=ce.fromRadians(A.x,A.y,C.x,C.y,hxt);this.orientedBoundingBox=S$(M,A.z,C.z,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=B.fromRotationTranslation(J.setScale(this._rotation,S,dxt),this._translation,this.shapeTransform),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=le.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let R=s.x-r.x,L=.5*R,F=C.x<A.x,_=C.x-A.x+F*R,w=_<=u,D=_>=L-u&&_<R-u,I=_>u&&_<L-u,N=w||D||I,k=y.x<m.x,z=y.x-m.x+k*R,V=z>L+u&&z<R-u,j=z>=L-u&&z<=L+u,U=z<L-u,q=V||j||U,Y=C.y<-h,te=C.y>=-h&&C.y<=+h,K=C.y>+h&&C.y<s.y-f,Z=Y||te||K,ee=A.y>r.y+f&&A.y<-h,me=A.y>=-h&&A.y<=+h,Te=A.y>+h,ue=ee||me||Te,ye=Z||ue,Ae=y.y-m.y,Pe=y.y<-h,Ee=y.y>=-h&&y.y<=+h,ze=y.y>+h&&y.y<s.y-f,qe=Pe||Ee||ze,it=m.y>r.y+f&&m.y<-h,Dt=m.y>=-h&&m.y<=+h,jt=m.y>+h,un=qe||(it||Dt||jt),{shaderUniforms:zt,shaderDefines:Ct}=this;for(let mt in Ct)Ct.hasOwnProperty(mt)&&(Ct[mt]=void 0);zt.ellipsoidRadiiUv=d.divideByScalar(S,v,zt.ellipsoidRadiiUv);let{x:Ei,z:an}=zt.ellipsoidRadiiUv,_e=an/Ei;zt.eccentricitySquared=1-_e*_e,zt.evoluteScale=H.fromElements((Ei*Ei-an*an)/Ei,(an*an-Ei*Ei)/an,zt.evoluteScale),zt.ellipsoidInverseRadiiSquaredUv=d.divideComponents(d.ONE,d.multiplyComponents(zt.ellipsoidRadiiUv,zt.ellipsoidRadiiUv,zt.ellipsoidInverseRadiiSquaredUv),zt.ellipsoidInverseRadiiSquaredUv);let Ce=0;Ct.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=Ce,Ce+=1,Ct.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=Ce,Ce+=1,zt.clipMinMaxHeight=H.fromElements((A.z-y.z)/v,(C.z-y.z)/v,zt.clipMinMaxHeight);let pn=(y.z-m.z)/v;if(zt.ellipsoidInverseHeightDifferenceUv=1/pn,m.z===y.z&&(zt.ellipsoidInverseHeightDifferenceUv=0),N&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,Ct.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=Ce,D?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,Ce+=1):I?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,Ce+=2):w&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,Ce+=2),zt.ellipsoidRenderLongitudeMinMax=H.fromElements(A.x,C.x,zt.ellipsoidRenderLongitudeMinMax)),q)if(Ct.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,y.x<m.x&&(Ct.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0),z<=u)zt.ellipsoidUvToShapeUvLongitude=H.fromElements(0,1,zt.ellipsoidUvToShapeUvLongitude);else{let so=R/z,Ro=-(m.x-r.x)/z;zt.ellipsoidUvToShapeUvLongitude=H.fromElements(so,Ro,zt.ellipsoidUvToShapeUvLongitude)}if(N){let mt=O.equalsEpsilon(A.x,r.x,void 0,l),so=O.equalsEpsilon(C.x,s.x,void 0,l);mt&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),so&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);let Ro=(m.x-r.x)/R,aa=(y.x-r.x)/R,Nr=(C.x-r.x)/R,Cs=1-_/R,Ne=(Nr+.5*Cs)%1;zt.ellipsoidShapeUvLongitudeMinMaxMid=d.fromElements(Ro,aa,Ne,zt.ellipsoidShapeUvLongitudeMinMaxMid)}if(ye&&(ue&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,Ct.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=Ce,ee?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,Ce+=1):me?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,Ce+=1):Te&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,Ce+=2)),Z&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,Ct.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=Ce,Y?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,Ce+=2):te?(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,Ce+=1):K&&(Ct.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,Ce+=1)),zt.ellipsoidRenderLatitudeSinMinMax=H.fromElements(Math.sin(A.y),Math.sin(C.y),zt.ellipsoidRenderLatitudeSinMinMax)),un)if(Ct.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,Ae<f)zt.ellipsoidUvToShapeUvLatitude=H.fromElements(0,1,zt.ellipsoidUvToShapeUvLatitude);else{let so=(s.y-r.y)/Ae,Ro=(r.y-m.y)/Ae;zt.ellipsoidUvToShapeUvLatitude=H.fromElements(so,Ro,zt.ellipsoidUvToShapeUvLatitude)}return this.shaderMaximumIntersectionsLength=Ce,!0};var QAe=new ce;Dg.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);let r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,l=n*r,u=(n+1)*r,f=i*r,h=(i+1)*r,p=ce.subsection(this._rectangle,s,l,a,u,QAe),g=O.lerp(this._minimumHeight,this._maximumHeight,f),m=O.lerp(this._minimumHeight,this._maximumHeight,h);return S$(p,g,m,this._ellipsoid,this._translation,this._rotation,o)};var $Ae=new d,ZAe=new d,mxt=new d;Dg.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){T.typeOf.object("spatialNode",e),T.typeOf.object("tileDimensions",t),T.typeOf.object("tileUv",n),T.typeOf.object("result",i);let o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,$Ae),s=d.multiplyByScalar(r,o,$Ae),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,ZAe),o,ZAe),l=d.add(a,s,mxt),u=ce.subsection(this._rectangle,a.x,a.y,l.x,l.y,QAe),f=O.lerp(this._minimumHeight,this._maximumHeight,a.z),h=O.lerp(this._minimumHeight,this._maximumHeight,l.z);return S$(u,f,h,this._ellipsoid,this._translation,this._rotation,i)};function S$(e,t,n,i,o,r,s){return s=Dn.fromRectangle(e,t,n,i,s),s.center=d.add(s.center,o,s.center),s.halfAxes=J.multiply(s.halfAxes,r,s.halfAxes),s}Dg.DefaultMinBounds=Object.freeze(new d(-O.PI,-O.PI_OVER_TWO,-ie.WGS84.minimumRadius));Dg.DefaultMaxBounds=Object.freeze(new d(O.PI,O.PI_OVER_TWO,10*ie.WGS84.maximumRadius));var bA=Dg;var af={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};af.getMinBounds=function(e){switch(e){case af.BOX:return gA.DefaultMinBounds;case af.ELLIPSOID:return bA.DefaultMinBounds;case af.CYLINDER:return yA.DefaultMinBounds;default:throw new E(`Invalid shape type ${e}`)}};af.getMaxBounds=function(e){switch(e){case af.BOX:return gA.DefaultMaxBounds;case af.ELLIPSOID:return bA.DefaultMaxBounds;case af.CYLINDER:return yA.DefaultMaxBounds;default:throw new E(`Invalid shape type ${e}`)}};af.getShapeConstructor=function(e){switch(e){case af.BOX:return gA;case af.ELLIPSOID:return bA;case af.CYLINDER:return yA;default:throw new E(`Invalid shape type ${e}`)}};var va=Object.freeze(af);function Yh(e){T.typeOf.object("options",e),T.defined("options.comparator",e.comparator),c(e.maximumLength)&&T.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=c(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(Yh.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(c(e)){for(T.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});Yh.prototype.clone=function(){let e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new Yh({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};Yh.prototype.reset=function(){this._length=0;let e=this._maximumLength;if(c(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};Yh.prototype.resort=function(){let e=this._length;for(let t=0;t<e;t++)JAe(this,t)};Yh.prototype.insert=function(e){let t,n=this._maximumLength;if(c(n)){if(n===0)return;if(this._length===n){let o=this._array[0];if(this._comparator(e,o)<=0)return e;t=this.removeMinimum()}}let i=this._length;return this._array[i]=e,this._length++,JAe(this,i),t};Yh.prototype.removeMinimum=function(){let e=this._length;if(e===0)return;this._length--;let t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],eCe(this,0)),this._array[e-1]=void 0,t};Yh.prototype.removeMaximum=function(){let e=this._length;if(e===0)return;this._length--;let t;if(e<=2)t=this._array[e-1];else{let n=w$(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&eCe(this,n)}return this._array[e-1]=void 0,t};Yh.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};Yh.prototype.getMaximum=function(){let e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[w$(this,1,2)?1:2]};function vG(e,t,n){let i=e._array,o=i[t];i[t]=i[n],i[n]=o}function D3(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function w$(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function JAe(e,t){if(t===0)return;let n=Math.floor(O.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=D3(e,t,i);for(o!==n&&(vG(e,t,i),t=i);t>=3;){let r=Math.floor((t-3)/4);if(D3(e,t,r)!==o)break;vG(e,t,r),t=r}}function eCe(e,t){let n=e._length,i=Math.floor(O.log2(t+1))%2===0,o;for(;(o=2*t+1)<n;){let r=o,s=o+1;if(s<n){D3(e,s,r)===i&&(r=s);let a=2*o+1,l=Math.max(Math.min(n-a,4),0);for(let u=0;u<l;u++){let f=a+u;D3(e,f,r)===i&&(r=f)}}if(D3(e,r,t)===i&&(vG(e,r,t),r!==o&&r!==s)){let a=Math.floor((r-1)/2);w$(e,r,a)===i&&vG(e,r,a)}t=r}}var xA=Yh;var v$=Object.freeze({UNLOADED:0,RECEIVING:1,PROCESSING:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function P3(e,t){this.spatialNode=e,this.keyframe=t,this.state=v$.UNLOADED,this.content=void 0,this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}P3.prototype.unload=function(){this.content=this.content&&this.content.destroy(),this.spatialNode=void 0,this.state=v$.UNLOADED,this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1};P3.priorityComparator=function(e,t){return e.priority-t.priority};P3.searchComparator=function(e,t){return e.keyframe-t.keyframe};P3.LoadState=v$;var go=P3;function k0(e,t,n,i,o){if(o=Math.min(o??128*1024*1024,536870912),i===Nt.UNSIGNED_SHORT&&(i=Nt.FLOAT32),i===Nt.FLOAT32&&!e.floatingPointTexture)throw new ae("Floating point texture not supported");let s=pxt(i),a=_xt(n,e.webgl2),l=Nt.getSizeInBytes(i),u=gxt(o,n,l),f=Math.ceil(Math.sqrt(t.x)),h=Math.ceil(t.z/f),p=f*t.x,g=h*t.y,m=Math.floor(u/p),y=Math.floor(u/g);if(m===0||y===0)throw new ae("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.textureMemoryByteLength=l*n*u**2,this.voxelCountPerTile=d.clone(t,new d),this.maximumTileCount=m*y,this.regionCountPerMegatexture=new H(m,y),this.voxelCountPerRegion=new H(p,g),this.sliceCountPerRegion=new H(f,h),this.voxelSizeUv=new H(1/u,1/u),this.sliceSizeUv=new H(t.x/u,t.y/u),this.regionSizeUv=new H(p/u,g/u),this.texture=new Rt({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:u,height:u,sampler:new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR,magnificationFilter:li.LINEAR})});let b=Nt.toComponentDatatype(i);this.tileVoxelDataTemp=$.createTypedArray(b,p*g*n),this.nodes=new Array(this.maximumTileCount);for(let x=0;x<this.maximumTileCount;x++)this.nodes[x]=new yxt(x);for(let x=0;x<this.maximumTileCount;x++){let A=this.nodes[x];A.previousNode=x>0?this.nodes[x-1]:void 0,A.nextNode=x<this.maximumTileCount-1?this.nodes[x+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function pxt(e){if(e===Nt.FLOAT32||e===Nt.FLOAT64)return Ue.FLOAT;if(e===Nt.UINT8)return Ue.UNSIGNED_BYTE}function _xt(e,t){if(e===1)return t?ke.RED:ke.LUMINANCE;if(e===2)return t?ke.RG:ke.LUMINANCE_ALPHA;if(e===3)return ke.RGB;if(e===4)return ke.RGBA}function gxt(e,t,n){let i=Math.floor(e/(t*n));return Math.min(ut.maximumTextureSize,O.previousPowerOfTwo(Math.floor(Math.sqrt(i))))}function yxt(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}k0.prototype.add=function(e){if(this.isFull())throw new E("Trying to add when there are no empty spots");let t=this.emptyList;this.emptyList=this.emptyList.nextNode,c(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,c(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;let n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};k0.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new E("Megatexture index out of bounds");let t=this.nodes[e];c(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),c(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,c(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};k0.prototype.isFull=function(){return this.emptyList===void 0};k0.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===Nt.UNSIGNED_SHORT&&(i=Nt.FLOAT32);let o=Nt.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.x)),a=Math.ceil(t.z/s),l=s*t.x,u=a*t.y,f=O.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){let p=Math.floor(f/l),g=Math.floor(f/u);if(p*g>=e)break;f*=2}return f*f*n*o};k0.prototype.writeDataToTexture=function(e,t){let n=t.constructor===Uint16Array?new Float32Array(t):t,{tileVoxelDataTemp:i,voxelCountPerTile:o,sliceCountPerRegion:r,voxelCountPerRegion:s,channelCount:a,regionCountPerMegatexture:l}=this;for(let g=0;g<o.z;g++){let m=g%r.x*o.x,y=Math.floor(g/r.x)*o.y;for(let b=0;b<o.y;b++){let x=bxt(o,b,g),A=(y+b)*s.x+m;for(let C=0;C<o.x;C++){let S=x+C,v=A+C;for(let P=0;P<a;P++)i[v*a+P]=n[S*a+P]}}}let u=e%l.x*s.x,f=Math.floor(e/l.x)*s.y,p={source:{arrayBufferView:i,width:s.x,height:s.y},xOffset:u,yOffset:f};this.texture.copyFrom(p)};function bxt(e,t,n){let i=e.y*e.x,o=n,r=t;return o*i+r*e.x}k0.prototype.isDestroyed=function(){return!1};k0.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),de(this)};var Lw=k0;function Ad(e,t,n,i,o,r,s){this.children=void 0,this.parent=o,this.level=e,this.x=t,this.y=n,this.z=i,this.dimensions=d.clone(s),this.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new Dn,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r)}var xxt=new d;Ad.prototype.computeBoundingVolumes=function(e){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);let t=J.getScale(this.orientedBoundingBox.halfAxes,xxt),n=2*d.maximumComponent(t);this.approximateVoxelSize=n/d.minimumComponent(this.dimensions)};Ad.prototype.constructChildNodes=function(e){let{level:t,x:n,y:i,z:o}=this,r=n*2,s=i*2,a=o*2,l=s+1,u=r+1,f=a+1,h=t+1,p=[[h,r,s,a],[h,u,s,a],[h,r,l,a],[h,u,l,a],[h,r,s,f],[h,u,s,f],[h,r,l,f],[h,u,l,f]];this.children=p.map(([g,m,y,b])=>new Ad(g,m,y,b,this,e,this.dimensions))};Ad.prototype.visibility=function(e,t){let n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};Ad.prototype.computeScreenSpaceError=function(e,t){let n=this.orientedBoundingBox,i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,O.EPSILON7);let o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};var tCe={keyframe:0};function I3(e,t){return tCe.keyframe=e,Lo(t,tCe,go.searchComparator)}Ad.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this,n=t.level,i=Math.floor(e),o=Math.ceil(e),r,s,a=+Number.MAX_VALUE,l=+Number.MAX_VALUE;for(;c(t);){let{renderableKeyframeNodes:h}=t;if(h.length>=1){let p=Txt(i,h),g=h[p],m=o===i||i<g.keyframe?p:Math.min(p+1,h.length-1),y=h[m],b=i-g.keyframe,x=nCe(n-t.level,b);x<a&&(a=x,r=g);let A=y.keyframe-o,C=nCe(n-t.level,A);if(C<l&&(l=C,s=y),b===0&&A===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,!c(r)||!c(s))return;let u=r.keyframe,f=s.keyframe;this.renderableKeyframeNodeLerp=u===f?0:O.clamp((e-u)/(f-u),0,1)};function Txt(e,t){let n=I3(e,t);return n<0?O.clamp(~n-1,0,t.length-1):n}function nCe(e,t){let n=Math.exp(e*4),i=t>=0?1:-200;return e*n+t*i}Ad.prototype.isVisited=function(e){return this.visitedFrameNumber===e};Ad.prototype.createKeyframeNode=function(e){let t=I3(e,this.keyframeNodes);if(t<0){t=~t;let n=new go(this,e);this.keyframeNodes.splice(t,0,n)}};Ad.prototype.destroyKeyframeNode=function(e,t){let n=e.keyframe,i=I3(n,this.keyframeNodes);if(i<0)throw new E("Keyframe node does not exist.");if(this.keyframeNodes.splice(i,1),e.megatextureIndex!==-1){for(let r=0;r<t.length;r++)t[r].remove(e.megatextureIndex);let o=I3(n,this.renderableKeyframeNodes);if(o<0)throw new E("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.unload()};Ad.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.megatextureIndex!==-1||e.content.metadata.length!==t.length)throw new E("Keyframe node cannot be added to megatexture");let{metadata:n}=e.content;for(let r=0;r<t.length;r++){let s=t[r];e.megatextureIndex=s.add(n[r])}let i=this.renderableKeyframeNodes,o=I3(e.keyframe,i);if(o>=0)throw new E("Keyframe already renderable");o=~o,i.splice(o,0,e)};Ad.prototype.isRenderable=function(e){let t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return c(t)&&c(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};var O3=Ad;function U0(e,t,n,i){let{provider:o,dimensions:r,paddingBefore:s,paddingAfter:a}=e,{types:l,componentTypes:u,metadataOrder:f}=o,h=d.add(r,s,new d);if(d.add(h,a,h),f===Td.Y_UP){let C=h.y;h.y=h.z,h.z=C}!c(i)&&c(o.maximumTileCount)&&(i=Lxt(o.maximumTileCount,h,l,u)),this._primitive=e,this.textureMemoryByteLength=0,this.megatextures=new Array(l.length);for(let C=0;C<l.length;C++){let S=l[C],v=at.getComponentCount(S),P=u[C];this.megatextures[C]=new Lw(t,h,v,P,i),this.textureMemoryByteLength+=this.megatextures[C].textureMemoryByteLength}let p=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._calculateStatistics=this._primitive._calculateStatistics??!1,this._frameNumber=0;let g=e._shape;this.rootNode=new O3(0,0,0,0,void 0,g,r),this._priorityQueue=new xA({maximumLength:p,comparator:go.priorityComparator}),this._highPriorityKeyframeNodes=new Array(p),this._highPriorityKeyframeNodeCount=0,this._keyframeNodesInMegatexture=new Array(p),this._keyframeCount=n,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(n),this._initialTilesLoaded=!1;let m=this._binaryTreeKeyframeWeighting;m[0]=0,m[n-1]=0,D$(m,1,n-2,0);let y=9,b=2048,x=Math.floor(b/y),A=Math.ceil(p/x);this.internalNodeTexture=new Rt({context:t,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,flipY:!1,width:b,height:A,sampler:new Qt({minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST})}),this.internalNodeTilesPerRow=x,this.internalNodeTexelSizeUv=new H(1/b,1/A),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new H}U0.prototype.findKeyframeNode=function(e){return this._keyframeNodesInMegatexture.find(function(t){return t.megatextureIndex===e})};function D$(e,t,n,i){if(t>n)return;let o=Math.floor((t+n)/2);e[o]=i,D$(e,t,o-1,i+1),D$(e,o+1,n,i+1)}U0.simultaneousRequestCountMaximum=50;U0.prototype.update=function(e,t,n,i){let o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,l=o._levelBlendFactor,u=l>0,f=a>1,h=(u?2:1)*(f?2:1);this._sampleCount=h;let p=h>=2;if(p&&!c(this.leafNodeTexture)){let C=Math.floor(512),S=Math.ceil(s/C);this.leafNodeTexture=new Rt({context:r,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,flipY:!1,width:1024,height:S,sampler:new Qt({minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST})}),this.leafNodeTexelSizeUv=H.fromElements(1/1024,1/S,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=C}else!p&&c(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=O.clamp(t,0,a-1),n&&iCe(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;let g=Ti();Ext(this,e),Sxt(this,e);let m=Ti();Ixt(this,h,l);let y=Ti(),b=o.loadProgress.numberOfListeners>0||o.allTilesLoaded.numberOfListeners>0||o.initialTilesLoaded.numberOfListeners>0;if(this._debugPrint||this._calculateStatistics||b){let x=m-g,A=y-m,C=y-g;Pxt(this,e,x,A,C)}};U0.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};U0.prototype.isDestroyed=function(){return!1};U0.prototype.destroy=function(){let e=this.megatextures,t=e.length;for(let n=0;n<t;n++)e[n]=e[n]&&e[n].destroy();return this.textureMemoryByteLength=0,this.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),de(this)};function iCe(e,t){if(t.computeBoundingVolumes(e._primitive._shape),c(t.children))for(let n=0;n<8;n++){let i=t.children[n];iCe(e,i)}}function Axt(e,t){if(e._simultaneousRequestCount>=U0.simultaneousRequestCountMaximum)return;let i=e._primitive.provider,{keyframe:o,spatialNode:r}=t;if(c(i.availableLevels)&&r.level>=i.availableLevels)return;function s(f){e._simultaneousRequestCount--,t.content=f,t.state=c(f)?go.LoadState.PROCESSING:go.LoadState.UNAVAILABLE}function a(f){e._simultaneousRequestCount--,t.state=go.LoadState.FAILED,e._primitive.tileFailed.raiseEvent()}let l={tileLevel:r.level,tileX:r.x,tileY:r.y,tileZ:r.z,keyframe:o},u=i.requestData(l);c(u)&&(e._simultaneousRequestCount++,t.state=go.LoadState.RECEIVING,u.then(s).catch(a))}function Cxt(e){return e/(1+e)}function Ext(e,t){let n=e._frameNumber,i=e._priorityQueue;i.reset(),oCe(e.rootNode,_s.MASK_INDETERMINATE,e,t);let o=e._highPriorityKeyframeNodes,r=0,s;for(;i.length>0;)s=i.removeMaximum(),s.highPriorityFrameNumber=n,o[r]=s,r++;e._highPriorityKeyframeNodeCount=r}function Sxt(e,t){let n=e.megatextures[0],i=n.occupiedCount,o=e._keyframeNodesInMegatexture;o.length=i,o.sort(wxt);let r=e._highPriorityKeyframeNodes,s=e._highPriorityKeyframeNodeCount,a=0,l=0;for(let u=0;u<s;u++){let f=r[u];if(!(f.state===go.LoadState.LOADED||f.spatialNode===void 0)&&(f.state===go.LoadState.UNLOADED&&Axt(e,f),f.state===go.LoadState.PROCESSING)){let{content:h}=f;if(h.update(e._primitive,t),!h.ready)continue;if(!vxt(h.metadata,e)){f.content=void 0,f.state=go.LoadState.FAILED,e._primitive.tileFailed.raiseEvent();continue}let p=0;if(n.isFull()){p=i-1-a,a++;let g=o[p];e._primitive.tileUnload.raiseEvent(),g.spatialNode.destroyKeyframeNode(g,e.megatextures)}else p=i+l,l++;f.spatialNode.addKeyframeNodeToMegatextures(f,e.megatextures),f.state=go.LoadState.LOADED,o[p]=f,e._primitive.tileLoad.raiseEvent()}}}function wxt(e,t){return e.highPriorityFrameNumber===t.highPriorityFrameNumber?t.priority-e.priority:t.highPriorityFrameNumber-e.highPriorityFrameNumber}function vxt(e,t){let n=t._primitive.provider.types.length;if(!Array.isArray(e)||e.length!==n)return!1;let{megatextures:i}=t;for(let o=0;o<n;o++){let{voxelCountPerTile:r,channelCount:s}=i[o],{x:a,y:l,z:u}=r,f=a*l*u,h=e[o],p=f*s;if(h.length!==p)return!1}return!0}function oCe(e,t,n,i){let{camera:o,context:r,pixelRatio:s,frameNumber:a}=i,{positionWC:l,frustum:u}=o,h=r.drawingBufferHeight/s/u.sseDenominator;if(e.computeScreenSpaceError(l,h),t=e.visibility(i,t),t===_s.MASK_OUTSIDE)return;e.visitedFrameNumber=a;let p=n._primitive,g=p._shape,m=p.screenSpaceError,y=n._priorityQueue,b=n._keyframeCount,x=O.clamp(Math.floor(n._keyframeLocation),0,b-2),A=x+1;if(b===1)e.createKeyframeNode(0);else if(e.keyframeNodes.length!==b)for(let M=0;M<b;M++)e.createKeyframeNode(M);let{screenSpaceError:C,keyframeNodes:S}=e,v=Cxt(C),P=!1;for(let M=0;M<S.length;M++){let R=S[M];R.priority=10*v+Dxt(x,R.keyframe,A,n),R.state!==go.LoadState.UNAVAILABLE&&R.state!==go.LoadState.FAILED&&R.priority!==-Number.MAX_VALUE&&y.insert(R),R.state===go.LoadState.LOADED&&(P=!0)}if(C<m||!P){e.children=void 0;return}c(e.children)||e.constructChildNodes(g);for(let M=0;M<8;M++){let R=e.children[M];oCe(R,t,n,i)}}function Dxt(e,t,n,i){let o=Math.min(Math.abs(t-e),Math.abs(t-n)),r=Math.max(e,i._keyframeCount-n-1,1),s=Math.pow(1-o/r,4),a=Math.exp(-i._binaryTreeKeyframeWeighting[t]);return O.lerp(a,s,.15+.85*s)}function Pxt(e,t,n,i,o){let r=e._keyframeCount,s=e.rootNode,a=Object.keys(go.LoadState).length,l=new Array(a),u=new Array(a),f=0;for(let P=0;P<a;P++){let M=new Array(r).fill(0);l[P]=M,u[P]=0}function h(P){let M=P.keyframeNodes;for(let R=0;R<M.length;R++){let L=M[R],F=L.keyframe,_=L.state;l[_][F]+=1,u[_]+=1,f++}if(c(P.children))for(let R=0;R<8;R++){let L=P.children[R];h(L)}}h(s),e._primitive.statistics.numberOfTilesWithContentReady=u[go.LoadState.LOADED],e._primitive.statistics.visited=f;let p=u[go.LoadState.RECEIVING],g=u[go.LoadState.PROCESSING],m=p!==e._primitive.statistics.numberOfPendingRequests||g!==e._primitive.statistics.numberOfTilesProcessing;if(m&&t.afterRender.push(function(){return e._primitive.loadProgress.raiseEvent(p,g),!0}),e._primitive.statistics.numberOfPendingRequests=p,e._primitive.statistics.numberOfTilesProcessing=g,m&&(p===0&&g===0)&&(t.afterRender.push(function(){return e._primitive.allTilesLoaded.raiseEvent(),!0}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){return e._primitive.initialTilesLoaded.raiseEvent(),!0}))),!e._debugPrint)return;let b=`KEYFRAMES: ${l[go.LoadState.LOADED]}`,x=`UNLOADED: ${u[go.LoadState.UNLOADED]} | RECEIVING: ${u[go.LoadState.RECEIVING]} | PROCESSING: ${u[go.LoadState.PROCESSING]} | LOADED: ${u[go.LoadState.LOADED]} | FAILED: ${u[go.LoadState.FAILED]} | UNAVAILABLE: ${u[go.LoadState.UNAVAILABLE]} | TOTAL: ${f}`,A=Math.round(n*100)/100,C=Math.round(i*100)/100,S=Math.round(o*100)/100,v=`LOAD: ${A} | OCT: ${C} | ALL: ${S}`;console.log(`${b} || ${x} || ${v}`)}var DG={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function Ixt(e,t,n){let i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2,a=0,l=0,u=[],f=[];function h(g,m,y,b,x){let A=!1;if(c(g.children))for(let C=0;C<8;C++){let S=g.children[C];S.computeSurroundingRenderableKeyframeNodes(o),S.isRenderable(r)&&(A=!0)}if(A){u[x]=DG.INTERNAL<<16|m,u[y]=b,a++,b=m,x=b*9+1;for(let C=0;C<8;C++){let S=g.children[C];m=a,y=m*9+0,h(S,m,y,b,x+C)}}else{if(e._primitive.tileVisible.raiseEvent(),s){let C=l*5,S=g.renderableKeyframeNodePrevious,v=g.level-S.spatialNode.level,P=S.spatialNode.parent,M=c(P)?P.renderableKeyframeNodePrevious:S,R=Oxt(g,i,n),L=v,F=1,_=S.megatextureIndex,w=M.megatextureIndex;f[C+0]=R,f[C+1]=L,f[C+2]=F,f[C+3]=_,f[C+4]=w,u[x]=DG.LEAF<<16|l}else{let C=g.renderableKeyframeNodePrevious,v=g.level-C.spatialNode.level===0?DG.LEAF:DG.PACKED_LEAF_FROM_PARENT;u[x]=v<<16|C.megatextureIndex}l++}}let p=e.rootNode;p.computeSurroundingRenderableKeyframeNodes(o),p.isRenderable(r)&&h(p,0,0,0,0),Rxt(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&Mxt(f,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function Oxt(e,t,n){if(e.parent===void 0)return 0;let i=e.screenSpaceError,o=e.parent.screenSpaceError,s=((t-i)/(o-i)+n-1)/n;return O.clamp(s,0,1)}function Rxt(e,t,n,i){let o=ke.componentsLength(i.pixelFormat),r=Math.ceil(e.length/t),s=Math.max(1,t*Math.min(r,n)),a=Math.max(1,Math.ceil(r/n)),l=new Uint8Array(s*a*o);for(let h=0;h<e.length;h++){let p=e[h],g=h*o;for(let m=0;m<o;m++)l[g+m]=p>>>m*8&255}let f={source:{arrayBufferView:l,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(f)}function Mxt(e,t,n,i){let o=ke.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),l=Math.max(1,Math.ceil(s/n)),u=new Uint8Array(a*l*o);for(let p=0;p<s;p++){let g=e[p*r+0],m=e[p*r+1],y=e[p*r+2],b=e[p*r+3],x=e[p*r+4],A=O.clamp(Math.floor(65536*g),0,65535);u[p*8+0]=A>>>0&255,u[p*8+1]=A>>>8&255,u[p*8+2]=m&255,u[p*8+3]=y&255,u[p*8+4]=b>>>0&255,u[p*8+5]=b>>>8&255,u[p*8+6]=x>>>0&255,u[p*8+7]=x>>>8&255}let h={source:{arrayBufferView:u,width:a,height:l},xOffset:0,yOffset:0};i.copyFrom(h)}function Lxt(e,t,n,i){let o=0,r=n.length;for(let s=0;s<r;s++){let a=n[s],l=i[s],u=at.getComponentCount(a);o+=Lw.getApproximateTextureMemoryByteLength(e,t,u,l)}return o}var R3=U0;function pp(e){e=e??W.EMPTY_OBJECT,this._ready=!1,this._provider=e.provider??pp.DefaultProvider,this._traversal=void 0,this._statistics=new gh,this._calculateStatistics=e.calculateStatistics??!1,this._shape=void 0,this._shapeVisible=!1,this._dimensions=new d,this._inputDimensions=new d,this._paddingBefore=new d,this._paddingAfter=new d,this._minBounds=new d,this._minBoundsOld=new d,this._maxBounds=new d,this._maxBoundsOld=new d,this._exaggeratedMinBounds=new d,this._exaggeratedMinBoundsOld=new d,this._exaggeratedMaxBounds=new d,this._exaggeratedMaxBoundsOld=new d,this._minClippingBounds=new d,this._minClippingBoundsOld=new d,this._maxClippingBounds=new d,this._maxClippingBoundsOld=new d,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._exaggeratedModelMatrix=B.clone(this._modelMatrix),this._compoundModelMatrix=new B,this._compoundModelMatrixOld=new B,this._customShader=e.customShader??pp.DefaultCustomShader,this._customShaderCompilationEvent=new pe,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new B,this._transformPositionUvToWorld=new B,this._transformDirectionWorldToLocal=new J,this._transformNormalLocalToWorld=new J,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new dh,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new H,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new H,megatextureTextures:[],megatextureSliceDimensions:new H,megatextureTileDimensions:new H,megatextureVoxelSizeUv:new H,megatextureSliceSizeUv:new H,megatextureTileSizeUv:new H,dimensions:new d,inputDimensions:new d,paddingBefore:new d,paddingAfter:new d,transformPositionViewToUv:new B,transformPositionUvToView:new B,transformDirectionViewToLocal:new J,transformNormalLocalToWorld:new J,cameraPositionUv:new d,ndcSpaceAxisAlignedBoundingBox:new se,clippingPlanesTexture:void 0,clippingPlanesMatrix:new B,stepSize:0,pickColor:new G},this._shapeDefinesOld={},this._uniformMap={};let t=this._uniforms,n=this._uniformMap;for(let o in t)if(t.hasOwnProperty(o)){let r=`u_${o}`;n[r]=function(){return t[o]}}this.tileLoad=new pe,this.tileVisible=new pe,this.tileFailed=new pe,this.tileUnload=new pe,this.loadProgress=new pe,this.allTilesLoaded=new pe,this.initialTilesLoaded=new pe;let i=this._provider;Nxt(this,i)}function Nxt(e,t){let{shape:n,minBounds:i=va.getMinBounds(n),maxBounds:o=va.getMaxBounds(n)}=t;e.minBounds=i,e.maxBounds=o,e.minClippingBounds=i.clone(),e.maxClippingBounds=o.clone(),e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e._exaggeratedModelMatrix=B.clone(e._modelMatrix,e._exaggeratedModelMatrix),sCe(e,t);let r=va.getShapeConstructor(n);e._shape=new r,e._shapeVisible=aCe(e,e._shape,t)}Object.defineProperties(pp.prototype,{ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){T.typeOf.object("modelMatrix",e),this._modelMatrix=B.clone(e,this._modelMatrix)}},shape:{get:function(){return this._provider.shape}},dimensions:{get:function(){return this._dimensions}},inputDimensions:{get:function(){return this._inputDimensions}},paddingBefore:{get:function(){return this._paddingBefore}},paddingAfter:{get:function(){return this._paddingAfter}},minimumValues:{get:function(){return this._provider.minimumValues}},maximumValues:{get:function(){return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){T.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){T.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){T.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){T.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){T.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){T.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=O.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){T.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){T.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){T.defined("minBounds",e),this._minBounds=d.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){T.defined("maxBounds",e),this._maxBounds=d.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){T.defined("minClippingBounds",e),this._minClippingBounds=d.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){T.defined("maxClippingBounds",e),this._maxClippingBounds=d.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){gs.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){let t=this._uniformMap,i=this._customShader.uniformMap;for(let o in i)i.hasOwnProperty(o)&&delete t[o];c(e)?this._customShader=e:this._customShader=pp.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}},statistics:{get:function(){return this._statistics}}});var Fxt=new se,Bxt=new se,kxt=new d,Uxt=new d,Vxt=new J,zxt=new J,Hxt=new B,Gxt=new B,jxt=new B,Wxt=B.fromRotationTranslation(J.fromUniformScale(.5,new J),new d(.5,.5,.5),new B),qxt=B.fromRotationTranslation(J.fromUniformScale(2,new J),new d(-1,-1,-1),new B);pp.prototype.update=function(e){let t=this._provider;this._customShader.update(e);let n=e.context;if(!this._ready){Qxt(this,t,n),e.afterRender.push(()=>(this._ready=!0,!0));return}$xt(this,e);let i=sCe(this,t),o=this._shape;if(i&&(this._shapeVisible=aCe(this,o,t),eTt(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;let r=tTt(t.timeIntervalCollection,this._clock),s=this._traversal,a=s._sampleCount;if(s.update(e,r,i,this._disableUpdate),a!==s._sampleCount&&(this._shaderDirty=!0),!s.isRenderable(s.rootNode)||(this._debugDraw&&lTt(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),nTt(this,e)&&(this._shaderDirty=!0);let u=s.leafNodeTexture,f=this._uniforms;c(u)&&(f.octreeLeafNodeTexture=s.leafNodeTexture,f.octreeLeafNodeTexelSizeUv=H.clone(s.leafNodeTexelSizeUv,f.octreeLeafNodeTexelSizeUv),f.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(E3(this,n),this._shaderDirty=!1);let h=n.uniformState.viewProjection,p=o.orientedBoundingBox,g=rTt(p,h,Bxt);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;f.ndcSpaceAxisAlignedBoundingBox=se.clone(g,f.ndcSpaceAxisAlignedBoundingBox);let y=n.uniformState.inverseView;f.transformPositionViewToUv=B.multiplyTransformation(this._transformPositionWorldToUv,y,f.transformPositionViewToUv);let b=n.uniformState.view;f.transformPositionUvToView=B.multiplyTransformation(b,this._transformPositionUvToWorld,f.transformPositionUvToView);let x=n.uniformState.inverseViewRotation;f.transformDirectionViewToLocal=J.multiply(this._transformDirectionWorldToLocal,x,f.transformDirectionViewToLocal),f.transformNormalLocalToWorld=J.clone(this._transformNormalLocalToWorld,f.transformNormalLocalToWorld);let A=e.camera.positionWC;f.cameraPositionUv=B.multiplyByPoint(this._transformPositionWorldToUv,A,f.cameraPositionUv),f.stepSize=this._stepSizeMultiplier;let C=e.passes.pick?this._drawCommandPick:e.passes.pickVoxel?this._drawCommandPickVoxel:this._drawCommand;C.boundingVolume=o.boundingSphere,e.commandList.push(C)};var Yxt=new d,P$=new d,Xxt=new he,Kxt=new d;function $xt(e,t){if(e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e.shape===va.ELLIPSOID){let n=t.verticalExaggerationRelativeHeight,i=t.verticalExaggeration;e._exaggeratedMinBounds.z=(e._minBounds.z-n)*i+n,e._exaggeratedMaxBounds.z=(e._maxBounds.z-n)*i+n}else{let n=d.fromElements(1,1,t.verticalExaggeration,Yxt);e._exaggeratedModelMatrix=B.multiplyByScale(e._modelMatrix,n,e._exaggeratedModelMatrix),e._exaggeratedModelMatrix=B.multiplyByTranslation(e._exaggeratedModelMatrix,Zxt(e,t),e._exaggeratedModelMatrix)}}function Zxt(e,t){let{shapeTransform:n=B.IDENTITY,globalTransform:i=B.IDENTITY}=e._provider,o=B.getTranslation(n,P$),r=B.multiplyByPoint(e._modelMatrix,o,P$),s=B.multiplyByPoint(i,r,P$),l=ie.WGS84.cartesianToCartographic(s,Xxt),u=0;c(l)&&(u=l.height);let f=Dr.getHeight(u,t.verticalExaggeration,t.verticalExaggerationRelativeHeight);return d.fromElements(0,0,(f-u)/t.verticalExaggeration,Kxt)}function Qxt(e,t,n){let i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=G.clone(e._pickId.color,i.pickColor);let{shaderDefines:o,shaderUniforms:r}=e._shape;e._shapeDefinesOld=je(o,!0);let s=e._uniformMap;for(let l in r)if(r.hasOwnProperty(l)){let u=`u_${l}`;c(s[u])&&dt(`VoxelPrimitive: Uniform name "${u}" is already defined`),s[u]=function(){return r[l]}}if(e._dimensions=d.clone(t.dimensions,e._dimensions),i.dimensions=d.clone(e._dimensions,i.dimensions),e._paddingBefore=d.clone(t.paddingBefore??d.ZERO,e._paddingBefore),i.paddingBefore=d.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=d.clone(t.paddingAfter??d.ZERO,e._paddingAfter),i.paddingAfter=d.clone(e._paddingAfter,i.paddingAfter),e._inputDimensions=d.add(e._dimensions,e._paddingBefore,e._inputDimensions),e._inputDimensions=d.add(e._inputDimensions,e._paddingAfter,e._inputDimensions),t.metadataOrder===Td.Y_UP){let l=e._inputDimensions.y;e._inputDimensions.y=e._inputDimensions.z,e._inputDimensions.z=l}i.inputDimensions=d.clone(e._inputDimensions,i.inputDimensions);let a=t.keyframeCount??1;e._traversal=new R3(e,n,a),e.statistics.texturesByteLength=e._traversal.textureMemoryByteLength,Jxt(e._traversal,i)}function sCe(e,t){let n=t.shapeTransform??B.IDENTITY,i=t.globalTransform??B.IDENTITY;return B.multiplyTransformation(i,e._exaggeratedModelMatrix,e._compoundModelMatrix),B.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),TA(e,"_compoundModelMatrix","_compoundModelMatrixOld")+TA(e,"_minBounds","_minBoundsOld")+TA(e,"_maxBounds","_maxBoundsOld")+TA(e,"_exaggeratedMinBounds","_exaggeratedMinBoundsOld")+TA(e,"_exaggeratedMaxBounds","_exaggeratedMaxBoundsOld")+TA(e,"_minClippingBounds","_minClippingBoundsOld")+TA(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function TA(e,t,n){let i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function aCe(e,t,n){if(!t.update(e._compoundModelMatrix,e._exaggeratedMinBounds,e._exaggeratedMaxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;let o=t.shapeTransform,r=B.inverse(o,Hxt),s=B.getRotation(o,Vxt),a=B.getScale(o,kxt),l=d.maximumComponent(a),u=d.divideByScalar(a,l,Uxt),f=J.multiplyByScale(s,u,zxt);return e._transformPositionWorldToUv=B.multiplyTransformation(Wxt,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=B.multiplyTransformation(o,qxt,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=B.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=J.inverseTranspose(f,e._transformNormalLocalToWorld),!0}function Jxt(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=H.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;let n=e.megatextures,i=n[0],o=n.length;t.megatextureTextures=new Array(o);for(let r=0;r<o;r++)t.megatextureTextures[r]=n[r].texture;t.megatextureSliceDimensions=H.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=H.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=H.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=H.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=H.clone(i.regionSizeUv,t.megatextureTileSizeUv)}function eTt(e,t){let n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=je(n,!0)),i}function tTt(e,t){if(!c(e)||!c(t))return 0;let n=t.currentTime,i,o=e.indexOf(n);o>=0?i=e.get(o):(o=~o,o===e.length?(o=e.length-1,i=e.get(o),n=i.stop):(i=e.get(o),n=i.start));let r=Q.secondsDifference(i.stop,i.start),a=Q.secondsDifference(n,i.start)/r;return o+a}function nTt(e,t){let n=e.clippingPlanes;if(!c(n))return!1;n.update(t);let{clippingPlanesState:i,enabled:o}=n;if(o){let r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=B.transpose(B.multiplyTransformation(B.inverse(n.modelMatrix,r.clippingPlanesMatrix),e._transformPositionUvToWorld,r.clippingPlanesMatrix),r.clippingPlanesMatrix)}return e._clippingPlanesState===i&&e._clippingPlanesEnabled===o?!1:(e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0)}pp.prototype.isDestroyed=function(){return!1};pp.prototype.destroy=function(){let e=this._drawCommand;c(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());let t=this._drawCommandPick;return c(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this.statistics.texturesByteLength=0,this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),de(this)};var rCe=new Array(new se(-1,-1,-1,1),new se(1,-1,-1,1),new se(-1,1,-1,1),new se(1,1,-1,1),new se(-1,-1,1,1),new se(1,-1,1,1),new se(-1,1,1,1),new se(1,1,1,1)),iTt=new Array(1,2,4,0,3,5,0,3,6,1,2,7,0,5,6,1,4,7,2,4,7,3,5,6),oTt=new Array(new se,new se,new se,new se,new se,new se,new se,new se);function rTt(e,t,n){let i=B.fromRotationTranslation(e.halfAxes,e.center,Gxt),o=B.multiply(t,i,jxt),r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,l=-Number.MAX_VALUE,u,f=oTt,h=rCe.length;for(u=0;u<h;u++)B.multiplyByVector(o,rCe[u],f[u]);for(u=0;u<h;u++){let p=f[u];if(p.z>=-p.w){let g=p.x/p.w,m=p.y/p.w;r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,m),l=Math.max(l,m)}else for(let g=0;g<3;g++){let m=iTt[u*3+g],y=f[m];if(y.z>=-y.w){let b=p.z+p.w,x=y.z+y.w,A=b/(b-x),C=se.lerp(p,y,A,Fxt),S=C.x/C.w,v=C.y/C.w;r=Math.min(r,S),s=Math.max(s,S),a=Math.min(a,v),l=Math.max(l,v)}}}return r=O.clamp(r,-1,1),a=O.clamp(a,-1,1),s=O.clamp(s,-1,1),l=O.clamp(l,-1,1),n=se.fromElements(r,a,s,l,n),n}var I$=3e7,sTt=new d(I$,0,0),aTt=new d(0,I$,0),cTt=new d(0,0,I$);function lTt(e,t){let n=e._traversal,i=e._debugPolylines;i.removeAll();function o(l,u,f,h){i.add({positions:[l,u],width:h,material:Xi.fromType("Color",{color:f})})}function r(l,u,f){let h=l.computeCorners();o(h[0],h[1],u,f),o(h[2],h[3],u,f),o(h[4],h[5],u,f),o(h[6],h[7],u,f),o(h[0],h[2],u,f),o(h[4],h[6],u,f),o(h[1],h[3],u,f),o(h[5],h[7],u,f),o(h[0],h[4],u,f),o(h[2],h[6],u,f),o(h[1],h[5],u,f),o(h[3],h[7],u,f)}function s(l){if(!n.isRenderable(l))return;let u=l.level,h=Math.max(1,5/Math.pow(2,u)),g=[G.RED,G.LIME,G.BLUE][u%3];if(r(l.orientedBoundingBox,g,h),c(l.children))for(let m=0;m<8;m++)s(l.children[m])}r(e._shape.orientedBoundingBox,G.WHITE,5),s(n.rootNode);let a=10;o(d.ZERO,sTt,G.RED,a),o(d.ZERO,aTt,G.LIME,a),o(d.ZERO,cTt,G.BLUE,a),i.update(t)}pp.DefaultCustomShader=new pA({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
    material.diffuse = vec3(1.0);
    material.alpha = 1.0;
}`});function cCe(){this.ready=!0,this.shape=va.BOX,this.dimensions=new d(1,1,1),this.names=["data"],this.types=[at.SCALAR],this.componentTypes=[Nt.FLOAT32],this.maximumTileCount=1}cCe.prototype.requestData=function(e){if((c(e)?e.tileLevel??0:0)>=1)return;let n=new _A({metadata:[new Float32Array(1)]});return Promise.resolve(n)};pp.DefaultProvider=new cCe;var V0=pp;function uTt(e,t,n,i){if(!c(e)||c(t)&&e.id!==t)return;let r=(e.classes||{})[n];if(!c(r))return;let a=(r.properties||{})[i];if(c(a))return a}var M3=uTt;function fTt(e,t,n,i,o){this.schemaId=e,this.className=t,this.propertyName=n,this.classProperty=i,this.metadataProperty=o}var L3=fTt;function dTt(e,t,n){if(!c(e))return;let i=e.propertyTextures;for(let o of i)if(o.class.id===t){let a=o.properties[n];if(c(a))return a}}var N3=dTt;var IG=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function ci(e){e=e??W.EMPTY_OBJECT;let t=e.canvas,n=e.creditContainer,i=e.creditViewport,o=je(e.contextOptions);if(!c(t))throw new E("options and options.canvas are required.");let r=c(n),s=new AI(t,o);r||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),c(i)||(i=t.parentNode),this._id=jn(),this._jobScheduler=new dB,this._frameState=new uB(s,new tB(n,"\u2022",i),this._jobScheduler),this._frameState.scene3DOnly=e.scene3DOnly??!1,this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new Pv(s),this._ellipsoid=e.ellipsoid??ie.default,this._globe=void 0,this._globeTranslucencyState=new fB,this._primitives=new fl,this._groundPrimitives=new fl,this._globeHeight=void 0,this._globeHeightDirty=!0,this._cameraUnderground=!1,this._removeUpdateHeightCallback=void 0,this._logDepthBuffer=ci.defaultLogDepthBuffer&&s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new lA,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=e.orderIndependentTranslucency??!0,this._executeOITFunction=void 0,this._depthPlane=new aB(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new ei({color:new G,stencil:0,owner:this}),this._depthClearCommand=new ei({depth:1,owner:this}),this._stencilClearCommand=new ei({stencil:0}),this._classificationStencilClearCommand=new ei({stencil:0,renderState:Ve.fromCache({stencilMask:kt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new ZB(this),this._preUpdate=new pe,this._postUpdate=new pe,this._renderError=new pe,this._preRender=new pe,this._postRender=new pe,this._minimumDisableDepthTestDistance=0,this._debugInspector=new s3,this._msaaSamples=e.msaaSamples??4,this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new pe,this.morphComplete=new pe,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=G.clone(G.BLACK),this._mode=oe.SCENE3D,this._mapProjection=c(e.mapProjection)?e.mapProjection:new Oi(this._ellipsoid),this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.atmosphere=new Ex,this.fog=new lB,this.fog.enabled=ie.WGS84.equals(this._ellipsoid),ie.WGS84.equals(this._ellipsoid)||(ro.DEFAULT_VIEW_RECTANGLE=ce.fromDegrees(-45,-45,45,45)),this._shadowMapCamera=new ro(this),this.shadowMap=new Tg({context:s,lightCamera:this._shadowMapCamera,enabled:e.shadows??!1}),this.invertClassification=!1,this.invertClassificationColor=G.clone(G.WHITE),this._actualInvertClassificationColor=G.clone(this._invertClassificationColor),this._invertClassification=new ww,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new XB,this._brdfLutGenerator=new K2,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new t3(this),this._cameraUnderground=!1,this._mapMode2D=e.mapMode2D??ru.INFINITE_SCROLL,this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=e.requestRenderMode??!1,this._renderRequested=!0,this.maximumRenderTimeChange=e.maximumRenderTimeChange??0,this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=sc.requestCompletedEvent.addEventListener(IG(this)),this._removeTaskProcessorListenerCallback=yi.taskCompletedEvent.addEventListener(IG(this)),this._removeGlobeCallbacks=[],this._removeTerrainProviderReadyListener=void 0;let a=new Ke(0,0,s.drawingBufferWidth,s.drawingBufferHeight),l=new ro(this);this._logDepthBuffer&&(l.frustum.near=.1,l.frustum.far=1e10),this.preloadFlightCamera=new ro(this),this.preloadFlightCullingVolume=void 0,this._picking=new wB(this),this._defaultView=new tA(this,l,a),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentCubeMap=void 0,this.light=new Rp,hCe(this,0,Q.now()),this.updateFrameState(),this.initializeFrame()}ci.defaultLogDepthBuffer=!0;function hTt(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;let n=[];c(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(IG(e))),n.push(t.terrainProviderChanged.addEventListener(IG(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(ci.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return ut.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return ut.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return Yd.isSupported(this._context)}},ellipsoid:{get:function(){return this._ellipsoid}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,hTt(this,e)}},primitives:{get:function(){return this._primitives}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(c(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(c(this.globe))return this.globe.terrainProvider},set:function(e){this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),c(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(c(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==oe.SCENE3D)throw new E("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===oe.SCENE2D)this.morphTo2D(0);else if(e===oe.SCENE3D)this.morphTo3D(0);else if(e===oe.COLUMBUS_VIEW)this.morphToColumbusView(0);else throw new E("value must be a valid SceneMode enumeration.");this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){if(this.camera.frustum instanceof on)throw new E("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new ro(this),c(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new cB(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!c(e)||e<0)throw new E("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){let t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){let e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,ut.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return .9999}},globeHeight:{get:function(){return this._globeHeight}}});ci.prototype.getCompressedTextureFormatSupported=function(e){let t=this.context;return(e==="WEBGL_compressed_texture_s3tc"||e==="s3tc")&&t.s3tc||(e==="WEBGL_compressed_texture_pvrtc"||e==="pvrtc")&&t.pvrtc||(e==="WEBGL_compressed_texture_etc"||e==="etc")&&t.etc||(e==="WEBGL_compressed_texture_etc1"||e==="etc1")&&t.etc1||(e==="WEBGL_compressed_texture_astc"||e==="astc")&&t.astc||(e==="EXT_texture_compression_bptc"||e==="bc7")&&t.bc7};function mTt(e,t){let n=e.pickedMetadataInfo,i=t.pickedMetadataInfo;return n?.schemaId!==i?.schemaId||n?.className!==i?.className||n?.propertyName!==i?.propertyName}function lCe(e,t,n){let i=e._frameState,o=e._context,r=e._view.oit,{lightShadowMaps:s,lightShadowsEnabled:a}=i.shadowState,l=t.derivedCommands;c(t.pickId)&&(l.picking=ap.createPickDerivedCommand(e,t,o,l.picking)),i.pickingMetadata&&t.pickMetadataAllowed&&(t.pickedMetadataInfo=i.pickedMetadataInfo,c(t.pickedMetadataInfo)&&(l.pickingMetadata=ap.createPickMetadataDerivedCommand(e,t,o,l.pickingMetadata))),t.pickOnly||(l.depth=ap.createDepthOnlyDerivedCommand(e,t,o,l.depth)),l.originalCommand=t,e._hdr&&(l.hdr=ap.createHdrCommand(t,o,l.hdr),t=l.hdr.command,l=t.derivedCommands),a&&t.receiveShadows&&(l.shadows=Tg.createReceiveDerivedCommand(s,t,n,o,l.shadows)),t.pass===De.TRANSLUCENT&&c(r)&&r.isSupported()&&(a&&t.receiveShadows?(l.oit=c(l.oit)?l.oit:{},l.oit.shadows=r.createDerivedCommands(l.shadows.receiveCommand,o,l.oit.shadows)):l.oit=r.createDerivedCommands(t,o,l.oit))}ci.prototype.updateDerivedCommands=function(e){let{derivedCommands:t}=e;if(!c(t))return;let n=this._frameState,{shadowState:i,useLogDepth:o}=this._frameState,r=this._context,s=!1,a=i.lastDirtyTime;e.lastDirtyTime!==a&&(e.lastDirtyTime=a,e.dirty=!0,s=!0);let l=this._hdr,u=c(t.logDepth),f=c(t.hdr),h=c(t.originalCommand),p=o&&!u,g=l&&!f,m=(!o||!l)&&!h,y=n.pickingMetadata&&mTt(e,n);if(e.dirty=e.dirty||p||g||m||y,!e.dirty)return;e.dirty=!1;let{shadowsEnabled:b,shadowMaps:x}=i;b&&e.castShadows&&(t.shadows=Tg.createCastDerivedCommand(x,e,s,r,t.shadows)),(u||p)&&(t.logDepth=ap.createLogDepthCommand(e,r,t.logDepth),lCe(this,t.logDepth.command,s)),(h||m)&&lCe(this,e,s)};var pTt=new gd({pass:Uo.RENDER}),O$=new gd({pass:Uo.PRELOAD}),R$=new gd({pass:Uo.PRELOAD_FLIGHT}),_Tt=new gd({pass:Uo.REQUEST_RENDER_MODE_DEFER_CHECK}),uCe=new le,M$;function gTt(e){if(!(e._mode!==oe.SCENE3D||!e.globe?.show||e._cameraUnderground||e._globeTranslucencyState.translucent))return uCe.radius=e.ellipsoid.minimumRadius+e.frameState.minimumTerrainHeight,M$=Y2.fromBoundingSphere(uCe,e.camera.positionWC,M$),M$}ci.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.pickVoxel=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function hCe(e,t,n){let i=e._frameState;i.frameNumber=t,i.time=Q.clone(n,i.time)}ci.prototype.updateFrameState=function(){let e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=gTt(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof on||this.camera.frustum instanceof jo),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState;let{globe:n}=this;c(n)&&n._terrainExaggerationChanged&&(this.verticalExaggeration=n._terrainExaggeration,this.verticalExaggerationRelativeHeight=n._terrainExaggerationRelativeHeight,n._terrainExaggerationChanged=!1),t.verticalExaggeration=this.verticalExaggeration,t.verticalExaggerationRelativeHeight=this.verticalExaggerationRelativeHeight,c(this._specularEnvironmentCubeMap)&&this._specularEnvironmentCubeMap.ready?(t.specularEnvironmentMaps=this._specularEnvironmentCubeMap.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentCubeMap.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=G.clone(this.invertClassificationColor,this._actualInvertClassificationColor),ww.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,c(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0};ci.prototype.isVisible=function(e,t,n){if(!c(t))return!1;let{boundingVolume:i}=t;return!c(i)||!t.cull?!0:e.computeVisibility(i)===Wt.OUTSIDE?!1:!c(n)||!t.occlude||!i.isOccluded(n)};var PG=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);PG=B.inverseTransformation(PG,PG);function yTt(e,t,n,i){let o=t._frameState,r=o.context,s=e.boundingVolume;c(t._debugVolume)&&t._debugVolume.destroy();let a=d.clone(s.center);if(o.mode!==oe.SCENE3D){a=B.multiplyByPoint(PG,a,a);let m=o.mapProjection,y=m.unproject(a);a=m.ellipsoid.cartographicToCartesian(y)}let l,u,{radius:f}=s;c(f)?(l=Js.createGeometry(new Js({radii:new d(f,f,f),vertexFormat:rn.FLAT_VERTEX_FORMAT})),u=B.fromTranslation(a)):(l=La.createGeometry(La.fromDimensions({dimensions:new d(2,2,2),vertexFormat:rn.FLAT_VERTEX_FORMAT})),u=B.fromRotationTranslation(s.halfAxes,a,new B)),t._debugVolume=new Pn({geometryInstances:new St({geometry:Nn.toWireframe(l),modelMatrix:u,attributes:{color:new Gt(1,0,0,1)}}),appearance:new rn({flat:!0,translucent:!1}),asynchronous:!1});let h=o.commandList,p=o.commandList=[];t._debugVolume.update(o),e=p[0],o.useLogDepth&&(e=ap.createLogDepthCommand(e,r).command);let g;c(i)&&(g=n.framebuffer,n.framebuffer=i),e.execute(r,n),c(g)&&(n.framebuffer=g),o.commandList=h}function _p(e,t,n,i){let o=t._frameState,r=t._context;if(c(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof ei){e.execute(r,n);return}e.debugShowBoundingVolume&&c(e.boundingVolume)&&yTt(e,t,n,i),o.useLogDepth&&c(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);let s=o.passes;if(!s.pick&&!s.pickVoxel&&!s.depth&&t._hdr&&c(e.derivedCommands)&&c(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth){if(o.pickingMetadata&&c(e.derivedCommands.pickingMetadata)){e=e.derivedCommands.pickingMetadata.pickMetadataCommand,e.execute(r,n);return}if(!o.pickingMetadata&&c(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(r,n);return}}else if(c(e.derivedCommands.depth)){e=e.derivedCommands.depth.depthOnlyCommand,e.execute(r,n);return}}if(t.debugShowCommands||t.debugShowFrustums){t._debugInspector.executeDebugShowFrustumsCommand(t,e,n);return}o.shadowState.lightShadowsEnabled&&e.receiveShadows&&c(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(r,n):e.execute(r,n)}function fCe(e,t,n){let{derivedCommands:i}=e;if(!c(i))return;let o=t._frameState,r=t._context;o.useLogDepth&&c(i.logDepth)&&(e=i.logDepth.command);let{picking:s,pickingMetadata:a,depth:l}=e.derivedCommands;c(a)&&(e=i.pickingMetadata.pickMetadataCommand,e.execute(r,n)),c(s)?(e=s.pickCommand,e.execute(r,n)):c(l)&&(e=l.depthOnlyCommand,e.execute(r,n))}function mCe(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function bTt(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+O.EPSILON12}function xTt(e,t,n,i,o){gg(i,mCe,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,n);for(let r=0;r<i.length;++r)t(i[r],e,n)}function TTt(e,t,n,i,o){gg(i,bTt,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,n);for(let r=0;r<i.length;++r)t(i[r],e,n)}function ATt(e,t,n){e.context.uniformState.updatePass(De.VOXELS);let i=n.commands[De.VOXELS];i.length=n.indices[De.VOXELS],gg(i,mCe,e.camera.positionWC);for(let o=0;o<i.length;++o)_p(i[o],e,t)}var CTt=new Ci,ETt=new bl,STt=new on,wTt=new jo;function vTt(e){let{frustum:t}=e;return c(t.fov)?t.clone(CTt):c(t.infiniteProjectionMatrix)?t.clone(ETt):c(t.width)?t.clone(STt):t.clone(wTt)}function DTt(e){if(e._environmentState.useOIT){if(!c(e._executeOITFunction)){let{view:t,context:n}=e;e._executeOITFunction=function(i,o,r,s,a){t.globeDepth.prepareColorTextures(n),t.oit.executeCommands(i,o,r,s,a)}}return e._executeOITFunction}return e.frameState.passes.render?xTt:TTt}function PTt(e,t,n){let{frameState:i,context:o}=e,{pick:r,pickVoxel:s}=i.passes,a=r||s,l;!a&&e._environmentState.useInvertClassification&&i.invertClassificationColor.alpha<1&&(l=e._invertClassification);let u=DTt(e);o.uniformState.updatePass(De.TRANSLUCENT);let f=n.commands[De.TRANSLUCENT];f.length=n.indices[De.TRANSLUCENT],u(e,_p,t,f,l)}function ITt(e,t,n){let{translucentTileClassification:i,globeDepth:o}=e._view;if(!(n.indices[De.CESIUM_3D_TILE_CLASSIFICATION]>0)||!i.isSupported())return;let s=n.commands[De.TRANSLUCENT];i.executeTranslucentCommands(e,_p,t,s,o.depthStencilTexture),i.executeClassificationCommands(e,_p,t,n)}function N$(e,t){let{camera:n,context:i,frameState:o}=e,{uniformState:r}=i;r.updateCamera(n);let s=vTt(n);s.near=n.frustum.near,s.far=n.frustum.far;let a=o.passes,l=a.pick||a.pickVoxel;l||OTt(e,t);let{clearGlobeDepth:u,renderTranslucentDepthForPick:f,useDepthPlane:h,useGlobeDepthFramebuffer:p,useInvertClassification:g,usePostProcessSelected:m}=e._environmentState,{globeDepth:y,globeTranslucencyFramebuffer:b,sceneFramebuffer:x,frustumCommandsList:A}=e._view,C=A.length,S=e._globeTranslucencyState,v=e._depthClearCommand,P=e._stencilClearCommand,M=e._classificationStencilClearCommand,R=e._depthPlane,L=n.position.z;function F(w,D){r.updatePass(D);let I=w.commands[D],N=w.indices[D];for(let k=0;k<N;++k)_p(I[k],e,t);return N}function _(w,D){r.updatePass(D);let I=w.commands[D],N=w.indices[D];for(let k=0;k<N;++k)fCe(I[k],e,t)}for(let w=0;w<C;++w){let D=C-w-1,I=A[D];e.mode===oe.SCENE2D?(n.position.z=L-I.near+1,s.far=Math.max(1,I.far-I.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=D!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s)),v.execute(i,t),i.stencilBuffer&&P.execute(i,t),S.translucent?(r.updatePass(De.GLOBE),S.executeGlobeCommands(I,_p,b,e,t)):F(I,De.GLOBE),p&&y.executeCopyDepth(i,t),f||(S.translucent?(r.updatePass(De.TERRAIN_CLASSIFICATION),S.executeGlobeClassificationCommands(I,_p,b,e,t)):F(I,De.TERRAIN_CLASSIFICATION)),u&&(v.execute(i,t),h&&R.execute(i,t));let N;if(!g||l||f)N=F(I,De.CESIUM_3D_TILE),N>0&&(p&&(y.prepareColorTextures(i,u),y.executeUpdateDepth(i,t,y.depthStencilTexture)),f||(N=F(I,De.CESIUM_3D_TILE_CLASSIFICATION)));else{e._invertClassification.clear(i,t);let z=t.framebuffer;t.framebuffer=e._invertClassification._fbo.framebuffer,N=F(I,De.CESIUM_3D_TILE),p&&(e._invertClassification.prepareTextures(i),y.executeUpdateDepth(i,t,e._invertClassification._fbo.getDepthStencilTexture())),N=F(I,De.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),t.framebuffer=z,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),N>0&&i.stencilBuffer&&M.execute(i,t),N=F(I,De.CESIUM_3D_TILE_CLASSIFICATION)}if(N>0&&i.stencilBuffer&&P.execute(i,t),ATt(e,t,I),F(I,De.OPAQUE),D!==0&&e.mode!==oe.SCENE2D&&(s.near=I.near,r.updateFrustum(s)),PTt(e,t,I),ITt(e,t,I),i.depthTexture&&e.useDepthPicking&&(p||f)){let z=e._picking.getPickDepth(e,D);z.update(i,y.depthStencilTexture),z.executeCopyDepth(i,t)}if(l||!m)continue;let k=t.framebuffer;t.framebuffer=x.getIdFramebuffer(),s.near=D!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s),S.translucent?(r.updatePass(De.GLOBE),S.executeGlobeCommands(I,fCe,b,e,t)):_(I,De.GLOBE),u&&(v.framebuffer=t.framebuffer,v.execute(i,t),v.framebuffer=void 0),u&&h&&R.execute(i,t),_(I,De.CESIUM_3D_TILE),_(I,De.OPAQUE),_(I,De.TRANSLUCENT),t.framebuffer=k}}function OTt(e,t){let{context:n,environmentState:i,view:o}=e;if(n.uniformState.updatePass(De.ENVIRONMENT),c(i.skyBoxCommand)&&_p(i.skyBoxCommand,e,t),i.isSkyAtmosphereVisible&&_p(i.skyAtmosphereCommand,e,t),i.isSunVisible&&(i.sunDrawCommand.execute(n,t),e.sunBloom&&!i.useWebVR)){let r;i.useGlobeDepthFramebuffer?r=o.globeDepth.framebuffer:i.usePostProcess?r=o.sceneFramebuffer.framebuffer:r=i.originalFramebuffer,e._sunPostProcess.execute(n),e._sunPostProcess.copy(n,r),t.framebuffer=r}i.isMoonVisible&&i.moonCommand.execute(n,t)}function pCe(e){e.context.uniformState.updatePass(De.COMPUTE);let t=e._environmentState.sunComputeCommand;c(t)&&t.execute(e._computeEngine);let n=e._computeCommandList;for(let i=0;i<n.length;++i)n[i].execute(e._computeEngine)}function RTt(e,t){e.context.uniformState.updatePass(De.OVERLAY);let n=e.context,i=e._overlayCommandList;for(let o=0;o<i.length;++o)i[o].execute(n,t)}function MTt(e,t,n){let{shadowMapCullingVolume:i,isPointLight:o,passes:r}=n,s=r.length,a=[De.GLOBE,De.CESIUM_3D_TILE,De.OPAQUE,De.TRANSLUCENT];for(let l=0;l<t.length;++l){let u=t[l];if(e.updateDerivedCommands(u),!(!u.castShadows||a.indexOf(u.pass)<0||!e.isVisible(i,u)))if(o)for(let f=0;f<s;++f)r[f].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let f=!1;for(let h=s-1;h>=0;--h){let p=r[h].cullingVolume;if(e.isVisible(p,u))r[h].commandList.push(u),f=!0;else if(f)break}}}}function _Ce(e){let{shadowState:t,commandList:n}=e.frameState,{shadowsEnabled:i,shadowMaps:o}=t;if(!i)return;let{context:r}=e,{uniformState:s}=r;for(let a=0;a<o.length;++a){let l=o[a];if(l.outOfView)continue;let{passes:u}=l;for(let f=0;f<u.length;++f)u[f].commandList.length=0;MTt(e,n,l);for(let f=0;f<u.length;++f){let h=l.passes[f],{camera:p,commandList:g}=h;s.updateCamera(p),l.updatePass(r,f);for(let m=0;m<g.length;++m){let y=g[m];s.updatePass(y.pass);let b=y.derivedCommands.shadows.castCommands[a];_p(b,e,h.passState)}}}}var LTt=new d;ci.prototype.updateAndExecuteCommands=function(e,t){YTt(this,e,t),this._environmentState.useWebVR?NTt(this,e,t):this._frameState.mode!==oe.SCENE2D||this._mapMode2D===ru.ROTATE?z0(!0,this,e):jTt(this,e)};function NTt(e,t){let n=e._view,i=n.camera,r=e._environmentState.renderTranslucentDepthForPick;gCe(e),n.createPotentiallyVisibleSet(e),pCe(e),r||_Ce(e);let s=t.viewport;s.x=0,s.y=0,s.width=s.width*.5;let a=ro.clone(i,e._cameraVR);a.frustum=i.frustum;let l=i.frustum.near,u=l*(e.focalLength??5),f=e.eyeSeparation??u/30,h=d.multiplyByScalar(a.right,f*.5,LTt);i.frustum.aspectRatio=s.width/s.height;let p=.5*f*l/u;d.add(a.position,h,i.position),i.frustum.xOffset=p,N$(e,t),s.x=s.width,d.subtract(a.position,h,i.position),i.frustum.xOffset=-p,N$(e,t),ro.clone(a,i)}var FTt=new he(Math.PI,O.PI_OVER_TWO),BTt=new d,kTt=new d,UTt=new B,VTt=new B,zTt=new d,HTt=new d,GTt=new Ke;function jTt(e,t){let{frameState:n,camera:i}=e,{uniformState:o}=e.context,r=t.viewport,s=Ke.clone(r,GTt);t.viewport=s;let a=FTt,l=BTt;e.mapProjection.project(a,l);let f=d.clone(i.position,kTt),h=B.clone(i.transform,VTt),p=i.frustum.clone();i._setTransform(B.IDENTITY);let g=B.computeViewportTransformation(s,0,1,UTt),m=i.frustum.projectionMatrix,y=i.positionWC.y,b=d.fromElements(O.sign(y)*l.x-y,0,-i.positionWC.x,zTt),x=Ot.pointToGLWindowCoordinates(m,g,b,HTt);x.x=Math.floor(x.x);let A=s.x,C=s.width;if(y===0||x.x<=A||x.x>=A+C)z0(!0,e,t);else if(Math.abs(A+C*.5-x.x)<1)s.width=x.x-s.x,i.position.x*=O.sign(i.position.x),i.frustum.right=0,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!0,e,t),s.x=x.x,i.position.x=-i.position.x,i.frustum.right=-i.frustum.left,i.frustum.left=0,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!1,e,t);else if(x.x>A+C*.5){s.width=x.x-A;let S=i.frustum.right;i.frustum.right=l.x-y,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!0,e,t),s.x=x.x,s.width=A+C-x.x,i.position.x=-i.position.x,i.frustum.left=-i.frustum.right,i.frustum.right=S-i.frustum.right*2,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!1,e,t)}else{s.x=x.x,s.width=A+C-x.x;let S=i.frustum.left;i.frustum.left=-l.x-y,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!0,e,t),s.x=A,s.width=x.x-A,i.position.x=-i.position.x,i.frustum.right=-i.frustum.left,i.frustum.left=S-i.frustum.left*2,n.cullingVolume=i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC),o.update(n),z0(!1,e,t)}i._setTransform(h),d.clone(f,i.position),i.frustum=p.clone(),t.viewport=r}function z0(e,t,n){let i=t._view,{renderTranslucentDepthForPick:o}=t._environmentState;e||(t.frameState.commandList.length=0),gCe(t),i.createPotentiallyVisibleSet(t),e&&(pCe(t),o||_Ce(t)),N$(t,n)}var dCe=new _s;ci.prototype.updateEnvironment=function(){let e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.atmosphere,s=this.skyAtmosphere,a=this.globe,l=this._globeTranslucencyState;if(!i||this._mode!==oe.SCENE2D&&t.camera.frustum instanceof on||!l.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{if(c(s)){if(c(a))s.setDynamicLighting(a_.fromGlobeFlags(a)),n.isReadyForAtmosphere=n.isReadyForAtmosphere||!a.show||a._surface._tilesToRender.length>0;else{let x=r.dynamicLighting;s.setDynamicLighting(x),n.isReadyForAtmosphere=!0}n.skyAtmosphereCommand=s.update(e,a),c(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)}else n.skyAtmosphereCommand=void 0;n.skyBoxCommand=c(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;let b=c(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=c(b)?b.drawCommand:void 0,n.sunComputeCommand=c(b)?b.computeCommand:void 0,n.moonCommand=c(this.moon)?this.moon.update(e):void 0}let u=n.clearGlobeDepth=c(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===oe.SCENE2D);(n.useDepthPlane=u&&this.mode===oe.SCENE3D&&l.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==oe.SCENE2D&&!o;let h=e.mode===oe.SCENE3D&&!l.sunVisibleThroughGlobe?e.occluder:void 0,p=e.cullingVolume,g=dCe.planes;for(let b=0;b<5;++b)g[b]=p.planes[b];p=dCe,n.isSkyAtmosphereVisible=c(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(p,n.sunDrawCommand,h),n.isMoonVisible=this.isVisible(p,n.moonCommand,h);let m=this.specularEnvironmentMaps,y=this._specularEnvironmentCubeMap;c(m)&&y?.url!==m?(y=y&&y.destroy(),this._specularEnvironmentCubeMap=new Yd(m)):!c(m)&&c(y)&&(y.destroy(),this._specularEnvironmentCubeMap=void 0),c(this._specularEnvironmentCubeMap)&&this._specularEnvironmentCubeMap.update(e)};function WTt(e){let t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new sp({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),c(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function qTt(e){let t=e._frameState,{passes:n,shadowState:i,shadowMaps:o}=t,r=o.length,s=r>0&&!n.pick&&!n.pickVoxel&&e.mode===oe.SCENE3D;if(s!==i.shadowsEnabled&&(++i.lastDirtyTime,i.shadowsEnabled=s),i.lightShadowsEnabled=!1,!!s){for(let a=0;a<r;++a)if(o[a]!==i.shadowMaps[a]){++i.lastDirtyTime;break}i.shadowMaps.length=0,i.lightShadowMaps.length=0;for(let a=0;a<r;++a){let l=o[a];l.update(t),i.shadowMaps.push(l),l.fromLightSource&&(i.lightShadowMaps.push(l),i.lightShadowsEnabled=!0),l.dirty&&(++i.lastDirtyTime,l.dirty=!1)}}}function gCe(e){let t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),WTt(e),qTt(e),e._globe&&e._globe.render(t)}function YTt(e,t,n){let i=e._context,o=e._frameState,r=e._environmentState,s=e._view,a=o.passes,l=a.pick||a.pickVoxel;c(s.globeDepth)&&(s.globeDepth.picking=l);let u=r.useWebVR;r.originalFramebuffer=t.framebuffer,c(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!u?e._sunPostProcess=new o3:c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!c(e.sun)&&c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);let f=e._clearColorCommand;G.clone(n,f.color),f.execute(i,t);let h=r.useGlobeDepthFramebuffer=c(s.globeDepth);h&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));let p=s.oit,g=r.useOIT=!l&&c(p)&&p.isSupported();g&&(p.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),p.clear(i,t,n),r.useOIT=p.isSupported());let m=e.postProcessStages,y=r.usePostProcess=!l&&(e._hdr||m.length>0||m.ambientOcclusion.enabled||m.fxaa.enabled||m.bloom.enabled);if(r.usePostProcessSelected=!1,y&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),m.update(i,o.useLogDepth,e._hdr),m.clear(i),y=r.usePostProcess=m.ready,r.usePostProcessSelected=y&&m.hasSelected),r.isSunVisible&&e.sunBloom&&!u?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):h?t.framebuffer=s.globeDepth.framebuffer:y&&(t.framebuffer=s.sceneFramebuffer.framebuffer),c(t.framebuffer)&&f.execute(i,t),r.useInvertClassification=!l&&c(t.framebuffer)&&e.invertClassification){let x;if(o.invertClassificationColor.alpha===1&&h&&(x=s.globeDepth.framebuffer),c(x)||i.depthTexture){if(e._invertClassification.previousFramebuffer=x,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),o.invertClassificationColor.alpha<1&&g){let A=e._invertClassification.unclassifiedCommand,C=A.derivedCommands;C.oit=p.createDerivedCommands(A,i,C.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}ci.prototype.resolveFramebuffers=function(e){let t=this._context,n=this._environmentState,i=this._view,{globeDepth:o,translucentTileClassification:r}=i;c(o)&&o.prepareColorTextures(t);let{useOIT:s,useGlobeDepthFramebuffer:a,usePostProcess:l,originalFramebuffer:u}=n,f=a?o.colorFramebufferManager:void 0,h=i.sceneFramebuffer._colorFramebuffer,p=i.sceneFramebuffer.idFramebuffer;if(s&&(e.framebuffer=l?h.framebuffer:u,i.oit.execute(t,e)),r.hasTranslucentDepth&&r.isSupported()&&r.execute(this,e),l){i.sceneFramebuffer.prepareColorTextures(t);let g=h;a&&!s&&(g=f);let m=this.postProcessStages,y=g.getColorTexture(0),b=p.getColorTexture(0),x=(f??h).getDepthStencilTexture();m.execute(t,y,x,b),m.copy(t,u)}!s&&!l&&a&&(e.framebuffer=u,o.executeCopyColor(t,e))};function XTt(e){let t=e._frameState.afterRender;for(let n=0;n<t.length;++n)t[n]()&&e.requestRender();t.length=0}function KTt(e){if(e.mode===oe.MORPHING)return;let t=e.camera.positionCartographic;return e.getHeight(t)}function yCe(e,t,n){let i=Number.NEGATIVE_INFINITY;if(e instanceof fl){let o=e.length;for(let r=0;r<o;++r){let s=e.get(r),a=yCe(s,t,n);c(a)&&a>i&&(i=a)}}else if(e.isCesium3DTileset&&e.show&&e.enableCollision){let o=e.getHeight(t,n);if(c(o)&&o>i)return o}return i}ci.prototype.getHeight=function(e,t){if(!c(e))return;let n=t===We.CLAMP_TO_TERRAIN||t===We.RELATIVE_TO_TERRAIN,i=t===We.CLAMP_TO_3D_TILE||t===We.RELATIVE_TO_3D_TILE;if(!c(e))return;let o=Number.NEGATIVE_INFINITY;if(!n){let s=yCe(this.primitives,e,this);c(s)&&s>o&&(o=s)}let r=this._globe;if(!i&&c(r)&&r.show){let s=r.getHeight(e);s>o&&(o=s)}if(o>Number.NEGATIVE_INFINITY)return o};var L$=new he;ci.prototype.updateHeight=function(e,t,n){T.typeOf.func("callback",t);let i=this._ellipsoid,o=g=>{he.clone(e,L$);let m;c(g)&&(m=g.height),c(m)||(m=this.getHeight(e,n)),c(m)&&(L$.height=m,t(L$))},r=n===We.CLAMP_TO_TERRAIN||n===We.RELATIVE_TO_TERRAIN,s=n===We.CLAMP_TO_3D_TILE||n===We.RELATIVE_TO_3D_TILE,a;!s&&c(this.globe)&&(a=this.globe._surface.updateHeight(e,o));let l={},u=g=>{if(r||g.isDestroyed()||!g.isCesium3DTileset)return;let m=g.updateHeight(e,o,i);l[g.id]=m};if(!r){let g=this.primitives.length;for(let m=0;m<g;++m){let y=this.primitives.get(m);u(y)}}let f=this.primitives.primitiveAdded.addEventListener(u),h=this.primitives.primitiveRemoved.addEventListener(g=>{g.isDestroyed()||!g.isCesium3DTileset||(c(l[g.id])&&l[g.id](),delete l[g.id])});return()=>{a=a&&a(),Object.values(l).forEach(g=>g()),l={},f(),h()}};function $Tt(e){let t=e.camera,n=e._mode,i=e._screenSpaceCameraController,o=t.positionCartographic;if(!c(o))return!1;if(!i.onMap()&&o.height<0)return!0;if(n===oe.SCENE2D||n===oe.MORPHING)return!1;let r=e._globeHeight;return c(r)&&o.height<r}ci.prototype.initializeFrame=function(){if(this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeightDirty){c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),this._globeHeight=KTt(this),this._globeHeightDirty=!1;let e=this.camera.positionCartographic;this._removeUpdateHeightCallback=this.updateHeight(e,t=>{this.isDestroyed()||(this._globeHeight=t.height)})}this._cameraUnderground=$Tt(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),c(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function ZTt(e,t){if(e.debugShowFramesPerSecond){if(!c(e._performanceDisplay)){let n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);let o=new yg({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else c(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function QTt(e){e._jobScheduler.resetBudgets();let t=e._frameState;e.primitives.prePassesUpdate(t),c(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function JTt(e){e.primitives.postPassesUpdate(e._frameState),sc.update()}var eAt=new G;function tAt(e){let t=e._frameState,n=e.context,{uniformState:i}=n,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=pTt;let r=e.backgroundColor??G.BLACK;e._hdr&&(r=G.clone(r,eAt),r.red=Math.pow(r.red,e.gamma),r.green=Math.pow(r.green,e.gamma),r.blue=Math.pow(r.blue,e.gamma)),t.backgroundColor=r,t.atmosphere=e.atmosphere,e.fog.update(t),i.update(t);let s=e.shadowMap;c(s)&&s.enabled&&(!c(e.light)||e.light instanceof Rp?d.negate(i.sunDirectionWC,e._shadowMapCamera.direction):d.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;let a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;let l=o.passState;l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0,l.viewport=Ke.clone(a,l.viewport),c(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,r),e.resolveFramebuffers(l),l.framebuffer=void 0,RTt(e,l),c(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function AA(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function nAt(e){return e._picking.updateMostDetailedRayPicks(e)}ci.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);let t=this._frameState;t.newFrame=!1,c(e)||(e=Q.now());let n=this._view.checkForCameraUpdates(this);n&&(this._globeHeightDirty=!0);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===oe.MORPHING;if(!i&&c(this.maximumRenderTimeChange)&&c(this._lastRenderTime)){let o=Math.abs(Q.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=Q.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;let o=O.incrementWrap(t.frameNumber,15e6,1);hCe(this,o,e),t.newFrame=!0}AA(this,QTt),this.primitives.show&&(AA(this,nAt),AA(this,iAt),AA(this,oAt),i||AA(this,rAt)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),AA(this,tAt)),ZTt(this,i),AA(this,JTt),XTt(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};ci.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};ci.prototype.requestRender=function(){this._renderRequested=!0};ci.prototype.clampLineWidth=function(e){return Math.max(ut.minimumAliasedLineWidth,Math.min(e,ut.maximumAliasedLineWidth))};ci.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};ci.prototype.pickVoxel=function(e,t,n){let i=this.pick(e,t,n);if(!c(i))return;let o=i.primitive;if(!(o instanceof V0))return;let r=this._picking.pickVoxelCoordinate(this,e,t,n),s=255*r[0]+r[1],a=o._traversal.findKeyframeNode(s);if(!c(a))return;let l=255*r[2]+r[3];return a3.fromKeyframeNode(o,s,l,a)};ci.prototype.pickMetadata=function(e,t,n,i){T.typeOf.object("windowPosition",e),T.typeOf.string("className",n),T.typeOf.string("propertyName",i);let o=this.pick(e);if(!c(o))return;let r=o.detail?.model?.structuralMetadata;if(!c(r))return;let s=r.schema,a=M3(s,t,n,i);if(!c(a))return;let l=N3(r,n,i);if(!c(l))return;let u=new L3(t,n,i,a,l);return this._picking.pickMetadata(this,e,u)};ci.prototype.pickMetadataSchema=function(e){T.typeOf.object("windowPosition",e);let t=this.pick(e);return c(t)?t.detail?.model?.structuralMetadata?.schema:void 0};ci.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};ci.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};ci.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function iAt(e){let t=e._frameState;O$.camera=t.camera,O$.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,O$)}function oAt(e){let t=e._frameState;if(!t.camera.canPreloadFlight())return;R$.camera=e.preloadFlightCamera,R$.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,R$)}function rAt(e){e.primitives.updateForPass(e._frameState,_Tt)}ci.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};ci.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};ci.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};ci.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};ci.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};ci.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};ci.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};ci.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};ci.prototype.cartesianToCanvasCoordinates=function(e,t){return Gi.worldToWindowCoordinates(this,e,t)};ci.prototype.completeMorph=function(){this._transitioner.completeMorph()};ci.prototype.morphTo2D=function(e){e=e??2,this._transitioner.morphTo2D(e,this._ellipsoid)};ci.prototype.morphToColumbusView=function(e){e=e??2,this._transitioner.morphToColumbusView(e,this._ellipsoid)};ci.prototype.morphTo3D=function(e){e=e??2,this._transitioner.morphTo3D(e,this._ellipsoid)};function sAt(e,t){if(e._removeTerrainProviderReadyListener=e._removeTerrainProviderReadyListener&&e._removeTerrainProviderReadyListener(),t.ready){c(e.globe)&&(e.globe.terrainProvider=t.provider);return}e.globe.terrainProvider=void 0,e._removeTerrainProviderReadyListener=t.readyEvent.addEventListener(n=>{c(e)&&c(e.globe)&&(e.globe.terrainProvider=n),e._removeTerrainProviderReadyListener()})}ci.prototype.setTerrain=function(e){return T.typeOf.object("terrain",e),sAt(this,e),e};ci.prototype.isDestroyed=function(){return!1};ci.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),c(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),de(this)};var F3=ci;function Nw(e){e=e??ie.WGS84,this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;let t=1.025,n=d.multiplyByScalar(e.radii,t,new d);this._scaleMatrix=B.fromScale(n),this._modelMatrix=new B,this._command=new Qe({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new d;let i=new d;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;let o=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return o._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return o._hueSaturationBrightness.x=o.hueShift,o._hueSaturationBrightness.y=o.saturationShift,o._hueSaturationBrightness.z=o.brightnessShift,o._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return o.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return o.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return o.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return o.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return o.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return o.atmosphereMieAnisotropy}}}Object.defineProperties(Nw.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Nw.prototype.setDynamicLighting=function(e){this._radiiAndDynamicAtmosphereColor.z=e};var F$=new B;Nw.prototype.update=function(e,t){if(!this.show)return;let n=e.mode;if(n!==oe.SCENE3D&&n!==oe.MORPHING||!e.passes.render)return;let i=B.fromRotationTranslation(e.context.uniformState.inverseViewRotation,d.ZERO,F$),o=B.multiplyTransformation(i,Fo.Y_UP_TO_Z_UP,F$),r=B.multiply(this._scaleMatrix,o,F$);B.clone(r,this._modelMatrix);let s=e.context,a=aAt(this),l=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||l||!c(t)||!t.show,f=this._command;if(!c(f.vertexArray)){let p=Js.createGeometry(new Js({radii:new d(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ie.POSITION_ONLY}));f.vertexArray=ti.fromGeometry({context:s,geometry:p,attributeLocations:Nn.createAttributeLocations(p),bufferUsage:Be.STATIC_DRAW}),f.renderState=Ve.fromCache({cull:{enabled:!0,face:xi.FRONT},blending:ln.ALPHA_BLEND,depthMask:!1})}let h=a|u<<2|l<<3;if(h!==this._flags){this._flags=h;let p=[];a&&p.push("COLOR_CORRECT"),u&&p.push("PER_FRAGMENT_ATMOSPHERE"),l&&p.push("GLOBE_TRANSLUCENT");let g=new He({defines:p,sources:[nh,iw,c2]}),m=new He({defines:p,sources:[nh,iw,a2]});this._spSkyAtmosphere=Jt.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:m}),f.shaderProgram=this._spSkyAtmosphere}return f};function aAt(e){return!(O.equalsEpsilon(e.hueShift,0,O.EPSILON7)&&O.equalsEpsilon(e.saturationShift,0,O.EPSILON7)&&O.equalsEpsilon(e.brightnessShift,0,O.EPSILON7))}Nw.prototype.isDestroyed=function(){return!1};Nw.prototype.destroy=function(){let e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),de(this)};var B3=Nw;function Bw(e){this.sources=e.sources,this._sources=void 0,this.show=e.show??!0,this._command=new Qe({modelMatrix:B.clone(B.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0,this._hasError=!1,this._error=void 0}Bw.prototype.update=function(e,t){let n=this,{mode:i,passes:o,context:r}=e;if(!this.show||i!==oe.SCENE3D&&i!==oe.MORPHING||!o.render)return;if(this._hasError){let a=this._error;throw this._hasError=!1,this._error=void 0,a}if(this._sources!==this.sources){this._sources=this.sources;let a=this.sources;if(T.defined("this.sources",a),Object.values(Go.FaceName).some(u=>!c(a[u])))throw new E("this.sources must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");let l=typeof a.positiveX;if(Object.values(Go.FaceName).some(u=>typeof a[u]!==l))throw new E("this.sources properties must all be the same type.");typeof a.positiveX=="string"?SI(r,this._sources).then(function(u){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=u}).catch(u=>{this._hasError=!0,this._error=u}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Go({context:r,source:a}))}let s=this._command;if(!c(s.vertexArray)){s.uniformMap={u_cubeMap:function(){return n._cubeMap}};let a=La.createGeometry(La.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ie.POSITION_ONLY})),l=this._attributeLocations=Nn.createAttributeLocations(a);s.vertexArray=ti.fromGeometry({context:r,geometry:a,attributeLocations:l,bufferUsage:Be.STATIC_DRAW}),s.renderState=Ve.fromCache({blending:ln.ALPHA_BLEND})}if(!c(s.shaderProgram)||this._useHdr!==t){let a=new He({defines:[t?"HDR":""],sources:[l2]});s.shaderProgram=Jt.fromCache({context:r,vertexShaderSource:u2,fragmentShaderSource:a,attributeLocations:this._attributeLocations}),this._useHdr=t}if(c(this._cubeMap))return s};Bw.prototype.isDestroyed=function(){return!1};Bw.prototype.destroy=function(){let e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),de(this)};function Fw(e){return tn(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}Bw.createEarthSkyBox=function(){return new Bw({sources:{positiveX:Fw("px"),negativeX:Fw("mx"),positiveY:Fw("py"),negativeY:Fw("my"),positiveZ:Fw("pz"),negativeZ:Fw("mz")}})};var k3=Bw;function V3(){this.show=!0,this._drawCommand=new Qe({primitiveType:Me.TRIANGLES,boundingVolume:new le,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new le,this._boundingVolume2D=new le,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;let e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(V3.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var cAt=new H,lAt=new H,uAt=new se,U3=new se;V3.prototype.update=function(e,t,n){if(!this.show)return;let i=e.mode;if(i===oe.SCENE2D||i===oe.MORPHING||!e.passes.render)return;let o=e.context,r=t.viewport.width,s=t.viewport.height;if(!c(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let S=Math.max(r,s);S=Math.pow(2,Math.ceil(Math.log(S)/Math.log(2))-2),S=Math.max(1,S);let v=n?o.halfFloatingPointTexture?Ue.HALF_FLOAT:Ue.FLOAT:Ue.UNSIGNED_BYTE;this._texture=new Rt({context:o,width:S,height:S,pixelFormat:ke.RGBA,pixelDatatype:v}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;let P=this,M={u_radiusTS:function(){return P._radiusTS}};this._commands.computeCommand=new Uc({fragmentShaderSource:d2,outputTexture:this._texture,uniformMap:M,persists:!1,owner:this,postExecute:function(){P._commands.computeCommand=void 0}})}let a=this._drawCommand;if(!c(a.vertexArray)){let S={direction:0},v=new Uint8Array(4*2);v[0]=0,v[1]=0,v[2]=255,v[3]=0,v[4]=255,v[5]=255,v[6]=0,v[7]=255;let P=yt.createVertexBuffer({context:o,typedArray:v,usage:Be.STATIC_DRAW}),M=[{index:S.direction,vertexBuffer:P,componentsPerAttribute:2,normalize:!0,componentDatatype:$.UNSIGNED_BYTE}],R=yt.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});a.vertexArray=new ti({context:o,attributes:M,indexBuffer:R}),a.shaderProgram=Jt.fromCache({context:o,vertexShaderSource:h2,fragmentShaderSource:f2,attributeLocations:S}),a.renderState=Ve.fromCache({blending:ln.ALPHA_BLEND}),a.uniformMap=this._uniformMap}let l=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,f=this._boundingVolume,h=this._boundingVolume2D;d.clone(l,f.center),h.center.x=u.z,h.center.y=u.x,h.center.z=u.y,f.radius=O.SOLAR_RADIUS+O.SOLAR_RADIUS*this._glowLengthTS,h.radius=f.radius,i===oe.SCENE3D?le.clone(f,a.boundingVolume):i===oe.COLUMBUS_VIEW&&le.clone(h,a.boundingVolume);let p=Gi.computeActualEllipsoidPosition(e,l,U3),g=d.magnitude(d.subtract(p,e.camera.position,U3)),m=o.uniformState.projection,y=uAt;y.x=0,y.y=0,y.z=-g,y.w=1;let b=B.multiplyByVector(m,y,U3),x=Gi.clipToGLWindowCoordinates(t.viewport,b,cAt);y.x=O.SOLAR_RADIUS;let A=B.multiplyByVector(m,y,U3),C=Gi.clipToGLWindowCoordinates(t.viewport,A,lAt);return this._size=H.magnitude(H.subtract(C,x,U3)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};V3.prototype.isDestroyed=function(){return!1};V3.prototype.destroy=function(){let e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),de(this)};var z3=V3;var TCe=Zo(AU(),1);function fAt(e,t,n){return T.typeOf.string("samplerUniformName",e),T.typeOf.string("matrixUniformName",t),T.typeOf.string("styleUniformName",n),`    float clipDistance = clip(gl_FragCoord, ${e}, ${t}); 
    vec4 clippingPlanesEdgeColor = vec4(1.0); 
    clippingPlanesEdgeColor.rgb = ${n}.rgb; 
    float clippingPlanesEdgeWidth = ${n}.a; 
    if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) 
    { 
        out_FragColor = clippingPlanesEdgeColor;
    } 
`}var H3=fAt;var dAt={modifyFragmentShader:function(t){return t=He.replaceMain(t,"czm_splitter_main"),t+=`uniform float czm_splitDirection; 
void main() 
{ 
#ifndef SHADOW_MAP
    if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard; 
    if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; 
#endif
    czm_splitter_main(); 
} 
`,t},addUniforms:function(t,n){n.czm_splitDirection=function(){return t.splitDirection}}},kw=dAt;var CA={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function G3(e){T.typeOf.object("options",e),T.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=G.clone(G.DARKGRAY),this._highlightColor=G.clone(G.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=CA.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=e.opaquePass??De.OPAQUE,this._cull=e.cull??!0,this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=B.clone(B.IDENTITY),this._modelMatrix=B.clone(B.IDENTITY),this.time=0,this.shadows=xn.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=e.splitDirection??Vr.NONE,this._splittingEnabled=!1,this._error=void 0,hAt(this,e)}Object.defineProperties(G3.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},color:{get:function(){return G.clone(this._highlightColor)},set:function(e){this._highlightColor=G.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(c(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=le.clone(e,this._boundingSphere)}}});function hAt(e,t){let n=Rx.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&c(n.batchTableBinary)&&(n.styleableProperties=Kp.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),c(n.draco)){let a=n.draco;e._decodingState=CA.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}let i=n.positions;c(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);let o=n.normals;c(o)&&(e._isOctEncoded16P=o.octEncoded);let r=n.colors;c(r)&&(c(r.constantColor)&&(e._constantColor=G.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);let s=n.batchIds;c(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength}var mAt=new d,pAt=new d,_At=new d,bCe,OG;function gAt(e){if(!c(OG)){bCe=new TCe.default(0),OG=new Array(e);for(let t=0;t<e;++t)OG[t]=bCe.random()}return OG}function yAt(e){let n=e.length/3,i=Math.min(n,20),o=gAt(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=d.fromElements(r,r,r,mAt),l=d.fromElements(s,s,s,pAt);for(let f=0;f<i;++f){let h=Math.floor(o[f]*n),p=d.unpack(e,h*3,_At);d.minimumByComponent(a,p,a),d.maximumByComponent(l,p,l)}let u=le.fromCornerPoints(a,l);return u.radius+=O.EPSILON2,u}function xCe(e,t){let n=$.fromTypedArray(e);return n===$.INT||n===$.UNSIGNED_INT||n===$.DOUBLE?(dt("Cast pnts property to floats",`Point cloud property "${t}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),new Float32Array(e)):e}var bAt=new se,xAt=new se,TAt=new G,ACe=0,RG=1,z$=2,CCe=3,AAt=4,B$=new B,CAt=new B;function EAt(e,t){let n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,l=i.batchIds,u=i.styleableProperties,f=c(u),h=e._isQuantized,p=e._isQuantizedDraco,g=e._isOctEncoded16P,m=e._isOctEncodedDraco,y=e._quantizedRange,b=e._octEncodedRange,x=e._isRGB565,A=e._isTranslucent,C=e._hasColors,S=e._hasNormals,v=e._hasBatchIds,P,M,R=[],L={};if(e._styleableShaderAttributes=L,f){let V=AAt;for(let j in u)if(u.hasOwnProperty(j)){let U=u[j],q=xCe(U.typedArray,j);P=U.componentCount,M=$.fromTypedArray(q);let Y=yt.createVertexBuffer({context:n,typedArray:q,usage:Be.STATIC_DRAW});e._geometryByteLength+=Y.sizeInBytes;let te={index:V,vertexBuffer:Y,componentsPerAttribute:P,componentDatatype:M,normalize:!1,offsetInBytes:0,strideInBytes:0};R.push(te),L[j]={location:V,componentCount:P},++V}}let F=yt.createVertexBuffer({context:n,typedArray:r.typedArray,usage:Be.STATIC_DRAW});e._geometryByteLength+=F.sizeInBytes;let _;C&&(_=yt.createVertexBuffer({context:n,typedArray:s.typedArray,usage:Be.STATIC_DRAW}),e._geometryByteLength+=_.sizeInBytes);let w;S&&(w=yt.createVertexBuffer({context:n,typedArray:a.typedArray,usage:Be.STATIC_DRAW}),e._geometryByteLength+=w.sizeInBytes);let D;v&&(l.typedArray=xCe(l.typedArray,"batchIds"),D=yt.createVertexBuffer({context:n,typedArray:l.typedArray,usage:Be.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes);let I=[];if(h?M=$.UNSIGNED_SHORT:p?M=y<=255?$.UNSIGNED_BYTE:$.UNSIGNED_SHORT:M=$.FLOAT,I.push({index:ACe,vertexBuffer:F,componentsPerAttribute:3,componentDatatype:M,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(h||p?e._boundingSphere=le.fromCornerPoints(d.ZERO,e._quantizedVolumeScale):e._boundingSphere=yAt(r.typedArray)),C)if(x)I.push({index:RG,vertexBuffer:_,componentsPerAttribute:1,componentDatatype:$.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{let V=A?4:3;I.push({index:RG,vertexBuffer:_,componentsPerAttribute:V,componentDatatype:$.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}S&&(g?(P=2,M=$.UNSIGNED_BYTE):m?(P=2,M=b<=255?$.UNSIGNED_BYTE:$.UNSIGNED_SHORT):(P=3,M=$.FLOAT),I.push({index:z$,vertexBuffer:w,componentsPerAttribute:P,componentDatatype:M,normalize:!1,offsetInBytes:0,strideInBytes:0})),v&&I.push({index:CCe,vertexBuffer:D,componentsPerAttribute:1,componentDatatype:$.fromTypedArray(l.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),f&&(I=I.concat(R));let N=new ti({context:n,attributes:I}),k={depthTest:{enabled:!0}},z={depthTest:{enabled:!0},depthMask:!1,blending:ln.ALPHA_BLEND};e._opaquePass===De.CESIUM_3D_TILE&&(k.stencilTest=kt.setCesium3DTileBit(),k.stencilMask=kt.CESIUM_3D_TILE_MASK,z.stencilTest=kt.setCesium3DTileBit(),z.stencilMask=kt.CESIUM_3D_TILE_MASK),e._opaqueRenderState=Ve.fromCache(k),e._translucentRenderState=Ve.fromCache(z),e._drawCommand=new Qe({boundingVolume:new le,cull:e._cull,modelMatrix:new B,primitiveType:Me.POINTS,vertexArray:N,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:A?e._translucentRenderState:e._opaqueRenderState,pass:A?De.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function SAt(e,t){let n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco,s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){let a=bAt;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){let l=t.camera.frustum,u;t.mode===oe.SCENE2D||l instanceof on?u=Number.POSITIVE_INFINITY:u=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=u}return a},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){let a=e.clippingPlanes;return e.isClipped?a.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){let a=e.clippingPlanes;if(!c(a))return G.TRANSPARENT;let l=G.clone(a.edgeColor,TAt);return l.alpha=a.edgeWidth,l},u_clippingPlanesMatrix:function(){let a=e.clippingPlanes;if(!c(a))return B.IDENTITY;let l=e.clippingPlanesOriginMatrix??e._modelMatrix;B.multiply(n.uniformState.view3D,l,B$);let u=B.multiply(B$,a.modelMatrix,B$);return B.inverseTranspose(u,CAt)}};kw.addUniforms(e,s),(i||o||r)&&(s=xt(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){let a=xAt;if(c(e._quantizedVolumeScale)){let l=d.clone(e._quantizedVolumeScale,a);d.divideByScalar(l,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),c(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function k$(e,t){let n=/czm_3dtiles_property_(\d+)/g,i=n.exec(e);for(;i!==null;){let o=parseInt(i[1]);t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function U$(e,t){e=e.slice(e.indexOf(`
`));let n=/czm_3dtiles_builtin_property_(\w+)/g,i=n.exec(e);for(;i!==null;){let o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function V$(e,t){let n=e.numberOfAttributes;for(let i=0;i<n;++i){let o=e.getAttribute(i);if(o.index===t)return o}}var wAt={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function vAt(e,t,n){let i,o,r,s=t.context,a=c(n),l=e._isQuantized,u=e._isQuantizedDraco,f=e._isOctEncoded16P,h=e._isOctEncodedDraco,p=e._isRGB565,g=e._isTranslucent,m=e._hasColors,y=e._hasNormals,b=e._hasBatchIds,x=e._backFaceCulling,A=e._normalShading,C=e._drawCommand.vertexArray,S=e.clippingPlanes,v=e._attenuation,P,M,R,L=g,F=je(wAt),_={},w=e._styleableShaderAttributes;for(o in w)w.hasOwnProperty(o)&&(r=w[o],F[o]=`czm_3dtiles_property_${r.location}`,_[r.location]=r);if(a){let ue={translucent:!1},ye="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";P=n.getColorShaderFunction(`getColorFromStyle${ye}`,F,ue),M=n.getShowShaderFunction(`getShowFromStyle${ye}`,F,ue),R=n.getPointSizeShaderFunction(`getPointSizeFromStyle${ye}`,F,ue),c(P)&&ue.translucent&&(L=!0)}e._styleTranslucent=L;let D=c(P),I=c(M),N=c(R),k=e.isClipped,z=[],V=[];D&&(k$(P,z),U$(P,V)),I&&(k$(M,z),U$(M,V)),N&&(k$(R,z),U$(R,V));let j=V.indexOf("COLOR")>=0,U=V.indexOf("NORMAL")>=0;if(U&&!y)throw new ae("Style references the NORMAL semantic but the point cloud does not have normals");for(o in w)if(w.hasOwnProperty(o)){r=w[o];let ue=z.indexOf(r.location)>=0,ye=V$(C,r.location);ye.enabled=ue}let q=m&&(!D||j);if(m){let ue=V$(C,RG);ue.enabled=q}let Y=y&&(A||x||U);if(y){let ue=V$(C,z$);ue.enabled=Y}let te={a_position:ACe};q&&(te.a_color=RG),Y&&(te.a_normal=z$),b&&(te.a_batchId=CCe);let K="",Z=z.length;for(i=0;i<Z;++i){let ue=z[i];r=_[ue];let ye=r.componentCount,Ae=`czm_3dtiles_property_${ue}`,Pe;ye===1?Pe="float":Pe=`vec${ye}`,K+=`in ${Pe} ${Ae}; 
`,te[Ae]=r.location}SAt(e,t);let ee=`in vec3 a_position; 
out vec4 v_color; 
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; 
uniform vec4 u_constantColor; 
uniform vec4 u_highlightColor; 
`;ee+=`float u_pointSize; 
float tiles3d_tileset_time; 
`,v&&(ee+=`float u_geometricError; 
float u_depthMultiplier; 
`),ee+=K,q&&(g?ee+=`in vec4 a_color; 
`:p?ee+=`in float a_color; 
const float SHIFT_RIGHT_11 = 1.0 / 2048.0; 
const float SHIFT_RIGHT_5 = 1.0 / 32.0; 
const float SHIFT_LEFT_11 = 2048.0; 
const float SHIFT_LEFT_5 = 32.0; 
const float NORMALIZE_6 = 1.0 / 64.0; 
const float NORMALIZE_5 = 1.0 / 32.0; 
`:ee+=`in vec3 a_color; 
`),Y&&(f||h?ee+=`in vec2 a_normal; 
`:ee+=`in vec3 a_normal; 
`),b&&(ee+=`in float a_batchId; 
`),(l||u||h)&&(ee+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; 
`),D&&(ee+=P),I&&(ee+=M),N&&(ee+=R),ee+=`void main() 
{ 
    u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; 
    tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; 
`,v&&(ee+=`    u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; 
    u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; 
`),q?g?ee+=`    vec4 color = a_color; 
`:p?ee+=`    float compressed = a_color; 
    float r = floor(compressed * SHIFT_RIGHT_11); 
    compressed -= r * SHIFT_LEFT_11; 
    float g = floor(compressed * SHIFT_RIGHT_5); 
    compressed -= g * SHIFT_LEFT_5; 
    float b = compressed; 
    vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); 
    vec4 color = vec4(rgb, 1.0); 
`:ee+=`    vec4 color = vec4(a_color, 1.0); 
`:ee+=`    vec4 color = u_constantColor; 
`,l||u?ee+=`    vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; 
`:ee+=`    vec3 position = a_position; 
`,ee+=`    vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); 
`,Y?(f?ee+=`    vec3 normal = czm_octDecode(a_normal); 
`:h?ee+=`    vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; 
`:ee+=`    vec3 normal = a_normal; 
`,ee+=`    vec3 normalEC = czm_normal * normal; 
`):ee+=`    vec3 normal = vec3(1.0); 
`,D&&(ee+=`    color = getColorFromStyle(position, position_absolute, color, normal); 
`),I&&(ee+=`    float show = float(getShowFromStyle(position, position_absolute, color, normal)); 
`),N?ee+=`    gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; 
`:v?ee+=`    vec4 positionEC = czm_modelView * vec4(position, 1.0); 
    float depth = -positionEC.z; 
    gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); 
`:ee+=`    gl_PointSize = u_pointSize; 
`,ee+=`    color = color * u_highlightColor; 
`,Y&&A&&(ee+=`    float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); 
    diffuseStrength = max(diffuseStrength, 0.4); 
    color.xyz *= diffuseStrength * czm_lightColor; 
`),ee+=`    v_color = color; 
    gl_Position = czm_modelViewProjection * vec4(position, 1.0); 
`,Y&&x&&(ee+=`    float visible = step(-normalEC.z, 0.0); 
    gl_Position *= visible; 
    gl_PointSize *= visible; 
`),I&&(ee+=`    gl_Position.w *= float(show); 
    gl_PointSize *= float(show); 
`),ee+=`} 
`;let me=`in vec4 v_color; 
`;k&&(me+=`uniform highp sampler2D u_clippingPlanes; 
uniform mat4 u_clippingPlanesMatrix; 
uniform vec4 u_clippingPlanesEdgeStyle; 
`,me+=`
`,me+=fg(S,s),me+=`
`),me+=`void main() 
{ 
    out_FragColor = czm_gammaCorrect(v_color); 
`,k&&(me+=H3("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),me+=`} 
`,e.splitDirection!==Vr.NONE&&(me=kw.modifyFragmentShader(me)),c(e._vertexShaderLoaded)&&(ee=e._vertexShaderLoaded(ee)),c(e._fragmentShaderLoaded)&&(me=e._fragmentShaderLoaded(me));let Te=e._drawCommand;c(Te.shaderProgram)&&Te.shaderProgram.destroy(),Te.shaderProgram=Jt.fromCache({context:s,vertexShaderSource:ee,fragmentShaderSource:me,attributeLocations:te});try{Te.shaderProgram._bind()}catch{throw new ae("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function DAt(e,t){if(e._decodingState===CA.READY)return!1;if(e._decodingState===CA.NEEDS_DECODE){let n=e._parsedContent,i=n.draco,o=n_.decodePointCloud(i,t);c(o)&&(e._decodingState=CA.DECODING,o.then(function(r){e._decodingState=CA.READY;let s=c(r.POSITION)?r.POSITION.array:void 0,a=c(r.RGB)?r.RGB.array:void 0,l=c(r.RGBA)?r.RGBA.array:void 0,u=c(r.NORMAL)?r.NORMAL.array:void 0,f=c(r.BATCH_ID)?r.BATCH_ID.array:void 0,h=c(s)&&c(r.POSITION.data.quantization),p=c(u)&&c(r.NORMAL.data.quantization);if(h){let b=r.POSITION.data.quantization,x=b.range;e._quantizedVolumeScale=d.fromElements(x,x,x),e._quantizedVolumeOffset=d.unpack(b.minValues),e._quantizedRange=(1<<b.quantizationBits)-1,e._isQuantizedDraco=!0}p&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties,m=i.batchTableProperties;for(let b in m)if(m.hasOwnProperty(b)){let x=r[b];c(g)||(g={}),g[b]={typedArray:x.array,componentCount:x.data.componentsPerAttribute}}c(s)&&(n.positions={typedArray:s});let y=l??a;c(y)&&(n.colors={typedArray:y}),c(u)&&(n.normals={typedArray:u}),c(f)&&(n.batchIds={typedArray:f}),n.styleableProperties=g}).catch(function(r){e._decodingState=CA.FAILED,e._error=r}))}return!0}var PAt=new se,IAt=new d;G3.prototype.update=function(e){let t=e.context;if(c(this._error)){let u=this._error;throw this._error=void 0,u}if(DAt(this,t))return;let i=!1,o=!B.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),c(this._drawCommand)||(EAt(this,e),o=!0,i=!0,this._ready=!0,this._parsedContent=void 0),o){B.clone(this.modelMatrix,this._modelMatrix);let u=this._drawCommand.modelMatrix;if(B.clone(this._modelMatrix,u),c(this._rtcCenter)&&B.multiplyByTranslation(u,this._rtcCenter,u),c(this._quantizedVolumeOffset)&&B.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==oe.SCENE3D){let h=e.mapProjection,p=B.getColumn(u,3,PAt);se.equals(p,se.UNIT_W)||Ot.basisTo2D(h,u,u)}let f=this._drawCommand.boundingVolume;if(le.clone(this._boundingSphere,f),this._cull){let h=f.center;B.multiplyByPoint(u,h,h);let p=B.getScale(u,IAt);f.radius*=d.maximumComponent(p)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);let r=this.splitDirection!==Vr.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&vAt(this,e,this._style),this._drawCommand.castShadows=xn.castShadows(this.shadows),this._drawCommand.receiveShadows=xn.receiveShadows(this.shadows);let s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?De.TRANSLUCENT:this._opaquePass;let a=e.commandList,l=e.passes;(l.render||l.pick)&&a.push(this._drawCommand)};G3.prototype.isDestroyed=function(){return!1};G3.prototype.destroy=function(){let e=this._drawCommand;return c(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),de(this)};var j3=G3;function SA(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.clock",e.clock),T.typeOf.object("options.intervals",e.intervals),this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this.shadows=e.shadows??xn.ENABLED,this.maximumMemoryUsage=e.maximumMemoryUsage??256,this.shading=new vm(e.shading),this.style=e.style,this.frameFailed=new pe,this.frameChanged=new pe,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new f_,this._loadTimestamp=void 0,this._clippingPlanesState=0,this._styleDirty=!1,this._pickId=void 0,this._totalMemoryUsageInBytes=0,this._frames=[],this._previousInterval=void 0,this._nextInterval=void 0,this._lastRenderedFrame=void 0,this._clockMultiplier=0,this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}Object.defineProperties(SA.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){gs.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(c(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}}});function OAt(e){return`uniform vec4 czm_pickColor;
${e}`}function RAt(e){return function(t){return xt(t,{czm_pickColor:function(){return e._pickId.color}})}}function MAt(){return"czm_pickColor"}SA.prototype.makeStyleDirty=function(){this._styleDirty=!0};SA.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};var LAt=new Q;function G$(e){let t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function EA(e,t){return e._intervals.indexOf(t.start)}function NAt(e,t){let n=e._intervals,i=e._clock,o=G$(e);if(o===0)return;let r=e._getAverageLoadTime(),s=Q.addSeconds(i.currentTime,r*o,LAt),a=n.indexOf(s),l=EA(e,t);return a===l&&(o>=0?++a:--a),n.get(a)}function FAt(e){let t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function BAt(e,t,n){let i=G$(e),o=EA(e,t),r=EA(e,n);return i>=0?o>=r:o<=r}function SCe(e,t){return function(n){let i=c(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0?e.frameFailed.raiseEvent({uri:t,message:i}):(console.log(`A frame failed to load: ${t}`),console.log(`Error: ${i}`))}}function kAt(e,t,n){let i=EA(e,t),o=e._frames,r=o[i];if(!c(r)){let s=t.data.transform,a=c(s)?B.fromArray(s):void 0,l=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:Ti(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber,uri:l},o[i]=r,we.fetchArrayBuffer({url:l}).then(function(u){r.pointCloud=new j3({arrayBuffer:u,cull:!0,fragmentShaderLoaded:OAt,uniformMapLoaded:RAt(e),pickIdLoaded:MAt})}).catch(SCe(e,l))}return r}function UAt(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function VAt(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);let o=t.pointCloud;if(c(o)&&!t.ready){let r=i.commandList,s=r.length;if(wCe(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){let a=(Ti()-t.timestamp)/1e3;UAt(e,a)}}t.touchedFrameNumber=i.frameNumber}var zAt=new B;function HAt(e,t){let n=e.shading;return c(n)&&c(n.baseResolution)?n.baseResolution:c(t.boundingSphere)?O.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function GAt(e){let t=e.shading;return c(t)&&c(t.maximumAttenuation)?t.maximumAttenuation:10}var jAt=new vm;function wCe(e,t,n,i){let o=e.shading??jAt,r=t.pointCloud,s=t.transform??B.IDENTITY;r.modelMatrix=B.multiplyTransformation(e.modelMatrix,s,zAt),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=HAt(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=GAt(e);try{r.update(i)}catch(a){SCe(e,t.uri)(a)}t.touchedFrameNumber=i.frameNumber}function H$(e,t,n,i){let o=kAt(e,t,i);VAt(e,o,n,i)}function WAt(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function vCe(e,t){let n=e._frames,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(c(r)&&(!c(t)||t(r))){let s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),c(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function qAt(e,t){let n=EA(e,t),i=e._frames[n];if(c(i)&&i.ready)return i}function ECe(e,t,n,i,o){return c(n)?n.ready?!0:(H$(e,t,i,o),n.ready):!1}function YAt(e,t,n,i,o){let r,s,a,l=e._intervals,u=e._frames,f=EA(e,n),h=EA(e,t);if(f>=h){for(r=f;r>=h;--r)if(s=l.get(r),a=u[r],ECe(e,s,a,i,o))return s}else for(r=f;r<=h;++r)if(s=l.get(r),a=u[r],ECe(e,s,a,i,o))return s;return t}function XAt(e,t,n){let i=e._frames,o=i.length;for(let r=0;r<o;++r){let s=i[r];c(s)&&c(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}var Uw={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};SA.prototype.update=function(e){if(e.mode===oe.MORPHING||!this.show)return;c(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),c(this._loadTimestamp)||(this._loadTimestamp=Q.clone(e.time));let t=Math.max(Q.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes,i=0,o=!1,r=c(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);let s=this._styleDirty;this._styleDirty=!1,(o||s)&&XAt(this,o,s),Uw.timeSinceLoad=t,Uw.isClipped=r;let a=this.shading,l=this._pointCloudEyeDomeLighting,u=e.commandList,f=u.length,h=this._previousInterval,p=this._nextInterval,g=FAt(this);if(!c(g))return;let m=!1,y=G$(this),b=y===0;y!==this._clockMultiplier&&(m=!0,this._clockMultiplier=y),(!c(h)||b)&&(h=g),(!c(p)||m||BAt(this,g,p))&&(p=NAt(this,g)),h=YAt(this,h,g,Uw,e);let x=qAt(this,h);c(x)||(H$(this,h,Uw,e),x=this._lastRenderedFrame),c(x)&&wCe(this,x,Uw,e),c(p)&&H$(this,p,Uw,e);let A=this;c(x)&&!c(this._lastRenderedFrame)&&e.afterRender.push(function(){return!0}),c(x)&&x!==this._lastRenderedFrame&&A.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return A.frameChanged.raiseEvent(A),!0}),this._previousInterval=h,this._nextInterval=p,this._lastRenderedFrame=x;let C=this._totalMemoryUsageInBytes,S=this.maximumMemoryUsage*1024*1024;C>S&&vCe(this,WAt(e));let P=u.length-f;c(a)&&a.attenuation&&a.eyeDomeLighting&&P>0&&l.update(e,f,a,this.boundingSphere)};SA.prototype.isDestroyed=function(){return!1};SA.prototype.destroy=function(){return vCe(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),de(this)};var Vw=SA;function ICe(e,t){if(c(t)){let n=t.clock;c(n)&&n.getValue(e)}}function KAt(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{let o=e._targetFrameRate;if(!c(o))e.resize(),e.render(),requestAnimationFrame(n);else{let r=1e3/o,s=i-t;s>r&&(e.resize(),e.render(),t=i-s%r),requestAnimationFrame(n)}}catch(o){e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors&&e.showErrorPanel("An error occurred while rendering.  Rendering has stopped.",void 0,o)}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function OCe(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,c(e._scene)&&(e._scene.pixelRatio=t),t}function RCe(e){let t=e._canvas,n=t.clientWidth,i=t.clientHeight,o=OCe(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=o,i*=o,t.width=n,t.height=i,e._canRender=n!==0&&i!==0,e._lastDevicePixelRatio=window.devicePixelRatio}function MCe(e){let t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){let o=e._scene.camera.frustum;c(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function Io(e,t){if(!c(e))throw new E("container is required.");e=In(e),t=t??W.EMPTY_OBJECT;let n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);let i=document.createElement("canvas"),o=Vt.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=Vt.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}(t.blurActiveElementOnCanvasFocus??!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);let a=document.createElement("div");a.className="cesium-widget-credits";let l=c(t.creditContainer)?In(t.creditContainer):n;l.appendChild(a);let u=c(t.creditViewport)?In(t.creditViewport):n,f=t.showRenderLoopErrors??!0,h=t.useBrowserRecommendedResolution??!0;this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=u,this._creditContainer=l,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=f,this._resolutionScale=1,this._useBrowserRecommendedResolution=h,this._forceResize=!1,this._entityView=void 0,this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._trackedEntityChanged=new pe,this._allowDataSourcesToSuspendAnimation=!0,this._clock=c(t.clock)?t.clock:new Ah,c(t.shouldAnimate)&&(this._clock.shouldAnimate=t.shouldAnimate),RCe(this);try{let p=t.ellipsoid??ie.default,g=new F3({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:u,ellipsoid:p,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:t.scene3DOnly??!1,shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=g,g.camera.constrainedAxis=d.UNIT_Z,OCe(this),MCe(this);let m=t.globe;c(m)||(m=new V2(p)),m!==!1&&(g.globe=m,g.globe.shadows=t.terrainShadows??xn.RECEIVE_ONLY);let y=t.skyBox;!c(y)&&ie.WGS84.equals(p)&&(y=k3.createEarthSkyBox()),y!==!1&&(g.skyBox=y,g.sun=new z3,ie.WGS84.equals(p)&&(g.moon=new q2));let b=t.skyAtmosphere;!c(b)&&ie.WGS84.equals(p)&&(b=new B3(p),b.show=t.globe!==!1&&m.show),b!==!1&&(g.skyAtmosphere=b);let x=t.baseLayer;if(t.globe!==!1&&x!==!1&&(c(x)||(x=Xa.fromWorldImagery()),g.imageryLayers.add(x)),c(t.terrainProvider)&&t.globe!==!1&&(g.terrainProvider=t.terrainProvider),c(t.terrain)&&t.globe!==!1){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");g.setTerrain(t.terrain)}this._screenSpaceEventHandler=new of(i),c(t.sceneMode)&&(t.sceneMode===oe.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===oe.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=t.useDefaultRenderLoop??!0,this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;let A=this;this._onRenderError=function(R,L){A._useDefaultRenderLoop=!1,A._renderLoopRunning=!1,A._showRenderLoopErrors&&A.showErrorPanel("An error occurred while rendering.  Rendering has stopped.",void 0,L)},g.renderError.addEventListener(this._onRenderError);let C=t.dataSources,S=!1;c(C)||(C=new wN,S=!0);let v=new uF({scene:g,dataSourceCollection:C}),P=new gr;this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=t.automaticallyTrackDataSourceClocks??!0,this._dataSourceCollection=C,this._destroyDataSourceCollection=S,this._dataSourceDisplay=v,this._eventHelper=P,this._canAnimateUpdateCallback=this._updateCanAnimate,P.add(this._clock.onTick,Io.prototype._onTick,this),P.add(g.morphStart,Io.prototype._clearTrackedObject,this),P.add(C.dataSourceAdded,Io.prototype._onDataSourceAdded,this),P.add(C.dataSourceRemoved,Io.prototype._onDataSourceRemoved,this),P.add(g.postRender,Io.prototype._postRender,this);let M=C.length;for(let R=0;R<M;R++)this._dataSourceAdded(C,C.get(R));this._dataSourceAdded(void 0,v.defaultDataSource),P.add(C.dataSourceAdded,Io.prototype._dataSourceAdded,this),P.add(C.dataSourceRemoved,Io.prototype._dataSourceRemoved,this)}catch(p){throw f&&this.showErrorPanel("Error constructing CesiumWidget.",'Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL.  Consider trying a different web browser or updating your video drivers.  Detailed error information is below:',p),p}}Object.defineProperties(Io.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},creditViewport:{get:function(){return this._creditViewport}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},creditDisplay:{get:function(){return this._scene.frameState.creditDisplay}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},camera:{get:function(){return this._scene.camera}},ellipsoid:{get:function(){return this._scene.ellipsoid}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){if(e<=0)throw new E("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&KAt(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new E("resolutionScale must be greater than 0.");this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,j$(this);let t=this.scene,n=t.mode;!c(e)||!c(e.position)?(this._needTrackedEntityUpdate=!1,(n===oe.COLUMBUS_VIEW||n===oe.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===oe.COLUMBUS_VIEW||n===oe.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(B.IDENTITY)):this._needTrackedEntityUpdate=!0,this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},trackedEntityChanged:{get:function(){return this._trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,ICe(this.clock,e))}}});Io.prototype.showErrorPanel=function(e,t,n){let i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";let r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);let s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);let a=document.createElement("div");a.className="cesium-widget-errorPanel-scroll",r.appendChild(a);function l(){a.style.maxHeight=`${Math.max(Math.round(i.clientHeight*.9-100),30)}px`}l(),c(window.addEventListener)&&window.addEventListener("resize",l,!1);let u=c(t),f=c(n);if(u||f){let g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),f){let m=ep(n);u||(typeof n=="string"&&(n=new Error(n)),t=ep({name:n.name,message:n.message}),m=n.stack),typeof console<"u"&&console.error(`${e}
${t}
${m}`);let y=document.createElement("div");y.className="cesium-widget-errorPanel-message-details collapsed";let b=document.createElement("span");b.className="cesium-widget-errorPanel-more-details",b.appendChild(document.createTextNode("See more...")),y.appendChild(b),y.onclick=function(x){y.removeChild(b),y.appendChild(document.createTextNode(m)),y.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",y.onclick=void 0},a.appendChild(y)}g.innerHTML=`<p>${t}</p>`}let h=document.createElement("div");h.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(h);let p=document.createElement("button");p.setAttribute("type","button"),p.className="cesium-button",p.appendChild(document.createTextNode("OK")),p.onclick=function(){c(l)&&c(window.removeEventListener)&&window.removeEventListener("resize",l,!1),i.removeChild(o)},h.appendChild(p),i.appendChild(o)};Io.prototype.isDestroyed=function(){return!1};Io.prototype.destroy=function(){let e=this.dataSources,t=e.length;for(let n=0;n<t;n++)this._dataSourceRemoved(e,e.get(n));this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),c(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),this._eventHelper.removeAll(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),de(this)};Io.prototype.resize=function(){let e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,RCe(this),MCe(this),this._scene.requestRender())};Io.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();let e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};Io.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Io.prototype._onEntityCollectionChanged,this)};Io.prototype._dataSourceRemoved=function(e,t){let n=t.entities;n.collectionChanged.removeEventListener(Io.prototype._onEntityCollectionChanged,this),c(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0)};Io.prototype._updateCanAnimate=function(e){this._clock.canAnimate=e};var $At=new le;Io.prototype._onTick=function(e){let t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&this._canAnimateUpdateCallback(n);let i=this._entityView;if(c(i)){let o=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(o,!1,i.boundingSphere??$At)===lt.DONE&&i.update(t)}};Io.prototype._onEntityCollectionChanged=function(e,t,n){let i=n.length;for(let o=0;o<i;o++){let r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0)}};Io.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};Io.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&ICe(this.clock,e)};Io.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);let n=t.entities.id,i=this._eventHelper.add(t.changedEvent,Io.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};Io.prototype._onDataSourceRemoved=function(e,t){let n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){let o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};Io.prototype.zoomTo=function(e,t){return LCe(this,e,{offset:t},!1)};Io.prototype.flyTo=function(e,t){return LCe(this,e,t,!0)};function LCe(e,t,n,i){if(!c(t))throw new E("zoomTarget is required.");j$(e);let o=new Promise(r=>{e._completeZoom=function(s){r(s)}});return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then(function(r){if(e._zoomPromise===o){if(r instanceof Xa){let s;c(r.imageryProvider)?s=Promise.resolve(r.getImageryRectangle()):s=new Promise(a=>{let l=r.readyEvent.addEventListener(()=>{l(),a(r.getImageryRectangle())})}),s.then(function(a){return VT(a,e.scene)}).then(function(a){e._zoomPromise===o&&(e._zoomTarget=a)});return}if(r instanceof bs||r instanceof Vw||r instanceof V0){e._zoomTarget=r;return}if(r.isLoading&&c(r.loadingEvent)){let s=r.loadingEvent.addEventListener(function(){s(),e._zoomPromise===o&&(e._zoomTarget=r.entities.values.slice(0))});return}if(Array.isArray(r)){e._zoomTarget=r.slice(0);return}r=r.values??r,c(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function W3(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function j$(e){let t=e._zoomPromise;c(t)&&(W3(e),e._completeZoom(!1))}Io.prototype._postRender=function(){ZAt(this),QAt(this)};var DCe=new le;function ZAt(e){let t=e._zoomTarget;if(!c(t)||e.scene.mode===oe.MORPHING)return;let n=e.scene,i=n.camera,o=e._zoomOptions??{},r;function s(f){c(o.offset)||(o.offset=new cd(0,-.5,f.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,r):(i.viewBoundingSphere(f,o.offset),i.lookAtTransform(B.IDENTITY),e._completeZoom(!0)),W3(e)}if(t instanceof Vw){if(c(t.boundingSphere)){s(t.boundingSphere);return}let f=t.frameChanged.addEventListener(function(h){s(h.boundingSphere),f()});return}if(t instanceof bs||t instanceof V0){s(t.boundingSphere);return}if(t instanceof he){r={destination:n.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyTo(r):(i.setView(r),e._completeZoom(!0)),W3(e);return}let a=t,l=[];for(let f=0,h=a.length;f<h;f++){let p=e._dataSourceDisplay.getBoundingSphere(a[f],!1,DCe);if(p===lt.PENDING)return;p!==lt.FAILED&&l.push(le.clone(DCe))}if(l.length===0){j$(e);return}e.trackedEntity=void 0;let u=le.fromBoundingSpheres(l);e._zoomIsFlight?(W3(e),i.flyToBoundingSphere(u,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(B.IDENTITY),W3(e),e._completeZoom(!0))}var PCe=new le;function QAt(e){if(!e._needTrackedEntityUpdate)return;let t=e._trackedEntity,n=e.clock.currentTime,i=X.getValueOrUndefined(t.position,n);if(!c(i))return;let o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,PCe);if(r===lt.PENDING)return;let s=o.mode;(s===oe.COLUMBUS_VIEW||s===oe.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===oe.COLUMBUS_VIEW||s===oe.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);let a=r!==lt.FAILED?PCe:void 0;e._entityView=new dF(t,o,o.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}var q3=Io;function Gw(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}var wA=new ce;function JAt(e,t,n,i){let o=i.length;for(let r=0;r<o;++r){let s=i[r];if(s.x===t&&s.y===n&&s.level===e)return!0}return!1}Gw.prototype.addAvailableTileRange=function(e,t,n,i,o){let r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let p=n;p<=o;++p)for(let g=t;g<=i;++g)JAt(e,g,p,s)||s.push(new zw(r,void 0,0,g,p));r.tileXYToRectangle(t,n,e,wA);let a=wA.west,l=wA.north;r.tileXYToRectangle(i,o,e,wA);let u=wA.east,f=wA.south,h=new oCt(e,a,f,u,l);for(let p=0;p<s.length;++p){let g=s[p];W$(g.extent,h)&&rCt(this._maximumLevel,g,h)}};Gw.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){let i=this._rootNodes[n];if(Hw(i.extent,e)){t=i;break}}return c(t)?Y3(void 0,t,e):-1};var eCt=[],tCt=[],nCt=new ce,iCt=new ce;Gw.prototype.computeBestAvailableLevelOverRectangle=function(e){let t=eCt;t.length=0,e.east<e.west?(t.push(ce.fromRadians(-Math.PI,e.south,e.east,e.north,nCt)),t.push(ce.fromRadians(e.west,e.south,Math.PI,e.north,iCt))):t.push(e);let n=tCt;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)X3(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(c(n[i])&&n[i].length===0)return i;return 0};var NCe=new he;Gw.prototype.isTileAvailable=function(e,t,n){let i=this._tilingScheme.tileXYToRectangle(t,n,e,wA);return ce.center(i,NCe),this.computeMaximumLevelAtPosition(NCe)>=e};Gw.prototype.computeChildMaskForTile=function(e,t,n){let i=e+1;if(i>=this._maximumLevel)return 0;let o=0;return o|=this.isTileAvailable(i,2*t,2*n+1)?1:0,o|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,o|=this.isTileAvailable(i,2*t,2*n)?4:0,o|=this.isTileAvailable(i,2*t+1,2*n)?8:0,o};function zw(e,t,n,i,o){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=o,this.extent=e.tileXYToRectangle(i,o,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}Object.defineProperties(zw.prototype,{nw:{get:function(){return this._nw||(this._nw=new zw(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new zw(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new zw(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new zw(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function oCt(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function W$(e,t){let n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east),r=Math.min(e.north,t.north);return i<r&&n<o}function rCt(e,t,n){for(;t.level<e;)if(MG(t.nw.extent,n))t=t.nw;else if(MG(t.ne.extent,n))t=t.ne;else if(MG(t.sw.extent,n))t=t.sw;else if(MG(t.se.extent,n))t=t.se;else break;if(t.rectangles.length===0||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let i=Lo(t.rectangles,n.level,sCt);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function sCt(e,t){return e.level-t}function MG(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Hw(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function Y3(e,t,n){let i=0,o=!1;for(;!o;){let r=t._nw&&Hw(t._nw.extent,n),s=t._ne&&Hw(t._ne.extent,n),a=t._sw&&Hw(t._sw.extent,n),l=t._se&&Hw(t._se.extent,n);if(r+s+a+l>1){r&&(i=Math.max(i,Y3(t,t._nw,n))),s&&(i=Math.max(i,Y3(t,t._ne,n))),a&&(i=Math.max(i,Y3(t,t._sw,n))),l&&(i=Math.max(i,Y3(t,t._se,n)));break}else r?t=t._nw:s?t=t._ne:a?t=t._sw:l?t=t._se:o=!0}for(;t!==e;){let r=t.rectangles;for(let s=r.length-1;s>=0&&r[s].level>i;--s){let a=r[s];Hw(a,n)&&(i=a.level)}t=t.parent}return i}function X3(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||W$(t.extent,n[i]);if(!o)return;let r=t.rectangles;for(i=0;i<r.length;++i){let s=r[i];e[s.level]||(e[s.level]=n),e[s.level]=aCt(e[s.level],s)}X3(e,t._nw,n),X3(e,t._ne,n),X3(e,t._sw,n),X3(e,t._se,n)}function aCt(e,t){let n=[];for(let i=0;i<e.length;++i){let o=e[i];W$(o,t)?(o.west<t.west&&n.push(new ce(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new ce(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new ce(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new ce(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}var Xh=Gw;var cCt=15;function FCe(e){this.ellipsoid=e.ellipsoid??ie.default,this.credit=void 0,this.tilingScheme=void 0,this.height=void 0,this.width=void 0,this.encoding=void 0,this.lodCount=void 0,this.hasAvailability=!1,this.tilesAvailable=void 0,this.tilesAvailabilityLoaded=void 0,this.levelZeroMaximumGeometricError=void 0,this.terrainDataStructure=void 0}FCe.prototype.build=function(e){e._credit=this.credit,e._tilingScheme=this.tilingScheme,e._height=this.height,e._width=this.width,e._encoding=this.encoding,e._lodCount=this.lodCount,e._hasAvailability=this.hasAvailability,e._tilesAvailable=this.tilesAvailable,e._tilesAvailabilityLoaded=this.tilesAvailabilityLoaded,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._terrainDataStructure=this.terrainDataStructure};function lCt(e,t){let n=t.copyrightText;c(n)&&(e.credit=new Tt(n));let i=t.spatialReference,o=i.latestWkid??i.wkid,r=t.extent,s={ellipsoid:e.ellipsoid};if(o===4326)s.rectangle=ce.fromDegrees(r.xmin,r.ymin,r.xmax,r.ymax),e.tilingScheme=new Ki(s);else if(o===3857){let u=Math.PI*e.ellipsoid.maximumRadius;t.extent.xmax>u&&(t.extent.xmax=u),t.extent.ymax>u&&(t.extent.ymax=u),t.extent.xmin<-u&&(t.extent.xmin=-u),t.extent.ymin<-u&&(t.extent.ymin=-u),s.rectangleSouthwestInMeters=new H(r.xmin,r.ymin),s.rectangleNortheastInMeters=new H(r.xmax,r.ymax),e.tilingScheme=new ls(s)}else throw new ae("Invalid spatial reference");let a=t.tileInfo;if(!c(a))throw new ae("tileInfo is required");e.width=a.rows+1,e.height=a.cols+1,e.encoding=a.format==="LERC"?fd.LERC:fd.NONE,e.lodCount=a.lods.length-1,(e.hasAvailability=t.capabilities.indexOf("Tilemap")!==-1)&&(e.tilesAvailable=new Xh(e.tilingScheme,e.lodCount),e.tilesAvailable.addAvailableTileRange(0,0,0,e.tilingScheme.getNumberOfXTilesAtLevel(0),e.tilingScheme.getNumberOfYTilesAtLevel(0)),e.tilesAvailabilityLoaded=new Xh(e.tilingScheme,e.lodCount)),e.levelZeroMaximumGeometricError=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.tilingScheme.ellipsoid,e.width,e.tilingScheme.getNumberOfXTilesAtLevel(0)),t.bandCount>1&&console.log("ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."),c(t.minValues)&&c(t.maxValues)?e.terrainDataStructure={elementMultiplier:1,lowestEncodedHeight:t.minValues[0],highestEncodedHeight:t.maxValues[0]}:e.terrainDataStructure={elementMultiplier:1}}async function uCt(e,t,n){try{let i=await t.fetchJson();lCt(e,i)}catch(i){let o=`An error occurred while accessing ${t}.`;throw Po.reportError(void 0,n,c(n)?n._errorEvent:void 0,o),i}}function H0(e){e=e??W.EMPTY_OBJECT,this._resource=void 0,this._credit=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._maxLevel=void 0,this._terrainDataStructure=void 0,this._width=void 0,this._height=void 0,this._encoding=void 0,this._lodCount=void 0,this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailabilityLoaded=void 0,this._availableCache={},this._errorEvent=new pe}Object.defineProperties(H0.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){return this._tilesAvailable}}});H0.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT,e=await Promise.resolve(e);let n=we.createIfNeeded(e);n.appendForwardSlash(),c(t.token)&&(n=n.getDerivedResource({queryParameters:{token:t.token}}));let i=n.getDerivedResource({queryParameters:{f:"pjson"}}),o=new FCe(t);await uCt(o,i);let r=new H0(t);return o.build(r),r._resource=n,r};H0.prototype.requestTileGeometry=function(e,t,n,i){let o=this._resource.getDerivedResource({url:`tile/${n}/${t}/${e}`,request:i}),r=this._hasAvailability,s=Promise.resolve(!0),a;if(r&&!c(q$(this,n+1,e*2,t*2))){let h=BCe(this,n+1,e*2,t*2);s=h.promise,a=h.request}let l=o.fetchArrayBuffer();if(!c(l)||!c(s))return;let u=this,f=this._tilesAvailable;return Promise.all([l,s]).then(function(h){return new qa({buffer:h[0],width:u._width,height:u._height,childTileMask:r?f.computeChildMaskForTile(n,e,t):cCt,structure:u._terrainDataStructure,encoding:u._encoding})}).catch(async function(h){if(c(a)&&a.state===$n.CANCELLED){i.cancel();try{await i.deferred?.promise}catch{}return i.state=$n.CANCELLED,Promise.reject(h)}return Promise.reject(h)})};function q$(e,t,n,i){if(!e._hasAvailability)return;let o=e._tilesAvailabilityLoaded,r=e._tilesAvailable;if(t>e._lodCount)return!1;if(r.isTileAvailable(t,n,i))return!0;if(o.isTileAvailable(t,n,i))return!1}H0.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};H0.prototype.getTileDataAvailable=function(e,t,n){if(!this._hasAvailability)return;let i=q$(this,n,e,t);if(c(i))return i;BCe(this,n,e,t)};H0.prototype.loadTileDataAvailability=function(e,t,n){};function fCt(e,t,n,i){let o=t-1,r=n-1,s=i[e.y*t+e.x],a=[],l={startX:e.x,startY:e.y,endX:0,endY:0},u=new H(e.x+1,e.y+1),f=!1,h=!1;for(;!(f&&h);){let p=u.x,g=h?u.y+1:u.y;if(!f){for(let m=e.y;m<g;++m)if(i[m*t+u.x]!==s){f=!0;break}f?(a.push(new H(u.x,e.y)),--u.x,--p,l.endX=u.x):u.x===o?(l.endX=u.x,f=!0):++u.x}if(!h){let m=u.y*t;for(let y=e.x;y<=p;++y)if(i[m+y]!==s){h=!0;break}h?(a.push(new H(e.x,u.y)),--u.y,l.endY=u.y):u.y===r?(l.endY=u.y,h=!0):++u.y}}return{endingIndices:a,range:l,value:s}}function dCt(e,t,n,i,o){let r=[];if(o.every(function(l){return l===o[0]}))return o[0]===1&&r.push({startX:e,startY:t,endX:e+n-1,endY:t+i-1}),r;let a=[new H(0,0)];for(;a.length>0;){let l=a.pop(),u=fCt(l,n,i,o);if(u.value===1){let h=u.range;h.startX+=e,h.endX+=e,h.startY+=t,h.endY+=t,r.push(h)}let f=u.endingIndices;f.length>0&&(a=a.concat(f))}return r}function BCe(e,t,n,i){if(!e._hasAvailability)return{};let o=Math.floor(n/128)*128,r=Math.floor(i/128)*128,s=Math.min(1<<t,128),a=`tilemap/${t}/${r}/${o}/${s}/${s}`,l=e._availableCache;if(c(l[a]))return l[a];let u=new Qo({throttle:!1,throttleByServer:!0,type:ms.TERRAIN}),h=e._resource.getDerivedResource({url:a,request:u}).fetchJson();return c(h)?(h=h.then(function(p){let g=dCt(o,r,s,s,p.data);e._tilesAvailabilityLoaded.addAvailableTileRange(t,o,r,o+s,r+s);let m=e._tilesAvailable;for(let y=0;y<g.length;++y){let b=g[y];m.addAvailableTileRange(t,b.startX,b.startY,b.endX,b.endY)}return q$(e,t,n,i)}),l[a]={promise:h,request:u},h=h.finally(function(p){return delete l[a],p}),{promise:h,request:u}):{}}var Y$=H0;var kCe="https://dev.virtualearth.net/REST/v1/Locations";function X$(e){e=e??W.EMPTY_OBJECT;let t=e.key;if(!c(t))throw new E("options.key is required.");this._key=t;let n={key:t};c(e.culture)&&(n.culture=e.culture),this._resource=new we({url:kCe,queryParameters:n}),this._credit=new Tt('<img src="http://dev.virtualearth.net/Branding/logo_powered_by.png"/>',!1)}Object.defineProperties(X$.prototype,{url:{get:function(){return kCe}},key:{get:function(){return this._key}},credit:{get:function(){return this._credit}}});X$.prototype.geocode=async function(e){return T.typeOf.string("query",e),this._resource.getDerivedResource({queryParameters:{query:e}}).fetchJsonp("jsonp").then(function(n){return n.resourceSets.length===0?[]:n.resourceSets[0].resources.map(function(o){let r=o.bbox,s=r[0],a=r[1],l=r[2],u=r[3];return{displayName:o.name,destination:ce.fromDegrees(a,s,u,l)}})})};var K$=X$;function $$(){}Object.defineProperties($$.prototype,{credit:{get:function(){}}});$$.prototype.geocode=function(e){T.typeOf.string("query",e);let t=e.match(/[^\s,\n]+/g);if(t.length===2||t.length===3){let n=+t[0],i=+t[1],o=t.length===3?+t[2]:300;if(isNaN(n)&&isNaN(i)){let r=/^(\d+.?\d*)([nsew])/i;for(let s=0;s<t.length;++s){let a=t[s].match(r);r.test(t[s])&&a.length===3&&(/^[ns]/i.test(a[2])?i=/^[n]/i.test(a[2])?+a[1]:-a[1]:/^[ew]/i.test(a[2])&&(n=/^[e]/i.test(a[2])?+a[1]:-a[1]))}}if(!isNaN(n)&&!isNaN(i)&&!isNaN(o)){let r={displayName:e,destination:d.fromDegrees(n,i,o)};return Promise.resolve([r])}}return Promise.resolve([])};var Z$=$$;var hCt=new se,UCe=new d,jw=new d;function mCt(e){let t=e.points,n=e.times;if(t.length<3){let i=n[0],o=1/(n[1]-i),r=t[0],s=t[1];return function(a,l){c(l)||(l=new d);let u=(a-i)*o;return d.lerp(r,s,u,l)}}return function(i,o){c(o)||(o=new d);let r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=hCt;a.z=s,a.y=s*s,a.x=a.y*s,a.w=1;let l,u,f,h,p;return r===0?(l=t[0],u=t[1],f=e.firstTangent,h=d.subtract(t[2],l,UCe),d.multiplyByScalar(h,.5,h),p=B.multiplyByVector(Iy.hermiteCoefficientMatrix,a,a)):r===t.length-2?(l=t[r],u=t[r+1],h=e.lastTangent,f=d.subtract(u,t[r-1],UCe),d.multiplyByScalar(f,.5,f),p=B.multiplyByVector(Iy.hermiteCoefficientMatrix,a,a)):(l=t[r-1],u=t[r],f=t[r+1],h=t[r+2],p=B.multiplyByVector(G0.catmullRomCoefficientMatrix,a,a)),o=d.multiplyByScalar(l,p.x,o),d.multiplyByScalar(u,p.y,jw),d.add(o,jw,o),d.multiplyByScalar(f,p.z,jw),d.add(o,jw,o),d.multiplyByScalar(h,p.w,jw),d.add(o,jw,o)}}var pCt=new d,_Ct=new d;function G0(e){e=e??W.EMPTY_OBJECT;let t=e.points,n=e.times,i=e.firstTangent,o=e.lastTangent;if(T.defined("points",t),T.defined("times",n),T.typeOf.number.greaterThanOrEquals("points.length",t.length,2),T.typeOf.number.equals("times.length","points.length",n.length,t.length),t.length>2&&(c(i)||(i=pCt,d.multiplyByScalar(t[1],2,i),d.subtract(i,t[2],i),d.subtract(i,t[0],i),d.multiplyByScalar(i,.5,i)),!c(o))){let r=t.length-1;o=_Ct,d.multiplyByScalar(t[r-1],2,o),d.subtract(t[r],o,o),d.add(o,t[r-2],o),d.multiplyByScalar(o,.5,o)}this._times=n,this._points=t,this._firstTangent=d.clone(i),this._lastTangent=d.clone(o),this._evaluateFunction=mCt(this),this._lastTimeIndex=0}Object.defineProperties(G0.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},firstTangent:{get:function(){return this._firstTangent}},lastTangent:{get:function(){return this._lastTangent}}});G0.catmullRomCoefficientMatrix=new B(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0);G0.prototype.findTimeInterval=Ni.prototype.findTimeInterval;G0.prototype.wrapTime=Ni.prototype.wrapTime;G0.prototype.clampTime=Ni.prototype.clampTime;G0.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};var Q$=G0;var LG={};LG.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){if(!c(e))throw new E("threshold is required.");if(!c(t))throw new E("keepAbove is required.");if(!c(n))throw new E("u0 is required.");if(!c(i))throw new E("u1 is required.");if(!c(o))throw new E("u2 is required.");c(r)?r.length=0:r=[];let s,a,l;t?(s=n<e,a=i<e,l=o<e):(s=n>e,a=i>e,l=o>e);let u=s+a+l,f,h,p,g,m,y;return u===1?s?(f=(e-n)/(i-n),h=(e-n)/(o-n),r.push(1),r.push(2),h!==1&&(r.push(-1),r.push(0),r.push(2),r.push(h)),f!==1&&(r.push(-1),r.push(0),r.push(1),r.push(f))):a?(p=(e-i)/(o-i),g=(e-i)/(n-i),r.push(2),r.push(0),g!==1&&(r.push(-1),r.push(1),r.push(0),r.push(g)),p!==1&&(r.push(-1),r.push(1),r.push(2),r.push(p))):l&&(m=(e-o)/(n-o),y=(e-o)/(i-o),r.push(0),r.push(1),y!==1&&(r.push(-1),r.push(2),r.push(1),r.push(y)),m!==1&&(r.push(-1),r.push(2),r.push(0),r.push(m))):u===2?!s&&n!==e?(g=(e-i)/(n-i),m=(e-o)/(n-o),r.push(0),r.push(-1),r.push(1),r.push(0),r.push(g),r.push(-1),r.push(2),r.push(0),r.push(m)):!a&&i!==e?(y=(e-o)/(i-o),f=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(y),r.push(-1),r.push(0),r.push(1),r.push(f)):!l&&o!==e&&(h=(e-n)/(o-n),p=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(h),r.push(-1),r.push(1),r.push(2),r.push(p)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};LG.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,l){if(!c(e))throw new E("x is required.");if(!c(t))throw new E("y is required.");if(!c(n))throw new E("x1 is required.");if(!c(i))throw new E("y1 is required.");if(!c(o))throw new E("x2 is required.");if(!c(r))throw new E("y2 is required.");if(!c(s))throw new E("x3 is required.");if(!c(a))throw new E("y3 is required.");let u=n-s,f=s-o,h=r-a,p=i-a,g=1/(h*u+f*p),m=t-a,y=e-s,b=(h*y+f*m)*g,x=(-p*y+u*m)*g,A=1-b-x;return c(l)?(l.x=b,l.y=x,l.z=A,l):new d(b,x,A)};LG.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,l){T.typeOf.number("x00",e),T.typeOf.number("y00",t),T.typeOf.number("x01",n),T.typeOf.number("y01",i),T.typeOf.number("x10",o),T.typeOf.number("y10",r),T.typeOf.number("x11",s),T.typeOf.number("y11",a);let u=(s-o)*(t-r)-(a-r)*(e-o),f=(n-e)*(t-r)-(i-t)*(e-o),h=(a-r)*(n-e)-(s-o)*(i-t);if(h===0)return;let p=u/h,g=f/h;if(p>=0&&p<=1&&g>=0&&g<=1)return c(l)||(l=new H),l.x=e+p*(n-e),l.y=t+p*(i-t),l};var Pg=LG;function j0(e){if(!c(e)||!c(e.quantizedVertices))throw new E("options.quantizedVertices is required.");if(!c(e.indices))throw new E("options.indices is required.");if(!c(e.minimumHeight))throw new E("options.minimumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.boundingSphere))throw new E("options.boundingSphere is required.");if(!c(e.horizonOcclusionPoint))throw new E("options.horizonOcclusionPoint is required.");if(!c(e.westIndices))throw new E("options.westIndices is required.");if(!c(e.southIndices))throw new E("options.southIndices is required.");if(!c(e.eastIndices))throw new E("options.eastIndices is required.");if(!c(e.northIndices))throw new E("options.northIndices is required.");if(!c(e.westSkirtHeight))throw new E("options.westSkirtHeight is required.");if(!c(e.southSkirtHeight))throw new E("options.southSkirtHeight is required.");if(!c(e.eastSkirtHeight))throw new E("options.eastSkirtHeight is required.");if(!c(e.northSkirtHeight))throw new E("options.northSkirtHeight is required.");this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;let t=this._quantizedVertices.length/3,n=this._uValues=this._quantizedVertices.subarray(0,t),i=this._vValues=this._quantizedVertices.subarray(t,2*t);this._heightValues=this._quantizedVertices.subarray(2*t,3*t);function o(s,a){return i[s]-i[a]}function r(s,a){return n[s]-n[a]}this._westIndices=FG(e.westIndices,o,t),this._southIndices=FG(e.southIndices,r,t),this._eastIndices=FG(e.eastIndices,o,t),this._northIndices=FG(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=e.childTileMask??15,this._createdByUpsampling=e.createdByUpsampling??!1,this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(j0.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return c(this._mesh)}}});var NG=[];function FG(e,t,n){NG.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)NG[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(NG.sort(t),Fe.createTypedArray(n,NG)):e}var VCe="createVerticesFromQuantizedTerrainMesh",gCt=new yi(VCe),yCt=new yi(VCe,kh.maximumAsynchronousTasks);j0.prototype.createMesh=function(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=e.exaggeration??1,s=e.exaggerationRelativeHeight??0,a=e.throttle??!0,l=t.ellipsoid,u=t.tileXYToRectangle(n,i,o),h=(a?yCt:gCt).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:u,relativeToCenter:this._boundingSphere.center,ellipsoid:l,exaggeration:r,exaggerationRelativeHeight:s});if(!c(h))return;let p=this;return Promise.resolve(h).then(function(g){let m=p._quantizedVertices.length/3,y=m+p._westIndices.length+p._southIndices.length+p._eastIndices.length+p._northIndices.length,b=Fe.createTypedArray(y,g.indices),x=new Float32Array(g.vertices),A=g.center,C=g.minimumHeight,S=g.maximumHeight,v=p._boundingSphere,P=p._orientedBoundingBox,M=d.clone(g.occludeePointInScaledSpace)??p._horizonOcclusionPoint,R=g.vertexStride,L=Oc.clone(g.encoding);return p._mesh=new hd(A,x,b,g.indexCountWithoutSkirts,m,C,S,v,M,R,P,L,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),p._quantizedVertices=void 0,p._encodedNormals=void 0,p._indices=void 0,p._uValues=void 0,p._vValues=void 0,p._heightValues=void 0,p._westIndices=void 0,p._southIndices=void 0,p._eastIndices=void 0,p._northIndices=void 0,p._mesh})};var bCt=new yi("upsampleQuantizedTerrainMesh",kh.maximumAsynchronousTasks);j0.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");let l=this._mesh;if(!c(this._mesh))return;let u=t*2!==o,f=n*2===r,h=e.ellipsoid,p=e.tileXYToRectangle(o,r,s),g=bCt.scheduleTask({vertices:l.vertices,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,indices:l.indices,indexCountWithoutSkirts:l.indexCountWithoutSkirts,encoding:l.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:f,childRectangle:p,ellipsoid:h});if(!c(g))return;let m=Math.min(this._westSkirtHeight,this._eastSkirtHeight);m=Math.min(m,this._southSkirtHeight),m=Math.min(m,this._northSkirtHeight);let y=u?m*.5:this._westSkirtHeight,b=f?m*.5:this._southSkirtHeight,x=u?this._eastSkirtHeight:m*.5,A=f?this._northSkirtHeight:m*.5,C=this._credits;return Promise.resolve(g).then(function(S){let v=new Uint16Array(S.vertices),P=Fe.createTypedArray(v.length/3,S.indices),M;return c(S.encodedNormals)&&(M=new Uint8Array(S.encodedNormals)),new j0({quantizedVertices:v,indices:P,encodedNormals:M,minimumHeight:S.minimumHeight,maximumHeight:S.maximumHeight,boundingSphere:le.clone(S.boundingSphere),orientedBoundingBox:Dn.clone(S.orientedBoundingBox),horizonOcclusionPoint:d.clone(S.horizonOcclusionPoint),westIndices:S.westIndices,southIndices:S.southIndices,eastIndices:S.eastIndices,northIndices:S.northIndices,westSkirtHeight:y,southSkirtHeight:b,eastSkirtHeight:x,northSkirtHeight:A,childTileMask:0,credits:C,createdByUpsampling:!0})})};var J$=32767,zCe=new d;j0.prototype.interpolateHeight=function(e,t,n){let i=O.clamp((t-e.west)/e.width,0,1);i*=J$;let o=O.clamp((n-e.south)/e.height,0,1);return o*=J$,c(this._mesh)?CCt(this,i,o):ECt(this,i,o)};function HCe(e,t,n,i,o,r,s,a){let l=Math.min(n,o,s),u=Math.max(n,o,s),f=Math.min(i,r,a),h=Math.max(i,r,a);return e>=l&&e<=u&&t>=f&&t<=h}var xCt=new H,TCt=new H,ACt=new H;function CCt(e,t,n){let i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,l=s.length;a<l;a+=3){let u=s[a],f=s[a+1],h=s[a+2],p=r.decodeTextureCoordinates(o,u,xCt),g=r.decodeTextureCoordinates(o,f,TCt),m=r.decodeTextureCoordinates(o,h,ACt);if(HCe(t,n,p.x,p.y,g.x,g.y,m.x,m.y)){let y=Pg.computeBarycentricCoordinates(t,n,p.x,p.y,g.x,g.y,m.x,m.y,zCe);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){let b=r.decodeHeight(o,u),x=r.decodeHeight(o,f),A=r.decodeHeight(o,h);return y.x*b+y.y*x+y.z*A}}}}function ECt(e,t,n){let i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,l=s.length;a<l;a+=3){let u=s[a],f=s[a+1],h=s[a+2],p=i[u],g=i[f],m=i[h],y=o[u],b=o[f],x=o[h];if(HCe(t,n,p,y,g,b,m,x)){let A=Pg.computeBarycentricCoordinates(t,n,p,y,g,b,m,x,zCe);if(A.x>=-1e-15&&A.y>=-1e-15&&A.z>=-1e-15){let C=A.x*r[u]+A.y*r[f]+A.z*r[h];return O.lerp(e._minimumHeight,e._maximumHeight,C/J$)}}}}j0.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};j0.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var vA=j0;function SCt(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function jCe(e){this.requestVertexNormals=e.requestVertexNormals??!1,this.requestWaterMask=e.requestWaterMask??!1,this.requestMetadata=e.requestMetadata??!0,this.ellipsoid=e.ellipsoid??ie.default,this.heightmapWidth=65,this.heightmapStructure=void 0,this.hasWaterMask=!1,this.hasMetadata=!1,this.hasVertexNormals=!1,this.scheme=void 0,this.lastResource=void 0,this.layerJsonResource=void 0,this.previousError=void 0,this.availability=void 0,this.tilingScheme=void 0,this.levelZeroMaximumGeometricError=void 0,this.heightmapStructure=void 0,this.layers=[],this.attribution="",this.overallAvailability=[],this.overallMaxZoom=0,this.tileCredits=[]}jCe.prototype.build=function(e){e._heightmapWidth=this.heightmapWidth,e._scheme=this.scheme;let t=c(this.lastResource.credits)?this.lastResource.credits:[];e._tileCredits=t.concat(this.tileCredits),e._availability=this.availability,e._tilingScheme=this.tilingScheme,e._requestWaterMask=this.requestWaterMask,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._heightmapStructure=this.heightmapStructure,e._layers=this.layers,e._hasWaterMask=this.hasWaterMask,e._hasVertexNormals=this.hasVertexNormals,e._hasMetadata=this.hasMetadata};async function WCe(e,t,n){if(!t.format){let y="The tile format is not specified in the layer.json file.";throw e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,y),new ae(y)}if(!t.tiles||t.tiles.length===0){let y="The layer.json file does not specify any tile URL templates.";throw e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,y),new ae(y)}let i=!1,o=!1,r=!1,s=!0,a=!1;if(t.format==="heightmap-1.0")a=!0,c(e.heightmapStructure)||(e.heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),o=!0,e.requestWaterMask=!0;else if(t.format.indexOf("quantized-mesh-1.")!==0){let y=`The tile format "${t.format}" is invalid or not supported.`;throw e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,y),new ae(y)}let l=t.tiles,u=t.maxzoom;if(e.overallMaxZoom=Math.max(e.overallMaxZoom,u),!t.projection||t.projection==="EPSG:4326")e.tilingScheme=new Ki({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else if(t.projection==="EPSG:3857")e.tilingScheme=new ls({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else{let y=`The projection "${t.projection}" is invalid or not supported.`;throw e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,y),new ae(y)}if(e.levelZeroMaximumGeometricError=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.tilingScheme.ellipsoid,e.heightmapWidth,e.tilingScheme.getNumberOfXTilesAtLevel(0)),!t.scheme||t.scheme==="tms"||t.scheme==="slippyMap")e.scheme=t.scheme;else{let y=`The scheme "${t.scheme}" is invalid or not supported.`;throw e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,y),new ae(y)}let f;c(t.extensions)&&t.extensions.indexOf("octvertexnormals")!==-1?i=!0:c(t.extensions)&&t.extensions.indexOf("vertexnormals")!==-1&&(i=!0,s=!1),c(t.extensions)&&t.extensions.indexOf("watermask")!==-1&&(o=!0),c(t.extensions)&&t.extensions.indexOf("metadata")!==-1&&(r=!0);let h=t.metadataAvailability,p=t.available,g;if(c(p)&&!c(h)){g=new Xh(e.tilingScheme,p.length);for(let y=0;y<p.length;++y){let b=p[y],x=e.tilingScheme.getNumberOfYTilesAtLevel(y);c(e.overallAvailability[y])||(e.overallAvailability[y]=[]);for(let A=0;A<b.length;++A){let C=b[A],S=x-C.endY-1,v=x-C.startY-1;e.overallAvailability[y].push([C.startX,S,C.endX,v]),g.addAvailableTileRange(y,C.startX,S,C.endX,v)}}}else c(h)&&(f=new Xh(e.tilingScheme,u),g=new Xh(e.tilingScheme,u),e.overallAvailability[0]=[[0,0,1,0]],g.addAvailableTileRange(0,0,0,1,0));e.hasWaterMask=e.hasWaterMask||o,e.hasVertexNormals=e.hasVertexNormals||i,e.hasMetadata=e.hasMetadata||r,c(t.attribution)&&(e.attribution.length>0&&(e.attribution+=" "),e.attribution+=t.attribution),e.layers.push(new SCt({resource:e.lastResource,version:t.version,isHeightmap:a,tileUrlTemplates:l,availability:g,hasVertexNormals:i,hasWaterMask:o,hasMetadata:r,availabilityLevels:h,availabilityTilesLoaded:f,littleEndianExtensionSize:s}));let m=t.parentUrl;return c(m)?c(g)?(e.lastResource=e.lastResource.getDerivedResource({url:m}),e.lastResource.appendForwardSlash(),e.layerJsonResource=e.lastResource.getDerivedResource({url:"layer.json"}),await nZ(e),!0):(console.log("A layer.json can't have a parentUrl if it does't have an available array."),!0):!0}function wCt(e,t,n){let i=`An error occurred while accessing ${e.layerJsonResource.url}.`;if(c(t)&&(i+=`
${t.message}`),e.previousError=Po.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,i),e.previousError.retry)return nZ(e,n);throw new ae(i)}async function vCt(e,t,n){await WCe(e,t,n);let i=e.overallAvailability.length;if(i>0){let o=e.availability=new Xh(e.tilingScheme,e.overallMaxZoom);for(let r=0;r<i;++r){let s=e.overallAvailability[r];for(let a=0;a<s.length;++a){let l=s[a];o.addAvailableTileRange(r,l[0],l[1],l[2],l[3])}}}if(e.attribution.length>0){let o=new Tt(e.attribution);e.tileCredits.push(o)}return!0}async function nZ(e,t){try{let n=await e.layerJsonResource.fetchJson();return vCt(e,n,t)}catch(n){return c(n)&&n.statusCode===404?(await WCe(e,{tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]},t),!0):wCt(e,n,t)}}function Kh(e){e=e??W.EMPTY_OBJECT,this._heightmapWidth=void 0,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._hasMetadata=!1,this._scheme=void 0,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=e.requestVertexNormals??!1,this._requestWaterMask=e.requestWaterMask??!1,this._requestMetadata=e.requestMetadata??!0,this._errorEvent=new pe;let t=e.credit;typeof t=="string"&&(t=new Tt(t)),this._credit=t,this._availability=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._layers=void 0,this._tileCredits=void 0}var eZ={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function GCe(e){return!c(e)||e.length===0?{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function DCt(e,t,n,i,o){let r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new qa({buffer:r,childTileMask:new Uint8Array(t,r.byteLength,1)[0],waterMask:new Uint8Array(t,r.byteLength+1,t.byteLength-r.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function PCt(e,t,n,i,o,r){let s=r.littleEndianExtensionSize,a=0,l=3,u=l+1,f=Float64Array.BYTES_PER_ELEMENT*l,h=Float64Array.BYTES_PER_ELEMENT*u,g=Uint16Array.BYTES_PER_ELEMENT*3,m=3,y=Uint16Array.BYTES_PER_ELEMENT,b=y*m,x=new DataView(t),A=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=f;let C=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let S=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let v=new le(new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0)),x.getFloat64(a+f,!0));a+=h;let P=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=f;let M=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let R=new Uint16Array(t,a,M*3);a+=M*g,M>64*1024&&(y=Uint32Array.BYTES_PER_ELEMENT,b=y*m);let L=R.subarray(0,M),F=R.subarray(M,2*M),_=R.subarray(M*2,3*M);Ln.zigZagDeltaDecode(L,F,_),a%y!==0&&(a+=y-a%y);let w=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let D=Fe.createTypedArrayFromArrayBuffer(M,t,a,w*m);a+=w*b;let I=0,N=D.length;for(let ue=0;ue<N;++ue){let ye=D[ue];D[ue]=I-ye,ye===0&&++I}let k=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let z=Fe.createTypedArrayFromArrayBuffer(M,t,a,k);a+=k*y;let V=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let j=Fe.createTypedArrayFromArrayBuffer(M,t,a,V);a+=V*y;let U=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let q=Fe.createTypedArrayFromArrayBuffer(M,t,a,U);a+=U*y;let Y=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let te=Fe.createTypedArrayFromArrayBuffer(M,t,a,Y);a+=Y*y;let K,Z;for(;a<x.byteLength;){let ue=x.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;let ye=x.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,ue===eZ.OCT_VERTEX_NORMALS&&e._requestVertexNormals)K=new Uint8Array(t,a,M*2);else if(ue===eZ.WATER_MASK&&e._requestWaterMask)Z=new Uint8Array(t,a,ye);else if(ue===eZ.METADATA&&e._requestMetadata){let Ae=x.getUint32(a,!0);if(Ae>0){let Ee=ir(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,Ae).available;if(c(Ee))for(let ze=0;ze<Ee.length;++ze){let qe=n+ze+1,it=Ee[ze],Dt=e._tilingScheme.getNumberOfYTilesAtLevel(qe);for(let jt=0;jt<it.length;++jt){let $e=it[jt],un=Dt-$e.endY-1,zt=Dt-$e.startY-1;e.availability.addAvailableTileRange(qe,$e.startX,un,$e.endX,zt),r.availability.addAvailableTileRange(qe,$e.startX,un,$e.endX,zt)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=ye}let ee=e.getLevelMaximumGeometricError(n)*5,me=e._tilingScheme.tileXYToRectangle(i,o,n),Te=Dn.fromRectangle(me,C,S,e._tilingScheme.ellipsoid);return new vA({center:A,minimumHeight:C,maximumHeight:S,boundingSphere:v,orientedBoundingBox:Te,horizonOcclusionPoint:P,quantizedVertices:R,encodedNormals:K,indices:D,westIndices:z,southIndices:j,eastIndices:q,northIndices:te,westSkirtHeight:ee,southSkirtHeight:ee,eastSkirtHeight:ee,northSkirtHeight:ee,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:Z,credits:e._tileCredits})}Kh.prototype.requestTileGeometry=function(e,t,n,i){let o=this._layers,r,s=o.length,a=!1,l=Promise.resolve();if(s===1)r=o[0];else for(let u=0;u<s;++u){let f=o[u];if(!c(f.availability)||f.availability.isTileAvailable(n,e,t)){r=f;break}let h=iZ(this,e,t,n,f,u===0);h.result&&(a=!0,l=l.then(()=>h.promise))}return!c(r)&&a?l.then(()=>new Promise(u=>{setTimeout(()=>{let f=this.requestTileGeometry(e,t,n,i);u(f)},0)})):qCe(this,e,t,n,r,i)};function qCe(e,t,n,i,o,r){if(!c(o))return Promise.reject(new ae("Terrain tile doesn't exist"));let s=o.tileUrlTemplates;if(s.length===0)return;let a;!e._scheme||e._scheme==="tms"?a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1:a=n;let l=[];e._requestVertexNormals&&o.hasVertexNormals&&l.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&l.push("watermask"),e._requestMetadata&&o.hasMetadata&&l.push("metadata");let u,f,h=s[(t+a+i)%s.length],p=o.resource;c(p._ionEndpoint)&&!c(p._ionEndpoint.externalType)?(l.length!==0&&(f={extensions:l.join("-")}),u=GCe(void 0)):u=GCe(l);let g=p.getDerivedResource({url:h,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:f,headers:u,request:r}).fetchArrayBuffer();if(c(g))return g.then(function(m){return c(m)?c(e._heightmapStructure)?DCt(e,m,i,t,n):PCt(e,m,i,t,n,o):Promise.reject(new ae("Mesh buffer doesn't exist."))})}Object.defineProperties(Kh.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){return this._availability}}});Kh.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};Kh.fromIonAssetId=async function(e,t){T.defined("assetId",e);let n=await Cu.fromAssetId(e);return Kh.fromUrl(n,t)};Kh.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT,e=await Promise.resolve(e);let n=we.createIfNeeded(e);n.appendForwardSlash();let i=new jCe(t);i.lastResource=n,i.layerJsonResource=i.lastResource.getDerivedResource({url:"layer.json"}),await nZ(i);let o=new Kh(t);return i.build(o),o};Kh.prototype.getTileDataAvailable=function(e,t,n){if(!c(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;let i=this._layers,o=i.length;for(let r=0;r<o;++r)if(iZ(this,e,t,n,i[r],r===0).result)return;return!1};Kh.prototype.loadTileDataAvailability=function(e,t,n){if(!c(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;let i=this._layers,o=i.length;for(let r=0;r<o;++r){let s=iZ(this,e,t,n,i[r],r===0);if(c(s.promise))return s.promise}};function tZ(e,t,n,i){if(i===0)return;let o=e.availabilityLevels,r=i%o===0?i-o:(i/o|0)*o,s=1<<i-r,a=t/s|0,l=n/s|0;return{level:r,x:a,y:l}}function iZ(e,t,n,i,o,r){if(!c(o.availabilityLevels))return{result:!1};let s,a=function(){delete o.availabilityPromiseCache[s]},l=o.availabilityTilesLoaded,u=o.availability,f=tZ(o,t,n,i);for(;c(f);){if(u.isTileAvailable(f.level,f.x,f.y)&&!l.isTileAvailable(f.level,f.x,f.y)){let h;if(!r&&(s=`${f.level}-${f.x}-${f.y}`,h=o.availabilityPromiseCache[s],!c(h))){let p=new Qo({throttle:!1,throttleByServer:!0,type:ms.TERRAIN});h=qCe(e,f.x,f.y,f.level,o,p),c(h)&&(o.availabilityPromiseCache[s]=h,h.then(a))}return{result:!0,promise:h}}f=tZ(o,f.x,f.y,f.level)}return{result:!1}}Kh._getAvailabilityTile=tZ;var DA=Kh;function Ig(e){e=e??W.EMPTY_OBJECT;let t=e.radius;T.typeOf.number("radius",t);let n={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,vertexFormat:e.vertexFormat,stRotation:e.stRotation,shadowVolume:e.shadowVolume};this._ellipseGeometry=new dl(n),this._workerName="createCircleGeometry"}Ig.packedLength=dl.packedLength;Ig.pack=function(e,t,n){return T.typeOf.object("value",e),dl.pack(e._ellipseGeometry,t,n)};var YCe=new dl({center:new d,semiMajorAxis:1,semiMinorAxis:1}),$a={center:new d,radius:void 0,ellipsoid:ie.clone(ie.default),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new Ie,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0,shadowVolume:void 0};Ig.unpack=function(e,t,n){let i=dl.unpack(e,t,YCe);return $a.center=d.clone(i._center,$a.center),$a.ellipsoid=ie.clone(i._ellipsoid,$a.ellipsoid),$a.ellipsoid=ie.clone(i._ellipsoid,YCe._ellipsoid),$a.height=i._height,$a.extrudedHeight=i._extrudedHeight,$a.granularity=i._granularity,$a.vertexFormat=Ie.clone(i._vertexFormat,$a.vertexFormat),$a.stRotation=i._stRotation,$a.shadowVolume=i._shadowVolume,c(n)?($a.semiMajorAxis=i._semiMajorAxis,$a.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new dl($a),n):($a.radius=i._semiMajorAxis,new Ig($a))};Ig.createGeometry=function(e){return dl.createGeometry(e._ellipseGeometry)};Ig.createShadowVolume=function(e,t,n){let i=e._ellipseGeometry._granularity,o=e._ellipseGeometry._ellipsoid,r=t(i,o),s=n(i,o);return new Ig({center:e._ellipseGeometry._center,radius:e._ellipseGeometry._semiMajorAxis,ellipsoid:o,stRotation:e._ellipseGeometry._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(Ig.prototype,{rectangle:{get:function(){return this._ellipseGeometry.rectangle}},textureCoordinateRotationPoints:{get:function(){return this._ellipseGeometry.textureCoordinateRotationPoints}}});var oZ=Ig;function Ww(e){e=e??W.EMPTY_OBJECT;let t=e.radius;T.typeOf.number("radius",t);let n={center:e.center,semiMajorAxis:t,semiMinorAxis:t,ellipsoid:e.ellipsoid,height:e.height,extrudedHeight:e.extrudedHeight,granularity:e.granularity,numberOfVerticalLines:e.numberOfVerticalLines};this._ellipseGeometry=new Hu(n),this._workerName="createCircleOutlineGeometry"}Ww.packedLength=Hu.packedLength;Ww.pack=function(e,t,n){return T.typeOf.object("value",e),Hu.pack(e._ellipseGeometry,t,n)};var ICt=new Hu({center:new d,semiMajorAxis:1,semiMinorAxis:1}),cf={center:new d,radius:void 0,ellipsoid:ie.clone(ie.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,numberOfVerticalLines:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0};Ww.unpack=function(e,t,n){let i=Hu.unpack(e,t,ICt);return cf.center=d.clone(i._center,cf.center),cf.ellipsoid=ie.clone(i._ellipsoid,cf.ellipsoid),cf.height=i._height,cf.extrudedHeight=i._extrudedHeight,cf.granularity=i._granularity,cf.numberOfVerticalLines=i._numberOfVerticalLines,c(n)?(cf.semiMajorAxis=i._semiMajorAxis,cf.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new Hu(cf),n):(cf.radius=i._semiMajorAxis,new Ww(cf))};Ww.createGeometry=function(e){return Hu.createGeometry(e._ellipseGeometry)};var rZ=Ww;function OCt(e){return e=e??W.EMPTY_OBJECT,DA.fromIonAssetId(2426648,{requestVertexNormals:e.requestVertexNormals??!1})}var K3=OCt;function RCt(e){return e=e??W.EMPTY_OBJECT,DA.fromIonAssetId(1,{requestVertexNormals:e.requestVertexNormals??!1,requestWaterMask:e.requestWaterMask??!1,ellipsoid:ie.WGS84})}var PA=RCt;function qw(e){e=e??W.EMPTY_OBJECT,T.defined("options.callback",e.callback),T.defined("options.width",e.width),T.defined("options.height",e.height),this._callback=e.callback,this._tilingScheme=e.tilingScheme,c(this._tilingScheme)||(this._tilingScheme=new Ki({ellipsoid:e.ellipsoid??ie.default})),this._width=e.width,this._height=e.height;let t=Math.max(this._width,this._height);this._levelZeroMaximumGeometricError=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,t,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new pe;let n=e.credit;typeof n=="string"&&(n=new Tt(n)),this._credit=n}Object.defineProperties(qw.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});qw.prototype.requestTileGeometry=function(e,t,n,i){let o=this._callback(e,t,n);if(!c(o))return;let r=this._width,s=this._height;return Promise.resolve(o).then(function(a){let l=a;return Array.isArray(l)&&(l=new Float64Array(l)),new qa({buffer:l,width:r,height:s})})};qw.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};qw.prototype.getTileDataAvailable=function(e,t,n){};qw.prototype.loadTileDataAvailability=function(e,t,n){};var sZ=qw;var MCt=1953029805,LCt=2917034100;function aZ(e,t){if(aZ.passThroughDataForTesting)return t;T.typeOf.object("key",e),T.typeOf.object("data",t);let n=e.byteLength;if(n===0||n%4!==0)throw new ae("The length of key must be greater than 0 and a multiple of 4.");let i=new DataView(t),o=i.getUint32(0,!0);if(o===MCt||o===LCt)return t;let r=new DataView(e),s=0,a=t.byteLength,l=a-a%8,u=n,f,h=8;for(;s<l;)for(h=(h+8)%24,f=h;s<l&&f<u;)i.setUint32(s,i.getUint32(s,!0)^r.getUint32(f,!0),!0),i.setUint32(s+4,i.getUint32(s+4,!0)^r.getUint32(f+4,!0),!0),s+=8,f+=24;if(s<a)for(f>=u&&(h=(h+8)%24,f=h);s<a;)i.setUint8(s,i.getUint8(s)^r.getUint8(f)),s++,f++}aZ.passThroughDataForTesting=!1;var $3=aZ;function XCe(e){this.proxy=e}XCe.prototype.getURL=function(e){let t=this.proxy.indexOf("?")===-1?"?":"";return this.proxy+t+encodeURIComponent(e)};var cZ=XCe;function KCe(e,t){return ws("defaultValue","defaultValue has been deprecated and will be removed in Cesium 1.134. Use the nullish coalescing operator instead: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing"),e??t}Object.defineProperty(KCe,"EMPTY_OBJECT",{get:function(){return ws("defaultValue.EMPTY_OBJECT","defaultValue.EMPTY_OBJECT has been deprecated and will be removed in Cesium 1.134. Use Frozen.EMPTY_OBJECT instead"),W.EMPTY_OBJECT}});var lZ=KCe;function BG(){E.throwInstantiationError()}Object.defineProperties(BG.prototype,{credit:{get:E.throwInstantiationError}});BG.getCreditsFromResult=function(e){if(c(e.attributions))return e.attributions.map(Tt.getIonCredit)};BG.prototype.geocode=E.throwInstantiationError;var Yw=BG;var NCt={SEARCH:0,AUTOCOMPLETE:1},W0=Object.freeze(NCt);function $Ce(){E.throwInstantiationError()}$Ce.createGeometry=function(e){E.throwInstantiationError()};var uZ=$Ce;var zCt=Zo(fZ(),1);function FCt(e,t){return(e&t)!==0}var Fc=FCt;var BCt=[1,2,4,8],ZCe=15,kCt=16,UCt=64,VCt=128;function gp(e,t,n,i,o,r){this._bits=e,this.cnodeVersion=t,this.imageryVersion=n,this.terrainVersion=i,this.imageryProvider=o,this.terrainProvider=r,this.ancestorHasTerrain=!1,this.terrainState=void 0}gp.clone=function(e,t){return c(t)?(t._bits=e._bits,t.cnodeVersion=e.cnodeVersion,t.imageryVersion=e.imageryVersion,t.terrainVersion=e.terrainVersion,t.imageryProvider=e.imageryProvider,t.terrainProvider=e.terrainProvider):t=new gp(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t};gp.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()};gp.prototype.hasSubtree=function(){return Fc(this._bits,kCt)};gp.prototype.hasImagery=function(){return Fc(this._bits,UCt)};gp.prototype.hasTerrain=function(){return Fc(this._bits,VCt)};gp.prototype.hasChildren=function(){return Fc(this._bits,ZCe)};gp.prototype.hasChild=function(e){return Fc(this._bits,BCt[e])};gp.prototype.getChildBitmask=function(){return this._bits&ZCe};var Z3=gp;function HCt(e){let t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n);for(let o=0;o<t;++o)i[o]=e.charCodeAt(o);return n}var GCt=HCt(`E\xF4\xBD\vy\xE2jE"\x92,\xCDq\xF8IFgQ\0B%\xC6\xE8a,f)\b\xC64\xDCjb%y
wmi\xD6\xF0\x9Ck\x93\xA1\xBDNu\xE0A[\xDF@V\f\xD9\xBBr\x9B\x81|3S\xEEOl\xD4q\xB0{\xC0\x7FEVZ\xADwUe\v3\x92*\xACl5\xC50s\xF83>mF8J\xB4\xDD\xF0.\xDDu\xDA\x8CDt"\xFAa"\f3"So\xAF9D\v\x8C9\xD99L\xB9\xBF\x7F\xAB\\\x8CP_\x9F"ux\xE9\x07q\x91h;\xC1\xC4\x9B\x7F\xF0<VqH\x82'UfYNe\x98u\xA3aF}a?A\0\x9F\xD7\xB44M\xCE\x87F\xB0\xD5\xB8\x8A'{\x8B\xDC+\xBBMg0\xC8\xD1\xF6\\\x8FP\xFA[/F\x9Bn5/'C.\xEB
\f^\xA5s\x1Be4\xE5l.jC'c#U\xA9?q{gC}:\xAF\xCD\xE2TU\x9C\xFDK\xC6\xE2\x9F/(\xED\xCB\\\xC6-f\x07\x88\xA7;/*"N\xB0k.\xDD\r\x95}}G\xBAC\xB2\xB2+>M\xAA>}\xE6\xCEI\x89\xC6\xE6x\fa1-\xA4O\xA5~q \x88\xEC\r1\xE8N\v\0nPh}=\b\r\x95\xA6n\xA3h\x97$[k\xF3#\xF3\xB6s\xB3\r\v@\xC0\x9F\xD8Q]\xFA".j\xDFI\0\xB9\xA0wU\xC6\xEFj\xBF{GL\x7F\x83\xEE\xDC\xDCF\x85\xA9\xADS\x07+S4\x07\xFF\x94Y\xE48\xE81\x83N\xB9XFk\xCB-#\x86\x92p\x005\x88"\xCF1\xB2&/\xE7\xC3u-6,rt\xB0#G\xB7\xD3\xD1&\x857r\xE2\0\x8CD\xCF\xDA3-\xDE\`\x86i#i*|\xCDKQ\r\x95T9w.)\xEA\x1B\xA6P\xA2j\x8FoP\x99\\>T\xFB\xEFP[\v\x07E\x89m(w7\xDB\x8EJfJo\x99 \xE5p\xE2\xB9q~\fmI-z\xFEr\xC7\xF2Y0\x8F\xBB]s\xE5\xC9 \xEAx\xEC \x90\xF0\x8A\x7FB|G\`\xB0\xBD&\xB7q\xB6\xC7\x9F\xD13\x82=\xD3\xAB\xEEc\x99\xC8+S\xA0D\\q\xC6\xCCD2O<\xCA\xC0)=R\xD3aX\xA9}e\xB4\xDC\xCF\r\xF4=\xF1\b\xA9B\xDA#	\xD8\xBF^PI\xF8M\xC0\xCBGLO\xF7{+\xD8\xC51\x92;\xB5o\xDCl\r\x92\x88\xD1\x9E\xDB?\xE2\xE9\xDA_\xD4\x84\xE2FaZ\xDEU\xCF\xA4\0\xBE\xFD\xCEg\xF1Ji\x97\xE6 H\xD8]\x7F~\xAEq N\xAE\xC0V\xA9\x91<\x82r\xE7v\xEC)I\xD6]-\x83\xE3\xDB6\xA9;f\x97\x87j\xD5\xB6=P^R\xB9K\xC7sWx\xC9\xF4.Y\x07\x95\x93o\xD0KW>''\xC7\`\xDB;\xED\x9ASD>?\x8D\x92mw\xA2
\xEB?R\xA8\xC6U^1I7\x85\xF4\xC5&-\xA9\xBF\x8B'T\xDA\xC3j \xE5*x\xB0\xD6\x90pr\xAA\x8Bh\xBD\x88\xF7_H\xB1~\xC0XL?f\xF9>\xE1e\xC0p\xA7\xCF8i\xAF\xF0VldI\x9C'\xADxtO\xC2\x87\xDEV9\0\xDAw\v\xCB-\x1B\x89\xFB5O\xF5\bQ\`\xC1
ZGM&30x\xDA\xC0\x9CFG\xE2[y\`In7gS
>\xE9\xECF9\xB2\xF14\r\xC6\x84Sun\xE1\fY\xD9\xDE)\x85{II\xA5wy\xBEIV.6\xE7\v:\xBBOb{\xD2M1\x95/\xBD8{\xA8O!\xE1\xECFpv\x95})"x\x88
\x90\xDD\x9D\\\xDA\xDEQ\xCF\xF0\xFCYRe|3\xDF\xF3H\xDA\xBB*u\xDB\`\xB2\xD4\xFC\xED\x1B\xEC\x7F5\xA8\xFF(1\x07-\xC8\xDC\x88F|\x8A["`);function lf(e){this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=O.EPSILON12,this.providers={},this.key=void 0,this._resource=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={}}Object.defineProperties(lf.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}}});lf.fromUrl=async function(e){T.defined("resourceOrUrl",e);let t=e;typeof t!="string"&&!(t instanceof we)&&(T.typeOf.string("resourceOrUrl.url",e.url),t=e.url);let n=we.createIfNeeded(t);n.appendForwardSlash();let i=new lf;i._resource=n;try{await jCt(i),await i.getQuadTreePacket("",i._quadPacketVersion)}catch(o){let r=`An error occurred while accessing ${JCe(i,"",1).url}: ${o}`;throw new ae(r)}return i};lf.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;Fc(t,r)?Fc(e,r)&&(s|=1):(s|=2,Fc(e,r)||(s|=1)),i+=s}return i};lf.quadKeyToTileXY=function(e){let t=0,n=0,i=e.length-1;for(let o=i;o>=0;--o){let r=1<<o,s=+e[i-o];Fc(s,2)?Fc(s,1)||(t|=r):(n|=r,Fc(s,1)&&(t|=r))}return{x:t,y:n,level:i}};lf.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(c(t))return t!==null;let n=!0,i=e,o;for(;i.length>1;)if(o=i.substring(i.length-1),i=i.substring(0,i.length-1),t=this.getTileInformationFromQuadKey(i),c(t)){!t.hasSubtree()&&!t.hasChild(parseInt(o))&&(n=!1);break}else if(t===null){n=!1;break}return n};var QCe=new yi("decodeGoogleEarthEnterprisePacket");lf.prototype.getQuadTreePacket=function(e,t,n){t=t??1,e=e??"";let o=JCe(this,e,t,n).fetchArrayBuffer();if(!c(o))return;let r=this._tileInfo,s=this.key;return o.then(function(a){return QCe.scheduleTask({buffer:a,quadKey:e,type:"Metadata",key:s},[a]).then(function(u){let f,h=-1;if(e!==""){h=e.length+1;let m=u[e];f=r[e],f._bits|=m._bits,delete u[e]}let p=Object.keys(u);p.sort(function(m,y){return m.length-y.length});let g=p.length;for(let m=0;m<g;++m){let y=p[m];if(u[y]!==null){let x=Z3.clone(u[y]),A=y.length;if(A===h)x.setParent(f);else if(A>1){let C=r[y.substring(0,y.length-1)];x.setParent(C)}r[y]=x}else r[y]=null}})})};lf.prototype.populateSubtree=function(e,t,n,i){let o=lf.tileXYToQuadKey(e,t,n);return mZ(this,o,i)};function mZ(e,t,n){let i=e._tileInfo,o=t,r=i[o];if(c(r)&&(!r.hasSubtree()||r.hasChildren()))return r;for(;r===void 0&&o.length>1;)o=o.substring(0,o.length-1),r=i[o];let s,a=e._subtreePromises,l=a[o];if(c(l))return l.then(function(){return s=new Qo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),mZ(e,t,s)});if(!c(r)||!r.hasSubtree())return Promise.reject(new ae(`Couldn't load metadata for tile ${t}`));if(l=e.getQuadTreePacket(o,r.cnodeVersion,n),!!c(l))return a[o]=l,l.then(function(){return s=new Qo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),mZ(e,t,s)}).finally(function(){delete a[o]})}lf.prototype.getTileInformation=function(e,t,n){let i=lf.tileXYToQuadKey(e,t,n);return this._tileInfo[i]};lf.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]};function JCe(e,t,n,i){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${n.toString()}`,request:i})}var dZ,hZ;function jCt(e){let t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!c(hZ)){let n=tn("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;hZ=ab(n).then(function(){dZ=window.cesiumGoogleEarthDbRootParser(zCt),c(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return hZ.then(function(){return t.fetchArrayBuffer()}).then(function(n){let i=dZ.EncryptedDbRootProto.decode(new Uint8Array(n)),o=i.encryptionData,r=o.byteOffset,s=r+o.byteLength,a=e.key=o.buffer.slice(r,s);o=i.dbrootData,r=o.byteOffset,s=r+o.byteLength;let l=o.buffer.slice(r,s);return QCe.scheduleTask({buffer:l,type:"DbRoot",key:a},[l])}).then(function(n){let i=dZ.DbRootProto.decode(new Uint8Array(n.buffer));if(e.imageryPresent=i.imageryPresent??e.imageryPresent,e.protoImagery=i.protoImagery,e.terrainPresent=i.terrainPresent??e.terrainPresent,c(i.endSnippet)&&c(i.endSnippet.model)){let a=i.endSnippet.model;e.negativeAltitudeExponentBias=a.negativeAltitudeExponentBias??e.negativeAltitudeExponentBias,e.negativeAltitudeThreshold=a.compressedNegativeAltitudeThreshold??e.negativeAltitudeThreshold}c(i.databaseVersion)&&(e._quadPacketVersion=i.databaseVersion.quadtreeVersion??e._quadPacketVersion);let o=e.providers,r=i.providerInfo??[],s=r.length;for(let a=0;a<s;++a){let l=r[a],u=l.copyrightString;c(u)&&(o[l.providerId]=new Tt(u.value))}}).catch(function(){console.log(`Failed to retrieve ${t.url}. Using defaults.`),e.key=GCt})}var Og=lf;function IA(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.buffer",e.buffer),T.typeOf.number("options.negativeAltitudeExponentBias",e.negativeAltitudeExponentBias),T.typeOf.number("options.negativeElevationThreshold",e.negativeElevationThreshold),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;let t=e.childTileMask??15,n=t&3;n|=t&4?8:0,n|=t&8?4:0,this._childTileMask=n,this._createdByUpsampling=e.createdByUpsampling??!1,this._skirtHeight=void 0,this._bufferType=this._buffer.constructor,this._mesh=void 0,this._minimumHeight=void 0,this._maximumHeight=void 0}Object.defineProperties(IA.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});var nEe="createVerticesFromGoogleEarthEnterpriseBuffer",WCt=new yi(nEe),qCt=new yi(nEe,kh.maximumAsynchronousTasks),eEe=new ce,pZ=new ce;IA.prototype.createMesh=function(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=e.exaggeration??1,s=e.exaggerationRelativeHeight??0,a=e.throttle??!0,l=t.ellipsoid;t.tileXYToNativeRectangle(n,i,o,eEe),t.tileXYToRectangle(n,i,o,pZ);let u=l.cartographicToCartesian(ce.center(pZ)),h=40075.16/(1<<o);this._skirtHeight=Math.min(h*8,1e3);let g=(a?qCt:WCt).scheduleTask({buffer:this._buffer,nativeRectangle:eEe,rectangle:pZ,relativeToCenter:u,ellipsoid:l,skirtHeight:this._skirtHeight,exaggeration:r,exaggerationRelativeHeight:s,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(!c(g))return;let m=this;return g.then(function(y){return m._mesh=new hd(u,new Float32Array(y.vertices),new Uint16Array(y.indices),y.indexCountWithoutSkirts,y.vertexCountWithoutSkirts,y.minimumHeight,y.maximumHeight,le.clone(y.boundingSphere3D),d.clone(y.occludeePointInScaledSpace),y.numberOfAttributes,Dn.clone(y.orientedBoundingBox),Oc.clone(y.encoding),y.westIndicesSouthToNorth,y.southIndicesEastToWest,y.eastIndicesNorthToSouth,y.northIndicesWestToEast),m._minimumHeight=y.minimumHeight,m._maximumHeight=y.maximumHeight,m._buffer=void 0,m._mesh})};IA.prototype.interpolateHeight=function(e,t,n){let i=O.clamp((t-e.west)/e.width,0,1),o=O.clamp((n-e.south)/e.height,0,1);return c(this._mesh)?ZCt(this,i,o):eEt(this,i,o,e)};var YCt=new yi("upsampleQuantizedTerrainMesh",kh.maximumAsynchronousTasks);IA.prototype.upsample=function(e,t,n,i,o,r,s){if(T.typeOf.object("tilingScheme",e),T.typeOf.number("thisX",t),T.typeOf.number("thisY",n),T.typeOf.number("thisLevel",i),T.typeOf.number("descendantX",o),T.typeOf.number("descendantY",r),T.typeOf.number("descendantLevel",s),s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");let l=this._mesh;if(!c(this._mesh))return;let u=t*2!==o,f=n*2===r,h=e.ellipsoid,p=e.tileXYToRectangle(o,r,s),g=YCt.scheduleTask({vertices:l.vertices,indices:l.indices,indexCountWithoutSkirts:l.indexCountWithoutSkirts,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,encoding:l.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:f,childRectangle:p,ellipsoid:h});if(!c(g))return;let m=this;return g.then(function(y){let b=new Uint16Array(y.vertices),x=Fe.createTypedArray(b.length/3,y.indices),A=m._skirtHeight;return new vA({quantizedVertices:b,indices:x,minimumHeight:y.minimumHeight,maximumHeight:y.maximumHeight,boundingSphere:le.clone(y.boundingSphere),orientedBoundingBox:Dn.clone(y.orientedBoundingBox),horizonOcclusionPoint:d.clone(y.horizonOcclusionPoint),westIndices:y.westIndices,southIndices:y.southIndices,eastIndices:y.eastIndices,northIndices:y.northIndices,westSkirtHeight:A,southSkirtHeight:A,eastSkirtHeight:A,northSkirtHeight:A,childTileMask:0,createdByUpsampling:!0,credits:m._credits})})};IA.prototype.isChildAvailable=function(e,t,n,i){T.typeOf.number("thisX",e),T.typeOf.number("thisY",t),T.typeOf.number("childX",n),T.typeOf.number("childY",i);let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};IA.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var XCt=new H,KCt=new H,$Ct=new H,iEe=new d;function ZCt(e,t,n){let i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,l=s.length;a<l;a+=3){let u=s[a],f=s[a+1],h=s[a+2],p=r.decodeTextureCoordinates(o,u,XCt),g=r.decodeTextureCoordinates(o,f,KCt),m=r.decodeTextureCoordinates(o,h,$Ct),y=Pg.computeBarycentricCoordinates(t,n,p.x,p.y,g.x,g.y,m.x,m.y,iEe);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){let b=r.decodeHeight(o,u),x=r.decodeHeight(o,f),A=r.decodeHeight(o,h);return y.x*b+y.y*x+y.z*A}}}var QCt=Uint16Array.BYTES_PER_ELEMENT,tEe=Uint32Array.BYTES_PER_ELEMENT,_Z=Int32Array.BYTES_PER_ELEMENT,JCt=Float32Array.BYTES_PER_ELEMENT,gZ=Float64Array.BYTES_PER_ELEMENT;function eEt(e,t,n,i){let o=e._buffer,r=0,s=0,a=0;n>.5?(t>.5?(r=2,s=.5):r=3,a=.5):t>.5&&(r=1,s=.5);let l=new DataView(o),u=0;for(let v=0;v<r;++v)u+=l.getUint32(u,!0),u+=tEe;u+=tEe,u+=2*gZ;let f=O.toRadians(l.getFloat64(u,!0)*180);u+=gZ;let h=O.toRadians(l.getFloat64(u,!0)*180);u+=gZ;let p=i.width/f/2,g=i.height/h/2,m=l.getInt32(u,!0);u+=_Z;let y=l.getInt32(u,!0)*3;u+=_Z,u+=_Z;let b=new Array(m),x=new Array(m),A=new Array(m),C;for(C=0;C<m;++C)b[C]=s+l.getUint8(u++)*p,x[C]=a+l.getUint8(u++)*g,A[C]=l.getFloat32(u,!0)*6371010,u+=JCt;let S=new Array(y);for(C=0;C<y;++C)S[C]=l.getUint16(u,!0),u+=QCt;for(C=0;C<y;C+=3){let v=S[C],P=S[C+1],M=S[C+2],R=b[v],L=b[P],F=b[M],_=x[v],w=x[P],D=x[M],I=Pg.computeBarycentricCoordinates(t,n,R,_,L,w,F,D,iEe);if(I.x>=-1e-15&&I.y>=-1e-15&&I.z>=-1e-15)return I.x*A[v]+I.y*A[P]+I.z*A[M]}}var Xw=IA;var Cd={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},kG=new Q;function UG(){this._terrainCache={},this._lastTidy=Q.now()}UG.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:Q.now()}};UG.prototype.get=function(e){let n=this._terrainCache[e];if(c(n))return delete this._terrainCache[e],n.buffer};UG.prototype.tidy=function(){if(Q.now(kG),Q.secondsDifference(kG,this._lastTidy)>10){let e=this._terrainCache,t=Object.keys(e),n=t.length;for(let i=0;i<n;++i){let o=t[i],r=e[o];Q.secondsDifference(kG,r.timestamp)>10&&delete e[o]}Q.clone(kG,this._lastTidy)}};function q0(e){e=e??W.EMPTY_OBJECT,this._tilingScheme=new Ki({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-O.PI,-O.PI,O.PI,O.PI),ellipsoid:e.ellipsoid});let t=e.credit;typeof t=="string"&&(t=new Tt(t)),this._credit=t,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new UG,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new pe}Object.defineProperties(q0.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tilingScheme:{get:function(){return this._tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});q0.fromMetadata=function(e,t){if(T.defined("metadata",e),!e.terrainPresent)throw new ae(`The server ${e.url} doesn't have terrain`);let n=new q0(t);return n._metadata=e,n};var tEt=new yi("decodeGoogleEarthEnterprisePacket");function oEe(e,t,n){let i=t.getChildBitmask();if(t.terrainState===Cd.PARENT){i=0;for(let o=0;o<4;++o){let r=n.getTileInformationFromQuadKey(e+o.toString());c(r)&&r.hasTerrain()&&(i|=1<<o)}}return i}q0.prototype.requestTileGeometry=function(e,t,n,i){let o=Og.tileXYToQuadKey(e,t,n),r=this._terrainCache,s=this._metadata,a=s.getTileInformationFromQuadKey(o);if(!c(a))return Promise.reject(new ae("Terrain tile doesn't exist"));let l=a.terrainState;c(l)||(l=a.terrainState=Cd.UNKNOWN);let u=r.get(o);if(c(u)){let x=s.providers[a.terrainProvider];return Promise.resolve(new Xw({buffer:u,childTileMask:oEe(o,a,s),credits:c(x)?[x]:void 0,negativeAltitudeExponentBias:s.negativeAltitudeExponentBias,negativeElevationThreshold:s.negativeAltitudeThreshold}))}if(r.tidy(),a.ancestorHasTerrain){if(l===Cd.NONE)return Promise.reject(new ae("Terrain tile doesn't exist"))}else return Promise.resolve(new qa({buffer:new Uint8Array(16*16),width:16,height:16}));let f,h=o,p=-1;switch(l){case Cd.SELF:p=a.terrainVersion;break;case Cd.PARENT:h=h.substring(0,h.length-1),f=s.getTileInformationFromQuadKey(h),p=f.terrainVersion;break;case Cd.UNKNOWN:a.hasTerrain()?p=a.terrainVersion:(h=h.substring(0,h.length-1),f=s.getTileInformationFromQuadKey(h),c(f)&&f.hasTerrain()&&(p=f.terrainVersion));break}if(p<0)return Promise.reject(new ae("Terrain tile doesn't exist"));let g=this._terrainPromises,m=this._terrainRequests,y,b;if(c(g[h]))y=g[h],b=m[h];else{b=i;let x=nEt(this,h,p,b).fetchArrayBuffer();if(!c(x))return;y=x.then(function(A){return c(A)?tEt.scheduleTask({buffer:A,type:"Terrain",key:s.key},[A]).then(function(C){let S=s.getTileInformationFromQuadKey(h);S.terrainState=Cd.SELF,r.add(h,C[0]);let v=S.terrainProvider,P=C.length-1;for(let M=0;M<P;++M){let R=h+M.toString(),L=s.getTileInformationFromQuadKey(R);c(L)&&(r.add(R,C[M+1]),L.terrainState=Cd.PARENT,L.terrainProvider===0&&(L.terrainProvider=v))}}):Promise.reject(new ae("Failed to load terrain."))}),g[h]=y,m[h]=b,y=y.finally(function(){delete g[h],delete m[h]})}return y.then(function(){let x=r.get(o);if(c(x)){let A=s.providers[a.terrainProvider];return new Xw({buffer:x,childTileMask:oEe(o,a,s),credits:c(A)?[A]:void 0,negativeAltitudeExponentBias:s.negativeAltitudeExponentBias,negativeElevationThreshold:s.negativeAltitudeThreshold})}return Promise.reject(new ae("Failed to load terrain."))}).catch(function(x){return b.state===$n.CANCELLED?(i.state=b.state,Promise.reject(x)):(a.terrainState=Cd.NONE,Promise.reject(x))})};q0.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};q0.prototype.getTileDataAvailable=function(e,t,n){let i=this._metadata,o=Og.tileXYToQuadKey(e,t,n),r=i.getTileInformation(e,t,n);if(r===null)return!1;if(c(r)){if(!r.ancestorHasTerrain)return!0;let s=r.terrainState;if(s===Cd.NONE)return!1;if((!c(s)||s===Cd.UNKNOWN)&&(r.terrainState=Cd.UNKNOWN,!r.hasTerrain())){o=o.substring(0,o.length-1);let a=i.getTileInformationFromQuadKey(o);if(!c(a)||!a.hasTerrain())return!1}return!0}if(i.isValid(o)){let s=new Qo({throttle:!1,throttleByServer:!0,type:ms.TERRAIN});i.populateSubtree(e,t,n,s)}return!1};q0.prototype.loadTileDataAvailability=function(e,t,n){};function nEt(e,t,n,i){return n=c(n)&&n>0?n:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1c-0${t}-t.${n.toString()}`,request:i})}var yZ=q0;var iEt="https://maps.googleapis.com/maps/api/geocode/json",rEe='<img alt="Google" src="https://assets.ion.cesium.com/google-credit.png" style="vertical-align:-5px">';function bZ(e){e=e??W.EMPTY_OBJECT;let t=e.key;if(!c(t))throw new E("options.key is required.");this._resource=new we({url:iEt,queryParameters:{key:t}}),this._credit=new Tt(rEe,!0)}Object.defineProperties(bZ.prototype,{credit:{get:function(){return this._credit}}});bZ.prototype.geocode=async function(e){T.typeOf.string("query",e);let n=await this._resource.getDerivedResource({queryParameters:{address:e}}).fetchJson();if(n.status==="ZERO_RESULTS")return[];if(n.status!=="OK")throw new ae(`GoogleGeocoderService got a bad response ${n.status}: ${n.error_message}`);return n.results.map(o=>{let r=o.geometry.viewport.southwest,s=o.geometry.viewport.northeast;return{displayName:o.formatted_address,destination:ce.fromDegrees(r.lng,r.lat,s.lng,s.lat),attribution:{html:rEe,collapsible:!1}}})};var xZ=bZ;var VG={};VG.defaultApiKey=void 0;VG.mapTilesApiEndpoint=new we({url:"https://tile.googleapis.com/v1/"});VG.getDefaultCredit=function(){return new Tt('<img src="https://assets.ion.cesium.com/google-credit.png" style="vertical-align: -5px" alt="Google">',!0)};var OA=VG;var Q3={};Q3.type=void 0;Q3.getRequiredDataPoints=E.throwInstantiationError;Q3.interpolateOrderZero=E.throwInstantiationError;Q3.interpolate=E.throwInstantiationError;var TZ=Q3;var oEt={GOOGLE:"GOOGLE",BING:"BING",DEFAULT:"DEFAULT"},Rg=Object.freeze(oEt);function AZ(e){T.defined("url",e),this._url=we.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(AZ.prototype,{url:{get:function(){return this._url}},credit:{get:function(){}}});AZ.prototype.geocode=async function(e,t){return T.typeOf.string("query",e),this._url.getDerivedResource({url:t===W0.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r,s=o.bbox;if(c(s))r=ce.fromDegrees(s[0],s[1],s[2],s[3]);else{let a=o.geometry.coordinates[0],l=o.geometry.coordinates[1];r=d.fromDegrees(a,l)}return{displayName:o.properties.label,destination:r,attributions:i.attributions}})})};var J3=AZ;function sEe(e){if(!Object.values(Rg).some(t=>t===e))throw new E(`Invalid geocodeProviderType: "${e}"`)}var aEe=Object.freeze({[Rg.GOOGLE]:"google",[Rg.BING]:"bing",[Rg.DEFAULT]:void 0});function rEt(e){return aEe[e]}function sEt(e){return Object.entries(aEe).find(t=>t[1]===e)[0]}function CZ(e){e=e??W.EMPTY_OBJECT,T.typeOf.object("options.scene",e.scene);let t=e.geocodeProviderType??Rg.DEFAULT;sEe(t);let n=e.accessToken??Xd.defaultAccessToken,i=we.createIfNeeded(e.server??Xd.defaultServer);i.appendForwardSlash();let o=Xd.getDefaultTokenCredit(n);c(o)&&e.scene.frameState.creditDisplay.addStaticCredit(Tt.clone(o));let r=i.getDerivedResource({url:"v1/geocode"});c(n)&&r.appendQueryParameters({access_token:n}),this._accessToken=n,this._server=i,this._pelias=new J3(r),this.geocodeProviderType=t}Object.defineProperties(CZ.prototype,{credit:{get:function(){}},geocodeProviderType:{get:function(){return sEt(this._pelias.url.queryParameters.geocoder)},set:function(e){sEe(e);let t={...this._pelias.url.queryParameters,geocoder:rEt(e)};c(t.geocoder)||delete t.geocoder,this._pelias.url.setQueryParameters(t)}}});CZ.prototype.geocode=async function(e,t){return this._pelias.geocode(e,t)};var RA=CZ;var Oo={};Oo.ExportStatus=Object.freeze({NotStarted:"NotStarted",InProgress:"InProgress",Complete:"Complete",Invalid:"Invalid"});Oo.ExportType=Object.freeze({IMODEL:"IMODEL",CESIUM:"CESIUM","3DTILES":"3DTILES"});Oo.RealityDataType=Object.freeze({Cesium3DTiles:"Cesium3DTiles",PNTS:"PNTS",RealityMesh3DTiles:"RealityMesh3DTiles",Terrain3DTiles:"Terrain3DTiles",KML:"KML",GeoJSON:"GeoJSON",Unstructured:"Unstructured"});Oo.defaultAccessToken=void 0;Oo.defaultShareKey=void 0;Oo._getAuthorizationHeader=function(){if(!c(Oo.defaultAccessToken)&&!c(Oo.defaultShareKey))throw new E("Must set ITwinPlatform.defaultAccessToken or ITwinPlatform.defaultShareKey first");return c(Oo.defaultShareKey)?`Basic ${Oo.defaultShareKey}`:`Bearer ${Oo.defaultAccessToken}`};Oo.apiEndpoint=new we({url:"https://api.bentley.com"});Oo.getExports=async function(e){if(T.typeOf.string("iModelId",e),!c(Oo.defaultAccessToken)&&!c(Oo.defaultShareKey))throw new E("Must set ITwinPlatform.defaultAccessToken or ITwinPlatform.defaultShareKey first");let t=new we({url:`${Oo.apiEndpoint}mesh-export`,headers:{Authorization:Oo._getAuthorizationHeader(),Accept:"application/vnd.bentley.itwin-platform.v1+json",Prefer:"return=representation"},queryParameters:{iModelId:e,exportType:Oo.ExportType["3DTILES"],$top:"5",client:"CesiumJS"}});typeof CESIUM_VERSION<"u"&&t.appendQueryParameters({clientVersion:CESIUM_VERSION});try{return await t.fetchJson()}catch(n){let i=JSON.parse(n.response);if(n.statusCode===401){let o=i.error.details?.[0].code??"";throw new ae(`Unauthorized, bad token, wrong scopes or headers bad. ${o}`)}else{if(n.statusCode===403)throw console.error(i.error.code,i.error.message),new ae("Not allowed, forbidden");if(n.statusCode===422)throw new ae(`Unprocessable Entity:${i.error.code} ${i.error.message}`);if(n.statusCode===429)throw new ae("Too many requests")}throw new ae(`Unknown request failure ${n.statusCode}`)}};Oo.getRealityDataMetadata=async function(e,t){if(T.typeOf.string("iTwinId",e),T.typeOf.string("realityDataId",t),!c(Oo.defaultAccessToken)&&!c(Oo.defaultShareKey))throw new E("Must set ITwinPlatform.defaultAccessToken or ITwinPlatform.defaultShareKey first");let n=new we({url:`${Oo.apiEndpoint}reality-management/reality-data/${t}`,headers:{Authorization:Oo._getAuthorizationHeader(),Accept:"application/vnd.bentley.itwin-platform.v1+json"},queryParameters:{iTwinId:e}});try{return(await n.fetchJson()).realityData}catch(i){let o=JSON.parse(i.response);if(i.statusCode===401){let r=o.error.details?.[0].code??"";throw new ae(`Unauthorized, bad token, wrong scopes or headers bad. ${r}`)}else{if(i.statusCode===403)throw console.error(o.error.code,o.error.message),new ae("Not allowed, forbidden");if(i.statusCode===404)throw new ae(`Reality data not found: ${e}, ${t}`);if(i.statusCode===422)throw new ae(`Unprocessable Entity:${o.error.code} ${o.error.message}`);if(i.statusCode===429)throw new ae("Too many requests")}throw new ae(`Unknown request failure ${i.statusCode}`)}};Oo.getRealityDataURL=async function(e,t,n){if(T.typeOf.string("iTwinId",e),T.typeOf.string("realityDataId",t),T.typeOf.string("rootDocument",n),!c(Oo.defaultAccessToken)&&!c(Oo.defaultShareKey))throw new E("Must set ITwinPlatform.defaultAccessToken or ITwinPlatform.defaultShareKey first");let i=new we({url:`${Oo.apiEndpoint}reality-management/reality-data/${t}/readaccess`,headers:{Authorization:Oo._getAuthorizationHeader(),Accept:"application/vnd.bentley.itwin-platform.v1+json"},queryParameters:{iTwinId:e}});try{let r=(await i.fetchJson())._links.containerUrl.href,s=new URL(r);return s.pathname=`${s.pathname}/${n}`,s.toString()}catch(o){let r=JSON.parse(o.response);if(o.statusCode===401){let s=r.error.details?.[0].code??"";throw new ae(`Unauthorized, bad token, wrong scopes or headers bad. ${s}`)}else{if(o.statusCode===403)throw console.error(r.error.code,r.error.message),new ae("Not allowed, forbidden");if(o.statusCode===404)throw new ae(`Reality data not found: ${e}, ${t}`);if(o.statusCode===422)throw new ae(`Unprocessable Entity:${r.error.code} ${r.error.message}`);if(o.statusCode===429)throw new ae("Too many requests")}throw new ae(`Unknown request failure ${o.statusCode}`)}};var us=Oo;function zG(){E.throwInstantiationError()}Object.defineProperties(zG.prototype,{ellipsoid:{get:E.throwInstantiationError}});zG.prototype.project=E.throwInstantiationError;zG.prototype.unproject=E.throwInstantiationError;var EZ=zG;function Kw(e){e=e??W.EMPTY_OBJECT;let t=e.weights,n=e.times;if(T.defined("weights",t),T.defined("times",n),T.typeOf.number.greaterThanOrEquals("weights.length",t.length,3),t.length%n.length!==0)throw new E("times.length must be a factor of weights.length.");this._times=n,this._weights=t,this._count=t.length/n.length,this._lastTimeIndex=0}Object.defineProperties(Kw.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}});Kw.prototype.findTimeInterval=Ni.prototype.findTimeInterval;Kw.prototype.wrapTime=Ni.prototype.wrapTime;Kw.prototype.clampTime=Ni.prototype.clampTime;Kw.prototype.evaluate=function(e,t){let n=this.weights,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);c(t)||(t=new Array(this._count));for(let s=0;s<this._count;s++){let a=o*this._count+s;t[s]=n[a]*(1-r)+n[a+this._count]*r}return t};var SZ=Kw;function wZ(e,t,n){T.defined("url",e),T.defined("apiKey",t),c(n)&&T.typeOf.object("params",n),e=we.createIfNeeded(e),e.appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=n??{},this._credit=new Tt('Geodata copyright <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',!1)}Object.defineProperties(wZ.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}},credit:{get:function(){return this._credit}}});wZ.prototype.geocode=async function(e){return T.typeOf.string("query",e),this._url.getDerivedResource({url:"json",queryParameters:xt(this._params,{q:e})}).fetchJson().then(function(n){return n.results.map(function(i){let o,r=i.bounds;if(c(r))o=ce.fromDegrees(r.southwest.lng,r.southwest.lat,r.northeast.lng,r.northeast.lat);else{let s=i.geometry.lat,a=i.geometry.lng;o=d.fromDegrees(s,a)}return{displayName:i.formatted,destination:o}})})};var vZ=wZ;var aEt={packedLength:void 0,pack:E.throwInstantiationError,unpack:E.throwInstantiationError},DZ=aEt;var cEt={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:E.throwInstantiationError,unpackInterpolationResult:E.throwInstantiationError},PZ=cEt;var lEt=new d;function uEt(e,t,n,i){let o=_b(e,t,n,i,lEt);return c(o)?o.x>0&&o.y>0&&o.z>0:!1}var IZ=uEt;function cEe(){E.throwInstantiationError()}cEe.prototype.getURL=E.throwInstantiationError;var OZ=cEe;function fEt(e,t,n,i,o,r,s){let a=Fi.numberOfPoints(e,t,o),l,u=n.red,f=n.green,h=n.blue,p=n.alpha,g=i.red,m=i.green,y=i.blue,b=i.alpha;if(G.equals(n,i)){for(l=0;l<a;l++)r[s++]=G.floatToByte(u),r[s++]=G.floatToByte(f),r[s++]=G.floatToByte(h),r[s++]=G.floatToByte(p);return s}let x=(g-u)/a,A=(m-f)/a,C=(y-h)/a,S=(b-p)/a,v=s;for(l=0;l<a;l++)r[v++]=G.floatToByte(u+l*x),r[v++]=G.floatToByte(f+l*A),r[v++]=G.floatToByte(h+l*C),r[v++]=G.floatToByte(p+l*S);return v}function ek(e){e=e??W.EMPTY_OBJECT;let t=e.positions,n=e.colors,i=e.colorsPerVertex??!1;if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(c(n)&&(i&&n.length<t.length||!i&&n.length<t.length-1))throw new E("colors has an invalid length.");this._positions=t,this._colors=n,this._colorsPerVertex=i,this._arcType=e.arcType??qt.GEODESIC,this._granularity=e.granularity??O.RADIANS_PER_DEGREE,this._ellipsoid=e.ellipsoid??ie.default,this._workerName="createSimplePolylineGeometry";let o=1+t.length*d.packedLength;o+=c(n)?1+n.length*G.packedLength:1,this.packedLength=o+ie.packedLength+3}ek.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=n??0;let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);let s=e._colors;for(r=c(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=G.packedLength)G.pack(s[i],t,n);return ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};ek.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=t??0;let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=G.packedLength)s[i]=G.unpack(e,t);let a=ie.unpack(e,t);t+=ie.packedLength;let l=e[t++]===1,u=e[t++],f=e[t];return c(n)?(n._positions=r,n._colors=s,n._ellipsoid=a,n._colorsPerVertex=l,n._arcType=u,n._granularity=f,n):new ek({positions:r,colors:s,ellipsoid:a,colorsPerVertex:l,arcType:u,granularity:f})};var HG=new Array(2),GG=new Array(2),dEt={positions:HG,height:GG,ellipsoid:void 0,minDistance:void 0,granularity:void 0};ek.createGeometry=function(e){let t=e._positions,n=e._colors,i=e._colorsPerVertex,o=e._arcType,r=e._granularity,s=e._ellipsoid,a=O.chordLength(r,s.maximumRadius),l=c(n)&&!i,u,f=t.length,h,p,g,m,y=0;if(o===qt.GEODESIC||o===qt.RHUMB){let S,v,P;o===qt.GEODESIC?(S=O.chordLength(r,s.maximumRadius),v=Fi.numberOfPoints,P=Fi.generateArc):(S=r,v=Fi.numberOfPointsRhumbLine,P=Fi.generateRhumbArc);let M=Fi.extractHeights(t,s),R=dEt;if(o===qt.GEODESIC?R.minDistance=a:R.granularity=r,R.ellipsoid=s,l){let L=0;for(u=0;u<f-1;u++)L+=v(t[u],t[u+1],S)+1;h=new Float64Array(L*3),g=new Uint8Array(L*4),R.positions=HG,R.height=GG;let F=0;for(u=0;u<f-1;++u){HG[0]=t[u],HG[1]=t[u+1],GG[0]=M[u],GG[1]=M[u+1];let _=P(R);if(c(n)){let w=_.length/3;m=n[u];for(let D=0;D<w;++D)g[F++]=G.floatToByte(m.red),g[F++]=G.floatToByte(m.green),g[F++]=G.floatToByte(m.blue),g[F++]=G.floatToByte(m.alpha)}h.set(_,y),y+=_.length}}else if(R.positions=t,R.height=M,h=new Float64Array(P(R)),c(n)){for(g=new Uint8Array(h.length/3*4),u=0;u<f-1;++u){let F=t[u],_=t[u+1],w=n[u],D=n[u+1];y=fEt(F,_,w,D,a,g,y)}let L=n[f-1];g[y++]=G.floatToByte(L.red),g[y++]=G.floatToByte(L.green),g[y++]=G.floatToByte(L.blue),g[y++]=G.floatToByte(L.alpha)}}else{p=l?f*2-2:f,h=new Float64Array(p*3),g=c(n)?new Uint8Array(p*4):void 0;let S=0,v=0;for(u=0;u<f;++u){let P=t[u];if(l&&u>0&&(d.pack(P,h,S),S+=3,m=n[u-1],g[v++]=G.floatToByte(m.red),g[v++]=G.floatToByte(m.green),g[v++]=G.floatToByte(m.blue),g[v++]=G.floatToByte(m.alpha)),l&&u===f-1)break;d.pack(P,h,S),S+=3,c(n)&&(m=n[u],g[v++]=G.floatToByte(m.red),g[v++]=G.floatToByte(m.green),g[v++]=G.floatToByte(m.blue),g[v++]=G.floatToByte(m.alpha))}}let b=new fn;b.position=new ve({componentDatatype:$.DOUBLE,componentsPerAttribute:3,values:h}),c(n)&&(b.color=new ve({componentDatatype:$.UNSIGNED_BYTE,componentsPerAttribute:4,values:g,normalize:!0})),p=h.length/3;let x=(p-1)*2,A=Fe.createTypedArray(p,x),C=0;for(u=0;u<p-1;++u)A[C++]=u,A[C++]=u+1;return new ct({attributes:b,indices:A,primitiveType:Me.LINES,boundingSphere:le.fromPoints(t)})};var RZ=ek;function $w(e){let t=e.radius??1,i={radii:new d(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new Js(i),this._workerName="createSphereGeometry"}$w.packedLength=Js.packedLength;$w.pack=function(e,t,n){return T.typeOf.object("value",e),Js.pack(e._ellipsoidGeometry,t,n)};var hEt=new Js,Y0={radius:void 0,radii:new d,vertexFormat:new Ie,stackPartitions:void 0,slicePartitions:void 0};$w.unpack=function(e,t,n){let i=Js.unpack(e,t,hEt);return Y0.vertexFormat=Ie.clone(i._vertexFormat,Y0.vertexFormat),Y0.stackPartitions=i._stackPartitions,Y0.slicePartitions=i._slicePartitions,c(n)?(d.clone(i._radii,Y0.radii),n._ellipsoidGeometry=new Js(Y0),n):(Y0.radius=i._radii.x,new $w(Y0))};$w.createGeometry=function(e){return Js.createGeometry(e._ellipsoidGeometry)};var MZ=$w;function mEt(e){return T.defined("value",e),e<=.04045?e*.07739938080495357:Math.pow((e+.055)*.9478672985781991,2.4)}var MA=mEt;function X0(e){throw new E("This type should not be instantiated directly.  Instead, use WebMercatorTilingScheme or GeographicTilingScheme.")}Object.defineProperties(X0.prototype,{ellipsoid:{get:E.throwInstantiationError},rectangle:{get:E.throwInstantiationError},projection:{get:E.throwInstantiationError}});X0.prototype.getNumberOfXTilesAtLevel=E.throwInstantiationError;X0.prototype.getNumberOfYTilesAtLevel=E.throwInstantiationError;X0.prototype.rectangleToNativeRectangle=E.throwInstantiationError;X0.prototype.tileXYToNativeRectangle=E.throwInstantiationError;X0.prototype.tileXYToRectangle=E.throwInstantiationError;X0.prototype.positionToTileXY=E.throwInstantiationError;var LZ=X0;function LA(e){e=e??W.EMPTY_OBJECT,this._clock=void 0,this._element=void 0,this._clockSubscription=void 0,this._seekFunction=void 0,this._lastPlaybackRate=void 0,this.clock=e.clock,this.element=e.element,this.epoch=e.epoch??Ge.MINIMUM_VALUE,this.tolerance=e.tolerance??1,this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}Object.defineProperties(LA.prototype,{clock:{get:function(){return this._clock},set:function(e){let t=this._clock;t!==e&&(c(t)&&(this._clockSubscription(),this._clockSubscription=void 0),c(e)&&(this._clockSubscription=e.onTick.addEventListener(LA.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){let t=this._element;t!==e&&(c(t)&&t.removeEventListener("seeked",this._seekFunction,!1),c(e)&&(this._seeking=!1,this._seekFunction=pEt(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}});LA.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,de(this)};LA.prototype.isDestroyed=function(){return!1};LA.prototype._trySetPlaybackRate=function(e){if(this._lastPlaybackRate===e.multiplier)return;let t=this._element;try{t.playbackRate=e.multiplier}catch{t.playbackRate=0}this._lastPlaybackRate=e.multiplier};LA.prototype._onTick=function(e){let t=this._element;if(!c(t)||t.readyState<2)return;let n=t.paused,i=e.shouldAnimate;if(i===n&&(i?t.play():t.pause()),this._seeking||this._firstTickAfterSeek){this._firstTickAfterSeek=!1;return}this._trySetPlaybackRate(e);let o=e.currentTime,r=this.epoch??Ge.MINIMUM_VALUE,s=Q.secondsDifference(o,r),a=t.duration,l,u=t.currentTime;t.loop?(s=s%a,s<0&&(s=a-s),l=s):s>a?l=a:s<0?l=0:l=s;let f=i?this.tolerance??1:.001;Math.abs(l-u)>f&&(this._seeking=!0,t.currentTime=l)};function pEt(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}var NZ=LA;function _Et(e,t){this.rectangle=e,this.maxLevel=t}function lEe(e){this.ellipsoid=e.ellipsoid??ie.default,this.tilingScheme=void 0,this.heightmapWidth=void 0,this.heightmapHeight=void 0,this.levelZeroMaximumGeometricError=void 0,this.rectangles=[]}lEe.prototype.build=function(e){e._tilingScheme=this.tilingScheme,e._heightmapWidth=this.heightmapWidth,e._heightmapHeight=this.heightmapHeight,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._rectangles=this.rectangles};function gEt(e,t){let n=t.getElementsByTagName("SRS")[0].textContent;if(n==="EPSG:4326")e.tilingScheme=new Ki({ellipsoid:e.ellipsoid});else throw new ae(`SRS ${n} is not supported`);let i=t.getElementsByTagName("TileFormat")[0];e.heightmapWidth=parseInt(i.getAttribute("width"),10),e.heightmapHeight=parseInt(i.getAttribute("height"),10),e.levelZeroMaximumGeometricError=cs.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,Math.min(e.heightmapWidth,e.heightmapHeight),e.tilingScheme.getNumberOfXTilesAtLevel(0));let o=t.getElementsByTagName("DataExtent");for(let r=0;r<o.length;++r){let s=o[r],a=O.toRadians(parseFloat(s.getAttribute("minx"))),l=O.toRadians(parseFloat(s.getAttribute("miny"))),u=O.toRadians(parseFloat(s.getAttribute("maxx"))),f=O.toRadians(parseFloat(s.getAttribute("maxy"))),h=parseInt(s.getAttribute("maxlevel"),10);e.rectangles.push(new _Et(new ce(a,l,u,f),h))}}function yEt(e,t,n){let i=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(i=`${i}: ${t.message}`),Po.reportError(void 0,n,c(n)?n._errorEvent:void 0,i),new ae(i)}async function bEt(e,t,n){try{let i=await t.fetchXML();gEt(e,i)}catch(i){yEt(t,i,n)}}function K0(e){e=e??W.EMPTY_OBJECT,this._errorEvent=new pe,this._terrainDataStructure={heightScale:1/1e3,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:256*256*256-1};let t=e.credit;typeof t=="string"&&(t=new Tt(t)),this._credit=t,this._tilingScheme=void 0,this._rectangles=[]}Object.defineProperties(K0.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});K0.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT;let n=new lEe(t),i=we.createIfNeeded(e);await bEt(n,i);let o=new K0(t);return n.build(o),o._resource=i,o};K0.prototype.requestTileGeometry=function(e,t,n,i){let o=this._tilingScheme.getNumberOfYTilesAtLevel(n),s=this._resource.getDerivedResource({url:`${n}/${e}/${o-t-1}.tif`,queryParameters:{cesium:!0},request:i}).fetchImage({preferImageBitmap:!0});if(!c(s))return;let a=this;return Promise.resolve(s).then(function(l){return new qa({buffer:Id(l),width:a._heightmapWidth,height:a._heightmapHeight,childTileMask:xEt(a,e,t,n),structure:a._terrainDataStructure})})};K0.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};var uEe=new ce;function xEt(e,t,n,i){let o=e._tilingScheme,r=e._rectangles,s=o.tileXYToRectangle(t,n,i),a=0;for(let l=0;l<r.length&&a!==15;++l){let u=r[l];if(u.maxLevel<=i)continue;let f=u.rectangle,h=ce.intersection(f,s,uEe);c(h)&&(jG(o,f,t*2,n*2,i+1)&&(a|=4),jG(o,f,t*2+1,n*2,i+1)&&(a|=8),jG(o,f,t*2,n*2+1,i+1)&&(a|=1),jG(o,f,t*2+1,n*2+1,i+1)&&(a|=2))}return a}function jG(e,t,n,i,o){let r=e.tileXYToRectangle(n,i,o);return c(ce.intersection(r,t,uEe))}K0.prototype.getTileDataAvailable=function(e,t,n){};K0.prototype.loadTileDataAvailability=function(e,t,n){};var FZ=K0;var TEt={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033},BZ=Object.freeze(TEt);function AEt(e){switch(e){case ne.FLOAT:return"float";case ne.FLOAT_VEC2:return"vec2";case ne.FLOAT_VEC3:return"vec3";case ne.FLOAT_VEC4:return"vec4";case ne.FLOAT_MAT2:return"mat2";case ne.FLOAT_MAT3:return"mat3";case ne.FLOAT_MAT4:return"mat4";case ne.SAMPLER_2D:return"sampler2D";case ne.BOOL:return"bool"}}var kZ=AEt;function CEt(e,t,n){if(typeof t!="function")throw new E("oldFunction is required to be a function.");if(typeof n!="function")throw new E("oldFunction is required to be a function.");return function(){n.apply(e,arguments),t.apply(e,arguments)}}var tk=CEt;var EEt=new d(1,1,1);function UZ(e){e=e??EEt,T.defined("dimensions",e),T.typeOf.number.greaterThanOrEquals("dimensions.x",e.x,0),T.typeOf.number.greaterThanOrEquals("dimensions.y",e.y,0),T.typeOf.number.greaterThanOrEquals("dimensions.z",e.z,0),this._dimensions=d.clone(e)}Object.defineProperties(UZ.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){T.defined("value",e),T.typeOf.number.greaterThanOrEquals("value.x",e.x,0),T.typeOf.number.greaterThanOrEquals("value.y",e.y,0),T.typeOf.number.greaterThanOrEquals("value.z",e.z,0),d.clone(e,this._dimensions)}}});var SEt=new d;UZ.prototype.emit=function(e){let t=this._dimensions,n=d.multiplyByScalar(t,.5,SEt),i=O.randomBetween(-n.x,n.x),o=O.randomBetween(-n.y,n.y),r=O.randomBetween(-n.z,n.z);e.position=d.fromElements(i,o,r,e.position),e.velocity=d.normalize(e.position,e.velocity)};var VZ=UZ;function yp(){this.featurePropertiesDirty=!1}Object.defineProperties(yp.prototype,{featuresLength:{get:function(){E.throwInstantiationError()}},pointsLength:{get:function(){E.throwInstantiationError()}},trianglesLength:{get:function(){E.throwInstantiationError()}},geometryByteLength:{get:function(){E.throwInstantiationError()}},texturesByteLength:{get:function(){E.throwInstantiationError()}},batchTableByteLength:{get:function(){E.throwInstantiationError()}},innerContents:{get:function(){E.throwInstantiationError()}},ready:{get:function(){E.throwInstantiationError()}},tileset:{get:function(){E.throwInstantiationError()}},tile:{get:function(){E.throwInstantiationError()}},url:{get:function(){E.throwInstantiationError()}},batchTable:{get:function(){E.throwInstantiationError()}},metadata:{get:function(){E.throwInstantiationError()},set:function(e){E.throwInstantiationError()}},group:{get:function(){E.throwInstantiationError()},set:function(e){E.throwInstantiationError()}}});yp.prototype.hasProperty=function(e,t){E.throwInstantiationError()};yp.prototype.getFeature=function(e){E.throwInstantiationError()};yp.prototype.applyDebugSettings=function(e,t){E.throwInstantiationError()};yp.prototype.applyStyle=function(e){E.throwInstantiationError()};yp.prototype.update=function(e,t){E.throwInstantiationError()};yp.prototype.pick=function(e,t,n){E.throwInstantiationError()};yp.prototype.isDestroyed=function(){E.throwInstantiationError()};yp.prototype.destroy=function(){E.throwInstantiationError()};var zZ=yp;function Zw(e,t){this._conditionsExpression=je(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,vEt(this,t)}Object.defineProperties(Zw.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}});function wEt(e,t){this.condition=e,this.expression=t}function vEt(e,t){let n=[],i=e._conditions;if(!c(i))return;let o=i.length;for(let r=0;r<o;++r){let s=i[r],a=String(s[0]),l=String(s[1]);n.push(new wEt(new Lf(a,t),new Lf(l,t)))}e._runtimeConditions=n}Zw.prototype.evaluate=function(e,t){let n=this._runtimeConditions;if(!c(n))return;let i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.condition.evaluate(e))return r.expression.evaluate(e,t)}};Zw.prototype.evaluateColor=function(e,t){let n=this._runtimeConditions;if(!c(n))return;let i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.condition.evaluate(e))return r.expression.evaluateColor(e,t)}};Zw.prototype.getShaderFunction=function(e,t,n,i){let o=this._runtimeConditions;if(!c(o)||o.length===0)return;let r="",s=o.length;for(let a=0;a<s;++a){let l=o[a],u=l.condition.getShaderExpression(t,n),f=l.expression.getShaderExpression(t,n);r+=`    ${a===0?"if":"else if"} (${u})
    {
        return ${f};
    }
`}return r=`${i} ${e}
{
${r}    return ${i}(1.0);
}
`,r};Zw.prototype.getVariables=function(){let e=[],t=this._runtimeConditions;if(!c(t)||t.length===0)return e;let n=t.length;for(let i=0;i<n;++i){let o=t[i];e.push.apply(e,o.condition.getVariables()),e.push.apply(e,o.expression.getVariables())}return e=e.filter(function(i,o,r){return r.indexOf(i)===o}),e};var nk=Zw;function $0(e){this._style={},this._ready=!1,this._show=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._labelColor=void 0,this._labelOutlineColor=void 0,this._labelOutlineWidth=void 0,this._font=void 0,this._labelStyle=void 0,this._labelText=void 0,this._backgroundColor=void 0,this._backgroundPadding=void 0,this._backgroundEnabled=void 0,this._scaleByDistance=void 0,this._translucencyByDistance=void 0,this._distanceDisplayCondition=void 0,this._heightOffset=void 0,this._anchorLineEnabled=void 0,this._anchorLineColor=void 0,this._image=void 0,this._disableDepthTestDistance=void 0,this._horizontalOrigin=void 0,this._verticalOrigin=void 0,this._labelHorizontalOrigin=void 0,this._labelVerticalOrigin=void 0,this._meta=void 0,this._colorShaderFunction=void 0,this._showShaderFunction=void 0,this._pointSizeShaderFunction=void 0,this._colorShaderFunctionReady=!1,this._showShaderFunctionReady=!1,this._pointSizeShaderFunctionReady=!1,this._colorShaderTranslucent=!1,DEt(this,e)}function DEt(e,t){t=je(t,!0)??e._style,e._style=t,e.show=t.show,e.color=t.color,e.pointSize=t.pointSize,e.pointOutlineColor=t.pointOutlineColor,e.pointOutlineWidth=t.pointOutlineWidth,e.labelColor=t.labelColor,e.labelOutlineColor=t.labelOutlineColor,e.labelOutlineWidth=t.labelOutlineWidth,e.labelStyle=t.labelStyle,e.font=t.font,e.labelText=t.labelText,e.backgroundColor=t.backgroundColor,e.backgroundPadding=t.backgroundPadding,e.backgroundEnabled=t.backgroundEnabled,e.scaleByDistance=t.scaleByDistance,e.translucencyByDistance=t.translucencyByDistance,e.distanceDisplayCondition=t.distanceDisplayCondition,e.heightOffset=t.heightOffset,e.anchorLineEnabled=t.anchorLineEnabled,e.anchorLineColor=t.anchorLineColor,e.image=t.image,e.disableDepthTestDistance=t.disableDepthTestDistance,e.horizontalOrigin=t.horizontalOrigin,e.verticalOrigin=t.verticalOrigin,e.labelHorizontalOrigin=t.labelHorizontalOrigin,e.labelVerticalOrigin=t.labelVerticalOrigin;let n={};if(c(t.meta)){let i=t.defines,o=t.meta??W.EMPTY_OBJECT;for(let r in o)o.hasOwnProperty(r)&&(n[r]=new Lf(o[r],i))}e._meta=n,e._ready=!0}function fr(e,t){let n=(e._style??W.EMPTY_OBJECT).defines;if(c(t)){if(typeof t=="boolean"||typeof t=="number")return new Lf(String(t));if(typeof t=="string")return new Lf(t,n);if(c(t.conditions))return new nk(t,n)}else return;return t}function dr(e){if(c(e)){if(c(e.expression))return e.expression;if(c(e.conditionsExpression))return je(e.conditionsExpression,!0)}else return;return e}Object.defineProperties($0.prototype,{style:{get:function(){return this._style}},show:{get:function(){return this._show},set:function(e){this._show=fr(this,e),this._style.show=dr(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=fr(this,e),this._style.color=dr(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=fr(this,e),this._style.pointSize=dr(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=fr(this,e),this._style.pointOutlineColor=dr(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=fr(this,e),this._style.pointOutlineWidth=dr(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=fr(this,e),this._style.labelColor=dr(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=fr(this,e),this._style.labelOutlineColor=dr(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=fr(this,e),this._style.labelOutlineWidth=dr(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=fr(this,e),this._style.font=dr(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=fr(this,e),this._style.labelStyle=dr(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=fr(this,e),this._style.labelText=dr(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=fr(this,e),this._style.backgroundColor=dr(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=fr(this,e),this._style.backgroundPadding=dr(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=fr(this,e),this._style.backgroundEnabled=dr(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=fr(this,e),this._style.scaleByDistance=dr(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=fr(this,e),this._style.translucencyByDistance=dr(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=fr(this,e),this._style.distanceDisplayCondition=dr(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=fr(this,e),this._style.heightOffset=dr(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=fr(this,e),this._style.anchorLineEnabled=dr(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=fr(this,e),this._style.anchorLineColor=dr(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=fr(this,e),this._style.image=dr(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=fr(this,e),this._style.disableDepthTestDistance=dr(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=fr(this,e),this._style.horizontalOrigin=dr(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=fr(this,e),this._style.verticalOrigin=dr(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=fr(this,e),this._style.labelHorizontalOrigin=dr(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=fr(this,e),this._style.labelVerticalOrigin=dr(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}});$0.fromUrl=function(e){if(!c(e))throw new E("url is required");return we.createIfNeeded(e).fetchJson(e).then(function(n){return new $0(n)})};$0.prototype.getColorShaderFunction=function(e,t,n){return this._colorShaderFunctionReady?(n.translucent=this._colorShaderTranslucent,this._colorShaderFunction):(this._colorShaderFunctionReady=!0,c(this.color)&&c(this.color.getShaderFunction)?this._colorShaderFunction=this.color.getShaderFunction(e,t,n,"vec4"):this._colorShaderFunction=void 0,this._colorShaderTranslucent=n.translucent,this._colorShaderFunction)};$0.prototype.getShowShaderFunction=function(e,t,n){return this._showShaderFunctionReady?this._showShaderFunction:(this._showShaderFunctionReady=!0,c(this.show)&&c(this.show.getShaderFunction)?this._showShaderFunction=this.show.getShaderFunction(e,t,n,"bool"):this._showShaderFunction=void 0,this._showShaderFunction)};$0.prototype.getPointSizeShaderFunction=function(e,t,n){return this._pointSizeShaderFunctionReady?this._pointSizeShaderFunction:(this._pointSizeShaderFunctionReady=!0,c(this.pointSize)&&c(this.pointSize.getShaderFunction)?this._pointSizeShaderFunction=this.pointSize.getShaderFunction(e,t,n,"float"):this._pointSizeShaderFunction=void 0,this._pointSizeShaderFunction)};$0.prototype.getVariables=function(){let e=[];return c(this.color)&&c(this.color.getVariables)&&e.push.apply(e,this.color.getVariables()),c(this.show)&&c(this.show.getVariables)&&e.push.apply(e,this.show.getVariables()),c(this.pointSize)&&c(this.pointSize.getVariables)&&e.push.apply(e,this.pointSize.getVariables()),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var NA=$0;function ik(e){e=e??W.EMPTY_OBJECT,this._maximumSubtreeCount=e.maximumSubtreeCount??0,this._subtreeRequestCounter=0,this._queue=new xA({comparator:ik.comparator})}ik.prototype.addSubtree=function(e){let t=new PEt(e,this._subtreeRequestCounter);this._subtreeRequestCounter++,this._queue.insert(t);let n=e.implicitCoordinates;if(n.level>0){let i=n.getParentSubtreeCoordinates();if(this.find(i)===void 0)throw new E("parent node needs to exist")}if(this._maximumSubtreeCount>0)for(;this._queue.length>this._maximumSubtreeCount&&this._queue.getMinimum()!==t;)this._queue.removeMinimum()};ik.prototype.find=function(e){let t=this._queue,n=t.internalArray,i=t.length;for(let o=0;o<i;o++){let r=n[o],a=r.subtree.implicitCoordinates;if(e.isEqual(a))return r.subtree}};ik.comparator=function(e,t){let n=e.subtree.implicitCoordinates,i=t.subtree.implicitCoordinates;return n.isAncestor(i)?1:i.isAncestor(n)?-1:e.stamp-t.stamp};function PEt(e,t){this.subtree=e,this.stamp=t}var ok=ik;function rk(e){e=e??W.EMPTY_OBJECT;let{className:t,names:n,types:i,componentTypes:o,shape:r,dimensions:s,paddingBefore:a=d.ZERO.clone(),paddingAfter:l=d.ZERO.clone(),globalTransform:u=B.IDENTITY.clone(),shapeTransform:f=B.IDENTITY.clone(),minBounds:h,maxBounds:p,minimumValues:g,maximumValues:m,maximumTileCount:y}=e;T.typeOf.string("className",t),T.typeOf.object("names",n),T.typeOf.object("types",i),T.typeOf.object("componentTypes",o),T.typeOf.string("shape",r),T.typeOf.object("dimensions",s),this._shapeTransform=f,this._globalTransform=u,this._shape=r,this._minBounds=h,this._maxBounds=p,this._dimensions=s,this._paddingBefore=a,this._paddingAfter=l,this._className=t,this._names=n,this._types=i,this._componentTypes=o,this._metadataOrder=r===va.ELLIPSOID?Td.Z_UP:Td.Y_UP,this._minimumValues=g,this._maximumValues=m,this._maximumTileCount=y,this._availableLevels=void 0,this._implicitTileset=void 0,this._subtreeCache=new ok}Object.defineProperties(rk.prototype,{globalTransform:{get:function(){return this._globalTransform}},shapeTransform:{get:function(){return this._shapeTransform}},shape:{get:function(){return this._shape}},minBounds:{get:function(){return this._minBounds}},maxBounds:{get:function(){return this._maxBounds}},dimensions:{get:function(){return this._dimensions}},paddingBefore:{get:function(){return this._paddingBefore}},paddingAfter:{get:function(){return this._paddingAfter}},className:{get:function(){return this._className}},names:{get:function(){return this._names}},types:{get:function(){return this._types}},componentTypes:{get:function(){return this._componentTypes}},metadataOrder:{get:function(){return this._metadataOrder}},minimumValues:{get:function(){return this._minimumValues}},maximumValues:{get:function(){return this._maximumValues}},maximumTileCount:{get:function(){return this._maximumTileCount}},availableLevels:{get:function(){return this._availableLevels}}});rk.fromUrl=async function(e){T.defined("url",e);let t=we.createIfNeeded(e),n=await t.fetchJson();OEt(n);let i=kEt(n,t);await i.load();let{root:o}=n,r=oi(n,"3DTILES_metadata")?n.extensions["3DTILES_metadata"]:n,s=new Kx({metadataJson:r,schema:i.schema}),a=o.content.extensions["3DTILES_content_voxels"],l=a.class,u=UEt(s,l);Object.assign(u,REt(o)),c(o.transform)?u.globalTransform=B.unpack(o.transform):u.globalTransform=B.clone(B.IDENTITY),u.dimensions=d.unpack(a.dimensions),u.maximumTileCount=IEt(s),c(a.padding)&&(u.paddingBefore=d.unpack(a.padding.before),u.paddingAfter=d.unpack(a.padding.after));let f=new rk(u),h=new Zx(t,o,i.schema);return f._implicitTileset=h,f._availableLevels=h.availableLevels,vi.unload(i),f};function IEt(e){if(c(e.tileset))return e.tileset.getPropertyBySemantic(yx.TILESET_TILE_COUNT)}function OEt(e){let t=e.root;if(!c(t.content))throw new ae("Root must have content");if(!oi(t.content,"3DTILES_content_voxels"))throw new ae("Root tile content must have 3DTILES_content_voxels extension");if(!oi(t,"3DTILES_implicit_tiling")&&!c(t.implicitTiling))throw new ae("Root tile must have implicit tiling");if(!c(e.schema)&&!c(e.schemaUri)&&!oi(e,"3DTILES_metadata"))throw new ae("Tileset must have a metadata schema")}function REt(e){let t=e.boundingVolume;if(c(t.box))return FEt(t.box);if(c(t.region))return MEt(t.region);if(oi(t,"3DTILES_bounding_volume_cylinder"))return BEt(t.extensions["3DTILES_bounding_volume_cylinder"]);throw new ae("Only box, region and 3DTILES_bounding_volume_cylinder are supported in Cesium3DTilesVoxelProvider")}function MEt(e){let t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],s=e[5],a=B.fromScale(ie.WGS84.radii),l=new d(t,n,r),u=new d(i,o,s);return{shape:va.ELLIPSOID,minBounds:l,maxBounds:u,shapeTransform:a}}var LEt=new d,NEt=new J;function FEt(e){let t=Dn.unpack(e),n=J.getScale(t.halfAxes,LEt),i=J.getRotation(t.halfAxes,NEt);return{shape:va.BOX,minBounds:d.negate(n,new d),maxBounds:d.clone(n),shapeTransform:B.fromRotationTranslation(i,t.center)}}function BEt(e){let{minRadius:t,maxRadius:n,height:i,minAngle:o=-O.PI,maxAngle:r=O.PI,translation:s=[0,0,0],rotation:a=[0,0,0,1]}=e;T.typeOf.number("minRadius",t),T.typeOf.number("maxRadius",n),T.typeOf.number("height",i),T.typeOf.number("minAngle",o),T.typeOf.number("maxAngle",r),T.typeOf.object("translation",s),T.typeOf.object("rotation",a);let l=-.5*i+s[2],u=.5*i+s[2],f=B.fromTranslationQuaternionRotationScale(d.unpack(s),Le.unpack(a),d.ONE);return{shape:va.CYLINDER,minBounds:d.fromElements(t,o,l),maxBounds:d.fromElements(n,r,u),shapeTransform:f}}function kEt(e,t){let{schemaUri:n,schema:i}=e;return c(n)?vi.getSchemaLoader({resource:t.getDerivedResource({url:n})}):vi.getSchemaLoader({schema:i})}function UEt(e,t){let{schema:n,statistics:i}=e,o=i?.classes[t],r=n.classes[t].properties,s=Object.entries(r).map(([g,m])=>{let{type:y,componentType:b}=m,x=o?.properties[g].min,A=o?.properties[g].max,C=at.getComponentCount(y),S=fEe(x,C),v=fEe(A,C);return{id:g,type:y,componentType:b,minValue:S,maxValue:v}}),a=s.map(g=>g.id),l=s.map(g=>g.type),u=s.map(g=>g.componentType),f=s.map(g=>g.minValue),h=s.map(g=>g.maxValue),p=f.some(c);return{className:t,names:a,types:l,componentTypes:u,minimumValues:p?f:void 0,maximumValues:p?h:void 0}}function fEe(e,t){if(!c(e))return;let n=Array.isArray(e)?e:[e];return Array.from({length:t},(i,o)=>n[o])}async function VEt(e,t){let n=e._implicitTileset,i=e._subtreeCache,o=i.find(t);if(c(o))return o;let r=n.subtreeUriTemplate.getDerivedResource({templateValues:t.getTemplateValues()}),s=n.baseResource.getDerivedResource({url:r.url}),a=await s.fetchArrayBuffer();if(o=i.find(t),c(o))return o;let l=I_(a);return o=await gx.fromSubtreeJson(s,l.jsonPayload,l.binaryPayload,n,t),i.addSubtree(o),o}rk.prototype.requestData=async function(e){e=e??W.EMPTY_OBJECT;let{tileLevel:t=0,tileX:n=0,tileY:i=0,tileZ:o=0,keyframe:r=0}=e;if(r!==0)return Promise.reject("3D Tiles currently doesn't support time-dynamic data.");let s=this._implicitTileset,a=new Qx({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:t,x:n,y:i,z:o}),l=a.isSubtreeRoot()&&a.level>0,u=l?a.getParentSubtreeCoordinates():a.getSubtreeCoordinates(),h=await VEt(this,u);if(!(l?h.childSubtreeIsAvailableAtCoordinates:h.tileIsAvailableAtCoordinates).call(h,a))return Promise.reject(`Tile is not available at level ${t}, x ${n}, y ${i}, z ${o}.`);let{contentUriTemplates:m,baseResource:y}=s,b=m[0].getDerivedResource({templateValues:a.getTemplateValues()}),x=y.getDerivedResource({url:b.url});return _A.fromGltf(x)};var HZ=rk;function GZ(e){e=e??1,T.typeOf.number.greaterThan("radius",e,0),this._radius=e??1}Object.defineProperties(GZ.prototype,{radius:{get:function(){return this._radius},set:function(e){T.typeOf.number.greaterThan("value",e,0),this._radius=e}}});GZ.prototype.emit=function(e){let t=O.randomBetween(0,O.TWO_PI),n=O.randomBetween(0,this._radius),i=n*Math.cos(t),o=n*Math.sin(t),r=0;e.position=d.fromElements(i,o,r,e.position),e.velocity=d.clone(d.UNIT_Z,e.velocity)};var sk=GZ;var jZ={CUMULUS:0};jZ.validate=function(e){return e===jZ.CUMULUS};var FA=Object.freeze(jZ);function $h(e,t){if(e=e??W.EMPTY_OBJECT,this._show=e.show??!0,this._position=d.clone(e.position??d.ZERO),!c(e.scale)&&c(e.maximumSize))this._maximumSize=d.clone(e.maximumSize),this._scale=new H(this._maximumSize.x,this._maximumSize.y);else{this._scale=H.clone(e.scale??new H(20,12));let n=new d(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=d.clone(e.maximumSize??n)}this._slice=e.slice??-1,this._color=G.clone(e.color??G.WHITE),this._brightness=e.brightness??1,this._cloudCollection=t,this._index=-1}var zEt=$h.SHOW_INDEX=0,HEt=$h.POSITION_INDEX=1,GEt=$h.SCALE_INDEX=2,jEt=$h.MAXIMUM_SIZE_INDEX=3,WEt=$h.SLICE_INDEX=4,qEt=$h.BRIGHTNESS_INDEX=5,YEt=$h.COLOR_INDEX=6;$h.NUMBER_OF_PROPERTIES=7;function BA(e,t){let n=e._cloudCollection;c(n)&&(n._updateCloud(e,t),e._dirty=!0)}Object.defineProperties($h.prototype,{show:{get:function(){return this._show},set:function(e){T.typeOf.bool("value",e),this._show!==e&&(this._show=e,BA(this,zEt))}},position:{get:function(){return this._position},set:function(e){T.typeOf.object("value",e);let t=this._position;d.equals(t,e)||(d.clone(e,t),BA(this,HEt))}},scale:{get:function(){return this._scale},set:function(e){T.typeOf.object("value",e);let t=this._scale;H.equals(t,e)||(H.clone(e,t),BA(this,GEt))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){T.typeOf.object("value",e);let t=this._maximumSize;d.equals(t,e)||(d.clone(e,t),BA(this,jEt))}},color:{get:function(){return this._color},set:function(e){T.typeOf.object("value",e);let t=this._color;G.equals(t,e)||(G.clone(e,t),BA(this,YEt))}},slice:{get:function(){return this._slice},set:function(e){T.typeOf.number("value",e),this._slice!==e&&(this._slice=e,BA(this,WEt))}},brightness:{get:function(){return this._brightness},set:function(e){T.typeOf.number("value",e),this._brightness!==e&&(this._brightness=e,BA(this,qEt))}}});$h.prototype._destroy=function(){this._cloudCollection=void 0};var uf=$h;var ff,WG=new d,XEt={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},KEt={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},$Et=uf.SHOW_INDEX,ZEt=uf.POSITION_INDEX,QEt=uf.SCALE_INDEX,JEt=uf.MAXIMUM_SIZE_INDEX,eSt=uf.SLICE_INDEX,tSt=uf.BRIGHTNESS_INDEX,nSt=uf.NUMBER_OF_PROPERTIES,iSt=uf.COLOR_INDEX;function Zh(e){e=e??W.EMPTY_OBJECT,this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(nSt),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=e.noiseDetail??16,this.noiseOffset=d.clone(e.noiseOffset??d.ZERO),this._loading=!1,this._ready=!1;let t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:dEe(t),u_noiseDetail:function(){return t.noiseDetail}},this._vaNoise=void 0,this._spNoise=void 0,this._spCreated=!1,this._sp=void 0,this._rs=void 0,this.show=e.show??!0,this._colorCommands=[],this.debugBillboards=e.debugBillboards??!1,this._compiledDebugBillboards=!1,this.debugEllipsoids=e.debugEllipsoids??!1,this._compiledDebugEllipsoids=!1}function dEe(e){return function(){return WG.x=e._textureSliceWidth,WG.y=e._noiseTextureRows,WG.z=1/e._noiseTextureRows,WG}}Object.defineProperties(Zh.prototype,{length:{get:function(){return qZ(this),this._clouds.length}}});function hEe(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Zh.prototype.add=function(e){e=e??W.EMPTY_OBJECT;let t=e.cloudType??FA.CUMULUS;if(!FA.validate(t))throw new E("invalid cloud type");let n;return t===FA.CUMULUS&&(n=new uf(e,this),n._index=this._clouds.length,this._clouds.push(n),this._createVertexArray=!0),n};Zh.prototype.remove=function(e){return this.contains(e)?(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Zh.prototype.removeAll=function(){hEe(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0};function qZ(e){if(e._cloudsRemoved){e._cloudsRemoved=!1;let t=[],n=e._clouds,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];c(s)&&(n._index=r++,t.push(s))}e._clouds=t}}Zh.prototype._updateCloud=function(e,t){e._dirty||(this._cloudsToUpdate[this._cloudsToUpdateIndex++]=e),++this._propertiesChanged[t]};Zh.prototype.contains=function(e){return c(e)&&e._cloudCollection===this};Zh.prototype.get=function(e){return T.typeOf.number("index",e),qZ(this),this._clouds[e]};var oSt=new Float32Array([-1,-1,1,-1,1,1,-1,1]),rSt=new Uint16Array([0,1,2,0,2,3]);function sSt(e){let t=yt.createVertexBuffer({context:e,typedArray:oSt,usage:Be.STATIC_DRAW}),n=yt.createIndexBuffer({context:e,typedArray:rSt,usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),i=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:$.FLOAT}];return new ti({context:e,attributes:i,indexBuffer:n})}var YZ;function aSt(e){let n=e.cache.cloudCollection_indexBufferBatched;if(c(n))return n;let i=16384*6-6,o=new Uint16Array(i);for(let r=0,s=0;r<i;r+=6,s+=4)o[r]=s,o[r+1]=s+1,o[r+2]=s+2,o[r+3]=s,o[r+4]=s+2,o[r+5]=s+3;return n=yt.createIndexBuffer({context:e,typedArray:o,usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferBatched=n,n}function cSt(e){let t=e.cache.cloudCollection_indexBufferInstanced;return c(t)||(t=yt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Be.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferInstanced=t),t}function lSt(e){let t=e.cache.cloudCollection_vertexBufferInstanced;return c(t)||(t=yt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:Be.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_vertexBufferInstanced=t),t}function uSt(e,t,n){let i=[{index:ff.positionHighAndScaleX,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:Be.STATIC_DRAW},{index:ff.positionLowAndScaleY,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:Be.STATIC_DRAW},{index:ff.packedAttribute0,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:Be.STATIC_DRAW},{index:ff.packedAttribute1,componentsPerAttribute:4,componentDatatype:$.FLOAT,usage:Be.STATIC_DRAW},{index:ff.color,componentsPerAttribute:4,componentDatatype:$.UNSIGNED_BYTE,normalize:!0,usage:Be.STATIC_DRAW}];n&&i.push({index:ff.direction,componentsPerAttribute:2,componentDatatype:$.FLOAT,vertexBuffer:lSt(e)});let o=n?t:4*t;return new Mp(e,i,o,n)}var WZ=new Hn;function mEe(e,t,n,i){let o,r=n[ff.positionHighAndScaleX],s=n[ff.positionLowAndScaleY],a=i.position;Hn.fromCartesian(a,WZ);let l=i.scale,u=WZ.high,f=WZ.low;e._instanced?(o=i._index,r(o,u.x,u.y,u.z,l.x),s(o,f.x,f.y,f.z,l.y)):(o=i._index*4,r(o+0,u.x,u.y,u.z,l.x),r(o+1,u.x,u.y,u.z,l.x),r(o+2,u.x,u.y,u.z,l.x),r(o+3,u.x,u.y,u.z,l.x),s(o+0,f.x,f.y,f.z,l.y),s(o+1,f.x,f.y,f.z,l.y),s(o+2,f.x,f.y,f.z,l.y),s(o+3,f.x,f.y,f.z,l.y))}function pEe(e,t,n,i){let o,r=n[ff.packedAttribute0],s=i.show,a=i.brightness;e._instanced?(o=i._index,r(o,s,a,0,0)):(o=i._index*4,r(o+0,s,a,0,0),r(o+1,s,a,1,0),r(o+2,s,a,1,1),r(o+3,s,a,0,1))}function _Ee(e,t,n,i){let o,r=n[ff.packedAttribute1],s=i.maximumSize,a=i.slice;e._instanced?(o=i._index,r(o,s.x,s.y,s.z,a)):(o=i._index*4,r(o+0,s.x,s.y,s.z,a),r(o+1,s.x,s.y,s.z,a),r(o+2,s.x,s.y,s.z,a),r(o+3,s.x,s.y,s.z,a))}function gEe(e,t,n,i){let o,r=n[ff.color],s=i.color,a=G.floatToByte(s.red),l=G.floatToByte(s.green),u=G.floatToByte(s.blue),f=G.floatToByte(s.alpha);e._instanced?(o=i._index,r(o,a,l,u,f)):(o=i._index*4,r(o+0,a,l,u,f),r(o+1,a,l,u,f),r(o+2,a,l,u,f),r(o+3,a,l,u,f))}function fSt(e,t,n,i){mEe(e,t,n,i),pEe(e,t,n,i),_Ee(e,t,n,i),gEe(e,t,n,i)}function dSt(e,t,n,i){let o=e,r=o._textureSliceWidth,s=o._noiseTextureRows;if(r/s<1||r%s!==0)throw new E("noiseTextureRows must evenly divide textureSliceWidth");let a=t.context;o._vaNoise=sSt(a),o._spNoise=Jt.fromCache({context:a,vertexShaderSource:n,fragmentShaderSource:i,attributeLocations:{position:0}});let l=o.noiseDetail,u=o.noiseOffset;o._noiseTexture=new Rt({context:a,width:r*r/s,height:r*s,pixelDatatype:Ue.UNSIGNED_BYTE,pixelFormat:ke.RGBA,sampler:new Qt({wrapS:gn.REPEAT,wrapT:gn.REPEAT,minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST})});let f=new Uc({vertexArray:o._vaNoise,shaderProgram:o._spNoise,outputTexture:o._noiseTexture,uniformMap:{u_noiseTextureDimensions:dEe(o),u_noiseDetail:function(){return l},u_noiseOffset:function(){return u}},persists:!1,owner:e,postExecute:function(h){o._ready=!0,o._loading=!1}});t.commandList.push(f),o._loading=!0}function hSt(e,t){let n=e,i=t.context;n._createVertexArray=!1,n._vaf=n._vaf&&n._vaf.destroy();let o=e._clouds,r=o.length;if(r>0){n._vaf=uSt(i,r,n._instanced);let s=n._vaf.writers,a;for(a=0;a<r;++a){let l=o[a];fSt(e,t,s,l)}n._vaf.commit(YZ(i))}}var mSt=[];function pSt(e,t){let n=t.context,i=e,r=i._clouds.length,s=i._cloudsToUpdate,a=i._cloudsToUpdateIndex,l=i._propertiesChanged,u=mSt;u.length=0,(l[ZEt]||l[QEt])&&u.push(mEe),(l[$Et]||l[tSt])&&u.push(pEe),(l[JEt]||l[eSt])&&u.push(_Ee),l[iSt]&&u.push(gEe);let f=u.length,h=i._vaf.writers,p,g,m;if(a/r>.1){for(p=0;p<a;++p)for(g=s[p],g._dirty=!1,m=0;m<f;++m)u[m](e,t,h,g);i._vaf.commit(YZ(n))}else{for(p=0;p<a;++p){for(g=s[p],g._dirty=!1,m=0;m<f;++m)u[m](e,t,h,g);i._instanced?i._vaf.subCommit(g._index,1):i._vaf.subCommit(g._index*4,4)}i._vaf.endSubCommits()}i._cloudsToUpdateIndex=0}function _St(e,t,n,i){let o=t.context,r=e,s=new He({defines:[],sources:[n]});r._instanced&&s.defines.push("INSTANCED");let a=new He({defines:[],sources:[i]});r.debugBillboards&&a.defines.push("DEBUG_BILLBOARDS"),r.debugEllipsoids&&a.defines.push("DEBUG_ELLIPSOIDS"),r._sp=Jt.replaceCache({context:o,shaderProgram:r._sp,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:ff}),r._rs=Ve.fromCache({depthTest:{enabled:!0,func:ne.LESS},depthMask:!1,blending:ln.ALPHA_BLEND}),r._spCreated=!0,r._compiledDebugBillboards=r.debugBillboards,r._compiledDebugEllipsoids=r.debugEllipsoids}function gSt(e,t){let n=e,i=t.passes,o=n._uniforms,r=t.commandList;if(i.render){let s=n._colorCommands,a=n._vaf.va,l=a.length;s.length=l;for(let u=0;u<l;u++){let f=s[u];c(f)||(f=s[u]=new Qe),f.pass=De.TRANSLUCENT,f.owner=e,f.uniformMap=o,f.count=a[u].indicesCount,f.vertexArray=a[u].va,f.shaderProgram=n._sp,f.renderState=n._rs,n._instanced&&(f.count=6,f.instanceCount=n._clouds.length),r.push(f)}}}Zh.prototype.update=function(e){if(qZ(this),!this.show)return;let t=this.debugBillboards||this.debugEllipsoids;this._ready=t?!0:c(this._noiseTexture),!this._ready&&!this._loading&&!t&&dSt(this,e,ZF,$F),this._instanced=e.context.instancedArrays,ff=this._instanced?KEt:XEt,YZ=this._instanced?cSt:aSt;let i=this._clouds.length,o=this._cloudsToUpdate,r=this._cloudsToUpdateIndex;this._createVertexArray?hSt(this,e):r>0&&pSt(this,e),r>i*1.5&&(o.length=i),!(!c(this._vaf)||!c(this._vaf.va)||!this._ready&!t)&&((!this._spCreated||this.debugBillboards!==this._compiledDebugBillboards||this.debugEllipsoids!==this._compiledDebugEllipsoids)&&_St(this,e,KF,XF),gSt(this,e))};Zh.prototype.isDestroyed=function(){return!1};Zh.prototype.destroy=function(){return this._noiseTexture=this._noiseTexture&&this._noiseTexture.destroy(),this._sp=this._sp&&this._sp.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),hEe(this._clouds),de(this)};var XZ=Zh;var ySt=O.toRadians(30);function KZ(e){this._angle=e??ySt}Object.defineProperties(KZ.prototype,{angle:{get:function(){return this._angle},set:function(e){T.typeOf.number("value",e),this._angle=e}}});KZ.prototype.emit=function(e){let t=Math.tan(this._angle),n=O.randomBetween(0,O.TWO_PI),i=O.randomBetween(0,t),o=i*Math.cos(n),r=i*Math.sin(n),s=1;e.velocity=d.fromElements(o,r,s,e.velocity),d.normalize(e.velocity,e.velocity),e.position=d.clone(d.ZERO,e.position)};var $Z=KZ;var bSt=new G,xSt=new G,TSt=new G,ASt=new G,yEe=new se,ak=new Uint8Array(4);function bEe(e,t,n,i){let o=t.height===n.height?0:(e-t.height)/(n.height-t.height);return G.lerp(t.color,n.color,o,i)}function qG(e,t){return{height:e,color:G.clone(t)}}function xEe(e){return e=e.filter(function(t,n,i){let o=n>0,r=n<i.length-1,s=o?t.height===i[n-1].height:!0,a=r?t.height===i[n+1].height:!0;return!s||!a}),e=e.filter(function(t,n,i){let o=n>0,r=n<i.length-1,s=o?G.equals(t.color,i[n-1].color):!1,a=r?G.equals(t.color,i[n+1].color):!1;return!s||!a}),e=e.filter(function(t,n,i){let o=n>0,r=o?G.equals(t.color,i[n-1].color):!1,s=o?t.height===i[n-1].height:!0;return!r||!s}),e}function CSt(e){let t,n,i=[],o=e.length;for(t=0;t<o;t++){let r=e[t],s=r.entries,a=s.length;if(!Array.isArray(s)||a===0)throw new E("entries must be an array with size > 0.");let l=[];for(n=0;n<a;n++){let g=s[n];if(!c(g.height))throw new E("entry requires a height.");if(!c(g.color))throw new E("entry requires a color.");let m=O.clamp(g.height,cu._minimumHeight,cu._maximumHeight),y=G.clone(g.color,bSt);y.red*=y.alpha,y.green*=y.alpha,y.blue*=y.alpha,l.push(qG(m,y))}let u=!0,f=!0;for(n=0;n<a-1;n++){let g=l[n+0],m=l[n+1];u=u&&g.height<=m.height,f=f&&g.height>=m.height}f?l=l.reverse():u||gg(l,function(g,m){return O.sign(g.height-m.height)});let h=r.extendDownwards??!1,p=r.extendUpwards??!1;l.length===1&&!h&&!p&&(h=!0,p=!0),h&&l.splice(0,0,qG(cu._minimumHeight,l[0].color)),p&&l.splice(l.length,0,qG(cu._maximumHeight,l[l.length-1].color)),l=xEe(l),i.push(l)}return i}function ESt(e){let t=CSt(e),n=[],i=[],o;function r(u,f){n.push(qG(u,f))}function s(u,f,h){let p=G.multiplyByScalar(h,1-f.alpha,ASt);p=G.add(p,f,p),r(u,p)}let a=t.length;for(o=0;o<a;o++){let u=t[o],f=0,h=0;i=n,n=[];let p=u.length,g=i.length;for(;f<p||h<g;){let m=f<p?u[f]:void 0,y=f>0?u[f-1]:void 0,b=f<p-1?u[f+1]:void 0,x=h<g?i[h]:void 0,A=h>0?i[h-1]:void 0,C=h<g-1?i[h+1]:void 0;if(c(m)&&c(x)&&m.height===x.height){let S=c(C)&&x.height===C.height,v=!c(A),P=!c(C),M=c(b)&&m.height===b.height,R=!c(y),L=!c(b);S?M?(s(m.height,m.color,x.color),s(m.height,b.color,C.color)):R?(r(m.height,x.color),s(m.height,m.color,C.color)):L?(s(m.height,m.color,x.color),r(m.height,C.color)):(s(m.height,m.color,x.color),s(m.height,m.color,C.color)):v?M?(r(m.height,m.color),s(m.height,b.color,x.color)):L?(r(m.height,m.color),r(m.height,x.color)):(R||r(m.height,m.color),s(m.height,m.color,x.color)):P?M?(s(m.height,m.color,x.color),r(m.height,b.color)):R?(r(m.height,x.color),r(m.height,m.color)):L?s(m.height,m.color,x.color):(s(m.height,m.color,x.color),r(m.height,m.color)):M?(s(m.height,m.color,x.color),s(m.height,b.color,x.color)):R?(r(m.height,x.color),s(m.height,m.color,x.color)):L?(s(m.height,m.color,x.color),r(m.height,x.color)):s(m.height,m.color,x.color),f+=M?2:1,h+=S?2:1}else if(c(m)&&c(x)&&c(A)&&m.height<x.height){let S=bEe(m.height,A,x,TSt);c(y)?c(b)?s(m.height,m.color,S):(s(m.height,m.color,S),r(m.height,S)):(r(m.height,S),s(m.height,m.color,S)),f++}else if(c(x)&&c(m)&&c(y)&&x.height<m.height){let S=bEe(x.height,y,m,xSt);c(A)?c(C)?s(x.height,S,x.color):(s(x.height,S,x.color),r(x.height,S)):(r(x.height,S),s(x.height,S,x.color)),h++}else c(m)&&(!c(x)||m.height<x.height)?(c(x)&&!c(A)&&!c(b)?(r(m.height,m.color),r(m.height,cu._emptyColor),r(x.height,cu._emptyColor)):(!c(x)&&c(A)&&!c(y)&&(r(A.height,cu._emptyColor),r(m.height,cu._emptyColor)),r(m.height,m.color)),f++):c(x)&&(!c(m)||x.height<m.height)&&(r(x.height,x.color),h++)}}return xEe(n)}function cu(e){let{scene:t,layers:n}=e??W.EMPTY_OBJECT;T.typeOf.object("options.scene",t),T.defined("options.layers",n),T.typeOf.number.greaterThan("options.layers.length",n.length,0);let{context:i}=t,o=ESt(n),r=o.length,s,a,l;if(!cu._useFloatTexture(i)){a=Ue.UNSIGNED_BYTE,l=ke.RGBA,s=new Uint8Array(r*4);for(let g=0;g<r;g++)se.packFloat(o[g].height,yEe),se.pack(yEe,s,g*4)}else{a=Ue.FLOAT,l=i.webgl2?ke.RED:ke.LUMINANCE,s=new Float32Array(r);for(let g=0;g<r;g++)s[g]=o[g].height}let f=Rt.create({context:i,pixelFormat:l,pixelDatatype:a,source:{arrayBufferView:s,width:r,height:1},sampler:new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.NEAREST,magnificationFilter:li.NEAREST})}),h=new Uint8Array(r*4);for(let g=0;g<r;g++)o[g].color.toBytes(ak),h[g*4+0]=ak[0],h[g*4+1]=ak[1],h[g*4+2]=ak[2],h[g*4+3]=ak[3];let p=Rt.create({context:i,pixelFormat:ke.RGBA,pixelDatatype:Ue.UNSIGNED_BYTE,source:{arrayBufferView:h,width:r,height:1},sampler:new Qt({wrapS:gn.CLAMP_TO_EDGE,wrapT:gn.CLAMP_TO_EDGE,minificationFilter:Yt.LINEAR,magnificationFilter:li.LINEAR})});return Xi.fromType("ElevationBand",{heights:f,colors:p})}cu._useFloatTexture=function(e){return e.floatingPointTexture};cu._maximumHeight=5906376425472;cu._minimumHeight=-5906376425472;cu._emptyColor=new G(0,0,0,0);var ZZ=cu;async function SSt(e,t){t=t??{},t.cacheBytes=t.cacheBytes??1536*1024*1024,t.maximumCacheOverflowBytes=t.maximumCacheOverflowBytes??1024*1024*1024,t.enableCollision=t.enableCollision??!0,e=e??W.EMPTY_OBJECT,T.typeOf.object("apiOptions",e),e.onlyUsingWithGoogleGeocoder||dt("google-tiles-with-google-geocoder","Only the Google geocoder can be used with Google Photorealistic 3D Tiles.  Set the `geocode` property of Viewer constructor options.  You can set additionalOptions.onlyUsingWithGoogleGeocoder to hide this warning once you have configured the geocoder.");let n=e.key??OA.defaultApiKey;if(!c(n))return wSt(t);let i,o=OA.getDefaultCredit();c(o)&&(i=[o]);let r=new we({url:`${OA.mapTilesApiEndpoint}3dtiles/root.json`,queryParameters:{key:n},credits:i});return bs.fromUrl(r,t)}var TEe={};async function wSt(e){let i=TEe[2275207];c(i)||(i=Cu.fromAssetId(2275207),TEe[2275207]=i);let o=await i;return bs.fromUrl(o,e)}var QZ=SSt;async function vSt(e){let t=await bs.fromIonAssetId(96188,e);e=e??W.EMPTY_OBJECT;let n=e.style;if(!c(n)){let i=(e.defaultColor??G.WHITE).toCssColorString();n=new NA({color:`Boolean(\${feature['cesium#color']}) ? color(\${feature['cesium#color']}) : ${i}`})}return t.style=n,t}var JZ=vSt;function DSt(e){e=e??W.EMPTY_OBJECT;let t=[],n=e.geometry;if(!c(n))throw new E("options.geometry is required.");(!c(n.attributes)||!c(n.primitiveType))&&(n=n.constructor.createGeometry(n));let i=n.attributes,o=B.clone(e.modelMatrix??B.IDENTITY),r=e.length??1e4;if(c(i.normal)&&t.push(new St({geometry:Nn.createLineSegmentsForVectors(n,"normal",r),attributes:{color:new Gt(1,0,0,1)},modelMatrix:o})),c(i.tangent)&&t.push(new St({geometry:Nn.createLineSegmentsForVectors(n,"tangent",r),attributes:{color:new Gt(0,1,0,1)},modelMatrix:o})),c(i.bitangent)&&t.push(new St({geometry:Nn.createLineSegmentsForVectors(n,"bitangent",r),attributes:{color:new Gt(0,0,1,1)},modelMatrix:o})),t.length>0)return new Pn({asynchronous:!1,geometryInstances:t,appearance:new rn({flat:!0,translucent:!1})})}var eQ=DSt;function ck(e){e=e??W.EMPTY_OBJECT;let t=e.attributeName,n=e.perInstanceAttribute;if(!c(t))throw new E("options.attributeName is required.");c(n)||(n=!1);let i=e.glslDatatype??"vec3",o=`v_${t}`,r;if(t==="normal"||t==="tangent"||t==="bitangent")r=`vec4 getColor() { return vec4((${o} + vec3(1.0)) * 0.5, 1.0); }
`;else switch(t==="st"&&(i="vec2"),i){case"float":r=`vec4 getColor() { return vec4(vec3(${o}), 1.0); }
`;break;case"vec2":r=`vec4 getColor() { return vec4(${o}, 0.0, 1.0); }
`;break;case"vec3":r=`vec4 getColor() { return vec4(${o}, 1.0); }
`;break;case"vec4":r=`vec4 getColor() { return ${o}; }
`;break;default:throw new E("options.glslDatatype must be float, vec2, vec3, or vec4.")}let s=`in vec3 position3DHigh;
in vec3 position3DLow;
in float batchId;
${n?"":`in ${i} ${t};
`}out ${i} ${o};
void main()
{
vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);
${n?`${o} = czm_batchTable_${t}(batchId);
`:`${o} = ${t};
`}gl_Position = czm_modelViewProjectionRelativeToEye * p;
}`,a=`in ${i} ${o};
${r}
void main()
{
out_FragColor = getColor();
}`;this.material=void 0,this.translucent=e.translucent??!1,this._vertexShaderSource=e.vertexShaderSource??s,this._fragmentShaderSource=e.fragmentShaderSource??a,this._renderState=io.getDefaultRenderState(!1,!1,e.renderState),this._closed=e.closed??!1,this._attributeName=t,this._glslDatatype=i}Object.defineProperties(ck.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},attributeName:{get:function(){return this._attributeName}},glslDatatype:{get:function(){return this._glslDatatype}}});ck.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;ck.prototype.isTranslucent=io.prototype.isTranslucent;ck.prototype.getRenderState=io.prototype.getRenderState;var tQ=ck;function YG(e){e=e??W.EMPTY_OBJECT,this.length=e.length??1e7,this._length=void 0,this.width=e.width??2,this._width=void 0,this.show=e.show??!0,this.modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._modelMatrix=new B,this.id=e.id,this._id=void 0,this._primitive=void 0}YG.prototype.update=function(e){if(this.show){if(!c(this._primitive)||!B.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=B.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,c(this._primitive)&&this._primitive.destroy(),this.modelMatrix[12]===0&&this.modelMatrix[13]===0&&this.modelMatrix[14]===0&&(this.modelMatrix[14]=.01);let t=new St({geometry:new ng({positions:[d.ZERO,d.UNIT_X],width:this.width,vertexFormat:is.VERTEX_FORMAT,colors:[G.RED,G.RED],arcType:qt.NONE}),modelMatrix:B.multiplyByUniformScale(this.modelMatrix,this.length,new B),id:this.id,pickPrimitive:this}),n=new St({geometry:new ng({positions:[d.ZERO,d.UNIT_Y],width:this.width,vertexFormat:is.VERTEX_FORMAT,colors:[G.GREEN,G.GREEN],arcType:qt.NONE}),modelMatrix:B.multiplyByUniformScale(this.modelMatrix,this.length,new B),id:this.id,pickPrimitive:this}),i=new St({geometry:new ng({positions:[d.ZERO,d.UNIT_Z],width:this.width,vertexFormat:is.VERTEX_FORMAT,colors:[G.BLUE,G.BLUE],arcType:qt.NONE}),modelMatrix:B.multiplyByUniformScale(this.modelMatrix,this.length,new B),id:this.id,pickPrimitive:this});this._primitive=new Pn({geometryInstances:[t,n,i],appearance:new is,asynchronous:!1})}this._primitive.update(e)}};YG.prototype.isDestroyed=function(){return!1};YG.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),de(this)};var lk=YG;function PSt(e){if(T.typeOf.object("options",e),T.typeOf.object("options.direction",e.direction),d.equals(e.direction,d.ZERO))throw new E("options.direction cannot be zero-length");this.direction=d.clone(e.direction),this.color=G.clone(e.color??G.WHITE),this.intensity=e.intensity??1}var nQ=PSt;var uk=`in vec3 v_positionMC;
in vec3 v_positionEC;
in vec2 v_st;
void main()
{
czm_materialInput materialInput;
vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));
#ifdef FACE_FORWARD
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
#endif
materialInput.s = v_st.s;
materialInput.st = v_st;
materialInput.str = vec3(v_st, 0.0);
materialInput.normalEC = normalEC;
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);
vec3 positionToEyeEC = -v_positionEC;
materialInput.positionToEyeEC = positionToEyeEC;
czm_material material = czm_getMaterial(materialInput);
#ifdef FLAT
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
#endif
}
`;var fk=`in vec3 position3DHigh;
in vec3 position3DLow;
in vec2 st;
in float batchId;
out vec3 v_positionMC;
out vec3 v_positionEC;
out vec2 v_st;
void main()
{
vec4 p = czm_computePosition();
v_positionMC = position3DHigh + position3DLow;
v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
v_st = st;
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function kA(e){e=e??W.EMPTY_OBJECT;let t=e.translucent??!0,n=e.aboveGround??!1;this.material=c(e.material)?e.material:Xi.fromType(Xi.ColorType),this.translucent=e.translucent??!0,this._vertexShaderSource=e.vertexShaderSource??fk,this._fragmentShaderSource=e.fragmentShaderSource??uk,this._renderState=io.getDefaultRenderState(t,!n,e.renderState),this._closed=!1,this._flat=e.flat??!1,this._faceForward=e.faceForward??n,this._aboveGround=n}Object.defineProperties(kA.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return kA.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}});kA.VERTEX_FORMAT=Ie.POSITION_AND_ST;kA.prototype.getFragmentShaderSource=io.prototype.getFragmentShaderSource;kA.prototype.isTranslucent=io.prototype.isTranslucent;kA.prototype.getRenderState=io.prototype.getRenderState;var iQ=kA;function lu(e){if(!c(e)||!c(e.scene))throw new E("options.scene is required.");this._scene=e.scene,this.samplingWindow=e.samplingWindow??lu.defaultSettings.samplingWindow,this.quietPeriod=e.quietPeriod??lu.defaultSettings.quietPeriod,this.warmupPeriod=e.warmupPeriod??lu.defaultSettings.warmupPeriod,this.minimumFrameRateDuringWarmup=e.minimumFrameRateDuringWarmup??lu.defaultSettings.minimumFrameRateDuringWarmup,this.minimumFrameRateAfterWarmup=e.minimumFrameRateAfterWarmup??lu.defaultSettings.minimumFrameRateAfterWarmup,this._lowFrameRate=new pe,this._nominalFrameRate=new pe,this._frameTimes=[],this._needsQuietPeriod=!0,this._quietPeriodEndTime=0,this._warmupPeriodEndTime=0,this._frameRateIsLow=!1,this._lastFramesPerSecond=void 0,this._pauseCount=0;let t=this;this._preUpdateRemoveListener=this._scene.preUpdate.addEventListener(function(o,r){ISt(t,r)}),this._hiddenPropertyName=document.hidden!==void 0?"hidden":document.mozHidden!==void 0?"mozHidden":document.msHidden!==void 0?"msHidden":document.webkitHidden!==void 0?"webkitHidden":void 0;let n=document.hidden!==void 0?"visibilitychange":document.mozHidden!==void 0?"mozvisibilitychange":document.msHidden!==void 0?"msvisibilitychange":document.webkitHidden!==void 0?"webkitvisibilitychange":void 0;function i(){OSt(t)}this._visibilityChangeRemoveListener=void 0,c(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}lu.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8};lu.fromScene=function(e){if(!c(e))throw new E("scene is required.");return(!c(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new lu({scene:e})),e._frameRateMonitor};Object.defineProperties(lu.prototype,{scene:{get:function(){return this._scene}},lowFrameRate:{get:function(){return this._lowFrameRate}},nominalFrameRate:{get:function(){return this._nominalFrameRate}},lastFramesPerSecond:{get:function(){return this._lastFramesPerSecond}}});lu.prototype.pause=function(){++this._pauseCount,this._pauseCount===1&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)};lu.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)};lu.prototype.isDestroyed=function(){return!1};lu.prototype.destroy=function(){return this._preUpdateRemoveListener(),c(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),de(this)};function ISt(e,t){if(e._pauseCount>0)return;let n=Ti();if(e._needsQuietPeriod)e._needsQuietPeriod=!1,e._frameTimes.length=0,e._quietPeriodEndTime=n+e.quietPeriod/qn.SECONDS_PER_MILLISECOND,e._warmupPeriodEndTime=e._quietPeriodEndTime+(e.warmupPeriod+e.samplingWindow)/qn.SECONDS_PER_MILLISECOND;else if(n>=e._quietPeriodEndTime){e._frameTimes.push(n);let i=n-e.samplingWindow/qn.SECONDS_PER_MILLISECOND;if(e._frameTimes.length>=2&&e._frameTimes[0]<=i){for(;e._frameTimes.length>=2&&e._frameTimes[1]<i;)e._frameTimes.shift();let o=(n-e._frameTimes[0])/(e._frameTimes.length-1);e._lastFramesPerSecond=1e3/o;let r=1e3/(n>e._warmupPeriodEndTime?e.minimumFrameRateAfterWarmup:e.minimumFrameRateDuringWarmup);o>r?e._frameRateIsLow||(e._frameRateIsLow=!0,e._needsQuietPeriod=!0,e.lowFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond)):e._frameRateIsLow&&(e._frameRateIsLow=!1,e._needsQuietPeriod=!0,e.nominalFrameRate.raiseEvent(e.scene,e._lastFramesPerSecond))}}}function OSt(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}var dk=lu;var AEe=Zo(fZ(),1);function oQ(){this._image=new Image}oQ.prototype.isReady=function(){return!0};oQ.prototype.shouldDiscardImage=function(e){return e===this._image};function UA(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new Ki({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-O.PI,-O.PI,O.PI,O.PI),ellipsoid:e.ellipsoid});let t=e.credit;typeof t=="string"&&(t=new Tt(t)),this._credit=t,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,c(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new oQ),this._errorEvent=new pe}Object.defineProperties(UA.prototype,{url:{get:function(){return this._metadata.url}},proxy:{get:function(){return this._metadata.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});UA.fromMetadata=function(e,t){if(T.defined("metadata",e),!e.imageryPresent)throw new ae(`The server ${e.url} doesn't have imagery`);let n=new UA(t);return n._metadata=e,n};UA.prototype.getTileCredits=function(e,t,n){let i=this._metadata,o=i.getTileInformation(e,t,n);if(c(o)){let r=i.providers[o.imageryProvider];if(c(r))return[r]}};UA.prototype.requestImage=function(e,t,n,i){let o=this._tileDiscardPolicy._image,r=this._metadata,s=Og.tileXYToQuadKey(e,t,n),a=r.getTileInformation(e,t,n);if(!c(a)){if(r.isValid(s)){let u=new Qo({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction});r.populateSubtree(e,t,n,u);return}return Promise.resolve(o)}if(!a.hasImagery())return Promise.resolve(o);let l=RSt(this,a,e,t,n,i).fetchArrayBuffer();if(c(l))return l.then(function(u){$3(r.key,u);let f=new Uint8Array(u),h,p=r.protoImagery;if((!c(p)||!p)&&(h=MSt(f)),!c(h)&&(!c(p)||p)){let g=LSt(f);h=g.imageType,f=g.imageData}return!c(h)||!c(f)?o:ux({uint8Array:f,format:h,flipY:!0})})};UA.prototype.pickFeatures=function(e,t,n,i,o){};function RSt(e,t,n,i,o,r){let s=Og.tileXYToQuadKey(n,i,o),a=t.imageryVersion;return a=c(a)&&a>0?a:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1-0${s}-i.${a.toString()}`,request:r})}function MSt(e){let t="JFIF";if(e[6]===t.charCodeAt(0)&&e[7]===t.charCodeAt(1)&&e[8]===t.charCodeAt(2)&&e[9]===t.charCodeAt(3))return"image/jpeg";let n="PNG";if(e[1]===n.charCodeAt(0)&&e[2]===n.charCodeAt(1)&&e[3]===n.charCodeAt(2))return"image/png"}function LSt(e){let t=AEe.Reader.create(e),n=t.len,i={};for(;t.pos<n;){let s=t.uint32(),a;switch(s>>>3){case 1:i.imageType=t.uint32();break;case 2:i.imageData=t.bytes();break;case 3:i.alphaType=t.uint32();break;case 4:i.imageAlpha=t.bytes();break;case 5:if(a=i.copyrightIds,c(a)||(a=i.copyrightIds=[]),(s&7)===2){let l=t.uint32()+t.pos;for(;t.pos<l;)a.push(t.uint32())}else a.push(t.uint32());break;default:t.skipType(s&7);break}}let o=i.imageType;if(c(o))switch(o){case 0:i.imageType="image/jpeg";break;case 4:i.imageType="image/png";break;default:throw new ae("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}let r=i.alphaType;return c(r)&&r!==0&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete i.alphaType,delete i.imageAlpha),i}var rQ=UA;var NSt=new G(1,1,1,.4),FSt=new G(0,1,0,.05),BSt=new G(0,.5,0,.2);function VA(e){e=e??W.EMPTY_OBJECT,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tilingScheme=c(e.tilingScheme)?e.tilingScheme:new Ki({ellipsoid:e.ellipsoid}),this._cells=e.cells??8,this._color=e.color??NSt,this._glowColor=e.glowColor??FSt,this._glowWidth=e.glowWidth??6,this._backgroundColor=e.backgroundColor??BSt,this._errorEvent=new pe,this._tileWidth=e.tileWidth??256,this._tileHeight=e.tileHeight??256,this._canvasSize=e.canvasSize??256,this._canvas=this._createGridCanvas()}Object.defineProperties(VA.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}});VA.prototype._drawGrid=function(e){let n=this._canvasSize;for(let i=0;i<=this._cells;++i){let r=1+i/this._cells*(n-1);e.moveTo(r,0),e.lineTo(r,n),e.moveTo(0,r),e.lineTo(n,r)}e.stroke()};VA.prototype._createGridCanvas=function(){let e=document.createElement("canvas");e.width=this._canvasSize,e.height=this._canvasSize;let t=0,n=this._canvasSize,i=e.getContext("2d"),o=this._backgroundColor.toCssColorString();i.fillStyle=o,i.fillRect(t,t,n,n);let r=this._glowColor.toCssColorString();i.strokeStyle=r,i.lineWidth=this._glowWidth,i.strokeRect(t,t,n,n),this._drawGrid(i),i.lineWidth=this._glowWidth*.5,i.strokeRect(t,t,n,n),this._drawGrid(i);let s=this._color.toCssColorString();return i.strokeStyle=s,i.lineWidth=2,i.strokeRect(t,t,n,n),i.lineWidth=1,this._drawGrid(i),e};VA.prototype.getTileCredits=function(e,t,n){};VA.prototype.requestImage=function(e,t,n,i){return Promise.resolve(this._canvas)};VA.prototype.pickFeatures=function(e,t,n,i,o){};var sQ=VA;function Qh(){}Qh._maxDecodingConcurrency=Math.max(Vt.hardwareConcurrency-1,1);Qh._decodeTaskProcessor=new yi("decodeI3S",Qh._maxDecodingConcurrency);Qh._promise=void 0;async function kSt(){if(await Qh._decodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}))return Qh._decodeTaskProcessor;throw new ae("I3S decoder could not be initialized.")}Qh.decode=async function(e,t,n,i,o){return T.typeOf.string("url",e),T.defined("defaultGeometrySchema",t),T.defined("geometryData",n),c(Qh._promise)||(Qh._promise=kSt()),Qh._promise.then(function(r){let s=n._parent._data,a=n._parent._inverseRotationMatrix,l=0,u=0,f=0;c(s.obb)?(l=s.obb.center[0],u=s.obb.center[1],f=s.obb.center[2]):c(s.mbs)&&(l=s.mbs[0],u=s.mbs[1],f=s.mbs[2]);let h=J.fromRotationX(-O.PI_OVER_TWO),p=new J;J.multiply(h,a,p);let g=he.fromDegrees(l,u,f),m=ie.WGS84.cartographicToCartesian(g),y={binaryData:n._data,featureData:c(i)&&c(i[0])?i[0].data:void 0,schema:t,bufferInfo:n._geometryBufferInfo,ellipsoidRadiiSquare:ie.WGS84.radiiSquared,url:e,geoidDataList:n._dataProvider._geoidDataList,cartographicCenter:g,cartesianCenter:m,parentRotation:p,enableFeatures:n._dataProvider.showFeatures,splitGeometryByColorTransparency:n._dataProvider.adjustMaterialAlphaMode,symbologyData:o,calculateNormals:n._dataProvider.calculateNormals};return r.scheduleTask(y)})};var hk=Qh;function aQ(e,t){this._parent=e,this._dataProvider=e._dataProvider,this._layer=e._layer,c(this._parent._nodeIndex)?this._resource=this._parent._layer.resource.getDerivedResource({url:`nodes/${this._parent._data.mesh.attribute.resource}/${t}`}):this._resource=this._parent.resource.getDerivedResource({url:t})}Object.defineProperties(aQ.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}}});aQ.prototype.load=async function(){return this._data=await Jh.loadJson(this._resource),this._data};var mk=aQ;function Mg(e,t){this._storageInfo=t,this._parent=e,this._dataProvider=e._dataProvider,this._loadPromise=void 0;let n=`attributes/${t.key}/0`;c(this._parent._nodeIndex)?this._resource=this._parent._layer.resource.getDerivedResource({url:`nodes/${this._parent._data.mesh.attribute.resource}/${n}`}):this._resource=this._parent.resource.getDerivedResource({url:n})}Object.defineProperties(Mg.prototype,{resource:{get:function(){return this._resource}},header:{get:function(){return this._header}},values:{get:function(){if(c(this._values)){if(c(this._values.attributeValues))return this._values.attributeValues;if(c(this._values.objectIds))return this._values.objectIds}return[]}},name:{get:function(){return this._storageInfo.name}}});function XG(e){return e==="UInt8"||e==="Int8"?1:e==="UInt16"||e==="Int16"?2:e==="UInt32"||e==="Int32"||e==="Oid32"||e==="Float32"?4:e==="UInt64"||e==="Int64"||e==="Float64"?8:0}function USt(e){return e==="String"?1:XG(e)}async function VSt(e){let t=await e._dataProvider._loadBinary(e._resource),n=new DataView(t);e._data=t,e._validateHeader(n);let i=e._parseHeader(n),o=e._getBodyOffset(i);e._validateBody(n,o),e._parseBody(n,o)}Mg.prototype.load=function(){return c(this._loadPromise)?this._loadPromise:(this._loadPromise=VSt(this).catch(function(e){console.error(e)}),this._loadPromise)};Mg.prototype._parseValue=function(e,t,n){let i;if(t==="UInt8")i=e.getUint8(n),n+=1;else if(t==="Int8")i=e.getInt8(n),n+=1;else if(t==="UInt16")i=e.getUint16(n,!0),n+=2;else if(t==="Int16")i=e.getInt16(n,!0),n+=2;else if(t==="UInt32")i=e.getUint32(n,!0),n+=4;else if(t==="Oid32")i=e.getUint32(n,!0),n+=4;else if(t==="Int32")i=e.getInt32(n,!0),n+=4;else if(t==="UInt64"){let o=e.getUint32(n,!0),r=e.getUint32(n+4,!0);i=o+Math.pow(2,32)*r,n+=8}else if(t==="Int64"){let o=e.getUint32(n,!0),r=e.getUint32(n+4,!0);r<Math.pow(2,31)?i=o+Math.pow(2,32)*r:i=o+Math.pow(2,32)*(r-Math.pow(2,32)),n+=8}else t==="Float32"?(i=e.getFloat32(n,!0),n+=4):t==="Float64"?(i=e.getFloat64(n,!0),n+=8):t==="String"&&(i=String.fromCharCode(e.getUint8(n)),n+=1);return{value:i,offset:n}};Mg.prototype._parseHeader=function(e){let t=0;this._header={};for(let n=0;n<this._storageInfo.header.length;n++){let i=this._storageInfo.header[n],o=this._parseValue(e,i.valueType,t);this._header[i.property]=o.value,t=o.offset}return t};Mg.prototype._parseBody=function(e,t){this._values={};for(let n=0;n<this._storageInfo.ordering.length;n++){let i=this._storageInfo.ordering[n],o=i==="ObjectIds"?"objectIds":i,r=this._storageInfo[o];if(c(r)){this._values[o]=[];for(let s=0;s<this._header.count;++s)if(r.valueType!=="String"){let a=this._parseValue(e,r.valueType,t);this._values[o].push(a.value),t=a.offset}else{let a=this._values.attributeByteCounts[s],l="";for(let u=0;u<a;++u){let f=this._parseValue(e,r.valueType,t);f.value.charCodeAt(0)!==0&&(l+=f.value),t=f.offset}this._values[o].push(l)}}}};Mg.prototype._getBodyOffset=function(e){let t=0;return c(this._storageInfo.attributeValues)?t=XG(this._storageInfo.attributeValues.valueType):c(this._storageInfo.objectIds)&&(t=XG(this._storageInfo.objectIds.valueType)),t>0?Math.ceil(e/t)*t:e};Mg.prototype._validateHeader=function(e){let t=0;for(let n=0;n<this._storageInfo.header.length;n++){let i=this._storageInfo.header[n];t+=USt(i.valueType)}if(e.byteLength<t)throw new ae(`Invalid attribute buffer size (field: ${this.name}, header: ${t}, actual: ${e.byteLength})`)};Mg.prototype._validateBody=function(e,t){if(!c(this._header.count))throw new ae(`Invalid attribute buffer (field: ${this.name}, count is missing)`);let n;for(let i=0;i<this._storageInfo.ordering.length&&t<e.byteLength;i++){let o=this._storageInfo.ordering[i],r=o==="ObjectIds"?"objectIds":o,s=this._storageInfo[r];if(c(s))if(s.valueType!=="String"){r==="attributeByteCounts"&&(n=t);let a=XG(s.valueType);t+=a*this._header.count}else{if(!c(n))throw new ae(`Invalid attribute buffer (field: ${this.name}, attributeByteCounts is missing)`);for(let a=0;a<this._header.count&&t<e.byteLength;++a){let l=this._parseValue(e,this._storageInfo.attributeByteCounts.valueType,n);t+=l.value,n=l.offset}}else throw new ae(`Invalid attribute buffer (field: ${this.name}, ${r} is missing)`)}if(e.byteLength<t)throw new ae(`Invalid attribute buffer size (field: ${this.name}, expected: ${t}, actual: ${e.byteLength})`)};var pk=Mg;function _k(e,t){let n=e._dataProvider,i=e._layer,o;c(e._nodeIndex)?o=i.resource.getDerivedResource({url:`nodes/${e._data.mesh.geometry.resource}/${t}`}):o=e.resource.getDerivedResource({url:t}),this._parent=e,this._dataProvider=n,this._layer=i,this._resource=o,this._customAttributes=void 0}Object.defineProperties(_k.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}},customAttributes:{get:function(){return this._customAttributes}}});_k.prototype.load=function(){let e=this;return this._dataProvider._loadBinary(this._resource).then(function(t){return e._data=t,t})};var zSt=new d,HSt=new d,GSt=new d,jSt=new d,WSt=new d;function cQ(e,t,n,i){let o=d.subtract(i,n,zSt),r=d.cross(o,d.subtract(e,n,HSt),jSt),s=d.cross(o,d.subtract(t,n,GSt),WSt);return d.dot(r,s)>=0}var qSt=new d,YSt=new d,XSt=new d,KSt=new d,$St=new d,ZSt=new d,QSt=new d,JSt=new d,ewt=new d,twt=new d;_k.prototype.getClosestPointIndexOnTriangle=function(e,t,n){if(c(this._customAttributes)&&c(this._customAttributes.positions)){let i=new d(e,t,n);i.x-=this._customAttributes.cartesianCenter.x,i.y-=this._customAttributes.cartesianCenter.y,i.z-=this._customAttributes.cartesianCenter.z,J.multiplyByVector(this._customAttributes.parentRotation,i,i);let o=Number.MAX_VALUE,r,s,a,l,u=this._customAttributes.positions,f=this._customAttributes.indices,h;c(f)?h=f.length:h=u.length/3;for(let p=0;p<h;p++){let g,m,y;c(f)?(g=f[p],m=f[p+1],y=f[p+2]):(g=p*3,m=p*3+1,y=p*3+2);let b=d.fromElements(u[g*3],u[g*3+1],u[g*3+2],qSt),x=d.fromElements(u[m*3],u[m*3+1],u[m*3+2],YSt),A=new d(u[y*3],u[y*3+1],u[y*3+2],XSt);if(!cQ(i,b,x,A)||!cQ(i,x,b,A)||!cQ(i,A,b,x))continue;let C=d.subtract(x,b,KSt),S=d.subtract(A,b,$St),v=d.cross(C,S,ZSt);if(d.magnitude(v)===0)continue;let P=d.normalize(v,QSt),M=d.subtract(i,b,JSt),R=Math.abs(d.dot(M,P));if(R<o){o=R,r=p;let L=d.magnitudeSquared(d.subtract(i,b,M)),F=d.magnitudeSquared(d.subtract(i,x,ewt)),_=d.magnitudeSquared(d.subtract(i,A,twt));L<F&&L<_?(a=g,l=b,s=L):F<_?(a=m,l=x,s=F):(a=y,l=A,s=_)}}if(c(r))return{index:a,distanceSquared:s,distance:Math.sqrt(s),queriedPosition:i,closestPosition:d.clone(l)}}return{index:-1,distanceSquared:Number.Infinity,distance:Number.Infinity}};function CEe(e){let t=[],n=e.length;for(let i=0;i<n;i++)i<3?t.push(MA(e[i])):t.push(e[i]);return t}_k.prototype._generateGltf=function(e,t,n,i,o,r,s,a){let l={pbrMetallicRoughness:{metallicFactor:0},doubleSided:!0,name:"Material"},u=!1,f,h="";if(c(this._parent._data.mesh)&&c(this._layer._data.materialDefinitions)){let C=this._parent._data.mesh.material.definition;if(C>=0&&C<this._layer._data.materialDefinitions.length){if(f=this._layer._data.materialDefinitions[C],l=f,c(l.pbrMetallicRoughness)&&c(l.pbrMetallicRoughness.baseColorTexture)){u=!0,l.pbrMetallicRoughness.baseColorTexture.index=0;let S="0";if(c(this._layer._data.textureSetDefinitions))for(let v=0;v<this._layer._data.textureSetDefinitions.length;v++){let P=this._layer._data.textureSetDefinitions[v];for(let M=0;M<P.formats.length;M++){let R=P.formats[M];if(R.format==="jpg"){S=R.name;break}}}c(this._parent._data.mesh)&&this._parent._data.mesh.material.resource>=0&&(h=this._layer.resource.getDerivedResource({url:`nodes/${this._parent._data.mesh.material.resource}/textures/${S}`}).url)}c(l.pbrMetallicRoughness)&&c(l.pbrMetallicRoughness.baseColorFactor)&&(l.pbrMetallicRoughness.baseColorFactor=CEe(l.pbrMetallicRoughness.baseColorFactor)),c(l.emissiveFactor)&&(l.emissiveFactor=CEe(l.emissiveFactor))}}else c(this._parent._data.textureData)&&(u=!0,h=this._parent.resource.getDerivedResource({url:`${this._parent._data.textureData[0].href}`}).url,l.pbrMetallicRoughness.baseColorTexture={index:0});c(l.alphaMode)&&(l.alphaMode=l.alphaMode.toUpperCase());let p=[],g=[],m=[];u&&(p=[{sampler:0,source:0}],g=[{uri:h}],m=[{magFilter:9729,minFilter:9986,wrapS:10497,wrapT:10497}]);let y=[],b=n.length;for(let A=0;A<b;A++){let C=n[A].primitives,S=C.length;for(let v=0;v<S;v++){let P=C[v];if(c(P.material)){for(;P.material>=y.length;){let R=je(l,!0);y.push(R)}let M=y[P.material];c(P.extra)&&P.extra.isTransparent?c(M.alphaMode)||(M.alphaMode="BLEND"):M.alphaMode==="BLEND"&&(M.alphaMode="OPAQUE")}}}return{scene:0,scenes:[{nodes:e}],nodes:t,meshes:n,buffers:i,bufferViews:o,accessors:r,materials:y,textures:p,images:g,samplers:m,asset:{version:"2.0"},extensions:s,extensionsUsed:a}};var Qw=_k;function Bc(e,t,n){let i,o,r,s;n?(i=0,o=e):(i=e._level+1,o=e._layer),typeof t=="number"?r=t:s=e.resource.getDerivedResource({url:`${t}/`}),this._parent=e,this._dataProvider=e._dataProvider,this._isRoot=n,this._level=i,this._layer=o,this._nodeIndex=r,this._resource=s,this._isLoading=!1,this._tile=void 0,this._data=void 0,this._geometryData=[],this._featureData=[],this._fields={},this._children=[],this._childrenReadyPromise=void 0,this._globalTransform=void 0,this._inverseGlobalTransform=void 0,this._inverseRotationMatrix=void 0,this._symbologyData=void 0}Object.defineProperties(Bc.prototype,{resource:{get:function(){return this._resource}},layer:{get:function(){return this._layer}},parent:{get:function(){return this._parent}},children:{get:function(){return this._children}},geometryData:{get:function(){return this._geometryData}},featureData:{get:function(){return this._featureData}},fields:{get:function(){return this._fields}},tile:{get:function(){return this._tile}},data:{get:function(){return this._data}}});Bc.prototype.load=async function(){let e=this;function t(){if(!e._isRoot){let o=e._create3DTileDefinition();e._tile=new Zf(e._layer._tileset,e._dataProvider.resource,o,e._parent._tile),e._tile._i3sNode=e}}if(!c(this._nodeIndex)){let o=await Jh.loadJson(this._resource);e._data=o,t();return}let n=await this._layer._getNodeInNodePages(this._nodeIndex);e._data=n;let i;e._isRoot?i="nodes/root/":c(n.mesh)&&(i=`../${n.mesh.geometry.resource}/`),c(i)&&c(e._parent.resource)&&(e._resource=e._parent.resource.getDerivedResource({url:i})),t()};function EEe(e,t){let n=new pk(e,t);return e._fields[t.name]=n,n.load()}Bc.prototype.loadFields=function(){let e=this._layer._data.attributeStorageInfo,t=[];if(c(e))for(let n=0;n<e.length;n++){let i=e[n],o=this._fields[i.name];c(o)?t.push(o.load()):t.push(EEe(this,i))}return Promise.all(t)};Bc.prototype.loadField=function(e){T.defined("name",e);let t=this._fields[e];if(c(t))return t.load();let n=this._layer._data.attributeStorageInfo;if(c(n))for(let i=0;i<n.length;i++){let o=n[i];if(o.name===e)return EEe(this,o)}return Promise.resolve()};Bc.prototype.getFieldsForPickedPosition=function(e){let t=this.geometryData[0];if(!c(t.customAttributes.featureIndex))return{};let n=t.getClosestPointIndexOnTriangle(e.x,e.y,e.z);if(n.index===-1||n.index>t.customAttributes.featureIndex.length)return{};let i=t.customAttributes.featureIndex[n.index];return this.getFieldsForFeature(i)};Bc.prototype.getFieldsForFeature=function(e){let t={};for(let n in this.fields)if(this.fields.hasOwnProperty(n)){let i=this.fields[n];e>=0&&e<i.values.length&&(t[i.name]=i.values[e])}return t};Bc.prototype._loadChildren=function(){let e=this;if(c(this._childrenReadyPromise))return this._childrenReadyPromise;let t=[];if(c(e._data.children))for(let n=0;n<e._data.children.length;n++){let i=e._data.children[n],o=new Bc(e,i.href??i,!1);e._children.push(o),t.push(o.load())}return this._childrenReadyPromise=Promise.all(t).then(function(){for(let n=0;n<e._children.length;n++)e._tile.children.push(e._children[n]._tile)}),this._childrenReadyPromise};Bc.prototype._loadGeometryData=function(){let e=[];if(c(this._data.geometryData))for(let t=0;t<this._data.geometryData.length;t++){let n=new Qw(this,this._data.geometryData[t].href);this._geometryData.push(n),e.push(n.load())}else if(c(this._data.mesh)){let t=this._layer._findBestGeometryBuffers(this._data.mesh.geometry.definition,["position","uv0"]),n=`./geometries/${t.bufferIndex}/`,i=new Qw(this,n);i._geometryDefinitions=t.definition,i._geometryBufferInfo=t.geometryBufferInfo,this._geometryData.push(i),e.push(i.load())}return Promise.all(e)};Bc.prototype._loadFeatureData=function(){let e=[];if(c(this._data.featureData))for(let t=0;t<this._data.featureData.length;t++){let n=new mk(this,this._data.featureData[t].href);this._featureData.push(n),e.push(n.load())}return Promise.all(e)};Bc.prototype._clearGeometryData=function(){this._geometryData=[]};Bc.prototype._create3DTileDefinition=function(){let e=this._data.obb,t=this._data.mbs;if(!c(e)&&!c(t)){console.error("Failed to load I3S node. Bounding volume is required.");return}let n;if(c(e)?n=he.fromDegrees(e.center[0],e.center[1],e.center[2]):n=he.fromDegrees(t[0],t[1],t[2]),c(this._dataProvider._geoidDataList)&&c(n))for(let x=0;x<this._dataProvider._geoidDataList.length;x++){let A=this._dataProvider._geoidDataList[x],C=A.projection.project(n);if(C.x>A.nativeExtent.west&&C.x<A.nativeExtent.east&&C.y>A.nativeExtent.south&&C.y<A.nativeExtent.north){n.height+=rwt(C.x,C.y,A);break}}let i={},o,r=0;c(e)?(i={box:[0,0,0,e.halfSize[0],0,0,0,e.halfSize[1],0,0,0,e.halfSize[2]]},r=Math.max(Math.max(this._data.obb.halfSize[0],this._data.obb.halfSize[1]),this._data.obb.halfSize[2]),o=ie.WGS84.cartographicToCartesian(n)):(i={sphere:[0,0,0,t[3]]},o=ie.WGS84.cartographicToCartesian(n),r=this._data.mbs[3]),r*=2;let s=1/0;if(c(this._data.lodThreshold))if(this._layer._data.nodePages.lodSelectionMetricType==="maxScreenThresholdSQ"){let x=Math.sqrt(this._data.lodThreshold/(Math.PI*.25));s=r/x}else if(this._layer._data.nodePages.lodSelectionMetricType==="maxScreenThreshold"){let x=this._data.lodThreshold;s=r/x}else console.error("Invalid lodSelectionMetricType in Layer");else if(c(this._data.lodSelection))for(let x=0;x<this._data.lodSelection.length;x++)this._data.lodSelection[x].metricType==="maxScreenThreshold"&&(s=r/this._data.lodSelection[x].maxError);s===1/0&&(s=1e5);let a=s*16,l=new Oa(0,0,0),u=Ot.headingPitchRollQuaternion(o,l);c(this._data.obb)&&(u=new Le(this._data.obb.quaternion[0],this._data.obb.quaternion[1],this._data.obb.quaternion[2],this._data.obb.quaternion[3]));let f=J.fromQuaternion(u),h=J.inverse(f,new J),p=new B(f[0],f[1],f[2],0,f[3],f[4],f[5],0,f[6],f[7],f[8],0,o.x,o.y,o.z,1),g=B.inverse(p,new B),m=B.clone(p);c(this._parent._globalTransform)&&B.multiply(p,this._parent._inverseGlobalTransform,m),this._globalTransform=p,this._inverseGlobalTransform=g,this._inverseRotationMatrix=h;let y=[];for(let x=0;x<this._children.length;x++)y.push(this._children[x]._create3DTileDefinition());return{children:y,refine:"REPLACE",boundingVolume:i,transform:[m[0],m[4],m[8],m[12],m[1],m[5],m[9],m[13],m[2],m[6],m[10],m[14],m[3],m[7],m[11],m[15]],content:{uri:c(this._resource)?this._resource.url:void 0},geometricError:a}};Bc.prototype._loadSymbology=async function(){!c(this._symbologyData)&&c(this._layer._symbology)&&(this._symbologyData=await this._layer._symbology._getSymbology(this))};Bc.prototype._createContentURL=async function(){let e={scene:0,scenes:[{nodes:[0]}],nodes:[{name:"singleNode"}],meshes:[],buffers:[],bufferViews:[],accessors:[],materials:[],textures:[],images:[],samplers:[],asset:{version:"2.0"}},t=[this._loadGeometryData()];if(this._dataProvider.legacyVersion16&&t.push(this._loadFeatureData()),await Promise.all(t),c(this._geometryData)&&this._geometryData.length>0){this._dataProvider._applySymbology&&await this._loadSymbology();let o=this._geometryData[0].resource.url,r=this._layer._data.store.defaultGeometrySchema,s=this._geometryData[0],a=await hk.decode(o,r,s,this._featureData[0],this._symbologyData);if(!c(a))return;e=s._generateGltf(a.meshData.nodesInScene,a.meshData.nodes,a.meshData.meshes,a.meshData.buffers,a.meshData.bufferViews,a.meshData.accessors,a.meshData.rootExtensions,a.meshData.extensionsUsed),this._geometryData[0]._customAttributes=a.meshData._customAttributes}let n=this._dataProvider._binarizeGltf(e),i=new Blob([n],{type:"application/binary"});return URL.createObjectURL(i)};async function nwt(e){let t=e._layer._filters,n=[];for(let i=0;i<t.length;i++){let o=e.loadField(t[i].name);n.push(o)}return await Promise.all(n),t}function iwt(e,t,n){if(!c(n.values)||n.values.length===0)return!1;let i=c(t)?t.values:[],o;e<i.length&&(o=i[e]);let r=!1;for(let s=0;s<n.values.length;s++)if(n.values[s]===o){r=!0;break}return r}async function SEe(e,t){let n=e._tile.content.batchTable;if(c(n)&&n.featuresLength>0){n.setAllShow(!0);let i=await nwt(e);if(i.length>0)for(let o=0;o<n.featuresLength;o++)for(let r=0;r<i.length;r++){let s=i[r];if(!iwt(o,e._fields[s.name],s)){n.setShow(o,!1);break}}}t.show=!0}Bc.prototype._filterFeatures=function(){let e=[];for(let n=0;n<this._children.length;n++){let i=this._children[n]._filterFeatures();e.push(i)}let t=this._tile?.content?._model;if(c(this._geometryData)&&this._geometryData.length>0&&c(t)&&t.ready){t.show=!1;let n=SEe(this,t);e.push(n)}return Promise.all(e)};Zf.prototype._hookedRequestContent=Zf.prototype.requestContent;Zf.prototype.requestContent=function(){if(!this.tileset._isI3STileSet)return this._hookedRequestContent();if(!this._isLoading){this._isLoading=!0;let e=this;return this._i3sNode._createContentURL().then(t=>{if(!c(t)){e._isLoading=!1;return}return e._contentResource=new we({url:t}),e._hookedRequestContent()}).then(t=>{let n=t?._model;return c(e._i3sNode._geometryData)&&e._i3sNode._geometryData.length>0&&c(n)&&(n.show=!1,n.readyEvent.addEventListener(()=>{SEe(e._i3sNode,n)})),e._isLoading=!1,t})}};function owt(e,t,n,i,o,r){let s=n*(1-e)+i*e,a=o*(1-e)+r*e;return s*(1-t)+a*t}function KG(e,t,n,i){let o=e+t*n;return i[o]}function rwt(e,t,n){let i=n.nativeExtent,o=(e-i.west)/(i.east-i.west)*(n.width-1),r=(t-i.south)/(i.north-i.south)*(n.height-1),s=Math.floor(o),a=Math.floor(r);o-=s,r-=a;let l=s<n.width?s+1:s,u=a<n.height?a+1:a;a=n.height-1-a,u=n.height-1-u;let f=KG(s,a,n.width,n.buffer),h=KG(l,a,n.width,n.buffer),p=KG(s,u,n.width,n.buffer),g=KG(l,u,n.width,n.buffer),m=owt(o,r,f,h,p,g);return m=m*n.scale+n.offset,m}Object.defineProperties(Zf.prototype,{i3sNode:{get:function(){return this._i3sNode}}});var Jw=Bc;function $G(e){this._layer=e,this._defaultSymbology=void 0,this._valueFields=[],this._uniqueValueHash=void 0,this._classBreaksHash=void 0,this._parseLayerSymbology()}Object.defineProperties($G.prototype,{defaultSymbology:{get:function(){return this._defaultSymbology}}});function lQ(e,t){let n=[];for(let i=0;i<e.length;i++){let o=G.byteToFloat(e[i]);i<3?n.push(MA(o)):n.push(o)}return n.length===3&&(c(t)?n.push(1-t/100):n.push(1)),n}function ev(e,t){let n={edges:void 0,material:void 0};if(c(e)&&c(e.symbolLayers))for(let i=0;i<e.symbolLayers.length;i++){let o=e.symbolLayers[i];if(o.type==="Fill"){let r=o.edges,s=o.outline;if(c(r)?(n.edges={},c(r.color)&&(n.edges.color=lQ(r.color,r.transparency))):c(s)&&(n.edges={},c(s.color)&&(n.edges.color=lQ(s.color,s.transparency))),!t){let a=o.material;c(a)&&(n.material={colorMixMode:a.colorMixMode},c(a.color)&&(n.material.color=lQ(a.color,a.transparency)))}break}}return n}function swt(e,t){if(c(e.uniqueValueGroups)){let n={};for(let i=0;i<e.uniqueValueGroups.length;i++){let o=e.uniqueValueGroups[i].classes;if(c(o))for(let r=0;r<o.length;r++){let s=ev(o[r].symbol,t),a=o[r].values;for(let l=0;l<a.length;l++){let u=a[l],f=n;for(let h=0;h<u.length;h++){let p=u[h];h===u.length-1?f[p]=s:(c(f[p])||(f[p]={}),f=f[p])}}}}return n}if(c(e.uniqueValueInfos)){let n={};for(let i=0;i<e.uniqueValueInfos.length;i++){let o=e.uniqueValueInfos[i];n[o.value]=ev(o.symbol,t)}return n}}function awt(e,t){if(c(e.classBreakInfos)){let n=[...e.classBreakInfos];n.sort(function(o,r){let s=o.classMaxValue??o.classMinValue,a=r.classMaxValue??r.classMinValue;return s-a});let i={ranges:[],symbols:[]};c(e.minValue)&&(i.ranges.push(e.minValue),i.symbols.push(void 0));for(let o=0;o<n.length;o++){let r=n[o];c(r.classMinValue)&&(i.ranges.length===0||r.classMinValue>i.ranges[i.ranges.length-1])&&(i.ranges.push(r.classMinValue),i.symbols.push(void 0)),c(r.classMaxValue)&&(i.ranges.length===0||r.classMaxValue>i.ranges[i.ranges.length-1])&&(i.ranges.push(r.classMaxValue),i.symbols.push(ev(r.symbol,t)))}return i.symbols.push(void 0),i}}$G.prototype._parseLayerSymbology=function(){let e=this._layer.data.drawingInfo;if(c(e)&&c(e.renderer)){let t=this._layer.data.cachedDrawingInfo,n=c(t)&&t.color===!0,i=e.renderer;i.type==="simple"?this._defaultSymbology=ev(i.symbol,n):i.type==="uniqueValue"?(this._defaultSymbology=ev(i.defaultSymbol,n),this._valueFields.push(i.field1),c(i.field2)&&this._valueFields.push(i.field2),c(i.field3)&&this._valueFields.push(i.field3),this._uniqueValueHash=swt(i,n)):i.type==="classBreaks"&&(this._defaultSymbology=ev(i.defaultSymbol,n),this._valueFields.push(i.field),this._classBreaksHash=awt(i,n))}};function wEe(e,t,n,i){let o=t[n];if(i<o.length){let r=o[i],s=e[r];return c(s)&&++n<t.length?wEe(s,t,n,i):s}}function cwt(e,t){let n=0,i=e.length;if(n<i)do{let o=n+i>>>1;e[o]<t?n=o+1:i=o}while(n<i);return n}function lwt(e,t,n){let i=t[n],o=cwt(e.ranges,i);return e.symbols[o]}$G.prototype._getSymbology=async function(e){let t={default:this._defaultSymbology};if(this._valueFields.length>0){let n=[];for(let r=0;r<this._valueFields.length;r++)n.push(e.loadField(this._valueFields[r]));await Promise.all(n);let i=[];for(let r=0;r<this._valueFields.length;r++)i.push(e.fields[this._valueFields[r]].values);let o;if(c(this._uniqueValueHash)?o=r=>wEe(this._uniqueValueHash,i,0,r):c(this._classBreaksHash)&&(o=r=>lwt(this._classBreaksHash,i[0],r)),c(o)){let r=i[0];for(let s=0;s<r.length;s++){let a=o(s);c(a)&&(t[s]=a)}}}return t};var gk=$G;function uu(e,t,n){this._dataProvider=e,this._parent=n,!c(t.href)&&c(t.id)&&(t.href=`layers/${t.id}`);let i=this._parent.resource.getUrlComponent(),o="";i.match(/layers\/\d/)?o=`${i}`.replace(/\/+$/,""):o=`${i}`.replace(/\/?$/,"/").concat(`${t.href}`),this._version=t.store.version;let r=this._version.split(".");this._majorVersion=parseInt(r[0]),this._minorVersion=r.length>1?parseInt(r[1]):0,this._resource=new we({url:o}),this._resource.setQueryParameters(this._dataProvider.resource.queryParameters),this._resource.appendForwardSlash(),this._data=t,this._rootNode=void 0,this._nodePages={},this._nodePageFetches={},this._extent=void 0,this._tileset=void 0,this._geometryDefinitions=void 0,this._filters=[],this._symbology=void 0,this._computeGeometryDefinitions(!0),this._computeExtent()}Object.defineProperties(uu.prototype,{resource:{get:function(){return this._resource}},rootNode:{get:function(){return this._rootNode}},tileset:{get:function(){return this._tileset}},data:{get:function(){return this._data}},version:{get:function(){return this._version}},majorVersion:{get:function(){return this._majorVersion}},minorVersion:{get:function(){return this._minorVersion}},legacyVersion16:{get:function(){if(c(this.version))return this.majorVersion<1||this.majorVersion===1&&this.minorVersion<=6}}});uu.prototype.load=async function(e){if(this._data.spatialReference.wkid!==4326)throw new ae(`Unsupported spatial reference: ${this._data.spatialReference.wkid}`);if(this._dataProvider.applySymbology&&(this._symbology=new gk(this)),await this._dataProvider.loadGeoidData(),await this._loadRootNode(e),await this._create3DTileset(e),this._rootNode._tile=this._tileset._root,this._tileset._root._i3sNode=this._rootNode,this.legacyVersion16)return this._rootNode._loadChildren()};uu.prototype._computeGeometryDefinitions=function(e){if(this._geometryDefinitions=[],c(this._data.geometryDefinitions))for(let t=0;t<this._data.geometryDefinitions.length;t++){let n=[],i=this._data.geometryDefinitions[t].geometryBuffers;for(let o=0;o<i.length;o++){let r=i[o],s=[],a=!1;if(c(r.compressedAttributes)&&e){a=!0;let l=r.compressedAttributes.attributes;for(let u=0;u<l.length;u++)s.push(l[u])}else for(let l in r)l!=="offset"&&s.push(l);n.push({compressed:a,attributes:s,index:i.indexOf(r)})}n.sort(function(o,r){return o.compressed&&!r.compressed?-1:!o.compressed&&r.compressed?1:o.attributes.length-r.attributes.length}),this._geometryDefinitions.push(n)}};uu.prototype._findBestGeometryBuffers=function(e,t){let n=this._geometryDefinitions[e];if(c(n)){for(let i=0;i<n.length;++i){let o=n[i],r=!1,s=o.attributes;for(let a=0;a<t.length;a++)if(!s.includes(t[a])){r=!0;break}if(!r)return{bufferIndex:o.index,definition:n,geometryBufferInfo:o}}if(c(n[0]))return{bufferIndex:0,definition:n,geometryBufferInfo:n[0]}}};uu.prototype._loadRootNode=function(e){if(c(this._data.nodePages)){let t=0;c(this._data.nodePages.rootIndex)&&(t=this._data.nodePages.rootIndex),this._rootNode=new Jw(this,t,!0)}else this._rootNode=new Jw(this,this._data.store.rootNode,!0);return this._rootNode.load(e)};uu.prototype._getNodeInNodePages=function(e){let t=Math.floor(e/this._data.nodePages.nodesPerPage),n=e%this._data.nodePages.nodesPerPage;return this._loadNodePage(t).then(function(i){return i.nodes[n]})};uu._fetchJson=function(e){return e.fetchJson()};uu.prototype._loadNodePage=function(e){let t=this;if(!c(this._nodePageFetches[e])){let n=this.resource.getDerivedResource({url:`nodepages/${e}/`}),i=uu._fetchJson(n).then(function(o){return c(o.error)&&o.error.code!==200?Promise.reject(o.error):(t._nodePages[e]=o.nodes,o)});this._nodePageFetches[e]=i}return this._nodePageFetches[e]};uu.prototype._computeExtent=function(){c(this._data.fullExtent)?this._extent=ce.fromDegrees(this._data.fullExtent.xmin,this._data.fullExtent.ymin,this._data.fullExtent.xmax,this._data.fullExtent.ymax):c(this._data.store.extent)&&(this._extent=ce.fromDegrees(this._data.store.extent[0],this._data.store.extent[1],this._data.store.extent[2],this._data.store.extent[3]))};uu.prototype._create3DTileset=async function(e){let t={asset:{version:"1.0"},geometricError:Number.MAX_VALUE,root:this._rootNode._create3DTileDefinition()},n=new Blob([JSON.stringify(t)],{type:"application/json"}),i=URL.createObjectURL(n),o=this._symbology?.defaultSymbology?.edges?.color;c(o)&&!c(e?.outlineColor)&&(e=c(e)?je(e):{},e.outlineColor=G.fromCartesian4(se.fromArray(o))),this._tileset=await bs.fromUrl(i,e),this._tileset.show=this._parent.show,this._tileset._isI3STileSet=!0,this._tileset.tileUnload.addEventListener(function(r){r._i3sNode._clearGeometryData(),URL.revokeObjectURL(r._contentResource._url),r._contentResource=r._i3sNode.resource}),this._tileset.tileVisible.addEventListener(function(r){c(r._i3sNode)&&r._i3sNode._loadChildren()})};uu.prototype._updateVisibility=function(){c(this._tileset)&&(this._tileset.show=this._parent.show)};uu.prototype.filterByAttributes=function(e){this._filters=c(e)?je(e,!0):[];let t=this._rootNode;return c(t)?t._filterFeatures():Promise.resolve()};var zA=uu;function ZG(e,t){this._dataProvider=e,this._resource=new we({url:t}),this._resource.setQueryParameters(e.resource.queryParameters),this._resource.appendForwardSlash()}Object.defineProperties(ZG.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}},names:{get:function(){let e=[],t=this._data.summary;if(c(t))for(let n=0;n<t.length;++n)e.push(t[n].fieldName);return e}}});ZG.prototype.load=async function(){return this._data=await Jh.loadJson(this._resource),this._data};ZG.prototype._getValues=function(e){let t=this._data.summary;if(c(t))for(let n=0;n<t.length;++n){let i=t[n];if(i.fieldName===e)return c(i.mostFrequentValues)?[...i.mostFrequentValues]:[]}};var yk=ZG;function bk(e,t,n){this._dataProvider=e,this._parent=t,this._data=n,this._name=n.name,this._modelName=n.modelName,this._visibility=n.visibility??!0,this._resource=void 0,this._sublayers=[],this._i3sLayers=[]}Object.defineProperties(bk.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}},name:{get:function(){return this._name}},modelName:{get:function(){return this._modelName}},sublayers:{get:function(){return this._sublayers}},visibility:{get:function(){return this._visibility},set:function(e){if(T.defined("value",e),this._visibility!==e){this._visibility=e;for(let t=0;t<this._i3sLayers.length;t++)this._i3sLayers[t]._updateVisibility()}}},show:{get:function(){return this._visibility&&this._parent.show}}});bk._fromData=async function(e,t,n,i){let o=new bk(e,i,n);if(o._data.layerType==="group"){let r=o._data.sublayers;if(c(r)){let s=[];for(let l=0;l<r.length;l++){let u=bk._fromData(e,t,r[l],o);s.push(u)}let a=await Promise.all(s);for(let l=0;l<a.length;l++){let u=a[l];o._sublayers.push(u),o._i3sLayers.push(...u._i3sLayers)}}}else if(o._data.layerType==="3DObject"){let r=t.concat(`/sublayers/${o._data.id}`),s=new we({url:r});s.setQueryParameters(e.resource.queryParameters),s.appendForwardSlash(),o._resource=s;let a=await Jh.loadJson(o._resource),l=new zA(e,a,o);o._i3sLayers.push(l)}else console.log(`${o._data.layerType} layer ${o._data.name} is skipped as not supported.`);return o};var xk=bk;var PEe=Zo(vEe(),1);function As(e){e=e??W.EMPTY_OBJECT,this._name=e.name,this._show=e.show??!0,this._geoidTiledTerrainProvider=e.geoidTiledTerrainProvider,this._showFeatures=e.showFeatures??!1,this._adjustMaterialAlphaMode=e.adjustMaterialAlphaMode??!1,this._applySymbology=e.applySymbology??!1,this._calculateNormals=e.calculateNormals??!1,this._cesium3dTilesetOptions=e.cesium3dTilesetOptions??W.EMPTY_OBJECT,this._layers=[],this._sublayers=[],this._data=void 0,this._extent=void 0,this._geoidDataPromise=void 0,this._geoidDataList=void 0,this._decoderTaskProcessor=void 0,this._taskProcessorReadyPromise=void 0,this._attributeStatistics=[],this._layersExtent=[]}Object.defineProperties(As.prototype,{name:{get:function(){return this._name}},show:{get:function(){return this._show},set:function(e){if(T.defined("value",e),this._show!==e){this._show=e;for(let t=0;t<this._layers.length;t++)this._layers[t]._updateVisibility()}}},geoidTiledTerrainProvider:{get:function(){return this._geoidTiledTerrainProvider}},layers:{get:function(){return this._layers}},sublayers:{get:function(){return this._sublayers}},data:{get:function(){return this._data}},extent:{get:function(){return this._extent}},resource:{get:function(){return this._resource}},showFeatures:{get:function(){return this._showFeatures}},adjustMaterialAlphaMode:{get:function(){return this._adjustMaterialAlphaMode}},applySymbology:{get:function(){return this._applySymbology}},calculateNormals:{get:function(){return this._calculateNormals}}});As.prototype.destroy=function(){for(let e=0;e<this._layers.length;e++)c(this._layers[e]._tileset)&&this._layers[e]._tileset.destroy();return de(this)};As.prototype.isDestroyed=function(){return!1};As.prototype.update=function(e){for(let t=0;t<this._layers.length;t++)c(this._layers[t]._tileset)&&this._layers[t]._tileset.update(e)};As.prototype.prePassesUpdate=function(e){for(let t=0;t<this._layers.length;t++)c(this._layers[t]._tileset)&&this._layers[t]._tileset.prePassesUpdate(e)};As.prototype.postPassesUpdate=function(e){for(let t=0;t<this._layers.length;t++)c(this._layers[t]._tileset)&&this._layers[t]._tileset.postPassesUpdate(e)};As.prototype.updateForPass=function(e,t){for(let n=0;n<this._layers.length;n++)c(this._layers[n]._tileset)&&this._layers[n]._tileset.updateForPass(e,t)};function uwt(e,t){let n=e.resource.getUrlComponent(),i="";return n.match(/layers\/\d/)?i=`${n}`.replace(/\/+$/,""):i=`${n}`.replace(/\/?$/,"/").concat(`layers/${t}`),i}async function DEe(e,t,n){if(t.layerType==="Building"){c(n.showFeatures)||(e._showFeatures=!0),c(n.adjustMaterialAlphaMode)||(e._adjustMaterialAlphaMode=!0),c(n.applySymbology)||(e._applySymbology=!0),c(n.calculateNormals)||(e._calculateNormals=!0);let i=uwt(e,t.id);if(c(t.sublayers)){let o=[];for(let s=0;s<t.sublayers.length;s++){let a=xk._fromData(e,i,t.sublayers[s],e);o.push(a)}let r=await Promise.all(o);for(let s=0;s<r.length;s++){let a=r[s];e._sublayers.push(a),e._layers.push(...a._i3sLayers)}}if(c(t.statisticsHRef)){let o=i.concat(`/${t.statisticsHRef}`),r=new yk(e,o);await r.load(),e._attributeStatistics.push(r)}if(c(t.fullExtent)){let o=ce.fromDegrees(t.fullExtent.xmin,t.fullExtent.ymin,t.fullExtent.xmax,t.fullExtent.ymax);e._layersExtent.push(o)}}else if(t.layerType==="3DObject"||t.layerType==="IntegratedMesh"){!c(n.calculateNormals)&&!c(t.textureSetDefinitions)&&(e._calculateNormals=!0);let i=new zA(e,t,e);e._layers.push(i),c(i._extent)&&e._layersExtent.push(i._extent)}else console.log(`${t.layerType} layer ${t.name} is skipped as not supported.`)}As.fromUrl=async function(e,t){T.defined("url",e),t=t??W.EMPTY_OBJECT;let n=we.createIfNeeded(e);n.setQueryParameters({f:"pjson"},!0);let i=await As.loadJson(n),o=new As(t);if(o._resource=n,o._data=i,c(i.layers)){let s=[];for(let a=0;a<i.layers.length;a++){let l=DEe(o,i.layers[a],t);s.push(l)}await Promise.all(s)}else await DEe(o,i,t);o._computeExtent();let r=[];for(let s=0;s<o._layers.length;s++)r.push(o._layers[s].load(t.cesium3dTilesetOptions));return await Promise.all(r),o};As._fetchJson=function(e){return e.fetchJson()};As.loadJson=async function(e){let t=await As._fetchJson(e);if(c(t.error)){if(console.error("Failed to fetch I3S ",e.url),c(t.error.message)&&console.error(t.error.message),c(t.error.details))for(let n=0;n<t.error.details.length;n++)console.log(t.error.details[n]);throw new ae(t.error)}return t};As.prototype._loadBinary=async function(e){let t=await e.fetchArrayBuffer();if(t.byteLength>0&&new Uint8Array(t)[0]===123&&new TextDecoder().decode(t).includes("404"))throw new ae(`Failed to load binary: ${e.url}`);return t};As.prototype._binarizeGltf=function(e){let n=new TextEncoder().encode(JSON.stringify(e)),i=new Uint8Array(n.byteLength+20),o={magic:new Uint8Array(i.buffer,0,4),version:new Uint32Array(i.buffer,4,1),length:new Uint32Array(i.buffer,8,1),chunkLength:new Uint32Array(i.buffer,12,1),chunkType:new Uint32Array(i.buffer,16,1),chunkData:new Uint8Array(i.buffer,20,n.byteLength)};return o.magic[0]=103,o.magic[1]=108,o.magic[2]=84,o.magic[3]=70,o.version[0]=2,o.length[0]=i.byteLength,o.chunkLength[0]=n.byteLength,o.chunkType[0]=1313821514,o.chunkData.set(n),i};var fwt=new H;function dwt(e,t){let n=e.tilingScheme,i=[],o={},r=e._lodCount,s=he.fromRadians(t.west,t.north),a=he.fromRadians(t.east,t.south),l=n.positionToTileXY(s,r),u=n.positionToTileXY(a,r);for(let h=l.x;h<=u.x;h++)for(let p=l.y;p<=u.y;p++){let g=H.fromElements(h,p,fwt),m=g.toString();if(!o.hasOwnProperty(m)){let y={x:g.x,y:g.y,level:r,tilingScheme:n,terrainProvider:e,positions:[]};o[m]=y,i.push(y)}}let f=[];for(let h=0;h<i.length;++h){let p=i[h],g=p.terrainProvider.requestTileGeometry(p.x,p.y,p.level);f.push(g)}return Promise.all(f).then(function(h){let p=[];for(let g=0;g<h.length;g++){let m={tilingScheme:n,x:i[g].x,y:i[g].y,level:i[g].level},y=h[g],b="Geographic";n._projection instanceof Mi&&(b="WebMercator");let x={projectionType:b,projection:n._projection,nativeExtent:n.tileXYToNativeRectangle(m.x,m.y,m.level),height:y._height,width:y._width,scale:y._structure.heightScale,offset:y._structure.heightOffset};if(y._encoding===fd.LERC){let A=PEe.default.decode(y._buffer);x.buffer=A.pixels[0]}else x.buffer=y._buffer;p.push(x)}return p})}async function hwt(e){let t=e._geoidTiledTerrainProvider;if(c(t))try{let n=await dwt(t,e._extent);e._geoidDataList=n}catch{console.log("Error retrieving Geoid Terrain tiles - no geoid conversion will be performed.")}}As.prototype.loadGeoidData=async function(){return c(this._geoidDataPromise)?this._geoidDataPromise:(this._geoidDataPromise=hwt(this),this._geoidDataPromise)};As.prototype._computeExtent=function(){let e;for(let t=0;t<this._layersExtent.length;t++){let n=this._layersExtent[t];c(e)?ce.union(e,n,e):e=ce.clone(n)}this._extent=e};As.prototype.getAttributeNames=function(){let e=[];for(let t=0;t<this._attributeStatistics.length;++t)e.push(...this._attributeStatistics[t].names);return e};As.prototype.getAttributeValues=function(e){T.defined("name",e);for(let t=0;t<this._attributeStatistics.length;++t){let n=this._attributeStatistics[t]._getValues(e);if(c(n))return n}return[]};As.prototype.filterByAttributes=function(e){let t=[];for(let n=0;n<this._layers.length;n++){let i=this._layers[n].filterByAttributes(e);t.push(i)}return Promise.all(t)};var Jh=As;var Tk={};Tk.createTilesetFromIModelId=async function(e,t){let{exports:n}=await us.getExports(e);if(n.length>0&&n.every(a=>a.status===us.ExportStatus.Invalid))throw new ae(`All exports for this iModel are Invalid: ${e}`);let i=n.find(a=>a.status===us.ExportStatus.Complete);if(!c(i))return;let o=new URL(i._links.mesh.href);o.pathname=`${o.pathname}/tileset.json`;let r=o.toString(),s=new we({url:r});return bs.fromUrl(s,t)};Tk.createTilesetForRealityDataId=async function(e,t,n,i){if(T.typeOf.string("iTwinId",e),T.typeOf.string("realityDataId",t),c(n)&&T.typeOf.string("type",n),c(i)&&T.typeOf.string("rootDocument",i),!c(n)||!c(i)){let s=await us.getRealityDataMetadata(e,t);i=s.rootDocument,n=s.type}if(![us.RealityDataType.Cesium3DTiles,us.RealityDataType.PNTS,us.RealityDataType.RealityMesh3DTiles,us.RealityDataType.Terrain3DTiles].includes(n))throw new ae(`Reality data type is not a mesh type: ${n}`);let r=await us.getRealityDataURL(e,t,i);return bs.fromUrl(r,{maximumScreenSpaceError:4})};Tk.createDataSourceForRealityDataId=async function(e,t,n,i){if(T.typeOf.string("iTwinId",e),T.typeOf.string("realityDataId",t),c(n)&&T.typeOf.string("type",n),c(i)&&T.typeOf.string("rootDocument",i),!c(n)||!c(i)){let s=await us.getRealityDataMetadata(e,t);i=s.rootDocument,n=s.type}if(![us.RealityDataType.KML,us.RealityDataType.GeoJSON].includes(n))throw new ae(`Reality data type is not a data source type: ${n}`);let r=await us.getRealityDataURL(e,t,i);return n===us.RealityDataType.GeoJSON?T0.load(r):kT.load(r)};Tk.loadGeospatialFeatures=async function(e,t,n){if(T.typeOf.string("iTwinId",e),T.typeOf.string("collectionId",t),c(n)&&(T.typeOf.number("limit",n),T.typeOf.number.lessThanOrEquals("limit",n,1e4),T.typeOf.number.greaterThanOrEquals("limit",n,1)),!c(us.defaultAccessToken)&&!c(us.defaultShareKey))throw new E("Must set ITwinPlatform.defaultAccessToken or ITwinPlatform.defaultShareKey first");let i=n??1e4,o=`${us.apiEndpoint}geospatial-features/itwins/${e}/ogc/collections/${t}/items`,r=new we({url:o,headers:{Authorization:us._getAuthorizationHeader(),Accept:"application/vnd.bentley.itwin-platform.v1+json"},queryParameters:{limit:i,client:"CesiumJS"}});return T0.load(r)};var uQ=Tk;function IEe(){}Object.defineProperties(IEe.prototype,{color:{get:E.throwInstantiationError},intensity:{get:E.throwInstantiationError}});var fQ=IEe;var mwt=/\/$/,OEe=new Tt('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function tv(e){e=e??W.EMPTY_OBJECT;let t=e.styleId;if(!c(t))throw new E("options.styleId is required.");let n=e.accessToken;if(!c(n))throw new E("options.accessToken is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;let i=we.createIfNeeded(e.url??"https://api.mapbox.com/styles/v1/");this._styleId=t,this._accessToken=n;let o=e.tilesize??512;this._tilesize=o;let r=e.username??"mapbox";this._username=r;let s=c(e.scaleFactor)?"@2x":"",a=i.getUrlComponent();mwt.test(a)||(a+="/"),a+=`${this._username}/${t}/tiles/${this._tilesize}/{z}/{x}/{y}${s}`,i.url=a,i.setQueryParameters({access_token:n});let l;c(e.credit)?(l=e.credit,typeof l=="string"&&(l=new Tt(l))):l=OEe,this._resource=i,this._imageryProvider=new Ya({url:i,credit:l,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(tv.prototype,{url:{get:function(){return this._imageryProvider.url}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}});tv.prototype.getTileCredits=function(e,t,n){};tv.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};tv.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};tv._defaultCredit=OEe;var dQ=tv;function hQ(e){}hQ.prototype.isReady=function(){return!0};hQ.prototype.shouldDiscardImage=function(e){return!1};var mQ=hQ;var pwt=new Tt("MapQuest, Open Street Map and contributors, CC-BY-SA");function JG(e){e=e??W.EMPTY_OBJECT;let t=we.createIfNeeded(e.url??"https://tile.openstreetmap.org/");t.appendForwardSlash(),t.url+=`{z}/{x}/{y}${e.retinaTiles?"@2x":""}.${e.fileExtension??"png"}`;let n=new ls({ellipsoid:e.ellipsoid}),i=256,o=256,r=e.minimumLevel??0,s=e.maximumLevel,a=e.rectangle??n.rectangle,l=n.positionToTileXY(ce.southwest(a),r),u=n.positionToTileXY(ce.northeast(a),r),f=(Math.abs(u.x-l.x)+1)*(Math.abs(u.y-l.y)+1);if(f>4)throw new E(`The rectangle and minimumLevel indicate that there are ${f} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let h=e.credit??pwt;typeof h=="string"&&(h=new Tt(h)),Ya.call(this,{url:t,credit:h,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}c(Object.create)&&(JG.prototype=Object.create(Ya.prototype),JG.prototype.constructor=JG);var Lg=JG;var _wt=new H(1,1);function pQ(e){e=e??W.EMPTY_OBJECT,this.mass=e.mass??1,this.position=d.clone(e.position??d.ZERO),this.velocity=d.clone(e.velocity??d.ZERO),this.life=e.life??Number.MAX_VALUE,this.image=e.image,this.startColor=G.clone(e.startColor??G.WHITE),this.endColor=G.clone(e.endColor??G.WHITE),this.startScale=e.startScale??1,this.endScale=e.endScale??1,this.imageSize=H.clone(e.imageSize??_wt),this._age=0,this._normalizedAge=0,this._billboard=void 0}Object.defineProperties(pQ.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});var REe=new d;pQ.prototype.update=function(e,t){return d.multiplyByScalar(this.velocity,e,REe),d.add(this.position,REe,this.position),c(t)&&t(this,e),this._age+=e,this.life===Number.MAX_VALUE?this._normalizedAge=0:this._normalizedAge=this._age/this.life,this._age<=this.life};var nv=pQ;function MEe(e){e=e??W.EMPTY_OBJECT,this.time=e.time??0,this.minimum=e.minimum??0,this.maximum=e.maximum??50,this._complete=!1}Object.defineProperties(MEe.prototype,{complete:{get:function(){return this._complete}}});var _Q=MEe;function LEe(e){throw new E("This type should not be instantiated directly.  Instead, use BoxEmitter, CircleEmitter, ConeEmitter or SphereEmitter.")}LEe.prototype.emit=function(e){E.throwInstantiationError()};var gQ=LEe;var NEe=new H(1,1);function Ak(e){e=e??W.EMPTY_OBJECT,this.show=e.show??!0,this.updateCallback=e.updateCallback,this.loop=e.loop??!0,this.image=e.image??void 0;let t=e.emitter;c(t)||(t=new sk(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=B.clone(e.modelMatrix??B.IDENTITY),this._emitterModelMatrix=B.clone(e.emitterModelMatrix??B.IDENTITY),this._matrixDirty=!0,this._combinedMatrix=new B,this._startColor=G.clone(e.color??e.startColor??G.WHITE),this._endColor=G.clone(e.color??e.endColor??G.WHITE),this._startScale=e.scale??e.startScale??1,this._endScale=e.scale??e.endScale??1,this._emissionRate=e.emissionRate??5,this._minimumSpeed=e.speed??e.minimumSpeed??1,this._maximumSpeed=e.speed??e.maximumSpeed??1,this._minimumParticleLife=e.particleLife??e.minimumParticleLife??5,this._maximumParticleLife=e.particleLife??e.maximumParticleLife??5,this._minimumMass=e.mass??e.minimumMass??1,this._maximumMass=e.mass??e.maximumMass??1,this._minimumImageSize=H.clone(e.imageSize??e.minimumImageSize??NEe),this._maximumImageSize=H.clone(e.imageSize??e.maximumImageSize??NEe),this._sizeInMeters=e.sizeInMeters??!1,this._lifetime=e.lifetime??Number.MAX_VALUE,this._billboardCollection=void 0,this._particles=[],this._particlePool=[],this._previousTime=void 0,this._currentTime=0,this._carryOver=0,this._complete=new pe,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}Object.defineProperties(Ak.prototype,{emitter:{get:function(){return this._emitter},set:function(e){T.defined("value",e),this._emitter=e}},bursts:{get:function(){return this._bursts},set:function(e){this._bursts=e,this._updateParticlePool=!0}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){T.defined("value",e),this._matrixDirty=this._matrixDirty||!B.equals(this._modelMatrix,e),B.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){T.defined("value",e),this._matrixDirty=this._matrixDirty||!B.equals(this._emitterModelMatrix,e),B.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){T.defined("value",e),G.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){T.defined("value",e),G.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){T.typeOf.object("value",e),T.typeOf.number.greaterThanOrEquals("value.x",e.x,0),T.typeOf.number.greaterThanOrEquals("value.y",e.y,0),this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){T.typeOf.object("value",e),T.typeOf.number.greaterThanOrEquals("value.x",e.x,0),T.typeOf.number.greaterThanOrEquals("value.y",e.y,0),this._maximumImageSize=e}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){T.typeOf.bool("value",e),this._sizeInMeters=e}},lifetime:{get:function(){return this._lifetime},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});function gwt(e){let t=e._emissionRate,n=e._maximumParticleLife,i=0,o=e._bursts;if(c(o)){let h=o.length;for(let p=0;p<h;++p)i+=o[p].maximum}let r=e._billboardCollection,s=e.image,a=Math.ceil(t*n+i),l=e._particles,u=e._particlePool,f=Math.max(a-l.length-u.length,0);for(let h=0;h<f;++h){let p=new nv;p._billboard=r.add({image:s,show:!1}),u.push(p)}e._particleEstimate=a}function ywt(e){let t=e._particlePool.pop();return c(t)||(t=new nv),t}function bwt(e,t){e._particlePool.push(t)}function xwt(e){let t=e._particles,n=e._particlePool,i=e._billboardCollection,o=t.length,r=n.length,s=e._particleEstimate,a=r-Math.max(s-o-r,0);for(let l=a;l<r;++l){let u=n[l];i.remove(u._billboard)}n.length=a}function Twt(e){c(e._billboard)&&(e._billboard.show=!1)}function FEe(e,t){let n=t._billboard;c(n)||(n=t._billboard=e._billboardCollection.add({image:t.image})),n.width=t.imageSize.x,n.height=t.imageSize.y,n.position=t.position,n.sizeInMeters=e.sizeInMeters,n.show=!0;let i=O.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),o=O.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),r=O.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),s=O.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);n.color=new G(i,o,r,s),n.scale=O.lerp(t.startScale,t.endScale,t.normalizedAge)}function Awt(e,t){t.startColor=G.clone(e._startColor,t.startColor),t.endColor=G.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=O.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=O.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=O.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=O.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;let n=O.randomBetween(e._minimumSpeed,e._maximumSpeed);d.multiplyByScalar(t.velocity,n,t.velocity),e._particles.push(t)}function Cwt(e,t){if(e._isComplete)return 0;t=O.mod(t,e._lifetime);let n=t*e._emissionRate,i=Math.floor(n);if(e._carryOver+=n-i,e._carryOver>1&&(i++,e._carryOver-=1),c(e.bursts)){let o=e.bursts.length;for(let r=0;r<o;r++){let s=e.bursts[r],a=e._currentTime;c(s)&&!s._complete&&a>s.time&&(i+=O.randomBetween(s.minimum,s.maximum),s._complete=!0)}}return i}var e5=new d;Ak.prototype.update=function(e){if(!this.show)return;c(this._billboardCollection)||(this._billboardCollection=new Ru),this._updateParticlePool&&(gwt(this),this._updateParticlePool=!1);let t=0;this._previousTime&&(t=Q.secondsDifference(e.time,this._previousTime)),t<0&&(t=0);let n=this._particles,i=this._emitter,o=this.updateCallback,r,s,a=n.length;for(r=0;r<a;++r)s=n[r],s.update(t,o)?FEe(this,s):(Twt(s),bwt(this,s),n[r]=n[a-1],--r,--a);n.length=a;let l=Cwt(this,t);if(l>0&&c(i)){this._matrixDirty&&(this._combinedMatrix=B.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);let u=this._combinedMatrix;for(r=0;r<l;r++)s=ywt(this),this._emitter.emit(s),d.add(s.position,s.velocity,e5),B.multiplyByPoint(u,e5,e5),s.position=B.multiplyByPoint(u,s.position,s.position),d.subtract(e5,s.position,s.velocity),d.normalize(s.velocity,s.velocity),Awt(this,s),FEe(this,s)}if(this._billboardCollection.update(e),this._previousTime=Q.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=O.mod(this._currentTime,this._lifetime),this.bursts){let u=this.bursts.length;for(r=0;r<u;r++)this.bursts[r]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120===0&&xwt(this)};Ak.prototype.isDestroyed=function(){return!1};Ak.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),de(this)};var yQ=Ak;function df(){E.throwInstantiationError()}df.computeDefaultLevelZeroMaximumGeometricError=function(e){return e.ellipsoid.maximumRadius*2*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))};Object.defineProperties(df.prototype,{quadtree:{get:E.throwInstantiationError,set:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError}});df.prototype.update=E.throwInstantiationError;df.prototype.beginUpdate=E.throwInstantiationError;df.prototype.endUpdate=E.throwInstantiationError;df.prototype.getLevelMaximumGeometricError=E.throwInstantiationError;df.prototype.loadTile=E.throwInstantiationError;df.prototype.computeTileVisibility=E.throwInstantiationError;df.prototype.showTileThisFrame=E.throwInstantiationError;df.prototype.computeDistanceToTile=E.throwInstantiationError;df.prototype.isDestroyed=E.throwInstantiationError;df.prototype.destroy=E.throwInstantiationError;var bQ=df;function xQ(e){e=e??1,T.typeOf.number.greaterThan("radius",e,0),this._radius=e??1}Object.defineProperties(xQ.prototype,{radius:{get:function(){return this._radius},set:function(e){T.typeOf.number.greaterThan("value",e,0),this._radius=e}}});xQ.prototype.emit=function(e){let t=O.randomBetween(0,O.TWO_PI),n=O.randomBetween(0,O.PI),i=O.randomBetween(0,this._radius),o=i*Math.cos(t)*Math.sin(n),r=i*Math.sin(t)*Math.sin(n),s=i*Math.cos(n);e.position=d.fromElements(o,r,s,e.position),e.velocity=d.normalize(e.position,e.velocity)};var TQ=xQ;function Ck(){}Ck.prototype.evaluate=function(e,t){E.throwInstantiationError()};Ck.prototype.evaluateColor=function(e,t){E.throwInstantiationError()};Ck.prototype.getShaderFunction=function(e,t,n,i){E.throwInstantiationError()};Ck.prototype.getVariables=function(){E.throwInstantiationError()};var AQ=Ck;function iv(e){T.typeOf.object("terrainProviderPromise",e),this._ready=!1,this._provider=void 0,this._errorEvent=new pe,this._readyEvent=new pe,Swt(this,e)}Object.defineProperties(iv.prototype,{errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}}});iv.fromWorldTerrain=function(e){return new iv(PA(e))};iv.fromWorldBathymetry=function(e){return new iv(K3(e))};function Ewt(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function Swt(e,t){let n;try{n=await Promise.resolve(t),e._provider=n,e._ready=!0,e._readyEvent.raiseEvent(n)}catch(i){Ewt(e._errorEvent,i)}}var Ek=iv;function ov(){}ov.prototype.boundingVolume=void 0;ov.prototype.boundingSphere=void 0;ov.prototype.distanceToCamera=function(e){E.throwInstantiationError()};ov.prototype.intersectPlane=function(e){E.throwInstantiationError()};ov.prototype.createDebugVolume=function(e){E.throwInstantiationError()};var CQ=ov;function Sk(e){e=e??W.EMPTY_OBJECT,this._tilingScheme=c(e.tilingScheme)?e.tilingScheme:new Ki({ellipsoid:e.ellipsoid}),this._color=e.color??G.YELLOW,this._errorEvent=new pe,this._tileWidth=e.tileWidth??256,this._tileHeight=e.tileHeight??256,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0}Object.defineProperties(Sk.prototype,{proxy:{get:function(){}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){}},minimumLevel:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}});Sk.prototype.getTileCredits=function(e,t,n){};Sk.prototype.requestImage=function(e,t,n,i){let o=document.createElement("canvas");o.width=256,o.height=256;let r=o.getContext("2d"),s=this._color.toCssColorString();return r.strokeStyle=s,r.lineWidth=2,r.strokeRect(1,1,255,255),r.font="bold 25px Arial",r.textAlign="center",r.fillStyle=s,r.fillText(`L: ${n}`,124,86),r.fillText(`X: ${e}`,124,136),r.fillText(`Y: ${t}`,124,186),Promise.resolve(o)};Sk.prototype.pickFeatures=function(e,t,n,i,o){};var wk=Sk;function EQ(e){E.throwInstantiationError()}EQ.prototype.isReady=E.throwInstantiationError;EQ.prototype.shouldDiscardImage=E.throwInstantiationError;var SQ=EQ;var wwt={START:0,LOADING:1,READY:2,UPSAMPLED_ONLY:3},wQ=Object.freeze(wwt);function t5(e,t){this.show=!0,c(e)||(e=new Ke),this.rectangle=Ke.clone(e),c(t)||(t=Xi.fromType(Xi.ColorType,{color:new G(1,1,1,1)})),this.material=t,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0}t5.prototype.update=function(e){if(!this.show)return;if(!c(this.material))throw new E("this.material must be defined.");if(!c(this.rectangle))throw new E("this.rectangle must be defined.");let t=this._rs;if((!c(t)||!Ke.equals(t.viewport,this.rectangle))&&(this._rs=Ve.fromCache({blending:ln.ALPHA_BLEND,viewport:this.rectangle})),e.passes.render){let i=e.context;if(this._material!==this.material||!c(this._overlayCommand)){this._material=this.material,c(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();let o=new He({sources:[this._material.shaderSource,m2]});this._overlayCommand=i.createViewportQuadCommand(o,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=De.OVERLAY}this._material.update(i),this._overlayCommand.renderState=this._rs,this._overlayCommand.uniformMap=this._material._uniforms,e.commandList.push(this._overlayCommand)}};t5.prototype.isDestroyed=function(){return!1};t5.prototype.destroy=function(){return c(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),de(this)};var vQ=t5;function DQ(){E.throwInstantiationError()}Object.defineProperties(DQ.prototype,{globalTransform:{get:E.throwInstantiationError},shapeTransform:{get:E.throwInstantiationError},shape:{get:E.throwInstantiationError},minBounds:{get:E.throwInstantiationError},maxBounds:{get:E.throwInstantiationError},dimensions:{get:E.throwInstantiationError},paddingBefore:{get:E.throwInstantiationError},paddingAfter:{get:E.throwInstantiationError},names:{get:E.throwInstantiationError},types:{get:E.throwInstantiationError},componentTypes:{get:E.throwInstantiationError},minimumValues:{get:E.throwInstantiationError},maximumValues:{get:E.throwInstantiationError},maximumTileCount:{get:E.throwInstantiationError},availableLevels:{get:E.throwInstantiationError},keyframeCount:{get:E.throwInstantiationError},timeIntervalCollection:{get:E.throwInstantiationError}});DQ.prototype.requestData=function(e){E.throwInstantiationError()};var PQ=DQ;function HA(){E.throwInstantiationError()}Object.defineProperties(HA.prototype,{orientedBoundingBox:{get:E.throwInstantiationError},boundingSphere:{get:E.throwInstantiationError},boundTransform:{get:E.throwInstantiationError},shapeTransform:{get:E.throwInstantiationError},shaderUniforms:{get:E.throwInstantiationError},shaderDefines:{get:E.throwInstantiationError},shaderMaximumIntersectionsLength:{get:E.throwInstantiationError}});HA.prototype.update=E.throwInstantiationError;HA.prototype.computeOrientedBoundingBoxForTile=E.throwInstantiationError;HA.prototype.computeOrientedBoundingBoxForSample=E.throwInstantiationError;HA.DefaultMinBounds=E.throwInstantiationError;HA.DefaultMaxBounds=E.throwInstantiationError;var IQ=HA;var OQ=`uniform sampler2D u_depthTexture;
in vec2 v_textureCoordinates;
void main()
{
float z_window = czm_unpackDepth(texture(u_depthTexture, v_textureCoordinates));
z_window = czm_reverseLogDepth(z_window);
float n_range = czm_depthRange.near;
float f_range = czm_depthRange.far;
float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);
float scale = pow(z_ndc * 0.5 + 0.5, 8.0);
out_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);
}
`;function vwt(e){e=e??W.EMPTY_OBJECT;let t=c(e.typedArray),n=c(e.url);if(t===n)throw new E("exactly one of options.typedArray, options.url must be defined");if(t&&(!c(e.width)||!c(e.height)))throw new E("options.width and options.height are required when options.typedArray is defined");this.typedArray=e.typedArray,this.width=e.width,this.height=e.height,this.pixelFormat=e.pixelFormat??ke.RGBA,this.pixelDatatype=e.pixelDatatype??Ue.UNSIGNED_BYTE;let i=e.url;typeof i=="string"&&(i=we.createIfNeeded(i)),this.resource=i;let r=e.repeat??!0?gn.REPEAT:gn.CLAMP_TO_EDGE;this.sampler=new Qt({wrapS:r,wrapT:r,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy})}var RQ=vwt;var Dwt={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",MAT2:"mat2",MAT3:"mat3",MAT4:"mat4"},MQ=Object.freeze(Dwt);var Pwt={SIGX:"SIGX",SIGY:"SIGY",SIGZ:"SIGZ",VARX:"VARX",VARY:"VARY",VARZ:"VARZ",SIGR:"VARZ"},LQ=Object.freeze(Pwt);function Iwt(e){async function t({data:i}){let o=[],r={id:i.id,result:void 0,error:void 0};self.CESIUM_BASE_URL=i.baseUrl;try{let s=await e(i.parameters,o);r.result=s}catch(s){s instanceof Error?r.error={name:s.name,message:s.message,stack:s.stack}:r.error=s}i.canTransferArrayBuffer||(o.length=0);try{postMessage(r,o)}catch(s){r.result=void 0,r.error=`postMessage failed with error: ${ep(s)}
  with responseMessage: ${JSON.stringify(r)}`,postMessage(r)}}function n(i){postMessage({id:i.data?.id,error:`postMessage failed with error: ${JSON.stringify(i)}`})}return self.onmessage=t,self.onmessageerror=n,self}var NQ=Iwt;globalThis.CESIUM_VERSION="1.129";var vk;typeof ko<"u"&&(vk=ko);(function(){/*!
 * Knockout JavaScript library v3.5.1
 * (c) The Knockout.js team - http://knockoutjs.com/
 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
 */(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||typeof jQuery>"u"||(o=jQuery),function(s){s(t.ko={})}(function(s,a){function l(_,w){return _===null||typeof _ in y?_===w:!1}function u(_,w){var D;return function(){D||(D=m.a.setTimeout(function(){D=e,_()},w))}}function f(_,w){var D;return function(){clearTimeout(D),D=m.a.setTimeout(_,w)}}function h(_,w){w&&w!=="change"?w==="beforeChange"?this.pc(_):this.gb(_,w):this.qc(_)}function p(_,w){w!==null&&w.s&&w.s()}function g(_,w){var D=this.qd,I=D[S];I.ra||(this.Qb&&this.mb[w]?(D.uc(w,_,this.mb[w]),this.mb[w]=null,--this.Qb):I.I[w]||D.uc(w,_,I.J?{da:_}:D.$c(_)),_.Ja&&_.gd())}var m=typeof s<"u"?s:{};m.b=function(_,w){for(var D=_.split("."),I=m,N=0;N<D.length-1;N++)I=I[D[N]];I[D[D.length-1]]=w},m.L=function(_,w,D){_[w]=D},m.version="3.5.1",m.b("version",m.version),m.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},m.a=function(){function _(K,Z){for(var ee in K)N.call(K,ee)&&Z(ee,K[ee])}function w(K,Z){if(Z)for(var ee in Z)N.call(Z,ee)&&(K[ee]=Z[ee]);return K}function D(K,Z){return K.__proto__=Z,K}function I(K,Z,ee,me){var Te=K[Z].match(Y)||[];m.a.D(ee.match(Y),function(ue){m.a.Na(Te,ue,me)}),K[Z]=Te.join(" ")}var N=Object.prototype.hasOwnProperty,k={__proto__:[]}instanceof Array,z=typeof Symbol=="function",V={},j={};V[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],V.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),_(V,function(K,Z){if(Z.length)for(var ee=0,me=Z.length;ee<me;ee++)j[Z[ee]]=K});var U={propertychange:!0},q=n&&function(){for(var K=3,Z=n.createElement("div"),ee=Z.getElementsByTagName("i");Z.innerHTML="<!--[if gt IE "+ ++K+"]><i></i><![endif]-->",ee[0];);return 4<K?K:e}(),Y=/\S+/g,te;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(K,Z,ee){for(var me=0,Te=K.length;me<Te;me++)Z.call(ee,K[me],me,K)},A:typeof Array.prototype.indexOf=="function"?function(K,Z){return Array.prototype.indexOf.call(K,Z)}:function(K,Z){for(var ee=0,me=K.length;ee<me;ee++)if(K[ee]===Z)return ee;return-1},Lb:function(K,Z,ee){for(var me=0,Te=K.length;me<Te;me++)if(Z.call(ee,K[me],me,K))return K[me];return e},Pa:function(K,Z){var ee=m.a.A(K,Z);0<ee?K.splice(ee,1):ee===0&&K.shift()},wc:function(K){var Z=[];return K&&m.a.D(K,function(ee){0>m.a.A(Z,ee)&&Z.push(ee)}),Z},Mb:function(K,Z,ee){var me=[];if(K)for(var Te=0,ue=K.length;Te<ue;Te++)me.push(Z.call(ee,K[Te],Te));return me},jb:function(K,Z,ee){var me=[];if(K)for(var Te=0,ue=K.length;Te<ue;Te++)Z.call(ee,K[Te],Te)&&me.push(K[Te]);return me},Nb:function(K,Z){if(Z instanceof Array)K.push.apply(K,Z);else for(var ee=0,me=Z.length;ee<me;ee++)K.push(Z[ee]);return K},Na:function(K,Z,ee){var me=m.a.A(m.a.bc(K),Z);0>me?ee&&K.push(Z):ee||K.splice(me,1)},Ba:k,extend:w,setPrototypeOf:D,Ab:k?D:w,P:_,Ga:function(K,Z,ee){if(!K)return K;var me={},Te;for(Te in K)N.call(K,Te)&&(me[Te]=Z.call(ee,K[Te],Te,K));return me},Tb:function(K){for(;K.firstChild;)m.removeNode(K.firstChild)},Yb:function(K){K=m.a.la(K);for(var Z=(K[0]&&K[0].ownerDocument||n).createElement("div"),ee=0,me=K.length;ee<me;ee++)Z.appendChild(m.oa(K[ee]));return Z},Ca:function(K,Z){for(var ee=0,me=K.length,Te=[];ee<me;ee++){var ue=K[ee].cloneNode(!0);Te.push(Z?m.oa(ue):ue)}return Te},va:function(K,Z){if(m.a.Tb(K),Z)for(var ee=0,me=Z.length;ee<me;ee++)K.appendChild(Z[ee])},Xc:function(K,Z){var ee=K.nodeType?[K]:K;if(0<ee.length){for(var me=ee[0],Te=me.parentNode,ue=0,ye=Z.length;ue<ye;ue++)Te.insertBefore(Z[ue],me);for(ue=0,ye=ee.length;ue<ye;ue++)m.removeNode(ee[ue])}},Ua:function(K,Z){if(K.length){for(Z=Z.nodeType===8&&Z.parentNode||Z;K.length&&K[0].parentNode!==Z;)K.splice(0,1);for(;1<K.length&&K[K.length-1].parentNode!==Z;)K.length--;if(1<K.length){var ee=K[0],me=K[K.length-1];for(K.length=0;ee!==me;)K.push(ee),ee=ee.nextSibling;K.push(me)}}return K},Zc:function(K,Z){7>q?K.setAttribute("selected",Z):K.selected=Z},Db:function(K){return K===null||K===e?"":K.trim?K.trim():K.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(K,Z){return K=K||"",Z.length>K.length?!1:K.substring(0,Z.length)===Z},vd:function(K,Z){if(K===Z)return!0;if(K.nodeType===11)return!1;if(Z.contains)return Z.contains(K.nodeType!==1?K.parentNode:K);if(Z.compareDocumentPosition)return(Z.compareDocumentPosition(K)&16)==16;for(;K&&K!=Z;)K=K.parentNode;return!!K},Sb:function(K){return m.a.vd(K,K.ownerDocument.documentElement)},kd:function(K){return!!m.a.Lb(K,m.a.Sb)},R:function(K){return K&&K.tagName&&K.tagName.toLowerCase()},Ac:function(K){return m.onError?function(){try{return K.apply(this,arguments)}catch(Z){throw m.onError&&m.onError(Z),Z}}:K},setTimeout:function(K,Z){return setTimeout(m.a.Ac(K),Z)},Gc:function(K){setTimeout(function(){throw m.onError&&m.onError(K),K},0)},B:function(K,Z,ee){var me=m.a.Ac(ee);if(ee=U[Z],m.options.useOnlyNativeEvents||ee||!o)if(ee||typeof K.addEventListener!="function")if(typeof K.attachEvent<"u"){var Te=function(ye){me.call(K,ye)},ue="on"+Z;K.attachEvent(ue,Te),m.a.K.za(K,function(){K.detachEvent(ue,Te)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else K.addEventListener(Z,me,!1);else te||(te=typeof o(K).on=="function"?"on":"bind"),o(K)[te](Z,me)},Fb:function(K,Z){if(!K||!K.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var ee;if(m.a.R(K)==="input"&&K.type&&Z.toLowerCase()=="click"?(ee=K.type,ee=ee=="checkbox"||ee=="radio"):ee=!1,m.options.useOnlyNativeEvents||!o||ee)if(typeof n.createEvent=="function")if(typeof K.dispatchEvent=="function")ee=n.createEvent(j[Z]||"HTMLEvents"),ee.initEvent(Z,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,K),K.dispatchEvent(ee);else throw Error("The supplied element doesn't support dispatchEvent");else if(ee&&K.click)K.click();else if(typeof K.fireEvent<"u")K.fireEvent("on"+Z);else throw Error("Browser doesn't support triggering events");else o(K).trigger(Z)},f:function(K){return m.O(K)?K():K},bc:function(K){return m.O(K)?K.v():K},Eb:function(K,Z,ee){var me;Z&&(typeof K.classList=="object"?(me=K.classList[ee?"add":"remove"],m.a.D(Z.match(Y),function(Te){me.call(K.classList,Te)})):typeof K.className.baseVal=="string"?I(K.className,"baseVal",Z,ee):I(K,"className",Z,ee))},Bb:function(K,Z){var ee=m.a.f(Z);(ee===null||ee===e)&&(ee="");var me=m.h.firstChild(K);!me||me.nodeType!=3||m.h.nextSibling(me)?m.h.va(K,[K.ownerDocument.createTextNode(ee)]):me.data=ee,m.a.Ad(K)},Yc:function(K,Z){if(K.name=Z,7>=q)try{var ee=K.name.replace(/[&<>'"]/g,function(me){return"&#"+me.charCodeAt(0)+";"});K.mergeAttributes(n.createElement("<input name='"+ee+"'/>"),!1)}catch{}},Ad:function(K){9<=q&&(K=K.nodeType==1?K:K.parentNode,K.style&&(K.style.zoom=K.style.zoom))},wd:function(K){if(q){var Z=K.style.width;K.style.width=0,K.style.width=Z}},Pd:function(K,Z){K=m.a.f(K),Z=m.a.f(Z);for(var ee=[],me=K;me<=Z;me++)ee.push(me);return ee},la:function(K){for(var Z=[],ee=0,me=K.length;ee<me;ee++)Z.push(K[ee]);return Z},Da:function(K){return z?Symbol(K):K},Zd:q===6,$d:q===7,W:q,Lc:function(K,Z){for(var ee=m.a.la(K.getElementsByTagName("input")).concat(m.a.la(K.getElementsByTagName("textarea"))),me=typeof Z=="string"?function(ye){return ye.name===Z}:function(ye){return Z.test(ye.name)},Te=[],ue=ee.length-1;0<=ue;ue--)me(ee[ue])&&Te.push(ee[ue]);return Te},Nd:function(K){return typeof K=="string"&&(K=m.a.Db(K))?r&&r.parse?r.parse(K):new Function("return "+K)():null},hc:function(K,Z,ee){if(!r||!r.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return r.stringify(m.a.f(K),Z,ee)},Od:function(K,Z,ee){ee=ee||{};var me=ee.params||{},Te=ee.includeFields||this.Jc,ue=K;if(typeof K=="object"&&m.a.R(K)==="form")for(var ue=K.action,ye=Te.length-1;0<=ye;ye--)for(var Ae=m.a.Lc(K,Te[ye]),Pe=Ae.length-1;0<=Pe;Pe--)me[Ae[Pe].name]=Ae[Pe].value;Z=m.a.f(Z);var Ee=n.createElement("form");Ee.style.display="none",Ee.action=ue,Ee.method="post";for(var ze in Z)K=n.createElement("input"),K.type="hidden",K.name=ze,K.value=m.a.hc(m.a.f(Z[ze])),Ee.appendChild(K);_(me,function(qe,it){var Dt=n.createElement("input");Dt.type="hidden",Dt.name=qe,Dt.value=it,Ee.appendChild(Dt)}),n.body.appendChild(Ee),ee.submitter?ee.submitter(Ee):Ee.submit(),setTimeout(function(){Ee.parentNode.removeChild(Ee)},0)}}}(),m.b("utils",m.a),m.b("utils.arrayForEach",m.a.D),m.b("utils.arrayFirst",m.a.Lb),m.b("utils.arrayFilter",m.a.jb),m.b("utils.arrayGetDistinctValues",m.a.wc),m.b("utils.arrayIndexOf",m.a.A),m.b("utils.arrayMap",m.a.Mb),m.b("utils.arrayPushAll",m.a.Nb),m.b("utils.arrayRemoveItem",m.a.Pa),m.b("utils.cloneNodes",m.a.Ca),m.b("utils.createSymbolOrString",m.a.Da),m.b("utils.extend",m.a.extend),m.b("utils.fieldsIncludedWithJsonPost",m.a.Jc),m.b("utils.getFormFields",m.a.Lc),m.b("utils.objectMap",m.a.Ga),m.b("utils.peekObservable",m.a.bc),m.b("utils.postJson",m.a.Od),m.b("utils.parseJson",m.a.Nd),m.b("utils.registerEventHandler",m.a.B),m.b("utils.stringifyJson",m.a.hc),m.b("utils.range",m.a.Pd),m.b("utils.toggleDomNodeCssClass",m.a.Eb),m.b("utils.triggerEvent",m.a.Fb),m.b("utils.unwrapObservable",m.a.f),m.b("utils.objectForEach",m.a.P),m.b("utils.addOrRemoveItem",m.a.Na),m.b("utils.setTextContent",m.a.Bb),m.b("unwrap",m.a.f),Function.prototype.bind||(Function.prototype.bind=function(_){var w=this;if(arguments.length===1)return function(){return w.apply(_,arguments)};var D=Array.prototype.slice.call(arguments,1);return function(){var I=D.slice(0);return I.push.apply(I,arguments),w.apply(_,I)}}),m.a.g=new function(){var _=0,w="__ko__"+new Date().getTime(),D={},I,N;return m.a.W?(I=function(k,z){var V=k[w];if(!V||V==="null"||!D[V]){if(!z)return e;V=k[w]="ko"+_++,D[V]={}}return D[V]},N=function(k){var z=k[w];return z?(delete D[z],k[w]=null,!0):!1}):(I=function(k,z){var V=k[w];return!V&&z&&(V=k[w]={}),V},N=function(k){return k[w]?(delete k[w],!0):!1}),{get:function(k,z){var V=I(k,!1);return V&&V[z]},set:function(k,z,V){(k=I(k,V!==e))&&(k[z]=V)},Ub:function(k,z,V){return k=I(k,!0),k[z]||(k[z]=V)},clear:N,Z:function(){return _+++w}}},m.b("utils.domData",m.a.g),m.b("utils.domData.clear",m.a.g.clear),m.a.K=new function(){function _(z,V){var j=m.a.g.get(z,I);return j===e&&V&&(j=[],m.a.g.set(z,I,j)),j}function w(z){var V=_(z,!1);if(V)for(var V=V.slice(0),j=0;j<V.length;j++)V[j](z);m.a.g.clear(z),m.a.K.cleanExternalData(z),k[z.nodeType]&&D(z.childNodes,!0)}function D(z,V){for(var j=[],U,q=0;q<z.length;q++)if((!V||z[q].nodeType===8)&&(w(j[j.length]=U=z[q]),z[q]!==U))for(;q--&&m.a.A(j,z[q])==-1;);}var I=m.a.g.Z(),N={1:!0,8:!0,9:!0},k={1:!0,9:!0};return{za:function(z,V){if(typeof V!="function")throw Error("Callback must be a function");_(z,!0).push(V)},yb:function(z,V){var j=_(z,!1);j&&(m.a.Pa(j,V),j.length==0&&m.a.g.set(z,I,e))},oa:function(z){return m.u.G(function(){N[z.nodeType]&&(w(z),k[z.nodeType]&&D(z.getElementsByTagName("*")))}),z},removeNode:function(z){m.oa(z),z.parentNode&&z.parentNode.removeChild(z)},cleanExternalData:function(z){o&&typeof o.cleanData=="function"&&o.cleanData([z])}}},m.oa=m.a.K.oa,m.removeNode=m.a.K.removeNode,m.b("cleanNode",m.oa),m.b("removeNode",m.removeNode),m.b("utils.domNodeDisposal",m.a.K),m.b("utils.domNodeDisposal.addDisposeCallback",m.a.K.za),m.b("utils.domNodeDisposal.removeDisposeCallback",m.a.K.yb),function(){var _=[0,"",""],w=[1,"<table>","</table>"],D=[3,"<table><tbody><tr>","</tr></tbody></table>"],I=[1,"<select multiple='multiple'>","</select>"],N={thead:w,tbody:w,tfoot:w,tr:[2,"<table><tbody>","</tbody></table>"],td:D,th:D,option:I,optgroup:I},k=8>=m.a.W;m.a.ua=function(z,V){var j;if(o){if(o.parseHTML)j=o.parseHTML(z,V)||[];else if((j=o.clean([z],V))&&j[0]){for(var U=j[0];U.parentNode&&U.parentNode.nodeType!==11;)U=U.parentNode;U.parentNode&&U.parentNode.removeChild(U)}}else{(j=V)||(j=n);var U=j.parentWindow||j.defaultView||t,q=m.a.Db(z).toLowerCase(),Y=j.createElement("div"),te;for(te=(q=q.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&N[q[1]]||_,q=te[0],te="ignored<div>"+te[1]+z+te[2]+"</div>",typeof U.innerShiv=="function"?Y.appendChild(U.innerShiv(te)):(k&&j.body.appendChild(Y),Y.innerHTML=te,k&&Y.parentNode.removeChild(Y));q--;)Y=Y.lastChild;j=m.a.la(Y.lastChild.childNodes)}return j},m.a.Md=function(z,V){var j=m.a.ua(z,V);return j.length&&j[0].parentElement||m.a.Yb(j)},m.a.fc=function(z,V){if(m.a.Tb(z),V=m.a.f(V),V!==null&&V!==e)if(typeof V!="string"&&(V=V.toString()),o)o(z).html(V);else for(var j=m.a.ua(V,z.ownerDocument),U=0;U<j.length;U++)z.appendChild(j[U])}}(),m.b("utils.parseHtmlFragment",m.a.ua),m.b("utils.setHtml",m.a.fc),m.aa=function(){function _(D,I){if(D){if(D.nodeType==8){var N=m.aa.Uc(D.nodeValue);N!=null&&I.push({ud:D,Kd:N})}else if(D.nodeType==1)for(var N=0,k=D.childNodes,z=k.length;N<z;N++)_(k[N],I)}}var w={};return{Xb:function(D){if(typeof D!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var I=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return w[I]=D,"<!--[ko_memo:"+I+"]-->"},bd:function(D,I){var N=w[D];if(N===e)throw Error("Couldn't find any memo with ID "+D+". Perhaps it's already been unmemoized.");try{return N.apply(null,I||[]),!0}finally{delete w[D]}},cd:function(D,I){var N=[];_(D,N);for(var k=0,z=N.length;k<z;k++){var V=N[k].ud,j=[V];I&&m.a.Nb(j,I),m.aa.bd(N[k].Kd,j),V.nodeValue="",V.parentNode&&V.parentNode.removeChild(V)}},Uc:function(D){return(D=D.match(/^\[ko_memo\:(.*?)\]$/))?D[1]:null}}}(),m.b("memoization",m.aa),m.b("memoization.memoize",m.aa.Xb),m.b("memoization.unmemoize",m.aa.bd),m.b("memoization.parseMemoText",m.aa.Uc),m.b("memoization.unmemoizeDomNodeAndDescendants",m.aa.cd),m.na=function(){function _(){if(N){for(var V=N,j=0,U;z<N;)if(U=I[z++]){if(z>V){if(5e3<=++j){z=N,m.a.Gc(Error("'Too much recursion' after processing "+j+" task groups."));break}V=N}try{U()}catch(q){m.a.Gc(q)}}}}function w(){_(),z=N=I.length=0}var D,I=[],N=0,k=1,z=0;return t.MutationObserver?D=function(V){var j=n.createElement("div");return new MutationObserver(V).observe(j,{attributes:!0}),function(){j.classList.toggle("foo")}}(w):D=n&&"onreadystatechange"in n.createElement("script")?function(V){var j=n.createElement("script");j.onreadystatechange=function(){j.onreadystatechange=null,n.documentElement.removeChild(j),j=null,V()},n.documentElement.appendChild(j)}:function(V){setTimeout(V,0)},{scheduler:D,zb:function(V){return N||m.na.scheduler(w),I[N++]=V,k++},cancel:function(V){V=V-(k-N),V>=z&&V<N&&(I[V]=null)},resetForTesting:function(){var V=N-z;return z=N=I.length=0,V},Sd:_}}(),m.b("tasks",m.na),m.b("tasks.schedule",m.na.zb),m.b("tasks.runEarly",m.na.Sd),m.Ta={throttle:function(_,w){_.throttleEvaluation=w;var D=null;return m.$({read:_,write:function(I){clearTimeout(D),D=m.a.setTimeout(function(){_(I)},w)}})},rateLimit:function(_,w){var D,I,N;typeof w=="number"?D=w:(D=w.timeout,I=w.method),_.Hb=!1,N=typeof I=="function"?I:I=="notifyWhenChangesStop"?f:u,_.ub(function(k){return N(k,D,w)})},deferred:function(_,w){if(w!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");_.Hb||(_.Hb=!0,_.ub(function(D){var I,N=!1;return function(){if(!N){m.na.cancel(I),I=m.na.zb(D);try{N=!0,_.notifySubscribers(e,"dirty")}finally{N=!1}}}}))},notify:function(_,w){_.equalityComparer=w=="always"?null:l}};var y={undefined:1,boolean:1,number:1,string:1};m.b("extenders",m.Ta),m.ic=function(_,w,D){this.da=_,this.lc=w,this.mc=D,this.Ib=!1,this.fb=this.Jb=null,m.L(this,"dispose",this.s),m.L(this,"disposeWhenNodeIsRemoved",this.l)},m.ic.prototype.s=function(){this.Ib||(this.fb&&m.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},m.ic.prototype.l=function(_){this.Jb=_,m.a.K.za(_,this.fb=this.s.bind(this))},m.T=function(){m.a.Ab(this,b),b.qb(this)};var b={qb:function(_){_.U={change:[]},_.sc=1},subscribe:function(_,w,D){var I=this;D=D||"change";var N=new m.ic(I,w?_.bind(w):_,function(){m.a.Pa(I.U[D],N),I.hb&&I.hb(D)});return I.Qa&&I.Qa(D),I.U[D]||(I.U[D]=[]),I.U[D].push(N),N},notifySubscribers:function(_,w){if(w=w||"change",w==="change"&&this.Gb(),this.Wa(w)){var D=w==="change"&&this.ed||this.U[w].slice(0);try{m.u.xc();for(var I=0,N;N=D[I];++I)N.Ib||N.lc(_)}finally{m.u.end()}}},ob:function(){return this.sc},Dd:function(_){return this.ob()!==_},Gb:function(){++this.sc},ub:function(_){var w=this,D=m.O(w),I,N,k,z,V;w.gb||(w.gb=w.notifySubscribers,w.notifySubscribers=h);var j=_(function(){w.Ja=!1,D&&z===w&&(z=w.nc?w.nc():w());var U=N||V&&w.sb(k,z);V=N=I=!1,U&&w.gb(k=z)});w.qc=function(U,q){q&&w.Ja||(V=!q),w.ed=w.U.change.slice(0),w.Ja=I=!0,z=U,j()},w.pc=function(U){I||(k=U,w.gb(U,"beforeChange"))},w.rc=function(){V=!0},w.gd=function(){w.sb(k,w.v(!0))&&(N=!0)}},Wa:function(_){return this.U[_]&&this.U[_].length},Bd:function(_){if(_)return this.U[_]&&this.U[_].length||0;var w=0;return m.a.P(this.U,function(D,I){D!=="dirty"&&(w+=I.length)}),w},sb:function(_,w){return!this.equalityComparer||!this.equalityComparer(_,w)},toString:function(){return"[object Object]"},extend:function(_){var w=this;return _&&m.a.P(_,function(D,I){var N=m.Ta[D];typeof N=="function"&&(w=N(w,I)||w)}),w}};m.L(b,"init",b.qb),m.L(b,"subscribe",b.subscribe),m.L(b,"extend",b.extend),m.L(b,"getSubscriptionsCount",b.Bd),m.a.Ba&&m.a.setPrototypeOf(b,Function.prototype),m.T.fn=b,m.Qc=function(_){return _!=null&&typeof _.subscribe=="function"&&typeof _.notifySubscribers=="function"},m.b("subscribable",m.T),m.b("isSubscribable",m.Qc),m.S=m.u=function(){function _(k){D.push(I),I=k}function w(){I=D.pop()}var D=[],I,N=0;return{xc:_,end:w,cc:function(k){if(I){if(!m.Qc(k))throw Error("Only subscribable things can act as dependencies");I.od.call(I.pd,k,k.fd||(k.fd=++N))}},G:function(k,z,V){try{return _(),k.apply(z,V||[])}finally{w()}},qa:function(){if(I)return I.o.qa()},Va:function(){if(I)return I.o.Va()},Ya:function(){if(I)return I.Ya},o:function(){if(I)return I.o}}}(),m.b("computedContext",m.S),m.b("computedContext.getDependenciesCount",m.S.qa),m.b("computedContext.getDependencies",m.S.Va),m.b("computedContext.isInitial",m.S.Ya),m.b("computedContext.registerDependency",m.S.cc),m.b("ignoreDependencies",m.Yd=m.u.G);var x=m.a.Da("_latestValue");m.ta=function(_){function w(){return 0<arguments.length?(w.sb(w[x],arguments[0])&&(w.ya(),w[x]=arguments[0],w.xa()),this):(m.u.cc(w),w[x])}return w[x]=_,m.a.Ba||m.a.extend(w,m.T.fn),m.T.fn.qb(w),m.a.Ab(w,A),m.options.deferUpdates&&m.Ta.deferred(w,!0),w};var A={equalityComparer:l,v:function(){return this[x]},xa:function(){this.notifySubscribers(this[x],"spectate"),this.notifySubscribers(this[x])},ya:function(){this.notifySubscribers(this[x],"beforeChange")}};m.a.Ba&&m.a.setPrototypeOf(A,m.T.fn);var C=m.ta.Ma="__ko_proto__";A[C]=m.ta,m.O=function(_){if((_=typeof _=="function"&&_[C])&&_!==A[C]&&_!==m.o.fn[C])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!_},m.Za=function(_){return typeof _=="function"&&(_[C]===A[C]||_[C]===m.o.fn[C]&&_.Nc)},m.b("observable",m.ta),m.b("isObservable",m.O),m.b("isWriteableObservable",m.Za),m.b("isWritableObservable",m.Za),m.b("observable.fn",A),m.L(A,"peek",A.v),m.L(A,"valueHasMutated",A.xa),m.L(A,"valueWillMutate",A.ya),m.Ha=function(_){if(_=_||[],typeof _!="object"||!("length"in _))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return _=m.ta(_),m.a.Ab(_,m.Ha.fn),_.extend({trackArrayChanges:!0})},m.Ha.fn={remove:function(_){for(var w=this.v(),D=[],I=typeof _!="function"||m.O(_)?function(z){return z===_}:_,N=0;N<w.length;N++){var k=w[N];if(I(k)){if(D.length===0&&this.ya(),w[N]!==k)throw Error("Array modified during remove; cannot remove item");D.push(k),w.splice(N,1),N--}}return D.length&&this.xa(),D},removeAll:function(_){if(_===e){var w=this.v(),D=w.slice(0);return this.ya(),w.splice(0,w.length),this.xa(),D}return _?this.remove(function(I){return 0<=m.a.A(_,I)}):[]},destroy:function(_){var w=this.v(),D=typeof _!="function"||m.O(_)?function(k){return k===_}:_;this.ya();for(var I=w.length-1;0<=I;I--){var N=w[I];D(N)&&(N._destroy=!0)}this.xa()},destroyAll:function(_){return _===e?this.destroy(function(){return!0}):_?this.destroy(function(w){return 0<=m.a.A(_,w)}):[]},indexOf:function(_){var w=this();return m.a.A(w,_)},replace:function(_,w){var D=this.indexOf(_);0<=D&&(this.ya(),this.v()[D]=w,this.xa())},sorted:function(_){var w=this().slice(0);return _?w.sort(_):w.sort()},reversed:function(){return this().slice(0).reverse()}},m.a.Ba&&m.a.setPrototypeOf(m.Ha.fn,m.ta.fn),m.a.D("pop push reverse shift sort splice unshift".split(" "),function(_){m.Ha.fn[_]=function(){var w=this.v();this.ya(),this.zc(w,_,arguments);var D=w[_].apply(w,arguments);return this.xa(),D===w?this:D}}),m.a.D(["slice"],function(_){m.Ha.fn[_]=function(){var w=this();return w[_].apply(w,arguments)}}),m.Pc=function(_){return m.O(_)&&typeof _.remove=="function"&&typeof _.push=="function"},m.b("observableArray",m.Ha),m.b("isObservableArray",m.Pc),m.Ta.trackArrayChanges=function(_,w){function D(){function Y(){if(V){var te=[].concat(_.v()||[]),K;_.Wa("arrayChange")&&((!N||1<V)&&(N=m.a.Pb(j,te,_.Ob)),K=N),j=te,N=null,V=0,K&&K.length&&_.notifySubscribers(K,"arrayChange")}}I?Y():(I=!0,z=_.subscribe(function(){++V},null,"spectate"),j=[].concat(_.v()||[]),N=null,k=_.subscribe(Y))}if(_.Ob={},w&&typeof w=="object"&&m.a.extend(_.Ob,w),_.Ob.sparse=!0,!_.zc){var I=!1,N=null,k,z,V=0,j,U=_.Qa,q=_.hb;_.Qa=function(Y){U&&U.call(_,Y),Y==="arrayChange"&&D()},_.hb=function(Y){q&&q.call(_,Y),Y!=="arrayChange"||_.Wa("arrayChange")||(k&&k.s(),z&&z.s(),z=k=null,I=!1,j=e)},_.zc=function(Y,te,K){function Z(Ee,ze,qe){return ee[ee.length]={status:Ee,value:ze,index:qe}}if(I&&!V){var ee=[],me=Y.length,Te=K.length,ue=0;switch(te){case"push":ue=me;case"unshift":for(te=0;te<Te;te++)Z("added",K[te],ue+te);break;case"pop":ue=me-1;case"shift":me&&Z("deleted",Y[ue],ue);break;case"splice":te=Math.min(Math.max(0,0>K[0]?me+K[0]:K[0]),me);for(var me=Te===1?me:Math.min(te+(K[1]||0),me),Te=te+Te-2,ue=Math.max(me,Te),ye=[],Ae=[],Pe=2;te<ue;++te,++Pe)te<me&&Ae.push(Z("deleted",Y[te],te)),te<Te&&ye.push(Z("added",K[Pe],te));m.a.Kc(Ae,ye);break;default:return}N=ee}}}};var S=m.a.Da("_state");m.o=m.$=function(_,w,D){function I(){if(0<arguments.length){if(typeof N=="function")N.apply(k.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return k.ra||m.u.cc(I),(k.ka||k.J&&I.Xa())&&I.ha(),k.X}if(typeof _=="object"?D=_:(D=D||{},_&&(D.read=_)),typeof D.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var N=D.write,k={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:D.read,nb:w||D.owner,l:D.disposeWhenNodeIsRemoved||D.l||null,Sa:D.disposeWhen||D.Sa,Rb:null,I:{},V:0,Ic:null};return I[S]=k,I.Nc=typeof N=="function",m.a.Ba||m.a.extend(I,m.T.fn),m.T.fn.qb(I),m.a.Ab(I,v),D.pure?(k.wb=!0,k.J=!0,m.a.extend(I,P)):D.deferEvaluation&&m.a.extend(I,M),m.options.deferUpdates&&m.Ta.deferred(I,!0),k.l&&(k.jc=!0,k.l.nodeType||(k.l=null)),k.J||D.deferEvaluation||I.ha(),k.l&&I.ja()&&m.a.K.za(k.l,k.Rb=function(){I.s()}),I};var v={equalityComparer:l,qa:function(){return this[S].V},Va:function(){var _=[];return m.a.P(this[S].I,function(w,D){_[D.Ka]=D.da}),_},Vb:function(_){if(!this[S].V)return!1;var w=this.Va();return m.a.A(w,_)!==-1?!0:!!m.a.Lb(w,function(D){return D.Vb&&D.Vb(_)})},uc:function(_,w,D){if(this[S].wb&&w===this)throw Error("A 'pure' computed must not be called recursively");this[S].I[_]=D,D.Ka=this[S].V++,D.La=w.ob()},Xa:function(){var _,w,D=this[S].I;for(_ in D)if(Object.prototype.hasOwnProperty.call(D,_)&&(w=D[_],this.Ia&&w.da.Ja||w.da.Dd(w.La)))return!0},Jd:function(){this.Ia&&!this[S].rb&&this.Ia(!1)},ja:function(){var _=this[S];return _.ka||0<_.V},Rd:function(){this.Ja?this[S].ka&&(this[S].sa=!0):this.Hc()},$c:function(_){if(_.Hb){var w=_.subscribe(this.Jd,this,"dirty"),D=_.subscribe(this.Rd,this);return{da:_,s:function(){w.s(),D.s()}}}return _.subscribe(this.Hc,this)},Hc:function(){var _=this,w=_.throttleEvaluation;w&&0<=w?(clearTimeout(this[S].Ic),this[S].Ic=m.a.setTimeout(function(){_.ha(!0)},w)):_.Ia?_.Ia(!0):_.ha(!0)},ha:function(_){var w=this[S],D=w.Sa,I=!1;if(!w.rb&&!w.ra){if(w.l&&!m.a.Sb(w.l)||D&&D()){if(!w.jc){this.s();return}}else w.jc=!1;w.rb=!0;try{I=this.zd(_)}finally{w.rb=!1}return I}},zd:function(_){var w=this[S],I=!1,D=w.wb?e:!w.V,I={qd:this,mb:w.I,Qb:w.V};m.u.xc({pd:I,od:g,o:this,Ya:D}),w.I={},w.V=0;var N=this.yd(w,I);return w.V?I=this.sb(w.X,N):(this.s(),I=!0),I&&(w.J?this.Gb():this.notifySubscribers(w.X,"beforeChange"),w.X=N,this.notifySubscribers(w.X,"spectate"),!w.J&&_&&this.notifySubscribers(w.X),this.rc&&this.rc()),D&&this.notifySubscribers(w.X,"awake"),I},yd:function(_,w){try{var D=_.Wc;return _.nb?D.call(_.nb):D()}finally{m.u.end(),w.Qb&&!_.J&&m.a.P(w.mb,p),_.sa=_.ka=!1}},v:function(_){var w=this[S];return(w.ka&&(_||!w.V)||w.J&&this.Xa())&&this.ha(),w.X},ub:function(_){m.T.fn.ub.call(this,_),this.nc=function(){return this[S].J||(this[S].sa?this.ha():this[S].ka=!1),this[S].X},this.Ia=function(w){this.pc(this[S].X),this[S].ka=!0,w&&(this[S].sa=!0),this.qc(this,!w)}},s:function(){var _=this[S];!_.J&&_.I&&m.a.P(_.I,function(w,D){D.s&&D.s()}),_.l&&_.Rb&&m.a.K.yb(_.l,_.Rb),_.I=e,_.V=0,_.ra=!0,_.sa=!1,_.ka=!1,_.J=!1,_.l=e,_.Sa=e,_.Wc=e,this.Nc||(_.nb=e)}},P={Qa:function(_){var w=this,D=w[S];if(!D.ra&&D.J&&_=="change"){if(D.J=!1,D.sa||w.Xa())D.I=null,D.V=0,w.ha()&&w.Gb();else{var I=[];m.a.P(D.I,function(N,k){I[k.Ka]=N}),m.a.D(I,function(N,k){var z=D.I[N],V=w.$c(z.da);V.Ka=k,V.La=z.La,D.I[N]=V}),w.Xa()&&w.ha()&&w.Gb()}D.ra||w.notifySubscribers(D.X,"awake")}},hb:function(_){var w=this[S];w.ra||_!="change"||this.Wa("change")||(m.a.P(w.I,function(D,I){I.s&&(w.I[D]={da:I.da,Ka:I.Ka,La:I.La},I.s())}),w.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var _=this[S];return _.J&&(_.sa||this.Xa())&&this.ha(),m.T.fn.ob.call(this)}},M={Qa:function(_){_!="change"&&_!="beforeChange"||this.v()}};m.a.Ba&&m.a.setPrototypeOf(v,m.T.fn);var R=m.ta.Ma;v[R]=m.o,m.Oc=function(_){return typeof _=="function"&&_[R]===v[R]},m.Fd=function(_){return m.Oc(_)&&_[S]&&_[S].wb},m.b("computed",m.o),m.b("dependentObservable",m.o),m.b("isComputed",m.Oc),m.b("isPureComputed",m.Fd),m.b("computed.fn",v),m.L(v,"peek",v.v),m.L(v,"dispose",v.s),m.L(v,"isActive",v.ja),m.L(v,"getDependenciesCount",v.qa),m.L(v,"getDependencies",v.Va),m.xb=function(_,w){return typeof _=="function"?m.o(_,w,{pure:!0}):(_=m.a.extend({},_),_.pure=!0,m.o(_,w))},m.b("pureComputed",m.xb),function(){function _(I,N,k){if(k=k||new D,I=N(I),typeof I!="object"||I===null||I===e||I instanceof RegExp||I instanceof Date||I instanceof String||I instanceof Number||I instanceof Boolean)return I;var z=I instanceof Array?[]:{};return k.save(I,z),w(I,function(V){var j=N(I[V]);switch(typeof j){case"boolean":case"number":case"string":case"function":z[V]=j;break;case"object":case"undefined":var U=k.get(j);z[V]=U!==e?U:_(j,N,k)}}),z}function w(I,N){if(I instanceof Array){for(var k=0;k<I.length;k++)N(k);typeof I.toJSON=="function"&&N("toJSON")}else for(k in I)N(k)}function D(){this.keys=[],this.values=[]}m.ad=function(I){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return _(I,function(N){for(var k=0;m.O(N)&&10>k;k++)N=N();return N})},m.toJSON=function(I,N,k){return I=m.ad(I),m.a.hc(I,N,k)},D.prototype={constructor:D,save:function(I,N){var k=m.a.A(this.keys,I);0<=k?this.values[k]=N:(this.keys.push(I),this.values.push(N))},get:function(I){return I=m.a.A(this.keys,I),0<=I?this.values[I]:e}}}(),m.b("toJS",m.ad),m.b("toJSON",m.toJSON),m.Wd=function(_,w,D){function I(N){var k=m.xb(_,D).extend({ma:"always"}),z=k.subscribe(function(V){V&&(z.s(),N(V))});return k.notifySubscribers(k.v()),z}return typeof Promise!="function"||w?I(w.bind(D)):new Promise(I)},m.b("when",m.Wd),function(){m.w={M:function(_){switch(m.a.R(_)){case"option":return _.__ko__hasDomDataOptionValue__===!0?m.a.g.get(_,m.c.options.$b):7>=m.a.W?_.getAttributeNode("value")&&_.getAttributeNode("value").specified?_.value:_.text:_.value;case"select":return 0<=_.selectedIndex?m.w.M(_.options[_.selectedIndex]):e;default:return _.value}},cb:function(_,w,D){switch(m.a.R(_)){case"option":typeof w=="string"?(m.a.g.set(_,m.c.options.$b,e),"__ko__hasDomDataOptionValue__"in _&&delete _.__ko__hasDomDataOptionValue__,_.value=w):(m.a.g.set(_,m.c.options.$b,w),_.__ko__hasDomDataOptionValue__=!0,_.value=typeof w=="number"?w:"");break;case"select":(w===""||w===null)&&(w=e);for(var I=-1,N=0,k=_.options.length,z;N<k;++N)if(z=m.w.M(_.options[N]),z==w||z===""&&w===e){I=N;break}(D||0<=I||w===e&&1<_.size)&&(_.selectedIndex=I,m.a.W===6&&m.a.setTimeout(function(){_.selectedIndex=I},0));break;default:(w===null||w===e)&&(w=""),_.value=w}}}}(),m.b("selectExtensions",m.w),m.b("selectExtensions.readValue",m.w.M),m.b("selectExtensions.writeValue",m.w.cb),m.m=function(){function _(V){V=m.a.Db(V),V.charCodeAt(0)===123&&(V=V.slice(1,-1)),V+=`
,`;var j=[],U=V.match(I),q,Y=[],te=0;if(1<U.length){for(var K=0,Z;Z=U[K];++K){var ee=Z.charCodeAt(0);if(ee===44){if(0>=te){j.push(q&&Y.length?{key:q,value:Y.join("")}:{unknown:q||Y.join("")}),q=te=0,Y=[];continue}}else if(ee===58){if(!te&&!q&&Y.length===1){q=Y.pop();continue}}else{if(ee===47&&1<Z.length&&(Z.charCodeAt(1)===47||Z.charCodeAt(1)===42))continue;ee===47&&K&&1<Z.length?(ee=U[K-1].match(N))&&!k[ee[0]]&&(V=V.substr(V.indexOf(Z)+1),U=V.match(I),K=-1,Z="/"):ee===40||ee===123||ee===91?++te:ee===41||ee===125||ee===93?--te:q||Y.length||ee!==34&&ee!==39||(Z=Z.slice(1,-1))}Y.push(Z)}if(0<te)throw Error("Unbalanced parentheses, braces, or brackets")}return j}var w=["true","false","null","undefined"],D=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,I=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),N=/[\])"'A-Za-z0-9_$]+$/,k={in:1,return:1,typeof:1},z={};return{Ra:[],wa:z,ac:_,vb:function(V,j){function U(ee,me){var Te;if(!K){var ue=m.getBindingHandler(ee);if(ue&&ue.preprocess&&!(me=ue.preprocess(me,ee,U)))return;(ue=z[ee])&&(Te=me,0<=m.a.A(w,Te)?Te=!1:(ue=Te.match(D),Te=ue===null?!1:ue[1]?"Object("+ue[1]+")"+ue[2]:Te),ue=Te),ue&&Y.push("'"+(typeof z[ee]=="string"?z[ee]:ee)+"':function(_z){"+Te+"=_z}")}te&&(me="function(){return "+me+" }"),q.push("'"+ee+"':"+me)}j=j||{};var q=[],Y=[],te=j.valueAccessors,K=j.bindingParams,Z=typeof V=="string"?_(V):V;return m.a.D(Z,function(ee){U(ee.key||ee.unknown,ee.value)}),Y.length&&U("_ko_property_writers","{"+Y.join(",")+" }"),q.join(",")},Id:function(V,j){for(var U=0;U<V.length;U++)if(V[U].key==j)return!0;return!1},eb:function(V,j,U,q,Y){V&&m.O(V)?!m.Za(V)||Y&&V.v()===q||V(q):(V=j.get("_ko_property_writers"))&&V[U]&&V[U](q)}}}(),m.b("expressionRewriting",m.m),m.b("expressionRewriting.bindingRewriteValidators",m.m.Ra),m.b("expressionRewriting.parseObjectLiteral",m.m.ac),m.b("expressionRewriting.preProcessBindings",m.m.vb),m.b("expressionRewriting._twoWayBindings",m.m.wa),m.b("jsonExpressionRewriting",m.m),m.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",m.m.vb),function(){function _(U){return U.nodeType==8&&k.test(N?U.text:U.nodeValue)}function w(U){return U.nodeType==8&&z.test(N?U.text:U.nodeValue)}function D(U,q){for(var Y=U,te=1,K=[];Y=Y.nextSibling;){if(w(Y)&&(m.a.g.set(Y,j,!0),te--,te===0))return K;K.push(Y),_(Y)&&te++}if(!q)throw Error("Cannot find closing comment tag to match: "+U.nodeValue);return null}function I(U,q){var Y=D(U,q);return Y?0<Y.length?Y[Y.length-1].nextSibling:U.nextSibling:null}var N=n&&n.createComment("test").text==="<!--test-->",k=N?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,z=N?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,V={ul:!0,ol:!0},j="__ko_matchedEndComment__";m.h={ea:{},childNodes:function(U){return _(U)?D(U):U.childNodes},Ea:function(U){if(_(U)){U=m.h.childNodes(U);for(var q=0,Y=U.length;q<Y;q++)m.removeNode(U[q])}else m.a.Tb(U)},va:function(U,q){if(_(U)){m.h.Ea(U);for(var Y=U.nextSibling,te=0,K=q.length;te<K;te++)Y.parentNode.insertBefore(q[te],Y)}else m.a.va(U,q)},Vc:function(U,q){var Y;_(U)?(Y=U.nextSibling,U=U.parentNode):Y=U.firstChild,Y?q!==Y&&U.insertBefore(q,Y):U.appendChild(q)},Wb:function(U,q,Y){Y?(Y=Y.nextSibling,_(U)&&(U=U.parentNode),Y?q!==Y&&U.insertBefore(q,Y):U.appendChild(q)):m.h.Vc(U,q)},firstChild:function(U){if(_(U))return!U.nextSibling||w(U.nextSibling)?null:U.nextSibling;if(U.firstChild&&w(U.firstChild))throw Error("Found invalid end comment, as the first child of "+U);return U.firstChild},nextSibling:function(U){if(_(U)&&(U=I(U)),U.nextSibling&&w(U.nextSibling)){var q=U.nextSibling;if(w(q)&&!m.a.g.get(q,j))throw Error("Found end comment without a matching opening comment, as child of "+U);return null}return U.nextSibling},Cd:_,Vd:function(U){return(U=(N?U.text:U.nodeValue).match(k))?U[1]:null},Sc:function(U){if(V[m.a.R(U)]){var q=U.firstChild;if(q)do if(q.nodeType===1){var Y;Y=q.firstChild;var te=null;if(Y)do if(te)te.push(Y);else if(_(Y)){var K=I(Y,!0);K?Y=K:te=[Y]}else w(Y)&&(te=[Y]);while(Y=Y.nextSibling);if(Y=te)for(te=q.nextSibling,K=0;K<Y.length;K++)te?U.insertBefore(Y[K],te):U.appendChild(Y[K])}while(q=q.nextSibling)}}}}(),m.b("virtualElements",m.h),m.b("virtualElements.allowedBindings",m.h.ea),m.b("virtualElements.emptyNode",m.h.Ea),m.b("virtualElements.insertAfter",m.h.Wb),m.b("virtualElements.prepend",m.h.Vc),m.b("virtualElements.setDomNodeChildren",m.h.va),function(){m.ga=function(){this.nd={}},m.a.extend(m.ga.prototype,{nodeHasBindings:function(_){switch(_.nodeType){case 1:return _.getAttribute("data-bind")!=null||m.j.getComponentNameForNode(_);case 8:return m.h.Cd(_);default:return!1}},getBindings:function(_,w){var D=this.getBindingsString(_,w),D=D?this.parseBindingsString(D,w,_):null;return m.j.tc(D,_,w,!1)},getBindingAccessors:function(_,w){var D=this.getBindingsString(_,w),D=D?this.parseBindingsString(D,w,_,{valueAccessors:!0}):null;return m.j.tc(D,_,w,!0)},getBindingsString:function(_){switch(_.nodeType){case 1:return _.getAttribute("data-bind");case 8:return m.h.Vd(_);default:return null}},parseBindingsString:function(_,w,D,I){try{var N=this.nd,k=_+(I&&I.valueAccessors||""),z;if(!(z=N[k])){var V,j="with($context){with($data||{}){return{"+m.m.vb(_,I)+"}}}";V=new Function("$context","$element",j),z=N[k]=V}return z(w,D)}catch(U){throw U.message=`Unable to parse bindings.
Bindings value: `+_+`
Message: `+U.message,U}}}),m.ga.instance=new m.ga}(),m.b("bindingProvider",m.ga),function(){function _(ue){var ye=(ue=m.a.g.get(ue,Te))&&ue.N;ye&&(ue.N=null,ye.Tc())}function w(ue,ye,Ae){this.node=ue,this.yc=ye,this.kb=[],this.H=!1,ye.N||m.a.K.za(ue,_),Ae&&Ae.N&&(Ae.N.kb.push(ue),this.Kb=Ae)}function D(ue){return function(){return ue}}function I(ue){return ue()}function N(ue){return m.a.Ga(m.u.G(ue),function(ye,Ae){return function(){return ue()[Ae]}})}function k(ue,ye,Ae){return typeof ue=="function"?N(ue.bind(null,ye,Ae)):m.a.Ga(ue,D)}function z(ue,ye){return N(this.getBindings.bind(this,ue,ye))}function V(ue,ye){var Ae=m.h.firstChild(ye);if(Ae){var Pe,Ee=m.ga.instance,ze=Ee.preprocessNode;if(ze){for(;Pe=Ae;)Ae=m.h.nextSibling(Pe),ze.call(Ee,Pe);Ae=m.h.firstChild(ye)}for(;Pe=Ae;)Ae=m.h.nextSibling(Pe),j(ue,Pe)}m.i.ma(ye,m.i.H)}function j(ue,ye){var Ae=ue,Pe=ye.nodeType===1;Pe&&m.h.Sc(ye),(Pe||m.ga.instance.nodeHasBindings(ye))&&(Ae=q(ye,null,ue).bindingContextForDescendants),Ae&&!ee[m.a.R(ye)]&&V(Ae,ye)}function U(ue){var ye=[],Ae={},Pe=[];return m.a.P(ue,function Ee(ze){if(!Ae[ze]){var qe=m.getBindingHandler(ze);qe&&(qe.after&&(Pe.push(ze),m.a.D(qe.after,function(it){if(ue[it]){if(m.a.A(Pe,it)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Pe.join(", "));Ee(it)}}),Pe.length--),ye.push({key:ze,Mc:qe})),Ae[ze]=!0}}),ye}function q(ue,ye,Ae){var Pe=m.a.g.Ub(ue,Te,{}),Ee=Pe.hd;if(!ye){if(Ee)throw Error("You cannot apply bindings multiple times to the same element.");Pe.hd=!0}Ee||(Pe.context=Ae),Pe.Zb||(Pe.Zb={});var ze;if(ye&&typeof ye!="function")ze=ye;else{var qe=m.ga.instance,it=qe.getBindingAccessors||z,Dt=m.$(function(){return(ze=ye?ye(Ae,ue):it.call(qe,ue,Ae))&&(Ae[te]&&Ae[te](),Ae[Z]&&Ae[Z]()),ze},null,{l:ue});ze&&Dt.ja()||(Dt=null)}var jt=Ae,$e;if(ze){var un=function(){return m.a.Ga(Dt?Dt():ze,I)},zt=Dt?function(Ct){return function(){return I(Dt()[Ct])}}:function(Ct){return ze[Ct]};un.get=function(Ct){return ze[Ct]&&I(zt(Ct))},un.has=function(Ct){return Ct in ze},m.i.H in ze&&m.i.subscribe(ue,m.i.H,function(){var Ct=(0,ze[m.i.H])();if(Ct){var Ei=m.h.childNodes(ue);Ei.length&&Ct(Ei,m.Ec(Ei[0]))}}),m.i.pa in ze&&(jt=m.i.Cb(ue,Ae),m.i.subscribe(ue,m.i.pa,function(){var Ct=(0,ze[m.i.pa])();Ct&&m.h.firstChild(ue)&&Ct(ue)})),Pe=U(ze),m.a.D(Pe,function(Ct){var Ei=Ct.Mc.init,an=Ct.Mc.update,_e=Ct.key;if(ue.nodeType===8&&!m.h.ea[_e])throw Error("The binding '"+_e+"' cannot be used with virtual elements");try{typeof Ei=="function"&&m.u.G(function(){var Ce=Ei(ue,zt(_e),un,jt.$data,jt);if(Ce&&Ce.controlsDescendantBindings){if($e!==e)throw Error("Multiple bindings ("+$e+" and "+_e+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");$e=_e}}),typeof an=="function"&&m.$(function(){an(ue,zt(_e),un,jt.$data,jt)},null,{l:ue})}catch(Ce){throw Ce.message='Unable to process binding "'+_e+": "+ze[_e]+`"
Message: `+Ce.message,Ce}})}return Pe=$e===e,{shouldBindDescendants:Pe,bindingContextForDescendants:Pe&&jt}}function Y(ue,ye){return ue&&ue instanceof m.fa?ue:new m.fa(ue,e,e,ye)}var te=m.a.Da("_subscribable"),K=m.a.Da("_ancestorBindingInfo"),Z=m.a.Da("_dataDependency");m.c={};var ee={script:!0,textarea:!0,template:!0};m.getBindingHandler=function(ue){return m.c[ue]};var me={};m.fa=function(ue,ye,Ae,Pe,Ee){function ze(){var zt=jt?Dt():Dt,Ct=m.a.f(zt);return ye?(m.a.extend(qe,ye),K in ye&&(qe[K]=ye[K])):(qe.$parents=[],qe.$root=Ct,qe.ko=m),qe[te]=$e,it?Ct=qe.$data:(qe.$rawData=zt,qe.$data=Ct),Ae&&(qe[Ae]=Ct),Pe&&Pe(qe,ye,Ct),ye&&ye[te]&&!m.S.o().Vb(ye[te])&&ye[te](),un&&(qe[Z]=un),qe.$data}var qe=this,it=ue===me,Dt=it?e:ue,jt=typeof Dt=="function"&&!m.O(Dt),$e,un=Ee&&Ee.dataDependency;Ee&&Ee.exportDependencies?ze():($e=m.xb(ze),$e.v(),$e.ja()?$e.equalityComparer=null:qe[te]=e)},m.fa.prototype.createChildContext=function(ue,ye,Ae,Pe){if(!Pe&&ye&&typeof ye=="object"&&(Pe=ye,ye=Pe.as,Ae=Pe.extend),ye&&Pe&&Pe.noChildContext){var Ee=typeof ue=="function"&&!m.O(ue);return new m.fa(me,this,null,function(ze){Ae&&Ae(ze),ze[ye]=Ee?ue():ue},Pe)}return new m.fa(ue,this,ye,function(ze,qe){ze.$parentContext=qe,ze.$parent=qe.$data,ze.$parents=(qe.$parents||[]).slice(0),ze.$parents.unshift(ze.$parent),Ae&&Ae(ze)},Pe)},m.fa.prototype.extend=function(ue,ye){return new m.fa(me,this,null,function(Ae){m.a.extend(Ae,typeof ue=="function"?ue(Ae):ue)},ye)};var Te=m.a.g.Z();w.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},w.prototype.sd=function(ue){m.a.Pa(this.kb,ue),!this.kb.length&&this.H&&this.Cc()},w.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,m.a.K.yb(this.node,_),m.i.ma(this.node,m.i.pa),this.Tc())},m.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(ue,ye,Ae,Pe,Ee){var ze=m.a.g.Ub(ue,Te,{});return ze.Fa||(ze.Fa=new m.T),Ee&&Ee.notifyImmediately&&ze.Zb[ye]&&m.u.G(Ae,Pe,[ue]),ze.Fa.subscribe(Ae,Pe,ye)},ma:function(ue,ye){var Ae=m.a.g.get(ue,Te);if(Ae&&(Ae.Zb[ye]=!0,Ae.Fa&&Ae.Fa.notifySubscribers(ue,ye),ye==m.i.H)){if(Ae.N)Ae.N.Cc();else if(Ae.N===e&&Ae.Fa&&Ae.Fa.Wa(m.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(ue,ye){var Ae=m.a.g.Ub(ue,Te,{});return Ae.N||(Ae.N=new w(ue,Ae,ye[K])),ye[K]==Ae?ye:ye.extend(function(Pe){Pe[K]=Ae})}},m.Td=function(ue){return(ue=m.a.g.get(ue,Te))&&ue.context},m.ib=function(ue,ye,Ae){return ue.nodeType===1&&m.h.Sc(ue),q(ue,ye,Y(Ae))},m.ld=function(ue,ye,Ae){return Ae=Y(Ae),m.ib(ue,k(ye,Ae,ue),Ae)},m.Oa=function(ue,ye){ye.nodeType!==1&&ye.nodeType!==8||V(Y(ue),ye)},m.vc=function(ue,ye,Ae){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(ye=n.body,!ye)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!ye||ye.nodeType!==1&&ye.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");j(Y(ue,Ae),ye)},m.Dc=function(ue){return!ue||ue.nodeType!==1&&ue.nodeType!==8?e:m.Td(ue)},m.Ec=function(ue){return(ue=m.Dc(ue))?ue.$data:e},m.b("bindingHandlers",m.c),m.b("bindingEvent",m.i),m.b("bindingEvent.subscribe",m.i.subscribe),m.b("bindingEvent.startPossiblyAsyncContentBinding",m.i.Cb),m.b("applyBindings",m.vc),m.b("applyBindingsToDescendants",m.Oa),m.b("applyBindingAccessorsToNode",m.ib),m.b("applyBindingsToNode",m.ld),m.b("contextFor",m.Dc),m.b("dataFor",m.Ec)}(),function(_){function w(z,V){var j=Object.prototype.hasOwnProperty.call(N,z)?N[z]:_,U;j?j.subscribe(V):(j=N[z]=new m.T,j.subscribe(V),D(z,function(q,Y){var te=!(!Y||!Y.synchronous);k[z]={definition:q,Gd:te},delete N[z],U||te?j.notifySubscribers(q):m.na.zb(function(){j.notifySubscribers(q)})}),U=!0)}function D(z,V){I("getConfig",[z],function(j){j?I("loadComponent",[z,j],function(U){V(U,j)}):V(null,null)})}function I(z,V,j,U){U||(U=m.j.loaders.slice(0));var q=U.shift();if(q){var Y=q[z];if(Y){var te=!1;if(Y.apply(q,V.concat(function(K){te?j(null):K!==null?j(K):I(z,V,j,U)}))!==_&&(te=!0,!q.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else I(z,V,j,U)}else j(null)}var N={},k={};m.j={get:function(z,V){var j=Object.prototype.hasOwnProperty.call(k,z)?k[z]:_;j?j.Gd?m.u.G(function(){V(j.definition)}):m.na.zb(function(){V(j.definition)}):w(z,V)},Bc:function(z){delete k[z]},oc:I},m.j.loaders=[],m.b("components",m.j),m.b("components.get",m.j.get),m.b("components.clearCachedDefinition",m.j.Bc)}(),function(){function _(j,U,q,Y){function te(){--Z===0&&Y(K)}var K={},Z=2,ee=q.template;q=q.viewModel,ee?N(U,ee,function(me){m.j.oc("loadTemplate",[j,me],function(Te){K.template=Te,te()})}):te(),q?N(U,q,function(me){m.j.oc("loadViewModel",[j,me],function(Te){K[V]=Te,te()})}):te()}function w(j,U,q){if(typeof U=="function")q(function(te){return new U(te)});else if(typeof U[V]=="function")q(U[V]);else if("instance"in U){var Y=U.instance;q(function(){return Y})}else"viewModel"in U?w(j,U.viewModel,q):j("Unknown viewModel value: "+U)}function D(j){switch(m.a.R(j)){case"script":return m.a.ua(j.text);case"textarea":return m.a.ua(j.value);case"template":if(I(j.content))return m.a.Ca(j.content.childNodes)}return m.a.Ca(j.childNodes)}function I(j){return t.DocumentFragment?j instanceof DocumentFragment:j&&j.nodeType===11}function N(j,U,q){typeof U.require=="string"?a||t.require?(a||t.require)([U.require],function(Y){Y&&typeof Y=="object"&&Y.Xd&&Y.default&&(Y=Y.default),q(Y)}):j("Uses require, but no AMD loader is present"):q(U)}function k(j){return function(U){throw Error("Component '"+j+"': "+U)}}var z={};m.j.register=function(j,U){if(!U)throw Error("Invalid configuration for "+j);if(m.j.tb(j))throw Error("Component "+j+" is already registered");z[j]=U},m.j.tb=function(j){return Object.prototype.hasOwnProperty.call(z,j)},m.j.unregister=function(j){delete z[j],m.j.Bc(j)},m.j.Fc={getConfig:function(j,U){U(m.j.tb(j)?z[j]:null)},loadComponent:function(j,U,q){var Y=k(j);N(Y,U,function(te){_(j,Y,te,q)})},loadTemplate:function(j,U,q){if(j=k(j),typeof U=="string")q(m.a.ua(U));else if(U instanceof Array)q(U);else if(I(U))q(m.a.la(U.childNodes));else if(U.element)if(U=U.element,t.HTMLElement?U instanceof HTMLElement:U&&U.tagName&&U.nodeType===1)q(D(U));else if(typeof U=="string"){var Y=n.getElementById(U);Y?q(D(Y)):j("Cannot find element with ID "+U)}else j("Unknown element type: "+U);else j("Unknown template value: "+U)},loadViewModel:function(j,U,q){w(k(j),U,q)}};var V="createViewModel";m.b("components.register",m.j.register),m.b("components.isRegistered",m.j.tb),m.b("components.unregister",m.j.unregister),m.b("components.defaultLoader",m.j.Fc),m.j.loaders.push(m.j.Fc),m.j.dd=z}(),function(){function _(D,I){var N=D.getAttribute("params");if(N){var N=w.parseBindingsString(N,I,D,{valueAccessors:!0,bindingParams:!0}),N=m.a.Ga(N,function(V){return m.o(V,null,{l:D})}),k=m.a.Ga(N,function(V){var j=V.v();return V.ja()?m.o({read:function(){return m.a.f(V())},write:m.Za(j)&&function(U){V()(U)},l:D}):j});return Object.prototype.hasOwnProperty.call(k,"$raw")||(k.$raw=N),k}return{$raw:{}}}m.j.getComponentNameForNode=function(D){var I=m.a.R(D);if(m.j.tb(I)&&(I.indexOf("-")!=-1||""+D=="[object HTMLUnknownElement]"||8>=m.a.W&&D.tagName===I))return I},m.j.tc=function(D,I,N,k){if(I.nodeType===1){var z=m.j.getComponentNameForNode(I);if(z){if(D=D||{},D.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var V={name:z,params:_(I,N)};D.component=k?function(){return V}:V}}return D};var w=new m.ga;9>m.a.W&&(m.j.register=function(D){return function(I){return D.apply(this,arguments)}}(m.j.register),n.createDocumentFragment=function(D){return function(){var I=D(),N=m.j.dd,k;for(k in N);return I}}(n.createDocumentFragment))}(),function(){function _(I,N,k){if(N=N.template,!N)throw Error("Component '"+I+"' has no template");I=m.a.Ca(N),m.h.va(k,I)}function w(I,N,k){var z=I.createViewModel;return z?z.call(I,N,k):N}var D=0;m.c.component={init:function(I,N,k,z,V){function j(){var K=U&&U.dispose;typeof K=="function"&&K.call(U),Y&&Y.s(),q=U=Y=null}var U,q,Y,te=m.a.la(m.h.childNodes(I));return m.h.Ea(I),m.a.K.za(I,j),m.o(function(){var K=m.a.f(N()),Z,ee;if(typeof K=="string"?Z=K:(Z=m.a.f(K.name),ee=m.a.f(K.params)),!Z)throw Error("No component name specified");var me=m.i.Cb(I,V),Te=q=++D;m.j.get(Z,function(ue){if(q===Te){if(j(),!ue)throw Error("Unknown component '"+Z+"'");_(Z,ue,I);var ye=w(ue,ee,{element:I,templateNodes:te});ue=me.createChildContext(ye,{extend:function(Ae){Ae.$component=ye,Ae.$componentTemplateNodes=te}}),ye&&ye.koDescendantsComplete&&(Y=m.i.subscribe(I,m.i.pa,ye.koDescendantsComplete,ye)),U=ye,m.Oa(ue,I)}})},null,{l:I}),{controlsDescendantBindings:!0}}},m.h.ea.component=!0}();var L={class:"className",for:"htmlFor"};m.c.attr={update:function(_,w){var D=m.a.f(w())||{};m.a.P(D,function(I,N){N=m.a.f(N);var k=I.indexOf(":"),k="lookupNamespaceURI"in _&&0<k&&_.lookupNamespaceURI(I.substr(0,k)),z=N===!1||N===null||N===e;z?k?_.removeAttributeNS(k,I):_.removeAttribute(I):N=N.toString(),8>=m.a.W&&I in L?(I=L[I],z?_.removeAttribute(I):_[I]=N):z||(k?_.setAttributeNS(k,I,N):_.setAttribute(I,N)),I==="name"&&m.a.Yc(_,z?"":N)})}},function(){m.c.checked={after:["value","attr"],init:function(_,w,D){function I(){var K=_.checked,Z=k();if(!m.S.Ya()&&(K||!V&&!m.S.qa())){var ee=m.u.G(w);if(U){var me=q?ee.v():ee,Te=te;te=Z,Te!==Z?K&&(m.a.Na(me,Z,!0),m.a.Na(me,Te,!1)):m.a.Na(me,Z,K),q&&m.Za(ee)&&ee(me)}else z&&(Z===e?Z=K:K||(Z=e)),m.m.eb(ee,D,"checked",Z,!0)}}function N(){var K=m.a.f(w()),Z=k();U?(_.checked=0<=m.a.A(K,Z),te=Z):_.checked=z&&Z===e?!!K:k()===K}var k=m.xb(function(){if(D.has("checkedValue"))return m.a.f(D.get("checkedValue"));if(Y)return D.has("value")?m.a.f(D.get("value")):_.value}),z=_.type=="checkbox",V=_.type=="radio";if(z||V){var j=w(),U=z&&m.a.f(j)instanceof Array,q=!(U&&j.push&&j.splice),Y=V||U,te=U?k():e;V&&!_.name&&m.c.uniqueName.init(_,function(){return!0}),m.o(I,null,{l:_}),m.a.B(_,"click",I),m.o(N,null,{l:_}),j=e}}},m.m.wa.checked=!0,m.c.checkedValue={update:function(_,w){_.value=m.a.f(w())}}}(),m.c.class={update:function(_,w){var D=m.a.Db(m.a.f(w()));m.a.Eb(_,_.__ko__cssValue,!1),_.__ko__cssValue=D,m.a.Eb(_,D,!0)}},m.c.css={update:function(_,w){var D=m.a.f(w());D!==null&&typeof D=="object"?m.a.P(D,function(I,N){N=m.a.f(N),m.a.Eb(_,I,N)}):m.c.class.update(_,w)}},m.c.enable={update:function(_,w){var D=m.a.f(w());D&&_.disabled?_.removeAttribute("disabled"):D||_.disabled||(_.disabled=!0)}},m.c.disable={update:function(_,w){m.c.enable.update(_,function(){return!m.a.f(w())})}},m.c.event={init:function(_,w,D,I,N){var k=w()||{};m.a.P(k,function(z){typeof z=="string"&&m.a.B(_,z,function(V){var j,U=w()[z];if(U){try{var q=m.a.la(arguments);I=N.$data,q.unshift(I),j=U.apply(I,q)}finally{j!==!0&&(V.preventDefault?V.preventDefault():V.returnValue=!1)}D.get(z+"Bubble")===!1&&(V.cancelBubble=!0,V.stopPropagation&&V.stopPropagation())}})})}},m.c.foreach={Rc:function(_){return function(){var w=_(),D=m.a.bc(w);return!D||typeof D.length=="number"?{foreach:w,templateEngine:m.ba.Ma}:(m.a.f(w),{foreach:D.data,as:D.as,noChildContext:D.noChildContext,includeDestroyed:D.includeDestroyed,afterAdd:D.afterAdd,beforeRemove:D.beforeRemove,afterRender:D.afterRender,beforeMove:D.beforeMove,afterMove:D.afterMove,templateEngine:m.ba.Ma})}},init:function(_,w){return m.c.template.init(_,m.c.foreach.Rc(w))},update:function(_,w,D,I,N){return m.c.template.update(_,m.c.foreach.Rc(w),D,I,N)}},m.m.Ra.foreach=!1,m.h.ea.foreach=!0,m.c.hasfocus={init:function(_,w,D){function I(z){_.__ko_hasfocusUpdating=!0;var V=_.ownerDocument;if("activeElement"in V){var j;try{j=V.activeElement}catch{j=V.body}z=j===_}V=w(),m.m.eb(V,D,"hasfocus",z,!0),_.__ko_hasfocusLastValue=z,_.__ko_hasfocusUpdating=!1}var N=I.bind(null,!0),k=I.bind(null,!1);m.a.B(_,"focus",N),m.a.B(_,"focusin",N),m.a.B(_,"blur",k),m.a.B(_,"focusout",k),_.__ko_hasfocusLastValue=!1},update:function(_,w){var D=!!m.a.f(w());_.__ko_hasfocusUpdating||_.__ko_hasfocusLastValue===D||(D?_.focus():_.blur(),!D&&_.__ko_hasfocusLastValue&&_.ownerDocument.body.focus(),m.u.G(m.a.Fb,null,[_,D?"focusin":"focusout"]))}},m.m.wa.hasfocus=!0,m.c.hasFocus=m.c.hasfocus,m.m.wa.hasFocus="hasfocus",m.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(_,w){m.a.fc(_,w())}},function(){function _(w,D,I){m.c[w]={init:function(N,k,z,V,j){var U,q,Y={},te,K,Z;if(D){V=z.get("as");var ee=z.get("noChildContext");Z=!(V&&ee),Y={as:V,noChildContext:ee,exportDependencies:Z}}return K=(te=z.get("completeOn")=="render")||z.has(m.i.pa),m.o(function(){var me=m.a.f(k()),Te=!I!=!me,ue=!q,ye;(Z||Te!==U)&&(K&&(j=m.i.Cb(N,j)),Te&&((!D||Z)&&(Y.dataDependency=m.S.o()),ye=D?j.createChildContext(typeof me=="function"?me:k,Y):m.S.qa()?j.extend(null,Y):j),ue&&m.S.qa()&&(q=m.a.Ca(m.h.childNodes(N),!0)),Te?(ue||m.h.va(N,m.a.Ca(q)),m.Oa(ye,N)):(m.h.Ea(N),te||m.i.ma(N,m.i.H)),U=Te)},null,{l:N}),{controlsDescendantBindings:!0}}},m.m.Ra[w]=!1,m.h.ea[w]=!0}_("if"),_("ifnot",!1,!0),_("with",!0)}(),m.c.let={init:function(_,w,D,I,N){return w=N.extend(w),m.Oa(w,_),{controlsDescendantBindings:!0}}},m.h.ea.let=!0;var F={};m.c.options={init:function(_){if(m.a.R(_)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<_.length;)_.remove(0);return{controlsDescendantBindings:!0}},update:function(_,w,D){function I(){return m.a.jb(_.options,function(ee){return ee.selected})}function N(ee,me,Te){var ue=typeof me;return ue=="function"?me(ee):ue=="string"?ee[me]:Te}function k(ee,me){if(K&&U)m.i.ma(_,m.i.H);else if(te.length){var Te=0<=m.a.A(te,m.w.M(me[0]));m.a.Zc(me[0],Te),K&&!Te&&m.u.G(m.a.Fb,null,[_,"change"])}}var z=_.multiple,V=_.length!=0&&z?_.scrollTop:null,j=m.a.f(w()),U=D.get("valueAllowUnset")&&D.has("value"),q=D.get("optionsIncludeDestroyed");w={};var Y,te=[];U||(z?te=m.a.Mb(I(),m.w.M):0<=_.selectedIndex&&te.push(m.w.M(_.options[_.selectedIndex]))),j&&(typeof j.length>"u"&&(j=[j]),Y=m.a.jb(j,function(ee){return q||ee===e||ee===null||!m.a.f(ee._destroy)}),D.has("optionsCaption")&&(j=m.a.f(D.get("optionsCaption")),j!==null&&j!==e&&Y.unshift(F)));var K=!1;if(w.beforeRemove=function(ee){_.removeChild(ee)},j=k,D.has("optionsAfterRender")&&typeof D.get("optionsAfterRender")=="function"&&(j=function(ee,me){k(0,me),m.u.G(D.get("optionsAfterRender"),null,[me[0],ee!==F?ee:e])}),m.a.ec(_,Y,function(ee,me,Te){return Te.length&&(te=!U&&Te[0].selected?[m.w.M(Te[0])]:[],K=!0),me=_.ownerDocument.createElement("option"),ee===F?(m.a.Bb(me,D.get("optionsCaption")),m.w.cb(me,e)):(Te=N(ee,D.get("optionsValue"),ee),m.w.cb(me,m.a.f(Te)),ee=N(ee,D.get("optionsText"),Te),m.a.Bb(me,ee)),[me]},w,j),!U){var Z;z?Z=te.length&&I().length<te.length:Z=te.length&&0<=_.selectedIndex?m.w.M(_.options[_.selectedIndex])!==te[0]:te.length||0<=_.selectedIndex,Z&&m.u.G(m.a.Fb,null,[_,"change"])}(U||m.S.Ya())&&m.i.ma(_,m.i.H),m.a.wd(_),V&&20<Math.abs(V-_.scrollTop)&&(_.scrollTop=V)}},m.c.options.$b=m.a.g.Z(),m.c.selectedOptions={init:function(_,w,D){function I(){var z=w(),V=[];m.a.D(_.getElementsByTagName("option"),function(j){j.selected&&V.push(m.w.M(j))}),m.m.eb(z,D,"selectedOptions",V)}function N(){var z=m.a.f(w()),V=_.scrollTop;z&&typeof z.length=="number"&&m.a.D(_.getElementsByTagName("option"),function(j){var U=0<=m.a.A(z,m.w.M(j));j.selected!=U&&m.a.Zc(j,U)}),_.scrollTop=V}if(m.a.R(_)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var k;m.i.subscribe(_,m.i.H,function(){k?I():(m.a.B(_,"change",I),k=m.o(N,null,{l:_}))},null,{notifyImmediately:!0})},update:function(){}},m.m.wa.selectedOptions=!0,m.c.style={update:function(_,w){var D=m.a.f(w()||{});m.a.P(D,function(I,N){if(N=m.a.f(N),(N===null||N===e||N===!1)&&(N=""),o)o(_).css(I,N);else if(/^--/.test(I))_.style.setProperty(I,N);else{I=I.replace(/-(\w)/g,function(z,V){return V.toUpperCase()});var k=_.style[I];_.style[I]=N,N===k||_.style[I]!=k||isNaN(N)||(_.style[I]=N+"px")}})}},m.c.submit={init:function(_,w,D,I,N){if(typeof w()!="function")throw Error("The value for a submit binding must be a function");m.a.B(_,"submit",function(k){var z,V=w();try{z=V.call(N.$data,_)}finally{z!==!0&&(k.preventDefault?k.preventDefault():k.returnValue=!1)}})}},m.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(_,w){m.a.Bb(_,w())}},m.h.ea.text=!0,function(){if(t&&t.navigator){var _=function(Y){if(Y)return parseFloat(Y[1])},w=t.navigator.userAgent,D,I,N,k,z;(D=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(z=_(w.match(/Edge\/([^ ]+)$/)))||_(w.match(/Chrome\/([^ ]+)/))||(I=_(w.match(/Version\/([^ ]+) Safari/)))||(N=_(w.match(/Firefox\/([^ ]+)/)))||(k=m.a.W||_(w.match(/MSIE ([^ ]+)/)))||(k=_(w.match(/rv:([^ )]+)/)))}if(8<=k&&10>k)var V=m.a.g.Z(),j=m.a.g.Z(),U=function(Y){var te=this.activeElement;(te=te&&m.a.g.get(te,j))&&te(Y)},q=function(Y,te){var K=Y.ownerDocument;m.a.g.get(K,V)||(m.a.g.set(K,V,!0),m.a.B(K,"selectionchange",U)),m.a.g.set(Y,j,te)};m.c.textInput={init:function(Y,te,K){function Z(ze,qe){m.a.B(Y,ze,qe)}function ee(){var ze=m.a.f(te());(ze===null||ze===e)&&(ze=""),Ae!==e&&ze===Ae?m.a.setTimeout(ee,4):Y.value!==ze&&(Ee=!0,Y.value=ze,Ee=!1,ue=Y.value)}function me(){ye||(Ae=Y.value,ye=m.a.setTimeout(Te,4))}function Te(){clearTimeout(ye),Ae=ye=e;var ze=Y.value;ue!==ze&&(ue=ze,m.m.eb(te(),K,"textInput",ze))}var ue=Y.value,ye,Ae,Pe=m.a.W==9?me:Te,Ee=!1;k&&Z("keypress",Te),11>k&&Z("propertychange",function(ze){Ee||ze.propertyName!=="value"||Pe(ze)}),k==8&&(Z("keyup",Te),Z("keydown",Te)),q&&(q(Y,Pe),Z("dragend",me)),(!k||9<=k)&&Z("input",Pe),5>I&&m.a.R(Y)==="textarea"?(Z("keydown",me),Z("paste",me),Z("cut",me)):11>D?Z("keydown",me):4>N?(Z("DOMAutoComplete",Te),Z("dragdrop",Te),Z("drop",Te)):z&&Y.type==="number"&&Z("keydown",me),Z("change",Te),Z("blur",Te),m.o(ee,null,{l:Y})}},m.m.wa.textInput=!0,m.c.textinput={preprocess:function(Y,te,K){K("textInput",Y)}}}(),m.c.uniqueName={init:function(_,w){if(w()){var D="ko_unique_"+ ++m.c.uniqueName.rd;m.a.Yc(_,D)}}},m.c.uniqueName.rd=0,m.c.using={init:function(_,w,D,I,N){var k;return D.has("as")&&(k={as:D.get("as"),noChildContext:D.get("noChildContext")}),w=N.createChildContext(w,k),m.Oa(w,_),{controlsDescendantBindings:!0}}},m.h.ea.using=!0,m.c.value={init:function(_,w,D){var I=m.a.R(_),N=I=="input";if(!N||_.type!="checkbox"&&_.type!="radio"){var k=[],z=D.get("valueUpdate"),V=!1,j=null;z&&(typeof z=="string"?k=[z]:k=m.a.wc(z),m.a.Pa(k,"change"));var U=function(){j=null,V=!1;var te=w(),K=m.w.M(_);m.m.eb(te,D,"value",K)};!m.a.W||!N||_.type!="text"||_.autocomplete=="off"||_.form&&_.form.autocomplete=="off"||m.a.A(k,"propertychange")!=-1||(m.a.B(_,"propertychange",function(){V=!0}),m.a.B(_,"focus",function(){V=!1}),m.a.B(_,"blur",function(){V&&U()})),m.a.D(k,function(te){var K=U;m.a.Ud(te,"after")&&(K=function(){j=m.w.M(_),m.a.setTimeout(U,0)},te=te.substring(5)),m.a.B(_,te,K)});var q;if(q=N&&_.type=="file"?function(){var te=m.a.f(w());te===null||te===e||te===""?_.value="":m.u.G(U)}:function(){var te=m.a.f(w()),K=m.w.M(_);j!==null&&te===j?m.a.setTimeout(q,0):(te!==K||K===e)&&(I==="select"?(K=D.get("valueAllowUnset"),m.w.cb(_,te,K),K||te===m.w.M(_)||m.u.G(U)):m.w.cb(_,te))},I==="select"){var Y;m.i.subscribe(_,m.i.H,function(){Y?D.get("valueAllowUnset")?q():U():(m.a.B(_,"change",U),Y=m.o(q,null,{l:_}))},null,{notifyImmediately:!0})}else m.a.B(_,"change",U),m.o(q,null,{l:_})}else m.ib(_,{checkedValue:w})},update:function(){}},m.m.wa.value=!0,m.c.visible={update:function(_,w){var D=m.a.f(w()),I=_.style.display!="none";D&&!I?_.style.display="":!D&&I&&(_.style.display="none")}},m.c.hidden={update:function(_,w){m.c.visible.update(_,function(){return!m.a.f(w())})}},function(_){m.c[_]={init:function(w,D,I,N,k){return m.c.event.init.call(this,w,function(){var z={};return z[_]=D(),z},I,N,k)}}}("click"),m.ca=function(){},m.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},m.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},m.ca.prototype.makeTemplateSource=function(_,w){if(typeof _=="string"){w=w||n;var D=w.getElementById(_);if(!D)throw Error("Cannot find template with ID "+_);return new m.C.F(D)}if(_.nodeType==1||_.nodeType==8)return new m.C.ia(_);throw Error("Unknown template type: "+_)},m.ca.prototype.renderTemplate=function(_,w,D,I){return _=this.makeTemplateSource(_,I),this.renderTemplateSource(_,w,D,I)},m.ca.prototype.isTemplateRewritten=function(_,w){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(_,w).data("isRewritten")},m.ca.prototype.rewriteTemplate=function(_,w,D){_=this.makeTemplateSource(_,D),w=w(_.text()),_.text(w),_.data("isRewritten",!0)},m.b("templateEngine",m.ca),m.kc=function(){function _(I,N,k,z){I=m.m.ac(I);for(var V=m.m.Ra,j=0;j<I.length;j++){var U=I[j].key;if(Object.prototype.hasOwnProperty.call(V,U)){var q=V[U];if(typeof q=="function"){if(U=q(I[j].value))throw Error(U)}else if(!q)throw Error("This template engine does not support the '"+U+"' binding within its templates")}}return k="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+m.m.vb(I,{valueAccessors:!0})+" } })()},'"+k.toLowerCase()+"')",z.createJavaScriptEvaluatorBlock(k)+N}var w=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,D=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(I,N,k){N.isTemplateRewritten(I,k)||N.rewriteTemplate(I,function(z){return m.kc.Ld(z,N)},k)},Ld:function(I,N){return I.replace(w,function(k,z,V,j,U){return _(U,z,V,N)}).replace(D,function(k,z){return _(z,"<!-- ko -->","#comment",N)})},md:function(I,N){return m.aa.Xb(function(k,z){var V=k.nextSibling;V&&V.nodeName.toLowerCase()===N&&m.ib(V,I,z)})}}}(),m.b("__tr_ambtns",m.kc.md),function(){m.C={},m.C.F=function(D){if(this.F=D){var I=m.a.R(D);this.ab=I==="script"?1:I==="textarea"?2:I=="template"&&D.content&&D.content.nodeType===11?3:4}},m.C.F.prototype.text=function(){var D=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[D];var I=arguments[0];D==="innerHTML"?m.a.fc(this.F,I):this.F[D]=I};var _=m.a.g.Z()+"_";m.C.F.prototype.data=function(D){if(arguments.length===1)return m.a.g.get(this.F,_+D);m.a.g.set(this.F,_+D,arguments[1])};var w=m.a.g.Z();m.C.F.prototype.nodes=function(){var D=this.F;if(arguments.length==0){var I=m.a.g.get(D,w)||{},N=I.lb||(this.ab===3?D.content:this.ab===4?D:e);if(!N||I.jd){var k=this.text();k&&k!==I.bb&&(N=m.a.Md(k,D.ownerDocument),m.a.g.set(D,w,{lb:N,bb:k,jd:!0}))}return N}I=arguments[0],this.ab!==e&&this.text(""),m.a.g.set(D,w,{lb:I})},m.C.ia=function(D){this.F=D},m.C.ia.prototype=new m.C.F,m.C.ia.prototype.constructor=m.C.ia,m.C.ia.prototype.text=function(){if(arguments.length==0){var D=m.a.g.get(this.F,w)||{};return D.bb===e&&D.lb&&(D.bb=D.lb.innerHTML),D.bb}m.a.g.set(this.F,w,{bb:arguments[0]})},m.b("templateSources",m.C),m.b("templateSources.domElement",m.C.F),m.b("templateSources.anonymousTemplate",m.C.ia)}(),function(){function _(j,U,q){var Y;for(U=m.h.nextSibling(U);j&&(Y=j)!==U;)j=m.h.nextSibling(Y),q(Y,j)}function w(j,U){if(j.length){var q=j[0],Y=j[j.length-1],te=q.parentNode,K=m.ga.instance,Z=K.preprocessNode;if(Z){if(_(q,Y,function(ee,me){var Te=ee.previousSibling,ue=Z.call(K,ee);ue&&(ee===q&&(q=ue[0]||me),ee===Y&&(Y=ue[ue.length-1]||Te))}),j.length=0,!q)return;q===Y?j.push(q):(j.push(q,Y),m.a.Ua(j,te))}_(q,Y,function(ee){ee.nodeType!==1&&ee.nodeType!==8||m.vc(U,ee)}),_(q,Y,function(ee){ee.nodeType!==1&&ee.nodeType!==8||m.aa.cd(ee,[U])}),m.a.Ua(j,te)}}function D(j){return j.nodeType?j:0<j.length?j[0]:null}function I(j,U,q,Y,te){te=te||{};var K=(j&&D(j)||q||{}).ownerDocument,Z=te.templateEngine||k;if(m.kc.xd(q,Z,K),q=Z.renderTemplate(q,Y,te,K),typeof q.length!="number"||0<q.length&&typeof q[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(K=!1,U){case"replaceChildren":m.h.va(j,q),K=!0;break;case"replaceNode":m.a.Xc(j,q),K=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+U)}return K&&(w(q,Y),te.afterRender&&m.u.G(te.afterRender,null,[q,Y[te.as||"$data"]]),U=="replaceChildren"&&m.i.ma(j,m.i.H)),q}function N(j,U,q){return m.O(j)?j():typeof j=="function"?j(U,q):j}var k;m.gc=function(j){if(j!=e&&!(j instanceof m.ca))throw Error("templateEngine must inherit from ko.templateEngine");k=j},m.dc=function(j,U,q,Y,te){if(q=q||{},(q.templateEngine||k)==e)throw Error("Set a template engine before calling renderTemplate");if(te=te||"replaceChildren",Y){var K=D(Y);return m.$(function(){var ee=U&&U instanceof m.fa?U:new m.fa(U,null,null,null,{exportDependencies:!0}),Z=N(j,ee.$data,ee),ee=I(Y,te,Z,ee,q);te=="replaceNode"&&(Y=ee,K=D(Y))},null,{Sa:function(){return!K||!m.a.Sb(K)},l:K&&te=="replaceNode"?K.parentNode:K})}return m.aa.Xb(function(Z){m.dc(j,U,q,Z,"replaceNode")})},m.Qd=function(j,U,q,Y,te){function K(Ae,Pe){m.u.G(m.a.ec,null,[Y,Ae,ee,q,Z,Pe]),m.i.ma(Y,m.i.H)}function Z(Ae,Pe){w(Pe,me),q.afterRender&&q.afterRender(Pe,Ae),me=null}function ee(Ae,Pe){me=te.createChildContext(Ae,{as:Te,noChildContext:q.noChildContext,extend:function(ze){ze.$index=Pe,Te&&(ze[Te+"Index"]=Pe)}});var Ee=N(j,Ae,me);return I(Y,"ignoreTargetNode",Ee,me,q)}var me,Te=q.as,ue=q.includeDestroyed===!1||m.options.foreachHidesDestroyed&&!q.includeDestroyed;if(ue||q.beforeRemove||!m.Pc(U))return m.$(function(){var Ae=m.a.f(U)||[];typeof Ae.length>"u"&&(Ae=[Ae]),ue&&(Ae=m.a.jb(Ae,function(Pe){return Pe===e||Pe===null||!m.a.f(Pe._destroy)})),K(Ae)},null,{l:Y});K(U.v());var ye=U.subscribe(function(Ae){K(U(),Ae)},null,"arrayChange");return ye.l(Y),ye};var z=m.a.g.Z(),V=m.a.g.Z();m.c.template={init:function(j,U){var q=m.a.f(U());if(typeof q=="string"||"name"in q)m.h.Ea(j);else if("nodes"in q){if(q=q.nodes||[],m.O(q))throw Error('The "nodes" option must be a plain, non-observable array.');var Y=q[0]&&q[0].parentNode;Y&&m.a.g.get(Y,V)||(Y=m.a.Yb(q),m.a.g.set(Y,V,!0)),new m.C.ia(j).nodes(Y)}else if(q=m.h.childNodes(j),0<q.length)Y=m.a.Yb(q),new m.C.ia(j).nodes(Y);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(j,U,q,Y,te){var K=U();U=m.a.f(K),q=!0,Y=null,typeof U=="string"?U={}:(K="name"in U?U.name:j,"if"in U&&(q=m.a.f(U.if)),q&&"ifnot"in U&&(q=!m.a.f(U.ifnot)),q&&!K&&(q=!1)),"foreach"in U?Y=m.Qd(K,q&&U.foreach||[],U,j,te):q?(q=te,"data"in U&&(q=te.createChildContext(U.data,{as:U.as,noChildContext:U.noChildContext,exportDependencies:!0})),Y=m.dc(K,q,U,j)):m.h.Ea(j),te=Y,(U=m.a.g.get(j,z))&&typeof U.s=="function"&&U.s(),m.a.g.set(j,z,!te||te.ja&&!te.ja()?e:te)}},m.m.Ra.template=function(j){return j=m.m.ac(j),j.length==1&&j[0].unknown||m.m.Id(j,"name")?null:"This template engine does not support anonymous templates nested within its templates"},m.h.ea.template=!0}(),m.b("setTemplateEngine",m.gc),m.b("renderTemplate",m.dc),m.a.Kc=function(_,w,D){if(_.length&&w.length){var I,N,k,z,V;for(I=N=0;(!D||I<D)&&(z=_[N]);++N){for(k=0;V=w[k];++k)if(z.value===V.value){z.moved=V.index,V.moved=z.index,w.splice(k,1),I=k=0;break}I+=k}}},m.a.Pb=function(){function _(w,D,I,N,k){var z=Math.min,V=Math.max,j=[],U,q=w.length,Y,te=D.length,K=te-q||1,Z=q+te+1,ee,me,Te;for(U=0;U<=q;U++)for(me=ee,j.push(ee=[]),Te=z(te,U+K),Y=V(0,U-1);Y<=Te;Y++)ee[Y]=Y?U?w[U-1]===D[Y-1]?me[Y-1]:z(me[Y]||Z,ee[Y-1]||Z)+1:Y+1:U+1;for(z=[],V=[],K=[],U=q,Y=te;U||Y;)te=j[U][Y]-1,Y&&te===j[U][Y-1]?V.push(z[z.length]={status:I,value:D[--Y],index:Y}):U&&te===j[U-1][Y]?K.push(z[z.length]={status:N,value:w[--U],index:U}):(--Y,--U,k.sparse||z.push({status:"retained",value:D[Y]}));return m.a.Kc(K,V,!k.dontLimitMoves&&10*q),z.reverse()}return function(w,D,I){return I=typeof I=="boolean"?{dontLimitMoves:I}:I||{},w=w||[],D=D||[],w.length<D.length?_(w,D,"added","deleted",I):_(D,w,"deleted","added",I)}}(),m.b("utils.compareArrays",m.a.Pb),function(){function _(I,N,k,z,V){var j=[],U=m.$(function(){var q=N(k,V,m.a.Ua(j,I))||[];0<j.length&&(m.a.Xc(j,q),z&&m.u.G(z,null,[k,q,V])),j.length=0,m.a.Nb(j,q)},null,{l:I,Sa:function(){return!m.a.kd(j)}});return{Y:j,$:U.ja()?U:e}}var w=m.a.g.Z(),D=m.a.g.Z();m.a.ec=function(I,N,k,z,V,j){function U(Ct){Ee={Aa:Ct,pb:m.ta(me++)},Z.push(Ee),K||Pe.push(Ee)}function q(Ct){Ee=te[Ct],me!==Ee.pb.v()&&Ae.push(Ee),Ee.pb(me++),m.a.Ua(Ee.Y,I),Z.push(Ee)}function Y(Ct,Ei){if(Ct)for(var an=0,_e=Ei.length;an<_e;an++)m.a.D(Ei[an].Y,function(Ce){Ct(Ce,an,Ei[an].Aa)})}N=N||[],typeof N.length>"u"&&(N=[N]),z=z||{};var te=m.a.g.get(I,w),K=!te,Z=[],ee=0,me=0,Te=[],ue=[],ye=[],Ae=[],Pe=[],Ee,ze=0;if(K)m.a.D(N,U);else{if(!j||te&&te._countWaitingForRemove){var qe=m.a.Mb(te,function(Ct){return Ct.Aa});j=m.a.Pb(qe,N,{dontLimitMoves:z.dontLimitMoves,sparse:!0})}for(var qe=0,it,Dt,jt;it=j[qe];qe++)switch(Dt=it.moved,jt=it.index,it.status){case"deleted":for(;ee<jt;)q(ee++);Dt===e&&(Ee=te[ee],Ee.$&&(Ee.$.s(),Ee.$=e),m.a.Ua(Ee.Y,I).length&&(z.beforeRemove&&(Z.push(Ee),ze++,Ee.Aa===D?Ee=null:ye.push(Ee)),Ee&&Te.push.apply(Te,Ee.Y))),ee++;break;case"added":for(;me<jt;)q(ee++);Dt!==e?(ue.push(Z.length),q(Dt)):U(it.value)}for(;me<N.length;)q(ee++);Z._countWaitingForRemove=ze}m.a.g.set(I,w,Z),Y(z.beforeMove,Ae),m.a.D(Te,z.beforeRemove?m.oa:m.removeNode);var $e,un,zt;try{zt=I.ownerDocument.activeElement}catch{}if(ue.length)for(;(qe=ue.shift())!=e;){for(Ee=Z[qe],$e=e;qe;)if((un=Z[--qe].Y)&&un.length){$e=un[un.length-1];break}for(N=0;ee=Ee.Y[N];$e=ee,N++)m.h.Wb(I,ee,$e)}for(qe=0;Ee=Z[qe];qe++){for(Ee.Y||m.a.extend(Ee,_(I,k,Ee.Aa,V,Ee.pb)),N=0;ee=Ee.Y[N];$e=ee,N++)m.h.Wb(I,ee,$e);!Ee.Ed&&V&&(V(Ee.Aa,Ee.Y,Ee.pb),Ee.Ed=!0,$e=Ee.Y[Ee.Y.length-1])}for(zt&&I.ownerDocument.activeElement!=zt&&zt.focus(),Y(z.beforeRemove,ye),qe=0;qe<ye.length;++qe)ye[qe].Aa=D;Y(z.afterMove,Ae),Y(z.afterAdd,Pe)}}(),m.b("utils.setDomNodeChildrenFromArrayMapping",m.a.ec),m.ba=function(){this.allowTemplateRewriting=!1},m.ba.prototype=new m.ca,m.ba.prototype.constructor=m.ba,m.ba.prototype.renderTemplateSource=function(_,w,D,I){return(w=!(9>m.a.W)&&_.nodes?_.nodes():null)?m.a.la(w.cloneNode(!0).childNodes):(_=_.text(),m.a.ua(_,I))},m.ba.Ma=new m.ba,m.gc(m.ba.Ma),m.b("nativeTemplateEngine",m.ba),function(){m.$a=function(){var w=this.Hd=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(D,I,N,k){if(k=k||n,N=N||{},2>w)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var z=D.data("precompiled");return z||(z=D.text()||"",z=o.template(null,"{{ko_with $item.koBindingContext}}"+z+"{{/ko_with}}"),D.data("precompiled",z)),D=[I.$data],I=o.extend({koBindingContext:I},N.templateOptions),I=o.tmpl(z,D,I),I.appendTo(k.createElement("div")),o.fragments={},I},this.createJavaScriptEvaluatorBlock=function(D){return"{{ko_code ((function() { return "+D+" })()) }}"},this.addTemplate=function(D,I){n.write("<script type='text/html' id='"+D+"'>"+I+"</script>")},0<w&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},m.$a.prototype=new m.ca,m.$a.prototype.constructor=m.$a;var _=new m.$a;0<_.Hd&&m.gc(_),m.b("jqueryTmplTemplateEngine",m.$a)}()})})()})()})();var Owt=ko;typeof window<"u"?(ko=window.ko,typeof vk<"u"?window.ko=vk:delete window.ko):(ko=global.ko,typeof vk<"u"?global.ko=vk:delete global.ko);var GA=Owt;/**
 * @license
 * Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
 * Copyright (c) Steve Sanderson
 * MIT license
 */var FQ="__knockoutObservables",BQ="__knockoutSubscribable";function BEe(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=kEe(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===FQ||o===BQ)&&!(o in i)){var r=e[o],s=r instanceof Array,a=n.isObservable(r)?r:s?n.observableArray(r):n.observable(r);Object.defineProperty(e,o,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[o]=a,s&&Mwt(n,a)}}),e}function kEe(e,t){var n=e[FQ];return!n&&t&&(n={},Object.defineProperty(e,FQ,{value:n})),n}function Rwt(e,t,n){var i=this,o={owner:e,deferEvaluation:!0};if(typeof n=="function")o.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if(typeof n.get!="function")throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=n.get,o.write=n.set}return e[t]=i.computed(o),BEe.call(i,e,[t]),e}function Mwt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=Lwt(e,t,i))})}function Lwt(e,t,n){var i=Nwt(e,n);return i.subscribe(t)}function Nwt(e,t){var n=t[BQ];if(!n){n=new e.subscribable,Object.defineProperty(t,BQ,{value:n});var i={};Fwt(t,n,i),Bwt(e,t,n,i)}return n}function Fwt(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(i){var o=e[i];e[i]=function(){var r=o.apply(this,arguments);return n.pause!==!0&&t.notifySubscribers(this),r}})}function Bwt(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})})}function UEe(e,t){if(!e)return null;var n=kEe(e,!1);return n&&n[t]||null}function kwt(e,t){var n=UEe(e,t);n&&n.valueHasMutated()}function Uwt(e){e.track=BEe,e.getObservable=UEe,e.valueHasMutated=kwt,e.defineProperty=Rwt}var Dk={attachToKo:Uwt};var VEe="http://www.w3.org/2000/svg",zEe="cesium-svgPath-svg",Vwt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){let i=document.createElementNS(VEe,"svg:svg");i.setAttribute("class",zEe);let o=document.createElementNS(VEe,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){let r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));let s=e.unwrap(r.width),a=e.unwrap(r.height);i.setAttribute("width",s),i.setAttribute("height",a),i.setAttribute("viewBox",`0 0 ${s} ${a}`),r.css&&i.setAttribute("class",`${zEe} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},Pk=Vwt;Dk.attachToKo(GA);Pk.register(GA);var xe=GA;function Ik(e){c(e)||(e=new Ah),this._clock=e,this._eventHelper=new gr,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=xe.observable(Q.now()),this.systemTime.equalityComparer=Q.equals,this.startTime=xe.observable(e.startTime),this.startTime.equalityComparer=Q.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=xe.observable(e.stopTime),this.stopTime.equalityComparer=Q.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=xe.observable(e.currentTime),this.currentTime.equalityComparer=Q.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=xe.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=xe.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=xe.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=xe.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=xe.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),xe.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(Ik.prototype,{clock:{get:function(){return this._clock}}});Ik.prototype.synchronize=function(){let e=this._clock;this.systemTime=Q.now(),this.startTime=e.startTime,this.stopTime=e.stopTime,this.currentTime=e.currentTime,this.multiplier=e.multiplier,this.clockStep=e.clockStep,this.clockRange=e.clockRange,this.canAnimate=e.canAnimate,this.shouldAnimate=e.shouldAnimate};Ik.prototype.isDestroyed=function(){return!1};Ik.prototype.destroy=function(){this._eventHelper.removeAll(),de(this)};var Ok=Ik;function zwt(){this.canExecute=void 0,this.beforeExecute=void 0,this.afterExecute=void 0,E.throwInstantiationError()}var kQ=zwt;function Hwt(e,t){if(!c(e))throw new E("func is required.");t=t??!0;let n=new pe,i=new pe;function o(){if(!o.canExecute)throw new E("Cannot execute command, canExecute is false.");let r={args:arguments,cancel:!1},s;return n.raiseEvent(r),r.cancel||(s=e.apply(null,arguments),i.raiseEvent(s)),s}return o.canExecute=t,xe.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}var Sn=Hwt;var rv={};rv.createCheckbox=function(e,t,n){T.typeOf.string("labelText",e),T.typeOf.string("checkedBinding",t);let i=document.createElement("div"),o=document.createElement("label"),r=document.createElement("input");r.type="checkbox";let s=`checked: ${t}`;return c(n)&&(s+=`, enable: ${n}`),r.setAttribute("data-bind",s),o.appendChild(r),o.appendChild(document.createTextNode(e)),i.appendChild(o),i};rv.createSection=function(e,t,n,i){T.defined("panel",e),T.typeOf.string("headerText",t),T.typeOf.string("sectionVisibleBinding",n),T.typeOf.string("toggleSectionVisibilityBinding",i);let o=document.createElement("div");o.className="cesium-cesiumInspector-section",o.setAttribute("data-bind",`css: { "cesium-cesiumInspector-section-collapsed": !${n} }`),e.appendChild(o);let r=document.createElement("h3");r.className="cesium-cesiumInspector-sectionHeader",r.appendChild(document.createTextNode(t)),r.setAttribute("data-bind",`click: ${i}`),o.appendChild(r);let s=document.createElement("div");return s.className="cesium-cesiumInspector-sectionContent",o.appendChild(s),s};rv.createRangeInput=function(e,t,n,i,o,r){T.typeOf.string("rangeText",e),T.typeOf.string("sliderValueBinding",t),T.typeOf.number("min",n),T.typeOf.number("max",i),r=r??t;let s=document.createElement("input");s.setAttribute("data-bind",`value: ${r}`),s.type="number";let a=document.createElement("input");a.type="range",a.min=n,a.max=i,a.step=o??"any",a.setAttribute("data-bind",`valueUpdate: "input", value: ${t}`);let l=document.createElement("div");l.appendChild(a);let u=document.createElement("div");return u.className="cesium-cesiumInspector-slider",u.appendChild(document.createTextNode(e)),u.appendChild(s),u.appendChild(l),u};rv.createRangeInputWithDynamicMinMax=function(e,t,n,i){T.typeOf.string("rangeText",e),T.typeOf.string("sliderValueBinding",t),i=i??t;let o=document.createElement("input");o.setAttribute("data-bind",`value: ${i}`),o.type="number";let r=document.createElement("input");r.type="range",r.step=n??"any",r.setAttribute("data-bind",`valueUpdate: "input", value: ${t}, attr: { min: ${t}Min, max: ${t}Max }`);let s=document.createElement("div");s.appendChild(r);let a=document.createElement("div");return a.className="cesium-cesiumInspector-slider",a.appendChild(document.createTextNode(e)),a.appendChild(o),a.appendChild(s),a};rv.createButton=function(e,t,n){T.typeOf.string("buttonText",e),T.typeOf.string("clickedBinding",t);let i=document.createElement("button");i.type="button",i.textContent=e,i.className="cesium-cesiumInspector-pickButton";let o=`click: ${t}`;return c(n)&&(o+=`, css: {"cesium-cesiumInspector-pickButtonHighlight" : ${n}}`),i.setAttribute("data-bind",o),i};var fu=rv;function Gwt(e,t,n,i,o){return n.call(i,e[t]),xe.getObservable(e,t).subscribe(n,i,o)}var Da=Gwt;function HEe(e,t){if(!c(e))throw new E("command is required.");this._command=e,t=t??W.EMPTY_OBJECT,this.toggled=t.toggled??!1,this.tooltip=t.tooltip??"",xe.track(this,["toggled","tooltip"])}Object.defineProperties(HEe.prototype,{command:{get:function(){return this._command}}});var Z0=HEe;var jA="http://www.w3.org/2000/svg",WEe="http://www.w3.org/1999/xlink",n5,Rk=G.fromCssColorString("rgba(247,250,255,0.384)"),i5=G.fromCssColorString("rgba(143,191,255,0.216)"),UQ=G.fromCssColorString("rgba(153,197,255,0.098)"),o5=G.fromCssColorString("rgba(255,255,255,0.086)"),jwt=G.fromCssColorString("rgba(255,255,255,0.267)"),Wwt=G.fromCssColorString("rgba(255,255,255,0)"),GEe=G.fromCssColorString("rgba(66,67,68,0.3)"),jEe=G.fromCssColorString("rgba(0,0,0,0.5)");function Q0(e){return G.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}var Mk={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"},animation_pathPointer:{tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},animation_pathSwooshFX:{tagName:"path",d:"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"}};function em(e){let t=document.createElementNS(jA,e.tagName);for(let n in e)if(e.hasOwnProperty(n)&&n!=="tagName")if(n==="children"){let i=e.children.length;for(let o=0;o<i;++o)t.appendChild(em(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(WEe,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function VQ(e,t,n){let i=document.createElementNS(jA,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");let o=document.createElementNS(jA,"tspan");return o.textContent=n,i.appendChild(o),i}function qwt(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}var r5=new G;function fs(e,t){let n=t.alpha,i=1-n;return r5.red=e.red*i+t.red*n,r5.green=e.green*i+t.green*n,r5.blue=e.blue*i+t.blue*n,r5.toCssColorString()}function zQ(e,t,n){let i=Mk[n],o={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{tagName:"rect",class:"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect",class:"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return em(o)}function Ywt(e,t,n){let i=Mk[n],o=Mk.animation_pathWingButton,r={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return em(r)}function Xwt(e,t){let n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&n5!==e))if(t.type==="mousedown"||i&&t.type==="mousemove"||t.type==="touchstart"&&t.touches.length===1||i&&t.type==="touchmove"&&t.touches.length===1){let o=e._centerX,r=e._centerY,a=e._svgNode.getBoundingClientRect(),l,u;if(t.type==="touchstart"||t.type==="touchmove"?(l=t.touches[0].clientX,u=t.touches[0].clientY):(l=t.clientX,u=t.clientY),!i&&(l>a.right||l<a.left||u<a.top||u>a.bottom))return;let f=e._shuttleRingPointer.getBoundingClientRect(),h=l-o-a.left,p=u-r-a.top,g=Math.atan2(p,h)*180/Math.PI+90;g>180&&(g-=360);let m=n.shuttleRingAngle;i||l<f.right&&l>f.left&&u>f.top&&u<f.bottom?(n5=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<m?n.slower():g>m&&n.faster(),t.preventDefault()}else e===n5&&(n5=void 0),n.shuttleRingDragging=!1}function Ng(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;let n=this;this._clickFunction=function(){let i=n._viewModel.command;i.canExecute&&i()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[Da(t,"toggled",this.setToggled,this),Da(t,"tooltip",this.setTooltip,this),Da(t.command,"canExecute",this.setEnabled,this)]}Ng.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);let e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();de(this)};Ng.prototype.isDestroyed=function(){return!1};Ng.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e){this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");return}if(this._toggled){this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");return}this.svgElement.setAttribute("class","cesium-animation-rectButton")}};Ng.prototype.setToggled=function(e){this._toggled!==e&&(this._toggled=e,this._enabled&&(e?this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"):this.svgElement.setAttribute("class","cesium-animation-rectButton")))};Ng.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function sv(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("viewModel is required.");e=In(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;let n=e.ownerDocument,i=document.createElement("style");i.textContent=".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }",n.head.insertBefore(i,n.head.childNodes[0]);let o=document.createElement("div");o.className="cesium-animation-theme",o.innerHTML='<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>',this._theme=o,this._themeNormal=o.childNodes[0],this._themeHover=o.childNodes[1],this._themeSelect=o.childNodes[2],this._themeDisabled=o.childNodes[3],this._themeKnob=o.childNodes[4],this._themePointer=o.childNodes[5],this._themeSwoosh=o.childNodes[6],this._themeSwooshHover=o.childNodes[7];let r=document.createElementNS(jA,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",WEe);let s=document.createElementNS(jA,"g");this._topG=s,this._realtimeSVG=new Ng(Ywt(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new Ng(zQ(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new Ng(zQ(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new Ng(zQ(84,99,"animation_pathPause"),t.pauseViewModel);let a=document.createElementNS(jA,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);let l=em({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=l;let u=Mk.animation_pathSwooshFX,f=Mk.animation_pathPointer,h=em({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:u.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:u.d},{tagName:u.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:u.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=h,this._shuttleRingPointer=em({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:f.tagName,d:f.d});let p=em({tagName:"g",transform:"translate(100,100)"});this._knobOuter=em({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});let g=61,m=em({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=VQ(0,-24,""),this._knobTime=VQ(0,-7,""),this._knobStatus=VQ(0,-41,"");let y=em({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),b=document.createElementNS(jA,"g");b.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(b),s.appendChild(p),s.appendChild(a),b.appendChild(l),b.appendChild(h),b.appendChild(this._shuttleRingPointer),p.appendChild(this._knobOuter),p.appendChild(m),p.appendChild(this._knobDate),p.appendChild(this._knobTime),p.appendChild(this._knobStatus),p.appendChild(y),r.appendChild(s),e.appendChild(r);let x=this;function A(M){Xwt(x,M)}this._mouseCallback=A,l.addEventListener("mousedown",A,!0),l.addEventListener("touchstart",A,!0),h.addEventListener("mousedown",A,!0),h.addEventListener("touchstart",A,!0),n.addEventListener("mousemove",A,!0),n.addEventListener("touchmove",A,!0),n.addEventListener("mouseup",A,!0),n.addEventListener("touchend",A,!0),n.addEventListener("touchcancel",A,!0),this._shuttleRingPointer.addEventListener("mousedown",A,!0),this._shuttleRingPointer.addEventListener("touchstart",A,!0),this._knobOuter.addEventListener("mousedown",A,!0),this._knobOuter.addEventListener("touchstart",A,!0);let C=this._knobTime.childNodes[0],S=this._knobDate.childNodes[0],v=this._knobStatus.childNodes[0],P;this._subscriptions=[Da(t.pauseViewModel,"toggled",function(M){P!==M&&(P=M,P?x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),Da(t,"shuttleRingAngle",function(M){qwt(x._shuttleRingPointer,x._knobOuter,M)}),Da(t,"dateLabel",function(M){S.textContent!==M&&(S.textContent=M)}),Da(t,"timeLabel",function(M){C.textContent!==M&&(C.textContent=M)}),Da(t,"multiplierLabel",function(M){v.textContent!==M&&(v.textContent=M)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(sv.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});sv.prototype.isDestroyed=function(){return!1};sv.prototype.destroy=function(){c(this._observer)&&(this._observer.disconnect(),this._observer=void 0);let e=this._container.ownerDocument,t=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",t,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",t,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",t,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",t,!0),e.removeEventListener("mousemove",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("mouseup",t,!0),e.removeEventListener("touchend",t,!0),e.removeEventListener("touchcancel",t,!0),this._shuttleRingPointer.removeEventListener("mousedown",t,!0),this._shuttleRingPointer.removeEventListener("touchstart",t,!0),this._knobOuter.removeEventListener("mousedown",t,!0),this._knobOuter.removeEventListener("touchstart",t,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();let n=this._subscriptions;for(let i=0,o=n.length;i<o;i++)n[i].dispose();return de(this)};sv.prototype.resize=function(){let e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;let n=this._svgNode,i=200,o=132,r=e,s=t;e===0&&t===0?(r=i,s=o):e===0?(s=t,r=i*(t/o)):t===0&&(r=e,s=o*(e/i));let a=r/i,l=s/o;n.style.cssText=`width: ${r}px; height: ${s}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`,n.setAttribute("width",r),n.setAttribute("height",s),n.setAttribute("viewBox",`0 0 ${r} ${s}`),this._topG.setAttribute("transform",`scale(${a},${l})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*l),this._lastHeight=e,this._lastWidth=t};sv.prototype.applyThemeChanges=function(){let e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(c(this._observer))return;let f=this;f._observer=new MutationObserver(function(){e.body.contains(f._container)&&(f._observer.disconnect(),f._observer=void 0,f.applyThemeChanges())}),f._observer.observe(e,{childList:!0,subtree:!0});return}let t=Q0(this._themeNormal),n=Q0(this._themeHover),i=Q0(this._themeSelect),o=Q0(this._themeDisabled),r=Q0(this._themeKnob),s=Q0(this._themePointer),a=Q0(this._themeSwoosh),l=Q0(this._themeSwooshHover),u=em({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":fs(t,Rk)},{tagName:"stop",offset:"12%","stop-color":fs(t,i5)},{tagName:"stop",offset:"46%","stop-color":fs(t,UQ)},{tagName:"stop",offset:"81%","stop-color":fs(t,o5)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":fs(n,Rk)},{tagName:"stop",offset:"12%","stop-color":fs(n,i5)},{tagName:"stop",offset:"46%","stop-color":fs(n,UQ)},{tagName:"stop",offset:"81%","stop-color":fs(n,o5)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":fs(i,Rk)},{tagName:"stop",offset:"12%","stop-color":fs(i,i5)},{tagName:"stop",offset:"46%","stop-color":fs(i,UQ)},{tagName:"stop",offset:"81%","stop-color":fs(i,o5)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":fs(o,jwt)},{tagName:"stop",offset:"75%","stop-color":fs(o,Wwt)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,in:"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":a.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":l.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":fs(s,jEe)},{tagName:"stop",offset:"100%","stop-color":fs(s,jEe)}]},{id:"animation_shuttleRingPointerPaused",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":"#CCC"},{tagName:"stop",offset:"40%","stop-color":"#CCC"},{tagName:"stop",offset:"60%","stop-color":"#555"},{tagName:"stop",offset:"100%","stop-color":"#555"}]},{id:"animation_knobOuter",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":fs(r,Rk)},{tagName:"stop",offset:"60%","stop-color":fs(r,GEe)},{tagName:"stop",offset:"85%","stop-color":fs(r,i5)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":fs(r,GEe)},{tagName:"stop",offset:"60%","stop-color":fs(r,Rk)},{tagName:"stop",offset:"85%","stop-color":fs(r,o5)}]}]});c(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};var Lk=sv;var Kwt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],J0=15,av=105;function qEe(e,t){return e-t}function HQ(e,t){let n=Lo(t,e,qEe);return n<0?~n:n}function $wt(e,t){if(Math.abs(e)<=J0)return e/J0;let n=J0,i=av,o,r=0,s;return e>0?(o=Math.log(t[t.length-1]),s=(o-r)/(i-n),Math.exp(r+s*(e-n))):(o=Math.log(-t[0]),s=(o-r)/(i-n),-Math.exp(r+s*(Math.abs(e)-n)))}function Zwt(e,t,n){if(n.clockStep===mo.SYSTEM_CLOCK)return J0;if(Math.abs(e)<=1)return e*J0;let i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);let o=J0,r=av,s,a=0,l;return e>0?(s=Math.log(i),l=(s-a)/(r-o),(Math.log(e)-a)/l+o):(s=Math.log(-t[0]),l=(s-a)/(r-o),-((Math.log(Math.abs(e))-a)/l+o))}function Ed(e){if(!c(e))throw new E("clockViewModel is required.");let t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=Ed.defaultDateFormatter,this._timeFormatter=Ed.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,xe.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(Ed.defaultTicks),this.timeLabel=void 0,xe.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,xe.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,xe.defineProperty(this,"multiplierLabel",function(){let s=t._clockViewModel;if(s.clockStep===mo.SYSTEM_CLOCK)return"Today";let a=s.multiplier;return a%1===0?`${a.toFixed(0)}x`:`${a.toFixed(3).replace(/0{0,3}$/,"")}x`}),this.shuttleRingAngle=void 0,xe.defineProperty(this,"shuttleRingAngle",{get:function(){return Zwt(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,av),-av);let a=t._allShuttleRingTicks,l=t._clockViewModel;if(l.clockStep=mo.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===av){l.multiplier=s>0?a[a.length-1]:a[0];return}let u=$wt(s,a);if(t.snapToTicks)u=a[HQ(u,a)];else if(u!==0){let f=Math.abs(u);if(f>100){let h=f.toFixed(0).length-2,p=Math.pow(10,h);u=Math.round(u/p)*p|0}else f>J0?u=Math.round(u):f>1?u=+u.toFixed(1):f>0&&(u=+u.toFixed(2))}l.multiplier=u}}),this._canAnimate=void 0,xe.defineProperty(this,"_canAnimate",function(){let s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===$r.UNBOUNDED)return!0;let l=s.multiplier,u=s.currentTime,f=s.startTime,h=!1;if(a===$r.LOOP_STOP)h=Q.greaterThan(u,f)||u.equals(f)&&l>0;else{let p=s.stopTime;h=Q.greaterThan(u,f)&&Q.lessThan(u,p)||u.equals(f)&&l>0||u.equals(p)&&l<0}return h||(s.shouldAnimate=!1),h}),this._isSystemTimeAvailable=void 0,xe.defineProperty(this,"_isSystemTimeAvailable",function(){let s=t._clockViewModel;if(s.clockRange===$r.UNBOUNDED)return!0;let l=s.systemTime;return Q.greaterThanOrEquals(l,s.startTime)&&Q.lessThanOrEquals(l,s.stopTime)}),this._isAnimating=void 0,xe.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});let n=Sn(function(){let s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Z0(n,{toggled:xe.computed(function(){return!t._isAnimating}),tooltip:"Pause"});let i=Sn(function(){let s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Z0(i,{toggled:xe.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});let o=Sn(function(){let s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Z0(o,{toggled:xe.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==mo.SYSTEM_CLOCK}),tooltip:"Play Forward"});let r=Sn(function(){t._clockViewModel.clockStep=mo.SYSTEM_CLOCK},xe.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Z0(r,{toggled:xe.computed(function(){return e.clockStep===mo.SYSTEM_CLOCK}),tooltip:xe.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=Sn(function(){let s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=HQ(l,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=Sn(function(){let s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=HQ(l,a)+1;u<a.length&&(s.multiplier=a[u])})}Ed.defaultDateFormatter=function(e,t){let n=Q.toGregorianDate(e);return`${Kwt[n.month-1]} ${n.day} ${n.year}`};Ed.defaultTicks=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800];Ed.defaultTimeFormatter=function(e,t){let n=Q.toGregorianDate(e),i=Math.round(n.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")}.${i.toString().padStart(3,"0")}`:`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")} UTC`};Ed.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};Ed.prototype.setShuttleRingTicks=function(e){if(!c(e))throw new E("positiveTicks is required.");let t,n,i,o={},r=this._sortedFilteredPositiveTicks;for(r.length=0,t=0,n=e.length;t<n;++t)i=e[t],o.hasOwnProperty(i)||(o[i]=!0,r.push(i));r.sort(qEe);let s=[];for(n=r.length,t=n-1;t>=0;--t)i=r[t],i!==0&&s.push(-i);Array.prototype.push.apply(s,r),this._allShuttleRingTicks=s};Object.defineProperties(Ed.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){if(typeof e!="function")throw new E("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if(typeof e!="function")throw new E("timeFormatter must be a function");this._timeFormatter=e}}});Ed._maxShuttleRingAngle=av;Ed._realtimeShuttleRingAngle=J0;var Nk=Ed;function YEe(e){e=e??W.EMPTY_OBJECT;let t=e.globe,n=e.imageryProviderViewModels??W.EMPTY_ARRAY,i=e.terrainProviderViewModels??W.EMPTY_ARRAY;if(!c(t))throw new E("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,xe.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);let o=xe.getObservable(this,"imageryProviderViewModels"),r=xe.pureComputed(function(){let h=o(),p={},g;for(g=0;g<h.length;g++){let b=h[g],x=b.category;c(p[x])?p[x].push(b):p[x]=[b]}let m=Object.keys(p),y=[];for(g=0;g<m.length;g++){let b=m[g];y.push({name:b,providers:p[b]})}return y});this._imageryProviders=r;let s=xe.getObservable(this,"terrainProviderViewModels"),a=xe.pureComputed(function(){let h=s(),p={},g;for(g=0;g<h.length;g++){let b=h[g],x=b.category;c(p[x])?p[x].push(b):p[x]=[b]}let m=Object.keys(p),y=[];for(g=0;g<m.length;g++){let b=m[g];y.push({name:b,providers:p[b]})}return y});this._terrainProviders=a,this.buttonTooltip=void 0,xe.defineProperty(this,"buttonTooltip",function(){let h=this.selectedImagery,p=this.selectedTerrain,g=c(h)?h.name:void 0,m=c(p)?p.name:void 0;return c(g)&&c(m)?`${g}
${m}`:c(g)?g:m}),this.buttonImageUrl=void 0,xe.defineProperty(this,"buttonImageUrl",function(){let h=this.selectedImagery;if(c(h))return h.iconUrl}),this.selectedImagery=void 0;let l=xe.observable();this._currentImageryLayers=[],xe.defineProperty(this,"selectedImagery",{get:function(){return l()},set:function(h){if(l()===h){this.dropDownVisible=!1;return}let p,g=this._currentImageryLayers,m=g.length,y=this._globe.imageryLayers,b=!1;for(p=0;p<m;p++){let x=y.length;for(let A=0;A<x;A++){let C=y.get(A);if(C===g[p]){y.remove(C),b=!0;break}}}if(c(h)){let x=h.creationCommand();if(Array.isArray(x)){let A=x.length;for(this._currentImageryLayers=[],p=A-1;p>=0;p--){let C=Xa.fromProviderAsync(x[p]);y.add(C,0),this._currentImageryLayers.push(C)}}else{this._currentImageryLayers=[];let A=Xa.fromProviderAsync(x);if(A.name=h.name,b)y.add(A,0);else{let C=y.get(0);c(C)&&y.remove(C),y.add(A,0)}this._currentImageryLayers.push(A)}}l(h),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;let u=xe.observable();xe.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(h){if(u()===h){this.dropDownVisible=!1;return}let p;if(c(h)&&(p=h.creationCommand()),c(p)&&!c(p.then))this._globe.depthTestAgainstTerrain=!(p instanceof np),this._globe.terrainProvider=p;else if(c(p)){let g=!1,m=this._globe.terrainProviderChanged.addEventListener(()=>{g=!0,m()}),b=new Ek(p).readyEvent.addEventListener(x=>{g||(this._globe.depthTestAgainstTerrain=!(x instanceof np),this._globe.terrainProvider=x,b())})}u(h),this.dropDownVisible=!1}});let f=this;this._toggleDropDown=Sn(function(){f.dropDownVisible=!f.dropDownVisible}),this.selectedImagery=e.selectedImageryProviderViewModel??n[0],this.selectedTerrain=e.selectedTerrainProviderViewModel}Object.defineProperties(YEe.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});var Fk=YEe;function s5(e,t){if(!c(e))throw new E("container is required.");e=In(e);let n=new Fk(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);let o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);let r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);let s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);let a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);let l=document.createElement("div");l.className="cesium-baseLayerPicker-category",a.appendChild(l);let u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),l.appendChild(u);let f=document.createElement("div");f.className="cesium-baseLayerPicker-choices",f.setAttribute("data-bind","foreach: providers"),l.appendChild(f);let h=document.createElement("div");h.className="cesium-baseLayerPicker-item",h.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),f.appendChild(h);let p=document.createElement("img");p.className="cesium-baseLayerPicker-itemIcon",p.setAttribute("data-bind","attr: { src: iconUrl }"),p.setAttribute("draggable","false"),h.appendChild(p);let g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),h.appendChild(g);let m=document.createElement("div");m.className="cesium-baseLayerPicker-sectionTitle",m.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),m.innerHTML="Terrain",r.appendChild(m);let y=document.createElement("div");y.className="cesium-baseLayerPicker-section",y.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(y);let b=document.createElement("div");b.className="cesium-baseLayerPicker-category",y.appendChild(b);let x=document.createElement("div");x.className="cesium-baseLayerPicker-categoryTitle",x.setAttribute("data-bind","text: name"),b.appendChild(x);let A=document.createElement("div");A.className="cesium-baseLayerPicker-choices",A.setAttribute("data-bind","foreach: providers"),b.appendChild(A);let C=document.createElement("div");C.className="cesium-baseLayerPicker-item",C.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),A.appendChild(C);let S=document.createElement("img");S.className="cesium-baseLayerPicker-itemIcon",S.setAttribute("data-bind","attr: { src: iconUrl }"),S.setAttribute("draggable","false"),C.appendChild(S);let v=document.createElement("div");v.className="cesium-baseLayerPicker-itemLabel",v.setAttribute("data-bind","text: name"),C.appendChild(v),xe.applyBindings(n,i),xe.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(P){i.contains(P.target)||r.contains(P.target)||(n.dropDownVisible=!1)},Vt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(s5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});s5.prototype.isDestroyed=function(){return!1};s5.prototype.destroy=function(){return Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),xe.cleanNode(this._element),xe.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),de(this)};var Bk=s5;function XEe(e){if(!c(e.name))throw new E("options.name is required.");if(!c(e.tooltip))throw new E("options.tooltip is required.");if(!c(e.iconUrl))throw new E("options.iconUrl is required.");if(typeof e.creationFunction!="function")throw new E("options.creationFunction is required.");let t=e.creationFunction;c(t.canExecute)||(t=Sn(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=e.category??"",xe.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(XEe.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});var ds=XEe;function Qwt(){let e=[],t=devicePixelRatio>=2;return e.push(new ds({name:"Bing Maps Aerial",iconUrl:tn("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return pg({style:mg.AERIAL})}})),e.push(new ds({name:"Bing Maps Aerial with Labels",iconUrl:tn("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return pg({style:mg.AERIAL_WITH_LABELS})}})),e.push(new ds({name:"Bing Maps Roads",iconUrl:tn("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return pg({style:mg.ROAD})}})),e.push(new ds({name:"ArcGIS World Imagery",iconUrl:tn("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png"),tooltip:`ArcGIS World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes 15m TerraColor imagery at small and mid-scales (~1:591M down to ~1:288k) for the world. The map features Maxar imagery at 0.3m resolution for select metropolitan areas around the world, 0.5m resolution across the United States and parts of Western Europe, and 1m resolution imagery across the rest of the world. In addition to commercial sources, the World Imagery map features high-resolution aerial photography contributed by the GIS User Community. This imagery ranges from 0.3m to 0.03m resolution (down to ~1:280 nin select communities). For more information on this map, including the terms of use, visit us online at 
https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9`,category:"Other",creationFunction:function(){return dg.fromBasemapType(Vh.SATELLITE,{enablePickFeatures:!1})}})),e.push(new ds({name:"ArcGIS World Hillshade",iconUrl:tn("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"),tooltip:`ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available down to ~1:9k. For more information on this map, including the terms of use, visit us online at 
https://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d`,category:"Other",creationFunction:function(){return dg.fromBasemapType(Vh.HILLSHADE,{enablePickFeatures:!1})}})),e.push(new ds({name:"Esri World Ocean",iconUrl:tn("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"),tooltip:`ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data.  The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. For more information on this map, including our terms of use, visit us online at 
https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500`,category:"Other",creationFunction:function(){return dg.fromBasemapType(Vh.OCEANS,{enablePickFeatures:!1})}})),e.push(new ds({name:"Open\xADStreet\xADMap",iconUrl:tn("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:`OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.
http://www.openstreetmap.org`,category:"Other",creationFunction:function(){return new Lg({url:"https://tile.openstreetmap.org/"})}})),e.push(new ds({name:"Stadia x Stamen Watercolor",iconUrl:tn("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and reminiscent of hand drawn maps, the watercolor maps from Stamen Design apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
https://docs.stadiamaps.com/map-styles/stamen-watercolor/`,category:"Other",creationFunction:function(){return new Lg({url:"https://tiles.stadiamaps.com/tiles/stamen_watercolor/",fileExtension:"jpg",credit:`&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>
           &copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
           &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
           &copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ds({name:"Stadia x Stamen Toner",iconUrl:tn("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and the most popular of the excellent styles from Stamen Design, these high-contrast B+W (black and white) maps are the perfect backdrop for your colorful and eye-catching overlays.
https://docs.stadiamaps.com/map-styles/stamen-toner/`,category:"Other",creationFunction:function(){return new Lg({url:"https://tiles.stadiamaps.com/tiles/stamen_toner/",retinaTiles:t,credit:`&copy; <a href="https://stamen.com/" target="_blank">Stamen Design</a>
            &copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
            &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
            &copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ds({name:"Stadia Alidade Smooth",iconUrl:tn("Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png"),tooltip:`Stadia's custom Alidade Smooth style is designed for maps that use a lot of markers or overlays. It features a muted color scheme and fewer points of interest to allow your added data to shine.
https://docs.stadiamaps.com/map-styles/alidade-smooth/`,category:"Other",creationFunction:function(){return new Lg({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth/",retinaTiles:t,credit:`&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
            &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
            &copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ds({name:"Stadia Alidade Smooth Dark",iconUrl:tn("Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png"),tooltip:`Stadia Alidade Smooth Dark, like its lighter cousin, is also designed to stay out of the way. It just flips the dark mode switch on the color scheme. With the lights out, your data can now literally shine.
https://docs.stadiamaps.com/map-styles/alidade-smooth-dark/`,category:"Other",creationFunction:function(){return new Lg({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/",retinaTiles:t,credit:`&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
            &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
            &copy; <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new ds({name:"Sentinel-2",iconUrl:tn("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return hg.fromAssetId(3954)}})),e.push(new ds({name:"Blue Marble",iconUrl:tn("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return hg.fromAssetId(3845)}})),e.push(new ds({name:"Earth at night",iconUrl:tn("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return hg.fromAssetId(3812)}})),e.push(new ds({name:"Natural Earth\xA0II",iconUrl:tn("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return D0.fromUrl(tn("Assets/Textures/NaturalEarthII"))}})),e}var kk=Qwt;function Jwt(){let e=[];return e.push(new ds({name:"WGS84 Ellipsoid",iconUrl:tn("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new np({ellipsoid:ie.WGS84})}})),e.push(new ds({name:"Cesium World Terrain",iconUrl:tn("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return PA({requestWaterMask:!0,requestVertexNormals:!0})}})),e}var Uk=Jwt;function evt(e){return function(t){let n=e._scene.pick(t.position);c(n)&&n.primitive instanceof bs&&(e.tileset=n.primitive),e.pickActive=!1}}function $Ee(e,t){t?e._eventHandler.setInputAction(function(n){let i=e._scene.pick(n.endPosition);c(i)&&i.primitive instanceof bs&&(e.tileset=i.primitive)},An.MOUSE_MOVE):(e._eventHandler.removeInputAction(An.MOUSE_MOVE),e.picking=e.picking)}var tvt={maximumFractionDigits:3};function Vk(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,tvt):Math.round(t).toLocaleString()}function zk(e,t){if(!c(e))return"";let n=t?e._statisticsPerPass[Uo.PICK]:e._statisticsPerPass[Uo.RENDER],i='<ul class="cesium-cesiumInspector-statistics">';return i+=`<li><strong>Visited: </strong>${n.visited.toLocaleString()}</li><li><strong>Selected: </strong>${n.selected.toLocaleString()}</li><li><strong>Commands: </strong>${n.numberOfCommands.toLocaleString()}</li>`,i+="</ul>",t||(i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Requests: </strong>${n.numberOfPendingRequests.toLocaleString()}</li><li><strong>Attempted: </strong>${n.numberOfAttemptedRequests.toLocaleString()}</li><li><strong>Processing: </strong>${n.numberOfTilesProcessing.toLocaleString()}</li><li><strong>Content Ready: </strong>${n.numberOfTilesWithContentReady.toLocaleString()}</li><li><strong>Total: </strong>${n.numberOfTilesTotal.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Features Selected: </strong>${n.numberOfFeaturesSelected.toLocaleString()}</li><li><strong>Features Loaded: </strong>${n.numberOfFeaturesLoaded.toLocaleString()}</li><li><strong>Points Selected: </strong>${n.numberOfPointsSelected.toLocaleString()}</li><li><strong>Points Loaded: </strong>${n.numberOfPointsLoaded.toLocaleString()}</li><li><strong>Triangles Selected: </strong>${n.numberOfTrianglesSelected.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Tiles styled: </strong>${n.numberOfTilesStyled.toLocaleString()}</li><li><strong>Features styled: </strong>${n.numberOfFeaturesStyled.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Children Union Culled: </strong>${n.numberOfTilesCulledWithChildrenUnion.toLocaleString()}</li>`,i+="</ul>",i+='<ul class="cesium-cesiumInspector-statistics">',i+=`<li><strong>Geometry Memory (MB): </strong>${Vk(n.geometryByteLength)}</li><li><strong>Texture Memory (MB): </strong>${Vk(n.texturesByteLength)}</li><li><strong>Batch Table Memory (MB): </strong>${Vk(n.batchTableByteLength)}</li>`,i+="</ul>"),i}function ZEe(){let e=vi.statistics;return`
  <ul class="cesium-cesiumInspector-statistics">
    <li><strong>Geometry Memory (MB): </strong>${Vk(e.geometryByteLength)}</li>
    <li><strong>Texture Memory (MB): </strong>${Vk(e.texturesByteLength)}</li>
  </ul>
  `}var nvt=[{text:"Highlight",value:Bl.HIGHLIGHT},{text:"Replace",value:Bl.REPLACE},{text:"Mix",value:Bl.MIX}],KEe=new G(1,1,0,.4),ivt=new G,a5=new G;function Pa(e,t){T.typeOf.object("scene",e),T.typeOf.object("performanceContainer",t);let n=this,i=e.canvas;this._eventHandler=new of(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new yg({container:t}),this._statisticsText="",this._pickStatisticsText="",this._resourceCacheStatisticsText="",this._editorError="",this.performance=!1,this.showStatistics=!0,this.showPickStatistics=!0,this.showResourceCacheStatistics=!1,this.inspectorVisible=!0,this.tilesetVisible=!1,this.displayVisible=!1,this.updateVisible=!1,this.loggingVisible=!1,this.styleVisible=!1,this.tileDebugLabelsVisible=!1,this.optimizationVisible=!1,this.styleString="{}",this.hasEnabledWireframe=!1,this._tileset=void 0,this._feature=void 0,this._tile=void 0,xe.track(this,["performance","inspectorVisible","_statisticsText","_pickStatisticsText","_resourceCacheStatisticsText","_editorError","showPickStatistics","showStatistics","showResourceCacheStatistics","tilesetVisible","displayVisible","updateVisible","loggingVisible","styleVisible","optimizationVisible","tileDebugLabelsVisible","styleString","_feature","_tile","_tileset","hasEnabledWireframe"]),this._properties=xe.observable({}),this.properties=[],xe.defineProperty(this,"properties",function(){let U=[],q=n._properties();for(let Y in q)q.hasOwnProperty(Y)&&U.push(Y);return U});let o=xe.observable();xe.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return o()},set:function(U){o(U),c(n._tileset)&&(n._tileset.dynamicScreenSpaceError=U)}}),this.dynamicScreenSpaceError=!1;let r=xe.observable();xe.defineProperty(this,"colorBlendMode",{get:function(){return r()},set:function(U){r(U),c(n._tileset)&&(n._tileset.colorBlendMode=U,n._scene.requestRender())}}),this.colorBlendMode=Bl.HIGHLIGHT;let s=xe.observable(),a=xe.observable();xe.defineProperty(this,"picking",{get:function(){return a()},set:function(U){a(U),U?n._eventHandler.setInputAction(function(q){let Y=e.pick(q.endPosition);if(Y instanceof Ws?(n.feature=Y,n.tile=Y.content.tile):c(Y)&&c(Y.content)?(n.feature=void 0,n.tile=Y.content.tile):(n.feature=void 0,n.tile=void 0),!!c(n._tileset)){if(s&&c(Y)&&c(Y.content)){let te;e.pickPositionSupported&&(te=e.pickPosition(q.endPosition),c(te)&&(n._tileset.debugPickPosition=te)),n._tileset.debugPickedTile=Y.content.tile}else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}},An.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(An.MOUSE_MOVE))}}),this.picking=!0;let l=xe.observable();xe.defineProperty(this,"colorize",{get:function(){return l()},set:function(U){l(U),c(n._tileset)&&(n._tileset.debugColorizeTiles=U,n._scene.requestRender())}}),this.colorize=!1;let u=xe.observable();xe.defineProperty(this,"wireframe",{get:function(){return u()},set:function(U){u(U),c(n._tileset)&&(n._tileset.debugWireframe=U,n._scene.requestRender())}}),this.wireframe=!1;let f=xe.observable();xe.defineProperty(this,"showBoundingVolumes",{get:function(){return f()},set:function(U){f(U),c(n._tileset)&&(n._tileset.debugShowBoundingVolume=U,n._scene.requestRender())}}),this.showBoundingVolumes=!1;let h=xe.observable();xe.defineProperty(this,"showContentBoundingVolumes",{get:function(){return h()},set:function(U){h(U),c(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=U,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;let p=xe.observable();xe.defineProperty(this,"showRequestVolumes",{get:function(){return p()},set:function(U){p(U),c(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=U,n._scene.requestRender())}}),this.showRequestVolumes=!1;let g=xe.observable();xe.defineProperty(this,"freezeFrame",{get:function(){return g()},set:function(U){g(U),c(n._tileset)&&(n._tileset.debugFreezeFrame=U,n._scene.debugShowFrustumPlanes=U,n._scene.requestRender())}}),this.freezeFrame=!1,xe.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return s()},set:function(U){s(U),c(n._tileset)&&(n._tileset.debugPickedTileLabelOnly=U,n._scene.requestRender())}}),this.showOnlyPickedTileDebugLabel=!1;let m=xe.observable();xe.defineProperty(this,"showGeometricError",{get:function(){return m()},set:function(U){m(U),c(n._tileset)&&(n._tileset.debugShowGeometricError=U,n._scene.requestRender())}}),this.showGeometricError=!1;let y=xe.observable();xe.defineProperty(this,"showRenderingStatistics",{get:function(){return y()},set:function(U){y(U),c(n._tileset)&&(n._tileset.debugShowRenderingStatistics=U,n._scene.requestRender())}}),this.showRenderingStatistics=!1;let b=xe.observable();xe.defineProperty(this,"showMemoryUsage",{get:function(){return b()},set:function(U){b(U),c(n._tileset)&&(n._tileset.debugShowMemoryUsage=U,n._scene.requestRender())}}),this.showMemoryUsage=!1;let x=xe.observable();xe.defineProperty(this,"showUrl",{get:function(){return x()},set:function(U){x(U),c(n._tileset)&&(n._tileset.debugShowUrl=U,n._scene.requestRender())}}),this.showUrl=!1;let A=xe.observable();xe.defineProperty(this,"maximumScreenSpaceError",{get:function(){return A()},set:function(U){U=Number(U),isNaN(U)||(A(U),c(n._tileset)&&(n._tileset.maximumScreenSpaceError=U))}}),this.maximumScreenSpaceError=16;let C=xe.observable();xe.defineProperty(this,"dynamicScreenSpaceErrorDensity",{get:function(){return C()},set:function(U){U=Number(U),isNaN(U)||(C(U),c(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorDensity=U))}}),this.dynamicScreenSpaceErrorDensity=2e-4,this.dynamicScreenSpaceErrorDensitySliderValue=void 0,xe.defineProperty(this,"dynamicScreenSpaceErrorDensitySliderValue",{get:function(){return Math.pow(C(),1/6)},set:function(U){let q=Math.pow(U,6);C(q),c(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorDensity=q)}});let S=xe.observable();xe.defineProperty(this,"dynamicScreenSpaceErrorFactor",{get:function(){return S()},set:function(U){U=Number(U),isNaN(U)||(S(U),c(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorFactor=U))}}),this.dynamicScreenSpaceErrorFactor=24;let v=evt(this),P=xe.observable();xe.defineProperty(this,"pickActive",{get:function(){return P()},set:function(U){P(U),U?n._eventHandler.setInputAction(v,An.LEFT_CLICK):n._eventHandler.removeInputAction(An.LEFT_CLICK)}});let M=xe.observable();xe.defineProperty(this,"pointCloudShading",{get:function(){return M()},set:function(U){M(U),c(n._tileset)&&(n._tileset.pointCloudShading.attenuation=U)}}),this.pointCloudShading=!1;let R=xe.observable();xe.defineProperty(this,"geometricErrorScale",{get:function(){return R()},set:function(U){U=Number(U),isNaN(U)||(R(U),c(n._tileset)&&(n._tileset.pointCloudShading.geometricErrorScale=U))}}),this.geometricErrorScale=1;let L=xe.observable();xe.defineProperty(this,"maximumAttenuation",{get:function(){return L()},set:function(U){U=Number(U),isNaN(U)||(L(U),c(n._tileset)&&(n._tileset.pointCloudShading.maximumAttenuation=U===0?void 0:U))}}),this.maximumAttenuation=0;let F=xe.observable();xe.defineProperty(this,"baseResolution",{get:function(){return F()},set:function(U){U=Number(U),isNaN(U)||(F(U),c(n._tileset)&&(n._tileset.pointCloudShading.baseResolution=U===0?void 0:U))}}),this.baseResolution=0;let _=xe.observable();xe.defineProperty(this,"eyeDomeLighting",{get:function(){return _()},set:function(U){_(U),c(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLighting=U)}}),this.eyeDomeLighting=!1;let w=xe.observable();xe.defineProperty(this,"eyeDomeLightingStrength",{get:function(){return w()},set:function(U){U=Number(U),isNaN(U)||(w(U),c(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingStrength=U))}}),this.eyeDomeLightingStrength=1;let D=xe.observable();xe.defineProperty(this,"eyeDomeLightingRadius",{get:function(){return D()},set:function(U){U=Number(U),isNaN(U)||(D(U),c(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingRadius=U))}}),this.eyeDomeLightingRadius=1,this.pickActive=!1;let I=xe.observable();xe.defineProperty(this,"skipLevelOfDetail",{get:function(){return I()},set:function(U){I(U),c(n._tileset)&&(n._tileset.skipLevelOfDetail=U)}}),this.skipLevelOfDetail=!0;let N=xe.observable();xe.defineProperty(this,"skipScreenSpaceErrorFactor",{get:function(){return N()},set:function(U){U=Number(U),isNaN(U)||(N(U),c(n._tileset)&&(n._tileset.skipScreenSpaceErrorFactor=U))}}),this.skipScreenSpaceErrorFactor=16;let k=xe.observable();xe.defineProperty(this,"baseScreenSpaceError",{get:function(){return k()},set:function(U){U=Number(U),isNaN(U)||(k(U),c(n._tileset)&&(n._tileset.baseScreenSpaceError=U))}}),this.baseScreenSpaceError=1024;let z=xe.observable();xe.defineProperty(this,"skipLevels",{get:function(){return z()},set:function(U){U=Number(U),isNaN(U)||(z(U),c(n._tileset)&&(n._tileset.skipLevels=U))}}),this.skipLevels=1;let V=xe.observable();xe.defineProperty(this,"immediatelyLoadDesiredLevelOfDetail",{get:function(){return V()},set:function(U){V(U),c(n._tileset)&&(n._tileset.immediatelyLoadDesiredLevelOfDetail=U)}}),this.immediatelyLoadDesiredLevelOfDetail=!1;let j=xe.observable();xe.defineProperty(this,"loadSiblings",{get:function(){return j()},set:function(U){j(U),c(n._tileset)&&(n._tileset.loadSiblings=U)}}),this.loadSiblings=!1,this._style=void 0,this._shouldStyle=!1,this._definedProperties=["properties","dynamicScreenSpaceError","colorBlendMode","picking","colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","maximumScreenSpaceError","dynamicScreenSpaceErrorDensity","baseScreenSpaceError","skipScreenSpaceErrorFactor","skipLevelOfDetail","skipLevels","immediatelyLoadDesiredLevelOfDetail","loadSiblings","dynamicScreenSpaceErrorDensitySliderValue","dynamicScreenSpaceErrorFactor","pickActive","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl","pointCloudShading","geometricErrorScale","maximumAttenuation","baseResolution","eyeDomeLighting","eyeDomeLightingStrength","eyeDomeLightingRadius"],this._removePostRenderEvent=e.postRender.addEventListener(function(){n._update()}),c(this._tileset)||$Ee(this,!0)}Object.defineProperties(Pa.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},statisticsText:{get:function(){return this._statisticsText}},pickStatisticsText:{get:function(){return this._pickStatisticsText}},resourceCacheStatisticsText:{get:function(){return this._resourceCacheStatisticsText}},colorBlendModes:{get:function(){return nvt}},editorError:{get:function(){return this._editorError}},tileset:{get:function(){return this._tileset},set:function(e){if(this._tileset=e,this._style=void 0,this.styleString="{}",this.feature=void 0,this.tile=void 0,c(e)){this._properties(e.properties);let t=["colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl"],n=t.length;for(let o=0;o<n;++o){let r=t[o];this[r]=this[r]}this.maximumScreenSpaceError=e.maximumScreenSpaceError,this.dynamicScreenSpaceError=e.dynamicScreenSpaceError,this.dynamicScreenSpaceErrorDensity=e.dynamicScreenSpaceErrorDensity,this.dynamicScreenSpaceErrorFactor=e.dynamicScreenSpaceErrorFactor,this.colorBlendMode=e.colorBlendMode,this.skipLevelOfDetail=e.skipLevelOfDetail,this.skipScreenSpaceErrorFactor=e.skipScreenSpaceErrorFactor,this.baseScreenSpaceError=e.baseScreenSpaceError,this.skipLevels=e.skipLevels,this.immediatelyLoadDesiredLevelOfDetail=e.immediatelyLoadDesiredLevelOfDetail,this.loadSiblings=e.loadSiblings,this.hasEnabledWireframe=e._enableDebugWireframe;let i=e.pointCloudShading;this.pointCloudShading=i.attenuation,this.geometricErrorScale=i.geometricErrorScale,this.maximumAttenuation=i.maximumAttenuation?i.maximumAttenuation:0,this.baseResolution=i.baseResolution?i.baseResolution:0,this.eyeDomeLighting=i.eyeDomeLighting,this.eyeDomeLightingStrength=i.eyeDomeLightingStrength,this.eyeDomeLightingRadius=i.eyeDomeLightingRadius,this._scene.requestRender()}else this._properties({});this._statisticsText=zk(e,!1),this._pickStatisticsText=zk(e,!0),this._resourceCacheStatisticsText=ZEe(),$Ee(this,!1)}},feature:{get:function(){return this._feature},set:function(e){if(this._feature===e)return;let t=this._feature;c(t)&&!t.content.isDestroyed()&&(!this.colorize&&c(this._style)?t.color=c(this._style.color)?this._style.color.evaluateColor(t,ivt):G.WHITE:t.color=a5,this._scene.requestRender()),c(e)&&(G.clone(e.color,a5),e.color=KEe,this._scene.requestRender()),this._feature=e}},tile:{get:function(){return this._tile},set:function(e){if(this._tile===e)return;let t=this._tile;c(t)&&!t.isDestroyed()&&!GQ(t.content)&&(t.color=a5,this._scene.requestRender()),c(e)&&!GQ(e.content)&&(G.clone(e.color,a5),e.color=KEe,this._scene.requestRender()),this._tile=e}}});function GQ(e){if(!c(e))return!1;if(e.featuresLength>0)return!0;let t=e.innerContents;if(c(t)){let n=t.length;for(let i=0;i<n;++i)if(!GQ(t[i]))return!1;return!0}return!1}Pa.prototype.togglePickTileset=function(){this.pickActive=!this.pickActive};Pa.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible};Pa.prototype.toggleTileset=function(){this.tilesetVisible=!this.tilesetVisible};Pa.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible};Pa.prototype.toggleUpdate=function(){this.updateVisible=!this.updateVisible};Pa.prototype.toggleLogging=function(){this.loggingVisible=!this.loggingVisible};Pa.prototype.toggleStyle=function(){this.styleVisible=!this.styleVisible};Pa.prototype.toggleTileDebugLabels=function(){this.tileDebugLabelsVisible=!this.tileDebugLabelsVisible};Pa.prototype.toggleOptimization=function(){this.optimizationVisible=!this.optimizationVisible};Pa.prototype.trimTilesCache=function(){c(this._tileset)&&this._tileset.trimLoadedTiles()};Pa.prototype.compileStyle=function(){let e=this._tileset;if(!(!c(e)||this.styleString===JSON.stringify(e.style))){this._editorError="";try{this.styleString.length===0&&(this.styleString="{}"),this._style=new NA(JSON.parse(this.styleString)),this._shouldStyle=!0,this._scene.requestRender()}catch(t){this._editorError=t.toString()}this.feature=this._feature,this.tile=this._tile}};Pa.prototype.styleEditorKeyPress=function(e,t){if(t.keyCode===9){t.preventDefault();let n=t.target,i=n.selectionStart,o=n.selectionEnd,r=o,a=n.value.slice(i,o).split(`
`),l=a.length,u;if(t.shiftKey)for(u=0;u<l;++u)a[u][0]===" "&&(a[u][1]===" "?(a[u]=a[u].substr(2),r-=2):(a[u]=a[u].substr(1),r-=1));else for(u=0;u<l;++u)a[u]=`  ${a[u]}`,r+=2;let f=a.join(`
`);n.value=n.value.slice(0,i)+f+n.value.slice(o),n.selectionStart=i!==o?i:r,n.selectionEnd=r}else t.ctrlKey&&(t.keyCode===10||t.keyCode===13)&&this.compileStyle();return!0};Pa.prototype._update=function(){let e=this._tileset;if(this.performance&&this._performanceDisplay.update(),c(e)){if(e.isDestroyed()){this.tile=void 0,this.feature=void 0,this.tileset=void 0;return}let t=e.style;this._style!==e.style&&(this._shouldStyle?(e.style=this._style,this._shouldStyle=!1):(this._style=t,this.styleString=JSON.stringify(t.style,null,"  ")))}this.showStatistics&&(this._statisticsText=zk(e,!1),this._pickStatisticsText=zk(e,!0),this._resourceCacheStatisticsText=ZEe())};Pa.prototype.isDestroyed=function(){return!1};Pa.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();let e=this;return this._definedProperties.forEach(function(t){xe.getObservable(e,t).dispose()}),de(this)};Pa.getStatistics=zk;var Hk=Pa;function c5(e,t){T.defined("container",e),T.typeOf.object("scene",t),e=In(e);let n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");let o=new Hk(t,i);this._viewModel=o,this._container=e,this._element=n;let r=document.createElement("div");r.textContent="3D Tiles Inspector",r.className="cesium-cesiumInspector-button",r.setAttribute("data-bind","click: toggleInspector"),n.appendChild(r),n.className="cesium-cesiumInspector cesium-3DTilesInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(n);let s=document.createElement("div");s.className="cesium-cesiumInspector-dropDown",n.appendChild(s);let a=fu.createSection,l=fu.createCheckbox,u=fu.createRangeInput,f=fu.createButton,h=a(s,"Tileset","tilesetVisible","toggleTileset"),p=a(s,"Display","displayVisible","toggleDisplay"),g=a(s,"Update","updateVisible","toggleUpdate"),m=a(s,"Logging","loggingVisible","toggleLogging"),y=a(s,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),b=a(s,"Style","styleVisible","toggleStyle"),x=a(s,"Optimization","optimizationVisible","toggleOptimization"),A=document.createElement("div");A.className="field-group";let C=document.createElement("label");C.className="field-label",C.appendChild(document.createTextNode("Properties: "));let S=document.createElement("div");S.setAttribute("data-bind","text: properties"),A.appendChild(C),A.appendChild(S),h.appendChild(A),h.appendChild(f("Pick Tileset","togglePickTileset","pickActive")),h.appendChild(f("Trim Tiles Cache","trimTilesCache")),h.appendChild(l("Enable Picking","picking")),p.appendChild(l("Colorize","colorize"));let v=p.appendChild(l("Wireframe","wireframe","_tileset === undefined || hasEnabledWireframe")),P=document.createElement("p");P.setAttribute("data-bind","visible: _tileset !== undefined && !hasEnabledWireframe"),P.setAttribute("class","cesium-3DTilesInspector-disabledElementsInfo"),P.innerText="Set enableDebugWireframe to true in the tileset constructor to enable this option.",v.appendChild(P),p.appendChild(l("Bounding Volumes","showBoundingVolumes")),p.appendChild(l("Content Volumes","showContentBoundingVolumes")),p.appendChild(l("Request Volumes","showRequestVolumes")),p.appendChild(l("Point Cloud Shading","pointCloudShading"));let M=document.createElement("div");M.setAttribute("data-bind","visible: pointCloudShading"),M.appendChild(u("Geometric Error Scale","geometricErrorScale",0,2,.01)),M.appendChild(u("Maximum Attenuation","maximumAttenuation",0,32,1)),M.appendChild(u("Base Resolution","baseResolution",0,1,.01)),M.appendChild(l("Eye Dome Lighting (EDL)","eyeDomeLighting")),p.appendChild(M);let R=document.createElement("div");R.setAttribute("data-bind","visible: eyeDomeLighting"),R.appendChild(u("EDL Strength","eyeDomeLightingStrength",0,2,.1)),R.appendChild(u("EDL Radius","eyeDomeLightingRadius",0,4,.1)),M.appendChild(R),g.appendChild(l("Freeze Frame","freezeFrame")),g.appendChild(l("Dynamic Screen Space Error","dynamicScreenSpaceError"));let L=document.createElement("div");L.appendChild(u("Maximum Screen Space Error","maximumScreenSpaceError",0,128,1)),g.appendChild(L);let F=document.createElement("div");F.setAttribute("data-bind","visible: dynamicScreenSpaceError"),F.appendChild(u("Screen Space Error Density","dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"dynamicScreenSpaceErrorDensity")),F.appendChild(u("Screen Space Error Factor","dynamicScreenSpaceErrorFactor",1,32,.1)),g.appendChild(F),m.appendChild(l("Performance","performance")),m.appendChild(i),m.appendChild(l("Statistics","showStatistics"));let _=document.createElement("div");_.className="cesium-3dTilesInspector-statistics",_.setAttribute("data-bind","html: statisticsText, visible: showStatistics"),m.appendChild(_),m.appendChild(l("Pick Statistics","showPickStatistics"));let w=document.createElement("div");w.className="cesium-3dTilesInspector-statistics",w.setAttribute("data-bind","html: pickStatisticsText, visible: showPickStatistics"),m.appendChild(w),m.appendChild(l("Resource Cache Statistics","showResourceCacheStatistics"));let D=document.createElement("div");D.className="cesium-3dTilesInspector-statistics",D.setAttribute("data-bind","html: resourceCacheStatisticsText, visible: showResourceCacheStatistics"),m.appendChild(D);let I=document.createElement("div");b.appendChild(I),I.appendChild(document.createTextNode("Color Blend Mode: "));let N=document.createElement("select");N.setAttribute("data-bind",'options: colorBlendModes, optionsText: "text", optionsValue: "value", value: colorBlendMode'),I.appendChild(N);let k=document.createElement("textarea");k.setAttribute("data-bind","textInput: styleString, event: { keydown: styleEditorKeyPress }"),I.className="cesium-cesiumInspector-styleEditor",I.appendChild(k);let z=f("Compile (Ctrl+Enter)","compileStyle");I.appendChild(z);let V=document.createElement("div");V.className="cesium-cesiumInspector-error",V.setAttribute("data-bind","text: editorError"),I.appendChild(V),y.appendChild(l("Show Picked Only","showOnlyPickedTileDebugLabel")),y.appendChild(l("Geometric Error","showGeometricError")),y.appendChild(l("Rendering Statistics","showRenderingStatistics")),y.appendChild(l("Memory Usage (MB)","showMemoryUsage")),y.appendChild(l("Url","showUrl")),x.appendChild(l("Skip Tile LODs","skipLevelOfDetail"));let j=document.createElement("div");j.appendChild(u("Skip SSE Factor","skipScreenSpaceErrorFactor",1,50,1)),x.appendChild(j);let U=document.createElement("div");U.appendChild(u("SSE before skipping LOD","baseScreenSpaceError",0,4096,1)),x.appendChild(U);let q=document.createElement("div");q.appendChild(u("Min. levels to skip","skipLevels",0,10,1)),x.appendChild(q),x.appendChild(l("Load only tiles that meet the max SSE.","immediatelyLoadDesiredLevelOfDetail")),x.appendChild(l("Load siblings of visible tiles","loadSiblings")),xe.applyBindings(o,n)}Object.defineProperties(c5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});c5.prototype.isDestroyed=function(){return!1};c5.prototype.destroy=function(){return xe.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),de(this)};var Gk=c5;function ovt(e){let t;if(c(e)){t="Command Statistics";let n=e.commandsInFrustums;for(let i in n)if(n.hasOwnProperty(i)){let o=parseInt(i,10),r;if(o===7)r="1, 2 and 3";else{let s=[];for(let a=2;a>=0;a--){let l=Math.pow(2,a);o>=l&&(s.push(a+1),o-=l)}r=s.reverse().join(" and ")}t+=`<br>&nbsp;&nbsp;&nbsp;&nbsp;${n[i]} in frustum ${r}`}t+=`<br>Total: ${e.totalCommands}`}return t}function jQ(e,t,n){let i=Math.min(n,t);return i=Math.max(i,e),i}var rvt=new mn,svt=new d;function jk(e,t){if(!c(e))throw new E("scene is required");if(!c(t))throw new E("performanceContainer is required");let n=this,i=e.canvas,o=new of(i);this._eventHandler=o,this._scene=e,this._canvas=i,this._primitive=void 0,this._tile=void 0,this._modelMatrixPrimitive=void 0,this._performanceDisplay=void 0,this._performanceContainer=t;let r=this._scene.globe;r.depthTestAgainstTerrain=!0,this.frustums=!1,this.frustumPlanes=!1,this.performance=!1,this.shaderCacheText="",this.primitiveBoundingSphere=!1,this.primitiveReferenceFrame=!1,this.filterPrimitive=!1,this.tileBoundingSphere=!1,this.filterTile=!1,this.wireframe=!1,this.depthFrustum=1,this._numberOfFrustums=1,this.suspendUpdates=!1,this.tileCoordinates=!1,this.frustumStatisticText=!1,this.tileText="",this.hasPickedPrimitive=!1,this.hasPickedTile=!1,this.pickPrimitiveActive=!1,this.pickTileActive=!1,this.dropDownVisible=!0,this.generalVisible=!0,this.primitivesVisible=!1,this.terrainVisible=!1,this.depthFrustumText="",xe.track(this,["frustums","frustumPlanes","performance","shaderCacheText","primitiveBoundingSphere","primitiveReferenceFrame","filterPrimitive","tileBoundingSphere","filterTile","wireframe","depthFrustum","suspendUpdates","tileCoordinates","frustumStatisticText","tileText","hasPickedPrimitive","hasPickedTile","pickPrimitiveActive","pickTileActive","dropDownVisible","generalVisible","primitivesVisible","terrainVisible","depthFrustumText"]),this._toggleDropDown=Sn(function(){n.dropDownVisible=!n.dropDownVisible}),this._toggleGeneral=Sn(function(){n.generalVisible=!n.generalVisible}),this._togglePrimitives=Sn(function(){n.primitivesVisible=!n.primitivesVisible}),this._toggleTerrain=Sn(function(){n.terrainVisible=!n.terrainVisible}),this._frustumsSubscription=xe.getObservable(this,"frustums").subscribe(function(u){n._scene.debugShowFrustums=u,n._scene.requestRender()}),this._frustumPlanesSubscription=xe.getObservable(this,"frustumPlanes").subscribe(function(u){n._scene.debugShowFrustumPlanes=u,n._scene.requestRender()}),this._performanceSubscription=xe.getObservable(this,"performance").subscribe(function(u){u?n._performanceDisplay=new yg({container:n._performanceContainer}):n._performanceContainer.innerHTML=""}),this._showPrimitiveBoundingSphere=Sn(function(){return n._primitive.debugShowBoundingVolume=n.primitiveBoundingSphere,n._scene.requestRender(),!0}),this._primitiveBoundingSphereSubscription=xe.getObservable(this,"primitiveBoundingSphere").subscribe(function(){n._showPrimitiveBoundingSphere()}),this._showPrimitiveReferenceFrame=Sn(function(){if(n.primitiveReferenceFrame){let u=n._primitive.modelMatrix;n._modelMatrixPrimitive=new lk({modelMatrix:u}),n._scene.primitives.add(n._modelMatrixPrimitive)}else c(n._modelMatrixPrimitive)&&(n._scene.primitives.remove(n._modelMatrixPrimitive),n._modelMatrixPrimitive=void 0);return n._scene.requestRender(),!0}),this._primitiveReferenceFrameSubscription=xe.getObservable(this,"primitiveReferenceFrame").subscribe(function(){n._showPrimitiveReferenceFrame()}),this._doFilterPrimitive=Sn(function(){return n.filterPrimitive?n._scene.debugCommandFilter=function(u){return c(n._modelMatrixPrimitive)&&u.owner===n._modelMatrixPrimitive._primitive?!0:c(n._primitive)?u.owner===n._primitive||u.owner===n._primitive._billboardCollection||u.owner.primitive===n._primitive:!1}:n._scene.debugCommandFilter=void 0,!0}),this._filterPrimitiveSubscription=xe.getObservable(this,"filterPrimitive").subscribe(function(){n._doFilterPrimitive(),n._scene.requestRender()}),this._wireframeSubscription=xe.getObservable(this,"wireframe").subscribe(function(u){r._surface.tileProvider._debug.wireframe=u,n._scene.requestRender()}),this._depthFrustumSubscription=xe.getObservable(this,"depthFrustum").subscribe(function(u){n._scene.debugShowDepthFrustum=u,n._scene.requestRender()}),this._incrementDepthFrustum=Sn(function(){let u=n.depthFrustum+1;return n.depthFrustum=jQ(1,n._numberOfFrustums,u),n._scene.requestRender(),!0}),this._decrementDepthFrustum=Sn(function(){let u=n.depthFrustum-1;return n.depthFrustum=jQ(1,n._numberOfFrustums,u),n._scene.requestRender(),!0}),this._suspendUpdatesSubscription=xe.getObservable(this,"suspendUpdates").subscribe(function(u){r._surface._debug.suspendLodUpdate=u,u||(n.filterTile=!1)});let s;this._showTileCoordinates=Sn(function(){return n.tileCoordinates&&!c(s)?s=e.imageryLayers.addImageryProvider(new wk({tilingScheme:e.terrainProvider.tilingScheme})):!n.tileCoordinates&&c(s)&&(e.imageryLayers.remove(s),s=void 0),!0}),this._tileCoordinatesSubscription=xe.getObservable(this,"tileCoordinates").subscribe(function(){n._showTileCoordinates(),n._scene.requestRender()}),this._tileBoundingSphereSubscription=xe.getObservable(this,"tileBoundingSphere").subscribe(function(){n._showTileBoundingSphere(),n._scene.requestRender()}),this._showTileBoundingSphere=Sn(function(){return n.tileBoundingSphere?r._surface.tileProvider._debug.boundingSphereTile=n._tile:r._surface.tileProvider._debug.boundingSphereTile=void 0,n._scene.requestRender(),!0}),this._doFilterTile=Sn(function(){return n.filterTile?(n.suspendUpdates=!0,r._surface._tilesToRender=[],c(n._tile)&&n._tile.renderable&&r._surface._tilesToRender.push(n._tile)):n.suspendUpdates=!1,!0}),this._filterTileSubscription=xe.getObservable(this,"filterTile").subscribe(function(){n.doFilterTile(),n._scene.requestRender()});function a(u){let f=n._scene.pick({x:u.position.x,y:u.position.y});c(f)&&(n.primitive=c(f.collection)?f.collection:f.primitive),n._scene.requestRender(),n.pickPrimitiveActive=!1}this._pickPrimitive=Sn(function(){n.pickPrimitiveActive=!n.pickPrimitiveActive}),this._pickPrimitiveActiveSubscription=xe.getObservable(this,"pickPrimitiveActive").subscribe(function(u){u?o.setInputAction(a,An.LEFT_CLICK):o.removeInputAction(An.LEFT_CLICK)});function l(u){let f,h=r.ellipsoid,p=n._scene.camera.getPickRay(u.position,rvt),g=r.pick(p,n._scene,svt);if(c(g)){let m=h.cartesianToCartographic(g),y=r._surface.tileProvider._tilesToRenderByTextureCount;for(let b=0;!f&&b<y.length;++b){let x=y[b];if(c(x))for(let A=0;!f&&A<x.length;++A){let C=x[A];ce.contains(C.rectangle,m)&&(f=C)}}}n.tile=f,n.pickTileActive=!1}this._pickTile=Sn(function(){n.pickTileActive=!n.pickTileActive}),this._pickTileActiveSubscription=xe.getObservable(this,"pickTileActive").subscribe(function(u){u?o.setInputAction(l,An.LEFT_CLICK):o.removeInputAction(An.LEFT_CLICK)}),this._removePostRenderEvent=e.postRender.addEventListener(function(){n._update()})}Object.defineProperties(jk.prototype,{scene:{get:function(){return this._scene}},performanceContainer:{get:function(){return this._performanceContainer}},toggleDropDown:{get:function(){return this._toggleDropDown}},showPrimitiveBoundingSphere:{get:function(){return this._showPrimitiveBoundingSphere}},showPrimitiveReferenceFrame:{get:function(){return this._showPrimitiveReferenceFrame}},doFilterPrimitive:{get:function(){return this._doFilterPrimitive}},incrementDepthFrustum:{get:function(){return this._incrementDepthFrustum}},decrementDepthFrustum:{get:function(){return this._decrementDepthFrustum}},showTileCoordinates:{get:function(){return this._showTileCoordinates}},showTileBoundingSphere:{get:function(){return this._showTileBoundingSphere}},doFilterTile:{get:function(){return this._doFilterTile}},toggleGeneral:{get:function(){return this._toggleGeneral}},togglePrimitives:{get:function(){return this._togglePrimitives}},toggleTerrain:{get:function(){return this._toggleTerrain}},pickPrimitive:{get:function(){return this._pickPrimitive}},pickTile:{get:function(){return this._pickTile}},selectParent:{get:function(){let e=this;return Sn(function(){e.tile=e.tile.parent})}},selectNW:{get:function(){let e=this;return Sn(function(){e.tile=e.tile.northwestChild})}},selectNE:{get:function(){let e=this;return Sn(function(){e.tile=e.tile.northeastChild})}},selectSW:{get:function(){let e=this;return Sn(function(){e.tile=e.tile.southwestChild})}},selectSE:{get:function(){let e=this;return Sn(function(){e.tile=e.tile.southeastChild})}},primitive:{get:function(){return this._primitive},set:function(e){let t=this._primitive;e!==t&&(this.hasPickedPrimitive=!0,c(t)&&(t.debugShowBoundingVolume=!1),this._scene.debugCommandFilter=void 0,c(this._modelMatrixPrimitive)&&(this._scene.primitives.remove(this._modelMatrixPrimitive),this._modelMatrixPrimitive=void 0),this._primitive=e,e.show=!1,setTimeout(function(){e.show=!0},50),this.showPrimitiveBoundingSphere(),this.showPrimitiveReferenceFrame(),this.doFilterPrimitive())}},tile:{get:function(){return this._tile},set:function(e){if(c(e)){this.hasPickedTile=!0;let t=this._tile;if(e!==t){this.tileText=`L: ${e.level} X: ${e.x} Y: ${e.y}`,this.tileText+=`<br>SW corner: ${e.rectangle.west}, ${e.rectangle.south}`,this.tileText+=`<br>NE corner: ${e.rectangle.east}, ${e.rectangle.north}`;let n=e.data;c(n)&&c(n.tileBoundingRegion)?this.tileText+=`<br>Min: ${n.tileBoundingRegion.minimumHeight} Max: ${n.tileBoundingRegion.maximumHeight}`:this.tileText+="<br>(Tile is not loaded)"}this._tile=e,this.showTileBoundingSphere(),this.doFilterTile()}else this.hasPickedTile=!1,this._tile=void 0}}});jk.prototype._update=function(){this.frustums&&(this.frustumStatisticText=ovt(this._scene.debugFrustumStatistics));let e=this._scene.numberOfFrustums;this._numberOfFrustums=e,this.depthFrustum=jQ(1,e,this.depthFrustum),this.depthFrustumText=`${this.depthFrustum} of ${e}`,this.performance&&this._performanceDisplay.update(),this.primitiveReferenceFrame&&(this._modelMatrixPrimitive.modelMatrix=this._primitive.modelMatrix),this.shaderCacheText=`Cached shaders: ${this._scene.context.shaderCache.numberOfShaders}`};jk.prototype.isDestroyed=function(){return!1};jk.prototype.destroy=function(){return this._eventHandler.destroy(),this._removePostRenderEvent(),this._frustumsSubscription.dispose(),this._frustumPlanesSubscription.dispose(),this._performanceSubscription.dispose(),this._primitiveBoundingSphereSubscription.dispose(),this._primitiveReferenceFrameSubscription.dispose(),this._filterPrimitiveSubscription.dispose(),this._wireframeSubscription.dispose(),this._depthFrustumSubscription.dispose(),this._suspendUpdatesSubscription.dispose(),this._tileCoordinatesSubscription.dispose(),this._tileBoundingSphereSubscription.dispose(),this._filterTileSubscription.dispose(),this._pickPrimitiveActiveSubscription.dispose(),this._pickTileActiveSubscription.dispose(),de(this)};var Wk=jk;function l5(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=In(e);let n=document.createElement("div"),i=new Wk(t,n);this._viewModel=i,this._container=e;let o=document.createElement("div");this._element=o;let r=document.createElement("div");r.textContent="Cesium Inspector",r.className="cesium-cesiumInspector-button",r.setAttribute("data-bind","click: toggleDropDown"),o.appendChild(r),o.className="cesium-cesiumInspector",o.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }'),e.appendChild(this._element);let s=document.createElement("div");s.className="cesium-cesiumInspector-dropDown",o.appendChild(s);let a=fu.createSection,l=fu.createCheckbox,u=a(s,"General","generalVisible","toggleGeneral"),f=l("Show Frustums","frustums"),h=document.createElement("div");h.className="cesium-cesiumInspector-frustumStatistics",h.setAttribute("data-bind","visible: frustums, html: frustumStatisticText"),f.appendChild(h),u.appendChild(f),u.appendChild(l("Show Frustum Planes","frustumPlanes")),u.appendChild(l("Performance Display","performance")),n.className="cesium-cesiumInspector-performanceDisplay",u.appendChild(n);let p=document.createElement("div");p.className="cesium-cesiumInspector-shaderCache",p.setAttribute("data-bind","html: shaderCacheText"),u.appendChild(p);let g=document.createElement("div");u.appendChild(g);let m=document.createElement("span");m.setAttribute("data-bind",'html: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frustum:"'),g.appendChild(m);let y=document.createElement("span");y.setAttribute("data-bind","text: depthFrustumText"),g.appendChild(y);let b=document.createElement("input");b.type="button",b.value="-",b.className="cesium-cesiumInspector-pickButton",b.setAttribute("data-bind","click: decrementDepthFrustum"),g.appendChild(b);let x=document.createElement("input");x.type="button",x.value="+",x.className="cesium-cesiumInspector-pickButton",x.setAttribute("data-bind","click: incrementDepthFrustum"),g.appendChild(x);let A=a(s,"Primitives","primitivesVisible","togglePrimitives"),C=document.createElement("div");C.className="cesium-cesiumInspector-pickSection",A.appendChild(C);let S=document.createElement("input");S.type="button",S.value="Pick a primitive",S.className="cesium-cesiumInspector-pickButton",S.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');let v=document.createElement("div");v.className="cesium-cesiumInspector-center",v.appendChild(S),C.appendChild(v),C.appendChild(l("Show bounding sphere","primitiveBoundingSphere","hasPickedPrimitive")),C.appendChild(l("Show reference frame","primitiveReferenceFrame","hasPickedPrimitive")),this._primitiveOnly=l("Show only selected","filterPrimitive","hasPickedPrimitive"),C.appendChild(this._primitiveOnly);let P=a(s,"Terrain","terrainVisible","toggleTerrain"),M=document.createElement("div");M.className="cesium-cesiumInspector-pickSection",P.appendChild(M);let R=document.createElement("input");R.type="button",R.value="Pick a tile",R.className="cesium-cesiumInspector-pickButton",R.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'),v=document.createElement("div"),v.appendChild(R),v.className="cesium-cesiumInspector-center",M.appendChild(v);let L=document.createElement("div");M.appendChild(L);let F=document.createElement("input");F.type="button",F.value="Parent",F.className="cesium-cesiumInspector-pickButton",F.setAttribute("data-bind","click: selectParent");let _=document.createElement("input");_.type="button",_.value="NW",_.className="cesium-cesiumInspector-pickButton",_.setAttribute("data-bind","click: selectNW");let w=document.createElement("input");w.type="button",w.value="NE",w.className="cesium-cesiumInspector-pickButton",w.setAttribute("data-bind","click: selectNE");let D=document.createElement("input");D.type="button",D.value="SW",D.className="cesium-cesiumInspector-pickButton",D.setAttribute("data-bind","click: selectSW");let I=document.createElement("input");I.type="button",I.value="SE",I.className="cesium-cesiumInspector-pickButton",I.setAttribute("data-bind","click: selectSE");let N=document.createElement("div");N.className="cesium-cesiumInspector-tileText",L.className="cesium-cesiumInspector-frustumStatistics",L.appendChild(N),L.setAttribute("data-bind","visible: hasPickedTile"),N.setAttribute("data-bind","html: tileText");let k=document.createElement("div");k.className="cesium-cesiumInspector-relativeText",k.textContent="Select relative:",L.appendChild(k);let z=document.createElement("table"),V=document.createElement("tr"),j=document.createElement("tr"),U=document.createElement("td");U.appendChild(F);let q=document.createElement("td");q.appendChild(_);let Y=document.createElement("td");Y.appendChild(w),V.appendChild(U),V.appendChild(q),V.appendChild(Y);let te=document.createElement("td"),K=document.createElement("td");K.appendChild(D);let Z=document.createElement("td");Z.appendChild(I),j.appendChild(te),j.appendChild(K),j.appendChild(Z),z.appendChild(V),z.appendChild(j),L.appendChild(z),M.appendChild(l("Show bounding volume","tileBoundingSphere","hasPickedTile")),M.appendChild(l("Show only selected","filterTile","hasPickedTile")),P.appendChild(l("Wireframe","wireframe")),P.appendChild(l("Suspend LOD update","suspendUpdates")),P.appendChild(l("Show tile coordinates","tileCoordinates")),xe.applyBindings(i,this._element)}Object.defineProperties(l5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});l5.prototype.isDestroyed=function(){return!1};l5.prototype.destroy=function(){return xe.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),de(this)};var qk=l5;function u5(e,t){c(t)||(t=document.body),t=In(t);let n=this,i=xe.observable(Cr.fullscreen),o=xe.observable(Cr.enabled),r=t.ownerDocument;this.isFullscreen=void 0,xe.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,xe.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&Cr.enabled)}}),this.tooltip=void 0,xe.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=Sn(function(){Cr.fullscreen?Cr.exitFullscreen():Cr.requestFullscreen(n._fullscreenElement)},xe.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=In(e)??r.body,this._callback=function(){i(Cr.fullscreen)},r.addEventListener(Cr.changeEventName,this._callback)}Object.defineProperties(u5.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}});u5.prototype.isDestroyed=function(){return!1};u5.prototype.destroy=function(){document.removeEventListener(Cr.changeEventName,this._callback),de(this)};var Yk=u5;var avt="M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z",cvt="M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";function f5(e,t){if(!c(e))throw new E("container is required.");e=In(e);let n=new Yk(t,e);n._exitFullScreenPath=cvt,n._enterFullScreenPath=avt;let i=document.createElement("button");i.type="button",i.className="cesium-button cesium-fullscreenButton",i.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(i),xe.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(f5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});f5.prototype.isDestroyed=function(){return!1};f5.prototype.destroy=function(){return this._viewModel.destroy(),xe.cleanNode(this._element),this._container.removeChild(this._element),de(this)};var Xk=f5;function QEe(e,t){if(!c(e))throw new E("scene is required.");this._scene=e,this._duration=t;let n=this;this._command=Sn(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",xe.track(this,["tooltip"])}Object.defineProperties(QEe.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(c(e)&&e<0)throw new E("value must be positive.");this._duration=e}}});var Kk=QEe;function d5(e,t,n){if(!c(e))throw new E("container is required.");e=In(e);let i=new Kk(t,n);i._svgPath="M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";let o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-home-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(o),xe.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(d5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});d5.prototype.isDestroyed=function(){return!1};d5.prototype.destroy=function(){return xe.cleanNode(this._element),this._container.removeChild(this._element),de(this)};var $k=d5;var JEe=1e3;function Sd(e){if(!c(e)||!c(e.scene))throw new E("options.scene is required.");c(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new RA({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._wasGeocodeCancelled=!1,this._previousCredits=[],this._complete=new pe,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=tSe,this._handleArrowUp=eSe;let t=this;this._suggestionsVisible=xe.pureComputed(function(){let o=xe.getObservable(t,"_suggestions")().length>0,r=xe.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=Sn(function(i){if(i=i??W0.SEARCH,t._focusTextbox=!1,c(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;if(t.hideSuggestions(),t.isSearchInProgress)mvt(t);else return dvt(t,t._geocoderServices,i)}),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(i,o){let r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38;return(r||s)&&o.preventDefault(),!0},this.handleKeyUp=function(i,o){let r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38,a=o.key==="Enter"||o.keyCode===13;return s?eSe(t):r?tSe(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;let o=i.destination;oSe(t),t.destinationFound(t,o)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(i,o){i!==t._selectedSuggestion&&(t._selectedSuggestion=i)},this.keepExpanded=!1,this.autoComplete=e.autocomplete??!0,this.destinationFound=e.destinationFound??Sd.flyToDestination,this._focusTextbox=!1,xe.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);let n=xe.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){Sd._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,xe.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,xe.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){if(typeof i!="string")throw new E("value must be a valid string.");this._searchText=i}}),this.flightDuration=void 0,xe.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){if(c(i)&&i<0)throw new E("value must be positive.");this._flightDuration=i}})}Object.defineProperties(Sd.prototype,{complete:{get:function(){return this._complete}},scene:{get:function(){return this._scene}},search:{get:function(){return this._searchCommand}},selectedSuggestion:{get:function(){return this._selectedSuggestion}},suggestions:{get:function(){return this._suggestions}}});Sd.prototype.destroy=function(){this._suggestionSubscription.dispose()};function eSe(e){if(e._suggestions.length===0)return;let t=e._suggestions.indexOf(e._selectedSuggestion);if(t===-1||t===0){e._selectedSuggestion=void 0;return}let n=t-1;e._selectedSuggestion=e._suggestions[n],Sd._adjustSuggestionsScroll(e,n)}function tSe(e){if(e._suggestions.length===0)return;let t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],Sd._adjustSuggestionsScroll(e,i)}function lvt(e,t){let n=c(t)?t.availability:void 0;return c(n)?UT(t,[e]).then(function(i){return e=i[0],e.height+=JEe,e}):(e.height+=JEe,Promise.resolve(e))}function uvt(e,t){let n=e._scene,i=n.ellipsoid,o=n.camera,r=n.terrainProvider,s=t,a;return t instanceof ce?O.equalsEpsilon(t.south,t.north,O.EPSILON7)&&O.equalsEpsilon(t.east,t.west,O.EPSILON7)?t=ce.center(t):a=VT(t,n):t=i.cartesianToCartographic(t),c(a)||(a=lvt(t,r)),a.then(function(l){s=i.cartographicToCartesian(l)}).finally(function(){o.flyTo({destination:s,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:B.IDENTITY})})}async function fvt(e,t,n){try{return{state:"fulfilled",value:await e.geocode(t,n),credits:e.credit}}catch(i){return{state:"rejected",reason:i}}}async function dvt(e,t,n){let i=e._searchText;if(iSe(i)){e.showSuggestions();return}e._isSearchInProgress=!0,e._wasGeocodeCancelled=!1;let o,r;for(o=0;o<t.length;o++){if(e._wasGeocodeCancelled)return;if(r=await fvt(t[o],i,n),c(r)&&r.state==="fulfilled"&&r.value.length>0)break}if(e._wasGeocodeCancelled)return;e._isSearchInProgress=!1,qQ(e);let s=r.value;if(r.state==="fulfilled"&&c(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);let a=nSe(e,Yw.getCreditsFromResult(s[0]));c(a)||WQ(e,t[o].credit);return}e._searchText=`${i} (not found)`}function WQ(e,t){c(t)&&!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&(e._scene.frameState.creditDisplay.addStaticCredit(t),e._previousCredits.push(t))}function nSe(e,t){return c(t)&&t.forEach(n=>WQ(e,n)),t}function qQ(e){!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&e._previousCredits.forEach(t=>{e._scene.frameState.creditDisplay.removeStaticCredit(t)}),e._previousCredits.length=0}function hvt(e,t){let n=In(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(t===0){i.scrollTop=0;return}let s=r.offsetTop;s+r.clientHeight>i.clientHeight?i.scrollTop=s+r.clientHeight:s<i.scrollTop&&(i.scrollTop=s)}function mvt(e){e._isSearchInProgress&&(e._isSearchInProgress=!1,e._wasGeocodeCancelled=!0)}function iSe(e){return/^\s*$/.test(e)}function oSe(e){xe.getObservable(e,"_suggestions").removeAll()}async function pvt(e){if(!e.autoComplete)return;let t=e._searchText;if(oSe(e),qQ(e),!iSe(t))for(let n of e._geocoderServices){let i=await n.geocode(t,W0.AUTOCOMPLETE);if(e._suggestions=e._suggestions.concat(i),i.length>0){let o=!0;i.forEach(r=>{let s=Yw.getCreditsFromResult(r);o=o&&!c(s),nSe(e,s)}),o&&WQ(e,n.credit)}if(e._suggestions.length>=5)return}}Sd.flyToDestination=uvt;Sd._updateSearchSuggestions=pvt;Sd._adjustSuggestionsScroll=hvt;Sd.prototype.isDestroyed=function(){return!1};Sd.prototype.destroy=function(){return qQ(this),de(this)};var Zk=Sd;var _vt="M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z",gvt="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z";function h5(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");if(!c(e.scene))throw new E("options.scene is required.");let t=In(e.container),n=new Zk(e);n._startSearchPath=_vt,n._stopSearchPath=gvt;let i=document.createElement("form");i.setAttribute("data-bind","submit: search");let o=document.createElement("input");o.type="search",o.className="cesium-geocoder-input",o.setAttribute("placeholder","Enter an address or landmark..."),o.setAttribute("data-bind",'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'),this._onTextBoxFocus=function(){setTimeout(function(){o.select()},0)},o.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(o),this._textBox=o;let r=document.createElement("span");r.className="cesium-geocoder-searchButton",r.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(r),t.appendChild(i);let s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");let a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");let l=document.createElement("li");a.appendChild(l),l.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),xe.applyBindings(n,i),xe.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let f=u.target;typeof u.composedPath=="function"&&(f=u.composedPath()[0]),t.contains(f)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},Vt.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),t.addEventListener("pointerup",this._onInputEnd,!0),t.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),t.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),t.addEventListener("touchend",this._onInputEnd,!0),t.addEventListener("touchcancel",this._onInputEnd,!0))}Object.defineProperties(h5.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});h5.prototype.isDestroyed=function(){return!1};h5.prototype.destroy=function(){let e=this._container;return Vt.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),e.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),e.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),e.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),xe.cleanNode(this._form),xe.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),de(this)};var Qk=h5;function yvt(e,t){t.currentTarget.parentElement.parentElement.querySelector(`#${e.name}-expander`).classList.toggle("active"),t.currentTarget.textContent=t.currentTarget.textContent==="+"?"-":"+"}function sSe(e,t){xe.track(e);for(let n=0;n<e.sublayers.length;n++)sSe(e.sublayers[n],t)}function m5(e){return e.modelName==="FullModel"}function aSe(e){return e.modelName==="Overview"}function cSe(e){return aSe(e)||m5(e)}function rSe(e,t){if(cSe(e)){e.visibility=!1;for(let i=0;i<e.sublayers.length;i++)e.sublayers[i].visibility=!0;let n={name:e.name,modelName:e.modelName,disable:xe.observable(!1),index:t.sublayers.length};return t.topLayers.push(n),t.sublayers.push(e),n}}function bvt(e,t){if(cSe(e)){t.sublayers.forEach(i=>i.visibility=!1),t.sublayers[e.index].visibility=!0;let n=document.getElementById("bsl-wrapper");m5(e)?(t.currentLevel=t.selectedLevel,n.style.display="block"):(t.selectedLevel=t.currentLevel,t.currentLevel="All",n.style.display="none")}}async function xvt(e,t){try{let n=e.getAttributeNames();for(let i=0;i<n.length;i++)if(n[i]==="BldgLevel"){let o=e.getAttributeValues(n[i]);for(let r=0;r<o.length;r++)t.push(o[r])}t.sort((i,o)=>i-o),t.unshift("All")}catch(n){console.log(`There was an error getting attributes: ${n}`)}}function Tvt(e){let t=this;this.levels=[],this.viewModel={sublayers:[],levels:this.levels,currentLevel:xe.observable(),selectedLevel:"All",topLayers:[{name:"Select a layer to explore...",disable:xe.observable(!0),index:-1}],currentLayer:xe.observable(),expandClickHandler:yvt,setOptionDisable:function(i,o){xe.applyBindingsToNode(i,{disable:o.disable},o)},defaultLayer:void 0},this.viewModel.currentLayer.subscribe(function(i){bvt(i,t.viewModel)});let n=e.sublayers;for(let i=0;i<n.length;i++){sSe(n[i],this.viewModel);let o=rSe(n[i],this.viewModel);c(o)&&(aSe(o)||!c(this.viewModel.defaultLayer)&&m5(o))&&(this.viewModel.defaultLayer=o)}if(this.viewModel.topLayers.length===1&&n.length>0){e.show=!1;let i={name:"Full Model",modelName:"FullModel",visibility:e.show,sublayers:e.sublayers};this.viewModel.defaultLayer=rSe(i,this.viewModel),this.viewModel.currentLayer.subscribe(function(o){e.show=m5(o)})}else this.viewModel.topLayers.length===1&&(this.viewModel.topLayers[0].name="Building layers not found");return xvt(e,this.levels),this.viewModel.currentLevel.subscribe(function(i){i!=="All"?e.filterByAttributes([{name:"BldgLevel",values:[i]}]):e.filterByAttributes()}),this.viewModel}var Jk=Tvt;function Avt(e,t){let n=document.getElementById(e);T.defined("container",n),T.defined("i3sProvider",t);let i=document.createElement("div");i.classList.add("cesium-viewer-i3s-explorer"),i.innerHTML=`
        <h3>Building explorer</h3>
        <select
          data-bind="options: topLayers, optionsText: 'name', optionsAfterRender: setOptionDisable, value: currentLayer"
        ></select>
        <div id="bsl-wrapper">
          <h3>Select Level</h3>
          <select data-bind="options: levels, value: currentLevel"></select>
          <h3>Disciplines & Categories</h3>
          <ul class="layersList" data-bind="foreach: sublayers">
            <ul class="layersList" data-bind="foreach: sublayers.sort(function (l, r) { return l.name.localeCompare(r.name) })">
              <li>
                <div class="li-wrapper">
                  <span
                    class="expandItem"
                    data-bind="click: $root.expandClickHandler"
                    >+</span
                  >
                  <input
                    type="checkbox"
                    data-bind="checked: visibility, valueUpdate: 'input', attr: { id: name}"
                  />
                  <label data-bind="attr: { for: name}">
                    <span data-bind="text: name"></span>
                  </label>
                </div>
                <ul class="nested" data-bind="attr: { id: name + '-expander'}">
                  <li data-bind="foreach: sublayers.sort(function (l, r) { return l.name.localeCompare(r.name) })">
                    <div class="li-wrapper">
                      <input
                        type="checkbox"
                        data-bind="checked: visibility, valueUpdate: 'input', attr: { id: name}"
                      />
                      <label data-bind="attr: { for: name}">
                        <span data-bind="text: name"></span>
                      </label>
                    </div>
                  </li>
                </ul>
              </li>
            </ul>
          </ul>
        </div>`,n.appendChild(i);let o=new Jk(t);xe.track(o),xe.applyBindings(o,n),c(o.defaultLayer)&&(o.currentLayer=o.defaultLayer)}var YQ=Avt;var Cvt="M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z",Evt="M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";function XQ(){this._cameraClicked=new pe,this._closeClicked=new pe,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",xe.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,xe.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?Evt:Cvt}}),xe.defineProperty(this,"_bodyless",{get:function(){return!c(this.description)||this.description.length===0}})}XQ.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(XQ.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});var eU=XQ;function p5(e){T.defined("container",e),e=In(e);let t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);let n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);let i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);let o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="&times;",t.appendChild(o);let r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);let s=new eU;xe.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;let a=this;r.addEventListener("load",function(){let l=r.contentDocument,u=l.createElement("link");u.href=tn("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";let f=l.createElement("div");f.className="cesium-infoBox-description",l.head.appendChild(u),l.body.appendChild(f),a._descriptionSubscription=Da(s,"description",function(h){r.style.height="5px",f.innerHTML=h;let p=null,g=f.firstElementChild;if(g!==null&&f.childNodes.length===1){let y=window.getComputedStyle(g);if(y!==null){let b=y["background-color"],x=G.fromCssColorString(b);c(x)&&x.alpha!==0&&(p=y["background-color"])}}t.style["background-color"]=p;let m=f.getBoundingClientRect().height;r.style.height=`${m}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(p5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});p5.prototype.isDestroyed=function(){return!1};p5.prototype.destroy=function(){let e=this._container;return xe.cleanNode(this._element),e.removeChild(this._element),c(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),de(this)};var tU=p5;function _5(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof on,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,xe.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);let t=this;xe.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=Sn(function(){t.sceneMode===oe.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new gr,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===oe.SCENE2D||t._scene.camera.frustum instanceof on}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=c(e.camera._currentFlight)}),this._switchToPerspective=Sn(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=Sn(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=oe}Object.defineProperties(_5.prototype,{scene:{get:function(){return this._scene}},toggleDropDown:{get:function(){return this._toggleDropDown}},switchToPerspective:{get:function(){return this._switchToPerspective}},switchToOrthographic:{get:function(){return this._switchToOrthographic}},isOrthographicProjection:{get:function(){return this._orthographic}}});_5.prototype.isDestroyed=function(){return!1};_5.prototype.destroy=function(){this._eventHelper.removeAll(),de(this)};var nU=_5;var Svt="M 28.15625,10.4375 9.125,13.21875 13.75,43.25 41.75,55.09375 50.8125,37 54.5,11.9375 z m 0.125,3 19.976451,0.394265 L 43.03125,16.875 22.6875,14.28125 z M 50.971746,15.705477 47.90625,36.03125 42.53125,46 44.84375,19.3125 z M 12.625,16.03125 l 29.15625,3.6875 -2.65625,31 L 16.4375,41.125 z",wvt="m 31.560594,6.5254438 -20.75,12.4687502 0.1875,24.5625 22.28125,11.8125 19.5,-12 0.65625,-0.375 0,-0.75 0.0312,-23.21875 z m 0.0625,3.125 16.65625,9.5000002 -16.125,10.28125 -17.34375,-9.71875 z m 18.96875,11.1875002 0.15625,20.65625 -17.46875,10.59375 0.15625,-20.28125 z m -37.0625,1.25 17.21875,9.625 -0.15625,19.21875 -16.9375,-9 z";function g5(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=In(e);let n=new nU(t);n._perspectivePath=Svt,n._orthographicPath=wvt;let i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);let o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.setAttribute("data-bind",'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic,       "cesium-projectionPicker-buttonOrthographic": _orthographic,       "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress,        "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),o.innerHTML='<!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --><!-- /ko -->',i.appendChild(o);let r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",r.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic),       "cesium-projectionPicker-none" : !_orthographic,       "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'),i.appendChild(r);let s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic),       "cesium-projectionPicker-none" : _orthographic,       "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'),i.appendChild(s),xe.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},Vt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(g5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});g5.prototype.isDestroyed=function(){return!1};g5.prototype.destroy=function(){return this._viewModel.destroy(),Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),xe.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),de(this)};var iU=g5;function KQ(e){if(!c(e)||!c(e.scene))throw new E("options.scene is required.");this._scene=e.scene,this.lowFrameRateMessage=e.lowFrameRateMessage??"This application appears to be performing poorly on your system.  Please try using a different web browser or updating your video drivers.",this.lowFrameRateMessageDismissed=!1,this.showingLowFrameRateMessage=!1,xe.track(this,["lowFrameRateMessage","lowFrameRateMessageDismissed","showingLowFrameRateMessage"]);let t=this;this._dismissMessage=Sn(function(){t.showingLowFrameRateMessage=!1,t.lowFrameRateMessageDismissed=!0});let n=dk.fromScene(e.scene);this._unsubscribeLowFrameRate=n.lowFrameRate.addEventListener(function(){t.lowFrameRateMessageDismissed||(t.showingLowFrameRateMessage=!0)}),this._unsubscribeNominalFrameRate=n.nominalFrameRate.addEventListener(function(){t.showingLowFrameRateMessage=!1})}Object.defineProperties(KQ.prototype,{scene:{get:function(){return this._scene}},dismissMessage:{get:function(){return this._dismissMessage}}});KQ.prototype.destroy=function(){return this._unsubscribeLowFrameRate(),this._unsubscribeNominalFrameRate(),de(this)};var oU=KQ;function y5(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");if(!c(e.scene))throw new E("options.scene is required.");let t=In(e.container),n=new oU(e),i=document.createElement("div");i.className="cesium-performance-watchdog-message-area",i.setAttribute("data-bind","visible: showingLowFrameRateMessage");let o=document.createElement("button");o.setAttribute("type","button"),o.className="cesium-performance-watchdog-message-dismiss",o.innerHTML="&times;",o.setAttribute("data-bind","click: dismissMessage"),i.appendChild(o);let r=document.createElement("div");r.className="cesium-performance-watchdog-message",r.setAttribute("data-bind","html: lowFrameRateMessage"),i.appendChild(r),t.appendChild(i),xe.applyBindings(n,i),this._container=t,this._viewModel=n,this._element=i}Object.defineProperties(y5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});y5.prototype.isDestroyed=function(){return!1};y5.prototype.destroy=function(){return this._viewModel.destroy(),xe.cleanNode(this._element),this._container.removeChild(this._element),de(this)};var rU=y5;function lSe(){this.showInstructions=!1;let e=this;this._command=Sn(function(){e.showInstructions=!e.showInstructions}),this._showClick=Sn(function(){e._touch=!1}),this._showTouch=Sn(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",xe.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(lSe.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});var sU=lSe;function b5(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");let t=In(e.container),n=new sU,i=e.instructionsInitiallyVisible??!1;n.showInstructions=i,n._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";let o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);let r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),o.appendChild(r);let s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);let a=document.createElement("button");a.type="button",a.className="cesium-navigation-button cesium-navigation-button-left",a.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');let l=document.createElement("img");l.src=tn("Widgets/Images/NavigationHelp/Mouse.svg"),l.className="cesium-navigation-button-icon",l.style.width="25px",l.style.height="25px",a.appendChild(l),a.appendChild(document.createTextNode("Mouse"));let u=document.createElement("button");u.type="button",u.className="cesium-navigation-button cesium-navigation-button-right",u.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');let f=document.createElement("img");f.src=tn("Widgets/Images/NavigationHelp/Touch.svg"),f.className="cesium-navigation-button-icon",f.style.width="25px",f.style.height="25px",u.appendChild(f),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);let h=document.createElement("div");h.className="cesium-click-navigation-help cesium-navigation-help-instructions",h.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),h.innerHTML=`            <table>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/MouseLeft.svg")}" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-pan">Pan view</div>                        <div class="cesium-navigation-help-details">Left click + drag</div>                    </td>                </tr>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/MouseRight.svg")}" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-zoom">Zoom view</div>                        <div class="cesium-navigation-help-details">Right click + drag, or</div>                        <div class="cesium-navigation-help-details">Mouse wheel scroll</div>                    </td>                </tr>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/MouseMiddle.svg")}" width="48" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-rotate">Rotate view</div>                        <div class="cesium-navigation-help-details">Middle click + drag, or</div>                        <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div>                    </td>                </tr>            </table>`,s.appendChild(h);let p=document.createElement("div");p.className="cesium-touch-navigation-help cesium-navigation-help-instructions",p.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),p.innerHTML=`            <table>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/TouchDrag.svg")}" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-pan">Pan view</div>                        <div class="cesium-navigation-help-details">One finger drag</div>                    </td>                </tr>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/TouchZoom.svg")}" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-zoom">Zoom view</div>                        <div class="cesium-navigation-help-details">Two finger pinch</div>                    </td>                </tr>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/TouchTilt.svg")}" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-rotate">Tilt view</div>                        <div class="cesium-navigation-help-details">Two finger drag, same direction</div>                    </td>                </tr>                <tr>                    <td><img src="${tn("Widgets/Images/NavigationHelp/TouchRotate.svg")}" width="70" height="48" /></td>                    <td>                        <div class="cesium-navigation-help-tilt">Rotate view</div>                        <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div>                    </td>                </tr>            </table>`,s.appendChild(p),xe.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},Vt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(b5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});b5.prototype.isDestroyed=function(){return!1};b5.prototype.destroy=function(){return Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),xe.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),de(this)};var aU=b5;var vvt=new H,x5="-1000px";function cU(e,t,n){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("selectionIndicatorElement is required.");if(!c(n))throw new E("container is required.");this._scene=e,this._screenPositionX=x5,this._screenPositionY=x5,this._tweens=e.tweens,this._container=n??document.body,this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,xe.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,xe.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&c(this.position)}}),xe.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return Gi.worldToWindowCoordinates(e,i,o)}}cU.prototype.update=function(){if(this.showSelection&&c(this.position)){let e=this.computeScreenSpacePosition(this.position,vvt);if(!c(e))this._screenPositionX=x5,this._screenPositionY=x5;else{let t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,r=o*.5;e.x=Math.min(Math.max(e.x,-o),n+o)-r,e.y=Math.min(Math.max(e.y,-o),i+o)-r,this._screenPositionX=`${Math.floor(e.x+.25)}px`,this._screenPositionY=`${Math.floor(e.y+.25)}px`}}};cU.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:Qr.EXPONENTIAL_OUT})};cU.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:Qr.EXPONENTIAL_OUT})};Object.defineProperties(cU.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});var lU=cU;function T5(e,t){if(!c(e))throw new E("container is required.");e=In(e),this._container=e;let n=document.createElement("div");n.className="cesium-selection-wrapper",n.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(n),this._element=n;let i="http://www.w3.org/2000/svg",o="M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z",r=document.createElementNS(i,"svg:svg");r.setAttribute("width",160),r.setAttribute("height",160),r.setAttribute("viewBox","0 0 160 160");let s=document.createElementNS(i,"g");s.setAttribute("transform","translate(80,80)"),r.appendChild(s);let a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d",o),s.appendChild(a),n.appendChild(r);let l=new lU(t,this._element,this._container);this._viewModel=l,xe.applyBindings(this._viewModel,this._element)}Object.defineProperties(T5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});T5.prototype.isDestroyed=function(){return!1};T5.prototype.destroy=function(){let e=this._container;return xe.cleanNode(this._element),e.removeChild(this._element),de(this)};var uU=T5;function A5(e,t){if(!c(e))throw new E("scene is required.");this._scene=e;let n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new gr,this._eventHelper.add(e.morphStart,i),this._duration=t??2,this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",xe.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,xe.defineProperty(this,"selectedTooltip",function(){let o=n.sceneMode;return o===oe.SCENE2D?n.tooltip2D:o===oe.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=Sn(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=Sn(function(){e.morphTo2D(n._duration)}),this._morphTo3D=Sn(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=Sn(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=oe}Object.defineProperties(A5.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new E("duration value must be positive.");this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}});A5.prototype.isDestroyed=function(){return!1};A5.prototype.destroy=function(){this._eventHelper.removeAll(),de(this)};var fU=A5;var Dvt="m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878         -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132         -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285         11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z         M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201         5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461         -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z",Pvt="m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z",Ivt="m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z";function C5(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=In(e);let i=new fU(t,n);i._globePath=Dvt,i._flatMapPath=Pvt,i._columbusViewPath=Ivt;let o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);let r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind",'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D,       "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D,       "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW,       "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),r.innerHTML='<!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --><!-- /ko -->',o.appendChild(r);let s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)),       "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D,       "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'),o.appendChild(s);let a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)),       "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D,       "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),o.appendChild(a);let l=document.createElement("button");l.type="button",l.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",l.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)),       "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW,       "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'),o.appendChild(l),xe.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},Vt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(C5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});C5.prototype.isDestroyed=function(){return!1};C5.prototype.destroy=function(){return this._viewModel.destroy(),Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),xe.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),de(this)};var dU=C5;function WA(e,t,n){this._color=e,this._height=t,this._base=n??0}WA.prototype.getHeight=function(){return this._height};WA.prototype.getBase=function(){return this._base};WA.prototype.getStartTime=function(){return this._start};WA.prototype.getStopTime=function(){return this._stop};WA.prototype.setRange=function(e,t){this._start=e,this._stop=t};WA.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){let n=Q.secondsDifference(this._start,e.epochJulian),i=Math.round(e.timeBarWidth*e.getAlpha(n)),o=Q.secondsDifference(this._stop,e.epochJulian),r=Math.round(e.timeBarWidth*e.getAlpha(o))-i;i<0&&(r+=i,i=0),i+r>e.timeBarWidth&&(r=e.timeBarWidth-i),r>0&&(t=`<span class="cesium-timeline-highlight" style="left: ${i.toString()}px; width: ${r.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`)}return t};var hU=WA;function uSe(e,t,n,i){this.interval=e,this.height=t,this.color=n||new G(.5,.5,.5,1),this.backgroundColor=i||new G(0,0,0,0)}uSe.prototype.render=function(e,t){let n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=Q.addSeconds(t.startJulian,t.duration,new Q);if(Q.lessThan(n,o)&&Q.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(Q.lessThanOrEquals(n,r)&&Q.greaterThanOrEquals(i,o)){let s,a,l;for(s=0;s<t.timeBarWidth;++s){let u=Q.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new Q);!c(a)&&Q.greaterThanOrEquals(u,n)?a=s:!c(l)&&Q.greaterThanOrEquals(u,i)&&(l=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),c(a)&&(c(l)||(l=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(l-a,1),this.height))}};var mU=uSe;var $Q=1e12,wd={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},Al={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},eb=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],Ovt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Cl(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("clock is required.");e=In(e);let n=e.ownerDocument;this.container=e;let i=n.createElement("div");i.className="cesium-timeline-main",e.appendChild(i),this._topDiv=i,this._endJulian=void 0,this._epochJulian=void 0,this._lastXPos=void 0,this._scrubElement=void 0,this._startJulian=void 0,this._timeBarSecondsSpan=void 0,this._clock=t,this._scrubJulian=t.currentTime,this._mainTicSpan=-1,this._mouseMode=wd.none,this._touchMode=Al.none,this._touchState={centerX:0,spanX:0},this._mouseX=0,this._timelineDrag=0,this._timelineDragLocation=void 0,this._lastHeight=void 0,this._lastWidth=void 0,this._topDiv.innerHTML='<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>',this._timeBarEle=this._topDiv.childNodes[0],this._trackContainer=this._topDiv.childNodes[1],this._trackListEle=this._topDiv.childNodes[1].childNodes[0],this._needleEle=this._topDiv.childNodes[2],this._rulerEle=this._topDiv.childNodes[3],this._context=this._trackListEle.getContext("2d"),this._trackList=[],this._highlightRanges=[],this.zoomTo(t.startTime,t.stopTime),this._onMouseDown=Rvt(this),this._onMouseUp=Mvt(this),this._onMouseMove=Lvt(this),this._onMouseWheel=Nvt(this),this._onTouchStart=Fvt(this),this._onTouchMove=kvt(this),this._onTouchEnd=Bvt(this);let o=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.addEventListener("mousemove",this._onMouseMove,!1),o.addEventListener("mousedown",this._onMouseDown,!1),o.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),o.addEventListener("mousewheel",this._onMouseWheel,!1),o.addEventListener("touchstart",this._onTouchStart,!1),o.addEventListener("touchmove",this._onTouchMove,!1),o.addEventListener("touchend",this._onTouchEnd,!1),o.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}Cl.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};Cl.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};Cl.prototype.isDestroyed=function(){return!1};Cl.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);let e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);let t=this._timeBarEle;t.removeEventListener("mousedown",this._onMouseDown,!1),t.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),t.removeEventListener("mousewheel",this._onMouseWheel,!1),t.removeEventListener("touchstart",this._onTouchStart,!1),t.removeEventListener("touchmove",this._onTouchMove,!1),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),de(this)};Cl.prototype.addHighlightRange=function(e,t,n){let i=new hU(e,t,n);return this._highlightRanges.push(i),this.resize(),i};Cl.prototype.addTrack=function(e,t,n,i){let o=new mU(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};Cl.prototype.zoomTo=function(e,t){if(!c(e))throw new E("startTime is required.");if(!c(t))throw new E("stopTime is required");if(Q.lessThanOrEquals(t,e))throw new E("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=Q.secondsDifference(t,e),this._clock&&this._clock.clockRange!==$r.UNBOUNDED){let i=this._clock.startTime,o=this._clock.stopTime,r=Q.secondsDifference(o,i),s=Q.secondsDifference(i,this._startJulian),a=Q.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=Q.addSeconds(this._endJulian,s,new Q),this._startJulian=i,this._timeBarSecondsSpan=Q.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=Q.addSeconds(this._startJulian,a,new Q),this._endJulian=o,this._timeBarSecondsSpan=Q.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();let n=document.createEvent("Event");n.initEvent("setzoom",!0,!0),n.startJulian=this._startJulian,n.endJulian=this._endJulian,n.epochJulian=this._epochJulian,n.totalSpan=this._timeBarSecondsSpan,n.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(n)};Cl.prototype.zoomFrom=function(e){let t=Q.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=this._timeBarSecondsSpan*.5:t+=t-this._timeBarSecondsSpan*.5;let n=this._timeBarSecondsSpan-t;this.zoomTo(Q.addSeconds(this._startJulian,t-t*e,new Q),Q.addSeconds(this._endJulian,n*e-n,new Q))};function ZQ(e){return e<10?`0${e.toString()}`:e.toString()}Cl.prototype.makeLabel=function(e){let t=Q.toGregorianDate(e),n=t.millisecond,i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i=`0${i}`;i=`.${i}`}return`${Ovt[t.month-1]} ${t.day} ${t.year} ${ZQ(t.hour)}:${ZQ(t.minute)}:${ZQ(t.second)}${i}`};Cl.prototype.smallestTicInPixels=7;Cl.prototype._makeTics=function(){let e=this._timeBarEle,t=Q.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8,o,r=this;this._needleEle.style.left=`${n.toString()}px`;let s="",a=.01,l=31536e6,u=1e-10,f=0,h=this._timeBarSecondsSpan;h<a?(h=a,this._timeBarSecondsSpan=a,this._endJulian=Q.addSeconds(this._startJulian,a,new Q)):h>l&&(h=l,this._timeBarSecondsSpan=l,this._endJulian=Q.addSeconds(this._startJulian,l,new Q));let p=this._timeBarEle.clientWidth;p<10&&(p=10);let g=this._startJulian,m=Math.min(h/p*1e-5,.4),y,b=Q.toGregorianDate(g);h>31536e4?y=Q.fromDate(new Date(Date.UTC(Math.floor(b.year/100)*100,0))):h>31536e3?y=Q.fromDate(new Date(Date.UTC(Math.floor(b.year/10)*10,0))):h>86400?y=Q.fromDate(new Date(Date.UTC(b.year,0))):y=Q.fromDate(new Date(Date.UTC(b.year,b.month,b.day)));let x=Q.secondsDifference(this._startJulian,Q.addSeconds(y,m,new Q)),A=x+h;this._epochJulian=y;function C(U){return Math.floor(x/U)*U}function S(U,q){return Math.ceil(U/q+.5)*q}function v(U){return(U-x)/h}function P(U,q){return U-q*Math.round(U/q)}this._rulerEle.innerHTML=this.makeLabel(Q.addSeconds(this._endJulian,-a,new Q));let M=this._rulerEle.offsetWidth+20;M<30&&(M=180);let R=f;f-=u;let L={startTime:x,startJulian:g,epochJulian:y,duration:h,timeBarWidth:p,getAlpha:v};this._highlightRanges.forEach(function(U){s+=U.render(L)});let F=0,_=0,w=0,D=M/p;D>1&&(D=1),D*=this._timeBarSecondsSpan;let I=-1,N=-1,k=eb.length,z;for(z=0;z<k;++z){let U=eb[z];if(++I,F=U,U>D&&U>f)break;N<0&&p*(U/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(N=I)}if(I>0){for(;I>0;)if(--I,Math.abs(P(F,eb[I]))<1e-5){eb[I]>=f&&(_=eb[I]);break}if(N>=0)for(;N<I;){if(Math.abs(P(_,eb[N]))<1e-5&&eb[N]>=f){w=eb[N];break}++N}}f=R,f>u&&w<1e-5&&Math.abs(f-F)>u&&(w=f,f<=F+u&&(_=0));let V=-999999,j;if(p*(w/this._timeBarSecondsSpan)>=3)for(o=C(w);o<=A;o=S(o,w))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(p*v(o)).toString()}px;"></span>`;if(p*(_/this._timeBarSecondsSpan)>=3)for(o=C(_);o<=A;o=S(o,_))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(p*v(o)).toString()}px;"></span>`;if(p*(F/this._timeBarSecondsSpan)>=2){this._mainTicSpan=F,A+=F,o=C(F);let U=Q.computeTaiMinusUtc(y);for(;o<=A;){let q=Q.addSeconds(g,o-x,new Q);if(F>2.1){let Z=Q.computeTaiMinusUtc(q);Math.abs(Z-U)>.1&&(o+=Z-U,q=Q.addSeconds(g,o-x,new Q))}let Y=Math.round(p*v(o)),te=this.makeLabel(q);this._rulerEle.innerHTML=te,j=this._rulerEle.offsetWidth,j<10&&(j=M);let K=Y-(j/2-1);K>V?(V=K+j+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${Y.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${K.toString()}px;">${te}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${Y.toString()}px;"></span>`,o=S(o,F)}}else this._mainTicSpan=-1;s+=`<span class="cesium-timeline-icon16" style="left:${i}px;bottom:0;background-position: 0 0;"></span>`,e.innerHTML=s,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),L.y=0,this._trackList.forEach(function(U){U.render(r._context,L),L.y+=U.height})};Cl.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;let e=this._scrubElement;if(c(this._scrubElement)){let t=Q.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==n&&(this._lastXPos=n,e.style.left=`${n-8}px`,this._needleEle.style.left=`${n}px`)}c(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(Q.addSeconds(this._startJulian,this._timelineDrag,new Q),Q.addSeconds(this._endJulian,this._timelineDrag,new Q)))};Cl.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=Q.addSeconds(this._startJulian,t,new Q),this._scrubElement){let i=e-8;this._scrubElement.style.left=`${i.toString()}px`,this._needleEle.style.left=`${e.toString()}px`}let n=document.createEvent("Event");n.initEvent("settime",!0,!0),n.clientX=e,n.timeSeconds=t,n.timeJulian=this._scrubJulian,n.clock=this._clock,this._topDiv.dispatchEvent(n)};function Rvt(e){return function(t){e._mouseMode!==wd.touchOnly&&(t.button===0?(e._mouseMode=wd.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=wd.zoom:e._mouseMode=wd.slide)),t.preventDefault()}}function Mvt(e){return function(t){e._mouseMode=wd.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function Lvt(e){return function(t){let n;if(e._mouseMode===wd.scrub){t.preventDefault();let i=t.clientX-e._topDiv.getBoundingClientRect().left;i<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):i>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===wd.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){let i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(Q.addSeconds(e._startJulian,i,new Q),Q.addSeconds(e._endJulian,i,new Q))}}else e._mouseMode===wd.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function Nvt(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;$Q=Math.max(Math.min(Math.abs(n),$Q),1),n/=$Q,e.zoomFrom(Math.pow(1.05,-n))}}function Fvt(e){return function(t){let n=t.touches.length,i,o,r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=wd.touchOnly,n===1?(i=Q.secondsDifference(e._scrubJulian,e._startJulian),o=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+r),Math.abs(t.touches[0].clientX-o)<50?(e._touchMode=Al.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=Al.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=Al.slideZoom,e._touchState.centerX=(t.touches[0].clientX+t.touches[1].clientX)*.5-r,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=Al.ignore}}function Bvt(e){return function(t){let n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===Al.singleTap?(e._touchMode=Al.scrub,e._onTouchMove(t)):e._touchMode===Al.scrub&&e._onTouchMove(t),e._mouseMode=wd.touchOnly,n!==1?e._touchMode=n>0?Al.ignore:Al.none:e._touchMode===Al.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function kvt(e){return function(t){let n,i,o,r,s,a,l=1,u=e._topDiv.getBoundingClientRect().left;e._touchMode===Al.singleTap&&(e._touchMode=Al.slideZoom),e._mouseMode=wd.touchOnly,e._touchMode===Al.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-u,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===Al.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-u,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-u,s=0),c(r)&&(s>0&&e._touchState.spanX>0?(l=e._touchState.spanX/s,a=Q.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*l)/e._topDiv.clientWidth,new Q)):(n=e._touchState.centerX-r,a=Q.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new Q)),e.zoomTo(a,Q.addSeconds(a,e._timeBarSecondsSpan*l,new Q)),e._touchState.centerX=r,e._touchState.spanX=s))}}Cl.prototype.resize=function(){let e=this.container.clientWidth,t=this.container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;this._trackContainer.style.height=`${t}px`;let n=1;this._trackList.forEach(function(i){n+=i.height}),this._trackListEle.style.height=`${n.toString()}px`,this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=n,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t};var pU=Cl;function fSe(e){let t=e.split(`
`),n;for(n=0;n<t.length&&!t[n].match(/\S/);n++);if(n===t.length)return"";let i="",o=/^\s*/,s=t[n].match(o)[0].length;for(let a=n;a<t.length;a++){let l=t[a];l.match(o)[0].length>=s&&(l=l.slice(s)),i+=`${l}
`}return i}function vd(e){T.typeOf.object("scene",e),this._scene=e,this._voxelPrimitive=void 0,this._customShaderCompilationRemoveCallback=void 0,this._definedProperties=[],this._getPrimitiveFunctions=[],this._modelMatrixReady=!1;let t=this;function n(o){let{name:r,initialValue:s}=o;t._definedProperties.push(r);let a=o.setPrimitiveFunction;a===!0&&(a=function(f){t._voxelPrimitive[r]=f});let l=o.getPrimitiveFunction;l===!0&&(l=function(){t[r]=t._voxelPrimitive[r]}),c(l)&&t._getPrimitiveFunctions.push(l);let u=xe.observable();return xe.defineProperty(t,r,{get:function(){return u()},set:function(f){typeof s=="number"&&typeof f=="string"&&(f=Number(f),isNaN(f)&&(f=s)),typeof s=="boolean"&&typeof f=="number"&&(f=f===1),u(f),c(a)&&c(t._voxelPrimitive)&&(a(f),e.requestRender())}}),t[r]=s,u}function i(o,r){return function(s){let a=t._voxelPrimitive[o].clone();a[r]=s,t._voxelPrimitive[o]=a}}n({name:"inspectorVisible",initialValue:!0}),n({name:"displayVisible",initialValue:!1}),n({name:"transformVisible",initialValue:!1}),n({name:"boundsVisible",initialValue:!1}),n({name:"clippingVisible",initialValue:!1}),n({name:"shaderVisible",initialValue:!1}),n({name:"shaderString",initialValue:"",getPrimitiveFunction:function(){let o=t._voxelPrimitive.customShader.fragmentShaderText;t.shaderString=fSe(o)}}),n({name:"shaderCompilationMessage",initialValue:""}),n({name:"shaderCompilationSuccess",initialValue:!0}),n({name:"depthTest",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"show",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"disableUpdate",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"debugDraw",initialValue:!1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"jitter",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"nearestSampling",initialValue:!0,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"screenSpaceError",initialValue:4,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"stepSize",initialValue:1,setPrimitiveFunction:!0,getPrimitiveFunction:!0}),n({name:"shapeIsBox",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsBox=o===va.BOX}}),n({name:"shapeIsEllipsoid",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsEllipsoid=o===va.ELLIPSOID}}),n({name:"shapeIsCylinder",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsCylinder=o===va.CYLINDER}}),n({name:"clippingBoxMaxXMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMaxXMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingBoxMaxXMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMaxXMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingBoxMaxX",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMaxX=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingBoxMinXMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMinXMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingBoxMinXMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMinXMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingBoxMinX",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMinX=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingBoxMaxYMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMaxYMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingBoxMaxYMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMaxYMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingBoxMaxY",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingBoxMaxY=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingBoxMinYMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMinYMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingBoxMinYMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMinYMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingBoxMinY",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingBoxMinY=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingBoxMaxZMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMaxZMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingBoxMaxZMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMaxZMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingBoxMaxZ",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingBoxMaxZ=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingBoxMinZMin",initialValue:0,getPrimitiveFunction:function(){t.clippingBoxMinZMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingBoxMinZMax",initialValue:1,getPrimitiveFunction:function(){t.clippingBoxMinZMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingBoxMinZ",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingBoxMinZ=t._voxelPrimitive.minClippingBounds.z}}),n({name:"clippingEllipsoidMaxLongitudeMin",initialValue:-O.PI,getPrimitiveFunction:function(){t.clippingEllipsoidMaxLongitudeMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingEllipsoidMaxLongitudeMax",initialValue:O.PI,getPrimitiveFunction:function(){t.clippingEllipsoidMaxLongitudeMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingEllipsoidMaxLongitude",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxLongitude=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingEllipsoidMinLongitudeMin",initialValue:-O.PI,getPrimitiveFunction:function(){t.clippingEllipsoidMinLongitudeMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingEllipsoidMinLongitudeMax",initialValue:O.PI,getPrimitiveFunction:function(){t.clippingEllipsoidMinLongitudeMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingEllipsoidMinLongitude",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingEllipsoidMinLongitude=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingEllipsoidMaxLatitudeMin",initialValue:-O.PI_OVER_TWO,getPrimitiveFunction:function(){t.clippingEllipsoidMaxLatitudeMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingEllipsoidMaxLatitudeMax",initialValue:O.PI_OVER_TWO,getPrimitiveFunction:function(){t.clippingEllipsoidMaxLatitudeMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingEllipsoidMaxLatitude",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxLatitude=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingEllipsoidMinLatitudeMin",initialValue:-O.PI_OVER_TWO,getPrimitiveFunction:function(){t.clippingEllipsoidMinLatitudeMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingEllipsoidMinLatitudeMax",initialValue:O.PI_OVER_TWO,getPrimitiveFunction:function(){t.clippingEllipsoidMinLatitudeMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingEllipsoidMinLatitude",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingEllipsoidMinLatitude=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingEllipsoidMaxHeightMin",initialValue:0,getPrimitiveFunction:function(){t.clippingEllipsoidMaxHeightMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingEllipsoidMaxHeightMax",initialValue:1e5,getPrimitiveFunction:function(){t.clippingEllipsoidMaxHeightMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingEllipsoidMaxHeight",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxHeight=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingEllipsoidMinHeightMin",initialValue:-1e5,getPrimitiveFunction:function(){t.clippingEllipsoidMinHeightMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingEllipsoidMinHeightMax",initialValue:0,getPrimitiveFunction:function(){t.clippingEllipsoidMinHeightMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingEllipsoidMinHeight",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingEllipsoidMinHeight=t._voxelPrimitive.minClippingBounds.z}}),n({name:"clippingCylinderMaxRadiusMin",initialValue:0,getPrimitiveFunction:function(){t.clippingCylinderMaxRadiusMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingCylinderMaxRadiusMax",initialValue:1,getPrimitiveFunction:function(){t.clippingCylinderMaxRadiusMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingCylinderMaxRadius",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingCylinderMaxRadius=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingCylinderMinRadiusMin",initialValue:0,getPrimitiveFunction:function(){t.clippingCylinderMinRadiusMin=t._voxelPrimitive.minBounds.x}}),n({name:"clippingCylinderMinRadiusMax",initialValue:1,getPrimitiveFunction:function(){t.clippingCylinderMinRadiusMax=t._voxelPrimitive.maxBounds.x}}),n({name:"clippingCylinderMinRadius",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingCylinderMinRadius=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingCylinderMaxAngleMin",initialValue:-O.PI,getPrimitiveFunction:function(){t.clippingCylinderMaxAngleMin=t._voxelPrimitive.minBounds.y}}),n({name:"clippingCylinderMaxAngleMax",initialValue:O.PI,getPrimitiveFunction:function(){t.clippingCylinderMaxAngleMax=t._voxelPrimitive.maxBounds.y}}),n({name:"clippingCylinderMaxAngle",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingCylinderMaxAngle=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingCylinderMinAngleMin",initialValue:-O.PI}),n({name:"clippingCylinderMinAngleMax",initialValue:O.PI}),n({name:"clippingCylinderMinAngle",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingCylinderMinAngle=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingCylinderMaxHeightMin",initialValue:-1,getPrimitiveFunction:function(){t.clippingCylinderMaxHeightMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingCylinderMaxHeightMax",initialValue:1,getPrimitiveFunction:function(){t.clippingCylinderMaxHeightMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingCylinderMaxHeight",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingCylinderMaxHeight=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingCylinderMinHeightMin",initialValue:-1,getPrimitiveFunction:function(){t.clippingCylinderMinHeightMin=t._voxelPrimitive.minBounds.z}}),n({name:"clippingCylinderMinHeightMax",initialValue:1,getPrimitiveFunction:function(){t.clippingCylinderMinHeightMax=t._voxelPrimitive.maxBounds.z}}),n({name:"clippingCylinderMinHeight",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingCylinderMinHeight=t._voxelPrimitive.minClippingBounds.z}}),n({name:"translationX",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.translationX=B.getTranslation(t._voxelPrimitive.modelMatrix,new d).x}}),n({name:"translationY",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.translationY=B.getTranslation(t._voxelPrimitive.modelMatrix,new d).y}}),n({name:"translationZ",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.translationZ=B.getTranslation(t._voxelPrimitive.modelMatrix,new d).z}}),n({name:"scaleX",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.scaleX=B.getScale(t._voxelPrimitive.modelMatrix,new d).x}}),n({name:"scaleY",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.scaleY=B.getScale(t._voxelPrimitive.modelMatrix,new d).y}}),n({name:"scaleZ",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)},getPrimitiveFunction:function(){t.scaleZ=B.getScale(t._voxelPrimitive.modelMatrix,new d).z}}),n({name:"angleX",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)}}),n({name:"angleY",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)}}),n({name:"angleZ",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&bp(t)}})}var Uvt=new d,Vvt=new d,zvt=new Oa,Hvt=new J;function bp(e){let t=d.fromElements(e.translationX,e.translationY,e.translationZ,Uvt),n=d.fromElements(e.scaleX,e.scaleY,e.scaleZ,Vvt),i=zvt;i.heading=e.angleX,i.pitch=e.angleY,i.roll=e.angleZ;let o=J.fromHeadingPitchRoll(i,Hvt),r=J.multiplyByScale(o,n,o);e._voxelPrimitive.modelMatrix=B.fromRotationTranslation(r,t,e._voxelPrimitive.modelMatrix)}Object.defineProperties(vd.prototype,{scene:{get:function(){return this._scene}},voxelPrimitive:{get:function(){return this._voxelPrimitive},set:function(e){if(c(this._customShaderCompilationRemoveCallback)&&this._customShaderCompilationRemoveCallback(),!c(e))return;this._voxelPrimitive=e;let t=this;t._customShaderCompilationRemoveCallback=t._voxelPrimitive.customShaderCompilationEvent.addEventListener(function(n){let i=t._voxelPrimitive.customShader.fragmentShaderText;t.shaderString=fSe(i),c(n)?(t.shaderCompilationMessage=n.message,t.shaderCompilationSuccess=!1):(t.shaderCompilationMessage="Shader compiled successfully!",t.shaderCompilationSuccess=!0)}),t._modelMatrixReady=!1;for(let n=0;n<t._getPrimitiveFunctions.length;n++)t._getPrimitiveFunctions[n]();t._modelMatrixReady=!0,bp(t)}}});vd.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible};vd.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible};vd.prototype.toggleTransform=function(){this.transformVisible=!this.transformVisible};vd.prototype.toggleBounds=function(){this.boundsVisible=!this.boundsVisible};vd.prototype.toggleClipping=function(){this.clippingVisible=!this.clippingVisible};vd.prototype.toggleShader=function(){this.shaderVisible=!this.shaderVisible};vd.prototype.compileShader=function(){c(this._voxelPrimitive)&&(this._voxelPrimitive.customShader=new pA({fragmentShaderText:this.shaderString,uniforms:this._voxelPrimitive.customShader.uniforms}))};vd.prototype.shaderEditorKeyPress=function(e,t){if(t.keyCode===9){t.preventDefault();let n=t.target,i=n.selectionStart,o=n.selectionEnd,r=o,a=n.value.slice(i,o).split(`
`),l=a.length,u;if(t.shiftKey)for(u=0;u<l;++u)a[u][0]===" "&&(a[u][1]===" "?(a[u]=a[u].substr(2),r-=2):(a[u]=a[u].substr(1),r-=1));else for(u=0;u<l;++u)a[u]=`  ${a[u]}`,r+=2;let f=a.join(`
`);n.value=n.value.slice(0,i)+f+n.value.slice(o),n.selectionStart=i!==o?i:r,n.selectionEnd=r}else t.ctrlKey&&(t.keyCode===10||t.keyCode===13)&&this.compileShader();return!0};vd.prototype.isDestroyed=function(){return!1};vd.prototype.destroy=function(){let e=this;return this._definedProperties.forEach(function(t){xe.getObservable(e,t).dispose()}),de(this)};var _U=vd;function E5(e,t){T.defined("container",e),T.typeOf.object("scene",t),e=In(e);let n=document.createElement("div"),i=new _U(t);this._viewModel=i,this._container=e,this._element=n;let o=document.createElement("div");o.textContent="Voxel Inspector",o.className="cesium-cesiumInspector-button",o.setAttribute("data-bind","click: toggleInspector"),n.appendChild(o),n.className="cesium-cesiumInspector cesium-VoxelInspector",n.setAttribute("data-bind",'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'),e.appendChild(n);let r=document.createElement("div");r.className="cesium-cesiumInspector-dropDown",n.appendChild(r);let{createSection:s,createCheckbox:a,createRangeInput:l,createButton:u}=fu,f=s(r,"Display","displayVisible","toggleDisplay"),h=s(r,"Transform","transformVisible","toggleTransform"),p=s(r,"Clipping","clippingVisible","toggleClipping"),g=s(r,"Shader","shaderVisible","toggleShader");f.appendChild(a("Depth Test","depthTest")),f.appendChild(a("Show","show")),f.appendChild(a("Disable Update","disableUpdate")),f.appendChild(a("Debug Draw","debugDraw")),f.appendChild(a("Jitter","jitter")),f.appendChild(a("Nearest Sampling","nearestSampling")),f.appendChild(l("Screen Space Error","screenSpaceError",0,128)),f.appendChild(l("Step Size","stepSize",0,2));let m=10,y=10,b=O.PI;h.appendChild(l("Translation X","translationX",-m,+m)),h.appendChild(l("Translation Y","translationY",-m,+m)),h.appendChild(l("Translation Z","translationZ",-m,+m)),h.appendChild(l("Scale X","scaleX",0,+y)),h.appendChild(l("Scale Y","scaleY",0,+y)),h.appendChild(l("Scale Z","scaleZ",0,+y)),h.appendChild(l("Heading","angleX",-b,+b)),h.appendChild(l("Pitch","angleY",-b,+b)),h.appendChild(l("Roll","angleZ",-b,+b)),QQ("Max X","Min X","Max Y","Min Y","Max Z","Min Z","clippingBoxMaxX","clippingBoxMinX","clippingBoxMaxY","clippingBoxMinY","clippingBoxMaxZ","clippingBoxMinZ","shapeIsBox",p),QQ("Max Longitude","Min Longitude","Max Latitude","Min Latitude","Max Height","Min Height","clippingEllipsoidMaxLongitude","clippingEllipsoidMinLongitude","clippingEllipsoidMaxLatitude","clippingEllipsoidMinLatitude","clippingEllipsoidMaxHeight","clippingEllipsoidMinHeight","shapeIsEllipsoid",p),QQ("Max Radius","Min Radius","Max Angle","Min Angle","Max Height","Min Height","clippingCylinderMaxRadius","clippingCylinderMinRadius","clippingCylinderMaxAngle","clippingCylinderMinAngle","clippingCylinderMaxHeight","clippingCylinderMinHeight","shapeIsCylinder",p);let x=document.createElement("div");g.appendChild(x);let A=document.createElement("textarea");A.setAttribute("data-bind","textInput: shaderString, event: { keydown: shaderEditorKeyPress }"),x.className="cesium-cesiumInspector-styleEditor",x.appendChild(A);let C=u("Compile (Ctrl+Enter)","compileShader");x.appendChild(C);let S=document.createElement("label");S.style.display="block",S.setAttribute("data-bind","text: shaderCompilationMessage, style: {color: shaderCompilationSuccess ? 'green' : 'red'}"),x.appendChild(S),xe.applyBindings(i,n)}Object.defineProperties(E5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});E5.prototype.isDestroyed=function(){return!1};E5.prototype.destroy=function(){return xe.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),de(this)};function QQ(e,t,n,i,o,r,s,a,l,u,f,h,p,g){let m=fu.createRangeInputWithDynamicMinMax,y=g.appendChild(document.createElement("div"));y.setAttribute("data-bind",`if: ${p}`),y.appendChild(m(e,s)),y.appendChild(m(t,a)),y.appendChild(m(n,l)),y.appendChild(m(i,u)),y.appendChild(m(o,f)),y.appendChild(m(r,h))}var gU=E5;var hSe=Zo(dSe(),1);function Gvt(e){let t=!1,n=window.screen;return c(n)&&(c(n.lockOrientation)?t=n.lockOrientation(e):c(n.mozLockOrientation)?t=n.mozLockOrientation(e):c(n.msLockOrientation)?t=n.msLockOrientation(e):c(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function mSe(){let e=window.screen;c(e)&&(c(e.unlockOrientation)?e.unlockOrientation():c(e.mozUnlockOrientation)?e.mozUnlockOrientation():c(e.msUnlockOrientation)?e.msUnlockOrientation():c(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function jvt(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(mSe(),e._locked=!1),e._noSleep.disable(),Cr.exitFullscreen(),n(!1)):(Cr.fullscreen||Cr.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=Gvt("landscape")),t.useWebVR=!0,n(!0)))}function S5(e,t){if(!c(e))throw new E("scene is required.");let n=this,i=xe.observable(Cr.enabled),o=xe.observable(!1);this.isVRMode=void 0,xe.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,xe.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&Cr.enabled)}}),this.tooltip=void 0,xe.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});let r=xe.observable(!1);this._isOrthographic=void 0,xe.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new gr,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof on)}),this._locked=!1,this._noSleep=new hSe.default,this._command=Sn(function(){jvt(n,e,o,r)},xe.getObservable(this,"isVREnabled")),this._vrElement=In(t)??document.body,this._callback=function(){!Cr.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(mSe(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(Cr.changeEventName,this._callback)}Object.defineProperties(S5.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}});S5.prototype.isDestroyed=function(){return!1};S5.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Cr.changeEventName,this._callback),de(this)};var bU=S5;var Wvt="M 5.3125 6.375 C 4.008126 6.375 2.96875 7.4141499 2.96875 8.71875 L 2.96875 19.5 C 2.96875 20.8043 4.008126 21.875 5.3125 21.875 L 13.65625 21.875 C 13.71832 20.0547 14.845166 18.59375 16.21875 18.59375 C 17.592088 18.59375 18.71881 20.0552 18.78125 21.875 L 27.09375 21.875 C 28.398125 21.875 29.4375 20.8043 29.4375 19.5 L 29.4375 8.71875 C 29.4375 7.4141499 28.398125 6.375 27.09375 6.375 L 5.3125 6.375 z M 9.625 10.4375 C 11.55989 10.4375 13.125 12.03385 13.125 13.96875 C 13.125 15.90365 11.55989 17.46875 9.625 17.46875 C 7.69011 17.46875 6.125 15.90365 6.125 13.96875 C 6.125 12.03385 7.69011 10.4375 9.625 10.4375 z M 22.46875 10.4375 C 24.40364 10.4375 25.96875 12.03385 25.96875 13.96875 C 25.96875 15.90365 24.40364 17.46875 22.46875 17.46875 C 20.53386 17.46875 18.96875 15.90365 18.96875 13.96875 C 18.96875 12.03385 20.53386 10.4375 22.46875 10.4375 z",qvt="M 25.770585,2.4552065 C 15.72282,13.962707 10.699956,19.704407 8.1768352,22.580207 c -1.261561,1.4379 -1.902282,2.1427 -2.21875,2.5 -0.141624,0.1599 -0.208984,0.2355 -0.25,0.2813 l 0.6875,0.75 c 10e-5,-10e-5 0.679191,0.727 0.6875,0.7187 0.01662,-0.016 0.02451,-0.024 0.03125,-0.031 0.01348,-0.014 0.04013,-0.038 0.0625,-0.062 0.04474,-0.05 0.120921,-0.1315 0.28125,-0.3126 0.320657,-0.3619 0.956139,-1.0921 2.2187499,-2.5312 2.5252219,-2.8781 7.5454589,-8.6169 17.5937499,-20.1250005 l -1.5,-1.3125 z m -20.5624998,3.9063 c -1.304375,0 -2.34375,1.0391 -2.34375,2.3437 l 0,10.8125005 c 0,1.3043 1.039375,2.375 2.34375,2.375 l 2.25,0 c 1.9518039,-2.2246 7.4710958,-8.5584 13.5624998,-15.5312005 l -15.8124998,0 z m 21.1249998,0 c -1.855467,2.1245 -2.114296,2.4005 -3.59375,4.0936995 1.767282,0.1815 3.15625,1.685301 3.15625,3.500001 0,1.9349 -1.56511,3.5 -3.5,3.5 -1.658043,0 -3.043426,-1.1411 -3.40625,-2.6875 -1.089617,1.2461 -2.647139,2.9988 -3.46875,3.9375 0.191501,-0.062 0.388502,-0.094 0.59375,-0.094 1.373338,0 2.50006,1.4614 2.5625,3.2812 l 8.3125,0 c 1.304375,0 2.34375,-1.0707 2.34375,-2.375 l 0,-10.8125005 c 0,-1.3046 -1.039375,-2.3437 -2.34375,-2.3437 l -0.65625,0 z M 9.5518351,10.423906 c 1.9348899,0 3.4999999,1.596401 3.4999999,3.531301 0,1.9349 -1.56511,3.5 -3.4999999,3.5 -1.9348899,0 -3.4999999,-1.5651 -3.4999999,-3.5 0,-1.9349 1.56511,-3.531301 3.4999999,-3.531301 z m 4.2187499,10.312601 c -0.206517,0.2356 -0.844218,0.9428 -1.03125,1.1562 l 0.8125,0 c 0.01392,-0.4081 0.107026,-0.7968 0.21875,-1.1562 z";function w5(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=In(e);let i=new bU(t,n);i._exitVRPath=qvt,i._enterVRPath=Wvt;let o=document.createElement("button");o.type="button",o.className="cesium-button cesium-vrButton",o.setAttribute("data-bind",'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'),e.appendChild(o),xe.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(w5.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});w5.prototype.isDestroyed=function(){return!1};w5.prototype.destroy=function(){return this._viewModel.destroy(),xe.cleanNode(this._element),this._container.removeChild(this._element),de(this)};var xU=w5;var pSe=new le;function ySe(e){let t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function Yvt(e){let t=e.getPropertyIds(),n="";return t.forEach(function(i){let o=e.getProperty(i);c(o)&&(n+=`<tr><th>${i}</th><td>${o}</td></tr>`)}),n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function Xvt(e){let t,n=[],i=e.getPropertyIds();for(t=0;t<i.length;t++){let r=i[t];/^name$/i.test(r)?n[0]=e.getProperty(r):/name/i.test(r)?n[1]=e.getProperty(r):/^title$/i.test(r)?n[2]=e.getProperty(r):/^(id|identifier)$/i.test(r)?n[3]=e.getProperty(r):/element/i.test(r)?n[4]=e.getProperty(r):/(id|identifier)$/i.test(r)&&(n[5]=e.getProperty(r))}let o=n.length;for(t=0;t<o;t++){let r=n[t];if(c(r)&&r!=="")return r}return"Unnamed Feature"}function _Se(e,t){let n=e.scene.pick(t.position);if(c(n)){let i=n.id??n.primitive.id;if(i instanceof nr)return i;if(n instanceof Ws)return new nr({name:Xvt(n),description:Yvt(n),feature:n})}if(c(e.scene.globe))return Zvt(e,t.position)}var Kvt=new Q;function eJ(e,t){if(c(t)){let n=t.clock;if(c(n)&&c(e)){let i=n.startTime,o=n.stopTime;Q.equals(i,o)&&(o=Q.addSeconds(i,O.EPSILON2,Kvt)),e.updateFromClock(),e.zoomTo(i,o)}}}var $vt=new d;function Zvt(e,t){let n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!c(o))return;let r=new nr({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!c(s)||s.length===0){e.selectedEntity=gSe();return}let a=s[0],l=new nr({id:a.name,description:a.description});if(c(a.position)){let u=e.scene.ellipsoid.cartographicToCartesian(a.position,$vt);l.position=new qc(u)}e.selectedEntity=l},function(){e.selectedEntity===r&&(e.selectedEntity=gSe())}),r}function gSe(){return new nr({id:"None",description:"No features found."})}function Qvt(e,t){let n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,l=e._timeline,u=e._fullscreenButton,f=e._infoBox,h=e._selectionIndicator,p=t?"hidden":"visible";if(c(n)&&(n.container.style.visibility=p),c(i)&&(i.container.style.visibility=p),c(o)&&(o.container.style.visibility=p),c(r)&&(r.container.style.visibility=p),c(s)&&(s.container.style.visibility=p),c(a)&&(a.container.style.visibility=p),c(l)&&(l.container.style.visibility=p),c(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=p),c(f)&&(f.container.style.visibility=p),c(h)&&(h.container.style.visibility=p),e._container){let g=t||!c(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function Ji(e,t){if(!c(e))throw new E("container is required.");if(e=In(e),t=t??W.EMPTY_OBJECT,t.globe===!1&&c(t.baseLayer)&&t.baseLayer!==!1)throw new E("Cannot use baseLayer when globe is disabled.");let n=(!c(t.globe)||t.globe!==!1)&&(!c(t.baseLayerPicker)||t.baseLayerPicker!==!1);if(!n&&c(t.selectedImageryProviderViewModel))throw new E("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.baseLayer instead or set options.baseLayerPicker to true.");if(!n&&c(t.selectedTerrainProviderViewModel))throw new E("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");let i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);let r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);let s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);let a=t.scene3DOnly??!1,l,u,f=!1;c(t.clockViewModel)?(u=t.clockViewModel,l=u.clock):(l=new Ah,u=new Ok(l),f=!0);let h=new q3(r,{baseLayer:n&&c(t.selectedImageryProviderViewModel)||c(t.baseLayer)||c(t.imageryProvider)?!1:void 0,clock:l,shouldAnimate:t.shouldAnimate,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,ellipsoid:t.ellipsoid,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,automaticallyTrackDataSourceClocks:t.automaticallyTrackDataSourceClocks,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,useBrowserRecommendedResolution:t.useBrowserRecommendedResolution,creditContainer:c(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,dataSources:t.dataSources,scene3DOnly:a,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,blurActiveElementOnCanvasFocus:t.blurActiveElementOnCanvasFocus,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples}),p=h.scene,g=new gr;g.add(l.onTick,Ji.prototype._onTick,this);let m;if(!c(t.selectionIndicator)||t.selectionIndicator!==!1){let q=document.createElement("div");q.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(q),m=new uU(q,p)}let y;if(!c(t.infoBox)||t.infoBox!==!1){let q=document.createElement("div");q.className="cesium-viewer-infoBoxContainer",o.appendChild(q),y=new tU(q);let Y=y.viewModel;g.add(Y.cameraClicked,Ji.prototype._onInfoBoxCameraClicked,this),g.add(Y.closeClicked,Ji.prototype._onInfoBoxClockClicked,this)}let b=document.createElement("div");b.className="cesium-viewer-toolbar",o.appendChild(b);let x;if(!c(t.geocoder)||t.geocoder!==!1){let q=document.createElement("div");q.className="cesium-viewer-geocoderContainer",b.appendChild(q);let Y;typeof t.geocoder=="string"?Y=[new RA({scene:p,geocodeProviderType:t.geocoder})]:c(t.geocoder)&&typeof t.geocoder!="boolean"&&(Y=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),x=new Qk({container:q,geocoderServices:Y,scene:p}),g.add(x.viewModel.search.beforeExecute,Ji.prototype._clearObjects,this)}let A;if((!c(t.homeButton)||t.homeButton!==!1)&&(A=new $k(b,p),c(x)&&g.add(A.viewModel.command.afterExecute,function(){let q=x.viewModel;q.searchText="",q.isSearchInProgress&&q.search()}),g.add(A.viewModel.command.beforeExecute,Ji.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new E("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let C;!a&&(!c(t.sceneModePicker)||t.sceneModePicker!==!1)&&(C=new dU(b,p));let S;t.projectionPicker&&(S=new iU(b,p));let v,P;if(n){let q=t.imageryProviderViewModels??kk(),Y=t.terrainProviderViewModels??Uk();v=new Bk(b,{globe:p.globe,imageryProviderViewModels:q,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:Y,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),P=b.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(c(t.baseLayer)&&t.baseLayer!==!1&&(n&&(v.viewModel.selectedImagery=void 0),p.imageryLayers.removeAll(),p.imageryLayers.add(t.baseLayer)),c(t.terrainProvider)&&(n&&(v.viewModel.selectedTerrain=void 0),p.terrainProvider=t.terrainProvider),c(t.terrain)){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");n&&(p.globe.depthTestAgainstTerrain=!0),p.setTerrain(t.terrain)}let M;if(!c(t.navigationHelpButton)||t.navigationHelpButton!==!1){let q=!0;try{if(c(window.localStorage)){let Y=window.localStorage.getItem("cesium-hasSeenNavHelp");c(Y)&&Y?q=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}M=new aU({container:b,instructionsInitiallyVisible:t.navigationInstructionsInitiallyVisible??q})}let R;if(!c(t.animation)||t.animation!==!1){let q=document.createElement("div");q.className="cesium-viewer-animationContainer",o.appendChild(q),R=new Lk(q,new Nk(u))}let L;if(!c(t.timeline)||t.timeline!==!1){let q=document.createElement("div");q.className="cesium-viewer-timelineContainer",o.appendChild(q),L=new pU(q,l),L.addEventListener("settime",ySe,!1),L.zoomTo(l.startTime,l.stopTime)}let F,_,w;(!c(t.fullscreenButton)||t.fullscreenButton!==!1)&&(w=document.createElement("div"),w.className="cesium-viewer-fullscreenContainer",o.appendChild(w),F=new Xk(w,t.fullscreenElement),_=Da(F.viewModel,"isFullscreenEnabled",function(q){w.style.display=q?"block":"none",c(L)&&(L.container.style.right=`${w.clientWidth}px`,L.resize())}));let D,I,N;if(t.vrButton){let q=document.createElement("div");q.className="cesium-viewer-vrContainer",o.appendChild(q),D=new xU(q,p,t.fullScreenElement),I=Da(D.viewModel,"isVREnabled",function(Y){q.style.display=Y?"block":"none",c(F)&&(q.style.right=`${w.clientWidth}px`),c(L)&&(L.container.style.right=`${q.clientWidth}px`,L.resize())}),N=Da(D.viewModel,"isVRMode",function(Y){Qvt(i,Y)})}this._baseLayerPickerDropDown=P,this._fullscreenSubscription=_,this._vrSubscription=I,this._vrModeSubscription=N,this._dataSourceChangedListeners={},this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=h,this._selectionIndicator=m,this._infoBox=y,this._clockViewModel=u,this._destroyClockViewModel=f,this._toolbar=b,this._homeButton=A,this._sceneModePicker=C,this._projectionPicker=S,this._baseLayerPicker=v,this._navigationHelpButton=M,this._animation=R,this._timeline=L,this._fullscreenButton=F,this._vrButton=D,this._geocoder=x,this._eventHelper=g,this._lastWidth=0,this._lastHeight=0,this._enableInfoOrSelection=c(y)||c(m),this._selectedEntity=void 0,this._selectedEntityChanged=new pe;let k=this._cesiumWidget.dataSources,z=this._cesiumWidget.dataSourceDisplay;g.add(k.dataSourceAdded,Ji.prototype._onDataSourceAdded,this),g.add(k.dataSourceRemoved,Ji.prototype._onDataSourceRemoved,this),g.add(p.postUpdate,Ji.prototype.resize,this);let V=k.length;for(let q=0;q<V;q++)this._dataSourceAdded(k,k.get(q));this._dataSourceAdded(void 0,z.defaultDataSource),g.add(k.dataSourceAdded,Ji.prototype._dataSourceAdded,this),g.add(k.dataSourceRemoved,Ji.prototype._dataSourceRemoved,this);function j(q){let Y=_Se(i,q);c(Y)?X.getValueOrUndefined(Y.position,i.clock.currentTime)?i.trackedEntity=Y:i.zoomTo(Y):c(i.trackedEntity)&&(i.trackedEntity=void 0)}function U(q){i.selectedEntity=_Se(i,q)}h.screenSpaceEventHandler.setInputAction(U,An.LEFT_CLICK),h.screenSpaceEventHandler.setInputAction(j,An.LEFT_DOUBLE_CLICK),h._canAnimateUpdateCallback=this._updateCanAnimate(this)}Object.defineProperties(Ji.prototype,{container:{get:function(){return this._container}},creditDisplay:{get:function(){return this._cesiumWidget.creditDisplay}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},projectionPicker:{get:function(){return this._projectionPicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},navigationHelpButton:{get:function(){return this._navigationHelpButton}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},vrButton:{get:function(){return this._vrButton}},dataSourceDisplay:{get:function(){return this._cesiumWidget.dataSourceDisplay}},entities:{get:function(){return this._cesiumWidget.entities}},dataSources:{get:function(){return this._cesiumWidget.dataSources}},canvas:{get:function(){return this._cesiumWidget.canvas}},scene:{get:function(){return this._cesiumWidget.scene}},shadows:{get:function(){return this.scene.shadowMap.enabled},set:function(e){this.scene.shadowMap.enabled=e}},terrainShadows:{get:function(){return this.scene.globe.shadows},set:function(e){this.scene.globe.shadows=e}},shadowMap:{get:function(){return this.scene.shadowMap}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},ellipsoid:{get:function(){return this._scene.ellipsoid}},postProcessStages:{get:function(){return this.scene.postProcessStages}},clock:{get:function(){return this._clockViewModel.clock}},clockViewModel:{get:function(){return this._clockViewModel}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e}},useBrowserRecommendedResolution:{get:function(){return this._cesiumWidget.useBrowserRecommendedResolution},set:function(e){this._cesiumWidget.useBrowserRecommendedResolution=e}},allowDataSourcesToSuspendAnimation:{get:function(){return this._cesiumWidget.allowDataSourcesToSuspendAnimation},set:function(e){this._cesiumWidget.allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._cesiumWidget.trackedEntity},set:function(e){this._cesiumWidget.trackedEntity=e}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;let t=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(e)?c(t)&&t.animateAppear():c(t)&&t.animateDepart(),this._selectedEntityChanged.raiseEvent(e)}}},selectedEntityChanged:{get:function(){return this._selectedEntityChanged}},trackedEntityChanged:{get:function(){return this._cesiumWidget.trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._cesiumWidget.clockTrackedDataSource},set:function(e){this._cesiumWidget.clockTrackedDataSource!==e&&(this._cesiumWidget.clockTrackedDataSource=e,eJ(this._timeline,e))}}});Ji.prototype.extend=function(e,t){if(!c(e))throw new E("mixin is required.");e(this,t)};Ji.prototype.resize=function(){let e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=c(this._animation),r=c(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;let s=i-125,a=this._baseLayerPickerDropDown;if(c(a)&&(a.style.maxHeight=`${s}px`),c(this._geocoder)){let m=this._geocoder.searchSuggestionsContainer;m.style.maxHeight=`${s}px`}c(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);let l=this._timeline,u,f=0,h=5,p=3,g=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){let m=this._lastWidth;u=this._animation.container,n>900?(f=169,m<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(f=136,(m<600||m>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(f=106,(m>600||m===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),h=f+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){let m=this._fullscreenButton,y=this._vrButton,b=l.container,x=b.style;p=b.clientHeight+3,x.left=`${f}px`;let A=0;c(m)&&(A+=m.container.clientWidth),c(y)&&(A+=y.container.clientWidth),x.right=`${A}px`,l.resize()}!r&&c(this._fullscreenButton)&&(g=this._fullscreenButton.container.clientWidth),this._bottomContainer.style.left=`${h}px`,this._bottomContainer.style.bottom=`${p}px`,this._bottomContainer.style.right=`${g}px`,this._lastWidth=n,this._lastHeight=i};Ji.prototype.forceResize=function(){this._lastWidth=0,this.resize()};Ji.prototype.render=function(){this._cesiumWidget.render()};Ji.prototype.isDestroyed=function(){return!1};Ji.prototype.destroy=function(){return c(this.screenSpaceEventHandler)&&!this.screenSpaceEventHandler.isDestroyed()&&(this.screenSpaceEventHandler.removeInputAction(An.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(An.LEFT_DOUBLE_CLICK)),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),c(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),c(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),c(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),c(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),c(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),c(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),c(this._timeline)&&(this._timeline.removeEventListener("settime",ySe,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),c(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),c(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),c(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),c(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._destroyClockViewModel&&(this._clockViewModel=this._clockViewModel.destroy()),this._cesiumWidget=this._cesiumWidget.destroy(),de(this)};Ji.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Ji.prototype._onEntityCollectionChanged,this)};Ji.prototype._dataSourceRemoved=function(e,t){let n=t.entities;n.collectionChanged.removeEventListener(Ji.prototype._onEntityCollectionChanged,this),c(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};Ji.prototype._updateCanAnimate=function(e){return function(t){e._clockViewModel.canAnimate=t}};Ji.prototype._onTick=function(e){let t=e.currentTime,n,i=!1,o=this.selectedEntity,r=c(o)&&this._enableInfoOrSelection;r&&o.isShowing&&o.isAvailable(t)&&(this._cesiumWidget.dataSourceDisplay.getBoundingSphere(o,!0,pSe)!==lt.FAILED?n=pSe.center:c(o.position)&&(n=o.position.getValue(t,n)),i=c(n));let s=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(s)&&(s.position=d.clone(n,s.position),s.showSelection=r&&i,s.update());let a=c(this._infoBox)?this._infoBox.viewModel:void 0;c(a)&&(a.showInfo=r,a.enableCamera=i,a.isCameraTracking=this.trackedEntity===this.selectedEntity,r?(a.titleText=o.name??o.id,a.description=X.getValueOrDefault(o.description,t,"")):(a.titleText="",a.description=""))};Ji.prototype._onEntityCollectionChanged=function(e,t,n){let i=n.length;for(let o=0;o<i;o++){let r=n[o];this.selectedEntity===r&&(this.selectedEntity=void 0)}};Ji.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{let n=this.selectedEntity.position;c(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};Ji.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};Ji.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};Ji.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};Ji.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&eJ(this.timeline,e)};Ji.prototype._onDataSourceAdded=function(e,t){this._cesiumWidget._automaticallyTrackDataSourceClocks&&t===this.clockTrackedDataSource&&eJ(this._timeline,t);let n=t.entities.id,i=this._eventHelper.add(t.changedEvent,Ji.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};Ji.prototype._onDataSourceRemoved=function(e,t){let n=t.entities.id;this._dataSourceChangedListeners[n](),this._dataSourceChangedListeners[n]=void 0};Ji.prototype.zoomTo=function(e,t){return this._cesiumWidget.zoomTo(e,t)};Ji.prototype.flyTo=function(e,t){return this._cesiumWidget.flyTo(e,t)};var tJ=Ji;function Jvt(e){T.typeOf.object("viewer",e);let t=document.createElement("div");t.className="cesium-viewer-cesium3DTilesInspectorContainer",e.container.appendChild(t);let n=new Gk(t,e.scene);Object.defineProperties(e,{cesium3DTilesInspector:{get:function(){return n}}})}var nJ=Jvt;function eDt(e){if(!c(e))throw new E("viewer is required.");let t=document.createElement("div");t.className="cesium-viewer-cesiumInspectorContainer",e.container.appendChild(t);let n=new qk(t,e.scene);Object.defineProperties(e,{cesiumInspector:{get:function(){return n}}})}var iJ=eDt;function tDt(e,t){if(!c(e))throw new E("viewer is required.");if(e.hasOwnProperty("dropTarget"))throw new E("dropTarget is already defined by another mixin.");if(e.hasOwnProperty("dropEnabled"))throw new E("dropEnabled is already defined by another mixin.");if(e.hasOwnProperty("dropError"))throw new E("dropError is already defined by another mixin.");if(e.hasOwnProperty("clearOnDrop"))throw new E("clearOnDrop is already defined by another mixin.");if(e.hasOwnProperty("flyToOnDrop"))throw new E("flyToOnDrop is already defined by another mixin.");t=t??W.EMPTY_OBJECT;let n=!0,i=t.flyToOnDrop??!0,o=new pe,r=t.clearOnDrop??!0,s=t.dropTarget??e.container,a=t.clampToGround??!0,l=t.proxy;s=In(s),Object.defineProperties(e,{dropTarget:{get:function(){return s},set:function(f){if(!c(f))throw new E("value is required.");bSe(s,u),s=f,oJ(s,u)}},dropEnabled:{get:function(){return n},set:function(f){f!==n&&(f?oJ(s,u):bSe(s,u),n=f)}},dropError:{get:function(){return o}},clearOnDrop:{get:function(){return r},set:function(f){r=f}},flyToOnDrop:{get:function(){return i},set:function(f){i=f}},proxy:{get:function(){return l},set:function(f){l=f}},clampToGround:{get:function(){return a},set:function(f){a=f}}});function u(f){qA(f),r&&(e.entities.removeAll(),e.dataSources.removeAll());let h=f.dataTransfer.files,p=h.length;for(let g=0;g<p;g++){let m=h[g],y=new FileReader;y.onload=nDt(e,m,l,a),y.onerror=iDt(e,m),y.readAsText(m)}}oJ(s,u),e.destroy=tk(e,e.destroy,function(){e.dropEnabled=!1}),e._handleDrop=u}function qA(e){e.stopPropagation(),e.preventDefault()}function bSe(e,t){let n=e;c(n)&&(n.removeEventListener("drop",t,!1),n.removeEventListener("dragenter",qA,!1),n.removeEventListener("dragover",qA,!1),n.removeEventListener("dragexit",qA,!1))}function oJ(e,t){e.addEventListener("drop",t,!1),e.addEventListener("dragenter",qA,!1),e.addEventListener("dragover",qA,!1),e.addEventListener("dragexit",qA,!1)}function nDt(e,t,n,i){let o=e.scene;return function(r){let s=t.name;try{let a;if(/\.czml$/i.test(s))a=SN.load(JSON.parse(r.target.result),{sourceUri:s});else if(/\.geojson$/i.test(s)||/\.json$/i.test(s)||/\.topojson$/i.test(s))a=T0.load(JSON.parse(r.target.result),{sourceUri:s,clampToGround:i});else if(/\.(kml|kmz)$/i.test(s))a=kT.load(t,{sourceUri:s,proxy:n,camera:o.camera,canvas:o.canvas,clampToGround:i,screenOverlayContainer:e.container});else if(/\.gpx$/i.test(s))a=BF.load(t,{sourceUri:s,proxy:n});else{e.dropError.raiseEvent(e,s,`Unrecognized file: ${s}`);return}c(a)&&e.dataSources.add(a).then(function(l){e.flyToOnDrop&&e.flyTo(l)}).catch(function(l){e.dropError.raiseEvent(e,s,l)})}catch(a){e.dropError.raiseEvent(e,s,a)}}}function iDt(e,t){return function(n){e.dropError.raiseEvent(e,t.name,n.target.error)}}var rJ=tDt;function oDt(e,t){if(!c(e))throw new E("viewer is required.");t=t??W.EMPTY_OBJECT;let n=new rU({scene:e.scene,container:e.bottomContainer,lowFrameRateMessage:t.lowFrameRateMessage});Object.defineProperties(e,{performanceWatchdog:{get:function(){return n}}})}var sJ=oDt;function rDt(e){T.typeOf.object("viewer",e);let t=document.createElement("div");t.className="cesium-viewer-voxelInspectorContainer",e.container.appendChild(t);let n=new gU(t,e.scene);Object.defineProperties(e,{voxelInspector:{get:function(){return n}}})}var aJ=rDt;globalThis.CESIUM_VERSION="1.129";var sDt="1.129";0&&(module.exports={AlphaMode,AlphaPipelineStage,AnchorPointDirect,AnchorPointIndirect,Animation,AnimationViewModel,Appearance,ApproximateTerrainHeights,ArcGISTiledElevationTerrainProvider,ArcGisBaseMapType,ArcGisMapServerImageryProvider,ArcGisMapService,ArcType,ArticulationStageType,AssociativeArray,Atmosphere,AtmospherePipelineStage,AttributeCompression,AttributeType,AutoExposure,AutomaticUniforms,Axis,AxisAlignedBoundingBox,B3dmLoader,B3dmParser,BaseLayerPicker,BaseLayerPickerViewModel,BatchTable,BatchTableHierarchy,BatchTexture,BatchTexturePipelineStage,Billboard,BillboardCollection,BillboardGraphics,BillboardLoadState,BillboardTexture,BillboardVisualizer,BingMapsGeocoderService,BingMapsImageryProvider,BingMapsStyle,BlendEquation,BlendFunction,BlendOption,BlendingState,BoundingRectangle,BoundingSphere,BoundingSphereState,BoundingVolumeSemantics,BoxEmitter,BoxGeometry,BoxGeometryUpdater,BoxGraphics,BoxOutlineGeometry,BrdfLutGenerator,Buffer,BufferLoader,BufferUsage,CPUStylingPipelineStage,CallbackPositionProperty,CallbackProperty,Camera,CameraEventAggregator,CameraEventType,CameraFlightPath,Cartesian2,Cartesian3,Cartesian4,Cartographic,CartographicGeocoderService,CatmullRomSpline,Cesium3DContentGroup,Cesium3DTile,Cesium3DTileBatchTable,Cesium3DTileColorBlendMode,Cesium3DTileContent,Cesium3DTileContentFactory,Cesium3DTileContentState,Cesium3DTileContentType,Cesium3DTileFeature,Cesium3DTileFeatureTable,Cesium3DTileOptimizationHint,Cesium3DTileOptimizations,Cesium3DTilePass,Cesium3DTilePassState,Cesium3DTilePointFeature,Cesium3DTileRefine,Cesium3DTileStyle,Cesium3DTileStyleEngine,Cesium3DTilesInspector,Cesium3DTilesInspectorViewModel,Cesium3DTilesVoxelProvider,Cesium3DTileset,Cesium3DTilesetBaseTraversal,Cesium3DTilesetCache,Cesium3DTilesetGraphics,Cesium3DTilesetHeatmap,Cesium3DTilesetMetadata,Cesium3DTilesetMostDetailedTraversal,Cesium3DTilesetSkipTraversal,Cesium3DTilesetStatistics,Cesium3DTilesetTraversal,Cesium3DTilesetVisualizer,CesiumInspector,CesiumInspectorViewModel,CesiumTerrainProvider,CesiumWidget,Check,CheckerboardMaterialProperty,CircleEmitter,CircleGeometry,CircleOutlineGeometry,ClassificationModelDrawCommand,ClassificationPipelineStage,ClassificationPrimitive,ClassificationType,ClearCommand,ClippingPlane,ClippingPlaneCollection,ClippingPolygon,ClippingPolygonCollection,Clock,ClockRange,ClockStep,ClockViewModel,CloudCollection,CloudType,Color,ColorBlendMode,ColorGeometryInstanceAttribute,ColorMaterialProperty,Command,ComponentDatatype,Composite3DTileContent,CompositeEntityCollection,CompositeMaterialProperty,CompositePositionProperty,CompositeProperty,CompressedTextureBuffer,ComputeCommand,ComputeEngine,ConditionsExpression,ConeEmitter,ConstantPositionProperty,ConstantProperty,ConstantSpline,ContentMetadata,Context,ContextLimits,CoplanarPolygonGeometry,CoplanarPolygonGeometryLibrary,CoplanarPolygonOutlineGeometry,CornerType,CorrelationGroup,CorridorGeometry,CorridorGeometryLibrary,CorridorGeometryUpdater,CorridorGraphics,CorridorOutlineGeometry,Credit,CreditDisplay,CubeMap,CubeMapFace,CubicRealPolynomial,CullFace,CullingVolume,CumulusCloud,CustomDataSource,CustomHeightmapTerrainProvider,CustomShader,CustomShaderMode,CustomShaderPipelineStage,CustomShaderTranslucencyMode,CylinderGeometry,CylinderGeometryLibrary,CylinderGeometryUpdater,CylinderGraphics,CylinderOutlineGeometry,CzmlDataSource,DataSource,DataSourceClock,DataSourceCollection,DataSourceDisplay,DebugAppearance,DebugCameraPrimitive,DebugInspector,DebugModelMatrixPrimitive,DefaultProxy,DepthFunction,DepthPlane,DequantizationPipelineStage,DerivedCommand,DeveloperError,DeviceOrientationCameraController,DirectionalLight,DiscardEmptyTileImagePolicy,DiscardMissingTileImagePolicy,DistanceDisplayCondition,DistanceDisplayConditionGeometryInstanceAttribute,DoubleEndedPriorityQueue,DoublyLinkedList,DracoLoader,DrawCommand,DynamicAtmosphereLightingType,DynamicEnvironmentMapManager,DynamicGeometryBatch,DynamicGeometryUpdater,EarthOrientationParameters,EarthOrientationParametersSample,EasingFunction,EllipseGeometry,EllipseGeometryLibrary,EllipseGeometryUpdater,EllipseGraphics,EllipseOutlineGeometry,Ellipsoid,EllipsoidGeodesic,EllipsoidGeometry,EllipsoidGeometryUpdater,EllipsoidGraphics,EllipsoidOutlineGeometry,EllipsoidPrimitive,EllipsoidRhumbLine,EllipsoidSurfaceAppearance,EllipsoidTangentPlane,EllipsoidTerrainProvider,EllipsoidalOccluder,Empty3DTileContent,EncodedCartesian3,Entity,EntityCluster,EntityCollection,EntityView,Event,EventHelper,Expression,ExpressionNodeType,ExtrapolationType,FeatureDetection,FeatureIdPipelineStage,Fog,ForEach,FrameRateMonitor,FrameState,Framebuffer,FramebufferManager,Frozen,FrustumCommands,FrustumGeometry,FrustumOutlineGeometry,Fullscreen,FullscreenButton,FullscreenButtonViewModel,GeoJsonDataSource,GeoJsonLoader,GeocodeType,Geocoder,GeocoderService,GeocoderViewModel,GeographicProjection,GeographicTilingScheme,Geometry,Geometry3DTileContent,GeometryAttribute,GeometryAttributes,GeometryFactory,GeometryInstance,GeometryInstanceAttribute,GeometryOffsetAttribute,GeometryPipeline,GeometryPipelineStage,GeometryType,GeometryUpdater,GeometryUpdaterSet,GeometryVisualizer,GetFeatureInfoFormat,Globe,GlobeDepth,GlobeSurfaceShaderSet,GlobeSurfaceTile,GlobeSurfaceTileProvider,GlobeTranslucency,GlobeTranslucencyFramebuffer,GlobeTranslucencyState,GltfBufferViewLoader,GltfDracoLoader,GltfGpmLoader,GltfGpmLocal,GltfImageLoader,GltfIndexBufferLoader,GltfJsonLoader,GltfLoader,GltfLoaderUtil,GltfMeshPrimitiveGpmLoader,GltfStructuralMetadataLoader,GltfTextureLoader,GltfVertexBufferLoader,GoogleEarthEnterpriseImageryProvider,GoogleEarthEnterpriseMapsProvider,GoogleEarthEnterpriseMetadata,GoogleEarthEnterpriseTerrainData,GoogleEarthEnterpriseTerrainProvider,GoogleEarthEnterpriseTileInformation,GoogleGeocoderService,GoogleMaps,GpxDataSource,GregorianDate,GridImageryProvider,GridMaterialProperty,GroundGeometryUpdater,GroundPolylineGeometry,GroundPolylinePrimitive,GroundPrimitive,GroupMetadata,HeadingPitchRange,HeadingPitchRoll,Heap,HeightReference,HeightmapEncoding,HeightmapTerrainData,HeightmapTessellator,HermitePolynomialApproximation,HermiteSpline,HilbertOrder,HomeButton,HomeButtonViewModel,HorizontalOrigin,I3SBuildingSceneLayerExplorer,I3SBuildingSceneLayerExplorerViewModel,I3SDataProvider,I3SDecoder,I3SFeature,I3SField,I3SGeometry,I3SLayer,I3SNode,I3SStatistics,I3SSublayer,I3SSymbology,I3dmLoader,I3dmParser,ITwinData,ITwinPlatform,Iau2000Orientation,Iau2006XysData,Iau2006XysSample,IauOrientationAxes,IauOrientationParameters,ImageBasedLighting,ImageBasedLightingPipelineStage,ImageMaterialProperty,Imagery,ImageryLayer,ImageryLayerCollection,ImageryLayerFeatureInfo,ImageryProvider,ImageryState,Implicit3DTileContent,ImplicitAvailabilityBitstream,ImplicitMetadataView,ImplicitSubdivisionScheme,ImplicitSubtree,ImplicitSubtreeCache,ImplicitSubtreeMetadata,ImplicitTileCoordinates,ImplicitTileset,IndexDatatype,InfoBox,InfoBoxViewModel,InspectorShared,InstanceAttributeSemantic,InstancingPipelineStage,InterpolationAlgorithm,InterpolationType,Intersect,IntersectionTests,Intersections2D,Interval,InvertClassification,Ion,IonGeocodeProviderType,IonGeocoderService,IonImageryProvider,IonResource,IonWorldImageryStyle,Iso8601,JobScheduler,JobType,JsonMetadataTable,JulianDate,KTX2Transcoder,KeyboardEventModifier,KeyframeNode,KmlCamera,KmlDataSource,KmlLookAt,KmlTour,KmlTourFlyTo,KmlTourWait,Label,LabelCollection,LabelGraphics,LabelStyle,LabelVisualizer,LagrangePolynomialApproximation,LeapSecond,Light,LightingModel,LightingPipelineStage,LinearApproximation,LinearSpline,ManagedArray,MapMode2D,MapProjection,MapboxImageryProvider,MapboxStyleImageryProvider,Material,MaterialAppearance,MaterialPipelineStage,MaterialProperty,Math,Matrix2,Matrix3,Matrix4,Megatexture,MeshPrimitiveGpmLocal,MetadataClass,MetadataClassProperty,MetadataComponentType,MetadataEntity,MetadataEnum,MetadataEnumValue,MetadataPicking,MetadataPickingPipelineStage,MetadataPipelineStage,MetadataSchema,MetadataSchemaLoader,MetadataSemantic,MetadataTable,MetadataTableProperty,MetadataType,MipmapHint,Model,Model3DTileContent,ModelAlphaOptions,ModelAnimation,ModelAnimationChannel,ModelAnimationCollection,ModelAnimationLoop,ModelAnimationState,ModelArticulation,ModelArticulationStage,ModelClippingPlanesPipelineStage,ModelClippingPolygonsPipelineStage,ModelColorPipelineStage,ModelComponents,ModelDrawCommand,ModelDrawCommands,ModelFeature,ModelFeatureTable,ModelGraphics,ModelLightingOptions,ModelMatrixUpdateStage,ModelNode,ModelRenderResources,ModelRuntimeNode,ModelRuntimePrimitive,ModelSceneGraph,ModelSilhouettePipelineStage,ModelSkin,ModelSplitterPipelineStage,ModelStatistics,ModelType,ModelUtility,ModelVisualizer,Moon,MorphTargetsPipelineStage,MorphWeightSpline,MortonOrder,Multiple3DTileContent,MultisampleFramebuffer,NavigationHelpButton,NavigationHelpButtonViewModel,NearFarScalar,NeverTileDiscardPolicy,NodeRenderResources,NodeStatisticsPipelineStage,NodeTransformationProperty,OIT,Occluder,OffsetGeometryInstanceAttribute,OpenCageGeocoderService,OpenStreetMapImageryProvider,OrderedGroundPrimitiveCollection,OrientedBoundingBox,OrthographicFrustum,OrthographicOffCenterFrustum,Packable,PackableForInterpolation,Particle,ParticleBurst,ParticleEmitter,ParticleSystem,Pass,PassState,PathGraphics,PathVisualizer,PeliasGeocoderService,PerInstanceColorAppearance,PerformanceDisplay,PerformanceWatchdog,PerformanceWatchdogViewModel,PerspectiveFrustum,PerspectiveOffCenterFrustum,PickDepth,PickDepthFramebuffer,PickFramebuffer,PickedMetadataInfo,Picking,PickingPipelineStage,PinBuilder,PixelDatatype,PixelFormat,Plane,PlaneGeometry,PlaneGeometryUpdater,PlaneGraphics,PlaneOutlineGeometry,PntsLoader,PntsParser,PointCloud,PointCloudEyeDomeLighting,PointCloudShading,PointCloudStylingPipelineStage,PointGraphics,PointPrimitive,PointPrimitiveCollection,PointVisualizer,PolygonGeometry,PolygonGeometryLibrary,PolygonGeometryUpdater,PolygonGraphics,PolygonHierarchy,PolygonOutlineGeometry,PolygonPipeline,Polyline,PolylineArrowMaterialProperty,PolylineCollection,PolylineColorAppearance,PolylineDashMaterialProperty,PolylineGeometry,PolylineGeometryUpdater,PolylineGlowMaterialProperty,PolylineGraphics,PolylineMaterialAppearance,PolylineOutlineMaterialProperty,PolylinePipeline,PolylineVisualizer,PolylineVolumeGeometry,PolylineVolumeGeometryLibrary,PolylineVolumeGeometryUpdater,PolylineVolumeGraphics,PolylineVolumeOutlineGeometry,PositionProperty,PositionPropertyArray,PostProcessStage,PostProcessStageCollection,PostProcessStageComposite,PostProcessStageLibrary,PostProcessStageSampleMode,PostProcessStageTextureCache,PpeMetadata,PpeSource,PpeTexture,Primitive,PrimitiveCollection,PrimitiveLoadPlan,PrimitiveOutlineGenerator,PrimitiveOutlinePipelineStage,PrimitivePipeline,PrimitiveRenderResources,PrimitiveState,PrimitiveStatisticsPipelineStage,PrimitiveType,ProjectionPicker,ProjectionPickerViewModel,Property,PropertyArray,PropertyAttribute,PropertyAttributeProperty,PropertyBag,PropertyTable,PropertyTexture,PropertyTextureProperty,ProviderViewModel,Proxy,QuadraticRealPolynomial,QuadtreeOccluders,QuadtreePrimitive,QuadtreeTile,QuadtreeTileLoadState,QuadtreeTileProvider,QuantizedMeshTerrainData,QuarticRealPolynomial,Quaternion,QuaternionSpline,Queue,Ray,Rectangle,RectangleCollisionChecker,RectangleGeometry,RectangleGeometryLibrary,RectangleGeometryUpdater,RectangleGraphics,RectangleOutlineGeometry,ReferenceFrame,ReferenceProperty,RenderState,Renderbuffer,RenderbufferFormat,Request,RequestErrorEvent,RequestScheduler,RequestState,RequestType,Resource,ResourceCache,ResourceCacheKey,ResourceCacheStatistics,ResourceLoader,ResourceLoaderState,Rotation,RuntimeError,S2Cell,SDFSettings,SampledPositionProperty,SampledProperty,Sampler,ScaledPositionProperty,Scene,SceneFramebuffer,SceneMode,SceneMode2DPipelineStage,SceneModePicker,SceneModePickerViewModel,SceneTransforms,SceneTransitioner,ScreenSpaceCameraController,ScreenSpaceEventHandler,ScreenSpaceEventType,SelectedFeatureIdPipelineStage,SelectionIndicator,SelectionIndicatorViewModel,SensorVolumePortionToDisplay,ShaderBuilder,ShaderCache,ShaderDestination,ShaderFunction,ShaderProgram,ShaderSource,ShaderStruct,ShadowMap,ShadowMapShader,ShadowMode,ShadowVolumeAppearance,ShowGeometryInstanceAttribute,Simon1994PlanetaryPositions,SimplePolylineGeometry,SingleTileImageryProvider,SkinningPipelineStage,SkyAtmosphere,SkyBox,SpatialNode,Spdcf,SpecularEnvironmentCubeMap,SphereEmitter,SphereGeometry,SphereOutlineGeometry,Spherical,Spline,SplitDirection,Splitter,StaticGeometryColorBatch,StaticGeometryPerMaterialBatch,StaticGroundGeometryColorBatch,StaticGroundGeometryPerMaterialBatch,StaticGroundPolylinePerMaterialBatch,StaticOutlineGeometryBatch,StencilConstants,StencilFunction,StencilOperation,SteppedSpline,Stereographic,StorageType,StripeMaterialProperty,StripeOrientation,StructuralMetadata,StyleCommandsNeeded,StyleExpression,Sun,SunLight,SunPostProcess,SupportedImageFormats,SvgPathBindingHandler,TaskProcessor,Terrain,TerrainData,TerrainEncoding,TerrainFillMesh,TerrainMesh,TerrainOffsetProperty,TerrainProvider,TerrainQuantization,TerrainState,Texture,TextureAtlas,TextureCache,TextureMagnificationFilter,TextureManager,TextureMinificationFilter,TexturePacker,TextureUniform,TextureWrap,TileAvailability,TileBoundingRegion,TileBoundingS2Cell,TileBoundingSphere,TileBoundingVolume,TileCoordinatesImageryProvider,TileDiscardPolicy,TileEdge,TileImagery,TileMapServiceImageryProvider,TileMetadata,TileOrientedBoundingBox,TileProviderError,TileReplacementQueue,TileSelectionResult,TileState,Tileset3DTileContent,TilesetMetadata,TilesetPipelineStage,TilingScheme,TimeConstants,TimeDynamicImagery,TimeDynamicPointCloud,TimeInterval,TimeIntervalCollection,TimeIntervalCollectionPositionProperty,TimeIntervalCollectionProperty,TimeStandard,Timeline,TimelineHighlightRange,TimelineTrack,Tipsify,ToggleButtonViewModel,Tonemapper,TrackingReferenceFrame,Transforms,TranslationRotationScale,TranslucentTileClassification,TridiagonalSystemSolver,TrustedServers,TweenCollection,UniformState,UniformType,UrlTemplateImageryProvider,VERSION,VRButton,VRButtonViewModel,VRTheWorldTerrainProvider,VaryingType,Vector3DTileBatch,Vector3DTileClampedPolylines,Vector3DTileContent,Vector3DTileGeometry,Vector3DTilePoints,Vector3DTilePolygons,Vector3DTilePolylines,Vector3DTilePrimitive,VelocityOrientationProperty,VelocityVectorProperty,VertexArray,VertexArrayFacade,VertexAttributeSemantic,VertexFormat,VerticalExaggeration,VerticalExaggerationPipelineStage,VerticalOrigin,VideoSynchronizer,View,Viewer,ViewportQuad,Visibility,Visualizer,VoxelBoxShape,VoxelCell,VoxelContent,VoxelCylinderShape,VoxelEllipsoidShape,VoxelInspector,VoxelInspectorViewModel,VoxelMetadataOrder,VoxelPrimitive,VoxelProvider,VoxelRenderResources,VoxelShape,VoxelShapeType,VoxelTraversal,VulkanConstants,WallGeometry,WallGeometryLibrary,WallGeometryUpdater,WallGraphics,WallOutlineGeometry,WebGLConstants,WebMapServiceImageryProvider,WebMapTileServiceImageryProvider,WebMercatorProjection,WebMercatorTilingScheme,WindingOrder,WireframeIndexGenerator,WireframePipelineStage,_shadersAcesTonemappingStage,_shadersAdditiveBlend,_shadersAdjustTranslucentFS,_shadersAllMaterialAppearanceFS,_shadersAllMaterialAppearanceVS,_shadersAmbientOcclusionGenerate,_shadersAmbientOcclusionModulate,_shadersAspectRampMaterial,_shadersAtmosphereCommon,_shadersAtmosphereStageFS,_shadersAtmosphereStageVS,_shadersBasicMaterialAppearanceFS,_shadersBasicMaterialAppearanceVS,_shadersBillboardCollectionFS,_shadersBillboardCollectionVS,_shadersBlackAndWhite,_shadersBloomComposite,_shadersBrdfLutGeneratorFS,_shadersBrightPass,_shadersBrightness,_shadersBumpMapMaterial,_shadersCPUStylingStageFS,_shadersCPUStylingStageVS,_shadersCheckerboardMaterial,_shadersCloudCollectionFS,_shadersCloudCollectionVS,_shadersCloudNoiseFS,_shadersCloudNoiseVS,_shadersCompareAndPackTranslucentDepth,_shadersCompositeOITFS,_shadersCompositeTranslucentClassification,_shadersComputeIrradianceFS,_shadersComputeRadianceMapFS,_shadersContrastBias,_shadersConvolveSpecularMapFS,_shadersConvolveSpecularMapVS,_shadersCustomShaderStageFS,_shadersCustomShaderStageVS,_shadersCzmBuiltins,_shadersDepthOfField,_shadersDepthPlaneFS,_shadersDepthPlaneVS,_shadersDepthView,_shadersDepthViewPacked,_shadersDotMaterial,_shadersEdgeDetection,_shadersElevationBandMaterial,_shadersElevationContourMaterial,_shadersElevationRampMaterial,_shadersEllipsoidFS,_shadersEllipsoidSurfaceAppearanceFS,_shadersEllipsoidSurfaceAppearanceVS,_shadersEllipsoidVS,_shadersFXAA,_shadersFXAA3_11,_shadersFadeMaterial,_shadersFeatureIdStageFS,_shadersFeatureIdStageVS,_shadersFilmicTonemapping,_shadersGaussianBlur1D,_shadersGeometryStageFS,_shadersGeometryStageVS,_shadersGlobeFS,_shadersGlobeVS,_shadersGridMaterial,_shadersGroundAtmosphere,_shadersHSBToRGB,_shadersHSLToRGB,_shadersImageBasedLightingStageFS,_shadersInstancingStageCommon,_shadersInstancingStageVS,_shadersIntersectBox,_shadersIntersectClippingPlanes,_shadersIntersectCylinder,_shadersIntersectDepth,_shadersIntersectEllipsoid,_shadersIntersectLongitude,_shadersIntersection,_shadersIntersectionUtils,_shadersLegacyInstancingStageVS,_shadersLensFlare,_shadersLightingStageFS,_shadersMaterialStageFS,_shadersMegatexture,_shadersMetadataStageFS,_shadersMetadataStageVS,_shadersModelClippingPlanesStageFS,_shadersModelClippingPolygonsStageFS,_shadersModelClippingPolygonsStageVS,_shadersModelColorStageFS,_shadersModelFS,_shadersModelSilhouetteStageFS,_shadersModelSilhouetteStageVS,_shadersModelSplitterStageFS,_shadersModelVS,_shadersModifiedReinhardTonemapping,_shadersMorphTargetsStageVS,_shadersNightVision,_shadersNormalMapMaterial,_shadersOctree,_shadersPassThrough,_shadersPassThroughDepth,_shadersPbrNeutralTonemapping,_shadersPerInstanceColorAppearanceFS,_shadersPerInstanceColorAppearanceVS,_shadersPerInstanceFlatColorAppearanceFS,_shadersPerInstanceFlatColorAppearanceVS,_shadersPointCloudEyeDomeLighting,_shadersPointCloudStylingStageVS,_shadersPointPrimitiveCollectionFS,_shadersPointPrimitiveCollectionVS,_shadersPolygonSignedDistanceFS,_shadersPolylineArrowMaterial,_shadersPolylineColorAppearanceVS,_shadersPolylineCommon,_shadersPolylineDashMaterial,_shadersPolylineFS,_shadersPolylineGlowMaterial,_shadersPolylineMaterialAppearanceVS,_shadersPolylineOutlineMaterial,_shadersPolylineShadowVolumeFS,_shadersPolylineShadowVolumeMorphFS,_shadersPolylineShadowVolumeMorphVS,_shadersPolylineShadowVolumeVS,_shadersPolylineVS,_shadersPrimitiveOutlineStageFS,_shadersPrimitiveOutlineStageVS,_shadersRGBToHSB,_shadersRGBToHSL,_shadersRGBToXYZ,_shadersReinhardTonemapping,_shadersReprojectWebMercatorFS,_shadersReprojectWebMercatorVS,_shadersRimLightingMaterial,_shadersSelectedFeatureIdStageCommon,_shadersShadowVolumeAppearanceFS,_shadersShadowVolumeAppearanceVS,_shadersShadowVolumeFS,_shadersSilhouette,_shadersSkinningStageVS,_shadersSkyAtmosphereCommon,_shadersSkyAtmosphereFS,_shadersSkyAtmosphereVS,_shadersSkyBoxFS,_shadersSkyBoxVS,_shadersSlopeRampMaterial,_shadersStripeMaterial,_shadersSunFS,_shadersSunTextureFS,_shadersSunVS,_shadersTexturedMaterialAppearanceFS,_shadersTexturedMaterialAppearanceVS,_shadersVector3DTileClampedPolylinesFS,_shadersVector3DTileClampedPolylinesVS,_shadersVector3DTilePolylinesVS,_shadersVectorTileVS,_shadersVerticalExaggerationStageVS,_shadersViewportQuadFS,_shadersViewportQuadVS,_shadersVoxelFS,_shadersVoxelUtils,_shadersVoxelVS,_shadersWater,_shadersWaterMaskMaterial,_shadersXYZToRGB,_shadersacesTonemapping,_shadersalphaWeight,_shadersantialias,_shadersapplyHSBShift,_shadersapproximateSphericalCoordinates,_shadersapproximateTanh,_shadersbackFacing,_shadersbranchFreeTernary,_shaderscascadeColor,_shaderscascadeDistance,_shaderscascadeMatrix,_shaderscascadeWeights,_shadersclipPolygons,_shaderscolumbusViewMorph,_shaderscomputeAtmosphereColor,_shaderscomputeGroundAtmosphereScattering,_shaderscomputePosition,_shaderscomputeScattering,_shadersconvertUvToBox,_shadersconvertUvToCylinder,_shadersconvertUvToEllipsoid,_shaderscosineAndSine,_shadersdecompressTextureCoordinates,_shadersdegreesPerRadian,_shadersdepthClamp,_shadersdepthRange,_shadersdepthRangeStruct,_shaderseastNorthUpToEyeCoordinates,_shadersellipsoidContainsPoint,_shadersellipsoidTextureCoordinates,_shadersepsilon1,_shadersepsilon2,_shadersepsilon3,_shadersepsilon4,_shadersepsilon5,_shadersepsilon6,_shadersepsilon7,_shadersequalsEpsilon,_shaderseyeOffset,_shaderseyeToWindowCoordinates,_shadersfastApproximateAtan,_shadersfog,_shadersgammaCorrect,_shadersgeodeticSurfaceNormal,_shadersgetDefaultMaterial,_shadersgetDynamicAtmosphereLightDirection,_shadersgetLambertDiffuse,_shadersgetSpecular,_shadersgetWaterNoise,_shadershue,_shadersinfinity,_shadersinverseGamma,_shadersisEmpty,_shadersisFull,_shaderslatitudeToWebMercatorFraction,_shaderslineDistance,_shaderslinearToSrgb,_shadersluminance,_shadersmaterial,_shadersmaterialInput,_shadersmaximumComponent,_shadersmetersPerPixel,_shadersmodelMaterial,_shadersmodelToWindowCoordinates,_shadersmodelVertexOutput,_shadersmultiplyWithColorBalance,_shadersnearFarScalar,_shadersoctDecode,_shadersoneOverPi,_shadersoneOverTwoPi,_shaderspackDepth,_shaderspassCesium3DTile,_shaderspassCesium3DTileClassification,_shaderspassCesium3DTileClassificationIgnoreShow,_shaderspassClassification,_shaderspassCompute,_shaderspassEnvironment,_shaderspassGlobe,_shaderspassOpaque,_shaderspassOverlay,_shaderspassTerrainClassification,_shaderspassTranslucent,_shaderspassVoxels,_shaderspbrLighting,_shaderspbrNeutralTonemapping,_shadersphong,_shaderspi,_shaderspiOverFour,_shaderspiOverSix,_shaderspiOverThree,_shaderspiOverTwo,_shadersplaneDistance,_shaderspointAlongRay,_shadersradiansPerDegree,_shadersray,_shadersrayEllipsoidIntersectionInterval,_shadersraySegment,_shadersraySphereIntersectionInterval,_shadersreadDepth,_shadersreadNonPerspective,_shadersreverseLogDepth,_shadersround,_shaderssaturation,_shaderssceneMode2D,_shaderssceneMode3D,_shaderssceneModeColumbusView,_shaderssceneModeMorphing,_shadersshadowDepthCompare,_shadersshadowParameters,_shadersshadowVisibility,_shaderssignNotZero,_shaderssolarRadius,_shaderssphericalHarmonics,_shaderssrgbToLinear,_shaderstangentToEyeSpaceMatrix,_shaderstextureCube,_shadersthreePiOver2,_shaderstransformPlane,_shaderstranslateRelativeToEye,_shaderstranslucentPhong,_shaderstranspose,_shaderstwoPi,_shadersunpackClippingExtents,_shadersunpackDepth,_shadersunpackFloat,_shadersunpackUint,_shadersvalueTransform,_shadersvertexLogDepth,_shaderswebMercatorMaxLatitude,_shaderswindowToEyeCoordinates,_shaderswriteDepthClamp,_shaderswriteLogDepth,_shaderswriteNonPerspective,addBuffer,addDefaults,addExtensionsRequired,addExtensionsUsed,addPipelineExtras,addToArray,appendForwardSlash,arrayRemoveDuplicates,barycentricCoordinates,binarySearch,buildModuleUrl,buildVoxelDrawCommands,clone,combine,computeFlyToLocationForRectangle,createBillboardPointCallback,createCommand,createDefaultImageryProviderViewModels,createDefaultTerrainProviderViewModels,createElevationBandMaterial,createGooglePhotorealistic3DTileset,createGuid,createMaterialPropertyDescriptor,createOsmBuildingsAsync,createPropertyDescriptor,createRawPropertyDescriptor,createTangentSpaceDebugPrimitive,createTaskProcessorWorker,createUniform,createUniformArray,createWorldBathymetryAsync,createWorldImageryAsync,createWorldTerrainAsync,decodeGoogleEarthEnterpriseData,decodeVectorPolylinePositions,defaultValue,defer,defined,demodernizeShader,deprecationWarning,destroyObject,exportKml,findAccessorMinMax,findContentMetadata,findGroupMetadata,findTileMetadata,forEachTextureInMaterial,formatError,freezeRenderState,getAbsoluteUri,getAccessorByteStride,getBaseUri,getBinaryAccessor,getClipAndStyleCode,getClippingFunction,getComponentReader,getElement,getExtensionFromUri,getFilenameFromUri,getImageFromTypedArray,getImagePixels,getJsonFromTypedArray,getMagic,getMetadataClassProperty,getMetadataProperty,getStringFromTypedArray,getTimestamp,hasExtension,heightReferenceOnEntityPropertyChanged,isBitSet,isBlobUri,isCrossOriginUrl,isDataUri,isLeapYear,knockout,knockout_3_5_1,knockout_es5,loadAndExecuteScript,loadCubeMap,loadImageFromTypedArray,loadKTX2,mergeSort,moveTechniqueRenderStates,moveTechniquesToExtension,numberOfComponentsForType,objectToQuery,oneTimeWarning,parseBatchTable,parseFeatureMetadataLegacy,parseGlb,parseResponseHeaders,parseStructuralMetadata,pickModel,pointInsideTriangle,preprocess3DTileContent,processVoxelProperties,queryToObject,readAccessorPacked,removeExtension,removeExtensionsRequired,removeExtensionsUsed,removePipelineExtras,removeUnusedElements,resizeImageToNextPowerOfTwo,sampleTerrain,sampleTerrainMostDetailed,scaleToGeodeticSurface,srgbToLinear,subdivideArray,subscribeAndEvaluate,updateAccessorComponentTypes,updateVersion,usesExtension,viewerCesium3DTilesInspectorMixin,viewerCesiumInspectorMixin,viewerDragDropMixin,viewerPerformanceWatchdogMixin,viewerVoxelInspectorMixin,webGLConstantToGlslType,wrapFunction,writeTextToCanvas});
//# sourceMappingURL=index.cjs.map
