/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.102
 *
 * 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 Cesium=(()=>{var ZAe=Object.create;var n3=Object.defineProperty;var JAe=Object.getOwnPropertyDescriptor;var QAe=Object.getOwnPropertyNames;var $Ae=Object.getPrototypeOf,exe=Object.prototype.hasOwnProperty;var U_=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Jc=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),txe=(e,t)=>{for(var n in t)n3(e,n,{get:t[n],enumerable:!0})},wK=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of QAe(t))!exe.call(e,o)&&o!==n&&n3(e,o,{get:()=>t[o],enumerable:!(i=JAe(t,o))||i.enumerable});return e};var vo=(e,t,n)=>(n=e!=null?ZAe($Ae(e)):{},wK(t||!e||!e.__esModule?n3(n,"default",{value:e,enumerable:!0}):n,e)),nxe=e=>wK(n3({},"__esModule",{value:!0}),e);var i3=Jc((qyt,PK)=>{var Im=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)};Im.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}};Im.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};Im.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};Im.prototype.random_int31=function(){return this.random_int()>>>1};Im.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Im.prototype.random=function(){return this.random_int()*(1/4294967296)};Im.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Im.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};PK.exports=Im});var KZ=Jc((HC,GC)=>{/*! https://mths.be/punycode v1.4.0 by @mathias */(function(e){var t=typeof HC=="object"&&HC&&!HC.nodeType&&HC,n=typeof GC=="object"&&GC&&!GC.nodeType&&GC,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(e=i);var o,r=2147483647,s=36,a=1,c=26,l=38,f=700,d=72,p=128,g="-",m=/^xn--/,A=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=s-a,E=Math.floor,S=String.fromCharCode,D;function w(U){throw new RangeError(C[U])}function R(U,G){for(var V=U.length,X=[];V--;)X[V]=G(U[V]);return X}function O(U,G){var V=U.split("@"),X="";V.length>1&&(X=V[0]+"@",U=V[1]),U=U.replace(x,".");var j=U.split("."),Q=R(j,G).join(".");return X+Q}function L(U){for(var G=[],V=0,X=U.length,j,Q;V<X;)j=U.charCodeAt(V++),j>=55296&&j<=56319&&V<X?(Q=U.charCodeAt(V++),(Q&64512)==56320?G.push(((j&1023)<<10)+(Q&1023)+65536):(G.push(j),V--)):G.push(j);return G}function N(U){return R(U,function(G){var V="";return G>65535&&(G-=65536,V+=S(G>>>10&1023|55296),G=56320|G&1023),V+=S(G),V}).join("")}function _(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:s}function b(U,G){return U+22+75*(U<26)-((G!=0)<<5)}function v(U,G,V){var X=0;for(U=V?E(U/f):U>>1,U+=E(U/G);U>T*c>>1;X+=s)U=E(U/T);return E(X+(T+1)*U/(U+l))}function I(U){var G=[],V=U.length,X,j=0,Q=p,W=d,K,J,_e,xe,re,ye,fe,Se,we;for(K=U.lastIndexOf(g),K<0&&(K=0),J=0;J<K;++J)U.charCodeAt(J)>=128&&w("not-basic"),G.push(U.charCodeAt(J));for(_e=K>0?K+1:0;_e<V;){for(xe=j,re=1,ye=s;_e>=V&&w("invalid-input"),fe=_(U.charCodeAt(_e++)),(fe>=s||fe>E((r-j)/re))&&w("overflow"),j+=fe*re,Se=ye<=W?a:ye>=W+c?c:ye-W,!(fe<Se);ye+=s)we=s-Se,re>E(r/we)&&w("overflow"),re*=we;X=G.length+1,W=v(j-xe,X,xe==0),E(j/X)>r-Q&&w("overflow"),Q+=E(j/X),j%=X,G.splice(j++,0,Q)}return N(G)}function B(U){var G,V,X,j,Q,W,K,J,_e,xe,re,ye=[],fe,Se,we,Ve;for(U=L(U),fe=U.length,G=p,V=0,Q=d,W=0;W<fe;++W)re=U[W],re<128&&ye.push(S(re));for(X=j=ye.length,j&&ye.push(g);X<fe;){for(K=r,W=0;W<fe;++W)re=U[W],re>=G&&re<K&&(K=re);for(Se=X+1,K-G>E((r-V)/Se)&&w("overflow"),V+=(K-G)*Se,G=K,W=0;W<fe;++W)if(re=U[W],re<G&&++V>r&&w("overflow"),re==G){for(J=V,_e=s;xe=_e<=Q?a:_e>=Q+c?c:_e-Q,!(J<xe);_e+=s)Ve=J-xe,we=s-xe,ye.push(S(b(xe+Ve%we,0))),J=E(Ve/we);ye.push(S(b(J,0))),Q=v(V,Se,X==j),V=0,++X}++V,++G}return ye.join("")}function F(U){return O(U,function(G){return m.test(G)?I(G.slice(4).toLowerCase()):G})}function k(U){return O(U,function(G){return A.test(G)?"xn--"+B(G):G})}if(o={version:"1.3.2",ucs2:{decode:L,encode:N},decode:I,encode:B,toASCII:k,toUnicode:F},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return o});else if(t&&n)if(GC.exports==t)n.exports=o;else for(D in o)o.hasOwnProperty(D)&&(t[D]=o[D]);else e.punycode=o})(HC)});var JZ=Jc((ZZ,P3)=>{/*!
 * 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 P3=="object"&&P3.exports?P3.exports=t():typeof define=="function"&&define.amd?define(t):e.IPv6=t(e)})(ZZ,function(e){"use strict";var t=e&&e.IPv6;function n(o){var r=o.toLowerCase(),s=r.split(":"),a=s.length,c=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&&(c=7);var l;for(l=0;l<a&&s[l]!=="";l++);if(l<c)for(s.splice(l,1,"0000");s.length<c;)s.splice(l,0,"0000");for(var f,d=0;d<c;d++){f=s[d].split("");for(var p=0;p<3&&(f[0]==="0"&&f.length>1);p++)f.splice(0,1);s[d]=f.join("")}var g=-1,m=0,A=0,x=-1,C=!1;for(d=0;d<c;d++)C?s[d]==="0"?A+=1:(C=!1,A>m&&(g=x,m=A)):s[d]==="0"&&(C=!0,x=d,A=1);A>m&&(g=x,m=A),m>1&&s.splice(g,m,""),a=s.length;var T="";for(s[0]===""&&(T=":"),d=0;d<a&&(T+=s[d],d!==a-1);d++)T+=":";return s[a-1]===""&&(T+=":"),T}function i(){return e.IPv6===this&&(e.IPv6=t),this}return{best:n,noConflict:i}})});var $Z=Jc((QZ,O3)=>{/*!
 * 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 O3=="object"&&O3.exports?O3.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)})(QZ,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 Ll=Jc((eJ,R3)=>{/*!
 * 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 R3=="object"&&R3.exports?R3.exports=t(KZ(),JZ(),$Z()):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(eJ,function(e,t,n,i){"use strict";var o=i&&i.URI;function r(b,v){var I=arguments.length>=1,B=arguments.length>=2;if(!(this instanceof r))return I?B?new r(b,v):new r(b):new r;if(b===void 0){if(I)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?b=location.href+"":b=""}if(b===null&&I)throw new TypeError("null is not a valid argument for URI");return this.href(b),v!==void 0?this.absoluteTo(v):this}function s(b){return/^[0-9]+$/.test(b)}r.version="1.19.11";var a=r.prototype,c=Object.prototype.hasOwnProperty;function l(b){return b.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(b){return b===void 0?"Undefined":String(Object.prototype.toString.call(b)).slice(8,-1)}function d(b){return f(b)==="Array"}function p(b,v){var I={},B,F;if(f(v)==="RegExp")I=null;else if(d(v))for(B=0,F=v.length;B<F;B++)I[v[B]]=!0;else I[v]=!0;for(B=0,F=b.length;B<F;B++){var k=I&&I[b[B]]!==void 0||!I&&v.test(b[B]);k&&(b.splice(B,1),F--,B--)}return b}function g(b,v){var I,B;if(d(v)){for(I=0,B=v.length;I<B;I++)if(!g(b,v[I]))return!1;return!0}var F=f(v);for(I=0,B=b.length;I<B;I++)if(F==="RegExp"){if(typeof b[I]=="string"&&b[I].match(v))return!0}else if(b[I]===v)return!0;return!1}function m(b,v){if(!d(b)||!d(v)||b.length!==v.length)return!1;b.sort(),v.sort();for(var I=0,B=b.length;I<B;I++)if(b[I]!==v[I])return!1;return!0}function A(b){var v=/^\/+|\/+$/g;return b.replace(v,"")}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(b){if(!(!b||!b.nodeName)){var v=b.nodeName.toLowerCase();if(!(v==="input"&&b.type!=="image"))return r.domAttributes[v]}};function x(b){return escape(b)}function C(b){return encodeURIComponent(b).replace(/[!'()*]/g,x).replace(/\*/g,"%2A")}r.encode=C,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=C,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(b,v){var I=r.encode(b+"");return v===void 0&&(v=r.escapeQuerySpace),v?I.replace(/%20/g,"+"):I},r.decodeQuery=function(b,v){b+="",v===void 0&&(v=r.escapeQuerySpace);try{return r.decode(v?b.replace(/\+/g,"%20"):b)}catch{return b}};var T={encode:"encode",decode:"decode"},E,S=function(b,v){return function(I){try{return r[v](I+"").replace(r.characters[b][v].expression,function(B){return r.characters[b][v].map[B]})}catch{return I}}};for(E in T)r[E+"PathSegment"]=S("pathname",T[E]),r[E+"UrnPathSegment"]=S("urnpath",T[E]);var D=function(b,v,I){return function(B){var F;I?F=function(V){return r[v](r[I](V))}:F=r[v];for(var k=(B+"").split(b),U=0,G=k.length;U<G;U++)k[U]=F(k[U]);return k.join(b)}};r.decodePath=D("/","decodePathSegment"),r.decodeUrnPath=D(":","decodeUrnPathSegment"),r.recodePath=D("/","encodePathSegment","decode"),r.recodeUrnPath=D(":","encodeUrnPathSegment","decode"),r.encodeReserved=S("reserved","encode"),r.parse=function(b,v){var I;return v||(v={preventInvalidHostname:r.preventInvalidHostname}),b=b.replace(r.leading_whitespace_expression,""),b=b.replace(r.ascii_tab_whitespace,""),I=b.indexOf("#"),I>-1&&(v.fragment=b.substring(I+1)||null,b=b.substring(0,I)),I=b.indexOf("?"),I>-1&&(v.query=b.substring(I+1)||null,b=b.substring(0,I)),b=b.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),b=b.replace(/^[/\\]{2,}/i,"//"),b.substring(0,2)==="//"?(v.protocol=null,b=b.substring(2),b=r.parseAuthority(b,v)):(I=b.indexOf(":"),I>-1&&(v.protocol=b.substring(0,I)||null,v.protocol&&!v.protocol.match(r.protocol_expression)?v.protocol=void 0:b.substring(I+1,I+3).replace(/\\/g,"/")==="//"?(b=b.substring(I+3),b=r.parseAuthority(b,v)):(b=b.substring(I+1),v.urn=!0))),v.path=b,v},r.parseHost=function(b,v){b||(b=""),b=b.replace(/\\/g,"/");var I=b.indexOf("/"),B,F;if(I===-1&&(I=b.length),b.charAt(0)==="[")B=b.indexOf("]"),v.hostname=b.substring(1,B)||null,v.port=b.substring(B+2,I)||null,v.port==="/"&&(v.port=null);else{var k=b.indexOf(":"),U=b.indexOf("/"),G=b.indexOf(":",k+1);G!==-1&&(U===-1||G<U)?(v.hostname=b.substring(0,I)||null,v.port=null):(F=b.substring(0,I).split(":"),v.hostname=F[0]||null,v.port=F[1]||null)}return v.hostname&&b.substring(I).charAt(0)!=="/"&&(I++,b="/"+b),v.preventInvalidHostname&&r.ensureValidHostname(v.hostname,v.protocol),v.port&&r.ensureValidPort(v.port),b.substring(I)||"/"},r.parseAuthority=function(b,v){return b=r.parseUserinfo(b,v),r.parseHost(b,v)},r.parseUserinfo=function(b,v){var I=b,B=b.indexOf("\\");B!==-1&&(b=b.replace(/\\/g,"/"));var F=b.indexOf("/"),k=b.lastIndexOf("@",F>-1?F:b.length-1),U;return k>-1&&(F===-1||k<F)?(U=b.substring(0,k).split(":"),v.username=U[0]?r.decode(U[0]):null,U.shift(),v.password=U[0]?r.decode(U.join(":")):null,b=I.substring(k+1)):(v.username=null,v.password=null),b},r.parseQuery=function(b,v){if(!b)return{};if(b=b.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!b)return{};for(var I={},B=b.split("&"),F=B.length,k,U,G,V=0;V<F;V++)k=B[V].split("="),U=r.decodeQuery(k.shift(),v),G=k.length?r.decodeQuery(k.join("="),v):null,U!=="__proto__"&&(c.call(I,U)?((typeof I[U]=="string"||I[U]===null)&&(I[U]=[I[U]]),I[U].push(G)):I[U]=G);return I},r.build=function(b){var v="",I=!1;return b.protocol&&(v+=b.protocol+":"),!b.urn&&(v||b.hostname)&&(v+="//",I=!0),v+=r.buildAuthority(b)||"",typeof b.path=="string"&&(b.path.charAt(0)!=="/"&&I&&(v+="/"),v+=b.path),typeof b.query=="string"&&b.query&&(v+="?"+b.query),typeof b.fragment=="string"&&b.fragment&&(v+="#"+b.fragment),v},r.buildHost=function(b){var v="";if(b.hostname)r.ip6_expression.test(b.hostname)?v+="["+b.hostname+"]":v+=b.hostname;else return"";return b.port&&(v+=":"+b.port),v},r.buildAuthority=function(b){return r.buildUserinfo(b)+r.buildHost(b)},r.buildUserinfo=function(b){var v="";return b.username&&(v+=r.encode(b.username)),b.password&&(v+=":"+r.encode(b.password)),v&&(v+="@"),v},r.buildQuery=function(b,v,I){var B="",F,k,U,G;for(k in b)if(k!=="__proto__"&&c.call(b,k))if(d(b[k]))for(F={},U=0,G=b[k].length;U<G;U++)b[k][U]!==void 0&&F[b[k][U]+""]===void 0&&(B+="&"+r.buildQueryParameter(k,b[k][U],I),v!==!0&&(F[b[k][U]+""]=!0));else b[k]!==void 0&&(B+="&"+r.buildQueryParameter(k,b[k],I));return B.substring(1)},r.buildQueryParameter=function(b,v,I){return r.encodeQuery(b,I)+(v!==null?"="+r.encodeQuery(v,I):"")},r.addQuery=function(b,v,I){if(typeof v=="object")for(var B in v)c.call(v,B)&&r.addQuery(b,B,v[B]);else if(typeof v=="string"){if(b[v]===void 0){b[v]=I;return}else typeof b[v]=="string"&&(b[v]=[b[v]]);d(I)||(I=[I]),b[v]=(b[v]||[]).concat(I)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(b,v,I){if(typeof v=="object")for(var B in v)c.call(v,B)&&r.setQuery(b,B,v[B]);else if(typeof v=="string")b[v]=I===void 0?null:I;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(b,v,I){var B,F,k;if(d(v))for(B=0,F=v.length;B<F;B++)b[v[B]]=void 0;else if(f(v)==="RegExp")for(k in b)v.test(k)&&(b[k]=void 0);else if(typeof v=="object")for(k in v)c.call(v,k)&&r.removeQuery(b,k,v[k]);else if(typeof v=="string")I!==void 0?f(I)==="RegExp"?!d(b[v])&&I.test(b[v])?b[v]=void 0:b[v]=p(b[v],I):b[v]===String(I)&&(!d(I)||I.length===1)?b[v]=void 0:d(b[v])&&(b[v]=p(b[v],I)):b[v]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(b,v,I,B){switch(f(v)){case"String":break;case"RegExp":for(var F in b)if(c.call(b,F)&&v.test(F)&&(I===void 0||r.hasQuery(b,F,I)))return!0;return!1;case"Object":for(var k in v)if(c.call(v,k)&&!r.hasQuery(b,k,v[k]))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 v in b;case"Boolean":var U=Boolean(d(b[v])?b[v].length:b[v]);return I===U;case"Function":return!!I(b[v],v,b);case"Array":if(!d(b[v]))return!1;var G=B?g:m;return G(b[v],I);case"RegExp":return d(b[v])?B?g(b[v],I):!1:Boolean(b[v]&&b[v].match(I));case"Number":I=String(I);case"String":return d(b[v])?B?g(b[v],I):!1:b[v]===I;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var b=[],v=[],I=0,B=0;B<arguments.length;B++){var F=new r(arguments[B]);b.push(F);for(var k=F.segment(),U=0;U<k.length;U++)typeof k[U]=="string"&&v.push(k[U]),k[U]&&I++}if(!v.length||!I)return new r("");var G=new r("").segment(v);return(b[0].path()===""||b[0].path().slice(0,1)==="/")&&G.path("/"+G.path()),G.normalize()},r.commonPath=function(b,v){var I=Math.min(b.length,v.length),B;for(B=0;B<I;B++)if(b.charAt(B)!==v.charAt(B)){B--;break}return B<1?b.charAt(0)===v.charAt(0)&&b.charAt(0)==="/"?"/":"":((b.charAt(B)!=="/"||v.charAt(B)!=="/")&&(B=b.substring(0,B).lastIndexOf("/")),b.substring(0,B+1))},r.withinString=function(b,v,I){I||(I={});var B=I.start||r.findUri.start,F=I.end||r.findUri.end,k=I.trim||r.findUri.trim,U=I.parens||r.findUri.parens,G=/[a-z0-9-]=["']?$/i;for(B.lastIndex=0;;){var V=B.exec(b);if(!V)break;var X=V.index;if(I.ignoreHtml){var j=b.slice(Math.max(X-3,0),X);if(j&&G.test(j))continue}for(var Q=X+b.slice(X).search(F),W=b.slice(X,Q),K=-1;;){var J=U.exec(W);if(!J)break;var _e=J.index+J[0].length;K=Math.max(K,_e)}if(K>-1?W=W.slice(0,K)+W.slice(K).replace(k,""):W=W.replace(k,""),!(W.length<=V[0].length)&&!(I.ignore&&I.ignore.test(W))){Q=X+W.length;var xe=v(W,X,Q,b);if(xe===void 0){B.lastIndex=Q;continue}xe=String(xe),b=b.slice(0,X)+xe+b.slice(Q),B.lastIndex=X+xe.length}}return B.lastIndex=0,b},r.ensureValidHostname=function(b,v){var I=!!b,B=!!v,F=!1;if(B&&(F=g(r.hostProtocols,v)),F&&!I)throw new TypeError("Hostname cannot be empty, if protocol is "+v);if(b&&b.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+b+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(b).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+b+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(b){if(b){var v=Number(b);if(!(s(v)&&v>0&&v<65536))throw new TypeError('Port "'+b+'" is not a valid port')}},r.noConflict=function(b){if(b){var v={URI:this.noConflict()};return i.URITemplate&&typeof i.URITemplate.noConflict=="function"&&(v.URITemplate=i.URITemplate.noConflict()),i.IPv6&&typeof i.IPv6.noConflict=="function"&&(v.IPv6=i.IPv6.noConflict()),i.SecondLevelDomains&&typeof i.SecondLevelDomains.noConflict=="function"&&(v.SecondLevelDomains=i.SecondLevelDomains.noConflict()),v}else i.URI===this&&(i.URI=o);return this},a.build=function(b){return b===!0?this._deferred_build=!0:(b===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 w(b){return function(v,I){return v===void 0?this._parts[b]||"":(this._parts[b]=v||null,this.build(!I),this)}}function R(b,v){return function(I,B){return I===void 0?this._parts[b]||"":(I!==null&&(I=I+"",I.charAt(0)===v&&(I=I.substring(1))),this._parts[b]=I,this.build(!B),this)}}a.protocol=w("protocol"),a.username=w("username"),a.password=w("password"),a.hostname=w("hostname"),a.port=w("port"),a.query=R("query","?"),a.fragment=R("fragment","#"),a.search=function(b,v){var I=this.query(b,v);return typeof I=="string"&&I.length?"?"+I:I},a.hash=function(b,v){var I=this.fragment(b,v);return typeof I=="string"&&I.length?"#"+I:I},a.pathname=function(b,v){if(b===void 0||b===!0){var I=this._parts.path||(this._parts.hostname?"/":"");return b?(this._parts.urn?r.decodeUrnPath:r.decodePath)(I):I}else return this._parts.urn?this._parts.path=b?r.recodeUrnPath(b):"":this._parts.path=b?r.recodePath(b):"/",this.build(!v),this},a.path=a.pathname,a.href=function(b,v){var I;if(b===void 0)return this.toString();this._string="",this._parts=r._parts();var B=b instanceof r,F=typeof b=="object"&&(b.hostname||b.path||b.pathname);if(b.nodeName){var k=r.getDomAttribute(b);b=b[k]||"",F=!1}if(!B&&F&&b.pathname!==void 0&&(b=b.toString()),typeof b=="string"||b instanceof String)this._parts=r.parse(String(b),this._parts);else if(B||F){var U=B?b._parts:b;for(I in U)I!=="query"&&c.call(this._parts,I)&&(this._parts[I]=U[I]);U.query&&this.query(U.query,!1)}else throw new TypeError("invalid input");return this.build(!v),this},a.is=function(b){var v=!1,I=!1,B=!1,F=!1,k=!1,U=!1,G=!1,V=!this._parts.urn;switch(this._parts.hostname&&(V=!1,I=r.ip4_expression.test(this._parts.hostname),B=r.ip6_expression.test(this._parts.hostname),v=I||B,F=!v,k=F&&n&&n.has(this._parts.hostname),U=F&&r.idn_expression.test(this._parts.hostname),G=F&&r.punycode_expression.test(this._parts.hostname)),b.toLowerCase()){case"relative":return V;case"absolute":return!V;case"domain":case"name":return F;case"sld":return k;case"ip":return v;case"ip4":case"ipv4":case"inet4":return I;case"ip6":case"ipv6":case"inet6":return B;case"idn":return U;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return G}return null};var O=a.protocol,L=a.port,N=a.hostname;a.protocol=function(b,v){if(b&&(b=b.replace(/:(\/\/)?$/,""),!b.match(r.protocol_expression)))throw new TypeError('Protocol "'+b+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return O.call(this,b,v)},a.scheme=a.protocol,a.port=function(b,v){return this._parts.urn?b===void 0?"":this:(b!==void 0&&(b===0&&(b=null),b&&(b+="",b.charAt(0)===":"&&(b=b.substring(1)),r.ensureValidPort(b))),L.call(this,b,v))},a.hostname=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b!==void 0){var I={preventInvalidHostname:this._parts.preventInvalidHostname},B=r.parseHost(b,I);if(B!=="/")throw new TypeError('Hostname "'+b+'" contains characters other than [A-Z0-9.-]');b=I.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(b,this._parts.protocol)}return N.call(this,b,v)},a.origin=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0){var I=this.protocol(),B=this.authority();return B?(I?I+"://":"")+this.authority():""}else{var F=r(b);return this.protocol(F.protocol()).authority(F.authority()).build(!v),this}},a.host=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0)return this._parts.hostname?r.buildHost(this._parts):"";var I=r.parseHost(b,this._parts);if(I!=="/")throw new TypeError('Hostname "'+b+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},a.authority=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0)return this._parts.hostname?r.buildAuthority(this._parts):"";var I=r.parseAuthority(b,this._parts);if(I!=="/")throw new TypeError('Hostname "'+b+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},a.userinfo=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0){var I=r.buildUserinfo(this._parts);return I&&I.substring(0,I.length-1)}else return b[b.length-1]!=="@"&&(b+="@"),r.parseUserinfo(b,this._parts),this.build(!v),this},a.resource=function(b,v){var I;return b===void 0?this.path()+this.search()+this.hash():(I=r.parse(b),this._parts.path=I.path,this._parts.query=I.query,this._parts.fragment=I.fragment,this.build(!v),this)},a.subdomain=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===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 B=this._parts.hostname.length-this.domain().length,F=this._parts.hostname.substring(0,B),k=new RegExp("^"+l(F));if(b&&b.charAt(b.length-1)!=="."&&(b+="."),b.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return b&&r.ensureValidHostname(b,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(k,b),this.build(!v),this}},a.domain=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(typeof b=="boolean"&&(v=b,b=void 0),b===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 B=this._parts.hostname.length-this.tld(v).length-1;return B=this._parts.hostname.lastIndexOf(".",B-1)+1,this._parts.hostname.substring(B)||""}else{if(!b)throw new TypeError("cannot set domain empty");if(b.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(b,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=b;else{var F=new RegExp(l(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(F,b)}return this.build(!v),this}},a.tld=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(typeof b=="boolean"&&(v=b,b=void 0),b===void 0){if(!this._parts.hostname||this.is("IP"))return"";var I=this._parts.hostname.lastIndexOf("."),B=this._parts.hostname.substring(I+1);return v!==!0&&n&&n.list[B.toLowerCase()]&&n.get(this._parts.hostname)||B}else{var F;if(b)if(b.match(/[^a-zA-Z0-9-]/))if(n&&n.is(b))F=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(F,b);else throw new TypeError('TLD "'+b+'" 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");F=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(F,b)}else throw new TypeError("cannot set TLD empty");return this.build(!v),this}},a.directory=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0||b===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var I=this._parts.path.length-this.filename().length-1,B=this._parts.path.substring(0,I)||(this._parts.hostname?"/":"");return b?r.decodePath(B):B}else{var F=this._parts.path.length-this.filename().length,k=this._parts.path.substring(0,F),U=new RegExp("^"+l(k));return this.is("relative")||(b||(b="/"),b.charAt(0)!=="/"&&(b="/"+b)),b&&b.charAt(b.length-1)!=="/"&&(b+="/"),b=r.recodePath(b),this._parts.path=this._parts.path.replace(U,b),this.build(!v),this}},a.filename=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(typeof b!="string"){if(!this._parts.path||this._parts.path==="/")return"";var I=this._parts.path.lastIndexOf("/"),B=this._parts.path.substring(I+1);return b?r.decodePathSegment(B):B}else{var F=!1;b.charAt(0)==="/"&&(b=b.substring(1)),b.match(/\.?\//)&&(F=!0);var k=new RegExp(l(this.filename())+"$");return b=r.recodePath(b),this._parts.path=this._parts.path.replace(k,b),F?this.normalizePath(v):this.build(!v),this}},a.suffix=function(b,v){if(this._parts.urn)return b===void 0?"":this;if(b===void 0||b===!0){if(!this._parts.path||this._parts.path==="/")return"";var I=this.filename(),B=I.lastIndexOf("."),F,k;return B===-1?"":(F=I.substring(B+1),k=/^[a-z0-9%]+$/i.test(F)?F:"",b?r.decodePathSegment(k):k)}else{b.charAt(0)==="."&&(b=b.substring(1));var U=this.suffix(),G;if(U)b?G=new RegExp(l(U)+"$"):G=new RegExp(l("."+U)+"$");else{if(!b)return this;this._parts.path+="."+r.recodePath(b)}return G&&(b=r.recodePath(b),this._parts.path=this._parts.path.replace(G,b)),this.build(!v),this}},a.segment=function(b,v,I){var B=this._parts.urn?":":"/",F=this.path(),k=F.substring(0,1)==="/",U=F.split(B);if(b!==void 0&&typeof b!="number"&&(I=v,v=b,b=void 0),b!==void 0&&typeof b!="number")throw new Error('Bad segment "'+b+'", must be 0-based integer');if(k&&U.shift(),b<0&&(b=Math.max(U.length+b,0)),v===void 0)return b===void 0?U:U[b];if(b===null||U[b]===void 0)if(d(v)){U=[];for(var G=0,V=v.length;G<V;G++)!v[G].length&&(!U.length||!U[U.length-1].length)||(U.length&&!U[U.length-1].length&&U.pop(),U.push(A(v[G])))}else(v||typeof v=="string")&&(v=A(v),U[U.length-1]===""?U[U.length-1]=v:U.push(v));else v?U[b]=A(v):U.splice(b,1);return k&&U.unshift(""),this.path(U.join(B),I)},a.segmentCoded=function(b,v,I){var B,F,k;if(typeof b!="number"&&(I=v,v=b,b=void 0),v===void 0){if(B=this.segment(b,v,I),!d(B))B=B!==void 0?r.decode(B):void 0;else for(F=0,k=B.length;F<k;F++)B[F]=r.decode(B[F]);return B}if(!d(v))v=typeof v=="string"||v instanceof String?r.encode(v):v;else for(F=0,k=v.length;F<k;F++)v[F]=r.encode(v[F]);return this.segment(b,v,I)};var _=a.query;return a.query=function(b,v){if(b===!0)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof b=="function"){var I=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),B=b.call(this,I);return this._parts.query=r.buildQuery(B||I,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this}else return b!==void 0&&typeof b!="string"?(this._parts.query=r.buildQuery(b,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this):_.call(this,b,v)},a.setQuery=function(b,v,I){var B=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof b=="string"||b instanceof String)B[b]=v!==void 0?v:null;else if(typeof b=="object")for(var F in b)c.call(b,F)&&(B[F]=b[F]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=r.buildQuery(B,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof b!="string"&&(I=v),this.build(!I),this},a.addQuery=function(b,v,I){var B=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(B,b,v===void 0?null:v),this._parts.query=r.buildQuery(B,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof b!="string"&&(I=v),this.build(!I),this},a.removeQuery=function(b,v,I){var B=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(B,b,v),this._parts.query=r.buildQuery(B,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof b!="string"&&(I=v),this.build(!I),this},a.hasQuery=function(b,v,I){var B=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(B,b,v,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(b){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!b)),this},a.normalizeHostname=function(b){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(!b)),this},a.normalizePort=function(b){return typeof this._parts.protocol=="string"&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!b)),this},a.normalizePath=function(b){var v=this._parts.path;if(!v)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!b),this;if(this._parts.path==="/")return this;v=r.recodePath(v);var I,B="",F,k;for(v.charAt(0)!=="/"&&(I=!0,v="/"+v),(v.slice(-3)==="/.."||v.slice(-2)==="/.")&&(v+="/"),v=v.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),I&&(B=v.substring(1).match(/^(\.\.\/)+/)||"",B&&(B=B[0]));F=v.search(/\/\.\.(\/|$)/),F!==-1;){if(F===0){v=v.substring(3);continue}k=v.substring(0,F).lastIndexOf("/"),k===-1&&(k=F),v=v.substring(0,k)+v.substring(F+3)}return I&&this.is("relative")&&(v=B+v.substring(1)),this._parts.path=v,this.build(!b),this},a.normalizePathname=a.normalizePath,a.normalizeQuery=function(b){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(!b)),this},a.normalizeFragment=function(b){return this._parts.fragment||(this._parts.fragment=null,this.build(!b)),this},a.normalizeSearch=a.normalizeQuery,a.normalizeHash=a.normalizeFragment,a.iso8859=function(){var b=r.encode,v=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=b,r.decode=v}return this},a.unicode=function(){var b=r.encode,v=r.decode;r.encode=C,r.decode=unescape;try{this.normalize()}finally{r.encode=b,r.decode=v}return this},a.readable=function(){var b=this.clone();b.username("").password("").normalize();var v="";if(b._parts.protocol&&(v+=b._parts.protocol+"://"),b._parts.hostname&&(b.is("punycode")&&e?(v+=e.toUnicode(b._parts.hostname),b._parts.port&&(v+=":"+b._parts.port)):v+=b.host()),b._parts.hostname&&b._parts.path&&b._parts.path.charAt(0)!=="/"&&(v+="/"),v+=b.path(!0),b._parts.query){for(var I="",B=0,F=b._parts.query.split("&"),k=F.length;B<k;B++){var U=(F[B]||"").split("=");I+="&"+r.decodeQuery(U[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),U[1]!==void 0&&(I+="="+r.decodeQuery(U[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}v+="?"+I.substring(1)}return v+=r.decodeQuery(b.hash(),!0),v},a.absoluteTo=function(b){var v=this.clone(),I=["protocol","username","password","hostname","port"],B,F,k;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(b instanceof r||(b=new r(b)),v._parts.protocol||(v._parts.protocol=b._parts.protocol,this._parts.hostname))return v;for(F=0;k=I[F];F++)v._parts[k]=b._parts[k];return v._parts.path?(v._parts.path.substring(-2)===".."&&(v._parts.path+="/"),v.path().charAt(0)!=="/"&&(B=b.directory(),B=B||(b.path().indexOf("/")===0?"/":""),v._parts.path=(B?B+"/":"")+v._parts.path,v.normalizePath())):(v._parts.path=b._parts.path,v._parts.query||(v._parts.query=b._parts.query)),v.build(),v},a.relativeTo=function(b){var v=this.clone().normalize(),I,B,F,k,U;if(v._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(b=new r(b).normalize(),I=v._parts,B=b._parts,k=v.path(),U=b.path(),k.charAt(0)!=="/")throw new Error("URI is already relative");if(U.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(I.protocol===B.protocol&&(I.protocol=null),I.username!==B.username||I.password!==B.password||I.protocol!==null||I.username!==null||I.password!==null)return v.build();if(I.hostname===B.hostname&&I.port===B.port)I.hostname=null,I.port=null;else return v.build();if(k===U)return I.path="",v.build();if(F=r.commonPath(k,U),!F)return v.build();var G=B.path.substring(F.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return I.path=G+I.path.substring(F.length)||"./",v.build()},a.equals=function(b){var v=this.clone(),I=new r(b),B={},F={},k={},U,G,V;if(v.normalize(),I.normalize(),v.toString()===I.toString())return!0;if(U=v.query(),G=I.query(),v.query(""),I.query(""),v.toString()!==I.toString()||U.length!==G.length)return!1;B=r.parseQuery(U,this._parts.escapeQuerySpace),F=r.parseQuery(G,this._parts.escapeQuerySpace);for(V in B)if(c.call(B,V)){if(d(B[V])){if(!m(B[V],F[V]))return!1}else if(B[V]!==F[V])return!1;k[V]=!0}for(V in F)if(c.call(F,V)&&!k[V])return!1;return!0},a.preventInvalidHostname=function(b){return this._parts.preventInvalidHostname=!!b,this},a.duplicateQueryParameters=function(b){return this._parts.duplicateQueryParameters=!!b,this},a.escapeQuerySpace=function(b){return this._parts.escapeQuerySpace=!!b,this},r})});var Qee=Jc(($8,e5)=>{/*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE */(function(e,t){typeof $8=="object"&&typeof e5<"u"?e5.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.DOMPurify=t())})($8,function(){"use strict";function e(me){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(be){return typeof be}:function(be){return be&&typeof Symbol=="function"&&be.constructor===Symbol&&be!==Symbol.prototype?"symbol":typeof be},e(me)}function t(me,be){return t=Object.setPrototypeOf||function(qt,Kn){return qt.__proto__=Kn,qt},t(me,be)}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function i(me,be,St){return n()?i=Reflect.construct:i=function(Kn,Ro,Uo){var Ao=[null];Ao.push.apply(Ao,Ro);var Yr=Function.bind.apply(Kn,Ao),Be=new Yr;return Uo&&t(Be,Uo.prototype),Be},i.apply(null,arguments)}function o(me){return r(me)||s(me)||a(me)||l()}function r(me){if(Array.isArray(me))return c(me)}function s(me){if(typeof Symbol<"u"&&me[Symbol.iterator]!=null||me["@@iterator"]!=null)return Array.from(me)}function a(me,be){if(me){if(typeof me=="string")return c(me,be);var St=Object.prototype.toString.call(me).slice(8,-1);if(St==="Object"&&me.constructor&&(St=me.constructor.name),St==="Map"||St==="Set")return Array.from(me);if(St==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(St))return c(me,be)}}function c(me,be){(be==null||be>me.length)&&(be=me.length);for(var St=0,qt=new Array(be);St<be;St++)qt[St]=me[St];return qt}function l(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var f=Object.hasOwnProperty,d=Object.setPrototypeOf,p=Object.isFrozen,g=Object.getPrototypeOf,m=Object.getOwnPropertyDescriptor,A=Object.freeze,x=Object.seal,C=Object.create,T=typeof Reflect<"u"&&Reflect,E=T.apply,S=T.construct;E||(E=function(be,St,qt){return be.apply(St,qt)}),A||(A=function(be){return be}),x||(x=function(be){return be}),S||(S=function(be,St){return i(be,o(St))});var D=F(Array.prototype.forEach),w=F(Array.prototype.pop),R=F(Array.prototype.push),O=F(String.prototype.toLowerCase),L=F(String.prototype.toString),N=F(String.prototype.match),_=F(String.prototype.replace),b=F(String.prototype.indexOf),v=F(String.prototype.trim),I=F(RegExp.prototype.test),B=k(TypeError);function F(me){return function(be){for(var St=arguments.length,qt=new Array(St>1?St-1:0),Kn=1;Kn<St;Kn++)qt[Kn-1]=arguments[Kn];return E(me,be,qt)}}function k(me){return function(){for(var be=arguments.length,St=new Array(be),qt=0;qt<be;qt++)St[qt]=arguments[qt];return S(me,St)}}function U(me,be,St){St=St||O,d&&d(me,null);for(var qt=be.length;qt--;){var Kn=be[qt];if(typeof Kn=="string"){var Ro=St(Kn);Ro!==Kn&&(p(be)||(be[qt]=Ro),Kn=Ro)}me[Kn]=!0}return me}function G(me){var be=C(null),St;for(St in me)E(f,me,[St])===!0&&(be[St]=me[St]);return be}function V(me,be){for(;me!==null;){var St=m(me,be);if(St){if(St.get)return F(St.get);if(typeof St.value=="function")return F(St.value)}me=g(me)}function qt(Kn){return console.warn("fallback value for",Kn),null}return qt}var X=A(["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"]),j=A(["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"]),Q=A(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),W=A(["animate","color-profile","cursor","discard","fedropshadow","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"]),K=A(["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"]),J=A(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_e=A(["#text"]),xe=A(["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","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","xmlns","slot"]),re=A(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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"]),ye=A(["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"]),fe=A(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Se=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),we=x(/<%[\w\W]*|[\w\W]*%>/gm),Ve=x(/\${[\w\W]*}/gm),qe=x(/^data-[\-\w.\u00B7-\uFFFF]/),mt=x(/^aria-[\-\w]+$/),Ht=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fn=x(/^(?:\w+script|data):/i),dt=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tn=x(/^html$/i),Jn=function(){return typeof window>"u"?null:window},Gt=function(be,St){if(e(be)!=="object"||typeof be.createPolicy!="function")return null;var qt=null,Kn="data-tt-policy-suffix";St.currentScript&&St.currentScript.hasAttribute(Kn)&&(qt=St.currentScript.getAttribute(Kn));var Ro="dompurify"+(qt?"#"+qt:"");try{return be.createPolicy(Ro,{createHTML:function(Ao){return Ao},createScriptURL:function(Ao){return Ao}})}catch{return console.warn("TrustedTypes policy "+Ro+" could not be created."),null}};function Je(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Jn(),be=function(De){return Je(De)};if(be.version="2.4.3",be.removed=[],!me||!me.document||me.document.nodeType!==9)return be.isSupported=!1,be;var St=me.document,qt=me.document,Kn=me.DocumentFragment,Ro=me.HTMLTemplateElement,Uo=me.Node,Ao=me.Element,Yr=me.NodeFilter,Be=me.NamedNodeMap,it=Be===void 0?me.NamedNodeMap||me.MozNamedAttrMap:Be,Ke=me.HTMLFormElement,Ze=me.DOMParser,ft=me.trustedTypes,Lt=Ao.prototype,En=V(Lt,"cloneNode"),so=V(Lt,"nextSibling"),So=V(Lt,"childNodes"),ns=V(Lt,"parentNode");if(typeof Ro=="function"){var Nr=qt.createElement("template");Nr.content&&Nr.content.ownerDocument&&(qt=Nr.content.ownerDocument)}var Hi=Gt(ft,St),Oi=Hi?Hi.createHTML(""):"",Ar=qt,Mn=Ar.implementation,Yn=Ar.createNodeIterator,Zn=Ar.createDocumentFragment,ti=Ar.getElementsByTagName,hc=St.importNode,Do={};try{Do=G(qt).documentMode?qt.documentMode:{}}catch{}var Bo={};be.isSupported=typeof ns=="function"&&Mn&&typeof Mn.createHTMLDocument<"u"&&Do!==9;var kf=Se,er=we,ba=Ve,lh=qe,V_=mt,Sa=fn,uh=dt,i0=Ht,tr=null,mc=U({},[].concat(o(X),o(j),o(Q),o(K),o(_e))),qr=null,K2=U({},[].concat(o(xe),o(re),o(ye),o(fe))),Xr=Object.seal(Object.create(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}})),VS=null,IH=null,uK=!0,PH=!0,fK=!1,IC=!1,o0=!1,OH=!1,RH=!1,PC=!1,Z2=!1,J2=!1,dK=!0,hK=!1,zAe="user-content-",BH=!0,US=!1,OC={},RC=null,mK=U({},["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"]),pK=null,_K=U({},["audio","video","img","source","image","track"]),MH=null,gK=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Q2="http://www.w3.org/1998/Math/MathML",$2="http://www.w3.org/2000/svg",Dm="http://www.w3.org/1999/xhtml",BC=Dm,LH=!1,NH=null,HAe=U({},[Q2,$2,Dm],L),r0,GAe=["application/xhtml+xml","text/html"],WAe="text/html",Bs,MC=null,jAe=qt.createElement("form"),yK=function(De){return De instanceof RegExp||De instanceof Function},FH=function(De){MC&&MC===De||((!De||e(De)!=="object")&&(De={}),De=G(De),r0=GAe.indexOf(De.PARSER_MEDIA_TYPE)===-1?r0=WAe:r0=De.PARSER_MEDIA_TYPE,Bs=r0==="application/xhtml+xml"?L:O,tr="ALLOWED_TAGS"in De?U({},De.ALLOWED_TAGS,Bs):mc,qr="ALLOWED_ATTR"in De?U({},De.ALLOWED_ATTR,Bs):K2,NH="ALLOWED_NAMESPACES"in De?U({},De.ALLOWED_NAMESPACES,L):HAe,MH="ADD_URI_SAFE_ATTR"in De?U(G(gK),De.ADD_URI_SAFE_ATTR,Bs):gK,pK="ADD_DATA_URI_TAGS"in De?U(G(_K),De.ADD_DATA_URI_TAGS,Bs):_K,RC="FORBID_CONTENTS"in De?U({},De.FORBID_CONTENTS,Bs):mK,VS="FORBID_TAGS"in De?U({},De.FORBID_TAGS,Bs):{},IH="FORBID_ATTR"in De?U({},De.FORBID_ATTR,Bs):{},OC="USE_PROFILES"in De?De.USE_PROFILES:!1,uK=De.ALLOW_ARIA_ATTR!==!1,PH=De.ALLOW_DATA_ATTR!==!1,fK=De.ALLOW_UNKNOWN_PROTOCOLS||!1,IC=De.SAFE_FOR_TEMPLATES||!1,o0=De.WHOLE_DOCUMENT||!1,PC=De.RETURN_DOM||!1,Z2=De.RETURN_DOM_FRAGMENT||!1,J2=De.RETURN_TRUSTED_TYPE||!1,RH=De.FORCE_BODY||!1,dK=De.SANITIZE_DOM!==!1,hK=De.SANITIZE_NAMED_PROPS||!1,BH=De.KEEP_CONTENT!==!1,US=De.IN_PLACE||!1,i0=De.ALLOWED_URI_REGEXP||i0,BC=De.NAMESPACE||Dm,De.CUSTOM_ELEMENT_HANDLING&&yK(De.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Xr.tagNameCheck=De.CUSTOM_ELEMENT_HANDLING.tagNameCheck),De.CUSTOM_ELEMENT_HANDLING&&yK(De.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Xr.attributeNameCheck=De.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),De.CUSTOM_ELEMENT_HANDLING&&typeof De.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Xr.allowCustomizedBuiltInElements=De.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),IC&&(PH=!1),Z2&&(PC=!0),OC&&(tr=U({},o(_e)),qr=[],OC.html===!0&&(U(tr,X),U(qr,xe)),OC.svg===!0&&(U(tr,j),U(qr,re),U(qr,fe)),OC.svgFilters===!0&&(U(tr,Q),U(qr,re),U(qr,fe)),OC.mathMl===!0&&(U(tr,K),U(qr,ye),U(qr,fe))),De.ADD_TAGS&&(tr===mc&&(tr=G(tr)),U(tr,De.ADD_TAGS,Bs)),De.ADD_ATTR&&(qr===K2&&(qr=G(qr)),U(qr,De.ADD_ATTR,Bs)),De.ADD_URI_SAFE_ATTR&&U(MH,De.ADD_URI_SAFE_ATTR,Bs),De.FORBID_CONTENTS&&(RC===mK&&(RC=G(RC)),U(RC,De.FORBID_CONTENTS,Bs)),BH&&(tr["#text"]=!0),o0&&U(tr,["html","head","body"]),tr.table&&(U(tr,["tbody"]),delete VS.tbody),A&&A(De),MC=De)},AK=U({},["mi","mo","mn","ms","mtext"]),xK=U({},["foreignobject","desc","title","annotation-xml"]),YAe=U({},["title","style","font","a","script"]),e3=U({},j);U(e3,Q),U(e3,W);var VH=U({},K);U(VH,J);var qAe=function(De){var yt=ns(De);(!yt||!yt.tagName)&&(yt={namespaceURI:BC,tagName:"template"});var jt=O(De.tagName),ao=O(yt.tagName);return NH[De.namespaceURI]?De.namespaceURI===$2?yt.namespaceURI===Dm?jt==="svg":yt.namespaceURI===Q2?jt==="svg"&&(ao==="annotation-xml"||AK[ao]):Boolean(e3[jt]):De.namespaceURI===Q2?yt.namespaceURI===Dm?jt==="math":yt.namespaceURI===$2?jt==="math"&&xK[ao]:Boolean(VH[jt]):De.namespaceURI===Dm?yt.namespaceURI===$2&&!xK[ao]||yt.namespaceURI===Q2&&!AK[ao]?!1:!VH[jt]&&(YAe[jt]||!e3[jt]):!!(r0==="application/xhtml+xml"&&NH[De.namespaceURI]):!1},vm=function(De){R(be.removed,{element:De});try{De.parentNode.removeChild(De)}catch{try{De.outerHTML=Oi}catch{De.remove()}}},UH=function(De,yt){try{R(be.removed,{attribute:yt.getAttributeNode(De),from:yt})}catch{R(be.removed,{attribute:null,from:yt})}if(yt.removeAttribute(De),De==="is"&&!qr[De])if(PC||Z2)try{vm(yt)}catch{}else try{yt.setAttribute(De,"")}catch{}},CK=function(De){var yt,jt;if(RH)De="<remove></remove>"+De;else{var ao=N(De,/^[\r\n\t ]+/);jt=ao&&ao[0]}r0==="application/xhtml+xml"&&BC===Dm&&(De='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+De+"</body></html>");var Zc=Hi?Hi.createHTML(De):De;if(BC===Dm)try{yt=new Ze().parseFromString(Zc,r0)}catch{}if(!yt||!yt.documentElement){yt=Mn.createDocument(BC,"template",null);try{yt.documentElement.innerHTML=LH?Oi:Zc}catch{}}var Da=yt.body||yt.documentElement;return De&&jt&&Da.insertBefore(qt.createTextNode(jt),Da.childNodes[0]||null),BC===Dm?ti.call(yt,o0?"html":"body")[0]:o0?yt.documentElement:Da},TK=function(De){return Yn.call(De.ownerDocument||De,De,Yr.SHOW_ELEMENT|Yr.SHOW_COMMENT|Yr.SHOW_TEXT,null,!1)},XAe=function(De){return De instanceof Ke&&(typeof De.nodeName!="string"||typeof De.textContent!="string"||typeof De.removeChild!="function"||!(De.attributes instanceof it)||typeof De.removeAttribute!="function"||typeof De.setAttribute!="function"||typeof De.namespaceURI!="string"||typeof De.insertBefore!="function"||typeof De.hasChildNodes!="function")},kS=function(De){return e(Uo)==="object"?De instanceof Uo:De&&e(De)==="object"&&typeof De.nodeType=="number"&&typeof De.nodeName=="string"},wm=function(De,yt,jt){Bo[De]&&D(Bo[De],function(ao){ao.call(be,yt,jt,MC)})},EK=function(De){var yt;if(wm("beforeSanitizeElements",De,null),XAe(De)||I(/[\u0080-\uFFFF]/,De.nodeName))return vm(De),!0;var jt=Bs(De.nodeName);if(wm("uponSanitizeElement",De,{tagName:jt,allowedTags:tr}),De.hasChildNodes()&&!kS(De.firstElementChild)&&(!kS(De.content)||!kS(De.content.firstElementChild))&&I(/<[/\w]/g,De.innerHTML)&&I(/<[/\w]/g,De.textContent)||jt==="select"&&I(/<template/i,De.innerHTML))return vm(De),!0;if(!tr[jt]||VS[jt]){if(!VS[jt]&&SK(jt)&&(Xr.tagNameCheck instanceof RegExp&&I(Xr.tagNameCheck,jt)||Xr.tagNameCheck instanceof Function&&Xr.tagNameCheck(jt)))return!1;if(BH&&!RC[jt]){var ao=ns(De)||De.parentNode,Zc=So(De)||De.childNodes;if(Zc&&ao)for(var Da=Zc.length,ia=Da-1;ia>=0;--ia)ao.insertBefore(En(Zc[ia],!0),so(De))}return vm(De),!0}return De instanceof Ao&&!qAe(De)||(jt==="noscript"||jt==="noembed")&&I(/<\/no(script|embed)/i,De.innerHTML)?(vm(De),!0):(IC&&De.nodeType===3&&(yt=De.textContent,yt=_(yt,kf," "),yt=_(yt,er," "),yt=_(yt,ba," "),De.textContent!==yt&&(R(be.removed,{element:De.cloneNode()}),De.textContent=yt)),wm("afterSanitizeElements",De,null),!1)},bK=function(De,yt,jt){if(dK&&(yt==="id"||yt==="name")&&(jt in qt||jt in jAe))return!1;if(!(PH&&!IH[yt]&&I(lh,yt))){if(!(uK&&I(V_,yt))){if(!qr[yt]||IH[yt]){if(!(SK(De)&&(Xr.tagNameCheck instanceof RegExp&&I(Xr.tagNameCheck,De)||Xr.tagNameCheck instanceof Function&&Xr.tagNameCheck(De))&&(Xr.attributeNameCheck instanceof RegExp&&I(Xr.attributeNameCheck,yt)||Xr.attributeNameCheck instanceof Function&&Xr.attributeNameCheck(yt))||yt==="is"&&Xr.allowCustomizedBuiltInElements&&(Xr.tagNameCheck instanceof RegExp&&I(Xr.tagNameCheck,jt)||Xr.tagNameCheck instanceof Function&&Xr.tagNameCheck(jt))))return!1}else if(!MH[yt]){if(!I(i0,_(jt,uh,""))){if(!((yt==="src"||yt==="xlink:href"||yt==="href")&&De!=="script"&&b(jt,"data:")===0&&pK[De])){if(!(fK&&!I(Sa,_(jt,uh,"")))){if(jt)return!1}}}}}}return!0},SK=function(De){return De.indexOf("-")>0},DK=function(De){var yt,jt,ao,Zc;wm("beforeSanitizeAttributes",De,null);var Da=De.attributes;if(Da){var ia={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:qr};for(Zc=Da.length;Zc--;){yt=Da[Zc];var t3=yt,Ms=t3.name,kH=t3.namespaceURI;if(jt=Ms==="value"?yt.value:v(yt.value),ao=Bs(Ms),ia.attrName=ao,ia.attrValue=jt,ia.keepAttr=!0,ia.forceKeepAttr=void 0,wm("uponSanitizeAttribute",De,ia),jt=ia.attrValue,!ia.forceKeepAttr&&(UH(Ms,De),!!ia.keepAttr)){if(I(/\/>/i,jt)){UH(Ms,De);continue}IC&&(jt=_(jt,kf," "),jt=_(jt,er," "),jt=_(jt,ba," "));var vK=Bs(De.nodeName);if(bK(vK,ao,jt)){if(hK&&(ao==="id"||ao==="name")&&(UH(Ms,De),jt=zAe+jt),Hi&&e(ft)==="object"&&typeof ft.getAttributeType=="function"&&!kH)switch(ft.getAttributeType(vK,ao)){case"TrustedHTML":jt=Hi.createHTML(jt);break;case"TrustedScriptURL":jt=Hi.createScriptURL(jt);break}try{kH?De.setAttributeNS(kH,Ms,jt):De.setAttribute(Ms,jt),w(be.removed)}catch{}}}}wm("afterSanitizeAttributes",De,null)}},KAe=function bn(De){var yt,jt=TK(De);for(wm("beforeSanitizeShadowDOM",De,null);yt=jt.nextNode();)wm("uponSanitizeShadowNode",yt,null),!EK(yt)&&(yt.content instanceof Kn&&bn(yt.content),DK(yt));wm("afterSanitizeShadowDOM",De,null)};return be.sanitize=function(bn){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},yt,jt,ao,Zc,Da;if(LH=!bn,LH&&(bn="<!-->"),typeof bn!="string"&&!kS(bn)){if(typeof bn.toString!="function")throw B("toString is not a function");if(bn=bn.toString(),typeof bn!="string")throw B("dirty is not a string, aborting")}if(!be.isSupported){if(e(me.toStaticHTML)==="object"||typeof me.toStaticHTML=="function"){if(typeof bn=="string")return me.toStaticHTML(bn);if(kS(bn))return me.toStaticHTML(bn.outerHTML)}return bn}if(OH||FH(De),be.removed=[],typeof bn=="string"&&(US=!1),US){if(bn.nodeName){var ia=Bs(bn.nodeName);if(!tr[ia]||VS[ia])throw B("root node is forbidden and cannot be sanitized in-place")}}else if(bn instanceof Uo)yt=CK("<!---->"),jt=yt.ownerDocument.importNode(bn,!0),jt.nodeType===1&&jt.nodeName==="BODY"||jt.nodeName==="HTML"?yt=jt:yt.appendChild(jt);else{if(!PC&&!IC&&!o0&&bn.indexOf("<")===-1)return Hi&&J2?Hi.createHTML(bn):bn;if(yt=CK(bn),!yt)return PC?null:J2?Oi:""}yt&&RH&&vm(yt.firstChild);for(var t3=TK(US?bn:yt);ao=t3.nextNode();)ao.nodeType===3&&ao===Zc||EK(ao)||(ao.content instanceof Kn&&KAe(ao.content),DK(ao),Zc=ao);if(Zc=null,US)return bn;if(PC){if(Z2)for(Da=Zn.call(yt.ownerDocument);yt.firstChild;)Da.appendChild(yt.firstChild);else Da=yt;return qr.shadowroot&&(Da=hc.call(St,Da,!0)),Da}var Ms=o0?yt.outerHTML:yt.innerHTML;return o0&&tr["!doctype"]&&yt.ownerDocument&&yt.ownerDocument.doctype&&yt.ownerDocument.doctype.name&&I(Tn,yt.ownerDocument.doctype.name)&&(Ms="<!DOCTYPE "+yt.ownerDocument.doctype.name+`>
`+Ms),IC&&(Ms=_(Ms,kf," "),Ms=_(Ms,er," "),Ms=_(Ms,ba," ")),Hi&&J2?Hi.createHTML(Ms):Ms},be.setConfig=function(bn){FH(bn),OH=!0},be.clearConfig=function(){MC=null,OH=!1},be.isValidAttribute=function(bn,De,yt){MC||FH({});var jt=Bs(bn),ao=Bs(De);return bK(jt,ao,yt)},be.addHook=function(bn,De){typeof De=="function"&&(Bo[bn]=Bo[bn]||[],R(Bo[bn],De))},be.removeHook=function(bn){if(Bo[bn])return w(Bo[bn])},be.removeHooks=function(bn){Bo[bn]&&(Bo[bn]=[])},be.removeAllHooks=function(){Bo={}},be}var pe=Je();return pe})});var cre=Jc((omn,are)=>{"use strict";are.exports=Z4e;var KO=1e20;function Z4e(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,c,l,f,d,p,g,m,A;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,c=e,t.stride?f=t.stride:f=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(p=e,d=p.getContext("2d"),r=p.width,s=p.height,g=d.getImageData(0,0,r,s),c=g.data,f=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(p=e.canvas,d=e,r=p.width,s=p.height,g=d.getImageData(0,0,r,s),c=g.data,f=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,c=g.data,f=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&c instanceof window.Uint8ClampedArray||window.Uint8Array&&c instanceof window.Uint8Array)for(l=c,c=Array(r*s),m=0,A=Math.floor(l.length/f);m<A;m++)c[m]=l[m*f+o]/255;else if(f!==1)throw Error("Raw data can have only 1 value per pixel");var x=Array(r*s),C=Array(r*s),T=Array(a),E=Array(a),S=Array(a+1),D=Array(a);for(m=0,A=r*s;m<A;m++){var w=c[m];x[m]=w===1?0:w===0?KO:Math.pow(Math.max(0,.5-w),2),C[m]=w===1?KO:w===0?0:Math.pow(Math.max(0,w-.5),2)}rre(x,r,s,T,E,D,S),rre(C,r,s,T,E,D,S);var R=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(m=0,A=r*s;m<A;m++)R[m]=Math.min(Math.max(1-((x[m]-C[m])/i+n),0),1);return R}function rre(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var c=0;c<n;c++)i[c]=e[c*t+a];for(sre(i,o,r,s,n),c=0;c<n;c++)e[c*t+a]=o[c]}for(c=0;c<n;c++){for(a=0;a<t;a++)i[a]=e[c*t+a];for(sre(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function sre(e,t,n,i,o){n[0]=0,i[0]=-KO,i[1]=+KO;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]=+KO}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 hre=Jc((Cmn,iU)=>{function aHe(){var e=0,t=1,n=2,i=3,o=4,r=5,s=6,a=7,c=8,l=9,f=10,d=11,p=12,g=13,m=14,A=15,x=16,C=17,T=0,E=1,S=2,D=3,w=4;function R(_,b){return 55296<=_.charCodeAt(b)&&_.charCodeAt(b)<=56319&&56320<=_.charCodeAt(b+1)&&_.charCodeAt(b+1)<=57343}function O(_,b){b===void 0&&(b=0);var v=_.charCodeAt(b);if(55296<=v&&v<=56319&&b<_.length-1){var I=v,B=_.charCodeAt(b+1);return 56320<=B&&B<=57343?(I-55296)*1024+(B-56320)+65536:I}if(56320<=v&&v<=57343&&b>=1){var I=_.charCodeAt(b-1),B=v;return 55296<=I&&I<=56319?(I-55296)*1024+(B-56320)+65536:B}return v}function L(_,b,v){var I=[_].concat(b).concat([v]),B=I[I.length-2],F=v,k=I.lastIndexOf(m);if(k>1&&I.slice(1,k).every(function(V){return V==i})&&[i,g,C].indexOf(_)==-1)return S;var U=I.lastIndexOf(o);if(U>0&&I.slice(1,U).every(function(V){return V==o})&&[p,o].indexOf(B)==-1)return I.filter(function(V){return V==o}).length%2==1?D:w;if(B==e&&F==t)return T;if(B==n||B==e||B==t)return F==m&&b.every(function(V){return V==i})?S:E;if(F==n||F==e||F==t)return E;if(B==s&&(F==s||F==a||F==l||F==f))return T;if((B==l||B==a)&&(F==a||F==c))return T;if((B==f||B==c)&&F==c)return T;if(F==i||F==A)return T;if(F==r)return T;if(B==p)return T;var G=I.indexOf(i)!=-1?I.lastIndexOf(i)-1:I.length-2;return[g,C].indexOf(I[G])!=-1&&I.slice(G+1,-1).every(function(V){return V==i})&&F==m||B==A&&[x,C].indexOf(F)!=-1?T:b.indexOf(o)!=-1?S:B==o&&F==o?T:E}this.nextBreak=function(_,b){if(b===void 0&&(b=0),b<0)return 0;if(b>=_.length-1)return _.length;for(var v=N(O(_,b)),I=[],B=b+1;B<_.length;B++)if(!R(_,B-1)){var F=N(O(_,B));if(L(v,I,F))return B;I.push(F)}return _.length},this.splitGraphemes=function(_){for(var b=[],v=0,I;(I=this.nextBreak(_,v))<_.length;)b.push(_.slice(v,I)),v=I;return v<_.length&&b.push(_.slice(v)),b},this.iterateGraphemes=function(_){var b=0,v={next:function(){var I,B;return(B=this.nextBreak(_,b))<_.length?(I=_.slice(b,B),b=B,{value:I,done:!1}):b<_.length?(I=_.slice(b),b=_.length,{value:I,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(v[Symbol.iterator]=function(){return v}),v},this.countGraphemes=function(_){for(var b=0,v=0,I;(I=this.nextBreak(_,v))<_.length;)v=I,b++;return v<_.length&&b++,b};function N(_){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?c:_==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?l: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?A:_==9792||_==9794||9877<=_&&_<=9878||_==9992||_==10084||_==127752||_==127806||_==127859||_==127891||_==127908||_==127912||_==127979||_==127981||_==128139||128187<=_&&_<=128188||_==128295||_==128300||_==128488||_==128640||_==128658?x:128102<=_&&_<=128105?C:d}return this}typeof iU<"u"&&iU.exports&&(iU.exports=aHe)});var nse=Jc((y0n,L6)=>{"use strict";L6.exports=hU;L6.exports.default=hU;function hU(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=$re(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,l,f,d,p,g;if(i&&(r=U8e(e,t,r,n)),e.length>80*n){a=l=e[0],c=f=e[1];for(var m=n;m<o;m+=n)d=e[m],p=e[m+1],d<a&&(a=d),p<c&&(c=p),d>l&&(l=d),p>f&&(f=p);g=Math.max(l-a,f-c),g=g!==0?32767/g:0}return DR(r,s,n,a,c,g,0),s}function $re(e,t,n,i,o){var r,s;if(o===M6(e,t,n,i)>0)for(r=t;r<n;r+=i)s=Qre(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=Qre(r,e[r],e[r+1],s);return s&&mU(s,s.next)&&(wR(s),s=s.next),s}function zA(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(mU(n,n.next)||Dr(n.prev,n,n.next)===0)){if(wR(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function DR(e,t,n,i,o,r,s){if(e){!s&&r&&W8e(e,i,o,r);for(var a=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,r?N8e(e,i,o,r):L8e(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),wR(e),e=l.next,a=l.next;continue}if(e=l,e===a){s?s===1?(e=F8e(zA(e),t,n),DR(e,t,n,i,o,r,2)):s===2&&V8e(e,t,n,i,o,r):DR(zA(e),t,n,i,o,r,1);break}}}}function L8e(e){var t=e.prev,n=e,i=e.next;if(Dr(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,c=n.y,l=i.y,f=o<r?o<s?o:s:r<s?r:s,d=a<c?a<l?a:l:c<l?c:l,p=o>r?o>s?o:s:r>s?r:s,g=a>c?a>l?a:l:c>l?c:l,m=i.next;m!==t;){if(m.x>=f&&m.x<=p&&m.y>=d&&m.y<=g&&oE(o,a,r,c,s,l,m.x,m.y)&&Dr(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function N8e(e,t,n,i){var o=e.prev,r=e,s=e.next;if(Dr(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,l=s.x,f=o.y,d=r.y,p=s.y,g=a<c?a<l?a:l:c<l?c:l,m=f<d?f<p?f:p:d<p?d:p,A=a>c?a>l?a:l:c>l?c:l,x=f>d?f>p?f:p:d>p?d:p,C=R6(g,m,t,n,i),T=R6(A,x,t,n,i),E=e.prevZ,S=e.nextZ;E&&E.z>=C&&S&&S.z<=T;){if(E.x>=g&&E.x<=A&&E.y>=m&&E.y<=x&&E!==o&&E!==s&&oE(a,f,c,d,l,p,E.x,E.y)&&Dr(E.prev,E,E.next)>=0||(E=E.prevZ,S.x>=g&&S.x<=A&&S.y>=m&&S.y<=x&&S!==o&&S!==s&&oE(a,f,c,d,l,p,S.x,S.y)&&Dr(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;E&&E.z>=C;){if(E.x>=g&&E.x<=A&&E.y>=m&&E.y<=x&&E!==o&&E!==s&&oE(a,f,c,d,l,p,E.x,E.y)&&Dr(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;S&&S.z<=T;){if(S.x>=g&&S.x<=A&&S.y>=m&&S.y<=x&&S!==o&&S!==s&&oE(a,f,c,d,l,p,S.x,S.y)&&Dr(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function F8e(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!mU(o,r)&&ese(o,i,i.next,r)&&vR(o,r)&&vR(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),wR(i),wR(i.next),i=e=r),i=i.next}while(i!==e);return zA(i)}function V8e(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&q8e(s,a)){var c=tse(s,a);s=zA(s,s.next),c=zA(c,c.next),DR(s,t,n,i,o,r,0),DR(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function U8e(e,t,n,i){var o=[],r,s,a,c,l;for(r=0,s=t.length;r<s;r++)a=t[r]*i,c=r<s-1?t[r+1]*i:e.length,l=$re(e,a,c,i,!1),l===l.next&&(l.steiner=!0),o.push(Y8e(l));for(o.sort(k8e),r=0;r<o.length;r++)n=z8e(o[r],n);return n}function k8e(e,t){return e.x-t.x}function z8e(e,t){var n=H8e(e,t);if(!n)return t;var i=tse(n,e);return zA(i,i.next),zA(n,n.next)}function H8e(e,t){var n=t,i=e.x,o=e.y,r=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>r&&(r=a,s=n.x<n.next.x?n:n.next,a===i))return s}n=n.next}while(n!==t);if(!s)return null;var c=s,l=s.x,f=s.y,d=1/0,p;n=s;do i>=n.x&&n.x>=l&&i!==n.x&&oE(o<f?i:r,o,l,f,o<f?r:i,o,n.x,n.y)&&(p=Math.abs(o-n.y)/(i-n.x),vR(n,e)&&(p<d||p===d&&(n.x>s.x||n.x===s.x&&G8e(s,n)))&&(s=n,d=p)),n=n.next;while(n!==c);return s}function G8e(e,t){return Dr(e.prev,e,t.prev)<0&&Dr(t.next,e,e.next)<0}function W8e(e,t,n,i){var o=e;do o.z===0&&(o.z=R6(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,j8e(o)}function j8e(e){var t,n,i,o,r,s,a,c,l=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||n.z<=i.z)?(o=n,n=n.nextZ,a--):(o=i,i=i.nextZ,c--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,l*=2}while(s>1);return e}function R6(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 Y8e(e){var 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 oE(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 q8e(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!X8e(e,t)&&(vR(e,t)&&vR(t,e)&&K8e(e,t)&&(Dr(e.prev,e,t.prev)||Dr(e,t.prev,t))||mU(e,t)&&Dr(e.prev,e,e.next)>0&&Dr(t.prev,t,t.next)>0)}function Dr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function mU(e,t){return e.x===t.x&&e.y===t.y}function ese(e,t,n,i){var o=dU(Dr(e,t,n)),r=dU(Dr(e,t,i)),s=dU(Dr(n,i,e)),a=dU(Dr(n,i,t));return!!(o!==r&&s!==a||o===0&&fU(e,n,t)||r===0&&fU(e,i,t)||s===0&&fU(n,e,i)||a===0&&fU(n,t,i))}function fU(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 dU(e){return e>0?1:e<0?-1:0}function X8e(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ese(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function vR(e,t){return Dr(e.prev,e,e.next)<0?Dr(e,t,e.next)>=0&&Dr(e,e.prev,t)>=0:Dr(e,t,e.prev)<0||Dr(e,e.next,t)<0}function K8e(e,t){var 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 tse(e,t){var n=new B6(e.i,e.x,e.y),i=new B6(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 Qre(e,t,n,i){var o=new B6(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 wR(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 B6(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}hU.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(M6(e,0,r,n));if(o)for(var a=0,c=t.length;a<c;a++){var l=t[a]*n,f=a<c-1?t[a+1]*n:e.length;s-=Math.abs(M6(e,l,f,n))}var d=0;for(a=0;a<i.length;a+=3){var p=i[a]*n,g=i[a+1]*n,m=i[a+2]*n;d+=Math.abs((e[p]-e[m])*(e[g+1]-e[p+1])-(e[p]-e[g])*(e[m+1]-e[p+1]))}return s===0&&d===0?0:Math.abs((d-s)/s)};function M6(e,t,n,i){for(var o=0,r=t,s=n-i;r<n;r+=i)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}hU.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,o=0;o<e.length;o++){for(var r=0;r<e[o].length;r++)for(var s=0;s<t;s++)n.vertices.push(e[o][r][s]);o>0&&(i+=e[o-1].length,n.holes.push(i))}return n}});var mue=Jc((dW,hW)=>{(function(e,t){typeof dW=="object"&&typeof hW<"u"?hW.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self).RBush=t()})(dW,function(){"use strict";function e(x,C,T,E,S){(function D(w,R,O,L,N){for(;L>O;){if(L-O>600){var _=L-O+1,b=R-O+1,v=Math.log(_),I=.5*Math.exp(2*v/3),B=.5*Math.sqrt(v*I*(_-I)/_)*(b-_/2<0?-1:1),F=Math.max(O,Math.floor(R-b*I/_+B)),k=Math.min(L,Math.floor(R+(_-b)*I/_+B));D(w,R,F,k,N)}var U=w[R],G=O,V=L;for(t(w,O,R),N(w[L],U)>0&&t(w,O,L);G<V;){for(t(w,G,V),G++,V--;N(w[G],U)<0;)G++;for(;N(w[V],U)>0;)V--}N(w[O],U)===0?t(w,O,V):t(w,++V,L),V<=R&&(O=V+1),R<=V&&(L=V-1)}})(x,C,T||0,E||x.length-1,S||n)}function t(x,C,T){var E=x[C];x[C]=x[T],x[T]=E}function n(x,C){return x<C?-1:x>C?1:0}var i=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(x,C,T){if(!T)return C.indexOf(x);for(var E=0;E<C.length;E++)if(T(x,C[E]))return E;return-1}function r(x,C){s(x,0,x.children.length,C,x)}function s(x,C,T,E,S){S||(S=m(null)),S.minX=1/0,S.minY=1/0,S.maxX=-1/0,S.maxY=-1/0;for(var D=C;D<T;D++){var w=x.children[D];a(S,x.leaf?E(w):w)}return S}function a(x,C){return x.minX=Math.min(x.minX,C.minX),x.minY=Math.min(x.minY,C.minY),x.maxX=Math.max(x.maxX,C.maxX),x.maxY=Math.max(x.maxY,C.maxY),x}function c(x,C){return x.minX-C.minX}function l(x,C){return x.minY-C.minY}function f(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function d(x){return x.maxX-x.minX+(x.maxY-x.minY)}function p(x,C){return x.minX<=C.minX&&x.minY<=C.minY&&C.maxX<=x.maxX&&C.maxY<=x.maxY}function g(x,C){return C.minX<=x.maxX&&C.minY<=x.maxY&&C.maxX>=x.minX&&C.maxY>=x.minY}function m(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function A(x,C,T,E,S){for(var D=[C,T];D.length;)if(!((T=D.pop())-(C=D.pop())<=E)){var w=C+Math.ceil((T-C)/E/2)*E;e(x,w,C,T,S),D.push(C,w,w,T)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(x){var C=this.data,T=[];if(!g(x,C))return T;for(var E=this.toBBox,S=[];C;){for(var D=0;D<C.children.length;D++){var w=C.children[D],R=C.leaf?E(w):w;g(x,R)&&(C.leaf?T.push(w):p(x,R)?this._all(w,T):S.push(w))}C=S.pop()}return T},i.prototype.collides=function(x){var C=this.data;if(!g(x,C))return!1;for(var T=[];C;){for(var E=0;E<C.children.length;E++){var S=C.children[E],D=C.leaf?this.toBBox(S):S;if(g(x,D)){if(C.leaf||p(x,D))return!0;T.push(S)}}C=T.pop()}return!1},i.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var C=0;C<x.length;C++)this.insert(x[C]);return this}var T=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===T.height)this._splitRoot(this.data,T);else{if(this.data.height<T.height){var E=this.data;this.data=T,T=E}this._insert(T,this.data.height-T.height-1,!0)}else this.data=T;return this},i.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},i.prototype.clear=function(){return this.data=m([]),this},i.prototype.remove=function(x,C){if(!x)return this;for(var T,E,S,D=this.data,w=this.toBBox(x),R=[],O=[];D||R.length;){if(D||(D=R.pop(),E=R[R.length-1],T=O.pop(),S=!0),D.leaf){var L=o(x,D.children,C);if(L!==-1)return D.children.splice(L,1),R.push(D),this._condense(R),this}S||D.leaf||!p(D,w)?E?(T++,D=E.children[T],S=!1):D=null:(R.push(D),O.push(T),T=0,E=D,D=D.children[0])}return this},i.prototype.toBBox=function(x){return x},i.prototype.compareMinX=function(x,C){return x.minX-C.minX},i.prototype.compareMinY=function(x,C){return x.minY-C.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(x){return this.data=x,this},i.prototype._all=function(x,C){for(var T=[];x;)x.leaf?C.push.apply(C,x.children):T.push.apply(T,x.children),x=T.pop();return C},i.prototype._build=function(x,C,T,E){var S,D=T-C+1,w=this._maxEntries;if(D<=w)return r(S=m(x.slice(C,T+1)),this.toBBox),S;E||(E=Math.ceil(Math.log(D)/Math.log(w)),w=Math.ceil(D/Math.pow(w,E-1))),(S=m([])).leaf=!1,S.height=E;var R=Math.ceil(D/w),O=R*Math.ceil(Math.sqrt(w));A(x,C,T,O,this.compareMinX);for(var L=C;L<=T;L+=O){var N=Math.min(L+O-1,T);A(x,L,N,R,this.compareMinY);for(var _=L;_<=N;_+=R){var b=Math.min(_+R-1,N);S.children.push(this._build(x,_,b,E-1))}}return r(S,this.toBBox),S},i.prototype._chooseSubtree=function(x,C,T,E){for(;E.push(C),!C.leaf&&E.length-1!==T;){for(var S=1/0,D=1/0,w=void 0,R=0;R<C.children.length;R++){var O=C.children[R],L=f(O),N=(_=x,b=O,(Math.max(b.maxX,_.maxX)-Math.min(b.minX,_.minX))*(Math.max(b.maxY,_.maxY)-Math.min(b.minY,_.minY))-L);N<D?(D=N,S=L<S?L:S,w=O):N===D&&L<S&&(S=L,w=O)}C=w||C.children[0]}var _,b;return C},i.prototype._insert=function(x,C,T){var E=T?x:this.toBBox(x),S=[],D=this._chooseSubtree(E,this.data,C,S);for(D.children.push(x),a(D,E);C>=0&&S[C].children.length>this._maxEntries;)this._split(S,C),C--;this._adjustParentBBoxes(E,S,C)},i.prototype._split=function(x,C){var T=x[C],E=T.children.length,S=this._minEntries;this._chooseSplitAxis(T,S,E);var D=this._chooseSplitIndex(T,S,E),w=m(T.children.splice(D,T.children.length-D));w.height=T.height,w.leaf=T.leaf,r(T,this.toBBox),r(w,this.toBBox),C?x[C-1].children.push(w):this._splitRoot(T,w)},i.prototype._splitRoot=function(x,C){this.data=m([x,C]),this.data.height=x.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(x,C,T){for(var E,S,D,w,R,O,L,N=1/0,_=1/0,b=C;b<=T-C;b++){var v=s(x,0,b,this.toBBox),I=s(x,b,T,this.toBBox),B=(S=v,D=I,w=void 0,R=void 0,O=void 0,L=void 0,w=Math.max(S.minX,D.minX),R=Math.max(S.minY,D.minY),O=Math.min(S.maxX,D.maxX),L=Math.min(S.maxY,D.maxY),Math.max(0,O-w)*Math.max(0,L-R)),F=f(v)+f(I);B<N?(N=B,E=b,_=F<_?F:_):B===N&&F<_&&(_=F,E=b)}return E||T-C},i.prototype._chooseSplitAxis=function(x,C,T){var E=x.leaf?this.compareMinX:c,S=x.leaf?this.compareMinY:l;this._allDistMargin(x,C,T,E)<this._allDistMargin(x,C,T,S)&&x.children.sort(E)},i.prototype._allDistMargin=function(x,C,T,E){x.children.sort(E);for(var S=this.toBBox,D=s(x,0,C,S),w=s(x,T-C,T,S),R=d(D)+d(w),O=C;O<T-C;O++){var L=x.children[O];a(D,x.leaf?S(L):L),R+=d(D)}for(var N=T-C-1;N>=C;N--){var _=x.children[N];a(w,x.leaf?S(_):_),R+=d(w)}return R},i.prototype._adjustParentBBoxes=function(x,C,T){for(var E=T;E>=0;E--)a(C[E],x)},i.prototype._condense=function(x){for(var C=x.length-1,T=void 0;C>=0;C--)x[C].children.length===0?C>0?(T=x[C-1].children).splice(T.indexOf(x[C]),1):this.clear():r(x[C],this.toBBox)},i})});var bj=Jc((exports,module)=>{/*!
 * protobuf.js v7.2.0 (c) 2016, daniel wirtz
 * compiled tue, 24 jan 2023 20:12:01 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,c=2,l=!0;c<arguments.length;)s[a++]=arguments[c++];return new Promise(function(d,p){s[a]=function(m){if(l)if(l=!1,m)p(m);else{for(var A=new Array(arguments.length-1),x=0;x<A.length;)A[x++]=arguments[x];d.apply(null,A)}};try{o.apply(r||null,s)}catch(g){l&&(l=!1,p(g))}})}},{}],2:[function(e,t,n){"use strict";var i=n;i.length=function(l){var f=l.length;if(!f)return 0;for(var d=0;--f%4>1&&l.charAt(f)==="=";)++d;return Math.ceil(l.length*3)/4-d};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(l,f,d){for(var p=null,g=[],m=0,A=0,x;f<d;){var C=l[f++];switch(A){case 0:g[m++]=o[C>>2],x=(C&3)<<4,A=1;break;case 1:g[m++]=o[x|C>>4],x=(C&15)<<2,A=2;break;case 2:g[m++]=o[x|C>>6],g[m++]=o[C&63],A=0;break}m>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,g)),m=0)}return A&&(g[m++]=o[x],g[m++]=61,A===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(l,f,d){for(var p=d,g=0,m,A=0;A<l.length;){var x=l.charCodeAt(A++);if(x===61&&g>1)break;if((x=r[x])===undefined)throw Error(a);switch(g){case 0:m=x,g=1;break;case 1:f[d++]=m<<2|(x&48)>>4,m=x,g=2;break;case 2:f[d++]=(m&15)<<4|(x&60)>>2,m=x,g=3;break;case 3:f[d++]=(m&3)<<6|x,g=0;break}}if(g===1)throw Error(a);return d-p},i.test=function(l){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(l)}},{}],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],c=0;c<a.length;)a[c].fn===s?a.splice(c,1):++c;return this},i.prototype.emit=function(r){var s=this._listeners[r];if(s){for(var a=[],c=1;c<arguments.length;)a.push(arguments[c++]);for(c=0;c<s.length;)s[c].fn.apply(s[c++].ctx,a)}return this}},{}],4:[function(e,t,n){"use strict";t.exports=i(i);function i(c){return typeof Float32Array<"u"?function(){var l=new Float32Array([-0]),f=new Uint8Array(l.buffer),d=f[3]===128;function p(x,C,T){l[0]=x,C[T]=f[0],C[T+1]=f[1],C[T+2]=f[2],C[T+3]=f[3]}function g(x,C,T){l[0]=x,C[T]=f[3],C[T+1]=f[2],C[T+2]=f[1],C[T+3]=f[0]}c.writeFloatLE=d?p:g,c.writeFloatBE=d?g:p;function m(x,C){return f[0]=x[C],f[1]=x[C+1],f[2]=x[C+2],f[3]=x[C+3],l[0]}function A(x,C){return f[3]=x[C],f[2]=x[C+1],f[1]=x[C+2],f[0]=x[C+3],l[0]}c.readFloatLE=d?m:A,c.readFloatBE=d?A:m}():function(){function l(d,p,g,m){var A=p<0?1:0;if(A&&(p=-p),p===0)d(1/p>0?0:2147483648,g,m);else if(isNaN(p))d(2143289344,g,m);else if(p>34028234663852886e22)d((A<<31|2139095040)>>>0,g,m);else if(p<11754943508222875e-54)d((A<<31|Math.round(p/1401298464324817e-60))>>>0,g,m);else{var x=Math.floor(Math.log(p)/Math.LN2),C=Math.round(p*Math.pow(2,-x)*8388608)&8388607;d((A<<31|x+127<<23|C)>>>0,g,m)}}c.writeFloatLE=l.bind(null,o),c.writeFloatBE=l.bind(null,r);function f(d,p,g){var m=d(p,g),A=(m>>31)*2+1,x=m>>>23&255,C=m&8388607;return x===255?C?NaN:A*(1/0):x===0?A*1401298464324817e-60*C:A*Math.pow(2,x-150)*(C+8388608)}c.readFloatLE=f.bind(null,s),c.readFloatBE=f.bind(null,a)}(),typeof Float64Array<"u"?function(){var l=new Float64Array([-0]),f=new Uint8Array(l.buffer),d=f[7]===128;function p(x,C,T){l[0]=x,C[T]=f[0],C[T+1]=f[1],C[T+2]=f[2],C[T+3]=f[3],C[T+4]=f[4],C[T+5]=f[5],C[T+6]=f[6],C[T+7]=f[7]}function g(x,C,T){l[0]=x,C[T]=f[7],C[T+1]=f[6],C[T+2]=f[5],C[T+3]=f[4],C[T+4]=f[3],C[T+5]=f[2],C[T+6]=f[1],C[T+7]=f[0]}c.writeDoubleLE=d?p:g,c.writeDoubleBE=d?g:p;function m(x,C){return f[0]=x[C],f[1]=x[C+1],f[2]=x[C+2],f[3]=x[C+3],f[4]=x[C+4],f[5]=x[C+5],f[6]=x[C+6],f[7]=x[C+7],l[0]}function A(x,C){return f[7]=x[C],f[6]=x[C+1],f[5]=x[C+2],f[4]=x[C+3],f[3]=x[C+4],f[2]=x[C+5],f[1]=x[C+6],f[0]=x[C+7],l[0]}c.readDoubleLE=d?m:A,c.readDoubleBE=d?A:m}():function(){function l(d,p,g,m,A,x){var C=m<0?1:0;if(C&&(m=-m),m===0)d(0,A,x+p),d(1/m>0?0:2147483648,A,x+g);else if(isNaN(m))d(0,A,x+p),d(2146959360,A,x+g);else if(m>17976931348623157e292)d(0,A,x+p),d((C<<31|2146435072)>>>0,A,x+g);else{var T;if(m<22250738585072014e-324)T=m/5e-324,d(T>>>0,A,x+p),d((C<<31|T/4294967296)>>>0,A,x+g);else{var E=Math.floor(Math.log(m)/Math.LN2);E===1024&&(E=1023),T=m*Math.pow(2,-E),d(T*4503599627370496>>>0,A,x+p),d((C<<31|E+1023<<20|T*1048576&1048575)>>>0,A,x+g)}}}c.writeDoubleLE=l.bind(null,o,0,4),c.writeDoubleBE=l.bind(null,r,4,0);function f(d,p,g,m,A){var x=d(m,A+p),C=d(m,A+g),T=(C>>31)*2+1,E=C>>>20&2047,S=4294967296*(C&1048575)+x;return E===2047?S?NaN:T*(1/0):E===0?T*5e-324*S:T*Math.pow(2,E-1075)*(S+4503599627370496)}c.readDoubleLE=f.bind(null,s,0,4),c.readDoubleBE=f.bind(null,a,4,0)}(),c}function o(c,l,f){l[f]=c&255,l[f+1]=c>>>8&255,l[f+2]=c>>>16&255,l[f+3]=c>>>24}function r(c,l,f){l[f]=c>>>24,l[f+1]=c>>>16&255,l[f+2]=c>>>8&255,l[f+3]=c&255}function s(c,l){return(c[l]|c[l+1]<<8|c[l+2]<<16|c[l+3]<<24)>>>0}function a(c,l){return(c[l]<<24|c[l+1]<<16|c[l+2]<<8|c[l+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,c=a>>>1,l=null,f=a;return function(p){if(p<1||p>c)return o(p);f+p>a&&(l=o(a),f=0);var g=r.call(l,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,c=0;c<r.length;++c)a=r.charCodeAt(c),a<128?s+=1:a<2048?s+=2:(a&64512)===55296&&(r.charCodeAt(c+1)&64512)===56320?(++c,s+=4):s+=3;return s},i.read=function(r,s,a){var c=a-s;if(c<1)return"";for(var l=null,f=[],d=0,p;s<a;)p=r[s++],p<128?f[d++]=p:p>191&&p<224?f[d++]=(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[d++]=55296+(p>>10),f[d++]=56320+(p&1023)):f[d++]=(p&15)<<12|(r[s++]&63)<<6|r[s++]&63,d>8191&&((l||(l=[])).push(String.fromCharCode.apply(String,f)),d=0);return l?(d&&l.push(String.fromCharCode.apply(String,f.slice(0,d))),l.join("")):String.fromCharCode.apply(String,f.slice(0,d))},i.write=function(r,s,a){for(var c=a,l,f,d=0;d<r.length;++d)l=r.charCodeAt(d),l<128?s[a++]=l:l<2048?(s[a++]=l>>6|192,s[a++]=l&63|128):(l&64512)===55296&&((f=r.charCodeAt(d+1))&64512)===56320?(l=65536+((l&1023)<<10)+(f&1023),++d,s[a++]=l>>18|240,s[a++]=l>>12&63|128,s[a++]=l>>6&63|128,s[a++]=l&63|128):(s[a++]=l>>12|224,s[a++]=l>>6&63|128,s[a++]=l&63|128);return a-c}},{}],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=c;var i=e(15),o,r=i.LongBits,s=i.utf8;function a(m,A){return RangeError("index out of range: "+m.pos+" + "+(A||1)+" > "+m.len)}function c(m){this.buf=m,this.pos=0,this.len=m.length}var l=typeof Uint8Array<"u"?function(A){if(A instanceof Uint8Array||Array.isArray(A))return new c(A);throw Error("illegal buffer")}:function(A){if(Array.isArray(A))return new c(A);throw Error("illegal buffer")},f=function(){return i.Buffer?function(x){return(c.create=function(T){return i.Buffer.isBuffer(T)?new o(T):l(T)})(x)}:l};c.create=f(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var A=4294967295;return function(){if(A=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(A=(A|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(A=(A|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(A=(A|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(A=(A|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return A;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return A}}(),c.prototype.int32=function(){return this.uint32()|0},c.prototype.sint32=function(){var A=this.uint32();return A>>>1^-(A&1)|0};function d(){var m=new r(0,0),A=0;if(this.len-this.pos>4){for(;A<4;++A)if(m.lo=(m.lo|(this.buf[this.pos]&127)<<A*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;A=0}else{for(;A<3;++A){if(this.pos>=this.len)throw a(this);if(m.lo=(m.lo|(this.buf[this.pos]&127)<<A*7)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(this.buf[this.pos++]&127)<<A*7)>>>0,m}if(this.len-this.pos>4){for(;A<5;++A)if(m.hi=(m.hi|(this.buf[this.pos]&127)<<A*7+3)>>>0,this.buf[this.pos++]<128)return m}else for(;A<5;++A){if(this.pos>=this.len)throw a(this);if(m.hi=(m.hi|(this.buf[this.pos]&127)<<A*7+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}c.prototype.bool=function(){return this.uint32()!==0};function p(m,A){return(m[A-4]|m[A-3]<<8|m[A-2]<<16|m[A-1]<<24)>>>0}c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},c.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))}c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var A=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,A},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var A=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,A},c.prototype.bytes=function(){var A=this.uint32(),x=this.pos,C=this.pos+A;if(C>this.len)throw a(this,A);return this.pos+=A,Array.isArray(this.buf)?this.buf.slice(x,C):x===C?new this.buf.constructor(0):this._slice.call(this.buf,x,C)},c.prototype.string=function(){var A=this.bytes();return s.read(A,0,A.length)},c.prototype.skip=function(A){if(typeof A=="number"){if(this.pos+A>this.len)throw a(this,A);this.pos+=A}else do if(this.pos>=this.len)throw a(this);while(this.buf[this.pos++]&128);return this},c.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},c._configure=function(m){o=m,c.create=f(),o._configure();var A=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return d.call(this)[A](!1)},uint64:function(){return d.call(this)[A](!0)},sint64:function(){return d.call(this).zzDecode()[A](!1)},fixed64:function(){return g.call(this)[A](!0)},sfixed64:function(){return g.call(this)[A](!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=Boolean(s),this.responseDelimited=Boolean(a)}o.prototype.rpcCall=function r(s,a,c,l,f){if(!l)throw TypeError("request must be specified");var d=this;if(!f)return i.asPromise(r,d,s,a,c,l);if(!d.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),undefined;try{return d.rpcImpl(s,a[d.requestDelimited?"encodeDelimited":"encode"](l).finish(),function(g,m){if(g)return d.emit("error",g,s),f(g);if(m===null)return d.end(!0),undefined;if(!(m instanceof c))try{m=c[d.responseDelimited?"decodeDelimited":"decode"](m)}catch(A){return d.emit("error",A,s),f(A)}return d.emit("data",m,s),f(null,m)})}catch(p){return d.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(c,l){this.lo=c>>>0,this.hi=l>>>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(l){if(l===0)return r;var f=l<0;f&&(l=-l);var d=l>>>0,p=(l-d)/4294967296>>>0;return f&&(p=~p>>>0,d=~d>>>0,++d>4294967295&&(d=0,++p>4294967295&&(p=0))),new o(d,p)},o.from=function(l){if(typeof l=="number")return o.fromNumber(l);if(i.isString(l))if(i.Long)l=i.Long.fromString(l);else return o.fromNumber(parseInt(l,10));return l.low||l.high?new o(l.low>>>0,l.high>>>0):r},o.prototype.toNumber=function(l){if(!l&&this.hi>>>31){var f=~this.lo+1>>>0,d=~this.hi>>>0;return f||(d=d+1>>>0),-(f+d*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(l){return i.Long?new i.Long(this.lo|0,this.hi|0,Boolean(l)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(l)}};var a=String.prototype.charCodeAt;o.fromHash=function(l){return l===s?r:new o((a.call(l,0)|a.call(l,1)<<8|a.call(l,2)<<16|a.call(l,3)<<24)>>>0,(a.call(l,4)|a.call(l,5)<<8|a.call(l,6)<<16|a.call(l,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 l=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^l)>>>0,this.lo=(this.lo<<1^l)>>>0,this},o.prototype.zzDecode=function(){var l=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^l)>>>0,this.hi=(this.hi>>>1^l)>>>0,this},o.prototype.length=function(){var l=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,d=this.hi>>>24;return d===0?f===0?l<16384?l<128?1:2:l<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:d<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=Boolean(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,c){var l=a[c];return l!=null&&a.hasOwnProperty(c)?typeof l!="object"||(Array.isArray(l)?l.length:Object.keys(l).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,c){var l=i.LongBits.fromHash(a);return i.Long?i.Long.fromBits(l.lo,l.hi,c):l.toNumber(Boolean(c))};function o(s,a,c){for(var l=Object.keys(a),f=0;f<l.length;++f)(s[l[f]]===undefined||!c)&&(s[l[f]]=a[l[f]]);return s}i.merge=o,i.lcFirst=function(a){return a.charAt(0).toLowerCase()+a.substring(1)};function r(s){function a(c,l){if(!(this instanceof a))return new a(c,l);Object.defineProperty(this,"message",{get:function(){return c}}),Error.captureStackTrace?Error.captureStackTrace(this,a):Object.defineProperty(this,"stack",{value:new Error().stack||""}),l&&o(this,l)}return a.prototype=Object.create(Error.prototype,{constructor:{value:a,writable:!0,enumerable:!1,configurable:!0},name:{get(){return s},set:undefined,enumerable:!1,configurable:!0},toString:{value(){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 c={},l=0;l<a.length;++l)c[a[l]]=1;return function(){for(var f=Object.keys(this),d=f.length-1;d>-1;--d)if(c[f[d]]===1&&this[f[d]]!==undefined&&this[f[d]]!==null)return f[d]}},i.oneOfSetter=function(a){return function(c){for(var l=0;l<a.length;++l)a[l]!==c&&delete this[a[l]]}},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(c,l){return new s(c,l)},i._Buffer_allocUnsafe=s.allocUnsafe||function(c){return new s(c)}}},{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=d;var i=e(15),o,r=i.LongBits,s=i.base64,a=i.utf8;function c(E,S,D){this.fn=E,this.len=S,this.next=undefined,this.val=D}function l(){}function f(E){this.head=E.head,this.tail=E.tail,this.len=E.len,this.next=E.states}function d(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(d.create=function(){return new o})()}:function(){return new d}};d.create=p(),d.alloc=function(S){return new i.Array(S)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.prototype._push=function(S,D,w){return this.tail=this.tail.next=new c(S,D,w),this.len+=D,this};function g(E,S,D){S[D]=E&255}function m(E,S,D){for(;E>127;)S[D++]=E&127|128,E>>>=7;S[D]=E}function A(E,S){this.len=E,this.next=undefined,this.val=S}A.prototype=Object.create(c.prototype),A.prototype.fn=m,d.prototype.uint32=function(S){return this.len+=(this.tail=this.tail.next=new A((S=S>>>0)<128?1:S<16384?2:S<2097152?3:S<268435456?4:5,S)).len,this},d.prototype.int32=function(S){return S<0?this._push(x,10,r.fromNumber(S)):this.uint32(S)},d.prototype.sint32=function(S){return this.uint32((S<<1^S>>31)>>>0)};function x(E,S,D){for(;E.hi;)S[D++]=E.lo&127|128,E.lo=(E.lo>>>7|E.hi<<25)>>>0,E.hi>>>=7;for(;E.lo>127;)S[D++]=E.lo&127|128,E.lo=E.lo>>>7;S[D++]=E.lo}d.prototype.uint64=function(S){var D=r.from(S);return this._push(x,D.length(),D)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(S){var D=r.from(S).zzEncode();return this._push(x,D.length(),D)},d.prototype.bool=function(S){return this._push(g,1,S?1:0)};function C(E,S,D){S[D]=E&255,S[D+1]=E>>>8&255,S[D+2]=E>>>16&255,S[D+3]=E>>>24}d.prototype.fixed32=function(S){return this._push(C,4,S>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(S){var D=r.from(S);return this._push(C,4,D.lo)._push(C,4,D.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(S){return this._push(i.float.writeFloatLE,4,S)},d.prototype.double=function(S){return this._push(i.float.writeDoubleLE,8,S)};var T=i.Array.prototype.set?function(S,D,w){D.set(S,w)}:function(S,D,w){for(var R=0;R<S.length;++R)D[w+R]=S[R]};d.prototype.bytes=function(S){var D=S.length>>>0;if(!D)return this._push(g,1,0);if(i.isString(S)){var w=d.alloc(D=s.length(S));s.decode(S,w,0),S=w}return this.uint32(D)._push(T,D,S)},d.prototype.string=function(S){var D=a.length(S);return D?this.uint32(D)._push(a.write,D,S):this._push(g,1,0)},d.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(l,0,0),this.len=0,this},d.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 c(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var S=this.head,D=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=S.next,this.tail=D,this.len+=w),this},d.prototype.finish=function(){for(var S=this.head.next,D=this.constructor.alloc(this.len),w=0;S;)S.fn(S.val,D,w),w+=S.len,S=S.next;return D},d._configure=function(E){o=E,d.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(c,l,f){l.set(c,f)}:function(c,l,f){if(c.copy)c.copy(l,f,0,c.length);else for(var d=0;d<c.length;)l[f++]=c[d++]}},r.prototype.bytes=function(c){o.isString(c)&&(c=o._Buffer_from(c,"base64"));var l=c.length>>>0;return this.uint32(l),l&&this._push(r.writeBytesBuffer,l,c),this};function s(a,c,l){a.length<40?o.utf8.write(a,c,l):c.utf8Write?c.utf8Write(a,l):c.write(a,l)}r.prototype.string=function(c){var l=o.Buffer.byteLength(c);return this.uint32(l),l&&this._push(s,l,c),this},r._configure()},{15:15,16:16}]},{},[8])})()});var w0e=Jc((UEi,q4)=>{/* 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,d){d=d||{};var p=d.encodedMaskData||d.encodedMaskData===null,g=c(f,d.inputOffset||0,p),m=d.noDataValue!==null?d.noDataValue:o.defaultNoDataValue,A=r(g,d.pixelType||Float32Array,d.encodedMaskData,m,d.returnMask),x={width:g.width,height:g.height,pixelData:A.resultPixels,minValue:A.minValue,maxValue:g.pixels.maxValue,noDataValue:m};return A.resultMask&&(x.maskData=A.resultMask),d.returnEncodedMask&&g.mask&&(x.encodedMaskData=g.mask.bitset?g.mask.bitset:null),d.returnFileInfo&&(x.fileInfo=s(g),d.computeUsedBitDepths&&(x.fileInfo.bitDepths=a(g))),x};var r=function(f,d,p,g,m){var A=0,x=f.pixels.numBlocksX,C=f.pixels.numBlocksY,T=Math.floor(f.width/x),E=Math.floor(f.height/C),S=2*f.maxZError,D=Number.MAX_VALUE,w;p=p||(f.mask?f.mask.bitset:null);var R,O;R=new d(f.width*f.height),m&&p&&(O=new Uint8Array(f.width*f.height));for(var L=new Float32Array(T*E),N,_,b=0;b<=C;b++){var v=b!==C?E:f.height%C;if(v!==0)for(var I=0;I<=x;I++){var B=I!==x?T:f.width%x;if(B!==0){var F=b*f.width*E+I*T,k=f.width-B,U=f.pixels.blocks[A],G,V,X;U.encoding<2?(U.encoding===0?G=U.rawData:(l(U.stuffedData,U.bitsPerPixel,U.numValidPixels,U.offset,S,L,f.pixels.maxValue),G=L),V=0):U.encoding===2?X=0:X=U.offset;var j;if(p)for(_=0;_<v;_++){for(F&7&&(j=p[F>>3],j<<=F&7),N=0;N<B;N++)F&7||(j=p[F>>3]),j&128?(O&&(O[F]=1),w=U.encoding<2?G[V++]:X,D=D>w?w:D,R[F++]=w):(O&&(O[F]=0),R[F++]=g),j<<=1;F+=k}else if(U.encoding<2)for(_=0;_<v;_++){for(N=0;N<B;N++)w=G[V++],D=D>w?w:D,R[F++]=w;F+=k}else for(D=D>X?X:D,_=0;_<v;_++){for(N=0;N<B;N++)R[F++]=X;F+=k}if(U.encoding===1&&V!==U.numValidPixels)throw"Block and Mask do not match";A++}}}return{resultPixels:R,resultMask:O,minValue:D}},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 d=f.pixels.numBlocksX*f.pixels.numBlocksY,p={},g=0;g<d;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)},c=function(f,d,p){var g={},m=new Uint8Array(f,d,10);if(g.fileIdentifierString=String.fromCharCode.apply(null,m),g.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+g.fileIdentifierString;d+=10;var A=new DataView(f,d,24);if(g.fileVersion=A.getInt32(0,!0),g.imageType=A.getInt32(4,!0),g.height=A.getUint32(8,!0),g.width=A.getUint32(12,!0),g.maxZError=A.getFloat64(16,!0),d+=24,!p)if(A=new DataView(f,d,16),g.mask={},g.mask.numBlocksY=A.getUint32(0,!0),g.mask.numBlocksX=A.getUint32(4,!0),g.mask.numBytes=A.getUint32(8,!0),g.mask.maxValue=A.getFloat32(12,!0),d+=16,g.mask.numBytes>0){var x=new Uint8Array(Math.ceil(g.width*g.height/8));A=new DataView(f,d,g.mask.numBytes);var C=A.getInt16(0,!0),T=2,E=0;do{if(C>0)for(;C--;)x[E++]=A.getUint8(T++);else{var S=A.getUint8(T++);for(C=-C;C--;)x[E++]=S}C=A.getInt16(T,!0),T+=2}while(T<g.mask.numBytes);if(C!==-32768||E<x.length)throw"Unexpected end of mask RLE encoding";g.mask.bitset=x,d+=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)));A=new DataView(f,d,16),g.pixels={},g.pixels.numBlocksY=A.getUint32(0,!0),g.pixels.numBlocksX=A.getUint32(4,!0),g.pixels.numBytes=A.getUint32(8,!0),g.pixels.maxValue=A.getFloat32(12,!0),d+=16;var D=g.pixels.numBlocksX,w=g.pixels.numBlocksY,R=D+(g.width%D>0?1:0),O=w+(g.height%w>0?1:0);g.pixels.blocks=new Array(R*O);for(var L=0,N=0;N<O;N++)for(var _=0;_<R;_++){var b=0,v=f.byteLength-d;A=new DataView(f,d,Math.min(10,v));var I={};g.pixels.blocks[L++]=I;var B=A.getUint8(0);if(b++,I.encoding=B&63,I.encoding>3)throw"Invalid block encoding ("+I.encoding+")";if(I.encoding===2){d++;continue}if(B!==0&&B!==2){if(B>>=6,I.offsetType=B,B===2)I.offset=A.getInt8(1),b++;else if(B===1)I.offset=A.getInt16(1,!0),b+=2;else if(B===0)I.offset=A.getFloat32(1,!0),b+=4;else throw"Invalid block offset type";if(I.encoding===1)if(B=A.getUint8(b),b++,I.bitsPerPixel=B&63,B>>=6,I.numValidPixelsType=B,B===2)I.numValidPixels=A.getUint8(b),b++;else if(B===1)I.numValidPixels=A.getUint16(b,!0),b+=2;else if(B===0)I.numValidPixels=A.getUint32(b,!0),b+=4;else throw"Invalid valid pixel count type"}if(d+=b,I.encoding!==3){var F,k;if(I.encoding===0){var U=(g.pixels.numBytes-1)/4;if(U!==Math.floor(U))throw"uncompressed block has invalid length";F=new ArrayBuffer(U*4),k=new Uint8Array(F),k.set(new Uint8Array(f,d,U*4));var G=new Float32Array(F);I.rawData=G,d+=U*4}else if(I.encoding===1){var V=Math.ceil(I.numValidPixels*I.bitsPerPixel/8),X=Math.ceil(V/4);F=new ArrayBuffer(X*4),k=new Uint8Array(F),k.set(new Uint8Array(f,d,V)),I.stuffedData=new Uint32Array(F),d+=V}}}return g.eofOffset=d,g},l=function(f,d,p,g,m,A,x){var C=(1<<d)-1,T=0,E,S=0,D,w,R=Math.ceil((x-g)/m),O=f.length*4-Math.ceil(d*p/8);for(f[f.length-1]<<=8*O,E=0;E<p;E++){if(S===0&&(w=f[T++],S=32),S>=d)D=w>>>S-d&C,S-=d;else{var L=d-S;D=(w&C)<<L&C,w=f[T++],S=32-L,D+=w>>>S}A[E]=D<R?g+D*m:x}return A};return o}(),t=function(){"use strict";var o={unstuff:function(c,l,f,d,p,g,m,A){var x=(1<<f)-1,C=0,T,E=0,S,D,w,R,O=c.length*4-Math.ceil(f*d/8);if(c[c.length-1]<<=8*O,p)for(T=0;T<d;T++)E===0&&(D=c[C++],E=32),E>=f?(S=D>>>E-f&x,E-=f):(w=f-E,S=(D&x)<<w&x,D=c[C++],E=32-w,S+=D>>>E),l[T]=p[S];else for(R=Math.ceil((A-g)/m),T=0;T<d;T++)E===0&&(D=c[C++],E=32),E>=f?(S=D>>>E-f&x,E-=f):(w=f-E,S=(D&x)<<w&x,D=c[C++],E=32-w,S+=D>>>E),l[T]=S<R?g+S*m:A},unstuffLUT:function(c,l,f,d,p,g){var m=(1<<l)-1,A=0,x=0,C=0,T=0,E=0,S,D=[],w=c.length*4-Math.ceil(l*f/8);c[c.length-1]<<=8*w;var R=Math.ceil((g-d)/p);for(x=0;x<f;x++)T===0&&(S=c[A++],T=32),T>=l?(E=S>>>T-l&m,T-=l):(C=l-T,E=(S&m)<<C&m,S=c[A++],T=32-C,E+=S>>>T),D[x]=E<R?d+E*p:g;return D.unshift(d),D},unstuff2:function(c,l,f,d,p,g,m,A){var x=(1<<f)-1,C=0,T,E=0,S=0,D,w,R;if(p)for(T=0;T<d;T++)E===0&&(w=c[C++],E=32,S=0),E>=f?(D=w>>>S&x,E-=f,S+=f):(R=f-E,D=w>>>S&x,w=c[C++],E=32-R,D|=(w&(1<<R)-1)<<f-R,S=R),l[T]=p[D];else{var O=Math.ceil((A-g)/m);for(T=0;T<d;T++)E===0&&(w=c[C++],E=32,S=0),E>=f?(D=w>>>S&x,E-=f,S+=f):(R=f-E,D=w>>>S&x,w=c[C++],E=32-R,D|=(w&(1<<R)-1)<<f-R,S=R),l[T]=D<O?g+D*m:A}return l},unstuffLUT2:function(c,l,f,d,p,g){var m=(1<<l)-1,A=0,x=0,C=0,T=0,E=0,S=0,D,w=[],R=Math.ceil((g-d)/p);for(x=0;x<f;x++)T===0&&(D=c[A++],T=32,S=0),T>=l?(E=D>>>S&m,T-=l,S+=l):(C=l-T,E=D>>>S&m,D=c[A++],T=32-C,E|=(D&(1<<C)-1)<<l-C,S=C),w[x]=E<R?d+E*p:g;return w.unshift(d),w},originalUnstuff:function(c,l,f,d){var p=(1<<f)-1,g=0,m,A=0,x,C,T,E=c.length*4-Math.ceil(f*d/8);for(c[c.length-1]<<=8*E,m=0;m<d;m++)A===0&&(C=c[g++],A=32),A>=f?(x=C>>>A-f&p,A-=f):(T=f-A,x=(C&p)<<T&p,C=c[g++],A=32-T,x+=C>>>A),l[m]=x;return l},originalUnstuff2:function(c,l,f,d){var p=(1<<f)-1,g=0,m,A=0,x=0,C,T,E;for(m=0;m<d;m++)A===0&&(T=c[g++],A=32,x=0),A>=f?(C=T>>>x&p,A-=f,x+=f):(E=f-A,C=T>>>x&p,T=c[g++],A=32-E,C|=(T&(1<<E)-1)<<f-E,x=E),l[m]=C;return l}},r={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(c){for(var l=65535,f=65535,d=c.length,p=Math.floor(d/2),g=0;p;){var m=p>=359?359:p;p-=m;do l+=c[g++]<<8,f+=l+=c[g++];while(--m);l=(l&65535)+(l>>>16),f=(f&65535)+(f>>>16)}return d&1&&(f+=l+=c[g]<<8),l=(l&65535)+(l>>>16),f=(f&65535)+(f>>>16),(f<<16|l)>>>0},readHeaderInfo:function(c,l){var f=l.ptr,d=new Uint8Array(c,f,6),p={};if(p.fileIdentifierString=String.fromCharCode.apply(null,d),p.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+p.fileIdentifierString;f+=6;var g=new DataView(c,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(c,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(c,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,l.headerInfo=p,l.ptr=f;var A,x;if(m>=3&&(x=m>=4?52:48,A=this.computeChecksumFletcher32(new Uint8Array(c,f-x,p.blobSize-14)),A!==p.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(c,l){var f=l.headerInfo,d=this.getDataTypeArray(f.imageType),p=f.numDims*this.getDataTypeSize(f.imageType),g=this.readSubArray(c,l.ptr,d,p),m=this.readSubArray(c,l.ptr+p,d,p);l.ptr+=2*p;var A,x=!0;for(A=0;A<f.numDims;A++)if(g[A]!==m[A]){x=!1;break}return f.minValues=g,f.maxValues=m,x},readSubArray:function(c,l,f,d){var p;if(f===Uint8Array)p=new Uint8Array(c,l,d);else{var g=new ArrayBuffer(d),m=new Uint8Array(g);m.set(new Uint8Array(c,l,d)),p=new f(g)}return p},readMask:function(c,l){var f=l.ptr,d=l.headerInfo,p=d.width*d.height,g=d.numValidPixel,m=new DataView(c,f,4),A={};if(A.numBytes=m.getUint32(0,!0),f+=4,(g===0||p===g)&&A.numBytes!==0)throw"invalid mask";var x,C;if(g===0)x=new Uint8Array(Math.ceil(p/8)),A.bitset=x,C=new Uint8Array(p),l.pixels.resultMask=C,f+=A.numBytes;else if(A.numBytes>0){x=new Uint8Array(Math.ceil(p/8)),m=new DataView(c,f,A.numBytes);var T=m.getInt16(0,!0),E=2,S=0,D=0;do{if(T>0)for(;T--;)x[S++]=m.getUint8(E++);else for(D=m.getUint8(E++),T=-T;T--;)x[S++]=D;T=m.getInt16(E,!0),E+=2}while(E<A.numBytes);if(T!==-32768||S<x.length)throw"Unexpected end of mask RLE encoding";C=new Uint8Array(p);var w=0,R=0;for(R=0;R<p;R++)R&7?(w=x[R>>3],w<<=R&7):w=x[R>>3],w&128&&(C[R]=1);l.pixels.resultMask=C,A.bitset=x,f+=A.numBytes}return l.ptr=f,l.mask=A,!0},readDataOneSweep:function(c,l,f){var d=l.ptr,p=l.headerInfo,g=p.numDims,m=p.width*p.height,A=p.imageType,x=p.numValidPixel*r.getDataTypeSize(A)*g,C,T=l.pixels.resultMask;if(f===Uint8Array)C=new Uint8Array(c,d,x);else{var E=new ArrayBuffer(x),S=new Uint8Array(E);S.set(new Uint8Array(c,d,x)),C=new f(E)}if(C.length===m*g)l.pixels.resultPixels=C;else{l.pixels.resultPixels=new f(m*g);var D=0,w=0,R=0,O=0;if(g>1)for(R=0;R<g;R++)for(O=R*m,w=0;w<m;w++)T[w]&&(l.pixels.resultPixels[O+w]=C[D++]);else for(w=0;w<m;w++)T[w]&&(l.pixels.resultPixels[w]=C[D++])}return d+=x,l.ptr=d,!0},readHuffmanTree:function(c,l){var f=this.HUFFMAN_LUT_BITS_MAX,d=new DataView(c,l.ptr,16);l.ptr+=16;var p=d.getInt32(0,!0);if(p<2)throw"unsupported Huffman version";var g=d.getInt32(4,!0),m=d.getInt32(8,!0),A=d.getInt32(12,!0);if(m>=A)return!1;var x=new Uint32Array(A-m);r.decodeBits(c,l,x);var C=[],T,E,S,D;for(T=m;T<A;T++)E=T-(T<g?0:g),C[E]={first:x[T-m],second:null};var w=c.byteLength-l.ptr,R=Math.ceil(w/4),O=new ArrayBuffer(R*4),L=new Uint8Array(O);L.set(new Uint8Array(c,l.ptr,w));var N=new Uint32Array(O),_=0,b,v=0;for(b=N[0],T=m;T<A;T++)E=T-(T<g?0:g),D=C[E].first,D>0&&(C[E].second=b<<_>>>32-D,32-_>=D?(_+=D,_===32&&(_=0,v++,b=N[v])):(_+=D-32,v++,b=N[v],C[E].second|=b>>>32-_));var I=0,B=0,F=new s;for(T=0;T<C.length;T++)C[T]!==void 0&&(I=Math.max(I,C[T].first));I>=f?B=f:B=I,I>=30&&console.log("WARning, large NUM LUT BITS IS "+I);var k=[],U,G,V,X,j,Q;for(T=m;T<A;T++)if(E=T-(T<g?0:g),D=C[E].first,D>0)if(U=[D,E],D<=B)for(G=C[E].second<<B-D,V=1<<B-D,S=0;S<V;S++)k[G|S]=U;else for(G=C[E].second,Q=F,X=D-1;X>=0;X--)j=G>>>X&1,j?(Q.right||(Q.right=new s),Q=Q.right):(Q.left||(Q.left=new s),Q=Q.left),X===0&&!Q.val&&(Q.val=U[1]);return{decodeLut:k,numBitsLUTQick:B,numBitsLUT:I,tree:F,stuffedData:N,srcPtr:v,bitPos:_}},readHuffman:function(c,l,f){var d=l.headerInfo,p=d.numDims,g=l.headerInfo.height,m=l.headerInfo.width,A=m*g,x=this.readHuffmanTree(c,l),C=x.decodeLut,T=x.tree,E=x.stuffedData,S=x.srcPtr,D=x.bitPos,w=x.numBitsLUTQick,R=x.numBitsLUT,O=l.headerInfo.imageType===0?128:0,L,N,_,b=l.pixels.resultMask,v,I,B,F,k,U,G,V=0;D>0&&(S++,D=0);var X=E[S],j=l.encodeMode===1,Q=new f(A*p),W=Q,K;for(K=0;K<d.numDims;K++){if(p>1&&(W=new f(Q.buffer,A*K,A),V=0),l.headerInfo.numValidPixel===m*g)for(U=0,F=0;F<g;F++)for(k=0;k<m;k++,U++){if(N=0,v=X<<D>>>32-w,I=v,32-D<w&&(v|=E[S+1]>>>64-D-w,I=v),C[I])N=C[I][1],D+=C[I][0];else for(v=X<<D>>>32-R,I=v,32-D<R&&(v|=E[S+1]>>>64-D-R,I=v),L=T,G=0;G<R;G++)if(B=v>>>R-G-1&1,L=B?L.right:L.left,!(L.left||L.right)){N=L.val,D=D+G+1;break}D>=32&&(D-=32,S++,X=E[S]),_=N-O,j?(k>0?_+=V:F>0?_+=W[U-m]:_+=V,_&=255,W[U]=_,V=_):W[U]=_}else for(U=0,F=0;F<g;F++)for(k=0;k<m;k++,U++)if(b[U]){if(N=0,v=X<<D>>>32-w,I=v,32-D<w&&(v|=E[S+1]>>>64-D-w,I=v),C[I])N=C[I][1],D+=C[I][0];else for(v=X<<D>>>32-R,I=v,32-D<R&&(v|=E[S+1]>>>64-D-R,I=v),L=T,G=0;G<R;G++)if(B=v>>>R-G-1&1,L=B?L.right:L.left,!(L.left||L.right)){N=L.val,D=D+G+1;break}D>=32&&(D-=32,S++,X=E[S]),_=N-O,j?(k>0&&b[U-1]?_+=V:F>0&&b[U-m]?_+=W[U-m]:_+=V,_&=255,W[U]=_,V=_):W[U]=_}l.ptr=l.ptr+(S+1)*4+(D>0?4:0)}l.pixels.resultPixels=Q},decodeBits:function(c,l,f,d,p){{var g=l.headerInfo,m=g.fileVersion,A=0,x=new DataView(c,l.ptr,5),C=x.getUint8(0);A++;var T=C>>6,E=T===0?4:3-T,S=(C&32)>0,D=C&31,w=0;if(E===1)w=x.getUint8(A),A++;else if(E===2)w=x.getUint16(A,!0),A+=2;else if(E===4)w=x.getUint32(A,!0),A+=4;else throw"Invalid valid pixel count type";var R=2*g.maxZError,O,L,N,_,b,v,I,B,F,k,U=g.numDims>1?g.maxValues[p]:g.zMax;if(S){for(l.counter.lut++,B=x.getUint8(A),F=D,A++,_=Math.ceil((B-1)*D/8),b=Math.ceil(_/4),L=new ArrayBuffer(b*4),N=new Uint8Array(L),l.ptr+=A,N.set(new Uint8Array(c,l.ptr,_)),I=new Uint32Array(L),l.ptr+=_,k=0;B-1>>>k;)k++;_=Math.ceil(w*k/8),b=Math.ceil(_/4),L=new ArrayBuffer(b*4),N=new Uint8Array(L),N.set(new Uint8Array(c,l.ptr,_)),O=new Uint32Array(L),l.ptr+=_,m>=3?v=o.unstuffLUT2(I,D,B-1,d,R,U):v=o.unstuffLUT(I,D,B-1,d,R,U),m>=3?o.unstuff2(O,f,k,w,v):o.unstuff(O,f,k,w,v)}else l.counter.bitstuffer++,k=D,l.ptr+=A,k>0&&(_=Math.ceil(w*k/8),b=Math.ceil(_/4),L=new ArrayBuffer(b*4),N=new Uint8Array(L),N.set(new Uint8Array(c,l.ptr,_)),O=new Uint32Array(L),l.ptr+=_,m>=3?d==null?o.originalUnstuff2(O,f,k,w):o.unstuff2(O,f,k,w,!1,d,R,U):d==null?o.originalUnstuff(O,f,k,w):o.unstuff(O,f,k,w,!1,d,R,U))}},readTiles:function(c,l,f){var d=l.headerInfo,p=d.width,g=d.height,m=d.microBlockSize,A=d.imageType,x=r.getDataTypeSize(A),C=Math.ceil(p/m),T=Math.ceil(g/m);l.pixels.numBlocksY=T,l.pixels.numBlocksX=C,l.pixels.ptr=0;var E=0,S=0,D=0,w=0,R=0,O=0,L=0,N=0,_=0,b=0,v=0,I=0,B=0,F=0,k=0,U=0,G,V,X,j,Q,W,K=new f(m*m),J=g%m||m,_e=p%m||m,xe,re,ye=d.numDims,fe,Se=l.pixels.resultMask,we=l.pixels.resultPixels;for(D=0;D<T;D++)for(R=D!==T-1?m:J,w=0;w<C;w++)for(O=w!==C-1?m:_e,v=D*p*m+w*m,I=p-O,fe=0;fe<ye;fe++){if(ye>1&&(we=new f(l.pixels.resultPixels.buffer,p*g*fe*x,p*g)),L=c.byteLength-l.ptr,G=new DataView(c,l.ptr,Math.min(10,L)),V={},U=0,N=G.getUint8(0),U++,_=N>>6&255,b=N>>2&15,b!==(w*m>>3&15))throw"integrity issue";if(W=N&3,W>3)throw l.ptr+=U,"Invalid block encoding ("+W+")";if(W===2){l.counter.constant++,l.ptr+=U;continue}else if(W===0){if(l.counter.uncompressed++,l.ptr+=U,B=R*O*x,F=c.byteLength-l.ptr,B=B<F?B:F,X=new ArrayBuffer(B%x===0?B:B+x-B%x),j=new Uint8Array(X),j.set(new Uint8Array(c,l.ptr,B)),Q=new f(X),k=0,Se)for(E=0;E<R;E++){for(S=0;S<O;S++)Se[v]&&(we[v]=Q[k++]),v++;v+=I}else for(E=0;E<R;E++){for(S=0;S<O;S++)we[v++]=Q[k++];v+=I}l.ptr+=k*x}else if(xe=r.getDataTypeUsed(A,_),re=r.getOnePixel(V,U,xe,G),U+=r.getDataTypeSize(xe),W===3)if(l.ptr+=U,l.counter.constantoffset++,Se)for(E=0;E<R;E++){for(S=0;S<O;S++)Se[v]&&(we[v]=re),v++;v+=I}else for(E=0;E<R;E++){for(S=0;S<O;S++)we[v++]=re;v+=I}else if(l.ptr+=U,r.decodeBits(c,l,K,re,fe),U=0,Se)for(E=0;E<R;E++){for(S=0;S<O;S++)Se[v]&&(we[v]=K[U++]),v++;v+=I}else for(E=0;E<R;E++){for(S=0;S<O;S++)we[v++]=K[U++];v+=I}}},formatFileInfo:function(c){return{fileIdentifierString:c.headerInfo.fileIdentifierString,fileVersion:c.headerInfo.fileVersion,imageType:c.headerInfo.imageType,height:c.headerInfo.height,width:c.headerInfo.width,numValidPixel:c.headerInfo.numValidPixel,microBlockSize:c.headerInfo.microBlockSize,blobSize:c.headerInfo.blobSize,maxZError:c.headerInfo.maxZError,pixelType:r.getPixelType(c.headerInfo.imageType),eofOffset:c.eofOffset,mask:c.mask?{numBytes:c.mask.numBytes}:null,pixels:{numBlocksX:c.pixels.numBlocksX,numBlocksY:c.pixels.numBlocksY,maxValue:c.headerInfo.zMax,minValue:c.headerInfo.zMin,noDataValue:c.noDataValue}}},constructConstantSurface:function(c){var l=c.headerInfo.zMax,f=c.headerInfo.numDims,d=c.headerInfo.height*c.headerInfo.width,p=d*f,g=0,m=0,A=0,x=c.pixels.resultMask;if(x)if(f>1)for(g=0;g<f;g++)for(A=g*d,m=0;m<d;m++)x[m]&&(c.pixels.resultPixels[A+m]=l);else for(m=0;m<d;m++)x[m]&&(c.pixels.resultPixels[m]=l);else if(c.pixels.resultPixels.fill)c.pixels.resultPixels.fill(l);else for(m=0;m<p;m++)c.pixels.resultPixels[m]=l},getDataTypeArray:function(c){var l;switch(c){case 0:l=Int8Array;break;case 1:l=Uint8Array;break;case 2:l=Int16Array;break;case 3:l=Uint16Array;break;case 4:l=Int32Array;break;case 5:l=Uint32Array;break;case 6:l=Float32Array;break;case 7:l=Float64Array;break;default:l=Float32Array}return l},getPixelType:function(c){var l;switch(c){case 0:l="S8";break;case 1:l="U8";break;case 2:l="S16";break;case 3:l="U16";break;case 4:l="S32";break;case 5:l="U32";break;case 6:l="F32";break;case 7:l="F64";break;default:l="F32"}return l},isValidPixelValue:function(c,l){if(l==null)return!1;var f;switch(c){case 0:f=l>=-128&&l<=127;break;case 1:f=l>=0&&l<=255;break;case 2:f=l>=-32768&&l<=32767;break;case 3:f=l>=0&&l<=65536;break;case 4:f=l>=-2147483648&&l<=2147483647;break;case 5:f=l>=0&&l<=4294967296;break;case 6:f=l>=-34027999387901484e22&&l<=34027999387901484e22;break;case 7:f=l>=5e-324&&l<=17976931348623157e292;break;default:f=!1}return f},getDataTypeSize:function(c){var l=0;switch(c){case 0:case 1:l=1;break;case 2:case 3:l=2;break;case 4:case 5:case 6:l=4;break;case 7:l=8;break;default:l=c}return l},getDataTypeUsed:function(c,l){var f=c;switch(c){case 2:case 4:f=c-l;break;case 3:case 5:f=c-2*l;break;case 6:l===0?f=c:l===1?f=2:f=1;break;case 7:l===0?f=c:f=c-2*l+1;break;default:f=c;break}return f},getOnePixel:function(c,l,f,d){var p=0;switch(f){case 0:p=d.getInt8(l);break;case 1:p=d.getUint8(l);break;case 2:p=d.getInt16(l,!0);break;case 3:p=d.getUint16(l,!0);break;case 4:p=d.getInt32(l,!0);break;case 5:p=d.getUInt32(l,!0);break;case 6:p=d.getFloat32(l,!0);break;case 7:p=d.getFloat64(l,!0);break;default:throw"the decoder does not understand this pixel type"}return p}},s=function(c,l,f){this.val=c,this.left=l,this.right=f},a={decode:function(c,l){l=l||{};var f=l.noDataValue,d=0,p={};if(p.ptr=l.inputOffset||0,p.pixels={},!!r.readHeaderInfo(c,p)){var g=p.headerInfo,m=g.fileVersion,A=r.getDataTypeArray(g.imageType);r.readMask(c,p),g.numValidPixel!==g.width*g.height&&!p.pixels.resultMask&&(p.pixels.resultMask=l.maskData);var x=g.width*g.height;if(p.pixels.resultPixels=new A(x*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(c,p))r.constructConstantSurface(p);else{var C=new DataView(c,p.ptr,2),T=C.getUint8(0);if(p.ptr++,T)r.readDataOneSweep(c,p,A);else if(m>1&&g.imageType<=1&&Math.abs(g.maxZError-.5)<1e-5){var E=C.getUint8(1);if(p.ptr++,p.encodeMode=E,E>2||m<4&&E>1)throw"Invalid Huffman flag "+E;E?r.readHuffman(c,p,A):r.readTiles(c,p,A)}else r.readTiles(c,p,A)}p.eofOffset=p.ptr;var S;l.inputOffset?(S=p.headerInfo.blobSize+l.inputOffset-p.ptr,Math.abs(S)>=1&&(p.eofOffset=l.inputOffset+p.headerInfo.blobSize)):(S=p.headerInfo.blobSize-p.ptr,Math.abs(S)>=1&&(p.eofOffset=p.headerInfo.blobSize));var D={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 w=p.pixels.resultMask;for(d=0;d<x;d++)w[d]||(D.pixelData[d]=f);D.noDataValue=f}return p.noDataValue=f,l.returnFileInfo&&(D.fileInfo=r.formatFileInfo(p)),D}},getBandCount:function(c){var l=0,f=0,d={};for(d.ptr=0,d.pixels={};f<c.byteLength-58;)r.readHeaderInfo(c,d),f+=d.headerInfo.blobSize,l++,d.ptr=f;return l}};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),c=String.fromCharCode.apply(null,a),l,f;if(c.trim()==="CntZImage")l=e,f=1;else if(c.substring(0,5)==="Lerc2")l=t,f=2;else throw"Unexpected file identifier string: "+c;for(var d=0,p=o.byteLength-10,g,m=[],A,x,C={width:0,height:0,pixels:[],pixelType:r.pixelType,mask:null,statistics:[]};s<p;){var T=l.decode(o,{inputOffset:s,encodedMaskData:g,maskData:x,returnMask:d===0,returnEncodedMask:d===0,returnFileInfo:!0,pixelType:r.pixelType||null,noDataValue:r.noDataValue||null});s=T.fileInfo.eofOffset,d===0&&(g=T.encodedMaskData,x=T.maskData,C.width=T.width,C.height=T.height,C.dimCount=T.dimCount||1,C.pixelType=T.pixelType||T.fileInfo.pixelType,C.mask=T.maskData),f>1&&T.fileInfo.mask&&T.fileInfo.mask.numBytes>0&&m.push(T.maskData),d++,C.pixels.push(T.pixelData),C.statistics.push({minValue:T.minValue,maxValue:T.maxValue,noDataValue:T.noDataValue,dimStats:T.dimStats})}var E,S,D;if(f>1&&m.length>1){for(D=C.width*C.height,C.bandMasks=m,x=new Uint8Array(D),x.set(m[0]),E=1;E<m.length;E++)for(A=m[E],S=0;S<D;S++)x[S]=x[S]&A[S];C.maskData=x}return C}};typeof define=="function"&&define.amd?define([],function(){return i}):typeof q4<"u"&&q4.exports?q4.exports=i:this.Lerc=i})()});var IAe=Jc((iji,wAe)=>{wAe.exports={webm:"data:video/webm;base64, ",mp4:"data:video/mp4;base64, "}});var OAe=Jc((oji,PAe)=>{var{webm:fyt,mp4:dyt}=IAe(),eK=()=>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,tK=()=>"wakeLock"in navigator,nK=class{constructor(){if(this.enabled=!1,tK()){this._wakeLock=null;let t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else eK()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",fyt),this._addSourceToVideo(this.noSleepVideo,"mp4",dyt),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})}))}_addSourceToVideo(t,n,i){var o=document.createElement("source");o.src=i,o.type=`video/${n}`,t.appendChild(o)}get isEnabled(){return this.enabled}enable(){return tK()?navigator.wakeLock.request("screen").then(t=>{this._wakeLock=t,this.enabled=!0,console.log("Wake Lock active."),this._wakeLock.addEventListener("release",()=>{console.log("Wake Lock released.")})}).catch(t=>{throw this.enabled=!1,console.error(`${t.name}, ${t.message}`),t}):eK()?(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(()=>{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(n=>(this.enabled=!0,n)).catch(n=>{throw this.enabled=!1,n})}disable(){tK()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):eK()?this.noSleepTimer&&(console.warn(`
          NoSleep now disabled for older iOS devices.
        `),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}};PAe.exports=nK});var Fyt={};txe(Fyt,{AlphaMode:()=>Ph,AlphaPipelineStage:()=>G1,Animation:()=>u2,AnimationViewModel:()=>f2,Appearance:()=>$i,ApproximateTerrainHeights:()=>fi,ArcGISTiledElevationTerrainProvider:()=>aj,ArcGisMapServerImageryProvider:()=>T_,ArcType:()=>Kt,ArticulationStageType:()=>Ya,AssociativeArray:()=>xt,AttributeCompression:()=>Gn,AttributeType:()=>rn,AutoExposure:()=>WN,AutomaticUniforms:()=>Pm,Axis:()=>Po,AxisAlignedBoundingBox:()=>$_,B3dmLoader:()=>a1,B3dmParser:()=>o1,BaseLayerPicker:()=>h2,BaseLayerPickerViewModel:()=>d2,BatchTable:()=>O0,BatchTableHierarchy:()=>oA,BatchTexture:()=>wc,BatchTexturePipelineStage:()=>W1,Billboard:()=>lo,BillboardCollection:()=>Jl,BillboardGraphics:()=>Na,BillboardVisualizer:()=>Zw,BingMapsGeocoderService:()=>lj,BingMapsImageryProvider:()=>SL,BingMapsStyle:()=>EL,BlendEquation:()=>aa,BlendFunction:()=>xo,BlendOption:()=>To,BlendingState:()=>un,BoundingRectangle:()=>Ye,BoundingSphere:()=>se,BoundingSphereState:()=>at,BoxEmitter:()=>Lq,BoxGeometry:()=>ol,BoxGeometryUpdater:()=>hP,BoxGraphics:()=>W0,BoxOutlineGeometry:()=>Xf,BrdfLutGenerator:()=>QL,Buffer:()=>lt,BufferLoader:()=>uA,BufferUsage:()=>Ne,CPUStylingPipelineStage:()=>X1,CallbackProperty:()=>nd,Camera:()=>ro,CameraEventAggregator:()=>JN,CameraEventType:()=>Ii,CameraFlightPath:()=>eN,Cartesian2:()=>H,Cartesian3:()=>h,Cartesian4:()=>oe,Cartographic:()=>he,CartographicGeocoderService:()=>tL,CatmullRomSpline:()=>uj,Cesium3DContentGroup:()=>iA,Cesium3DTile:()=>eu,Cesium3DTileBatchTable:()=>ap,Cesium3DTileColorBlendMode:()=>ul,Cesium3DTileContent:()=>Nq,Cesium3DTileContentFactory:()=>NA,Cesium3DTileContentState:()=>Eo,Cesium3DTileContentType:()=>cs,Cesium3DTileFeature:()=>xs,Cesium3DTileFeatureTable:()=>fd,Cesium3DTileOptimizationHint:()=>of,Cesium3DTileOptimizations:()=>BR,Cesium3DTilePass:()=>qo,Cesium3DTilePassState:()=>Of,Cesium3DTilePointFeature:()=>Rp,Cesium3DTileRefine:()=>Sr,Cesium3DTileStyle:()=>fC,Cesium3DTileStyleEngine:()=>UR,Cesium3DTilesInspector:()=>A2,Cesium3DTilesInspectorViewModel:()=>y2,Cesium3DTilesVoxelProvider:()=>zq,Cesium3DTileset:()=>Rc,Cesium3DTilesetCache:()=>NR,Cesium3DTilesetGraphics:()=>J0,Cesium3DTilesetHeatmap:()=>FR,Cesium3DTilesetMetadata:()=>ZA,Cesium3DTilesetMostDetailedTraversal:()=>nE,Cesium3DTilesetStatistics:()=>Xp,Cesium3DTilesetTraversal:()=>zh,Cesium3DTilesetVisualizer:()=>zR,CesiumInspector:()=>T2,CesiumInspectorViewModel:()=>C2,CesiumTerrainProvider:()=>nL,CesiumWidget:()=>hF,Check:()=>Qc,CheckerboardMaterialProperty:()=>yE,CircleEmitter:()=>yF,CircleGeometry:()=>mj,CircleOutlineGeometry:()=>pj,ClassificationModelDrawCommand:()=>E1,ClassificationPipelineStage:()=>j1,ClassificationPrimitive:()=>fT,ClassificationType:()=>Un,ClearCommand:()=>ii,ClippingPlane:()=>xA,ClippingPlaneCollection:()=>ss,Clock:()=>vd,ClockRange:()=>Br,ClockStep:()=>uo,ClockViewModel:()=>s2,CloudCollection:()=>qq,CloudType:()=>gS,Color:()=>z,ColorBlendMode:()=>ja,ColorGeometryInstanceAttribute:()=>Nt,ColorMaterialProperty:()=>Mt,Command:()=>GX,ComponentDatatype:()=>q,Composite3DTileContent:()=>xP,CompositeEntityCollection:()=>u9,CompositeMaterialProperty:()=>xE,CompositePositionProperty:()=>Ws,CompositeProperty:()=>Qa,CompressedTextureBuffer:()=>lD,ComputeCommand:()=>Lu,ComputeEngine:()=>XS,ConditionsExpression:()=>mF,ConeEmitter:()=>Kq,ConstantPositionProperty:()=>Sc,ConstantProperty:()=>ei,ConstantSpline:()=>f1,ContentMetadata:()=>TR,Context:()=>Gw,ContextLimits:()=>Ft,CoplanarPolygonGeometry:()=>SB,CoplanarPolygonGeometryLibrary:()=>Hp,CoplanarPolygonOutlineGeometry:()=>cf,CornerType:()=>vi,CorridorGeometry:()=>nx,CorridorGeometryLibrary:()=>Mi,CorridorGeometryUpdater:()=>ZR,CorridorGraphics:()=>Y0,CorridorOutlineGeometry:()=>KR,Credit:()=>Zt,CreditDisplay:()=>oN,CubeMap:()=>Ma,CubeMapFace:()=>yh,CubicRealPolynomial:()=>I0,CullFace:()=>gi,CullingVolume:()=>$r,CumulusCloud:()=>Pu,CustomDataSource:()=>nB,CustomHeightmapTerrainProvider:()=>_j,CustomShader:()=>TC,CustomShaderMode:()=>Ip,CustomShaderPipelineStage:()=>tO,CustomShaderTranslucencyMode:()=>Bg,CylinderGeometry:()=>iB,CylinderGeometryLibrary:()=>ix,CylinderGeometryUpdater:()=>rB,CylinderGraphics:()=>q0,CylinderOutlineGeometry:()=>oB,CzmlDataSource:()=>pB,DataSource:()=>Or,DataSourceClock:()=>wd,DataSourceCollection:()=>_B,DataSourceDisplay:()=>nM,DebugAppearance:()=>Zq,DebugCameraPrimitive:()=>dm,DebugInspector:()=>rF,DebugModelMatrixPrimitive:()=>xF,DefaultProxy:()=>gj,DepthFunction:()=>Fa,DepthPlane:()=>aN,DequantizationPipelineStage:()=>iO,DerivedCommand:()=>I_,DeveloperError:()=>de,DeviceOrientationCameraController:()=>lN,DirectionalLight:()=>Jq,DiscardEmptyTileImagePolicy:()=>Kb,DiscardMissingTileImagePolicy:()=>CL,DistanceDisplayCondition:()=>bt,DistanceDisplayConditionGeometryInstanceAttribute:()=>Vn,DoubleEndedPriorityQueue:()=>Nx,DoublyLinkedList:()=>LR,DracoLoader:()=>pp,DrawCommand:()=>tt,DynamicGeometryBatch:()=>fx,DynamicGeometryUpdater:()=>ri,EarthOrientationParameters:()=>aD,EarthOrientationParametersSample:()=>H_,EasingFunction:()=>Mr,EllipseGeometry:()=>Fc,EllipseGeometryLibrary:()=>Cl,EllipseGeometryUpdater:()=>yB,EllipseGraphics:()=>X0,EllipseOutlineGeometry:()=>au,Ellipsoid:()=>ie,EllipsoidGeodesic:()=>Gu,EllipsoidGeometry:()=>vs,EllipsoidGeometryUpdater:()=>xB,EllipsoidGraphics:()=>K0,EllipsoidOutlineGeometry:()=>$l,EllipsoidPrimitive:()=>XL,EllipsoidRhumbLine:()=>la,EllipsoidSurfaceAppearance:()=>Qq,EllipsoidTangentPlane:()=>ca,EllipsoidTerrainProvider:()=>A_,EllipsoidalOccluder:()=>Qp,Empty3DTileContent:()=>iE,EncodedCartesian3:()=>Hn,Entity:()=>jo,EntityCluster:()=>tu,EntityCollection:()=>Ss,EntityView:()=>oM,Event:()=>Ae,EventHelper:()=>wr,Expression:()=>ju,ExpressionNodeType:()=>ht,ExtrapolationType:()=>iu,FeatureDetection:()=>Vt,FeatureIdPipelineStage:()=>Rg,Fog:()=>uN,ForEach:()=>Pe,FrameRateMonitor:()=>EF,FrameState:()=>fN,Framebuffer:()=>Ns,FramebufferManager:()=>mi,FrustumCommands:()=>pN,FrustumGeometry:()=>Vx,FrustumOutlineGeometry:()=>sL,Fullscreen:()=>fr,FullscreenButton:()=>w2,FullscreenButtonViewModel:()=>v2,GeoJsonDataSource:()=>aM,GeoJsonLoader:()=>c1,GeocodeType:()=>By,Geocoder:()=>b2,GeocoderService:()=>Tj,GeocoderViewModel:()=>E2,GeographicProjection:()=>Ei,GeographicTilingScheme:()=>ji,Geometry:()=>ct,Geometry3DTileContent:()=>TP,GeometryAttribute:()=>ve,GeometryAttributes:()=>dn,GeometryFactory:()=>Ej,GeometryInstance:()=>At,GeometryInstanceAttribute:()=>Va,GeometryOffsetAttribute:()=>nn,GeometryPipeline:()=>Ln,GeometryPipelineStage:()=>aO,GeometryType:()=>Nu,GeometryUpdater:()=>si,GeometryVisualizer:()=>GB,GetFeatureInfoFormat:()=>Wx,Globe:()=>qL,GlobeDepth:()=>_N,GlobeSurfaceShaderSet:()=>LL,GlobeSurfaceTile:()=>If,GlobeSurfaceTileProvider:()=>FL,GlobeTranslucency:()=>VL,GlobeTranslucencyFramebuffer:()=>gN,GlobeTranslucencyState:()=>dN,GltfBufferViewLoader:()=>bT,GltfDracoLoader:()=>ST,GltfImageLoader:()=>DT,GltfIndexBufferLoader:()=>vT,GltfJsonLoader:()=>IT,GltfLoader:()=>Cp,GltfLoaderUtil:()=>hl,GltfStructuralMetadataLoader:()=>e1,GltfTextureLoader:()=>PT,GltfVertexBufferLoader:()=>OT,GoogleEarthEnterpriseImageryProvider:()=>eX,GoogleEarthEnterpriseMapsProvider:()=>vL,GoogleEarthEnterpriseMetadata:()=>Zd,GoogleEarthEnterpriseTerrainData:()=>Gb,GoogleEarthEnterpriseTerrainProvider:()=>Oj,GoogleEarthEnterpriseTileInformation:()=>aL,GpxDataSource:()=>fM,GregorianDate:()=>Lm,GridImageryProvider:()=>tX,GridMaterialProperty:()=>PE,GroundGeometryUpdater:()=>jn,GroundPolylineGeometry:()=>k0,GroundPolylinePrimitive:()=>Qf,GroundPrimitive:()=>Ec,GroupMetadata:()=>pE,HeadingPitchRange:()=>uu,HeadingPitchRoll:()=>Ba,Heap:()=>nD,HeightReference:()=>We,HeightmapEncoding:()=>bf,HeightmapTerrainData:()=>ga,HeightmapTessellator:()=>Bb,HermitePolynomialApproximation:()=>sB,HermiteSpline:()=>Ig,HilbertOrder:()=>xT,HomeButton:()=>D2,HomeButtonViewModel:()=>S2,HorizontalOrigin:()=>_i,I3SDataProvider:()=>oX,I3SFeature:()=>SF,I3SField:()=>DF,I3SGeometry:()=>AS,I3SLayer:()=>CS,I3SNode:()=>xS,I3dmLoader:()=>u1,I3dmParser:()=>l1,Iau2000Orientation:()=>lL,Iau2006XysData:()=>cD,Iau2006XysSample:()=>x0,IauOrientationAxes:()=>uL,IauOrientationParameters:()=>cL,ImageBasedLighting:()=>nA,ImageBasedLightingPipelineStage:()=>w1,ImageMaterialProperty:()=>og,Imagery:()=>nS,ImageryLayer:()=>bu,ImageryLayerCollection:()=>UL,ImageryLayerFeatureInfo:()=>eh,ImageryProvider:()=>Gc,ImageryState:()=>ui,Implicit3DTileContent:()=>BT,ImplicitAvailabilityBitstream:()=>TT,ImplicitMetadataView:()=>ET,ImplicitSubdivisionScheme:()=>kr,ImplicitSubtree:()=>yA,ImplicitSubtreeCache:()=>_F,ImplicitSubtreeMetadata:()=>EP,ImplicitTileCoordinates:()=>$A,ImplicitTileset:()=>QA,IndexDatatype:()=>Fe,InfoBox:()=>P2,InfoBoxViewModel:()=>I2,InspectorShared:()=>Ea,InstanceAttributeSemantic:()=>zr,InstancingPipelineStage:()=>U1,InterpolationAlgorithm:()=>Bj,InterpolationType:()=>ud,Intersect:()=>Qt,IntersectionTests:()=>Yi,Intersections2D:()=>g_,Interval:()=>yc,InvertClassification:()=>uS,Ion:()=>Jd,IonGeocoderService:()=>hL,IonImageryProvider:()=>b_,IonResource:()=>Qd,IonWorldImageryStyle:()=>S_,Iso8601:()=>ze,JobScheduler:()=>hN,JobType:()=>fa,JsonMetadataTable:()=>yp,JulianDate:()=>$,KTX2Transcoder:()=>uD,KeyboardEventModifier:()=>Js,KeyframeNode:()=>Ki,KmlCamera:()=>dM,KmlDataSource:()=>IM,KmlLookAt:()=>CM,KmlTour:()=>TM,KmlTourFlyTo:()=>SM,KmlTourWait:()=>DM,Label:()=>Ug,LabelCollection:()=>Fh,LabelGraphics:()=>$f,LabelStyle:()=>No,LabelVisualizer:()=>WB,LagrangePolynomialApproximation:()=>aB,LeapSecond:()=>Fi,Light:()=>rX,LightingModel:()=>Rh,LightingPipelineStage:()=>lO,LinearApproximation:()=>rx,LinearSpline:()=>wg,ManagedArray:()=>Yl,MapMode2D:()=>wl,MapProjection:()=>Fj,MapboxImageryProvider:()=>wL,MapboxStyleImageryProvider:()=>sX,Material:()=>Vi,MaterialAppearance:()=>oo,MaterialPipelineStage:()=>fO,MaterialProperty:()=>Wo,Math:()=>P,Matrix2:()=>Ji,Matrix3:()=>Z,Matrix4:()=>M,Megatexture:()=>ES,MetadataClass:()=>ad,MetadataClassProperty:()=>hg,MetadataComponentType:()=>tn,MetadataEntity:()=>Nn,MetadataEnum:()=>kP,MetadataEnumValue:()=>UP,MetadataPipelineStage:()=>Ku,MetadataSchema:()=>cd,MetadataSchemaLoader:()=>RT,MetadataSemantic:()=>AA,MetadataTable:()=>fl,MetadataTableProperty:()=>SP,MetadataType:()=>zt,MipmapHint:()=>Ah,Model:()=>pd,Model3DTileContent:()=>Mh,ModelAlphaOptions:()=>vO,ModelAnimation:()=>p1,ModelAnimationChannel:()=>m1,ModelAnimationCollection:()=>_1,ModelAnimationLoop:()=>Ga,ModelAnimationState:()=>hd,ModelArticulation:()=>P1,ModelArticulationStage:()=>I1,ModelClippingPlanesPipelineStage:()=>B1,ModelColorPipelineStage:()=>Og,ModelComponents:()=>Rt,ModelDrawCommand:()=>b1,ModelFeature:()=>g1,ModelFeatureTable:()=>A1,ModelGraphics:()=>$m,ModelLightingOptions:()=>LO,ModelMatrixUpdateStage:()=>k1,ModelNode:()=>M1,ModelRenderResources:()=>wO,ModelRuntimeNode:()=>H1,ModelRuntimePrimitive:()=>SO,ModelSceneGraph:()=>FO,ModelSilhouettePipelineStage:()=>OO,ModelSkin:()=>DO,ModelSplitterPipelineStage:()=>BO,ModelStatistics:()=>VO,ModelType:()=>rr,ModelUtility:()=>sn,ModelVisualizer:()=>YB,Moon:()=>ZL,MorphTargetsPipelineStage:()=>hO,MorphWeightSpline:()=>Vj,MortonOrder:()=>Kg,Multiple3DTileContent:()=>SR,MultisampleFramebuffer:()=>Ww,NavigationHelpButton:()=>R2,NavigationHelpButtonViewModel:()=>O2,NearFarScalar:()=>Pt,NeverTileDiscardPolicy:()=>cX,NodeRenderResources:()=>MO,NodeStatisticsPipelineStage:()=>z1,NodeTransformationProperty:()=>Z0,OIT:()=>yN,Occluder:()=>mL,OctahedralProjectedCubeMap:()=>id,OffsetGeometryInstanceAttribute:()=>Wi,OpenCageGeocoderService:()=>zj,OpenStreetMapImageryProvider:()=>_C,OrderedGroundPrimitiveCollection:()=>gB,OrientedBoundingBox:()=>Rn,OrthographicFrustum:()=>en,OrthographicOffCenterFrustum:()=>Tr,Packable:()=>Hj,PackableForInterpolation:()=>Gj,Particle:()=>bS,ParticleBurst:()=>uX,ParticleEmitter:()=>fX,ParticleSystem:()=>dX,Pass:()=>Ee,PassState:()=>La,PathGraphics:()=>ep,PathVisualizer:()=>XB,PeliasGeocoderService:()=>dL,PerInstanceColorAppearance:()=>on,PerformanceDisplay:()=>P_,PerformanceWatchdog:()=>M2,PerformanceWatchdogViewModel:()=>B2,PerspectiveFrustum:()=>Ti,PerspectiveOffCenterFrustum:()=>zc,PickDepth:()=>mN,PickDepthFramebuffer:()=>xN,PickFramebuffer:()=>EN,Picking:()=>DN,PickingPipelineStage:()=>mO,PinBuilder:()=>d_,PixelDatatype:()=>Xe,PixelFormat:()=>rt,Plane:()=>cn,PlaneGeometry:()=>CB,PlaneGeometryUpdater:()=>EB,PlaneGraphics:()=>sP,PlaneOutlineGeometry:()=>TB,PntsLoader:()=>kO,PntsParser:()=>PA,PointCloud:()=>OF,PointCloudEyeDomeLighting:()=>Tp,PointCloudShading:()=>Oh,PointCloudStylingPipelineStage:()=>_O,PointGraphics:()=>Q0,PointPrimitive:()=>Ds,PointPrimitiveCollection:()=>SE,PointVisualizer:()=>ZB,PolygonGeometry:()=>px,PolygonGeometryLibrary:()=>Wn,PolygonGeometryUpdater:()=>vB,PolygonGraphics:()=>ed,PolygonHierarchy:()=>Dc,PolygonOutlineGeometry:()=>DB,PolygonPipeline:()=>li,Polyline:()=>ef,PolylineArrowMaterialProperty:()=>RE,PolylineCollection:()=>gd,PolylineColorAppearance:()=>Vr,PolylineDashMaterialProperty:()=>ME,PolylineGeometry:()=>f_,PolylineGeometryUpdater:()=>$B,PolylineGlowMaterialProperty:()=>NE,PolylineGraphics:()=>Ua,PolylineMaterialAppearance:()=>Vs,PolylineOutlineMaterialProperty:()=>iy,PolylinePipeline:()=>Di,PolylineVisualizer:()=>tM,PolylineVolumeGeometry:()=>PB,PolylineVolumeGeometryLibrary:()=>Ed,PolylineVolumeGeometryUpdater:()=>MB,PolylineVolumeGraphics:()=>$0,PolylineVolumeOutlineGeometry:()=>BB,PositionProperty:()=>Jm,PositionPropertyArray:()=>n_,PostProcessStage:()=>po,PostProcessStageCollection:()=>XN,PostProcessStageComposite:()=>jc,PostProcessStageLibrary:()=>Bf,PostProcessStageSampleMode:()=>Du,PostProcessStageTextureCache:()=>oC,Primitive:()=>Dn,PrimitiveCollection:()=>xl,PrimitiveLoadPlan:()=>bA,PrimitiveOutlineGenerator:()=>EA,PrimitiveOutlinePipelineStage:()=>AO,PrimitivePipeline:()=>F0,PrimitiveRenderResources:()=>NO,PrimitiveState:()=>mr,PrimitiveStatisticsPipelineStage:()=>xO,PrimitiveType:()=>Me,ProjectionPicker:()=>N2,ProjectionPickerViewModel:()=>L2,Property:()=>Y,PropertyArray:()=>VE,PropertyAttribute:()=>TA,PropertyAttributeProperty:()=>ZP,PropertyBag:()=>cl,PropertyTable:()=>Ic,PropertyTexture:()=>CA,PropertyTextureProperty:()=>KP,ProviderViewModel:()=>ps,Proxy:()=>Wj,QuadraticRealPolynomial:()=>xc,QuadtreeOccluders:()=>kL,QuadtreePrimitive:()=>YL,QuadtreeTile:()=>zL,QuadtreeTileLoadState:()=>Os,QuadtreeTileProvider:()=>yX,QuantizedMeshTerrainData:()=>Mx,QuarticRealPolynomial:()=>PI,Quaternion:()=>Le,QuaternionSpline:()=>h1,Queue:()=>jg,Ray:()=>wn,Rectangle:()=>ce,RectangleCollisionChecker:()=>Ax,RectangleGeometry:()=>gx,RectangleGeometryLibrary:()=>ls,RectangleGeometryUpdater:()=>LB,RectangleGraphics:()=>td,RectangleOutlineGeometry:()=>HA,ReferenceFrame:()=>to,ReferenceProperty:()=>i_,RenderState:()=>Ue,Renderbuffer:()=>Ul,RenderbufferFormat:()=>_c,Request:()=>zo,RequestErrorEvent:()=>ph,RequestScheduler:()=>Oa,RequestState:()=>hi,RequestType:()=>Qr,Resource:()=>Oe,ResourceCache:()=>Ui,ResourceCacheKey:()=>ml,ResourceCacheStatistics:()=>WP,ResourceLoader:()=>no,ResourceLoaderState:()=>Ut,Rotation:()=>mf,RuntimeError:()=>ue,S2Cell:()=>fp,SDFSettings:()=>bs,SampledPositionProperty:()=>Ys,SampledProperty:()=>ru,Sampler:()=>ln,ScaledPositionProperty:()=>Qh,Scene:()=>aF,SceneFramebuffer:()=>Jx,SceneMode:()=>te,SceneMode2DPipelineStage:()=>CO,SceneModePicker:()=>V2,SceneModePickerViewModel:()=>F2,SceneTransforms:()=>qi,SceneTransitioner:()=>ZN,ScreenSpaceCameraController:()=>eF,ScreenSpaceEventHandler:()=>Tu,ScreenSpaceEventType:()=>yn,SelectedFeatureIdPipelineStage:()=>Mg,SelectionIndicator:()=>z2,SelectionIndicatorViewModel:()=>k2,ShaderBuilder:()=>S0,ShaderCache:()=>Fw,ShaderDestination:()=>Te,ShaderFunction:()=>qw,ShaderProgram:()=>Xt,ShaderSource:()=>ke,ShaderStruct:()=>Yw,ShadowMap:()=>B_,ShadowMapShader:()=>_m,ShadowMode:()=>gn,ShadowVolumeAppearance:()=>Gl,ShowGeometryInstanceAttribute:()=>_n,Simon1994PlanetaryPositions:()=>K_,SimplePolylineGeometry:()=>$j,SingleTileImageryProvider:()=>PL,SkinningPipelineStage:()=>EO,SkyAtmosphere:()=>cF,SkyBox:()=>lF,SpatialNode:()=>DS,SphereEmitter:()=>xX,SphereGeometry:()=>eY,SphereOutlineGeometry:()=>Wp,Spherical:()=>cB,Spline:()=>io,SplitDirection:()=>Pc,Splitter:()=>SS,StaticGeometryColorBatch:()=>gf,StaticGeometryPerMaterialBatch:()=>yf,StaticGroundGeometryColorBatch:()=>sb,StaticGroundGeometryPerMaterialBatch:()=>NB,StaticGroundPolylinePerMaterialBatch:()=>eM,StaticOutlineGeometryBatch:()=>lb,StencilConstants:()=>Bt,StencilFunction:()=>kn,StencilOperation:()=>ut,SteppedSpline:()=>d1,StripeMaterialProperty:()=>kE,StripeOrientation:()=>Pd,StructuralMetadata:()=>da,StyleCommandsNeeded:()=>md,StyleExpression:()=>CX,Sun:()=>dF,SunLight:()=>Hm,SunPostProcess:()=>iF,SupportedImageFormats:()=>t1,SvgPathBindingHandler:()=>o2,TaskProcessor:()=>pi,TerrainData:()=>Yd,TerrainEncoding:()=>oc,TerrainExaggeration:()=>Cc,TerrainFillMesh:()=>sS,TerrainMesh:()=>Df,TerrainOffsetProperty:()=>eA,TerrainProvider:()=>Hr,TerrainQuantization:()=>Ps,TerrainState:()=>mo,Texture:()=>It,TextureAtlas:()=>Vg,TextureCache:()=>Vw,TextureMagnificationFilter:()=>yi,TextureManager:()=>QF,TextureMinificationFilter:()=>an,TextureUniform:()=>VX,TextureWrap:()=>vn,TileAvailability:()=>qd,TileBoundingRegion:()=>af,TileBoundingS2Cell:()=>OR,TileBoundingSphere:()=>jp,TileBoundingVolume:()=>TX,TileCoordinatesImageryProvider:()=>LF,TileDiscardPolicy:()=>bX,TileEdge:()=>pn,TileImagery:()=>iS,TileMapServiceImageryProvider:()=>Fy,TileMetadata:()=>ER,TileOrientedBoundingBox:()=>lf,TileProviderError:()=>Xn,TileReplacementQueue:()=>HL,TileSelectionResult:()=>$n,TileState:()=>SX,Tileset3DTileContent:()=>GO,TilesetMetadata:()=>RR,TilesetPipelineStage:()=>D1,TilingScheme:()=>tY,TimeConstants:()=>Qn,TimeDynamicImagery:()=>jx,TimeDynamicPointCloud:()=>IS,TimeInterval:()=>An,TimeIntervalCollection:()=>Pr,TimeIntervalCollectionPositionProperty:()=>o_,TimeIntervalCollectionProperty:()=>r_,TimeStandard:()=>qn,Timeline:()=>W2,TimelineHighlightRange:()=>H2,TimelineTrack:()=>G2,Tipsify:()=>LI,ToggleButtonViewModel:()=>Qy,Tonemapper:()=>Yy,Transforms:()=>Ot,TranslationRotationScale:()=>rg,TranslucentTileClassification:()=>bN,TridiagonalSystemSolver:()=>zT,TrustedServers:()=>YC,TweenCollection:()=>aC,UniformState:()=>Hw,UniformType:()=>OS,UrlTemplateImageryProvider:()=>ya,VERSION:()=>Nyt,VRButton:()=>Y2,VRButtonViewModel:()=>j2,VRTheWorldTerrainProvider:()=>nY,VaryingType:()=>UX,Vector3DTileBatch:()=>vh,Vector3DTileClampedPolylines:()=>dR,Vector3DTileContent:()=>mR,Vector3DTileGeometry:()=>lp,Vector3DTilePoints:()=>rR,Vector3DTilePolygons:()=>sR,Vector3DTilePolylines:()=>LA,Vector3DTilePrimitive:()=>aA,VelocityOrientationProperty:()=>uB,VelocityVectorProperty:()=>lx,VertexArray:()=>oi,VertexArrayFacade:()=>Wm,VertexAttributeSemantic:()=>Ct,VertexFormat:()=>Ie,VerticalOrigin:()=>On,VideoSynchronizer:()=>iY,View:()=>eC,Viewer:()=>iK,ViewportQuad:()=>wX,Visibility:()=>ur,Visualizer:()=>Q7,VoxelBoxShape:()=>Cm,VoxelContent:()=>gF,VoxelCylinderShape:()=>Tm,VoxelEllipsoidShape:()=>dC,VoxelInspector:()=>X2,VoxelInspectorViewModel:()=>q2,VoxelPrimitive:()=>BS,VoxelProvider:()=>OX,VoxelRenderResources:()=>KF,VoxelShape:()=>RX,VoxelShapeType:()=>zi,VoxelTraversal:()=>PS,VulkanConstants:()=>oY,WallGeometry:()=>VB,WallGeometryLibrary:()=>xx,WallGeometryUpdater:()=>zB,WallGraphics:()=>tp,WallOutlineGeometry:()=>kB,WebGLConstants:()=>ee,WebMapServiceImageryProvider:()=>RL,WebMapTileServiceImageryProvider:()=>ML,WebMercatorProjection:()=>Si,WebMercatorTilingScheme:()=>Gr,WindingOrder:()=>Zr,WireframeIndexGenerator:()=>ZT,WireframePipelineStage:()=>bO,_shadersAcesTonemappingStage:()=>vN,_shadersAdditiveBlend:()=>tF,_shadersAdjustTranslucentFS:()=>wb,_shadersAllMaterialAppearanceFS:()=>$w,_shadersAllMaterialAppearanceVS:()=>eI,_shadersAmbientOcclusionGenerate:()=>wN,_shadersAmbientOcclusionModulate:()=>IN,_shadersAspectRampMaterial:()=>rI,_shadersAtmosphereCommon:()=>p_,_shadersBasicMaterialAppearanceFS:()=>tI,_shadersBasicMaterialAppearanceVS:()=>nI,_shadersBillboardCollectionFS:()=>WO,_shadersBillboardCollectionVS:()=>jO,_shadersBlackAndWhite:()=>PN,_shadersBloomComposite:()=>ON,_shadersBrdfLutGeneratorFS:()=>OM,_shadersBrightPass:()=>nF,_shadersBrightness:()=>RN,_shadersBumpMapMaterial:()=>sI,_shadersCPUStylingStageFS:()=>q1,_shadersCPUStylingStageVS:()=>Y1,_shadersCheckerboardMaterial:()=>aI,_shadersCloudCollectionFS:()=>RM,_shadersCloudCollectionVS:()=>BM,_shadersCloudNoiseFS:()=>MM,_shadersCloudNoiseVS:()=>LM,_shadersCompareAndPackTranslucentDepth:()=>NM,_shadersCompositeOITFS:()=>FM,_shadersCompositeTranslucentClassification:()=>$x,_shadersContrastBias:()=>BN,_shadersCustomShaderStageFS:()=>Z1,_shadersCustomShaderStageVS:()=>K1,_shadersCzmBuiltins:()=>C0,_shadersDepthOfField:()=>MN,_shadersDepthPlaneFS:()=>VM,_shadersDepthPlaneVS:()=>UM,_shadersDepthView:()=>LN,_shadersDepthViewPacked:()=>FX,_shadersDotMaterial:()=>cI,_shadersEdgeDetection:()=>NN,_shadersElevationBandMaterial:()=>lI,_shadersElevationContourMaterial:()=>uI,_shadersElevationRampMaterial:()=>fI,_shadersEllipsoidFS:()=>Ib,_shadersEllipsoidSurfaceAppearanceFS:()=>CF,_shadersEllipsoidSurfaceAppearanceVS:()=>TF,_shadersEllipsoidVS:()=>Pb,_shadersFXAA:()=>VN,_shadersFXAA3_11:()=>kM,_shadersFadeMaterial:()=>dI,_shadersFeatureIdStageFS:()=>J1,_shadersFeatureIdStageVS:()=>Q1,_shadersFilmicTonemapping:()=>FN,_shadersGaussianBlur1D:()=>jy,_shadersGeometryStageFS:()=>oO,_shadersGeometryStageVS:()=>rO,_shadersGlobeFS:()=>zM,_shadersGlobeVS:()=>HM,_shadersGridMaterial:()=>hI,_shadersGroundAtmosphere:()=>Ob,_shadersHSBToRGB:()=>sv,_shadersHSLToRGB:()=>av,_shadersImageBasedLightingStageFS:()=>v1,_shadersInstancingStageCommon:()=>L1,_shadersInstancingStageVS:()=>N1,_shadersIntersectBox:()=>zF,_shadersIntersectClippingPlanes:()=>kF,_shadersIntersectCylinder:()=>HF,_shadersIntersectDepth:()=>UF,_shadersIntersectEllipsoid:()=>GF,_shadersIntersection:()=>xC,_shadersIntersectionUtils:()=>VF,_shadersLegacyInstancingStageVS:()=>F1,_shadersLensFlare:()=>UN,_shadersLightingStageFS:()=>cO,_shadersMaterialStageFS:()=>uO,_shadersMegatexture:()=>XF,_shadersMetadataStageFS:()=>$1,_shadersMetadataStageVS:()=>eO,_shadersModelClippingPlanesStageFS:()=>R1,_shadersModelColorStageFS:()=>O1,_shadersModelFS:()=>x1,_shadersModelSilhouetteStageFS:()=>IO,_shadersModelSilhouetteStageVS:()=>PO,_shadersModelSplitterStageFS:()=>RO,_shadersModelVS:()=>C1,_shadersModifiedReinhardTonemapping:()=>kN,_shadersMorphTargetsStageVS:()=>dO,_shadersNightVision:()=>zN,_shadersNormalMapMaterial:()=>mI,_shadersOctahedralProjectionAtlasFS:()=>mP,_shadersOctahedralProjectionFS:()=>pP,_shadersOctahedralProjectionVS:()=>_P,_shadersOctree:()=>qF,_shadersPassThrough:()=>Il,_shadersPassThroughDepth:()=>Hy,_shadersPerInstanceColorAppearanceFS:()=>bI,_shadersPerInstanceColorAppearanceVS:()=>SI,_shadersPerInstanceFlatColorAppearanceFS:()=>w0,_shadersPerInstanceFlatColorAppearanceVS:()=>DI,_shadersPointCloudEyeDomeLighting:()=>n1,_shadersPointCloudStylingStageVS:()=>pO,_shadersPointPrimitiveCollectionFS:()=>ny,_shadersPointPrimitiveCollectionVS:()=>JR,_shadersPolylineArrowMaterial:()=>pI,_shadersPolylineColorAppearanceVS:()=>qI,_shadersPolylineCommon:()=>Wl,_shadersPolylineDashMaterial:()=>_I,_shadersPolylineFS:()=>H0,_shadersPolylineGlowMaterial:()=>gI,_shadersPolylineMaterialAppearanceVS:()=>XI,_shadersPolylineOutlineMaterial:()=>yI,_shadersPolylineShadowVolumeFS:()=>GI,_shadersPolylineShadowVolumeMorphFS:()=>WI,_shadersPolylineShadowVolumeMorphVS:()=>jI,_shadersPolylineShadowVolumeVS:()=>YI,_shadersPolylineVS:()=>$O,_shadersPrimitiveOutlineStageFS:()=>yO,_shadersPrimitiveOutlineStageVS:()=>gO,_shadersRGBToHSB:()=>cv,_shadersRGBToHSL:()=>lv,_shadersRGBToXYZ:()=>uv,_shadersReinhardTonemapping:()=>HN,_shadersReprojectWebMercatorFS:()=>GM,_shadersReprojectWebMercatorVS:()=>WM,_shadersRimLightingMaterial:()=>AI,_shadersSelectedFeatureIdStageCommon:()=>KT,_shadersShadowVolumeAppearanceFS:()=>lT,_shadersShadowVolumeAppearanceVS:()=>OI,_shadersShadowVolumeFS:()=>eg,_shadersSilhouette:()=>GN,_shadersSkinningStageVS:()=>TO,_shadersSkyAtmosphereCommon:()=>Rb,_shadersSkyAtmosphereFS:()=>jM,_shadersSkyAtmosphereVS:()=>YM,_shadersSkyBoxFS:()=>qM,_shadersSkyBoxVS:()=>XM,_shadersSlopeRampMaterial:()=>xI,_shadersStripeMaterial:()=>CI,_shadersSunFS:()=>KM,_shadersSunTextureFS:()=>ZM,_shadersSunVS:()=>JM,_shadersTexturedMaterialAppearanceFS:()=>iI,_shadersTexturedMaterialAppearanceVS:()=>oI,_shadersVector3DTileClampedPolylinesFS:()=>uR,_shadersVector3DTileClampedPolylinesVS:()=>lR,_shadersVector3DTilePolylinesVS:()=>aR,_shadersVectorTileVS:()=>AT,_shadersViewportQuadFS:()=>QM,_shadersViewportQuadVS:()=>l0,_shadersVoxelFS:()=>NF,_shadersVoxelVS:()=>FF,_shadersWater:()=>TI,_shadersXYZToRGB:()=>fv,_shadersacesTonemapping:()=>dv,_shadersalphaWeight:()=>hv,_shadersantialias:()=>mv,_shadersapproximateSphericalCoordinates:()=>pv,_shadersbackFacing:()=>_v,_shadersbranchFreeTernary:()=>gv,_shaderscascadeColor:()=>yv,_shaderscascadeDistance:()=>Av,_shaderscascadeMatrix:()=>xv,_shaderscascadeWeights:()=>Cv,_shaderscolumbusViewMorph:()=>Tv,_shaderscomputePosition:()=>Ev,_shadersconvertUvToBox:()=>WF,_shadersconvertUvToCylinder:()=>jF,_shadersconvertUvToEllipsoid:()=>YF,_shaderscosineAndSine:()=>bv,_shadersdecompressTextureCoordinates:()=>Sv,_shadersdefaultPbrMaterial:()=>Dv,_shadersdegreesPerRadian:()=>hD,_shadersdepthClamp:()=>vv,_shadersdepthRange:()=>mD,_shadersdepthRangeStruct:()=>JD,_shaderseastNorthUpToEyeCoordinates:()=>wv,_shadersellipsoidContainsPoint:()=>Iv,_shadersellipsoidWgs84TextureCoordinates:()=>Pv,_shadersepsilon1:()=>pD,_shadersepsilon2:()=>_D,_shadersepsilon3:()=>gD,_shadersepsilon4:()=>yD,_shadersepsilon5:()=>AD,_shadersepsilon6:()=>xD,_shadersepsilon7:()=>CD,_shadersequalsEpsilon:()=>Ov,_shaderseyeOffset:()=>Rv,_shaderseyeToWindowCoordinates:()=>Bv,_shadersfastApproximateAtan:()=>Mv,_shadersfog:()=>Lv,_shadersgammaCorrect:()=>Nv,_shadersgeodeticSurfaceNormal:()=>Fv,_shadersgetDefaultMaterial:()=>Vv,_shadersgetLambertDiffuse:()=>Uv,_shadersgetSpecular:()=>kv,_shadersgetWaterNoise:()=>zv,_shadershue:()=>Hv,_shadersinfinity:()=>TD,_shadersinverseGamma:()=>Gv,_shadersisEmpty:()=>Wv,_shadersisFull:()=>jv,_shaderslatitudeToWebMercatorFraction:()=>Yv,_shaderslineDistance:()=>qv,_shaderslinearToSrgb:()=>Xv,_shadersluminance:()=>Kv,_shadersmaterial:()=>QD,_shadersmaterialInput:()=>$D,_shadersmetersPerPixel:()=>Zv,_shadersmodelMaterial:()=>ev,_shadersmodelToWindowCoordinates:()=>Jv,_shadersmodelVertexOutput:()=>tv,_shadersmultiplyWithColorBalance:()=>Qv,_shadersnearFarScalar:()=>$v,_shadersoctDecode:()=>ew,_shadersoneOverPi:()=>ED,_shadersoneOverTwoPi:()=>bD,_shaderspackDepth:()=>tw,_shaderspassCesium3DTile:()=>SD,_shaderspassCesium3DTileClassification:()=>DD,_shaderspassCesium3DTileClassificationIgnoreShow:()=>vD,_shaderspassClassification:()=>wD,_shaderspassCompute:()=>ID,_shaderspassEnvironment:()=>PD,_shaderspassGlobe:()=>OD,_shaderspassOpaque:()=>RD,_shaderspassOverlay:()=>BD,_shaderspassTerrainClassification:()=>MD,_shaderspassTranslucent:()=>LD,_shaderspassVoxels:()=>ND,_shaderspbrLighting:()=>nw,_shaderspbrMetallicRoughnessMaterial:()=>iw,_shaderspbrParameters:()=>nv,_shaderspbrSpecularGlossinessMaterial:()=>ow,_shadersphong:()=>rw,_shaderspi:()=>FD,_shaderspiOverFour:()=>VD,_shaderspiOverSix:()=>UD,_shaderspiOverThree:()=>kD,_shaderspiOverTwo:()=>zD,_shadersplaneDistance:()=>sw,_shaderspointAlongRay:()=>aw,_shadersradiansPerDegree:()=>HD,_shadersray:()=>iv,_shadersrayEllipsoidIntersectionInterval:()=>cw,_shadersraySegment:()=>ov,_shadersraySphereIntersectionInterval:()=>lw,_shadersreadDepth:()=>uw,_shadersreadNonPerspective:()=>fw,_shadersreverseLogDepth:()=>dw,_shadersround:()=>hw,_shaderssampleOctahedralProjection:()=>mw,_shaderssaturation:()=>pw,_shaderssceneMode2D:()=>GD,_shaderssceneMode3D:()=>WD,_shaderssceneModeColumbusView:()=>jD,_shaderssceneModeMorphing:()=>YD,_shadersshadowDepthCompare:()=>_w,_shadersshadowParameters:()=>rv,_shadersshadowVisibility:()=>gw,_shaderssignNotZero:()=>yw,_shaderssolarRadius:()=>qD,_shaderssphericalHarmonics:()=>Aw,_shaderssrgbToLinear:()=>xw,_shaderstangentToEyeSpaceMatrix:()=>Cw,_shaderstextureCube:()=>Tw,_shadersthreePiOver2:()=>XD,_shaderstransformPlane:()=>Ew,_shaderstranslateRelativeToEye:()=>bw,_shaderstranslucentPhong:()=>Sw,_shaderstranspose:()=>Dw,_shaderstwoPi:()=>KD,_shadersunpackDepth:()=>vw,_shadersunpackFloat:()=>ww,_shadersunpackUint:()=>Iw,_shadersvalueTransform:()=>Pw,_shadersvertexLogDepth:()=>Ow,_shaderswebMercatorMaxLatitude:()=>ZD,_shaderswindowToEyeCoordinates:()=>Rw,_shaderswriteDepthClamp:()=>Bw,_shaderswriteLogDepth:()=>Mw,_shaderswriteNonPerspective:()=>Lw,addBuffer:()=>MP,addDefaults:()=>DP,addExtensionsRequired:()=>OP,addExtensionsUsed:()=>Yu,addPipelineExtras:()=>yg,addToArray:()=>rs,appendForwardSlash:()=>QS,arrayRemoveDuplicates:()=>go,barycentricCoordinates:()=>R0,binarySearch:()=>wo,buildDrawCommand:()=>S1,buildModuleUrl:()=>$t,buildVoxelDrawCommands:()=>JF,cancelAnimationFrame:()=>rY,clone:()=>Ge,combine:()=>_t,computeFlyToLocationForRectangle:()=>bC,createBillboardPointCallback:()=>OA,createCommand:()=>Cn,createDefaultImageryProviderViewModels:()=>m2,createDefaultTerrainProviderViewModels:()=>p2,createElevationBandMaterial:()=>MX,createGuid:()=>zn,createMaterialPropertyDescriptor:()=>Io,createOsmBuildings:()=>LX,createPropertyDescriptor:()=>ae,createRawPropertyDescriptor:()=>al,createTangentSpaceDebugPrimitive:()=>NX,createTaskProcessorWorker:()=>kX,createUniform:()=>jS,createUniformArray:()=>YS,createWorldImagery:()=>D_,createWorldTerrain:()=>gL,decodeGoogleEarthEnterpriseData:()=>yL,decodeVectorPolylinePositions:()=>hR,defaultValue:()=>y,defer:()=>Jr,defined:()=>u,demodernizeShader:()=>Nw,deprecationWarning:()=>nr,destroyObject:()=>le,exportKml:()=>ij,findAccessorMinMax:()=>mA,findContentMetadata:()=>UA,findGroupMetadata:()=>kA,findTileMetadata:()=>bR,forEachTextureInMaterial:()=>wT,formatError:()=>cm,freezeRenderState:()=>rG,getAbsoluteUri:()=>Fm,getAccessorByteStride:()=>dl,getBaseUri:()=>$S,getBinaryAccessor:()=>ql,getClipAndStyleCode:()=>IF,getClippingFunction:()=>v_,getComponentReader:()=>gp,getElement:()=>In,getExtensionFromUri:()=>f0,getFilenameFromUri:()=>e_,getImageFromTypedArray:()=>AL,getImagePixels:()=>Wf,getJsonFromTypedArray:()=>Oo,getMagic:()=>od,getStringFromTypedArray:()=>ll,getTimestamp:()=>di,hasExtension:()=>ai,heightReferenceOnEntityPropertyChanged:()=>np,isBitSet:()=>sc,isBlobUri:()=>d0,isCrossOriginUrl:()=>h0,isDataUri:()=>Vm,isLeapYear:()=>Nm,knockout:()=>Ce,knockout_3_5_1:()=>SC,knockout_es5:()=>i2,loadAndExecuteScript:()=>m0,loadCubeMap:()=>Xw,loadImageFromTypedArray:()=>fA,loadKTX2:()=>tl,mergeSort:()=>C_,moveTechniqueRenderStates:()=>PP,moveTechniquesToExtension:()=>RP,numberOfComponentsForType:()=>Kl,objectToQuery:()=>p0,oneTimeWarning:()=>wt,parseBatchTable:()=>Sp,parseBoundingVolumeSemantics:()=>jP,parseFeatureMetadataLegacy:()=>$P,parseGlb:()=>wP,parseResponseHeaders:()=>eD,parseStructuralMetadata:()=>QP,pointInsideTriangle:()=>uY,preprocess3DTileContent:()=>Hh,processVoxelProperties:()=>ZF,queryToObject:()=>Nl,readAccessorPacked:()=>LP,removeExtension:()=>pA,removeExtensionsRequired:()=>vP,removeExtensionsUsed:()=>hA,removePipelineExtras:()=>IP,removeUnusedElements:()=>BP,requestAnimationFrame:()=>fY,resizeImageToNextPowerOfTwo:()=>Cg,sampleTerrain:()=>jB,sampleTerrainMostDetailed:()=>u_,scaleToGeodeticSurface:()=>c0,subdivideArray:()=>RI,subscribeAndEvaluate:()=>ta,updateAccessorComponentTypes:()=>NP,updateVersion:()=>FP,usesExtension:()=>_r,viewerCesium3DTilesInspectorMixin:()=>oK,viewerCesiumInspectorMixin:()=>rK,viewerDragDropMixin:()=>aK,viewerPerformanceWatchdogMixin:()=>cK,viewerVoxelInspectorMixin:()=>lK,webGLConstantToGlslType:()=>dY,wrapFunction:()=>xL,writeTextToCanvas:()=>BA});function ixe(e){return e!=null}var u=ixe;function s0(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}u(Object.create)&&(s0.prototype=Object.create(Error.prototype),s0.prototype.constructor=s0);s0.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return u(this.stack)&&(e+=`
${this.stack.toString()}`),e};s0.throwInstantiationError=function(){throw new s0("This function defines an interface and should not be called directly.")};var de=s0;var is={};is.typeOf={};function oxe(e){return`${e} is required, actual value was undefined`}function LC(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}is.defined=function(e,t){if(!u(t))throw new de(oxe(e))};is.typeOf.func=function(e,t){if(typeof t!="function")throw new de(LC(typeof t,"function",e))};is.typeOf.string=function(e,t){if(typeof t!="string")throw new de(LC(typeof t,"string",e))};is.typeOf.number=function(e,t){if(typeof t!="number")throw new de(LC(typeof t,"number",e))};is.typeOf.number.lessThan=function(e,t,n){if(is.typeOf.number(e,t),t>=n)throw new de(`Expected ${e} to be less than ${n}, actual value was ${t}`)};is.typeOf.number.lessThanOrEquals=function(e,t,n){if(is.typeOf.number(e,t),t>n)throw new de(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};is.typeOf.number.greaterThan=function(e,t,n){if(is.typeOf.number(e,t),t<=n)throw new de(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};is.typeOf.number.greaterThanOrEquals=function(e,t,n){if(is.typeOf.number(e,t),t<n)throw new de(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};is.typeOf.object=function(e,t){if(typeof t!="object")throw new de(LC(typeof t,"object",e))};is.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new de(LC(typeof t,"boolean",e))};is.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new de(LC(typeof t,"bigint",e))};is.typeOf.number.equals=function(e,t,n,i){if(is.typeOf.number(e,n),is.typeOf.number(t,i),n!==i)throw new de(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};var Qc=is;function IK(e,t){return e??t}IK.EMPTY_OBJECT=Object.freeze({});var y=IK;var zH=vo(i3(),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=y(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=y(t,255),Math.round((st.clamp(e,-1,1)*.5+.5)*t)};st.fromSNorm=function(e,t){return t=y(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=y(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});st.cosh=y(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){return e*st.RADIANS_PER_DEGREE};st.toDegrees=function(e){return e*st.DEGREES_PER_RADIAN};st.convertLongitudeRange=function(e){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){return st.clamp(e,-1*st.PI_OVER_TWO,st.PI_OVER_TWO)};st.negativePiToPi=function(e){return e>=-st.PI&&e<=st.PI?e:st.zeroToTwoPi(e+st.PI)-st.PI};st.zeroToTwoPi=function(e){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){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){n=y(n,0),i=y(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){return e-t<-n};st.lessThanOrEquals=function(e,t,n){return e-t<n};st.greaterThan=function(e,t,n){return e-t>n};st.greaterThanOrEquals=function(e,t,n){return e-t>-n};var o3=[1];st.factorial=function(e){let t=o3.length;if(e>=t){let n=o3[t-1];for(let i=t;i<=e;i++){let o=n*i;o3.push(o),n=o}}return o3[e]};st.incrementWrap=function(e,t,n){return n=y(n,0),++e,e>t&&(e=n),e};st.isPowerOfTwo=function(e){return e!==0&&(e&e-1)===0};st.nextPowerOfTwo=function(e){return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};st.previousPowerOfTwo=function(e){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 e<t?t:e>n?n:e};var OK=new zH.default;st.setRandomNumberSeed=function(e){OK=new zH.default(e)};st.nextRandomNumber=function(){return OK.random()};st.randomBetween=function(e,t){return st.nextRandomNumber()*(t-e)+e};st.acosClamped=function(e){return Math.acos(st.clamp(e,-1,1))};st.asinClamped=function(e){return Math.asin(st.clamp(e,-1,1))};st.chordLength=function(e,t){return 2*t*Math.sin(e*.5)};st.logBase=function(e,t){return Math.log(e)/Math.log(t)};st.cbrt=y(Math.cbrt,function(t){let n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});st.log2=y(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 e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};st.fastApproximateAtan2=function(e,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;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 P=st;function $e(e,t,n){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0)}$e.fromSpherical=function(e,t){u(t)||(t=new $e);let n=e.clock,i=e.cone,o=y(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};$e.fromElements=function(e,t,n,i){return u(i)?(i.x=e,i.y=t,i.z=n,i):new $e(e,t,n)};$e.clone=function(e,t){if(u(e))return u(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new $e(e.x,e.y,e.z)};$e.fromCartesian4=$e.clone;$e.packedLength=3;$e.pack=function(e,t,n){return n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};$e.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new $e),n.x=e[t++],n.y=e[t++],n.z=e[t],n};$e.packArray=function(e,t){let n=e.length,i=n*3;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)$e.pack(e[o],t,o*3);return t};$e.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){let o=i/3;t[o]=$e.unpack(e,i,t[o])}return t};$e.fromArray=$e.unpack;$e.maximumComponent=function(e){return Math.max(e.x,e.y,e.z)};$e.minimumComponent=function(e){return Math.min(e.x,e.y,e.z)};$e.minimumByComponent=function(e,t,n){return 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};$e.maximumByComponent=function(e,t,n){return 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};$e.clamp=function(e,t,n,i){let o=P.clamp(e.x,t.x,n.x),r=P.clamp(e.y,t.y,n.y),s=P.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};$e.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z};$e.magnitude=function(e){return Math.sqrt($e.magnitudeSquared(e))};var s3=new $e;$e.distance=function(e,t){return $e.subtract(e,t,s3),$e.magnitude(s3)};$e.distanceSquared=function(e,t){return $e.subtract(e,t,s3),$e.magnitudeSquared(s3)};$e.normalize=function(e,t){let n=$e.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t};$e.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z};$e.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};$e.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};$e.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};$e.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};$e.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};$e.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};$e.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t};$e.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};var RK=new $e;$e.lerp=function(e,t,n,i){return $e.multiplyByScalar(t,n,RK),i=$e.multiplyByScalar(e,1-n,i),$e.add(RK,i,i)};var r3=new $e,HH=new $e;$e.angleBetween=function(e,t){$e.normalize(e,r3),$e.normalize(t,HH);let n=$e.dot(r3,HH),i=$e.magnitude($e.cross(r3,HH,r3));return Math.atan2(i,n)};var rxe=new $e;$e.mostOrthogonalAxis=function(e,t){let n=$e.normalize(e,rxe);return $e.abs(n,n),n.x<=n.y?n.x<=n.z?t=$e.clone($e.UNIT_X,t):t=$e.clone($e.UNIT_Z,t):n.y<=n.z?t=$e.clone($e.UNIT_Y,t):t=$e.clone($e.UNIT_Z,t),t};$e.projectVector=function(e,t,n){let i=$e.dot(e,t)/$e.dot(t,t);return $e.multiplyByScalar(t,i,n)};$e.equals=function(e,t){return e===t||u(e)&&u(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};$e.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};$e.equalsEpsilon=function(e,t,n,i){return e===t||u(e)&&u(t)&&P.equalsEpsilon(e.x,t.x,n,i)&&P.equalsEpsilon(e.y,t.y,n,i)&&P.equalsEpsilon(e.z,t.z,n,i)};$e.cross=function(e,t,n){let i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,c=t.z,l=o*c-r*a,f=r*s-i*c,d=i*a-o*s;return n.x=l,n.y=f,n.z=d,n};$e.midpoint=function(e,t,n){return n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n};$e.fromDegrees=function(e,t,n,i,o){return e=P.toRadians(e),t=P.toRadians(t),$e.fromRadians(e,t,n,i,o)};var Bu=new $e,NC=new $e,sxe=new $e(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);$e.fromRadians=function(e,t,n,i,o){n=y(n,0);let r=u(i)?i.radiiSquared:sxe,s=Math.cos(t);Bu.x=s*Math.cos(e),Bu.y=s*Math.sin(e),Bu.z=Math.sin(t),Bu=$e.normalize(Bu,Bu),$e.multiplyComponents(r,Bu,NC);let a=Math.sqrt($e.dot(Bu,NC));return NC=$e.divideByScalar(NC,a,NC),Bu=$e.multiplyByScalar(Bu,n,Bu),u(o)||(o=new $e),$e.add(NC,Bu,o)};$e.fromDegreesArray=function(e,t,n){let i=e.length;u(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]=$e.fromDegrees(r,s,0,t,n[a])}return n};$e.fromRadiansArray=function(e,t,n){let i=e.length;u(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]=$e.fromRadians(r,s,0,t,n[a])}return n};$e.fromDegreesArrayHeights=function(e,t,n){let i=e.length;u(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],c=o/3;n[c]=$e.fromDegrees(r,s,a,t,n[c])}return n};$e.fromRadiansArrayHeights=function(e,t,n){let i=e.length;u(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],c=o/3;n[c]=$e.fromRadians(r,s,a,t,n[c])}return n};$e.ZERO=Object.freeze(new $e(0,0,0));$e.ONE=Object.freeze(new $e(1,1,1));$e.UNIT_X=Object.freeze(new $e(1,0,0));$e.UNIT_Y=Object.freeze(new $e(0,1,0));$e.UNIT_Z=Object.freeze(new $e(0,0,1));$e.prototype.clone=function(e){return $e.clone(this,e)};$e.prototype.equals=function(e){return $e.equals(this,e)};$e.prototype.equalsEpsilon=function(e,t,n){return $e.equalsEpsilon(this,e,t,n)};$e.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};var h=$e;function pt(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}pt.fromElements=function(e,t,n,i,o){return u(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new pt(e,t,n,i)};pt.fromColor=function(e,t){return u(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new pt(e.red,e.green,e.blue,e.alpha)};pt.clone=function(e,t){if(u(e))return u(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new pt(e.x,e.y,e.z,e.w)};pt.packedLength=4;pt.pack=function(e,t,n){return n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};pt.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new pt),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};pt.packArray=function(e,t){let n=e.length,i=n*4;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)pt.pack(e[o],t,o*4);return t};pt.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){let o=i/4;t[o]=pt.unpack(e,i,t[o])}return t};pt.fromArray=pt.unpack;pt.maximumComponent=function(e){return Math.max(e.x,e.y,e.z,e.w)};pt.minimumComponent=function(e){return Math.min(e.x,e.y,e.z,e.w)};pt.minimumByComponent=function(e,t,n){return 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};pt.maximumByComponent=function(e,t,n){return 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};pt.clamp=function(e,t,n,i){let o=P.clamp(e.x,t.x,n.x),r=P.clamp(e.y,t.y,n.y),s=P.clamp(e.z,t.z,n.z),a=P.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};pt.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};pt.magnitude=function(e){return Math.sqrt(pt.magnitudeSquared(e))};var a3=new pt;pt.distance=function(e,t){return pt.subtract(e,t,a3),pt.magnitude(a3)};pt.distanceSquared=function(e,t){return pt.subtract(e,t,a3),pt.magnitudeSquared(a3)};pt.normalize=function(e,t){let n=pt.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,t};pt.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};pt.multiplyComponents=function(e,t,n){return 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};pt.divideComponents=function(e,t,n){return 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};pt.add=function(e,t,n){return 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};pt.subtract=function(e,t,n){return 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};pt.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};pt.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};pt.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};pt.abs=function(e,t){return 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 BK=new pt;pt.lerp=function(e,t,n,i){return pt.multiplyByScalar(t,n,BK),i=pt.multiplyByScalar(e,1-n,i),pt.add(BK,i,i)};var axe=new pt;pt.mostOrthogonalAxis=function(e,t){let n=pt.normalize(e,axe);return pt.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=pt.clone(pt.UNIT_X,t):t=pt.clone(pt.UNIT_W,t):n.z<=n.w?t=pt.clone(pt.UNIT_Z,t):t=pt.clone(pt.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=pt.clone(pt.UNIT_Y,t):t=pt.clone(pt.UNIT_W,t):n.z<=n.w?t=pt.clone(pt.UNIT_Z,t):t=pt.clone(pt.UNIT_W,t),t};pt.equals=function(e,t){return e===t||u(e)&&u(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};pt.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]};pt.equalsEpsilon=function(e,t,n,i){return e===t||u(e)&&u(t)&&P.equalsEpsilon(e.x,t.x,n,i)&&P.equalsEpsilon(e.y,t.y,n,i)&&P.equalsEpsilon(e.z,t.z,n,i)&&P.equalsEpsilon(e.w,t.w,n,i)};pt.ZERO=Object.freeze(new pt(0,0,0,0));pt.ONE=Object.freeze(new pt(1,1,1,1));pt.UNIT_X=Object.freeze(new pt(1,0,0,0));pt.UNIT_Y=Object.freeze(new pt(0,1,0,0));pt.UNIT_Z=Object.freeze(new pt(0,0,1,0));pt.UNIT_W=Object.freeze(new pt(0,0,0,1));pt.prototype.clone=function(e){return pt.clone(this,e)};pt.prototype.equals=function(e){return pt.equals(this,e)};pt.prototype.equalsEpsilon=function(e,t,n){return pt.equalsEpsilon(this,e,t,n)};pt.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};var GH=new Float32Array(1),va=new Uint8Array(GH.buffer),cxe=new Uint32Array([287454020]),lxe=new Uint8Array(cxe.buffer),MK=lxe[0]===68;pt.packFloat=function(e,t){return u(t)||(t=new pt),GH[0]=e,MK?(t.x=va[0],t.y=va[1],t.z=va[2],t.w=va[3]):(t.x=va[3],t.y=va[2],t.z=va[1],t.w=va[0]),t};pt.unpackFloat=function(e){return MK?(va[0]=e.x,va[1]=e.y,va[2]=e.z,va[3]=e.w):(va[0]=e.w,va[1]=e.z,va[2]=e.y,va[3]=e.x),GH[0]};var oe=pt;function et(e,t,n,i,o,r,s,a,c){this[0]=y(e,0),this[1]=y(i,0),this[2]=y(s,0),this[3]=y(t,0),this[4]=y(o,0),this[5]=y(a,0),this[6]=y(n,0),this[7]=y(r,0),this[8]=y(c,0)}et.packedLength=9;et.pack=function(e,t,n){return n=y(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};et.unpack=function(e,t,n){return t=y(t,0),u(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};et.packArray=function(e,t){let n=e.length,i=n*9;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)et.pack(e[o],t,o*9);return t};et.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){let o=i/9;t[o]=et.unpack(e,i,t[o])}return t};et.clone=function(e,t){if(u(e))return u(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 et(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])};et.fromArray=et.unpack;et.fromColumnMajorArray=function(e,t){return et.clone(e,t)};et.fromRowMajorArray=function(e,t){return u(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 et(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};et.fromQuaternion=function(e,t){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,c=e.y*e.w,l=e.z*e.z,f=e.z*e.w,d=e.w*e.w,p=n-s-l+d,g=2*(i-f),m=2*(o+c),A=2*(i+f),x=-n+s-l+d,C=2*(a-r),T=2*(o-c),E=2*(a+r),S=-n-s+l+d;return u(t)?(t[0]=p,t[1]=A,t[2]=T,t[3]=g,t[4]=x,t[5]=E,t[6]=m,t[7]=C,t[8]=S,t):new et(p,g,m,A,x,C,T,E,S)};et.fromHeadingPitchRoll=function(e,t){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),c=n*i,l=-o*s+a*r*i,f=a*s+o*r*i,d=n*s,p=o*i+a*r*s,g=-a*i+o*r*s,m=-r,A=a*n,x=o*n;return u(t)?(t[0]=c,t[1]=d,t[2]=m,t[3]=l,t[4]=p,t[5]=A,t[6]=f,t[7]=g,t[8]=x,t):new et(c,l,f,d,p,g,m,A,x)};et.fromScale=function(e,t){return u(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 et(e.x,0,0,0,e.y,0,0,0,e.z)};et.fromUniformScale=function(e,t){return u(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 et(e,0,0,0,e,0,0,0,e)};et.fromCrossProduct=function(e,t){return u(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 et(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)};et.fromRotationX=function(e,t){let n=Math.cos(e),i=Math.sin(e);return u(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 et(1,0,0,0,n,-i,0,i,n)};et.fromRotationY=function(e,t){let n=Math.cos(e),i=Math.sin(e);return u(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 et(n,0,i,0,1,0,-i,0,n)};et.fromRotationZ=function(e,t){let n=Math.cos(e),i=Math.sin(e);return u(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 et(n,-i,0,i,n,0,0,0,1)};et.toArray=function(e,t){return u(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]]};et.getElementIndex=function(e,t){return e*3+t};et.getColumn=function(e,t,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};et.setColumn=function(e,t,n,i){i=et.clone(e,i);let o=t*3;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i};et.getRow=function(e,t,n){let i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n};et.setRow=function(e,t,n,i){return i=et.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};var uxe=new h;et.setScale=function(e,t,n){let i=et.getScale(e,uxe),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 fxe=new h;et.setUniformScale=function(e,t,n){let i=et.getScale(e,fxe),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 WH=new h;et.getScale=function(e,t){return t.x=h.magnitude(h.fromElements(e[0],e[1],e[2],WH)),t.y=h.magnitude(h.fromElements(e[3],e[4],e[5],WH)),t.z=h.magnitude(h.fromElements(e[6],e[7],e[8],WH)),t};var LK=new h;et.getMaximumScale=function(e){return et.getScale(e,LK),h.maximumComponent(LK)};var dxe=new h;et.setRotation=function(e,t,n){let i=et.getScale(e,dxe);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 hxe=new h;et.getRotation=function(e,t){let n=et.getScale(e,hxe);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};et.multiply=function(e,t,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],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],l=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],d=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]=c,n[6]=l,n[7]=f,n[8]=d,n};et.add=function(e,t,n){return 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};et.subtract=function(e,t,n){return 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};et.multiplyByVector=function(e,t,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,c=e[2]*i+e[5]*o+e[8]*r;return n.x=s,n.y=a,n.z=c,n};et.multiplyByScalar=function(e,t,n){return 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};et.multiplyByScale=function(e,t,n){return 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};et.multiplyByUniformScale=function(e,t,n){return 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};et.negate=function(e,t){return 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};et.transpose=function(e,t){let n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],c=e[2],l=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]=c,t[7]=l,t[8]=f,t};function mxe(e){let t=0;for(let n=0;n<9;++n){let i=e[n];t+=i*i}return Math.sqrt(t)}var jH=[1,0,0],YH=[2,2,1];function pxe(e){let t=0;for(let n=0;n<3;++n){let i=e[et.getElementIndex(YH[n],jH[n])];t+=2*i*i}return Math.sqrt(t)}function _xe(e,t){let n=P.EPSILON15,i=0,o=1;for(let l=0;l<3;++l){let f=Math.abs(e[et.getElementIndex(YH[l],jH[l])]);f>i&&(o=l,i=f)}let r=1,s=0,a=jH[o],c=YH[o];if(Math.abs(e[et.getElementIndex(c,a)])>n){let l=e[et.getElementIndex(c,c)],f=e[et.getElementIndex(a,a)],d=e[et.getElementIndex(c,a)],p=(l-f)/2/d,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=et.clone(et.IDENTITY,t),t[et.getElementIndex(a,a)]=t[et.getElementIndex(c,c)]=r,t[et.getElementIndex(c,a)]=s,t[et.getElementIndex(a,c)]=-s,t}var c3=new et,NK=new et;et.computeEigenDecomposition=function(e,t){let n=P.EPSILON20,i=10,o=0,r=0;u(t)||(t={});let s=t.unitary=et.clone(et.IDENTITY,t.unitary),a=t.diagonal=et.clone(e,t.diagonal),c=n*mxe(a);for(;r<i&&pxe(a)>c;)_xe(a,c3),et.transpose(c3,NK),et.multiply(a,c3,a),et.multiply(NK,a,a),et.multiply(s,c3,s),++o>2&&(++r,o=0);return t};et.abs=function(e,t){return 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};et.determinant=function(e){let t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],c=e[5],l=e[8];return t*(r*l-c*s)+o*(c*i-n*l)+a*(n*s-r*i)};et.inverse=function(e,t){let n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],c=e[6],l=e[7],f=e[8],d=et.determinant(e);t[0]=s*f-l*a,t[1]=l*o-i*f,t[2]=i*a-s*o,t[3]=c*a-r*f,t[4]=n*f-c*o,t[5]=r*o-n*a,t[6]=r*l-c*s,t[7]=c*i-n*l,t[8]=n*s-r*i;let p=1/d;return et.multiplyByScalar(t,p,t)};var gxe=new et;et.inverseTranspose=function(e,t){return et.inverse(et.transpose(e,gxe),t)};et.equals=function(e,t){return e===t||u(e)&&u(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]};et.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(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};et.IDENTITY=Object.freeze(new et(1,0,0,0,1,0,0,0,1));et.ZERO=Object.freeze(new et(0,0,0,0,0,0,0,0,0));et.COLUMN0ROW0=0;et.COLUMN0ROW1=1;et.COLUMN0ROW2=2;et.COLUMN1ROW0=3;et.COLUMN1ROW1=4;et.COLUMN1ROW2=5;et.COLUMN2ROW0=6;et.COLUMN2ROW1=7;et.COLUMN2ROW2=8;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]};et.prototype.equalsEpsilon=function(e,t){return et.equalsEpsilon(this,e,t)};et.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
(${this[1]}, ${this[4]}, ${this[7]})
(${this[2]}, ${this[5]}, ${this[8]})`};var Z=et;function zS(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}u(Object.create)&&(zS.prototype=Object.create(Error.prototype),zS.prototype.constructor=zS);zS.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return u(this.stack)&&(e+=`
${this.stack.toString()}`),e};var ue=zS;function Qe(e,t,n,i,o,r,s,a,c,l,f,d,p,g,m,A){this[0]=y(e,0),this[1]=y(o,0),this[2]=y(c,0),this[3]=y(p,0),this[4]=y(t,0),this[5]=y(r,0),this[6]=y(l,0),this[7]=y(g,0),this[8]=y(n,0),this[9]=y(s,0),this[10]=y(f,0),this[11]=y(m,0),this[12]=y(i,0),this[13]=y(a,0),this[14]=y(d,0),this[15]=y(A,0)}Qe.packedLength=16;Qe.pack=function(e,t,n){return n=y(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};Qe.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Qe),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};Qe.packArray=function(e,t){let n=e.length,i=n*16;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)Qe.pack(e[o],t,o*16);return t};Qe.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){let o=i/16;t[o]=Qe.unpack(e,i,t[o])}return t};Qe.clone=function(e,t){if(u(e))return u(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 Qe(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])};Qe.fromArray=Qe.unpack;Qe.fromColumnMajorArray=function(e,t){return Qe.clone(e,t)};Qe.fromRowMajorArray=function(e,t){return u(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 Qe(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])};Qe.fromRotationTranslation=function(e,t,n){return t=y(t,h.ZERO),u(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 Qe(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)};Qe.fromTranslationQuaternionRotationScale=function(e,t,n,i){u(i)||(i=new Qe);let o=n.x,r=n.y,s=n.z,a=t.x*t.x,c=t.x*t.y,l=t.x*t.z,f=t.x*t.w,d=t.y*t.y,p=t.y*t.z,g=t.y*t.w,m=t.z*t.z,A=t.z*t.w,x=t.w*t.w,C=a-d-m+x,T=2*(c-A),E=2*(l+g),S=2*(c+A),D=-a+d-m+x,w=2*(p-f),R=2*(l-g),O=2*(p+f),L=-a-d+m+x;return i[0]=C*o,i[1]=S*o,i[2]=R*o,i[3]=0,i[4]=T*r,i[5]=D*r,i[6]=O*r,i[7]=0,i[8]=E*s,i[9]=w*s,i[10]=L*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};Qe.fromTranslationRotationScale=function(e,t){return Qe.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};Qe.fromTranslation=function(e,t){return Qe.fromRotationTranslation(Z.IDENTITY,e,t)};Qe.fromScale=function(e,t){return u(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 Qe(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};Qe.fromUniformScale=function(e,t){return u(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 Qe(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};Qe.fromRotation=function(e,t){return u(t)||(t=new Qe),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 FC=new h,VC=new h,HS=new h;Qe.fromCamera=function(e,t){let n=e.position,i=e.direction,o=e.up;h.normalize(i,FC),h.normalize(h.cross(FC,o,VC),VC),h.normalize(h.cross(VC,FC,HS),HS);let r=VC.x,s=VC.y,a=VC.z,c=FC.x,l=FC.y,f=FC.z,d=HS.x,p=HS.y,g=HS.z,m=n.x,A=n.y,x=n.z,C=r*-m+s*-A+a*-x,T=d*-m+p*-A+g*-x,E=c*m+l*A+f*x;return u(t)?(t[0]=r,t[1]=d,t[2]=-c,t[3]=0,t[4]=s,t[5]=p,t[6]=-l,t[7]=0,t[8]=a,t[9]=g,t[10]=-f,t[11]=0,t[12]=C,t[13]=T,t[14]=E,t[15]=1,t):new Qe(r,s,a,C,d,p,g,T,-c,-l,-f,E,0,0,0,1)};Qe.computePerspectiveFieldOfView=function(e,t,n,i,o){let s=1/Math.tan(e*.5),a=s/t,c=(i+n)/(n-i),l=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]=c,o[11]=-1,o[12]=0,o[13]=0,o[14]=l,o[15]=0,o};Qe.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){let a=1/(t-e),c=1/(i-n),l=1/(r-o),f=-(t+e)*a,d=-(i+n)*c,p=-(r+o)*l;return a*=2,c*=2,l*=-2,s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=l,s[11]=0,s[12]=f,s[13]=d,s[14]=p,s[15]=1,s};Qe.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){let a=2*o/(t-e),c=2*o/(i-n),l=(t+e)/(t-e),f=(i+n)/(i-n),d=-(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]=c,s[6]=0,s[7]=0,s[8]=l,s[9]=f,s[10]=d,s[11]=p,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};Qe.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){let s=2*o/(t-e),a=2*o/(i-n),c=(t+e)/(t-e),l=(i+n)/(i-n),f=-1,d=-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]=c,r[9]=l,r[10]=f,r[11]=d,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r};Qe.computeViewportTransformation=function(e,t,n,i){u(i)||(i=new Qe),e=y(e,y.EMPTY_OBJECT);let o=y(e.x,0),r=y(e.y,0),s=y(e.width,0),a=y(e.height,0);t=y(t,0),n=y(n,1);let c=s*.5,l=a*.5,f=(n-t)*.5,d=c,p=l,g=f,m=o+c,A=r+l,x=t+f,C=1;return i[0]=d,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]=A,i[14]=x,i[15]=C,i};Qe.computeView=function(e,t,n,i,o){return 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]=-h.dot(i,e),o[13]=-h.dot(n,e),o[14]=h.dot(t,e),o[15]=1,o};Qe.toArray=function(e,t){return u(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]]};Qe.getElementIndex=function(e,t){return e*4+t};Qe.getColumn=function(e,t,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};Qe.setColumn=function(e,t,n,i){i=Qe.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};Qe.getRow=function(e,t,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};Qe.setRow=function(e,t,n,i){return i=Qe.clone(e,i),i[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};Qe.setTranslation=function(e,t,n){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]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};var yxe=new h;Qe.setScale=function(e,t,n){let i=Qe.getScale(e,yxe),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 Axe=new h;Qe.setUniformScale=function(e,t,n){let i=Qe.getScale(e,Axe),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 qH=new h;Qe.getScale=function(e,t){return t.x=h.magnitude(h.fromElements(e[0],e[1],e[2],qH)),t.y=h.magnitude(h.fromElements(e[4],e[5],e[6],qH)),t.z=h.magnitude(h.fromElements(e[8],e[9],e[10],qH)),t};var FK=new h;Qe.getMaximumScale=function(e){return Qe.getScale(e,FK),h.maximumComponent(FK)};var xxe=new h;Qe.setRotation=function(e,t,n){let i=Qe.getScale(e,xxe);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 Cxe=new h;Qe.getRotation=function(e,t){let n=Qe.getScale(e,Cxe);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};Qe.multiply=function(e,t,n){let i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],c=e[5],l=e[6],f=e[7],d=e[8],p=e[9],g=e[10],m=e[11],A=e[12],x=e[13],C=e[14],T=e[15],E=t[0],S=t[1],D=t[2],w=t[3],R=t[4],O=t[5],L=t[6],N=t[7],_=t[8],b=t[9],v=t[10],I=t[11],B=t[12],F=t[13],k=t[14],U=t[15],G=i*E+a*S+d*D+A*w,V=o*E+c*S+p*D+x*w,X=r*E+l*S+g*D+C*w,j=s*E+f*S+m*D+T*w,Q=i*R+a*O+d*L+A*N,W=o*R+c*O+p*L+x*N,K=r*R+l*O+g*L+C*N,J=s*R+f*O+m*L+T*N,_e=i*_+a*b+d*v+A*I,xe=o*_+c*b+p*v+x*I,re=r*_+l*b+g*v+C*I,ye=s*_+f*b+m*v+T*I,fe=i*B+a*F+d*k+A*U,Se=o*B+c*F+p*k+x*U,we=r*B+l*F+g*k+C*U,Ve=s*B+f*F+m*k+T*U;return n[0]=G,n[1]=V,n[2]=X,n[3]=j,n[4]=Q,n[5]=W,n[6]=K,n[7]=J,n[8]=_e,n[9]=xe,n[10]=re,n[11]=ye,n[12]=fe,n[13]=Se,n[14]=we,n[15]=Ve,n};Qe.add=function(e,t,n){return 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};Qe.subtract=function(e,t,n){return 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};Qe.multiplyTransformation=function(e,t,n){let i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],l=e[8],f=e[9],d=e[10],p=e[12],g=e[13],m=e[14],A=t[0],x=t[1],C=t[2],T=t[4],E=t[5],S=t[6],D=t[8],w=t[9],R=t[10],O=t[12],L=t[13],N=t[14],_=i*A+s*x+l*C,b=o*A+a*x+f*C,v=r*A+c*x+d*C,I=i*T+s*E+l*S,B=o*T+a*E+f*S,F=r*T+c*E+d*S,k=i*D+s*w+l*R,U=o*D+a*w+f*R,G=r*D+c*w+d*R,V=i*O+s*L+l*N+p,X=o*O+a*L+f*N+g,j=r*O+c*L+d*N+m;return n[0]=_,n[1]=b,n[2]=v,n[3]=0,n[4]=I,n[5]=B,n[6]=F,n[7]=0,n[8]=k,n[9]=U,n[10]=G,n[11]=0,n[12]=V,n[13]=X,n[14]=j,n[15]=1,n};Qe.multiplyByMatrix3=function(e,t,n){let i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],l=e[8],f=e[9],d=e[10],p=t[0],g=t[1],m=t[2],A=t[3],x=t[4],C=t[5],T=t[6],E=t[7],S=t[8],D=i*p+s*g+l*m,w=o*p+a*g+f*m,R=r*p+c*g+d*m,O=i*A+s*x+l*C,L=o*A+a*x+f*C,N=r*A+c*x+d*C,_=i*T+s*E+l*S,b=o*T+a*E+f*S,v=r*T+c*E+d*S;return n[0]=D,n[1]=w,n[2]=R,n[3]=0,n[4]=O,n[5]=L,n[6]=N,n[7]=0,n[8]=_,n[9]=b,n[10]=v,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};Qe.multiplyByTranslation=function(e,t,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],c=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]=c,n[15]=e[15],n};Qe.multiplyByScale=function(e,t,n){let i=t.x,o=t.y,r=t.z;return i===1&&o===1&&r===1?Qe.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)};Qe.multiplyByUniformScale=function(e,t,n){return 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};Qe.multiplyByVector=function(e,t,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,c=e[1]*i+e[5]*o+e[9]*r+e[13]*s,l=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=c,n.z=l,n.w=f,n};Qe.multiplyByPointAsVector=function(e,t,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,c=e[2]*i+e[6]*o+e[10]*r;return n.x=s,n.y=a,n.z=c,n};Qe.multiplyByPoint=function(e,t,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],c=e[2]*i+e[6]*o+e[10]*r+e[14];return n.x=s,n.y=a,n.z=c,n};Qe.multiplyByScalar=function(e,t,n){return 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};Qe.negate=function(e,t){return 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};Qe.transpose=function(e,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};Qe.abs=function(e,t){return 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};Qe.equals=function(e,t){return e===t||u(e)&&u(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]};Qe.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(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};Qe.getTranslation=function(e,t){return t.x=e[12],t.y=e[13],t.z=e[14],t};Qe.getMatrix3=function(e,t){return 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 Txe=new Z,Exe=new Z,bxe=new oe,Sxe=new oe(0,0,0,1);Qe.inverse=function(e,t){let n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],c=e[9],l=e[13],f=e[2],d=e[6],p=e[10],g=e[14],m=e[3],A=e[7],x=e[11],C=e[15],T=p*C,E=g*x,S=d*C,D=g*A,w=d*x,R=p*A,O=f*C,L=g*m,N=f*x,_=p*m,b=f*A,v=d*m,I=T*a+D*c+w*l-(E*a+S*c+R*l),B=E*s+O*c+_*l-(T*s+L*c+N*l),F=S*s+L*a+b*l-(D*s+O*a+v*l),k=R*s+N*a+v*c-(w*s+_*a+b*c),U=E*i+S*o+R*r-(T*i+D*o+w*r),G=T*n+L*o+N*r-(E*n+O*o+_*r),V=D*n+O*i+v*r-(S*n+L*i+b*r),X=w*n+_*i+b*o-(R*n+N*i+v*o);T=o*l,E=r*c,S=i*l,D=r*a,w=i*c,R=o*a,O=n*l,L=r*s,N=n*c,_=o*s,b=n*a,v=i*s;let j=T*A+D*x+w*C-(E*A+S*x+R*C),Q=E*m+O*x+_*C-(T*m+L*x+N*C),W=S*m+L*A+b*C-(D*m+O*A+v*C),K=R*m+N*A+v*x-(w*m+_*A+b*x),J=S*p+R*g+E*d-(w*g+T*d+D*p),_e=N*g+T*f+L*p-(O*p+_*g+E*f),xe=O*d+v*g+D*f-(b*g+S*f+L*d),re=b*p+w*f+_*d-(N*d+v*p+R*f),ye=n*I+i*B+o*F+r*k;if(Math.abs(ye)<P.EPSILON21){if(Z.equalsEpsilon(Qe.getMatrix3(e,Txe),Exe,P.EPSILON7)&&oe.equals(Qe.getRow(e,3,bxe),Sxe))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 ue("matrix is not invertible because its determinate is zero.")}return ye=1/ye,t[0]=I*ye,t[1]=B*ye,t[2]=F*ye,t[3]=k*ye,t[4]=U*ye,t[5]=G*ye,t[6]=V*ye,t[7]=X*ye,t[8]=j*ye,t[9]=Q*ye,t[10]=W*ye,t[11]=K*ye,t[12]=J*ye,t[13]=_e*ye,t[14]=xe*ye,t[15]=re*ye,t};Qe.inverseTransformation=function(e,t){let n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],c=e[8],l=e[9],f=e[10],d=e[12],p=e[13],g=e[14],m=-n*d-i*p-o*g,A=-r*d-s*p-a*g,x=-c*d-l*p-f*g;return t[0]=n,t[1]=r,t[2]=c,t[3]=0,t[4]=i,t[5]=s,t[6]=l,t[7]=0,t[8]=o,t[9]=a,t[10]=f,t[11]=0,t[12]=m,t[13]=A,t[14]=x,t[15]=1,t};var Dxe=new Qe;Qe.inverseTranspose=function(e,t){return Qe.inverse(Qe.transpose(e,Dxe),t)};Qe.IDENTITY=Object.freeze(new Qe(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1));Qe.ZERO=Object.freeze(new Qe(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));Qe.COLUMN0ROW0=0;Qe.COLUMN0ROW1=1;Qe.COLUMN0ROW2=2;Qe.COLUMN0ROW3=3;Qe.COLUMN1ROW0=4;Qe.COLUMN1ROW1=5;Qe.COLUMN1ROW2=6;Qe.COLUMN1ROW3=7;Qe.COLUMN2ROW0=8;Qe.COLUMN2ROW1=9;Qe.COLUMN2ROW2=10;Qe.COLUMN2ROW3=11;Qe.COLUMN3ROW0=12;Qe.COLUMN3ROW1=13;Qe.COLUMN3ROW2=14;Qe.COLUMN3ROW3=15;Object.defineProperties(Qe.prototype,{length:{get:function(){return Qe.packedLength}}});Qe.prototype.clone=function(e){return Qe.clone(this,e)};Qe.prototype.equals=function(e){return Qe.equals(this,e)};Qe.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]};Qe.prototype.equalsEpsilon=function(e,t){return Qe.equalsEpsilon(this,e,t)};Qe.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 M=Qe;var vxe={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},ee=Object.freeze(vxe);var wxe=new h;function kt(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}var Ls={};Ls[ee.FLOAT]="float";Ls[ee.FLOAT_VEC2]="vec2";Ls[ee.FLOAT_VEC3]="vec3";Ls[ee.FLOAT_VEC4]="vec4";Ls[ee.INT]="int";Ls[ee.INT_VEC2]="ivec2";Ls[ee.INT_VEC3]="ivec3";Ls[ee.INT_VEC4]="ivec4";Ls[ee.BOOL]="bool";Ls[ee.BOOL_VEC2]="bvec2";Ls[ee.BOOL_VEC3]="bvec3";Ls[ee.BOOL_VEC4]="bvec4";Ls[ee.FLOAT_MAT2]="mat2";Ls[ee.FLOAT_MAT3]="mat3";Ls[ee.FLOAT_MAT4]="mat4";Ls[ee.SAMPLER_2D]="sampler2D";Ls[ee.SAMPLER_CUBE]="samplerCube";kt.prototype.getDeclaration=function(e){let t=`uniform ${Ls[this._datatype]} ${e}`,n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};var Ixe={czm_viewport:new kt({size:1,datatype:ee.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new kt({size:1,datatype:ee.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new kt({size:1,datatype:ee.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new kt({size:1,datatype:ee.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new kt({size:1,datatype:ee.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new kt({size:1,datatype:ee.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new kt({size:1,datatype:ee.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return M.getTranslation(e.inverseView,wxe)}}),czm_frameNumber:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new kt({size:1,datatype:ee.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new kt({size:1,datatype:ee.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new kt({size:1,datatype:ee.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new kt({size:1,datatype:ee.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new kt({size:1,datatype:ee.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new kt({size:9,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new kt({size:1,datatype:ee.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.fogDensity}}),czm_splitPosition:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new kt({size:1,datatype:ee.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new kt({size:1,datatype:ee.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new kt({size:1,datatype:ee.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},Pm=Ixe;function Pxe(){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 zn=Pxe;function Oxe(){return!0}function Rxe(e,t){t=y(t,"This object was destroyed, i.e., destroy() was called.");function n(){}for(let i in e)typeof e[i]=="function"&&(e[i]=n);e.isDestroyed=Oxe}var le=Rxe;var _s={UNSIGNED_BYTE:ee.UNSIGNED_BYTE,UNSIGNED_SHORT:ee.UNSIGNED_SHORT,UNSIGNED_INT:ee.UNSIGNED_INT};_s.getSizeInBytes=function(e){switch(e){case _s.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case _s.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case _s.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}};_s.fromSizeInBytes=function(e){switch(e){case 2:return _s.UNSIGNED_SHORT;case 4:return _s.UNSIGNED_INT;case 1:return _s.UNSIGNED_BYTE}};_s.validate=function(e){return u(e)&&(e===_s.UNSIGNED_BYTE||e===_s.UNSIGNED_SHORT||e===_s.UNSIGNED_INT)};_s.createTypedArray=function(e,t){return e>=P.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};_s.createTypedArrayFromArrayBuffer=function(e,t,n,i){return e>=P.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};_s.fromTypedArray=function(e){if(e instanceof Uint8Array)return _s.UNSIGNED_BYTE;if(e instanceof Uint16Array)return _s.UNSIGNED_SHORT;if(e instanceof Uint32Array)return _s.UNSIGNED_INT};var Fe=Object.freeze(_s);var l3={STREAM_DRAW:ee.STREAM_DRAW,STATIC_DRAW:ee.STATIC_DRAW,DYNAMIC_DRAW:ee.DYNAMIC_DRAW,validate:function(e){return e===l3.STREAM_DRAW||e===l3.STATIC_DRAW||e===l3.DYNAMIC_DRAW}},Ne=Object.freeze(l3);function Mu(e){e=y(e,y.EMPTY_OBJECT);let t=e.context._gl,n=e.bufferTarget,i=e.typedArray,o=e.sizeInBytes,r=e.usage,s=u(i);s&&(o=i.byteLength);let a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=zn(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}Mu.createVertexBuffer=function(e){return new Mu({context:e.context,bufferTarget:ee.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};Mu.createIndexBuffer=function(e){let t=e.context,n=e.indexDatatype,i=Fe.getSizeInBytes(n),o=new Mu({context:t,bufferTarget:ee.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(Mu.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});Mu.prototype._getBuffer=function(){return this._buffer};Mu.prototype.copyFromArrayView=function(e,t){t=y(t,0);let n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};Mu.prototype.copyFromBuffer=function(e,t,n,i){let o=ee.COPY_READ_BUFFER,r=ee.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)};Mu.prototype.getBufferData=function(e,t,n,i){t=y(t,0),n=y(n,0);let o=this._gl,r=ee.COPY_READ_BUFFER;o.bindBuffer(r,this._buffer),o.getBufferSubData(r,t,e,n,i),o.bindBuffer(r,null)};Mu.prototype.isDestroyed=function(){return!1};Mu.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),le(this)};var lt=Mu;var k_,xr={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},$c={};Object.defineProperties($c,{element:{get:function(){if($c.supportsFullscreen())return document[xr.fullscreenElement]}},changeEventName:{get:function(){if($c.supportsFullscreen())return xr.fullscreenchange}},errorEventName:{get:function(){if($c.supportsFullscreen())return xr.fullscreenerror}},enabled:{get:function(){if($c.supportsFullscreen())return document[xr.fullscreenEnabled]}},fullscreen:{get:function(){if($c.supportsFullscreen())return $c.element!==null}}});$c.supportsFullscreen=function(){if(u(k_))return k_;k_=!1;let e=document.body;if(typeof e.requestFullscreen=="function")return xr.requestFullscreen="requestFullscreen",xr.exitFullscreen="exitFullscreen",xr.fullscreenEnabled="fullscreenEnabled",xr.fullscreenElement="fullscreenElement",xr.fullscreenchange="fullscreenchange",xr.fullscreenerror="fullscreenerror",k_=!0,k_;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"?(xr.requestFullscreen=n,k_=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(xr.requestFullscreen=n,k_=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?xr.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(xr.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?xr.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(xr.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?xr.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(xr.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),xr.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),xr.fullscreenerror=n)}return k_};$c.requestFullscreen=function(e,t){$c.supportsFullscreen()&&e[xr.requestFullscreen]({vrDisplay:t})};$c.exitFullscreen=function(){$c.supportsFullscreen()&&document[xr.exitFullscreen]()};$c._names=xr;var fr=$c;var wa;typeof navigator<"u"?wa=navigator:wa={};function a0(e){let t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}var u3,VK;function $H(){if(!u(u3)&&(u3=!1,!_3())){let e=/ Chrome\/([\.0-9]+)/.exec(wa.userAgent);e!==null&&(u3=!0,VK=a0(e[1]))}return u3}function Bxe(){return $H()&&VK}var f3,UK;function kK(){if(!u(f3)&&(f3=!1,!$H()&&!_3()&&/ Safari\/[\.0-9]+/.test(wa.userAgent))){let e=/ Version\/([\.0-9]+)/.exec(wa.userAgent);e!==null&&(f3=!0,UK=a0(e[1]))}return f3}function Mxe(){return kK()&&UK}var d3,JH;function zK(){if(!u(d3)){d3=!1;let e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(wa.userAgent);e!==null&&(d3=!0,JH=a0(e[1]),JH.isNightly=!!e[2])}return d3}function Lxe(){return zK()&&JH}var GS,QH;function HK(){if(!u(GS)){GS=!1;let e;wa.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(wa.userAgent),e!==null&&(GS=!0,QH=a0(e[1]))):wa.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(wa.userAgent),e!==null&&(GS=!0,QH=a0(e[1])))}return GS}function Nxe(){return HK()&&QH}var h3,GK;function _3(){if(!u(h3)){h3=!1;let e=/ Edg\/([\.0-9]+)/.exec(wa.userAgent);e!==null&&(h3=!0,GK=a0(e[1]))}return h3}function Fxe(){return _3()&&GK}var m3,WK;function eG(){if(!u(m3)){m3=!1;let e=/Firefox\/([\.0-9]+)/.exec(wa.userAgent);e!==null&&(m3=!0,WK=a0(e[1]))}return m3}var XH;function Vxe(){return u(XH)||(XH=/Windows/i.test(wa.appVersion)),XH}var KH;function Uxe(){return u(KH)||(KH=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),KH}function kxe(){return eG()&&WK}var ZH;function zxe(){return u(ZH)||(ZH=!eG()&&typeof PointerEvent<"u"&&(!u(wa.pointerEnabled)||wa.pointerEnabled)),ZH}var jK,p3;function YK(){if(!u(p3)){let e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");let t=e.style.imageRendering;p3=u(t)&&t!=="",p3&&(jK=t)}return p3}function Hxe(){return YK()?jK:void 0}function pc(){return pc._result}pc._promise=void 0;pc._result=void 0;pc.initialize=function(){return u(pc._promise)||(pc._promise=new Promise(e=>{let t=new Image;t.onload=function(){pc._result=t.width>0&&t.height>0,e(pc._result)},t.onerror=function(){pc._result=!1,e(pc._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),pc._promise};Object.defineProperties(pc,{initialized:{get:function(){return u(pc._result)}}});var UC=[];typeof ArrayBuffer<"u"&&(UC.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&UC.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&UC.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&UC.push(BigInt64Array),typeof BigUint64Array<"u"&&UC.push(BigUint64Array));var zf={isChrome:$H,chromeVersion:Bxe,isSafari:kK,safariVersion:Mxe,isWebkit:zK,webkitVersion:Lxe,isInternetExplorer:HK,internetExplorerVersion:Nxe,isEdge:_3,edgeVersion:Fxe,isFirefox:eG,firefoxVersion:kxe,isWindows:Vxe,isIPadOrIOS:Uxe,hardwareConcurrency:y(wa.hardwareConcurrency,3),supportsPointerEvents:zxe,supportsImageRenderingPixelated:YK,supportsWebP:pc,imageRenderingValue:Hxe,typedArrayTypes:UC};zf.supportsBasis=function(e){return zf.supportsWebAssembly()&&e.context.supportsBasis};zf.supportsFullscreen=function(){return fr.supportsFullscreen()};zf.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};zf.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};zf.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};zf.supportsBigInt=function(){return typeof BigInt<"u"};zf.supportsWebWorkers=function(){return typeof Worker<"u"};zf.supportsWebAssembly=function(){return typeof WebAssembly<"u"};zf.supportsWebgl2=function(e){return e.context.webgl2};var Vt=zf;function tG(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 ne(e,t,n,i){this.red=y(e,1),this.green=y(t,1),this.blue=y(n,1),this.alpha=y(i,1)}ne.fromCartesian4=function(e,t){return u(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new ne(e.x,e.y,e.z,e.w)};ne.fromBytes=function(e,t,n,i,o){return e=ne.byteToFloat(y(e,255)),t=ne.byteToFloat(y(t,255)),n=ne.byteToFloat(y(n,255)),i=ne.byteToFloat(y(i,255)),u(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new ne(e,t,n,i)};ne.fromAlpha=function(e,t,n){return u(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new ne(e.red,e.green,e.blue,t)};var nG,iG,Om;Vt.supportsTypedArrays()&&(nG=new ArrayBuffer(4),iG=new Uint32Array(nG),Om=new Uint8Array(nG));ne.fromRgba=function(e,t){return iG[0]=e,ne.fromBytes(Om[0],Om[1],Om[2],Om[3],t)};ne.fromHsl=function(e,t,n,i,o){e=y(e,0)%1,t=y(t,0),n=y(n,0),i=y(i,1);let r=n,s=n,a=n;if(t!==0){let c;n<.5?c=n*(1+t):c=n+t-n*t;let l=2*n-c;r=tG(l,c,e+1/3),s=tG(l,c,e),a=tG(l,c,e-1/3)}return u(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new ne(r,s,a,i)};ne.fromRandom=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.red;if(!u(n)){let s=y(e.minimumRed,0),a=y(e.maximumRed,1);n=s+P.nextRandomNumber()*(a-s)}let i=e.green;if(!u(i)){let s=y(e.minimumGreen,0),a=y(e.maximumGreen,1);i=s+P.nextRandomNumber()*(a-s)}let o=e.blue;if(!u(o)){let s=y(e.minimumBlue,0),a=y(e.maximumBlue,1);o=s+P.nextRandomNumber()*(a-s)}let r=e.alpha;if(!u(r)){let s=y(e.minimumAlpha,0),a=y(e.maximumAlpha,1);r=s+P.nextRandomNumber()*(a-s)}return u(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new ne(n,i,o,r)};var Gxe=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Wxe=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,jxe=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,Yxe=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;ne.fromCssColorString=function(e,t){u(t)||(t=new ne),e=e.replace(/\s/g,"");let n=ne[e.toUpperCase()];if(u(n))return ne.clone(n,t),t;let i=Gxe.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(y(i[4],"f"),16)/15,t):(i=Wxe.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(y(i[4],"ff"),16)/255,t):(i=jxe.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(y(i[4],"1.0")),t):(i=Yxe.exec(e),i!==null?ne.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(y(i[4],"1.0")),t):(t=void 0,t))))};ne.packedLength=4;ne.pack=function(e,t,n){return n=y(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};ne.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new ne),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};ne.byteToFloat=function(e){return e/255};ne.floatToByte=function(e){return e===1?255:e*256|0};ne.clone=function(e,t){if(u(e))return u(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new ne(e.red,e.green,e.blue,e.alpha)};ne.equals=function(e,t){return e===t||u(e)&&u(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};ne.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]};ne.prototype.clone=function(e){return ne.clone(this,e)};ne.prototype.equals=function(e){return ne.equals(this,e)};ne.prototype.equalsEpsilon=function(e,t){return this===e||u(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};ne.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};ne.prototype.toCssColorString=function(){let e=ne.floatToByte(this.red),t=ne.floatToByte(this.green),n=ne.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};ne.prototype.toCssHexString=function(){let e=ne.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=ne.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=ne.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=ne.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};ne.prototype.toBytes=function(e){let t=ne.floatToByte(this.red),n=ne.floatToByte(this.green),i=ne.floatToByte(this.blue),o=ne.floatToByte(this.alpha);return u(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};ne.prototype.toRgba=function(){return Om[0]=ne.floatToByte(this.red),Om[1]=ne.floatToByte(this.green),Om[2]=ne.floatToByte(this.blue),Om[3]=ne.floatToByte(this.alpha),iG[0]};ne.prototype.brighten=function(e,t){return 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};ne.prototype.darken=function(e,t){return e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};ne.prototype.withAlpha=function(e,t){return ne.fromAlpha(this,e,t)};ne.add=function(e,t,n){return 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};ne.subtract=function(e,t,n){return 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};ne.multiply=function(e,t,n){return 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};ne.divide=function(e,t,n){return 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};ne.mod=function(e,t,n){return 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};ne.lerp=function(e,t,n,i){return i.red=P.lerp(e.red,t.red,n),i.green=P.lerp(e.green,t.green,n),i.blue=P.lerp(e.blue,t.blue,n),i.alpha=P.lerp(e.alpha,t.alpha,n),i};ne.multiplyByScalar=function(e,t,n){return n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};ne.divideByScalar=function(e,t,n){return n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};ne.ALICEBLUE=Object.freeze(ne.fromCssColorString("#F0F8FF"));ne.ANTIQUEWHITE=Object.freeze(ne.fromCssColorString("#FAEBD7"));ne.AQUA=Object.freeze(ne.fromCssColorString("#00FFFF"));ne.AQUAMARINE=Object.freeze(ne.fromCssColorString("#7FFFD4"));ne.AZURE=Object.freeze(ne.fromCssColorString("#F0FFFF"));ne.BEIGE=Object.freeze(ne.fromCssColorString("#F5F5DC"));ne.BISQUE=Object.freeze(ne.fromCssColorString("#FFE4C4"));ne.BLACK=Object.freeze(ne.fromCssColorString("#000000"));ne.BLANCHEDALMOND=Object.freeze(ne.fromCssColorString("#FFEBCD"));ne.BLUE=Object.freeze(ne.fromCssColorString("#0000FF"));ne.BLUEVIOLET=Object.freeze(ne.fromCssColorString("#8A2BE2"));ne.BROWN=Object.freeze(ne.fromCssColorString("#A52A2A"));ne.BURLYWOOD=Object.freeze(ne.fromCssColorString("#DEB887"));ne.CADETBLUE=Object.freeze(ne.fromCssColorString("#5F9EA0"));ne.CHARTREUSE=Object.freeze(ne.fromCssColorString("#7FFF00"));ne.CHOCOLATE=Object.freeze(ne.fromCssColorString("#D2691E"));ne.CORAL=Object.freeze(ne.fromCssColorString("#FF7F50"));ne.CORNFLOWERBLUE=Object.freeze(ne.fromCssColorString("#6495ED"));ne.CORNSILK=Object.freeze(ne.fromCssColorString("#FFF8DC"));ne.CRIMSON=Object.freeze(ne.fromCssColorString("#DC143C"));ne.CYAN=Object.freeze(ne.fromCssColorString("#00FFFF"));ne.DARKBLUE=Object.freeze(ne.fromCssColorString("#00008B"));ne.DARKCYAN=Object.freeze(ne.fromCssColorString("#008B8B"));ne.DARKGOLDENROD=Object.freeze(ne.fromCssColorString("#B8860B"));ne.DARKGRAY=Object.freeze(ne.fromCssColorString("#A9A9A9"));ne.DARKGREEN=Object.freeze(ne.fromCssColorString("#006400"));ne.DARKGREY=ne.DARKGRAY;ne.DARKKHAKI=Object.freeze(ne.fromCssColorString("#BDB76B"));ne.DARKMAGENTA=Object.freeze(ne.fromCssColorString("#8B008B"));ne.DARKOLIVEGREEN=Object.freeze(ne.fromCssColorString("#556B2F"));ne.DARKORANGE=Object.freeze(ne.fromCssColorString("#FF8C00"));ne.DARKORCHID=Object.freeze(ne.fromCssColorString("#9932CC"));ne.DARKRED=Object.freeze(ne.fromCssColorString("#8B0000"));ne.DARKSALMON=Object.freeze(ne.fromCssColorString("#E9967A"));ne.DARKSEAGREEN=Object.freeze(ne.fromCssColorString("#8FBC8F"));ne.DARKSLATEBLUE=Object.freeze(ne.fromCssColorString("#483D8B"));ne.DARKSLATEGRAY=Object.freeze(ne.fromCssColorString("#2F4F4F"));ne.DARKSLATEGREY=ne.DARKSLATEGRAY;ne.DARKTURQUOISE=Object.freeze(ne.fromCssColorString("#00CED1"));ne.DARKVIOLET=Object.freeze(ne.fromCssColorString("#9400D3"));ne.DEEPPINK=Object.freeze(ne.fromCssColorString("#FF1493"));ne.DEEPSKYBLUE=Object.freeze(ne.fromCssColorString("#00BFFF"));ne.DIMGRAY=Object.freeze(ne.fromCssColorString("#696969"));ne.DIMGREY=ne.DIMGRAY;ne.DODGERBLUE=Object.freeze(ne.fromCssColorString("#1E90FF"));ne.FIREBRICK=Object.freeze(ne.fromCssColorString("#B22222"));ne.FLORALWHITE=Object.freeze(ne.fromCssColorString("#FFFAF0"));ne.FORESTGREEN=Object.freeze(ne.fromCssColorString("#228B22"));ne.FUCHSIA=Object.freeze(ne.fromCssColorString("#FF00FF"));ne.GAINSBORO=Object.freeze(ne.fromCssColorString("#DCDCDC"));ne.GHOSTWHITE=Object.freeze(ne.fromCssColorString("#F8F8FF"));ne.GOLD=Object.freeze(ne.fromCssColorString("#FFD700"));ne.GOLDENROD=Object.freeze(ne.fromCssColorString("#DAA520"));ne.GRAY=Object.freeze(ne.fromCssColorString("#808080"));ne.GREEN=Object.freeze(ne.fromCssColorString("#008000"));ne.GREENYELLOW=Object.freeze(ne.fromCssColorString("#ADFF2F"));ne.GREY=ne.GRAY;ne.HONEYDEW=Object.freeze(ne.fromCssColorString("#F0FFF0"));ne.HOTPINK=Object.freeze(ne.fromCssColorString("#FF69B4"));ne.INDIANRED=Object.freeze(ne.fromCssColorString("#CD5C5C"));ne.INDIGO=Object.freeze(ne.fromCssColorString("#4B0082"));ne.IVORY=Object.freeze(ne.fromCssColorString("#FFFFF0"));ne.KHAKI=Object.freeze(ne.fromCssColorString("#F0E68C"));ne.LAVENDER=Object.freeze(ne.fromCssColorString("#E6E6FA"));ne.LAVENDAR_BLUSH=Object.freeze(ne.fromCssColorString("#FFF0F5"));ne.LAWNGREEN=Object.freeze(ne.fromCssColorString("#7CFC00"));ne.LEMONCHIFFON=Object.freeze(ne.fromCssColorString("#FFFACD"));ne.LIGHTBLUE=Object.freeze(ne.fromCssColorString("#ADD8E6"));ne.LIGHTCORAL=Object.freeze(ne.fromCssColorString("#F08080"));ne.LIGHTCYAN=Object.freeze(ne.fromCssColorString("#E0FFFF"));ne.LIGHTGOLDENRODYELLOW=Object.freeze(ne.fromCssColorString("#FAFAD2"));ne.LIGHTGRAY=Object.freeze(ne.fromCssColorString("#D3D3D3"));ne.LIGHTGREEN=Object.freeze(ne.fromCssColorString("#90EE90"));ne.LIGHTGREY=ne.LIGHTGRAY;ne.LIGHTPINK=Object.freeze(ne.fromCssColorString("#FFB6C1"));ne.LIGHTSEAGREEN=Object.freeze(ne.fromCssColorString("#20B2AA"));ne.LIGHTSKYBLUE=Object.freeze(ne.fromCssColorString("#87CEFA"));ne.LIGHTSLATEGRAY=Object.freeze(ne.fromCssColorString("#778899"));ne.LIGHTSLATEGREY=ne.LIGHTSLATEGRAY;ne.LIGHTSTEELBLUE=Object.freeze(ne.fromCssColorString("#B0C4DE"));ne.LIGHTYELLOW=Object.freeze(ne.fromCssColorString("#FFFFE0"));ne.LIME=Object.freeze(ne.fromCssColorString("#00FF00"));ne.LIMEGREEN=Object.freeze(ne.fromCssColorString("#32CD32"));ne.LINEN=Object.freeze(ne.fromCssColorString("#FAF0E6"));ne.MAGENTA=Object.freeze(ne.fromCssColorString("#FF00FF"));ne.MAROON=Object.freeze(ne.fromCssColorString("#800000"));ne.MEDIUMAQUAMARINE=Object.freeze(ne.fromCssColorString("#66CDAA"));ne.MEDIUMBLUE=Object.freeze(ne.fromCssColorString("#0000CD"));ne.MEDIUMORCHID=Object.freeze(ne.fromCssColorString("#BA55D3"));ne.MEDIUMPURPLE=Object.freeze(ne.fromCssColorString("#9370DB"));ne.MEDIUMSEAGREEN=Object.freeze(ne.fromCssColorString("#3CB371"));ne.MEDIUMSLATEBLUE=Object.freeze(ne.fromCssColorString("#7B68EE"));ne.MEDIUMSPRINGGREEN=Object.freeze(ne.fromCssColorString("#00FA9A"));ne.MEDIUMTURQUOISE=Object.freeze(ne.fromCssColorString("#48D1CC"));ne.MEDIUMVIOLETRED=Object.freeze(ne.fromCssColorString("#C71585"));ne.MIDNIGHTBLUE=Object.freeze(ne.fromCssColorString("#191970"));ne.MINTCREAM=Object.freeze(ne.fromCssColorString("#F5FFFA"));ne.MISTYROSE=Object.freeze(ne.fromCssColorString("#FFE4E1"));ne.MOCCASIN=Object.freeze(ne.fromCssColorString("#FFE4B5"));ne.NAVAJOWHITE=Object.freeze(ne.fromCssColorString("#FFDEAD"));ne.NAVY=Object.freeze(ne.fromCssColorString("#000080"));ne.OLDLACE=Object.freeze(ne.fromCssColorString("#FDF5E6"));ne.OLIVE=Object.freeze(ne.fromCssColorString("#808000"));ne.OLIVEDRAB=Object.freeze(ne.fromCssColorString("#6B8E23"));ne.ORANGE=Object.freeze(ne.fromCssColorString("#FFA500"));ne.ORANGERED=Object.freeze(ne.fromCssColorString("#FF4500"));ne.ORCHID=Object.freeze(ne.fromCssColorString("#DA70D6"));ne.PALEGOLDENROD=Object.freeze(ne.fromCssColorString("#EEE8AA"));ne.PALEGREEN=Object.freeze(ne.fromCssColorString("#98FB98"));ne.PALETURQUOISE=Object.freeze(ne.fromCssColorString("#AFEEEE"));ne.PALEVIOLETRED=Object.freeze(ne.fromCssColorString("#DB7093"));ne.PAPAYAWHIP=Object.freeze(ne.fromCssColorString("#FFEFD5"));ne.PEACHPUFF=Object.freeze(ne.fromCssColorString("#FFDAB9"));ne.PERU=Object.freeze(ne.fromCssColorString("#CD853F"));ne.PINK=Object.freeze(ne.fromCssColorString("#FFC0CB"));ne.PLUM=Object.freeze(ne.fromCssColorString("#DDA0DD"));ne.POWDERBLUE=Object.freeze(ne.fromCssColorString("#B0E0E6"));ne.PURPLE=Object.freeze(ne.fromCssColorString("#800080"));ne.RED=Object.freeze(ne.fromCssColorString("#FF0000"));ne.ROSYBROWN=Object.freeze(ne.fromCssColorString("#BC8F8F"));ne.ROYALBLUE=Object.freeze(ne.fromCssColorString("#4169E1"));ne.SADDLEBROWN=Object.freeze(ne.fromCssColorString("#8B4513"));ne.SALMON=Object.freeze(ne.fromCssColorString("#FA8072"));ne.SANDYBROWN=Object.freeze(ne.fromCssColorString("#F4A460"));ne.SEAGREEN=Object.freeze(ne.fromCssColorString("#2E8B57"));ne.SEASHELL=Object.freeze(ne.fromCssColorString("#FFF5EE"));ne.SIENNA=Object.freeze(ne.fromCssColorString("#A0522D"));ne.SILVER=Object.freeze(ne.fromCssColorString("#C0C0C0"));ne.SKYBLUE=Object.freeze(ne.fromCssColorString("#87CEEB"));ne.SLATEBLUE=Object.freeze(ne.fromCssColorString("#6A5ACD"));ne.SLATEGRAY=Object.freeze(ne.fromCssColorString("#708090"));ne.SLATEGREY=ne.SLATEGRAY;ne.SNOW=Object.freeze(ne.fromCssColorString("#FFFAFA"));ne.SPRINGGREEN=Object.freeze(ne.fromCssColorString("#00FF7F"));ne.STEELBLUE=Object.freeze(ne.fromCssColorString("#4682B4"));ne.TAN=Object.freeze(ne.fromCssColorString("#D2B48C"));ne.TEAL=Object.freeze(ne.fromCssColorString("#008080"));ne.THISTLE=Object.freeze(ne.fromCssColorString("#D8BFD8"));ne.TOMATO=Object.freeze(ne.fromCssColorString("#FF6347"));ne.TURQUOISE=Object.freeze(ne.fromCssColorString("#40E0D0"));ne.VIOLET=Object.freeze(ne.fromCssColorString("#EE82EE"));ne.WHEAT=Object.freeze(ne.fromCssColorString("#F5DEB3"));ne.WHITE=Object.freeze(ne.fromCssColorString("#FFFFFF"));ne.WHITESMOKE=Object.freeze(ne.fromCssColorString("#F5F5F5"));ne.YELLOW=Object.freeze(ne.fromCssColorString("#FFFF00"));ne.YELLOWGREEN=Object.freeze(ne.fromCssColorString("#9ACD32"));ne.TRANSPARENT=Object.freeze(new ne(0,0,0,0));var z=ne;function g3(e){e=y(e,y.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}g3.ALL=Object.freeze(new g3({color:new z(0,0,0,0),depth:1,stencil:0}));g3.prototype.execute=function(e,t){e.clear(this,t)};var ii=g3;var qxe={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},Ee=Object.freeze(qxe);function qK(e){e=y(e,y.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=y(e.persists,!1),this.pass=Ee.COMPUTE,this.owner=e.owner}qK.prototype.execute=function(e){e.execute(this)};var Lu=qK;function vt(e,t){this.x=y(e,0),this.y=y(t,0)}vt.fromElements=function(e,t,n){return u(n)?(n.x=e,n.y=t,n):new vt(e,t)};vt.clone=function(e,t){if(u(e))return u(t)?(t.x=e.x,t.y=e.y,t):new vt(e.x,e.y)};vt.fromCartesian3=vt.clone;vt.fromCartesian4=vt.clone;vt.packedLength=2;vt.pack=function(e,t,n){return n=y(n,0),t[n++]=e.x,t[n]=e.y,t};vt.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new vt),n.x=e[t++],n.y=e[t],n};vt.packArray=function(e,t){let n=e.length,i=n*2;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)vt.pack(e[o],t,o*2);return t};vt.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){let o=i/2;t[o]=vt.unpack(e,i,t[o])}return t};vt.fromArray=vt.unpack;vt.maximumComponent=function(e){return Math.max(e.x,e.y)};vt.minimumComponent=function(e){return Math.min(e.x,e.y)};vt.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n};vt.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n};vt.clamp=function(e,t,n,i){let o=P.clamp(e.x,t.x,n.x),r=P.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};vt.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y};vt.magnitude=function(e){return Math.sqrt(vt.magnitudeSquared(e))};var y3=new vt;vt.distance=function(e,t){return vt.subtract(e,t,y3),vt.magnitude(y3)};vt.distanceSquared=function(e,t){return vt.subtract(e,t,y3),vt.magnitudeSquared(y3)};vt.normalize=function(e,t){let n=vt.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t};vt.dot=function(e,t){return e.x*t.x+e.y*t.y};vt.cross=function(e,t){return e.x*t.y-e.y*t.x};vt.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n};vt.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n};vt.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n};vt.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n};vt.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n};vt.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n};vt.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t};vt.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};var XK=new vt;vt.lerp=function(e,t,n,i){return vt.multiplyByScalar(t,n,XK),i=vt.multiplyByScalar(e,1-n,i),vt.add(XK,i,i)};var KK=new vt,ZK=new vt;vt.angleBetween=function(e,t){return vt.normalize(e,KK),vt.normalize(t,ZK),P.acosClamped(vt.dot(KK,ZK))};var Xxe=new vt;vt.mostOrthogonalAxis=function(e,t){let n=vt.normalize(e,Xxe);return vt.abs(n,n),n.x<=n.y?t=vt.clone(vt.UNIT_X,t):t=vt.clone(vt.UNIT_Y,t),t};vt.equals=function(e,t){return e===t||u(e)&&u(t)&&e.x===t.x&&e.y===t.y};vt.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]};vt.equalsEpsilon=function(e,t,n,i){return e===t||u(e)&&u(t)&&P.equalsEpsilon(e.x,t.x,n,i)&&P.equalsEpsilon(e.y,t.y,n,i)};vt.ZERO=Object.freeze(new vt(0,0));vt.ONE=Object.freeze(new vt(1,1));vt.UNIT_X=Object.freeze(new vt(1,0));vt.UNIT_Y=Object.freeze(new vt(0,1));vt.prototype.clone=function(e){return vt.clone(this,e)};vt.prototype.equals=function(e){return vt.equals(this,e)};vt.prototype.equalsEpsilon=function(e,t,n){return vt.equalsEpsilon(this,e,t,n)};vt.prototype.toString=function(){return`(${this.x}, ${this.y})`};var H=vt;var Kxe=new h,Zxe=new h;function Jxe(e,t,n,i,o){let r=e.x,s=e.y,a=e.z,c=t.x,l=t.y,f=t.z,d=r*r*c*c,p=s*s*l*l,g=a*a*f*f,m=d+p+g,A=Math.sqrt(1/m),x=h.multiplyByScalar(e,A,Kxe);if(m<i)return isFinite(A)?h.clone(x,o):void 0;let C=n.x,T=n.y,E=n.z,S=Zxe;S.x=x.x*C*2,S.y=x.y*T*2,S.z=x.z*E*2;let D=(1-A)*h.magnitude(e)/(.5*h.magnitude(S)),w=0,R,O,L,N,_,b,v,I,B,F,k;do{D-=w,L=1/(1+D*C),N=1/(1+D*T),_=1/(1+D*E),b=L*L,v=N*N,I=_*_,B=b*L,F=v*N,k=I*_,R=d*b+p*v+g*I-1,O=d*B*C+p*F*T+g*k*E;let U=-2*O;w=R/U}while(Math.abs(R)>P.EPSILON12);return u(o)?(o.x=r*L,o.y=s*N,o.z=a*_,o):new h(r*L,s*N,a*_)}var c0=Jxe;function Kr(e,t,n){this.longitude=y(e,0),this.latitude=y(t,0),this.height=y(n,0)}Kr.fromRadians=function(e,t,n,i){return n=y(n,0),u(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Kr(e,t,n)};Kr.fromDegrees=function(e,t,n,i){return e=P.toRadians(e),t=P.toRadians(t),Kr.fromRadians(e,t,n,i)};var Qxe=new h,$xe=new h,eCe=new h,tCe=new h(1/6378137,1/6378137,1/6356752314245179e-9),nCe=new h(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),iCe=P.EPSILON1;Kr.fromCartesian=function(e,t,n){let i=u(t)?t.oneOverRadii:tCe,o=u(t)?t.oneOverRadiiSquared:nCe,r=u(t)?t._centerToleranceSquared:iCe,s=c0(e,i,o,r,$xe);if(!u(s))return;let a=h.multiplyComponents(s,o,Qxe);a=h.normalize(a,a);let c=h.subtract(e,s,eCe),l=Math.atan2(a.y,a.x),f=Math.asin(a.z),d=P.sign(h.dot(c,e))*h.magnitude(c);return u(n)?(n.longitude=l,n.latitude=f,n.height=d,n):new Kr(l,f,d)};Kr.toCartesian=function(e,t,n){return h.fromRadians(e.longitude,e.latitude,e.height,t,n)};Kr.clone=function(e,t){if(u(e))return u(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Kr(e.longitude,e.latitude,e.height)};Kr.equals=function(e,t){return e===t||u(e)&&u(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};Kr.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};Kr.ZERO=Object.freeze(new Kr(0,0,0));Kr.prototype.clone=function(e){return Kr.clone(this,e)};Kr.prototype.equals=function(e){return Kr.equals(this,e)};Kr.prototype.equalsEpsilon=function(e,t){return Kr.equalsEpsilon(this,e,t)};Kr.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};var he=Kr;function QK(e,t,n,i){t=y(t,0),n=y(n,0),i=y(i,0),e._radii=new h(t,n,i),e._radiiSquared=new h(t*t,n*n,i*i),e._radiiToTheFourth=new h(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new h(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new h(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=P.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function Zi(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,QK(this,e,t,n)}Object.defineProperties(Zi.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}}});Zi.clone=function(e,t){if(!u(e))return;let n=e._radii;return u(t)?(h.clone(n,t._radii),h.clone(e._radiiSquared,t._radiiSquared),h.clone(e._radiiToTheFourth,t._radiiToTheFourth),h.clone(e._oneOverRadii,t._oneOverRadii),h.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new Zi(n.x,n.y,n.z)};Zi.fromCartesian3=function(e,t){return u(t)||(t=new Zi),u(e)&&QK(t,e.x,e.y,e.z),t};Zi.WGS84=Object.freeze(new Zi(6378137,6378137,6356752314245179e-9));Zi.UNIT_SPHERE=Object.freeze(new Zi(1,1,1));Zi.MOON=Object.freeze(new Zi(P.LUNAR_RADIUS,P.LUNAR_RADIUS,P.LUNAR_RADIUS));Zi.prototype.clone=function(e){return Zi.clone(this,e)};Zi.packedLength=h.packedLength;Zi.pack=function(e,t,n){return n=y(n,0),h.pack(e._radii,t,n),t};Zi.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t);return Zi.fromCartesian3(i,n)};Zi.prototype.geocentricSurfaceNormal=h.normalize;Zi.prototype.geodeticSurfaceNormalCartographic=function(e,t){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 u(t)||(t=new h),t.x=r,t.y=s,t.z=a,h.normalize(t,t)};Zi.prototype.geodeticSurfaceNormal=function(e,t){if(!h.equalsEpsilon(e,h.ZERO,P.EPSILON14))return u(t)||(t=new h),t=h.multiplyComponents(e,this._oneOverRadiiSquared,t),h.normalize(t,t)};var oCe=new h,rCe=new h;Zi.prototype.cartographicToCartesian=function(e,t){let n=oCe,i=rCe;this.geodeticSurfaceNormalCartographic(e,n),h.multiplyComponents(this._radiiSquared,n,i);let o=Math.sqrt(h.dot(n,i));return h.divideByScalar(i,o,i),h.multiplyByScalar(n,e.height,n),u(t)||(t=new h),h.add(i,n,t)};Zi.prototype.cartographicArrayToCartesianArray=function(e,t){let n=e.length;u(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 sCe=new h,aCe=new h,cCe=new h;Zi.prototype.cartesianToCartographic=function(e,t){let n=this.scaleToGeodeticSurface(e,aCe);if(!u(n))return;let i=this.geodeticSurfaceNormal(n,sCe),o=h.subtract(e,n,cCe),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=P.sign(h.dot(o,e))*h.magnitude(o);return u(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new he(r,s,a)};Zi.prototype.cartesianArrayToCartographicArray=function(e,t){let n=e.length;u(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};Zi.prototype.scaleToGeodeticSurface=function(e,t){return c0(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};Zi.prototype.scaleToGeocentricSurface=function(e,t){u(t)||(t=new h);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 h.multiplyByScalar(e,s,t)};Zi.prototype.transformPositionToScaledSpace=function(e,t){return u(t)||(t=new h),h.multiplyComponents(e,this._oneOverRadii,t)};Zi.prototype.transformPositionFromScaledSpace=function(e,t){return u(t)||(t=new h),h.multiplyComponents(e,this._radii,t)};Zi.prototype.equals=function(e){return this===e||u(e)&&h.equals(this._radii,e._radii)};Zi.prototype.toString=function(){return this._radii.toString()};Zi.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){t=y(t,0);let i=this._squaredXOverSquaredZ;if(u(n)||(n=new h),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};var lCe=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],uCe=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function JK(e,t,n){let i=.5*(t+e),o=.5*(t-e),r=0;for(let s=0;s<5;s++){let a=o*lCe[s];r+=uCe[s]*(n(i+a)+n(i-a))}return r*=o,r}Zi.prototype.surfaceArea=function(e){let t=e.west,n=e.east,i=e.south,o=e.north;for(;n<t;)n+=P.TWO_PI;let r=this._radiiSquared,s=r.x,a=r.y,c=r.z,l=s*a;return JK(i,o,function(f){let d=Math.cos(f),p=Math.sin(f);return Math.cos(f)*JK(t,n,function(g){let m=Math.cos(g),A=Math.sin(g);return Math.sqrt(l*p*p+c*(a*m*m+s*A*A)*d*d)})})};var ie=Zi;function A3(e){this._ellipsoid=y(e,ie.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(A3.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});A3.prototype.project=function(e,t){let n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return u(t)?(t.x=i,t.y=o,t.z=r,t):new h(i,o,r)};A3.prototype.unproject=function(e,t){let n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return u(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};var Ei=A3;var fCe={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Qt=Object.freeze(fCe);function Fn(e,t,n,i){this.west=y(e,0),this.south=y(t,0),this.east=y(n,0),this.north=y(i,0)}Object.defineProperties(Fn.prototype,{width:{get:function(){return Fn.computeWidth(this)}},height:{get:function(){return Fn.computeHeight(this)}}});Fn.packedLength=4;Fn.pack=function(e,t,n){return n=y(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};Fn.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Fn),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};Fn.computeWidth=function(e){let t=e.east,n=e.west;return t<n&&(t+=P.TWO_PI),t-n};Fn.computeHeight=function(e){return e.north-e.south};Fn.fromDegrees=function(e,t,n,i,o){return e=P.toRadians(y(e,0)),t=P.toRadians(y(t,0)),n=P.toRadians(y(n,0)),i=P.toRadians(y(i,0)),u(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new Fn(e,t,n,i)};Fn.fromRadians=function(e,t,n,i,o){return u(o)?(o.west=y(e,0),o.south=y(t,0),o.east=y(n,0),o.north=y(i,0),o):new Fn(e,t,n,i)};Fn.fromCartographicArray=function(e,t){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 c=0,l=e.length;c<l;c++){let f=e[c];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 d=f.longitude>=0?f.longitude:f.longitude+P.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}return i-n>r-o&&(n=o,i=r,i>P.PI&&(i=i-P.TWO_PI),n>P.PI&&(n=n-P.TWO_PI)),u(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new Fn(n,s,i,a)};Fn.fromCartesianArray=function(e,t,n){t=y(t,ie.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let l=0,f=e.length;l<f;l++){let d=t.cartesianToCartographic(e[l]);i=Math.min(i,d.longitude),o=Math.max(o,d.longitude),a=Math.min(a,d.latitude),c=Math.max(c,d.latitude);let p=d.longitude>=0?d.longitude:d.longitude+P.TWO_PI;r=Math.min(r,p),s=Math.max(s,p)}return o-i>s-r&&(i=r,o=s,o>P.PI&&(o=o-P.TWO_PI),i>P.PI&&(i=i-P.TWO_PI)),u(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new Fn(i,a,o,c)};Fn.clone=function(e,t){if(u(e))return u(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new Fn(e.west,e.south,e.east,e.north)};Fn.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(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};Fn.prototype.clone=function(e){return Fn.clone(this,e)};Fn.prototype.equals=function(e){return Fn.equals(this,e)};Fn.equals=function(e,t){return e===t||u(e)&&u(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};Fn.prototype.equalsEpsilon=function(e,t){return Fn.equalsEpsilon(this,e,t)};Fn.validate=function(e){};Fn.southwest=function(e,t){return u(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new he(e.west,e.south)};Fn.northwest=function(e,t){return u(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new he(e.west,e.north)};Fn.northeast=function(e,t){return u(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new he(e.east,e.north)};Fn.southeast=function(e,t){return u(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new he(e.east,e.south)};Fn.center=function(e,t){let n=e.east,i=e.west;n<i&&(n+=P.TWO_PI);let o=P.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return u(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new he(o,r)};Fn.intersection=function(e,t,n){let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=P.TWO_PI:r<s&&i>0&&(r+=P.TWO_PI),i<o&&s<0?s+=P.TWO_PI:r<s&&o<0&&(o+=P.TWO_PI);let a=P.negativePiToPi(Math.max(o,s)),c=P.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&c<=a)return;let l=Math.max(e.south,t.south),f=Math.min(e.north,t.north);if(!(l>=f))return u(n)?(n.west=a,n.south=l,n.east=c,n.north=f,n):new Fn(a,l,c,f)};Fn.simpleIntersection=function(e,t,n){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 u(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new Fn(i,o,r,s)};Fn.union=function(e,t,n){u(n)||(n=new Fn);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=P.TWO_PI:r<s&&i>0&&(r+=P.TWO_PI),i<o&&s<0?s+=P.TWO_PI:r<s&&o<0&&(o+=P.TWO_PI);let a=P.negativePiToPi(Math.min(o,s)),c=P.negativePiToPi(Math.max(i,r));return n.west=a,n.south=Math.min(e.south,t.south),n.east=c,n.north=Math.max(e.north,t.north),n};Fn.expand=function(e,t,n){return u(n)||(n=new Fn),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};Fn.contains=function(e,t){let n=t.longitude,i=t.latitude,o=e.west,r=e.east;return r<o&&(r+=P.TWO_PI,n<0&&(n+=P.TWO_PI)),(n>o||P.equalsEpsilon(n,o,P.EPSILON14))&&(n<r||P.equalsEpsilon(n,r,P.EPSILON14))&&i>=e.south&&i<=e.north};var dCe=new he;Fn.subsample=function(e,t,n,i){t=y(t,ie.WGS84),n=y(n,0),u(i)||(i=[]);let o=0,r=e.north,s=e.south,a=e.east,c=e.west,l=dCe;l.height=n,l.longitude=c,l.latitude=r,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=a,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.latitude=s,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=c,i[o]=t.cartographicToCartesian(l,i[o]),o++,r<0?l.latitude=r:s>0?l.latitude=s:l.latitude=0;for(let f=1;f<8;++f)l.longitude=-Math.PI+f*P.PI_OVER_TWO,Fn.contains(e,l)&&(i[o]=t.cartographicToCartesian(l,i[o]),o++);return l.latitude===0&&(l.longitude=c,i[o]=t.cartographicToCartesian(l,i[o]),o++,l.longitude=a,i[o]=t.cartographicToCartesian(l,i[o]),o++),i.length=o,i};Fn.subsection=function(e,t,n,i,o,r){if(u(r)||(r=new Fn),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=P.TWO_PI+e.east-e.west;r.west=P.negativePiToPi(e.west+t*a),r.east=P.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};Fn.MAX_VALUE=Object.freeze(new Fn(-Math.PI,-P.PI_OVER_TWO,Math.PI,P.PI_OVER_TWO));var ce=Fn;function Cr(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.width=y(n,0),this.height=y(i,0)}Cr.packedLength=4;Cr.pack=function(e,t,n){return n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};Cr.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Cr),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};Cr.fromPoints=function(e,t){if(u(t)||(t=new Cr),!u(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 c=e[a],l=c.x,f=c.y;i=Math.min(l,i),r=Math.max(l,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 hCe=new Ei,mCe=new he,pCe=new he;Cr.fromRectangle=function(e,t,n){if(u(n)||(n=new Cr),!u(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;t=y(t,hCe);let i=t.project(ce.southwest(e,mCe)),o=t.project(ce.northeast(e,pCe));return H.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};Cr.clone=function(e,t){if(u(e))return u(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new Cr(e.x,e.y,e.width,e.height)};Cr.union=function(e,t,n){u(n)||(n=new Cr);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};Cr.expand=function(e,t,n){n=Cr.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};Cr.intersect=function(e,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?Qt.OUTSIDE:Qt.INTERSECTING};Cr.equals=function(e,t){return e===t||u(e)&&u(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};Cr.prototype.clone=function(e){return Cr.clone(this,e)};Cr.prototype.intersect=function(e){return Cr.intersect(this,e)};Cr.prototype.equals=function(e){return Cr.equals(this,e)};var Ye=Cr;var oa={POINTS:ee.POINTS,LINES:ee.LINES,LINE_LOOP:ee.LINE_LOOP,LINE_STRIP:ee.LINE_STRIP,TRIANGLES:ee.TRIANGLES,TRIANGLE_STRIP:ee.TRIANGLE_STRIP,TRIANGLE_FAN:ee.TRIANGLE_FAN};oa.isLines=function(e){return e===oa.LINES||e===oa.LINE_LOOP||e===oa.LINE_STRIP};oa.isTriangles=function(e){return e===oa.TRIANGLES||e===oa.TRIANGLE_STRIP||e===oa.TRIANGLE_FAN};oa.validate=function(e){return e===oa.POINTS||e===oa.LINES||e===oa.LINE_LOOP||e===oa.LINE_STRIP||e===oa.TRIANGLES||e===oa.TRIANGLE_STRIP||e===oa.TRIANGLE_FAN};var Me=Object.freeze(oa);var l0=`in vec4 position;
in vec2 textureCoordinates;

out vec2 v_textureCoordinates;

void main() 
{
    gl_Position = position;
    v_textureCoordinates = textureCoordinates;
}
`;var dr={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 WS(e){e=y(e,y.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=y(e.primitiveType,Me.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=y(e.offset,0),this._instanceCount=y(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._flags=0,this.cull=y(e.cull,!0),this.occlude=y(e.occlude,!0),this.executeInClosestFrustum=y(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.castShadows=y(e.castShadows,!1),this.receiveShadows=y(e.receiveShadows,!1),this.pickOnly=y(e.pickOnly,!1),this.depthForTranslucentClassification=y(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Ia(e,t){return(e._flags&t)===t}function z_(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(WS.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 Ia(this,dr.CULL)},set:function(e){Ia(this,dr.CULL)!==e&&(z_(this,dr.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Ia(this,dr.OCCLUDE)},set:function(e){Ia(this,dr.OCCLUDE)!==e&&(z_(this,dr.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 Ia(this,dr.CAST_SHADOWS)},set:function(e){Ia(this,dr.CAST_SHADOWS)!==e&&(z_(this,dr.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return Ia(this,dr.RECEIVE_SHADOWS)},set:function(e){Ia(this,dr.RECEIVE_SHADOWS)!==e&&(z_(this,dr.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 Ia(this,dr.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){Ia(this,dr.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(z_(this,dr.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 Ia(this,dr.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){Ia(this,dr.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(z_(this,dr.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)}},pickOnly:{get:function(){return Ia(this,dr.PICK_ONLY)},set:function(e){Ia(this,dr.PICK_ONLY)!==e&&(z_(this,dr.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Ia(this,dr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){Ia(this,dr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(z_(this,dr.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});WS.shallowClone=function(e,t){if(u(e))return u(t)||(t=new WS),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._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t};WS.prototype.execute=function(e,t){e.draw(this,t)};var tt=WS;var bi={UNSIGNED_BYTE:ee.UNSIGNED_BYTE,UNSIGNED_SHORT:ee.UNSIGNED_SHORT,UNSIGNED_INT:ee.UNSIGNED_INT,FLOAT:ee.FLOAT,HALF_FLOAT:ee.HALF_FLOAT_OES,UNSIGNED_INT_24_8:ee.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:ee.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:ee.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:ee.UNSIGNED_SHORT_5_6_5};bi.toWebGLConstant=function(e,t){switch(e){case bi.UNSIGNED_BYTE:return ee.UNSIGNED_BYTE;case bi.UNSIGNED_SHORT:return ee.UNSIGNED_SHORT;case bi.UNSIGNED_INT:return ee.UNSIGNED_INT;case bi.FLOAT:return ee.FLOAT;case bi.HALF_FLOAT:return t.webgl2?ee.HALF_FLOAT:ee.HALF_FLOAT_OES;case bi.UNSIGNED_INT_24_8:return ee.UNSIGNED_INT_24_8;case bi.UNSIGNED_SHORT_4_4_4_4:return ee.UNSIGNED_SHORT_4_4_4_4;case bi.UNSIGNED_SHORT_5_5_5_1:return ee.UNSIGNED_SHORT_5_5_5_1;case bi.UNSIGNED_SHORT_5_6_5:return bi.UNSIGNED_SHORT_5_6_5}};bi.isPacked=function(e){return e===bi.UNSIGNED_INT_24_8||e===bi.UNSIGNED_SHORT_4_4_4_4||e===bi.UNSIGNED_SHORT_5_5_5_1||e===bi.UNSIGNED_SHORT_5_6_5};bi.sizeInBytes=function(e){switch(e){case bi.UNSIGNED_BYTE:return 1;case bi.UNSIGNED_SHORT:case bi.UNSIGNED_SHORT_4_4_4_4:case bi.UNSIGNED_SHORT_5_5_5_1:case bi.UNSIGNED_SHORT_5_6_5:case bi.HALF_FLOAT:return 2;case bi.UNSIGNED_INT:case bi.FLOAT:case bi.UNSIGNED_INT_24_8:return 4}};bi.validate=function(e){return e===bi.UNSIGNED_BYTE||e===bi.UNSIGNED_SHORT||e===bi.UNSIGNED_INT||e===bi.FLOAT||e===bi.HALF_FLOAT||e===bi.UNSIGNED_INT_24_8||e===bi.UNSIGNED_SHORT_4_4_4_4||e===bi.UNSIGNED_SHORT_5_5_5_1||e===bi.UNSIGNED_SHORT_5_6_5};var Xe=Object.freeze(bi);var ot={DEPTH_COMPONENT:ee.DEPTH_COMPONENT,DEPTH_STENCIL:ee.DEPTH_STENCIL,ALPHA:ee.ALPHA,RED:ee.RED,RG:ee.RG,RGB:ee.RGB,RGBA:ee.RGBA,LUMINANCE:ee.LUMINANCE,LUMINANCE_ALPHA:ee.LUMINANCE_ALPHA,RGB_DXT1:ee.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:ee.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:ee.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:ee.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:ee.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:ee.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:ee.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:ee.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:ee.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:ee.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:ee.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:ee.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:ee.COMPRESSED_RGBA_BPTC_UNORM};ot.componentsLength=function(e){switch(e){case ot.RGB:return 3;case ot.RGBA:return 4;case ot.LUMINANCE_ALPHA:case ot.RG:return 2;case ot.ALPHA:case ot.RED:case ot.LUMINANCE:return 1;default:return 1}};ot.validate=function(e){return e===ot.DEPTH_COMPONENT||e===ot.DEPTH_STENCIL||e===ot.ALPHA||e===ot.RED||e===ot.RG||e===ot.RGB||e===ot.RGBA||e===ot.LUMINANCE||e===ot.LUMINANCE_ALPHA||e===ot.RGB_DXT1||e===ot.RGBA_DXT1||e===ot.RGBA_DXT3||e===ot.RGBA_DXT5||e===ot.RGB_PVRTC_4BPPV1||e===ot.RGB_PVRTC_2BPPV1||e===ot.RGBA_PVRTC_4BPPV1||e===ot.RGBA_PVRTC_2BPPV1||e===ot.RGBA_ASTC||e===ot.RGB_ETC1||e===ot.RGB8_ETC2||e===ot.RGBA8_ETC2_EAC||e===ot.RGBA_BC7};ot.isColorFormat=function(e){return e===ot.ALPHA||e===ot.RGB||e===ot.RGBA||e===ot.LUMINANCE||e===ot.LUMINANCE_ALPHA};ot.isDepthFormat=function(e){return e===ot.DEPTH_COMPONENT||e===ot.DEPTH_STENCIL};ot.isCompressedFormat=function(e){return e===ot.RGB_DXT1||e===ot.RGBA_DXT1||e===ot.RGBA_DXT3||e===ot.RGBA_DXT5||e===ot.RGB_PVRTC_4BPPV1||e===ot.RGB_PVRTC_2BPPV1||e===ot.RGBA_PVRTC_4BPPV1||e===ot.RGBA_PVRTC_2BPPV1||e===ot.RGBA_ASTC||e===ot.RGB_ETC1||e===ot.RGB8_ETC2||e===ot.RGBA8_ETC2_EAC||e===ot.RGBA_BC7};ot.isDXTFormat=function(e){return e===ot.RGB_DXT1||e===ot.RGBA_DXT1||e===ot.RGBA_DXT3||e===ot.RGBA_DXT5};ot.isPVRTCFormat=function(e){return e===ot.RGB_PVRTC_4BPPV1||e===ot.RGB_PVRTC_2BPPV1||e===ot.RGBA_PVRTC_4BPPV1||e===ot.RGBA_PVRTC_2BPPV1};ot.isASTCFormat=function(e){return e===ot.RGBA_ASTC};ot.isETC1Format=function(e){return e===ot.RGB_ETC1};ot.isETC2Format=function(e){return e===ot.RGB8_ETC2||e===ot.RGBA8_ETC2_EAC};ot.isBC7Format=function(e){return e===ot.RGBA_BC7};ot.compressedTextureSizeInBytes=function(e,t,n){switch(e){case ot.RGB_DXT1:case ot.RGBA_DXT1:case ot.RGB_ETC1:case ot.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case ot.RGBA_DXT3:case ot.RGBA_DXT5:case ot.RGBA_ASTC:case ot.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case ot.RGB_PVRTC_4BPPV1:case ot.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case ot.RGB_PVRTC_2BPPV1:case ot.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case ot.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};ot.textureSizeInBytes=function(e,t,n,i){let o=ot.componentsLength(e);return Xe.isPacked(t)&&(o=1),o*Xe.sizeInBytes(t)*n*i};ot.alignmentInBytes=function(e,t,n){let i=ot.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};ot.createTypedArray=function(e,t,n,i){let o,r=Xe.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===Xe.FLOAT?o=Float32Array:o=Uint32Array;let s=ot.componentsLength(e)*n*i;return new o(s)};ot.flipY=function(e,t,n,i,o){if(o===1)return e;let r=ot.createTypedArray(t,n,i,o),s=ot.componentsLength(t),a=i*s;for(let c=0;c<o;++c){let l=c*i*s,f=(o-c-1)*i*s;for(let d=0;d<a;++d)r[f+d]=e[l+d]}return r};ot.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===ot.DEPTH_STENCIL)return ee.DEPTH24_STENCIL8;if(e===ot.DEPTH_COMPONENT){if(t===Xe.UNSIGNED_SHORT)return ee.DEPTH_COMPONENT16;if(t===Xe.UNSIGNED_INT)return ee.DEPTH_COMPONENT24}if(t===Xe.FLOAT)switch(e){case ot.RGBA:return ee.RGBA32F;case ot.RGB:return ee.RGB32F;case ot.RG:return ee.RG32F;case ot.RED:return ee.R32F}if(t===Xe.HALF_FLOAT)switch(e){case ot.RGBA:return ee.RGBA16F;case ot.RGB:return ee.RGB16F;case ot.RG:return ee.RG16F;case ot.RED:return ee.R16F}return e};var rt=Object.freeze(ot);var hr={_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(hr,{maximumCombinedTextureImageUnits:{get:function(){return hr._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return hr._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return hr._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return hr._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return hr._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return hr._maximumTextureSize}},maximumVaryingVectors:{get:function(){return hr._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return hr._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return hr._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return hr._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return hr._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return hr._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return hr._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return hr._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return hr._maximumViewportWidth}},maximumViewportHeight:{get:function(){return hr._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return hr._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return hr._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return hr._maximumColorAttachments}},maximumSamples:{get:function(){return hr._maximumSamples}},highpFloatSupported:{get:function(){return hr._highpFloatSupported}},highpIntSupported:{get:function(){return hr._highpIntSupported}}});var Ft=hr;function oG(e,t,n){let i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function x3(e,t,n){let i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Hf(e){e=y(e,y.EMPTY_OBJECT);let n=e.context._gl,i=Ft.maximumColorAttachments;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=y(e.destroyAttachments,!0);let o=u(e.depthTexture)||u(e.depthRenderbuffer),r=u(e.depthStencilTexture)||u(e.depthStencilRenderbuffer);this._bind();let s,a,c,l,f;if(u(e.colorTextures)){let d=e.colorTextures;for(l=this._colorTextures.length=this._activeColorAttachments.length=d.length,c=0;c<l;++c)s=d[c],f=this._gl.COLOR_ATTACHMENT0+c,oG(this,f,s),this._activeColorAttachments[c]=f,this._colorTextures[c]=s}if(u(e.colorRenderbuffers)){let d=e.colorRenderbuffers;for(l=this._colorRenderbuffers.length=this._activeColorAttachments.length=d.length,c=0;c<l;++c)a=d[c],f=this._gl.COLOR_ATTACHMENT0+c,x3(this,f,a),this._activeColorAttachments[c]=f,this._colorRenderbuffers[c]=a}u(e.depthTexture)&&(s=e.depthTexture,oG(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s),u(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,x3(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),u(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,x3(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),u(e.depthStencilTexture)&&(s=e.depthStencilTexture,oG(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s),u(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,x3(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(Hf.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)}}});Hf.prototype._bind=function(){let e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};Hf.prototype._unBind=function(){let e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};Hf.prototype.bindDraw=function(){let e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};Hf.prototype.bindRead=function(){let e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};Hf.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};Hf.prototype.getColorTexture=function(e){return this._colorTextures[e]};Hf.prototype.getColorRenderbuffer=function(e){return this._colorRenderbuffers[e]};Hf.prototype.isDestroyed=function(){return!1};Hf.prototype.destroy=function(){if(this.destroyAttachments){let e=0,t=this._colorTextures,n=t.length;for(;e<n;++e){let o=t[e];u(o)&&o.destroy()}let i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){let o=i[e];u(o)&&o.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),le(this)};var Ns=Hf;var C3={CLOCKWISE:ee.CW,COUNTER_CLOCKWISE:ee.CCW};C3.validate=function(e){return e===C3.CLOCKWISE||e===C3.COUNTER_CLOCKWISE};var Zr=Object.freeze(C3);function $K(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]=$K(e[t]));return Object.freeze(e)}var rG=$K;function dh(e){let t=y(e,y.EMPTY_OBJECT),n=y(t.cull,y.EMPTY_OBJECT),i=y(t.polygonOffset,y.EMPTY_OBJECT),o=y(t.scissorTest,y.EMPTY_OBJECT),r=y(o.rectangle,y.EMPTY_OBJECT),s=y(t.depthRange,y.EMPTY_OBJECT),a=y(t.depthTest,y.EMPTY_OBJECT),c=y(t.colorMask,y.EMPTY_OBJECT),l=y(t.blending,y.EMPTY_OBJECT),f=y(l.color,y.EMPTY_OBJECT),d=y(t.stencilTest,y.EMPTY_OBJECT),p=y(d.frontOperation,y.EMPTY_OBJECT),g=y(d.backOperation,y.EMPTY_OBJECT),m=y(t.sampleCoverage,y.EMPTY_OBJECT),A=t.viewport;this.frontFace=y(t.frontFace,Zr.COUNTER_CLOCKWISE),this.cull={enabled:y(n.enabled,!1),face:y(n.face,ee.BACK)},this.lineWidth=y(t.lineWidth,1),this.polygonOffset={enabled:y(i.enabled,!1),factor:y(i.factor,0),units:y(i.units,0)},this.scissorTest={enabled:y(o.enabled,!1),rectangle:Ye.clone(r)},this.depthRange={near:y(s.near,0),far:y(s.far,1)},this.depthTest={enabled:y(a.enabled,!1),func:y(a.func,ee.LESS)},this.colorMask={red:y(c.red,!0),green:y(c.green,!0),blue:y(c.blue,!0),alpha:y(c.alpha,!0)},this.depthMask=y(t.depthMask,!0),this.stencilMask=y(t.stencilMask,-1),this.blending={enabled:y(l.enabled,!1),color:new z(y(f.red,0),y(f.green,0),y(f.blue,0),y(f.alpha,0)),equationRgb:y(l.equationRgb,ee.FUNC_ADD),equationAlpha:y(l.equationAlpha,ee.FUNC_ADD),functionSourceRgb:y(l.functionSourceRgb,ee.ONE),functionSourceAlpha:y(l.functionSourceAlpha,ee.ONE),functionDestinationRgb:y(l.functionDestinationRgb,ee.ZERO),functionDestinationAlpha:y(l.functionDestinationAlpha,ee.ZERO)},this.stencilTest={enabled:y(d.enabled,!1),frontFunction:y(d.frontFunction,ee.ALWAYS),backFunction:y(d.backFunction,ee.ALWAYS),reference:y(d.reference,0),mask:y(d.mask,-1),frontOperation:{fail:y(p.fail,ee.KEEP),zFail:y(p.zFail,ee.KEEP),zPass:y(p.zPass,ee.KEEP)},backOperation:{fail:y(g.fail,ee.KEEP),zFail:y(g.zFail,ee.KEEP),zPass:y(g.zPass,ee.KEEP)}},this.sampleCoverage={enabled:y(m.enabled,!1),value:y(m.value,1),invert:y(m.invert,!1)},this.viewport=u(A)?new Ye(A.x,A.y,A.width,A.height):void 0,this.id=0,this._applyFunctions=[]}var _Ce=0,fh={};dh.fromCache=function(e){let t=JSON.stringify(e),n=fh[t];if(u(n))return++n.referenceCount,n.state;let i=new dh(e),o=JSON.stringify(i);return n=fh[o],u(n)||(i.id=_Ce++,n={referenceCount:0,state:i},fh[o]=n),++n.referenceCount,fh[t]={referenceCount:1,state:n.state},n.state};dh.removeFromCache=function(e){let t=new dh(e),n=JSON.stringify(t),i=fh[n],o=JSON.stringify(e),r=fh[o];u(r)&&(--r.referenceCount,r.referenceCount===0&&(delete fh[o],u(i)&&--i.referenceCount)),u(i)&&i.referenceCount===0&&delete fh[n]};dh.getCache=function(){return fh};dh.clearCache=function(){fh={}};function u0(e,t,n){n?e.enable(t):e.disable(t)}function eZ(e,t){e.frontFace(t.frontFace)}function tZ(e,t){let n=t.cull,i=n.enabled;u0(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function nZ(e,t){e.lineWidth(t.lineWidth)}function iZ(e,t){let n=t.polygonOffset,i=n.enabled;u0(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function oZ(e,t,n){let i=t.scissorTest,o=u(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(u0(e,e.SCISSOR_TEST,o),o){let r=u(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function rZ(e,t){let n=t.depthRange;e.depthRange(n.near,n.far)}function sZ(e,t){let n=t.depthTest,i=n.enabled;u0(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function aZ(e,t){let n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function cZ(e,t){e.depthMask(t.depthMask)}function lZ(e,t){e.stencilMask(t.stencilMask)}function gCe(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function uZ(e,t,n){let i=t.blending,o=u(n.blendingEnabled)?n.blendingEnabled:i.enabled;u0(e,e.BLEND,o),o&&(gCe(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function fZ(e,t){let n=t.stencilTest,i=n.enabled;if(u0(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 c=n.frontOperation,l=c.fail,f=c.zFail,d=c.zPass;e.stencilOpSeparate(e.FRONT,l,f,d);let p=n.backOperation,g=p.fail,m=p.zFail,A=p.zPass;e.stencilOpSeparate(e.BACK,g,m,A)}}function dZ(e,t){let n=t.sampleCoverage,i=n.enabled;u0(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}var yCe=new Ye;function hZ(e,t,n){let i=y(t.viewport,n.viewport);u(i)||(i=yCe,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)}dh.apply=function(e,t,n){eZ(e,t),tZ(e,t),nZ(e,t),iZ(e,t),rZ(e,t),sZ(e,t),aZ(e,t),cZ(e,t),lZ(e,t),fZ(e,t),dZ(e,t),oZ(e,t,n),uZ(e,t,n),hZ(e,t,n)};function ACe(e,t){let n=[];return e.frontFace!==t.frontFace&&n.push(eZ),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(tZ),e.lineWidth!==t.lineWidth&&n.push(nZ),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(iZ),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(rZ),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(sZ),(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(aZ),e.depthMask!==t.depthMask&&n.push(cZ),e.stencilMask!==t.stencilMask&&n.push(lZ),(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(fZ),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(dZ),n}dh.partialApply=function(e,t,n,i,o,r){if(t!==n){let f=n._applyFunctions[t.id];u(f)||(f=ACe(t,n),n._applyFunctions[t.id]=f);let d=f.length;for(let p=0;p<d;++p)f[p](e,n)}let s=u(i.scissorTest)?i.scissorTest:t.scissorTest,a=u(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&oZ(e,n,o);let c=u(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,l=u(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(c!==l||l&&t.blending!==n.blending)&&uZ(e,n,o),(t!==n||i!==o||i.context!==o.context)&&hZ(e,n,o)};dh.getState=function(e){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:Ye.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:z.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:u(e.viewport)?Ye.clone(e.viewport):void 0}};var Ue=dh;function Yt(e,t,n,i){this[0]=y(e,0),this[1]=y(n,0),this[2]=y(t,0),this[3]=y(i,0)}Yt.packedLength=4;Yt.pack=function(e,t,n){return n=y(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};Yt.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Yt),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};Yt.packArray=function(e,t){let n=e.length,i=n*4;u(t)?!Array.isArray(t)&&t.length!==i||t.length!==i&&(t.length=i):t=new Array(i);for(let o=0;o<n;++o)Yt.pack(e[o],t,o*4);return t};Yt.unpackArray=function(e,t){let n=e.length;u(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){let o=i/4;t[o]=Yt.unpack(e,i,t[o])}return t};Yt.clone=function(e,t){if(u(e))return u(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Yt(e[0],e[2],e[1],e[3])};Yt.fromArray=Yt.unpack;Yt.fromColumnMajorArray=function(e,t){return Yt.clone(e,t)};Yt.fromRowMajorArray=function(e,t){return u(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Yt(e[0],e[1],e[2],e[3])};Yt.fromScale=function(e,t){return u(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Yt(e.x,0,0,e.y)};Yt.fromUniformScale=function(e,t){return u(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Yt(e,0,0,e)};Yt.fromRotation=function(e,t){let n=Math.cos(e),i=Math.sin(e);return u(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Yt(n,-i,i,n)};Yt.toArray=function(e,t){return u(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]]};Yt.getElementIndex=function(e,t){return e*2+t};Yt.getColumn=function(e,t,n){let i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};Yt.setColumn=function(e,t,n,i){i=Yt.clone(e,i);let o=t*2;return i[o]=n.x,i[o+1]=n.y,i};Yt.getRow=function(e,t,n){let i=e[t],o=e[t+2];return n.x=i,n.y=o,n};Yt.setRow=function(e,t,n,i){return i=Yt.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};var xCe=new H;Yt.setScale=function(e,t,n){let i=Yt.getScale(e,xCe),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 CCe=new H;Yt.setUniformScale=function(e,t,n){let i=Yt.getScale(e,CCe),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 mZ=new H;Yt.getScale=function(e,t){return t.x=H.magnitude(H.fromElements(e[0],e[1],mZ)),t.y=H.magnitude(H.fromElements(e[2],e[3],mZ)),t};var pZ=new H;Yt.getMaximumScale=function(e){return Yt.getScale(e,pZ),H.maximumComponent(pZ)};var TCe=new H;Yt.setRotation=function(e,t,n){let i=Yt.getScale(e,TCe);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 ECe=new H;Yt.getRotation=function(e,t){let n=Yt.getScale(e,ECe);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};Yt.multiply=function(e,t,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};Yt.add=function(e,t,n){return 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};Yt.subtract=function(e,t,n){return 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};Yt.multiplyByVector=function(e,t,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};Yt.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Yt.multiplyByScale=function(e,t,n){return 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};Yt.multiplyByUniformScale=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Yt.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};Yt.transpose=function(e,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};Yt.abs=function(e,t){return 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};Yt.equals=function(e,t){return e===t||u(e)&&u(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]};Yt.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]};Yt.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(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};Yt.IDENTITY=Object.freeze(new Yt(1,0,0,1));Yt.ZERO=Object.freeze(new Yt(0,0,0,0));Yt.COLUMN0ROW0=0;Yt.COLUMN0ROW1=1;Yt.COLUMN1ROW0=2;Yt.COLUMN1ROW1=3;Object.defineProperties(Yt.prototype,{length:{get:function(){return Yt.packedLength}}});Yt.prototype.clone=function(e){return Yt.clone(this,e)};Yt.prototype.equals=function(e){return Yt.equals(this,e)};Yt.prototype.equalsEpsilon=function(e,t){return Yt.equalsEpsilon(this,e,t)};Yt.prototype.toString=function(){return`(${this[0]}, ${this[2]})
(${this[1]}, ${this[3]})`};var Ji=Yt;function bCe(e,t,n,i){switch(t.type){case e.FLOAT:return new _Z(e,t,n,i);case e.FLOAT_VEC2:return new gZ(e,t,n,i);case e.FLOAT_VEC3:return new yZ(e,t,n,i);case e.FLOAT_VEC4:return new AZ(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new sG(e,t,n,i);case e.INT:case e.BOOL:return new xZ(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new CZ(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new TZ(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new EZ(e,t,n,i);case e.FLOAT_MAT2:return new bZ(e,t,n,i);case e.FLOAT_MAT3:return new SZ(e,t,n,i);case e.FLOAT_MAT4:return new DZ(e,t,n,i);default:throw new ue(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function _Z(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}_Z.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function gZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}gZ.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 yZ(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}yZ.prototype.set=function(){let e=this.value;u(e.red)?z.equals(e,this._value)||(this._value=z.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue)):u(e.x)&&(h.equals(e,this._value)||(this._value=h.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z)))};function AZ(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}AZ.prototype.set=function(){let e=this.value;u(e.red)?z.equals(e,this._value)||(this._value=z.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha)):u(e.x)&&(oe.equals(e,this._value)||(this._value=oe.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w)))};function sG(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}sG.prototype.set=function(){let e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);let t=this.value;e.bindTexture(t._target,t._texture)};sG.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function xZ(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}xZ.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function CZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}CZ.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 TZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new h,this._gl=e,this._location=i}TZ.prototype.set=function(){let e=this.value;h.equals(e,this._value)||(h.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function EZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new oe,this._gl=e,this._location=i}EZ.prototype.set=function(){let e=this.value;oe.equals(e,this._value)||(oe.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};var SCe=new Float32Array(4);function bZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new Ji,this._gl=e,this._location=i}bZ.prototype.set=function(){if(!Ji.equalsArray(this.value,this._value,0)){Ji.clone(this.value,this._value);let e=Ji.toArray(this.value,SCe);this._gl.uniformMatrix2fv(this._location,!1,e)}};var DCe=new Float32Array(9);function SZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new Z,this._gl=e,this._location=i}SZ.prototype.set=function(){if(!Z.equalsArray(this.value,this._value,0)){Z.clone(this.value,this._value);let e=Z.toArray(this.value,DCe);this._gl.uniformMatrix3fv(this._location,!1,e)}};var vCe=new Float32Array(16);function DZ(e,t,n,i){this.name=n,this.value=void 0,this._value=new M,this._gl=e,this._location=i}DZ.prototype.set=function(){if(!M.equalsArray(this.value,this._value,0)){M.clone(this.value,this._value);let e=M.toArray(this.value,vCe);this._gl.uniformMatrix4fv(this._location,!1,e)}};var jS=bCe;function wCe(e,t,n,i){switch(t.type){case e.FLOAT:return new vZ(e,t,n,i);case e.FLOAT_VEC2:return new wZ(e,t,n,i);case e.FLOAT_VEC3:return new IZ(e,t,n,i);case e.FLOAT_VEC4:return new PZ(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new aG(e,t,n,i);case e.INT:case e.BOOL:return new OZ(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new RZ(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new BZ(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new MZ(e,t,n,i);case e.FLOAT_MAT2:return new LZ(e,t,n,i);case e.FLOAT_MAT3:return new NZ(e,t,n,i);case e.FLOAT_MAT4:return new FZ(e,t,n,i);default:throw new ue(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function vZ(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]}vZ.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 wZ(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]}wZ.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 IZ(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]}IZ.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];u(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):u(s.x)&&(h.equalsArray(s,n,o)||(h.pack(s,n,o),i=!0)),o+=3}i&&this._gl.uniform3fv(this._location,n)};function PZ(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]}PZ.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];u(s.red)?z.equalsArray(s,n,o)||(z.pack(s,n,o),i=!0):u(s.x)&&(oe.equalsArray(s,n,o)||(oe.pack(s,n,o),i=!0)),o+=4}i&&this._gl.uniform4fv(this._location,n)};function aG(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}aG.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)}};aG.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 OZ(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]}OZ.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 RZ(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]}RZ.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 BZ(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]}BZ.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+=3}i&&this._gl.uniform3iv(this._location,n)};function MZ(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]}MZ.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];oe.equalsArray(s,n,o)||(oe.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniform4iv(this._location,n)};function LZ(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]}LZ.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];Ji.equalsArray(s,n,o)||(Ji.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function NZ(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]}NZ.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];Z.equalsArray(s,n,o)||(Z.pack(s,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)};function FZ(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]}FZ.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];M.equalsArray(s,n,o)||(M.pack(s,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};var YS=wCe;var ICe=0;function Rm(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=PCe(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=ICe++}Rm.fromCache=function(e){return e=y(e,y.EMPTY_OBJECT),e.context.shaderCache.getShaderProgram(e)};Rm.replaceCache=function(e){return e=y(e,y.EMPTY_OBJECT),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(Rm.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return T3(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return T3(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return T3(this),this._uniformsByName}}});function VZ(e){let t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(u(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 PCe(e,t){let n={};if(!Ft.highpFloatSupported||!Ft.highpIntSupported){let i,o,r,s,a=VZ(e),c=VZ(t),l=a.length,f=c.length;for(i=0;i<l;i++)for(o=0;o<f;o++)if(a[i]===c[o]){r=a[i],s=`czm_mediump_${r}`;let d=new RegExp(`${r}\\b`,"g");t=t.replace(d,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}var hh="[Cesium WebGL] ";function OCe(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(u(a))for(let p in a)a.hasOwnProperty(p)&&e.bindAttribLocation(s,a[p],p);e.linkProgram(s);let c;if(e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(c=e.getShaderInfoLog(o),u(c)&&c.length>0&&console.log(`${hh}Vertex shader compile log: ${c}`),c=e.getShaderInfoLog(r),u(c)&&c.length>0&&console.log(`${hh}Fragment shader compile log: ${c}`),c=e.getProgramInfoLog(s),u(c)&&c.length>0&&console.log(`${hh}Shader program link log: ${c}`)),e.deleteShader(o),e.deleteShader(r),s;let l,f=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(c=e.getProgramInfoLog(s),console.error(`${hh}Shader program link log: ${c}`),d(o,"vertex"),d(r,"fragment"),l=`Program failed to link.  Link log: ${c}`):(c=e.getShaderInfoLog(o),console.error(`${hh}Vertex shader compile log: ${c}`),console.error(`${hh} Vertex shader source:
${n}`),l=`Vertex shader failed to compile.  Compile log: ${c}`):(c=e.getShaderInfoLog(r),console.error(`${hh}Fragment shader compile log: ${c}`),console.error(`${hh} Fragment shader source:
${i}`),l=`Fragment shader failed to compile.  Compile log: ${c}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new ue(l);function d(p,g){if(!u(f))return;let m=f.getTranslatedShaderSource(p);if(m===""){console.error(`${hh}${g} shader translation failed.`);return}console.error(`${hh}Translated ${g} shaderSource:
${m}`)}}function RCe(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 BCe(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),c="[0]",l=a.name.indexOf(c,a.name.length-c.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(l.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){let f=e.getUniformLocation(t,l);if(f!==null){let d=jS(e,a,l,f);n[l]=d,i.push(d),d._setSampler&&o.push(d)}}else{let f,d,p,g,m=l.indexOf("[");if(m>=0){if(f=n[l.slice(0,m)],!u(f))continue;d=f._locations,d.length<=1&&(p=f.value,g=e.getUniformLocation(t,l),g!==null&&(d.push(g),p.push(e.getUniform(t,g))))}else{d=[];for(let A=0;A<a.size;++A)g=e.getUniformLocation(t,`${l}[${A}]`),g!==null&&d.push(g);f=YS(e,a,l,d),n[l]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function MCe(e,t){let n=[],i=[];for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=o,a=e._duplicateUniformNames[s];u(a)&&(r.name=a,s=a);let c=Pm[s];u(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function LCe(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 T3(e){u(e._program)||UZ(e)}function UZ(e){let t=e._program,n=e._gl,i=OCe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=BCe(n,i),s=MCe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=RCe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=LCe(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,c,l,f){let d=e._vertexShaderText,p=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=c.replace(g," != ");try{UZ(e),l(e._program)}catch(m){e._vertexShaderText=d,e._fragmentShaderText=p;let x=/(?:Compile|Link) error: ([^]*)/.exec(m.message);f(x?x[1]:m.message)}})}Rm.prototype._bind=function(){T3(this),this._gl.useProgram(this._program)};Rm.prototype._setUniforms=function(e,t,n){let i,o;if(u(e)){let a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){let c=a[o];c.value=e[c.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,c=this._program;a.validateProgram(c)}};Rm.prototype.isDestroyed=function(){return!1};Rm.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Rm.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),le(this)};var Xt=Rm;function E3(e){this._context=e}var qS,NCe=new tt({primitiveType:Me.TRIANGLES}),FCe=new ii({color:new z(0,0,0,0)});function VCe(e,t){return new Ns({context:e,colorTextures:[t],destroyAttachments:!1})}function UCe(e,t){return Xt.fromCache({context:e,vertexShaderSource:l0,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function kCe(e,t){return(!u(qS)||qS.viewport.width!==e||qS.viewport.height!==t)&&(qS=Ue.fromCache({viewport:new Ye(0,0,e,t)})),qS}E3.prototype.execute=function(e){u(e.preExecute)&&e.preExecute(e);let t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=u(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=u(e.shaderProgram)?e.shaderProgram:UCe(o,e.fragmentShaderSource),a=VCe(o,t),c=kCe(n,i),l=e.uniformMap,f=FCe;f.framebuffer=a,f.renderState=c,f.execute(o);let d=NCe;d.vertexArray=r,d.renderState=c,d.shaderProgram=s,d.uniformMap=l,d.framebuffer=a,d.execute(o),a.destroy(),e.persists||(s.destroy(),u(e.vertexArray)&&r.destroy()),u(e.postExecute)&&e.postExecute(t)};E3.prototype.isDestroyed=function(){return!1};E3.prototype.destroy=function(){return le(this)};var XS=E3;var Sn={BYTE:ee.BYTE,UNSIGNED_BYTE:ee.UNSIGNED_BYTE,SHORT:ee.SHORT,UNSIGNED_SHORT:ee.UNSIGNED_SHORT,INT:ee.INT,UNSIGNED_INT:ee.UNSIGNED_INT,FLOAT:ee.FLOAT,DOUBLE:ee.DOUBLE};Sn.getSizeInBytes=function(e){switch(e){case Sn.BYTE:return Int8Array.BYTES_PER_ELEMENT;case Sn.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Sn.SHORT:return Int16Array.BYTES_PER_ELEMENT;case Sn.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Sn.INT:return Int32Array.BYTES_PER_ELEMENT;case Sn.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Sn.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case Sn.DOUBLE:return Float64Array.BYTES_PER_ELEMENT}};Sn.fromTypedArray=function(e){if(e instanceof Int8Array)return Sn.BYTE;if(e instanceof Uint8Array)return Sn.UNSIGNED_BYTE;if(e instanceof Int16Array)return Sn.SHORT;if(e instanceof Uint16Array)return Sn.UNSIGNED_SHORT;if(e instanceof Int32Array)return Sn.INT;if(e instanceof Uint32Array)return Sn.UNSIGNED_INT;if(e instanceof Float32Array)return Sn.FLOAT;if(e instanceof Float64Array)return Sn.DOUBLE};Sn.validate=function(e){return u(e)&&(e===Sn.BYTE||e===Sn.UNSIGNED_BYTE||e===Sn.SHORT||e===Sn.UNSIGNED_SHORT||e===Sn.INT||e===Sn.UNSIGNED_INT||e===Sn.FLOAT||e===Sn.DOUBLE)};Sn.createTypedArray=function(e,t){switch(e){case Sn.BYTE:return new Int8Array(t);case Sn.UNSIGNED_BYTE:return new Uint8Array(t);case Sn.SHORT:return new Int16Array(t);case Sn.UNSIGNED_SHORT:return new Uint16Array(t);case Sn.INT:return new Int32Array(t);case Sn.UNSIGNED_INT:return new Uint32Array(t);case Sn.FLOAT:return new Float32Array(t);case Sn.DOUBLE:return new Float64Array(t)}};Sn.createArrayBufferView=function(e,t,n,i){switch(n=y(n,0),i=y(i,(t.byteLength-n)/Sn.getSizeInBytes(e)),e){case Sn.BYTE:return new Int8Array(t,n,i);case Sn.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case Sn.SHORT:return new Int16Array(t,n,i);case Sn.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case Sn.INT:return new Int32Array(t,n,i);case Sn.UNSIGNED_INT:return new Uint32Array(t,n,i);case Sn.FLOAT:return new Float32Array(t,n,i);case Sn.DOUBLE:return new Float64Array(t,n,i)}};Sn.fromName=function(e){switch(e){case"BYTE":return Sn.BYTE;case"UNSIGNED_BYTE":return Sn.UNSIGNED_BYTE;case"SHORT":return Sn.SHORT;case"UNSIGNED_SHORT":return Sn.UNSIGNED_SHORT;case"INT":return Sn.INT;case"UNSIGNED_INT":return Sn.UNSIGNED_INT;case"FLOAT":return Sn.FLOAT;case"DOUBLE":return Sn.DOUBLE}};var q=Object.freeze(Sn);var kZ={};function KS(e,t){u(kZ[e])||(kZ[e]=!0,console.warn(y(t,e)))}KS.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.";KS.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined.  zIndex will be ignored";KS.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height.  heightReference will be ignored";KS.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight.  extrudedHeightReference will be ignored";var wt=KS;function zCe(e,t){wt(e,t)}var nr=zCe;var HCe={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},Nu=Object.freeze(HCe);function nt(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}var ZS=new h;nt.fromAxisAngle=function(e,t,n){let i=t/2,o=Math.sin(i);ZS=h.normalize(e,ZS);let r=ZS.x*o,s=ZS.y*o,a=ZS.z*o,c=Math.cos(i);return u(n)?(n.x=r,n.y=s,n.z=a,n.w=c,n):new nt(r,s,a,c)};var GCe=[1,2,0],WCe=new Array(3);nt.fromRotationMatrix=function(e,t){let n,i,o,r,s,a=e[Z.COLUMN0ROW0],c=e[Z.COLUMN1ROW1],l=e[Z.COLUMN2ROW2],f=a+c+l;if(f>0)n=Math.sqrt(f+1),s=.5*n,n=.5/n,i=(e[Z.COLUMN1ROW2]-e[Z.COLUMN2ROW1])*n,o=(e[Z.COLUMN2ROW0]-e[Z.COLUMN0ROW2])*n,r=(e[Z.COLUMN0ROW1]-e[Z.COLUMN1ROW0])*n;else{let d=GCe,p=0;c>a&&(p=1),l>a&&l>c&&(p=2);let g=d[p],m=d[g];n=Math.sqrt(e[Z.getElementIndex(p,p)]-e[Z.getElementIndex(g,g)]-e[Z.getElementIndex(m,m)]+1);let A=WCe;A[p]=.5*n,n=.5/n,s=(e[Z.getElementIndex(m,g)]-e[Z.getElementIndex(g,m)])*n,A[g]=(e[Z.getElementIndex(g,p)]+e[Z.getElementIndex(p,g)])*n,A[m]=(e[Z.getElementIndex(m,p)]+e[Z.getElementIndex(p,m)])*n,i=-A[0],o=-A[1],r=-A[2]}return u(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new nt(i,o,r,s)};var zZ=new nt,HZ=new nt,cG=new nt,GZ=new nt;nt.fromHeadingPitchRoll=function(e,t){return GZ=nt.fromAxisAngle(h.UNIT_X,e.roll,zZ),cG=nt.fromAxisAngle(h.UNIT_Y,-e.pitch,t),t=nt.multiply(cG,GZ,cG),HZ=nt.fromAxisAngle(h.UNIT_Z,-e.heading,zZ),nt.multiply(HZ,t,t)};var b3=new h,lG=new h,Gf=new nt,WZ=new nt,S3=new nt;nt.packedLength=4;nt.pack=function(e,t,n){return n=y(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=y(t,0),u(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,S3),nt.conjugate(S3,S3);for(let o=0,r=n-t+1;o<r;o++){let s=o*3;nt.unpack(e,(t+o)*4,Gf),nt.multiply(Gf,S3,Gf),Gf.w<0&&nt.negate(Gf,Gf),nt.computeAxis(Gf,b3);let a=nt.computeAngle(Gf);u(i)||(i=[]),i[s]=b3.x*a,i[s+1]=b3.y*a,i[s+2]=b3.z*a}};nt.unpackInterpolationResult=function(e,t,n,i,o){u(o)||(o=new nt),h.fromArray(e,0,lG);let r=h.magnitude(lG);return nt.unpack(t,i*4,WZ),r===0?nt.clone(nt.IDENTITY,Gf):nt.fromAxisAngle(lG,r,Gf),nt.multiply(Gf,WZ,o)};nt.clone=function(e,t){if(u(e))return u(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.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};nt.magnitudeSquared=function(e){return 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){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){let n=nt.magnitudeSquared(e);return t=nt.conjugate(e,t),nt.multiplyByScalar(t,1/n,t)};nt.add=function(e,t,n){return 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 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.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};nt.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};nt.multiply=function(e,t,n){let i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,c=t.y,l=t.z,f=t.w,d=s*a+i*f+o*l-r*c,p=s*c-i*l+o*f+r*a,g=s*l+i*c-o*a+r*f,m=s*f-i*a-o*c-r*l;return n.x=d,n.y=p,n.z=g,n.w=m,n};nt.multiplyByScalar=function(e,t,n){return 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 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){let n=e.w;if(Math.abs(n-1)<P.EPSILON6)return t.x=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 Math.abs(e.w-1)<P.EPSILON6?0:2*Math.acos(e.w)};var uG=new nt;nt.lerp=function(e,t,n,i){return uG=nt.multiplyByScalar(t,n,uG),i=nt.multiplyByScalar(e,1-n,i),nt.add(uG,i,i)};var jZ=new nt,fG=new nt,dG=new nt;nt.slerp=function(e,t,n,i){let o=nt.dot(e,t),r=t;if(o<0&&(o=-o,r=jZ=nt.negate(t,jZ)),1-o<P.EPSILON6)return nt.lerp(e,r,n,i);let s=Math.acos(o);return fG=nt.multiplyByScalar(e,Math.sin((1-n)*s),fG),dG=nt.multiplyByScalar(r,Math.sin(n*s),dG),i=nt.add(fG,dG,i),nt.multiplyByScalar(i,1/Math.sin(s),i)};nt.log=function(e,t){let n=P.acosClamped(e.w),i=0;return n!==0&&(i=n/Math.sin(n)),h.multiplyByScalar(e,i,t)};nt.exp=function(e,t){let n=h.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 jCe=new h,YCe=new h,JS=new nt,kC=new nt;nt.computeInnerQuadrangle=function(e,t,n,i){let o=nt.conjugate(t,JS);nt.multiply(o,n,kC);let r=nt.log(kC,jCe);nt.multiply(o,e,kC);let s=nt.log(kC,YCe);return h.add(r,s,r),h.multiplyByScalar(r,.25,r),h.negate(r,r),nt.exp(r,JS),nt.multiply(t,JS,i)};nt.squad=function(e,t,n,i,o,r){let s=nt.slerp(e,t,o,JS),a=nt.slerp(n,i,o,kC);return nt.slerp(s,a,2*o*(1-o),r)};var qCe=new nt,YZ=1.9011074535173003,D3=Vt.supportsTypedArrays()?new Float32Array(8):[],v3=Vt.supportsTypedArrays()?new Float32Array(8):[],Bm=Vt.supportsTypedArrays()?new Float32Array(8):[],Mm=Vt.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){let t=e+1,n=2*t+1;D3[e]=1/(t*n),v3[e]=t/n}D3[7]=YZ/(8*17);v3[7]=YZ*8/17;nt.fastSlerp=function(e,t,n,i){let o=nt.dot(e,t),r;o>=0?r=1:(r=-1,o=-o);let s=o-1,a=1-n,c=n*n,l=a*a;for(let g=7;g>=0;--g)Bm[g]=(D3[g]*c-v3[g])*s,Mm[g]=(D3[g]*l-v3[g])*s;let f=r*n*(1+Bm[0]*(1+Bm[1]*(1+Bm[2]*(1+Bm[3]*(1+Bm[4]*(1+Bm[5]*(1+Bm[6]*(1+Bm[7])))))))),d=a*(1+Mm[0]*(1+Mm[1]*(1+Mm[2]*(1+Mm[3]*(1+Mm[4]*(1+Mm[5]*(1+Mm[6]*(1+Mm[7])))))))),p=nt.multiplyByScalar(e,d,qCe);return nt.multiplyByScalar(t,f,i),nt.add(p,i,i)};nt.fastSquad=function(e,t,n,i,o,r){let s=nt.fastSlerp(e,t,o,JS),a=nt.fastSlerp(n,i,o,kC);return nt.fastSlerp(s,a,2*o*(1-o),r)};nt.equals=function(e,t){return e===t||u(e)&&u(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=y(n,0),e===t||u(e)&&u(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;function XCe(e,t,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 wo=XCe;function KCe(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}var H_=KCe;function ZCe(e,t,n,i,o,r,s,a){this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a}var Lm=ZCe;function JCe(e){return e%4===0&&e%100!==0||e%400===0}var Nm=JCe;function QCe(e,t){this.julianDate=e,this.offset=t}var Fi=QCe;var $Ce={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($Ce);var eTe={UTC:0,TAI:1},qn=Object.freeze(eTe);var XZ=new Lm,hG=[31,28,31,30,31,30,31,31,30,31,30,31],mG=29;function pG(e,t){return Tt.compare(e.julianDate,t.julianDate)}var zC=new Fi;function I3(e){zC.julianDate=e;let t=Tt.leapSeconds,n=wo(t,zC,pG);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&Tt.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),Tt.addSeconds(e,i,e)}function qZ(e,t){zC.julianDate=e;let n=Tt.leapSeconds,i=wo(n,zC,pG);if(i<0&&(i=~i),i===0)return Tt.addSeconds(e,-n[0].offset,t);if(i>=n.length)return Tt.addSeconds(e,-n[i-1].offset,t);let o=Tt.secondsDifference(n[i].julianDate,e);if(o===0)return Tt.addSeconds(e,-n[i].offset,t);if(!(o<=1))return Tt.addSeconds(e,-n[--i].offset,t)}function G_(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 _G(e,t,n,i,o,r,s){let a=(t-14)/12|0,c=e+4800+a,l=(1461*c/4|0)+(367*(t-2-12*a)/12|0)-(3*((c+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&&(l-=1),[l,f]}var tTe=/^(\d{4})$/,nTe=/^(\d{4})-(\d{2})$/,iTe=/^(\d{4})-?(\d{3})$/,oTe=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,rTe=/^(\d{4})-?(\d{2})-?(\d{2})$/,gG=/([Z+\-])?(\d{2})?:?(\d{2})?$/,sTe=/^(\d{2})(\.\d+)?/.source+gG.source,aTe=/^(\d{2}):?(\d{2})(\.\d+)?/.source+gG.source,cTe=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+gG.source;function Tt(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=y(e,0),t=y(t,0),n=y(n,qn.UTC);let i=e|0;t=t+(e-i)*Qn.SECONDS_PER_DAY,G_(i,t,this),n===qn.UTC&&I3(this)}Tt.fromGregorianDate=function(e,t){let n=_G(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return u(t)?(G_(n[0],n[1],t),I3(t),t):new Tt(n[0],n[1],qn.UTC)};Tt.fromDate=function(e,t){let n=_G(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return u(t)?(G_(n[0],n[1],t),I3(t),t):new Tt(n[0],n[1],qn.UTC)};Tt.fromIso8601=function(e,t){e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,c=0,l=0,f=n[0],d=n[1],p,g;if(n=f.match(rTe),n!==null)i=+n[1],o=+n[2],r=+n[3];else if(n=f.match(nTe),n!==null)i=+n[1],o=+n[2];else if(n=f.match(tTe),n!==null)i=+n[1];else{let C;if(n=f.match(iTe),n!==null)i=+n[1],C=+n[2],g=Nm(i);else if(n=f.match(oTe),n!==null){i=+n[1];let T=+n[2],E=+n[3]||0,S=new Date(Date.UTC(i,0,4));C=T*7+E-S.getUTCDay()-3}p=new Date(Date.UTC(i,0,1)),p.setUTCDate(C),o=p.getUTCMonth()+1,r=p.getUTCDate()}g=Nm(i);let m;if(u(d)){n=d.match(cTe),n!==null?(s=+n[1],a=+n[2],c=+n[3],l=+(n[4]||0)*1e3,m=5):(n=d.match(aTe),n!==null?(s=+n[1],a=+n[2],c=+(n[3]||0)*60,m=4):(n=d.match(sTe),n!==null&&(s=+n[1],a=+(n[2]||0)*60,m=3)));let C=n[m],T=+n[m+1],E=+(n[m+2]||0);switch(C){case"+":s=s-T,a=a-E;break;case"-":s=s+T,a=a+E;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}let A=c===60;for(A&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(p=g&&o===2?mG:hG[o-1];r>p;)r-=p,o++,o>12&&(o-=12,i++),p=g&&o===2?mG:hG[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?mG:hG[o-1],r+=p;let x=_G(i,o,r,s,a,c,l);return u(t)?(G_(x[0],x[1],t),I3(t)):t=new Tt(x[0],x[1],qn.UTC),A&&Tt.addSeconds(t,1,t),t};Tt.now=function(e){return Tt.fromDate(new Date,e)};var w3=new Tt(0,0,qn.TAI);Tt.toGregorianDate=function(e,t){let n=!1,i=qZ(e,w3);u(i)||(Tt.addSeconds(e,-1,w3),i=qZ(w3,w3),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 c=4e3*(s+1)/1461001|0;s=s-(1461*c/4|0)+31|0;let l=80*s/2447|0,f=s-(2447*l/80|0)|0;s=l/11|0;let d=l+2-12*s|0,p=100*(a-49)+c+s|0,g=r/Qn.SECONDS_PER_HOUR|0,m=r-g*Qn.SECONDS_PER_HOUR,A=m/Qn.SECONDS_PER_MINUTE|0;m=m-A*Qn.SECONDS_PER_MINUTE;let x=m|0,C=(m-x)/Qn.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(x+=1),u(t)?(t.year=p,t.month=d,t.day=f,t.hour=g,t.minute=A,t.second=x,t.millisecond=C,t.isLeapSecond=n,t):new Lm(p,d,f,g,A,x,C,n)};Tt.toDate=function(e){let t=Tt.toGregorianDate(e,XZ),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))};Tt.toIso8601=function(e,t){let n=Tt.toGregorianDate(e,XZ),i=n.year,o=n.month,r=n.day,s=n.hour,a=n.minute,c=n.second,l=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&c===0&&l===0&&(i=9999,o=12,r=31,s=24);let f;return!u(t)&&l!==0?(f=(l*.01).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")}:${c.toString().padStart(2,"0")}.${f}Z`):!u(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")}:${c.toString().padStart(2,"0")}Z`:(f=(l*.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")}:${c.toString().padStart(2,"0")}.${f}Z`)};Tt.clone=function(e,t){if(u(e))return u(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new Tt(e.dayNumber,e.secondsOfDay,qn.TAI)};Tt.compare=function(e,t){let n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};Tt.equals=function(e,t){return e===t||u(e)&&u(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};Tt.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(t)&&Math.abs(Tt.secondsDifference(e,t))<=n};Tt.totalDays=function(e){return e.dayNumber+e.secondsOfDay/Qn.SECONDS_PER_DAY};Tt.secondsDifference=function(e,t){return(e.dayNumber-t.dayNumber)*Qn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};Tt.daysDifference=function(e,t){let n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/Qn.SECONDS_PER_DAY;return n+i};Tt.computeTaiMinusUtc=function(e){zC.julianDate=e;let t=Tt.leapSeconds,n=wo(t,zC,pG);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};Tt.addSeconds=function(e,t,n){return G_(e.dayNumber,e.secondsOfDay+t,n)};Tt.addMinutes=function(e,t,n){let i=e.secondsOfDay+t*Qn.SECONDS_PER_MINUTE;return G_(e.dayNumber,i,n)};Tt.addHours=function(e,t,n){let i=e.secondsOfDay+t*Qn.SECONDS_PER_HOUR;return G_(e.dayNumber,i,n)};Tt.addDays=function(e,t,n){let i=e.dayNumber+t;return G_(i,e.secondsOfDay,n)};Tt.lessThan=function(e,t){return Tt.compare(e,t)<0};Tt.lessThanOrEquals=function(e,t){return Tt.compare(e,t)<=0};Tt.greaterThan=function(e,t){return Tt.compare(e,t)>0};Tt.greaterThanOrEquals=function(e,t){return Tt.compare(e,t)>=0};Tt.prototype.clone=function(e){return Tt.clone(this,e)};Tt.prototype.equals=function(e){return Tt.equals(this,e)};Tt.prototype.equalsEpsilon=function(e,t){return Tt.equalsEpsilon(this,e,t)};Tt.prototype.toString=function(){return Tt.toIso8601(this)};Tt.leapSeconds=[new Fi(new Tt(2441317,43210,qn.TAI),10),new Fi(new Tt(2441499,43211,qn.TAI),11),new Fi(new Tt(2441683,43212,qn.TAI),12),new Fi(new Tt(2442048,43213,qn.TAI),13),new Fi(new Tt(2442413,43214,qn.TAI),14),new Fi(new Tt(2442778,43215,qn.TAI),15),new Fi(new Tt(2443144,43216,qn.TAI),16),new Fi(new Tt(2443509,43217,qn.TAI),17),new Fi(new Tt(2443874,43218,qn.TAI),18),new Fi(new Tt(2444239,43219,qn.TAI),19),new Fi(new Tt(2444786,43220,qn.TAI),20),new Fi(new Tt(2445151,43221,qn.TAI),21),new Fi(new Tt(2445516,43222,qn.TAI),22),new Fi(new Tt(2446247,43223,qn.TAI),23),new Fi(new Tt(2447161,43224,qn.TAI),24),new Fi(new Tt(2447892,43225,qn.TAI),25),new Fi(new Tt(2448257,43226,qn.TAI),26),new Fi(new Tt(2448804,43227,qn.TAI),27),new Fi(new Tt(2449169,43228,qn.TAI),28),new Fi(new Tt(2449534,43229,qn.TAI),29),new Fi(new Tt(2450083,43230,qn.TAI),30),new Fi(new Tt(2450630,43231,qn.TAI),31),new Fi(new Tt(2451179,43232,qn.TAI),32),new Fi(new Tt(2453736,43233,qn.TAI),33),new Fi(new Tt(2454832,43234,qn.TAI),34),new Fi(new Tt(2456109,43235,qn.TAI),35),new Fi(new Tt(2457204,43236,qn.TAI),36),new Fi(new Tt(2457754,43237,qn.TAI),37)];var $=Tt;var XC=vo(Ll(),1);function lTe(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}var QS=lTe;function tJ(e,t){if(e===null||typeof e!="object")return e;t=y(t,!1);let n=new e.constructor;for(let i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=tJ(o,t)),n[i]=o}return n}var Ge=tJ;function nJ(e,t,n){n=y(n,!1);let i={},o=u(e),r=u(t),s,a,c;if(o)for(s in e)e.hasOwnProperty(s)&&(a=e[s],r&&n&&typeof a=="object"&&t.hasOwnProperty(s)?(c=t[s],typeof c=="object"?i[s]=nJ(a,c,n):i[s]=a):i[s]=a);if(r)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(c=t[s],i[s]=c);return i}var _t=nJ;function uTe(){let e,t,n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}var Jr=uTe;var iJ=vo(Ll(),1);function yG(e,t){let n;return typeof document<"u"&&(n=document),yG._implementation(e,t,n)}yG._implementation=function(e,t,n){if(!u(t)){if(typeof n>"u")return e;t=y(n.baseURI,n.location.href)}let i=new iJ.default(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};var Fm=yG;var oJ=vo(Ll(),1);function fTe(e,t){let n="",i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new oJ.default(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}var $S=fTe;var rJ=vo(Ll(),1);function dTe(e){let t=new rJ.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 f0=dTe;var sJ={};function hTe(e,t,n){u(t)||(t=e.width),u(n)||(n=e.height);let i=sJ[t];u(i)||(i={},sJ[t]=i);let o=i[n];if(!u(o)){let r=document.createElement("canvas");r.width=t,r.height=n,o=r.getContext("2d"),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}var Wf=hTe;var mTe=/^blob:/i;function pTe(e){return mTe.test(e)}var d0=pTe;var mh;function _Te(e){u(mh)||(mh=document.createElement("a")),mh.href=window.location.href;let t=mh.host,n=mh.protocol;return mh.href=e,mh.href=mh.href,n!==mh.protocol||t!==mh.host}var h0=_Te;var gTe=/^data:/i;function yTe(e){return gTe.test(e)}var Vm=yTe;function ATe(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 m0=ATe;function xTe(e){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 p0=xTe;function CTe(e){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];u(a)?a=decodeURIComponent(a):a="";let c=t[s];typeof c=="string"?t[s]=[c,a]:Array.isArray(c)?c.push(a):t[s]=a}return t}var Nl=CTe;var TTe={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},hi=Object.freeze(TTe);var ETe={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},Qr=Object.freeze(ETe);function B3(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.throttleByServer,!1),n=y(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=y(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=y(e.type,Qr.OTHER),this.serverKey=void 0,this.state=hi.UNISSUED,this.deferred=void 0,this.cancelled=!1}B3.prototype.cancel=function(){this.cancelled=!0};B3.prototype.clone=function(e){return u(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=this.RequestState.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new B3(this)};var zo=B3;function bTe(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 eD=bTe;function aJ(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=eD(this.responseHeaders))}aJ.prototype.toString=function(){let e="Request has failed.";return u(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};var ph=aJ;var iD=vo(Ll(),1);function tD(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(tD.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});tD.prototype.addEventListener=function(e,t){this._listeners.push(e),this._scopes.push(t);let n=this;return function(){n.removeEventListener(e,t)}};tD.prototype.removeEventListener=function(e,t){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 STe(e,t){return t-e}tD.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];u(r)&&t[e].apply(n[e],arguments)}let o=this._toRemove;if(i=o.length,i>0){for(o.sort(STe),e=0;e<i;e++){let r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};var Ae=tD;function _0(e){this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(_0.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){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 AG(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}_0.prototype.reserve=function(e){e=y(e,this._length),this._array.length=e};_0.prototype.heapify=function(e){e=y(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?(AG(i,o,e),e=o):r=!1}};_0.prototype.resort=function(){let e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};_0.prototype.insert=function(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)AG(t,o,s),o=s;else break}let r;return u(i)&&this._length>i&&(r=t[i],this._length=i),r};_0.prototype.pop=function(e){if(e=y(e,0),this._length===0)return;let t=this._array,n=t[e];return AG(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};var nD=_0;function DTe(e,t){return e.priority-t.priority}var Qi={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0},WC=20,Pa=new nD({comparator:DTe});Pa.maximumLength=WC;Pa.reserve(WC);var _h=[],Um={},vTe=typeof document<"u"?new iD.default(document.location.href):new iD.default,M3=new Ae;function Ho(){}Ho.maximumRequests=50;Ho.maximumRequestsPerServer=6;Ho.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};Ho.throttleRequests=!0;Ho.debugShowStatistics=!1;Ho.requestCompletedEvent=M3;Object.defineProperties(Ho,{statistics:{get:function(){return Qi}},priorityHeapLength:{get:function(){return WC},set:function(e){if(e<WC)for(;Pa.length>e;){let t=Pa.pop();g0(t)}WC=e,Pa.maximumLength=e,Pa.reserve(e)}}});function cJ(e){u(e.priorityFunction)&&(e.priority=e.priorityFunction())}Ho.serverHasOpenSlots=function(e,t){t=y(t,1);let n=y(Ho.requestsByServer[e],Ho.maximumRequestsPerServer);return Um[e]+t<=n};Ho.heapHasOpenSlots=function(e){return Pa.length+e<=WC};function lJ(e){return e.state===hi.UNISSUED&&(e.state=hi.ISSUED,e.deferred=Jr()),e.deferred.promise}function wTe(e){return function(t){if(e.state===hi.CANCELLED)return;let n=e.deferred;--Qi.numberOfActiveRequests,--Um[e.serverKey],M3.raiseEvent(),e.state=hi.RECEIVED,e.deferred=void 0,n.resolve(t)}}function ITe(e){return function(t){e.state!==hi.CANCELLED&&(++Qi.numberOfFailedRequests,--Qi.numberOfActiveRequests,--Um[e.serverKey],M3.raiseEvent(t),e.state=hi.FAILED,e.deferred.reject(t))}}function uJ(e){let t=lJ(e);return e.state=hi.ACTIVE,_h.push(e),++Qi.numberOfActiveRequests,++Qi.numberOfActiveRequestsEver,++Um[e.serverKey],e.requestFunction().then(wTe(e)).catch(ITe(e)),t}function g0(e){let t=e.state===hi.ACTIVE;if(e.state=hi.CANCELLED,++Qi.numberOfCancelledRequests,u(e.deferred)){let n=e.deferred;e.deferred=void 0,n.reject()}t&&(--Qi.numberOfActiveRequests,--Um[e.serverKey],++Qi.numberOfCancelledActiveRequests),u(e.cancelFunction)&&e.cancelFunction()}Ho.update=function(){let e,t,n=0,i=_h.length;for(e=0;e<i;++e){if(t=_h[e],t.cancelled&&g0(t),t.state!==hi.ACTIVE){++n;continue}n>0&&(_h[e-n]=t)}_h.length-=n;let o=Pa.internalArray,r=Pa.length;for(e=0;e<r;++e)cJ(o[e]);Pa.resort();let s=Math.max(Ho.maximumRequests-_h.length,0),a=0;for(;a<s&&Pa.length>0;){if(t=Pa.pop(),t.cancelled){g0(t);continue}if(t.throttleByServer&&!Ho.serverHasOpenSlots(t.serverKey)){g0(t);continue}uJ(t),++a}PTe()};Ho.getServerKey=function(e){let t=new iD.default(e);t.scheme()===""&&(t=new iD.default(e).absoluteTo(vTe),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);let i=Um[n];return u(i)||(Um[n]=0),n};Ho.request=function(e){if(Vm(e.url)||d0(e.url))return M3.raiseEvent(),e.state=hi.RECEIVED,e.requestFunction();if(++Qi.numberOfAttemptedRequests,u(e.serverKey)||(e.serverKey=Ho.getServerKey(e.url)),Ho.throttleRequests&&e.throttleByServer&&!Ho.serverHasOpenSlots(e.serverKey))return;if(!Ho.throttleRequests||!e.throttle)return uJ(e);if(_h.length>=Ho.maximumRequests)return;cJ(e);let t=Pa.insert(e);if(u(t)){if(t===e)return;g0(t)}return lJ(e)};function PTe(){Ho.debugShowStatistics&&(Qi.numberOfActiveRequests===0&&Qi.lastNumberOfActiveRequests>0&&(Qi.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Qi.numberOfAttemptedRequests}`),Qi.numberOfAttemptedRequests=0),Qi.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Qi.numberOfCancelledRequests}`),Qi.numberOfCancelledRequests=0),Qi.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Qi.numberOfCancelledActiveRequests}`),Qi.numberOfCancelledActiveRequests=0),Qi.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Qi.numberOfFailedRequests}`),Qi.numberOfFailedRequests=0)),Qi.lastNumberOfActiveRequests=Qi.numberOfActiveRequests)}Ho.clearForSpecs=function(){for(;Pa.length>0;){let t=Pa.pop();g0(t)}let e=_h.length;for(let t=0;t<e;++t)g0(_h[t]);_h.length=0,Um={},Qi.numberOfAttemptedRequests=0,Qi.numberOfActiveRequests=0,Qi.numberOfCancelledRequests=0,Qi.numberOfCancelledActiveRequests=0,Qi.numberOfFailedRequests=0,Qi.numberOfActiveRequestsEver=0,Qi.lastNumberOfActiveRequests=0};Ho.numberOfActiveRequestsByServer=function(e){return Um[e]};Ho.requestHeap=Pa;var Oa=Ho;var fJ=vo(Ll(),1);var oD={},jC={};oD.add=function(e,t){let n=`${e.toLowerCase()}:${t}`;u(jC[n])||(jC[n]=!0)};oD.remove=function(e,t){let n=`${e.toLowerCase()}:${t}`;u(jC[n])&&delete jC[n]};function OTe(e){let t=new fJ.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}}oD.contains=function(e){let t=OTe(e);return!!(u(t)&&u(jC[t]))};oD.clear=function(){jC={}};var YC=oD;var mJ=function(){try{let e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function CG(e,t,n,i){let o=e.query();if(o.length===0)return{};let r;if(o.indexOf("=")===-1){let s={};s[o]=void 0,r=s}else r=Nl(o);n?t._queryParameters=N3(r,t._queryParameters,i):t._queryParameters=r,e.search("")}function RTe(e,t){let n=t._queryParameters,i=Object.keys(n);i.length===1&&!u(n[i[0]])?e.search(i[0]):e.search(p0(n))}function gh(e,t){return u(e)?u(e.clone)?e.clone():Ge(e):t}function TG(e){if(e.state===hi.ISSUED||e.state===hi.ACTIVE)throw new ue("The Resource is already being fetched.");e.state=hi.UNISSUED,e.deferred=void 0}function N3(e,t,n){if(!n)return _t(e,t);let i=Ge(e,!0);for(let o in t)if(t.hasOwnProperty(o)){let r=i[o],s=t[o];u(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}function Et(e){e=y(e,y.EMPTY_OBJECT),typeof e=="string"&&(e={url:e}),this._url=void 0,this._templateValues=gh(e.templateValues,{}),this._queryParameters=gh(e.queryParameters,{}),this.headers=gh(e.headers,{}),this.request=y(e.request,new zo),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=y(e.retryAttempts,0),this._retryCount=0;let t=new XC.default(e.url);CG(t,this,!0,!0),t.fragment(""),this._url=t.toString()}Et.createIfNeeded=function(e){return e instanceof Et?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new Et({url:e})};var qC;Et.supportsImageBitmapOptions=function(){if(u(qC))return qC;if(typeof createImageBitmap!="function")return qC=Promise.resolve(!1),qC;let e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";return qC=Et.fetchBlob({url:e}).then(function(t){let n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){let n=Wf(t[0]),i=Wf(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),qC};Object.defineProperties(Et,{isBlobSupported:{get:function(){return mJ}}});Object.defineProperties(Et.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){let t=new XC.default(e);CG(t,this,!1),t.fragment(""),this._url=t.toString()}},extension:{get:function(){return f0(this._url)}},isDataUri:{get:function(){return Vm(this._url)}},isBlobUri:{get:function(){return d0(this._url)}},isCrossOriginUrl:{get:function(){return h0(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}});Et.prototype.toString=function(){return this.getUrlComponent(!0,!0)};Et.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=new XC.default(this._url);e&&RTe(n,this);let i=n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}"),o=this._templateValues;return i=i.replace(/{(.*?)}/g,function(r,s){let a=o[s];return u(a)?encodeURIComponent(a):r}),t&&u(this.proxy)&&(i=this.proxy.getURL(i)),i};Et.prototype.setQueryParameters=function(e,t){t?this._queryParameters=N3(this._queryParameters,e,!1):this._queryParameters=N3(e,this._queryParameters,!1)};Et.prototype.appendQueryParameters=function(e){this._queryParameters=N3(e,this._queryParameters,!0)};Et.prototype.setTemplateValues=function(e,t){t?this._templateValues=_t(this._templateValues,e):this._templateValues=_t(e,this._templateValues)};Et.prototype.getDerivedResource=function(e){let t=this.clone();if(t._retryCount=0,u(e.url)){let n=new XC.default(e.url),i=y(e.preserveQueryParameters,!1);CG(n,t,!0,i),n.fragment(""),n.scheme()!==""?t._url=n.toString():t._url=n.absoluteTo(new XC.default(Fm(this._url))).toString()}return u(e.queryParameters)&&(t._queryParameters=_t(e.queryParameters,t._queryParameters)),u(e.templateValues)&&(t._templateValues=_t(e.templateValues,t.templateValues)),u(e.headers)&&(t.headers=_t(e.headers,t.headers)),u(e.proxy)&&(t.proxy=e.proxy),u(e.request)&&(t.request=e.request),u(e.retryCallback)&&(t.retryCallback=e.retryCallback),u(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};Et.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})};Et.prototype.clone=function(e){return u(e)||(e=new Et({url:this._url})),e._url=this._url,e._queryParameters=Ge(this._queryParameters),e._templateValues=Ge(this._templateValues),e.headers=Ge(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e};Et.prototype.getBaseUri=function(e){return $S(this.getUrlComponent(e),e)};Et.prototype.appendForwardSlash=function(){this._url=QS(this._url)};Et.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};Et.fetchArrayBuffer=function(e){return new Et(e).fetchArrayBuffer()};Et.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};Et.fetchBlob=function(e){return new Et(e).fetchBlob()};Et.prototype.fetchImage=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.preferImageBitmap,!1),n=y(e.preferBlob,!1),i=y(e.flipY,!1),o=y(e.skipColorSpaceConversion,!1);if(TG(this.request),!mJ||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return xG({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});let r=this.fetchBlob();if(!u(r))return;let s,a,c,l;return Et.supportsImageBitmapOptions().then(function(f){return s=f,a=s&&t,r}).then(function(f){if(!u(f))return;if(l=f,a)return Et.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});let d=window.URL.createObjectURL(f);return c=new Et({url:d}),xG({resource:c,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(f){if(u(f))return f.blob=l,a||window.URL.revokeObjectURL(c.url),f}).catch(function(f){return u(c)&&window.URL.revokeObjectURL(c.url),f.blob=l,Promise.reject(f)})};function xG(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 c=Jr();return Et._Implementations.createImage(r,a,c,n,i,o),c.promise};let s=Oa.request(r);if(u(s))return s.catch(function(a){return r.state!==hi.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(r.state=hi.UNISSUED,r.deferred=void 0,xG({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}Et.fetchImage=function(e){return new Et(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};Et.prototype.fetchText=function(){return this.fetch({responseType:"text"})};Et.fetchText=function(e){return new Et(e).fetchText()};Et.prototype.fetchJson=function(){let e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(u(e))return e.then(function(t){if(u(t))return JSON.parse(t)})};Et.fetchJson=function(e){return new Et(e).fetchJson()};Et.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};Et.fetchXML=function(e){return new Et(e).fetchXML()};Et.prototype.fetchJsonp=function(e){e=y(e,"callback"),TG(this.request);let t;do t=`loadJsonp${P.nextRandomNumber().toString().substring(2,8)}`;while(u(window[t]));return pJ(this,e,t)};function pJ(e,t,n){let i={};i[t]=n,e.setQueryParameters(i);let o=e.request;o.url=e.url,o.requestFunction=function(){let s=Jr();return window[n]=function(a){s.resolve(a);try{delete window[n]}catch{window[n]=void 0}},Et._Implementations.loadAndExecuteScript(e.url,n,s),s.promise};let r=Oa.request(o);if(u(r))return r.catch(function(s){return o.state!==hi.FAILED?Promise.reject(s):e.retryOnError(s).then(function(a){return a?(o.state=hi.UNISSUED,o.deferred=void 0,pJ(e,t,n)):Promise.reject(s)})})}Et.fetchJsonp=function(e){return new Et(e).fetchJsonp(e.callbackParameterName)};Et.prototype._makeRequest=function(e){let t=this;TG(t.request);let n=t.request;n.url=t.url,n.requestFunction=function(){let o=e.responseType,r=_t(e.headers,t.headers),s=e.overrideMimeType,a=e.method,c=e.data,l=Jr(),f=Et._Implementations.loadWithXhr(t.url,o,a,c,r,l,s);return u(f)&&u(f.abort)&&(n.cancelFunction=function(){f.abort()}),l.promise};let i=Oa.request(n);if(u(i))return i.then(function(o){return n.cancelFunction=void 0,o}).catch(function(o){return n.cancelFunction=void 0,n.state!==hi.FAILED?Promise.reject(o):t.retryOnError(o).then(function(r){return r?(n.state=hi.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(o)})})};var BTe=/^data:(.*?)(;base64)?,(.*)$/;function L3(e,t){let n=decodeURIComponent(t);return e?atob(n):n}function dJ(e,t){let n=L3(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 MTe(e,t){t=y(t,"");let n=e[1],i=!!e[2],o=e[3],r,s;switch(t){case"":case"text":return L3(i,o);case"arraybuffer":return dJ(i,o);case"blob":return r=dJ(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(L3(i,o),n);case"json":return JSON.parse(L3(i,o));default:}}Et.prototype.fetch=function(e){return e=gh(e,{}),e.method="GET",this._makeRequest(e)};Et.fetch=function(e){return new Et(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et.prototype.delete=function(e){return e=gh(e,{}),e.method="DELETE",this._makeRequest(e)};Et.delete=function(e){return new Et(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};Et.prototype.head=function(e){return e=gh(e,{}),e.method="HEAD",this._makeRequest(e)};Et.head=function(e){return new Et(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et.prototype.options=function(e){return e=gh(e,{}),e.method="OPTIONS",this._makeRequest(e)};Et.options=function(e){return new Et(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et.prototype.post=function(e,t){return Qc.defined("data",e),t=gh(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};Et.post=function(e){return new Et(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et.prototype.put=function(e,t){return Qc.defined("data",e),t=gh(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};Et.put=function(e){return new Et(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et.prototype.patch=function(e,t){return Qc.defined("data",e),t=gh(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};Et.patch=function(e){return new Et(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Et._Implementations={};Et._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&&(YC.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};Et._Implementations.createImage=function(e,t,n,i,o,r){let s=e.url;Et.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){Et._Implementations.loadImageElement(s,t,n);return}let c="blob",l="GET",f=Jr(),d=Et._Implementations.loadWithXhr(s,c,l,void 0,void 0,f,void 0,void 0,void 0);return u(d)&&u(d.abort)&&(e.cancelFunction=function(){d.abort()}),f.promise.then(function(p){if(!u(p)){n.reject(new ue(`Successfully retrieved ${s} but it contained no content.`));return}return Et.createImageBitmapFromBlob(p,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(p){n.resolve(p)})}).catch(function(a){n.reject(a)})};Et.createImageBitmapFromBlob=function(e,t){return Qc.defined("options",t),Qc.typeOf.bool("options.flipY",t.flipY),Qc.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),Qc.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function hJ(e,t){switch(t){case"text":return e.toString("utf8");case"json":return JSON.parse(e.toString("utf8"));default:return new Uint8Array(e).buffer}}function LTe(e,t,n,i,o,r,s){let a,c;Promise.all([import("url"),import("zlib")]).then(([l,f])=>(a=l.parse(e),c=f,a.protocol==="https:"?import("https"):import("http"))).then(l=>{let f={protocol:a.protocol,hostname:a.hostname,port:a.port,path:a.path,query:a.query,method:n,headers:o};l.request(f).on("response",function(d){if(d.statusCode<200||d.statusCode>=300){r.reject(new ph(d.statusCode,d,d.headers));return}let p=[];d.on("data",function(g){p.push(g)}),d.on("end",function(){let g=Buffer.concat(p);d.headers["content-encoding"]==="gzip"?c.gunzip(g,function(m,A){m?r.reject(new ue("Error decompressing response.")):r.resolve(hJ(A,t))}):r.resolve(hJ(g,t))})}).on("error",function(d){r.reject(new ph)}).end()})}var NTe=typeof XMLHttpRequest>"u";Et._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){let a=BTe.exec(e);if(a!==null){r.resolve(MTe(a,t));return}if(NTe){LTe(e,t,n,i,o,r,s);return}let c=new XMLHttpRequest;if(YC.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),u(s)&&u(c.overrideMimeType)&&c.overrideMimeType(s),u(o))for(let f in o)o.hasOwnProperty(f)&&c.setRequestHeader(f,o[f]);u(t)&&(c.responseType=t);let l=!1;return typeof e=="string"&&(l=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),c.onload=function(){if((c.status<200||c.status>=300)&&!(l&&c.status===0)){r.reject(new ph(c.status,c.response,c.getAllResponseHeaders()));return}let f=c.response,d=c.responseType;if(n==="HEAD"||n==="OPTIONS"){let g=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};g.forEach(function(A){let x=A.split(": "),C=x.shift();m[C]=x.join(": ")}),r.resolve(m);return}if(c.status===204)r.resolve();else if(u(f)&&(!u(t)||d===t))r.resolve(f);else if(t==="json"&&typeof f=="string")try{r.resolve(JSON.parse(f))}catch(p){r.reject(p)}else(d===""||d==="document")&&u(c.responseXML)&&c.responseXML.hasChildNodes()?r.resolve(c.responseXML):(d===""||d==="text")&&u(c.responseText)?r.resolve(c.responseText):r.reject(new ue("Invalid XMLHttpRequest response type."))},c.onerror=function(f){r.reject(new ph)},c.send(i),c};Et._Implementations.loadAndExecuteScript=function(e,t,n){return m0(e,t).catch(function(i){n.reject(i)})};Et._DefaultImplementations={};Et._DefaultImplementations.createImage=Et._Implementations.createImage;Et._DefaultImplementations.loadWithXhr=Et._Implementations.loadWithXhr;Et._DefaultImplementations.loadAndExecuteScript=Et._Implementations.loadAndExecuteScript;Et.DEFAULT=Object.freeze(new Et({url:typeof document>"u"?"":document.location.href.split("?")[0]}));var Oe=Et;function sD(e){e=y(e,y.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=y(e.addNewLeapSeconds,!0),u(e.data)?_J(this,e.data):_J(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}sD.fromUrl=async function(e,t){t=y(t,y.EMPTY_OBJECT);let n=Oe.createIfNeeded(e),i;try{i=await n.fetchJson()}catch{throw new ue(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new sD({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};sD.NONE=Object.freeze({compute:function(e,t){return u(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new H_(0,0,0,0,0),t}});sD.prototype.compute=function(e,t){if(!u(this._samples))return;if(u(t)||(t=new H_(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(u(i)){let a=n[i],c=n[i+1],l=$.lessThanOrEquals(a,e),f=!u(c),d=f||$.greaterThanOrEquals(c,e);if(l&&d)return o=i,!f&&c.equals(e)&&++o,r=o+1,yJ(this,n,this._samples,e,o,r,t),t}let s=wo(n,e,$.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,yJ(this,n,this._samples,e,o,r,t),t};function FTe(e,t){return $.compare(e.julianDate,t)}function _J(e,t){if(!u(t.columnNames))throw new ue("Error in loaded EOP data: The columnNames property is required.");if(!u(t.samples))throw new ue("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"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||o<0||r<0||s<0||a<0||c<0)throw new ue("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");let l=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=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let d,p=e._addNewLeapSeconds;for(let g=0,m=l.length;g<m;g+=e._columnCount){let A=l[g+n],x=l[g+c],C=A+Qn.MODIFIED_JULIAN_DATE_DIFFERENCE,T=new $(C,x,qn.TAI);if(f.push(T),p){if(x!==d&&u(d)){let E=$.leapSeconds,S=wo(E,T,FTe);if(S<0){let D=new Fi(T,x);E.splice(~S,0,D)}}d=x}}}function gJ(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 rD(e,t,n){return t+e*(n-t)}function yJ(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 c=t[o],l=t[r];if(c.equals(l)||i.equals(c))return gJ(e,n,o,a,s),s;if(i.equals(l))return gJ(e,n,r,a,s),s;let f=$.secondsDifference(i,c)/$.secondsDifference(l,c),d=o*a,p=r*a,g=n[d+e._ut1MinusUtcSecondsColumn],m=n[p+e._ut1MinusUtcSecondsColumn],A=m-g;if(A>.5||A<-.5){let x=n[d+e._taiMinusUtcSecondsColumn],C=n[p+e._taiMinusUtcSecondsColumn];x!==C&&(l.equals(i)?g=m:m-=C-x)}return s.xPoleWander=rD(f,n[d+e._xPoleWanderRadiansColumn],n[p+e._xPoleWanderRadiansColumn]),s.yPoleWander=rD(f,n[d+e._yPoleWanderRadiansColumn],n[p+e._yPoleWanderRadiansColumn]),s.xPoleOffset=rD(f,n[d+e._xCelestialPoleOffsetRadiansColumn],n[p+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=rD(f,n[d+e._yCelestialPoleOffsetRadiansColumn],n[p+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=rD(f,g,m),s}var aD=sD;function Ra(e,t,n){this.heading=y(e,0),this.pitch=y(t,0),this.roll=y(n,0)}Ra.fromQuaternion=function(e,t){u(t)||(t=new Ra);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=-P.asinClamped(n),t};Ra.fromDegrees=function(e,t,n,i){return u(i)||(i=new Ra),i.heading=e*P.RADIANS_PER_DEGREE,i.pitch=t*P.RADIANS_PER_DEGREE,i.roll=n*P.RADIANS_PER_DEGREE,i};Ra.clone=function(e,t){if(u(e))return u(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new Ra(e.heading,e.pitch,e.roll)};Ra.equals=function(e,t){return e===t||u(e)&&u(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};Ra.equalsEpsilon=function(e,t,n,i){return e===t||u(e)&&u(t)&&P.equalsEpsilon(e.heading,t.heading,n,i)&&P.equalsEpsilon(e.pitch,t.pitch,n,i)&&P.equalsEpsilon(e.roll,t.roll,n,i)};Ra.prototype.clone=function(e){return Ra.clone(this,e)};Ra.prototype.equals=function(e){return Ra.equals(this,e)};Ra.prototype.equalsEpsilon=function(e,t,n){return Ra.equalsEpsilon(this,e,t,n)};Ra.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};var Ba=Ra;var AJ=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function VTe(){let e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){let i=e[t].getAttribute("src"),o=AJ.exec(i);if(o!==null)return o[1]}}var KC;function xJ(e){return typeof document>"u"?e:(u(KC)||(KC=document.createElement("a")),KC.href=e,KC.href=KC.href,KC.href)}var y0;function CJ(){if(u(y0))return y0;let e;return typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:typeof define=="object"&&u(define.amd)&&!define.amd.toUrlUndefined&&u(U_.toUrl)?e=Fm("..",A0("Core/buildModuleUrl.js")):e=VTe(),y0=new Oe({url:xJ(e)}),y0.appendForwardSlash(),y0}function UTe(e){return xJ(U_.toUrl(`../${e}`))}function TJ(e){return CJ().getDerivedResource({url:e}).url}var F3;function A0(e){return u(F3)||(typeof define=="object"&&u(define.amd)&&!define.amd.toUrlUndefined&&u(U_.toUrl)?F3=UTe:F3=TJ),F3(e)}A0._cesiumScriptRegex=AJ;A0._buildModuleUrlFromBaseUrl=TJ;A0._clearBaseResource=function(){y0=void 0};A0.setBaseUrl=function(e){y0=Oe.DEFAULT.getDerivedResource({url:e})};A0.getCesiumBaseUrl=CJ;var $t=A0;function kTe(e,t,n){this.x=e,this.y=t,this.s=n}var x0=kTe;function SG(e){e=y(e,y.EMPTY_OBJECT),this._xysFileUrlTemplate=Oe.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=y(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=y(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new $(this._sampleZeroJulianEphemerisDate,0,qn.TAI),this._stepSizeDays=y(e.stepSizeDays,1),this._samplesPerXysFile=y(e.samplesPerXysFile,1e3),this._totalSamples=y(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 zTe=new $(0,0,qn.TAI);function EG(e,t,n){let i=zTe;return i.dayNumber=t,i.secondsOfDay=n,$.daysDifference(i,e._sampleZeroDateTT)}SG.prototype.preload=function(e,t,n,i){let o=EG(this,e,t),r=EG(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 c=s/this._samplesPerXysFile|0,l=a/this._samplesPerXysFile|0,f=[];for(let d=c;d<=l;++d)f.push(bG(this,d));return Promise.all(f)};SG.prototype.computeXysRadians=function(e,t,n){let i=EG(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 c=!1,l=this._samples;if(u(l[s*3])||(bG(this,s/this._samplesPerXysFile|0),c=!0),u(l[a*3])||(bG(this,a/this._samplesPerXysFile|0),c=!0),c)return;u(n)?(n.x=0,n.y=0,n.s=0):n=new x0(0,0,0);let f=i-s*this._stepSizeDays,d=this._work,p=this._denominators,g=this._coef,m=this._xTable,A,x;for(A=0;A<=r;++A)d[A]=f-m[A];for(A=0;A<=r;++A){for(g[A]=1,x=0;x<=r;++x)x!==A&&(g[A]*=d[x]);g[A]*=p[A];let C=(s+A)*3;n.x+=g[A]*l[C++],n.y+=g[A]*l[C++],n.s+=g[A]*l[C]}return n};function bG(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n,i=e._xysFileUrlTemplate;u(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new Oe({url:$t(`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,c=t*e._samplesPerXysFile*3;for(let l=0,f=a.length;l<f;++l)s[c+l]=a[l]});return e._chunkDownloadsInProgress[t]=o,o}var cD=SG;var Gi={},DG={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"}},ZC={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},vG={},el={east:new h,north:new h,up:new h,west:new h,south:new h,down:new h},W_=new h,j_=new h,Y_=new h;Gi.localFrameToFixedFrameGenerator=function(e,t){if(!DG.hasOwnProperty(e)||!DG[e].hasOwnProperty(t))throw new de("firstAxis and secondAxis must be east, north, up, west, south or down.");let n=DG[e][t],i,o=e+t;return u(vG[o])?i=vG[o]:(i=function(r,s,a){if(u(a)||(a=new M),h.equalsEpsilon(r,h.ZERO,P.EPSILON14))h.unpack(ZC[e],0,W_),h.unpack(ZC[t],0,j_),h.unpack(ZC[n],0,Y_);else if(P.equalsEpsilon(r.x,0,P.EPSILON14)&&P.equalsEpsilon(r.y,0,P.EPSILON14)){let c=P.sign(r.z);h.unpack(ZC[e],0,W_),e!=="east"&&e!=="west"&&h.multiplyByScalar(W_,c,W_),h.unpack(ZC[t],0,j_),t!=="east"&&t!=="west"&&h.multiplyByScalar(j_,c,j_),h.unpack(ZC[n],0,Y_),n!=="east"&&n!=="west"&&h.multiplyByScalar(Y_,c,Y_)}else{s=y(s,ie.WGS84),s.geodeticSurfaceNormal(r,el.up);let c=el.up,l=el.east;l.x=-r.y,l.y=r.x,l.z=0,h.normalize(l,el.east),h.cross(c,l,el.north),h.multiplyByScalar(el.up,-1,el.down),h.multiplyByScalar(el.east,-1,el.west),h.multiplyByScalar(el.north,-1,el.south),W_=el[e],j_=el[t],Y_=el[n]}return a[0]=W_.x,a[1]=W_.y,a[2]=W_.z,a[3]=0,a[4]=j_.x,a[5]=j_.y,a[6]=j_.z,a[7]=0,a[8]=Y_.x,a[9]=Y_.y,a[10]=Y_.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},vG[o]=i),i};Gi.eastNorthUpToFixedFrame=Gi.localFrameToFixedFrameGenerator("east","north");Gi.northEastDownToFixedFrame=Gi.localFrameToFixedFrameGenerator("north","east");Gi.northUpEastToFixedFrame=Gi.localFrameToFixedFrameGenerator("north","up");Gi.northWestUpToFixedFrame=Gi.localFrameToFixedFrameGenerator("north","west");var HTe=new Le,GTe=new h(1,1,1),WTe=new M;Gi.headingPitchRollToFixedFrame=function(e,t,n,i,o){i=y(i,Gi.eastNorthUpToFixedFrame);let r=Le.fromHeadingPitchRoll(t,HTe),s=M.fromTranslationQuaternionRotationScale(h.ZERO,r,GTe,WTe);return o=i(e,n,o),M.multiply(o,s,o)};var jTe=new M,YTe=new Z;Gi.headingPitchRollQuaternion=function(e,t,n,i,o){let r=Gi.headingPitchRollToFixedFrame(e,t,n,i,jTe),s=M.getMatrix3(r,YTe);return Le.fromRotationMatrix(s,o)};var qTe=new h(1,1,1),XTe=new h,EJ=new M,KTe=new M,ZTe=new Z,JTe=new Le;Gi.fixedFrameToHeadingPitchRoll=function(e,t,n,i){t=y(t,ie.WGS84),n=y(n,Gi.eastNorthUpToFixedFrame),u(i)||(i=new Ba);let o=M.getTranslation(e,XTe);if(h.equals(o,h.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=M.inverseTransformation(n(o,t,EJ),EJ),s=M.setScale(e,qTe,KTe);s=M.setTranslation(s,h.ZERO,s),r=M.multiply(r,s,r);let a=Le.fromRotationMatrix(M.getMatrix3(r,ZTe),JTe);return a=Le.normalize(a,a),Ba.fromQuaternion(a,i)};var QTe=6*3600+41*60+50.54841,$Te=8640184812866e-6,eEe=.093104,tEe=-62e-7,nEe=11772758384668e-32,iEe=72921158553e-15,oEe=P.TWO_PI/86400,V3=new $;Gi.computeTemeToPseudoFixedMatrix=function(e,t){V3=$.addSeconds(e,-$.computeTaiMinusUtc(e),V3);let n=V3.dayNumber,i=V3.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=(QTe+o*($Te+o*(eEe+o*tEe)))*oEe%P.TWO_PI,c=iEe+nEe*(n-24515455e-1),l=(i+Qn.SECONDS_PER_DAY*.5)%Qn.SECONDS_PER_DAY,f=a+c*l,d=Math.cos(f),p=Math.sin(f);return u(t)?(t[0]=d,t[1]=-p,t[2]=0,t[3]=p,t[4]=d,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new Z(d,p,0,-p,d,0,0,0,1)};Gi.iau2006XysData=new cD;Gi.earthOrientationParameters=aD.NONE;var PG=32.184,rEe=2451545;Gi.preloadIcrfFixed=function(e){let t=e.start.dayNumber,n=e.start.secondsOfDay+PG,i=e.stop.dayNumber,o=e.stop.secondsOfDay+PG;return Gi.iau2006XysData.preload(t,n,i,o)};Gi.computeIcrfToFixedMatrix=function(e,t){u(t)||(t=new Z);let n=Gi.computeFixedToIcrfMatrix(e,t);if(u(n))return Z.transpose(n,t)};var sEe=new x0(0,0,0),aEe=new H_(0,0,0,0,0,0),wG=new Z,IG=new Z;Gi.computeFixedToIcrfMatrix=function(e,t){u(t)||(t=new Z);let n=Gi.earthOrientationParameters.compute(e,aEe);if(!u(n))return;let i=e.dayNumber,o=e.secondsOfDay+PG,r=Gi.iau2006XysData.computeXysRadians(i,o,sEe);if(!u(r))return;let s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-s*s-a*a)),l=wG;l[0]=1-c*s*s,l[3]=-c*s*a,l[6]=s,l[1]=-c*s*a,l[4]=1-c*a*a,l[7]=a,l[2]=-s,l[5]=-a,l[8]=1-c*(s*s+a*a);let f=Z.fromRotationZ(-r.s,IG),d=Z.multiply(l,f,wG),p=e.dayNumber,g=e.secondsOfDay-$.computeTaiMinusUtc(e)+n.ut1MinusUtc,m=p-2451545,A=g/Qn.SECONDS_PER_DAY,x=.779057273264+A+.00273781191135448*(m+A);x=x%1*P.TWO_PI;let C=Z.fromRotationZ(x,IG),T=Z.multiply(d,C,wG),E=Math.cos(n.xPoleWander),S=Math.cos(n.yPoleWander),D=Math.sin(n.xPoleWander),w=Math.sin(n.yPoleWander),R=i-rEe+o/Qn.SECONDS_PER_DAY;R/=36525;let O=-47e-6*R*P.RADIANS_PER_DEGREE/3600,L=Math.cos(O),N=Math.sin(O),_=IG;return _[0]=E*L,_[1]=E*N,_[2]=D,_[3]=-S*N+w*D*L,_[4]=S*L+w*D*N,_[5]=-w*E,_[6]=-w*N-S*D*L,_[7]=w*L-S*D*N,_[8]=S*E,Z.multiply(T,_,t)};var cEe=new oe;Gi.pointToWindowCoordinates=function(e,t,n,i){return i=Gi.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};Gi.pointToGLWindowCoordinates=function(e,t,n,i){u(i)||(i=new H);let o=cEe;return M.multiplyByVector(e,oe.fromElements(n.x,n.y,n.z,1,o),o),oe.multiplyByScalar(o,1/o.w,o),M.multiplyByVector(t,o,o),H.fromCartesian4(o,i)};var lEe=new h,uEe=new h,fEe=new h;Gi.rotationMatrixFromPositionVelocity=function(e,t,n,i){let o=y(n,ie.WGS84).geodeticSurfaceNormal(e,lEe),r=h.cross(t,o,uEe);h.equalsEpsilon(r,h.ZERO,P.EPSILON6)&&(r=h.clone(h.UNIT_X,r));let s=h.cross(r,t,fEe);return h.normalize(s,s),h.cross(t,s,r),h.negate(r,r),h.normalize(r,r),u(i)||(i=new Z),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 bJ=new M(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),SJ=new he,DJ=new h,dEe=new h,hEe=new Z,OG=new M,vJ=new M;Gi.basisTo2D=function(e,t,n){let i=M.getTranslation(t,dEe),o=e.ellipsoid,r=o.cartesianToCartographic(i,SJ),s=e.project(r,DJ);h.fromElements(s.z,s.x,s.y,s);let a=Gi.eastNorthUpToFixedFrame(i,o,OG),c=M.inverseTransformation(a,vJ),l=M.getMatrix3(t,hEe),f=M.multiplyByMatrix3(c,l,n);return M.multiply(bJ,f,n),M.setTranslation(n,s,n),n};Gi.wgs84To2DModelMatrix=function(e,t,n){let i=e.ellipsoid,o=Gi.eastNorthUpToFixedFrame(t,i,OG),r=M.inverseTransformation(o,vJ),s=i.cartesianToCartographic(t,SJ),a=e.project(s,DJ);h.fromElements(a.z,a.x,a.y,a);let c=M.fromTranslation(a,OG);return M.multiply(bJ,r,n),M.multiply(c,n,n),n};var Ot=Gi;function RG(e){e=y(e,y.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=y(e.primitiveType,Me.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=y(e.geometryType,Nu.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}RG.computeNumberOfVertices=function(e){let t=-1;for(let n in e.attributes)if(e.attributes.hasOwnProperty(n)&&u(e.attributes[n])&&u(e.attributes[n].values)){let i=e.attributes[n];t=i.values.length/i.componentsPerAttribute}return t};var mEe=new he,pEe=new h,wJ=new M,_Ee=[new he,new he,new he],gEe=[new H,new H,new H],yEe=[new H,new H,new H],AEe=new h,xEe=new Le,CEe=new M,TEe=new Ji;RG._textureCoordinateRotationPoints=function(e,t,n,i){let o,r=ce.center(i,mEe),s=he.toCartesian(r,n,pEe),a=Ot.eastNorthUpToFixedFrame(s,n,wJ),c=M.inverse(a,wJ),l=gEe,f=_Ee;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 d=AEe;for(o=0;o<3;o++)he.toCartesian(f[o],n,d),d=M.multiplyByPointAsVector(c,d,d),l[o].x=d.x,l[o].y=d.y;let p=Le.fromAxisAngle(h.UNIT_Z,-t,xEe),g=Z.fromQuaternion(p,CEe),m=e.length,A=Number.POSITIVE_INFINITY,x=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(o=0;o<m;o++)d=M.multiplyByPointAsVector(c,e[o],d),d=Z.multiplyByVector(g,d,d),A=Math.min(A,d.x),x=Math.min(x,d.y),C=Math.max(C,d.x),T=Math.max(T,d.y);let E=Ji.fromRotation(t,TEe),S=yEe;S[0].x=A,S[0].y=x,S[1].x=A,S[1].y=T,S[2].x=C,S[2].y=x;let D=l[0],w=l[2].x-D.x,R=l[1].y-D.y;for(o=0;o<3;o++){let b=S[o];Ji.multiplyByVector(E,b,b),b.x=(b.x-D.x)/w,b.y=(b.y-D.y)/R}let O=S[0],L=S[1],N=S[2],_=new Array(6);return H.pack(O,_),H.pack(L,_,2),H.pack(N,_,4),_};var ct=RG;function EEe(e){e=y(e,y.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.values=e.values}var ve=EEe;function JC(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(JC.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}}});JC.clone=function(e){if(u(e))return new JC(e._format,e._datatype,e._width,e._height,e._buffer)};JC.prototype.clone=function(){return JC.clone(this)};var lD=JC;var IJ=vo(Ll(),1);function PJ(){if(!u(ra._canTransferArrayBuffer)){let e=new Worker(RJ("Workers/transferTypedArrayTest.js"));e.postMessage=y(e.webkitPostMessage,e.postMessage);let t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return ra._canTransferArrayBuffer=!1,ra._canTransferArrayBuffer}let i=Jr();e.onmessage=function(o){let r=o.data.array,s=u(r)&&r[0]===t;i.resolve(s),e.terminate(),ra._canTransferArrayBuffer=s},ra._canTransferArrayBuffer=i.promise}return ra._canTransferArrayBuffer}var MG=new Ae;function OJ(e,t){--e._activeTasks;let n=t.id;if(!u(n))return;let i=e._deferreds,o=i[n];if(u(t.error)){let r=t.error;r.name==="RuntimeError"?(r=new ue(t.error.message),r.stack=t.error.stack):r.name==="DeveloperError"&&(r=new de(t.error.message),r.stack=t.error.stack),MG.raiseEvent(r),o.reject(r)}else MG.raiseEvent(),o.resolve(t.result);delete i[n]}function RJ(e){let t=$t(e);if(h0(t)){let n=`importScripts("${t}");`,i;try{i=new Blob([n],{type:"application/javascript"})}catch{let s=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,a=new s;a.append(n),i=a.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(i)}return t}var BG;function bEe(){return u(BG)||(BG=RJ("Workers/cesiumWorkerBootstrapper.js")),BG}function BJ(e){let t=new Worker(bEe());t.postMessage=y(t.webkitPostMessage,t.postMessage);let n={loaderConfig:{paths:{Workers:$t("Workers")},baseUrl:$t.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(n),t.onmessage=function(i){OJ(e,i.data)},t}function SEe(e,t){let n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Vt.supportsWebAssembly()){if(!u(t.fallbackModulePath))throw new ue(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=$t(t.fallbackModulePath),Promise.resolve(n)}return n.modulePath=$t(t.modulePath),n.wasmBinaryFile=$t(t.wasmBinaryFile),Oe.fetchArrayBuffer({url:n.wasmBinaryFile}).then(function(i){return n.wasmBinary=i,n})}function ra(e,t){let n=new IJ.default(e);this._workerPath=n.scheme().length!==0&&n.fragment().length===0?e:ra._workerModulePrefix+e,this._maximumActiveTasks=y(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}var DEe=[];ra.prototype.scheduleTask=function(e,t){if(u(this._worker)||(this._worker=BJ(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;let n=this;return Promise.resolve(PJ()).then(function(i){u(t)?i||(t.length=0):t=DEe;let o=n._nextID++,r=Jr();return n._deferreds[o]=r,n._worker.postMessage({id:o,parameters:e,canTransferArrayBuffer:i},t),r.promise})};ra.prototype.initWebAssemblyModule=function(e){u(this._worker)||(this._worker=BJ(this));let t=Jr(),n=this,i=this._worker;return SEe(this,e).then(function(o){return Promise.resolve(PJ()).then(function(r){let s,a=o.wasmBinary;u(a)&&r&&(s=[a]),i.onmessage=function(c){i.onmessage=function(l){OJ(n,l.data)},t.resolve(c.data)},i.postMessage({webAssemblyConfig:o},s)})}),t.promise};ra.prototype.isDestroyed=function(){return!1};ra.prototype.destroy=function(){return u(this._worker)&&this._worker.terminate(),le(this)};ra.taskCompletedEvent=MG;ra._defaultWorkerModulePrefix="Workers/";ra._workerModulePrefix=ra._defaultWorkerModulePrefix;ra._canTransferArrayBuffer=void 0;var pi=ra;function km(){}km._transcodeTaskProcessor=new pi("transcodeKTX2",Number.POSITIVE_INFINITY);km._readyPromise=void 0;function vEe(){let e=km._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(){return km._transcodeTaskProcessor});km._readyPromise=e}km.transcode=function(e,t){return u(km._readyPromise)||vEe(),km._readyPromise.then(function(n){let i;if(e instanceof ArrayBuffer){let o=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:o},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])}).then(function(n){let i=n.length,o=Object.keys(n[0]),r=o.length,s;for(s=0;s<i;s++){let a=n[s];for(let c=0;c<r;c++){let l=a[o[c]];a[o[c]]=new lD(l.internalFormat,l.datatype,l.width,l.height,l.levelBuffer)}}if(r===1){for(s=0;s<i;++s)n[s]=n[s][o[0]];i===1&&(n=n[0])}return n}).catch(function(n){throw n})};var uD=km;var MJ;LJ.setKTX2SupportedFormats=function(e,t,n,i,o,r){MJ={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function LJ(e){let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=Oe.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return uD.transcode(n,MJ)})}var tl=LJ;function U3(e,t,n,i,o,r,s,a,c,l,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=c,this._flipY=l,this._initialized=f}Object.defineProperties(U3.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});U3.prototype.copyFrom=function(e){let t=y(e.xOffset,0),n=y(e.yOffset,0),i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);let a=i.width,c=i.height,l=i.arrayBufferView,f=this._size,d=this._pixelFormat,p=this._internalFormat,g=this._pixelDatatype,m=this._preMultiplyAlpha,A=this._flipY,x=y(e.skipColorSpaceConversion,!1),C=4;u(l)&&(C=rt.alignmentInBytes(d,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,C),x?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let T=!1;if(!this._initialized){if(t===0&&n===0&&a===f&&c===f)u(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),A&&(l=rt.flipY(l,d,g,f,f)),o.texImage2D(s,0,p,f,f,0,d,Xe.toWebGLConstant(g,this._context),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,A),o.texImage2D(s,0,p,d,Xe.toWebGLConstant(g,this._context),i)),T=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);let E=rt.createTypedArray(d,g,f,f);o.texImage2D(s,0,p,f,f,0,d,Xe.toWebGLConstant(g,this._context),E)}this._initialized=!0}T||(u(l)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),A&&(l=rt.flipY(l,d,g,a,c)),o.texSubImage2D(s,0,t,n,a,c,d,Xe.toWebGLConstant(g,this._context),l)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,A),o.texSubImage2D(s,0,t,n,d,Xe.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};U3.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._size),r=y(r,this._size);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};var yh=U3;var k3={DONT_CARE:ee.DONT_CARE,FASTEST:ee.FASTEST,NICEST:ee.NICEST,validate:function(e){return e===k3.DONT_CARE||e===k3.FASTEST||e===k3.NICEST}},Ah=Object.freeze(k3);var z3={NEAREST:ee.NEAREST,LINEAR:ee.LINEAR};z3.validate=function(e){return e===z3.NEAREST||e===z3.LINEAR};var yi=Object.freeze(z3);var q_={NEAREST:ee.NEAREST,LINEAR:ee.LINEAR,NEAREST_MIPMAP_NEAREST:ee.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:ee.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:ee.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:ee.LINEAR_MIPMAP_LINEAR};q_.validate=function(e){return e===q_.NEAREST||e===q_.LINEAR||e===q_.NEAREST_MIPMAP_NEAREST||e===q_.LINEAR_MIPMAP_NEAREST||e===q_.NEAREST_MIPMAP_LINEAR||e===q_.LINEAR_MIPMAP_LINEAR};var an=Object.freeze(q_);var H3={CLAMP_TO_EDGE:ee.CLAMP_TO_EDGE,REPEAT:ee.REPEAT,MIRRORED_REPEAT:ee.MIRRORED_REPEAT,validate:function(e){return e===H3.CLAMP_TO_EDGE||e===H3.REPEAT||e===H3.MIRRORED_REPEAT}},vn=Object.freeze(H3);function fD(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.wrapS,vn.CLAMP_TO_EDGE),n=y(e.wrapT,vn.CLAMP_TO_EDGE),i=y(e.minificationFilter,an.LINEAR),o=y(e.magnificationFilter,yi.LINEAR),r=u(e.maximumAnisotropy)?e.maximumAnisotropy:1;this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(fD.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}}});fD.equals=function(e,t){return e===t||u(e)&&u(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};fD.NEAREST=Object.freeze(new fD({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST}));var ln=fD;function dD(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=e.source,i,o;if(u(n)){let T=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];i=T[0].width,o=T[0].height}else i=e.width,o=e.height;let r=i,s=y(e.pixelDatatype,Xe.UNSIGNED_BYTE),a=y(e.pixelFormat,rt.RGBA),c=rt.toInternalFormat(a,s,t),l=rt.textureSizeInBytes(a,s,r,r)*6,f=e.preMultiplyAlpha||a===rt.RGB||a===rt.LUMINANCE,d=y(e.flipY,!0),p=y(e.skipColorSpaceConversion,!1),g=t._gl,m=g.TEXTURE_CUBE_MAP,A=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,A);function x(T,E,S,D,w){let R=E.arrayBufferView;u(R)||(R=E.bufferView);let O=4;u(R)&&(O=rt.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,O),w?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),u(R)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),D&&(R=rt.flipY(R,a,s,r,r)),g.texImage2D(T,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),R)):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,D),g.texImage2D(T,0,c,a,Xe.toWebGLConstant(s,t),E))}u(n)?(x(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,f,d,p),x(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,f,d,p),x(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,f,d,p),x(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,f,d,p),x(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,f,d,p),x(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,f,d,p)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,r,r,0,a,Xe.toWebGLConstant(s,t),null)),g.bindTexture(m,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=m,this._texture=A,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=l,this._preMultiplyAlpha=f,this._flipY=d,this._sampler=void 0;let C=u(n);this._positiveX=new yh(t,A,m,g.TEXTURE_CUBE_MAP_POSITIVE_X,c,a,s,r,f,d,C),this._negativeX=new yh(t,A,m,g.TEXTURE_CUBE_MAP_NEGATIVE_X,c,a,s,r,f,d,C),this._positiveY=new yh(t,A,m,g.TEXTURE_CUBE_MAP_POSITIVE_Y,c,a,s,r,f,d,C),this._negativeY=new yh(t,A,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,c,a,s,r,f,d,C),this._positiveZ=new yh(t,A,m,g.TEXTURE_CUBE_MAP_POSITIVE_Z,c,a,s,r,f,d,C),this._negativeZ=new yh(t,A,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,c,a,s,r,f,d,C),this.sampler=u(e.sampler)?e.sampler:new ln}Object.defineProperties(dD.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){let t=e.minificationFilter,n=e.magnificationFilter,i=t===an.NEAREST_MIPMAP_NEAREST||t===an.NEAREST_MIPMAP_LINEAR||t===an.LINEAR_MIPMAP_NEAREST||t===an.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===Xe.FLOAT&&!o.textureFloatLinear||r===Xe.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?an.NEAREST_MIPMAP_NEAREST:an.NEAREST,n=yi.NEAREST);let s=o._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.texParameteri(a,s.TEXTURE_MIN_FILTER,t),s.texParameteri(a,s.TEXTURE_MAG_FILTER,n),s.texParameteri(a,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(a,s.TEXTURE_WRAP_T,e.wrapT),u(this._textureFilterAnisotropic)&&s.texParameteri(a,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(a,null),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}}});dD.prototype.generateMipmap=function(e){e=y(e,Ah.DONT_CARE),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)};dD.prototype.isDestroyed=function(){return!1};dD.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=le(this._positiveX),this._negativeX=le(this._negativeX),this._positiveY=le(this._positiveY),this._negativeY=le(this._negativeY),this._positiveZ=le(this._positiveZ),this._negativeZ=le(this._negativeZ),le(this)};var Ma=dD;function wEe(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}var La=wEe;var hD=`/**
 * A built-in GLSL floating-point constant for converting radians to degrees.
 *
 * @alias czm_degreesPerRadian
 * @glslConstant
 *
 * @see CesiumMath.DEGREES_PER_RADIAN
 *
 * @example
 * // GLSL declaration
 * const float czm_degreesPerRadian = ...;
 *
 * // Example
 * float deg = czm_degreesPerRadian * rad;
 */
const float czm_degreesPerRadian = 57.29577951308232;
`;var mD=`/**
 * A built-in GLSL vec2 constant for defining the depth range.
 * This is a workaround to a bug where IE11 does not implement gl_DepthRange.
 *
 * @alias czm_depthRange
 * @glslConstant
 *
 * @example
 * // GLSL declaration
 * float depthRangeNear = czm_depthRange.near;
 * float depthRangeFar = czm_depthRange.far;
 *
 */
const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
`;var pD=`/**
 * 0.1
 *
 * @name czm_epsilon1
 * @glslConstant
 */
const float czm_epsilon1 = 0.1;
`;var _D=`/**
 * 0.01
 *
 * @name czm_epsilon2
 * @glslConstant
 */
const float czm_epsilon2 = 0.01;
`;var gD=`/**
 * 0.001
 *
 * @name czm_epsilon3
 * @glslConstant
 */
const float czm_epsilon3 = 0.001;
`;var yD=`/**
 * 0.0001
 *
 * @name czm_epsilon4
 * @glslConstant
 */
const float czm_epsilon4 = 0.0001;
`;var AD=`/**
 * 0.00001
 *
 * @name czm_epsilon5
 * @glslConstant
 */
const float czm_epsilon5 = 0.00001;
`;var xD=`/**
 * 0.000001
 *
 * @name czm_epsilon6
 * @glslConstant
 */
const float czm_epsilon6 = 0.000001;
`;var CD=`/**
 * 0.0000001
 *
 * @name czm_epsilon7
 * @glslConstant
 */
const float czm_epsilon7 = 0.0000001;
`;var TD=`/**
 * DOC_TBA
 *
 * @name czm_infinity
 * @glslConstant
 */
const float czm_infinity = 5906376272000.0;  // Distance from the Sun to Pluto in meters.  TODO: What is best given lowp, mediump, and highp?
`;var ED=`/**
 * A built-in GLSL floating-point constant for <code>1/pi</code>.
 *
 * @alias czm_oneOverPi
 * @glslConstant
 *
 * @see CesiumMath.ONE_OVER_PI
 *
 * @example
 * // GLSL declaration
 * const float czm_oneOverPi = ...;
 *
 * // Example
 * float pi = 1.0 / czm_oneOverPi;
 */
const float czm_oneOverPi = 0.3183098861837907;
`;var bD=`/**
 * A built-in GLSL floating-point constant for <code>1/2pi</code>.
 *
 * @alias czm_oneOverTwoPi
 * @glslConstant
 *
 * @see CesiumMath.ONE_OVER_TWO_PI
 *
 * @example
 * // GLSL declaration
 * const float czm_oneOverTwoPi = ...;
 *
 * // Example
 * float pi = 2.0 * czm_oneOverTwoPi;
 */
const float czm_oneOverTwoPi = 0.15915494309189535;
`;var SD=`/**
 * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
 *
 * @name czm_passCesium3DTile
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passCesium3DTile = 4.0;
`;var DD=`/**
 * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
 *
 * @name czm_passCesium3DTileClassification
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passCesium3DTileClassification = 5.0;
`;var vD=`/**
 * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}
 *
 * @name czm_passCesium3DTileClassificationIgnoreShow
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
`;var wD=`/**
 * The automatic GLSL constant for {@link Pass#CLASSIFICATION}
 *
 * @name czm_passClassification
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passClassification = 7.0;
`;var ID=`/**
 * The automatic GLSL constant for {@link Pass#COMPUTE}
 *
 * @name czm_passCompute
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passCompute = 1.0;
`;var PD=`/**
 * The automatic GLSL constant for {@link Pass#ENVIRONMENT}
 *
 * @name czm_passEnvironment
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passEnvironment = 0.0;
`;var OD=`/**
 * The automatic GLSL constant for {@link Pass#GLOBE}
 *
 * @name czm_passGlobe
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passGlobe = 2.0;
`;var RD=`/**
 * The automatic GLSL constant for {@link Pass#OPAQUE}
 *
 * @name czm_passOpaque
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passOpaque = 7.0;
`;var BD=`/**
 * The automatic GLSL constant for {@link Pass#OVERLAY}
 *
 * @name czm_passOverlay
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passOverlay = 10.0;
`;var MD=`/**
 * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}
 *
 * @name czm_passTerrainClassification
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passTerrainClassification = 3.0;
`;var LD=`/**
 * The automatic GLSL constant for {@link Pass#TRANSLUCENT}
 *
 * @name czm_passTranslucent
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passTranslucent = 8.0;
`;var ND=`/**
 * The automatic GLSL constant for {@link Pass#VOXELS}
 *
 * @name czm_passVoxels
 * @glslConstant
 *
 * @see czm_pass
 */
const float czm_passVoxels = 9.0;
`;var FD=`/**
 * A built-in GLSL floating-point constant for <code>Math.PI</code>.
 *
 * @alias czm_pi
 * @glslConstant
 *
 * @see CesiumMath.PI
 *
 * @example
 * // GLSL declaration
 * const float czm_pi = ...;
 *
 * // Example
 * float twoPi = 2.0 * czm_pi;
 */
const float czm_pi = 3.141592653589793;
`;var VD=`/**
 * A built-in GLSL floating-point constant for <code>pi/4</code>.
 *
 * @alias czm_piOverFour
 * @glslConstant
 *
 * @see CesiumMath.PI_OVER_FOUR
 *
 * @example
 * // GLSL declaration
 * const float czm_piOverFour = ...;
 *
 * // Example
 * float pi = 4.0 * czm_piOverFour;
 */
const float czm_piOverFour = 0.7853981633974483;
`;var UD=`/**
 * A built-in GLSL floating-point constant for <code>pi/6</code>.
 *
 * @alias czm_piOverSix
 * @glslConstant
 *
 * @see CesiumMath.PI_OVER_SIX
 *
 * @example
 * // GLSL declaration
 * const float czm_piOverSix = ...;
 *
 * // Example
 * float pi = 6.0 * czm_piOverSix;
 */
const float czm_piOverSix = 0.5235987755982988;
`;var kD=`/**
 * A built-in GLSL floating-point constant for <code>pi/3</code>.
 *
 * @alias czm_piOverThree
 * @glslConstant
 *
 * @see CesiumMath.PI_OVER_THREE
 *
 * @example
 * // GLSL declaration
 * const float czm_piOverThree = ...;
 *
 * // Example
 * float pi = 3.0 * czm_piOverThree;
 */
const float czm_piOverThree = 1.0471975511965976;
`;var zD=`/**
 * A built-in GLSL floating-point constant for <code>pi/2</code>.
 *
 * @alias czm_piOverTwo
 * @glslConstant
 *
 * @see CesiumMath.PI_OVER_TWO
 *
 * @example
 * // GLSL declaration
 * const float czm_piOverTwo = ...;
 *
 * // Example
 * float pi = 2.0 * czm_piOverTwo;
 */
const float czm_piOverTwo = 1.5707963267948966;
`;var HD=`/**
 * A built-in GLSL floating-point constant for converting degrees to radians.
 *
 * @alias czm_radiansPerDegree
 * @glslConstant
 *
 * @see CesiumMath.RADIANS_PER_DEGREE
 *
 * @example
 * // GLSL declaration
 * const float czm_radiansPerDegree = ...;
 *
 * // Example
 * float rad = czm_radiansPerDegree * deg;
 */
const float czm_radiansPerDegree = 0.017453292519943295;
`;var GD=`/**
 * The constant identifier for the 2D {@link SceneMode}
 *
 * @name czm_sceneMode2D
 * @glslConstant
 * @see czm_sceneMode
 * @see czm_sceneModeColumbusView
 * @see czm_sceneMode3D
 * @see czm_sceneModeMorphing
 */
const float czm_sceneMode2D = 2.0;
`;var WD=`/**
 * The constant identifier for the 3D {@link SceneMode}
 *
 * @name czm_sceneMode3D
 * @glslConstant
 * @see czm_sceneMode
 * @see czm_sceneMode2D
 * @see czm_sceneModeColumbusView
 * @see czm_sceneModeMorphing
 */
const float czm_sceneMode3D = 3.0;
`;var jD=`/**
 * The constant identifier for the Columbus View {@link SceneMode}
 *
 * @name czm_sceneModeColumbusView
 * @glslConstant
 * @see czm_sceneMode
 * @see czm_sceneMode2D
 * @see czm_sceneMode3D
 * @see czm_sceneModeMorphing
 */
const float czm_sceneModeColumbusView = 1.0;
`;var YD=`/**
 * The constant identifier for the Morphing {@link SceneMode}
 *
 * @name czm_sceneModeMorphing
 * @glslConstant
 * @see czm_sceneMode
 * @see czm_sceneMode2D
 * @see czm_sceneModeColumbusView
 * @see czm_sceneMode3D
 */
const float czm_sceneModeMorphing = 0.0;
`;var qD=`/**
 * A built-in GLSL floating-point constant for one solar radius.
 *
 * @alias czm_solarRadius
 * @glslConstant
 *
 * @see CesiumMath.SOLAR_RADIUS
 *
 * @example
 * // GLSL declaration
 * const float czm_solarRadius = ...;
 */
const float czm_solarRadius = 695500000.0;
`;var XD=`/**
 * A built-in GLSL floating-point constant for <code>3pi/2</code>.
 *
 * @alias czm_threePiOver2
 * @glslConstant
 *
 * @see CesiumMath.THREE_PI_OVER_TWO
 *
 * @example
 * // GLSL declaration
 * const float czm_threePiOver2 = ...;
 *
 * // Example
 * float pi = (2.0 / 3.0) * czm_threePiOver2;
 */
const float czm_threePiOver2 = 4.71238898038469;
`;var KD=`/**
 * A built-in GLSL floating-point constant for <code>2pi</code>.
 *
 * @alias czm_twoPi
 * @glslConstant
 *
 * @see CesiumMath.TWO_PI
 *
 * @example
 * // GLSL declaration
 * const float czm_twoPi = ...;
 *
 * // Example
 * float pi = czm_twoPi / 2.0;
 */
const float czm_twoPi = 6.283185307179586;
`;var ZD=`/**
 * The maximum latitude, in radians, both North and South, supported by a Web Mercator
 * (EPSG:3857) projection.  Technically, the Mercator projection is defined
 * for any latitude up to (but not including) 90 degrees, but it makes sense
 * to cut it off sooner because it grows exponentially with increasing latitude.
 * The logic behind this particular cutoff value, which is the one used by
 * Google Maps, Bing Maps, and Esri, is that it makes the projection
 * square.  That is, the rectangle is equal in the X and Y directions.
 *
 * The constant value is computed as follows:
 *   czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))
 *
 * @name czm_webMercatorMaxLatitude
 * @glslConstant
 */
const float czm_webMercatorMaxLatitude = 1.4844222297453324;
`;var JD=`/**
 * @name czm_depthRangeStruct
 * @glslStruct
 */
struct czm_depthRangeStruct
{
    float near;
    float far;
};
`;var QD=`/**
 * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.
 *
 * @name czm_material
 * @glslStruct
 *
 * @property {vec3} diffuse Incoming light that scatters evenly in all directions.
 * @property {float} specular Intensity of incoming light reflecting in a single direction.
 * @property {float} shininess The sharpness of the specular reflection.  Higher values create a smaller, more focused specular highlight.
 * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
 * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
 * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
 */
struct czm_material
{
    vec3 diffuse;
    float specular;
    float shininess;
    vec3 normal;
    vec3 emission;
    float alpha;
};
`;var $D=`/**
 * Used as input to every material's czm_getMaterial function.
 *
 * @name czm_materialInput
 * @glslStruct
 *
 * @property {float} s 1D texture coordinates.
 * @property {vec2} st 2D texture coordinates.
 * @property {vec3} str 3D texture coordinates.
 * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.
 * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.
 * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates.  The magnitude is the distance in meters from the fragment to the eye.
 * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid.  Only available for globe materials.
 * @property {float} slope The slope of the terrain in radians.  0 is flat; pi/2 is vertical.  Only available for globe materials.
 * @property {float} aspect The aspect of the terrain in radians.  0 is East, pi/2 is North, pi is West, 3pi/2 is South.  Only available for globe materials.
 */
struct czm_materialInput
{
    float s;
    vec2 st;
    vec3 str;
    vec3 normalEC;
    mat3 tangentToEyeMatrix;
    vec3 positionToEyeEC;
    float height;
    float slope;
    float aspect;
};
`;var ev=`/**
 * Struct for representing a material for a {@link Model}. The model
 * rendering pipeline will pass this struct between material, custom shaders,
 * and lighting stages. This is not to be confused with {@link czm_material}
 * which is used by the older Fabric materials system, although they are similar.
 * <p>
 * All color values (diffuse, specular, emissive) are in linear color space.
 * </p>
 *
 * @name czm_modelMaterial
 * @glslStruct
 *
 * @property {vec3} diffuse Incoming light that scatters evenly in all directions.
 * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
 * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.
 * @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces.
 * @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
 * @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded.
 * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
 */
struct czm_modelMaterial {
    vec3 diffuse;
    float alpha;
    vec3 specular;
    float roughness;
    vec3 normalEC;
    float occlusion;
    vec3 emissive;
};
`;var tv=`/**
 * Struct for representing the output of a custom vertex shader.
 * 
 * @name czm_modelVertexOutput
 * @glslStruct
 *
 * @see {@link CustomShader}
 * @see {@link Model}
 *
 * @property {vec3} positionMC The position of the vertex in model coordinates
 * @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives. 
 */
struct czm_modelVertexOutput {
  vec3 positionMC;
  float pointSize;
};
`;var nv=`/**
 * Parameters for {@link czm_pbrLighting}
 *
 * @name czm_material
 * @glslStruct
 *
 * @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation
 * @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is.
 * @property {vec3} f0 The reflectance of the material at normal incidence
 */
struct czm_pbrParameters
{
    vec3 diffuseColor;
    float roughness;
    vec3 f0;
};
`;var iv=`/**
 * DOC_TBA
 *
 * @name czm_ray
 * @glslStruct
 */
struct czm_ray
{
    vec3 origin;
    vec3 direction;
};
`;var ov=`/**
 * DOC_TBA
 *
 * @name czm_raySegment
 * @glslStruct
 */
struct czm_raySegment
{
    float start;
    float stop;
};

/**
 * DOC_TBA
 *
 * @name czm_emptyRaySegment
 * @glslConstant 
 */
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);

/**
 * DOC_TBA
 *
 * @name czm_fullRaySegment
 * @glslConstant 
 */
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
`;var rv=`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 sv=`/**
 * Converts an HSB color (hue, saturation, brightness) to RGB
 * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
 *
 * @name czm_HSBToRGB
 * @glslFunction
 * 
 * @param {vec3} hsb The color in HSB.
 *
 * @returns {vec3} The color in RGB.
 *
 * @example
 * vec3 hsb = czm_RGBToHSB(rgb);
 * hsb.z *= 0.1;
 * rgb = czm_HSBToRGB(hsb);
 */

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 av=`/**
 * Converts an HSL color (hue, saturation, lightness) to RGB
 * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
 *
 * @name czm_HSLToRGB
 * @glslFunction
 * 
 * @param {vec3} rgb The color in HSL.
 *
 * @returns {vec3} The color in RGB.
 *
 * @example
 * vec3 hsl = czm_RGBToHSL(rgb);
 * hsl.z *= 0.1;
 * rgb = czm_HSLToRGB(hsl);
 */

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 cv=`/**
 * Converts an RGB color to HSB (hue, saturation, brightness)
 * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
 *
 * @name czm_RGBToHSB
 * @glslFunction
 * 
 * @param {vec3} rgb The color in RGB.
 *
 * @returns {vec3} The color in HSB.
 *
 * @example
 * vec3 hsb = czm_RGBToHSB(rgb);
 * hsb.z *= 0.1;
 * rgb = czm_HSBToRGB(hsb);
 */

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 lv=`/**
 * Converts an RGB color to HSL (hue, saturation, lightness)
 * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
 *
 * @name czm_RGBToHSL
 * @glslFunction
 * 
 * @param {vec3} rgb The color in RGB.
 *
 * @returns {vec3} The color in HSL.
 *
 * @example
 * vec3 hsl = czm_RGBToHSL(rgb);
 * hsl.z *= 0.1;
 * rgb = czm_HSLToRGB(hsl);
 */
 
vec3 RGBtoHCV(vec3 rgb)
{
    // Based on work by Sam Hocevar and Emil Persson
    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 uv=`/**
 * Converts an RGB color to CIE Yxy.
 * <p>The conversion is described in
 * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
 * </p>
 * 
 * @name czm_RGBToXYZ
 * @glslFunction
 * 
 * @param {vec3} rgb The color in RGB.
 *
 * @returns {vec3} The color in CIE Yxy.
 *
 * @example
 * vec3 xyz = czm_RGBToXYZ(rgb);
 * xyz.x = max(xyz.x - luminanceThreshold, 0.0);
 * rgb = czm_XYZToRGB(xyz);
 */
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 fv=`/**
 * Converts a CIE Yxy color to RGB.
 * <p>The conversion is described in
 * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
 * </p>
 * 
 * @name czm_XYZToRGB
 * @glslFunction
 * 
 * @param {vec3} Yxy The color in CIE Yxy.
 *
 * @returns {vec3} The color in RGB.
 *
 * @example
 * vec3 xyz = czm_RGBToXYZ(rgb);
 * xyz.x = max(xyz.x - luminanceThreshold, 0.0);
 * rgb = czm_XYZToRGB(xyz);
 */
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 dv=`// See:
//    https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/

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 hv=`/**
 * @private
 */
float czm_alphaWeight(float a)
{
    float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];

    // See Weighted Blended Order-Independent Transparency for examples of different weighting functions:
    // http://jcgt.org/published/0002/02/09/
    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 mv=`/**
 * Procedural anti-aliasing by blurring two colors that meet at a sharp edge.
 *
 * @name czm_antialias
 * @glslFunction
 *
 * @param {vec4} color1 The color on one side of the edge.
 * @param {vec4} color2 The color on the other side of the edge.
 * @param {vec4} currentcolor The current color, either <code>color1</code> or <code>color2</code>.
 * @param {float} dist The distance to the edge in texture coordinates.
 * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.
 * @returns {vec4} The anti-aliased color.
 *
 * @example
 * // GLSL declarations
 * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);
 * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);
 *
 * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space
 * float dist = abs(textureCoordinates.t - 0.5);
 * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));
 * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);
 */
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); //makes the transition nicer
    
    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 pv=`/**
 * Approximately computes spherical coordinates given a normal.
 * Uses approximate inverse trigonometry for speed and consistency,
 * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.
 *
 * @name czm_approximateSphericalCoordinates
 * @glslFunction
 *
 * @param {vec3} normal arbitrary-length normal.
 *
 * @returns {vec2} Approximate latitude and longitude spherical coordinates.
 */
vec2 czm_approximateSphericalCoordinates(vec3 normal) {
    // Project into plane with vertical for latitude
    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 _v=`/**
 * Determines if the fragment is back facing
 *
 * @name czm_backFacing
 * @glslFunction 
 * 
 * @returns {bool} <code>true</code> if the fragment is back facing; otherwise, <code>false</code>.
 */
bool czm_backFacing()
{
    // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494.
    return gl_FrontFacing == false;
}
`;var gv=`/**
 * Branchless ternary operator to be used when it's inexpensive to explicitly
 * evaluate both possibilities for a float expression.
 *
 * @name czm_branchFreeTernary
 * @glslFunction
 *
 * @param {bool} comparison A comparison statement
 * @param {float} a Value to return if the comparison is true.
 * @param {float} b Value to return if the comparison is false.
 *
 * @returns {float} equivalent of comparison ? a : b
 */
float czm_branchFreeTernary(bool comparison, float a, float b) {
    float useA = float(comparison);
    return a * useA + b * (1.0 - useA);
}

/**
 * Branchless ternary operator to be used when it's inexpensive to explicitly
 * evaluate both possibilities for a vec2 expression.
 *
 * @name czm_branchFreeTernary
 * @glslFunction
 *
 * @param {bool} comparison A comparison statement
 * @param {vec2} a Value to return if the comparison is true.
 * @param {vec2} b Value to return if the comparison is false.
 *
 * @returns {vec2} equivalent of comparison ? a : b
 */
vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {
    float useA = float(comparison);
    return a * useA + b * (1.0 - useA);
}

/**
 * Branchless ternary operator to be used when it's inexpensive to explicitly
 * evaluate both possibilities for a vec3 expression.
 *
 * @name czm_branchFreeTernary
 * @glslFunction
 *
 * @param {bool} comparison A comparison statement
 * @param {vec3} a Value to return if the comparison is true.
 * @param {vec3} b Value to return if the comparison is false.
 *
 * @returns {vec3} equivalent of comparison ? a : b
 */
vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {
    float useA = float(comparison);
    return a * useA + b * (1.0 - useA);
}

/**
 * Branchless ternary operator to be used when it's inexpensive to explicitly
 * evaluate both possibilities for a vec4 expression.
 *
 * @name czm_branchFreeTernary
 * @glslFunction
 *
 * @param {bool} comparison A comparison statement
 * @param {vec3} a Value to return if the comparison is true.
 * @param {vec3} b Value to return if the comparison is false.
 *
 * @returns {vec3} equivalent of comparison ? a : b
 */
vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {
    float useA = float(comparison);
    return a * useA + b * (1.0 - useA);
}
`;var yv=`
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 Av=`
uniform vec4 shadowMap_cascadeDistances;

float czm_cascadeDistance(vec4 weights)
{
    return dot(shadowMap_cascadeDistances, weights);
}
`;var xv=`
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 Cv=`
uniform vec4 shadowMap_cascadeSplits[2];

vec4 czm_cascadeWeights(float depthEye)
{
    // One component is set to 1.0 and all others set to 0.0.
    vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));
    vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);
    return near * far;
}
`;var Tv=`/**
 * DOC_TBA
 *
 * @name czm_columbusViewMorph
 * @glslFunction
 */
vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
{
    // Just linear for now.
    vec3 p = mix(position2D.xyz, position3D.xyz, time);
    return vec4(p, 1.0);
}
`;var Ev=`/**
 * Returns a position in model coordinates relative to eye taking into
 * account the current scene mode: 3D, 2D, or Columbus view.
 * <p>
 * This uses standard position attributes, <code>position3DHigh</code>, 
 * <code>position3DLow</code>, <code>position2DHigh</code>, and <code>position2DLow</code>, 
 * and should be used when writing a vertex shader for an {@link Appearance}.
 * </p>
 *
 * @name czm_computePosition
 * @glslFunction
 *
 * @returns {vec4} The position relative to eye.
 *
 * @example
 * vec4 p = czm_computePosition();
 * v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
 * gl_Position = czm_modelViewProjectionRelativeToEye * p;
 *
 * @see czm_translateRelativeToEye
 */
vec4 czm_computePosition();
`;var bv=`/**
 * @private
 */
vec2 cordic(float angle)
{
// Scale the vector by the appropriate factor for the 24 iterations to follow.
    vec2 vector = vec2(6.0725293500888267e-1, 0.0);
// Iteration 1
    float sense = (angle < 0.0) ? -1.0 : 1.0;
 //   float factor = sense * 1.0;  // 2^-0
    mat2 rotation = mat2(1.0, sense, -sense, 1.0);
    vector = rotation * vector;
    angle -= sense * 7.8539816339744828e-1;  // atan(2^-0)
// Iteration 2
    sense = (angle < 0.0) ? -1.0 : 1.0;
    float factor = sense * 5.0e-1;  // 2^-1
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 4.6364760900080609e-1;  // atan(2^-1)
// Iteration 3
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 2.5e-1;  // 2^-2
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 2.4497866312686414e-1;  // atan(2^-2)
// Iteration 4
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.25e-1;  // 2^-3
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.2435499454676144e-1;  // atan(2^-3)
// Iteration 5
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 6.25e-2;  // 2^-4
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 6.2418809995957350e-2;  // atan(2^-4)
// Iteration 6
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 3.125e-2;  // 2^-5
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 3.1239833430268277e-2;  // atan(2^-5)
// Iteration 7
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.5625e-2;  // 2^-6
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.5623728620476831e-2;  // atan(2^-6)
// Iteration 8
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 7.8125e-3;  // 2^-7
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 7.8123410601011111e-3;  // atan(2^-7)
// Iteration 9
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 3.90625e-3;  // 2^-8
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 3.9062301319669718e-3;  // atan(2^-8)
// Iteration 10
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.953125e-3;  // 2^-9
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.9531225164788188e-3;  // atan(2^-9)
// Iteration 11
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 9.765625e-4;  // 2^-10
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 9.7656218955931946e-4;  // atan(2^-10)
// Iteration 12
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 4.8828125e-4;  // 2^-11
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 4.8828121119489829e-4;  // atan(2^-11)
// Iteration 13
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 2.44140625e-4;  // 2^-12
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 2.4414062014936177e-4;  // atan(2^-12)
// Iteration 14
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.220703125e-4;  // 2^-13
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.2207031189367021e-4;  // atan(2^-13)
// Iteration 15
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 6.103515625e-5;  // 2^-14
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 6.1035156174208773e-5;  // atan(2^-14)
// Iteration 16
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 3.0517578125e-5;  // 2^-15
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 3.0517578115526096e-5;  // atan(2^-15)
// Iteration 17
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.52587890625e-5;  // 2^-16
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.5258789061315762e-5;  // atan(2^-16)
// Iteration 18
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 7.62939453125e-6;  // 2^-17
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 7.6293945311019700e-6;  // atan(2^-17)
// Iteration 19
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 3.814697265625e-6;  // 2^-18
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 3.8146972656064961e-6;  // atan(2^-18)
// Iteration 20
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.9073486328125e-6;  // 2^-19
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 1.9073486328101870e-6;  // atan(2^-19)
// Iteration 21
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 9.5367431640625e-7;  // 2^-20
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 9.5367431640596084e-7;  // atan(2^-20)
// Iteration 22
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 4.76837158203125e-7;  // 2^-21
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 4.7683715820308884e-7;  // atan(2^-21)
// Iteration 23
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 2.384185791015625e-7;  // 2^-22
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
    angle -= sense * 2.3841857910155797e-7;  // atan(2^-22)
// Iteration 24
    sense = (angle < 0.0) ? -1.0 : 1.0;
    factor = sense * 1.1920928955078125e-7;  // 2^-23
    rotation[0][1] = factor;
    rotation[1][0] = -factor;
    vector = rotation * vector;
//    angle -= sense * 1.1920928955078068e-7;  // atan(2^-23)

    return vector;
}

/**
 * Computes the cosine and sine of the provided angle using the CORDIC algorithm.
 *
 * @name czm_cosineAndSine
 * @glslFunction
 *
 * @param {float} angle The angle in radians.
 *
 * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).
 *
 * @example
 * vec2 v = czm_cosineAndSine(czm_piOverSix);
 * float cosine = v.x;
 * float sine = v.y;
 */
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 Sv=`/**
 * Decompresses texture coordinates that were packed into a single float.
 *
 * @name czm_decompressTextureCoordinates
 * @glslFunction
 *
 * @param {float} encoded The compressed texture coordinates.
 * @returns {vec2} The decompressed texture coordinates.
 */
 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 Dv=`/**
 * Get default parameters for physically based rendering. These defaults
 * describe a rough dielectric (non-metal) surface (e.g. rough plastic).
 *
 * @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting}
 */
czm_pbrParameters czm_defaultPbrMaterial()
{
    czm_pbrParameters results;
    results.diffuseColor = vec3(1.0);
    results.roughness = 1.0;

    const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
    results.f0 = REFLECTANCE_DIELECTRIC;
    return results;
}
`;var vv=`// emulated noperspective
#if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH)
out float v_WindowZ;
#endif

/**
 * Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.
 * GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes, 
 * capping the shadow volume. More information here: 
 * https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.
 *
 * When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring 
 * no geometry gets clipped by setting the clip space z value to 0.0 and then
 * sending the unaltered screen space z value (using emulated noperspective
 * interpolation) to the frag shader where it is clamped to [0,1] and then
 * written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:
 * https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.
 *
 * When GL_EXT_frag_depth is not available, which is the case on some mobile 
 * devices, we must attempt to fix this only in the vertex shader. 
 * The approach is to clamp the z value to the far plane, which closes the 
 * shadow volume but also distorts the geometry, so there can still be artifacts
 * on frustum seams.
 *
 * @name czm_depthClamp
 * @glslFunction
 *
 * @param {vec4} coords The vertex in clip coordinates.
 * @returns {vec4} The modified vertex.
 *
 * @example
 * gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));
 *
 * @see czm_writeDepthClamp
 */
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 wv=`/**
 * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system 
 * to eye coordinates.  In east-north-up coordinates, x points east, y points north, and z points along the 
 * surface normal.  East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.
 * <br /><br />
 * The ellipsoid is assumed to be centered at the model coordinate's origin.
 *
 * @name czm_eastNorthUpToEyeCoordinates
 * @glslFunction
 *
 * @param {vec3} positionMC The position on the ellipsoid in model coordinates.
 * @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.
 *
 * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.
 *
 * @example
 * // Transform a vector defined in the east-north-up coordinate 
 * // system, (0, 0, 1) which is the surface normal, to eye 
 * // coordinates.
 * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
 * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);
 */
mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
{
    vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));  // normalized surface tangent in model coordinates
    vec3 tangentEC = normalize(czm_normal3D * tangentMC);                // normalized surface tangent in eye coordiantes
    vec3 bitangentEC = normalize(cross(normalEC, tangentEC));            // normalized surface bitangent in eye coordinates

    return mat3(
        tangentEC.x,   tangentEC.y,   tangentEC.z,
        bitangentEC.x, bitangentEC.y, bitangentEC.z,
        normalEC.x,    normalEC.y,    normalEC.z);
}
`;var Iv=`/**
 * DOC_TBA
 *
 * @name czm_ellipsoidContainsPoint
 * @glslFunction
 *
 */
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 Pv=`/**
 * DOC_TBA
 *
 * @name czm_ellipsoidWgs84TextureCoordinates
 * @glslFunction
 */
vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
{
    return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
}
`;var Ov=`/**
 * Compares <code>left</code> and <code>right</code> componentwise. Returns <code>true</code>
 * if they are within <code>epsilon</code> and <code>false</code> otherwise. The inputs
 * <code>left</code> and <code>right</code> can be <code>float</code>s, <code>vec2</code>s,
 * <code>vec3</code>s, or <code>vec4</code>s.
 *
 * @name czm_equalsEpsilon
 * @glslFunction
 *
 * @param {} left The first vector.
 * @param {} right The second vector.
 * @param {float} epsilon The epsilon to use for equality testing.
 * @returns {bool} <code>true</code> if the components are within <code>epsilon</code> and <code>false</code> otherwise.
 *
 * @example
 * // GLSL declarations
 * bool czm_equalsEpsilon(float left, float right, float epsilon);
 * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);
 * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);
 * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);
 */
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 Rv=`/**
 * DOC_TBA
 *
 * @name czm_eyeOffset
 * @glslFunction
 *
 * @param {vec4} positionEC DOC_TBA.
 * @param {vec3} eyeOffset DOC_TBA.
 *
 * @returns {vec4} DOC_TBA.
 */
vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
{
    // This equation is approximate in x and y.
    vec4 p = positionEC;
    vec4 zEyeOffset = normalize(p) * eyeOffset.z;
    p.xy += eyeOffset.xy + zEyeOffset.xy;
    p.z += zEyeOffset.z;
    return p;
}
`;var Bv=`/**
 * Transforms a position from eye to window coordinates.  The transformation
 * from eye to clip coordinates is done using {@link czm_projection}.
 * The transform from normalized device coordinates to window coordinates is
 * done using {@link czm_viewportTransformation}, which assumes a depth range
 * of <code>near = 0</code> and <code>far = 1</code>.
 * <br /><br />
 * This transform is useful when there is a need to manipulate window coordinates
 * in a vertex shader as done by {@link BillboardCollection}.
 *
 * @name czm_eyeToWindowCoordinates
 * @glslFunction
 *
 * @param {vec4} position The position in eye coordinates to transform.
 *
 * @returns {vec4} The transformed position in window coordinates.
 *
 * @see czm_modelToWindowCoordinates
 * @see czm_projection
 * @see czm_viewportTransformation
 * @see BillboardCollection
 *
 * @example
 * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
 */
vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
{
    vec4 q = czm_projection * positionEC;                        // clip coordinates
    q.xyz /= q.w;                                                // normalized device coordinates
    q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
    return q;
}
`;var Mv=`/**
 * Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input.
 *
 * Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on
 * "Efficient approximations for the arctangent function," Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.
 * Adapted from ShaderFastLibs under MIT License.
 *
 * Chosen for the following characteristics over range [0, 1]:
 * - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan)
 * - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator)
 *
 * The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301);
 * Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2.
 *
 * @name czm_fastApproximateAtan
 * @glslFunction
 *
 * @param {float} x Value between 0 and 1 inclusive.
 *
 * @returns {float} Approximation of atan(x)
 */
float czm_fastApproximateAtan(float x) {
    return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
}

/**
 * Approximation of atan2.
 *
 * Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html
 * However, we replaced their atan curve with Michael Drobot's (see above).
 *
 * @name czm_fastApproximateAtan
 * @glslFunction
 *
 * @param {float} x Value between -1 and 1 inclusive.
 * @param {float} y Value between -1 and 1 inclusive.
 *
 * @returns {float} Approximation of atan2(x, y)
 */
float czm_fastApproximateAtan(float x, float y) {
    // atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications.
    // So range-reduce using abs and by flipping whether x or y is on top.
    float t = abs(x); // t used as swap and atan result.
    float opposite = abs(y);
    float adjacent = max(t, opposite);
    opposite = min(t, opposite);

    t = czm_fastApproximateAtan(opposite / adjacent);

    // Undo range reduction
    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 Lv=`/**
 * Gets the color with fog at a distance from the camera.
 *
 * @name czm_fog
 * @glslFunction
 *
 * @param {float} distanceToCamera The distance to the camera in meters.
 * @param {vec3} color The original color.
 * @param {vec3} fogColor The color of the fog.
 *
 * @returns {vec3} The color adjusted for fog at the distance from the camera.
 */
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);
}

/**
 * Gets the color with fog at a distance from the camera.
 *
 * @name czm_fog
 * @glslFunction
 *
 * @param {float} distanceToCamera The distance to the camera in meters.
 * @param {vec3} color The original color.
 * @param {vec3} fogColor The color of the fog.
 * @param {float} fogModifierConstant A constant to modify the appearance of fog.
 *
 * @returns {vec3} The color adjusted for fog at the distance from the camera.
 */
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 Nv=`/**
 * Converts a color from RGB space to linear space.
 *
 * @name czm_gammaCorrect
 * @glslFunction
 *
 * @param {vec3} color The color in RGB space.
 * @returns {vec3} The color in linear space.
 */
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 Fv=`/**
 * DOC_TBA
 *
 * @name czm_geodeticSurfaceNormal
 * @glslFunction
 *
 * @param {vec3} positionOnEllipsoid DOC_TBA
 * @param {vec3} ellipsoidCenter DOC_TBA
 * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA
 * 
 * @returns {vec3} DOC_TBA.
 */
vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
{
    return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
}
`;var Vv=`/**
 * An czm_material with default values. Every material's czm_getMaterial
 * should use this default material as a base for the material it returns.
 * The default normal value is given by materialInput.normalEC.
 *
 * @name czm_getDefaultMaterial
 * @glslFunction
 *
 * @param {czm_materialInput} input The input used to construct the default material.
 *
 * @returns {czm_material} The default material.
 *
 * @see czm_materialInput
 * @see czm_material
 * @see czm_getMaterial
 */
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 Uv=`/**
 * Calculates the intensity of diffusely reflected light.
 *
 * @name czm_getLambertDiffuse
 * @glslFunction
 *
 * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
 * @param {vec3} normalEC The surface normal in eye coordinates.
 *
 * @returns {float} The intensity of the diffuse reflection.
 *
 * @see czm_phong
 *
 * @example
 * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
 * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
 * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
 */
float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
{
    return max(dot(lightDirectionEC, normalEC), 0.0);
}
`;var kv=`/**
 * Calculates the specular intensity of reflected light.
 *
 * @name czm_getSpecular
 * @glslFunction
 *
 * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
 * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.
 * @param {vec3} normalEC The surface normal in eye coordinates.
 * @param {float} shininess The sharpness of the specular reflection.  Higher values create a smaller, more focused specular highlight.
 *
 * @returns {float} The intensity of the specular highlight.
 *
 * @see czm_phong
 *
 * @example
 * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
 * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
 * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
 */
float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
{
    vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
    float specular = max(dot(toReflectedLight, toEyeEC), 0.0);

    // pow has undefined behavior if both parameters <= 0.
    // Prevent this by making sure shininess is at least czm_epsilon2.
    return pow(specular, max(shininess, czm_epsilon2));
}
`;var zv=`/**
 * @private
 */
vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)
{
    float cosAngle = cos(angleInRadians);
    float sinAngle = sin(angleInRadians);

    // time dependent sampling directions
    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);

    // rotate sampling direction by specified angle
    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));

    // average and scale to between -1 and 1
    return ((noise / 4.0) - 0.5) * 2.0;
}
`;var Hv=`/**
 * Adjusts the hue of a color.
 * 
 * @name czm_hue
 * @glslFunction
 * 
 * @param {vec3} rgb The color.
 * @param {float} adjustment The amount to adjust the hue of the color in radians.
 *
 * @returns {float} The color with the hue adjusted.
 *
 * @example
 * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)
 */
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 Gv=`/**
 * Converts a color in linear space to RGB space.
 *
 * @name czm_inverseGamma
 * @glslFunction
 *
 * @param {vec3} color The color in linear space.
 * @returns {vec3} The color in RGB space.
 */
vec3 czm_inverseGamma(vec3 color) {
    return pow(color, vec3(1.0 / czm_gamma));
}
`;var Wv=`/**
 * Determines if a time interval is empty.
 *
 * @name czm_isEmpty
 * @glslFunction 
 * 
 * @param {czm_raySegment} interval The interval to test.
 * 
 * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
 *
 * @example
 * bool b0 = czm_isEmpty(czm_emptyRaySegment);      // true
 * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
 * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
 */
bool czm_isEmpty(czm_raySegment interval)
{
    return (interval.stop < 0.0);
}
`;var jv=`/**
 * Determines if a time interval is empty.
 *
 * @name czm_isFull
 * @glslFunction 
 * 
 * @param {czm_raySegment} interval The interval to test.
 * 
 * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
 *
 * @example
 * bool b0 = czm_isEmpty(czm_emptyRaySegment);      // true
 * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
 * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
 */
bool czm_isFull(czm_raySegment interval)
{
    return (interval.start == 0.0 && interval.stop == czm_infinity);
}
`;var Yv=`/**
 * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.
 *
 * @name czm_latitudeToWebMercatorFraction
 * @glslFunction
 *
 * @param {float} latitude The geodetic latitude, in radians.
 * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.
 * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.
 *
 * @returns {float} The fraction of the rectangle at which the latitude occurs.  If the latitude is the southern
 *          boundary of the rectangle, the return value will be zero.  If it is the northern boundary, the return
 *          value will be 1.0.  Latitudes in between are mapped according to the Web Mercator projection.
 */ 
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 qv=`/**
 * Computes distance from an point in 2D to a line in 2D.
 *
 * @name czm_lineDistance
 * @glslFunction
 *
 * param {vec2} point1 A point along the line.
 * param {vec2} point2 A point along the line.
 * param {vec2} point A point that may or may not be on the line.
 * returns {float} The distance from the point to the line.
 */
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 Xv=`/**
 * Converts a linear RGB color to an sRGB color.
 *
 * @param {vec3|vec4} linearIn The color in linear color space.
 * @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.
 */
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 Kv=`/**
 * Computes the luminance of a color. 
 *
 * @name czm_luminance
 * @glslFunction
 *
 * @param {vec3} rgb The color.
 * 
 * @returns {float} The luminance.
 *
 * @example
 * float light = czm_luminance(vec3(0.0)); // 0.0
 * float dark = czm_luminance(vec3(1.0));  // ~1.0 
 */
float czm_luminance(vec3 rgb)
{
    // Algorithm from Chapter 10 of Graphics Shaders.
    const vec3 W = vec3(0.2125, 0.7154, 0.0721);
    return dot(rgb, W);
}
`;var Zv=`/**
 * Computes the size of a pixel in meters at a distance from the eye.
 * <p>
 * Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel.
 * </p>
 * @name czm_metersPerPixel
 * @glslFunction
 *
 * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
 * @param {float} pixelRatio The scaling factor from pixel space to coordinate space
 *
 * @returns {float} The meters per pixel at positionEC.
 */
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;
}

/**
 * Computes the size of a pixel in meters at a distance from the eye.
 * <p>
 * Use this version when scaling by pixel ratio.
 * </p>
 * @name czm_metersPerPixel
 * @glslFunction
 *
 * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
 *
 * @returns {float} The meters per pixel at positionEC.
 */
float czm_metersPerPixel(vec4 positionEC)
{
    return czm_metersPerPixel(positionEC, czm_pixelRatio);
}
`;var Jv=`/**
 * Transforms a position from model to window coordinates.  The transformation
 * from model to clip coordinates is done using {@link czm_modelViewProjection}.
 * The transform from normalized device coordinates to window coordinates is
 * done using {@link czm_viewportTransformation}, which assumes a depth range
 * of <code>near = 0</code> and <code>far = 1</code>.
 * <br /><br />
 * This transform is useful when there is a need to manipulate window coordinates
 * in a vertex shader as done by {@link BillboardCollection}.
 * <br /><br />
 * This function should not be confused with {@link czm_viewportOrthographic},
 * which is an orthographic projection matrix that transforms from window 
 * coordinates to clip coordinates.
 *
 * @name czm_modelToWindowCoordinates
 * @glslFunction
 *
 * @param {vec4} position The position in model coordinates to transform.
 *
 * @returns {vec4} The transformed position in window coordinates.
 *
 * @see czm_eyeToWindowCoordinates
 * @see czm_modelViewProjection
 * @see czm_viewportTransformation
 * @see czm_viewportOrthographic
 * @see BillboardCollection
 *
 * @example
 * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);
 */
vec4 czm_modelToWindowCoordinates(vec4 position)
{
    vec4 q = czm_modelViewProjection * position;                // clip coordinates
    q.xyz /= q.w;                                                // normalized device coordinates
    q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
    return q;
}
`;var Qv=`/**
 * DOC_TBA
 *
 * @name czm_multiplyWithColorBalance
 * @glslFunction
 */
vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
{
    // Algorithm from Chapter 10 of Graphics Shaders.
    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 $v=`/**
 * Computes a value that scales with distance.  The scaling is clamped at the near and
 * far distances, and does not extrapolate.  This function works with the
 * {@link NearFarScalar} JavaScript class.
 *
 * @name czm_nearFarScalar
 * @glslFunction
 *
 * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).
 * @param {float} cameraDistSq The square of the current distance from the camera.
 *
 * @returns {float} The value at this distance.
 */
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 ew=` /**
  * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
  * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
  * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
  *
  * @name czm_octDecode
  * @param {vec2} encoded The oct-encoded, unit-length vector
  * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
  * @returns {vec3} The decoded and normalized vector
  */
  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);
  }

/**
 * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
 * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
 * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
 *
 * @name czm_octDecode
 * @param {vec2} encoded The oct-encoded, unit-length vector
 * @returns {vec3} The decoded and normalized vector
 */
 vec3 czm_octDecode(vec2 encoded)
 {
    return czm_octDecode(encoded, 255.0);
 }

 /**
 * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.
 * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
 * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
 *
 * @name czm_octDecode
 * @param {float} encoded The oct-encoded, unit-length vector
 * @returns {vec3} The decoded and normalized vector
 */
 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));
 }

/**
 * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.
 * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
 * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
 *
 * @name czm_octDecode
 * @param {vec2} encoded The packed oct-encoded, unit-length vectors.
 * @param {vec3} vector1 One decoded and normalized vector.
 * @param {vec3} vector2 One decoded and normalized vector.
 * @param {vec3} vector3 One decoded and normalized vector.
 */
  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 tw=`/**
 * Packs a depth value into a vec3 that can be represented by unsigned bytes.
 *
 * @name czm_packDepth
 * @glslFunction
 *
 * @param {float} depth The floating-point depth.
 * @returns {vec3} The packed depth.
 */
vec4 czm_packDepth(float depth)
{
    // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA
    // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
    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 nw=`vec3 lambertianDiffuse(vec3 diffuseColor)
{
    return diffuseColor / czm_pi;
}

vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
{
    return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);
}

float smithVisibilityG1(float NdotV, float roughness)
{
    // this is the k value for direct lighting.
    // for image based lighting it will be roughness^2 / 2
    float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
    return NdotV / (NdotV * (1.0 - k) + k);
}

float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
{
    return (
        smithVisibilityG1(NdotL, roughness) *
        smithVisibilityG1(NdotV, roughness)
    );
}

float GGX(float roughness, float NdotH)
{
    float roughnessSquared = roughness * roughness;
    float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
    return roughnessSquared / (czm_pi * f * f);
}

/**
 * Compute the diffuse and specular contributions using physically based
 * rendering. This function only handles direct lighting.
 * <p>
 * This function only handles the lighting calculations. Metallic/roughness
 * and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial}
 * </p>
 *
 * @name czm_pbrlighting
 * @glslFunction
 *
 * @param {vec3} positionEC The position of the fragment in eye coordinates
 * @param {vec3} normalEC The surface normal in eye coordinates
 * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
 * @param {vec3} lightColorHdr radiance of the light source. This is a HDR value.
 * @param {czm_pbrParameters} The computed PBR parameters.
 * @return {vec3} The computed HDR color
 *
 * @example
 * czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial(
 *  baseColor,
 *  metallic,
 *  roughness
 * );
 * vec3 color = czm_pbrlighting(
 *  positionEC,
 *  normalEC,
 *  lightDirectionEC,
 *  lightColorHdr,
 *  pbrParameters);
 */
vec3 czm_pbrLighting(
    vec3 positionEC,
    vec3 normalEC,
    vec3 lightDirectionEC,
    vec3 lightColorHdr,
    czm_pbrParameters pbrParameters
)
{
    vec3 v = -normalize(positionEC);
    vec3 l = normalize(lightDirectionEC);
    vec3 h = normalize(v + l);
    vec3 n = normalEC;
    float NdotL = clamp(dot(n, l), 0.001, 1.0);
    float NdotV = abs(dot(n, v)) + 0.001;
    float NdotH = clamp(dot(n, h), 0.0, 1.0);
    float LdotH = clamp(dot(l, h), 0.0, 1.0);
    float VdotH = clamp(dot(v, h), 0.0, 1.0);

    vec3 f0 = pbrParameters.f0;
    float reflectance = max(max(f0.r, f0.g), f0.b);
    vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
    vec3 F = fresnelSchlick2(f0, f90, VdotH);

    float alpha = pbrParameters.roughness;
    float G = smithVisibilityGGX(alpha, NdotL, NdotV);
    float D = GGX(alpha, NdotH);
    vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);

    vec3 diffuseColor = pbrParameters.diffuseColor;
    // F here represents the specular contribution
    vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);

    // Lo = (diffuse + specular) * Li * NdotL
    return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;
}
`;var iw=`/**
 * Compute parameters for physically based rendering using the
 * metallic/roughness workflow. All inputs are linear; sRGB texture values must
 * be decoded beforehand
 *
 * @name czm_pbrMetallicRoughnessMaterial
 * @glslFunction
 *
 * @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence)
 * @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt);
 * @param {float} roughness A value between 0.0 and 1.0
 * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
 */
czm_pbrParameters czm_pbrMetallicRoughnessMaterial(
    vec3 baseColor,
    float metallic,
    float roughness
) 
{
    czm_pbrParameters results;

    // roughness is authored as perceptual roughness
    // square it to get material roughness
    roughness = clamp(roughness, 0.0, 1.0);
    results.roughness = roughness * roughness;

    // dielectrics use f0 = 0.04, metals use albedo as f0
    metallic = clamp(metallic, 0.0, 1.0);
    const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
    vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);
    results.f0 = f0;

    // diffuse only applies to dielectrics.
    results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);

    return results;
}
`;var ow=`/**
 * Compute parameters for physically based rendering using the
 * specular/glossy workflow. All inputs are linear; sRGB texture values must
 * be decoded beforehand
 *
 * @name czm_pbrSpecularGlossinessMaterial
 * @glslFunction
 *
 * @param {vec3} diffuse The diffuse color for dielectrics (non-metals)
 * @param {vec3} specular The reflectance at normal incidence (f0)
 * @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.
 * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
 */
czm_pbrParameters czm_pbrSpecularGlossinessMaterial(
    vec3 diffuse,
    vec3 specular,
    float glossiness
) 
{
    czm_pbrParameters results;

    // glossiness is the opposite of roughness, but easier for artists to use.
    float roughness = 1.0 - glossiness;
    results.roughness = roughness * roughness;

    results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));
    results.f0 = specular;

    return results;
}
`;var rw=`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);
}

/**
 * Computes a color using the Phong lighting model.
 *
 * @name czm_phong
 * @glslFunction
 *
 * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.
 * @param {czm_material} material The fragment's material.
 *
 * @returns {vec4} The computed color.
 *
 * @example
 * vec3 positionToEyeEC = // ...
 * czm_material material = // ...
 * vec3 lightDirectionEC = // ...
 * out_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC);
 *
 * @see czm_getMaterial
 */
vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
    // Diffuse from directional light sources at eye (for top-down)
    float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);
    if (czm_sceneMode == czm_sceneMode3D) {
        // (and horizon views in 3D)
        diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);
    }

    float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);

    // Temporary workaround for adding ambient.
    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 sw=`/**
 * Computes distance from a point to a plane.
 *
 * @name czm_planeDistance
 * @glslFunction
 *
 * param {vec4} plane A Plane in Hessian Normal Form. See Plane.js
 * param {vec3} point A point in the same space as the plane.
 * returns {float} The distance from the point to the plane.
 */
float czm_planeDistance(vec4 plane, vec3 point) {
    return (dot(plane.xyz, point) + plane.w);
}

/**
 * Computes distance from a point to a plane.
 *
 * @name czm_planeDistance
 * @glslFunction
 *
 * param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js
 * param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js
 * param {vec3} point A point in the same space as the plane.
 * returns {float} The distance from the point to the plane.
 */
float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
    return (dot(planeNormal, point) + planeDistance);
}
`;var aw=`/**
 * Computes the point along a ray at the given time.  <code>time</code> can be positive, negative, or zero.
 *
 * @name czm_pointAlongRay
 * @glslFunction
 *
 * @param {czm_ray} ray The ray to compute the point along.
 * @param {float} time The time along the ray.
 * 
 * @returns {vec3} The point along the ray at the given time.
 * 
 * @example
 * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction
 * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)
 */
vec3 czm_pointAlongRay(czm_ray ray, float time)
{
    return ray.origin + (time * ray.direction);
}
`;var cw=`/**
 * DOC_TBA
 *
 * @name czm_rayEllipsoidIntersectionInterval
 * @glslFunction
 */
czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)
{
   // ray and ellipsoid center in eye coordinates.  radii in model coordinates.
    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) // Outside ellipsoid.
    {
        if (qw >= 0.0) // Looking outward or tangent (0 intersections).
        {
            return czm_emptyRaySegment;
        }
        else // qw < 0.0.
        {
            float qw2 = qw * qw;
            float difference = q2 - 1.0; // Positively valued.
            float w2 = dot(w, w);
            float product = w2 * difference;

            if (qw2 < product) // Imaginary roots (0 intersections).
            {
                return czm_emptyRaySegment;
            }
            else if (qw2 > product) // Distinct roots (2 intersections).
            {
                float discriminant = qw * qw - product;
                float temp = -qw + sqrt(discriminant); // Avoid cancellation.
                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 // qw2 == product.  Repeated roots (2 intersections).
            {
                float root = sqrt(difference / w2);
                czm_raySegment i = czm_raySegment(root, root);
                return i;
            }
        }
    }
    else if (q2 < 1.0) // Inside ellipsoid (2 intersections).
    {
        float difference = q2 - 1.0; // Negatively valued.
        float w2 = dot(w, w);
        float product = w2 * difference; // Negatively valued.
        float discriminant = qw * qw - product;
        float temp = -qw + sqrt(discriminant); // Positively valued.
        czm_raySegment i = czm_raySegment(0.0, temp / w2);
        return i;
    }
    else // q2 == 1.0. On ellipsoid.
    {
        if (qw < 0.0) // Looking inward.
        {
            float w2 = dot(w, w);
            czm_raySegment i = czm_raySegment(0.0, -qw / w2);
            return i;
        }
        else // qw >= 0.0.  Looking outward or tangent.
        {
            return czm_emptyRaySegment;
        }
    }
}
`;var lw=`/**
 * Compute the intersection interval of a ray with a sphere.
 *
 * @name czm_raySphereIntersectionInterval
 * @glslFunction
 *
 * @param {czm_ray} ray The ray.
 * @param {vec3} center The center of the sphere.
 * @param {float} radius The radius of the sphere.
 * @return {czm_raySegment} The intersection interval of the ray with the sphere.
 */
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 uw=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
    return czm_reverseLogDepth(texture(depthTexture, texCoords).r);
}
`;var fw=`/**
 * Reads a value previously transformed with {@link czm_writeNonPerspective}
 * by dividing it by \`w\`, the value used in the perspective divide.
 * This function is intended to be called in a fragment shader to access a
 * \`varying\` that should not be subject to perspective interpolation.
 * For example, screen-space texture coordinates. The value should have been
 * previously written in the vertex shader with a call to
 * {@link czm_writeNonPerspective}.
 *
 * @name czm_readNonPerspective
 * @glslFunction
 *
 * @param {float|vec2|vec3|vec4} value The non-perspective value to be read.
 * @param {float} oneOverW One over the perspective divide value, \`w\`. Usually this is simply \`gl_FragCoord.w\`.
 * @returns {float|vec2|vec3|vec4} The usable value.
 */
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 dw=`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 = pow(2.0, log2Depth) - 1.0;
    return far * (1.0 - near / (depthFromNear + near)) / (far - near);
#endif
    return logZ;
}
`;var hw=`/**
 * Round a floating point value. This function exists because round() doesn't
 * exist in GLSL 1.00. 
 *
 * @param {float|vec2|vec3|vec4} value The value to round
 * @param {float|vec2|vec3|vec3} The rounded value. The type matches the input.
 */
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 mw=`/**
 * Samples the 4 neighboring pixels and return the weighted average.
 *
 * @private
 */
vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)
{
    direction /= dot(vec3(1.0), abs(direction));
    vec2 rev = abs(direction.zx) - vec2(1.0);
    vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,
                    direction.z < 0.0 ? rev.y : -rev.y);
    vec2 uv = direction.y < 0.0 ? neg : direction.xz;
    vec2 coord = 0.5 * uv + vec2(0.5);
    vec2 pixel = 1.0 / textureSize;

    if (lod > 0.0)
    {
        // Each subseqeuent mip level is half the size
        float scale = 1.0 / pow(2.0, lod);
        float offset = ((textureSize.y + 1.0) / textureSize.x);

        coord.x *= offset;
        coord *= scale;

        coord.x += offset + pixel.x;
        coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;
    }
    else
    {
        coord.x *= (textureSize.y / textureSize.x);
    }

    // Do bilinear filtering
    #ifndef OES_texture_float_linear
        vec3 color1 = texture(projectedMap, coord + vec2(0.0, pixel.y)).rgb;
        vec3 color2 = texture(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;
        vec3 color3 = texture(projectedMap, coord + pixel).rgb;
        vec3 color4 = texture(projectedMap, coord).rgb;

        vec2 texturePosition = coord * textureSize;

        float fu = fract(texturePosition.x);
        float fv = fract(texturePosition.y);

        vec3 average1 = mix(color4, color2, fu);
        vec3 average2 = mix(color1, color3, fu);

        vec3 color = mix(average1, average2, fv);
    #else
        vec3 color = texture(projectedMap, coord).rgb;
    #endif

    return color;
}


/**
 * Samples from a cube map that has been projected using an octahedral projection from the given direction.
 *
 * @name czm_sampleOctahedralProjection
 * @glslFunction
 *
 * @param {sampler2D} projectedMap The texture with the octahedral projected cube map.
 * @param {vec2} textureSize The width and height dimensions in pixels of the projected map.
 * @param {vec3} direction The normalized direction used to sample the cube map.
 * @param {float} lod The level of detail to sample.
 * @param {float} maxLod The maximum level of detail.
 * @returns {vec3} The color of the cube map at the direction.
 */
vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {
    float currentLod = floor(lod + 0.5);
    float nextLod = min(currentLod + 1.0, maxLod);

    vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);
    vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);

    return mix(colorNextLod, colorCurrentLod, nextLod - lod);
}
`;var pw=`/**
 * Adjusts the saturation of a color.
 * 
 * @name czm_saturation
 * @glslFunction
 * 
 * @param {vec3} rgb The color.
 * @param {float} adjustment The amount to adjust the saturation of the color.
 *
 * @returns {float} The color with the saturation adjusted.
 *
 * @example
 * vec3 greyScale = czm_saturation(color, 0.0);
 * vec3 doubleSaturation = czm_saturation(color, 2.0);
 */
vec3 czm_saturation(vec3 rgb, float adjustment)
{
    // Algorithm from Chapter 16 of OpenGL Shading Language
    const vec3 W = vec3(0.2125, 0.7154, 0.0721);
    vec3 intensity = vec3(dot(rgb, W));
    return mix(intensity, rgb, adjustment);
}
`;var _w=`
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 gw=`
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 yw=`/**
 * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative.  This is similar to the GLSL
 * built-in function <code>sign</code> except that returns 1.0 instead of 0.0 when the input value is 0.0.
 * 
 * @name czm_signNotZero
 * @glslFunction
 *
 * @param {} value The value for which to determine the sign.
 * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.
 */
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 Aw=`/**
 * Computes a color from the third order spherical harmonic coefficients and a normalized direction vector.
 * <p>
 * The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22].
 * </p>
 *
 * @name czm_sphericalHarmonics
 * @glslFunction
 *
 * @param {vec3} normal The normalized direction.
 * @param {vec3[9]} coefficients The third order spherical harmonic coefficients.
 * @returns {vec3} The color at the direction.
 *
 * @see https://graphics.stanford.edu/papers/envmap/envmap.pdf
 */
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;

    return
          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);
}
`;var xw=`/**
 * Converts an sRGB color to a linear RGB color.
 *
 * @param {vec3|vec4} srgbIn The color in sRGB space
 * @returns {vec3|vec4} The color in linear color space. The vector type matches the input.
 */
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 Cw=`/**
 * Creates a matrix that transforms vectors from tangent space to eye space.
 *
 * @name czm_tangentToEyeSpaceMatrix
 * @glslFunction
 *
 * @param {vec3} normalEC The normal vector in eye coordinates.
 * @param {vec3} tangentEC The tangent vector in eye coordinates.
 * @param {vec3} bitangentEC The bitangent vector in eye coordinates.
 *
 * @returns {mat3} The matrix that transforms from tangent space to eye space.
 *
 * @example
 * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);
 * vec3 normal = tangentToEye * texture(normalMap, st).xyz;
 */
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 Tw=`/**
 * A wrapper around the texture (WebGL2) / textureCube (WebGL1)
 * function to allow for WebGL 1 support.
 * 
 * @name czm_textureCube
 * @glslFunction
 *
 * @param {samplerCube} sampler The sampler.
 * @param {vec3} p The coordinates to sample the texture at.
 */
vec4 czm_textureCube(samplerCube sampler, vec3 p) {
#if __VERSION__ == 300
    return texture(sampler, p);
#else  
    return textureCube(sampler, p);
#endif
}`;var Ew=`/**
 * Transforms a plane.
 * 
 * @name czm_transformPlane
 * @glslFunction
 *
 * @param {vec4} plane The plane in Hessian Normal Form.
 * @param {mat4} transform The inverse-transpose of a transformation matrix.
 */
vec4 czm_transformPlane(vec4 plane, mat4 transform) {
    vec4 transformedPlane = transform * plane;
    // Convert the transformed plane to Hessian Normal Form
    float normalMagnitude = length(transformedPlane.xyz);
    return transformedPlane / normalMagnitude;
}
`;var bw=`/**
 * Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},
 * and then provided to the shader as separate <code>high</code> and <code>low</code> bits to
 * be relative to the eye.  As shown in the example, the position can then be transformed in eye
 * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},
 * respectively.
 * <p>
 * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as
 * described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}.
 * </p>
 *
 * @name czm_translateRelativeToEye
 * @glslFunction
 *
 * @param {vec3} high The position's high bits.
 * @param {vec3} low The position's low bits.
 * @returns {vec3} The position translated to be relative to the camera's position.
 *
 * @example
 * in vec3 positionHigh;
 * in vec3 positionLow;
 *
 * void main()
 * {
 *   vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
 *   gl_Position = czm_modelViewProjectionRelativeToEye * p;
 * }
 *
 * @see czm_modelViewRelativeToEye
 * @see czm_modelViewProjectionRelativeToEye
 * @see czm_computePosition
 * @see EncodedCartesian3
 */
vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
{
    vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
    vec3 lowDifference = low - czm_encodedCameraPositionMCLow;

    return vec4(highDifference + lowDifference, 1.0);
}
`;var Sw=`/**
 * @private
 */
vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
{
    // Diffuse from directional light sources at eye (for top-down and horizon views)
    float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);

    if (czm_sceneMode == czm_sceneMode3D) {
        // (and horizon views in 3D)
        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);

    // Temporary workaround for adding ambient.
    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 Dw=`/**
 * Returns the transpose of the matrix.  The input <code>matrix</code> can be
 * a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.
 *
 * @name czm_transpose
 * @glslFunction
 *
 * @param {} matrix The matrix to transpose.
 *
 * @returns {} The transposed matrix.
 *
 * @example
 * // GLSL declarations
 * mat2 czm_transpose(mat2 matrix);
 * mat3 czm_transpose(mat3 matrix);
 * mat4 czm_transpose(mat4 matrix);
 *
 * // Transpose a 3x3 rotation matrix to find its inverse.
 * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(
 *     positionMC, normalEC);
 * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);
 */
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 vw=`/**
 * Unpacks a vec4 depth value to a float in [0, 1) range.
 *
 * @name czm_unpackDepth
 * @glslFunction
 *
 * @param {vec4} packedDepth The packed depth.
 *
 * @returns {float} The floating-point depth in [0, 1) range.
 */
 float czm_unpackDepth(vec4 packedDepth)
 {
    // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA
    // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
    return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
 }
`;var ww=`/**
 * Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4.
 *
 * @name czm_unpackFloat
 * @glslFunction
 *
 * @param {vec4} packedFloat The packed float.
 *
 * @returns {float} The floating-point depth in arbitrary range.
 */
float czm_unpackFloat(vec4 packedFloat)
{
    // Convert to [0.0, 255.0] and round to integer
    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 Iw=`/**
 * Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type,
 * so the return value is an int.
 * <p>
 * There are also precision limitations in WebGL 1. highp int is still limited
 * to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur.
 * </p>
 *
 * @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order.
 *
 * @return {int} The unpacked value.
 */
 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 Pw=`/**
 * Transform metadata values following the EXT_structural_metadata spec
 * by multiplying by scale and adding the offset. Operations are always
 * performed component-wise, even for matrices.
 * 
 * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add
 * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply
 * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value.
 *
 * @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input.
 */
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 Ow=`#ifdef LOG_DEPTH
// 1.0 at the near plane, increasing linearly from there.
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

    // With the very high far/near ratios used with the logarithmic depth
    // buffer, floating point rounding errors can cause linear depth values
    // to end up on the wrong side of the far plane, even for vertices that
    // are really nowhere near it. Since we always write a correct logarithmic
    // depth value in the fragment shader anyway, we just need to make sure
    // such errors don't cause the primitive to be clipped entirely before
    // we even get to the fragment shader.
    coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;
#endif

    return coords;
}

/**
 * Writes the logarithmic depth to gl_Position using the already computed gl_Position.
 *
 * @name czm_vertexLogDepth
 * @glslFunction
 */
void czm_vertexLogDepth()
{
#ifdef LOG_DEPTH
    v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
    gl_Position = czm_updatePositionDepth(gl_Position);
#endif
}

/**
 * Writes the logarithmic depth to gl_Position using the provided clip coordinates.
 * <p>
 * An example use case for this function would be moving the vertex in window coordinates
 * before converting back to clip coordinates. Use the original vertex clip coordinates.
 * </p>
 * @name czm_vertexLogDepth
 * @glslFunction
 *
 * @param {vec4} clipCoords The vertex in clip coordinates.
 *
 * @example
 * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));
 */
void czm_vertexLogDepth(vec4 clipCoords)
{
#ifdef LOG_DEPTH
    v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
    czm_updatePositionDepth(clipCoords);
#endif
}
`;var Rw=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
{
    // Reconstruct NDC coordinates
    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);

    // Reverse the perspective division to obtain clip coordinates.
    q /= screenCoordinate.w;

    // Reverse the projection transformation to obtain eye coordinates.
    if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s
    {
        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;
}

/**
 * Transforms a position from window to eye coordinates.
 * The transform from window to normalized device coordinates is done using components
 * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
 * the inverse of <code>czm_viewportTransformation</code>. The transformation from
 * normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,
 * which is expected to be the scalar used in the perspective divide. The transformation
 * from clip to eye coordinates is done using {@link czm_inverseProjection}.
 *
 * @name czm_windowToEyeCoordinates
 * @glslFunction
 *
 * @param {vec4} fragmentCoordinate The position in window coordinates to transform.
 *
 * @returns {vec4} The transformed position in eye coordinates.
 *
 * @see czm_modelToWindowCoordinates
 * @see czm_eyeToWindowCoordinates
 * @see czm_inverseProjection
 * @see czm_viewport
 * @see czm_viewportTransformation
 *
 * @example
 * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
 */
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)
{
    // See reverseLogDepth.glsl. This is separate to re-use the pow.
#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 = pow(2.0, 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; // Better precision
    return eyeCoordinate;
#else
    vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
    vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
#endif
    return eyeCoordinate;
}

/**
 * Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.
 * This function produces more accurate results for window positions with log depth than
 * conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version
 * of czm_windowToEyeCoordinates.
 *
 * @name czm_windowToEyeCoordinates
 * @glslFunction
 *
 * @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.
 * @param {float} depthOrLogDepth A depth or log depth for the fragment.
 *
 * @see czm_modelToWindowCoordinates
 * @see czm_eyeToWindowCoordinates
 * @see czm_inverseProjection
 * @see czm_viewport
 * @see czm_viewportTransformation
 *
 * @returns {vec4} The transformed position in eye coordinates.
 */
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
{
    vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
    return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
}
`;var Bw=`// emulated noperspective
#if !defined(LOG_DEPTH)
in float v_WindowZ;
#endif

/**
 * Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane
 * by writing the fragment's depth. See czm_depthClamp for more details.
 *
 * @name czm_writeDepthClamp
 * @glslFunction
 *
 * @example
 * out_FragColor = color;
 * czm_writeDepthClamp();
 *
 * @see czm_depthClamp
 */
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 Mw=`#ifdef LOG_DEPTH
in float v_depthFromNearPlusOne;

#ifdef POLYGON_OFFSET
uniform vec2 u_polygonOffset;
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#endif

#endif

/**
 * Writes the fragment depth to the logarithmic depth buffer.
 * <p>
 * Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when
 * ray-casting geometry using a full screen quad.
 * </p>
 * @name czm_writeLogDepth
 * @glslFunction
 *
 * @param {float} depth The depth coordinate, where 1.0 is on the near plane and
 *                      depth increases in eye-space units from there
 *
 * @example
 * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);
 */
void czm_writeLogDepth(float depth)
{
#if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
    // Discard the vertex if it's not between the near and far planes.
    // We allow a bit of epsilon on the near plane comparison because a 1.0
    // from the vertex shader (indicating the vertex should be _on_ the near
    // plane) will not necessarily come here as exactly 1.0.
    if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
        discard;
    }

#ifdef POLYGON_OFFSET
    // Polygon offset: m * factor + r * units
    float factor = u_polygonOffset[0];
    float units = u_polygonOffset[1];

#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
    // This factor doesn't work in IE 10
    if (factor != 0.0) {
        // m = sqrt(dZdX^2 + dZdY^2);
        float x = dFdx(depth);
        float y = dFdy(depth);
        float m = sqrt(x * x + y * y);

        // Apply the factor before computing the log depth.
        depth += m * factor;
    }
#endif

#endif

    gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;

#ifdef POLYGON_OFFSET
    // Apply the units after the log depth.
    gl_FragDepth += czm_epsilon7 * units;
#endif

#endif
}

/**
 * Writes the fragment depth to the logarithmic depth buffer.
 * <p>
 * Use this when the vertex shader calls {@link czm_vertexlogDepth}.
 * </p>
 *
 * @name czm_writeLogDepth
 * @glslFunction
 */
void czm_writeLogDepth() {
#ifdef LOG_DEPTH
    czm_writeLogDepth(v_depthFromNearPlusOne);
#endif
}
`;var Lw=`/**
 * Transforms a value for non-perspective interpolation by multiplying
 * it by w, the value used in the perspective divide. This function is
 * intended to be called in a vertex shader to compute the value of a
 * \`varying\` that should not be subject to perspective interpolation.
 * For example, screen-space texture coordinates. The fragment shader
 * must call {@link czm_readNonPerspective} to retrieve the final
 * non-perspective value.
 *
 * @name czm_writeNonPerspective
 * @glslFunction
 *
 * @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.
 * @param {float} w The perspective divide value. Usually this is the computed \`gl_Position.w\`.
 * @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a \`varying\` and read in the
 *          fragment shader with {@link czm_readNonPerspective}.
 */
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 C0={czm_degreesPerRadian:hD,czm_depthRange:mD,czm_epsilon1:pD,czm_epsilon2:_D,czm_epsilon3:gD,czm_epsilon4:yD,czm_epsilon5:AD,czm_epsilon6:xD,czm_epsilon7:CD,czm_infinity:TD,czm_oneOverPi:ED,czm_oneOverTwoPi:bD,czm_passCesium3DTile:SD,czm_passCesium3DTileClassification:DD,czm_passCesium3DTileClassificationIgnoreShow:vD,czm_passClassification:wD,czm_passCompute:ID,czm_passEnvironment:PD,czm_passGlobe:OD,czm_passOpaque:RD,czm_passOverlay:BD,czm_passTerrainClassification:MD,czm_passTranslucent:LD,czm_passVoxels:ND,czm_pi:FD,czm_piOverFour:VD,czm_piOverSix:UD,czm_piOverThree:kD,czm_piOverTwo:zD,czm_radiansPerDegree:HD,czm_sceneMode2D:GD,czm_sceneMode3D:WD,czm_sceneModeColumbusView:jD,czm_sceneModeMorphing:YD,czm_solarRadius:qD,czm_threePiOver2:XD,czm_twoPi:KD,czm_webMercatorMaxLatitude:ZD,czm_depthRangeStruct:JD,czm_material:QD,czm_materialInput:$D,czm_modelMaterial:ev,czm_modelVertexOutput:tv,czm_pbrParameters:nv,czm_ray:iv,czm_raySegment:ov,czm_shadowParameters:rv,czm_HSBToRGB:sv,czm_HSLToRGB:av,czm_RGBToHSB:cv,czm_RGBToHSL:lv,czm_RGBToXYZ:uv,czm_XYZToRGB:fv,czm_acesTonemapping:dv,czm_alphaWeight:hv,czm_antialias:mv,czm_approximateSphericalCoordinates:pv,czm_backFacing:_v,czm_branchFreeTernary:gv,czm_cascadeColor:yv,czm_cascadeDistance:Av,czm_cascadeMatrix:xv,czm_cascadeWeights:Cv,czm_columbusViewMorph:Tv,czm_computePosition:Ev,czm_cosineAndSine:bv,czm_decompressTextureCoordinates:Sv,czm_defaultPbrMaterial:Dv,czm_depthClamp:vv,czm_eastNorthUpToEyeCoordinates:wv,czm_ellipsoidContainsPoint:Iv,czm_ellipsoidWgs84TextureCoordinates:Pv,czm_equalsEpsilon:Ov,czm_eyeOffset:Rv,czm_eyeToWindowCoordinates:Bv,czm_fastApproximateAtan:Mv,czm_fog:Lv,czm_gammaCorrect:Nv,czm_geodeticSurfaceNormal:Fv,czm_getDefaultMaterial:Vv,czm_getLambertDiffuse:Uv,czm_getSpecular:kv,czm_getWaterNoise:zv,czm_hue:Hv,czm_inverseGamma:Gv,czm_isEmpty:Wv,czm_isFull:jv,czm_latitudeToWebMercatorFraction:Yv,czm_lineDistance:qv,czm_linearToSrgb:Xv,czm_luminance:Kv,czm_metersPerPixel:Zv,czm_modelToWindowCoordinates:Jv,czm_multiplyWithColorBalance:Qv,czm_nearFarScalar:$v,czm_octDecode:ew,czm_packDepth:tw,czm_pbrLighting:nw,czm_pbrMetallicRoughnessMaterial:iw,czm_pbrSpecularGlossinessMaterial:ow,czm_phong:rw,czm_planeDistance:sw,czm_pointAlongRay:aw,czm_rayEllipsoidIntersectionInterval:cw,czm_raySphereIntersectionInterval:lw,czm_readDepth:uw,czm_readNonPerspective:fw,czm_reverseLogDepth:dw,czm_round:hw,czm_sampleOctahedralProjection:mw,czm_saturation:pw,czm_shadowDepthCompare:_w,czm_shadowVisibility:gw,czm_signNotZero:yw,czm_sphericalHarmonics:Aw,czm_srgbToLinear:xw,czm_tangentToEyeSpaceMatrix:Cw,czm_textureCube:Tw,czm_transformPlane:Ew,czm_translateRelativeToEye:bw,czm_translucentPhong:Sw,czm_transpose:Dw,czm_unpackDepth:vw,czm_unpackFloat:ww,czm_unpackUint:Iw,czm_valueTransform:Pw,czm_vertexLogDepth:Ow,czm_windowToEyeCoordinates:Rw,czm_writeDepthClamp:Bw,czm_writeLogDepth:Mw,czm_writeNonPerspective:Lw};function IEe(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/(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(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor/g,""),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable
${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT"))):(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 Nw=IEe;function NJ(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 FJ(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return u(i)||(t=NJ(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function VJ(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);u(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&gs._czmBuiltinsAndUniforms.hasOwnProperty(i)){let o=FJ(i,gs._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),VJ(o,t)}}))}function PEe(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])}function OEe(e){let t=[],n=FJ("main",e,t);VJ(n,t),PEe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function UJ(e,t,n){let i,o,r="",s=e.sources;if(u(s))for(i=0,o=s.length;i<o;++i)r+=`
#line 0
${s[i]}`;r=NJ(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(A,x){return a=x,`
`});let c=[];r=r.replace(/#extension.*\n/gm,function(A){return c.push(A),`
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");let l=e.pickColorQualifier;u(l)&&(r=gs.createPickFragmentShaderSource(r,l));let f="",d=c.length;for(i=0;i<d;i++)f+=c[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(u(p))for(i=0,o=p.length;i<o;++i){let A=p[i];A.length!==0&&(f+=`#define ${A}
`)}n.textureFloatLinear&&(f+=`#define OES_texture_float_linear

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

`);let g="";e.includeBuiltIns&&(g=OEe(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=Nw(f,t),f}function gs(e){e=y(e,y.EMPTY_OBJECT);let t=e.pickColorQualifier;this.defines=u(e.defines)?e.defines.slice(0):[],this.sources=u(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=y(e.includeBuiltIns,!0)}gs.prototype.clone=function(){return new gs({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};gs.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};gs.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}`};gs.prototype.createCombinedVertexShader=function(e){return UJ(this,!1,e)};gs.prototype.createCombinedFragmentShader=function(e){return UJ(this,!0,e)};gs._czmBuiltinsAndUniforms={};for(let e in C0)C0.hasOwnProperty(e)&&(gs._czmBuiltinsAndUniforms[e]=C0[e]);for(let e in Pm)if(Pm.hasOwnProperty(e)){let t=Pm[e];typeof t.getDeclaration=="function"&&(gs._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}gs.createPickVertexShaderSource=function(e){return`${gs.replaceMain(e,"czm_old_main")}
in vec4 pickColor; 
out vec4 czm_pickColor; 
void main() 
{ 
    czm_old_main(); 
    czm_pickColor = pickColor; 
}`};gs.createPickFragmentShaderSource=function(e,t){let n=gs.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 REe(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 kJ(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 zJ(e,t){let n=t.length;for(let i=0;i<n;++i){let o=t[i];if(kJ(e,o))return o}}var BEe=["v_normalEC","v_normal"];gs.findNormalVarying=function(e){return kJ(e,"#ifdef HAS_NORMALS")?REe(e,"HAS_NORMALS")?"v_normalEC":void 0:zJ(e,BEe)};var MEe=["v_positionEC"];gs.findPositionVarying=function(e){return zJ(e,MEe)};var ke=gs;function jf(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(jf.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});jf.prototype.replaceShaderProgram=function(e){return u(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function LEe(e){let t=Object.keys(e).sort();return JSON.stringify(e,t)}jf.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource,i=e.attributeLocations;typeof t=="string"&&(t=new ke({sources:[t]})),typeof n=="string"&&(n=new ke({sources:[n]}));let o=t.getCacheKey(),r=n.getCacheKey(),s=u(i)?LEe(i):"",a=`${o}:${r}:${s}`,c;if(u(this._shaders[a]))c=this._shaders[a],delete this._shadersToRelease[a];else{let l=this._context,f=t.createCombinedVertexShader(l),d=n.createCombinedFragmentShader(l),p=new Xt({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:t,vertexShaderText:f,fragmentShaderSource:n,fragmentShaderText:d,attributeLocations:i});c={cache:this,shaderProgram:p,keyword:a,derivedKeywords:[],count:0},p._cachedShader=c,this._shaders[a]=c,++this._numberOfShaders}return++c.count,c.shaderProgram};jf.prototype.replaceDerivedShaderProgram=function(e,t,n){let i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(u(r)){LG(this,r);let s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};jf.prototype.getDerivedShaderProgram=function(e,t){let n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(u(o))return o.shaderProgram};jf.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 ke({sources:[r]})),typeof s=="string"&&(s=new ke({sources:[s]}));let c=this._context,l=r.createCombinedVertexShader(c),f=s.createCombinedFragmentShader(c),d=new Xt({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:l,fragmentShaderSource:s,fragmentShaderText:f,attributeLocations:a}),p={cache:this,shaderProgram:d,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),d._cachedShader=p,this._shaders[o]=p,d};function LG(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];LG(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}jf.prototype.destroyReleasedShaderPrograms=function(){let e=this._shadersToRelease;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];LG(this,n),--this._numberOfShaders}this._shadersToRelease={}};jf.prototype.releaseShaderProgram=function(e){if(u(e)){let t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};jf.prototype.isDestroyed=function(){return!1};jf.prototype.destroy=function(){let e=this._shaders;for(let t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return le(this)};var Fw=jf;function Yf(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=e.width,i=e.height,o=e.source;u(o)&&(u(n)||(n=y(o.videoWidth,o.width)),u(i)||(i=y(o.videoHeight,o.height)));let r=y(e.pixelFormat,rt.RGBA),s=y(e.pixelDatatype,Xe.UNSIGNED_BYTE),a=rt.toInternalFormat(r,s,t),c=rt.isCompressedFormat(a),l=e.preMultiplyAlpha||r===rt.RGB||r===rt.LUMINANCE,f=y(e.flipY,!0),d=y(e.skipColorSpaceConversion,!1),p=!0,g=t._gl,m=g.TEXTURE_2D,A=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,A);let x=4;if(u(o)&&u(o.arrayBufferView)&&!c&&(x=rt.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,x),d?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),u(o))if(u(o.arrayBufferView)){g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1);let T=o.arrayBufferView,E,S,D;if(c){if(g.compressedTexImage2D(m,0,a,n,i,0,T),u(o.mipLevels))for(S=n,D=i,E=0;E<o.mipLevels.length;++E)S=Math.floor(S/2)|0,S<1&&(S=1),D=Math.floor(D/2)|0,D<1&&(D=1),g.compressedTexImage2D(m,E+1,a,S,D,0,o.mipLevels[E])}else if(f&&(T=rt.flipY(T,r,s,n,i)),g.texImage2D(m,0,a,n,i,0,r,Xe.toWebGLConstant(s,t),T),u(o.mipLevels))for(S=n,D=i,E=0;E<o.mipLevels.length;++E)S=Math.floor(S/2)|0,S<1&&(S=1),D=Math.floor(D/2)|0,D<1&&(D=1),g.texImage2D(m,E+1,a,S,D,0,r,Xe.toWebGLConstant(s,t),o.mipLevels[E])}else u(o.framebuffer)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._bind(),g.copyTexImage2D(m,0,a,o.xOffset,o.yOffset,n,i,0),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._unBind()):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,f),g.texImage2D(m,0,a,r,Xe.toWebGLConstant(s,t),o));else g.texImage2D(m,0,a,n,i,0,r,Xe.toWebGLConstant(s,t),null),p=!1;g.bindTexture(m,null);let C;c?C=rt.compressedTextureSizeInBytes(r,n,i):C=rt.textureSizeInBytes(r,s,n,i),this._id=zn(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=m,this._texture=A,this._internalFormat=a,this._pixelFormat=r,this._pixelDatatype=s,this._width=n,this._height=i,this._dimensions=new H(n,i),this._hasMipmap=!1,this._sizeInBytes=C,this._preMultiplyAlpha=l,this._flipY=f,this._initialized=p,this._sampler=void 0,this.sampler=u(e.sampler)?e.sampler:new ln}Yf.create=function(e){return new Yf(e)};Yf.fromFramebuffer=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=t._gl,i=y(e.pixelFormat,rt.RGB),o=y(e.framebufferXOffset,0),r=y(e.framebufferYOffset,0),s=y(e.width,n.drawingBufferWidth),a=y(e.height,n.drawingBufferHeight),c=e.framebuffer;return new Yf({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:u(c)?c:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(Yf.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter,i=this._context,o=this._pixelFormat,r=this._pixelDatatype,s=t===an.NEAREST_MIPMAP_NEAREST||t===an.NEAREST_MIPMAP_LINEAR||t===an.LINEAR_MIPMAP_NEAREST||t===an.LINEAR_MIPMAP_LINEAR;(r===Xe.FLOAT&&!i.textureFloatLinear||r===Xe.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?an.NEAREST_MIPMAP_NEAREST:an.NEAREST,n=yi.NEAREST),i.webgl2&&rt.isDepthFormat(o)&&(t=an.NEAREST,n=yi.NEAREST);let a=i._gl,c=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(c,this._texture),a.texParameteri(c,a.TEXTURE_MIN_FILTER,t),a.texParameteri(c,a.TEXTURE_MAG_FILTER,n),a.texParameteri(c,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(c,a.TEXTURE_WRAP_T,e.wrapT),u(this._textureFilterAnisotropic)&&a.texParameteri(c,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(c,null),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}}});Yf.prototype.copyFrom=function(e){let t=y(e.xOffset,0),n=y(e.yOffset,0),i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);let a=i.width,c=i.height,l=i.arrayBufferView,f=this._width,d=this._height,p=this._internalFormat,g=this._pixelFormat,m=this._pixelDatatype,A=this._preMultiplyAlpha,x=this._flipY,C=y(e.skipColorSpaceConversion,!1),T=4;u(l)&&(T=rt.alignmentInBytes(g,m,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,T),C?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let E=!1;if(!this._initialized){if(t===0&&n===0&&a===f&&c===d)u(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),x&&(l=rt.flipY(l,g,m,f,d)),r.texImage2D(s,0,p,f,d,0,g,Xe.toWebGLConstant(m,o),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x),r.texImage2D(s,0,p,g,Xe.toWebGLConstant(m,o),i)),E=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);let S=rt.createTypedArray(g,m,f,d);r.texImage2D(s,0,p,f,d,0,g,Xe.toWebGLConstant(m,o),S)}this._initialized=!0}E||(u(l)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),x&&(l=rt.flipY(l,g,m,a,c)),r.texSubImage2D(s,0,t,n,a,c,g,Xe.toWebGLConstant(m,o),l)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,x),r.texSubImage2D(s,0,t,n,g,Xe.toWebGLConstant(m,o),i))),r.bindTexture(s,null)};Yf.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._width),r=y(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};Yf.prototype.generateMipmap=function(e){e=y(e,Ah.DONT_CARE),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)};Yf.prototype.isDestroyed=function(){return!1};Yf.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),le(this)};var It=Yf;function T0(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(T0.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});T0.prototype.getTexture=function(e){let t=this._textures[e];if(u(t))return delete this._texturesToRelease[e],++t.count,t.texture};T0.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};T0.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={}};T0.prototype.isDestroyed=function(){return!1};T0.prototype.destroy=function(){let e=this._textures;for(let t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return le(this)};var Vw=T0;function xh(){this.high=h.clone(h.ZERO),this.low=h.clone(h.ZERO)}xh.encode=function(e,t){u(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 zm={high:0,low:0};xh.fromCartesian=function(e,t){u(t)||(t=new xh);let n=t.high,i=t.low;return xh.encode(e.x,zm),n.x=zm.high,i.x=zm.low,xh.encode(e.y,zm),n.y=zm.high,i.y=zm.low,xh.encode(e.z,zm),n.z=zm.high,i.z=zm.low,t};var NG=new xh;xh.writeElements=function(e,t,n){xh.fromCartesian(e,NG);let i=NG.high,o=NG.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=xh;function ys(e,t){this.normal=h.clone(e),this.distance=t}ys.fromPointNormal=function(e,t,n){let i=-h.dot(t,e);return u(n)?(h.clone(t,n.normal),n.distance=i,n):new ys(t,i)};var NEe=new h;ys.fromCartesian4=function(e,t){let n=h.fromCartesian4(e,NEe),i=e.w;return u(t)?(h.clone(n,t.normal),t.distance=i,t):new ys(n,i)};ys.getPointDistance=function(e,t){return h.dot(e.normal,t)+e.distance};var FEe=new h;ys.projectPointOntoPlane=function(e,t,n){u(n)||(n=new h);let i=ys.getPointDistance(e,t),o=h.multiplyByScalar(e.normal,i,FEe);return h.subtract(t,o,n)};var VEe=new M,UEe=new oe,kEe=new h;ys.transform=function(e,t,n){let i=e.normal,o=e.distance,r=M.inverseTranspose(t,VEe),s=oe.fromElements(i.x,i.y,i.z,o,UEe);s=M.multiplyByVector(r,s,s);let a=h.fromCartesian4(s,kEe);return s=oe.divideByScalar(s,h.magnitude(a),s),ys.fromCartesian4(s,n)};ys.clone=function(e,t){return u(t)?(h.clone(e.normal,t.normal),t.distance=e.distance,t):new ys(e.normal,e.distance)};ys.equals=function(e,t){return e.distance===t.distance&&h.equals(e.normal,t.normal)};ys.ORIGIN_XY_PLANE=Object.freeze(new ys(h.UNIT_Z,0));ys.ORIGIN_YZ_PLANE=Object.freeze(new ys(h.UNIT_X,0));ys.ORIGIN_ZX_PLANE=Object.freeze(new ys(h.UNIT_Y,0));var cn=ys;function Fu(e){this.planes=y(e,[])}var Uw=[new h,new h,new h];h.clone(h.UNIT_X,Uw[0]);h.clone(h.UNIT_Y,Uw[1]);h.clone(h.UNIT_Z,Uw[2]);var X_=new h,zEe=new h,HJ=new cn(new h(1,0,0),0);Fu.fromBoundingSphere=function(e,t){u(t)||(t=new Fu);let n=Uw.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 c=Uw[a],l=i[s],f=i[s+1];u(l)||(l=i[s]=new oe),u(f)||(f=i[s+1]=new oe),h.multiplyByScalar(c,-r,X_),h.add(o,X_,X_),l.x=c.x,l.y=c.y,l.z=c.z,l.w=-h.dot(c,X_),h.multiplyByScalar(c,r,X_),h.add(o,X_,X_),f.x=-c.x,f.y=-c.y,f.z=-c.z,f.w=-h.dot(h.negate(c,zEe),X_),s+=2}return t};Fu.prototype.computeVisibility=function(e){let t=this.planes,n=!1;for(let i=0,o=t.length;i<o;++i){let r=e.intersectPlane(cn.fromCartesian4(t[i],HJ));if(r===Qt.OUTSIDE)return Qt.OUTSIDE;r===Qt.INTERSECTING&&(n=!0)}return n?Qt.INTERSECTING:Qt.INSIDE};Fu.prototype.computeVisibilityWithPlaneMask=function(e,t){if(t===Fu.MASK_OUTSIDE||t===Fu.MASK_INSIDE)return t;let n=Fu.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(cn.fromCartesian4(i[o],HJ));if(a===Qt.OUTSIDE)return Fu.MASK_OUTSIDE;a===Qt.INTERSECTING&&(n|=s)}return n};Fu.MASK_OUTSIDE=4294967295;Fu.MASK_INSIDE=0;Fu.MASK_INDETERMINATE=2147483647;var $r=Fu;function Ch(e){e=y(e,y.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=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new $r,this._orthographicMatrix=new M}function GJ(e){(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._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=M.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix))}Object.defineProperties(Ch.prototype,{projectionMatrix:{get:function(){return GJ(this),this._orthographicMatrix}}});var HEe=new h,GEe=new h,WEe=new h,FG=new h;Ch.prototype.computeCullingVolume=function(e,t,n){let i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,l=this.far,f=h.cross(t,n,HEe);h.normalize(f,f);let d=GEe;h.multiplyByScalar(t,c,d),h.add(e,d,d);let p=WEe;h.multiplyByScalar(f,a,p),h.add(d,p,p);let g=i[0];return u(g)||(g=i[0]=new oe),g.x=f.x,g.y=f.y,g.z=f.z,g.w=-h.dot(f,p),h.multiplyByScalar(f,s,p),h.add(d,p,p),g=i[1],u(g)||(g=i[1]=new oe),g.x=-f.x,g.y=-f.y,g.z=-f.z,g.w=-h.dot(h.negate(f,FG),p),h.multiplyByScalar(n,r,p),h.add(d,p,p),g=i[2],u(g)||(g=i[2]=new oe),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-h.dot(n,p),h.multiplyByScalar(n,o,p),h.add(d,p,p),g=i[3],u(g)||(g=i[3]=new oe),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-h.dot(h.negate(n,FG),p),g=i[4],u(g)||(g=i[4]=new oe),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-h.dot(t,d),h.multiplyByScalar(t,l,p),h.add(e,p,p),g=i[5],u(g)||(g=i[5]=new oe),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-h.dot(h.negate(t,FG),p),this._cullingVolume};Ch.prototype.getPixelDimensions=function(e,t,n,i,o){GJ(this);let r=this.right-this.left,s=this.top-this.bottom,a=i*r/e,c=i*s/t;return o.x=a,o.y=c,o};Ch.prototype.clone=function(e){return u(e)||(e=new Ch),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};Ch.prototype.equals=function(e){return u(e)&&e instanceof Ch&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Ch.prototype.equalsEpsilon=function(e,t,n){return e===this||u(e)&&e instanceof Ch&&P.equalsEpsilon(this.right,e.right,t,n)&&P.equalsEpsilon(this.left,e.left,t,n)&&P.equalsEpsilon(this.top,e.top,t,n)&&P.equalsEpsilon(this.bottom,e.bottom,t,n)&&P.equalsEpsilon(this.near,e.near,t,n)&&P.equalsEpsilon(this.far,e.far,t,n)};var Tr=Ch;function nl(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new Tr,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far}nl.packedLength=4;nl.pack=function(e,t,n){return n=y(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};nl.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new nl),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function E0(e){let t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._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(nl.prototype,{projectionMatrix:{get:function(){return E0(this),this._offCenterFrustum.projectionMatrix}}});nl.prototype.computeCullingVolume=function(e,t,n){return E0(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};nl.prototype.getPixelDimensions=function(e,t,n,i,o){return E0(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};nl.prototype.clone=function(e){return u(e)||(e=new nl),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};nl.prototype.equals=function(e){return!u(e)||!(e instanceof nl)?!1:(E0(this),E0(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};nl.prototype.equalsEpsilon=function(e,t,n){return!u(e)||!(e instanceof nl)?!1:(E0(this),E0(e),P.equalsEpsilon(this.width,e.width,t,n)&&P.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};var en=nl;var VG={};function jEe(e){let t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}var YEe=32.184,qEe=2451545;function cQ(e,t){t=$.addSeconds(e,YEe,t);let n=$.totalDays(t)-qEe;return t=$.addSeconds(t,jEe(n),t),t}var G3=new $(2451545,0,qn.TAI),XEe=1e3,Vu=P.RADIANS_PER_DEGREE,Fl=P.RADIANS_PER_ARCSECOND,sa=14959787e4,WJ=new Z;function lQ(e,t,n,i,o,r,s){n<0&&(n=-n,o+=P.PI);let a=e*(1-t),c=i-o,l=o,f=ZEe(r-i,t),d=KEe(t,0);tbe(c,n,l,WJ);let p=a*(1+t),g=Math.cos(f),m=Math.sin(f),A=1+t*g,x=p/A;return u(s)?(s.x=x*g,s.y=x*m,s.z=0):s=new h(x*g,x*m,0),Z.multiplyByVector(WJ,s,s)}function KEe(e,t){return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function ZEe(e,t){let n=$Ee(e,t);return ebe(n,t)}var JEe=50,QEe=P.EPSILON8;function $Ee(e,t){let n=Math.floor(e/P.TWO_PI);e-=n*P.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<JEe&&Math.abs(o-i)>QEe;++r){o=i;let s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}return o=i+n*P.TWO_PI,o}function ebe(e,t){let n=Math.floor(e/P.TWO_PI);e-=n*P.TWO_PI;let i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t),r=Math.atan2(o,i);return r=P.zeroToTwoPi(r),e<0&&(r-=P.TWO_PI),r+=n*P.TWO_PI,r}function tbe(e,t,n,i){let o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),c=Math.cos(n),l=Math.sin(n);return u(i)?(i[0]=c*o-l*r*s,i[1]=l*o+c*r*s,i[2]=r*a,i[3]=-c*r-l*o*s,i[4]=-l*r+c*o*s,i[5]=o*a,i[6]=l*a,i[7]=-c*a,i[8]=s):i=new Z(c*o-l*r*s,-c*r-l*o*s,l*a,l*o+c*r*s,-l*r+c*o*s,-c*a,r*a,o*a,s),i}var nbe=1.0000010178*sa,ibe=100.46645683*Vu,obe=129597742283429e-5*Fl,jJ=16002,YJ=21863,qJ=32004,XJ=10931,KJ=14529,ZJ=16368,JJ=15318,QJ=32794,rbe=64*1e-7*sa,sbe=-152*1e-7*sa,abe=62*1e-7*sa,cbe=-8*1e-7*sa,lbe=32*1e-7*sa,ube=-41*1e-7*sa,fbe=19*1e-7*sa,dbe=-11*1e-7*sa,hbe=-150*1e-7*sa,mbe=-46*1e-7*sa,pbe=68*1e-7*sa,_be=54*1e-7*sa,gbe=14*1e-7*sa,ybe=24*1e-7*sa,Abe=-28*1e-7*sa,xbe=22*1e-7*sa,$J=10,eQ=16002,tQ=21863,nQ=10931,iQ=1473,oQ=32004,rQ=4387,sQ=73,Cbe=-325*1e-7,Tbe=-322*1e-7,Ebe=-79*1e-7,bbe=232*1e-7,Sbe=-52*1e-7,Dbe=97*1e-7,vbe=55*1e-7,wbe=-41*1e-7,Ibe=-105*1e-7,Pbe=-137*1e-7,Obe=258*1e-7,Rbe=35*1e-7,Bbe=-116*1e-7,Mbe=-88*1e-7,Lbe=-112*1e-7,Nbe=-80*1e-7,QC=new $(0,0,qn.TAI);function Fbe(e,t){cQ(e,QC);let i=(QC.dayNumber-G3.dayNumber+(QC.secondsOfDay-G3.secondsOfDay)/Qn.SECONDS_PER_DAY)/(Qn.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=nbe+rbe*Math.cos(jJ*o)+hbe*Math.sin(jJ*o)+sbe*Math.cos(YJ*o)+mbe*Math.sin(YJ*o)+abe*Math.cos(qJ*o)+pbe*Math.sin(qJ*o)+cbe*Math.cos(XJ*o)+_be*Math.sin(XJ*o)+lbe*Math.cos(KJ*o)+gbe*Math.sin(KJ*o)+ube*Math.cos(ZJ*o)+ybe*Math.sin(ZJ*o)+fbe*Math.cos(JJ*o)+Abe*Math.sin(JJ*o)+dbe*Math.cos(QJ*o)+xbe*Math.sin(QJ*o),s=ibe+obe*i+Cbe*Math.cos($J*o)+Ibe*Math.sin($J*o)+Tbe*Math.cos(eQ*o)+Pbe*Math.sin(eQ*o)+Ebe*Math.cos(tQ*o)+Obe*Math.sin(tQ*o)+bbe*Math.cos(nQ*o)+Rbe*Math.sin(nQ*o)+Sbe*Math.cos(iQ*o)+Bbe*Math.sin(iQ*o)+Dbe*Math.cos(oQ*o)+Mbe*Math.sin(oQ*o)+vbe*Math.cos(rQ*o)+Lbe*Math.sin(rQ*o)+wbe*Math.cos(sQ*o)+Nbe*Math.sin(sQ*o),a=.0167086342-.0004203654*i,c=102.93734808*Vu+11612.3529*Fl*i,l=469.97289*Fl*i,f=174.87317577*Vu-8679.27034*Fl*i;return lQ(r,a,l,c,f,s,t)}function uQ(e,t){cQ(e,QC);let i=(QC.dayNumber-G3.dayNumber+(QC.secondsOfDay-G3.secondsOfDay)/Qn.SECONDS_PER_DAY)/Qn.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i,a=383397.7725+.004*i,c=.055545526-16e-9*i,l=5.15668983*Vu,f=-8e-5*i+.02966*o-42e-6*r-13e-8*s,d=83.35324312*Vu,p=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s,g=125.04455501*Vu,m=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s,A=218.31664563*Vu,x=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s,C=297.85019547*Vu+Fl*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),T=93.27209062*Vu+Fl*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),E=134.96340251*Vu+Fl*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),S=357.52910918*Vu+Fl*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),D=310.17137918*Vu-Fl*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),w=2*C,R=4*C,O=6*C,L=2*E,N=3*E,_=4*E,b=2*T;a+=3400.4*Math.cos(w)-635.6*Math.cos(w-E)-235.6*Math.cos(E)+218.1*Math.cos(w-S)+181*Math.cos(w+E),c+=.014216*Math.cos(w-E)+.008551*Math.cos(w-L)-.001383*Math.cos(E)+.001356*Math.cos(w+E)-.001147*Math.cos(R-N)-914e-6*Math.cos(R-L)+869e-6*Math.cos(w-S-E)-627e-6*Math.cos(w)-394e-6*Math.cos(R-_)+282e-6*Math.cos(w-S-L)-279e-6*Math.cos(C-E)-236e-6*Math.cos(L)+231e-6*Math.cos(R)+229e-6*Math.cos(O-_)-201e-6*Math.cos(L-b),f+=486.26*Math.cos(w-b)-40.13*Math.cos(w)+37.51*Math.cos(b)+25.73*Math.cos(L-b)+19.97*Math.cos(w-S-b),p+=-55609*Math.sin(w-E)-34711*Math.sin(w-L)-9792*Math.sin(E)+9385*Math.sin(R-N)+7505*Math.sin(R-L)+5318*Math.sin(w+E)+3484*Math.sin(R-_)-3417*Math.sin(w-S-E)-2530*Math.sin(O-_)-2376*Math.sin(w)-2075*Math.sin(w-N)-1883*Math.sin(L)-1736*Math.sin(O-5*E)+1626*Math.sin(S)-1370*Math.sin(O-N),m+=-5392*Math.sin(w-b)-540*Math.sin(S)-441*Math.sin(w)+423*Math.sin(b)-288*Math.sin(L-b),x+=-3332.9*Math.sin(w)+1197.4*Math.sin(w-E)-662.5*Math.sin(S)+396.3*Math.sin(E)-218*Math.sin(w-S);let v=2*D,I=3*D;f+=46.997*Math.cos(D)*i-.614*Math.cos(w-b+D)*i+.614*Math.cos(w-b-D)*i-.0297*Math.cos(v)*o-.0335*Math.cos(D)*o+.0012*Math.cos(w-b+v)*o-16e-5*Math.cos(D)*r+4e-5*Math.cos(I)*r+4e-5*Math.cos(v)*r;let B=2.116*Math.sin(D)*i-.111*Math.sin(w-b-D)*i-.0015*Math.sin(D)*o;p+=B,x+=B,m+=-520.77*Math.sin(D)*i+13.66*Math.sin(w-b+D)*i+1.12*Math.sin(w-D)*i-1.06*Math.sin(b-D)*i+.66*Math.sin(v)*o+.371*Math.sin(D)*o-.035*Math.sin(w-b+v)*o-.015*Math.sin(w-b+D)*o+.0014*Math.sin(D)*r-.0011*Math.sin(I)*r-9e-4*Math.sin(v)*r,a*=XEe;let F=l+f*Fl,k=d+p*Fl,U=A+x*Fl,G=g+m*Fl;return lQ(a,c,F,k,G,U,t)}var aQ=.012300034,Vbe=aQ/(aQ+1)*-1;function Ube(e,t){return t=uQ(e,t),h.multiplyByScalar(t,Vbe,t)}var fQ=new Z(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819),kw=new h;VG.computeSunPositionInEarthInertialFrame=function(e,t){return u(e)||(e=$.now()),u(t)||(t=new h),kw=Fbe(e,kw),t=h.negate(kw,t),Ube(e,kw),h.subtract(t,kw,t),Z.multiplyByVector(fQ,t,t),t};VG.computeMoonPositionInEarthInertialFrame=function(e,t){return u(e)||(e=$.now()),t=uQ(e,t),Z.multiplyByVector(fQ,t,t),t};var K_=VG;var W3={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};W3.getMorphTime=function(e){return e===W3.SCENE3D?1:e===W3.MORPHING?void 0:0};var te=Object.freeze(W3);function kbe(e){e=y(e,y.EMPTY_OBJECT),this.color=z.clone(y(e.color,z.WHITE)),this.intensity=y(e.intensity,2)}var Hm=kbe;function $C(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Ye,this._viewportCartesian4=new oe,this._viewportDirty=!1,this._viewportOrthographicMatrix=M.clone(M.IDENTITY),this._viewportTransformation=M.clone(M.IDENTITY),this._model=M.clone(M.IDENTITY),this._view=M.clone(M.IDENTITY),this._inverseView=M.clone(M.IDENTITY),this._projection=M.clone(M.IDENTITY),this._infiniteProjection=M.clone(M.IDENTITY),this._entireFrustum=new H,this._currentFrustum=new H,this._frustumPlanes=new oe,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=Z.clone(M.IDENTITY),this._view3DDirty=!0,this._view3D=new M,this._inverseView3DDirty=!0,this._inverseView3D=new M,this._inverseModelDirty=!0,this._inverseModel=new M,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new Z,this._viewRotation=new Z,this._inverseViewRotation=new Z,this._viewRotation3D=new Z,this._inverseViewRotation3D=new Z,this._inverseProjectionDirty=!0,this._inverseProjection=new M,this._modelViewDirty=!0,this._modelView=new M,this._modelView3DDirty=!0,this._modelView3D=new M,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new M,this._inverseModelViewDirty=!0,this._inverseModelView=new M,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new M,this._viewProjectionDirty=!0,this._viewProjection=new M,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new M,this._modelViewProjectionDirty=!0,this._modelViewProjection=new M,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new M,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new M,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new M,this._normalDirty=!0,this._normal=new Z,this._normal3DDirty=!0,this._normal3D=new Z,this._inverseNormalDirty=!0,this._inverseNormal=new Z,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new Z,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new Hn,this._cameraPosition=new h,this._sunPositionWC=new h,this._sunPositionColumbusView=new h,this._sunDirectionWC=new h,this._sunDirectionEC=new h,this._moonDirectionEC=new h,this._lightDirectionWC=new h,this._lightDirectionEC=new h,this._lightColor=new h,this._lightColorHdr=new h,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new h,this._cameraRight=new h,this._cameraUp=new h,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new H,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new z,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new H,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties($C.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!Ye.equals(e,this._viewport)){Ye.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 dQ(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return dQ(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){M.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,M.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){let e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,M.getMatrix3(this.inverseModel,e),Z.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return UG(this),this._view3D}},viewRotation:{get:function(){return UG(this),this._viewRotation}},viewRotation3D:{get:function(){return UG(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return pQ(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return pQ(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return Zbe(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return Jbe(this),this._modelView}},modelView3D:{get:function(){return Qbe(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return oSe(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return $be(this),this._inverseModelView}},inverseModelView3D:{get:function(){return eSe(this),this._inverseModelView3D}},viewProjection:{get:function(){return tSe(this),this._viewProjection}},inverseViewProjection:{get:function(){return nSe(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return iSe(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return rSe(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return sSe(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return aSe(this),this._modelViewInfiniteProjection}},normal:{get:function(){return cSe(this),this._normal}},normal3D:{get:function(){return lSe(this),this._normal3D}},inverseNormal:{get:function(){return uSe(this),this._inverseNormal}},inverseNormal3D:{get:function(){return fSe(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}},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 mQ(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return mQ(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},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}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},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 y(this._ellipsoid,ie.WGS84)}}});function zbe(e,t){M.clone(t,e._view),M.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 Hbe(e,t){M.clone(t,e._inverseView),M.getMatrix3(t,e._inverseViewRotation)}function Gbe(e,t){M.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function Wbe(e,t){M.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function jbe(e,t){h.clone(t.positionWC,e._cameraPosition),h.clone(t.directionWC,e._cameraDirection),h.clone(t.rightWC,e._cameraRight),h.clone(t.upWC,e._cameraUp);let n=t.positionCartographic;u(n)?e._eyeHeight=n.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}var zw=new Z,Ybe=new he;function qbe(e,t){u(Ot.computeIcrfToFixedMatrix(t.time,zw))||(zw=Ot.computeTemeToPseudoFixedMatrix(t.time,zw));let n=K_.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);Z.multiplyByVector(zw,n,n),h.normalize(n,e._sunDirectionWC),n=Z.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),h.normalize(n,n),n=K_.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),Z.multiplyByVector(zw,n,n),Z.multiplyByVector(e.viewRotation3D,n,n),h.normalize(n,n);let i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,Ybe);i.project(r,e._sunPositionColumbusView)}$C.prototype.updateCamera=function(e){zbe(this,e.viewMatrix),Hbe(this,e.inverseViewMatrix),jbe(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==te.SCENE2D&&e.frustum instanceof en};$C.prototype.updateFrustum=function(e){Gbe(this,e.projectionMatrix),u(e.infiniteProjectionMatrix)&&Wbe(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=P.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,u(e._offCenterFrustum)&&(e=e._offCenterFrustum),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right};$C.prototype.updatePass=function(e){this._pass=e};var Xbe=[],Kbe=new Hm;$C.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===te.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),qbe(this,e);let n=y(e.light,Kbe);n instanceof Hm?(this._lightDirectionWC=h.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=h.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=h.normalize(h.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=Z.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));let i=n.color,o=h.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=h.multiplyByScalar(o,n.intensity,o);let r=h.maximumComponent(o);r>1?h.divideByScalar(o,r,this._lightColor):h.clone(o,this._lightColor);let s=e.brdfLutGenerator,a=u(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=y(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=y(e.sphericalHarmonicCoefficients,Xbe),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,u(this._specularEnvironmentMaps)&&H.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=Ot.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;let c=t.frustum.fov,l=this._viewport,f;u(c)?l.height>l.width?f=Math.tan(.5*c)*2/l.height:f=Math.tan(.5*c)*2/l.width:f=1/Math.max(l.width,l.height),this._geometricToleranceOverMeter=f*e.maximumScreenSpaceError,z.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function dQ(e){if(e._viewportDirty){let t=e._viewport;M.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),M.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function Zbe(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==te.SCENE2D&&e._mode!==te.MORPHING&&!e._orthographicIn3D?M.inverse(e._projection,e._inverseProjection):M.clone(M.ZERO,e._inverseProjection))}function Jbe(e){e._modelViewDirty&&(e._modelViewDirty=!1,M.multiplyTransformation(e._view,e._model,e._modelView))}function Qbe(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,M.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function $be(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,M.inverse(e.modelView,e._inverseModelView))}function eSe(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,M.inverse(e.modelView3D,e._inverseModelView3D))}function tSe(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,M.multiply(e._projection,e._view,e._viewProjection))}function nSe(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,M.inverse(e.viewProjection,e._inverseViewProjection))}function iSe(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,M.multiply(e._projection,e.modelView,e._modelViewProjection))}function oSe(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 rSe(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,M.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function sSe(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,M.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function aSe(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,M.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function cSe(e){if(e._normalDirty){e._normalDirty=!1;let t=e._normal;M.getMatrix3(e.inverseModelView,t),Z.getRotation(t,t),Z.transpose(t,t)}}function lSe(e){if(e._normal3DDirty){e._normal3DDirty=!1;let t=e._normal3D;M.getMatrix3(e.inverseModelView3D,t),Z.getRotation(t,t),Z.transpose(t,t)}}function uSe(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,M.getMatrix3(e.inverseModelView,e._inverseNormal),Z.getRotation(e._inverseNormal,e._inverseNormal))}function fSe(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,M.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),Z.getRotation(e._inverseNormal3D,e._inverseNormal3D))}var hQ=new h;function mQ(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,M.multiplyByPoint(e.inverseModel,e._cameraPosition,hQ),Hn.fromCartesian(hQ,e._encodedCameraPositionMC))}var dSe=new h,hSe=new h,mSe=new h,pSe=new h,_Se=new he,gSe=new h,ySe=new M;function ASe(e,t,n,i,o,r,s,a){let c=dSe;c.x=e.y,c.y=e.z,c.z=e.x;let l=hSe;l.x=n.y,l.y=n.z,l.z=n.x;let f=mSe;f.x=i.y,f.y=i.z,f.z=i.x;let d=pSe;d.x=t.y,d.y=t.z,d.z=t.x,r===te.SCENE2D&&(c.z=o*.5);let p=s.unproject(c,_Se);p.longitude=P.clamp(p.longitude,-Math.PI,Math.PI),p.latitude=P.clamp(p.latitude,-P.PI_OVER_TWO,P.PI_OVER_TWO);let g=s.ellipsoid,m=g.cartographicToCartesian(p,gSe),A=Ot.eastNorthUpToFixedFrame(m,g,ySe);return M.multiplyByPointAsVector(A,l,l),M.multiplyByPointAsVector(A,f,f),M.multiplyByPointAsVector(A,d,d),u(a)||(a=new M),a[0]=l.x,a[1]=f.x,a[2]=-d.x,a[3]=0,a[4]=l.y,a[5]=f.y,a[6]=-d.y,a[7]=0,a[8]=l.z,a[9]=f.z,a[10]=-d.z,a[11]=0,a[12]=-h.dot(l,m),a[13]=-h.dot(f,m),a[14]=h.dot(d,m),a[15]=1,a}function UG(e){e._view3DDirty&&(e._mode===te.SCENE3D?M.clone(e._view,e._view3D):ASe(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),M.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function pQ(e){e._inverseView3DDirty&&(M.inverseTransformation(e.view3D,e._inverseView3D),M.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}var Hw=$C;function xSe(e,t,n,i){let o=u(t.vertexBuffer),r=u(t.value),s=t.value?t.value.length:t.componentsPerAttribute,a={index:y(t.index,n),enabled:y(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:y(t.componentDatatype,q.FLOAT),normalize:y(t.normalize,!1),offsetInBytes:y(t.offsetInBytes,0),strideInBytes:y(t.strideInBytes,0),instanceDivisor:y(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(c){let l=this.index;c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),c.vertexAttribPointer(l,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),c.enableVertexAttribArray(l),this.instanceDivisor>0&&(i.glVertexAttribDivisor(l,this.instanceDivisor),i._vertexAttribDivisors[l]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(c){c.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(c){c.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(c){c.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(c){c.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(c){c.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(c){}}e.push(a)}function gQ(e,t,n){for(let i=0;i<t.length;++i){let o=t[i];o.enabled&&o.vertexAttrib(e)}u(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function Gm(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer,r,s=[],a=1,c=!1,l=!1,f=i.length;for(r=0;r<f;++r)xSe(s,i[r],r,t);for(f=s.length,r=0;r<f;++r){let p=s[r];if(u(p.vertexBuffer)&&p.instanceDivisor===0){let g=p.strideInBytes||p.componentsPerAttribute*q.getSizeInBytes(p.componentDatatype);a=p.vertexBuffer.sizeInBytes/g;break}}for(r=0;r<f;++r)s[r].instanceDivisor>0&&(c=!0),u(s[r].value)&&(l=!0);let d;t.vertexArrayObject&&(d=t.glCreateVertexArray(),t.glBindVertexArray(d),gQ(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=c,this._hasConstantAttributes=l,this._context=t,this._gl=n,this._vao=d,this._attributes=s,this._indexBuffer=o}function _Q(e){return e.values.length/e.componentsPerAttribute}function CSe(e){return q.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function TSe(e){let t,n,i,o=[];for(n in e)e.hasOwnProperty(n)&&u(e[n])&&u(e[n].values)&&(o.push(n),e[n].componentDatatype===q.DOUBLE&&(e[n].componentDatatype=q.FLOAT,e[n].values=q.createTypedArray(q.FLOAT,e[n].values)));let r,s=o.length;if(s>0)for(r=_Q(e[o[0]]),t=1;t<s;++t){let l=_Q(e[o[t]]);if(l!==r)throw new ue(`Each attribute list must have the same number of vertices.  Attribute ${o[t]} has a different number of vertices (${l.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(l,f){return q.getSizeInBytes(e[f].componentDatatype)-q.getSizeInBytes(e[l].componentDatatype)});let a=0,c={};for(t=0;t<s;++t)n=o[t],i=e[n],c[n]=a,a+=CSe(i);if(a>0){let l=q.getSizeInBytes(e[o[0]].componentDatatype),f=a%l;f!==0&&(a+=l-f);let d=r*a,p=new ArrayBuffer(d),g={};for(t=0;t<s;++t){n=o[t];let m=q.getSizeInBytes(e[n].componentDatatype);g[n]={pointer:q.createTypedArray(e[n].componentDatatype,p),index:c[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 A=i.values,x=g[n],C=x.pointer,T=i.componentsPerAttribute;for(let E=0;E<T;++E)C[x.index+E]=A[t*T+E];x.index+=x.strideInComponentType}return{buffer:p,offsetsInBytes:c,vertexSizeInBytes:a}}}Gm.fromGeometry=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=y(e.geometry,y.EMPTY_OBJECT),i=y(e.bufferUsage,Ne.DYNAMIC_DRAW),o=y(e.attributeLocations,y.EMPTY_OBJECT),r=y(e.interleave,!1),s=e.vertexArrayAttributes,a,c,l,f=u(s)?s:[],d=n.attributes;if(r){let m=TSe(d);if(u(m)){l=lt.createVertexBuffer({context:t,typedArray:m.buffer,usage:i});let A=m.offsetsInBytes,x=m.vertexSizeInBytes;for(a in d)d.hasOwnProperty(a)&&u(d[a])&&(c=d[a],u(c.values)?f.push({index:o[a],vertexBuffer:l,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:A[a],strideInBytes:x}):f.push({index:o[a],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(a in d)if(d.hasOwnProperty(a)&&u(d[a])){c=d[a];let m=c.componentDatatype;m===q.DOUBLE&&(m=q.FLOAT),l=void 0,u(c.values)&&(l=lt.createVertexBuffer({context:t,typedArray:q.createTypedArray(m,c.values),usage:i})),f.push({index:o[a],vertexBuffer:l,value:c.value,componentDatatype:m,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let p,g=n.indices;return u(g)&&(ct.computeNumberOfVertices(n)>=P.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?p=lt.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:Fe.UNSIGNED_INT}):p=lt.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:Fe.UNSIGNED_SHORT})),new Gm({context:t,attributes:f,indexBuffer:p})};Object.defineProperties(Gm.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});Gm.prototype.getAttribute=function(e){return this._attributes[e]};function ESe(e){let t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;let i=t._vertexAttribDivisors,o=e._attributes,r=Ft.maximumVertexAttributes,s;if(n){let a=o.length;for(s=0;s<a;++s){let c=o[s];if(c.enabled){let l=c.instanceDivisor,f=c.index;l!==i[f]&&(t.glVertexAttribDivisor(f,l),i[f]=l)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function bSe(e,t){let n=e._attributes,i=n.length;for(let o=0;o<i;++o){let r=n[o];r.enabled&&u(r.value)&&r.vertexAttrib(t)}}Gm.prototype._bind=function(){u(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&ESe(this),this._hasConstantAttributes&&bSe(this,this._gl)):gQ(this._gl,this._attributes,this._indexBuffer)};Gm.prototype._unBind=function(){if(u(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)}};Gm.prototype.isDestroyed=function(){return!1};Gm.prototype.destroy=function(){let e=this._attributes;for(let n=0;n<e.length;++n){let i=e[n].vertexBuffer;u(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}let t=this._indexBuffer;return u(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),u(this._vao)&&this._context.glDeleteVertexArray(this._vao),le(this)};var oi=Gm;function Vl(e,t){let{getWebGLStub:n,requestWebgl1:i,webgl:o={},allowTextureFilterAnisotropic:r=!0}=y(t,{});o.alpha=y(o.alpha,!1),o.stencil=y(o.stencil,!0),o.powerPreference=y(o.powerPreference,"high-performance");let s=u(n)?n(e,o):SSe(e,o,i),c=typeof WebGL2RenderingContext<"u"&&s instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=s,this._gl=s,this._webgl2=c,this._id=zn(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new Fw(this),this._textureCache=new Vw;let l=s;this._stencilBits=l.getParameter(l.STENCIL_BITS),Ft._maximumCombinedTextureImageUnits=l.getParameter(l.MAX_COMBINED_TEXTURE_IMAGE_UNITS),Ft._maximumCubeMapSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),Ft._maximumFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),Ft._maximumTextureImageUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),Ft._maximumRenderbufferSize=l.getParameter(l.MAX_RENDERBUFFER_SIZE),Ft._maximumTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),Ft._maximumVaryingVectors=l.getParameter(l.MAX_VARYING_VECTORS),Ft._maximumVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),Ft._maximumVertexTextureImageUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Ft._maximumVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),Ft._maximumSamples=this._webgl2?l.getParameter(l.MAX_SAMPLES):0;let f=l.getParameter(l.ALIASED_LINE_WIDTH_RANGE);Ft._minimumAliasedLineWidth=f[0],Ft._maximumAliasedLineWidth=f[1];let d=l.getParameter(l.ALIASED_POINT_SIZE_RANGE);Ft._minimumAliasedPointSize=d[0],Ft._maximumAliasedPointSize=d[1];let p=l.getParameter(l.MAX_VIEWPORT_DIMS);Ft._maximumViewportWidth=p[0],Ft._maximumViewportHeight=p[1];let g=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT);Ft._highpFloatSupported=g.precision!==0;let m=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_INT);Ft._highpIntSupported=m.rangeMax!==0,this._antialias=l.getContextAttributes().antialias,this._standardDerivatives=!!Er(l,["OES_standard_derivatives"]),this._blendMinmax=!!Er(l,["EXT_blend_minmax"]),this._elementIndexUint=!!Er(l,["OES_element_index_uint"]),this._depthTexture=!!Er(l,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!Er(l,["EXT_frag_depth"]),this._debugShaders=Er(l,["WEBGL_debug_shaders"]),this._textureFloat=!!Er(l,["OES_texture_float"]),this._textureHalfFloat=!!Er(l,["OES_texture_half_float"]),this._textureFloatLinear=!!Er(l,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!Er(l,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!Er(l,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!Er(l,["EXT_float_blend"]),this._colorBufferHalfFloat=!!Er(l,["EXT_color_buffer_half_float"]),this._s3tc=!!Er(l,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!Er(l,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!Er(l,["WEBGL_compressed_texture_astc"]),this._etc=!!Er(l,["WEBG_compressed_texture_etc"]),this._etc1=!!Er(l,["WEBGL_compressed_texture_etc1"]),this._bc7=!!Er(l,["EXT_texture_compression_bptc"]),tl.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);let A=r?Er(l,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=A,Ft._maximumTextureFilterAnisotropy=u(A)?l.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let x,C,T,E,S,D,w,R,O,L;if(c){let v=this;x=function(){return v._gl.createVertexArray()},C=function(I){v._gl.bindVertexArray(I)},T=function(I){v._gl.deleteVertexArray(I)},E=function(I,B,F,k,U){l.drawElementsInstanced(I,B,F,k,U)},S=function(I,B,F,k){l.drawArraysInstanced(I,B,F,k)},D=function(I,B){l.vertexAttribDivisor(I,B)},w=function(I){l.drawBuffers(I)}}else R=Er(l,["OES_vertex_array_object"]),u(R)&&(x=function(){return R.createVertexArrayOES()},C=function(v){R.bindVertexArrayOES(v)},T=function(v){R.deleteVertexArrayOES(v)}),O=Er(l,["ANGLE_instanced_arrays"]),u(O)&&(E=function(v,I,B,F,k){O.drawElementsInstancedANGLE(v,I,B,F,k)},S=function(v,I,B,F){O.drawArraysInstancedANGLE(v,I,B,F)},D=function(v,I){O.vertexAttribDivisorANGLE(v,I)}),L=Er(l,["WEBGL_draw_buffers"]),u(L)&&(w=function(v){L.drawBuffersWEBGL(v)});this.glCreateVertexArray=x,this.glBindVertexArray=C,this.glDeleteVertexArray=T,this.glDrawElementsInstanced=E,this.glDrawArraysInstanced=S,this.glVertexAttribDivisor=D,this.glDrawBuffers=w,this._vertexArrayObject=!!R,this._instancedArrays=!!O,this._drawBuffers=!!L,Ft._maximumDrawBuffers=this.drawBuffers?l.getParameter(ee.MAX_DRAW_BUFFERS):1,Ft._maximumColorAttachments=this.drawBuffers?l.getParameter(ee.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new z(0,0,0,0),this._clearDepth=1,this._clearStencil=0;let N=new Hw,_=new La(this),b=Ue.fromCache();this._defaultPassState=_,this._defaultRenderState=b,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=N,this._currentRenderState=b,this._currentPassState=_,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let v=0;v<Ft._maximumVertexAttributes;v++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:n,requestWebgl1:i,webgl:o,allowTextureFilterAnisotropic:r},this.cache={},Ue.apply(l,b,_)}function SSe(e,t,n){if(typeof WebGLRenderingContext>"u")throw new ue("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(!u(r))throw new ue("The browser supports WebGL, but initialization failed.");return r}function DSe(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 vSe(e,t,n,i){let o=`${DSe(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function wSe(e,t,n){let i=e.getError();if(i!==e.NO_ERROR)throw new ue(vSe(e,t,n,i))}function ISe(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 PSe(e,t){if(!u(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,ISe(e,o,t))}return i}function Er(e,t){let n=t.length;for(let i=0;i<n;++i){let o=e.getExtension(t[i]);if(o)return o}}var OSe={};Object.defineProperties(Vl.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}},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=PSe(this._originalGLContext,e?wSe:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new It({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return this._defaultEmissiveTexture===void 0&&(this._defaultEmissiveTexture=new It({context:this,pixelFormat:rt.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 It({context:this,pixelFormat:rt.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 Ma({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 OSe}}});function yQ(e,t,n,i){let o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,Ue.partialApply(e._gl,o,t,r,n,i)}var kG;typeof WebGLRenderingContext<"u"&&(kG=[ee.BACK]);function zG(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=kG;if(u(t))t._bind(),n=t._getActiveColorAttachments();else{let i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}var RSe=new ii;Vl.prototype.clear=function(e,t){e=y(e,RSe),t=y(t,this._defaultPassState);let n=this._gl,i=0,o=e.color,r=e.depth,s=e.stencil;u(o)&&(z.equals(this._clearColor,o)||(z.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),u(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),u(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);let a=y(e.renderState,this._defaultRenderState);yQ(this,a,t,!0);let c=y(e.framebuffer,t.framebuffer);zG(this,c),n.clear(i)};function BSe(e,t,n,i,o){zG(e,t),yQ(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function MSe(e,t,n,i){let o=t._primitiveType,r=t._vertexArray,s=t._offset,a=t._count,c=t.instanceCount;e._us.model=y(t._modelMatrix,M.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();let l=r.indexBuffer;u(l)?(s=s*l.bytesPerIndex,a=y(a,l.numberOfIndices),c===0?e._gl.drawElements(o,a,l.indexDatatype,s):e.glDrawElementsInstanced(o,a,l.indexDatatype,s,c)):(a=y(a,r.numberOfVertices),c===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,c)),r._unBind()}Vl.prototype.draw=function(e,t,n,i){t=y(t,this._defaultPassState);let o=y(e._framebuffer,t.framebuffer),r=y(e._renderState,this._defaultRenderState);n=y(n,e._shaderProgram),i=y(i,e._uniformMap),BSe(this,o,t,n,r),MSe(this,e,n,i)};Vl.prototype.endFrame=function(){let e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);let t=kG;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)};Vl.prototype.readPixels=function(e){let t=this._gl;e=y(e,y.EMPTY_OBJECT);let n=Math.max(y(e.x,0),0),i=Math.max(y(e.y,0),0),o=y(e.width,t.drawingBufferWidth),r=y(e.height,t.drawingBufferHeight),s=e.framebuffer,a=Xe.UNSIGNED_BYTE;u(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);let c=rt.createTypedArray(rt.RGBA,a,o,r);return zG(this,s),t.readPixels(n,i,o,r,rt.RGBA,Xe.toWebGLConstant(a,this),c),c};var AQ={position:0,textureCoordinates:1};Vl.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!u(e)){let t=new ct({attributes:{position:new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new ve({componentDatatype:q.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=oi.fromGeometry({context:this,geometry:t,attributeLocations:AQ,bufferUsage:Ne.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Vl.prototype.createViewportQuadCommand=function(e,t){return t=y(t,y.EMPTY_OBJECT),new tt({vertexArray:this.getViewportQuadVertexArray(),primitiveType:Me.TRIANGLES,renderState:t.renderState,shaderProgram:Xt.fromCache({context:this,vertexShaderSource:l0,fragmentShaderSource:e,attributeLocations:AQ}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Vl.prototype.getObjectByPickColor=function(e){return this._pickObjects[e.toRgba()]};function HG(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(HG.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});HG.prototype.destroy=function(){delete this._pickObjects[this.key]};Vl.prototype.createPickId=function(e){++this._nextPickColor[0];let t=this._nextPickColor[0];if(t===0)throw new ue("Out of unique Pick IDs.");return this._pickObjects[t]=e,new HG(this._pickObjects,t,z.fromRgba(t))};Vl.prototype.isDestroyed=function(){return!1};Vl.prototype.destroy=function(){let e=this.cache;for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];u(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(),le(this)};Vl._deprecationWarning=nr;var Gw=Vl;function eT(e){e=y(e,y.EMPTY_OBJECT);let t=e.context,n=e.width,i=e.height;this._width=n,this._height=i;let o=e.colorRenderbuffers,r=e.colorTextures;if(u(o)!==u(r))throw new de("Both color renderbuffer and texture attachments must be provided.");let s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(u(s)!==u(a))throw new de("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new Ns({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new Ns({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}eT.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};eT.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};eT.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),u(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)};eT.prototype.isDestroyed=function(){return!1};eT.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),le(this)};var Ww=eT;var il={RGBA4:ee.RGBA4,RGBA8:ee.RGBA8,RGBA16F:ee.RGBA16F,RGBA32F:ee.RGBA32F,RGB5_A1:ee.RGB5_A1,RGB565:ee.RGB565,DEPTH_COMPONENT16:ee.DEPTH_COMPONENT16,STENCIL_INDEX8:ee.STENCIL_INDEX8,DEPTH_STENCIL:ee.DEPTH_STENCIL,DEPTH24_STENCIL8:ee.DEPTH24_STENCIL8,validate:function(e){return e===il.RGBA4||e===il.RGBA8||e===il.RGBA16F||e===il.RGBA32F||e===il.RGB5_A1||e===il.RGB565||e===il.DEPTH_COMPONENT16||e===il.STENCIL_INDEX8||e===il.DEPTH_STENCIL||e===il.DEPTH24_STENCIL8},getColorFormat:function(e){return e===ee.FLOAT?il.RGBA32F:e===ee.HALF_FLOAT_OES?il.RGBA16F:il.RGBA8}},_c=Object.freeze(il);function jw(e){e=y(e,y.EMPTY_OBJECT);let n=e.context._gl,i=Ft.maximumRenderbufferSize,o=y(e.format,_c.RGBA4),r=u(e.width)?e.width:n.drawingBufferWidth,s=u(e.height)?e.height:n.drawingBufferHeight,a=y(e.numSamples,1);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(jw.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});jw.prototype._getRenderbuffer=function(){return this._renderbuffer};jw.prototype.isDestroyed=function(){return!1};jw.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),le(this)};var Ul=jw;function os(e){e=y(e,y.EMPTY_OBJECT),this._numSamples=y(e.numSamples,1),this._colorAttachmentsLength=y(e.colorAttachmentsLength,1),this._color=y(e.color,!0),this._depth=y(e.depth,!1),this._depthStencil=y(e.depthStencil,!1),this._supportsDepthTexture=y(e.supportsDepthTexture,!1),this._createColorAttachments=y(e.createColorAttachments,!0),this._createDepthAttachments=y(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(os.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}}});os.prototype.isDirty=function(e,t,n,i,o){n=y(n,1);let r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=u(i)&&this._pixelDatatype!==i||u(o)&&this._pixelFormat!==o,c=n===1?u(this._framebuffer):u(this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!c||this._color&&!u(this._colorTextures[0])};os.prototype.update=function(e,t,n,i,o,r){if(i=e.msaa?y(i,1):1,o=y(o,this._color?y(this._pixelDatatype,Xe.UNSIGNED_BYTE):void 0),r=y(r,this._color?y(this._pixelFormat,rt.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 It({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:ln.NEAREST}),this._numSamples>1){let a=_c.getColorFormat(o);this._colorRenderbuffers[s]=new Ul({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new It({context:e,width:t,height:n,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Xe.UNSIGNED_INT_24_8,sampler:ln.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new Ul({context:e,width:t,height:n,format:_c.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new Ul({context:e,width:t,height:n,format:_c.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new It({context:e,width:t,height:n,pixelFormat:rt.DEPTH_COMPONENT,pixelDatatype:Xe.UNSIGNED_INT,sampler:ln.NEAREST}):this._depthRenderbuffer=new Ul({context:e,width:t,height:n,format:_c.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new Ww({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 Ns({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};os.prototype.getColorTexture=function(e){return e=y(e,0),this._colorTextures[e]};os.prototype.setColorTexture=function(e,t){t=y(t,0),this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};os.prototype.getColorRenderbuffer=function(e){return e=y(e,0),this._colorRenderbuffers[e]};os.prototype.setColorRenderbuffer=function(e,t){t=y(t,0),this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};os.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};os.prototype.setDepthRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};os.prototype.getDepthTexture=function(){return this._depthTexture};os.prototype.setDepthTexture=function(e){this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};os.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};os.prototype.setDepthStencilRenderbuffer=function(e){this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};os.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};os.prototype.setDepthStencilTexture=function(e){this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};os.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};os.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};os.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};os.prototype.destroy=function(){if(this._color){let e,t=this._colorTextures.length;for(e=0;e<t;++e){let n=this._colorTextures[e];this._createColorAttachments&&u(n)&&!n.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),u(n)&&n.isDestroyed()&&(this._colorTextures[e]=void 0);let i=this._colorRenderbuffers[e];this._createColorAttachments&&u(i)&&!i.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),u(i)&&i.isDestroyed()&&(this._colorRenderbuffers[e]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),u(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),u(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()),u(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),u(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};var mi=os;var b0={VERTEX:0,FRAGMENT:1,BOTH:2};b0.includesVertexShader=function(e){return e===b0.VERTEX||e===b0.BOTH};b0.includesFragmentShader=function(e){return e===b0.FRAGMENT||e===b0.BOTH};var Te=Object.freeze(b0);function GG(e){this.name=e,this.fields=[]}GG.prototype.addField=function(e,t){let n=`    ${e} ${t};`;this.fields.push(n)};GG.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=["    float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};var Yw=GG;function WG(e){this.signature=e,this.body=[]}WG.prototype.addLines=function(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}`)};WG.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};var qw=WG;function gc(){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(gc.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});gc.prototype.addDefine=function(e,t,n){n=y(n,Te.BOTH);let i=e;u(t)&&(i+=` ${t.toString()}`),Te.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),Te.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};gc.prototype.addStruct=function(e,t,n){this._structs[e]=new Yw(t),Te.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),Te.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};gc.prototype.addStructField=function(e,t,n){this._structs[e].addField(t,n)};gc.prototype.addFunction=function(e,t,n){this._functions[e]=new qw(t),Te.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),Te.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};gc.prototype.addFunctionLines=function(e,t){this._functions[e].addLines(t)};gc.prototype.addUniform=function(e,t,n){n=y(n,Te.BOTH);let i=`uniform ${e} ${t};`;Te.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),Te.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};gc.prototype.setPositionAttribute=function(e,t){return this._positionAttributeLine=`in ${e} ${t};`,this._attributeLocations[t]=0,0};gc.prototype.addAttribute=function(e,t){let n=`in ${e} ${t};`;this._attributeLines.push(n);let i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=NSe(e),i};gc.prototype.addVarying=function(e,t){let n=`${e} ${t};`;this._vertexShaderParts.varyingLines.push(`out ${n}`),this._fragmentShaderParts.varyingLines.push(`in ${n}`)};gc.prototype.addVertexLines=function(e){let t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};gc.prototype.addFragmentLines=function(e){let t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};gc.prototype.buildShaderProgram=function(e){let t=u(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=LSe(this),i=FSe(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
`),r=new ke({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
`),a=new ke({defines:this._fragmentShaderParts.defineLines,sources:[s]});return Xt.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};gc.prototype.clone=function(){return Ge(this,!0)};function LSe(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 NSe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function FSe(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 S0=gc;function As(e,t,n,i){let o=As._verifyAttributes(t);n=y(n,0);let r=[],s={},a,c,l=o.length;for(let d=0;d<l;++d){let p=o[d];if(p.vertexBuffer){r.push(p);continue}c=p.usage,a=s[c],u(a)||(a=s[c]=[]),a.push(p)}function f(d,p){return q.getSizeInBytes(p.componentDatatype)-q.getSizeInBytes(d.componentDatatype)}this._allBuffers=[];for(c in s)if(s.hasOwnProperty(c)){a=s[c],a.sort(f);let d=As._vertexSizeInBytes(a),p=a[0].usage,g={vertexSizeInBytes:d,vertexBuffer:void 0,usage:p,needsCommit:!1,arrayBuffer:void 0,arrayViews:As._createArrayViews(a,d)};this._allBuffers.push(g)}this._size=0,this._instanced=y(i,!1),this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}As._verifyAttributes=function(e){let t=[];for(let i=0;i<e.length;++i){let o=e[i],r={index:y(o.index,i),enabled:y(o.enabled,!0),componentsPerAttribute:o.componentsPerAttribute,componentDatatype:y(o.componentDatatype,q.FLOAT),normalize:y(o.normalize,!1),vertexBuffer:o.vertexBuffer,usage:y(o.usage,Ne.STATIC_DRAW)};t.push(r)}let n=new Array(t.length);for(let i=0;i<t.length;++i){let r=t[i].index;n[r]=!0}return t};As._vertexSizeInBytes=function(e){let t=0,n=e.length;for(let s=0;s<n;++s){let a=e[s];t+=a.componentsPerAttribute*q.getSizeInBytes(a.componentDatatype)}let i=n>0?q.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};As._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/q.getSizeInBytes(a),view:void 0}),i+=s.componentsPerAttribute*q.getSizeInBytes(a)}return n};As.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];As._resize(o,this._size),As._appendWriters(this.writers,o)}jG(this)};As._resize=function(e,t){if(e.vertexSizeInBytes>0){let n=new ArrayBuffer(t*e.vertexSizeInBytes);if(u(e.arrayBuffer)){let r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let c=0;c<a;++c)r[c]=s[c]}let i=e.arrayViews,o=i.length;for(let r=0;r<o;++r){let s=i[r];s.view=q.createArrayBufferView(s.componentDatatype,n,s.offsetInBytes)}e.arrayBuffer=n}};var VSe=[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 c=i*n;t[c]=o,t[c+1]=r,t[c+2]=s,t[c+3]=a,e.needsCommit=!0}}];As._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]=VSe[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};As.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=USe(this,i)||t;if(t||!u(this.va)){jG(this);let s=this.va=[],a=P.SIXTY_FOUR_KILOBYTES-4,c=u(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let l=0;l<c;++l){let f=[];for(o=0,r=n.length;o<r;++o){i=n[o];let d=l*(i.vertexSizeInBytes*a);As._appendAttributes(f,i,d,this._instanced)}f=f.concat(this._precreated),s.push({va:new oi({context:this._context,attributes:f,indexBuffer:e}),indicesCount:1.5*(l!==c-1?a:this._size%a)})}}};function USe(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;let n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=u(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=lt.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}As._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})}};As.prototype.subCommit=function(e,t){let n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)kSe(n[i],e,t)};function kSe(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)}}As.prototype.endSubCommits=function(){let e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function jG(e){let t=e.va;if(!u(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}As.prototype.isDestroyed=function(){return!1};As.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 jG(this),le(this)};var Wm=As;function zSe(e,t,n){let i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[Oe.createIfNeeded(t.positiveX).fetchImage(i),Oe.createIfNeeded(t.negativeX).fetchImage(i),Oe.createIfNeeded(t.positiveY).fetchImage(i),Oe.createIfNeeded(t.negativeY).fetchImage(i),Oe.createIfNeeded(t.positiveZ).fetchImage(i),Oe.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new Ma({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}var Xw=zSe;function Z_(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Ae,this.setValue(e)}Object.defineProperties(Z_.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});Z_.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};Z_.prototype.setValue=function(e){let t=this._value;if(t!==e){let n=u(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))}};Z_.prototype.equals=function(e){return this===e||e instanceof Z_&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};Z_.prototype.valueOf=function(){return this._value};Z_.prototype.toString=function(){return String(this._value)};var ei=Z_;function HSe(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(r){let s=this[t],a=this[n];u(a)&&(a(),this[n]=void 0),r!==void 0&&(!u(r)||!u(r.getValue))&&u(o)&&(r=o(r)),s!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,s)),u(r)&&u(r.definitionChanged)&&(this[n]=r.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,r,r)},this))}}}function GSe(e){return new ei(e)}function WSe(e,t,n){return HSe(e,`_${e.toString()}`,`_${e.toString()}Subscription`,y(t,!1),y(n,GSe))}var ae=WSe;function Kw(e){this._definitionChanged=new Ae,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.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(Kw.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),image:ae("image"),scale:ae("scale"),pixelOffset:ae("pixelOffset"),eyeOffset:ae("eyeOffset"),horizontalOrigin:ae("horizontalOrigin"),verticalOrigin:ae("verticalOrigin"),heightReference:ae("heightReference"),color:ae("color"),rotation:ae("rotation"),alignedAxis:ae("alignedAxis"),sizeInMeters:ae("sizeInMeters"),width:ae("width"),height:ae("height"),scaleByDistance:ae("scaleByDistance"),translucencyByDistance:ae("translucencyByDistance"),pixelOffsetScaleByDistance:ae("pixelOffsetScaleByDistance"),imageSubRegion:ae("imageSubRegion"),distanceDisplayCondition:ae("distanceDisplayCondition"),disableDepthTestDistance:ae("disableDepthTestDistance")});Kw.prototype.clone=function(e){return u(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):new Kw(this)};Kw.prototype.merge=function(e){this.show=y(this._show,e.show),this.image=y(this._image,e.image),this.scale=y(this._scale,e.scale),this.pixelOffset=y(this._pixelOffset,e.pixelOffset),this.eyeOffset=y(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=y(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=y(this._verticalOrigin,e.verticalOrigin),this.heightReference=y(this._heightReference,e.heightReference),this.color=y(this._color,e.color),this.rotation=y(this._rotation,e.rotation),this.alignedAxis=y(this._alignedAxis,e.alignedAxis),this.sizeInMeters=y(this._sizeInMeters,e.sizeInMeters),this.width=y(this._width,e.width),this.height=y(this._height,e.height),this.scaleByDistance=y(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=y(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=y(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=y(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=y(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this._disableDepthTestDistance,e.disableDepthTestDistance)};var Na=Kw;function D0(){this._array=[],this._hash={}}Object.defineProperties(D0.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});D0.prototype.contains=function(e){return u(this._hash[e])};D0.prototype.set=function(e,t){let n=this._hash[e];t!==n&&(this.remove(e),this._hash[e]=t,this._array.push(t))};D0.prototype.get=function(e){return this._hash[e]};D0.prototype.remove=function(e){let t=this._hash[e],n=u(t);if(n){let i=this._array;i.splice(i.indexOf(t),1),delete this._hash[e]}return n};D0.prototype.removeAll=function(){let e=this._array;e.length>0&&(this._hash={},e.length=0)};var xt=D0;function kl(e,t){e=y(e,0),this._near=e,t=y(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(kl.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}}});kl.packedLength=2;kl.pack=function(e,t,n){return n=y(n,0),t[n++]=e.near,t[n]=e.far,t};kl.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new kl),n.near=e[t++],n.far=e[t],n};kl.equals=function(e,t){return e===t||u(e)&&u(t)&&e.near===t.near&&e.far===t.far};kl.clone=function(e,t){if(u(e))return u(t)||(t=new kl),t.near=e.near,t.far=e.far,t};kl.prototype.clone=function(e){return kl.clone(this,e)};kl.prototype.equals=function(e){return kl.equals(this,e)};var bt=kl;function Uu(e,t,n,i){this.near=y(e,0),this.nearValue=y(t,0),this.far=y(n,1),this.farValue=y(i,0)}Uu.clone=function(e,t){if(u(e))return u(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new Uu(e.near,e.nearValue,e.far,e.farValue)};Uu.packedLength=4;Uu.pack=function(e,t,n){return n=y(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};Uu.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Uu),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};Uu.equals=function(e,t){return e===t||u(e)&&u(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};Uu.prototype.clone=function(e){return Uu.clone(this,e)};Uu.prototype.equals=function(e){return Uu.equals(this,e)};var Pt=Uu;var jSe={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},We=Object.freeze(jSe);var YSe={CENTER:0,LEFT:1,RIGHT:-1},_i=Object.freeze(YSe);var qSe={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},On=Object.freeze(qSe);var XSe={DONE:0,PENDING:1,FAILED:2},at=Object.freeze(XSe);function qf(){de.throwInstantiationError()}Object.defineProperties(qf.prototype,{isConstant:{get:de.throwInstantiationError},definitionChanged:{get:de.throwInstantiationError}});qf.prototype.getValue=de.throwInstantiationError;qf.prototype.equals=de.throwInstantiationError;qf.equals=function(e,t){return e===t||u(e)&&e.equals(t)};qf.arrayEquals=function(e,t){if(e===t)return!0;if(!u(e)||!u(t)||e.length!==t.length)return!1;let n=e.length;for(let i=0;i<n;i++)if(!qf.equals(e[i],t[i]))return!1;return!0};qf.isConstant=function(e){return!u(e)||e.isConstant};qf.getValueOrUndefined=function(e,t,n){return u(e)?e.getValue(t,n):void 0};qf.getValueOrDefault=function(e,t,n,i){return u(e)?y(e.getValue(t,i),n):n};qf.getValueOrClonedDefault=function(e,t,n,i){let o;return u(e)&&(o=e.getValue(t,i)),u(o)||(o=n.clone(o)),o};var Y=qf;var KSe=z.WHITE,ZSe=h.ZERO,JSe=We.NONE,QSe=H.ZERO,$Se=1,eDe=0,tDe=h.ZERO,nDe=_i.CENTER,iDe=On.CENTER,oDe=!1,rDe=new h,sDe=new z,aDe=new h,cDe=new H,lDe=new Pt,uDe=new Pt,fDe=new Pt,dDe=new Ye,hDe=new bt;function xQ(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function J_(e,t){t.collectionChanged.addEventListener(J_.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}J_.prototype.update=function(e){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,c,l=r.billboard,f=s.isShowing&&s.isAvailable(e)&&Y.getValueOrDefault(a._show,e,!0),d;if(f&&(d=Y.getValueOrUndefined(s._position,e,rDe),c=Y.getValueOrUndefined(a._image,e),f=u(d)&&u(c)),!f){YG(r,s,n);continue}Y.isConstant(s._position)||(n._clusterDirty=!0),u(l)||(l=n.getBillboard(s),l.id=s,l.image=void 0,r.billboard=l),l.show=f,(!u(l.image)||r.textureValue!==c)&&(l.image=c,r.textureValue=c),l.position=d,l.color=Y.getValueOrDefault(a._color,e,KSe,sDe),l.eyeOffset=Y.getValueOrDefault(a._eyeOffset,e,ZSe,aDe),l.heightReference=Y.getValueOrDefault(a._heightReference,e,JSe),l.pixelOffset=Y.getValueOrDefault(a._pixelOffset,e,QSe,cDe),l.scale=Y.getValueOrDefault(a._scale,e,$Se),l.rotation=Y.getValueOrDefault(a._rotation,e,eDe),l.alignedAxis=Y.getValueOrDefault(a._alignedAxis,e,tDe),l.horizontalOrigin=Y.getValueOrDefault(a._horizontalOrigin,e,nDe),l.verticalOrigin=Y.getValueOrDefault(a._verticalOrigin,e,iDe),l.width=Y.getValueOrUndefined(a._width,e),l.height=Y.getValueOrUndefined(a._height,e),l.scaleByDistance=Y.getValueOrUndefined(a._scaleByDistance,e,lDe),l.translucencyByDistance=Y.getValueOrUndefined(a._translucencyByDistance,e,uDe),l.pixelOffsetScaleByDistance=Y.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,fDe),l.sizeInMeters=Y.getValueOrDefault(a._sizeInMeters,e,oDe),l.distanceDisplayCondition=Y.getValueOrUndefined(a._distanceDisplayCondition,e,hDe),l.disableDepthTestDistance=Y.getValueOrUndefined(a._disableDepthTestDistance,e);let p=Y.getValueOrUndefined(a._imageSubRegion,e,dDe);u(p)&&l.setImageSubRegion(l._imageId,p)}return!0};J_.prototype.getBoundingSphere=function(e,t){let n=this._items.get(e.id);if(!u(n)||!u(n.billboard))return at.FAILED;let i=n.billboard;if(i.heightReference===We.NONE)t.center=h.clone(i.position,t.center);else{if(!u(i._clampedPosition))return at.PENDING;t.center=h.clone(i._clampedPosition,t.center)}return t.radius=0,at.DONE};J_.prototype.isDestroyed=function(){return!1};J_.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(J_.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return le(this)};J_.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],u(r._billboard)&&u(r._position)&&s.set(r.id,new xQ(r));for(o=i.length-1;o>-1;o--)r=i[o],u(r._billboard)&&u(r._position)?s.contains(r.id)||s.set(r.id,new xQ(r)):(YG(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],YG(s.get(r.id),r,a),s.remove(r.id)};function YG(e,t,n){u(e)&&(e.billboard=void 0,n.removeBillboard(t))}var Zw=J_;function mDe(e,t){this.start=y(e,0),this.stop=y(t,0)}var yc=mDe;function mn(e,t){this.center=h.clone(y(e,h.ZERO)),this.radius=y(t,0)}var KG=new h,ZG=new h,JG=new h,QG=new h,$G=new h,e8=new h,t8=new h,Fs=new h,n8=new h,i8=new h,o8=new h,r8=new h,pDe=4/3*P.PI;mn.fromPoints=function(e,t){if(u(t)||(t=new mn),!u(e)||e.length===0)return t.center=h.clone(h.ZERO,t.center),t.radius=0,t;let n=h.clone(e[0],t8),i=h.clone(n,KG),o=h.clone(n,ZG),r=h.clone(n,JG),s=h.clone(n,QG),a=h.clone(n,$G),c=h.clone(n,e8),l=e.length,f;for(f=1;f<l;f++){h.clone(e[f],n);let O=n.x,L=n.y,N=n.z;O<i.x&&h.clone(n,i),O>s.x&&h.clone(n,s),L<o.y&&h.clone(n,o),L>a.y&&h.clone(n,a),N<r.z&&h.clone(n,r),N>c.z&&h.clone(n,c)}let d=h.magnitudeSquared(h.subtract(s,i,Fs)),p=h.magnitudeSquared(h.subtract(a,o,Fs)),g=h.magnitudeSquared(h.subtract(c,r,Fs)),m=i,A=s,x=d;p>x&&(x=p,m=o,A=a),g>x&&(x=g,m=r,A=c);let C=n8;C.x=(m.x+A.x)*.5,C.y=(m.y+A.y)*.5,C.z=(m.z+A.z)*.5;let T=h.magnitudeSquared(h.subtract(A,C,Fs)),E=Math.sqrt(T),S=i8;S.x=i.x,S.y=o.y,S.z=r.z;let D=o8;D.x=s.x,D.y=a.y,D.z=c.z;let w=h.midpoint(S,D,r8),R=0;for(f=0;f<l;f++){h.clone(e[f],n);let O=h.magnitude(h.subtract(n,w,Fs));O>R&&(R=O);let L=h.magnitudeSquared(h.subtract(n,C,Fs));if(L>T){let N=Math.sqrt(L);E=(E+N)*.5,T=E*E;let _=N-E;C.x=(E*C.x+_*n.x)/N,C.y=(E*C.y+_*n.y)/N,C.z=(E*C.z+_*n.z)/N}}return E<R?(h.clone(C,t.center),t.radius=E):(h.clone(w,t.center),t.radius=R),t};var _De=new Ei,gDe=new h,yDe=new h,qG=new he,XG=new he;mn.fromRectangle2D=function(e,t,n){return mn.fromRectangleWithHeights2D(e,t,0,0,n)};mn.fromRectangleWithHeights2D=function(e,t,n,i,o){if(u(o)||(o=new mn),!u(e))return o.center=h.clone(h.ZERO,o.center),o.radius=0,o;t=y(t,_De),ce.southwest(e,qG),qG.height=n,ce.northeast(e,XG),XG.height=i;let r=t.project(qG,gDe),s=t.project(XG,yDe),a=s.x-r.x,c=s.y-r.y,l=s.z-r.z;o.radius=Math.sqrt(a*a+c*c+l*l)*.5;let f=o.center;return f.x=r.x+a*.5,f.y=r.y+c*.5,f.z=r.z+l*.5,o};var ADe=[];mn.fromRectangle3D=function(e,t,n,i){if(t=y(t,ie.WGS84),n=y(n,0),u(i)||(i=new mn),!u(e))return i.center=h.clone(h.ZERO,i.center),i.radius=0,i;let o=ce.subsample(e,t,n,ADe);return mn.fromPoints(o,i)};mn.fromVertices=function(e,t,n,i){if(u(i)||(i=new mn),!u(e)||e.length===0)return i.center=h.clone(h.ZERO,i.center),i.radius=0,i;t=y(t,h.ZERO),n=y(n,3);let o=t8;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;let r=h.clone(o,KG),s=h.clone(o,ZG),a=h.clone(o,JG),c=h.clone(o,QG),l=h.clone(o,$G),f=h.clone(o,e8),d=e.length,p;for(p=0;p<d;p+=n){let N=e[p]+t.x,_=e[p+1]+t.y,b=e[p+2]+t.z;o.x=N,o.y=_,o.z=b,N<r.x&&h.clone(o,r),N>c.x&&h.clone(o,c),_<s.y&&h.clone(o,s),_>l.y&&h.clone(o,l),b<a.z&&h.clone(o,a),b>f.z&&h.clone(o,f)}let g=h.magnitudeSquared(h.subtract(c,r,Fs)),m=h.magnitudeSquared(h.subtract(l,s,Fs)),A=h.magnitudeSquared(h.subtract(f,a,Fs)),x=r,C=c,T=g;m>T&&(T=m,x=s,C=l),A>T&&(T=A,x=a,C=f);let E=n8;E.x=(x.x+C.x)*.5,E.y=(x.y+C.y)*.5,E.z=(x.z+C.z)*.5;let S=h.magnitudeSquared(h.subtract(C,E,Fs)),D=Math.sqrt(S),w=i8;w.x=r.x,w.y=s.y,w.z=a.z;let R=o8;R.x=c.x,R.y=l.y,R.z=f.z;let O=h.midpoint(w,R,r8),L=0;for(p=0;p<d;p+=n){o.x=e[p]+t.x,o.y=e[p+1]+t.y,o.z=e[p+2]+t.z;let N=h.magnitude(h.subtract(o,O,Fs));N>L&&(L=N);let _=h.magnitudeSquared(h.subtract(o,E,Fs));if(_>S){let b=Math.sqrt(_);D=(D+b)*.5,S=D*D;let v=b-D;E.x=(D*E.x+v*o.x)/b,E.y=(D*E.y+v*o.y)/b,E.z=(D*E.z+v*o.z)/b}}return D<L?(h.clone(E,i.center),i.radius=D):(h.clone(O,i.center),i.radius=L),i};mn.fromEncodedCartesianVertices=function(e,t,n){if(u(n)||(n=new mn),!u(e)||!u(t)||e.length!==t.length||e.length===0)return n.center=h.clone(h.ZERO,n.center),n.radius=0,n;let i=t8;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];let o=h.clone(i,KG),r=h.clone(i,ZG),s=h.clone(i,JG),a=h.clone(i,QG),c=h.clone(i,$G),l=h.clone(i,e8),f=e.length,d;for(d=0;d<f;d+=3){let L=e[d]+t[d],N=e[d+1]+t[d+1],_=e[d+2]+t[d+2];i.x=L,i.y=N,i.z=_,L<o.x&&h.clone(i,o),L>a.x&&h.clone(i,a),N<r.y&&h.clone(i,r),N>c.y&&h.clone(i,c),_<s.z&&h.clone(i,s),_>l.z&&h.clone(i,l)}let p=h.magnitudeSquared(h.subtract(a,o,Fs)),g=h.magnitudeSquared(h.subtract(c,r,Fs)),m=h.magnitudeSquared(h.subtract(l,s,Fs)),A=o,x=a,C=p;g>C&&(C=g,A=r,x=c),m>C&&(C=m,A=s,x=l);let T=n8;T.x=(A.x+x.x)*.5,T.y=(A.y+x.y)*.5,T.z=(A.z+x.z)*.5;let E=h.magnitudeSquared(h.subtract(x,T,Fs)),S=Math.sqrt(E),D=i8;D.x=o.x,D.y=r.y,D.z=s.z;let w=o8;w.x=a.x,w.y=c.y,w.z=l.z;let R=h.midpoint(D,w,r8),O=0;for(d=0;d<f;d+=3){i.x=e[d]+t[d],i.y=e[d+1]+t[d+1],i.z=e[d+2]+t[d+2];let L=h.magnitude(h.subtract(i,R,Fs));L>O&&(O=L);let N=h.magnitudeSquared(h.subtract(i,T,Fs));if(N>E){let _=Math.sqrt(N);S=(S+_)*.5,E=S*S;let b=_-S;T.x=(S*T.x+b*i.x)/_,T.y=(S*T.y+b*i.y)/_,T.z=(S*T.z+b*i.z)/_}}return S<O?(h.clone(T,n.center),n.radius=S):(h.clone(R,n.center),n.radius=O),n};mn.fromCornerPoints=function(e,t,n){u(n)||(n=new mn);let i=h.midpoint(e,t,n.center);return n.radius=h.distance(i,t),n};mn.fromEllipsoid=function(e,t){return u(t)||(t=new mn),h.clone(h.ZERO,t.center),t.radius=e.maximumRadius,t};var xDe=new h;mn.fromBoundingSpheres=function(e,t){if(u(t)||(t=new mn),!u(e)||e.length===0)return t.center=h.clone(h.ZERO,t.center),t.radius=0,t;let n=e.length;if(n===1)return mn.clone(e[0],t);if(n===2)return mn.union(e[0],e[1],t);let i=[],o;for(o=0;o<n;o++)i.push(e[o].center);t=mn.fromPoints(i,t);let r=t.center,s=t.radius;for(o=0;o<n;o++){let a=e[o];s=Math.max(s,h.distance(r,a.center,xDe)+a.radius)}return t.radius=s,t};var CDe=new h,TDe=new h,EDe=new h;mn.fromOrientedBoundingBox=function(e,t){u(t)||(t=new mn);let n=e.halfAxes,i=Z.getColumn(n,0,CDe),o=Z.getColumn(n,1,TDe),r=Z.getColumn(n,2,EDe);return h.add(i,o,i),h.add(i,r,i),t.center=h.clone(e.center,t.center),t.radius=h.magnitude(i),t};var bDe=new h,SDe=new h;mn.fromTransformation=function(e,t){u(t)||(t=new mn);let n=M.getTranslation(e,bDe),i=M.getScale(e,SDe),o=.5*h.magnitude(i);return t.center=h.clone(n,t.center),t.radius=o,t};mn.clone=function(e,t){if(u(e))return u(t)?(t.center=h.clone(e.center,t.center),t.radius=e.radius,t):new mn(e.center,e.radius)};mn.packedLength=4;mn.pack=function(e,t,n){n=y(n,0);let i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t};mn.unpack=function(e,t,n){t=y(t,0),u(n)||(n=new mn);let i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};var DDe=new h,vDe=new h;mn.union=function(e,t,n){u(n)||(n=new mn);let i=e.center,o=e.radius,r=t.center,s=t.radius,a=h.subtract(r,i,DDe),c=h.magnitude(a);if(o>=c+s)return e.clone(n),n;if(s>=c+o)return t.clone(n),n;let l=(o+c+s)*.5,f=h.multiplyByScalar(a,(-o+l)/c,vDe);return h.add(f,i,f),h.clone(f,n.center),n.radius=l,n};var wDe=new h;mn.expand=function(e,t,n){n=mn.clone(e,n);let i=h.magnitude(h.subtract(t,n.center,wDe));return i>n.radius&&(n.radius=i),n};mn.intersectPlane=function(e,t){let n=e.center,i=e.radius,o=t.normal,r=h.dot(o,n)+t.distance;return r<-i?Qt.OUTSIDE:r<i?Qt.INTERSECTING:Qt.INSIDE};mn.transform=function(e,t,n){return u(n)||(n=new mn),n.center=M.multiplyByPoint(t,e.center,n.center),n.radius=M.getMaximumScale(t)*e.radius,n};var IDe=new h;mn.distanceSquaredTo=function(e,t){let n=h.subtract(e.center,t,IDe),i=h.magnitude(n)-e.radius;return i<=0?0:i*i};mn.transformWithoutScale=function(e,t,n){return u(n)||(n=new mn),n.center=M.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};var PDe=new h;mn.computePlaneDistances=function(e,t,n,i){u(i)||(i=new yc);let o=h.subtract(e.center,t,PDe),r=h.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};var CQ=new h,ODe=new h,RDe=new h,BDe=new h,MDe=new h,LDe=new he,TQ=new Array(8);for(let e=0;e<8;++e)TQ[e]=new h;var NDe=new Ei;mn.projectTo2D=function(e,t,n){t=y(t,NDe);let i=t.ellipsoid,o=e.center,r=e.radius,s;h.equals(o,h.ZERO)?s=h.clone(h.UNIT_X,CQ):s=i.geodeticSurfaceNormal(o,CQ);let a=h.cross(h.UNIT_Z,s,ODe);h.normalize(a,a);let c=h.cross(s,a,RDe);h.normalize(c,c),h.multiplyByScalar(s,r,s),h.multiplyByScalar(c,r,c),h.multiplyByScalar(a,r,a);let l=h.negate(c,MDe),f=h.negate(a,BDe),d=TQ,p=d[0];h.add(s,c,p),h.add(p,a,p),p=d[1],h.add(s,c,p),h.add(p,f,p),p=d[2],h.add(s,l,p),h.add(p,f,p),p=d[3],h.add(s,l,p),h.add(p,a,p),h.negate(s,s),p=d[4],h.add(s,c,p),h.add(p,a,p),p=d[5],h.add(s,c,p),h.add(p,f,p),p=d[6],h.add(s,l,p),h.add(p,f,p),p=d[7],h.add(s,l,p),h.add(p,a,p);let g=d.length;for(let C=0;C<g;++C){let T=d[C];h.add(o,T,T);let E=i.cartesianToCartographic(T,LDe);t.project(E,T)}n=mn.fromPoints(d,n),o=n.center;let m=o.x,A=o.y,x=o.z;return o.x=x,o.y=m,o.z=A,n};mn.isOccluded=function(e,t){return!t.isBoundingSphereVisible(e)};mn.equals=function(e,t){return e===t||u(e)&&u(t)&&h.equals(e.center,t.center)&&e.radius===t.radius};mn.prototype.intersectPlane=function(e){return mn.intersectPlane(this,e)};mn.prototype.distanceSquaredTo=function(e){return mn.distanceSquaredTo(this,e)};mn.prototype.computePlaneDistances=function(e,t,n){return mn.computePlaneDistances(this,e,t,n)};mn.prototype.isOccluded=function(e){return mn.isOccluded(this,e)};mn.prototype.equals=function(e){return mn.equals(this,e)};mn.prototype.clone=function(e){return mn.clone(this,e)};mn.prototype.volume=function(){let e=this.radius;return pDe*e*e*e};var se=mn;function FDe(e){e=y(e,y.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 dn=FDe;var VDe={NONE:0,TOP:1,ALL:2},nn=Object.freeze(VDe);function es(e){e=y(e,y.EMPTY_OBJECT),this.position=y(e.position,!1),this.normal=y(e.normal,!1),this.st=y(e.st,!1),this.bitangent=y(e.bitangent,!1),this.tangent=y(e.tangent,!1),this.color=y(e.color,!1)}es.POSITION_ONLY=Object.freeze(new es({position:!0}));es.POSITION_AND_NORMAL=Object.freeze(new es({position:!0,normal:!0}));es.POSITION_NORMAL_AND_ST=Object.freeze(new es({position:!0,normal:!0,st:!0}));es.POSITION_AND_ST=Object.freeze(new es({position:!0,st:!0}));es.POSITION_AND_COLOR=Object.freeze(new es({position:!0,color:!0}));es.ALL=Object.freeze(new es({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));es.DEFAULT=es.POSITION_NORMAL_AND_ST;es.packedLength=6;es.pack=function(e,t,n){return n=y(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};es.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new es),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};es.clone=function(e,t){if(u(e))return u(t)||(t=new es),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=es;var UDe=new h;function zl(e){e=y(e,y.EMPTY_OBJECT);let t=e.minimum,n=e.maximum,i=y(e.vertexFormat,Ie.DEFAULT);this._minimum=h.clone(t),this._maximum=h.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}zl.fromDimensions=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.dimensions,n=h.multiplyByScalar(t,.5,new h);return new zl({minimum:h.negate(n,new h),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};zl.fromAxisAlignedBoundingBox=function(e){return new zl({minimum:e.minimum,maximum:e.maximum})};zl.packedLength=2*h.packedLength+Ie.packedLength+1;zl.pack=function(e,t,n){return n=y(n,0),h.pack(e._minimum,t,n),h.pack(e._maximum,t,n+h.packedLength),Ie.pack(e._vertexFormat,t,n+2*h.packedLength),t[n+2*h.packedLength+Ie.packedLength]=y(e._offsetAttribute,-1),t};var bQ=new h,SQ=new h,DQ=new Ie,EQ={minimum:bQ,maximum:SQ,vertexFormat:DQ,offsetAttribute:void 0};zl.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,bQ),o=h.unpack(e,t+h.packedLength,SQ),r=Ie.unpack(e,t+2*h.packedLength,DQ),s=e[t+2*h.packedLength+Ie.packedLength];return u(n)?(n._minimum=h.clone(i,n._minimum),n._maximum=h.clone(o,n._maximum),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(EQ.offsetAttribute=s===-1?void 0:s,new zl(EQ))};zl.createGeometry=function(e){let t=e._minimum,n=e._maximum,i=e._vertexFormat;if(h.equals(t,n))return;let o=new dn,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:q.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){let l=new Float32Array(72);l[0]=0,l[1]=0,l[2]=1,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=1,l[9]=0,l[10]=0,l[11]=1,l[12]=0,l[13]=0,l[14]=-1,l[15]=0,l[16]=0,l[17]=-1,l[18]=0,l[19]=0,l[20]=-1,l[21]=0,l[22]=0,l[23]=-1,l[24]=1,l[25]=0,l[26]=0,l[27]=1,l[28]=0,l[29]=0,l[30]=1,l[31]=0,l[32]=0,l[33]=1,l[34]=0,l[35]=0,l[36]=-1,l[37]=0,l[38]=0,l[39]=-1,l[40]=0,l[41]=0,l[42]=-1,l[43]=0,l[44]=0,l[45]=-1,l[46]=0,l[47]=0,l[48]=0,l[49]=1,l[50]=0,l[51]=0,l[52]=1,l[53]=0,l[54]=0,l[55]=1,l[56]=0,l[57]=0,l[58]=1,l[59]=0,l[60]=0,l[61]=-1,l[62]=0,l[63]=0,l[64]=-1,l[65]=0,l[66]=0,l[67]=-1,l[68]=0,l[69]=0,l[70]=-1,l[71]=0,o.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:l})}if(i.st){let l=new Float32Array(48);l[0]=0,l[1]=0,l[2]=1,l[3]=0,l[4]=1,l[5]=1,l[6]=0,l[7]=1,l[8]=1,l[9]=0,l[10]=0,l[11]=0,l[12]=0,l[13]=1,l[14]=1,l[15]=1,l[16]=0,l[17]=0,l[18]=1,l[19]=0,l[20]=1,l[21]=1,l[22]=0,l[23]=1,l[24]=1,l[25]=0,l[26]=0,l[27]=0,l[28]=0,l[29]=1,l[30]=1,l[31]=1,l[32]=1,l[33]=0,l[34]=0,l[35]=0,l[36]=0,l[37]=1,l[38]=1,l[39]=1,l[40]=0,l[41]=0,l[42]=1,l[43]=0,l[44]=1,l[45]=1,l[46]=0,l[47]=1,o.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:l})}if(i.tangent){let l=new Float32Array(72);l[0]=1,l[1]=0,l[2]=0,l[3]=1,l[4]=0,l[5]=0,l[6]=1,l[7]=0,l[8]=0,l[9]=1,l[10]=0,l[11]=0,l[12]=-1,l[13]=0,l[14]=0,l[15]=-1,l[16]=0,l[17]=0,l[18]=-1,l[19]=0,l[20]=0,l[21]=-1,l[22]=0,l[23]=0,l[24]=0,l[25]=1,l[26]=0,l[27]=0,l[28]=1,l[29]=0,l[30]=0,l[31]=1,l[32]=0,l[33]=0,l[34]=1,l[35]=0,l[36]=0,l[37]=-1,l[38]=0,l[39]=0,l[40]=-1,l[41]=0,l[42]=0,l[43]=-1,l[44]=0,l[45]=0,l[46]=-1,l[47]=0,l[48]=-1,l[49]=0,l[50]=0,l[51]=-1,l[52]=0,l[53]=0,l[54]=-1,l[55]=0,l[56]=0,l[57]=-1,l[58]=0,l[59]=0,l[60]=1,l[61]=0,l[62]=0,l[63]=1,l[64]=0,l[65]=0,l[66]=1,l[67]=0,l[68]=0,l[69]=1,l[70]=0,l[71]=0,o.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:l})}if(i.bitangent){let l=new Float32Array(72);l[0]=0,l[1]=1,l[2]=0,l[3]=0,l[4]=1,l[5]=0,l[6]=0,l[7]=1,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=1,l[14]=0,l[15]=0,l[16]=1,l[17]=0,l[18]=0,l[19]=1,l[20]=0,l[21]=0,l[22]=1,l[23]=0,l[24]=0,l[25]=0,l[26]=1,l[27]=0,l[28]=0,l[29]=1,l[30]=0,l[31]=0,l[32]=1,l[33]=0,l[34]=0,l[35]=1,l[36]=0,l[37]=0,l[38]=1,l[39]=0,l[40]=0,l[41]=1,l[42]=0,l[43]=0,l[44]=1,l[45]=0,l[46]=0,l[47]=1,l[48]=0,l[49]=0,l[50]=1,l[51]=0,l[52]=0,l[53]=1,l[54]=0,l[55]=0,l[56]=1,l[57]=0,l[58]=0,l[59]=1,l[60]=0,l[61]=0,l[62]=1,l[63]=0,l[64]=0,l[65]=1,l[66]=0,l[67]=0,l[68]=1,l[69]=0,l[70]=0,l[71]=1,o.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:l})}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]=4+2,r[7]=4+1,r[8]=4+0,r[9]=4+3,r[10]=4+2,r[11]=4+0,r[12]=8+0,r[13]=8+1,r[14]=8+2,r[15]=8+0,r[16]=8+2,r[17]=8+3,r[18]=12+2,r[19]=12+1,r[20]=12+0,r[21]=12+3,r[22]=12+2,r[23]=12+0,r[24]=16+2,r[25]=16+1,r[26]=16+0,r[27]=16+3,r[28]=16+2,r[29]=16+0,r[30]=20+0,r[31]=20+1,r[32]=20+2,r[33]=20+0,r[34]=20+2,r[35]=20+3}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:q.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=h.subtract(n,t,UDe),c=h.magnitude(a)*.5;if(u(e._offsetAttribute)){let l=s.length,f=e._offsetAttribute===nn.NONE?0:1,d=new Uint8Array(l/3).fill(f);o.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}return new ct({attributes:o,indices:r,primitiveType:Me.TRIANGLES,boundingSphere:new se(h.ZERO,c),offsetAttribute:e._offsetAttribute})};var s8;zl.getUnitBox=function(){return u(s8)||(s8=zl.createGeometry(zl.fromDimensions({dimensions:new h(1,1,1),vertexFormat:Ie.POSITION_ONLY}))),s8};var ol=zl;var kDe=new h;function Th(e){e=y(e,y.EMPTY_OBJECT);let t=e.minimum,n=e.maximum;this._min=h.clone(t),this._max=h.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}Th.fromDimensions=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.dimensions,n=h.multiplyByScalar(t,.5,new h);return new Th({minimum:h.negate(n,new h),maximum:n,offsetAttribute:e.offsetAttribute})};Th.fromAxisAlignedBoundingBox=function(e){return new Th({minimum:e.minimum,maximum:e.maximum})};Th.packedLength=2*h.packedLength+1;Th.pack=function(e,t,n){return n=y(n,0),h.pack(e._min,t,n),h.pack(e._max,t,n+h.packedLength),t[n+h.packedLength*2]=y(e._offsetAttribute,-1),t};var wQ=new h,IQ=new h,vQ={minimum:wQ,maximum:IQ,offsetAttribute:void 0};Th.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,wQ),o=h.unpack(e,t+h.packedLength,IQ),r=e[t+h.packedLength*2];return u(n)?(n._min=h.clone(i,n._min),n._max=h.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(vQ.offsetAttribute=r===-1?void 0:r,new Th(vQ))};Th.createGeometry=function(e){let t=e._min,n=e._max;if(h.equals(t,n))return;let i=new dn,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:q.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=h.subtract(n,t,kDe),a=h.magnitude(s)*.5;if(u(e._offsetAttribute)){let c=r.length,l=e._offsetAttribute===nn.NONE?0:1,f=new Uint8Array(c/3).fill(l);i.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new ct({attributes:i,indices:o,primitiveType:Me.LINES,boundingSphere:new se(h.ZERO,a),offsetAttribute:e._offsetAttribute})};var Xf=Th;function tT(e,t,n,i){e=y(e,1),t=y(t,1),n=y(n,1),i=y(i,1),this.value=new Uint8Array([z.floatToByte(e),z.floatToByte(t),z.floatToByte(n),z.floatToByte(i)])}Object.defineProperties(tT.prototype,{componentDatatype:{get:function(){return q.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});tT.fromColor=function(e){return new tT(e.red,e.green,e.blue,e.alpha)};tT.toValue=function(e,t){return u(t)?e.toBytes(t):new Uint8Array(e.toBytes())};tT.equals=function(e,t){return e===t||u(e)&&u(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 Nt=tT;function Jw(e,t){e=y(e,0),t=y(t,Number.MAX_VALUE),this.value=new Float32Array([e,t])}Object.defineProperties(Jw.prototype,{componentDatatype:{get:function(){return q.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});Jw.fromDistanceDisplayCondition=function(e){return new Jw(e.near,e.far)};Jw.toValue=function(e,t){return u(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])};var Vn=Jw;function zDe(e){e=y(e,y.EMPTY_OBJECT),this.geometry=e.geometry,this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=y(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}var At=zDe;function Go(e){e=y(e,y.EMPTY_OBJECT),this.start=u(e.start)?$.clone(e.start):new $,this.stop=u(e.stop)?$.clone(e.stop):new $,this.data=e.data,this.isStartIncluded=y(e.isStartIncluded,!0),this.isStopIncluded=y(e.isStopIncluded,!0)}Object.defineProperties(Go.prototype,{isEmpty:{get:function(){let e=$.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});var nT={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};Go.fromIso8601=function(e,t){let n=e.iso8601.split("/");if(n.length!==2)throw new de("options.iso8601 is an invalid ISO 8601 interval.");let i=$.fromIso8601(n[0]),o=$.fromIso8601(n[1]),r=y(e.isStartIncluded,!0),s=y(e.isStopIncluded,!0),a=e.data;return u(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(nT.start=i,nT.stop=o,nT.isStartIncluded=r,nT.isStopIncluded=s,nT.data=a,new Go(nT))};Go.toIso8601=function(e,t){return`${$.toIso8601(e.start,t)}/${$.toIso8601(e.stop,t)}`};Go.clone=function(e,t){if(u(e))return u(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new Go(e)};Go.equals=function(e,t,n){return e===t||u(e)&&u(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&$.equals(e.start,t.start)&&$.equals(e.stop,t.stop)&&(e.data===t.data||u(n)&&n(e.data,t.data)))};Go.equalsEpsilon=function(e,t,n,i){return n=y(n,0),e===t||u(e)&&u(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&$.equalsEpsilon(e.start,t.start,n)&&$.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||u(i)&&i(e.data,t.data)))};Go.intersect=function(e,t,n,i){if(!u(t))return Go.clone(Go.EMPTY,n);let o=e.start,r=e.stop,s=t.start,a=t.stop,c=$.greaterThanOrEquals(s,o)&&$.greaterThanOrEquals(r,s),l=!c&&$.lessThanOrEquals(s,o)&&$.lessThanOrEquals(o,a);if(!c&&!l)return Go.clone(Go.EMPTY,n);let f=e.isStartIncluded,d=e.isStopIncluded,p=t.isStartIncluded,g=t.isStopIncluded,m=$.lessThan(r,a);return u(n)||(n=new Go),n.start=c?s:o,n.isStartIncluded=f&&p||!$.equals(s,o)&&(c&&p||l&&f),n.stop=m?r:a,n.isStopIncluded=m?d:d&&g||!$.equals(a,r)&&g,n.data=u(i)?i(e.data,t.data):e.data,n};Go.contains=function(e,t){if(e.isEmpty)return!1;let n=$.compare(e.start,t);if(n===0)return e.isStartIncluded;let i=$.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};Go.prototype.clone=function(e){return Go.clone(this,e)};Go.prototype.equals=function(e,t){return Go.equals(this,e,t)};Go.prototype.equalsEpsilon=function(e,t,n){return Go.equalsEpsilon(this,e,t,n)};Go.prototype.toString=function(){return Go.toIso8601(this)};Go.EMPTY=Object.freeze(new Go({start:new $,stop:new $,isStartIncluded:!1,isStopIncluded:!1}));var An=Go;var PQ=Object.freeze($.fromIso8601("0000-01-01T00:00:00Z")),OQ=Object.freeze($.fromIso8601("9999-12-31T24:00:00Z")),HDe=Object.freeze(new An({start:PQ,stop:OQ})),GDe={MINIMUM_VALUE:PQ,MAXIMUM_VALUE:OQ,MAXIMUM_INTERVAL:HDe},ze=GDe;function Qw(e,t,n){e=y(e,0),t=y(t,0),n=y(n,0),this.value=new Float32Array([e,t,n])}Object.defineProperties(Qw.prototype,{componentDatatype:{get:function(){return q.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});Qw.fromCartesian3=function(e){return new Qw(e.x,e.y,e.z)};Qw.toValue=function(e,t){return u(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};var Wi=Qw;function j3(e){e=y(e,!0),this.value=j3.toValue(e)}Object.defineProperties(j3.prototype,{componentDatatype:{get:function(){return q.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});j3.toValue=function(e,t){return u(t)?(t[0]=e,t):new Uint8Array([e])};var _n=j3;var $w=`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 eI=`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;      // position in eye coordinates
    v_normalEC = czm_normal * normal;                         // normal in eye coordinates
    v_tangentEC = czm_normal * tangent;                       // tangent in eye coordinates
    v_bitangentEC = czm_normal * bitangent;                   // bitangent in eye coordinates
    v_st = st;

    gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var tI=`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 nI=`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;      // position in eye coordinates
    v_normalEC = czm_normal * normal;                         // normal in eye coordinates

    gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var iI=`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 oI=`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;      // position in eye coordinates
    v_normalEC = czm_normal * normal;                         // normal in eye coordinates
    v_st = st;

    gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var WDe={ADD:ee.FUNC_ADD,SUBTRACT:ee.FUNC_SUBTRACT,REVERSE_SUBTRACT:ee.FUNC_REVERSE_SUBTRACT,MIN:ee.MIN,MAX:ee.MAX},aa=Object.freeze(WDe);var jDe={ZERO:ee.ZERO,ONE:ee.ONE,SOURCE_COLOR:ee.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:ee.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:ee.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:ee.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:ee.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:ee.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:ee.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:ee.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:ee.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:ee.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:ee.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:ee.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:ee.SRC_ALPHA_SATURATE},xo=Object.freeze(jDe);var YDe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.SOURCE_ALPHA,functionSourceAlpha:xo.ONE,functionDestinationRgb:xo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:xo.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.ONE,functionSourceAlpha:xo.ONE,functionDestinationRgb:xo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:xo.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.SOURCE_ALPHA,functionSourceAlpha:xo.ONE,functionDestinationRgb:xo.ONE,functionDestinationAlpha:xo.ONE})},un=Object.freeze(YDe);var qDe={FRONT:ee.FRONT,BACK:ee.BACK,FRONT_AND_BACK:ee.FRONT_AND_BACK},gi=Object.freeze(qDe);function iT(e){e=y(e,y.EMPTY_OBJECT),this.material=e.material,this.translucent=y(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=y(e.closed,!1)}Object.defineProperties(iT.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}}});iT.prototype.getFragmentShaderSource=function(){let e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),u(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
`)};iT.prototype.isTranslucent=function(){return u(this.material)&&this.material.isTranslucent()||!u(this.material)&&this.translucent};iT.prototype.getRenderState=function(){let e=this.isTranslucent(),t=Ge(this.renderState,!1);return e?(t.depthMask=!1,t.blending=un.ALPHA_BLEND):t.depthMask=!0,t};iT.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=un.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:gi.BACK}),u(n)&&(i=_t(n,i,!0)),i};var $i=iT;var rI=`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 sI=`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 aI=`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;

    // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
    float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);  // 0.0 or 1.0

    // Find the distance from the closest separator (region between two colors)
    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 cI=`uniform vec4 lightColor;
uniform vec4 darkColor;
uniform vec2 repeat;

czm_material czm_getMaterial(czm_materialInput materialInput)
{
    czm_material material = czm_getDefaultMaterial(materialInput);

    // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
    float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));  // 0.0 or 1.0

    vec4 color = mix(lightColor, darkColor, b);
    color = czm_gammaCorrect(color);
    material.diffuse = color.rgb;
    material.alpha = color.a;

    return material;
}
`;var lI=`uniform sampler2D heights;
uniform sampler2D colors;

// This material expects heights to be sorted from lowest to highest.

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);

    // early-out when outside the height range
    if (height < minHeight || height > maxHeight) {
        material.diffuse = vec3(0.0);
        material.alpha = 0.0;
        return material;
    }

    // Binary search to find heights above and below.
    int idxBelow = 0;
    int idxAbove = heightsDimensions.x;
    float heightBelow = minHeight;
    float heightAbove = maxHeight;

    // while loop not allowed, so use for loop with max iterations.
    // maxIterations of 16 supports a texture size up to 65536 (2^16).
    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);

    // undo preumultiplied alpha
    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 uI=`#ifdef GL_OES_standard_derivatives
    #extension GL_OES_standard_derivatives : enable
#endif

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
    // If no derivatives available (IE 10?), use pixel ratio
    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 fI=`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 dI=`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 hI=`#ifdef GL_OES_standard_derivatives
    #extension GL_OES_standard_derivatives : enable
#endif

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;

    // Fuzz Factor - Controls blurriness of lines
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
    const float fuzz = 1.2;
    vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;

    // From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13.
    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
    // If no derivatives available (IE 10?), revert to view-dependent fuzz
    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

    // Edges taken from RimLightingMaterial.glsl
    // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
    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 mI=`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 pI=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

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
     // If no derivatives available (IE 10?), 2.5% of the line will be the arrow head
    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);

    // Find the distance from the closest separator (region between two colors)
    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;

    // Get the relative position within the dash from 0 to 1
    float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));
    // Figure out the mask index.
    float maskIndex = floor(dashPosition * maskLength);
    // Test the bit mask.
    float maskTest = floor(dashPattern / pow(2.0, maskIndex));
    vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;
    if (fragColor.a < 0.005) {   // matches 0/255 and 1/255
        discard;
    }

    fragColor = czm_gammaCorrect(fragColor);
    material.emission = fragColor.rgb;
    material.alpha = fragColor.a;
    return material;
}
`;var gI=`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 yI=`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);

    // Find the distance from the closest separator (region between two colors)
    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 AI=`uniform vec4 color;
uniform vec4 rimColor;
uniform float width;

czm_material czm_getMaterial(czm_materialInput materialInput)
{
    czm_material material = czm_getDefaultMaterial(materialInput);

    // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
    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 xI=`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 CI=`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);

    // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)
    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 TI=`// Thanks for the contribution Jonas
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog

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;

    // fade is a function of the distance from the fragment and the frequency of the waves
    float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);

    float specularMapValue = texture(specularMap, materialInput.st).r;

    // note: not using directional motion at this time, just set the angle to 0.0;
    vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);
    vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));

    // fade out the normal perturbation as we move further from the water surface
    normalTangentSpace.xy /= fade;

    // attempt to fade out the normal perturbation as we approach non water areas (low specular map value)
    normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);

    normalTangentSpace = normalize(normalTangentSpace);

    // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane
    float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);

    // fade out water effect as specular map value decreases
    material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;

    // base color is a blend of the water and non-water color based on the value from the specular map
    // may need a uniform blend factor to better control this
    material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);

    // diffuse highlights are based on how perturbed the normal is
    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 je(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=y(e.minificationFilter,an.LINEAR),this._magnificationFilter=y(e.magnificationFilter,yi.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,XDe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),u(je._uniformList[this.type])||(je._uniformList[this.type]=Object.keys(this._uniforms))}je._uniformList={};je.fromType=function(e,t){let n=new je({fabric:{type:e}});if(u(t))for(let i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};je.prototype.isTranslucent=function(){if(u(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};je.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n,i=this._loadedImages,o=i.length;for(t=0;t<o;++t){let c=i[t];n=c.id;let l=c.image,f;Array.isArray(l)&&(f=l.slice(1,l.length).map(function(A){return A.bufferView}),l=l[0]);let d=new ln({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter}),p;u(l.internalFormat)?p=new It({context:e,pixelFormat:l.internalFormat,width:l.width,height:l.height,source:{arrayBufferView:l.bufferView,mipLevels:f},sampler:d}):p=new It({context:e,source:l,sampler:d});let g=this._textures[n];u(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=p;let m=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(m)){let A=this.uniforms[m];A.x=p._width,A.y=p._height}}i.length=0;let r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){let c=r[t];n=c.id;let l=c.images,f=new Ma({context:e,source:{positiveX:l[0],negativeX:l[1],positiveY:l[2],negativeY:l[3],positiveZ:l[4],negativeZ:l[5]},sampler:new ln({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 c in a)a.hasOwnProperty(c)&&a[c].update(e)};je.prototype.isDestroyed=function(){return!1};je.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 le(this)};function XDe(e,t){e=y(e,y.EMPTY_OBJECT),t._strict=y(e.strict,!1),t._count=y(e.count,0),t._template=Ge(y(e.fabric,y.EMPTY_OBJECT)),t._template.uniforms=Ge(y(t._template.uniforms,y.EMPTY_OBJECT)),t._template.materials=Ge(y(t._template.materials,y.EMPTY_OBJECT)),t.type=u(t._template.type)?t._template.type:zn(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n,i=je._materialCache.getMaterial(t.type);if(u(i)){let r=Ge(i.fabric,!0);t._template=_t(t._template,r,!0),n=i.translucent}QDe(t),u(i)||je._materialCache.addMaterial(t.type,t),eve(t),ove(t),sve(t);let o=t._translucentFunctions.length===0?!0:void 0;if(n=y(n,o),n=y(e.translucent,n),u(n))if(typeof n=="function"){let r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function a8(e,t,n,i){if(u(e)){for(let o in e)if(e.hasOwnProperty(o)){let r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function RQ(e,t){}function KDe(e,t){}var ZDe=["type","materials","uniforms","components","source"],JDe=["diffuse","specular","shininess","normal","emission","alpha"];function QDe(e){let t=e._template,n=t.uniforms,i=t.materials,o=t.components;a8(t,ZDe,RQ,!0),a8(o,JDe,RQ,!0);let r=[];for(let s in i)i.hasOwnProperty(s)&&r.push(s);a8(n,r,KDe,!1)}function $De(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 eve(e){let t=e._template.components,n=e._template.source;if(u(n))e.shaderSource+=`${n}
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
{
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
`,u(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&&$De(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 BQ={mat2:Ji,mat3:Z,mat4:M},tve=/\.ktx2$/i;function nve(e){let t;return function(n,i){let o=n.uniforms,r=o[e],s=t!==r,a=!u(r)||r===je.DefaultImageId;t=r;let c=n._textures[e],l,f;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&u(c)&&(c!==i.defaultTexture&&c.destroy(),c=void 0),!u(c)||c===i.defaultTexture){let p=new ln({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});c=new It({context:i,source:r,sampler:p}),n._textures[e]=c;return}c.copyFrom({source:r})}else u(c)||(n._textures[e]=i.defaultTexture);return}if(r instanceof It&&r!==c){n._texturePaths[e]=void 0;let p=n._textures[e];u(p)&&p!==n._defaultTexture&&p.destroy(),n._textures[e]=r,l=`${e}Dimensions`,o.hasOwnProperty(l)&&(f=o[l],f.x=r._width,f.y=r._height);return}if(s&&u(c)&&a&&(c!==n._defaultTexture&&c.destroy(),c=void 0),u(c)||(n._texturePaths[e]=void 0,c=n._textures[e]=n._defaultTexture,l=`${e}Dimensions`,o.hasOwnProperty(l)&&(f=o[l],f.x=c._width,f.y=c._height)),a)return;let d=r instanceof Oe;if(!u(n._texturePaths[e])||d&&r.url!==n._texturePaths[e].url||!d&&r!==n._texturePaths[e]){if(typeof r=="string"||d){let p=d?r:Oe.createIfNeeded(r),g;tve.test(p.url)?g=tl(p.url):g=p.fetchImage(),Promise.resolve(g).then(function(m){n._loadedImages.push({id:e,image:m})}).catch(function(){u(c)&&c!==n._defaultTexture&&c.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 ive(e){return function(t,n){let i=t.uniforms[e];if(i instanceof Ma){let r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(u(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===je.DefaultCubeMapId)return;let o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){let r=[Oe.createIfNeeded(i.positiveX).fetchImage(),Oe.createIfNeeded(i.negativeX).fetchImage(),Oe.createIfNeeded(i.positiveY).fetchImage(),Oe.createIfNeeded(i.negativeY).fetchImage(),Oe.createIfNeeded(i.positiveZ).fetchImage(),Oe.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function ove(e){let t=e._template.uniforms;for(let n in t)t.hasOwnProperty(n)&&MQ(e,n)}function MQ(e,t){let n=e._strict,i=e._template.uniforms,o=i[t],r=rve(o),s;if(r==="channels")s=EI(e,t,o,!1);else{if(r==="sampler2D"){let l=`${t}Dimensions`;ave(e,l)>0&&(i[l]={type:"ivec3",x:1,y:1},MQ(e,l))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){let l=`uniform ${r} ${t};`;e.shaderSource=l+e.shaderSource}let c=`${t}_${e._count++}`;if(s=EI(e,t,c),e.uniforms[t]=o,r==="sampler2D")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(nve(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(ive(t));else if(r.indexOf("mat")!==-1){let l=new BQ[r];e._uniforms[c]=function(){return BQ[r].fromColumnMajorArray(e.uniforms[t],l)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function rve(e){let t=e.type;if(!u(t)){let n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Oe||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===je.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 sve(e){let t=e._strict,n=e._template.materials;for(let i in n)if(n.hasOwnProperty(i)){let o=new je({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=_t(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);let r="czm_getMaterial",s=`${r}_${e._count++}`;EI(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;let a=`${s}(materialInput)`,c=EI(e,i,a)}}function EI(e,t,n,i){i=y(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(c,l,f){return l||f?c:(o+=1,n)}),o}function ave(e,t,n){return EI(e,t,t,n)}je._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};je.DefaultImageId="czm_defaultImage";je.DefaultCubeMapId="czm_defaultCubeMap";je.ColorType="Color";je._materialCache.addMaterial(je.ColorType,{fabric:{type:je.ColorType,uniforms:{color:new z(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});je.ImageType="Image";je._materialCache.addMaterial(je.ImageType,{fabric:{type:je.ImageType,uniforms:{image:je.DefaultImageId,repeat:new H(1,1),color:new z(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}});je.DiffuseMapType="DiffuseMap";je._materialCache.addMaterial(je.DiffuseMapType,{fabric:{type:je.DiffuseMapType,uniforms:{image:je.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});je.AlphaMapType="AlphaMap";je._materialCache.addMaterial(je.AlphaMapType,{fabric:{type:je.AlphaMapType,uniforms:{image:je.DefaultImageId,channel:"a",repeat:new H(1,1)},components:{alpha:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});je.SpecularMapType="SpecularMap";je._materialCache.addMaterial(je.SpecularMapType,{fabric:{type:je.SpecularMapType,uniforms:{image:je.DefaultImageId,channel:"r",repeat:new H(1,1)},components:{specular:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});je.EmissionMapType="EmissionMap";je._materialCache.addMaterial(je.EmissionMapType,{fabric:{type:je.EmissionMapType,uniforms:{image:je.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{emission:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});je.BumpMapType="BumpMap";je._materialCache.addMaterial(je.BumpMapType,{fabric:{type:je.BumpMapType,uniforms:{image:je.DefaultImageId,channel:"r",strength:.8,repeat:new H(1,1)},source:sI},translucent:!1});je.NormalMapType="NormalMap";je._materialCache.addMaterial(je.NormalMapType,{fabric:{type:je.NormalMapType,uniforms:{image:je.DefaultImageId,channels:"rgb",strength:.8,repeat:new H(1,1)},source:mI},translucent:!1});je.GridType="Grid";je._materialCache.addMaterial(je.GridType,{fabric:{type:je.GridType,uniforms:{color:new z(0,1,0,1),cellAlpha:.1,lineCount:new H(8,8),lineThickness:new H(1,1),lineOffset:new H(0,0)},source:hI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});je.StripeType="Stripe";je._materialCache.addMaterial(je.StripeType,{fabric:{type:je.StripeType,uniforms:{horizontal:!0,evenColor:new z(1,1,1,.5),oddColor:new z(0,0,1,.5),offset:0,repeat:5},source:CI},translucent:function(e){let t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});je.CheckerboardType="Checkerboard";je._materialCache.addMaterial(je.CheckerboardType,{fabric:{type:je.CheckerboardType,uniforms:{lightColor:new z(1,1,1,.5),darkColor:new z(0,0,0,.5),repeat:new H(5,5)},source:aI},translucent:function(e){let t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});je.DotType="Dot";je._materialCache.addMaterial(je.DotType,{fabric:{type:je.DotType,uniforms:{lightColor:new z(1,1,0,.75),darkColor:new z(0,1,1,.75),repeat:new H(5,5)},source:cI},translucent:function(e){let t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});je.WaterType="Water";je._materialCache.addMaterial(je.WaterType,{fabric:{type:je.WaterType,uniforms:{baseWaterColor:new z(.2,.3,.6,1),blendColor:new z(0,1,.699,1),specularMap:je.DefaultImageId,normalMap:je.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:TI},translucent:function(e){let t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});je.RimLightingType="RimLighting";je._materialCache.addMaterial(je.RimLightingType,{fabric:{type:je.RimLightingType,uniforms:{color:new z(1,0,0,.7),rimColor:new z(1,1,1,.4),width:.3},source:AI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});je.FadeType="Fade";je._materialCache.addMaterial(je.FadeType,{fabric:{type:je.FadeType,uniforms:{fadeInColor:new z(1,0,0,1),fadeOutColor:new z(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new H(.5,.5)},source:dI},translucent:function(e){let t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});je.PolylineArrowType="PolylineArrow";je._materialCache.addMaterial(je.PolylineArrowType,{fabric:{type:je.PolylineArrowType,uniforms:{color:new z(1,1,1,1)},source:pI},translucent:!0});je.PolylineDashType="PolylineDash";je._materialCache.addMaterial(je.PolylineDashType,{fabric:{type:je.PolylineDashType,uniforms:{color:new z(1,0,1,1),gapColor:new z(0,0,0,0),dashLength:16,dashPattern:255},source:_I},translucent:!0});je.PolylineGlowType="PolylineGlow";je._materialCache.addMaterial(je.PolylineGlowType,{fabric:{type:je.PolylineGlowType,uniforms:{color:new z(0,.5,1,1),glowPower:.25,taperPower:1},source:gI},translucent:!0});je.PolylineOutlineType="PolylineOutline";je._materialCache.addMaterial(je.PolylineOutlineType,{fabric:{type:je.PolylineOutlineType,uniforms:{color:new z(1,1,1,1),outlineColor:new z(1,0,0,1),outlineWidth:1},source:yI},translucent:function(e){let t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});je.ElevationContourType="ElevationContour";je._materialCache.addMaterial(je.ElevationContourType,{fabric:{type:je.ElevationContourType,uniforms:{spacing:100,color:new z(1,0,0,1),width:1},source:uI},translucent:!1});je.ElevationRampType="ElevationRamp";je._materialCache.addMaterial(je.ElevationRampType,{fabric:{type:je.ElevationRampType,uniforms:{image:je.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:fI},translucent:!1});je.SlopeRampMaterialType="SlopeRamp";je._materialCache.addMaterial(je.SlopeRampMaterialType,{fabric:{type:je.SlopeRampMaterialType,uniforms:{image:je.DefaultImageId},source:xI},translucent:!1});je.AspectRampMaterialType="AspectRamp";je._materialCache.addMaterial(je.AspectRampMaterialType,{fabric:{type:je.AspectRampMaterialType,uniforms:{image:je.DefaultImageId},source:rI},translucent:!1});je.ElevationBandType="ElevationBand";je._materialCache.addMaterial(je.ElevationBandType,{fabric:{type:je.ElevationBandType,uniforms:{heights:je.DefaultImageId,colors:je.DefaultImageId},source:lI},translucent:!0});var Vi=je;function v0(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.materialSupport,v0.MaterialSupport.TEXTURED);this.material=u(e.material)?e.material:Vi.fromType(Vi.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=y(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=$i.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=y(e.flat,!1),this._faceForward=y(e.faceForward,!n)}Object.defineProperties(v0.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}}});v0.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;v0.prototype.isTranslucent=$i.prototype.isTranslucent;v0.prototype.getRenderState=$i.prototype.getRenderState;v0.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ie.POSITION_AND_NORMAL,vertexShaderSource:nI,fragmentShaderSource:tI}),TEXTURED:Object.freeze({vertexFormat:Ie.POSITION_NORMAL_AND_ST,vertexShaderSource:oI,fragmentShaderSource:iI}),ALL:Object.freeze({vertexFormat:Ie.ALL,vertexShaderSource:eI,fragmentShaderSource:$w})};var oo=v0;var bI=`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 SI=`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;      // position in eye coordinates
    v_normalEC = czm_normal * normal;                         // normal in eye coordinates
    v_color = color;

    gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;var w0=`in vec4 v_color;

void main()
{
    out_FragColor = czm_gammaCorrect(v_color);
}
`;var DI=`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 jm(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.flat,!1),o=i?DI:SI,r=i?w0:bI,s=i?jm.FLAT_VERTEX_FORMAT:jm.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,o),this._fragmentShaderSource=y(e.fragmentShaderSource,r),this._renderState=$i.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=y(e.faceForward,!n)}Object.defineProperties(jm.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}}});jm.VERTEX_FORMAT=Ie.POSITION_AND_NORMAL;jm.FLAT_VERTEX_FORMAT=Ie.POSITION_ONLY;jm.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;jm.prototype.isTranslucent=$i.prototype.isTranslucent;jm.prototype.getRenderState=$i.prototype.getRenderState;var on=jm;function oT(e){this._definitionChanged=new Ae,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(oT.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color")});oT.prototype.getType=function(e){return"Color"};oT.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,z.WHITE,t.color),t};oT.prototype.equals=function(e){return this===e||e instanceof oT&&Y.equals(this._color,e._color)};var Mt=oT;function Q_(e){e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ie.WGS84),this._rectangle=y(e.rectangle,ce.MAX_VALUE),this._projection=new Ei(this._ellipsoid),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Q_.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Q_.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Q_.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Q_.prototype.rectangleToNativeRectangle=function(e,t){let n=P.toDegrees(e.west),i=P.toDegrees(e.south),o=P.toDegrees(e.east),r=P.toDegrees(e.north);return u(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new ce(n,i,o,r)};Q_.prototype.tileXYToNativeRectangle=function(e,t,n,i){let o=this.tileXYToRectangle(e,t,n,i);return o.west=P.toDegrees(o.west),o.south=P.toDegrees(o.south),o.east=P.toDegrees(o.east),o.north=P.toDegrees(o.north),o};Q_.prototype.tileXYToRectangle=function(e,t,n,i){let o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,c=e*a+o.west,l=(e+1)*a+o.west,f=o.height/s,d=o.north-t*f,p=o.north-(t+1)*f;return u(i)||(i=new ce(c,p,l,d)),i.west=c,i.south=p,i.east=l,i.north=d,i};Q_.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,c=e.longitude;i.east<i.west&&(c+=P.TWO_PI);let l=(c-i.west)/s|0;l>=o&&(l=o-1);let f=(i.north-e.latitude)/a|0;return f>=r&&(f=r-1),u(n)?(n.x=l,n.y=f,n):new H(l,f)};var ji=Q_;var LQ=new h,NQ=new h,FQ=new he,c8=new h,cve=new h,VQ=new se,lve=new ji,vI=[new he,new he,new he,new he],wI=new H,Fr={};Fr.initialize=function(){let e=Fr._initPromise;return u(e)||(e=Oe.fetchJson($t("Assets/approximateTerrainHeights.json")).then(function(t){Fr._terrainHeights=t}),Fr._initPromise=e),e};Fr.getMinimumMaximumHeights=function(e,t){t=y(t,ie.WGS84);let n=UQ(e),i=Fr._defaultMinTerrainHeight,o=Fr._defaultMaxTerrainHeight;if(u(n)){let r=`${n.level}-${n.x}-${n.y}`,s=Fr._terrainHeights[r];u(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(ce.northeast(e,FQ),LQ),t.cartographicToCartesian(ce.southwest(e,FQ),NQ),h.midpoint(NQ,LQ,c8);let a=t.scaleToGeodeticSurface(c8,cve);if(u(a)){let c=h.distance(c8,a);i=Math.min(i,-c)}else i=Fr._defaultMinTerrainHeight}return i=Math.max(Fr._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};Fr.getBoundingSphere=function(e,t){t=y(t,ie.WGS84);let n=UQ(e),i=Fr._defaultMaxTerrainHeight;if(u(n)){let r=`${n.level}-${n.x}-${n.y}`,s=Fr._terrainHeights[r];u(s)&&(i=s[1])}let o=se.fromRectangle3D(e,t,0);return se.fromRectangle3D(e,t,i,VQ),se.union(o,VQ,o)};function UQ(e){he.fromRadians(e.east,e.north,0,vI[0]),he.fromRadians(e.west,e.north,0,vI[1]),he.fromRadians(e.east,e.south,0,vI[2]),he.fromRadians(e.west,e.south,0,vI[3]);let t=0,n=0,i=0,o=0,r=Fr._terrainHeightsMaxLevel,s;for(s=0;s<=r;++s){let a=!1;for(let c=0;c<4;++c){let l=vI[c];if(lve.positionToTileXY(l,s,wI),c===0)i=wI.x,o=wI.y;else if(i!==wI.x||o!==wI.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}}Fr._terrainHeightsMaxLevel=6;Fr._defaultMaxTerrainHeight=9e3;Fr._defaultMinTerrainHeight=-1e5;Fr._terrainHeights=void 0;Fr._initPromise=void 0;Object.defineProperties(Fr,{initialized:{get:function(){return u(Fr._terrainHeights)}}});var fi=Fr;function Ac(e,t,n){this.minimum=h.clone(y(e,h.ZERO)),this.maximum=h.clone(y(t,h.ZERO)),u(n)?n=h.clone(n):n=h.midpoint(this.minimum,this.maximum,new h),this.center=n}Ac.fromCorners=function(e,t,n){return u(n)||(n=new Ac),n.minimum=h.clone(e,n.minimum),n.maximum=h.clone(t,n.maximum),n.center=h.midpoint(e,t,n.center),n};Ac.fromPoints=function(e,t){if(u(t)||(t=new Ac),!u(e)||e.length===0)return t.minimum=h.clone(h.ZERO,t.minimum),t.maximum=h.clone(h.ZERO,t.maximum),t.center=h.clone(h.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,c=e.length;for(let d=1;d<c;d++){let p=e[d],g=p.x,m=p.y,A=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(A,o),a=Math.max(A,a)}let l=t.minimum;l.x=n,l.y=i,l.z=o;let f=t.maximum;return f.x=r,f.y=s,f.z=a,t.center=h.midpoint(l,f,t.center),t};Ac.clone=function(e,t){if(u(e))return u(t)?(t.minimum=h.clone(e.minimum,t.minimum),t.maximum=h.clone(e.maximum,t.maximum),t.center=h.clone(e.center,t.center),t):new Ac(e.minimum,e.maximum,e.center)};Ac.equals=function(e,t){return e===t||u(e)&&u(t)&&h.equals(e.center,t.center)&&h.equals(e.minimum,t.minimum)&&h.equals(e.maximum,t.maximum)};var Y3=new h;Ac.intersectPlane=function(e,t){Y3=h.subtract(e.maximum,e.minimum,Y3);let n=h.multiplyByScalar(Y3,.5,Y3),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=h.dot(e.center,i)+t.distance;return r-o>0?Qt.INSIDE:r+o<0?Qt.OUTSIDE:Qt.INTERSECTING};Ac.prototype.clone=function(e){return Ac.clone(this,e)};Ac.prototype.intersectPlane=function(e){return Ac.intersectPlane(this,e)};Ac.prototype.equals=function(e){return Ac.equals(this,e)};var $_=Ac;var l8={};l8.computeDiscriminant=function(e,t,n){return t*t-4*e*n};function kQ(e,t,n){let i=e+t;return P.sign(e)!==P.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}l8.computeRealRoots=function(e,t,n){let i;if(e===0)return t===0?[]:[-n/t];if(t===0){if(n===0)return[0,0];let c=Math.abs(n),l=Math.abs(e);if(c<l&&c/l<P.EPSILON14)return[0,0];if(c>l&&l/c<P.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=kQ(o,-r,P.EPSILON14);if(s<0)return[];let a=-.5*kQ(t,P.sign(t)*Math.sqrt(s),P.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};var xc=l8;var f8={};f8.computeDiscriminant=function(e,t,n,i){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 u8(e,t,n,i){let o=e,r=t/3,s=n/3,a=i,c=o*s,l=r*a,f=r*r,d=s*s,p=o*s-f,g=o*a-r*s,m=r*a-d,A=4*p*m-g*g,x,C;if(A<0){let X,j,Q;f*l>=c*d?(X=o,j=p,Q=-2*r*p+o*g):(X=a,j=m,Q=-a*g+2*s*m);let K=-(Q<0?-1:1)*Math.abs(X)*Math.sqrt(-A);C=-Q+K;let J=C/2,_e=J<0?-Math.pow(-J,1/3):Math.pow(J,1/3),xe=C===K?-_e:-j/_e;return x=j<=0?_e+xe:-Q/(_e*_e+xe*xe+j),f*l>=c*d?[(x-r)/o]:[-a/(x+s)]}let T=p,E=-2*r*p+o*g,S=m,D=-a*g+2*s*m,w=Math.sqrt(A),R=Math.sqrt(3)/2,O=Math.abs(Math.atan2(o*w,-E)/3);x=2*Math.sqrt(-T);let L=Math.cos(O);C=x*L;let N=x*(-L/2-R*Math.sin(O)),_=C+N>2*r?C-r:N-r,b=o,v=_/b;O=Math.abs(Math.atan2(a*w,-D)/3),x=2*Math.sqrt(-S),L=Math.cos(O),C=x*L,N=x*(-L/2-R*Math.sin(O));let I=-a,B=C+N<2*s?C+s:N+s,F=I/B,k=b*B,U=-_*B-b*I,G=_*I,V=(s*U-r*G)/(-r*U+s*k);return v<=V?v<=F?V<=F?[v,V,F]:[v,F,V]:[F,v,V]:v<=F?[V,v,F]:V<=F?[V,F,v]:[F,V,v]}f8.computeRealRoots=function(e,t,n,i){let o,r;if(e===0)return xc.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=xc.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return u8(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):u8(e,t,0,i);if(i===0)return o=xc.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 u8(e,t,n,i)};var I0=f8;var d8={};d8.computeDiscriminant=function(e,t,n,i,o){let r=e*e,s=r*e,a=t*t,c=a*t,l=n*n,f=l*n,d=i*i,p=d*i,g=o*o,m=g*o;return a*l*d-4*c*p-4*e*f*d+18*e*t*n*p-27*r*d*d+256*s*m+o*(18*c*n*i-4*a*f+16*e*l*l-80*e*t*l*i-6*e*a*d+144*r*n*d)+g*(144*e*a*n-27*a*a-128*r*l-192*r*t*i)};function Kf(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,c=I0.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(c.length>0){let l=-e/4,f=c[c.length-1];if(Math.abs(f)<P.EPSILON14){let d=xc.computeRealRoots(1,r,a);if(d.length===2){let p=d[0],g=d[1],m;if(p>=0&&g>=0){let A=Math.sqrt(p),x=Math.sqrt(g);return[l-x,l-A,l+A,l+x]}else{if(p>=0&&g<0)return m=Math.sqrt(p),[l-m,l+m];if(p<0&&g>=0)return m=Math.sqrt(g),[l-m,l+m]}}return[]}else if(f>0){let d=Math.sqrt(f),p=(r+f-s/d)/2,g=(r+f+s/d)/2,m=xc.computeRealRoots(1,d,p),A=xc.computeRealRoots(1,-d,g);return m.length!==0?(m[0]+=l,m[1]+=l,A.length!==0?(A[0]+=l,A[1]+=l,m[1]<=A[0]?[m[0],m[1],A[0],A[1]]:A[1]<=m[0]?[A[0],A[1],m[0],m[1]]:m[0]>=A[0]&&m[1]<=A[1]?[A[0],m[0],m[1],A[1]]:A[0]>=m[0]&&A[1]<=m[1]?[m[0],A[0],A[1],m[1]]:m[0]>A[0]&&m[0]<A[1]?[A[0],m[0],A[1],m[1]]:[m[0],A[0],m[1],A[1]]):m):A.length!==0?(A[0]+=l,A[1]+=l,A):[]}}return[]}function II(e,t,n,i){let o=n*n,r=t*t,s=e*e,a=-2*t,c=n*e+r-4*i,l=s*i-n*t*e+o,f=I0.computeRealRoots(1,a,c,l);if(f.length>0){let d=f[0],p=t-d,g=p*p,m=e/2,A=p/2,x=g-4*i,C=g+4*Math.abs(i),T=s-4*d,E=s+4*Math.abs(d),S,D;if(d<0||x*E<T*C){let b=Math.sqrt(T);S=b/2,D=b===0?0:(e*A-n)/b}else{let b=Math.sqrt(x);S=b===0?0:(e*A-n)/b,D=b/2}let w,R;m===0&&S===0?(w=0,R=0):P.sign(m)===P.sign(S)?(w=m+S,R=d/w):(R=m-S,w=d/R);let O,L;A===0&&D===0?(O=0,L=0):P.sign(A)===P.sign(D)?(O=A+D,L=i/O):(L=A-D,O=i/L);let N=xc.computeRealRoots(1,w,O),_=xc.computeRealRoots(1,R,L);if(N.length!==0)return _.length!==0?N[1]<=_[0]?[N[0],N[1],_[0],_[1]]:_[1]<=N[0]?[_[0],_[1],N[0],N[1]]:N[0]>=_[0]&&N[1]<=_[1]?[_[0],N[0],N[1],_[1]]:_[0]>=N[0]&&_[1]<=N[1]?[N[0],_[0],_[1],N[1]]:N[0]>_[0]&&N[0]<_[1]?[_[0],N[0],_[1],N[1]]:[N[0],_[0],N[1],_[1]]:N;if(_.length!==0)return _}return[]}d8.computeRealRoots=function(e,t,n,i,o){if(Math.abs(e)<P.EPSILON15)return I0.computeRealRoots(t,n,i,o);let r=t/e,s=n/e,a=i/e,c=o/e,l=r<0?1:0;switch(l+=s<0?l+1:l,l+=a<0?l+1:l,l+=c<0?l+1:l,l){case 0:return Kf(r,s,a,c);case 1:return II(r,s,a,c);case 2:return II(r,s,a,c);case 3:return Kf(r,s,a,c);case 4:return Kf(r,s,a,c);case 5:return II(r,s,a,c);case 6:return Kf(r,s,a,c);case 7:return Kf(r,s,a,c);case 8:return II(r,s,a,c);case 9:return Kf(r,s,a,c);case 10:return Kf(r,s,a,c);case 11:return II(r,s,a,c);case 12:return Kf(r,s,a,c);case 13:return Kf(r,s,a,c);case 14:return Kf(r,s,a,c);case 15:return Kf(r,s,a,c);default:return}};var PI=d8;function q3(e,t){t=h.clone(y(t,h.ZERO)),h.equals(t,h.ZERO)||h.normalize(t,t),this.origin=h.clone(y(e,h.ZERO)),this.direction=t}q3.clone=function(e,t){if(u(e))return u(t)?(t.origin=h.clone(e.origin),t.direction=h.clone(e.direction),t):new q3(e.origin,e.direction)};q3.getPoint=function(e,t,n){return u(n)||(n=new h),n=h.multiplyByScalar(e.direction,t,n),h.add(e.origin,n,n)};var wn=q3;var ir={};ir.rayPlane=function(e,t,n){u(n)||(n=new h);let i=e.origin,o=e.direction,r=t.normal,s=h.dot(r,o);if(Math.abs(s)<P.EPSILON15)return;let a=(-t.distance-h.dot(r,i))/s;if(!(a<0))return n=h.multiplyByScalar(o,a,n),h.add(i,n,n)};var uve=new h,fve=new h,XQ=new h,zQ=new h,HQ=new h;ir.rayTriangleParametric=function(e,t,n,i,o){o=y(o,!1);let r=e.origin,s=e.direction,a=h.subtract(n,t,uve),c=h.subtract(i,t,fve),l=h.cross(s,c,XQ),f=h.dot(a,l),d,p,g,m,A;if(o){if(f<P.EPSILON6||(d=h.subtract(r,t,zQ),g=h.dot(d,l),g<0||g>f)||(p=h.cross(d,a,HQ),m=h.dot(s,p),m<0||g+m>f))return;A=h.dot(c,p)/f}else{if(Math.abs(f)<P.EPSILON6)return;let x=1/f;if(d=h.subtract(r,t,zQ),g=h.dot(d,l)*x,g<0||g>1||(p=h.cross(d,a,HQ),m=h.dot(s,p)*x,m<0||g+m>1))return;A=h.dot(c,p)*x}return A};ir.rayTriangle=function(e,t,n,i,o,r){let s=ir.rayTriangleParametric(e,t,n,i,o);if(!(!u(s)||s<0))return u(r)||(r=new h),h.multiplyByScalar(e.direction,s,r),h.add(e.origin,r,r)};var dve=new wn;ir.lineSegmentTriangle=function(e,t,n,i,o,r,s){let a=dve;h.clone(e,a.origin),h.subtract(t,e,a.direction),h.normalize(a.direction,a.direction);let c=ir.rayTriangleParametric(a,n,i,o,r);if(!(!u(c)||c<0||c>h.distance(e,t)))return u(s)||(s=new h),h.multiplyByScalar(a.direction,c,s),h.add(a.origin,s,s)};function hve(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),c=(-t+a)*s,l=(-t-a)*s;return c<l?(i.root0=c,i.root1=l):(i.root0=l,i.root1=c),i}let r=-t/(2*e);if(r!==0)return i.root0=i.root1=r,i}var mve={root0:0,root1:0};function KQ(e,t,n){u(n)||(n=new yc);let i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=h.subtract(i,r,XQ),c=h.dot(o,o),l=2*h.dot(o,a),f=h.magnitudeSquared(a)-s,d=hve(c,l,f,mve);if(u(d))return n.start=d.root0,n.stop=d.root1,n}ir.raySphere=function(e,t,n){if(n=KQ(e,t,n),!(!u(n)||n.stop<0))return n.start=Math.max(n.start,0),n};var pve=new wn;ir.lineSegmentSphere=function(e,t,n,i){let o=pve;h.clone(e,o.origin);let r=h.subtract(t,e,o.direction),s=h.magnitude(r);if(h.normalize(r,r),i=KQ(o,n,i),!(!u(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};var _ve=new h,gve=new h;ir.rayEllipsoid=function(e,t){let n=t.oneOverRadii,i=h.multiplyComponents(n,e.origin,_ve),o=h.multiplyComponents(n,e.direction,gve),r=h.magnitudeSquared(i),s=h.dot(i,o),a,c,l,f,d;if(r>1){if(s>=0)return;let p=s*s;if(a=r-1,c=h.magnitudeSquared(o),l=c*a,p<l)return;if(p>l){f=s*s-l,d=-s+Math.sqrt(f);let m=d/c,A=a/d;return m<A?new yc(m,A):{start:A,stop:m}}let g=Math.sqrt(a/c);return new yc(g,g)}else if(r<1)return a=r-1,c=h.magnitudeSquared(o),l=c*a,f=s*s-l,d=-s+Math.sqrt(f),new yc(0,d/c);if(s<0)return c=h.magnitudeSquared(o),new yc(0,-s/c)};function P0(e,t,n){let i=e+t;return P.sign(e)!==P.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}function yve(e,t,n,i,o){let r=i*i,s=o*o,a=(e[Z.COLUMN1ROW1]-e[Z.COLUMN2ROW2])*s,c=o*(i*P0(e[Z.COLUMN1ROW0],e[Z.COLUMN0ROW1],P.EPSILON15)+t.y),l=e[Z.COLUMN0ROW0]*r+e[Z.COLUMN2ROW2]*s+i*t.x+n,f=s*P0(e[Z.COLUMN2ROW1],e[Z.COLUMN1ROW2],P.EPSILON15),d=o*(i*P0(e[Z.COLUMN2ROW0],e[Z.COLUMN0ROW2])+t.z),p,g=[];if(d===0&&f===0){if(p=xc.computeRealRoots(a,c,l),p.length===0)return g;let O=p[0],L=Math.sqrt(Math.max(1-O*O,0));if(g.push(new h(i,o*O,o*-L)),g.push(new h(i,o*O,o*L)),p.length===2){let N=p[1],_=Math.sqrt(Math.max(1-N*N,0));g.push(new h(i,o*N,o*-_)),g.push(new h(i,o*N,o*_))}return g}let m=d*d,A=f*f,x=a*a,C=d*f,T=x+A,E=2*(c*a+C),S=2*l*a+c*c-A+m,D=2*(l*c-C),w=l*l-m;if(T===0&&E===0&&S===0&&D===0)return g;p=PI.computeRealRoots(T,E,S,D,w);let R=p.length;if(R===0)return g;for(let O=0;O<R;++O){let L=p[O],N=L*L,_=Math.max(1-N,0),b=Math.sqrt(_),v;P.sign(a)===P.sign(l)?v=P0(a*N+l,c*L,P.EPSILON12):P.sign(l)===P.sign(c*L)?v=P0(a*N,c*L+l,P.EPSILON12):v=P0(a*N+c*L,l,P.EPSILON12);let I=P0(f*L,d,P.EPSILON15),B=v*I;B<0?g.push(new h(i,o*L,o*b)):B>0?g.push(new h(i,o*L,o*-b)):b!==0?(g.push(new h(i,o*L,o*-b)),g.push(new h(i,o*L,o*b)),++O):g.push(new h(i,o*L,o*b))}return g}var h8=new h,GQ=new h,WQ=new h,X3=new h,Ave=new h,xve=new Z,Cve=new Z,Tve=new Z,Eve=new Z,bve=new Z,jQ=new Z,YQ=new Z,qQ=new h,Sve=new h,Dve=new he;ir.grazingAltitudeLocation=function(e,t){let n=e.origin,i=e.direction;if(!h.equals(n,h.ZERO)){let w=t.geodeticSurfaceNormal(n,h8);if(h.dot(i,w)>=0)return n}let o=u(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,h8),s=h.normalize(r,r),a=h.mostOrthogonalAxis(r,X3),c=h.normalize(h.cross(a,s,GQ),GQ),l=h.normalize(h.cross(s,c,WQ),WQ),f=xve;f[0]=s.x,f[1]=s.y,f[2]=s.z,f[3]=c.x,f[4]=c.y,f[5]=c.z,f[6]=l.x,f[7]=l.y,f[8]=l.z;let d=Z.transpose(f,Cve),p=Z.fromScale(t.radii,Tve),g=Z.fromScale(t.oneOverRadii,Eve),m=bve;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 A=Z.multiply(Z.multiply(d,g,jQ),m,jQ),x=Z.multiply(Z.multiply(A,p,YQ),f,YQ),C=Z.multiplyByVector(A,n,Ave),T=yve(x,h.negate(C,h8),0,0,1),E,S,D=T.length;if(D>0){let w=h.clone(h.ZERO,Sve),R=Number.NEGATIVE_INFINITY;for(let L=0;L<D;++L){E=Z.multiplyByVector(p,Z.multiplyByVector(f,T[L],qQ),qQ);let N=h.normalize(h.subtract(E,n,X3),X3),_=h.dot(N,i);_>R&&(R=_,w=h.clone(E,w))}let O=t.cartesianToCartographic(w,Dve);return R=P.clamp(R,0,1),S=h.magnitude(h.subtract(w,n,X3))*Math.sqrt(1-R*R),S=o?-S:S,O.height=S,t.cartographicToCartesian(O,new h)}};var vve=new h;ir.lineSegmentPlane=function(e,t,n,i){u(i)||(i=new h);let o=h.subtract(t,e,vve),r=n.normal,s=h.dot(r,o);if(Math.abs(s)<P.EPSILON6)return;let a=h.dot(r,e),c=-(n.distance+a)/s;if(!(c<0||c>1))return h.multiplyByScalar(o,c,i),h.add(e,i,i),i};ir.trianglePlaneIntersection=function(e,t,n,i){let o=i.normal,r=i.distance,s=h.dot(o,e)+r<0,a=h.dot(o,t)+r<0,c=h.dot(o,n)+r<0,l=0;l+=s?1:0,l+=a?1:0,l+=c?1:0;let f,d;if((l===1||l===2)&&(f=new h,d=new h),l===1){if(s)return ir.lineSegmentPlane(e,t,i,f),ir.lineSegmentPlane(e,n,i,d),{positions:[e,t,n,f,d],indices:[0,3,4,1,2,4,1,4,3]};if(a)return ir.lineSegmentPlane(t,n,i,f),ir.lineSegmentPlane(t,e,i,d),{positions:[e,t,n,f,d],indices:[1,3,4,2,0,4,2,4,3]};if(c)return ir.lineSegmentPlane(n,e,i,f),ir.lineSegmentPlane(n,t,i,d),{positions:[e,t,n,f,d],indices:[2,3,4,0,1,4,0,4,3]}}else if(l===2)if(s)if(a){if(!c)return ir.lineSegmentPlane(e,n,i,f),ir.lineSegmentPlane(t,n,i,d),{positions:[e,t,n,f,d],indices:[0,1,4,0,4,3,2,3,4]}}else return ir.lineSegmentPlane(n,t,i,f),ir.lineSegmentPlane(e,t,i,d),{positions:[e,t,n,f,d],indices:[2,0,4,2,4,3,1,3,4]};else return ir.lineSegmentPlane(t,e,i,f),ir.lineSegmentPlane(n,e,i,d),{positions:[e,t,n,f,d],indices:[1,2,4,1,4,3,0,3,4]}};var Yi=ir;var m8=new oe;function Eh(e,t){t=y(t,ie.WGS84),e=t.scaleToGeodeticSurface(e);let n=Ot.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=h.fromCartesian4(M.getColumn(n,0,m8)),this._yAxis=h.fromCartesian4(M.getColumn(n,1,m8));let i=h.fromCartesian4(M.getColumn(n,2,m8));this._plane=cn.fromPointNormal(e,i)}Object.defineProperties(Eh.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 wve=new $_;Eh.fromPoints=function(e,t){let n=$_.fromPoints(e,wve);return new Eh(n.center,t)};var ZQ=new wn,K3=new h;Eh.prototype.projectPointOntoPlane=function(e,t){let n=ZQ;n.origin=e,h.normalize(e,n.direction);let i=Yi.rayPlane(n,this._plane,K3);if(u(i)||(h.negate(n.direction,n.direction),i=Yi.rayPlane(n,this._plane,K3)),u(i)){let o=h.subtract(i,this._origin,i),r=h.dot(this._xAxis,o),s=h.dot(this._yAxis,o);return u(t)?(t.x=r,t.y=s,t):new H(r,s)}};Eh.prototype.projectPointsOntoPlane=function(e,t){u(t)||(t=[]);let n=0,i=e.length;for(let o=0;o<i;o++){let r=this.projectPointOntoPlane(e[o],t[n]);u(r)&&(t[n]=r,n++)}return t.length=n,t};Eh.prototype.projectPointToNearestOnPlane=function(e,t){u(t)||(t=new H);let n=ZQ;n.origin=e,h.clone(this._plane.normal,n.direction);let i=Yi.rayPlane(n,this._plane,K3);u(i)||(h.negate(n.direction,n.direction),i=Yi.rayPlane(n,this._plane,K3));let o=h.subtract(i,this._origin,i),r=h.dot(this._xAxis,o),s=h.dot(this._yAxis,o);return t.x=r,t.y=s,t};Eh.prototype.projectPointsToNearestOnPlane=function(e,t){u(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 Ive=new h;Eh.prototype.projectPointOntoEllipsoid=function(e,t){u(t)||(t=new h);let n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=Ive;return h.multiplyByScalar(o,e.x,s),t=h.add(i,s,t),h.multiplyByScalar(r,e.y,s),h.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};Eh.prototype.projectPointsOntoEllipsoid=function(e,t){let n=e.length;u(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 ca=Eh;function Ri(e,t){this.center=h.clone(y(e,h.ZERO)),this.halfAxes=Z.clone(y(t,Z.ZERO))}Ri.packedLength=h.packedLength+Z.packedLength;Ri.pack=function(e,t,n){return n=y(n,0),h.pack(e.center,t,n),Z.pack(e.halfAxes,t,n+h.packedLength),t};Ri.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new Ri),h.unpack(e,t,n.center),Z.unpack(e,t+h.packedLength,n.halfAxes),n};var Pve=new h,Ove=new h,Rve=new h,Bve=new h,Mve=new h,Lve=new h,Nve=new Z,Fve={unitary:new Z,diagonal:new Z};Ri.fromPoints=function(e,t){if(u(t)||(t=new Ri),!u(e)||e.length===0)return t.halfAxes=Z.ZERO,t.center=h.ZERO,t;let n,i=e.length,o=h.clone(e[0],Pve);for(n=1;n<i;n++)h.add(o,e[n],o);let r=1/i;h.multiplyByScalar(o,r,o);let s=0,a=0,c=0,l=0,f=0,d=0,p;for(n=0;n<i;n++)p=h.subtract(e[n],o,Ove),s+=p.x*p.x,a+=p.x*p.y,c+=p.x*p.z,l+=p.y*p.y,f+=p.y*p.z,d+=p.z*p.z;s*=r,a*=r,c*=r,l*=r,f*=r,d*=r;let g=Nve;g[0]=s,g[1]=a,g[2]=c,g[3]=a,g[4]=l,g[5]=f,g[6]=c,g[7]=f,g[8]=d;let m=Z.computeEigenDecomposition(g,Fve),A=Z.clone(m.unitary,t.halfAxes),x=Z.getColumn(A,0,Bve),C=Z.getColumn(A,1,Mve),T=Z.getColumn(A,2,Lve),E=-Number.MAX_VALUE,S=-Number.MAX_VALUE,D=-Number.MAX_VALUE,w=Number.MAX_VALUE,R=Number.MAX_VALUE,O=Number.MAX_VALUE;for(n=0;n<i;n++)p=e[n],E=Math.max(h.dot(x,p),E),S=Math.max(h.dot(C,p),S),D=Math.max(h.dot(T,p),D),w=Math.min(h.dot(x,p),w),R=Math.min(h.dot(C,p),R),O=Math.min(h.dot(T,p),O);x=h.multiplyByScalar(x,.5*(w+E),x),C=h.multiplyByScalar(C,.5*(R+S),C),T=h.multiplyByScalar(T,.5*(O+D),T);let L=h.add(x,C,t.center);h.add(L,T,L);let N=Rve;return N.x=E-w,N.y=S-R,N.z=D-O,h.multiplyByScalar(N,.5,N),Z.multiplyByScale(t.halfAxes,N,t.halfAxes),t};var n$=new h,Vve=new h;function JQ(e,t,n,i,o,r,s,a,c,l,f){u(f)||(f=new Ri);let d=f.halfAxes;Z.setColumn(d,0,t,d),Z.setColumn(d,1,n,d),Z.setColumn(d,2,i,d);let p=n$;p.x=(o+r)/2,p.y=(s+a)/2,p.z=(c+l)/2;let g=Vve;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(l-c)/2;let m=f.center;return p=Z.multiplyByVector(d,p,p),h.add(e,p,m),Z.multiplyByScale(d,g,d),f}var QQ=new he,Uve=new h,kve=new he,zve=new he,Hve=new he,Gve=new he,Wve=new he,jve=new h,$Q=new h,Yve=new h,e$=new h,qve=new h,Xve=new H,Kve=new H,Zve=new H,Jve=new H,Qve=new H,$ve=new h,ewe=new h,twe=new h,nwe=new h,iwe=new H,owe=new h,rwe=new h,swe=new h,awe=new cn(h.UNIT_X,0);Ri.fromRectangle=function(e,t,n,i,o){t=y(t,0),n=y(n,0),i=y(i,ie.WGS84);let r,s,a,c,l,f,d;if(e.width<=P.PI){let R=ce.center(e,QQ),O=i.cartographicToCartesian(R,Uve),L=new ca(O,i);d=L.plane;let N=R.longitude,_=e.south<0&&e.north>0?0:R.latitude,b=he.fromRadians(N,e.north,n,kve),v=he.fromRadians(e.west,e.north,n,zve),I=he.fromRadians(e.west,_,n,Hve),B=he.fromRadians(e.west,e.south,n,Gve),F=he.fromRadians(N,e.south,n,Wve),k=i.cartographicToCartesian(b,jve),U=i.cartographicToCartesian(v,$Q),G=i.cartographicToCartesian(I,Yve),V=i.cartographicToCartesian(B,e$),X=i.cartographicToCartesian(F,qve),j=L.projectPointToNearestOnPlane(k,Xve),Q=L.projectPointToNearestOnPlane(U,Kve),W=L.projectPointToNearestOnPlane(G,Zve),K=L.projectPointToNearestOnPlane(V,Jve),J=L.projectPointToNearestOnPlane(X,Qve);return r=Math.min(Q.x,W.x,K.x),s=-r,c=Math.max(Q.y,j.y),a=Math.min(K.y,J.y),v.height=B.height=t,U=i.cartographicToCartesian(v,$Q),V=i.cartographicToCartesian(B,e$),l=Math.min(cn.getPointDistance(d,U),cn.getPointDistance(d,V)),f=n,JQ(L.origin,L.xAxis,L.yAxis,L.zAxis,r,s,a,c,l,f,o)}let p=e.south>0,g=e.north<0,m=p?e.south:g?e.north:0,A=ce.center(e,QQ).longitude,x=h.fromRadians(A,m,n,i,$ve);x.z=0;let T=Math.abs(x.x)<P.EPSILON10&&Math.abs(x.y)<P.EPSILON10?h.UNIT_X:h.normalize(x,ewe),E=h.UNIT_Z,S=h.cross(T,E,twe);d=cn.fromPointNormal(x,T,awe);let D=h.fromRadians(A+P.PI_OVER_TWO,m,n,i,nwe);s=h.dot(cn.projectPointOntoPlane(d,D,iwe),S),r=-s,c=h.fromRadians(0,e.north,g?t:n,i,owe).z,a=h.fromRadians(0,e.south,p?t:n,i,rwe).z;let w=h.fromRadians(e.east,m,n,i,swe);return l=cn.getPointDistance(d,w),f=0,JQ(x,S,E,T,r,s,a,c,l,f,o)};Ri.fromTransformation=function(e,t){return u(t)||(t=new Ri),t.center=M.getTranslation(e,t.center),t.halfAxes=M.getMatrix3(e,t.halfAxes),t.halfAxes=Z.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};Ri.clone=function(e,t){if(u(e))return u(t)?(h.clone(e.center,t.center),Z.clone(e.halfAxes,t.halfAxes),t):new Ri(e.center,e.halfAxes)};Ri.intersectPlane=function(e,t){let n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,c=Math.abs(r*o[Z.COLUMN0ROW0]+s*o[Z.COLUMN0ROW1]+a*o[Z.COLUMN0ROW2])+Math.abs(r*o[Z.COLUMN1ROW0]+s*o[Z.COLUMN1ROW1]+a*o[Z.COLUMN1ROW2])+Math.abs(r*o[Z.COLUMN2ROW0]+s*o[Z.COLUMN2ROW1]+a*o[Z.COLUMN2ROW2]),l=h.dot(i,n)+t.distance;return l<=-c?Qt.OUTSIDE:l>=c?Qt.INSIDE:Qt.INTERSECTING};var i$=new h,o$=new h,r$=new h,cwe=new h,t$=new h,lwe=new h;Ri.distanceSquaredTo=function(e,t){let n=h.subtract(t,e.center,n$),i=e.halfAxes,o=Z.getColumn(i,0,i$),r=Z.getColumn(i,1,o$),s=Z.getColumn(i,2,r$),a=h.magnitude(o),c=h.magnitude(r),l=h.magnitude(s),f=!0,d=!0,p=!0;a>0?h.divideByScalar(o,a,o):f=!1,c>0?h.divideByScalar(r,c,r):d=!1,l>0?h.divideByScalar(s,l,s):p=!1;let g=!f+!d+!p,m,A,x;if(g===1){let S=o;m=r,A=s,d?p||(S=s,A=o):(S=r,m=o),x=h.cross(m,A,t$),S===o?o=x:S===r?r=x:S===s&&(s=x)}else if(g===2){m=o,d?m=r:p&&(m=s);let S=h.UNIT_Y;S.equalsEpsilon(m,P.EPSILON3)&&(S=h.UNIT_X),A=h.cross(m,S,cwe),h.normalize(A,A),x=h.cross(m,A,t$),h.normalize(x,x),m===o?(r=A,s=x):m===r?(s=A,o=x):m===s&&(o=A,r=x)}else g===3&&(o=h.UNIT_X,r=h.UNIT_Y,s=h.UNIT_Z);let C=lwe;C.x=h.dot(n,o),C.y=h.dot(n,r),C.z=h.dot(n,s);let T=0,E;return C.x<-a?(E=C.x+a,T+=E*E):C.x>a&&(E=C.x-a,T+=E*E),C.y<-c?(E=C.y+c,T+=E*E):C.y>c&&(E=C.y-c,T+=E*E),C.z<-l?(E=C.z+l,T+=E*E):C.z>l&&(E=C.z-l,T+=E*E),T};var uwe=new h,fwe=new h;Ri.computePlaneDistances=function(e,t,n,i){u(i)||(i=new yc);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=e.center,a=e.halfAxes,c=Z.getColumn(a,0,i$),l=Z.getColumn(a,1,o$),f=Z.getColumn(a,2,r$),d=h.add(c,l,uwe);h.add(d,f,d),h.add(d,s,d);let p=h.subtract(d,t,fwe),g=h.dot(n,p);return o=Math.min(g,o),r=Math.max(g,r),h.add(s,c,d),h.add(d,l,d),h.subtract(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.add(s,c,d),h.subtract(d,l,d),h.add(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.add(s,c,d),h.subtract(d,l,d),h.subtract(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.subtract(s,c,d),h.add(d,l,d),h.add(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.subtract(s,c,d),h.add(d,l,d),h.subtract(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.subtract(s,c,d),h.subtract(d,l,d),h.add(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),h.subtract(s,c,d),h.subtract(d,l,d),h.subtract(d,f,d),h.subtract(d,t,p),g=h.dot(n,p),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};var dwe=new h,hwe=new h,mwe=new h;Ri.computeCorners=function(e,t){u(t)||(t=[new h,new h,new h,new h,new h,new h,new h,new h]);let n=e.center,i=e.halfAxes,o=Z.getColumn(i,0,dwe),r=Z.getColumn(i,1,hwe),s=Z.getColumn(i,2,mwe);return h.clone(n,t[0]),h.subtract(t[0],o,t[0]),h.subtract(t[0],r,t[0]),h.subtract(t[0],s,t[0]),h.clone(n,t[1]),h.subtract(t[1],o,t[1]),h.subtract(t[1],r,t[1]),h.add(t[1],s,t[1]),h.clone(n,t[2]),h.subtract(t[2],o,t[2]),h.add(t[2],r,t[2]),h.subtract(t[2],s,t[2]),h.clone(n,t[3]),h.subtract(t[3],o,t[3]),h.add(t[3],r,t[3]),h.add(t[3],s,t[3]),h.clone(n,t[4]),h.add(t[4],o,t[4]),h.subtract(t[4],r,t[4]),h.subtract(t[4],s,t[4]),h.clone(n,t[5]),h.add(t[5],o,t[5]),h.subtract(t[5],r,t[5]),h.add(t[5],s,t[5]),h.clone(n,t[6]),h.add(t[6],o,t[6]),h.add(t[6],r,t[6]),h.subtract(t[6],s,t[6]),h.clone(n,t[7]),h.add(t[7],o,t[7]),h.add(t[7],r,t[7]),h.add(t[7],s,t[7]),t};var pwe=new Z;Ri.computeTransformation=function(e,t){u(t)||(t=new M);let n=e.center,i=Z.multiplyByUniformScale(e.halfAxes,2,pwe);return M.fromRotationTranslation(i,n,t)};var _we=new se;Ri.isOccluded=function(e,t){let n=se.fromOrientedBoundingBox(e,_we);return!t.isBoundingSphereVisible(n)};Ri.prototype.intersectPlane=function(e){return Ri.intersectPlane(this,e)};Ri.prototype.distanceSquaredTo=function(e){return Ri.distanceSquaredTo(this,e)};Ri.prototype.computePlaneDistances=function(e,t,n){return Ri.computePlaneDistances(this,e,t,n)};Ri.prototype.computeCorners=function(e){return Ri.computeCorners(this,e)};Ri.prototype.computeTransformation=function(e){return Ri.computeTransformation(this,e)};Ri.prototype.isOccluded=function(e){return Ri.isOccluded(this,e)};Ri.equals=function(e,t){return e===t||u(e)&&u(t)&&h.equals(e.center,t.center)&&Z.equals(e.halfAxes,t.halfAxes)};Ri.prototype.clone=function(e){return Ri.clone(this,e)};Ri.prototype.equals=function(e){return Ri.equals(this,e)};var Rn=Ri;var Z3={};Z3.getHeight=function(e,t,n){return(e-n)*t+n};var gwe=new h;Z3.getPosition=function(e,t,n,i,o){let r=t.cartesianToCartographic(e,gwe),s=Z3.getHeight(r.height,n,i);return h.fromRadians(r.longitude,r.latitude,s,t,o)};var Cc=Z3;var OI=`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;

    //extrudeDirection is zero for the top layer
    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);

    // If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w):
    // - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts)
    // - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w)
    // - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow)
    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);

    // - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0)
    // - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x)
    // - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow)
    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
    // 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction
    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 eg=`#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 s$={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};s$.NUMBER_OF_CLASSIFICATION_TYPES=3;var Un=Object.freeze(s$);var ywe={NEVER:ee.NEVER,LESS:ee.LESS,EQUAL:ee.EQUAL,LESS_OR_EQUAL:ee.LEQUAL,GREATER:ee.GREATER,NOT_EQUAL:ee.NOTEQUAL,GREATER_OR_EQUAL:ee.GEQUAL,ALWAYS:ee.ALWAYS},Fa=Object.freeze(ywe);function Awe(e,t){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 RI=Awe;function Ym(e,t,n){if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;let i=xwe(t),o=e.floatingPointTexture,r=i===Xe.FLOAT&&!o,s=Cwe(t,r),a=Twe(s,t,r),c=Math.floor(Ft.maximumTextureSize/a),l=Math.min(n,c),f=a*l,d=Math.ceil(n/l),p=1/f,g=p*.5,m=1/d,A=m*.5;this._textureDimensions=new H(f,d),this._textureStep=new oe(p,g,m,A),this._pixelDatatype=r?Xe.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;let x=4*f*d;this._batchValues=i===Xe.FLOAT&&!r?new Float32Array(x):new Uint8Array(x),this._batchValuesDirty=!1}Object.defineProperties(Ym.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function xwe(e){let t=!1,n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==q.UNSIGNED_BYTE){t=!0;break}return t?Xe.FLOAT:Xe.UNSIGNED_BYTE}function c$(e,t){let n=e[t].componentsPerAttribute;return n===2?H:n===3?h:n===4?oe:Number}function Cwe(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!==q.UNSIGNED_BYTE&&t?i+=4:++i}return n}function Twe(e,t,n){let i=e.length,o=e[i-1];return t[i-1].componentDatatype!==q.UNSIGNED_BYTE&&n?o+4:o+1}var BI=new oe;function Ewe(e,t,n){let i=oe.unpack(e,t,BI),o=oe.unpackFloat(i);i=oe.unpack(e,t+4,BI);let r=oe.unpackFloat(i);i=oe.unpack(e,t+8,BI);let s=oe.unpackFloat(i);i=oe.unpack(e,t+12,BI);let a=oe.unpackFloat(i);return oe.fromElements(o,r,s,a,n)}function bwe(e,t,n){let i=oe.packFloat(e.x,BI);oe.pack(i,t,n),i=oe.packFloat(e.y,i),oe.pack(i,t,n+4),i=oe.packFloat(e.z,i),oe.pack(i,t,n+8),i=oe.packFloat(e.w,i),oe.pack(i,t,n+12)}var a$=new oe;Ym.prototype.getBatchedAttribute=function(e,t,n){let i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o,a;this._packFloats&&i[t].componentDatatype!==Xe.UNSIGNED_BYTE?a=Ewe(this._batchValues,s,a$):a=oe.unpack(this._batchValues,s,a$);let c=c$(i,t);return u(c.fromCartesian4)?c.fromCartesian4(a,n):u(c.clone)?c.clone(a,n):a.x};var Swe=[void 0,void 0,new H,new h,new oe],Dwe=new oe;Ym.prototype.setBatchedAttribute=function(e,t,n){let i=this._attributes,o=Swe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=c$(this._attributes,t);if(u(s.equals)?s.equals(r,n):r===n)return;let c=Dwe;c.x=u(n.x)?n.x:n,c.y=u(n.y)?n.y:0,c.z=u(n.z)?n.z:0,c.w=u(n.w)?n.w:0;let l=this._offsets[t],d=4*this._stride*e+4*l;this._packFloats&&i[t].componentDatatype!==Xe.UNSIGNED_BYTE?bwe(c,this._batchValues,d):oe.pack(c,this._batchValues,d),this._batchValuesDirty=!0};function vwe(e,t){let n=e._textureDimensions;e._texture=new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:ln.NEAREST,flipY:!1})}function wwe(e){let t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}Ym.prototype.update=function(e){u(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,u(this._texture)||vwe(this,e.context),wwe(this))};Ym.prototype.getUniformMapCallback=function(){let e=this;return function(t){return e._attributes.length===0?t:_t(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function Iwe(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 Pwe(e){return e===1?"float":`vec${e}`}function Owe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function Rwe(e,t){let i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=Pwe(o),a=Owe(o),c=e._offsets[t],l=`${s} ${r}(float batchId) 
{ 
    vec2 st = computeSt(batchId); 
    st.x += batchTextureStep.x * float(${c}); 
`;return e._packFloats&&i.componentDatatype!==Xe.UNSIGNED_BYTE?l+=`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))); 
`:l+=`    vec4 textureValue = texture(batchTexture, st); 
`,l+=`    ${s} value = textureValue${a}; 
`,e._pixelDatatype===Xe.UNSIGNED_BYTE&&i.componentDatatype===q.UNSIGNED_BYTE&&!i.normalize?l+=`value *= 255.0; 
`:e._pixelDatatype===Xe.FLOAT&&i.componentDatatype===q.UNSIGNED_BYTE&&i.normalize&&(l+=`value /= 255.0; 
`),l+=`    return value; 
} 
`,l}Ym.prototype.getVertexShaderCallback=function(){let e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture; 
`;t+=`${Iwe(this)}
`;let n=e.length;for(let i=0;i<n;++i)t+=Rwe(this,i);return function(i){let o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};Ym.prototype.isDestroyed=function(){return!1};Ym.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),le(this)};var O0=Ym;var eo={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};eo.getMathType=function(e){switch(e){case eo.SCALAR:return Number;case eo.VEC2:return H;case eo.VEC3:return h;case eo.VEC4:return oe;case eo.MAT2:return Ji;case eo.MAT3:return Z;case eo.MAT4:return M}};eo.getNumberOfComponents=function(e){switch(e){case eo.SCALAR:return 1;case eo.VEC2:return 2;case eo.VEC3:return 3;case eo.VEC4:case eo.MAT2:return 4;case eo.MAT3:return 9;case eo.MAT4:return 16}};eo.getAttributeLocationCount=function(e){switch(e){case eo.SCALAR:case eo.VEC2:case eo.VEC3:case eo.VEC4:return 1;case eo.MAT2:return 2;case eo.MAT3:return 3;case eo.MAT4:return 4}};eo.getGlslType=function(e){switch(e){case eo.SCALAR:return"float";case eo.VEC2:return"vec2";case eo.VEC3:return"vec3";case eo.VEC4:return"vec4";case eo.MAT2:return"mat2";case eo.MAT3:return"mat3";case eo.MAT4:return"mat4"}};var rn=Object.freeze(eo);var l$=1/256,u$=256,_o={};_o.octEncodeInRange=function(e,t,n){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 i=n.x,o=n.y;n.x=(1-Math.abs(o))*P.signNotZero(i),n.y=(1-Math.abs(i))*P.signNotZero(o)}return n.x=P.toSNorm(n.x,t),n.y=P.toSNorm(n.y,t),n};_o.octEncode=function(e,t){return _o.octEncodeInRange(e,255,t)};var MI=new H,f$=new Uint8Array(1);function J3(e){return f$[0]=e,f$[0]}_o.octEncodeToCartesian4=function(e,t){return _o.octEncodeInRange(e,65535,MI),t.x=J3(MI.x*l$),t.y=J3(MI.x),t.z=J3(MI.y*l$),t.w=J3(MI.y),t};_o.octDecodeInRange=function(e,t,n,i){if(i.x=P.fromSNorm(e,n),i.y=P.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))*P.signNotZero(o),i.y=(1-Math.abs(o))*P.signNotZero(i.y)}return h.normalize(i,i)};_o.octDecode=function(e,t,n){return _o.octDecodeInRange(e,t,255,n)};_o.octDecodeFromCartesian4=function(e,t){let n=e.x,i=e.y,o=e.z,r=e.w,s=n*u$+i,a=o*u$+r;return _o.octDecodeInRange(s,a,65535,t)};_o.octPackFloat=function(e){return 256*e.x+e.y};var _8=new H;_o.octEncodeFloat=function(e){return _o.octEncode(e,_8),_o.octPackFloat(_8)};_o.octDecodeFloat=function(e,t){let n=e/256,i=Math.floor(n),o=(n-i)*256;return _o.octDecode(i,o,t)};_o.octPack=function(e,t,n,i){let o=_o.octEncodeFloat(e),r=_o.octEncodeFloat(t),s=_o.octEncode(n,_8);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};_o.octUnpack=function(e,t,n,i){let o=e.x/65536,r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;let a=Math.floor(o),c=(o-a)*65536;_o.octDecodeFloat(s,t),_o.octDecodeFloat(c,n),_o.octDecode(r,a,i)};_o.compressTextureCoordinates=function(e){let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};_o.decompressTextureCoordinates=function(e,t){let n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function p8(e){return e>>1^-(e&1)}_o.zigZagDeltaDecode=function(e,t,n){let i=e.length,o=0,r=0,s=0;for(let a=0;a<i;++a)o+=p8(e[a]),r+=p8(t[a]),e[a]=o,t[a]=r,u(n)&&(s+=p8(n[a]),n[a]=s)};_o.dequantize=function(e,t,n,i){let o=rn.getNumberOfComponents(n),r;switch(t){case q.BYTE:r=127;break;case q.UNSIGNED_BYTE:r=255;break;case q.SHORT:r=32767;break;case q.UNSIGNED_SHORT:r=65535;break;case q.INT:r=2147483647;break;case q.UNSIGNED_INT:r=4294967295;break}let s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let c=0;c<o;c++){let l=a*o+c;s[l]=Math.max(e[l]/r,-1)}return s};_o.decodeRGB565=function(e,t){let n=e.length;u(t)||(t=new Float32Array(n*3));let i=(1<<5)-1,o=(1<<6)-1,r=1/31,s=1/63;for(let a=0;a<n;a++){let c=e[a],l=c>>11,f=c>>5&o,d=c&i,p=3*a;t[p]=l*r,t[p+1]=f*s,t[p+2]=d*r}return t};var Gn=_o;var d$=new h,h$=new h,m$=new h;function Bwe(e,t,n,i,o){u(o)||(o=new h);let r,s,a,c,l,f,d,p;if(u(t.z)){if(h.equalsEpsilon(e,t,P.EPSILON14))return h.clone(h.UNIT_X,o);if(h.equalsEpsilon(e,n,P.EPSILON14))return h.clone(h.UNIT_Y,o);if(h.equalsEpsilon(e,i,P.EPSILON14))return h.clone(h.UNIT_Z,o);r=h.subtract(n,t,d$),s=h.subtract(i,t,h$),a=h.subtract(e,t,m$),c=h.dot(r,r),l=h.dot(r,s),f=h.dot(r,a),d=h.dot(s,s),p=h.dot(s,a)}else{if(H.equalsEpsilon(e,t,P.EPSILON14))return h.clone(h.UNIT_X,o);if(H.equalsEpsilon(e,n,P.EPSILON14))return h.clone(h.UNIT_Y,o);if(H.equalsEpsilon(e,i,P.EPSILON14))return h.clone(h.UNIT_Z,o);r=H.subtract(n,t,d$),s=H.subtract(i,t,h$),a=H.subtract(e,t,m$),c=H.dot(r,r),l=H.dot(r,s),f=H.dot(r,a),d=H.dot(s,s),p=H.dot(s,a)}o.y=d*f-l*p,o.z=c*p-l*f;let g=c*d-l*l;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}var R0=Bwe;var g8={};g8.calculateACMR=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.indices,n=e.maximumIndex,i=y(e.cacheSize,24),o=t.length;if(!u(n)){n=0;let a=0,c=t[a];for(;a<o;)c>n&&(n=c),++a,c=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)};g8.tipsify=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.indices,n=e.maximumIndex,i=y(e.cacheSize,24),o;function r(_,b,v,I){for(;b.length>=1;){let B=b[b.length-1];if(b.splice(b.length-1,1),_[B].numLiveTriangles>0)return B}for(;o<I;){if(_[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(_,b,v,I,B,F,k){let U=-1,G,V=-1,X=0;for(;X<v.length;){let j=v[X];I[j].numLiveTriangles&&(G=0,B-I[j].timeStamp+2*I[j].numLiveTriangles<=b&&(G=B-I[j].timeStamp),(G>V||V===-1)&&(V=G,U=j)),++X}return U===-1?r(I,F,_,k):U}let a=t.length,c=0,l=0,f=t[l],d=a;if(u(n))c=n+1;else{for(;l<d;)f>c&&(c=f),++l,f=t[l];if(c===-1)return 0;++c}let p=[],g;for(g=0;g<c;g++)p[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};l=0;let m=0;for(;l<d;)p[t[l]].vertexTriangles.push(m),++p[t[l]].numLiveTriangles,p[t[l+1]].vertexTriangles.push(m),++p[t[l+1]].numLiveTriangles,p[t[l+2]].vertexTriangles.push(m),++p[t[l+2]].numLiveTriangles,++m,l+=3;let A=0,x=i+1;o=1;let C=[],T=[],E,S,D=0,w=[],R=a/3,O=[];for(g=0;g<R;g++)O[g]=!1;let L,N;for(;A!==-1;){C=[],S=p[A],N=S.vertexTriangles.length;for(let _=0;_<N;++_)if(m=S.vertexTriangles[_],!O[m]){O[m]=!0,l=m+m+m;for(let b=0;b<3;++b)L=t[l],C.push(L),T.push(L),w[D]=L,++D,E=p[L],--E.numLiveTriangles,x-E.timeStamp>i&&(E.timeStamp=x,++x),++l}A=s(t,i,C,p,x,T,c)}return w};var LI=g8;var Tc={};function oV(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function Mwe(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)oV(i,o,e[r],e[r+1],e[r+2]);return i}function Lwe(e){let t=e.length;if(t>=3){let n=(t-2)*6,i=Fe.createTypedArray(t,n);oV(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)oV(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function Nwe(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)oV(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}Tc.toWireframe=function(e){let t=e.indices;if(u(t)){switch(e.primitiveType){case Me.TRIANGLES:e.indices=Mwe(t);break;case Me.TRIANGLE_STRIP:e.indices=Lwe(t);break;case Me.TRIANGLE_FAN:e.indices=Nwe(t);break}e.primitiveType=Me.LINES}return e};Tc.createLineSegmentsForVectors=function(e,t,n){t=y(t,"normal"),n=y(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 c,l=e.boundingSphere;return u(l)&&(c=new se(l.center,l.radius+n)),new ct({attributes:{position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:Me.LINES,boundingSphere:c})};Tc.createAttributeLocations=function(e){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];u(n[a])&&(i[a]=o++)}for(let a in n)n.hasOwnProperty(a)&&!u(i[a])&&(i[a]=o++);return i};Tc.reorderForPreVertexCache=function(e){let t=ct.computeNumberOfVertices(e),n=e.indices;if(u(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,c=0,l=0,f;for(;a<r;)f=i[o[a]],f!==-1?s[c]=f:(f=o[a],i[f]=l,s[c]=l,++l),++a,++c;e.indices=s;let d=e.attributes;for(let p in d)if(d.hasOwnProperty(p)&&u(d[p])&&u(d[p].values)){let g=d[p],m=g.values,A=0,x=g.componentsPerAttribute,C=q.createTypedArray(g.componentDatatype,l*x);for(;A<t;){let T=i[A];if(T!==-1)for(let E=0;E<x;E++)C[x*T+E]=m[x*A+E];++A}g.values=C}}return e};Tc.reorderForPostVertexCache=function(e,t){let n=e.indices;if(e.primitiveType===Me.TRIANGLES&&u(n)){let i=n.length,o=0;for(let r=0;r<i;r++)n[r]>o&&(o=n[r]);e.indices=LI.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function p$(e){let t={};for(let n in e)if(e.hasOwnProperty(n)&&u(e[n])&&u(e[n].values)){let i=e[n];t[n]=new ve({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function Fwe(e,t,n){for(let i in t)if(t.hasOwnProperty(i)&&u(t[i])&&u(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])}}Tc.fitToUnsignedShortIndices=function(e){let t=[],n=ct.computeNumberOfVertices(e);if(u(e.indices)&&n>=P.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=p$(e.attributes),a=e.indices,c=a.length,l;e.primitiveType===Me.TRIANGLES?l=3:e.primitiveType===Me.LINES?l=2:e.primitiveType===Me.POINTS&&(l=1);for(let f=0;f<c;f+=l){for(let d=0;d<l;++d){let p=a[f+d],g=i[p];u(g)||(g=r++,i[p]=g,Fwe(s,e.attributes,p)),o.push(g)}r+l>=P.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=p$(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 _$=new h,Vwe=new he;Tc.projectTo2D=function(e,t,n,i,o){let r=e.attributes[t];o=u(o)?o:new Ei;let s=o.ellipsoid,a=r.values,c=new Float64Array(a.length),l=0;for(let f=0;f<a.length;f+=3){let d=h.fromArray(a,f,_$),p=s.cartesianToCartographic(d,Vwe),g=o.project(p,_$);c[l++]=g.x,c[l++]=g.y,c[l++]=g.z}return e.attributes[n]=r,e.attributes[i]=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};var y8={high:0,low:0};Tc.encodeAttribute=function(e,t,n,i){let o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),c=new Float32Array(s);for(let f=0;f<s;++f)Hn.encode(r[f],y8),a[f]=y8.high,c[f]=y8.low;let l=o.componentsPerAttribute;return e.attributes[n]=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:l,values:a}),e.attributes[i]=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:l,values:c}),delete e.attributes[t],e};var Jf=new h;function A8(e,t){if(u(t)){let n=t.values,i=n.length;for(let o=0;o<i;o+=3)h.unpack(n,o,Jf),M.multiplyByPoint(e,Jf,Jf),h.pack(Jf,n,o)}}function x8(e,t){if(u(t)){let n=t.values,i=n.length;for(let o=0;o<i;o+=3)h.unpack(n,o,Jf),Z.multiplyByVector(e,Jf,Jf),Jf=h.normalize(Jf,Jf),h.pack(Jf,n,o)}}var Q3=new M,$3=new Z;Tc.transformToWorldCoordinates=function(e){let t=e.modelMatrix;if(M.equals(t,M.IDENTITY))return e;let n=e.geometry.attributes;A8(t,n.position),A8(t,n.prevPosition),A8(t,n.nextPosition),(u(n.normal)||u(n.tangent)||u(n.bitangent))&&(M.inverse(t,Q3),M.transpose(Q3,Q3),M.getMatrix3(Q3,$3),x8($3,n.normal),x8($3,n.tangent),x8($3,n.bitangent));let i=e.geometry.boundingSphere;return u(i)&&(e.geometry.boundingSphere=se.transform(i,t,i)),e.modelMatrix=M.clone(M.IDENTITY),e};function Uwe(e,t){let n=e.length,i={},o=e[0][t].attributes,r;for(r in o)if(o.hasOwnProperty(r)&&u(o[r])&&u(o[r].values)){let s=o[r],a=s.values.length,c=!0;for(let l=1;l<n;++l){let f=e[l][t].attributes[r];if(!u(f)||s.componentDatatype!==f.componentDatatype||s.componentsPerAttribute!==f.componentsPerAttribute||s.normalize!==f.normalize){c=!1;break}a+=f.values.length}c&&(i[r]=new ve({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:q.createTypedArray(s.componentDatatype,a)}))}return i}var kwe=new h;function C8(e,t){let n=e.length,i,o,r,s,a=e[0].modelMatrix,c=u(e[0][t].indices),l=e[0][t].primitiveType,f=Uwe(e,t),d,p,g;for(i in f)if(f.hasOwnProperty(i))for(d=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)d[s++]=p[r];let m;if(c){let T=0;for(o=0;o<n;++o)T+=e[o][t].indices.length;let E=ct.computeNumberOfVertices(new ct({attributes:f,primitiveType:Me.POINTS})),S=Fe.createTypedArray(E,T),D=0,w=0;for(o=0;o<n;++o){let R=e[o][t].indices,O=R.length;for(s=0;s<O;++s)S[D++]=w+R[s];w+=ct.computeNumberOfVertices(e[o][t])}m=S}let A=new h,x=0,C;for(o=0;o<n;++o){if(C=e[o][t].boundingSphere,!u(C)){A=void 0;break}h.add(C.center,A,A)}if(u(A))for(h.divideByScalar(A,n,A),o=0;o<n;++o){C=e[o][t].boundingSphere;let T=h.magnitude(h.subtract(C.center,A,kwe))+C.radius;T>x&&(x=T)}return new ct({attributes:f,indices:m,primitiveType:l,boundingSphere:u(A)?new se(A,x):void 0})}Tc.combineInstances=function(e){let t=[],n=[],i=e.length;for(let r=0;r<i;++r){let s=e[r];u(s.geometry)?t.push(s):u(s.westHemisphereGeometry)&&u(s.eastHemisphereGeometry)&&n.push(s)}let o=[];return t.length>0&&o.push(C8(t,"geometry")),n.length>0&&(o.push(C8(n,"westHemisphereGeometry")),o.push(C8(n,"eastHemisphereGeometry"))),o};var ku=new h,NI=new h,rT=new h,sT=new h;Tc.computeNormal=function(e){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),c=new Array(r),l;for(l=0;l<o;l++)s[l]={indexOffset:0,count:0,currentCount:0};let f=0;for(l=0;l<r;l+=3){let m=t[l],A=t[l+1],x=t[l+2],C=m*3,T=A*3,E=x*3;NI.x=i[C],NI.y=i[C+1],NI.z=i[C+2],rT.x=i[T],rT.y=i[T+1],rT.z=i[T+2],sT.x=i[E],sT.y=i[E+1],sT.z=i[E+2],s[m].count++,s[A].count++,s[x].count++,h.subtract(rT,NI,rT),h.subtract(sT,NI,sT),a[f]=h.cross(rT,sT,new h),f++}let d=0;for(l=0;l<o;l++)s[l].indexOffset+=d,d+=s[l].count;f=0;let p;for(l=0;l<r;l+=3){p=s[t[l]];let m=p.indexOffset+p.currentCount;c[m]=f,p.currentCount++,p=s[t[l+1]],m=p.indexOffset+p.currentCount,c[m]=f,p.currentCount++,p=s[t[l+2]],m=p.indexOffset+p.currentCount,c[m]=f,p.currentCount++,f++}let g=new Float32Array(o*3);for(l=0;l<o;l++){let m=l*3;if(p=s[l],h.clone(h.ZERO,ku),p.count>0){for(f=0;f<p.count;f++)h.add(ku,a[c[p.indexOffset+f]],ku);h.equalsEpsilon(h.ZERO,ku,P.EPSILON10)&&h.clone(a[c[p.indexOffset]],ku)}h.equalsEpsilon(h.ZERO,ku,P.EPSILON10)&&(ku.z=1),h.normalize(ku,ku),g[m]=ku.x,g[m+1]=ku.y,g[m+2]=ku.z}return e.attributes.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g}),e};var zwe=new h,g$=new h,Hwe=new h;Tc.computeTangentAndBitangent=function(e){let t=e.attributes,n=e.indices,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,c=new Array(s*3),l;for(l=0;l<c.length;l++)c[l]=0;let f,d,p;for(l=0;l<a;l+=3){let A=n[l],x=n[l+1],C=n[l+2];f=A*3,d=x*3,p=C*3;let T=A*2,E=x*2,S=C*2,D=i[f],w=i[f+1],R=i[f+2],O=r[T],L=r[T+1],N=r[E+1]-L,_=r[S+1]-L,b=1/((r[E]-O)*_-(r[S]-O)*N),v=(_*(i[d]-D)-N*(i[p]-D))*b,I=(_*(i[d+1]-w)-N*(i[p+1]-w))*b,B=(_*(i[d+2]-R)-N*(i[p+2]-R))*b;c[f]+=v,c[f+1]+=I,c[f+2]+=B,c[d]+=v,c[d+1]+=I,c[d+2]+=B,c[p]+=v,c[p+1]+=I,c[p+2]+=B}let g=new Float32Array(s*3),m=new Float32Array(s*3);for(l=0;l<s;l++){f=l*3,d=f+1,p=f+2;let A=h.fromArray(o,f,zwe),x=h.fromArray(c,f,Hwe),C=h.dot(A,x);h.multiplyByScalar(A,C,g$),h.normalize(h.subtract(x,g$,x),x),g[f]=x.x,g[d]=x.y,g[p]=x.z,h.normalize(h.cross(A,x,x),x),m[f]=x.x,m[d]=x.y,m[p]=x.z}return e.attributes.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:m}),e};var FI=new H,Zf=new h,y$=new h,A$=new h,eV=new H;Tc.compressVertices=function(e){let t=e.attributes.extrudeDirection,n,i;if(u(t)){let w=t.values;i=w.length/3;let R=new Float32Array(i*2),O=0;for(n=0;n<i;++n){if(h.fromArray(w,n*3,Zf),h.equals(Zf,h.ZERO)){O+=2;continue}eV=Gn.octEncodeInRange(Zf,65535,eV),R[O++]=eV.x,R[O++]=eV.y}return e.attributes.compressedAttributes=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:R}),delete e.attributes.extrudeDirection,e}let o=e.attributes.normal,r=e.attributes.st,s=u(o),a=u(r);if(!s&&!a)return e;let c=e.attributes.tangent,l=e.attributes.bitangent,f=u(c),d=u(l),p,g,m,A;s&&(p=o.values),a&&(g=r.values),f&&(m=c.values),d&&(A=l.values),i=(s?p.length:g.length)/(s?3:2);let T=i,E=a&&s?2:1;E+=f||d?1:0,T*=E;let S=new Float32Array(T),D=0;for(n=0;n<i;++n){a&&(H.fromArray(g,n*2,FI),S[D++]=Gn.compressTextureCoordinates(FI));let w=n*3;s&&u(m)&&u(A)?(h.fromArray(p,w,Zf),h.fromArray(m,w,y$),h.fromArray(A,w,A$),Gn.octPack(Zf,y$,A$,FI),S[D++]=FI.x,S[D++]=FI.y):(s&&(h.fromArray(p,w,Zf),S[D++]=Gn.octEncodeFloat(Zf)),f&&(h.fromArray(m,w,Zf),S[D++]=Gn.octEncodeFloat(Zf)),d&&(h.fromArray(A,w,Zf),S[D++]=Gn.octEncodeFloat(Zf)))}return e.attributes.compressedAttributes=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:E,values:S}),s&&delete e.attributes.normal,a&&delete e.attributes.st,d&&delete e.attributes.bitangent,f&&delete e.attributes.tangent,e};function Gwe(e){if(u(e.indices))return e;let t=ct.computeNumberOfVertices(e),n=Fe.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function Wwe(e){let t=ct.computeNumberOfVertices(e),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 jwe(e){let t=ct.computeNumberOfVertices(e),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 Ywe(e){if(u(e.indices))return e;let t=ct.computeNumberOfVertices(e),n=Fe.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function qwe(e){let t=ct.computeNumberOfVertices(e),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 Xwe(e){let t=ct.computeNumberOfVertices(e),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 Kwe(e){switch(e.primitiveType){case Me.TRIANGLE_FAN:return Wwe(e);case Me.TRIANGLE_STRIP:return jwe(e);case Me.TRIANGLES:return Gwe(e);case Me.LINE_STRIP:return qwe(e);case Me.LINE_LOOP:return Xwe(e);case Me.LINES:return Ywe(e)}return e}function tg(e,t){Math.abs(e.y)<P.EPSILON6&&(t?e.y=-P.EPSILON6:e.y=P.EPSILON6)}function Zwe(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){tg(e,e.y<0),tg(t,t.y<0),tg(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=P.sign(e.y):s=P.sign(n.y):o>r?s=P.sign(t.y):s=P.sign(n.y);let a=s<0;tg(e,a),tg(t,a),tg(n,a)}var x$=new h;function zu(e,t,n,i){h.add(e,h.multiplyByScalar(h.subtract(t,e,x$),e.y/(e.y-t.y),x$),n),h.clone(n,i),tg(n,!0),tg(i,!1)}var B0=new h,M0=new h,L0=new h,N0=new h,T8={positions:new Array(7),indices:new Array(3*3)};function Jwe(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;Zwe(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=T8.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(zu(e,t,B0,L0),zu(e,n,M0,N0),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(zu(t,n,B0,L0),zu(t,e,M0,N0),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(zu(n,e,B0,L0),zu(n,t,M0,N0),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||(zu(n,e,B0,L0),zu(n,t,M0,N0),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(zu(t,n,B0,L0),zu(t,e,M0,N0),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(zu(e,t,B0,L0),zu(e,n,M0,N0),a[0]=1,a[1]=2,a[3]=1,a[6]=0));let c=T8.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,(s===1||s===2)&&(c[3]=B0,c[4]=M0,c[5]=L0,c[6]=N0,c.length=7),T8}function C$(e,t){let n=e.attributes;if(n.position.values.length===0)return;for(let o in n)if(n.hasOwnProperty(o)&&u(n[o])&&u(n[o].values)){let r=n[o];r.values=q.createTypedArray(r.componentDatatype,r.values)}let i=ct.computeNumberOfVertices(e);return e.indices=Fe.createTypedArray(i,e.indices),t&&(e.boundingSphere=se.fromVertices(n.position.values)),e}function cT(e){let t=e.attributes,n={};for(let i in t)if(t.hasOwnProperty(i)&&u(t[i])&&u(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 D8(e,t,n){let i=u(e.geometry.boundingSphere);t=C$(t,i),n=C$(n,i),u(n)&&!u(t)?e.geometry=n:!u(n)&&u(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function v8(e,t){let n=new e,i=new e,o=new e;return function(r,s,a,c,l,f,d,p){let g=e.fromArray(l,r*t,n),m=e.fromArray(l,s*t,i),A=e.fromArray(l,a*t,o);e.multiplyByScalar(g,c.x,g),e.multiplyByScalar(m,c.y,m),e.multiplyByScalar(A,c.z,A);let x=e.add(g,m,g);e.add(x,A,x),p&&e.normalize(x,x),e.pack(x,f,d*t)}}var Qwe=v8(oe,4),iV=v8(h,3),v$=v8(H,2),$we=function(e,t,n,i,o,r,s){let a=o[e]*i.x,c=o[t]*i.y,l=o[n]*i.z;r[s]=a+c+l>P.EPSILON6?1:0},VI=new h,E8=new h,b8=new h,eIe=new h;function tV(e,t,n,i,o,r,s,a,c,l,f,d,p,g,m,A){if(!u(r)&&!u(s)&&!u(a)&&!u(c)&&!u(l)&&g===0)return;let x=h.fromArray(o,e*3,VI),C=h.fromArray(o,t*3,E8),T=h.fromArray(o,n*3,b8),E=R0(i,x,C,T,eIe);if(u(E)){if(u(r)&&iV(e,t,n,E,r,d.normal.values,A,!0),u(l)){let S=h.fromArray(l,e*3,VI),D=h.fromArray(l,t*3,E8),w=h.fromArray(l,n*3,b8);h.multiplyByScalar(S,E.x,S),h.multiplyByScalar(D,E.y,D),h.multiplyByScalar(w,E.z,w);let R;!h.equals(S,h.ZERO)||!h.equals(D,h.ZERO)||!h.equals(w,h.ZERO)?(R=h.add(S,D,S),h.add(R,w,R),h.normalize(R,R)):(R=VI,R.x=0,R.y=0,R.z=0),h.pack(R,d.extrudeDirection.values,A*3)}if(u(f)&&$we(e,t,n,E,f,d.applyOffset.values,A),u(s)&&iV(e,t,n,E,s,d.tangent.values,A,!0),u(a)&&iV(e,t,n,E,a,d.bitangent.values,A,!0),u(c)&&v$(e,t,n,E,c,d.st.values,A),g>0)for(let S=0;S<g;S++){let D=p[S];tIe(e,t,n,E,A,m[D],d[D])}}}function tIe(e,t,n,i,o,r,s){let a=r.componentsPerAttribute,c=r.values,l=s.values;switch(a){case 4:Qwe(e,t,n,i,c,l,o,!1);break;case 3:iV(e,t,n,i,c,l,o,!1);break;case 2:v$(e,t,n,i,c,l,o,!1);break;default:l[o]=c[e]*i.x+c[t]*i.y+c[n]*i.z}}function bh(e,t,n,i,o,r){let s=e.position.values.length/3;if(o!==-1){let a=i[o],c=n[a];return c===-1?(n[a]=s,e.position.values.push(r.x,r.y,r.z),t.push(s),s):(t.push(c),c)}return e.position.values.push(r.x,r.y,r.z),t.push(s),s}var nIe={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function T$(e){let t=e.geometry,n=t.attributes,i=n.position.values,o=u(n.normal)?n.normal.values:void 0,r=u(n.bitangent)?n.bitangent.values:void 0,s=u(n.tangent)?n.tangent.values:void 0,a=u(n.st)?n.st.values:void 0,c=u(n.extrudeDirection)?n.extrudeDirection.values:void 0,l=u(n.applyOffset)?n.applyOffset.values:void 0,f=t.indices,d=[];for(let R in n)n.hasOwnProperty(R)&&!nIe[R]&&u(n[R])&&d.push(R);let p=d.length,g=cT(t),m=cT(t),A,x,C,T,E,S=[];S.length=i.length/3;let D=[];for(D.length=i.length/3,E=0;E<S.length;++E)S[E]=-1,D[E]=-1;let w=f.length;for(E=0;E<w;E+=3){let R=f[E],O=f[E+1],L=f[E+2],N=h.fromArray(i,R*3),_=h.fromArray(i,O*3),b=h.fromArray(i,L*3),v=Jwe(N,_,b);if(u(v)&&v.positions.length>3){let I=v.positions,B=v.indices,F=B.length;for(let k=0;k<F;++k){let U=B[k],G=I[U];G.y<0?(A=m.attributes,x=m.indices,C=S):(A=g.attributes,x=g.indices,C=D),T=bh(A,x,C,f,U<3?E+U:-1,G),tV(R,O,L,G,i,o,s,r,a,c,l,A,d,p,n,T)}}else u(v)&&(N=v.positions[0],_=v.positions[1],b=v.positions[2]),N.y<0?(A=m.attributes,x=m.indices,C=S):(A=g.attributes,x=g.indices,C=D),T=bh(A,x,C,f,E,N),tV(R,O,L,N,i,o,s,r,a,c,l,A,d,p,n,T),T=bh(A,x,C,f,E+1,_),tV(R,O,L,_,i,o,s,r,a,c,l,A,d,p,n,T),T=bh(A,x,C,f,E+2,b),tV(R,O,L,b,i,o,s,r,a,c,l,A,d,p,n,T)}D8(e,m,g)}var w$=cn.fromPointNormal(h.ZERO,h.UNIT_Y),iIe=new h,oIe=new h;function aT(e,t,n,i,o,r,s){if(!u(s))return;let a=h.fromArray(i,e*3,VI);h.equalsEpsilon(a,n,P.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function E$(e){let t=e.geometry,n=t.attributes,i=n.position.values,o=u(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=cT(t),a=cT(t),c,l=r.length,f=[];f.length=i.length/3;let d=[];for(d.length=i.length/3,c=0;c<f.length;++c)f[c]=-1,d[c]=-1;for(c=0;c<l;c+=2){let p=r[c],g=r[c+1],m=h.fromArray(i,p*3,VI),A=h.fromArray(i,g*3,E8),x;Math.abs(m.y)<P.EPSILON6&&(m.y<0?m.y=-P.EPSILON6:m.y=P.EPSILON6),Math.abs(A.y)<P.EPSILON6&&(A.y<0?A.y=-P.EPSILON6:A.y=P.EPSILON6);let C=s.attributes,T=s.indices,E=d,S=a.attributes,D=a.indices,w=f,R=Yi.lineSegmentPlane(m,A,w$,b8);if(u(R)){let O=h.multiplyByScalar(h.UNIT_Y,5*P.EPSILON9,iIe);m.y<0&&(h.negate(O,O),C=a.attributes,T=a.indices,E=f,S=s.attributes,D=s.indices,w=d);let L=h.add(R,O,oIe);x=bh(C,T,E,r,c,m),aT(p,g,m,i,x,C,o),x=bh(C,T,E,r,-1,L),aT(p,g,L,i,x,C,o),h.negate(O,O),h.add(R,O,L),x=bh(S,D,w,r,-1,L),aT(p,g,L,i,x,S,o),x=bh(S,D,w,r,c+1,A),aT(p,g,A,i,x,S,o)}else{let O,L,N;m.y<0?(O=a.attributes,L=a.indices,N=f):(O=s.attributes,L=s.indices,N=d),x=bh(O,L,N,r,c,m),aT(p,g,m,i,x,O,o),x=bh(O,L,N,r,c+1,A),aT(p,g,A,i,x,O,o)}}D8(e,a,s)}var b$=new H,rIe=new H,I$=new h,P$=new h,S8=new h,sIe=new h,aIe=new h,cIe=new h,S$=new oe;function D$(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=h.unpack(n,s,I$);if(a.x>0)continue;let c=h.unpack(i,s,P$);(a.y<0&&c.y>0||a.y>0&&c.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):h.pack(a,i,s));let l=h.unpack(o,s,S8);(a.y<0&&l.y>0||a.y>0&&l.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):h.pack(a,o,s))}}var lIe=5*P.EPSILON9,nV=P.EPSILON6;function uIe(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=u(n.st)?n.st.values:void 0,c=u(n.color)?n.color.values:void 0,l=cT(t),f=cT(t),d,p,g,m=!1,A=i.length/3;for(d=0;d<A;d+=4){let x=d,C=d+2,T=h.fromArray(i,x*3,I$),E=h.fromArray(i,C*3,P$);if(Math.abs(T.y)<nV)for(T.y=nV*(E.y<0?-1:1),i[d*3+1]=T.y,i[(d+1)*3+1]=T.y,p=x*3;p<x*3+4*3;p+=3)o[p]=i[d*3],o[p+1]=i[d*3+1],o[p+2]=i[d*3+2];if(Math.abs(E.y)<nV)for(E.y=nV*(T.y<0?-1:1),i[(d+2)*3+1]=E.y,i[(d+3)*3+1]=E.y,p=x*3;p<x*3+4*3;p+=3)r[p]=i[(d+2)*3],r[p+1]=i[(d+2)*3+1],r[p+2]=i[(d+2)*3+2];let S=l.attributes,D=l.indices,w=f.attributes,R=f.indices,O=Yi.lineSegmentPlane(T,E,w$,sIe);if(u(O)){m=!0;let L=h.multiplyByScalar(h.UNIT_Y,lIe,aIe);T.y<0&&(h.negate(L,L),S=f.attributes,D=f.indices,w=l.attributes,R=l.indices);let N=h.add(O,L,cIe);S.position.values.push(T.x,T.y,T.z,T.x,T.y,T.z),S.position.values.push(N.x,N.y,N.z),S.position.values.push(N.x,N.y,N.z),S.prevPosition.values.push(o[x*3],o[x*3+1],o[x*3+2]),S.prevPosition.values.push(o[x*3+3],o[x*3+4],o[x*3+5]),S.prevPosition.values.push(T.x,T.y,T.z,T.x,T.y,T.z),S.nextPosition.values.push(N.x,N.y,N.z),S.nextPosition.values.push(N.x,N.y,N.z),S.nextPosition.values.push(N.x,N.y,N.z),S.nextPosition.values.push(N.x,N.y,N.z),h.negate(L,L),h.add(O,L,N),w.position.values.push(N.x,N.y,N.z),w.position.values.push(N.x,N.y,N.z),w.position.values.push(E.x,E.y,E.z,E.x,E.y,E.z),w.prevPosition.values.push(N.x,N.y,N.z),w.prevPosition.values.push(N.x,N.y,N.z),w.prevPosition.values.push(N.x,N.y,N.z),w.prevPosition.values.push(N.x,N.y,N.z),w.nextPosition.values.push(E.x,E.y,E.z,E.x,E.y,E.z),w.nextPosition.values.push(r[C*3],r[C*3+1],r[C*3+2]),w.nextPosition.values.push(r[C*3+3],r[C*3+4],r[C*3+5]);let _=H.fromArray(s,x*2,b$),b=Math.abs(_.y);S.expandAndWidth.values.push(-1,b,1,b),S.expandAndWidth.values.push(-1,-b,1,-b),w.expandAndWidth.values.push(-1,b,1,b),w.expandAndWidth.values.push(-1,-b,1,-b);let v=h.magnitudeSquared(h.subtract(O,T,S8));if(v/=h.magnitudeSquared(h.subtract(E,T,S8)),u(c)){let I=oe.fromArray(c,x*4,S$),B=oe.fromArray(c,C*4,S$),F=P.lerp(I.x,B.x,v),k=P.lerp(I.y,B.y,v),U=P.lerp(I.z,B.z,v),G=P.lerp(I.w,B.w,v);for(p=x*4;p<x*4+2*4;++p)S.color.values.push(c[p]);for(S.color.values.push(F,k,U,G),S.color.values.push(F,k,U,G),w.color.values.push(F,k,U,G),w.color.values.push(F,k,U,G),p=C*4;p<C*4+2*4;++p)w.color.values.push(c[p])}if(u(a)){let I=H.fromArray(a,x*2,b$),B=H.fromArray(a,(d+3)*2,rIe),F=P.lerp(I.x,B.x,v);for(p=x*2;p<x*2+2*2;++p)S.st.values.push(a[p]);for(S.st.values.push(F,I.y),S.st.values.push(F,B.y),w.st.values.push(F,I.y),w.st.values.push(F,B.y),p=C*2;p<C*2+2*2;++p)w.st.values.push(a[p])}g=S.position.values.length/3-4,D.push(g,g+2,g+1),D.push(g+1,g+2,g+3),g=w.position.values.length/3-4,R.push(g,g+2,g+1),R.push(g+1,g+2,g+3)}else{let L,N;for(T.y<0?(L=f.attributes,N=f.indices):(L=l.attributes,N=l.indices),L.position.values.push(T.x,T.y,T.z),L.position.values.push(T.x,T.y,T.z),L.position.values.push(E.x,E.y,E.z),L.position.values.push(E.x,E.y,E.z),p=d*3;p<d*3+4*3;++p)L.prevPosition.values.push(o[p]),L.nextPosition.values.push(r[p]);for(p=d*2;p<d*2+4*2;++p)L.expandAndWidth.values.push(s[p]),u(a)&&L.st.values.push(a[p]);if(u(c))for(p=d*4;p<d*4+4*4;++p)L.color.values.push(c[p]);g=L.position.values.length/3-4,N.push(g,g+2,g+1),N.push(g+1,g+2,g+3)}}m&&(D$(f),D$(l)),D8(e,f,l)}Tc.splitLongitude=function(e){let t=e.geometry,n=t.boundingSphere;if(u(n)&&(n.center.x-n.radius>0||se.intersectPlane(n,cn.ORIGIN_ZX_PLANE)!==Qt.INTERSECTING))return e;if(t.geometryType!==Nu.NONE)switch(t.geometryType){case Nu.POLYLINES:uIe(e);break;case Nu.TRIANGLES:T$(e);break;case Nu.LINES:E$(e);break}else Kwe(t),t.primitiveType===Me.TRIANGLES?T$(e):t.primitiveType===Me.LINES&&E$(e);return e};var Ln=Tc;function rl(e){this._ellipsoid=y(e,ie.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(rl.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});rl.mercatorAngleToGeodeticLatitude=function(e){return P.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};rl.geodeticLatitudeToMercatorAngle=function(e){e>rl.MaximumLatitude?e=rl.MaximumLatitude:e<-rl.MaximumLatitude&&(e=-rl.MaximumLatitude);let t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};rl.MaximumLatitude=rl.mercatorAngleToGeodeticLatitude(Math.PI);rl.prototype.project=function(e,t){let n=this._semimajorAxis,i=e.longitude*n,o=rl.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return u(t)?(t.x=i,t.y=o,t.z=r,t):new h(i,o,r)};rl.prototype.unproject=function(e,t){let n=this._oneOverSemimajorAxis,i=e.x*n,o=rl.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return u(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};var Si=rl;function fIe(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(!M.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)u(e[r].geometry)&&Ln.transformToWorldCoordinates(e[r]);else M.multiplyTransformation(t,e[0].modelMatrix,t)}function w8(e,t){let n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});let r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function dIe(e){let t=e.length;for(let n=0;n<t;++n){let i=e[n];u(i.geometry)?w8(i.geometry,n):u(i.westHemisphereGeometry)&&u(i.eastHemisphereGeometry)&&(w8(i.westHemisphereGeometry,n),w8(i.eastHemisphereGeometry,n))}}function hIe(e){let t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix,c,l,f,d=t.length;for(c=0;c<d;++c)if(u(t[c].geometry)){f=t[c].geometry.primitiveType;break}if(fIe(t,a,o),!o)for(c=0;c<d;++c)u(t[c].geometry)&&Ln.splitLongitude(t[c]);if(dIe(t),r)for(c=0;c<d;++c){let g=t[c];u(g.geometry)?(Ln.reorderForPostVertexCache(g.geometry),Ln.reorderForPreVertexCache(g.geometry)):u(g.westHemisphereGeometry)&&u(g.eastHemisphereGeometry)&&(Ln.reorderForPostVertexCache(g.westHemisphereGeometry),Ln.reorderForPreVertexCache(g.westHemisphereGeometry),Ln.reorderForPostVertexCache(g.eastHemisphereGeometry),Ln.reorderForPreVertexCache(g.eastHemisphereGeometry))}let p=Ln.combineInstances(t);for(d=p.length,c=0;c<d;++c){l=p[c];let g=l.attributes;if(o)for(let m in g)g.hasOwnProperty(m)&&g[m].componentDatatype===q.DOUBLE&&Ln.encodeAttribute(l,m,`${m}3DHigh`,`${m}3DLow`);else for(let m in g)if(g.hasOwnProperty(m)&&g[m].componentDatatype===q.DOUBLE){let A=`${m}3D`,x=`${m}2D`;Ln.projectTo2D(l,m,A,x,n),u(l.boundingSphere)&&m==="position"&&(l.boundingSphereCV=se.fromVertices(l.attributes.position2D.values)),Ln.encodeAttribute(l,A,`${A}High`,`${A}Low`),Ln.encodeAttribute(l,x,`${x}High`,`${x}Low`)}s&&Ln.compressVertices(l)}if(!i){let g=[];for(d=p.length,c=0;c<d;++c)l=p[c],g=g.concat(Ln.fitToUnsignedShortIndices(l));p=g}return p}function I8(e,t,n,i){let o,r,s,a=i.length-1;if(a>=0){let l=i[a];o=l.offset+l.count,s=l.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;let c=e.length;for(let l=0;l<c;++l){let d=e[l][t];if(!u(d))continue;let p=d.indices.length;o+p>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:p}),o+=p}}function mIe(e,t){let n=[];return I8(e,"geometry",t,n),I8(e,"westHemisphereGeometry",t,n),I8(e,"eastHemisphereGeometry",t,n),n}var qm={};qm.combineGeometry=function(e){let t,n,i=e.instances,o=i.length,r,s,a=!1;o>0&&(t=hIe(e),t.length>0&&(n=Ln.createAttributeLocations(t[0]),e.createPickOffsets&&(r=mIe(i,t))),u(i[0].attributes)&&u(i[0].attributes.offset)&&(s=new Array(o),a=!0));let c=new Array(o),l=new Array(o);for(let f=0;f<o;++f){let d=i[f],p=d.geometry;u(p)&&(c[f]=p.boundingSphere,l[f]=p.boundingSphereCV,a&&(s[f]=d.geometry.offsetAttribute));let g=d.eastHemisphereGeometry,m=d.westHemisphereGeometry;u(g)&&u(m)&&(u(g.boundingSphere)&&u(m.boundingSphere)&&(c[f]=se.union(g.boundingSphere,m.boundingSphere)),u(g.boundingSphereCV)&&u(m.boundingSphereCV)&&(l[f]=se.union(g.boundingSphereCV,m.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:l}};function pIe(e,t){let n=e.attributes;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];u(o)&&u(o.values)&&t.push(o.values.buffer)}u(e.indices)&&t.push(e.indices.buffer)}function _Ie(e,t){let n=e.length;for(let i=0;i<n;++i)pIe(e[i],t)}function gIe(e){let t=1,n=e.length;for(let i=0;i<n;i++){let o=e[i];if(++t,!u(o))continue;let r=o.attributes;t+=7+2*se.packedLength+(u(o.indices)?o.indices.length:0);for(let s in r)if(r.hasOwnProperty(s)&&u(r[s])){let a=r[s];t+=5+a.values.length}}return t}qm.packCreateGeometryResults=function(e,t){let n=new Float64Array(gIe(e)),i=[],o={},r=e.length,s=0;n[s++]=r;for(let a=0;a<r;a++){let c=e[a],l=u(c);if(n[s++]=l?1:0,!l)continue;n[s++]=c.primitiveType,n[s++]=c.geometryType,n[s++]=y(c.offsetAttribute,-1);let f=u(c.boundingSphere)?1:0;n[s++]=f,f&&se.pack(c.boundingSphere,n,s),s+=se.packedLength;let d=u(c.boundingSphereCV)?1:0;n[s++]=d,d&&se.pack(c.boundingSphereCV,n,s),s+=se.packedLength;let p=c.attributes,g=[];for(let A in p)p.hasOwnProperty(A)&&u(p[A])&&(g.push(A),u(o[A])||(o[A]=i.length,i.push(A)));n[s++]=g.length;for(let A=0;A<g.length;A++){let x=g[A],C=p[x];n[s++]=o[x],n[s++]=C.componentDatatype,n[s++]=C.componentsPerAttribute,n[s++]=C.normalize?1:0,n[s++]=C.values.length,n.set(C.values,s),s+=C.values.length}let m=u(c.indices)?c.indices.length:0;n[s++]=m,m>0&&(n.set(c.indices,s),s+=m)}return t.push(n.buffer),{stringTable:i,packedData:n}};qm.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 c=n[s++],l=n[s++],f=n[s++];f===-1&&(f=void 0);let d,p;n[s++]===1&&(d=se.unpack(n,s)),s+=se.packedLength,n[s++]===1&&(p=se.unpack(n,s)),s+=se.packedLength;let A,x,C,T=new dn,E=n[s++];for(i=0;i<E;i++){let D=t[n[s++]],w=n[s++];C=n[s++];let R=n[s++]!==0;A=n[s++],x=q.createTypedArray(w,A);for(let O=0;O<A;O++)x[O]=n[s++];T[D]=new ve({componentDatatype:w,componentsPerAttribute:C,normalize:R,values:x})}let S;if(A=n[s++],A>0){let D=x.length/C;for(S=Fe.createTypedArray(D,A),i=0;i<A;i++)S[i]=n[s++]}o[r++]=new ct({primitiveType:c,geometryType:l,boundingSphere:d,boundingSphereCV:p,indices:S,attributes:T,offsetAttribute:f})}return o};function yIe(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(M.pack(s.modelMatrix,i,o),o+=M.packedLength,u(s.attributes)&&u(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 AIe(e){let t=e,n=new Array(t[0]),i=0,o=1;for(;o<t.length;){let r=M.unpack(t,o),s;o+=M.packedLength,u(t[o])&&(s={offset:new Wi(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}qm.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:yIe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof Ei,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};qm.unpackCombineGeometryParameters=function(e){let t=AIe(e.packedInstances),n=e.createGeometryResults,i=n.length,o=0;for(let a=0;a<i;a++){let c=qm.unpackCreateGeometryResults(n[a]),l=c.length;for(let f=0;f<l;f++){let d=c[f],p=t[o];p.geometry=d,++o}}let r=ie.clone(e.ellipsoid),s=e.isGeographic?new Ei(r):new Si(r);return{instances:t,ellipsoid:r,projection:s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:M.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}};function O$(e){let t=e.length,n=1+(se.packedLength+1)*t,i=new Float32Array(n),o=0;i[o++]=t;for(let r=0;r<t;++r){let s=e[r];u(s)?(i[o++]=1,se.pack(e[r],i,o)):i[o++]=0,o+=se.packedLength}return i}function R$(e){let t=new Array(e[0]),n=0,i=1;for(;i<e.length;)e[i++]===1&&(t[n]=se.unpack(e,i)),++n,i+=se.packedLength;return t}qm.packCombineGeometryResults=function(e,t){u(e.geometries)&&_Ie(e.geometries,t);let n=O$(e.boundingSpheres),i=O$(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}};qm.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:R$(e.boundingSpheres),boundingSpheresCV:R$(e.boundingSpheresCV)}};var F0=qm;var xIe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},mr=Object.freeze(xIe);var Hl={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};Hl.NUMBER_OF_SHADOW_MODES=4;Hl.castShadows=function(e){return e===Hl.ENABLED||e===Hl.CAST_ONLY};Hl.receiveShadows=function(e){return e===Hl.ENABLED||e===Hl.RECEIVE_ONLY};Hl.fromCastReceive=function(e,t){return e&&t?Hl.ENABLED:e?Hl.CAST_ONLY:t?Hl.RECEIVE_ONLY:Hl.DISABLED};var gn=Object.freeze(Hl);function pr(e){e=y(e,y.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=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=new M,this.show=y(e.show,!0),this._vertexCacheOptimize=y(e.vertexCacheOptimize,!1),this._interleave=y(e.interleave,!1),this._releaseGeometryInstances=y(e.releaseGeometryInstances,!0),this._allowPicking=y(e.allowPicking,!0),this._asynchronous=y(e.asynchronous,!0),this._compressVertices=y(e.compressVertices,!0),this.cull=y(e.cull,!0),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,this.shadows=y(e.shadows,gn.DISABLED),this._translucent=void 0,this._state=mr.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=[],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;let t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoad=(o,r,s)=>{this._error=s,this._state=r,o.afterRender.push(function(){if(t._ready=t._state===mr.COMPLETE||t._state===mr.FAILED,!u(s))return n(t),!0;i(s)})}}),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(pr.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}},readyPromise:{get:function(){return this._readyPromise}}});function CIe(e){let t=e.length,n=[],i=e[0].attributes,o;for(o in i)if(i.hasOwnProperty(o)&&u(i[o])){let r=i[o],s=!0;for(let a=1;a<t;++a){let c=e[a].attributes[o];if(!u(c)||r.componentDatatype!==c.componentDatatype||r.componentsPerAttribute!==c.componentsPerAttribute||r.normalize!==c.normalize){s=!1;break}}s&&n.push(o)}return n}var TIe=new H,EIe=new h,z$=new oe;function H$(e){let t=e.length;if(t===1)return e[0];if(t===2)return H.unpack(e,0,TIe);if(t===3)return h.unpack(e,0,EIe);if(t===4)return oe.unpack(e,0,z$)}function bIe(e,t){let n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;let r=CIe(i),s=r.length,a=[],c={},l={},f,p=i[0].attributes,g,m,A;for(g=0;g<s;++g)m=r[g],A=p[m],c[m]=g,a.push({functionName:`czm_batchTable_${m}`,componentDatatype:A.componentDatatype,componentsPerAttribute:A.componentsPerAttribute,normalize:A.normalize});r.indexOf("distanceDisplayCondition")!==-1&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:q.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:q.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:q.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:q.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:q.FLOAT,componentsPerAttribute:1}),l.center3DHigh=a.length-5,l.center3DLow=a.length-4,l.center2DHigh=a.length-3,l.center2DLow=a.length-2,l.radius=a.length-1),r.indexOf("offset")!==-1&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:q.FLOAT,componentsPerAttribute:3}),f=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});let x=a.length,C=new O0(t,a,o);for(g=0;g<o;++g){let T=i[g];p=T.attributes;for(let R=0;R<s;++R){m=r[R],A=p[m];let O=H$(A.value),L=c[m];C.setBatchedAttribute(g,L,O)}let E={primitive:y(T.pickPrimitive,e)};u(T.id)&&(E.id=T.id);let S=t.createPickId(E);e._pickIds.push(S);let D=S.color,w=z$;w.x=z.floatToByte(D.red),w.y=z.floatToByte(D.green),w.z=z.floatToByte(D.blue),w.w=z.floatToByte(D.alpha),C.setBatchedAttribute(g,x-1,w)}e._batchTable=C,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=l,e._batchTableOffsetAttribute2DIndex=f}function SIe(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 DIe(e){let t=e.attributes,n=new dn;for(let o in t)t.hasOwnProperty(o)&&u(t[o])&&(n[o]=SIe(t[o]));let i;if(u(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:se.clone(e.boundingSphere)})}function vIe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:M.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}var wIe=/in\s+vec(?:3|4)\s+(.*)3DHigh;/g;pr._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=wIe.exec(t))!==null;){let a=i[1],c=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;c!=="vec4 czm_computePosition()"&&(o+=`${c};
`),u(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+=`${c}
{
    return u_modifiedModelView * position;
}

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

`:(r+=`in vec3 ${a}2DHigh;
in vec3 ${a}2DLow;
`,s+=`${c}
{
    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(`
`)};pr._appendShowToShader=function(e,t){return u(e._batchTableAttributeIndices.show)?`${ke.replaceMain(t,"czm_non_show_main")}
void main() 
{ 
    czm_non_show_main(); 
    gl_Position *= czm_batchTable_show(batchId); 
}`:t};pr._updateColorAttribute=function(e,t,n){if(!u(e._batchTableAttributeIndices.color)&&!u(e._batchTableAttributeIndices.depthFailColor)||t.search(/in\s+vec4\s+color;/g)===-1)return t;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 B$(e){return`${ke.replaceMain(e,"czm_non_pick_main")}
out vec4 v_pickColor; 
void main() 
{ 
    czm_non_pick_main(); 
    v_pickColor = czm_batchTable_pickColor(batchId); 
}`}function M$(e){return`in vec4 v_pickColor;
${e}`}pr._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};pr._appendOffsetToShader=function(e,t){if(!u(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};pr._appendDistanceDisplayConditionToShader=function(e,t,n){if(!u(e._batchTableAttributeIndices.distanceDisplayCondition))return t;let i=ke.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 L$(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",c="compressedAttributes",l=`in ${a} ${c};`,f="",d="";if(i){f+=`vec2 st;
`;let m=s>1?`${c}.x`:c;d+=`    st = czm_decompressTextureCoordinates(${m});
`}n&&o&&r?(f+=`vec3 normal;
vec3 tangent;
vec3 bitangent;
`,d+=`    czm_octDecode(${c}.${i?"yz":"xy"}, normal, tangent, bitangent);
`):(n&&(f+=`vec3 normal;
`,d+=`    normal = czm_octDecode(${c}${s>1?`.${i?"y":"x"}`:""});
`),o&&(f+=`vec3 tangent;
`,d+=`    tangent = czm_octDecode(${c}.${i&&n?"z":"y"});
`),r&&(f+=`vec3 bitangent;
`,d+=`    bitangent = czm_octDecode(${c}.${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=ke.replaceMain(p,"czm_non_compressed_main");let g=`void main() 
{ 
${d}    czm_non_compressed_main(); 
}`;return[l,f,p,g].join(`
`)}function IIe(e){let t=ke.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
    czm_non_depth_clamp_main();
    gl_Position = czm_depthClamp(gl_Position);}
`,t}function PIe(e){let t=ke.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 N$(e,t){let n=e.vertexAttributes}function OIe(e,t){return function(){return e[t]}}var P8=Math.max(Vt.hardwareConcurrency-1,1),rV,RIe=new pi("combineGeometry");function BIe(e,t){let n,i,o,r,s=e._instanceIds;if(e._state===mr.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let a=e._numberOfInstances=n.length,c=[],l=[];for(o=0;o<a;++o)i=n[o].geometry,s.push(n[o].id),l.push({moduleName:i._workerName,geometry:i});if(!u(rV))for(rV=new Array(P8),o=0;o<P8;o++)rV[o]=new pi("createGeometry");let f;for(l=RI(l,P8),o=0;o<l.length;o++){let d=0,p=l[o],g=p.length;for(r=0;r<g;++r)f=p[r],i=f.geometry,u(i.constructor.pack)&&(f.offset=d,d+=y(i.constructor.packedLength,i.packedLength));let m;if(d>0){let A=new Float64Array(d);for(m=[A.buffer],r=0;r<g;++r)f=p[r],i=f.geometry,u(i.constructor.pack)&&(i.constructor.pack(i,A,f.offset),f.geometry=A)}c.push(rV[o].scheduleTask({subTasks:l[o]},m))}e._state=mr.CREATING,Promise.all(c).then(function(d){e._createGeometryResults=d,e._state=mr.CREATED}).catch(function(d){kI(e,t,mr.FAILED,d)})}else if(e._state===mr.CREATED){let a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];let c=t.scene3DOnly,l=t.mapProjection,f=RIe.scheduleTask(F0.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:l.ellipsoid,projection:l,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:c,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=mr.COMBINING,Promise.resolve(f).then(function(d){let p=F0.unpackCombineGeometryResults(d);e._geometries=p.geometries,e._attributeLocations=p.attributeLocations,e.modelMatrix=M.clone(p.modelMatrix,e.modelMatrix),e._pickOffsets=p.pickOffsets,e._offsetInstanceExtend=p.offsetInstanceExtend,e._instanceBoundingSpheres=p.boundingSpheres,e._instanceBoundingSpheresCV=p.boundingSpheresCV,u(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=mr.COMBINED):kI(e,t,mr.FAILED,void 0)}).catch(function(d){kI(e,t,mr.FAILED,d)})}}function MIe(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,c=0;for(a=0;a<i;a++){s=n[a];let p=s.geometry,g;u(p.attributes)&&u(p.primitiveType)?g=DIe(p):g=p.constructor.createGeometry(p),o[c++]=vIe(s,g),r.push(s.id)}o.length=c;let l=t.scene3DOnly,f=t.mapProjection,d=F0.combineGeometry({instances:o,ellipsoid:f.ellipsoid,projection:f,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=d.geometries,e._attributeLocations=d.attributeLocations,e.modelMatrix=M.clone(d.modelMatrix,e.modelMatrix),e._pickOffsets=d.pickOffsets,e._offsetInstanceExtend=d.offsetInstanceExtend,e._instanceBoundingSpheres=d.boundingSpheres,e._instanceBoundingSpheresCV=d.boundingSpheresCV,u(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=mr.COMBINED):kI(e,t,mr.FAILED,void 0)}function LIe(e,t){let n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!u(n)){e._recomputeBoundingSpheres=!1;return}let i,o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length,a=e._tempBoundingSpheres;if(!u(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new se;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let A=a[i],x=e._batchTable.getBatchedAttribute(i,n,new h);A=r[i].clone(A),Y$(A,x,o[i])}let c=[],l=[],f=[];for(i=0;i<s;++i){let A=a[i];A.center.x-A.radius>0||se.intersectPlane(A,cn.ORIGIN_ZX_PLANE)!==Qt.INTERSECTING?c.push(A):(l.push(A),f.push(A))}let d=c[0],p=f[0],g=l[0];for(i=1;i<c.length;i++)d=se.union(d,c[i]);for(i=1;i<f.length;i++)p=se.union(p,f[i]);for(i=1;i<l.length;i++)g=se.union(g,l[i]);let m=[];for(u(d)&&m.push(d),u(p)&&m.push(p),u(g)&&m.push(g),i=0;i<m.length;i++){let A=m[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=A,e._boundingSphereCV[i]=se.projectTo2D(A,t.mapProjection,e._boundingSphereCV[i])}pr._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}var F$=new Hn,G$=new he,W$=new h,j$=new se;function NIe(e,t){if(!u(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;let i=e._batchTableBoundingSphereAttributeIndices,o=i.center3DHigh,r=i.center3DLow,s=i.center2DHigh,a=i.center2DLow,c=i.radius,l=t.mapProjection,f=l.ellipsoid,d=e._batchTable,p=e._instanceBoundingSpheres,g=p.length;for(let m=0;m<g;++m){let A=p[m];if(!u(A))continue;let x=e.modelMatrix;u(x)&&(A=se.transform(A,x,j$));let C=A.center,T=A.radius,E=Hn.fromCartesian(C,F$);if(d.setBatchedAttribute(m,o,E.high),d.setBatchedAttribute(m,r,E.low),!t.scene3DOnly){let S=f.cartesianToCartographic(C,G$),D=l.project(S,W$);E=Hn.fromCartesian(D,F$),d.setBatchedAttribute(m,s,E.high),d.setBatchedAttribute(m,a,E.low)}d.setBatchedAttribute(m,c,T)}e._batchTableBoundingSpheresUpdated=!0}var O8=new h,FIe=new h;function V$(e,t){if(!u(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;let i=e._batchTableOffsetAttribute2DIndex,o=t.mapProjection,r=o.ellipsoid,s=e._batchTable,a=e._instanceBoundingSpheres,c=a.length;for(let l=0;l<c;++l){let f=a[l];if(!u(f))continue;let d=s.getBatchedAttribute(l,e._batchTableAttributeIndices.offset);if(h.equals(d,h.ZERO)){s.setBatchedAttribute(l,i,h.ZERO);continue}let p=e.modelMatrix;u(p)&&(f=se.transform(f,p,j$));let g=f.center;g=r.scaleToGeodeticSurface(g,FIe);let m=r.cartesianToCartographic(g,G$),A=o.project(m,W$),x=h.add(d,g,O8);m=r.cartesianToCartographic(x,m);let C=o.project(m,O8),T=h.subtract(C,A,O8),E=T.x;T.x=T.z,T.z=T.y,T.y=E,s.setBatchedAttribute(l,i,T)}e._batchTableOffsetsUpdated=!0}function VIe(e,t){let n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let c=0;c<a;++c){let l=i[c];if(s.push(oi.fromGeometry({context:r,geometry:l,attributeLocations:n,bufferUsage:Ne.STATIC_DRAW,interleave:e._interleave})),u(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,l);else if(e._boundingSpheres.push(se.clone(l.boundingSphere)),e._boundingSphereWC.push(new se),!o){let f=l.boundingSphereCV.center,d=f.x,p=f.y,g=f.z;f.x=g,f.y=d,f.z=p,e._boundingSphereCV.push(se.clone(l.boundingSphereCV)),e._boundingSphere2D.push(new se),e._boundingSphereMorph.push(new se)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,kI(e,t,mr.COMPLETE,void 0)}function UIe(e,t,n,i){let o=n.getRenderState(),r;i?(r=Ge(o,!1),r.cull={enabled:!0,face:gi.BACK},e._frontFaceRS=Ue.fromCache(r),r.cull.face=gi.FRONT,e._backFaceRS=Ue.fromCache(r)):(e._frontFaceRS=Ue.fromCache(o),e._backFaceRS=e._frontFaceRS),r=Ge(o,!1),u(e._depthFailAppearance)&&(r.depthTest.enabled=!1),u(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=Ge(o,!1),r.depthTest.func=Fa.GREATER,i?(r.cull={enabled:!0,face:gi.BACK},e._frontFaceDepthFailRS=Ue.fromCache(r),r.cull.face=gi.FRONT,e._backFaceDepthFailRS=Ue.fromCache(r)):(e._frontFaceDepthFailRS=Ue.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function kIe(e,t,n){let i=t.context,o=e._attributeLocations,r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=pr._appendOffsetToShader(e,r),r=pr._appendShowToShader(e,r),r=pr._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=B$(r),r=pr._updateColorAttribute(e,r,!1),r=L$(e,r),r=pr._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=M$(s),e._sp=Xt.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),N$(e._sp,o),u(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=pr._appendShowToShader(e,r),r=pr._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=B$(r),r=pr._updateColorAttribute(e,r,!0),r=L$(e,r),r=pr._modifyShaderPosition(e,r,t.scene3DOnly),r=IIe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=M$(s),s=PIe(s),e._spDepthFail=Xt.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),N$(e._spDepthFail,o))}var UI=new M,U$=new h;function k$(e,t,n,i){let o=u(n)?n._uniforms:void 0,r={},s=t.uniforms;if(u(s))for(let c in s)s.hasOwnProperty(c)&&(r[c]=OIe(s,c));let a=_t(r,o);return a=e._batchTable.getUniformMapCallback()(a),u(e.rtcCenter)&&(a.u_modifiedModelView=function(){let c=i.context.uniformState.view;return M.multiply(c,e._modelMatrix,UI),M.multiplyByPoint(UI,e.rtcCenter,U$),M.setTranslation(UI,U$,UI),UI}),a}function zIe(e,t,n,i,o,r,s,a){let c=k$(e,t,n,a),l;u(e._depthFailAppearance)&&(l=k$(e,e._depthFailAppearance,e._depthFailAppearance.material,a));let f=i?Ee.TRANSLUCENT:Ee.OPAQUE,d=o?2:1;d*=u(e._depthFailAppearance)?2:1,r.length=e._va.length*d;let p=r.length,g=0;for(let m=0;m<p;++m){let A;o&&(A=r[m],u(A)||(A=r[m]=new tt({owner:e,primitiveType:e._primitiveType})),A.vertexArray=e._va[g],A.renderState=e._backFaceRS,A.shaderProgram=e._sp,A.uniformMap=c,A.pass=f,++m),A=r[m],u(A)||(A=r[m]=new tt({owner:e,primitiveType:e._primitiveType})),A.vertexArray=e._va[g],A.renderState=e._frontFaceRS,A.shaderProgram=e._sp,A.uniformMap=c,A.pass=f,u(e._depthFailAppearance)&&(o&&(++m,A=r[m],u(A)||(A=r[m]=new tt({owner:e,primitiveType:e._primitiveType})),A.vertexArray=e._va[g],A.renderState=e._backFaceDepthFailRS,A.shaderProgram=e._spDepthFail,A.uniformMap=l,A.pass=f),++m,A=r[m],u(A)||(A=r[m]=new tt({owner:e,primitiveType:e._primitiveType})),A.vertexArray=e._va[g],A.renderState=e._frontFaceDepthFailRS,A.shaderProgram=e._spDepthFail,A.uniformMap=l,A.pass=f),++g}}pr._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!M.equals(n,e._modelMatrix))for(M.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],u(s)&&(e._boundingSphereWC[o]=se.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=se.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=se.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));let a=e.appearance.pixelSize;if(u(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];let c=e._boundingSphereWC[o],f=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;c.radius=s.radius+f}};function HIe(e,t,n,i,o,r,s,a){pr._updateBoundingVolumes(e,t,o);let c;t.mode===te.SCENE3D?c=e._boundingSphereWC:t.mode===te.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===te.SCENE2D&&u(e._boundingSphere2D)?c=e._boundingSphere2D:u(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);let l=t.commandList,f=t.passes;if(f.render||f.pick){let d=e.allowPicking,p=gn.castShadows(e.shadows),g=gn.receiveShadows(e.shadows),m=n.length,A=a?2:1;A*=u(e._depthFailAppearance)?2:1;for(let x=0;x<m;++x){let C=Math.floor(x/A),T=n[x];T.modelMatrix=o,T.boundingVolume=c[C],T.cull=r,T.debugShowBoundingVolume=s,T.castShadows=p,T.receiveShadows=g,d?T.pickId="v_pickColor":T.pickId=void 0,l.push(T)}}}pr.prototype.update=function(e){if(!u(this.geometryInstances)&&this._va.length===0||u(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&this.geometryInstances.length===0||!u(this.appearance)||e.mode!==te.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(u(this._error))throw this._error;if(this._state===mr.FAILED)return;let t=e.context;if(u(this._batchTable)||bIe(this,t),this._batchTable.attributes.length>0){if(Ft.maximumVertexTextureImageUnits===0)throw new ue("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!==mr.COMPLETE&&this._state!==mr.COMBINED&&(this.asynchronous?BIe(this,e):MIe(this,e)),this._state===mr.COMBINED&&(NIe(this,e),V$(this,e),VIe(this,e)),!this.show||this._state!==mr.COMPLETE)return;this._batchTableOffsetsUpdated||V$(this,e),this._recomputeBoundingSpheres&&LIe(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=u(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 c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,o=!0),u(this._material)&&this._material.update(t);let l=n.closed&&c;o&&y(this._createRenderStatesFunction,UIe)(this,t,n,l),r&&y(this._createShaderProgramFunction,kIe)(this,e,n),(o||r)&&y(this._createCommandsFunction,zIe)(this,n,i,c,l,this._colorCommands,this._pickCommands,e),y(this._updateAndQueueCommandsFunction,HIe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,l)};var GIe=new se,WIe=new se;function Y$(e,t,n){if(n===nn.TOP){let i=se.clone(e,GIe),o=se.clone(e,WIe);o.center=h.add(o.center,t,o.center),e=se.union(i,o,e)}else n===nn.ALL&&(e.center=h.add(e.center,t,e.center));return e}function jIe(e,t,n){return function(){let i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=q.createTypedArray(o.componentDatatype,r);return u(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function YIe(e,t,n,i,o){return function(r){let s=H$(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}var qIe=new h;function XIe(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(u(i)){i=i.clone();let o=e.modelMatrix,r=t.offset;u(r)&&Y$(i,h.fromArray(r.get(),0,qIe),e._offsetInstanceExtend[n]),u(o)&&(i=se.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function KIe(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}pr.prototype.getGeometryInstanceAttributes=function(e){let t=-1,n=this._lastPerInstanceAttributeIndex,i=this._instanceIds,o=i.length;for(let l=0;l<o;++l){let f=(n+l)%o;if(e===i[f]){t=f;break}}if(t===-1)return;let r=this._perInstanceAttributeCache[t];if(u(r))return r;let s=this._batchTable,a=this._batchTableAttributeIndices;r={};let c={};for(let l in a)if(a.hasOwnProperty(l)){let f=a[l];c[l]={get:jIe(s,t,f),set:YIe(s,t,f,this,l)}}return XIe(this,c,t),KIe(this,c,t),Object.defineProperties(r,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=r,r};pr.prototype.isDestroyed=function(){return!1};pr.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,le(this)};function kI(e,t,n,i){e._completeLoad(t,n,i)}var Dn=pr;function ZIe(e){e=y(e,y.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.value=e.value}var Va=ZIe;var lT=`#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;
    // Sample depths at both offset and negative offset
    float upOrRightLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
    float downOrLeftLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));
    // Explicitly evaluate both paths
    // Necessary for multifrustum and for edges of the screen
    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
    // Treat world coords as a sphere normal for spherical coordinates
    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
    // Unpack planes and transform to eye space
    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
    // When classifying translucent geometry, logDepthOrDepth == 0.0
    // indicates a region that should not be classified, possibly due to there
    // being opaque pixels there in another buffer.
    // Check for logDepthOrDepth != 0.0 to make sure this should be classified.
    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; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource
        czm_writeDepthClamp();
    }
#else // CULL_FRAGMENTS
        out_FragColor.a = 1.0;
#endif // CULL_FRAGMENTS
#else // PICK

#ifdef CULL_FRAGMENTS
    // When classifying translucent geometry, logDepthOrDepth == 0.0
    // indicates a region that should not be classified, possibly due to there
    // being opaque pixels there in another buffer.
    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
    // Compute normal by sampling adjacent pixels in 2x2 block in screen space
    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

    // Premultiply alpha. Required for classification primitives on translucent globe.
    out_FragColor.rgb *= out_FragColor.a;

#else // PER_INSTANCE_COLOR

    // Material support.
    // USES_ is distinct from REQUIRES_, because some things are dependencies of each other or
    // dependencies for culling but might not actually be used by the material.

    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
    // Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired
    // texture coordinate system, which typically forms a tight oriented bounding box around the geometry.
    // Shader is provided a set of reference points for remapping.
    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

    // Premultiply alpha. Required for classification primitives on translucent globe.
    out_FragColor.rgb *= out_FragColor.a;

#endif // PER_INSTANCE_COLOR
    czm_writeDepthClamp();
#endif // PICK
}
`;function Hu(e,t,n){this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};let i=new R8;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;let o=new R8;if(o.requiresTextureCoordinates=e,n instanceof on)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}Hu.prototype.createFragmentShader=function(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 on&&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 on||(o=t.material.shaderSource),new ke({defines:i,sources:[o,lT]})};Hu.prototype.createPickFragmentShader=function(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 ke({defines:n,sources:[lT],pickColorQualifier:"in"})};Hu.prototype.createVertexShader=function(e,t,n,i){return eee(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Hu.prototype.createPickVertexShader=function(e,t,n,i){return eee(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};var q$=new h,X$=new he,K$={high:0,low:0};function eee(e,t,n,i,o,r,s,a){let c=i.slice();if(a.eastMostYhighDefine===""){let l=X$;l.longitude=P.PI,l.latitude=0,l.height=0;let f=s.project(l,q$),d=Hn.encode(f.x,K$);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${d.high.toFixed(`${d.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${d.low.toFixed(`${d.low}`.length+1)}`;let p=X$;p.longitude=-P.PI,p.latitude=0,p.height=0;let g=s.project(p,q$);d=Hn.encode(g.x,K$),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${d.high.toFixed(`${d.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${d.low.toFixed(`${d.low}`.length+1)}`}return n&&(c.push(a.eastMostYhighDefine),c.push(a.eastMostYlowDefine),c.push(a.westMostYhighDefine),c.push(a.westMostYlowDefine)),u(r)&&r instanceof on&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new ke({defines:c,sources:[o]})}function R8(){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(R8.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 Z$(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 JIe=[new H,new H,new H,new H];function tee(e,t){let n=JIe,i=H.unpack(t,0,n[0]),o=H.unpack(t,2,n[1]),r=H.unpack(t,4,n[2]);e.uMaxVmax=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});let s=1/Z$(i,o,r),a=1/Z$(i,r,o);e.uvMinAndExtents=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}var nee=new he,iee=new h,QIe=new h,$Ie=new h,sV={high:0,low:0};function oee(e,t,n){let i=nee;i.height=0,i.longitude=e.west,i.latitude=e.south;let o=t.project(i,iee);i.latitude=e.north;let r=t.project(i,QIe);i.longitude=e.east,i.latitude=e.south;let s=t.project(i,$Ie),a=[0,0,0,0],c=[0,0,0,0],l=Hn.encode(o.x,sV);a[0]=l.high,c[0]=l.low,l=Hn.encode(o.y,sV),a[1]=l.high,c[1]=l.low,l=Hn.encode(r.y,sV),a[2]=l.high,c[2]=l.low,l=Hn.encode(s.x,sV),a[3]=l.high,c[3]=l.low,n.planes2D_HIGH=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}var ePe=new M,tPe=new M,J$=new h,nPe=new he,iPe=[new he,new he,new he,new he,new he,new he,new he,new he];function oPe(e,t,n,i,o,r){let s=ce.center(e,nPe);s.height=n;let a=he.toCartesian(s,t,J$),c=Ot.eastNorthUpToFixedFrame(a,t,ePe),l=M.inverse(c,tPe),f=e.west,d=e.east,p=e.north,g=e.south,m=iPe;m[0].latitude=g,m[0].longitude=f,m[1].latitude=p,m[1].longitude=f,m[2].latitude=p,m[2].longitude=d,m[3].latitude=g,m[3].longitude=d;let A=(f+d)*.5,x=(p+g)*.5;m[4].latitude=g,m[4].longitude=A,m[5].latitude=p,m[5].longitude=A,m[6].latitude=x,m[6].longitude=f,m[7].latitude=x,m[7].longitude=d;let C=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,E=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY;for(let O=0;O<8;O++){m[O].height=n;let L=he.toCartesian(m[O],t,J$);M.multiplyByPoint(l,L,L),L.z=0,C=Math.min(C,L.x),T=Math.max(T,L.x),E=Math.min(E,L.y),S=Math.max(S,L.y)}let D=i;D.x=C,D.y=E,D.z=0,M.multiplyByPoint(c,D,D);let w=o;w.x=T,w.y=E,w.z=0,M.multiplyByPoint(c,w,w),h.subtract(w,D,o);let R=r;R.x=C,R.y=S,R.z=0,M.multiplyByPoint(c,R,R),h.subtract(R,D,r)}var rPe=new h,sPe=new h,aPe=new Hn;Hu.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){let r=iee,s=rPe,a=sPe;oPe(e,n,y(o,0),r,s,a);let c={};tee(c,t);let l=Hn.fromCartesian(r,aPe);return c.southWest_HIGH=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:3,normalize:!1,value:h.pack(l.high,[0,0,0])}),c.southWest_LOW=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:3,normalize:!1,value:h.pack(l.low,[0,0,0])}),c.eastward=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:3,normalize:!1,value:h.pack(s,[0,0,0])}),c.northward=new Va({componentDatatype:q.FLOAT,componentsPerAttribute:3,normalize:!1,value:h.pack(a,[0,0,0])}),oee(e,i,c),c};var cPe=new h;function Q$(e,t,n,i){let o=nee;o.latitude=e,o.longitude=t,o.height=0;let r=he.toCartesian(o,n,cPe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=P.fastApproximateAtan2(s,r.z),c=P.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=c,i}var $$=new H;Hu.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){let o=Q$(e.south,e.west,n,$$),r=o.x,s=o.y,a=Q$(e.north,e.east,n,$$),c=a.x,l=a.y,f=0;s>l&&(f=P.PI-s,s=-P.PI,l+=f),r-=P.EPSILON5,s-=P.EPSILON5,c+=P.EPSILON5,l+=P.EPSILON5;let d=1/(l-s),p=1/(c-r),g={sphericalExtents:new Va({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,p,d]}),longitudeRotation:new Va({componentDatatype:q.FLOAT,componentsPerAttribute:1,normalize:!1,value:[f]})};return tee(g,t),oee(e,i,g),g};Hu.hasAttributesForTextureCoordinatePlanes=function(e){return u(e.southWest_HIGH)&&u(e.southWest_LOW)&&u(e.northward)&&u(e.eastward)&&u(e.planes2D_HIGH)&&u(e.planes2D_LOW)&&u(e.uMaxVmax)&&u(e.uvMinAndExtents)};Hu.hasAttributesForSphericalExtents=function(e){return u(e.sphericalExtents)&&u(e.longitudeRotation)&&u(e.planes2D_HIGH)&&u(e.planes2D_LOW)&&u(e.uMaxVmax)&&u(e.uvMinAndExtents)};function lPe(e){return Math.max(e.width,e.height)>Hu.MAX_WIDTH_FOR_PLANAR_EXTENTS}Hu.shouldUseSphericalCoordinates=function(e){return lPe(e)};Hu.MAX_WIDTH_FOR_PLANAR_EXTENTS=P.toRadians(1);var Gl=Hu;var uPe={NEVER:ee.NEVER,LESS:ee.LESS,EQUAL:ee.EQUAL,LESS_OR_EQUAL:ee.LEQUAL,GREATER:ee.GREATER,NOT_EQUAL:ee.NOTEQUAL,GREATER_OR_EQUAL:ee.GEQUAL,ALWAYS:ee.ALWAYS},kn=Object.freeze(uPe);var fPe={ZERO:ee.ZERO,KEEP:ee.KEEP,REPLACE:ee.REPLACE,INCREMENT:ee.INCR,DECREMENT:ee.DECR,INVERT:ee.INVERT,INCREMENT_WRAP:ee.INCR_WRAP,DECREMENT_WRAP:ee.DECR_WRAP},ut=Object.freeze(fPe);var aV={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};aV.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:kn.ALWAYS,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.REPLACE},backFunction:kn.ALWAYS,backOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.REPLACE},reference:aV.CESIUM_3D_TILE_MASK,mask:aV.CESIUM_3D_TILE_MASK}};var Bt=Object.freeze(aV);function V0(e){e=y(e,y.EMPTY_OBJECT);let t=e.geometryInstances;this.geometryInstances=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Un.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=y(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;let n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);let r=this._error;u(r)?o(r):i(this)}}),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:y(e.vertexCacheOptimize,!1),interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:y(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(V0.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}},readyPromise:{get:function(){return this._readyPromise}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}});V0.isSupported=function(e){return e.context.stencilBuffer};function uT(e,t){let n=t?kn.EQUAL:kn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:ut.KEEP,zFail:ut.DECREMENT_WRAP,zPass:ut.KEEP},backFunction:n,backOperation:{fail:ut.KEEP,zFail:ut.INCREMENT_WRAP,zPass:ut.KEEP},reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Fa.LESS_OR_EQUAL},depthMask:!1}}function M8(e){return{stencilTest:{enabled:e,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND}}var dPe={stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function hPe(e,t,n,i){if(u(e._rsStencilDepthPass))return;let o=!e.debugShowShadowVolume;e._rsStencilDepthPass=Ue.fromCache(uT(o,!1)),e._rsStencilDepthPass3DTiles=Ue.fromCache(uT(o,!0)),e._rsColorPass=Ue.fromCache(M8(o,!1)),e._rsPickPass=Ue.fromCache(dPe)}function mPe(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=ke.replaceMain(s,"czm_non_compressed_main");let a=`void main() 
{ 
${r}    czm_non_compressed_main(); 
}`;return[i,o,s,a].join(`
`)}}function pPe(e,t){let n=t.context,i=e._primitive,o=OI;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Dn._appendDistanceDisplayConditionToShader(i,o),o=Dn._modifyShaderPosition(e,o,t.scene3DOnly),o=Dn._updateColorAttribute(i,o);let r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=mPe(i,o));let a=e._extruded?"EXTRUDED_GEOMETRY":"",c=new ke({defines:[a],sources:[o]}),l=new ke({sources:[eg]}),f=e._primitive._attributeLocations,d=new Gl(s,r,e.appearance);if(e._spStencil=Xt.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:f}),e._primitive.allowPicking){let m=ke.createPickVertexShaderSource(o);m=Dn._appendShowToShader(i,m),m=Dn._updatePickColorAttribute(m);let A=d.createPickFragmentShader(!1),x=d.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=Xt.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:x,fragmentShaderSource:A,attributeLocations:f}),s){let C=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!u(C)){let T=d.createPickFragmentShader(!0),E=d.createPickVertexShader([a],m,!0,t.mapProjection);C=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:E,fragmentShaderSource:T,attributeLocations:f})}e._spPick2D=C}}else e._spPick=Xt.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:f});o=Dn._appendShowToShader(i,o),c=new ke({defines:[a],sources:[o]}),e._sp=Xt.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:f});let p=d.createFragmentShader(!1),g=d.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Xt.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:p,attributeLocations:f}),s){let m=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!u(m)){let A=d.createFragmentShader(!0),x=d.createVertexShader([a],o,!0,t.mapProjection);m=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:x,fragmentShaderSource:A,attributeLocations:f})}e._spColor2D=m}}function _Pe(e,t){let n=e._primitive,i=n._va.length*2;t.length=i;let o,r,s,a=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap),l=e._needs2DShader;for(o=0;o<i;o+=2){let g=n._va[a++];r=t[o],u(r)||(r=t[o]=new tt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Ee.TERRAIN_CLASSIFICATION,s=tt.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],u(r)||(r=t[o+1]=new tt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Ee.TERRAIN_CLASSIFICATION;let A=e.appearance.material;if(u(A)&&(c=_t(c,A._uniforms)),r.uniformMap=c,s=tt.shallowClone(r,r.derivedCommands.tileset),s.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,l){let x=tt.shallowClone(r,r.derivedCommands.appearance2D);x.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=x,x=tt.shallowClone(s,s.derivedCommands.appearance2D),x.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=x}}let f=e._commandsIgnoreShow,d=e._spStencil,p=0;i=f.length=i/2;for(let g=0;g<i;++g){let m=f[g]=tt.shallowClone(t[p],f[g]);m.shaderProgram=d,m.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,p+=2}}function gPe(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 c,l,f,d=0,p=i._batchTable.getUniformMapCallback()(e._uniformMap),g=e._needs2DShader;for(c=0;c<o;c+=2){let m=i._va[d++];if(n&&(a=r[s++],m=i._va[a.index]),l=t[c],u(l)||(l=t[c]=new tt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),l.vertexArray=m,l.renderState=e._rsStencilDepthPass,l.shaderProgram=e._sp,l.uniformMap=p,l.pass=Ee.TERRAIN_CLASSIFICATION,n&&(l.offset=a.offset,l.count=a.count),f=tt.shallowClone(l,l.derivedCommands.tileset),f.renderState=e._rsStencilDepthPass3DTiles,f.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,l.derivedCommands.tileset=f,l=t[c+1],u(l)||(l=t[c+1]=new tt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),l.vertexArray=m,l.renderState=e._rsPickPass,l.shaderProgram=e._spPick,l.uniformMap=p,l.pass=Ee.TERRAIN_CLASSIFICATION,n&&(l.offset=a.offset,l.count=a.count),f=tt.shallowClone(l,l.derivedCommands.tileset),f.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,l.derivedCommands.tileset=f,g){let A=tt.shallowClone(l,l.derivedCommands.pick2D);A.shaderProgram=e._spPick2D,l.derivedCommands.pick2D=A,A=tt.shallowClone(f,f.derivedCommands.pick2D),A.shaderProgram=e._spPick2D,f.derivedCommands.pick2D=A}}}function yPe(e,t,n,i,o,r,s){_Pe(e,r),gPe(e,s)}function ree(e,t){return Math.floor(e%t/2)}function B8(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function see(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function APe(e,t,n,i,o,r,s,a){let c=e._primitive;Dn._updateBoundingVolumes(c,t,o);let l;t.mode===te.SCENE3D?l=c._boundingSphereWC:t.mode===te.COLUMBUS_VIEW?l=c._boundingSphereCV:t.mode===te.SCENE2D&&u(c._boundingSphere2D)?l=c._boundingSphere2D:u(c._boundingSphereMorph)&&(l=c._boundingSphereMorph);let f=e.classificationType,d=f!==Un.CESIUM_3D_TILE,p=f!==Un.TERRAIN,g=t.passes,m,A,x;if(g.render){let C=n.length;for(m=0;m<C;++m)A=l[ree(m,C)],d&&(x=n[m],B8(x,t,o,r,A,s)),p&&(x=n[m].derivedCommands.tileset,B8(x,t,o,r,A,s));if(t.invertClassification){let T=e._commandsIgnoreShow,E=T.length;for(m=0;m<E;++m)A=l[m],x=T[m],B8(x,t,o,r,A,s)}}if(g.pick){let C=i.length,T=c._pickOffsets;for(m=0;m<C;++m){let E=T[ree(m,C)];A=l[E.index],d&&(x=i[m],see(x,t,o,r,A)),p&&(x=i[m].derivedCommands.tileset,see(x,t,o,r,A))}}}V0.prototype.update=function(e){if(!u(this._primitive)&&!u(this.geometryInstances))return;let t=this.appearance;u(t)&&u(t.material)&&t.material.update(e.context);let n=this,i=this._primitiveOptions;if(!u(this._primitive)){let o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s,a,c,l=!1,f=!0,d,p=!1,g=!1;for(r>0&&(c=o[0].attributes,p=Gl.hasAttributesForSphericalExtents(c),g=Gl.hasAttributesForTextureCoordinatePlanes(c),d=c.color),s=0;s<r;s++){a=o[s];let A=a.attributes.color;u(A)&&(l=!0),f=f&&u(A)&&Nt.equals(d,A)}if(!f&&!p&&!g)throw new de("All GeometryInstances must have the same color attribute except via GroundPrimitives");l&&!u(t)&&(t=new on({flat:!0}),this.appearance=t),this._usePickOffsets=!p&&!g,this._hasSphericalExtentsAttribute=p,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=l;let m=new Array(r);for(s=0;s<r;++s)a=o[s],m[s]=new At({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:y(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=m,u(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(A,x){n._createBoundingVolumeFunction(A,x)}),i._createRenderStatesFunction=function(A,x,C,T){hPe(n,x)},i._createShaderProgramFunction=function(A,x,C){pPe(n,x)},i._createCommandsFunction=function(A,x,C,T,E,S,D){yPe(n,void 0,void 0,!0,!1,S,D)},u(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(A,x,C,T,E,S,D,w){n._updateAndQueueCommandsFunction(A,x,C,T,E,S,D,w)}:i._updateAndQueueCommandsFunction=function(A,x,C,T,E,S,D,w){APe(n,x,C,T,E,S,D,w)},this._primitive=new Dn(i)}this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=Ue.fromCache(uT(!1,!1)),this._rsStencilDepthPass3DTiles=Ue.fromCache(uT(!1,!0)),this._rsColorPass=Ue.fromCache(M8(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=Ue.fromCache(uT(!0,!1)),this._rsStencilDepthPass3DTiles=Ue.fromCache(uT(!0,!0)),this._rsColorPass=Ue.fromCache(M8(!0))),this._primitive.appearance!==t&&(this._primitive.appearance=t),this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{u(this._primitive)&&this._primitive.ready&&this._completeLoad()})};V0.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)};V0.prototype.isDestroyed=function(){return!1};V0.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,le(this)};var fT=V0;var xPe={u_globeMinimumAltitude:function(){return 55e3}};function sl(e){e=y(e,y.EMPTY_OBJECT);let t=e.appearance,n=e.geometryInstances;if(!u(t)&&u(n)){let r=Array.isArray(n)?n:[n],s=r.length;for(let a=0;a<s;a++){let c=r[a].attributes;if(u(c)&&u(c.color)){t=new on({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Un.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1;let i=this;this._readyPromise=new Promise((r,s)=>{i._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);let a=this._error;u(a)?s(a):r(this)}}),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=fi._defaultMaxTerrainHeight,this._minTerrainHeight=fi._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;let o=this;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:y(e.vertexCacheOptimize,!1),interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:y(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:o,_extruded:!0,_uniformMap:xPe}}Object.defineProperties(sl.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}},readyPromise:{get:function(){return this._readyPromise}}});sl.isSupported=fT.isSupported;function aee(e){return function(t,n){let i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function cee(e){return function(t,n){return e._minHeight}}var CPe=new h,TPe=new h,EPe=new h,bPe=new he,SPe=new ce;function cV(e,t){let n=e.mapProjection.ellipsoid;if(!u(t.attributes)||!u(t.attributes.position3DHigh))return u(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,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let d=0;d<r;d+=3){let p=h.unpack(i,d,CPe),g=h.unpack(o,d,TPe),m=h.add(p,g,EPe),A=n.cartesianToCartographic(m,bPe),x=A.latitude,C=A.longitude;s=Math.min(s,x),a=Math.min(a,C),c=Math.max(c,x),l=Math.max(l,C)}let f=SPe;return f.north=c,f.south=s,f.east=l,f.west=a,f}function DPe(e,t,n){let i=fi.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function vPe(e,t,n){let i=t.mapProjection.ellipsoid,o=cV(t,n),r=Rn.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){let s=t.mapProjection,a=se.fromRectangleWithHeights2D(o,s,e._maxHeight,e._minHeight);h.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function L8(e,t){return Math.floor(e%t/2)}function N8(e,t,n,i,o,r,s){let a=e._primitive;n.mode!==te.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 lee(e,t,n,i,o,r){let s=e._primitive;n.mode!==te.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 wPe(e,t,n,i,o,r,s,a){let c;t.mode===te.SCENE3D?c=e._boundingVolumes:c=e._boundingVolumes2D;let l=e.classificationType,f=l!==Un.CESIUM_3D_TILE,d=l!==Un.TERRAIN,p=t.passes,g=e._primitive,m,A,x;if(p.render){let C=n.length;for(m=0;m<C;++m)A=c[L8(m,C)],f&&(x=n[m],N8(e,x,t,o,r,A,s)),d&&(x=n[m].derivedCommands.tileset,N8(e,x,t,o,r,A,s));if(t.invertClassification){let T=g._commandsIgnoreShow,E=T.length;for(m=0;m<E;++m)A=c[m],x=T[m],N8(e,x,t,o,r,A,s)}}if(p.pick){let C=i.length,T;for(e._useFragmentCulling||(T=g._primitive._pickOffsets),m=0;m<C;++m){if(A=c[L8(m,C)],!e._useFragmentCulling){let E=T[L8(m,C)];A=c[E.index]}f&&(x=i[m],lee(e,x,t,o,r,A)),d&&(x=i[m].derivedCommands.tileset,lee(e,x,t,o,r,A))}}}sl.initializeTerrainHeights=function(){return fi.initialize()};sl.prototype.update=function(e){if(!u(this._primitive)&&!u(this.geometryInstances))return;if(!fi.initialized){sl.initializeTerrainHeights();return}let t=this,n=this._classificationPrimitiveOptions;if(!u(this._primitive)){let i=e.mapProjection.ellipsoid,o,r,s,a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=a.length,l=new Array(c),f,d;for(f=0;f<c;++f){o=a[f],r=o.geometry;let A=cV(e,r);u(d)?u(A)&&ce.union(d,A,d):d=ce.clone(A);let x=o.id;if(u(x)&&u(A)){let C=fi.getBoundingSphere(A,i);this._boundingSpheresKeys.push(x),this._boundingSpheres.push(C)}s=r.constructor,!u(s)||u(s.createShadowVolume)}DPe(this,d,i);let p=e.terrainExaggeration,g=e.terrainExaggerationRelativeHeight;this._minHeight=Cc.getHeight(this._minTerrainHeight,p,g),this._maxHeight=Cc.getHeight(this._maxTerrainHeight,p,g);let m=sl._supportsMaterials(e.context);if(this._useFragmentCulling=m,m){let A,x=!0;for(f=0;f<c;++f)if(o=a[f],r=o.geometry,d=cV(e,r),Gl.shouldUseSphericalCoordinates(d)){x=!1;break}for(f=0;f<c;++f){o=a[f],r=o.geometry,s=r.constructor;let C=cV(e,r),T=r.textureCoordinateRotationPoints;x?A=Gl.getPlanarTextureCoordinateAttributes(C,T,i,e.mapProjection,this._maxHeight):A=Gl.getSphericalExtentGeometryInstanceAttributes(C,T,i,e.mapProjection);let E=o.attributes;for(let S in E)E.hasOwnProperty(S)&&(A[S]=E[S]);l[f]=new At({geometry:s.createShadowVolume(r,cee(this),aee(this)),attributes:A,id:o.id})}}else for(f=0;f<c;++f)o=a[f],r=o.geometry,s=r.constructor,l[f]=new At({geometry:s.createShadowVolume(r,cee(this),aee(this)),attributes:o.attributes,id:o.id});n.geometryInstances=l,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(A,x){vPe(t,A,x)},n._updateAndQueueCommandsFunction=function(A,x,C,T,E,S,D,w){wPe(t,x,C,T,E,S,D,w)},this._primitive=new fT(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(()=>{u(this._primitive)&&this._primitive.ready&&this._completeLoad()})};sl.prototype.getBoundingSphere=function(e){let t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};sl.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)};sl.prototype.isDestroyed=function(){return!1};sl.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),le(this)};sl._supportsMaterials=function(e){return e.depthTexture};sl.supportsMaterials=function(e){return sl._supportsMaterials(e.frameState.context)};var Ec=sl;function dT(){de.throwInstantiationError()}Object.defineProperties(dT.prototype,{isConstant:{get:de.throwInstantiationError},definitionChanged:{get:de.throwInstantiationError}});dT.prototype.getType=de.throwInstantiationError;dT.prototype.getValue=de.throwInstantiationError;dT.prototype.equals=de.throwInstantiationError;dT.getValue=function(e,t,n){let i;return u(t)&&(i=t.getType(e),u(i))?((!u(n)||n.type!==i)&&(n=Vi.fromType(i)),t.getValue(e,n.uniforms),n):((!u(n)||n.type!==Vi.ColorType)&&(n=Vi.fromType(Vi.ColorType)),z.clone(z.WHITE,n.uniforms.color),n)};var Wo=dT;function U0(e,t,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}U0.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!Y.getValueOrDefault(t.show,n,!0)};U0.prototype._setOptions=de.throwInstantiationError;U0.prototype.update=function(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),c=this._options;if(!u(s.fill)||s.fill.getValue(e)){let l=t.fillMaterialProperty,f=l instanceof Mt,d,p=t._getIsClosed(c);if(f)d=new on({closed:p,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{let g=Wo.getValue(e,l,this._material);this._material=g,d=new oo({material:g,translucent:g.isTranslucent(),closed:p})}if(n)c.vertexFormat=on.VERTEX_FORMAT,this._primitive=o.add(new Ec({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:d,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Y.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=d.vertexFormat;let g=this._geometryUpdater.createFillGeometryInstance(e);f&&(d.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Dn({geometryInstances:g,appearance:d,asynchronous:!1,shadows:a}))}}if(!n&&u(s.outline)&&s.outline.getValue(e)){let l=this._geometryUpdater.createOutlineGeometryInstance(e),f=Y.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Dn({geometryInstances:l,appearance:new on({flat:!0,translucent:l.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(f)}}),asynchronous:!1,shadows:a}))}};U0.prototype.getBoundingSphere=function(e){let t=this._entity,n=this._primitive,i=this._outlinePrimitive,o;return u(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),u(o)&&u(o.boundingSphere))?(se.clone(o.boundingSphere,e),at.DONE):u(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),u(o)&&u(o.boundingSphere))?(se.clone(o.boundingSphere,e),at.DONE):u(n)&&!n.ready||u(i)&&!i.ready?at.PENDING:at.FAILED};U0.prototype.isDestroyed=function(){return!1};U0.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),le(this)};var ri=U0;var IPe={NONE:0,GEODESIC:1,RHUMB:2},Kt=Object.freeze(IPe);var uee=P.EPSILON10;function PPe(e,t,n,i){if(!u(e))return;n=y(n,!1);let o=u(i),r=e.length;if(r<2)return e;let s,a=e[0],c,l,f=0,d=-1;for(s=1;s<r;++s)c=e[s],t(a,c,uee)?(u(l)||(l=e.slice(0,s),f=s-1,d=0),o&&i.push(s)):(u(l)&&(l.push(c),f=s,o&&(d=i.length)),a=c);return n&&t(e[0],e[r-1],uee)&&(o&&(u(l)?i.splice(d,0,f):i.push(r-1)),u(l)?l.length-=1:l=e.slice(0,-1)),u(l)?l:e}var go=PPe;function OPe(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),c=1/Math.sqrt(1+a*a),l=c*a,f=Math.atan2(a,r),d=c*s,p=d*d,g=1-p,m=Math.sqrt(g),A=t/4,x=A*A,C=x*A,T=x*x,E=1+A-3*x/4+5*C/4-175*T/64,S=1-A+15*x/8-35*C/8,D=1-3*A+35*x/4,w=1-5*A,R=E*f-S*Math.sin(2*f)*A/2-D*Math.sin(4*f)*x/16-w*Math.sin(6*f)*C/48-Math.sin(8*f)*5*T/512,O=e._constants;O.a=n,O.b=i,O.f=o,O.cosineHeading=r,O.sineHeading=s,O.tanU=a,O.cosineU=c,O.sineU=l,O.sigma=f,O.sineAlpha=d,O.sineSquaredAlpha=p,O.cosineSquaredAlpha=g,O.cosineAlpha=m,O.u2Over4=A,O.u4Over16=x,O.u6Over64=C,O.u8Over256=T,O.a0=E,O.a1=S,O.a2=D,O.a3=w,O.distanceRatio=R}function RPe(e,t){return e*t*(4+e*(4-3*t))/16}function fee(e,t,n,i,o,r,s){let a=RPe(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function BPe(e,t,n,i,o,r,s){let a=(t-n)/t,c=r-i,l=Math.atan((1-a)*Math.tan(o)),f=Math.atan((1-a)*Math.tan(s)),d=Math.cos(l),p=Math.sin(l),g=Math.cos(f),m=Math.sin(f),A=d*g,x=d*m,C=p*m,T=p*g,E=c,S=P.TWO_PI,D=Math.cos(E),w=Math.sin(E),R,O,L,N,_;do{D=Math.cos(E),w=Math.sin(E);let V=x-T*D;L=Math.sqrt(g*g*w*w+V*V),O=C+A*D,R=Math.atan2(L,O);let X;L===0?(X=0,N=1):(X=A*w/L,N=1-X*X),S=E,_=O-2*C/N,isFinite(_)||(_=0),E=c+fee(a,X,N,R,L,O,_)}while(Math.abs(E-S)>P.EPSILON12);let b=N*(t*t-n*n)/(n*n),v=1+b*(4096+b*(b*(320-175*b)-768))/16384,I=b*(256+b*(b*(74-47*b)-128))/1024,B=_*_,F=I*L*(_+I*(O*(2*B-1)-I*_*(4*L*L-3)*(4*B-3)/6)/4),k=n*v*(R-F),U=Math.atan2(g*w,x-T*D),G=Math.atan2(d*w,x*D-T);e._distance=k,e._startHeading=U,e._endHeading=G,e._uSquared=b}var MPe=new h,F8=new h;function dee(e,t,n,i){let o=h.normalize(i.cartographicToCartesian(t,F8),MPe),r=h.normalize(i.cartographicToCartesian(n,F8),F8);BPe(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,OPe(e)}function zI(e,t,n){let i=y(n,ie.WGS84);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,u(e)&&u(t)&&dee(this,e,t,i)}Object.defineProperties(zI.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return this._startHeading}},endHeading:{get:function(){return this._endHeading}}});zI.prototype.setEndPoints=function(e,t){dee(this,e,t,this._ellipsoid)};zI.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};zI.prototype.interpolateUsingSurfaceDistance=function(e,t){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),c=Math.sin(4*i),l=Math.sin(6*i),f=Math.sin(8*i),d=i*i,p=i*d,g=n.u8Over256,m=n.u2Over4,A=n.u6Over64,x=n.u4Over16,C=2*p*g*o/3+i*(1-m+7*x/4-15*A/4+579*g/64-(x-15*A/4+187*g/16)*o-(5*A/4-115*g/16)*r-29*g*s/16)+(m/2-x+71*A/32-85*g/16)*a+(5*x/16-5*A/4+383*g/96)*c-d*((A-11*g/2)*a+5*g*c/2)+(29*A/96-29*g/16)*l+539*g*f/1536,T=Math.asin(Math.sin(C)*n.cosineAlpha),E=Math.atan(n.a/n.b*Math.tan(T));C=C-n.sigma;let S=Math.cos(2*n.sigma+C),D=Math.sin(C),w=Math.cos(C),R=n.cosineU*w,O=n.sineU*D,N=Math.atan2(D*n.sineHeading,R-O*n.cosineHeading)-fee(n.f,n.sineAlpha,n.cosineSquaredAlpha,C,D,w,S);return u(t)?(t.longitude=this._start.longitude+N,t.latitude=E,t.height=0,t):new he(this._start.longitude+N,E,0)};var Gu=zI;function U8(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,c=a*i,l=n,f=Math.sin(2*l),d=Math.sin(4*l),p=Math.sin(6*l),g=Math.sin(8*l),m=Math.sin(10*l),A=Math.sin(12*l);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*c/1048576)*l-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*c/524288)*f+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*c/8388608)*d-(35*r/3072+175*s/12288+3675*a/262144+13475*c/1048576)*p+(315*s/131072+2205*a/524288+43659*c/8388608)*g-(693*a/1310720+6237*c/5242880)*m+1001*c/8388608*A)}function LPe(e,t,n){let i=e/n;if(t===0)return i;let o=i*i,r=o*i,s=r*i,a=t,c=a*a,l=c*c,f=l*c,d=f*c,p=d*c,g=p*c,m=Math.sin(2*i),A=Math.cos(2*i),x=Math.sin(4*i),C=Math.cos(4*i),T=Math.sin(6*i),E=Math.cos(6*i),S=Math.sin(8*i),D=Math.cos(8*i),w=Math.sin(10*i),R=Math.cos(10*i),O=Math.sin(12*i);return i+i*c/4+7*i*l/64+15*i*f/256+579*i*d/16384+1515*i*p/65536+16837*i*g/1048576+(3*i*l/16+45*i*f/256-i*(32*o-561)*d/4096-i*(232*o-1677)*p/16384+i*(399985-90560*o+512*s)*g/5242880)*A+(21*i*f/256+483*i*d/4096-i*(224*o-1969)*p/16384-i*(33152*o-112599)*g/1048576)*C+(151*i*d/4096+4681*i*p/65536+1479*i*g/16384-453*r*g/32768)*E+(1097*i*p/65536+42783*i*g/1048576)*D+8011*i*g/1048576*R+(3*c/8+3*l/16+213*f/2048-3*o*f/64+255*d/4096-33*o*d/512+20861*p/524288-33*o*p/512+s*p/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*m+(21*l/256+21*f/256+533*d/8192-21*o*d/512+197*p/4096-315*o*p/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*x+(151*f/6144+151*d/4096+5019*p/131072-453*o*p/16384+26965*g/786432-8607*o*g/131072)*T+(1097*d/131072+1097*p/65536+225797*g/10485760-1097*o*g/65536)*S+(8011*p/2621440+8011*g/1048576)*w+293393*g/251658240*O}function hT(e,t){if(e===0)return Math.log(Math.tan(.5*(P.PI_OVER_TWO+t)));let n=e*Math.sin(t);return Math.log(Math.tan(.5*(P.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function NPe(e,t,n,i,o){let r=hT(e._ellipticity,n),s=hT(e._ellipticity,o);return Math.atan2(P.negativePiToPi(i-t),s-r)}function FPe(e,t,n,i,o,r,s){let a=e._heading,c=r-i,l=0;if(P.equalsEpsilon(Math.abs(a),P.PI_OVER_TWO,P.EPSILON8))if(t===n)l=t*Math.cos(o)*P.negativePiToPi(c);else{let f=Math.sin(o);l=t*Math.cos(o)*P.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*f*f)}else{let f=U8(e._ellipticity,t,o);l=(U8(e._ellipticity,t,s)-f)/Math.cos(a)}return Math.abs(l)}var VPe=new h,V8=new h;function hee(e,t,n,i){let o=h.normalize(i.cartographicToCartesian(t,V8),VPe),r=h.normalize(i.cartographicToCartesian(n,V8),V8),s=i.maximumRadius,a=i.minimumRadius,c=s*s,l=a*a;e._ellipticitySquared=(c-l)/c,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=NPe(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=FPe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function mee(e,t,n,i,o,r){if(n===0)return he.clone(e,r);let s=o*o,a,c,l;if(Math.abs(P.PI_OVER_TWO-Math.abs(t))>P.EPSILON8){let f=U8(o,i,e.latitude),d=n*Math.cos(t),p=f+d;c=LPe(p,o,i);let g=hT(o,e.latitude),m=hT(o,c);l=Math.tan(t)*(m-g),a=P.negativePiToPi(e.longitude+l)}else{c=e.latitude;let f;if(o===0)f=i*Math.cos(e.latitude);else{let d=Math.sin(e.latitude);f=i*Math.cos(e.latitude)/Math.sqrt(1-s*d*d)}l=n/f,t>0?a=P.negativePiToPi(e.longitude+l):a=P.negativePiToPi(e.longitude-l)}return u(r)?(r.longitude=a,r.latitude=c,r.height=0,r):new he(a,c,0)}function Xm(e,t,n){let i=y(n,ie.WGS84);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,u(e)&&u(t)&&hee(this,e,t,i)}Object.defineProperties(Xm.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return this._heading}}});Xm.fromStartHeadingDistance=function(e,t,n,i,o){let r=y(i,ie.WGS84),s=r.maximumRadius,a=r.minimumRadius,c=s*s,l=a*a,f=Math.sqrt((c-l)/c);t=P.negativePiToPi(t);let d=mee(e,t,n,r.maximumRadius,f);return!u(o)||u(i)&&!i.equals(o.ellipsoid)?new Xm(e,d,r):(o.setEndPoints(e,d),o)};Xm.prototype.setEndPoints=function(e,t){hee(this,e,t,this._ellipsoid)};Xm.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};Xm.prototype.interpolateUsingSurfaceDistance=function(e,t){return mee(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};Xm.prototype.findIntersectionWithLongitude=function(e,t){let n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=P.negativePiToPi(e),P.equalsEpsilon(Math.abs(e),Math.PI,P.EPSILON14)&&(e=P.sign(r.longitude)*Math.PI),u(t)||(t=new he),Math.abs(P.PI_OVER_TWO-o)<=P.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(P.equalsEpsilon(Math.abs(P.PI_OVER_TWO-o),P.PI_OVER_TWO,P.EPSILON8))return P.equalsEpsilon(e,r.longitude,P.EPSILON12)?void 0:(t.longitude=e,t.latitude=P.PI_OVER_TWO*P.sign(P.PI_OVER_TWO-i),t.height=0,t);let s=r.latitude,a=n*Math.sin(s),c=Math.tan(.5*(P.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),l=(1+a)/(1-a),f=r.latitude,d;do{d=f;let p=n*Math.sin(d),g=(1+p)/(1-p);f=2*Math.atan(c*Math.pow(g/l,n/2))-P.PI_OVER_TWO}while(!P.equalsEpsilon(f,d,P.EPSILON12));return t.longitude=e,t.latitude=f,t.height=0,t};Xm.prototype.findIntersectionWithLatitude=function(e,t){let n=this._ellipticity,i=this._heading,o=this._start;if(P.equalsEpsilon(Math.abs(i),P.PI_OVER_TWO,P.EPSILON8))return;let r=hT(n,o.latitude),s=hT(n,e),a=Math.tan(i)*(s-r),c=P.negativePiToPi(o.longitude+a);return u(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new he(c,e,0)};var la=Xm;var q8=[Ei,Si],UPe=q8.length,Mee=Math.cos(P.toRadians(30)),pee=Math.cos(P.toRadians(150)),Lee=0,Nee=1e3;function ig(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions;this.width=y(e.width,1),this._positions=t,this.granularity=y(e.granularity,9999),this.loop=y(e.loop,!1),this.arcType=y(e.arcType,Kt.GEODESIC),this._ellipsoid=ie.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ig.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+ie.packedLength+1+1}}});ig.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<UPe;i++)if(t instanceof q8[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};var kPe=new h,_ee=new h,gee=new h;function Y8(e,t,n,i,o){let r=bc(i,e,0,kPe),s=bc(i,e,n,_ee),a=bc(i,t,0,gee),c=Km(s,r,_ee),l=Km(a,r,gee);return h.cross(l,c,o),h.normalize(o,o)}var zPe=new he,HPe=new h,GPe=new h,WPe=new h;function k8(e,t,n,i,o,r,s,a,c,l,f){if(o===0)return;let d;r===Kt.GEODESIC?d=new Gu(e,t,s):r===Kt.RHUMB&&(d=new la(e,t,s));let p=d.surfaceDistance;if(p<o)return;let g=Y8(e,t,i,s,WPe),m=Math.ceil(p/o),A=p/m,x=A,C=m-1,T=a.length;for(let E=0;E<C;E++){let S=d.interpolateUsingSurfaceDistance(x,zPe),D=bc(s,S,n,HPe),w=bc(s,S,i,GPe);h.pack(g,a,T),h.pack(D,c,T),h.pack(w,l,T),f.push(S.latitude),f.push(S.longitude),T+=3,x+=A}}var z8=new he;function bc(e,t,n,i){return he.clone(t,z8),z8.height=n,he.toCartesian(z8,e,i)}ig.pack=function(e,t,n){let i=y(n,0),o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){let a=o[s];h.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};ig.unpack=function(e,t,n){let i=y(t,0),o=e[i++],r=new Array(o);for(let p=0;p<o;p++)r[p]=h.unpack(e,i),i+=3;let s=e[i++],a=e[i++]===1,c=e[i++],l=ie.unpack(e,i);i+=ie.packedLength;let f=e[i++],d=e[i++]===1;return u(n)||(n=new ig({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=c,n._ellipsoid=l,n._projectionIndex=f,n._scene3DOnly=d,n};function Km(e,t,n){return h.subtract(e,t,n),h.normalize(n,n),n}function yee(e,t,n,i){return i=Km(e,t,i),i=h.cross(i,n,i),i=h.normalize(i,i),i=h.cross(n,i,i),i}var jPe=new h,YPe=new h,qPe=new h,Fee=new h,XPe=0,KPe=-1;function H8(e,t,n,i,o){let r=Km(n,t,Fee),s=yee(e,t,r,jPe),a=yee(i,t,r,YPe);if(P.equalsEpsilon(h.dot(s,a),KPe,P.EPSILON5))return o=h.cross(r,s,o),o=h.normalize(o,o),o;o=h.add(a,s,o),o=h.normalize(o,o);let c=h.cross(r,o,qPe);return h.dot(a,c)<XPe&&(o=h.negate(o,o)),o}var dV=cn.fromPointNormal(h.ZERO,h.UNIT_Y),ZPe=new h,JPe=new h,QPe=new h,$Pe=new h,e1e=new h,lV=new h,uV=new he,Aee=new he,xee=new he;ig.createGeometry=function(e){let t=!e._scene3DOnly,n=e.loop,i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new q8[e._projectionIndex](i),a=Lee,c=Nee,l,f,d=e._positions,p=d.length;p===2&&(n=!1);let g,m,A,x,C=new la(void 0,void 0,i),T,E,S,D=[d[0]];for(f=0;f<p-1;f++)g=d[f],m=d[f+1],T=Yi.lineSegmentPlane(g,m,dV,lV),u(T)&&!h.equalsEpsilon(T,g,P.EPSILON7)&&!h.equalsEpsilon(T,m,P.EPSILON7)&&(e.arcType===Kt.GEODESIC?D.push(h.clone(T)):e.arcType===Kt.RHUMB&&(S=i.cartesianToCartographic(T,uV).longitude,A=i.cartesianToCartographic(g,uV),x=i.cartesianToCartographic(m,Aee),C.setEndPoints(A,x),E=C.findIntersectionWithLongitude(S,xee),T=i.cartographicToCartesian(E,lV),u(T)&&!h.equalsEpsilon(T,g,P.EPSILON7)&&!h.equalsEpsilon(T,m,P.EPSILON7)&&D.push(h.clone(T)))),D.push(m);n&&(g=d[p-1],m=d[0],T=Yi.lineSegmentPlane(g,m,dV,lV),u(T)&&!h.equalsEpsilon(T,g,P.EPSILON7)&&!h.equalsEpsilon(T,m,P.EPSILON7)&&(e.arcType===Kt.GEODESIC?D.push(h.clone(T)):e.arcType===Kt.RHUMB&&(S=i.cartesianToCartographic(T,uV).longitude,A=i.cartesianToCartographic(g,uV),x=i.cartesianToCartographic(m,Aee),C.setEndPoints(A,x),E=C.findIntersectionWithLongitude(S,xee),T=i.cartographicToCartesian(E,lV),u(T)&&!h.equalsEpsilon(T,g,P.EPSILON7)&&!h.equalsEpsilon(T,m,P.EPSILON7)&&D.push(h.clone(T)))));let w=D.length,R=new Array(w);for(f=0;f<w;f++){let j=he.fromCartesian(D[f],i);j.height=0,R[f]=j}if(R=go(R,he.equalsEpsilon),w=R.length,w<2)return;let O=[],L=[],N=[],_=[],b=ZPe,v=JPe,I=QPe,B=$Pe,F=e1e,k=R[0],U=R[1],G=R[w-1];for(b=bc(i,G,a,b),B=bc(i,U,a,B),v=bc(i,k,a,v),I=bc(i,k,c,I),n?F=H8(b,v,I,B,F):F=Y8(k,U,c,i,F),h.pack(F,L,0),h.pack(v,N,0),h.pack(I,_,0),O.push(k.latitude),O.push(k.longitude),k8(k,U,a,c,o,r,i,L,N,_,O),f=1;f<w-1;++f){b=h.clone(v,b),v=h.clone(B,v);let j=R[f];bc(i,j,c,I),bc(i,R[f+1],a,B),H8(b,v,I,B,F),l=L.length,h.pack(F,L,l),h.pack(v,N,l),h.pack(I,_,l),O.push(j.latitude),O.push(j.longitude),k8(R[f],R[f+1],a,c,o,r,i,L,N,_,O)}let V=R[w-1],X=R[w-2];if(v=bc(i,V,a,v),I=bc(i,V,c,I),n){let j=R[0];b=bc(i,X,a,b),B=bc(i,j,a,B),F=H8(b,v,I,B,F)}else F=Y8(X,V,c,i,F);if(l=L.length,h.pack(F,L,l),h.pack(v,N,l),h.pack(I,_,l),O.push(V.latitude),O.push(V.longitude),n){for(k8(V,k,a,c,o,r,i,L,N,_,O),l=L.length,f=0;f<3;++f)L[l+f]=L[f],N[l+f]=N[f],_[l+f]=_[f];O.push(k.latitude),O.push(k.longitude)}return D1e(n,s,N,_,L,O,t)};var t1e=new h,n1e=new Z,i1e=new Le;function Cee(e,t,n,i){let o=Km(n,t,t1e),r=h.dot(o,e);if(r>Mee||r<pee){let s=Km(i,n,Fee),a=r<pee?P.PI_OVER_TWO:-P.PI_OVER_TWO,c=Le.fromAxisAngle(s,a,i1e),l=Z.fromQuaternion(c,n1e);return Z.multiplyByVector(l,e,e),!0}return!1}var Tee=new he,o1e=new h,Eee=new h;function HI(e,t,n,i,o){let r=he.toCartesian(t,e._ellipsoid,o1e),s=h.add(r,n,Eee),a=!1,c=e._ellipsoid,l=c.cartesianToCartographic(s,Tee);Math.abs(t.longitude-l.longitude)>P.PI_OVER_TWO&&(a=!0,s=h.subtract(r,n,Eee),l=c.cartesianToCartographic(s,Tee)),l.height=0;let f=e.project(l,o);return o=h.subtract(f,i,o),o.z=0,o=h.normalize(o,o),a&&h.negate(o,o),o}var r1e=new h,bee=new h;function See(e,t,n,i,o,r){let s=h.subtract(t,e,r1e);h.normalize(s,s);let a=n-Lee,c=h.multiplyByScalar(s,a,bee);h.add(e,c,o);let l=i-Nee;c=h.multiplyByScalar(s,l,bee),h.add(t,c,r)}var s1e=new h;function fV(e,t){let n=cn.getPointDistance(dV,e),i=cn.getPointDistance(dV,t),o=s1e;P.equalsEpsilon(n,0,P.EPSILON2)?(o=Km(t,e,o),h.multiplyByScalar(o,P.EPSILON2,o),h.add(e,o,e)):P.equalsEpsilon(i,0,P.EPSILON2)&&(o=Km(e,t,o),h.multiplyByScalar(o,P.EPSILON2,o),h.add(t,o,t))}function a1e(e,t){let n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(P.equalsEpsilon(n,P.PI,P.EPSILON11)){let o=P.sign(t.longitude);return e.longitude=o*(n-P.EPSILON11),1}else if(P.equalsEpsilon(i,P.PI,P.EPSILON11)){let o=P.sign(e.longitude);return t.longitude=o*(i-P.EPSILON11),2}return 0}var Vee=new he,Uee=new he,Dee=new h,G8=new h,vee=new h,wee=new h,c1e=new h,Iee=new h,l1e=[Vee,Uee],u1e=new ce,f1e=new h,d1e=new h,h1e=new h,m1e=new h,p1e=new h,_1e=new h,W8=new h,j8=new h,g1e=new h,y1e=new h,A1e=new h,Pee=new h,x1e=new h,C1e=new h,T1e=new Hn,E1e=new Hn,Oee=new h,b1e=new h,Ree=new h,S1e=[new se,new se],kee=[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],Bee=kee.length;function D1e(e,t,n,i,o,r,s){let a,c,l=t._ellipsoid,f=n.length/3-1,d=f*8,p=d*4,g=f*36,m=d>65535?new Uint32Array(g):new Uint16Array(g),A=new Float64Array(d*3),x=new Float32Array(p),C=new Float32Array(p),T=new Float32Array(p),E=new Float32Array(p),S=new Float32Array(p),D,w,R,O;s&&(D=new Float32Array(p),w=new Float32Array(p),R=new Float32Array(p),O=new Float32Array(d*2));let L=r.length/2,N=0,_=Vee;_.height=0;let b=Uee;b.height=0;let v=Dee,I=G8;if(s)for(c=0,a=1;a<L;a++)_.latitude=r[c],_.longitude=r[c+1],b.latitude=r[c+2],b.longitude=r[c+3],v=t.project(_,v),I=t.project(b,I),N+=h.distance(v,I),c+=2;let B=i.length/3;I=h.unpack(i,0,I);let F=0;for(c=3,a=1;a<B;a++)v=h.clone(I,v),I=h.unpack(i,c,I),F+=h.distance(v,I),c+=3;let k;c=3;let U=0,G=0,V=0,X=0,j=!1,Q=h.unpack(n,0,wee),W=h.unpack(i,0,G8),K=h.unpack(o,0,Iee);if(e){let we=h.unpack(n,n.length-6,vee);Cee(K,we,Q,W)&&(K=h.negate(K,K))}let J=0,_e=0,xe=0;for(a=0;a<f;a++){let we=h.clone(Q,vee),Ve=h.clone(W,Dee),qe=h.clone(K,c1e);j&&(qe=h.negate(qe,qe)),Q=h.unpack(n,c,wee),W=h.unpack(i,c,G8),K=h.unpack(o,c,Iee),j=Cee(K,we,Q,W),_.latitude=r[U],_.longitude=r[U+1],b.latitude=r[U+2],b.longitude=r[U+3];let mt,Ht,fn,dt;if(s){let Oi=a1e(_,b);mt=t.project(_,p1e),Ht=t.project(b,_1e);let Ar=Km(Ht,mt,Oee);Ar.y=Math.abs(Ar.y),fn=W8,dt=j8,Oi===0||h.dot(Ar,h.UNIT_Y)>Mee?(fn=HI(t,_,qe,mt,W8),dt=HI(t,b,K,Ht,j8)):Oi===1?(dt=HI(t,b,K,Ht,j8),fn.x=0,fn.y=P.sign(_.longitude-Math.abs(b.longitude)),fn.z=0):(fn=HI(t,_,qe,mt,W8),dt.x=0,dt.y=P.sign(_.longitude-b.longitude),dt.z=0)}let Tn=h.distance(Ve,W),Jn=Hn.fromCartesian(we,T1e),Gt=h.subtract(Q,we,g1e),Je=h.normalize(Gt,Pee),pe=h.subtract(Ve,we,y1e);pe=h.normalize(pe,pe);let me=h.cross(Je,pe,Pee);me=h.normalize(me,me);let be=h.cross(pe,qe,x1e);be=h.normalize(be,be);let St=h.subtract(W,Q,A1e);St=h.normalize(St,St);let qt=h.cross(K,St,C1e);qt=h.normalize(qt,qt);let Kn=Tn/F,Ro=J/F,Uo=0,Ao,Yr,Be,it=0,Ke=0;if(s){Uo=h.distance(mt,Ht),Ao=Hn.fromCartesian(mt,E1e),Yr=h.subtract(Ht,mt,Oee),Be=h.normalize(Yr,b1e);let Oi=Be.x;Be.x=Be.y,Be.y=-Oi,it=Uo/N,Ke=_e/N}for(k=0;k<8;k++){let Oi=X+k*4,Ar=G+k*2,Mn=Oi+3,Yn=k<4?1:-1,Zn=k===2||k===3||k===6||k===7?1:-1;h.pack(Jn.high,x,Oi),x[Mn]=Gt.x,h.pack(Jn.low,C,Oi),C[Mn]=Gt.y,h.pack(be,T,Oi),T[Mn]=Gt.z,h.pack(qt,E,Oi),E[Mn]=Kn*Yn,h.pack(me,S,Oi);let ti=Ro*Zn;ti===0&&Zn<0&&(ti=9),S[Mn]=ti,s&&(D[Oi]=Ao.high.x,D[Oi+1]=Ao.high.y,D[Oi+2]=Ao.low.x,D[Oi+3]=Ao.low.y,R[Oi]=-fn.y,R[Oi+1]=fn.x,R[Oi+2]=dt.y,R[Oi+3]=-dt.x,w[Oi]=Yr.x,w[Oi+1]=Yr.y,w[Oi+2]=Be.x,w[Oi+3]=Be.y,O[Ar]=it*Yn,ti=Ke*Zn,ti===0&&Zn<0&&(ti=9),O[Ar+1]=ti)}let Ze=h1e,ft=m1e,Lt=f1e,En=d1e,so=ce.fromCartographicArray(l1e,u1e),So=fi.getMinimumMaximumHeights(so,l),ns=So.minimumTerrainHeight,Nr=So.maximumTerrainHeight;xe+=ns,xe+=Nr,See(we,Ve,ns,Nr,Ze,Lt),See(Q,W,ns,Nr,ft,En);let Hi=h.multiplyByScalar(me,P.EPSILON5,Ree);h.add(Ze,Hi,Ze),h.add(ft,Hi,ft),h.add(Lt,Hi,Lt),h.add(En,Hi,En),fV(Ze,ft),fV(Lt,En),h.pack(Ze,A,V),h.pack(ft,A,V+3),h.pack(En,A,V+6),h.pack(Lt,A,V+9),Hi=h.multiplyByScalar(me,-2*P.EPSILON5,Ree),h.add(Ze,Hi,Ze),h.add(ft,Hi,ft),h.add(Lt,Hi,Lt),h.add(En,Hi,En),fV(Ze,ft),fV(Lt,En),h.pack(Ze,A,V+12),h.pack(ft,A,V+15),h.pack(En,A,V+18),h.pack(Lt,A,V+21),U+=2,c+=3,G+=16,V+=24,X+=32,J+=Tn,_e+=Uo}c=0;let re=0;for(a=0;a<f;a++){for(k=0;k<Bee;k++)m[c+k]=kee[k]+re;re+=8,c+=Bee}let ye=S1e;se.fromVertices(n,h.ZERO,3,ye[0]),se.fromVertices(i,h.ZERO,3,ye[1]);let fe=se.fromBoundingSpheres(ye);fe.radius+=xe/(f*2);let Se={position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,normalize:!1,values:A}),startHiAndForwardOffsetX:ng(x),startLoAndForwardOffsetY:ng(C),startNormalAndForwardOffsetZ:ng(T),endNormalAndTextureCoordinateNormalizationX:ng(E),rightNormalAndTextureCoordinateNormalizationY:ng(S)};return s&&(Se.startHiLo2D=ng(D),Se.offsetAndRight2D=ng(w),Se.startEndNormals2D=ng(R),Se.texcoordNormalization2D=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,normalize:!1,values:O})),new ct({attributes:Se,indices:m,boundingSphere:fe})}function ng(e){return new ve({componentDatatype:q.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}ig._projectNormal=HI;var k0=ig;var GI=`in vec4 v_startPlaneNormalEcAndHalfWidth;
in vec4 v_endPlaneNormalEcAndBatchId;
in vec4 v_rightPlaneEC; // Technically can compute distance for this here
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);

    // Discard for sky
    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);
    // Check distance of the eye coordinate against the right-facing plane
    float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);

    // Check eye coordinate against the mitering planes
    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
    }

    // Check distance of the eye coordinate against start and end planes with normals in the right plane.
    // For computing unskewed lengthwise texture coordinate.
    // Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking.

    // aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward"
    vec3 alignedPlaneNormal;

    // start aligned plane
    alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);
    alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
    distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);

    // end aligned plane
    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
    // Clamp - distance to aligned planes may be negative due to mitering,
    // so fragment texture coordinate might be out-of-bounds.
    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

    // Premultiply alpha. Required for classification primitives on translucent globe.
    out_FragColor.rgb *= out_FragColor.a;

    czm_writeDepthClamp();
}
`;var WI=`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) {
    // We don't expect the ray to ever be parallel to the plane
    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
    // Use distances for planes aligned with segment to prevent skew in dashing
    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);

    // Clamp - distance to aligned planes may be negative due to mitering
    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 jI=`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;

// For materials
#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

// Morphing planes using SLERP or NLERP doesn't seem to work, so instead draw the material directly on the shadow volume.
// Morph views are from very far away and aren't meant to be used precisely, so this should be sufficient.
void main()
{
    v_batchId = batchId;

    // Start position
    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;

    // Start plane
    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);

    // Right plane
    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);

    // End position
    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));

    // End plane
    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);

    // Forward direction
    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
    // For computing texture coordinates

    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

    // Compute a normal along which to "push" the position out, extending the miter depending on view distance.
    // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
    // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
    // Since this is morphing, compute both 3D and 2D positions and then blend.

    // ****** 3D ******
    // Check distance to the end plane and start plane, pick the plane that is closer
    vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition
    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)); // Points "up" for start plane, "down" at end plane.
    vec3 normalEC = normalize(cross(planeDirection, upOrDown));         // In practice, the opposite seems to work too.

    // Nudge the top vertex upwards to prevent flickering
    vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
    geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
    geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
    positionEc3D.xyz += geodeticSurfaceNormal;

    // Determine if this vertex is on the "left" or "right"
    normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);

    // A "perfect" implementation would push along normals according to the angle against forward.
    // In practice, just pushing the normal out by halfWidth is sufficient for morph views.
    positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)

    // ****** 2D ******
    // Check distance to the end plane and start plane, pick the plane that is closer
    vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition
    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)); // Points "up" for start plane, "down" at end plane.
    normalEC = normalize(cross(planeDirection, upOrDown));         // In practice, the opposite seems to work too.

    // Nudge the top vertex upwards to prevent flickering
    geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
    geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
    geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
    positionEc2D.xyz += geodeticSurfaceNormal;

    // Determine if this vertex is on the "left" or "right"
    normalEC *= sign(texcoordNormalization2D.x);
#ifndef PER_INSTANCE_COLOR
    // Use vertex's sidedness to compute its texture coordinate.
    v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
#endif

    // A "perfect" implementation would push along normals according to the angle against forward.
    // In practice, just pushing the normal out by halfWidth is sufficient for morph views.
    positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)

    // Blend for actual position
    gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);

#ifdef ANGLE_VARYING
    // Approximate relative screen space direction of the line.
    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 YI=`in vec3 position3DHigh;
in vec3 position3DLow;

// In 2D and in 3D, texture coordinate normalization component signs encodes:
// * X sign - sidedness relative to right plane
// * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume
#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;

// For materials
#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);

    // Right plane
    v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
    v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);

    // start plane
    vec4 startPlaneEC;
    startPlaneEC.xyz =  czm_normal * vec3(0.0, startEndNormals2D.xy);
    startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);

    // end plane
    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);

    // start plane
    vec4 startPlaneEC;
    startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
    startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);

    // end plane
    vec4 endPlaneEC;
    endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
    endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);

    // Right plane
    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

    // Compute a normal along which to "push" the position out, extending the miter depending on view distance.
    // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
    // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
    vec4 positionRelativeToEye = czm_computePosition();

    // Check distance to the end plane and start plane, pick the plane that is closer
    vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition
    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)); // Points "up" for start plane, "down" at end plane.
    vec3 normalEC = normalize(cross(planeDirection, upOrDown));           // In practice, the opposite seems to work too.

    // Extrude bottom vertices downward for far view distances, like for GroundPrimitives
    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));

    // Determine distance along normalEC to push for a volume of appropriate width.
    // Make volumes about double pixel width for a conservative fit - in practice the
    // extra cost here is minimal compared to the loose volume heights.
    //
    // N = normalEC (guaranteed "right-facing")
    // R = rightEC
    // p = angle between N and R
    // w = distance to push along R if R == N
    // d = distance to push along N
    //
    //   N   R
    //  {  p| }      * cos(p) = dot(N, R) = w / d
    //  d  |  |w    * d = w / dot(N, R)
    //    { | }
    //       o---------- polyline segment ---->
    //
    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 = distance to push along R
    width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N

    // Determine if this vertex is on the "left" or "right"
#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
    // Approximate relative screen space direction of the line.
    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 qI=`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 Wl=`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);

    // Distance that p0 is behind the near plane. Negative means p0 is
    // in front of the near plane.
    float endPoint0Distance =  czm_currentFrustum.x + p0.z;

    // Camera looks down -Z.
    // When moving a point along +Z: LESS VISIBLE
    //   * Points in front of the camera move closer to the camera.
    //   * Points behind the camrea move farther away from the camera.
    // When moving a point along -Z: MORE VISIBLE
    //   * Points in front of the camera move farther away from the camera.
    //   * Points behind the camera move closer to the camera.

    // Positive denominator: -Z, becoming more visible
    // Negative denominator: +Z, becoming less visible
    // Nearly zero: parallel to near plane
    float denominator = -direction.z;

    if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)
    {
        // p0 is behind the near plane and the line to p1 is nearly parallel to
        // the near plane, so cull the segment completely.
        culledByNearPlane = true;
    }
    else if (endPoint0Distance > 0.0)
    {
        // p0 is behind the near plane, and the line to p1 is moving distinctly
        // toward or away from it.

        // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)
        float t = endPoint0Distance / denominator;
        if (t < 0.0 || t > magnitude)
        {
            // Near plane intersection is not between the two points.
            // We already confirmed p0 is behind the naer plane, so now
            // we know the entire segment is behind it.
            culledByNearPlane = true;
        }
        else
        {
            // Segment crosses the near plane, update p0 to lie exactly on it.
            p0 = p0 + t * direction;

            // Numerical noise might put us a bit on the wrong side of the near plane.
            // Don't let that happen.
            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)
{
    // expandDirection +1 is to the _left_ when looking from positionEC toward nextEC.

#ifdef POLYLINE_DASH
    // Compute the window coordinates of the points.
    vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);
    vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);
    vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);

    // Determine the relative screen space direction of the line.
    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; // precomputed atan(1,0)

    // Quantize the angle so it doesn't change rapidly between segments.
    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 a segment was culled, we can't use the corresponding direction
    // computed above. We should never see both of these be true without
    // \`segmentCulled\` above also being true.
    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;

    // When lines are split at the anti-meridian, the position may be at the
    // same location as the next or previous position, and we need to handle
    // that to avoid producing NaNs.
    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);

        // The sine of the angle between the two vectors is given by the formula
        //         |a x b| = |a||b|sin(theta)
        // which is
        //     float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0)));
        // Because the z components of both vectors are zero, the x and y coordinate will be zero.
        // Therefore, the sine of the angle is just the z component of the cross product.
        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 X8=`${Wl}
${qI}`,v1e=w0;Vt.isInternetExplorer()||(X8=`#define CLIP_POLYLINE 
${X8}`);function z0(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=z0.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,X8),this._fragmentShaderSource=y(e.fragmentShaderSource,v1e),this._renderState=$i.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(z0.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}}});z0.VERTEX_FORMAT=Ie.POSITION_ONLY;z0.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;z0.prototype.isTranslucent=$i.prototype.isTranslucent;z0.prototype.getRenderState=$i.prototype.getRenderState;var Vr=z0;var XI=`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 H0=`#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 K8=`${Wl}
${XI}`,w1e=H0;Vt.isInternetExplorer()||(K8=`#define CLIP_POLYLINE 
${K8}`);function G0(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=!1,i=G0.VERTEX_FORMAT;this.material=u(e.material)?e.material:Vi.fromType(Vi.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,K8),this._fragmentShaderSource=y(e.fragmentShaderSource,w1e),this._renderState=$i.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(G0.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}}});G0.VERTEX_FORMAT=Ie.POSITION_AND_ST;G0.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;G0.prototype.isTranslucent=$i.prototype.isTranslucent;G0.prototype.getRenderState=$i.prototype.getRenderState;var Vs=G0;function Zm(e){e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;u(t)||(t=new Vs),this.appearance=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Un.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1;let n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);let r=this._error;u(r)?o(r):i(this)}}),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=zee(!1),this._renderState3DTiles=zee(!0),this._renderStateMorph=Ue.fromCache({cull:{enabled:!0,face:gi.FRONT},depthTest:{enabled:!0},blending:un.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(Zm.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}},readyPromise:{get:function(){return this._readyPromise}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});Zm.initializeTerrainHeights=function(){return fi.initialize()};function I1e(e,t,n){let i=t.context,o=e._primitive,r=o._attributeLocations,s=o._batchTable.getVertexShaderCallback()(YI);s=Dn._appendShowToShader(o,s),s=Dn._appendDistanceDisplayConditionToShader(o,s),s=Dn._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(jI);a=Dn._appendShowToShader(o,a),a=Dn._appendDistanceDisplayConditionToShader(o,a),a=Dn._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(GI),l=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`],f="",d="";u(n.material)?(d=u(n.material)?n.material.shaderSource:"",d.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&l.push("ANGLE_VARYING"),d.search(/in\s+float\s+v_width;/g)!==-1&&l.push("WIDTH_VARYING")):f="PER_INSTANCE_COLOR",l.push(f);let p=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",f]:[f],g=new ke({defines:l,sources:[s]}),m=new ke({defines:p,sources:[d,c]});e._sp=Xt.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:r});let A=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!u(A)){let C=new ke({defines:l.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});A=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:C,fragmentShaderSource:m,attributeLocations:r})}e._sp2D=A;let x=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!u(x)){let C=new ke({defines:l.concat([`MAX_TERRAIN_HEIGHT ${fi._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()(WI);let T=new ke({defines:p,sources:[d,c]});x=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:r})}e._spMorph=x}function zee(e){return Ue.fromCache({cull:{enabled:!0},blending:un.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:kn.EQUAL,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},backFunction:kn.EQUAL,backOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK}})}function P1e(e,t,n,i,o,r){let s=e._primitive,a=s._va.length;o.length=a,r.length=a;let l=t instanceof Vr?{}:n._uniforms,f=s._batchTable.getUniformMapCallback()(l);for(let d=0;d<a;d++){let p=s._va[d],g=o[d];u(g)||(g=o[d]=new tt({owner:e,primitiveType:s._primitiveType})),g.vertexArray=p,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=f,g.pass=Ee.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";let m=tt.shallowClone(g,g.derivedCommands.tileset);m.renderState=e._renderState3DTiles,m.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=m;let A=tt.shallowClone(g,g.derivedCommands.color2D);A.shaderProgram=e._sp2D,g.derivedCommands.color2D=A;let x=tt.shallowClone(m,m.derivedCommands.color2D);x.shaderProgram=e._sp2D,m.derivedCommands.color2D=x;let C=tt.shallowClone(g,g.derivedCommands.colorMorph);C.renderState=e._renderStateMorph,C.shaderProgram=e._spMorph,C.pickId="czm_batchTable_pickColor(v_batchId)",g.derivedCommands.colorMorph=C}}function Hee(e,t,n,i,o,r,s){n.mode===te.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==te.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function O1e(e,t,n,i,o,r,s){let a=e._primitive;Dn._updateBoundingVolumes(a,t,o);let c;t.mode===te.SCENE3D?c=a._boundingSphereWC:t.mode===te.COLUMBUS_VIEW?c=a._boundingSphereCV:t.mode===te.SCENE2D&&u(a._boundingSphere2D)?c=a._boundingSphere2D:u(a._boundingSphereMorph)&&(c=a._boundingSphereMorph);let l=t.mode===te.MORPHING,f=e.classificationType,d=f!==Un.CESIUM_3D_TILE,p=f!==Un.TERRAIN&&!l,g,m=t.passes;if(m.render||m.pick&&a.allowPicking){let A=n.length;for(let x=0;x<A;++x){let C=c[x];d&&(g=n[x],Hee(e,g,t,o,r,C,s)),p&&(g=n[x].derivedCommands.tileset,Hee(e,g,t,o,r,C,s))}}}Zm.prototype.update=function(e){if(!u(this._primitive)&&!u(this.geometryInstances))return;if(!fi.initialized){Zm.initializeTerrainHeights();return}let t,n=this,i=this._primitiveOptions;if(!u(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,!u(a)||!u(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){let c=o[t];a={};let l=c.attributes;for(let f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);u(a.width)||(a.width=new Va({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,value:[c.geometry.width]})),c.geometry._scene3DOnly=e.scene3DOnly,k0.setProjectionAndEllipsoid(c.geometry,e.mapProjection),s[t]=new At({geometry:c.geometry,attributes:a,id:c.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(c,l,f){I1e(n,l,f)},i._createCommandsFunction=function(c,l,f,d,p,g,m){P1e(n,l,f,d,g,m)},i._updateAndQueueCommandsFunction=function(c,l,f,d,p,g,m,A){O1e(n,l,f,d,p,g,m)},this._primitive=new Dn(i),this._primitive.readyPromise.then(this._completeLoad)}if(this.appearance instanceof Vr&&!this._hasPerInstanceColors)throw new de("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)};Zm.prototype.getGeometryInstanceAttributes=function(e){return this._primitive.getGeometryInstanceAttributes(e)};Zm.isSupported=function(e){return e.frameState.context.depthTexture};Zm.prototype.isDestroyed=function(){return!1};Zm.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,le(this)};var Qf=Zm;var R1e=new H(1,1),B1e=!1,M1e=z.WHITE;function mT(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(mT.prototype,{isConstant:{get:function(){return Y.isConstant(this._image)&&Y.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:ae("image"),repeat:ae("repeat"),color:ae("color"),transparent:ae("transparent")});mT.prototype.getType=function(e){return"Image"};mT.prototype.getValue=function(e,t){return u(t)||(t={}),t.image=Y.getValueOrUndefined(this._image,e),t.repeat=Y.getValueOrClonedDefault(this._repeat,e,R1e,t.repeat),t.color=Y.getValueOrClonedDefault(this._color,e,M1e,t.color),Y.getValueOrDefault(this._transparent,e,B1e)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};mT.prototype.equals=function(e){return this===e||e instanceof mT&&Y.equals(this._image,e._image)&&Y.equals(this._repeat,e._repeat)&&Y.equals(this._color,e._color)&&Y.equals(this._transparent,e._transparent)};var og=mT;function L1e(e){if(e instanceof z)return new Mt(e);if(typeof e=="string"||e instanceof Oe||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){let t=new og;return t.image=e,t}}function N1e(e,t){return ae(e,t,L1e)}var Io=N1e;function KI(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(KI.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),dimensions:ae("dimensions"),heightReference:ae("heightReference"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});KI.prototype.clone=function(e){return u(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 KI(this)};KI.prototype.merge=function(e){this.show=y(this.show,e.show),this.dimensions=y(this.dimensions,e.dimensions),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var W0=KI;var F1e={FIXED:0,INERTIAL:1},to=Object.freeze(F1e);function pT(){de.throwInstantiationError()}Object.defineProperties(pT.prototype,{isConstant:{get:de.throwInstantiationError},definitionChanged:{get:de.throwInstantiationError},referenceFrame:{get:de.throwInstantiationError}});pT.prototype.getValue=de.throwInstantiationError;pT.prototype.getValueInReferenceFrame=de.throwInstantiationError;pT.prototype.equals=de.throwInstantiationError;var Z8=new Z;pT.convertToReferenceFrame=function(e,t,n,i,o){if(!u(t))return t;if(u(o)||(o=new h),n===i)return h.clone(t,o);let r=Ot.computeIcrfToFixedMatrix(e,Z8);if(u(r)||(r=Ot.computeTemeToPseudoFixedMatrix(e,Z8)),n===to.INERTIAL)return Z.multiplyByVector(r,t,o);if(n===to.FIXED)return Z.multiplyByVector(Z.transpose(r,Z8),t,o)};var Jm=pT;function j0(e,t){this._definitionChanged=new Ae,this._value=h.clone(e),this._referenceFrame=y(t,to.FIXED)}Object.defineProperties(j0.prototype,{isConstant:{get:function(){return!u(this._value)||this._referenceFrame===to.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});j0.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};j0.prototype.setValue=function(e,t){let n=!1;h.equals(this._value,e)||(n=!0,this._value=h.clone(e)),u(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};j0.prototype.getValueInReferenceFrame=function(e,t,n){return Jm.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};j0.prototype.equals=function(e){return this===e||e instanceof j0&&h.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};var Sc=j0;function ZI(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(ZI.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),positions:ae("positions"),width:ae("width"),height:ae("height"),heightReference:ae("heightReference"),extrudedHeight:ae("extrudedHeight"),extrudedHeightReference:ae("extrudedHeightReference"),cornerType:ae("cornerType"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition"),classificationType:ae("classificationType"),zIndex:ae("zIndex")});ZI.prototype.clone=function(e){return u(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 ZI(this)};ZI.prototype.merge=function(e){this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.width=y(this.width,e.width),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=y(this.cornerType,e.cornerType),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};var Y0=ZI;function V1e(e){return e}function U1e(e,t){return ae(e,t,V1e)}var al=U1e;function JI(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(JI.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),length:ae("length"),topRadius:ae("topRadius"),bottomRadius:ae("bottomRadius"),heightReference:ae("heightReference"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),numberOfVerticalLines:ae("numberOfVerticalLines"),slices:ae("slices"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});JI.prototype.clone=function(e){return u(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 JI(this)};JI.prototype.merge=function(e){this.show=y(this.show,e.show),this.length=y(this.length,e.length),this.topRadius=y(this.topRadius,e.topRadius),this.bottomRadius=y(this.bottomRadius,e.bottomRadius),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=y(this.slices,e.slices),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var q0=JI;function QI(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(QI.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),semiMajorAxis:ae("semiMajorAxis"),semiMinorAxis:ae("semiMinorAxis"),height:ae("height"),heightReference:ae("heightReference"),extrudedHeight:ae("extrudedHeight"),extrudedHeightReference:ae("extrudedHeightReference"),rotation:ae("rotation"),stRotation:ae("stRotation"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),numberOfVerticalLines:ae("numberOfVerticalLines"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition"),classificationType:ae("classificationType"),zIndex:ae("zIndex")});QI.prototype.clone=function(e){return u(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 QI(this)};QI.prototype.merge=function(e){this.show=y(this.show,e.show),this.semiMajorAxis=y(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=y(this.semiMinorAxis,e.semiMinorAxis),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=y(this.rotation,e.rotation),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};var X0=QI;function $I(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties($I.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),radii:ae("radii"),innerRadii:ae("innerRadii"),minimumClock:ae("minimumClock"),maximumClock:ae("maximumClock"),minimumCone:ae("minimumCone"),maximumCone:ae("maximumCone"),heightReference:ae("heightReference"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),stackPartitions:ae("stackPartitions"),slicePartitions:ae("slicePartitions"),subdivisions:ae("subdivisions"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});$I.prototype.clone=function(e){return u(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 $I(this)};$I.prototype.merge=function(e){this.show=y(this.show,e.show),this.radii=y(this.radii,e.radii),this.innerRadii=y(this.innerRadii,e.innerRadii),this.minimumClock=y(this.minimumClock,e.minimumClock),this.maximumClock=y(this.maximumClock,e.maximumClock),this.minimumCone=y(this.minimumCone,e.minimumCone),this.maximumCone=y(this.maximumCone,e.maximumCone),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.stackPartitions=y(this.stackPartitions,e.stackPartitions),this.slicePartitions=y(this.slicePartitions,e.slicePartitions),this.subdivisions=y(this.subdivisions,e.subdivisions),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var K0=$I;function eP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(eP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),text:ae("text"),font:ae("font"),style:ae("style"),scale:ae("scale"),showBackground:ae("showBackground"),backgroundColor:ae("backgroundColor"),backgroundPadding:ae("backgroundPadding"),pixelOffset:ae("pixelOffset"),eyeOffset:ae("eyeOffset"),horizontalOrigin:ae("horizontalOrigin"),verticalOrigin:ae("verticalOrigin"),heightReference:ae("heightReference"),fillColor:ae("fillColor"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),translucencyByDistance:ae("translucencyByDistance"),pixelOffsetScaleByDistance:ae("pixelOffsetScaleByDistance"),scaleByDistance:ae("scaleByDistance"),distanceDisplayCondition:ae("distanceDisplayCondition"),disableDepthTestDistance:ae("disableDepthTestDistance")});eP.prototype.clone=function(e){return u(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 eP(this)};eP.prototype.merge=function(e){this.show=y(this.show,e.show),this.text=y(this.text,e.text),this.font=y(this.font,e.font),this.style=y(this.style,e.style),this.scale=y(this.scale,e.scale),this.showBackground=y(this.showBackground,e.showBackground),this.backgroundColor=y(this.backgroundColor,e.backgroundColor),this.backgroundPadding=y(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=y(this.pixelOffset,e.pixelOffset),this.eyeOffset=y(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=y(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=y(this.verticalOrigin,e.verticalOrigin),this.heightReference=y(this.heightReference,e.heightReference),this.fillColor=y(this.fillColor,e.fillColor),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=y(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=y(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=y(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this.disableDepthTestDistance,e.disableDepthTestDistance)};var $f=eP;var k1e=new h(1,1,1),z1e=h.ZERO,H1e=Le.IDENTITY;function Gee(e,t,n){this.translation=h.clone(y(e,z1e)),this.rotation=Le.clone(y(t,H1e)),this.scale=h.clone(y(n,k1e))}Gee.prototype.equals=function(e){return this===e||u(e)&&h.equals(this.translation,e.translation)&&Le.equals(this.rotation,e.rotation)&&h.equals(this.scale,e.scale)};var rg=Gee;var J8=new rg;function tP(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(tP.prototype,{isConstant:{get:function(){return Y.isConstant(this._translation)&&Y.isConstant(this._rotation)&&Y.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:ae("translation"),rotation:ae("rotation"),scale:ae("scale")});tP.prototype.getValue=function(e,t){return u(t)||(t=new rg),t.translation=Y.getValueOrClonedDefault(this._translation,e,J8.translation,t.translation),t.rotation=Y.getValueOrClonedDefault(this._rotation,e,J8.rotation,t.rotation),t.scale=Y.getValueOrClonedDefault(this._scale,e,J8.scale,t.scale),t};tP.prototype.equals=function(e){return this===e||e instanceof tP&&Y.equals(this._translation,e._translation)&&Y.equals(this._rotation,e._rotation)&&Y.equals(this._scale,e._scale)};var Z0=tP;function Qm(e,t){this._propertyNames=[],this._definitionChanged=new Ae,u(e)&&this.merge(e,t)}Object.defineProperties(Qm.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(!Y.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});Qm.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function G1e(e){return new ei(e)}Qm.prototype.addProperty=function(e,t,n){this._propertyNames.push(e),Object.defineProperty(this,e,ae(e,!0,y(n,G1e))),u(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};Qm.prototype.removeProperty=function(e){let n=this._propertyNames.indexOf(e);this._propertyNames.splice(n,1),delete this[e],this._definitionChanged.raiseEvent(this)};Qm.prototype.getValue=function(e,t){u(t)||(t={});let n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){let r=n[i];t[r]=Y.getValueOrUndefined(this[r],e,t[r])}return t};Qm.prototype.merge=function(e,t){let n=this._propertyNames,i=u(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){let s=i[o],a=this[s],c=e[s];a===void 0&&n.indexOf(s)===-1&&this.addProperty(s,void 0,t),c!==void 0&&(a!==void 0?u(a)&&u(a.merge)&&a.merge(c):u(c)&&u(c.merge)&&u(c.clone)?this[s]=c.clone():this[s]=c)}};function W1e(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||!Y.equals(e[s],t[s]))return!1}return!0}Qm.prototype.equals=function(e){return this===e||e instanceof Qm&&W1e(this,e)};var cl=Qm;function Wee(e){return new Z0(e)}function j1e(e){return new cl(e,Wee)}function Y1e(e){return new cl(e)}function nP(e){this._definitionChanged=new Ae,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._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._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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(nP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),uri:ae("uri"),scale:ae("scale"),minimumPixelSize:ae("minimumPixelSize"),maximumScale:ae("maximumScale"),incrementallyLoadTextures:ae("incrementallyLoadTextures"),runAnimations:ae("runAnimations"),clampAnimations:ae("clampAnimations"),shadows:ae("shadows"),heightReference:ae("heightReference"),silhouetteColor:ae("silhouetteColor"),silhouetteSize:ae("silhouetteSize"),color:ae("color"),colorBlendMode:ae("colorBlendMode"),colorBlendAmount:ae("colorBlendAmount"),imageBasedLightingFactor:ae("imageBasedLightingFactor"),lightColor:ae("lightColor"),distanceDisplayCondition:ae("distanceDisplayCondition"),nodeTransformations:ae("nodeTransformations",void 0,j1e),articulations:ae("articulations",void 0,Y1e),clippingPlanes:ae("clippingPlanes"),customShader:ae("customShader")});nP.prototype.clone=function(e){return u(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,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.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 nP(this)};nP.prototype.merge=function(e){this.show=y(this.show,e.show),this.uri=y(this.uri,e.uri),this.scale=y(this.scale,e.scale),this.minimumPixelSize=y(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=y(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=y(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=y(this.runAnimations,e.runAnimations),this.clampAnimations=y(this.clampAnimations,e.clampAnimations),this.shadows=y(this.shadows,e.shadows),this.heightReference=y(this.heightReference,e.heightReference),this.silhouetteColor=y(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=y(this.silhouetteSize,e.silhouetteSize),this.color=y(this.color,e.color),this.colorBlendMode=y(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=y(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=y(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=y(this.lightColor,e.lightColor),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=y(this.clippingPlanes,e.clippingPlanes),this.customShader=y(this.customShader,e.customShader);let t=e.nodeTransformations;if(u(t)){let i=this.nodeTransformations;u(i)?i.merge(t):this.nodeTransformations=new cl(t,Wee)}let n=e.articulations;if(u(n)){let i=this.articulations;u(i)?i.merge(n):this.articulations=new cl(n)}};var $m=nP;function iP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(iP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),uri:ae("uri"),maximumScreenSpaceError:ae("maximumScreenSpaceError")});iP.prototype.clone=function(e){return u(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new iP(this)};iP.prototype.merge=function(e){this.show=y(this.show,e.show),this.uri=y(this.uri,e.uri),this.maximumScreenSpaceError=y(this.maximumScreenSpaceError,e.maximumScreenSpaceError)};var J0=iP;function oP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(oP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),leadTime:ae("leadTime"),trailTime:ae("trailTime"),width:ae("width"),resolution:ae("resolution"),material:Io("material"),distanceDisplayCondition:ae("distanceDisplayCondition")});oP.prototype.clone=function(e){return u(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 oP(this)};oP.prototype.merge=function(e){this.show=y(this.show,e.show),this.leadTime=y(this.leadTime,e.leadTime),this.trailTime=y(this.trailTime,e.trailTime),this.width=y(this.width,e.width),this.resolution=y(this.resolution,e.resolution),this.material=y(this.material,e.material),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var ep=oP;function rP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(rP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),plane:ae("plane"),dimensions:ae("dimensions"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});rP.prototype.clone=function(e){return u(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 rP(this)};rP.prototype.merge=function(e){this.show=y(this.show,e.show),this.plane=y(this.plane,e.plane),this.dimensions=y(this.dimensions,e.dimensions),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var sP=rP;function aP(e){this._definitionChanged=new Ae,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.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(aP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),pixelSize:ae("pixelSize"),heightReference:ae("heightReference"),color:ae("color"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),scaleByDistance:ae("scaleByDistance"),translucencyByDistance:ae("translucencyByDistance"),distanceDisplayCondition:ae("distanceDisplayCondition"),disableDepthTestDistance:ae("disableDepthTestDistance")});aP.prototype.clone=function(e){return u(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):new aP(this)};aP.prototype.merge=function(e){this.show=y(this.show,e.show),this.pixelSize=y(this.pixelSize,e.pixelSize),this.heightReference=y(this.heightReference,e.heightReference),this.color=y(this.color,e.color),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.scaleByDistance=y(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=y(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this.disableDepthTestDistance,e.disableDepthTestDistance)};var Q0=aP;function q1e(e,t){this.positions=u(e)?e:[],this.holes=u(t)?t:[]}var Dc=q1e;function X1e(e){return Array.isArray(e)&&(e=new Dc(e)),new ei(e)}function cP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(cP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),hierarchy:ae("hierarchy",void 0,X1e),height:ae("height"),heightReference:ae("heightReference"),extrudedHeight:ae("extrudedHeight"),extrudedHeightReference:ae("extrudedHeightReference"),stRotation:ae("stRotation"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),perPositionHeight:ae("perPositionHeight"),closeTop:ae("closeTop"),closeBottom:ae("closeBottom"),arcType:ae("arcType"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition"),classificationType:ae("classificationType"),zIndex:ae("zIndex"),textureCoordinates:ae("textureCoordinates")});cP.prototype.clone=function(e){return u(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 cP(this)};cP.prototype.merge=function(e){this.show=y(this.show,e.show),this.hierarchy=y(this.hierarchy,e.hierarchy),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.perPositionHeight=y(this.perPositionHeight,e.perPositionHeight),this.closeTop=y(this.closeTop,e.closeTop),this.closeBottom=y(this.closeBottom,e.closeBottom),this.arcType=y(this.arcType,e.arcType),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex),this.textureCoordinates=y(this.textureCoordinates,e.textureCoordinates)};var ed=cP;function lP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(lP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),positions:ae("positions"),width:ae("width"),granularity:ae("granularity"),material:Io("material"),depthFailMaterial:Io("depthFailMaterial"),arcType:ae("arcType"),clampToGround:ae("clampToGround"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition"),classificationType:ae("classificationType"),zIndex:ae("zIndex")});lP.prototype.clone=function(e){return u(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 lP(this)};lP.prototype.merge=function(e){this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.width=y(this.width,e.width),this.granularity=y(this.granularity,e.granularity),this.material=y(this.material,e.material),this.depthFailMaterial=y(this.depthFailMaterial,e.depthFailMaterial),this.arcType=y(this.arcType,e.arcType),this.clampToGround=y(this.clampToGround,e.clampToGround),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};var Ua=lP;function uP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(uP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),positions:ae("positions"),shape:ae("shape"),cornerType:ae("cornerType"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});uP.prototype.clone=function(e){return u(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 uP(this)};uP.prototype.merge=function(e){this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.shape=y(this.shape,e.shape),this.cornerType=y(this.cornerType,e.cornerType),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var $0=uP;function fP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(fP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),coordinates:ae("coordinates"),height:ae("height"),heightReference:ae("heightReference"),extrudedHeight:ae("extrudedHeight"),extrudedHeightReference:ae("extrudedHeightReference"),rotation:ae("rotation"),stRotation:ae("stRotation"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition"),classificationType:ae("classificationType"),zIndex:ae("zIndex")});fP.prototype.clone=function(e){return u(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 fP(this)};fP.prototype.merge=function(e){this.show=y(this.show,e.show),this.coordinates=y(this.coordinates,e.coordinates),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=y(this.rotation,e.rotation),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};var td=fP;function dP(e){this._definitionChanged=new Ae,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(y(e,y.EMPTY_OBJECT))}Object.defineProperties(dP.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ae("show"),positions:ae("positions"),minimumHeights:ae("minimumHeights"),maximumHeights:ae("maximumHeights"),granularity:ae("granularity"),fill:ae("fill"),material:Io("material"),outline:ae("outline"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth"),shadows:ae("shadows"),distanceDisplayCondition:ae("distanceDisplayCondition")});dP.prototype.clone=function(e){return u(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 dP(this)};dP.prototype.merge=function(e){this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.minimumHeights=y(this.minimumHeights,e.minimumHeights),this.maximumHeights=y(this.maximumHeights,e.maximumHeights),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};var tp=dP;var K1e=new he;function Z1e(e){return new Sc(e)}function J1e(e){return ae(e,void 0,Z1e)}function Us(e,t){return ae(e,void 0,function(n){return n instanceof t?n:new t(n)})}function Sh(e){e=y(e,y.EMPTY_OBJECT);let t=e.id;u(t)||(t=zn()),this._availability=void 0,this._id=t,this._definitionChanged=new Ae,this._name=e.name,this._show=y(e.show,!0),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"],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 Q8(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)&&Q8(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(Sh.prototype,{availability:al("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:al("name"),show:{get:function(){return this._show},set:function(e){if(e===this._show)return;let t=this.isShowing;this._show=e;let n=this.isShowing;t!==n&&Q8(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!u(this.entityCollection)||this.entityCollection.show)&&(!u(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(u(t)){let o=t._children.indexOf(this);t._children.splice(o,1)}this._parent=e,u(e)&&e._children.push(this);let i=this.isShowing;n!==i&&Q8(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:Us("billboard",Na),box:Us("box",W0),corridor:Us("corridor",Y0),cylinder:Us("cylinder",q0),description:ae("description"),ellipse:Us("ellipse",X0),ellipsoid:Us("ellipsoid",K0),label:Us("label",$f),model:Us("model",$m),tileset:Us("tileset",J0),orientation:ae("orientation"),path:Us("path",ep),plane:Us("plane",sP),point:Us("point",Q0),polygon:Us("polygon",ed),polyline:Us("polyline",Ua),polylineVolume:Us("polylineVolume",$0),properties:Us("properties",cl),position:J1e("position"),rectangle:Us("rectangle",td),viewFrom:ae("viewFrom"),wall:Us("wall",tp)});Sh.prototype.isAvailable=function(e){let t=this._availability;return!u(t)||t.contains(e)};Sh.prototype.addProperty=function(e){this._propertyNames.push(e),Object.defineProperty(this,e,al(e,!0))};Sh.prototype.removeProperty=function(e){let n=this._propertyNames.indexOf(e);this._propertyNames.splice(n,1),delete this[e]};Sh.prototype.merge=function(e){this.name=y(this.name,e.name),this.availability=y(this.availability,e.availability);let t=this._propertyNames,n=u(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")continue;let s=this[r],a=e[r];!u(s)&&t.indexOf(r)===-1&&this.addProperty(r),u(a)&&(u(s)?u(s.merge)&&s.merge(a):u(a.merge)&&u(a.clone)?this[r]=a.clone():this[r]=a)}};var jee=new Z,Yee=new h,qee=new Le;Sh.prototype.computeModelMatrix=function(e,t){let n=Y.getValueOrUndefined(this._position,e,Yee);if(!u(n))return;let i=Y.getValueOrUndefined(this._orientation,e,qee);return u(i)?t=M.fromRotationTranslation(Z.fromQuaternion(i,jee),n,t):t=Ot.eastNorthUpToFixedFrame(n,void 0,t),t};Sh.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){let r=Y.getValueOrDefault(t,e,We.NONE),s=Y.getValueOrUndefined(this._position,e,Yee);if(r===We.NONE||!u(s)||h.equalsEpsilon(s,h.ZERO,P.EPSILON8))return this.computeModelMatrix(e,o);let a=i.cartesianToCartographic(s,K1e);r===We.CLAMP_TO_GROUND?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);let c=Y.getValueOrUndefined(this._orientation,e,qee);return u(c)?o=M.fromRotationTranslation(Z.fromQuaternion(c,jee),s,o):o=Ot.eastNorthUpToFixedFrame(s,void 0,o),o};Sh.supportsMaterialsforEntitiesOnTerrain=function(e){return Ec.supportsMaterials(e)};Sh.supportsPolylinesOnTerrain=function(e){return Qf.isSupported(e)};var jo=Sh;var Q1e=new Mt(z.WHITE),$1e=new ei(!0),eOe=new ei(!0),tOe=new ei(!1),nOe=new ei(z.BLACK),iOe=new ei(gn.DISABLED),oOe=new ei(new bt),rOe=new ei(Un.BOTH);function vc(e){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 Ae,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=jo.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(vc.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||!u(this._entity.availability)&&Y.isConstant(this._showProperty)&&Y.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!u(this._entity.availability)&&Y.isConstant(this._showProperty)&&Y.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}}});vc.prototype.isOutlineVisible=function(e){let t=this._entity,n=this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e);return y(n,!1)};vc.prototype.isFilled=function(e){let t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e);return y(n,!1)};vc.prototype.createFillGeometryInstance=de.throwInstantiationError;vc.prototype.createOutlineGeometryInstance=de.throwInstantiationError;vc.prototype.isDestroyed=function(){return!1};vc.prototype.destroy=function(){le(this)};vc.prototype._isHidden=function(e,t){let n=t.show;return u(n)&&n.isConstant&&!n.getValue(ze.MINIMUM_VALUE)};vc.prototype._isOnTerrain=function(e,t){return!1};vc.prototype._getIsClosed=function(e){return!0};vc.prototype._isDynamic=de.throwInstantiationError;vc.prototype._setStaticOptions=de.throwInstantiationError;vc.prototype._onEntityPropertyChanged=function(e,t,n,i){if(this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!u(o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}let r=o.fill,s=u(r)&&r.isConstant?r.getValue(ze.MINIMUM_VALUE):!0,a=o.outline,c=u(a);if(c&&a.isConstant&&(c=a.getValue(ze.MINIMUM_VALUE)),!s&&!c){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}let l=o.show;if(this._isHidden(e,o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}this._materialProperty=y(o.material,Q1e),this._fillProperty=y(r,eOe),this._showProperty=y(l,$1e),this._showOutlineProperty=y(o.outline,tOe),this._outlineColorProperty=c?y(o.outlineColor,nOe):void 0,this._shadowsProperty=y(o.shadows,iOe),this._distanceDisplayConditionProperty=y(o.distanceDisplayCondition,oOe),this._classificationTypeProperty=y(o.classificationType,rOe),this._fillEnabled=s;let f=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof Mt);if(c&&f&&(wt(wt.geometryOutlines),c=!1),this._onTerrain=f,this._outlineEnabled=c,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 d=o.outlineWidth;this._outlineWidth=u(d)?d.getValue(ze.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};vc.prototype.createDynamicUpdater=function(e,t){return new this.constructor.DynamicGeometryUpdater(this,e,t)};var si=vc;function _T(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Ae,this.setCallback(e,t)}Object.defineProperties(_T.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}});_T.prototype.getValue=function(e,t){return this._callback(e,t)};_T.prototype.setCallback=function(e,t){let n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};_T.prototype.equals=function(e){return this===e||e instanceof _T&&this._callback===e._callback&&this._isConstant===e._isConstant};var nd=_T;var Xee=new h,sOe=new he;function gT(e,t,n,i){this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new h,this._cartographicPosition=new he,this._normal=new h,this._definitionChanged=new Ae,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;let o=this;if(u(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){o._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){o._updateClamping()})),t.isConstant){let r=t.getValue(ze.MINIMUM_VALUE,Xee);if(!u(r)||h.equals(r,h.ZERO)||!u(e.globe))return;this._position=h.clone(r,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(gT.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});gT.prototype._updateClamping=function(){u(this._removeCallbackFunc)&&this._removeCallbackFunc();let e=this._scene,t=e.globe,n=this._position;if(!u(t)||h.equals(n,h.ZERO)){this._terrainHeight=0;return}let i=t.ellipsoid,o=t._surface,r=this,s=i.cartesianToCartographic(n,this._cartographicPosition),a=t.getHeight(s);u(a)?this._terrainHeight=a:this._terrainHeight=0;function c(l){if(e.mode===te.SCENE3D){let f=i.cartesianToCartographic(l,sOe);r._terrainHeight=f.height}else r._terrainHeight=l.x;r.definitionChanged.raiseEvent()}this._removeCallbackFunc=o.updateHeight(s,c)};gT.prototype.getValue=function(e,t){let n=Y.getValueOrDefault(this._heightReference,e,We.NONE),i=Y.getValueOrDefault(this._extrudedHeightReference,e,We.NONE);if(n===We.NONE&&i!==We.RELATIVE_TO_GROUND)return this._position=h.clone(h.ZERO,this._position),h.clone(h.ZERO,t);if(this._positionProperty.isConstant)return h.multiplyByScalar(this._normal,this._terrainHeight,t);let o=this._scene,r=this._positionProperty.getValue(e,Xee);if(!u(r)||h.equals(r,h.ZERO)||!u(o.globe))return h.clone(h.ZERO,t);if(h.equalsEpsilon(this._position,r,P.EPSILON10))return h.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=h.clone(r,this._position),this._updateClamping();let s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return h.multiplyByScalar(s,this._terrainHeight,t)};gT.prototype.isDestroyed=function(){return!1};gT.prototype.destroy=function(){return u(this._removeEventListener)&&this._removeEventListener(),u(this._removeModeListener)&&this._removeModeListener(),u(this._removeCallbackFunc)&&this._removeCallbackFunc(),le(this)};var eA=gT;function aOe(e,t,n,i){if(si.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!u(o))return;u(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);let r=o.heightReference;if(u(r)){let s=new nd(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new eA(this._scene,s,r)}}var np=aOe;var Kee=h.ZERO,Zee=new h,cOe=new h,Jee=new z;function lOe(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function jl(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new lOe(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}u(Object.create)&&(jl.prototype=Object.create(si.prototype),jl.prototype.constructor=jl);Object.defineProperties(jl.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});jl.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Mt){let a;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,Jee)),u(a)||(a=z.WHITE),s.color=Nt.fromColor(a)}return u(this._options.offsetAttribute)&&(s.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,Kee,Zee))),new At({id:t,geometry:ol.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};jl.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Jee),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return u(this._options.offsetAttribute)&&(r.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,Kee,Zee))),new At({id:t,geometry:Xf.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};jl.prototype._computeCenter=function(e,t){return Y.getValueOrUndefined(this._entity.position,e,t)};jl.prototype._isHidden=function(e,t){return!u(t.dimensions)||!u(e.position)||si.prototype._isHidden.call(this,e,t)};jl.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Y.isConstant(e.orientation)||!t.dimensions.isConstant||!Y.isConstant(t.outlineWidth)};jl.prototype._setStaticOptions=function(e,t){let n=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Mt?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(ze.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==We.NONE?nn.ALL:void 0};jl.prototype._onEntityPropertyChanged=np;jl.DynamicGeometryUpdater=yT;function yT(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(yT.prototype=Object.create(ri.prototype),yT.prototype.constructor=yT);yT.prototype._isHidden=function(e,t,n){let i=Y.getValueOrUndefined(e.position,n,cOe),o=this._options.dimensions;return!u(i)||!u(o)||ri.prototype._isHidden.call(this,e,t,n)};yT.prototype._setOptions=function(e,t,n){let i=Y.getValueOrDefault(t.heightReference,n,We.NONE),o=this._options;o.dimensions=Y.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==We.NONE?nn.ALL:void 0};var hP=jl;var $ee=vo(Qee(),1);var uOe=0,t5={};function ip(e,t){let n,i=e;u(t5[i])?n=t5[i]:(n=uOe++,t5[i]=n),t=y(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(ip.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(!u(this._element)){let e=$ee.default.sanitize(this._html),t=document.createElement("div");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}}});ip.equals=function(e,t){return e===t||u(e)&&u(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};ip.prototype.equals=function(e){return ip.equals(this,e)};ip.getIonCredit=function(e){let t=u(e.collapsible)&&!e.collapsible,n=new ip(e.html,t);return n._isIon=n.html.indexOf("ion-credit.png")!==-1,n};ip.clone=function(e){if(u(e))return new ip(e.html,e.showOnScreen)};var Zt=ip;var mP=`in vec2 v_textureCoordinates;

uniform float originalSize;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
uniform sampler2D texture4;
uniform sampler2D texture5;

const float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));
const float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));
const float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));
const float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));

void main()
{
    vec2 uv = v_textureCoordinates;
    vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);
    vec2 pixel = 1.0 / textureSize;

    float mipLevel = 0.0;

    if (uv.x - pixel.x > (textureSize.y / textureSize.x))
    {
        mipLevel = 1.0;
        if (uv.y - pixel.y > yMipLevel1)
        {
            mipLevel = 2.0;
            if (uv.y - pixel.y * 3.0 > yMipLevel2)
            {
                mipLevel = 3.0;
                if (uv.y - pixel.y * 5.0 > yMipLevel3)
                {
                    mipLevel = 4.0;
                    if (uv.y - pixel.y * 7.0 > yMipLevel4)
                    {
                        mipLevel = 5.0;
                    }
                }
            }
        }
    }

    if (mipLevel > 0.0)
    {
        float scale = pow(2.0, mipLevel);

        uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);
        uv.x *= ((textureSize.x - 2.0) / textureSize.y);

        uv.x -= 1.0 + pixel.x;
        uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));
        uv *= scale;
    }
    else
    {
        uv.x *= (textureSize.x / textureSize.y);
    }

    if(mipLevel == 0.0)
    {
        out_FragColor = texture(texture0, uv);
    }
    else if(mipLevel == 1.0)
    {
        out_FragColor = texture(texture1, uv);
    }
    else if(mipLevel == 2.0)
    {
        out_FragColor = texture(texture2, uv);
    }
    else if(mipLevel == 3.0)
    {
        out_FragColor = texture(texture3, uv);
    }
    else if(mipLevel == 4.0)
    {
        out_FragColor = texture(texture4, uv);
    }
    else if(mipLevel == 5.0)
    {
        out_FragColor = texture(texture5, uv);
    }
    else
    {
        out_FragColor = vec4(0.0);
    }
}
`;var pP=`in vec3 v_cubeMapCoordinates;
uniform samplerCube cubeMap;

void main()
{
    vec4 rgba = czm_textureCube(cubeMap, v_cubeMapCoordinates);
    #ifdef RGBA_NORMALIZED
        out_FragColor = vec4(rgba.rgb, 1.0);
    #else
        float m = rgba.a * 16.0;
        vec3 r = rgba.rgb * m;
        out_FragColor = vec4(r * r, 1.0);
    #endif
}
`;var _P=`in vec4 position;
in vec3 cubeMapCoordinates;

out vec3 v_cubeMapCoordinates;

void main()
{
    gl_Position = position;
    v_cubeMapCoordinates = cubeMapCoordinates;
}
`;function tA(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1;let t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoadFromCache=o=>{n5(this),this._texture=o,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0,n()},t._failLoad=o=>{i(o)},t._completeLoad=()=>{this._ready=!0,n()}})}Object.defineProperties(tA.prototype,{url:{get:function(){return this._url}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}}});tA.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};var fOe=new h(1,0,0),dOe=new h(0,0,1),hOe=new h(-1,0,0),mOe=new h(0,0,-1),hV=new h(0,1,0),pOe=new h(0,-1,0),nte=[hV,hOe,dOe,pOe,fOe,hV,mOe,hV,hV],ite=nte.length,ote=new Float32Array(ite*3),ete=0;for(let e=0;e<ite;++e,ete+=3)h.pack(nte[e],ote,ete);var _Oe=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),gOe=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function yOe(e){let t=lt.createVertexBuffer({context:e,typedArray:_Oe,usage:Ne.STATIC_DRAW}),n=lt.createVertexBuffer({context:e,typedArray:ote,usage:Ne.STATIC_DRAW}),i=lt.createIndexBuffer({context:e,typedArray:gOe,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:q.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:q.FLOAT}];return new oi({context:e,attributes:o,indexBuffer:i})}function tte(e){return function(){return e}}function n5(e){e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();let t,n,i=e._cubeMaps;if(u(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();let o=e._mipTextures;if(u(o))for(n=o.length,t=0;t<n;++t)o[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}tA.prototype.update=function(e){let t=e.context;if(!tA.isSupported(t)||(u(this._texture)&&u(this._va)&&n5(this),u(this._texture)))return;if(!u(this._texture)&&!this._loading){let g=e.context.textureCache.getTexture(this._url);u(g)&&this._completeLoadFromCache(g)}let n=this._cubeMapBuffers;if(!u(n)&&!this._loading){let g=this;tl(this._url).then(function(m){g._cubeMapBuffers=m,g._loading=!1}).catch(function(m){g._failLoad(m)}),this._loading=!0}if(!u(this._cubeMapBuffers))return;let i=[],o=n[0].positiveX.pixelDatatype;u(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT;let r=rt.RGBA,s=new ke({defines:i,sources:[pP]});this._va=yOe(t),this._sp=Xt.fromCache({context:t,vertexShaderSource:_P,fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});let a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;let c=this._cubeMaps=new Array(a),l=this._mipTextures=new Array(a),f=n[0].positiveX.width*2,d={originalSize:function(){return f}};for(let g=0;g<a;++g){let m=n[g].positiveY;n[g].positiveY=n[g].negativeY,n[g].negativeY=m;let A=c[g]=new Ma({context:t,source:n[g],pixelDatatype:o}),x=c[g].width*2,C=l[g]=new It({context:t,width:x,height:x,pixelDatatype:o,pixelFormat:r}),T=new Lu({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:tte(A)},outputTexture:C,persists:!0,owner:this});e.commandList.push(T),d[`texture${g}`]=tte(C)}this._texture=new It({context:t,width:f*1.5+2,height:f,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);let p=new Lu({fragmentShaderSource:mP,uniformMap:d,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(p),this._completeLoad()};tA.prototype.isDestroyed=function(){return!1};tA.prototype.destroy=function(){return n5(this),this._texture=this._texture&&this._texture.destroy(),le(this)};var id=tA;function gP(e){e=y(e,y.EMPTY_OBJECT);let t=u(e.imageBasedLightingFactor)?H.clone(e.imageBasedLightingFactor):new H(1,1);this._imageBasedLightingFactor=t;let n=y(e.luminanceAtZenith,.2);this._luminanceAtZenith=n;let i=e.sphericalHarmonicCoefficients;this._sphericalHarmonicCoefficients=i,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapAtlas=void 0,this._specularEnvironmentMapAtlasDirty=!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._previousLuminanceAtZenith=n,this._previousSphericalHarmonicCoefficients=i}Object.defineProperties(gP.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=H.clone(e,this._imageBasedLightingFactor)}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){this._previousLuminanceAtZenith=this._luminanceAtZenith,this._luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentMapAtlasDirty=this._specularEnvironmentMapAtlasDirty||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}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return u(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return u(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}});function AOe(e,t){if(id.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),u(e._specularEnvironmentMaps)){let n=new id(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,n.readyPromise.then(function(){e._specularEnvironmentMapLoaded=!0}).catch(function(i){console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}gP.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._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||u(this._luminanceAtZenith)!==u(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||u(this._previousSphericalHarmonicCoefficients)!==u(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(AOe(this,t),this._specularEnvironmentMapAtlasDirty=!1),u(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);let o=!u(this._specularEnvironmentMapAtlas)&&u(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!u(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!u(this._sphericalHarmonicCoefficients)&&u(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!u(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!u(this._specularEnvironmentMapAtlas)&&u(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!u(this._sphericalHarmonicCoefficients)&&u(e.sphericalHarmonicCoefficients)};gP.prototype.isDestroyed=function(){return!1};gP.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),le(this)};var nA=gP;function Dh(e){e=y(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(Dh.prototype,{length:{get:function(){return this._length},set:function(e){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}}});Dh.prototype.get=function(e){return this._array[e]};Dh.prototype.set=function(e,t){e>=this._length&&(this.length=e+1),this._array[e]=t};Dh.prototype.peek=function(){return this._array[this._length-1]};Dh.prototype.push=function(e){let t=this.length++;this._array[t]=e};Dh.prototype.pop=function(){if(this._length===0)return;let e=this._array[this._length-1];return--this.length,e};Dh.prototype.reserve=function(e){e>this._array.length&&(this._array.length=e)};Dh.prototype.resize=function(e){this.length=e};Dh.prototype.trim=function(e){e=y(e,this._length),this._array.length=e};var Yl=Dh;var op={X:0,Y:1,Z:2};op.Y_UP_TO_Z_UP=M.fromRotationTranslation(Z.fromRotationX(P.PI_OVER_TWO));op.Z_UP_TO_Y_UP=M.fromRotationTranslation(Z.fromRotationX(-P.PI_OVER_TWO));op.X_UP_TO_Z_UP=M.fromRotationTranslation(Z.fromRotationY(-P.PI_OVER_TWO));op.Z_UP_TO_X_UP=M.fromRotationTranslation(Z.fromRotationY(P.PI_OVER_TWO));op.X_UP_TO_Y_UP=M.fromRotationTranslation(Z.fromRotationZ(P.PI_OVER_TWO));op.Y_UP_TO_X_UP=M.fromRotationTranslation(Z.fromRotationZ(-P.PI_OVER_TWO));op.fromName=function(e){return op[e]};var Po=Object.freeze(op);function rte(e){e=y(e,y.EMPTY_OBJECT),this._metadata=e.metadata}Object.defineProperties(rte.prototype,{metadata:{get:function(){return this._metadata}}});var iA=rte;function sg(e,t,n){return t=y(t,0),n=y(n,e.byteLength-t),e=e.subarray(t,t+n),sg.decode(e)}sg.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};sg.decodeWithFromCharCode=function(e){let t="",n=xOe(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 yP(e,t,n){return t<=e&&e<=n}function xOe(e){let t=0,n=0,i=0,o=128,r=191,s=[],a=e.length;for(let c=0;c<a;++c){let l=e[c];if(i===0){if(yP(l,0,127)){s.push(l);continue}if(yP(l,194,223)){i=1,t=l&31;continue}if(yP(l,224,239)){l===224&&(o=160),l===237&&(r=159),i=2,t=l&15;continue}if(yP(l,240,244)){l===240&&(o=144),l===244&&(r=143),i=3,t=l&7;continue}throw new ue("String decoding failed.")}if(!yP(l,o,r)){t=i=n=0,o=128,r=191,--c;continue}o=128,r=191,t=t<<6|l&63,++n,n===i&&(s.push(t),t=i=n=0)}return s}typeof TextDecoder<"u"?sg.decode=sg.decodeWithTextDecoder:sg.decode=sg.decodeWithFromCharCode;var ll=sg;function COe(e,t){return t=y(t,0),ll(e,t,Math.min(4,e.length))}var od=COe;function rp(e,t,n,i,o,r){this._tileset=e,this._tile=t,this._resource=n,this._contents=[],this._metadata=void 0,this._group=void 0,this._readyPromise=TOe(this,i,o,r)}Object.defineProperties(rp.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}},readyPromise:{get:function(){return this._readyPromise}},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 AP=Uint32Array.BYTES_PER_ELEMENT;function TOe(e,t,n,i){n=y(n,0);let o=new Uint8Array(t),r=new DataView(t);n+=AP;let s=r.getUint32(n,!0);if(s!==1)throw new ue(`Only Composite Tile version 1 is supported. Version ${s} is not.`);n+=AP,n+=AP;let a=r.getUint32(n,!0);n+=AP;let c=[],l=e._resource,f=l.queryParameters.compositeIndex;u(f)?f=`${f}_`:f="";for(let d=0;d<a;++d){let p=od(o,n),g=r.getUint32(n+AP*2,!0),m=i[p],A=`${f}${d}`,x=l.getDerivedResource({queryParameters:{compositeIndex:A}});if(u(m)){let C=m(e._tileset,e._tile,x,t,n);e._contents.push(C),c.push(C.readyPromise)}else throw new ue(`Unknown tile content type, ${p}, inside Composite tile`);n+=g}return Promise.all(c).then(function(){return e})}rp.prototype.hasProperty=function(e,t){return!1};rp.prototype.getFeature=function(e){};rp.prototype.applyDebugSettings=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};rp.prototype.applyStyle=function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};rp.prototype.update=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};rp.prototype.isDestroyed=function(){return!1};rp.prototype.destroy=function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return le(this)};var xP=rp;function EOe(e,t,n){return JSON.parse(ll(e,t,n))}var Oo=EOe;function ka(e){this._id=zn();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,Ft.maximumTextureSize),r=Math.ceil(t/Ft.maximumTextureSize),s=1/o,a=s*.5,c=1/r,l=c*.5;n=new H(o,r),i=new oe(s,a,c,l)}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(ka.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return u(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),u(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}}});ka.DEFAULT_COLOR_VALUE=z.WHITE;ka.DEFAULT_SHOW_VALUE=!0;function ste(e){let t=e._textureDimensions;return t.x*t.y*4}function ate(e){if(!u(e._batchValues)){let t=ste(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function cte(e){if(!u(e._showAlphaProperties)){let t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}ka.prototype.setShow=function(e,t){if(t&&!u(this._showAlphaProperties))return;let n=cte(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;let r=ate(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};ka.prototype.setAllShow=function(e){let t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};ka.prototype.getShow=function(e){if(!u(this._showAlphaProperties))return!0;let t=e*2;return this._showAlphaProperties[t]===255};var bOe=new Array(4);ka.prototype.setColor=function(e,t){if(z.equals(t,ka.DEFAULT_COLOR_VALUE)&&!u(this._batchValues))return;let n=t.toBytes(bOe),i=n[3],o=ate(this),r=e*4,s=cte(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 c=s[a+1]!==255,l=s[a]!==0;o[r+3]=l?i:0,s[a+1]=i;let f=i!==255;f&&!c?++this._translucentFeaturesLength:!f&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,u(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};ka.prototype.setAllColor=function(e){let t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};ka.prototype.getColor=function(e,t){if(!u(this._batchValues))return z.clone(ka.DEFAULT_COLOR_VALUE,t);let n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return z.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};ka.prototype.getPickColor=function(e){return this._pickIds[e]};function lte(e,t,n){let i=e._textureDimensions;return new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:ln.NEAREST})}function SOe(e,t){let n=e._featuresLength;if(!u(e._pickTexture)&&n>0){let i=e._pickIds,o=ste(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let c=0;c<n;++c){let l=t.createPickId(s.getFeature(c));i.push(l);let f=l.color,d=c*4;r[d]=z.floatToByte(f.red),r[d+1]=z.floatToByte(f.green),r[d+2]=z.floatToByte(f.blue),r[d+3]=z.floatToByte(f.alpha)}e._pickTexture=lte(e,t,r),u(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function DOe(e){let t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}ka.prototype.update=function(e,t){let n=t.context;this._defaultTexture=n.defaultTexture;let i=t.passes;(i.pick||i.postProcess)&&SOe(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,u(this._batchTexture)||(this._batchTexture=lte(this,n,this._batchValues),u(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),DOe(this))};ka.prototype.isDestroyed=function(){return!1};ka.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 le(this)};var wc=ka;var vOe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wOe={SCALAR:void 0,VEC2:H,VEC3:h,VEC4:oe,MAT2:Ji,MAT3:Z,MAT4:M};function IOe(e){let t=e.componentType,n;typeof t=="string"?n=q.fromName(t):n=t;let i=vOe[e.type],o=wOe[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return q.createArrayBufferView(n,r,s,i*a)}}}var ql=IOe;function sp(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,POe(this,e.extension,e.binaryBody)}Object.defineProperties(sp.prototype,{byteLength:{get:function(){return this._byteLength}}});function POe(e,t,n){let i,o,r,s=t.instancesLength,a=t.classes,c=t.classIds,l=t.parentCounts,f=t.parentIds,d=s,p=0;u(c.byteOffset)&&(c.componentType=y(c.componentType,q.UNSIGNED_SHORT),c.type=rn.SCALAR,r=ql(c),c=r.createArrayBufferView(n.buffer,n.byteOffset+c.byteOffset,s),p+=c.byteLength);let g;if(u(l)){for(u(l.byteOffset)&&(l.componentType=y(l.componentType,q.UNSIGNED_SHORT),l.type=rn.SCALAR,r=ql(l),l=r.createArrayBufferView(n.buffer,n.byteOffset+l.byteOffset,s),p+=l.byteLength),g=new Uint16Array(s),d=0,i=0;i<s;++i)g[i]=d,d+=l[i];p+=g.byteLength}u(f)&&u(f.byteOffset)&&(f.componentType=y(f.componentType,q.UNSIGNED_SHORT),f.type=rn.SCALAR,r=ql(f),f=r.createArrayBufferView(n.buffer,n.byteOffset+f.byteOffset,d),p+=f.byteLength);let m=a.length;for(i=0;i<m;++i){let C=a[i].length,T=a[i].instances,E=OOe(C,T,n);p+=ROe(E),a[i].instances=_t(E,T)}let A=new Array(m).fill(0),x=new Uint16Array(s);for(i=0;i<s;++i)o=c[i],x[i]=A[o],++A[o];p+=x.byteLength,e._classes=a,e._classIds=c,e._classIndexes=x,e._parentCounts=l,e._parentIndexes=g,e._parentIds=f,e._byteLength=p}function OOe(e,t,n){let i;for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=r.byteOffset;if(u(s)){let a=r.componentType,c=r.type;if(!u(a))throw new ue("componentType is required.");if(!u(c))throw new ue("type is required.");if(!u(n))throw new ue(`Property ${o} requires a batch table binary.`);let l=ql(r),f=l.componentsPerAttribute,d=l.classType,p=l.createArrayBufferView(n.buffer,n.byteOffset+s,e);u(i)||(i={}),i[o]={typedArray:p,componentCount:f,type:d}}}return i}function ROe(e){let t=0;for(let n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}var BOe=[],MOe=[],LOe=0;function NOe(e,t,n){let i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,c=BOe;c.length=Math.max(c.length,a);let l=++LOe,f=MOe;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===l)continue;c[t]=l;let d=n(e,t);if(u(d))return d;let p=o[t],g=s[t];for(let m=0;m<p;++m){let A=r[g+m];A!==t&&f.push(A)}}}function FOe(e,t,n){let i=!0;for(;i;){let o=n(e,t);if(u(o))return o;let r=e._parentIds[t];i=r!==t,t=r}}function CP(e,t,n){let i=e._parentCounts,o=e._parentIds;if(u(o)){if(u(i))return NOe(e,t,n)}else return n(e,t);return FOe(e,t,n)}sp.prototype.hasProperty=function(e,t){let n=CP(this,e,function(i,o){let r=i._classIds[o],s=i._classes[r].instances;if(u(s[t]))return!0});return u(n)};sp.prototype.propertyExists=function(e){let t=this._classes,n=t.length;for(let i=0;i<n;++i){let o=t[i].instances;if(u(o[e]))return!0}return!1};sp.prototype.getPropertyIds=function(e,t){return t=u(t)?t:[],t.length=0,CP(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};sp.prototype.getProperty=function(e,t){return CP(this,e,function(n,i){let o=n._classIds[i],r=n._classes[o],s=n._classIndexes[i],a=r.instances[t];if(u(a))return u(a.typedArray)?VOe(a,s):Ge(a[s],!0)})};function VOe(e,t){let n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}sp.prototype.setProperty=function(e,t,n){let i=CP(this,e,function(o,r){let s=o._classIds[r],a=o._classes[s],c=o._classIndexes[r],l=a.instances[t];if(u(l))return u(l.typedArray)?UOe(l,c,n):l[c]=Ge(n,!0),!0});return u(i)};function UOe(e,t,n){let i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}sp.prototype.isClass=function(e,t){let n=CP(this,e,function(i,o){let r=i._classIds[o];if(i._classes[r].name===t)return!0});return u(n)};sp.prototype.getClassName=function(e){let t=this._classIds[e];return this._classes[t].name};var oA=sp;var kOe={HIGHLIGHT:0,REPLACE:1,MIX:2},ul=Object.freeze(kOe);var i5=wc.DEFAULT_COLOR_VALUE,o5=wc.DEFAULT_SHOW_VALUE;function co(e,t,n,i,o){this.featuresLength=t;let r;u(n)&&(r=n.extensions),this._extensions=y(r,{});let s=zOe(n);this._properties=s,this._batchTableHierarchy=HOe(this,n,i);let a=fte(t,s,i);this._binaryPropertiesByteLength=GOe(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new wc({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}co._deprecationWarning=nr;Object.defineProperties(co.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return u(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function zOe(e){let t={};if(!u(e))return t;for(let n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=Ge(e[n],!0));return t}function HOe(e,t,n){if(!u(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"],o=t.HIERARCHY;if(u(o)&&(co._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),!!u(i))return new oA({extension:i,binaryBody:n})}function fte(e,t,n){let i;for(let o in t)if(t.hasOwnProperty(o)){let r=t[o],s=r.byteOffset;if(u(s)){let a=r.componentType,c=r.type;if(!u(a))throw new ue("componentType is required.");if(!u(c))throw new ue("type is required.");if(!u(n))throw new ue(`Property ${o} requires a batch table binary.`);let l=ql(r),f=l.componentsPerAttribute,d=l.classType,p=l.createArrayBufferView(n.buffer,n.byteOffset+s,e);u(i)||(i={}),i[o]={typedArray:p,componentCount:f,type:d}}}return i}function GOe(e){if(!u(e))return 0;let t=0;for(let n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}co.getBinaryProperties=function(e,t,n){return fte(e,t,n)};co.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};co.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};co.prototype.getShow=function(e){return this._batchTexture.getShow(e)};co.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};co.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};co.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};co.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};var WOe=new z;co.prototype.applyStyle=function(e){if(!u(e)){this.setAllColor(i5),this.setAllShow(o5);return}let t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){let o=t.getFeature(i),r=u(e.color)?y(e.color.evaluateColor(o,WOe),i5):i5,s=u(e.show)?y(e.show.evaluate(o),o5):o5;this.setColor(i,r),this.setShow(i,s)}};function jOe(e,t){let n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function YOe(e,t,n){let i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}co.prototype.isClass=function(e,t){let n=this._batchTableHierarchy;return u(n)?n.isClass(e,t):!1};co.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t};co.prototype.getExactClassName=function(e){let t=this._batchTableHierarchy;if(u(t))return t.getClassName(e)};co.prototype.hasProperty=function(e,t){return u(this._properties[t])||u(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};co.prototype.hasPropertyBySemantic=function(){return!1};co.prototype.getPropertyIds=function(e,t){t=u(t)?t:[],t.length=0;let n=Object.keys(this._properties);return t.push.apply(t,n),u(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};co.prototype.getPropertyBySemantic=function(e,t){};co.prototype.getProperty=function(e,t){if(u(this._batchTableBinaryProperties)){let i=this._batchTableBinaryProperties[t];if(u(i))return jOe(i,e)}let n=this._properties[t];if(u(n))return Ge(n[e],!0);if(u(this._batchTableHierarchy)){let i=this._batchTableHierarchy.getProperty(e,t);if(u(i))return i}};co.prototype.setProperty=function(e,t,n){let i=this.featuresLength;if(u(this._batchTableBinaryProperties)){let r=this._batchTableBinaryProperties[t];if(u(r)){YOe(r,e,n);return}}if(u(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];u(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=Ge(n,!0)};function qOe(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)); 
} 
`}co.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;let i=this;return function(o){let r=dte(o,n,!1),s;return Ft.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}
${qOe(i)}${s}`}};function ute(e,t){return e=ke.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 XOe(e,t){let n=`texture(${t}`,i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let l=o;l<e.length;++l){let f=e.charAt(l);if(f==="(")++s;else if(f===")"&&(--s,s===0)){r=l+1;break}}let c=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+c+e.slice(r),i=o+c.length,o=e.indexOf(n,i)}return e}function dte(e,t,n){if(!u(t))return ute(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`),o=e.match(i);if(!u(o))return ute(e,n);let r=o[0],s=o[2];e=ke.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); 
} 
`,c=`    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); 
`,l;if(s==="vec3"||s==="vec4"){let f=s==="vec3"?`vec4(${t}, 1.0)`:t,d=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,d),l=`    vec4 source = ${f}; 
    tile_diffuse = tile_diffuse_final(source, tile_featureColor); 
    tile_main(); 
`}else s==="sampler2D"&&(e=XOe(e,t),l=`    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) 
{ 
${l}`,n&&(e+=c),e+=`} 
`,e}co.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=dte(i,t,!0),Ft.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}};co.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=ke.replaceMain(e,"tile_main"),Ft.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture;
in vec2 tile_featureSt; 
in vec4 tile_featureColor; 
void main() 
{ 
    tile_main(); 
    out_FragColor = tile_featureColor; 
    out_FragColor.rgb *= out_FragColor.a; 
}`:e+=`uniform sampler2D tile_batchTexture; 
uniform sampler2D tile_pickTexture;
in vec2 tile_featureSt; 
void main() 
{ 
    tile_main(); 
    vec4 featureProperties = texture(tile_batchTexture, tile_featureSt); 
    if (featureProperties.a == 0.0) { 
        discard; 
    } 
    out_FragColor = featureProperties; 
    out_FragColor.rgb *= out_FragColor.a; 
} 
`,e}};function KOe(e){let t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===ul.HIGHLIGHT)return 0;if(n===ul.REPLACE)return 1;if(n===ul.MIX)return P.clamp(i,P.EPSILON4,1)}co.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;let e=this;return function(t){return _t(t,{tile_batchTexture:function(){return y(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return KOe(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};co.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};var ag={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};co.prototype.addDerivedCommands=function(e,t){let n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s._skipLevelOfDetail&&s._hasMixedContent&&e.context.stencilBuffer,c=ZOe(this);for(let l=t;l<i;++l){let f=n[l];if(f.pass===Ee.COMPUTE)continue;let d=f.derivedCommands.tileset;(!u(d)||f.dirty)&&(d={},f.derivedCommands.tileset=d,d.originalCommand=JOe(f),f.dirty=!1);let p=d.originalCommand;c!==ag.ALL_OPAQUE&&f.pass!==Ee.TRANSLUCENT&&(u(d.translucent)||(d.translucent=QOe(p))),c!==ag.ALL_TRANSLUCENT&&f.pass!==Ee.TRANSLUCENT&&(u(d.opaque)||(d.opaque=$Oe(p)),a&&(r||(u(d.zback)||(d.zback=tRe(e.context,p)),s._backfaceCommands.push(d.zback)),(!u(d.stencil)||o._selectionDepth!==iRe(d.stencil))&&(f.renderState.depthMask?d.stencil=nRe(p,o._selectionDepth):d.stencil=d.opaque)));let g=a?d.stencil:d.opaque,m=d.translucent;f.pass!==Ee.TRANSLUCENT?(c===ag.ALL_OPAQUE&&(n[l]=g),c===ag.ALL_TRANSLUCENT&&(n[l]=m),c===ag.OPAQUE_AND_TRANSLUCENT&&(n[l]=g,n.push(m))):n[l]=p}};function ZOe(e){let t=e._batchTexture.translucentFeaturesLength;return t===0?ag.ALL_OPAQUE:t===e.featuresLength?ag.ALL_TRANSLUCENT:ag.OPAQUE_AND_TRANSLUCENT}function JOe(e){let t=tt.shallowClone(e),n=t.pass===Ee.TRANSLUCENT;return t.uniformMap=u(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function QOe(e){let t=tt.shallowClone(e);return t.pass=Ee.TRANSLUCENT,t.renderState=oRe(e.renderState),t}function $Oe(e){let t=tt.shallowClone(e);return t.renderState=rRe(e.renderState),t}function eRe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!u(n)){let i=t.fragmentShaderSource.clone();i.defines=u(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),i.sources.unshift(`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
`),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function tRe(e,t){let n=tt.shallowClone(t),i=Ge(n.renderState,!0);i.cull.enabled=!0,i.cull.face=gi.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=Bt.setCesium3DTileBit(),i.stencilMask=Bt.CESIUM_3D_TILE_MASK,n.renderState=Ue.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=Ge(t.uniformMap);let o=new H(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=eRe(e,t.shaderProgram),n}function nRe(e,t){let n=tt.shallowClone(e),i=Ge(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=Bt.SKIP_LOD_MASK,i.stencilTest.reference=Bt.CESIUM_3D_TILE_MASK|t<<Bt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=kn.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ut.REPLACE,i.stencilTest.backFunction=kn.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=ut.REPLACE,i.stencilMask=Bt.CESIUM_3D_TILE_MASK|Bt.SKIP_LOD_MASK,n.renderState=Ue.fromCache(i),n}function iRe(e){return(e.renderState.stencilTest.reference&Bt.SKIP_LOD_MASK)>>>Bt.SKIP_LOD_BIT_SHIFT}function oRe(e){let t=Ge(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=un.ALPHA_BLEND,t.stencilTest=Bt.setCesium3DTileBit(),t.stencilMask=Bt.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}function rRe(e){let t=Ge(e,!0);return t.stencilTest=Bt.setCesium3DTileBit(),t.stencilMask=Bt.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}co.prototype.update=function(e,t){this._batchTexture.update(e,t)};co.prototype.isDestroyed=function(){return!1};co.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),le(this)};var ap=co;function sRe(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}var vh=sRe;var AT=`in vec3 position;
in float a_batchId;

uniform mat4 u_modifiedModelViewProjection;

void main()
{
    gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
}
`;function Wu(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Wu.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 u(this._color)||(this._color=new z),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(u(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)}}});Wu.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Wu.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Wu.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Wu.getPropertyInherited=function(e,t,n){let i=e.batchTable;if(u(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(u(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(u(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(u(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),u(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}let c=u(e.group)?e.group.metadata:void 0;if(u(c)){if(c.hasPropertyBySemantic(n))return c.getPropertyBySemantic(n);if(c.hasProperty(n))return c.getProperty(n)}let l=e.tileset.metadata;if(u(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}};Wu.prototype.getPropertyInherited=function(e){return Wu.getPropertyInherited(this._content,this._batchId,e)};Wu.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Wu.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Wu.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Wu.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var xs=Wu;var r5=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)})}},s5=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)})}},He=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+He.version}static addUnaryOp(t){return He.max_unop_len=Math.max(t.length,He.max_unop_len),He.unary_ops[t]=1,He}static addBinaryOp(t,n,i){return He.max_binop_len=Math.max(t.length,He.max_binop_len),He.binary_ops[t]=n,i?He.right_associative.add(t):He.right_associative.delete(t),He}static addIdentifierChar(t){return He.additional_identifier_chars.add(t),He}static addLiteral(t,n){return He.literals[t]=n,He}static removeUnaryOp(t){return delete He.unary_ops[t],t.length===He.max_unop_len&&(He.max_unop_len=He.getMaxKeyLen(He.unary_ops)),He}static removeAllUnaryOps(){return He.unary_ops={},He.max_unop_len=0,He}static removeIdentifierChar(t){return He.additional_identifier_chars.delete(t),He}static removeBinaryOp(t){return delete He.binary_ops[t],t.length===He.max_binop_len&&(He.max_binop_len=He.getMaxKeyLen(He.binary_ops)),He.right_associative.delete(t),He}static removeAllBinaryOps(){return He.binary_ops={},He.max_binop_len=0,He}static removeLiteral(t){return delete He.literals[t],He}static removeAllLiterals(){return He.literals={},He}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 He(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 He.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!He.binary_ops[String.fromCharCode(t)]||He.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return He.isIdentifierStart(t)||He.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(He.hooks[t]){let i={context:this,node:n};return He.hooks.run(t,i),i.node}return n}searchHook(t){if(He.hooks[t]){let n={context:this};return He.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===He.SPACE_CODE||t===He.TAB_CODE||t===He.LF_CODE||t===He.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:He.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===He.SEMCOL_CODE||i===He.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,He.max_binop_len),n=t.length;for(;n>0;){if(He.binary_ops.hasOwnProperty(t)&&(!He.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!He.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,c,l;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:He.binaryPrecedence(n),right_a:He.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=He.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:He.right_associative.has(n)},l=n;let f=d=>r.right_a&&d.right_a?i>d.prec:i<=d.prec;for(;o.length>2&&f(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:He.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+l),o.push(r,t)}for(c=o.length-1,t=o[c];c>1;)t={type:He.BINARY_EXP,operator:o[c-1].value,left:o[c-2],right:t},c-=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,He.isDecimalDigit(t)||t===He.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===He.SQUOTE_CODE||t===He.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===He.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,He.max_unop_len),i=n.length;i>0;){if(He.unary_ops.hasOwnProperty(n)&&(!He.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!He.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:He.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}He.isIdentifierStart(t)?(o=this.gobbleIdentifier(),He.literals.hasOwnProperty(o.name)?o={type:He.LITERAL,value:He.literals[o.name],raw:o.name}:o.name===He.this_str&&(o={type:He.THIS_EXP})):t===He.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===He.PERIOD_CODE||n===He.OBRACK_CODE||n===He.OPAREN_CODE||n===He.QUMARK_CODE;){let i;if(n===He.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==He.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===He.OBRACK_CODE?(t={type:He.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),n=this.code,n!==He.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===He.OPAREN_CODE?t={type:He.CALL_EXP,arguments:this.gobbleArguments(He.CPAREN_CODE),callee:t}:(n===He.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:He.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(;He.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===He.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);He.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++));He.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);He.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,He.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===He.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===He.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:He.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:He.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(He.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,He.isIdentifierPart(t));)this.index++;return{type:He.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===He.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===He.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===He.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===He.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===He.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(He.CPAREN_CODE);if(this.code===He.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:He.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:He.ARRAY_EXP,elements:this.gobbleArguments(He.CBRACK_CODE)}}},aRe=new r5;Object.assign(He,{hooks:aRe,plugins:new s5(He),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,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});He.max_unop_len=He.getMaxKeyLen(He.unary_ops);He.max_binop_len=He.getMaxKeyLen(He.binary_ops);var cg=e=>new He(e).parse(),cRe=Object.getOwnPropertyNames(He);cRe.forEach(e=>{cg[e]===void 0&&e!=="prototype"&&(cg[e]=He[e])});cg.Jsep=He;var lRe="ConditionalExpression",uRe={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:lRe,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 :")}})}};cg.plugins.register(uRe);var fRe={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},ht=Object.freeze(fRe);function rd(e,t){this._expression=e,e=bRe(e,t),e=DRe(SRe(e)),cg.addBinaryOp("=~",0),cg.addBinaryOp("!~",0);let n;try{n=cg(e)}catch(i){throw new ue(i)}this._runtimeAst=Ai(this,n)}Object.defineProperties(rd.prototype,{expression:{get:function(){return this._expression}}});var Bn={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new H],cartesian3Array:[new h],cartesian4Array:[new oe],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 h),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new oe),this.cartesian4Array[this.cartesian4Index++]}};rd.prototype.evaluate=function(e,t){Bn.reset();let n=this._runtimeAst.evaluate(e);return t instanceof z&&n instanceof oe?z.fromCartesian4(n,t):n instanceof H||n instanceof h||n instanceof oe?n.clone(t):n};rd.prototype.evaluateColor=function(e,t){Bn.reset();let n=this._runtimeAst.evaluate(e);return z.fromCartesian4(n,t)};rd.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
{
    return ${o};
}
`,o};rd.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};rd.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var dRe=["!","-","+"],hte=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],_V=/\${(.*?)}/g,hRe=/\\/g,mRe="@#%",pRe=/@#%/g,gV=new z,yV={abs:Cs(Math.abs),sqrt:Cs(Math.sqrt),cos:Cs(Math.cos),sin:Cs(Math.sin),tan:Cs(Math.tan),acos:Cs(Math.acos),asin:Cs(Math.asin),atan:Cs(Math.atan),radians:Cs(P.toRadians),degrees:Cs(P.toDegrees),sign:Cs(P.sign),floor:Cs(Math.floor),ceil:Cs(Math.ceil),round:Cs(Math.round),exp:Cs(Math.exp),exp2:Cs(gRe),log:Cs(Math.log),log2:Cs(yRe),fract:Cs(_Re),length:ARe,normalize:xRe},AV={atan2:mV(Math.atan2,!1),pow:mV(Math.pow,!1),min:mV(Math.min,!0),max:mV(Math.max,!0),distance:CRe,dot:TRe,cross:ERe},l5={clamp:mte(P.clamp,!0),mix:mte(P.lerp,!0)};function _Re(e){return e-Math.floor(e)}function gRe(e){return Math.pow(2,e)}function yRe(e){return P.log2(e)}function Cs(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),Bn.getCartesian2());if(n instanceof h)return h.fromElements(e(n.x),e(n.y),e(n.z),Bn.getCartesian3());if(n instanceof oe)return oe.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Bn.getCartesian4());throw new ue(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function mV(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),Bn.getCartesian2());if(i instanceof h)return h.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Bn.getCartesian3());if(i instanceof oe)return oe.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Bn.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),Bn.getCartesian2());if(i instanceof h&&o instanceof h)return h.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Bn.getCartesian3());if(i instanceof oe&&o instanceof oe)return oe.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Bn.getCartesian4());throw new ue(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function mte(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),Bn.getCartesian2());if(i instanceof h&&o instanceof h)return h.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Bn.getCartesian3());if(i instanceof oe&&o instanceof oe)return oe.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),Bn.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),Bn.getCartesian2());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),e(i.z,o.z,r.z),Bn.getCartesian3());if(i instanceof oe&&o instanceof oe&&r instanceof oe)return oe.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),Bn.getCartesian4());throw new ue(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function ARe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof H)return H.magnitude(t);if(t instanceof h)return h.magnitude(t);if(t instanceof oe)return oe.magnitude(t);throw new ue(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function xRe(e,t){if(typeof t=="number")return 1;if(t instanceof H)return H.normalize(t,Bn.getCartesian2());if(t instanceof h)return h.normalize(t,Bn.getCartesian3());if(t instanceof oe)return oe.normalize(t,Bn.getCartesian4());throw new ue(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function CRe(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 h&&n instanceof h)return h.distance(t,n);if(t instanceof oe&&n instanceof oe)return oe.distance(t,n);throw new ue(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function TRe(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 h&&n instanceof h)return h.dot(t,n);if(t instanceof oe&&n instanceof oe)return oe.dot(t,n);throw new ue(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function ERe(e,t,n){if(t instanceof h&&n instanceof h)return h.cross(t,n,Bn.getCartesian3());throw new ue(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function gt(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,NRe(this)}function bRe(e,t){if(!u(t))return e;for(let n in t)if(t.hasOwnProperty(n)){let i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;u(o)&&(e=e.replace(i,o))}return e}function SRe(e){return e.replace(hRe,mRe)}function c5(e){return e.replace(pRe,"\\")}function DRe(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 ue("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function vRe(e){let t=typeof e.value;if(e.value===null)return new gt(ht.LITERAL_NULL,null);if(t==="boolean")return new gt(ht.LITERAL_BOOLEAN,e.value);if(t==="number")return new gt(ht.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new gt(ht.VARIABLE_IN_STRING,e.value):new gt(ht.LITERAL_STRING,c5(e.value))}function wRe(e,t){let n=t.arguments,i=n.length,o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;let c=t.callee.object;if(o==="test"||o==="exec"){if(!u(c.callee)||c.callee.name!=="regExp")throw new ue(`${o} is not a function.`);return i===0?o==="test"?new gt(ht.LITERAL_BOOLEAN,!1):new gt(ht.LITERAL_NULL,null):(s=Ai(e,c),a=Ai(e,n[0]),new gt(ht.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=Ai(e,c),new gt(ht.FUNCTION_CALL,o,r);throw new ue(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new gt(ht.LITERAL_COLOR,o);if(r=Ai(e,n[0]),u(n[1])){let c=Ai(e,n[1]);return new gt(ht.LITERAL_COLOR,o,[r,c])}return new gt(ht.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new ue(`${o} requires three arguments.`);return r=[Ai(e,n[0]),Ai(e,n[1]),Ai(e,n[2])],new gt(ht.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new ue(`${o} requires four arguments.`);return r=[Ai(e,n[0]),Ai(e,n[1]),Ai(e,n[2]),Ai(e,n[3])],new gt(ht.LITERAL_COLOR,o,r)}else if(o==="vec2"||o==="vec3"||o==="vec4"){r=new Array(i);for(let c=0;c<i;++c)r[c]=Ai(e,n[c]);return new gt(ht.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new gt(ht.LITERAL_BOOLEAN,!0):new gt(ht.LITERAL_BOOLEAN,!1):(r=Ai(e,n[0]),new gt(ht.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new ue(`${o} requires exactly one argument.`);return r=Ai(e,n[0]),new gt(ht.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new ue(`${o} does not take any argument.`);return new gt(ht.UNARY,o)}else if(u(yV[o])){if(i!==1)throw new ue(`${o} requires exactly one argument.`);return r=Ai(e,n[0]),new gt(ht.UNARY,o,r)}else if(u(AV[o])){if(i!==2)throw new ue(`${o} requires exactly two arguments.`);return s=Ai(e,n[0]),a=Ai(e,n[1]),new gt(ht.BINARY,o,s,a)}else if(u(l5[o])){if(i!==3)throw new ue(`${o} requires exactly three arguments.`);s=Ai(e,n[0]),a=Ai(e,n[1]);let c=Ai(e,n[2]);return new gt(ht.TERNARY,o,s,a,c)}else{if(o==="Boolean")return i===0?new gt(ht.LITERAL_BOOLEAN,!1):(r=Ai(e,n[0]),new gt(ht.UNARY,o,r));if(o==="Number")return i===0?new gt(ht.LITERAL_NUMBER,0):(r=Ai(e,n[0]),new gt(ht.UNARY,o,r));if(o==="String")return i===0?new gt(ht.LITERAL_STRING,""):(r=Ai(e,n[0]),new gt(ht.UNARY,o,r));if(o==="regExp")return IRe(e,t)}}throw new ue(`Unexpected function call "${o}".`)}function IRe(e,t){let n=t.arguments;if(n.length===0)return new gt(ht.LITERAL_REGEX,new RegExp);let i=Ai(e,n[0]),o;if(n.length>1){let r=Ai(e,n[1]);if(a5(i)&&a5(r)){try{o=new RegExp(c5(String(i._value)),r._value)}catch(s){throw new ue(s)}return new gt(ht.LITERAL_REGEX,o)}return new gt(ht.REGEX,i,r)}if(a5(i)){try{o=new RegExp(c5(String(i._value)))}catch(r){throw new ue(r)}return new gt(ht.LITERAL_REGEX,o)}return new gt(ht.REGEX,i)}function PRe(e){if(MRe(e.name)){let t=LRe(e.name);return t.substr(0,8)==="tiles3d_"?new gt(ht.BUILTIN_VARIABLE,t):new gt(ht.VARIABLE,t)}else{if(e.name==="NaN")return new gt(ht.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new gt(ht.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new gt(ht.LITERAL_UNDEFINED,void 0)}throw new ue(`${e.name} is not defined.`)}function ORe(e){let t=e.property.name;if(t==="PI")return new gt(ht.LITERAL_NUMBER,Math.PI);if(t==="E")return new gt(ht.LITERAL_NUMBER,Math.E)}function RRe(e){if(e.property.name==="POSITIVE_INFINITY")return new gt(ht.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function BRe(e,t){if(t.object.name==="Math")return ORe(t);if(t.object.name==="Number")return RRe(t);let n,i=Ai(e,t.object);return t.computed?(n=Ai(e,t.property),new gt(ht.MEMBER,"brackets",i,n)):(n=new gt(ht.LITERAL_STRING,t.property.name),new gt(ht.MEMBER,"dot",i,n))}function a5(e){return e._type>=ht.LITERAL_NULL}function MRe(e){return e.substr(0,4)==="czm_"}function LRe(e){return e.substr(4)}function Ai(e,t){let n,i,o,r;if(t.type==="Literal")n=vRe(t);else if(t.type==="CallExpression")n=wRe(e,t);else if(t.type==="Identifier")n=PRe(t);else if(t.type==="UnaryExpression"){i=t.operator;let s=Ai(e,t.argument);if(dRe.indexOf(i)>-1)n=new gt(ht.UNARY,i,s);else throw new ue(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=Ai(e,t.left),r=Ai(e,t.right),hte.indexOf(i)>-1)n=new gt(ht.BINARY,i,o,r);else throw new ue(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=Ai(e,t.left),r=Ai(e,t.right),hte.indexOf(i)>-1&&(n=new gt(ht.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){let s=Ai(e,t.test);o=Ai(e,t.consequent),r=Ai(e,t.alternate),n=new gt(ht.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=BRe(e,t);else if(t.type==="ArrayExpression"){let s=[];for(let a=0;a<t.elements.length;a++)s[a]=Ai(e,t.elements[a]);n=new gt(ht.ARRAY,s)}else throw t.type==="Compound"?new ue("Provide exactly one expression."):new ue("Cannot parse expression.");return n}function NRe(e){e._type===ht.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ht.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===ht.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:u(yV[e._value])&&(e.evaluate=VRe(e._value)):e._type===ht.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:u(AV[e._value])&&(e.evaluate=URe(e._value)):e._type===ht.TERNARY?e.evaluate=kRe(e._value):e._type===ht.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ht.ARRAY?e.evaluate=e._evaluateArray:e._type===ht.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ht.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ht.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ht.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ht.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ht.REGEX?e.evaluate=e._evaluateRegExp:e._type===ht.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=FRe):e.evaluate=e._evaluateLiteral}function FRe(e){return u(e)?e.content.tileset.timeSinceLoad:0}function VRe(e){let t=yV[e];return function(n){let i=this._left.evaluate(n);return t(e,i)}}function URe(e){let t=AV[e];return function(n){let i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function kRe(e){let t=l5[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(u(e))return e.getPropertyInherited(t)}gt.prototype._evaluateLiteral=function(){return this._value};gt.prototype._evaluateLiteralColor=function(e){let t=gV,n=this._left;if(this._value==="color")u(n)?n.length>1?(z.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):z.fromCssColorString(n[0].evaluate(e),t):z.fromBytes(255,255,255,255,t);else if(this._value==="rgb")z.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;z.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return oe.fromColor(t,Bn.getCartesian4())};gt.prototype._evaluateLiteralVector=function(e){let t=Bn.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){let c=i[a].evaluate(e);if(typeof c=="number")t.push(c);else if(c instanceof H)t.push(c.x,c.y);else if(c instanceof h)t.push(c.x,c.y,c.z);else if(c instanceof oe)t.push(c.x,c.y,c.z,c.w);else throw new ue(`${n} argument must be a vector or number. Argument is ${c}.`)}let r=t.length,s=parseInt(n.charAt(3));if(r===0)throw new ue(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new ue(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new ue(`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,Bn.getCartesian2());if(n==="vec3")return h.fromArray(t,0,Bn.getCartesian3());if(n==="vec4")return oe.fromArray(t,0,Bn.getCartesian4())};gt.prototype._evaluateLiteralString=function(){return this._value};gt.prototype._evaluateVariableString=function(e){let t=this._value,n=_V.exec(t);for(;n!==null;){let i=n[0],o=n[1],r=xV(e,o);u(r)||(r=""),t=t.replace(i,r),n=_V.exec(t)}return t};gt.prototype._evaluateVariable=function(e){return xV(e,this._value)};function rA(e){return e._value==="feature"}gt.prototype._evaluateMemberDot=function(e){if(rA(this._left))return xV(e,this._right.evaluate(e));let t=this._left.evaluate(e);if(!u(t))return;let n=this._right.evaluate(e);if(t instanceof H||t instanceof h||t instanceof oe){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]};gt.prototype._evaluateMemberBrackets=function(e){if(rA(this._left))return xV(e,this._right.evaluate(e));let t=this._left.evaluate(e);if(!u(t))return;let n=this._right.evaluate(e);if(t instanceof H||t instanceof h||t instanceof oe){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]};gt.prototype._evaluateArray=function(e){let t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};gt.prototype._evaluateNot=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ue(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};gt.prototype._evaluateNegative=function(e){let t=this._left.evaluate(e);if(t instanceof H)return H.negate(t,Bn.getCartesian2());if(t instanceof h)return h.negate(t,Bn.getCartesian3());if(t instanceof oe)return oe.negate(t,Bn.getCartesian4());if(typeof t=="number")return-t;throw new ue(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};gt.prototype._evaluatePositive=function(e){let t=this._left.evaluate(e);if(!(t instanceof H||t instanceof h||t instanceof oe||typeof t=="number"))throw new ue(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};gt.prototype._evaluateLessThan=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ue(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};gt.prototype._evaluateLessThanOrEquals=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ue(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};gt.prototype._evaluateGreaterThan=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ue(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};gt.prototype._evaluateGreaterThanOrEquals=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new ue(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};gt.prototype._evaluateOr=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ue(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;let n=this._right.evaluate(e);if(typeof n!="boolean")throw new ue(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};gt.prototype._evaluateAnd=function(e){let t=this._left.evaluate(e);if(typeof t!="boolean")throw new ue(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;let n=this._right.evaluate(e);if(typeof n!="boolean")throw new ue(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};gt.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,Bn.getCartesian2());if(n instanceof h&&t instanceof h)return h.add(t,n,Bn.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.add(t,n,Bn.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new ue(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};gt.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,Bn.getCartesian2());if(n instanceof h&&t instanceof h)return h.subtract(t,n,Bn.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.subtract(t,n,Bn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new ue(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};gt.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,Bn.getCartesian2());if(n instanceof H&&typeof t=="number")return H.multiplyByScalar(n,t,Bn.getCartesian2());if(t instanceof H&&typeof n=="number")return H.multiplyByScalar(t,n,Bn.getCartesian2());if(n instanceof h&&t instanceof h)return h.multiplyComponents(t,n,Bn.getCartesian3());if(n instanceof h&&typeof t=="number")return h.multiplyByScalar(n,t,Bn.getCartesian3());if(t instanceof h&&typeof n=="number")return h.multiplyByScalar(t,n,Bn.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.multiplyComponents(t,n,Bn.getCartesian4());if(n instanceof oe&&typeof t=="number")return oe.multiplyByScalar(n,t,Bn.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.multiplyByScalar(t,n,Bn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new ue(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};gt.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,Bn.getCartesian2());if(t instanceof H&&typeof n=="number")return H.divideByScalar(t,n,Bn.getCartesian2());if(n instanceof h&&t instanceof h)return h.divideComponents(t,n,Bn.getCartesian3());if(t instanceof h&&typeof n=="number")return h.divideByScalar(t,n,Bn.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.divideComponents(t,n,Bn.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.divideByScalar(t,n,Bn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new ue(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};gt.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,Bn.getCartesian2());if(n instanceof h&&t instanceof h)return h.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Bn.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,Bn.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new ue(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};gt.prototype._evaluateEqualsStrict=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof h&&t instanceof h||n instanceof oe&&t instanceof oe?t.equals(n):t===n};gt.prototype._evaluateNotEqualsStrict=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof h&&t instanceof h||n instanceof oe&&t instanceof oe?!t.equals(n):t!==n};gt.prototype._evaluateConditional=function(e){let t=this._test.evaluate(e);if(typeof t!="boolean")throw new ue(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};gt.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};gt.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};gt.prototype._evaluateIsExactClass=function(e){return u(e)?e.isExactClass(this._left.evaluate(e)):!1};gt.prototype._evaluateIsClass=function(e){return u(e)?e.isClass(this._left.evaluate(e)):!1};gt.prototype._evaluateGetExactClassName=function(e){if(u(e))return e.getExactClassName()};gt.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};gt.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};gt.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};gt.prototype._evaluateRegExp=function(e){let t=this._value.evaluate(e),n="";u(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new ue(o)}return i};gt.prototype._evaluateRegExpTest=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new ue(`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)};gt.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 ue(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};gt.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 ue(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};gt.prototype._evaluateRegExpExec=function(e){let t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new ue(`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 u(i)?i[1]:null};gt.prototype._evaluateToString=function(e){let t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof H||t instanceof h||t instanceof oe)return String(t);throw new ue(`Unexpected function call "${this._value}".`)};function pte(e){let t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==ht.LITERAL_NUMBER)return;let i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return z.fromHsl(i,o,r,s,gV)}function _te(e){let t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==ht.LITERAL_NUMBER)return;let i=gV;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 lg(e){return e%1===0?e.toFixed(1):e.toString()}function zRe(e){let t=lg(e.red),n=lg(e.green),i=lg(e.blue);return`vec3(${t}, ${n}, ${i})`}function pV(e){let t=lg(e.red),n=lg(e.green),i=lg(e.blue),o=lg(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function gte(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 yte(e,t){return u(t[e])?t[e]:rd.NULL_SENTINEL}rd.NULL_SENTINEL="czm_infinity";gt.prototype.getShaderExpression=function(e,t,n){let i,o,r,s,a=this._type,c=this._value;u(this._left)&&(Array.isArray(this._left)?o=gte(this._left,e,t,this):o=this._left.getShaderExpression(e,t,this)),u(this._right)&&(r=this._right.getShaderExpression(e,t,this)),u(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(c=gte(this._value,e,t,this));let l,f,d;switch(a){case ht.VARIABLE:return rA(this)?void 0:yte(c,e);case ht.UNARY:if(c==="Boolean")return`bool(${o})`;if(c==="Number")return`float(${o})`;if(c==="round")return`floor(${o} + 0.5)`;if(u(yV[c]))return`${c}(${o})`;if(c==="isNaN")return`(${o} != ${o})`;if(c==="isFinite")return`(abs(${o}) < czm_infinity)`;if(c==="String"||c==="isExactClass"||c==="isClass"||c==="getExactClassName")throw new ue(`Error generating style shader: "${c}" is not supported.`);return c+o;case ht.BINARY:return c==="%"?`mod(${o}, ${r})`:c==="==="?`(${o} == ${r})`:c==="!=="?`(${o} != ${r})`:c==="atan2"?`atan(${o}, ${r})`:u(AV[c])?`${c}(${o}, ${r})`:`(${o} ${c} ${r})`;case ht.TERNARY:if(u(l5[c]))return`${c}(${o}, ${r}, ${s})`;break;case ht.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case ht.MEMBER:return rA(this._left)?yte(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 ht.FUNCTION_CALL:throw new ue(`Error generating style shader: "${c}" is not supported.`);case ht.ARRAY:if(c.length===4)return`vec4(${c[0]}, ${c[1]}, ${c[2]}, ${c[3]})`;if(c.length===3)return`vec3(${c[0]}, ${c[1]}, ${c[2]})`;if(c.length===2)return`vec2(${c[0]}, ${c[1]})`;throw new ue("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ht.REGEX:throw new ue("Error generating style shader: Regular expressions are not supported.");case ht.VARIABLE_IN_STRING:throw new ue("Error generating style shader: Converting a variable to a string is not supported.");case ht.LITERAL_NULL:return rd.NULL_SENTINEL;case ht.LITERAL_BOOLEAN:return c?"true":"false";case ht.LITERAL_NUMBER:return lg(c);case ht.LITERAL_STRING:if(u(n)&&n._type===ht.MEMBER&&(c==="r"||c==="g"||c==="b"||c==="a"||c==="x"||c==="y"||c==="z"||c==="w"||rA(n._left)))return c;if(i=z.fromCssColorString(c,gV),u(i))return zRe(i);throw new ue("Error generating style shader: String literals are not supported.");case ht.LITERAL_COLOR:if(l=o,c==="color"){if(u(l)){if(l.length>1){let p=l[0],g=l[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${p}, ${g})`}}else return"vec4(1.0)";return`vec4(${l[0]}, 1.0)`}else{if(c==="rgb")return i=_te(this),u(i)?pV(i):`vec4(${l[0]} / 255.0, ${l[1]} / 255.0, ${l[2]} / 255.0, 1.0)`;if(c==="rgba")return l[3]!=="1.0"&&(t.translucent=!0),i=_te(this),u(i)?pV(i):`vec4(${l[0]} / 255.0, ${l[1]} / 255.0, ${l[2]} / 255.0, ${l[3]})`;if(c==="hsl")return i=pte(this),u(i)?pV(i):`vec4(czm_HSLToRGB(vec3(${l[0]}, ${l[1]}, ${l[2]})), 1.0)`;if(c==="hsla")return i=pte(this),u(i)?(i.alpha!==1&&(t.translucent=!0),pV(i)):(l[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${l[0]}, ${l[1]}, ${l[2]})), ${l[3]})`)}break;case ht.LITERAL_VECTOR:f=o.length,d=`${c}(`;for(let p=0;p<f;++p)d+=o[p],p<f-1&&(d+=", ");return d+=")",d;case ht.LITERAL_REGEX:throw new ue("Error generating style shader: Regular expressions are not supported.");case ht.LITERAL_UNDEFINED:return rd.NULL_SENTINEL;case ht.BUILTIN_VARIABLE:if(c==="tiles3d_tileset_time")return c}};gt.prototype.getVariables=function(e,t){let n,i,o,r=this._type,s=this._value;if(u(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(u(this._right)&&this._right.getVariables(e,this),u(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 ht.VARIABLE:rA(this)||e.push(s);break;case ht.VARIABLE_IN_STRING:for(a=_V.exec(s);a!==null;)e.push(a[1]),a=_V.exec(s);break;case ht.LITERAL_STRING:u(t)&&t._type===ht.MEMBER&&rA(t._left)&&e.push(s);break}};var ju=rd;function cp(e){e=y(e,y.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=y(e.center,h.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=z.clone(z.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=y(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(cp.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});var HRe={position:0,a_batchId:1};function GRe(e,t){if(u(e._va))return;let n=lt.createVertexBuffer({context:t,typedArray:e._positions,usage:Ne.STATIC_DRAW}),i=lt.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:Ne.STATIC_DRAW}),o=lt.createIndexBuffer({context:t,typedArray:e._indices,usage:Ne.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:q.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:q.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new oi({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new oi({context:t,attributes:r,indexBuffer:lt.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:Ne.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function WRe(e,t){if(u(e._sp))return;let n=e._batchTable,i=y(e._attributeLocations,HRe),o=e._pickId,r=e._vertexShaderSource,s=e._fragmentShaderSource;if(u(r)){e._sp=Xt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=ke.replaceMain(s,"czm_non_pick_main"),s=`${s}void main() 
{ 
    czm_non_pick_main(); 
    out_FragColor = ${o}; 
} 
`,e._spPick=Xt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}let a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(AT),c=n.getFragmentShaderCallback(!1,void 0,!0)(eg);o=n.getPickId();let l=new ke({sources:[a]}),f=new ke({defines:["VECTOR_TILE"],sources:[c]});e._sp=Xt.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:f,attributeLocations:i}),l=new ke({sources:[AT]}),f=new ke({defines:["VECTOR_TILE"],sources:[eg]}),e._spStencil=Xt.fromCache({context:t,vertexShaderSource:l,fragmentShaderSource:f,attributeLocations:i}),c=ke.replaceMain(c,"czm_non_pick_main"),c=`${c}
void main() 
{ 
    czm_non_pick_main(); 
    out_FragColor = ${o}; 
} 
`;let d=new ke({sources:[a]}),p=new ke({defines:["VECTOR_TILE"],sources:[c]});e._spPick=Xt.fromCache({context:t,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:i})}function Ate(e){let t=e?kn.EQUAL:kn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:ut.KEEP,zFail:ut.DECREMENT_WRAP,zPass:ut.KEEP},backFunction:t,backOperation:{fail:ut.KEEP,zFail:ut.INCREMENT_WRAP,zPass:ut.KEEP},reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Fa.LESS_OR_EQUAL},depthMask:!1}}var jRe={stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND},YRe={stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function qRe(e){u(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Ue.fromCache(Ate(!1)),e._rsStencilDepthPass3DTiles=Ue.fromCache(Ate(!0)),e._rsColorPass=Ue.fromCache(jRe),e._rsPickPass=Ue.fromCache(YRe))}var sA=new M,xte=new h;function XRe(e,t){if(u(e._uniformMap))return;let n={u_modifiedModelViewProjection:function(){let i=t.uniformState.view,o=t.uniformState.projection;return M.clone(i,sA),M.multiplyByPoint(sA,e._center,xte),M.setTranslation(sA,xte,sA),M.multiply(o,sA,sA),sA},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function u5(e,t,n,i,o,r,s){let a=e.constructor.BYTES_PER_ELEMENT,c=r.length;for(let l=0;l<c;++l){let f=r[l],d=s[f],p=i[d],g=o[d],m=new e.constructor(e.buffer,a*p,g);t.set(m,n),i[d]=n,n+=g}return n}function KRe(e,t){let n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length),a=t.pop(),c=[a],l=u5(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=l;t.length>0;){let f=t.pop();if(z.equals(f.color,a.color))l=u5(n,s,l,i,o,f.batchIds,r),a.batchIds=a.batchIds.concat(f.batchIds),a.count=l-a.offset;else{let d=l;l=u5(n,s,l,i,o,f.batchIds,r),f.offset=d,f.count=l-d,c.push(f),a=f}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}function f5(e,t,n,i,o,r,s){let a=e.bytesPerIndex,c=r.length;for(let l=0;l<c;++l){let f=r[l],d=s[f],p=i[d],g=o[d];t.copyFromBuffer(e,p*a,n*a,g*a),i[d]=n,n+=g}return n}function ZRe(e,t){let n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp,r=t.pop(),s=[r],a=e._va.indexBuffer,c=e._vaSwap.indexBuffer,l=f5(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=l;t.length>0;){let d=t.pop();if(z.equals(d.color,r.color))l=f5(a,c,l,n,i,d.batchIds,o),r.batchIds=r.batchIds.concat(d.batchIds),r.count=l-r.offset;else{let p=l;l=f5(a,c,l,n,i,d.batchIds,o),d.offset=p,d.count=l-p,s.push(d),r=d}}let f=e._va;e._va=e._vaSwap,e._vaSwap=f,e._batchedIndices=s}function JRe(e,t){return t.color.toRgba()-e.color.toRgba()}function QRe(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 c=n[s].color.toRgba();if(u(r[c])){o=!0;break}else r[c]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(JRe),t.webgl2?ZRe(e,n):KRe(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function $Re(e,t){let n=QRe(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(u(i)&&!n&&i.length===s)return;i.length=s;let a=e._va,c=e._sp,l=y(e._modelMatrix,M.IDENTITY),f=e._uniformMap,d=e._boundingVolume;for(let p=0;p<r;++p){let g=o[p].offset,m=o[p].count,A=i[p*2];u(A)||(A=i[p*2]=new tt({owner:e})),A.vertexArray=a,A.modelMatrix=l,A.offset=g,A.count=m,A.renderState=e._rsStencilDepthPass,A.shaderProgram=c,A.uniformMap=f,A.boundingVolume=d,A.cull=!1,A.pass=Ee.TERRAIN_CLASSIFICATION;let x=tt.shallowClone(A,A.derivedCommands.tileset);x.renderState=e._rsStencilDepthPass3DTiles,x.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,A.derivedCommands.tileset=x;let C=i[p*2+1];u(C)||(C=i[p*2+1]=new tt({owner:e})),C.vertexArray=a,C.modelMatrix=l,C.offset=g,C.count=m,C.renderState=e._rsColorPass,C.shaderProgram=c,C.uniformMap=f,C.boundingVolume=d,C.cull=!1,C.pass=Ee.TERRAIN_CLASSIFICATION;let T=tt.shallowClone(C,C.derivedCommands.tileset);T.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,C.derivedCommands.tileset=T}e._commandsDirty=!0}function eBe(e,t){if(e.classificationType===Un.TERRAIN||!t.invertClassification||u(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 c=0;c<s;++c){let l=i[c]=tt.shallowClone(n[a],i[c]);l.shaderProgram=o,l.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function tBe(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=y(e._modelMatrix,M.IDENTITY),a=e._uniformMap;for(let c=0;c<t;++c){let l=e._indexOffsets[c],f=e._indexCounts[c],d=u(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume,p=n[c*2];u(p)||(p=n[c*2]=new tt({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=l,p.count=f,p.renderState=e._rsStencilDepthPass,p.shaderProgram=o,p.uniformMap=a,p.boundingVolume=d,p.pass=Ee.TERRAIN_CLASSIFICATION;let g=tt.shallowClone(p,p.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=g;let m=n[c*2+1];u(m)||(m=n[c*2+1]=new tt({owner:e,pickOnly:!0})),m.vertexArray=i,m.modelMatrix=s,m.offset=l,m.count=f,m.renderState=e._rsPickPass,m.shaderProgram=r,m.uniformMap=a,m.boundingVolume=d,m.pass=Ee.TERRAIN_CLASSIFICATION;let A=tt.shallowClone(m,m.derivedCommands.tileset);A.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=A}e._pickCommandsDirty=!1}cp.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 xs(e,r)}};cp.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function nBe(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=z.WHITE}let r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=z.clone(z.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}var iBe=new z,oBe=z.WHITE,rBe=!0,sBe=/\$/;cp.prototype.applyStyle=function(e,t){if(!u(e)){nBe(this,t);return}let n=e.color,i=n instanceof ju&&!sBe.test(n.expression);this._updatingAllCommands=i;let o=this._batchIds,r=o.length,s;for(s=0;s<r;++s){let a=o[s],c=t[a];c.color=u(e.color)?e.color.evaluateColor(c,iBe):oBe,c.show=u(e.show)?e.show.evaluate(c):rBe}if(i){let a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=z.clone(z.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};cp.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;let n=this._batchIdLookUp,i=n[e];if(!u(i))return;let o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],c=this._batchedIndices,l=c.length,f;for(f=0;f<l;++f){let A=c[f].offset,x=c[f].count;if(s>=A&&s<A+x)break}c.push(new vh({color:z.clone(t),offset:s,count:a,batchIds:[e]}));let d=[],p=[],g=c[f].batchIds,m=g.length;for(let A=0;A<m;++A){let x=g[A];if(x===e)continue;let C=n[x];o[C]<s?d.push(x):p.push(x)}p.length!==0&&c.push(new vh({color:z.clone(c[f].color),offset:s+a,count:c[f].offset+c[f].count-(s+a),batchIds:p})),d.length!==0?(c[f].count=s-c[f].offset,c[f].batchIds=d):c.splice(f,1),this._batchDirty=!0};function Cte(e,t,n,i){let o=e.classificationType,r=o!==Un.CESIUM_3D_TILE,s=o!==Un.TERRAIN,a=t.commandList,c=n.length,l,f;for(f=0;f<c;++f)r&&(l=n[f],l.pass=Ee.TERRAIN_CLASSIFICATION,a.push(l)),s&&(l=n[f].derivedCommands.tileset,l.pass=Ee.CESIUM_3D_TILE_CLASSIFICATION,a.push(l));if(!(!t.invertClassification||!u(i)))for(c=i.length,f=0;f<c;++f)a.push(i[f])}function aBe(e,t){let n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){let r=t[o+1];r.pass=Ee.OPAQUE,n.push(r)}}function cBe(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;u(e._rsWireframe)||(e._rsWireframe=Ue.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}cp.prototype.update=function(e){let t=e.context;GRe(this,t),WRe(this,t),qRe(this),XRe(this,t);let n=e.passes;n.render&&($Re(this,t),eBe(this,e),cBe(this),this._debugWireframe?aBe(e,this._commands):Cte(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(tBe(this),Cte(this,e,this._pickCommands))};cp.prototype.isDestroyed=function(){return!1};cp.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(),le(this)};var aA=cp;function Xl(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,u(this._center)||(u(this._boundingVolume)?this._center=h.clone(this._boundingVolume.center):this._center=h.clone(h.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._update=function(t,n){},this._readyPromise=pBe(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Un.BOTH}Object.defineProperties(Xl.prototype,{trianglesLength:{get:function(){return u(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return u(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});Xl.packedBoxLength=M.packedLength+h.packedLength;Xl.packedCylinderLength=M.packedLength+2;Xl.packedEllipsoidLength=M.packedLength+h.packedLength;Xl.packedSphereLength=h.packedLength+1;function lBe(e){let t=new Float64Array(M.packedLength+h.packedLength),n=0;return h.pack(e._center,t,n),n+=h.packedLength,M.pack(e._modelMatrix,t,n),t}function uBe(e,t){let n=0,i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let c=0;c<o;++c)r[c]=se.unpack(t,n),n+=se.packedLength;let s=t[n++],a=e._batchedIndices=new Array(s);for(let c=0;c<s;++c){let l=z.unpack(t,n);n+=z.packedLength;let f=t[n++],d=t[n++],p=t[n++],g=new Array(p);for(let m=0;m<p;++m)g[m]=t[n++];a[c]=new vh({color:l,offset:f,count:d,batchIds:g})}return i}var fBe=new pi("createVectorTileGeometries",5),dBe=new z;function hBe(e){if(!u(e._primitive)&&!u(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,o=e._cylinderBatchIds,r=e._ellipsoids,s=e._ellipsoidBatchIds,a=e._spheres,c=e._sphereBatchIds,l=e._batchTableColors,f=e._packedBuffer;if(!u(l)){let m=0;u(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),m+=n.length),u(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),m+=o.length),u(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),m+=s.length),u(e._spheres)&&(a=e._sphere=a.slice(),c=e._sphereBatchIds=c.slice(),m+=c.length),l=e._batchTableColors=new Uint32Array(m);let A=e._batchTable;for(let x=0;x<m;++x){let C=A.getColor(x,dBe);l[x]=C.toRgba()}f=e._packedBuffer=lBe(e)}let d=[];u(t)&&d.push(t.buffer,n.buffer),u(i)&&d.push(i.buffer,o.buffer),u(r)&&d.push(r.buffer,s.buffer),u(a)&&d.push(a.buffer,c.buffer),d.push(l.buffer,f.buffer);let p={boxes:u(t)?t.buffer:void 0,boxBatchIds:u(t)?n.buffer:void 0,cylinders:u(i)?i.buffer:void 0,cylinderBatchIds:u(i)?o.buffer:void 0,ellipsoids:u(r)?r.buffer:void 0,ellipsoidBatchIds:u(r)?s.buffer:void 0,spheres:u(a)?a.buffer:void 0,sphereBatchIds:u(a)?c.buffer:void 0,batchTableColors:l.buffer,packedBuffer:f.buffer},g=e._verticesPromise=fBe.scheduleTask(p,d);return u(g)?g.then(function(m){let A=new Float64Array(m.packedBuffer);uBe(e,A)===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),e._ready=!0}):void 0}}function mBe(e){e._ready&&!u(e._primitive)&&(e._primitive=new aA({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:y(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)}Xl.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Xl.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Xl.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Xl.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function pBe(e){return new Promise(function(t,n){e._update=function(i,o){let r=hBe(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),u(r)&&r.then(function(){mBe(i),t(i)}).catch(function(s){n(s)})}})}Xl.prototype.update=function(e){this._update(this,e)};Xl.prototype.isDestroyed=function(){return!1};Xl.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),le(this)};var lp=Xl;function up(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._readyPromise=yBe(this,i,o)}Object.defineProperties(up.prototype,{featuresLength:{get:function(){return u(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return u(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return u(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return u(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){return this._readyPromise}},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 _Be(e){return function(t,n){u(e._geometries)&&e._geometries.updateCommands(t,n)}}function gBe(e,t){let n,i,o,r,s,a=y(e.BOXES_LENGTH,0),c=y(e.CYLINDERS_LENGTH,0),l=y(e.ELLIPSOIDS_LENGTH,0),f=y(e.SPHERES_LENGTH,0);if(a>0&&u(e.BOX_BATCH_IDS)){let m=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,m,a)}if(c>0&&u(e.CYLINDER_BATCH_IDS)){let m=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,m,c)}if(l>0&&u(e.ELLIPSOID_BATCH_IDS)){let m=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,m,l)}if(f>0&&u(e.SPHERE_BATCH_IDS)){let m=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,m,f)}let d=u(n)||u(i)||u(o)||u(r),p=a>0&&!u(n)||c>0&&!u(i)||l>0&&!u(o)||f>0&&!u(r);if(d&&p)throw new ue("If one group of batch ids is defined, then all batch ids must be defined.");if(!u(n)&&!u(i)&&!u(o)&&!u(r)){let m=0;if(!u(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=m++;if(!u(i)&&c>0)for(i=new Uint16Array(c),s=0;s<c;++s)i[s]=m++;if(!u(o)&&l>0)for(o=new Uint16Array(l),s=0;s<l;++s)o[s]=m++;if(!u(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 cA=Uint32Array.BYTES_PER_ELEMENT;function yBe(e,t,n){n=y(n,0);let i=new Uint8Array(t),o=new DataView(t);n+=cA;let r=o.getUint32(n,!0);if(r!==1)throw new ue(`Only Geometry tile version 1 is supported.  Version ${r} is not.`);n+=cA;let s=o.getUint32(n,!0);if(n+=cA,s===0){e._readyPromise.resolve(e);return}let a=o.getUint32(n,!0);if(n+=cA,a===0)throw new ue("Feature table must have a byte length greater than zero");let c=o.getUint32(n,!0);n+=cA;let l=o.getUint32(n,!0);n+=cA;let f=o.getUint32(n,!0);n+=cA;let d=Oo(i,n,a);n+=a;let p=new Uint8Array(t,n,c);n+=c;let g,m;l>0&&(g=Oo(i,n,l),n+=l,f>0&&(m=new Uint8Array(t,n,f),m=new Uint8Array(m)));let A=y(d.BOXES_LENGTH,0),x=y(d.CYLINDERS_LENGTH,0),C=y(d.ELLIPSOIDS_LENGTH,0),T=y(d.SPHERES_LENGTH,0),E=A+x+C+T,S=new ap(e,E,g,m,_Be(e));if(e._batchTable=S,E===0)return;let D=e.tile.computedTransform,w;u(d.RTC_CENTER)&&(w=h.unpack(d.RTC_CENTER),M.multiplyByPoint(D,w,w));let R=gBe(d,p);if(A>0||x>0||C>0||T>0){let O,L,N,_;if(A>0){let b=p.byteOffset+d.BOXES.byteOffset;O=new Float32Array(p.buffer,b,lp.packedBoxLength*A)}if(x>0){let b=p.byteOffset+d.CYLINDERS.byteOffset;L=new Float32Array(p.buffer,b,lp.packedCylinderLength*x)}if(C>0){let b=p.byteOffset+d.ELLIPSOIDS.byteOffset;N=new Float32Array(p.buffer,b,lp.packedEllipsoidLength*C)}if(T>0){let b=p.byteOffset+d.SPHERES.byteOffset;_=new Float32Array(p.buffer,b,lp.packedSphereLength*T)}return e._geometries=new lp({boxes:O,boxBatchIds:R.boxes,cylinders:L,cylinderBatchIds:R.cylinders,ellipsoids:N,ellipsoidBatchIds:R.ellipsoids,spheres:_,sphereBatchIds:R.spheres,center:w,modelMatrix:D,batchTable:S,boundingVolume:e.tile.boundingVolume.boundingVolume}),e._geometries.readyPromise.then(function(){return e})}return Promise.resolve(e)}function Tte(e){let t=e.featuresLength;if(!u(e._features)&&t>0){let n=new Array(t);u(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}up.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};up.prototype.getFeature=function(e){return Tte(this),this._features[e]};up.prototype.applyDebugSettings=function(e,t){u(this._geometries)&&this._geometries.applyDebugSettings(e,t)};up.prototype.applyStyle=function(e){Tte(this),u(this._geometries)&&this._geometries.applyStyle(e,this._features)};up.prototype.update=function(e,t){u(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),u(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t)};up.prototype.isDestroyed=function(){return!1};up.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),le(this)};var TP=up;var d5={};d5.encode2D=function(e,t,n){let i=Math.pow(2,e),o={x:t,y:n},r,s,a,c=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,c+=BigInt((3*r^s)*a*a),Ete(i,o,r,s);return c};d5.decode2D=function(e,t){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)),Ete(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function Ete(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 xT=d5;var lA=30,ABe=1<<lA,xBe=1<<lA+1>>>0,h5=2*lA+1,ug=4,Dte=[],vte=[],CBe=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],fg=1,CT=2,CV=[fg,0,0,fg|CT];function Ur(e){if(!Vt.supportsBigInt())throw new ue("S2 required BigInt support");this._cellId=e,this._level=Ur.getLevel(e)}Ur.fromToken=function(e){return new Ur(Ur.getIdFromToken(e))};Ur.isValidId=function(e){return!(e<=0||e>>BigInt(h5)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};Ur.isValidToken=function(e){return/^[0-9a-fA-F]{1,16}$/.test(e)?Ur.isValidId(Ur.getIdFromToken(e)):!1};Ur.getIdFromToken=function(e){return BigInt("0x"+e+"0".repeat(16-e.length))};Ur.getTokenFromId=function(e){let t=Math.floor(OBe(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};Ur.getLevel=function(e){let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return lA-(t>>1)};Ur.prototype.getChild=function(e){let t=Pte(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new Ur(n)};Ur.prototype.getParent=function(){let e=Pte(this._cellId)<<BigInt(2);return new Ur(this._cellId&~e+BigInt(1)|e)};Ur.prototype.getParentAtLevel=function(e){let t=IBe(e);return new Ur(this._cellId&-t|t)};Ur.prototype.getCenter=function(e){e=y(e,ie.WGS84);let t=TBe(this._cellId,this._level);t=h.normalize(t,t);let n=new he.fromCartesian(t,ie.UNIT_SPHERE);return he.toCartesian(n,e,new h)};Ur.prototype.getVertex=function(e,t){t=y(t,ie.WGS84);let n=EBe(this._cellId,this._level,e);n=h.normalize(n,n);let i=new he.fromCartesian(n,ie.UNIT_SPHERE);return he.toCartesian(i,t,new h)};Ur.fromFacePositionLevel=function(e,t,n){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(h5-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new Ur(a)};function TBe(e,t){let n=bBe(e,t);return SBe(n[0],n[1],n[2])}function EBe(e,t,n){let i=wte(e,t),o=DBe([i[1],i[2]],t),r=n>>1&1;return Ite(i[0],o[0][r^n&1],o[1][r])}function bBe(e,t){let n=wte(e),i=n[0],o=n[1],r=n[2],s=t===30,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),c=s?1:a?2:0,l=(o<<1)+c,f=(r<<1)+c;return[i,l,f]}function wte(e){Dte.length===0&&wBe();let t=Number(e>>BigInt(h5)),n=t&fg,i=(1<<ug)-1,o=0,r=0;for(let s=7;s>=0;s--){let c=(1<<2*(s===7?lA-7*ug:ug))-1;n+=Number(e>>BigInt(s*2*ug+1)&BigInt(c))<<2,n=vte[n];let l=s*ug;o+=n>>ug+2<<l,r+=(n>>2&i)<<l,n&=fg|CT}return[t,o,r]}function SBe(e,t,n){let i=bte(t),o=bte(n),r=TV(i),s=TV(o);return Ite(e,r,s)}function Ite(e,t,n){switch(e){case 0:return new h(1,t,n);case 1:return new h(-t,1,n);case 2:return new h(-t,-n,1);case 3:return new h(-1,-n,-t);case 4:return new h(n,-1,-t);default:return new h(n,t,-1)}}function TV(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function bte(e){return 1/xBe*e}function DBe(e,t){let n=[[],[]],i=vBe(t);for(let o=0;o<2;++o){let r=e[o]&-i,s=r+i;n[o][0]=TV(Ste(r)),n[o][1]=TV(Ste(s))}return n}function vBe(e){return 1<<lA-e>>>0}function Ste(e){return 1/ABe*e}function dg(e,t,n,i,o,r){if(e===ug){let s=(t<<ug)+n;Dte[(s<<2)+i]=(o<<2)+r,vte[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;let s=CBe[r];dg(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^CV[0]),dg(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^CV[1]),dg(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^CV[2]),dg(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^CV[3])}}function wBe(){dg(0,0,0,0,0,0),dg(0,0,0,fg,0,fg),dg(0,0,0,CT,0,CT),dg(0,0,0,fg|CT,0,fg|CT)}function Pte(e){return e&~e+BigInt(1)}function IBe(e){return BigInt(1)<<BigInt(2*(lA-e))}var PBe=[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 OBe(e){return PBe[(-e&e)%BigInt(67)]}var fp=Ur;function RBe(e,t){return u(e)&&u(e.extensions)&&u(e.extensions[t])}var ai=RBe;function m5(e){let t=e.lengthBits,n=e.availableCount,i=e.constant,o=e.bitstream;if(u(i))n=t;else{let r=Math.ceil(t/8);if(o.length!==r)throw new ue(`Availability bitstream must be exactly ${r} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);let s=y(e.computeAvailableCountEnabled,!1);!u(n)&&s&&(n=BBe(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function BBe(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(m5.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});m5.prototype.getBit=function(e){if(u(this._constant))return this._constant;let t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};var TT=m5;function dp(e){e=y(e,y.EMPTY_OBJECT);let t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(dp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});dp.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};dp.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};dp.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};dp.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};dp.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};dp.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};dp.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};var ET=dp;var EV={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};EV.getBranchingFactor=function(e){switch(e){case EV.OCTREE:return 8;case EV.QUADTREE:return 4}};var kr=Object.freeze(EV);function ks(){}Object.defineProperties(ks.prototype,{class:{get:function(){de.throwInstantiationError()}}});ks.prototype.hasProperty=function(e){de.throwInstantiationError()};ks.prototype.hasPropertyBySemantic=function(e){de.throwInstantiationError()};ks.prototype.getPropertyIds=function(e){de.throwInstantiationError()};ks.prototype.getProperty=function(e){de.throwInstantiationError()};ks.prototype.setProperty=function(e,t){de.throwInstantiationError()};ks.prototype.getPropertyBySemantic=function(e){de.throwInstantiationError()};ks.prototype.setPropertyBySemantic=function(e,t){de.throwInstantiationError()};ks.hasProperty=function(e,t,n){if(u(t[e]))return!0;let i=n.properties;if(!u(i))return!1;let o=i[e];return!!(u(o)&&u(o.default))};ks.hasPropertyBySemantic=function(e,t,n){let i=n.propertiesBySemantic;if(!u(i))return!1;let o=i[e];return u(o)};ks.getPropertyIds=function(e,t,n){n=u(n)?n:[],n.length=0;for(let o in e)e.hasOwnProperty(o)&&u(e[o])&&n.push(o);let i=t.properties;if(u(i))for(let o in i)i.hasOwnProperty(o)&&!u(e[o])&&u(i[o].default)&&n.push(o);return n};ks.getProperty=function(e,t,n){let i=n.properties[e],o=t[e];Array.isArray(o)&&(o=o.slice());let r=!0;if(o=i.handleNoData(o),!u(o)&&u(i.default))return o=Ge(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(u(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};ks.setProperty=function(e,t,n,i){if(!u(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o,r=i.properties;u(r)&&(o=r[e]);let s=!0;return u(o)&&(t=o.packVectorAndMatrixTypes(t,s),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};ks.getPropertyBySemantic=function(e,t,n){let i=n.propertiesBySemantic;if(!u(i))return;let o=i[e];if(u(o))return ks.getProperty(o.id,t,n)};ks.setPropertyBySemantic=function(e,t,n,i){let o=i.propertiesBySemantic;if(!u(o))return!1;let r=i.propertiesBySemantic[e];return u(r)?ks.setProperty(r.id,t,n,i):!1};var Nn=ks;function hp(e){e=y(e,y.EMPTY_OBJECT);let t=e.subtreeMetadata,n=e.class,i=u(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(hp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});hp.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};hp.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};hp.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};hp.prototype.getProperty=function(e){return Nn.getProperty(e,this._properties,this._class)};hp.prototype.setProperty=function(e,t){return Nn.setProperty(e,t,this._properties,this._class)};hp.prototype.getPropertyBySemantic=function(e){return Nn.getPropertyBySemantic(e,this._properties,this._class)};hp.prototype.setPropertyBySemantic=function(e,t){return Nn.setPropertyBySemantic(e,t,this._properties,this._class)};var EP=hp;var Dt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};Dt.getMinimum=function(e){switch(e){case Dt.INT8:return-128;case Dt.UINT8:return 0;case Dt.INT16:return-32768;case Dt.UINT16:return 0;case Dt.INT32:return-2147483648;case Dt.UINT32:return 0;case Dt.INT64:return Vt.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case Dt.UINT64:return Vt.supportsBigInt()?BigInt(0):0;case Dt.FLOAT32:return-34028234663852886e22;case Dt.FLOAT64:return-Number.MAX_VALUE}};Dt.getMaximum=function(e){switch(e){case Dt.INT8:return 127;case Dt.UINT8:return 255;case Dt.INT16:return 32767;case Dt.UINT16:return 65535;case Dt.INT32:return 2147483647;case Dt.UINT32:return 4294967295;case Dt.INT64:return Vt.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case Dt.UINT64:return Vt.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case Dt.FLOAT32:return 34028234663852886e22;case Dt.FLOAT64:return Number.MAX_VALUE}};Dt.isIntegerType=function(e){switch(e){case Dt.INT8:case Dt.UINT8:case Dt.INT16:case Dt.UINT16:case Dt.INT32:case Dt.UINT32:case Dt.INT64:case Dt.UINT64:return!0;default:return!1}};Dt.isUnsignedIntegerType=function(e){switch(e){case Dt.UINT8:case Dt.UINT16:case Dt.UINT32:case Dt.UINT64:return!0;default:return!1}};Dt.isVectorCompatible=function(e){switch(e){case Dt.INT8:case Dt.UINT8:case Dt.INT16:case Dt.UINT16:case Dt.INT32:case Dt.UINT32:case Dt.FLOAT32:case Dt.FLOAT64:return!0;default:return!1}};Dt.normalize=function(e,t){return Math.max(Number(e)/Number(Dt.getMaximum(t)),-1)};Dt.unnormalize=function(e,t){let n=Dt.getMaximum(t),i=Dt.isUnsignedIntegerType(t)?0:-n;return e=P.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===Dt.INT64||t===Dt.UINT64)&&Vt.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};Dt.applyValueTransform=function(e,t,n){return n*e+t};Dt.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};Dt.getSizeInBytes=function(e){switch(e){case Dt.INT8:case Dt.UINT8:return 1;case Dt.INT16:case Dt.UINT16:return 2;case Dt.INT32:case Dt.UINT32:return 4;case Dt.INT64:case Dt.UINT64:return 8;case Dt.FLOAT32:return 4;case Dt.FLOAT64:return 8}};Dt.fromComponentDatatype=function(e){switch(e){case q.BYTE:return Dt.INT8;case q.UNSIGNED_BYTE:return Dt.UINT8;case q.SHORT:return Dt.INT16;case q.UNSIGNED_SHORT:return Dt.UINT16;case q.INT:return Dt.INT32;case q.UNSIGNED_INT:return Dt.UINT32;case q.FLOAT:return Dt.FLOAT32;case q.DOUBLE:return Dt.FLOAT64}};Dt.toComponentDatatype=function(e){switch(e){case Dt.INT8:return q.BYTE;case Dt.UINT8:return q.UNSIGNED_BYTE;case Dt.INT16:return q.SHORT;case Dt.UINT16:return q.UNSIGNED_SHORT;case Dt.INT32:return q.INT;case Dt.UINT32:return q.UNSIGNED_INT;case Dt.FLOAT32:return q.FLOAT;case Dt.FLOAT64:return q.DOUBLE}};var tn=Object.freeze(Dt);var Mo={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};Mo.isVectorType=function(e){switch(e){case Mo.VEC2:case Mo.VEC3:case Mo.VEC4:return!0;default:return!1}};Mo.isMatrixType=function(e){switch(e){case Mo.MAT2:case Mo.MAT3:case Mo.MAT4:return!0;default:return!1}};Mo.getComponentCount=function(e){switch(e){case Mo.SCALAR:case Mo.STRING:case Mo.ENUM:case Mo.BOOLEAN:return 1;case Mo.VEC2:return 2;case Mo.VEC3:return 3;case Mo.VEC4:return 4;case Mo.MAT2:return 4;case Mo.MAT3:return 9;case Mo.MAT4:return 16}};Mo.getMathType=function(e){switch(e){case Mo.VEC2:return H;case Mo.VEC3:return h;case Mo.VEC4:return oe;case Mo.MAT2:return Ji;case Mo.MAT3:return Z;case Mo.MAT4:return M;default:return}};var zt=Object.freeze(Mo);function ua(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.type,i=e.componentType,o=e.enumType,r=u(i)&&tn.isIntegerType(i)&&y(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=u(o)?o.valueType:i,this._isArray=y(e.isArray,!1),this._isVariableLengthArray=y(e.isVariableLengthArray,!1),this._arrayLength=e.arrayLength,this._min=Ge(e.min,!0),this._max=Ge(e.max,!0),this._normalized=r;let s=Ge(e.offset,!0),a=Ge(e.scale,!0),c=u(s)||u(a),l=!0;u(s)||(s=this.expandConstant(0,l)),u(a)||(a=this.expandConstant(1,l)),this._offset=s,this._scale=a,this._hasValueTransform=c,this._noData=Ge(e.noData,!0),this._default=Ge(e.default,!0),this._required=y(e.required,!0),this._extras=Ge(e.extras,!0),this._extensions=Ge(e.extensions,!0)}ua.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.property,i=MBe(n),o=LBe(n,e.enums),r;return u(i)?i?r=u(n.optional)?!n.optional:!0:r=y(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 MBe(e){if(e.type==="ARRAY")return!0;let t=e.type;if(t===zt.SCALAR||zt.isMatrixType(t)||zt.isVectorType(t))return!1;if(u(tn[t]))return!0;if(u(e.noData)||u(e.scale)||u(e.offset)||u(e.required)||u(e.count)||u(e.array)||u(e.optional))return!1}function LBe(e,t){let n=e.type,i=e.componentType,o=n==="ARRAY",r,s,a;o?(r=!0,s=e.componentCount,a=!u(s)):e.array?(r=!0,s=e.count,a=!u(e.count)):(r=!1,s=void 0,a=!1);let c;if(u(e.enumType)&&(c=t[e.enumType]),n===zt.ENUM)return{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===zt.ENUM)return{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===zt.SCALAR||zt.isMatrixType(n)||zt.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===zt.BOOLEAN||n===zt.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===zt.BOOLEAN||i===zt.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(u(i)&&u(tn[i]))return{type:zt.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(u(tn[n]))return{type:zt.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s}}ua.prototype.normalize=function(e){return this._normalized?p5(e,this._valueType,tn.normalize):e};ua.prototype.unnormalize=function(e){return this._normalized?p5(e,this._valueType,tn.unnormalize):e};ua.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:ua.valueTransformInPlace(e,this._offset,this._scale,tn.applyValueTransform)};ua.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:ua.valueTransformInPlace(e,this._offset,this._scale,tn.unapplyValueTransform)};ua.prototype.expandConstant=function(e,t){t=y(t,!1);let n=this._isArray,i=this._arrayLength,o=zt.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(!u(t))return e;if(!Mte(e,t))return e};function Mte(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(!Mte(e[n],t[n]))return!1;return!0}ua.prototype.unpackVectorAndMatrixTypes=function(e,t){t=y(t,!1);let n=zt.getMathType(this._type),i=this._isArray,o=zt.getComponentCount(this._type),r=i&&o>1;return u(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=y(t,!1);let n=zt.getMathType(this._type),i=this._isArray,o=zt.getComponentCount(this._type),r=i&&o>1;return u(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(!(!u(e)&&u(this._default)))return this._required&&!u(e)?"required property must have a value":this._isArray?NBe(this,e):Lte(this,e)};function NBe(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=Lte(e,t[i]);if(u(o))return o}}function Lte(e,t){let n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return zt.isVectorType(n)?FBe(t,n,i):zt.isMatrixType(n)?VBe(t,n,i):n===zt.STRING?UBe(t):n===zt.BOOLEAN?kBe(t):n===zt.ENUM?zBe(t,o):HBe(t,i,r)}function FBe(e,t,n){if(!tn.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===zt.VEC2&&!(e instanceof H))return`vector value ${e} must be a Cartesian2`;if(t===zt.VEC3&&!(e instanceof h))return`vector value ${e} must be a Cartesian3`;if(t===zt.VEC4&&!(e instanceof oe))return`vector value ${e} must be a Cartesian4`}function VBe(e,t,n){if(!tn.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===zt.MAT2&&!(e instanceof Ji))return`matrix value ${e} must be a Matrix2`;if(t===zt.MAT3&&!(e instanceof Z))return`matrix value ${e} must be a Matrix3`;if(t===zt.MAT4&&!(e instanceof M))return`matrix value ${e} must be a Matrix4`}function UBe(e){if(typeof e!="string")return bV(e,zt.STRING)}function kBe(e){if(typeof e!="boolean")return bV(e,zt.BOOLEAN)}function zBe(e,t){let n=typeof e;if(u(t))return n!=="string"||!u(t.valuesByName[e])?`value ${e} is not a valid enum name for ${t.id}`:void 0}function HBe(e,t,n){let i=typeof e;switch(t){case tn.INT8:case tn.UINT8:case tn.INT16:case tn.UINT16:case tn.INT32:case tn.UINT32:case tn.FLOAT32:case tn.FLOAT64:return i!=="number"?bV(e,t):isFinite(e)?Rte(e,t,n):Bte(e,t);case tn.INT64:case tn.UINT64:return i!=="number"&&i!=="bigint"?bV(e,t):i==="number"&&!isFinite(e)?Bte(e,t):Rte(e,t,n)}}function bV(e,t){return`value ${e} does not match type ${t}`}function Ote(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function Rte(e,t,n){if(n){let i=tn.isUnsignedIntegerType(t)?0:-1,o=1;return e<i||e>o?Ote(e,t,n):void 0}if(e<tn.getMinimum(t)||e>tn.getMaximum(t))return Ote(e,t,n)}function Bte(e,t){return`value ${e} of type ${t} must be finite`}function p5(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=p5(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 hg=ua;function bP(e){e=y(e,y.EMPTY_OBJECT);let t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews,r=i.type,s=i.isArray,a=i.isVariableLengthArray,c=i.valueType,l=i.enumType,f=r===zt.STRING,d=r===zt.BOOLEAN,p=0,g;if(a){let _=y(n.arrayOffsetType,n.offsetType);_=y(tn[_],tn.UINT32);let b=y(n.arrayOffsets,n.arrayOffsetBufferView);g=new _5(o[b],_,t+1),p+=g.typedArray.byteLength}let m=zt.getComponentCount(r),A;a?A=g.get(t)-g.get(0):s?A=t*i.arrayLength:A=t;let x=m*A,C;if(f){let _=y(n.stringOffsetType,n.offsetType);_=y(tn[_],tn.UINT32);let b=y(n.stringOffsets,n.stringOffsetBufferView);C=new _5(o[b],_,x+1),p+=C.typedArray.byteLength}(f||d)&&(c=tn.UINT8);let T;f?T=C.get(x)-C.get(0):d?T=Math.ceil(x/8):T=x;let E=y(n.values,n.bufferView),S=new _5(o[E],c,T);p+=S.typedArray.byteLength;let D=n.offset,w=n.scale,R=i.hasValueTransform||u(D)||u(w);D=y(D,i.offset),w=y(w,i.scale),D=Nte(D),w=Nte(w);let O,L,N=this;f?O=function(_){return jBe(_,N._values,N._stringOffsets)}:d?(O=function(_){return YBe(_,N._values)},L=function(_,b){qBe(_,N._values,b)}):u(l)?(O=function(_){let b=N._values.get(_);return l.namesByValue[b]},L=function(_,b){let v=l.valuesByName[b];N._values.set(_,v)}):(O=function(_){return N._values.get(_)},L=function(_,b){N._values.set(_,b)}),this._arrayOffsets=g,this._stringOffsets=C,this._values=S,this._classProperty=i,this._count=t,this._vectorComponentCount=m,this._min=n.min,this._max=n.max,this._offset=D,this._scale=w,this._hasValueTransform=R,this._getValue=O,this._setValue=L,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=p}Object.defineProperties(bP.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}}});bP.prototype.get=function(e){let t=GBe(this,e);return t=this._classProperty.handleNoData(t),u(t)?(t=this._classProperty.normalize(t),t=tMe(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};bP.prototype.set=function(e,t){let n=this._classProperty;t=n.packVectorAndMatrixTypes(t),t=nMe(this,t),t=n.unnormalize(t),WBe(this,e,t)};bP.prototype.getTypedArray=function(){if(u(this._values))return this._values.typedArray};function Nte(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 GBe(e,t){Vte(e)&&Ute(e);let n=e._classProperty,i=n.isArray,o=n.type,r=zt.getComponentCount(o);if(u(e._unpackedValues)){let s=e._unpackedValues[t];return i?Ge(s,!0):s}return!i&&r===1?e._getValue(t):Fte(e,n,t)}function Fte(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;let s=zt.getComponentCount(t.type);i*=s,o*=s}else{let a=y(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 WBe(e,t,n){$Be(e,t,n)&&Ute(e);let i=e._classProperty,o=i.isArray,r=i.type,s=zt.getComponentCount(r);if(u(e._unpackedValues)){i.isArray&&(n=Ge(n,!0)),e._unpackedValues[t]=n;return}if(!o&&s===1){e._setValue(t,n);return}let a,c;if(i.isVariableLengthArray)a=e._arrayOffsets.get(t),c=e._arrayOffsets.get(t+1)-a;else{let f=y(i.arrayLength,1)*e._vectorComponentCount;a=t*f,c=f}for(let l=0;l<c;++l)e._setValue(a+l,n[l])}function jBe(e,t,n){let i=n.get(e),o=n.get(e+1)-i;return ll(t.typedArray,i,o)}function YBe(e,t){let n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function qBe(e,t,n){let i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function XBe(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 c=n.getUint8(i+a);r&&(s?c!==0&&(c=~(c-1)&255,s=!1):c=~c&255),o+=c*Math.pow(256,a)}return r&&(o=-o),o}function KBe(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 c=n.getUint8(i+a);r&&(s?c!==0&&(c=~(c-1)&255,s=!1):c=~c&255),o+=BigInt(c)*(BigInt(1)<<BigInt(a*8))}return r&&(o=-o),o}function ZBe(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 JBe(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 QBe(e){switch(e){case tn.INT8:return q.BYTE;case tn.UINT8:return q.UNSIGNED_BYTE;case tn.INT16:return q.SHORT;case tn.UINT16:return q.UNSIGNED_SHORT;case tn.INT32:return q.INT;case tn.UINT32:return q.UNSIGNED_INT;case tn.FLOAT32:return q.FLOAT;case tn.FLOAT64:return q.DOUBLE}}function Vte(e){if(u(e._unpackedValues))return!1;let t=e._classProperty,n=t.type,i=t.valueType;return n===zt.STRING||i===tn.INT64&&!Vt.supportsBigInt64Array()||i===tn.UINT64&&!Vt.supportsBigUint64Array()}function $Be(e,t,n){if(Vte(e))return!0;let i=e._arrayOffsets;if(u(i)){let o=i.get(t+1)-i.get(t),r=n.length;if(o!==r)return!0}return!1}function Ute(e){e._unpackedValues=eMe(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function eMe(e){let t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=zt.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]=Fte(e,i,a);return n}function tMe(e,t){let i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:hg.valueTransformInPlace(t,e._offset,e._scale,tn.applyValueTransform)}function nMe(e,t){let i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:hg.valueTransformInPlace(t,e._offset,e._scale,tn.unapplyValueTransform)}function _5(e,t,n){let i=this,o,r,s;if(t===tn.INT64)Vt.supportsBigInt()?Vt.supportsBigInt64Array()?(o=new BigInt64Array(e.buffer,e.byteOffset,n),s=function(a,c){i.typedArray[a]=BigInt(c)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return KBe(a,i)}):(wt("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 XBe(a,i)});else if(t===tn.UINT64)Vt.supportsBigInt()?Vt.supportsBigUint64Array()?(o=new BigUint64Array(e.buffer,e.byteOffset,n),s=function(a,c){i.typedArray[a]=BigInt(c)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return JBe(a,i)}):(wt("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 ZBe(a,i)});else{let a=QBe(t);o=q.createArrayBufferView(a,e.buffer,e.byteOffset,n),s=function(c,l){i.typedArray[c]=l}}u(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 SP=bP;function sd(e){e=y(e,y.EMPTY_OBJECT);let t=e.count,n=e.class,i=0,o={};if(u(e.properties)){for(let r in e.properties)if(e.properties.hasOwnProperty(r)){let s=new SP({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(sd.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});sd.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};sd.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};sd.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};sd.prototype.getProperty=function(e,t){let n=this._properties[t],i;return u(n)?i=n.get(e):i=iMe(this._class,t),i};sd.prototype.setProperty=function(e,t,n){let i=this._properties[t];return u(i)?(i.set(e,n),!0):!1};sd.prototype.getPropertyBySemantic=function(e,t){let n,i=this._class.propertiesBySemantic;if(u(i)&&(n=i[t]),u(n))return this.getProperty(e,n.id)};sd.prototype.setPropertyBySemantic=function(e,t,n){let i,o=this._class.propertiesBySemantic;return u(o)&&(i=o[t]),u(i)?this.setProperty(e,i.id,n):!1};sd.prototype.getPropertyTypedArray=function(e){let t=this._properties[e];if(u(t))return t.getTypedArray()};sd.prototype.getPropertyTypedArrayBySemantic=function(e){let t,n=this._class.propertiesBySemantic;if(u(n)&&(t=n[e]),u(t))return this.getPropertyTypedArray(t.id)};function iMe(e,t){let n=e.properties;if(!u(n))return;let i=n[t];if(u(i)&&u(i.default)){let o=i.default;return i.isArray&&(o=Ge(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}var fl=sd;function mg(){}Object.defineProperties(mg.prototype,{promise:{get:function(){de.throwInstantiationError()}},cacheKey:{get:function(){de.throwInstantiationError()}}});mg.prototype.load=function(){de.throwInstantiationError()};mg.prototype.unload=function(){};mg.prototype.process=function(e){};mg.prototype.getError=function(e,t){u(t)&&(e+=`
${t.message}`);let n=new ue(e);return u(t)&&(n.stack=`Original stack:
${t.stack}
Handler stack:
${n.stack}`),n};mg.prototype.isDestroyed=function(){return!1};mg.prototype.destroy=function(){return this.unload(),le(this)};var no=mg;var oMe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Ut=Object.freeze(oMe);function mp(e){e=y(e,y.EMPTY_OBJECT);let t=e.typedArray,n=e.resource,i=e.cacheKey;this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=Ut.UNLOADED,this._promise=void 0}u(Object.create)&&(mp.prototype=Object.create(no.prototype),mp.prototype.constructor=mp);Object.defineProperties(mp.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});mp.prototype.load=function(){return u(this._typedArray)?this._promise=Promise.resolve(this):this._promise=rMe(this),this._promise};function rMe(e){let t=e._resource;return e._state=Ut.LOADING,mp._fetchArrayBuffer(t).then(function(n){if(!e.isDestroyed())return e._typedArray=new Uint8Array(n),e._state=Ut.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Ut.FAILED;let i=`Failed to load external buffer: ${t.url}`;return Promise.reject(e.getError(i,n))})}mp._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};mp.prototype.unload=function(){this._typedArray=void 0};var uA=mp;var njt=function(){"use strict";var e=" ",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(p){n=p.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(p){for(var g=new Uint8Array(p.length),m=0;m<p.length;++m){var A=p.charCodeAt(m);g[m]=A>96?A-71:A>64?A-65:A>47?A+4:A>46?63:62}for(var x=0,m=0;m<p.length;++m)g[x++]=g[m]<60?t[g[m]]:(g[m]-60)*64+g[++m];return g.buffer.slice(0,x)}function r(p){if(!p)throw new Error("Assertion failed")}function s(p){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}function a(p,g,m){var A=n.exports.sbrk,x=A(p.length*4),C=A(g*4),T=new Uint8Array(n.exports.memory.buffer),E=s(p);T.set(E,x),m&&m(x,x,p.length,g);var S=n.exports.meshopt_optimizeVertexFetchRemap(C,x,p.length,g);T=new Uint8Array(n.exports.memory.buffer);var D=new Uint32Array(g);new Uint8Array(D.buffer).set(T.subarray(C,C+g*4)),E.set(T.subarray(x,x+p.length*4)),A(x-A(0));for(var w=0;w<p.length;++w)p[w]=D[p[w]];return[D,S]}function c(p,g,m,A,x){var C=n.exports.sbrk,T=C(g),E=C(A*x),S=new Uint8Array(n.exports.memory.buffer);S.set(s(m),E);var D=p(T,g,E,A,x),w=new Uint8Array(D);return w.set(S.subarray(T,T+D)),C(T-C(0)),w}function l(p){for(var g=0,m=0;m<p.length;++m){var A=p[m];g=g<A?A:g}return g}function f(p,g){if(r(g==2||g==4),g==4)return new Uint32Array(p.buffer,p.byteOffset,p.byteLength/4);var m=new Uint16Array(p.buffer,p.byteOffset,p.byteLength/2);return new Uint32Array(m)}function d(p,g,m,A,x,C){var T=n.exports.sbrk,E=T(m*A),S=T(m*C),D=new Uint8Array(n.exports.memory.buffer);D.set(s(g),S),p(E,m,A,x,S);var w=new Uint8Array(m*A);return w.set(D.subarray(E,E+m*A)),T(E-T(0)),w}return{ready:i,supported:!0,reorderMesh:function(p,g,m){var A=g?m?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(p,l(p)+1,A)},encodeVertexBuffer:function(p,g,m){r(m>0&&m<=256),r(m%4==0);var A=n.exports.meshopt_encodeVertexBufferBound(g,m);return c(n.exports.meshopt_encodeVertexBuffer,A,p,g,m)},encodeIndexBuffer:function(p,g,m){r(m==2||m==4),r(g%3==0);var A=f(p,m),x=n.exports.meshopt_encodeIndexBufferBound(g,l(A)+1);return c(n.exports.meshopt_encodeIndexBuffer,x,A,g,4)},encodeIndexSequence:function(p,g,m){r(m==2||m==4);var A=f(p,m),x=n.exports.meshopt_encodeIndexSequenceBound(g,l(A)+1);return c(n.exports.meshopt_encodeIndexSequence,x,A,g,4)},encodeGltfBuffer:function(p,g,m,A){var x={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(x[A]),x[A](p,g,m)},encodeFilterOct:function(p,g,m,A){return r(m==4||m==8),r(A>=1&&A<=16),d(n.exports.meshopt_encodeFilterOct,p,g,m,A,16)},encodeFilterQuat:function(p,g,m,A){return r(m==8),r(A>=4&&A<=16),d(n.exports.meshopt_encodeFilterQuat,p,g,m,A,16)},encodeFilterExp:function(p,g,m,A){return r(m>0&&m%4==0),r(A>=1&&A<=24),d(n.exports.meshopt_encodeFilterExp,p,g,m,A,m)}}}();var kte=function(){"use strict";var e=" ",t=" ",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=e;WebAssembly.validate(n)&&(o=t);var r,s=WebAssembly.instantiate(a(o),{}).then(function(d){r=d.instance,r.exports.__wasm_call_ctors()});function a(d){for(var p=new Uint8Array(d.length),g=0;g<d.length;++g){var m=d.charCodeAt(g);p[g]=m>96?m-71:m>64?m-65:m>47?m+4:m>46?63:62}for(var A=0,g=0;g<d.length;++g)p[A++]=p[g]<60?i[p[g]]:(p[g]-60)*64+p[++g];return p.buffer.slice(0,A)}function c(d,p,g,m,A,x){var C=r.exports.sbrk,T=g+3&-4,E=C(T*m),S=C(A.length),D=new Uint8Array(r.exports.memory.buffer);D.set(A,S);var w=d(E,g,m,S,A.length);if(w==0&&x&&x(E,T,m),p.set(D.subarray(E,E+g*m)),C(E-C(0)),w!=0)throw new Error("Malformed buffer data: "+w)}var l={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:s,supported:!0,decodeVertexBuffer:function(d,p,g,m,A){c(r.exports.meshopt_decodeVertexBuffer,d,p,g,m,r.exports[l[A]])},decodeIndexBuffer:function(d,p,g,m){c(r.exports.meshopt_decodeIndexBuffer,d,p,g,m)},decodeIndexSequence:function(d,p,g,m){c(r.exports.meshopt_decodeIndexSequence,d,p,g,m)},decodeGltfBuffer:function(d,p,g,m,A,x){c(r.exports[f[A]],d,p,g,m,r.exports[l[x]])}}}();var rjt=function(){"use strict";var e=" ",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(p){n=p.instance,n.exports.__wasm_call_ctors()});function o(p){for(var g=new Uint8Array(p.length),m=0;m<p.length;++m){var A=p.charCodeAt(m);g[m]=A>96?A-71:A>64?A-65:A>47?A+4:A>46?63:62}for(var x=0,m=0;m<p.length;++m)g[x++]=g[m]<60?t[g[m]]:(g[m]-60)*64+g[++m];return g.buffer.slice(0,x)}function r(p){if(!p)throw new Error("Assertion failed")}function s(p){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}function a(p,g){var m=n.exports.sbrk,A=m(p.length*4),x=m(g*4),C=new Uint8Array(n.exports.memory.buffer),T=s(p);C.set(T,A);var E=n.exports.meshopt_optimizeVertexFetchRemap(x,A,p.length,g);C=new Uint8Array(n.exports.memory.buffer);var S=new Uint32Array(g);new Uint8Array(S.buffer).set(C.subarray(x,x+g*4)),T.set(C.subarray(A,A+p.length*4)),m(A-m(0));for(var D=0;D<p.length;++D)p[D]=S[p[D]];return[S,E]}function c(p){for(var g=0,m=0;m<p.length;++m){var A=p[m];g=g<A?A:g}return g}function l(p,g,m,A,x,C,T,E,S){var D=n.exports.sbrk,w=D(4),R=D(m*4),O=D(x*C),L=D(m*4),N=new Uint8Array(n.exports.memory.buffer);N.set(s(A),O),N.set(s(g),L);var _=p(R,L,m,O,x,C,T,E,S,w);N=new Uint8Array(n.exports.memory.buffer);var b=new Uint32Array(_);s(b).set(N.subarray(R,R+_*4));var v=new Float32Array(1);return s(v).set(N.subarray(w,w+4)),D(w-D(0)),[b,v[0]]}function f(p,g,m,A){var x=n.exports.sbrk,C=x(m*A),T=new Uint8Array(n.exports.memory.buffer);T.set(s(g),C);var E=p(C,m,A);return x(C-x(0)),E}var d={LockBorder:1};return{ready:i,supported:!0,compactMesh:function(p){r(p instanceof Uint32Array||p instanceof Int32Array||p instanceof Uint16Array||p instanceof Int16Array),r(p.length%3==0);var g=p.BYTES_PER_ELEMENT==4?p:new Uint32Array(p);return a(g,c(p)+1)},simplify:function(p,g,m,A,x,C){r(p instanceof Uint32Array||p instanceof Int32Array||p instanceof Uint16Array||p instanceof Int16Array),r(p.length%3==0),r(g instanceof Float32Array),r(g.length%m==0),r(m>=3),r(A%3==0);for(var T=0,E=0;E<(C?C.length:0);++E)T|=d[C[E]];var S=p.BYTES_PER_ELEMENT==4?p:new Uint32Array(p),D=l(n.exports.meshopt_simplify,S,p.length,g,g.length,m*4,A,x,T);return D[0]=p instanceof Uint32Array?D[0]:new p.constructor(D[0]),D},getScale:function(p,g){return r(p instanceof Float32Array),r(p.length%g==0),f(n.exports.meshopt_simplifyScale,p,p.length,g*4)}}}();function pg(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey,a=n.bufferViews[i],c=a.buffer,l=a.byteOffset,f=a.byteLength,d=!1,p,g,m,A;if(ai(a,"EXT_meshopt_compression")){let C=a.extensions.EXT_meshopt_compression;c=C.buffer,l=y(C.byteOffset,0),f=C.byteLength,d=!0,p=C.byteStride,g=C.count,m=C.mode,A=y(C.filter,"NONE")}let x=n.buffers[c];this._hasMeshopt=d,this._meshoptByteStride=p,this._meshoptCount=g,this._meshoptMode=m,this._meshoptFilter=A,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=x,this._bufferId=c,this._byteOffset=l,this._byteLength=f,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=Ut.UNLOADED,this._promise=void 0,this._process=function(C,T){}}u(Object.create)&&(pg.prototype=Object.create(no.prototype),pg.prototype.constructor=pg);Object.defineProperties(pg.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});pg.prototype.load=function(){let e=sMe(this);this._bufferLoader=e,this._state=Ut.LOADING;let t=this,n=new Promise(function(i){t._process=function(o,r){if(!o._hasMeshopt||!u(o._typedArray)||o._state!==Ut.PROCESSING)return;let s=o._meshoptCount,a=o._meshoptByteStride,c=new Uint8Array(s*a);kte.decodeGltfBuffer(c,s,a,o._typedArray,o._meshoptMode,o._meshoptFilter),o._typedArray=c,o._state=Ut.READY,i(o)}});return this._promise=e.promise.then(function(){if(t.isDestroyed())return;let i=e.typedArray,o=new Uint8Array(i.buffer,i.byteOffset+t._byteOffset,t._byteLength);return t.unload(),t._typedArray=o,t._hasMeshopt?(t._state=Ut.PROCESSING,n):(t._state=Ut.READY,t)}).catch(function(i){if(t.isDestroyed())return;t.unload(),t._state=Ut.FAILED;let o="Failed to load buffer view";return Promise.reject(t.getError(o,i))}),this._promise};function sMe(e){let t=e._resourceCache,n=e._buffer;if(u(n.uri)){let o=e._baseResource.getDerivedResource({url:n.uri});return t.loadExternalBuffer({resource:o})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}pg.prototype.process=function(e){return this._process(this,e)};pg.prototype.unload=function(){u(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};var bT=pg;function za(){}za._maxDecodingConcurrency=Math.max(Vt.hardwareConcurrency-1,1);za._decoderTaskProcessor=void 0;za._taskProcessorReady=!1;za._getDecoderTaskProcessor=function(){if(!u(za._decoderTaskProcessor)){let e=new pi("decodeDraco",za._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(){za._taskProcessorReady=!0}),za._decoderTaskProcessor=e}return za._decoderTaskProcessor};za.decodePointCloud=function(e){let t=za._getDecoderTaskProcessor();if(za._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};za.decodeBufferView=function(e){let t=za._getDecoderTaskProcessor();if(za._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};var pp=za;function _g(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._draco=i,this._cacheKey=s,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=Ut.UNLOADED,this._promise=void 0,this._process=function(a,c){}}u(Object.create)&&(_g.prototype=Object.create(no.prototype),_g.prototype.constructor=_g);Object.defineProperties(_g.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});_g.prototype.load=function(){let t=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=t,this._state=Ut.LOADING;let n=this,i=new Promise(function(o,r){n._process=function(s,a){if(!u(s._bufferViewTypedArray)||u(s._decodePromise))return;let c=s._draco,f=s._gltf.bufferViews,d=c.bufferView,p=f[d],g=c.attributes,m={array:new Uint8Array(s._bufferViewTypedArray),bufferView:p,compressedAttributes:g,dequantizeInShader:!0},A=pp.decodeBufferView(m);u(A)&&(s._decodePromise=A.then(function(x){if(s.isDestroyed()){o();return}s.unload(),s._decodedData={indices:x.indexArray,vertexAttributes:x.attributeData},s._state=Ut.READY,o(s)}).catch(function(x){if(s.isDestroyed()){o();return}r(x)}))}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._bufferViewTypedArray=t.typedArray,n._state=Ut.PROCESSING,i}).catch(function(o){if(!n.isDestroyed())return aMe(n,o)}),this._promise};function aMe(e,t){e.unload(),e._state=Ut.FAILED;let n="Failed to load Draco";return Promise.reject(e.getError(n,t))}_g.prototype.process=function(e){return this._process(this,e)};_g.prototype.unload=function(){u(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0};var ST=_g;function cMe(e){let t=e.uint8Array,n=e.format,i=e.request,o=y(e.flipY,!1),r=y(e.skipColorSpaceConversion,!1),s=new Blob([t],{type:n}),a;return Oe.supportsImageBitmapOptions().then(function(c){return c?Promise.resolve(Oe.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new Oe({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(c){return u(a)&&window.URL.revokeObjectURL(a),c}).catch(function(c){return u(a)&&window.URL.revokeObjectURL(a),Promise.reject(c)})}var fA=cMe;function _p(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey,a=n.images[i],c=a.bufferView,l=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=c,this._uri=l,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=Ut.UNLOADED,this._promise=void 0}u(Object.create)&&(_p.prototype=Object.create(no.prototype),_p.prototype.constructor=_p);Object.defineProperties(_p.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}});_p.prototype.load=function(){return u(this._bufferViewId)?(this._promise=lMe(this),this._promise):(this._promise=uMe(this),this._promise)};function zte(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}}function lMe(e){let n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,e._state=Ut.LOADING,n.promise.then(function(){if(e.isDestroyed())return;let i=n.typedArray;return dMe(i).then(function(o){if(e.isDestroyed())return;let r=zte(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Ut.READY,e})}).catch(function(i){if(!e.isDestroyed())return Hte(e,i,"Failed to load embedded image")})}function uMe(e){let t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});return e._state=Ut.LOADING,mMe(i).then(function(o){if(e.isDestroyed())return;let r=zte(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Ut.READY,e}).catch(function(o){if(!e.isDestroyed())return Hte(e,o,`Failed to load image: ${n}`)})}function Hte(e,t,n){return e.unload(),e._state=Ut.FAILED,Promise.reject(e.getError(n,t))}function fMe(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 ue("Image format is not recognized")}function dMe(e){let t=fMe(e);if(t==="image/ktx2"){let n=new Uint8Array(e);return tl(n)}return _p._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}var hMe=/(^data:image\/ktx2)|(\.ktx2$)/i;function mMe(e){let t=e.getUrlComponent(!1,!0);return hMe.test(t)?tl(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}_p.prototype.unload=function(){u(this._bufferViewLoader)&&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};_p._loadImageFromTypedArray=fA;var DT=_p;var pMe={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},fa=Object.freeze(pMe);function gg(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,c=y(e.asynchronous,!0),l=y(e.loadBuffer,!1),f=y(e.loadTypedArray,!1),d=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=d,this._draco=s,this._cacheKey=a,this._asynchronous=c,this._loadBuffer=l,this._loadTypedArray=f,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Ut.UNLOADED,this._promise=void 0,this._process=function(p,g){}}u(Object.create)&&(gg.prototype=Object.create(no.prototype),gg.prototype.constructor=gg);Object.defineProperties(gg.prototype,{promise:{get:function(){return this._promise}},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 _Me=new g5;gg.prototype.load=function(){let e;u(this._draco)?e=gMe(this):e=yMe(this);let t=this,n=new Promise(function(i){t._process=function(o,r){if(o._state===Ut.READY)return;let s=o._typedArray,a=o._indexDatatype;if(u(o._dracoLoader)&&o._dracoLoader.process(r),u(o._bufferViewLoader)&&o._bufferViewLoader.process(r),!u(s))return;let c;if(o._loadBuffer&&o._asynchronous){let l=_Me;if(l.set(s,a,r.context),!r.jobScheduler.execute(l,fa.BUFFER))return;c=l.buffer}else o._loadBuffer&&(c=Gte(s,a,r.context));o.unload(),o._buffer=c,o._typedArray=o._loadTypedArray?s:void 0,o._state=Ut.READY,i(o)}});return this._promise=e.then(function(){if(!t.isDestroyed())return n}).catch(function(i){if(!t.isDestroyed())return xMe(t,i)}),this._promise};function gMe(e){let n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Ut.LOADING,n.promise.then(function(){if(e.isDestroyed())return;let i=n.decodedData.indices.typedArray;return e._typedArray=i,e._indexDatatype=q.fromTypedArray(i),e._state=Ut.PROCESSING,e})}function yMe(e){let t=e._gltf,n=e._accessorId,o=t.accessors[n].bufferView,s=e._resourceCache.loadBufferView({gltf:t,bufferViewId:o,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Ut.LOADING,e._bufferViewLoader=s,s.promise.then(function(){if(e.isDestroyed())return;let a=s.typedArray;return e._typedArray=AMe(e,a),e._state=Ut.PROCESSING,e})}function AMe(e,t){let n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=Fe.getSizeInBytes(s),c=t.buffer,l=t.byteOffset+o.byteOffset;if(l%a!==0){let d=r*a,p=new Uint8Array(c,l,d);c=new Uint8Array(p).buffer,l=0,nr("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let f;return s===Fe.UNSIGNED_BYTE?f=new Uint8Array(c,l,r):s===Fe.UNSIGNED_SHORT?f=new Uint16Array(c,l,r):s===Fe.UNSIGNED_INT&&(f=new Uint32Array(c,l,r)),f}function xMe(e,t){e.unload(),e._state=Ut.FAILED;let n="Failed to load index buffer";return t=e.getError(n,t),Promise.reject(t)}function g5(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}g5.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};g5.prototype.execute=function(){this.buffer=Gte(this.typedArray,this.indexDatatype,this.context)};function Gte(e,t,n){let i=lt.createIndexBuffer({typedArray:e,context:n,usage:Ne.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}gg.prototype.process=function(e){return this._process(this,e)};gg.prototype.unload=function(){u(this._buffer)&&this._buffer.destroy();let e=this._resourceCache;u(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),u(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};var vT=gg;function CMe(e,t,n){if(n=y(n,!1),n){let i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}var rs=CMe;function TMe(e,t){return u(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}var _r=TMe;function Wt(){}Wt.objectLegacy=function(e,t){if(u(e)){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let i=e[n],o=t(i,n);if(u(o))return o}}};Wt.object=function(e,t){if(u(e)){let n=e.length;for(let i=0;i<n;i++){let o=e[i],r=t(o,i);if(u(r))return r}}};Wt.topLevel=function(e,t,n){let i=e[t];return u(i)&&!Array.isArray(i)?Wt.objectLegacy(i,n):Wt.object(i,n)};Wt.accessor=function(e,t){return Wt.topLevel(e,"accessors",t)};Wt.accessorWithSemantic=function(e,t,n){let i={};return Wt.mesh(e,function(o){return Wt.meshPrimitive(o,function(r){let s=Wt.meshPrimitiveAttribute(r,function(a,c){if(c.indexOf(t)===0&&!u(i[a])){i[a]=!0;let l=n(a);if(u(l))return l}});return u(s)?s:Wt.meshPrimitiveTarget(r,function(a){return Wt.meshPrimitiveTargetAttribute(a,function(c,l){if(l.indexOf(t)===0&&!u(i[c])){i[c]=!0;let f=n(c);if(u(f))return f}})})})})};Wt.accessorContainingVertexAttributeData=function(e,t){let n={};return Wt.mesh(e,function(i){return Wt.meshPrimitive(i,function(o){let r=Wt.meshPrimitiveAttribute(o,function(s){if(!u(n[s])){n[s]=!0;let a=t(s);if(u(a))return a}});return u(r)?r:Wt.meshPrimitiveTarget(o,function(s){return Wt.meshPrimitiveTargetAttribute(s,function(a){if(!u(n[a])){n[a]=!0;let c=t(a);if(u(c))return c}})})})})};Wt.accessorContainingIndexData=function(e,t){let n={};return Wt.mesh(e,function(i){return Wt.meshPrimitive(i,function(o){let r=o.indices;if(u(r)&&!u(n[r])){n[r]=!0;let s=t(r);if(u(s))return s}})})};Wt.animation=function(e,t){return Wt.topLevel(e,"animations",t)};Wt.animationChannel=function(e,t){let n=e.channels;return Wt.object(n,t)};Wt.animationSampler=function(e,t){let n=e.samplers;return Wt.object(n,t)};Wt.buffer=function(e,t){return Wt.topLevel(e,"buffers",t)};Wt.bufferView=function(e,t){return Wt.topLevel(e,"bufferViews",t)};Wt.camera=function(e,t){return Wt.topLevel(e,"cameras",t)};Wt.image=function(e,t){return Wt.topLevel(e,"images",t)};Wt.material=function(e,t){return Wt.topLevel(e,"materials",t)};Wt.materialValue=function(e,t){let n=e.values;u(e.extensions)&&u(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(u(o))return o}};Wt.mesh=function(e,t){return Wt.topLevel(e,"meshes",t)};Wt.meshPrimitive=function(e,t){let n=e.primitives;if(u(n)){let i=n.length;for(let o=0;o<i;o++){let r=n[o],s=t(r,o);if(u(s))return s}}};Wt.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(u(o))return o}};Wt.meshPrimitiveTarget=function(e,t){let n=e.targets;if(u(n)){let i=n.length;for(let o=0;o<i;++o){let r=t(n[o],o);if(u(r))return r}}};Wt.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(u(o))return o}};Wt.node=function(e,t){return Wt.topLevel(e,"nodes",t)};Wt.nodeInTree=function(e,t,n){let i=e.nodes;if(u(i)){let o=t.length;for(let r=0;r<o;r++){let s=t[r],a=i[s];if(u(a)){let c=n(a,s);if(u(c))return c;let l=a.children;if(u(l)&&(c=Wt.nodeInTree(e,l,n),u(c)))return c}}}};Wt.nodeInScene=function(e,t,n){let i=t.nodes;if(u(i))return Wt.nodeInTree(e,i,n)};Wt.program=function(e,t){return _r(e,"KHR_techniques_webgl")?Wt.object(e.extensions.KHR_techniques_webgl.programs,t):Wt.topLevel(e,"programs",t)};Wt.sampler=function(e,t){return Wt.topLevel(e,"samplers",t)};Wt.scene=function(e,t){return Wt.topLevel(e,"scenes",t)};Wt.shader=function(e,t){return _r(e,"KHR_techniques_webgl")?Wt.object(e.extensions.KHR_techniques_webgl.shaders,t):Wt.topLevel(e,"shaders",t)};Wt.skin=function(e,t){return Wt.topLevel(e,"skins",t)};Wt.skinJoint=function(e,t){let n=e.joints;if(u(n)){let i=n.length;for(let o=0;o<i;o++){let r=n[o],s=t(r);if(u(s))return s}}};Wt.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(u(o))return o}};Wt.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(u(o))return o}};Wt.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(u(o))return o}};Wt.technique=function(e,t){return _r(e,"KHR_techniques_webgl")?Wt.object(e.extensions.KHR_techniques_webgl.techniques,t):Wt.topLevel(e,"techniques",t)};Wt.texture=function(e,t){return Wt.topLevel(e,"textures",t)};var Pe=Wt;function EMe(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 Kl=EMe;function bMe(e,t){let n=t.bufferView;if(u(n)){let i=e.bufferViews[n];if(u(i.byteStride)&&i.byteStride>0)return i.byteStride}return q.getSizeInBytes(t.componentType)*Kl(t.type)}var dl=bMe;function SMe(e){Pe.accessor(e,function(n){u(n.bufferView)&&(n.byteOffset=y(n.byteOffset,0))}),Pe.bufferView(e,function(n){u(n.buffer)&&(n.byteOffset=y(n.byteOffset,0))}),Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){if(i.mode=y(i.mode,ee.TRIANGLES),!u(i.material)){u(e.materials)||(e.materials=[]);let o={name:"default"};i.material=rs(e.materials,o)}})}),Pe.accessorContainingVertexAttributeData(e,function(n){let i=e.accessors[n],o=i.bufferView;if(i.normalized=y(i.normalized,!1),u(o)){let r=e.bufferViews[o];r.byteStride=dl(e,i),r.target=ee.ARRAY_BUFFER}}),Pe.accessorContainingIndexData(e,function(n){let o=e.accessors[n].bufferView;if(u(o)){let r=e.bufferViews[o];r.target=ee.ELEMENT_ARRAY_BUFFER}}),Pe.material(e,function(n){let i=y(n.extensions,y.EMPTY_OBJECT),o=i.KHR_materials_common;if(u(o)){let c=o.technique,l=u(o.values)?o.values:{};o.values=l,l.ambient=u(l.ambient)?l.ambient:[0,0,0,1],l.emission=u(l.emission)?l.emission:[0,0,0,1],l.transparency=y(l.transparency,1),c!=="CONSTANT"&&(l.diffuse=u(l.diffuse)?l.diffuse:[0,0,0,1],c!=="LAMBERT"&&(l.specular=u(l.specular)?l.specular:[0,0,0,1],l.shininess=y(l.shininess,0))),o.transparent=y(o.transparent,!1),o.doubleSided=y(o.doubleSided,!1);return}n.emissiveFactor=y(n.emissiveFactor,[0,0,0]),n.alphaMode=y(n.alphaMode,"OPAQUE"),n.doubleSided=y(n.doubleSided,!1),n.alphaMode==="MASK"&&(n.alphaCutoff=y(n.alphaCutoff,.5));let r=i.KHR_techniques_webgl;u(r)&&Pe.materialValue(n,function(c){u(c.index)&&dA(c)}),dA(n.emissiveTexture),dA(n.normalTexture),dA(n.occlusionTexture);let s=n.pbrMetallicRoughness;u(s)&&(s.baseColorFactor=y(s.baseColorFactor,[1,1,1,1]),s.metallicFactor=y(s.metallicFactor,1),s.roughnessFactor=y(s.roughnessFactor,1),dA(s.baseColorTexture),dA(s.metallicRoughnessTexture));let a=i.KHR_materials_pbrSpecularGlossiness;u(a)&&(a.diffuseFactor=y(a.diffuseFactor,[1,1,1,1]),a.specularFactor=y(a.specularFactor,[1,1,1]),a.glossinessFactor=y(a.glossinessFactor,1),dA(a.specularGlossinessTexture))}),Pe.animation(e,function(n){Pe.animationSampler(n,function(i){i.interpolation=y(i.interpolation,"LINEAR")})});let t=DMe(e);return Pe.node(e,function(n,i){u(t[i])||u(n.translation)||u(n.rotation)||u(n.scale)?(n.translation=y(n.translation,[0,0,0]),n.rotation=y(n.rotation,[0,0,0,1]),n.scale=y(n.scale,[1,1,1])):n.matrix=y(n.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),Pe.sampler(e,function(n){n.wrapS=y(n.wrapS,ee.REPEAT),n.wrapT=y(n.wrapT,ee.REPEAT)}),u(e.scenes)&&!u(e.scene)&&(e.scene=0),e}function DMe(e){let t={};return Pe.animation(e,function(n){Pe.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 dA(e){u(e)&&(e.texCoord=y(e.texCoord,0))}var DP=SMe;function vMe(e){return Pe.shader(e,function(t){SV(t)}),Pe.buffer(e,function(t){SV(t)}),Pe.image(e,function(t){SV(t)}),SV(e),e}function SV(e){e.extras=u(e.extras)?e.extras:{},e.extras._pipeline=u(e.extras._pipeline)?e.extras._pipeline:{}}var yg=vMe;function wMe(e,t){let n=e.extensionsRequired;if(u(n)){let i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}var vP=wMe;function IMe(e,t){let n=e.extensionsUsed;if(u(n)){let i=n.indexOf(t);i>=0&&n.splice(i,1),vP(e,t),n.length===0&&delete e.extensionsUsed}}var hA=IMe;var PMe=4;function OMe(e){if(od(e)!=="glTF")throw new ue("File is not valid binary glTF");let n=Wte(e,0,5),i=n[1];if(i!==1&&i!==2)throw new ue("Binary glTF version is not 1 or 2");return i===1?RMe(e,n):BMe(e,n)}function Wte(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*PMe,!0);return o}function RMe(e,t){let n=t[2],i=t[3];if(t[4]!==0)throw new ue("Binary glTF scene format is not JSON");let r=20,s=r+i,a=ll(e,r,i),c=JSON.parse(a);yg(c);let l=e.subarray(s,n),f=c.buffers;if(u(f)&&Object.keys(f).length>0){let d=y(f.binary_glTF,f.KHR_binary_glTF);u(d)&&(d.extras._pipeline.source=l,delete d.uri)}return hA(c,"KHR_binary_glTF"),c}function BMe(e,t){let n=t[2],i=12,o,r;for(;i<n;){let s=Wte(e,i,2),a=s[0],c=s[1];i+=8;let l=e.subarray(i,i+a);if(i+=a,c===1313821514){let f=ll(l);o=JSON.parse(f),yg(o)}else c===5130562&&(r=l)}if(u(o)&&u(r)){let s=o.buffers;if(u(s)&&s.length>0){let a=s[0];a.extras._pipeline.source=r}}return o}var wP=OMe;function MMe(e){return Pe.shader(e,function(t){DV(t)}),Pe.buffer(e,function(t){DV(t)}),Pe.image(e,function(t){DV(t)}),DV(e),e}function DV(e){u(e.extras)&&(u(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}var IP=MMe;function LMe(e,t){let n=e.extensionsUsed;u(n)||(n=[],e.extensionsUsed=n),rs(n,t,!0)}var Yu=LMe;function NMe(e){switch(e){case q.BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt8(n+s*o)};case q.UNSIGNED_BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint8(n+s*o)};case q.SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt16(n+s*o,!0)};case q.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 q.INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt32(n+s*o,!0)};case q.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 q.FLOAT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat32(n+s*o,!0)};case q.DOUBLE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat64(n+s*o,!0)}}}var gp=NMe;function FMe(e,t){let n=e.bufferViews,i=e.buffers,o=t.bufferView,r=Kl(t.type);if(!u(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),c=n[o],l=c.buffer,d=i[l].extras._pipeline.source,p=t.count,g=dl(e,t),m=t.byteOffset+c.byteOffset+d.byteOffset,A=t.componentType,x=q.getSizeInBytes(A),C=new DataView(d.buffer),T=new Array(r),E=gp(A);for(let S=0;S<p;S++){E(C,m,r,x,T);for(let D=0;D<r;D++){let w=T[D];s[D]=Math.min(s[D],w),a[D]=Math.max(a[D],w)}m+=g}return{min:s,max:a}}var mA=FMe;var VMe=[ee.FUNC_ADD,ee.FUNC_ADD],UMe=[ee.ONE,ee.ZERO,ee.ONE,ee.ZERO];function jte(e,t){let n=e.enable;return u(n)?n.indexOf(t)>-1:!1}var kMe=[ee.ZERO,ee.ONE,ee.SRC_COLOR,ee.ONE_MINUS_SRC_COLOR,ee.SRC_ALPHA,ee.ONE_MINUS_SRC_ALPHA,ee.DST_ALPHA,ee.ONE_MINUS_DST_ALPHA,ee.DST_COLOR,ee.ONE_MINUS_DST_COLOR];function zMe(e,t){if(!u(e))return t;for(let n=0;n<4;n++)if(kMe.indexOf(e[n])===-1)return t;return e}function HMe(e){let t={},n={},i=e.techniques;return u(i)&&(Pe.technique(e,function(o,r){let s=o.states;if(u(s)){let a=n[r]={};if(jte(s,ee.BLEND)){a.alphaMode="BLEND";let c=s.functions;u(c)&&(u(c.blendEquationSeparate)||u(c.blendFuncSeparate))&&(t[r]={blendEquation:y(c.blendEquationSeparate,VMe),blendFactors:zMe(c.blendFuncSeparate,UMe)})}jte(s,ee.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(u(e.extensions)||(e.extensions={}),Yu(e,"KHR_blend")),Pe.material(e,function(o){if(u(o.technique)){let r=n[o.technique];Pe.objectLegacy(r,function(a,c){o[c]=a});let s=t[o.technique];u(s)&&(u(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}var PP=HMe;function GMe(e,t){let n=e.extensionsRequired;u(n)||(n=[],e.extensionsRequired=n),rs(n,t,!0),Yu(e,t)}var OP=GMe;function WMe(e){let t=e.techniques,n={},i={},o={};if(u(t)){let r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,Pe.technique(e,function(a,c){let l={name:a.name,program:void 0,attributes:{},uniforms:{}},f;if(Pe.techniqueAttribute(a,function(d,p){f=a.parameters[d],l.attributes[p]={semantic:f.semantic}}),Pe.techniqueUniform(a,function(d,p){f=a.parameters[d],l.uniforms[p]={count:f.count,node:f.node,type:f.type,semantic:f.semantic,value:f.value},u(n[c])||(n[c]={}),n[c][d]=p}),u(o[a.program]))l.program=o[a.program];else{let d=e.programs[a.program],p={name:d.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[d.fragmentShader];p.fragmentShader=rs(r.shaders,g,!0);let m=e.shaders[d.vertexShader];p.vertexShader=rs(r.shaders,m,!0),l.program=rs(r.programs,p),o[a.program]=l.program}i[c]=rs(r.techniques,l)}),r.techniques.length>0&&(u(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,Yu(e,"KHR_techniques_webgl"),OP(e,"KHR_techniques_webgl"))}return Pe.material(e,function(r){if(u(r.technique)){let s={technique:i[r.technique]};Pe.objectLegacy(r.values,function(a,c){u(s.values)||(s.values={});let l=n[r.technique][c];u(l)&&(s.values[l]=a)}),u(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 RP=WMe;function jMe(e,t){Qc.typeOf.object("material",e),Qc.defined("handler",t);let n=e.pbrMetallicRoughness;if(u(n)){if(u(n.baseColorTexture)){let o=n.baseColorTexture,r=t(o.index,o);if(u(r))return r}if(u(n.metallicRoughnessTexture)){let o=n.metallicRoughnessTexture,r=t(o.index,o);if(u(r))return r}}if(u(e.extensions)){let o=e.extensions.KHR_materials_pbrSpecularGlossiness;if(u(o)){if(u(o.diffuseTexture)){let s=o.diffuseTexture,a=t(s.index,s);if(u(a))return a}if(u(o.specularGlossinessTexture)){let s=o.specularGlossinessTexture,a=t(s.index,s);if(u(a))return a}}let r=e.extensions.KHR_materials_common;if(u(r)&&u(r.values)){let s=r.values.diffuse,a=r.values.ambient,c=r.values.emission,l=r.values.specular;if(u(s)&&u(s.index)){let f=t(s.index,s);if(u(f))return f}if(u(a)&&u(a.index)){let f=t(a.index,a);if(u(f))return f}if(u(c)&&u(c.index)){let f=t(c.index,c);if(u(f))return f}if(u(l)&&u(l.index)){let f=t(l.index,l);if(u(f))return f}}}let i=Pe.materialValue(e,function(o){if(u(o.index)){let r=t(o.index,o);if(u(r))return r}});if(u(i))return i;if(u(e.emissiveTexture)){let o=e.emissiveTexture,r=t(o.index,o);if(u(r))return r}if(u(e.normalTexture)){let o=e.normalTexture,r=t(o.index,o);if(u(r))return r}if(u(e.occlusionTexture)){let o=e.occlusionTexture,r=t(o.index,o);if(u(r))return r}}var wT=jMe;var Yte=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function YMe(e,t){return t=y(t,Yte),Yte.forEach(function(n){t.indexOf(n)>-1&&XMe(e,n)}),e}var qMe={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function XMe(e,t){let n=qMe[t],i=e[n];if(u(i)){let o=0,r=Ih[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(wh[t](e,a-o),o++)}}function wh(){}wh.accessor=function(e,t){e.accessors.splice(t,1),Pe.mesh(e,function(i){Pe.meshPrimitive(i,function(o){Pe.meshPrimitiveAttribute(o,function(s,a){s>t&&o.attributes[a]--}),Pe.meshPrimitiveTarget(o,function(s){Pe.meshPrimitiveTargetAttribute(s,function(a,c){a>t&&s[c]--})});let r=o.indices;u(r)&&r>t&&o.indices--})}),Pe.skin(e,function(i){u(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),Pe.animation(e,function(i){Pe.animationSampler(i,function(o){u(o.input)&&o.input>t&&o.input--,u(o.output)&&o.output>t&&o.output--})})};wh.buffer=function(e,t){e.buffers.splice(t,1),Pe.bufferView(e,function(i){u(i.buffer)&&i.buffer>t&&i.buffer--,u(i.extensions)&&u(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};wh.bufferView=function(e,t){if(e.bufferViews.splice(t,1),Pe.accessor(e,function(i){u(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Pe.shader(e,function(i){u(i.bufferView)&&i.bufferView>t&&i.bufferView--}),Pe.image(e,function(i){u(i.bufferView)&&i.bufferView>t&&i.bufferView--}),_r(e,"KHR_draco_mesh_compression")&&Pe.mesh(e,function(i){Pe.meshPrimitive(i,function(o){u(o.extensions)&&u(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),_r(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(u(a)){for(let c in a)if(a.hasOwnProperty(c)){let l=a[c];u(l.bufferView)&&l.bufferView>t&&l.bufferView--,u(l.arrayOffsetBufferView)&&l.arrayOffsetBufferView>t&&l.arrayOffsetBufferView--,u(l.stringOffsetBufferView)&&l.stringOffsetBufferView>t&&l.stringOffsetBufferView--}}}}if(_r(e,"EXT_structural_metadata")){let o=e.extensions.EXT_structural_metadata.propertyTables;if(u(o)){let r=o.length;for(let s=0;s<r;++s){let c=o[s].properties;for(let l in c)if(c.hasOwnProperty(l)){let f=c[l];u(f.values)&&f.values>t&&f.values--,u(f.arrayOffsets)&&f.arrayOffsets>t&&f.arrayOffsets--,u(f.stringOffsets)&&f.stringOffsets>t&&f.stringOffsets--}}}}};wh.image=function(e,t){e.images.splice(t,1),Pe.texture(e,function(i){u(i.source)&&i.source>t&&--i.source;let o=i.extensions;u(o)&&u(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:u(o)&&u(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};wh.mesh=function(e,t){e.meshes.splice(t,1),Pe.node(e,function(i){u(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};wh.node=function(e,t){e.nodes.splice(t,1),Pe.skin(e,function(i){u(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),Pe.animation(e,function(i){Pe.animationChannel(i,function(o){u(o.target)&&u(o.target.node)&&o.target.node>t&&o.target.node--})}),Pe.technique(e,function(i){Pe.techniqueUniform(i,function(o){u(o.node)&&o.node>t&&o.node--})}),Pe.node(e,function(i){u(i.children)&&(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),Pe.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};wh.material=function(e,t){e.materials.splice(t,1),Pe.mesh(e,function(i){Pe.meshPrimitive(i,function(o){u(o.material)&&o.material>t&&o.material--})})};wh.sampler=function(e,t){e.samplers.splice(t,1),Pe.texture(e,function(i){u(i.sampler)&&i.sampler>t&&--i.sampler})};wh.texture=function(e,t){if(e.textures.splice(t,1),Pe.material(e,function(i){wT(i,function(o,r){r.index>t&&--r.index})}),_r(e,"EXT_feature_metadata")){Pe.mesh(e,function(r){Pe.meshPrimitive(r,function(s){let a=s.extensions;if(u(a)&&u(a.EXT_feature_metadata)){let l=a.EXT_feature_metadata.featureIdTextures;if(u(l)){let f=l.length;for(let d=0;d<f;++d){let g=l[d].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(u(a)){for(let c in a)if(a.hasOwnProperty(c)){let f=a[c].texture;f.index>t&&--f.index}}}}if(_r(e,"EXT_mesh_features")&&Pe.mesh(e,function(i){Pe.meshPrimitive(i,function(o){let r=o.extensions;if(u(r)&&u(r.EXT_mesh_features)){let a=r.EXT_mesh_features.featureIds;if(u(a)){let c=a.length;for(let l=0;l<c;++l){let f=a[l];u(f.texture)&&f.texture.index>t&&--f.texture.index}}}})}),_r(e,"EXT_structural_metadata")){let o=e.extensions.EXT_structural_metadata.propertyTextures;if(u(o)){let r=o.length;for(let s=0;s<r;++s){let c=o[s].properties;for(let l in c)if(c.hasOwnProperty(l)){let f=c[l];f.index>t&&--f.index}}}}};function Ih(){}Ih.accessor=function(e){let t={};return Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){Pe.meshPrimitiveAttribute(i,function(r){t[r]=!0}),Pe.meshPrimitiveTarget(i,function(r){Pe.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});let o=i.indices;u(o)&&(t[o]=!0)})}),Pe.skin(e,function(n){u(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),Pe.animation(e,function(n){Pe.animationSampler(n,function(i){u(i.input)&&(t[i.input]=!0),u(i.output)&&(t[i.output]=!0)})}),_r(e,"EXT_mesh_gpu_instancing")&&Pe.node(e,function(n){u(n.extensions)&&u(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})}),t};Ih.buffer=function(e){let t={};return Pe.bufferView(e,function(n){u(n.buffer)&&(t[n.buffer]=!0),u(n.extensions)&&u(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};Ih.bufferView=function(e){let t={};if(Pe.accessor(e,function(n){u(n.bufferView)&&(t[n.bufferView]=!0)}),Pe.shader(e,function(n){u(n.bufferView)&&(t[n.bufferView]=!0)}),Pe.image(e,function(n){u(n.bufferView)&&(t[n.bufferView]=!0)}),_r(e,"KHR_draco_mesh_compression")&&Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){u(i.extensions)&&u(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),_r(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(u(s)){for(let a in s)if(s.hasOwnProperty(a)){let c=s[a];u(c.bufferView)&&(t[c.bufferView]=!0),u(c.arrayOffsetBufferView)&&(t[c.arrayOffsetBufferView]=!0),u(c.stringOffsetBufferView)&&(t[c.stringOffsetBufferView]=!0)}}}}if(_r(e,"EXT_structural_metadata")){let i=e.extensions.EXT_structural_metadata.propertyTables;if(u(i)){let o=i.length;for(let r=0;r<o;++r){let a=i[r].properties;for(let c in a)if(a.hasOwnProperty(c)){let l=a[c];u(l.values)&&(t[l.values]=!0),u(l.arrayOffsets)&&(t[l.arrayOffsets]=!0),u(l.stringOffsets)&&(t[l.stringOffsets]=!0)}}}}return t};Ih.image=function(e){let t={};return Pe.texture(e,function(n){u(n.source)&&(t[n.source]=!0),u(n.extensions)&&u(n.extensions.EXT_texture_webp)?t[n.extensions.EXT_texture_webp.source]=!0:u(n.extensions)&&u(n.extensions.KHR_texture_basisu)&&(t[n.extensions.KHR_texture_basisu.source]=!0)}),t};Ih.mesh=function(e){let t={};return Pe.node(e,function(n){if(u(n.mesh&&u(e.meshes))){let i=e.meshes[n.mesh];u(i)&&u(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}}),t};function qte(e,t,n){let i=e.nodes[t];return u(i.mesh)||u(i.camera)||u(i.skin)||u(i.weights)||u(i.extras)||u(i.extensions)&&Object.keys(i.extensions).length!==0||u(n[t])?!1:!u(i.children)||i.children.filter(function(o){return!qte(e,o,n)}).length===0}Ih.node=function(e){let t={};return Pe.skin(e,function(n){u(n.skeleton)&&(t[n.skeleton]=!0),Pe.skinJoint(n,function(i){t[i]=!0})}),Pe.animation(e,function(n){Pe.animationChannel(n,function(i){u(i.target)&&u(i.target.node)&&(t[i.target.node]=!0)})}),Pe.technique(e,function(n){Pe.techniqueUniform(n,function(i){u(i.node)&&(t[i.node]=!0)})}),Pe.node(e,function(n,i){qte(e,i,t)||(t[i]=!0)}),t};Ih.material=function(e){let t={};return Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){u(i.material)&&(t[i.material]=!0)})}),t};Ih.texture=function(e){let t={};if(Pe.material(e,function(n){wT(n,function(i){t[i]=!0})}),_r(e,"EXT_feature_metadata")){Pe.mesh(e,function(o){Pe.meshPrimitive(o,function(r){let s=r.extensions;if(u(s)&&u(s.EXT_feature_metadata)){let c=s.EXT_feature_metadata.featureIdTextures;if(u(c)){let l=c.length;for(let f=0;f<l;++f){let p=c[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(u(s)){for(let a in s)if(s.hasOwnProperty(a)){let l=s[a].texture;t[l.index]=!0}}}}if(_r(e,"EXT_mesh_features")&&Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){let o=i.extensions;if(u(o)&&u(o.EXT_mesh_features)){let s=o.EXT_mesh_features.featureIds;if(u(s)){let a=s.length;for(let c=0;c<a;++c){let l=s[c];u(l.texture)&&(t[l.texture.index]=!0)}}}})}),_r(e,"EXT_structural_metadata")){let i=e.extensions.EXT_structural_metadata.propertyTextures;if(u(i)){let o=i.length;for(let r=0;r<o;++r){let a=i[r].properties;for(let c in a)if(a.hasOwnProperty(c)){let l=a[c];t[l.index]=!0}}}}return t};Ih.sampler=function(e){let t={};return Pe.texture(e,function(n){u(n.sampler)&&(t[n.sampler]=!0)}),t};var BP=YMe;function KMe(e,t){let n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:rs(e.buffers,n),byteOffset:0,byteLength:t.length};return rs(e.bufferViews,o)}var MP=KMe;function ZMe(e,t){let n=dl(e,t),i=q.getSizeInBytes(t.componentType),o=Kl(t.type),r=t.count,s=new Array(o*r);if(!u(t.bufferView))return s.fill(0);let a=e.bufferViews[t.bufferView],c=e.buffers[a.buffer].extras._pipeline.source,l=t.byteOffset+a.byteOffset+c.byteOffset,f=new DataView(c.buffer),d=new Array(o),p=gp(t.componentType);for(let g=0;g<r;++g){p(f,l,o,i,d);for(let m=0;m<o;++m)s[g*o+m]=d[m];l+=n}return s}var LP=ZMe;function JMe(e){let t;return Pe.accessorWithSemantic(e,"JOINTS_0",function(n){let i=e.accessors[n];t=i.componentType,t===ee.BYTE?vV(e,i,q.UNSIGNED_BYTE):t!==ee.UNSIGNED_BYTE&&t!==ee.UNSIGNED_SHORT&&vV(e,i,q.UNSIGNED_SHORT)}),Pe.accessorWithSemantic(e,"WEIGHTS_0",function(n){let i=e.accessors[n];t=i.componentType,t===ee.BYTE?vV(e,i,q.UNSIGNED_BYTE):t===ee.SHORT&&vV(e,i,q.UNSIGNED_SHORT)}),e}function vV(e,t,n){let i=q.createTypedArray(n,LP(e,t)),o=new Uint8Array(i.buffer);t.bufferView=MP(e,o),t.componentType=n,t.byteOffset=0}var NP=JMe;function QMe(e,t){return hA(e,t),t==="CESIUM_RTC"&&$Me(e),y5(e,t)}function $Me(e){Pe.technique(e,function(t){Pe.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function y5(e,t){if(Array.isArray(e)){let n=e.length;for(let i=0;i<n;++i)y5(e[i],t)}else if(e!==null&&typeof e=="object"&&e.constructor===Object){let n=e.extensions,i;u(n)&&(i=n[t],u(i)&&(delete n[t],Object.keys(n).length===0&&delete e.extensions));for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&y5(e[o],t);return i}}var pA=QMe;var wV={.8:rLe,"1.0":DLe,"2.0":void 0};function eLe(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.targetVersion,i=e.version;e.asset=y(e.asset,{version:"1.0"}),e.asset.version=y(e.asset.version,"1.0"),i=y(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(wV,i)||(u(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(wV,i)||(i="1.0"));let o=wV[i];for(;u(o)&&i!==n;)o(e,t),i=e.asset.version,o=wV[i];return t.keepLegacyExtensions||(ILe(e),PLe(e)),e}function Kte(e){let t=e.materials;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n],o=i.instanceTechnique;u(o)&&(i.technique=o.technique,i.values=o.values,delete i.instanceTechnique)}}function tLe(e){let t=e.meshes;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let o=t[n].primitives;if(u(o)){let r=o.length;for(let s=0;s<r;++s){let a=o[s],c=y(a.primitive,ee.TRIANGLES);a.mode=y(a.mode,c),delete a.primitive}}}}function nLe(e){let t=e.nodes,n=new h,i=new Le;for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o];if(u(r.rotation)){let a=r.rotation;h.fromArray(a,0,n),Le.fromAxisAngle(n,a[3],i),r.rotation=[i.x,i.y,i.z,i.w]}let s=r.instanceSkin;u(s)&&(r.skeletons=s.skeletons,r.skin=s.skin,r.meshes=s.meshes,delete r.instanceSkin)}}function iLe(e){let t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new h,a=new Le;for(let c in t)if(Object.prototype.hasOwnProperty.call(t,c)){let l=t[c],f=l.channels,d=l.parameters,p=l.samplers;if(u(f)){let g=f.length;for(let m=0;m<g;++m){let A=f[m];if(A.target.path==="rotation"){let x=d[p[A.sampler].output];if(u(r[x]))continue;r[x]=!0;let C=n[x],T=i[C.bufferView],S=o[T.buffer].extras._pipeline.source,D=S.byteOffset+T.byteOffset+C.byteOffset,w=C.componentType,R=C.count,O=Kl(C.type),L=C.count*O,N=q.createArrayBufferView(w,S.buffer,D,L);for(let _=0;_<R;_++){let b=_*O;h.unpack(N,b,s);let v=N[b+3];Le.fromAxisAngle(s,v,a),Le.pack(a,N,b)}}}}}}function oLe(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(u(o)){let r=y(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(o,r)){let s=o[r],a=s.instanceProgram;i.attributes=y(i.attributes,a.attributes),i.program=y(i.program,a.program),i.uniforms=y(i.uniforms,a.uniforms),i.states=y(i.states,s.states)}delete i.passes,delete i.pass}}}function rLe(e){u(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(u(e.version)&&delete e.version,Kte(e),tLe(e),nLe(e),iLe(e),oLe(e),u(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),u(e.lights)){let n=y(e.extensions,{});e.extensions=n;let i=y(n.KHR_materials_common,{});n.KHR_materials_common=i,i.lights=e.lights,delete e.lights,Yu(e,"KHR_materials_common")}}function sLe(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(u(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 Xte(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),u(o.name)||(o.name=i)}return n}function aLe(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,u(i)&&(o[i]=s));for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&u(n[s])){let a={},c=e[s];e[s]=Xte(c,a),n[s]=a}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);u(e.scene)&&(e.scene=n.scenes[e.scene]),Pe.bufferView(e,function(s){u(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),Pe.accessor(e,function(s){u(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),Pe.shader(e,function(s){let a=s.extensions;if(u(a)){let c=a.KHR_binary_glTF;u(c)&&(s.bufferView=n.bufferViews[c.bufferView],delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Pe.program(e,function(s){u(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),u(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),Pe.technique(e,function(s){u(s.program)&&(s.program=n.programs[s.program]),Pe.techniqueParameter(s,function(a){u(a.node)&&(a.node=n.nodes[a.node]);let c=a.value;typeof c=="string"&&(a.value={index:n.textures[c]})})}),Pe.mesh(e,function(s){Pe.meshPrimitive(s,function(a){u(a.indices)&&(a.indices=n.accessors[a.indices]),Pe.meshPrimitiveAttribute(a,function(c,l){a.attributes[l]=n.accessors[c]}),u(a.material)&&(a.material=n.materials[a.material])})}),Pe.node(e,function(s){let a=s.children;if(u(a)){let c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}if(u(s.meshes)){let c=s.meshes,l=c.length;if(l>0)for(s.mesh=n.meshes[c[0]],t=1;t<l;++t){let f={mesh:n.meshes[c[t]]},d=rs(e.nodes,f);u(a)||(a=[],s.children=a),a.push(d)}delete s.meshes}if(u(s.camera)&&(s.camera=n.cameras[s.camera]),u(s.skin)&&(s.skin=n.skins[s.skin]),u(s.skeletons)){let c=s.skeletons;if(c.length>0&&u(s.skin)){let f=e.skins[s.skin];f.skeleton=n.nodes[c[0]]}delete s.skeletons}u(s.jointName)&&delete s.jointName}),Pe.skin(e,function(s){u(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);let a=s.jointNames;if(u(a)){let c=[],l=a.length;for(t=0;t<l;++t)c[t]=o[a[t]];s.joints=c,delete s.jointNames}}),Pe.scene(e,function(s){let a=s.nodes;if(u(a)){let c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}}),Pe.animation(e,function(s){let a={};s.samplers=Xte(s.samplers,a),Pe.animationSampler(s,function(c){c.input=n.accessors[c.input],c.output=n.accessors[c.output]}),Pe.animationChannel(s,function(c){c.sampler=a[c.sampler];let l=c.target;u(l)&&(l.node=n.nodes[l.id],delete l.id)})}),Pe.material(e,function(s){u(s.technique)&&(s.technique=n.techniques[s.technique]),Pe.materialValue(s,function(c,l){typeof c=="string"&&(s.values[l]={index:n.textures[c]})});let a=s.extensions;if(u(a)){let c=a.KHR_materials_common;u(c)&&u(c.values)&&Pe.materialValue(c,function(l,f){typeof l=="string"&&(c.values[f]={index:n.textures[l]})})}}),Pe.image(e,function(s){let a=s.extensions;if(u(a)){let c=a.KHR_binary_glTF;u(c)&&(s.bufferView=n.bufferViews[c.bufferView],s.mimeType=c.mimeType,delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),Pe.texture(e,function(s){u(s.sampler)&&(s.sampler=n.samplers[s.sampler]),u(s.source)&&(s.source=n.images[s.source])})}function cLe(e){Pe.animation(e,function(t){Pe.animationSampler(t,function(n){delete n.name})})}function lLe(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]}Pe.node(e,function(t){u(t.children)&&t.children.length===0&&delete t.children})}function uLe(e){let t=e.asset;delete t.profile,delete t.premultipliedAlpha}var fLe={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function dLe(e){let t=e.extensionsUsed;if(e.extensionsRequired=y(e.extensionsRequired,[]),u(t)){let n=t.length;for(let i=0;i<n;++i){let o=t[i];u(fLe[o])&&e.extensionsRequired.push(o)}}}function hLe(e){Pe.buffer(e,function(t){delete t.type})}function mLe(e){Pe.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function pLe(e){Pe.mesh(e,function(t){Pe.meshPrimitive(t,function(n){Pe.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})}),Pe.technique(e,function(t){Pe.techniqueParameter(t,function(n){let i=n.semantic;u(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}var _Le={POSITION:!0,NORMAL:!0,TANGENT:!0},gLe={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function yLe(e){let t={};Pe.mesh(e,function(n){Pe.meshPrimitive(n,function(i){Pe.meshPrimitiveAttribute(i,function(o,r){if(r.charAt(0)!=="_"){let s=r.search(/_[0-9]+/g),a=r,c="_0";s>=0&&(a=r.substring(0,s),c=r.substring(s));let l,f=gLe[a];u(f)?(l=f+c,t[r]=l):u(_Le[a])||(l=`_${r}`,t[r]=l)}});for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],s=i.attributes[o];u(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),Pe.technique(e,function(n){Pe.techniqueParameter(n,function(i){let o=t[i.semantic];u(o)&&(i.semantic=o)})})}function ALe(e){Pe.camera(e,function(t){let n=t.perspective;if(u(n)){let i=n.aspectRatio;u(i)&&i===0&&delete n.aspectRatio;let o=n.yfov;u(o)&&o===0&&(n.yfov=1)}})}function A5(e,t){return u(t.byteStride)&&t.byteStride!==0?t.byteStride:dl(e,t)}function xLe(e){Pe.buffer(e,function(t){u(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),Pe.accessor(e,function(t){let n=t.bufferView;if(u(n)){let i=e.bufferViews[n],o=A5(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(y(i.byteLength,0),r)}})}function CLe(e){let t,n,i,o=e.bufferViews,r={};Pe.accessorContainingVertexAttributeData(e,function(a){let c=e.accessors[a];u(c.bufferView)&&(r[c.bufferView]=!0)});let s={};Pe.accessor(e,function(a){u(a.bufferView)&&(s[a.bufferView]=y(s[a.bufferView],[]),s[a.bufferView].push(a))});for(let a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];let c=s[a];c.sort(function(p,g){return p.byteOffset-g.byteOffset});let l=0,f=0,d=c.length;for(t=0;t<d;++t){let p=c[t],g=A5(e,p),m=p.byteOffset,A=p.count*g;delete p.byteStride;let x=t<d-1,C=x?A5(e,c[t+1]):void 0;if(g!==C){let T=Ge(i,!0);r[a]&&(T.byteStride=g),T.byteOffset+=l,T.byteLength=m+A-l;let E=rs(o,T);for(n=f;n<=t;++n)p=c[n],p.bufferView=E,p.byteOffset=p.byteOffset-l;l=x?c[t+1].byteOffset:void 0,f=t+1}}}BP(e,["accessor","bufferView","buffer"])}function TLe(e){Pe.accessorWithSemantic(e,"POSITION",function(t){let n=e.accessors[t];if(!u(n.min)||!u(n.max)){let i=mA(e,n);n.min=i.min,n.max=i.max}})}function Zte(e){return(!u(e.children)||e.children.length===0)&&(!u(e.meshes)||e.meshes.length===0)&&!u(e.camera)&&!u(e.skin)&&!u(e.skeletons)&&!u(e.jointName)&&(!u(e.translation)||h.fromArray(e.translation).equals(h.ZERO))&&(!u(e.scale)||h.fromArray(e.scale).equals(new h(1,1,1)))&&(!u(e.rotation)||oe.fromArray(e.rotation).equals(new oe(0,0,0,1)))&&(!u(e.matrix)||M.fromColumnMajorArray(e.matrix).equals(M.IDENTITY))&&!u(e.extensions)&&!u(e.extras)}function Jte(e,t){Pe.scene(e,function(n){let i=n.nodes;if(u(i)){let o=i.length;for(let r=o;r>=0;--r)if(i[r]===t){i.splice(r,1);return}}}),Pe.node(e,function(n,i){if(u(n.children)){let o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),Zte(n)&&Jte(e,i))}}),delete e.nodes[t]}function ELe(e){return Pe.node(e,function(t,n){Zte(t)&&Jte(e,n)}),e}function bLe(e){Pe.animation(e,function(t){Pe.animationSampler(t,function(n){let i=e.accessors[n.input];if(!u(i.min)||!u(i.max)){let o=mA(e,i);i.min=o.min,i.max=o.max}})})}function SLe(e){Pe.accessor(e,function(t){if(u(t.min)||u(t.max)){let n=mA(e,t);u(t.min)&&(t.min=n.min),u(t.max)&&(t.max=n.max)}})}function DLe(e){e.asset=y(e.asset,{}),e.asset.version="2.0",Kte(e),sLe(e),ELe(e),aLe(e),cLe(e),uLe(e),dLe(e),xLe(e),CLe(e),TLe(e),bLe(e),SLe(e),hLe(e),mLe(e),pLe(e),yLe(e),NP(e),ALe(e),PP(e),RP(e),lLe(e)}var vLe=["u_tex","u_diffuse","u_emission"],wLe=["u_diffuse"];function x5(e){e.pbrMetallicRoughness=u(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function IV(e){return u(e.index)}function PV(e){return Array.isArray(e)&&e.length===4}function Qte(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 ILe(e){Pe.material(e,function(t){Pe.materialValue(t,function(n,i){vLe.indexOf(i)!==-1&&IV(n)?(x5(t),t.pbrMetallicRoughness.baseColorTexture=n):wLe.indexOf(i)!==-1&&PV(n)&&(x5(t),t.pbrMetallicRoughness.baseColorFactor=Qte(n))})}),pA(e,"KHR_techniques_webgl"),pA(e,"KHR_blend")}function PLe(e){Pe.material(e,function(t){let n=y(t.extensions,y.EMPTY_OBJECT).KHR_materials_common;if(u(n)){n.technique==="CONSTANT"&&(Yu(e,"KHR_materials_unlit"),t.extensions=u(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={});let o=u(n.values)?n.values:{},r=o.ambient,s=o.diffuse,a=o.emission,c=o.transparency,l=n.doubleSided,f=n.transparent;x5(t),u(r)&&(PV(r)?t.emissiveFactor=r.slice(0,3):IV(r)&&(t.emissiveTexture=r)),u(s)&&(PV(s)?t.pbrMetallicRoughness.baseColorFactor=Qte(s):IV(s)&&(t.pbrMetallicRoughness.baseColorTexture=s)),u(l)&&(t.doubleSided=l),u(a)&&(PV(a)?t.emissiveFactor=a.slice(0,3):IV(a)&&(t.emissiveTexture=a)),u(c)&&(u(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=c:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,c]),u(f)&&(t.alphaMode=f?"BLEND":"OPAQUE")}}),pA(e,"KHR_materials_common")}var FP=eLe;function Ag(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;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=Ut.UNLOADED,this._promise=void 0}u(Object.create)&&(Ag.prototype=Object.create(no.prototype),Ag.prototype.constructor=Ag);Object.defineProperties(Ag.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});Ag.prototype.load=function(){this._state=Ut.LOADING;let e;u(this._gltfJson)?e=$te(this,this._gltfJson):u(this._typedArray)?e=ene(this,this._typedArray):e=OLe(this);let t=this;return this._promise=e.then(function(n){if(!t.isDestroyed())return t._gltf=n,t._state=Ut.READY,t}).catch(function(n){if(!t.isDestroyed())return RLe(t,n)}),this._promise};function OLe(e){return e._fetchGltf().then(function(t){if(e.isDestroyed())return;let n=new Uint8Array(t);return ene(e,n)})}function RLe(e,t){e.unload(),e._state=Ut.FAILED;let n=`Failed to load glTF: ${e._gltfResource.url}`;return Promise.reject(e.getError(n,t))}function BLe(e,t){if(u(t.asset)&&t.asset.version==="2.0"&&!_r(t,"KHR_techniques_webgl")&&!_r(t,"KHR_materials_common"))return Promise.resolve();let n=[];return Pe.buffer(t,function(i){if(!u(i.extras._pipeline.source)&&u(i.uri)){let o=e._baseResource.getDerivedResource({url:i.uri}),s=e._resourceCache.loadExternalBuffer({resource:o});e._bufferLoaders.push(s),n.push(s.promise.then(function(a){i.extras._pipeline.source=a.typedArray}))}}),Promise.all(n).then(function(){FP(t)})}function MLe(e){let t=[];return Pe.buffer(e,function(n){let i=n.uri;!u(n.extras._pipeline.source)&&u(i)&&Vm(i)&&(delete n.uri,t.push(Oe.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function LLe(e,t){let n=[];return Pe.buffer(t,function(i,o){let r=i.extras._pipeline.source;if(u(r)&&!u(i.uri)){let a=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:o,typedArray:r});e._bufferLoaders.push(a),n.push(a.promise)}}),Promise.all(n)}function $te(e,t){return yg(t),MLe(t).then(function(){return BLe(e,t)}).then(function(){return DP(t),LLe(e,t)}).then(function(){return IP(t),t})}function ene(e,t){let n;return od(t)==="glTF"?n=wP(t):n=Oo(t),$te(e,n)}Ag.prototype.unload=function(){let e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0};Ag.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};var IT=Ag;var NLe={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},Ph=Object.freeze(NLe);var Yo={};function FLe(){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 VLe(){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 ULe(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function kLe(){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 zLe(){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 HLe(){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 GLe(){this.attributes=[]}function WLe(){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 jLe(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function YLe(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function qLe(){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 XLe(){this.nodes=[]}var KLe={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function ZLe(){this.input=[],this.interpolation=void 0,this.output=[]}function JLe(){this.node=void 0,this.path=void 0}function QLe(){this.sampler=void 0,this.target=void 0}function $Le(){this.name=void 0,this.samplers=[],this.channels=[]}function eNe(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function tNe(){this.name=void 0,this.stages=[]}function tne(){this.credits=[]}function nNe(){this.asset=new tne,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=M.clone(M.IDENTITY)}function iNe(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=Z.clone(Z.IDENTITY),this.channels=void 0}function xg(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=oe.clone(xg.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=xg.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=xg.DEFAULT_ROUGHNESS_FACTOR}xg.DEFAULT_BASE_COLOR_FACTOR=oe.ONE;xg.DEFAULT_METALLIC_FACTOR=1;xg.DEFAULT_ROUGHNESS_FACTOR=1;function _A(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=oe.clone(_A.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=h.clone(_A.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=_A.DEFAULT_GLOSSINESS_FACTOR}_A.DEFAULT_DIFFUSE_FACTOR=oe.ONE;_A.DEFAULT_SPECULAR_FACTOR=h.ONE;_A.DEFAULT_GLOSSINESS_FACTOR=1;function C5(){this.metallicRoughness=new xg,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=h.clone(C5.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=Ph.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}C5.DEFAULT_EMISSIVE_FACTOR=h.ZERO;Yo.Quantization=FLe;Yo.Attribute=VLe;Yo.Indices=ULe;Yo.FeatureIdAttribute=kLe;Yo.FeatureIdTexture=HLe;Yo.FeatureIdImplicitRange=zLe;Yo.MorphTarget=GLe;Yo.Primitive=WLe;Yo.Instances=jLe;Yo.Skin=YLe;Yo.Node=qLe;Yo.Scene=XLe;Yo.AnimatedPropertyType=Object.freeze(KLe);Yo.AnimationSampler=ZLe;Yo.AnimationTarget=JLe;Yo.AnimationChannel=QLe;Yo.Animation=$Le;Yo.ArticulationStage=eNe;Yo.Articulation=tNe;Yo.Asset=tne;Yo.Components=nNe;Yo.TextureReader=iNe;Yo.MetallicRoughness=xg;Yo.SpecularGlossiness=_A;Yo.Material=C5;var Rt=Yo;var OV={};OV.getImageIdFromTexture=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.textureId,i=e.supportedImageFormats,o=t.textures[n],r=o.extensions;if(u(r)){if(i.webp&&u(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&u(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source};OV.createSampler=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.textureInfo,i=y(e.compressedTextureNoMipmap,!1),o=vn.REPEAT,r=vn.REPEAT,s=an.LINEAR,a=yi.LINEAR,c=n.index,f=t.textures[c].sampler;if(u(f)){let g=t.samplers[f];o=y(g.wrapS,o),r=y(g.wrapT,r),s=y(g.minFilter,s),a=y(g.magFilter,a)}let d=!1,p=n.extensions;return u(p)&&u(p.KHR_texture_transform)&&(d=!0),(i||d)&&s!==an.LINEAR&&s!==an.NEAREST&&(s===an.NEAREST_MIPMAP_NEAREST||s===an.NEAREST_MIPMAP_LINEAR?s=an.NEAREST:s=an.LINEAR),new ln({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};var oNe=new H(1,1);OV.createModelTextureReader=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.textureInfo,n=e.channels,i=e.texture,o=y(t.texCoord,0),r,s=y(t.extensions,y.EMPTY_OBJECT).KHR_texture_transform;if(u(s)){o=y(s.texCoord,o);let c=u(s.offset)?H.unpack(s.offset):H.ZERO,l=y(s.rotation,0),f=u(s.scale)?H.unpack(s.scale):oNe;l=-l,r=new Z(Math.cos(l)*f.x,-Math.sin(l)*f.y,c.x,Math.sin(l)*f.x,Math.cos(l)*f.y,c.y,0,0,1)}let a=new Rt.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.transform=r,a.channels=n,a};var hl=OV;function rNe(e){let t=document.createElement("canvas");return t.width=P.nextPowerOfTwo(e.width),t.height=P.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}var Cg=rNe;function Tg(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,c=y(e.asynchronous,!0),l=i.index,f=hl.getImageIdFromTexture({gltf:n,textureId:l,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=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=Ut.UNLOADED,this._promise=void 0,this._process=function(d,p){}}u(Object.create)&&(Tg.prototype=Object.create(no.prototype),Tg.prototype.constructor=Tg);Object.defineProperties(Tg.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});var sNe=new T5;Tg.prototype.load=function(){let t=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=t,this._state=Ut.LOADING;let n=this,i=new Promise(function(o){n._process=function(r,s){if(u(r._texture)||!u(r._image))return;let a;if(r._asynchronous){let c=sNe;if(c.set(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context),!s.jobScheduler.execute(c,fa.TEXTURE))return;a=c.texture}else a=nne(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context);r.unload(),r._texture=a,r._state=Ut.READY,o(r)}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._image=t.image,n._mipLevels=t.mipLevels,n._state=Ut.PROCESSING,i}).catch(function(o){if(n.isDestroyed())return;n.unload(),n._state=Ut.FAILED;let r="Failed to load texture";return Promise.reject(n.getError(r,o))}),this._promise};function T5(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}T5.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o};T5.prototype.execute=function(){this.texture=nne(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};function nne(e,t,n,i,o){let r=n.internalFormat,s=!1;rt.isCompressedFormat(r)&&!u(i)&&(s=!0);let a=hl.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),c=a.minificationFilter,l=a.wrapS,f=a.wrapT,d=c===an.NEAREST_MIPMAP_NEAREST||c===an.NEAREST_MIPMAP_LINEAR||c===an.LINEAR_MIPMAP_NEAREST||c===an.LINEAR_MIPMAP_LINEAR,p=!u(r)&&d,g=p||l===vn.REPEAT||l===vn.MIRRORED_REPEAT||f===vn.REPEAT||f===vn.MIRRORED_REPEAT,m=!P.isPowerOfTwo(n.width)||!P.isPowerOfTwo(n.height),A=g&&m,x;return u(r)?(!o.webgl2&&rt.isCompressedFormat(r)&&m&&g&&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=It.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(A&&(n=Cg(n)),x=It.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),p&&x.generateMipmap(),x}Tg.prototype.process=function(e){return this._process(this,e)};Tg.prototype.unload=function(){u(this._texture)&&this._texture.destroy(),u(this._imageLoader)&&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 PT=Tg;function Eg(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,l=e.cacheKey,f=y(e.asynchronous,!0),d=y(e.loadBuffer,!1),p=y(e.loadTypedArray,!1);this._resourceCache=t,this._gltfResource=i,this._baseResource=o,this._gltf=n,this._bufferViewId=r,this._draco=s,this._attributeSemantic=a,this._accessorId=c,this._cacheKey=l,this._asynchronous=f,this._loadBuffer=d,this._loadTypedArray=p,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Ut.UNLOADED,this._promise=void 0,this._process=function(g,m){}}u(Object.create)&&(Eg.prototype=Object.create(no.prototype),Eg.prototype.constructor=Eg);Object.defineProperties(Eg.prototype,{promise:{get:function(){return this._promise}},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 aNe(e,t){return u(e)&&u(e.attributes)&&u(e.attributes[t])}Eg.prototype.load=function(){let e;aNe(this._draco,this._attributeSemantic)?e=lNe(this):e=uNe(this);let t=this,n=new E5,i=new Promise(function(o){t._process=function(r,s){if(r._state===Ut.READY)return;let a=r._typedArray;if(u(r._dracoLoader)&&r._dracoLoader.process(s),u(r._bufferViewLoader)&&r._bufferViewLoader.process(s),!u(a))return;let c;if(r._loadBuffer&&r._asynchronous){let l=n;if(l.set(a,s.context),!s.jobScheduler.execute(l,fa.BUFFER))return;c=l.buffer}else r._loadBuffer&&(c=ine(a,s.context));r.unload(),r._buffer=c,r._typedArray=r._loadTypedArray?a:void 0,r._state=Ut.READY,o(r)}});return this._promise=e.then(function(){if(!t.isDestroyed())return i}).catch(function(o){if(!t.isDestroyed())return fNe(t,o)}),this._promise};function cNe(e,t,n,i){let r=(1<<e.quantizationBits)-1,s=1/r,a=new Rt.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=rn.VEC2,a.normalizationRange=r;else{let c=rn.getMathType(i);if(c===Number){let l=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=l,a.normalizationRange=r,a.quantizedVolumeStepSize=l*s}else{a.quantizedVolumeOffset=c.unpack(e.minValues),a.normalizationRange=c.unpack(new Array(n).fill(r));let l=new Array(n).fill(e.range);a.quantizedVolumeDimensions=c.unpack(l);let f=l.map(function(d){return d*s});a.quantizedVolumeStepSize=c.unpack(f)}}return a}function lNe(e){let n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Ut.LOADING,n.promise.then(function(){if(e.isDestroyed())return;let i=n.decodedData.vertexAttributes,o=e._attributeSemantic,r=i[o],s=e._accessorId,c=e._gltf.accessors[s].type,l=r.array,f=r.data.quantization;return u(f)&&(e._quantization=cNe(f,r.data.componentDatatype,r.data.componentsPerAttribute,c)),e._typedArray=new Uint8Array(l.buffer,l.byteOffset,l.byteLength),e._state=Ut.PROCESSING,e})}function uNe(e){let n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Ut.LOADING,e._bufferViewLoader=n,n.promise.then(function(){if(!e.isDestroyed())return e._typedArray=n.typedArray,e._state=Ut.PROCESSING,e})}function fNe(e,t){e.unload(),e._state=Ut.FAILED;let n="Failed to load vertex buffer";return t=e.getError(n,t),Promise.reject(t)}function E5(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}E5.prototype.set=function(e,t){this.typedArray=e,this.context=t};E5.prototype.execute=function(){this.buffer=ine(this.typedArray,this.context)};function ine(e,t){let n=lt.createVertexBuffer({typedArray:e,context:t,usage:Ne.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}Eg.prototype.process=function(e){return this._process(this,e)};Eg.prototype.unload=function(){u(this._buffer)&&this._buffer.destroy();let e=this._resourceCache;u(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),u(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};var OT=Eg;function VP(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=y(e.properties,{}),i={};for(let o in n)if(n.hasOwnProperty(o)){let r=n[o];u(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=Ge(e.extras,!0),this._extensions=Ge(e.extensions,!0)}VP.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.class,i={};for(let o in n.properties)if(n.properties.hasOwnProperty(o)){let r=hg.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new VP({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(VP.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}}});VP.BATCH_TABLE_CLASS_NAME="_batchTable";var ad=VP;function RV(e){e=y(e,y.EMPTY_OBJECT);let t=e.value,n=e.name;this._value=t,this._name=n,this._description=e.description,this._extras=Ge(e.extras,!0),this._extensions=Ge(e.extensions,!0)}RV.fromJson=function(e){return new RV({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(RV.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 UP=RV;function BV(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.values,i={},o={},r=n.length;for(let a=0;a<r;++a){let c=n[a];i[c.value]=c.name,o[c.name]=c.value}let s=y(e.valueType,tn.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=Ge(e.extras,!0),this._extensions=Ge(e.extensions,!0)}BV.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.enum,i=n.values.map(function(o){return UP.fromJson(o)});return new BV({id:t,values:i,valueType:tn[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(BV.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 kP=BV;function MV(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.classes,{}),n=y(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=Ge(e.extras,!0),this._extensions=Ge(e.extensions,!0)}MV.fromJson=function(e){let t={};if(u(e.enums))for(let i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=kP.fromJson({id:i,enum:e.enums[i]}));let n={};if(u(e.classes))for(let i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=ad.fromJson({id:i,class:e.classes[i],enums:t}));return new MV({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(MV.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 cd=MV;function gA(e){e=y(e,y.EMPTY_OBJECT);let t=e.schema,n=e.resource,i=e.cacheKey;this._schema=u(t)?cd.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=Ut.UNLOADED,this._promise=void 0}u(Object.create)&&(gA.prototype=Object.create(no.prototype),gA.prototype.constructor=gA);Object.defineProperties(gA.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});gA.prototype.load=function(){return u(this._schema)?this._promise=Promise.resolve(this):this._promise=dNe(this),this._promise};function dNe(e){let t=e._resource;return e._state=Ut.LOADING,t.fetchJson().then(function(n){if(!e.isDestroyed())return e._schema=cd.fromJson(n),e._state=Ut.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Ut.FAILED;let i=`Failed to load schema: ${t.url}`;return Promise.reject(e.getError(i,n))})}gA.prototype.unload=function(){this._schema=void 0};var RT=gA;var ld={};function zP(e){return Fm(e.url)}function LV(e){let t=e.byteOffset,n=e.byteLength;if(ai(e,"EXT_meshopt_compression")){let i=e.extensions.EXT_meshopt_compression;t=y(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function hNe(e,t){let n=t.byteOffset+e.byteOffset,i=e.componentType,o=e.type,r=e.count;return`${n}-${i}-${o}-${r}`}function one(e){return zP(e)}function rne(e,t){return`${zP(e)}-buffer-id-${t}`}function HP(e,t,n,i){if(u(e.uri)){let o=i.getDerivedResource({url:e.uri});return one(o)}return rne(n,t)}function b5(e,t,n,i){let o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],c=HP(a,s,n,i),l=LV(r);return`${c}-range-${l}`}function sne(e,t,n,i){let o=e.images[t],r=o.bufferView,s=o.uri;if(u(s)){let p=i.getDerivedResource({url:s});return zP(p)}let a=e.bufferViews[r],c=a.buffer,l=e.buffers[c],f=HP(l,c,n,i),d=LV(a);return`${f}-range-${d}`}function mNe(e,t){let n=hl.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}ld.getSchemaCacheKey=function(e){let t=e.schema,n=e.resource;return u(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${zP(n)}`};ld.getExternalBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.resource;return`external-buffer:${one(t)}`};ld.getEmbeddedBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.parentResource,n=e.bufferId;return`embedded-buffer:${rne(t,n)}`};ld.getGltfCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltfResource;return`gltf:${zP(t)}`};ld.getBufferViewCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource,r=t.bufferViews[n],s=r.buffer,a=t.buffers[s];ai(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);let c=HP(a,s,i,o),l=LV(r);return`buffer-view:${c}-range-${l}`};ld.getDracoCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return`draco:${b5(t,n,i,o)}`};ld.getVertexBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=y(e.dequantize,!1),l=y(e.loadBuffer,!1),f=y(e.loadTypedArray,!1),d="";if(c&&(d+="-dequantize"),l&&(d+="-buffer",d+=`-context-${o.context.id}`),f&&(d+="-typed-array"),u(s))return`vertex-buffer:${b5(t,s,n,i)}-draco-${a}${d}`;let p=t.bufferViews[r],g=p.buffer,m=t.buffers[g],A=HP(m,g,n,i),x=LV(p);return`vertex-buffer:${A}-range-${x}${d}`};ld.getIndexBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=y(e.loadBuffer,!1),c=y(e.loadTypedArray,!1),l="";if(a&&(l+="-buffer",l+=`-context-${r.context.id}`),c&&(l+="-typed-array"),u(s))return`index-buffer:${b5(t,s,i,o)}-draco${l}`;let f=t.accessors[n],d=f.bufferView,p=t.bufferViews[d],g=p.buffer,m=t.buffers[g],A=HP(m,g,i,o),x=hNe(f,p);return`index-buffer:${A}-accessor-${x}${l}`};ld.getImageCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;return`image:${sne(t,n,i,o)}`};ld.getTextureCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=n.index,c=hl.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),l=sne(t,c,i,o),f=mNe(t,n);return`texture:${l}-sampler-${f}-context-${s.context.id}`};var ml=ld;function GP(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}GP.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};GP.prototype.addGeometryLoader=function(e){let t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;let n=this;return e.promise.then(function(i){if(!n._geometrySizes.hasOwnProperty(t))return;let o=i.buffer,r=i.typedArray,s=0;u(o)&&(s+=o.sizeInBytes),u(r)&&(s+=r.byteLength),n.geometryByteLength+=s,n._geometrySizes[t]=s}).catch(function(){delete n._geometrySizes[t]})};GP.prototype.addTextureLoader=function(e){let t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;let n=this;return e.promise.then(function(i){if(!n._textureSizes.hasOwnProperty(t))return;let o=i.texture.sizeInBytes;n.texturesByteLength+=i.texture.sizeInBytes,n._textureSizes[t]=o}).catch(function(){delete n._textureSizes[t]})};GP.prototype.removeLoader=function(e){let t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],u(n)&&(this.geometryByteLength-=n);let i=this._textureSizes[t];delete this._textureSizes[t],u(i)&&(this.texturesByteLength-=i)};var WP=GP;function xn(){}xn.cacheEntries={};xn.statistics=new WP;function pNe(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}xn.get=function(e){let t=xn.cacheEntries[e];if(u(t))return++t.referenceCount,t.resourceLoader};xn.load=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.resourceLoader,n=t.cacheKey;xn.cacheEntries[n]=new pNe(t),t.load()};xn.unload=function(e){let t=e.cacheKey,n=xn.cacheEntries[t];--n.referenceCount,n.referenceCount===0&&(xn.statistics.removeLoader(e),e.destroy(),delete xn.cacheEntries[t])};xn.loadSchema=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.schema,n=e.resource,i=ml.getSchemaCacheKey({schema:t,resource:n}),o=xn.get(i);return u(o)||(o=new RT({schema:t,resource:n,cacheKey:i}),xn.load({resourceLoader:o})),o};xn.loadEmbeddedBuffer=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.parentResource,n=e.bufferId,i=e.typedArray,o=ml.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n}),r=xn.get(o);return u(r)||(r=new uA({typedArray:i,cacheKey:o}),xn.load({resourceLoader:r})),r};xn.loadExternalBuffer=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.resource,n=ml.getExternalBufferCacheKey({resource:t}),i=xn.get(n);return u(i)||(i=new uA({resource:t,cacheKey:n}),xn.load({resourceLoader:i})),i};xn.loadGltfJson=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson,r=ml.getGltfCacheKey({gltfResource:t}),s=xn.get(r);return u(s)||(s=new IT({resourceCache:xn,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),xn.load({resourceLoader:s})),s};xn.loadBufferView=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource,r=ml.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o}),s=xn.get(r);return u(s)||(s=new bT({resourceCache:xn,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),xn.load({resourceLoader:s})),s};xn.loadDraco=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource,r=ml.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o}),s=xn.get(r);return u(s)||(s=new ST({resourceCache:xn,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),xn.load({resourceLoader:s})),s};xn.loadVertexBuffer=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,l=y(e.asynchronous,!0),f=y(e.dequantize,!1),d=y(e.loadBuffer,!1),p=y(e.loadTypedArray,!1),g=ml.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:f,loadBuffer:d,loadTypedArray:p}),m=xn.get(g);if(u(m))return m;m=new OT({resourceCache:xn,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:c,cacheKey:g,asynchronous:l,dequantize:f,loadBuffer:d,loadTypedArray:p}),xn.load({resourceLoader:m});let A=xn.statistics.addGeometryLoader(m);return xn.cacheEntries[g]._statisticsPromise=A,m};xn.loadIndexBuffer=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=y(e.asynchronous,!0),c=y(e.loadBuffer,!1),l=y(e.loadTypedArray,!1),f=ml.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:c,loadTypedArray:l}),d=xn.get(f);if(u(d))return d;d=new vT({resourceCache:xn,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:f,asynchronous:a,loadBuffer:c,loadTypedArray:l}),xn.load({resourceLoader:d});let p=xn.statistics.addGeometryLoader(d);return xn.cacheEntries[f]._statisticsPromise=p,d};xn.loadImage=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource,r=ml.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o}),s=xn.get(r);return u(s)||(s=new DT({resourceCache:xn,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),xn.load({resourceLoader:s})),s};xn.loadTexture=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=y(e.asynchronous,!0),c=ml.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s}),l=xn.get(c);if(u(l))return l;l=new PT({resourceCache:xn,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:c,asynchronous:a}),xn.load({resourceLoader:l});let f=xn.statistics.addTextureLoader(l);return xn.cacheEntries[c]._statisticsPromise=f,l};xn.clearForSpecs=function(){let e=[OT,vT,ST,PT,DT,bT,uA,RT,IT],t,n=xn.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),c=e.indexOf(s.resourceLoader.constructor);return a-c});let o=i.length;for(let r=0;r<o;++r){let s=i[r];t=s.resourceLoader.cacheKey,u(n[t])&&(s.resourceLoader.destroy(),delete n[t])}xn.statistics.clear()};var Ui=xn;function Ha(e,t,n,i,o){this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=o,this._subtreeLevels=i.subtreeLevels,this._subdivisionScheme=i.subdivisionScheme,this._branchingFactor=i.branchingFactor,this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],this._readyPromise=_Ne(this,t,n,i)}Object.defineProperties(Ha.prototype,{readyPromise:{get:function(){return this._readyPromise}},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}}});Ha.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};Ha.prototype.tileIsAvailableAtCoordinates=function(e){let t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};Ha.prototype.contentIsAvailableAtIndex=function(e,t){return t=y(t,0),this._contentAvailabilityBitstreams[t].getBit(e)};Ha.prototype.contentIsAvailableAtCoordinates=function(e,t){let n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};Ha.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};Ha.prototype.childSubtreeIsAvailableAtCoordinates=function(e){let t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};Ha.prototype.getLevelOffset=function(e){let t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};Ha.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===kr.OCTREE&&(t=3),e>>t};function _Ne(e,t,n,i){let o;u(t)?o={json:t,binary:void 0}:o=gNe(n);let r=o.json;e._subtreeJson=r;let s;if(ai(r,"3DTILES_metadata"))s=r.extensions["3DTILES_metadata"];else if(u(r.tileMetadata)){let m=r.tileMetadata;s=r.propertyTables[m]}let a=[];if(u(r.contentMetadata)){let m=r.contentMetadata.length;for(let A=0;A<m;A++){let x=r.contentMetadata[A];a.push(r.propertyTables[x])}}let c,l=i.metadataSchema,f=r.subtreeMetadata;if(u(f)){let m=f.class,A=l.classes[m];c=new EP({subtreeMetadata:f,class:A})}e._metadata=c,e._tilePropertyTableJson=s,e._contentPropertyTableJsons=a;let d={constant:0};r.contentAvailabilityHeaders=[],ai(r,"3DTILES_multiple_contents")?r.contentAvailabilityHeaders=r.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(r.contentAvailability)?r.contentAvailabilityHeaders=r.contentAvailability:r.contentAvailabilityHeaders.push(y(r.contentAvailability,d));let p=yNe(r.buffers),g=ANe(r.bufferViews,p);xNe(r,g),u(s)&&ane(s,g);for(let m=0;m<a.length;m++){let A=a[m];ane(A,g)}return CNe(e,p,o.binary).then(function(m){let A=ENe(g,m);return bNe(e,r,i,A),u(s)&&(SNe(e,i,A),vNe(e)),DNe(e,i,A),wNe(e),e})}function gNe(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=Oo(e,i,o);i+=o;let a=e.subarray(i,i+r);return{json:s,binary:a}}function yNe(e){e=u(e)?e:[];for(let t=0;t<e.length;t++){let n=e[t];n.isExternal=u(n.uri),n.isActive=!1}return e}function ANe(e,t){e=u(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 xNe(e,t){let n,i=e.tileAvailability;u(i.bitstream)?n=t[i.bitstream]:u(i.bufferView)&&(n=t[i.bufferView]),u(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);let o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,u(o[s].bitstream)?n=t[o[s].bitstream]:u(o[s].bufferView)&&(n=t[o[s].bufferView]),u(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;let r=e.childSubtreeAvailability;u(r.bitstream)?n=t[r.bitstream]:u(r.bufferView)&&(n=t[r.bufferView]),u(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}function ane(e,t){let n=e.properties,i;for(let o in n)if(n.hasOwnProperty(o)){let r=n[o],s=y(r.values,r.bufferView);i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0;let a=y(r.stringOffsets,r.stringOffsetBufferView);u(a)&&(i=t[a],i.isActive=!0,i.bufferHeader.isActive=!0);let c=y(r.arrayOffsets,r.arrayOffsetBufferView);u(c)&&(i=t[c],i.isActive=!0,i.bufferHeader.isActive=!0)}}function CNe(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=TNe(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];u(a)&&(r[s]=a)}return r})}function TNe(e,t){let i=e._resource.getDerivedResource({url:t.uri}),o=Ui.loadExternalBuffer({resource:i});return e._bufferLoader=o,o.promise.then(function(r){return r.typedArray})}function ENe(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,c=t[o.buffer].subarray(r,s);n[i]=c}return n}function bNe(e,t,n,i){let o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),c=ai(t,"3DTILES_metadata"),l=u(e._tilePropertyTableJson),f=c||l;e._tileAvailability=S5(t.tileAvailability,i,s,f);let d=e._contentPropertyTableJsons.length>0;f=f||d;for(let p=0;p<t.contentAvailabilityHeaders.length;p++){let g=S5(t.contentAvailabilityHeaders[p],i,s,f);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=S5(t.childSubtreeAvailability,i,a)}function S5(e,t,n,i){if(u(e.constant))return new TT({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});let o;return u(e.bitstream)?o=t[e.bitstream]:u(e.bufferView)&&(o=t[e.bufferView]),new TT({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function SNe(e,t,n){let i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new fl({class:a,count:o,properties:i.properties,bufferViews:n})}function DNe(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 c=i[a],f=o[a].availableCount,d=c.class,p=r.classes[d],g=new fl({class:p,count:f,properties:c.properties,bufferViews:n});s.push(g)}}function cne(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 vNe(e){let t=cne(e._tileAvailability);e._tileJumpBuffer=t}function wNe(e){let t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){let o=n[i],r=cne(o);t.push(r)}}Ha.prototype.getTileIndex=function(e){let t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new ue("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};Ha.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new ue("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function INe(e,t){if(!u(e._tileMetadataTable))return;let n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function PNe(e,t,n){let i=e._contentMetadataTables;if(!u(i))return;let o=i[n];if(!u(o))return;let r=e._contentAvailabilityBitstreams[n],s=e.getTileIndex(t);if(r.getBit(s))return e._contentJumpBuffers[n][s]}Ha.prototype.getTileMetadataView=function(e){let t=INe(this,e);if(!u(t))return;let n=this._tileMetadataTable;return new ET({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};Ha.prototype.getContentMetadataView=function(e,t){let n=PNe(this,e,t);if(!u(n))return;let i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new ET({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};Ha.prototype.isDestroyed=function(){return!1};Ha.prototype.destroy=function(){return u(this._bufferLoader)&&Ui.unload(this._bufferLoader),le(this)};var yA=Ha;var ONe={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"},AA=Object.freeze(ONe);function RNe(e){return{tile:{boundingVolume:lne("TILE",e),minimumHeight:une("TILE",e),maximumHeight:fne("TILE",e)},content:{boundingVolume:lne("CONTENT",e),minimumHeight:une("CONTENT",e),maximumHeight:fne("CONTENT",e)}}}function lne(e,t){let n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(u(i))return{box:i};let o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(u(r))return{region:r};let s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);if(u(a))return{sphere:a}}function une(e,t){let n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function fne(e,t){let n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}var jP=RNe;function qu(e,t,n,i,o,r){let s=t.implicitTileset,a=t.implicitCoordinates;this._implicitTileset=s,this._implicitCoordinates=a,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 c=a.getTemplateValues(),l=s.subtreeUriTemplate.getDerivedResource({templateValues:c});this._url=l.getUrlComponent(!0),this._readyPromise=BNe(this,i,o,r)}Object.defineProperties(qu.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(){}},readyPromise:{get:function(){return this._readyPromise}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function BNe(e,t,n,i){i=y(i,0);let o;u(n)&&(o=new Uint8Array(n,i));let r=new yA(e._resource,t,o,e._implicitTileset,e._implicitCoordinates);return e._implicitSubtree=r,r.readyPromise.then(function(){return MNe(e,r),e})}function MNe(e,t){let n=e._tile,i=e._implicitCoordinates.childIndex,o=NNe(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;let s=LNe(e,t,o.bottomRow);for(let a=0;a<s.length;a++){let c=s[a],l=c.tile,f=jNe(e,l,c.childIndex);l.children.push(f),r.numberOfTilesTotal++}}function LNe(e,t,n){let i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){let s=n[r];if(u(s))for(let a=0;a<o;a++){let c=r*o+a;t.childSubtreeIsAvailableAtIndex(c)&&i.push({tile:s,childIndex:a})}}return i}function NNe(e,t,n,i){let s=dne(e,t,n,i,0,!0),a=e._tileset.statistics,c=[s],l=[],f=e._implicitTileset;for(let d=1;d<f.subtreeLevels;d++){let p=t.getLevelOffset(d),g=f.branchingFactor*c.length;for(let m=0;m<g;m++){let A=p+m;if(!t.tileIsAvailableAtIndex(A)){l.push(void 0);continue}let x=t.getParentMortonIndex(m),C=c[x],T=m%f.branchingFactor,E=dne(e,t,C,T,A);C.children.push(E),a.numberOfTilesTotal++,l.push(E)}c=l,l=[]}return{rootTile:s,bottomRow:c}}function hne(e,t,n){let i=AA.TILE_GEOMETRIC_ERROR;return u(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function dne(e,t,n,i,o,r){let s=e._implicitTileset,a;y(r,!1)?a=n.implicitCoordinates:a=n.implicitCoordinates.getChildCoordinates(i);let c,l,f;if(u(t.tilePropertyTableJson)){c=t.getTileMetadataView(a);let w=jP(c);l=w.tile,f=w.content}let p=t.contentPropertyTableJsons.length,g=!1;for(let w=0;w<p;w++)if(t.contentIsAvailableAtCoordinates(a,w)){g=!0;break}let m=UNe(s,a,i,r,n,l),A=[];for(let w=0;w<s.contentCount;w++){if(!t.contentIsAvailableAtIndex(o,w))continue;let L={uri:s.contentUriTemplates[w].getDerivedResource({templateValues:a.getTemplateValues()}).url},N=kNe(m,f);u(N)&&(L.boundingVolume=N),A.push(_t(L,s.contentHeaders[w]))}let x=hne(c,s,a),C={boundingVolume:m,geometricError:x,refine:s.refine,contents:A},T=!0,E=Ge(s.tileHeader,T);delete E.boundingVolume,delete E.transform;let S=_t(C,E,T),D=yne(e,s.baseResource,S,n);return D.implicitCoordinates=a,D.implicitSubtree=t,D.metadata=c,D.hasImplicitContentMetadata=g,D}function NV(e,t){return u(e)&&u(t)&&(u(t.minimumHeight)||u(t.maximumHeight))&&(ai(e,"3DTILES_bounding_volume_S2")||u(e.region))}function v5(e,t){u(t)&&(ai(e,"3DTILES_bounding_volume_S2")?VNe(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):u(e.region)&&FNe(e.region,t.minimumHeight,t.maximumHeight))}function FNe(e,t,n){u(t)&&(e[4]=t),u(n)&&(e[5]=n)}function VNe(e,t,n){u(t)&&(e.minimumHeight=t),u(n)&&(e.maximumHeight=n)}function UNe(e,t,n,i,o,r){let s;return!u(r)||!u(r.boundingVolume)||!NV(r.boundingVolume,r)&&NV(e.boundingVolume,r)?s=mne(e,t,n,y(i,!1),o):s=r.boundingVolume,v5(s,r),s}function kNe(e,t){let n;return u(t)&&(n=t.boundingVolume),NV(n,t)?v5(n,t):NV(e,t)&&(n=Ge(e,!0),v5(n,t)),n}function mne(e,t,n,i,o){let r=e.boundingVolume;return ai(r,"3DTILES_bounding_volume_S2")?pne(i,o,n,t.level,t.x,t.y,t.z):u(r.region)?{region:gne(r.region,t.level,t.x,t.y,t.z)}:{box:_ne(r.box,t.level,t.x,t.y,t.z)}}function pne(e,t,n,i,o,r,s){let a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:fp.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};let c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),l=c%2===0?xT.encode2D(i,o,r):xT.encode2D(i,r,o),f=fp.fromFacePositionLevel(c,BigInt(l),i),d,p;if(u(s)){let g=(a.maximumHeight+a.minimumHeight)/2;d=n<4?a.minimumHeight:g,p=n<4?g:a.maximumHeight}else d=a.minimumHeight,p=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:fp.getTokenFromId(f._cellId),minimumHeight:d,maximumHeight:p}}}}var zNe=new h,HNe=new h,D5=new h,GNe=new Z;function _ne(e,t,n,i,o){if(t===0)return e;let r=h.unpack(e,0,HNe),s=Z.unpack(e,3,GNe),a=Math.pow(2,-t),c=-1+(2*n+1)*a,l=-1+(2*i+1)*a,f=0,d=h.fromElements(a,a,1,zNe);u(o)&&(f=-1+(2*o+1)*a,d.z=a);let p=h.fromElements(c,l,f,D5);p=Z.multiplyByVector(s,p,D5),p=h.add(p,r,D5);let g=Z.clone(s);g=Z.multiplyByScale(g,d,g);let m=new Array(12);return h.pack(p,m),Z.pack(g,m,3),m}var WNe=new ce;function gne(e,t,n,i,o){if(t===0)return e.slice();let r=ce.unpack(e,0,WNe),s=e[4],a=e[5],c=Math.pow(2,-t),l=c*r.width,f=P.negativePiToPi(r.west+n*l),d=P.negativePiToPi(f+l),p=c*r.height,g=P.negativePiToPi(r.south+i*p),m=P.negativePiToPi(g+p),A=s,x=a;if(u(o)){let C=c*(a-s);A+=o*C,x=A+C}return[f,g,d,m,A,x]}function jNe(e,t,n){let i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=mne(i,o,n,!1,t),s=hne(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,c={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},l=yne(e,i.baseResource,c,t);return l.implicitTileset=i,l.implicitCoordinates=o,l}function yne(e,t,n,i){let o=e._tile.constructor;return new o(e._tileset,t,n,i)}qu.prototype.hasProperty=function(e,t){return!1};qu.prototype.getFeature=function(e){};qu.prototype.applyDebugSettings=function(e,t){};qu.prototype.applyStyle=function(e){};qu.prototype.update=function(e,t){};qu.prototype.isDestroyed=function(){return!1};qu.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),le(this)};qu._deriveBoundingBox=_ne;qu._deriveBoundingRegion=gne;qu._deriveBoundingVolumeS2=pne;var BT=qu;var YNe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Ga=Object.freeze(YNe);function MT(e,t){this._distance=t,this._normal=new Ane(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(MT.prototype,{distance:{get:function(){return this._distance},set:function(e){u(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){u(this.onChangeCallback)&&!h.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),h.clone(e,this._normal._cartesian3)}}});MT.fromPlane=function(e,t){return u(t)?(t.normal=e.normal,t.distance=e.distance):t=new MT(e.normal,e.distance),t};MT.clone=function(e,t){return u(t)?(t.normal=e.normal,t.distance=e.distance,t):new MT(e.normal,e.distance)};function Ane(e,t){this._clippingPlane=t,this._cartesian3=h.clone(e)}Object.defineProperties(Ane.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){u(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){u(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){u(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});var xA=MT;function Wa(e){e=y(e,y.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=y(e.enabled,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this.edgeColor=z.clone(y(e.edgeColor,z.WHITE)),this.edgeWidth=y(e.edgeWidth,0),this.planeAdded=new Ae,this.planeRemoved=new Ae,this._owner=void 0;let t=y(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?bne:Sne,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;let n=e.planes;if(u(n)){let i=n.length;for(let o=0;o<i;++o)this.add(n[o])}}function bne(e){return e===Qt.OUTSIDE}function Sne(e){return e===Qt.INSIDE}Object.defineProperties(Wa.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?bne:Sne)}},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 xne(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}Wa.prototype.add=function(e){let t=this._planes.length,n=this;e.onChangeCallback=function(i){xne(n,i)},e.index=t,xne(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};Wa.prototype.get=function(e){return this._planes[e]};function Dne(e,t){let n=e.length;for(let i=0;i<n;++i)if(cn.equals(e[i],t))return i;return-1}Wa.prototype.contains=function(e){return Dne(this._planes,e)!==-1};Wa.prototype.remove=function(e){let t=this._planes,n=Dne(t,e);if(n===-1)return!1;e instanceof xA&&(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 xA&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};Wa.prototype.removeAll=function(){let e=this._planes,t=e.length;for(let n=0;n<t;++n){let i=e[n];i instanceof xA&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};var qNe=new oe,XNe=new oe;function Cne(e,t,n){let i=e._uint8View,o=e._planes,r=0;for(let s=t;s<n;++s){let a=o[s],c=Gn.octEncodeToCartesian4(a.normal,XNe);i[r]=c.x,i[r+1]=c.y,i[r+2]=c.z,i[r+3]=c.w;let l=oe.packFloat(a.distance,qNe);i[r+4]=l.x,i[r+5]=l.y,i[r+6]=l.z,i[r+7]=l.w,r+=8}}function Tne(e,t,n){let i=e._float32View,o=e._planes,r=0;for(let s=t;s<n;++s){let a=o[s],c=a.normal;i[r]=c.x,i[r+1]=c.y,i[r+2]=c.z,i[r+3]=a.distance,r+=4}}function vne(e,t){let n=Ft.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}var KNe=new H;Wa.prototype.update=function(e){let t=this._clippingPlanesTexture,n=e.context,i=Wa.useFloatTexture(n),o=i?this.length:this.length*2;if(u(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(!u(t)){let s=vne(o,KNe);s.y*=2,i?(t=new It({context:n,width:s.x,height:s.y,pixelFormat:rt.RGBA,pixelDatatype:Xe.FLOAT,sampler:ln.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new It({context:n,width:s.x,height:s.y,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,sampler:ln.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?(Tne(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(Cne(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),Tne(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),Cne(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 ZNe=new M,Ene=new cn(h.UNIT_X,0);Wa.prototype.computeIntersectionWithBoundingVolume=function(e,t){let n=this._planes,i=n.length,o=this.modelMatrix;u(t)&&(o=M.multiply(t,o,ZNe));let r=Qt.INSIDE;!this.unionClippingRegions&&i>0&&(r=Qt.OUTSIDE);for(let s=0;s<i;++s){let a=n[s];cn.transform(a,o,Ene);let c=e.intersectPlane(Ene);if(c===Qt.INTERSECTING)r=c;else if(this._testIntersection(c))return c}return r};Wa.setOwner=function(e,t,n){e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),u(e)&&(e._owner=t,t[n]=e))};Wa.useFloatTexture=function(e){return e.floatingPointTexture};Wa.getTextureResolution=function(e,t,n){let i=e.texture;if(u(i))return n.x=i.width,n.y=i.height,n;let o=Wa.useFloatTexture(t)?e.length:e.length*2,r=vne(o,n);return r.y*=2,r};Wa.prototype.isDestroyed=function(){return!1};Wa.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),le(this)};var ss=Wa;var YP={HIGHLIGHT:0,REPLACE:1,MIX:2};YP.getColorBlend=function(e,t){if(e===YP.HIGHLIGHT)return 0;if(e===YP.REPLACE)return 1;if(e===YP.MIX)return P.clamp(t,P.EPSILON4,1)};var ja=Object.freeze(YP);var JNe={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},Ya=Object.freeze(JNe);var QNe={STEP:0,LINEAR:1,CUBICSPLINE:2},ud=Object.freeze(QNe);var wne={};function qP(e){this._count=e.count,this._properties=Ge(e.properties,!0)}qP.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,wne)};qP.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,wne,e)};qP.prototype.getProperty=function(e,t){let n=this._properties[t];if(u(n))return Ge(n[e],!0)};qP.prototype.setProperty=function(e,t,n){let i=this._properties[t];u(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=Ge(n,!0)};var yp=qP;function qa(e){e=y(e,y.EMPTY_OBJECT),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(qa.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(u(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 u(this._metadataTable)&&(e+=this._metadataTable.byteLength),u(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});qa.prototype.hasProperty=function(e,t){return!!(u(this._metadataTable)&&this._metadataTable.hasProperty(t)||u(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||u(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};qa.prototype.hasPropertyBySemantic=function(e,t){return u(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};qa.prototype.propertyExists=function(e){return!!(u(this._metadataTable)&&this._metadataTable.hasProperty(e)||u(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||u(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};qa.prototype.propertyExistsBySemantic=function(e){return u(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};var w5=[];qa.prototype.getPropertyIds=function(e,t){return t=u(t)?t:[],t.length=0,u(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(w5)),u(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,w5)),u(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(w5)),t};qa.prototype.getProperty=function(e,t){let n;if(u(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),u(n))||u(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),u(n))||u(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),u(n)))return n};qa.prototype.setProperty=function(e,t,n){u(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||u(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(u(this._jsonMetadataTable)||(this._jsonMetadataTable=new yp({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};qa.prototype.getPropertyBySemantic=function(e,t){if(u(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};qa.prototype.setPropertyBySemantic=function(e,t,n){return u(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};qa.prototype.getPropertyTypedArray=function(e){if(u(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};qa.prototype.getPropertyTypedArrayBySemantic=function(e){if(u(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};qa.prototype.isClass=function(e,t){let n=this._batchTableHierarchy;return u(n)?n.isClass(e,t):!1};qa.prototype.isExactClass=function(e,t){return this.getExactClassName(e)===t};qa.prototype.getExactClassName=function(e){let t=this._batchTableHierarchy;if(u(t))return t.getClassName(e)};var Ic=qa;function XP(e){e=y(e,y.EMPTY_OBJECT);let t=e.property,n=e.classProperty,i=e.textures,o=u(t.channels)?t.channels:[0],r=t,s=hl.createModelTextureReader({textureInfo:r,channels:tFe(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,c=t.scale,l=n.hasValueTransform||u(a)||u(c);a=y(a,n.offset),c=y(c,n.scale),a=n.unpackVectorAndMatrixTypes(a),c=n.unpackVectorAndMatrixTypes(c),this._offset=a,this._scale=c,this._hasValueTransform=l,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(XP.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}}});XP.prototype.isGpuCompatible=function(){let e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===zt.SCALAR&&n===tn.UINT8:zt.isVectorType(t)||t===zt.SCALAR?n===tn.UINT8:!1};var $Ne=[void 0,"float","vec2","vec3","vec4"],eFe=[void 0,"int","ivec2","ivec3","ivec4"];XP.prototype.getGlslType=function(){let e=this._classProperty,t=zt.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?$Ne[t]:eFe[t]};XP.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function tFe(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}var KP=XP;function I5(e){e=y(e,y.EMPTY_OBJECT);let t=e.propertyTexture,n=e.class,i=e.textures,o=t.extensions,r=t.extras,s={};if(u(t.properties))for(let a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new KP({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(I5.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}}});I5.prototype.getProperty=function(e){return this._properties[e]};var CA=I5;function Ine(e){e=y(e,y.EMPTY_OBJECT);let t=e.property,n=e.classProperty;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||u(i)||u(o);i=y(i,n.offset),o=y(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(Ine.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 ZP=Ine;function P5(e){e=y(e,y.EMPTY_OBJECT);let t=e.propertyAttribute,n=e.class,i={};if(u(t.properties))for(let o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new ZP({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(P5.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}}});P5.prototype.getProperty=function(e){return this._properties[e]};var TA=P5;function JP(e){e=y(e,y.EMPTY_OBJECT),this._schema=e.schema;let t=e.propertyTables;this._propertyTableCount=u(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(JP.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(!u(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}}});JP.prototype.getPropertyTable=function(e){return this._propertyTables[e]};JP.prototype.getPropertyTexture=function(e){return this._propertyTextures[e]};JP.prototype.getPropertyAttribute=function(e){return this._propertyAttributes[e]};var da=JP;function nFe(e){e=y(e,y.EMPTY_OBJECT);let t=e.extension,n=e.schema,i=[];if(u(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){let a=t.propertyTables[s],c=n.classes[a.class],l=new fl({count:a.count,properties:a.properties,class:c,bufferViews:e.bufferViews});i.push(new Ic({id:s,name:a.name,count:a.count,metadataTable:l,extras:a.extras,extensions:a.extensions}))}let o=[];if(u(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){let a=t.propertyTextures[s];o.push(new CA({id:s,name:a.name,propertyTexture:a,class:n.classes[a.class],textures:e.textures}))}let r=[];if(u(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){let a=t.propertyAttributes[s];r.push(new TA({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new da({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}var QP=nFe;function iFe(e){e=y(e,y.EMPTY_OBJECT);let t=e.extension,n=e.schema,i,o=[],r;if(u(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){let a=r[i],c=t.featureTables[a],l=n.classes[c.class],f=new fl({count:c.count,properties:c.properties,class:l,bufferViews:e.bufferViews});o.push(new Ic({id:a,count:c.count,metadataTable:f,extras:c.extras,extensions:c.extensions}))}let s=[];if(u(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){let a=r[i],c=t.featureTextures[a];s.push(new CA({id:a,propertyTexture:oFe(c),class:n.classes[c.class],textures:e.textures}))}return new da({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function oFe(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:rFe(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=_t(o.texture,r,!0)}return t}function rFe(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 $P=iFe;function bg(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltf,n=e.extension,i=e.extensionLegacy,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.frameState,c=e.cacheKey,l=y(e.asynchronous,!0);this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=c,this._asynchronous=l,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=Ut.UNLOADED,this._promise=void 0}u(Object.create)&&(bg.prototype=Object.create(no.prototype),bg.prototype.constructor=bg);Object.defineProperties(bg.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});bg.prototype.load=function(){let e=uFe(this),t=pFe(this),n=_Fe(this);this._gltf=void 0,this._state=Ut.LOADING;let i=this;this._promise=Promise.all([e,t,n]).then(function(o){if(i.isDestroyed())return;let r=o[0],s=o[1],a=o[2];return u(i._extension)?i._structuralMetadata=QP({extension:i._extension,schema:a,bufferViews:r,textures:s}):i._structuralMetadata=$P({extension:i._extensionLegacy,schema:a,bufferViews:r,textures:s}),i._state=Ut.READY,i}).catch(function(o){if(i.isDestroyed())return;i.unload(),i._state=Ut.FAILED;let r="Failed to load structural metadata";return Promise.reject(i.getError(r,o))})};function sFe(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;u(o)&&(t[o]=!0),u(r)&&(t[r]=!0),u(s)&&(t[s]=!0)}}function aFe(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;u(o)&&(t[o]=!0),u(r)&&(t[r]=!0),u(s)&&(t[s]=!0)}}function cFe(e){let t=e.propertyTables,n={};if(u(t))for(let i=0;i<t.length;i++){let o=t[i];sFe(o.properties,n)}return n}function lFe(e){let t=e.featureTables,n={};if(u(t)){for(let i in t)if(t.hasOwnProperty(i)){let r=t[i].properties;u(r)&&aFe(r,n)}}return n}function uFe(e){let t;u(e._extension)?t=cFe(e._extension):t=lFe(e._extensionLegacy);let n=[],i={};for(let o in t)if(t.hasOwnProperty(o)){let r=Ui.loadBufferView({gltf:e._gltf,bufferViewId:parseInt(o),gltfResource:e._gltfResource,baseResource:e._baseResource});n.push(r.promise),e._bufferViewLoaders.push(r),i[o]=r}return Promise.all(n).then(function(){let o={};for(let r in i)if(i.hasOwnProperty(r)){let s=i[r],a=new Uint8Array(s.typedArray);o[r]=a}return Pne(e),o})}function fFe(e){let t={},n=e.propertyTextures;if(u(n))for(let i=0;i<n.length;i++){let r=n[i].properties;u(r)&&dFe(r,t)}return t}function dFe(e,t){for(let n in e)if(e.hasOwnProperty(n)){let i=e[n];t[i.index]=i}}function hFe(e){let t={},n=e.featureTextures;if(u(n)){for(let i in n)if(n.hasOwnProperty(i)){let r=n[i].properties;u(r)&&mFe(r,t)}}return t}function mFe(e,t){for(let n in e)if(e.hasOwnProperty(n)){let o=e[n].texture;t[o.index]=o}}function pFe(e){let t;u(e._extension)?t=fFe(e._extension):t=hFe(e._extensionLegacy);let n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,c=[],l={};for(let f in t)if(t.hasOwnProperty(f)){let d=Ui.loadTexture({gltf:n,textureInfo:t[f],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});c.push(d.promise),e._textureLoaders.push(d),l[f]=d}return Promise.all(c).then(function(){let f={};for(let d in l)if(l.hasOwnProperty(d)){let p=l[d];f[d]=p.texture}return f})}function _Fe(e){let t=y(e._extension,e._extensionLegacy),n;if(u(t.schemaUri)){let i=e._baseResource.getDerivedResource({url:t.schemaUri});n=Ui.loadSchema({resource:i})}else n=Ui.loadSchema({schema:t.schema});return e._schemaLoader=n,n.promise.then(function(i){return i.schema})}bg.prototype.process=function(e){if(this._state!==Ut.LOADING)return;let t=this._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i].process(e)};function Pne(e){let t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)Ui.unload(t[i]);e._bufferViewLoaders.length=0}function gFe(e){let t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)Ui.unload(t[i]);e._textureLoaders.length=0}bg.prototype.unload=function(){Pne(this),gFe(this),u(this._schemaLoader)&&Ui.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};var e1=bg;var ci={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function yFe(e){switch(e){case ci.POSITION:return"positionMC";case ci.NORMAL:return"normalMC";case ci.TANGENT:return"tangentMC";case ci.TEXCOORD:return"texCoord";case ci.COLOR:return"color";case ci.JOINTS:return"joints";case ci.WEIGHTS:return"weights";case ci.FEATURE_ID:return"featureId"}}ci.hasSetIndex=function(e){switch(e){case ci.POSITION:case ci.NORMAL:case ci.TANGENT:return!1;case ci.TEXCOORD:case ci.COLOR:case ci.JOINTS:case ci.WEIGHTS:case ci.FEATURE_ID:return!0}};ci.fromGltfSemantic=function(e){let t=e,i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return ci.POSITION;case"NORMAL":return ci.NORMAL;case"TANGENT":return ci.TANGENT;case"TEXCOORD":return ci.TEXCOORD;case"COLOR":return ci.COLOR;case"JOINTS":return ci.JOINTS;case"WEIGHTS":return ci.WEIGHTS;case"_FEATURE_ID":return ci.FEATURE_ID}};ci.fromPntsSemantic=function(e){switch(e){case"POSITION":case"POSITION_QUANTIZED":return ci.POSITION;case"RGBA":case"RGB":case"RGB565":return ci.COLOR;case"NORMAL":case"NORMAL_OCT16P":return ci.NORMAL;case"BATCH_ID":return ci.FEATURE_ID}};ci.getGlslType=function(e){switch(e){case ci.POSITION:case ci.NORMAL:case ci.TANGENT:return"vec3";case ci.TEXCOORD:return"vec2";case ci.COLOR:return"vec4";case ci.JOINTS:return"ivec4";case ci.WEIGHTS:return"vec4";case ci.FEATURE_ID:return"int"}};ci.getVariableName=function(e,t){let n=yFe(e);return u(t)&&(n+=`_${t}`),n};var Ct=Object.freeze(ci);function Xa(){}Xa.getFailedLoadFunction=function(e,t,n){return function(i){let o=`Failed to load ${t}: ${n}`;u(i)&&(o+=`
${i.message}`);let r=new ue(o);return u(i)&&(r.stack=`Original stack:
${i.stack}
Handler stack:
${r.stack}`),Promise.reject(r)}};Xa.getNodeTransform=function(e){return u(e.matrix)?e.matrix:M.fromTranslationQuaternionRotationScale(u(e.translation)?e.translation:h.ZERO,u(e.rotation)?e.rotation:Le.IDENTITY,u(e.scale)?e.scale:h.ONE)};Xa.getAttributeBySemantic=function(e,t,n){let i=e.attributes,o=i.length;for(let r=0;r<o;++r){let s=i[r],a=u(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};Xa.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}};Xa.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}};Xa.hasQuantizedAttributes=function(e){if(!u(e))return!1;for(let t=0;t<e.length;t++){let n=e[t];if(u(n.quantization))return!0}return!1};Xa.getAttributeInfo=function(e){let t=e.semantic,n=e.setIndex,i,o=!1;u(t)?(i=Ct.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());let r=/^color_\d+$/.test(i),s=e.type,a=rn.getGlslType(s);r&&(a="vec4");let c=u(e.quantization),l;return c&&(l=r?"vec4":rn.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:l}};var AFe=new h,xFe=new h;Xa.getPositionMinMax=function(e,t,n){let i=Xa.getAttributeBySemantic(e,"POSITION"),o=i.max,r=i.min;return u(n)&&u(t)&&(r=h.add(r,t,xFe),o=h.add(o,n,AFe)),{min:r,max:o}};Xa.getAxisCorrectionMatrix=function(e,t,n){return n=M.clone(M.IDENTITY,n),e===Po.Y?n=M.clone(Po.Y_UP_TO_Z_UP,n):e===Po.X&&(n=M.clone(Po.X_UP_TO_Z_UP,n)),t===Po.Z&&(n=M.multiplyTransformation(n,Po.Z_UP_TO_X_UP,n)),n};var CFe=new Z;Xa.getCullFace=function(e,t){if(!Me.isTriangles(t))return gi.BACK;let n=M.getMatrix3(e,CFe);return Z.determinant(n)<0?gi.FRONT:gi.BACK};Xa.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};Xa.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_techniques_webgl:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};Xa.checkSupportedExtensions=function(e){let t=e.length;for(let n=0;n<t;n++){let i=e[n];if(!Xa.supportedExtensions[i])throw new ue(`Unsupported glTF Extension: ${i}`)}};var sn=Xa;var LT={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};LT.fromGltfSemantic=function(e){let t=e,i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return LT.TRANSLATION;case"ROTATION":return LT.ROTATION;case"SCALE":return LT.SCALE;case"_FEATURE_ID":return LT.FEATURE_ID}};var zr=Object.freeze(LT);var TFe=65534,EFe=255;function FV(e){e=y(e,y.EMPTY_OBJECT);let t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;this._triangleIndices=t,this._originalVertexCount=i,this._edges=new Bne(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],bFe(this)}Object.defineProperties(FV.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function bFe(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 c=t[a],l=t[a+1],f=t[a+2],d=!1,p=d||n.hasEdge(c,l),g=d||n.hasEdge(l,f),m=d||n.hasEdge(f,c),A=One(i,c,l,f,p,g,m);for(;u(A);){let x=s[A];if(!u(x)){x=r+o.length;let C=A;for(;C>=r;)C=o[C-r];o.push(C),s[A]=x}x>TFe&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):x>EFe&&t instanceof Uint8Array&&(t=new Uint16Array(t)),A===c?(c=x,t[a]=x):A===l?(l=x,t[a+1]=x):(f=x,t[a+2]=x),A=One(i,c,l,f,p,g,m)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function One(e,t,n,i,o,r,s){let a=s?1:0,c=o?1:0,l=0,f=O5(e,t,a,c,l);if(f===0)return t;let d=0,p=o?1:0,g=r?1:0,m=O5(e,n,d,p,g);if(m===0)return n;let A=s?1:0,x=0,C=r?1:0,T=O5(e,i,A,x,C);if(T===0)return i;let E=f&m&T,S,D,w;if(E&1<<0)S=0,D=1,w=2;else if(E&1<<1)S=0,w=1,D=2;else if(E&1<<2)D=0,S=1,w=2;else if(E&1<<3)D=0,w=1,S=2;else if(E&1<<4)w=0,S=1,D=2;else if(E&1<<5)w=0,D=1,S=2;else{let N=R5(f),_=R5(m),b=R5(T);return N<_&&N<b?t:_<b?n:i}let R=t*3;e[R+S]=a,e[R+D]=c,e[R+w]=l;let O=n*3;e[O+S]=d,e[O+D]=p,e[O+w]=g;let L=i*3;e[L+S]=A,e[L+D]=x,e[L+w]=C}function O5(e,t,n,i,o){let r=t*3,s=e[r],a=e[r+1],c=e[r+2];return u(s)?(s===n&&a===i&&c===o)<<0|(s===n&&a===o&&c===i)<<1|(s===i&&a===n&&c===o)<<2|(s===i&&a===o&&c===n)<<3|(s===o&&a===n&&c===i)<<4|(s===o&&a===i&&c===n)<<5:63}function R5(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}FV.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 c=t[a]*i,l=n+a*i;for(let f=0;f<i;f++)s[l+f]=s[c+f]}return s};FV.createTexture=function(e){let t=e.cache.modelOutliningCache;if(u(t)||(t=e.cache.modelOutliningCache={}),u(t.outlineTexture))return t.outlineTexture;let n=Math.min(4096,Ft.maximumTextureSize),i=n,o=Rne(i),r=[];for(;i>1;)i>>=1,r.push(Rne(i));let s=new It({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:rt.LUMINANCE,sampler:new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.LINEAR_MIPMAP_LINEAR,magnificationFilter:yi.LINEAR})});return t.outlineTexture=s,s};function Rne(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 Bne(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)}}Bne.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 EA=FV;function Mne(e){this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function SFe(e){this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function VV(e){this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}VV.prototype.postProcess=function(e){this.needsOutlines&&(DFe(this),wFe(this,e))};function DFe(e){let t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new EA({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=Fe.fromTypedArray(n.typedArray);let r=vFe(o.outlineCoordinates),s=new Mne(r);s.loadBuffer=!0,s.loadTypedArray=!1,e.attributePlans.push(s),t.outlineCoordinates=s.attribute;let a=e.attributePlans,c=e.attributePlans.length;for(let l=0;l<c;l++){let f=a[l].attribute;f.typedArray=o.updateAttribute(f.typedArray)}}function vFe(e){let t=new Rt.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=q.FLOAT,t.type=rn.VEC3,t.normalized=!1,t.count=e.length/3,t}function wFe(e,t){IFe(e.attributePlans,t),u(e.indicesPlan)&&PFe(e.indicesPlan,t)}function IFe(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=lt.createVertexBuffer({typedArray:s,context:t,usage:Ne.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function PFe(e,t){let n=e.indices;if(e.loadBuffer){let i=lt.createIndexBuffer({typedArray:n.typedArray,context:t,usage:Ne.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}VV.AttributeLoadPlan=Mne;VV.IndicesLoadPlan=SFe;var bA=VV;function OFe(e){e=y(e,y.EMPTY_OBJECT),this.webp=y(e.webp,!1),this.basis=y(e.basis,!1)}var t1=OFe;var RFe=Rt.Attribute,BFe=Rt.Indices,Nne=Rt.FeatureIdAttribute,Fne=Rt.FeatureIdTexture,Vne=Rt.FeatureIdImplicitRange,MFe=Rt.MorphTarget,LFe=Rt.Primitive,NFe=Rt.Instances,FFe=Rt.Skin,VFe=Rt.Node,UFe=Rt.AnimatedPropertyType,kFe=Rt.AnimationSampler,zFe=Rt.AnimationTarget,HFe=Rt.AnimationChannel,GFe=Rt.Animation,WFe=Rt.ArticulationStage,jFe=Rt.Articulation,YFe=Rt.Asset,qFe=Rt.Scene,XFe=Rt.Components,KFe=Rt.MetallicRoughness,ZFe=Rt.SpecularGlossiness,JFe=Rt.Material,or={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function xp(e){e=y(e,y.EMPTY_OBJECT);let t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=y(e.releaseGltfJson,!1),r=y(e.asynchronous,!0),s=y(e.incrementallyLoadTextures,!0),a=y(e.upAxis,Po.Y),c=y(e.forwardAxis,Po.Z),l=y(e.loadAttributesAsTypedArray,!1),f=y(e.loadAttributesFor2D,!1),d=y(e.loadIndicesForWireframe,!1),p=y(e.loadPrimitiveOutline,!0),g=y(e.loadForClassification,!1),m=y(e.renameBatchIdSemantic,!1);n=u(n)?n:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=n,this._typedArray=i,this._releaseGltfJson=o,this._asynchronous=r,this._incrementallyLoadTextures=s,this._upAxis=a,this._forwardAxis=c,this._loadAttributesAsTypedArray=l,this._loadAttributesFor2D=f,this._loadIndicesForWireframe=d,this._loadPrimitiveOutline=p,this._loadForClassification=g,this._renameBatchIdSemantic=m,this._hasKhrMeshQuantization=!1,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=or.NOT_LOADED,this._textureState=or.NOT_LOADED,this._promise=void 0,this._texturesLoadedPromise=void 0,this._process=function(A,x){},this._processTextures=function(A,x){},this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._structuralMetadataLoader=void 0,this._postProcessBuffers=[],this._components=void 0}u(Object.create)&&(xp.prototype=Object.create(no.prototype),xp.prototype.constructor=xp);Object.defineProperties(xp.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}}});xp.prototype.load=function(){let e=Ui.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=or.LOADING,this._textureState=or.LOADING;let t=this,n,i=new Promise(function(o,r){n=new Promise(function(s,a){t._process=function(c,l){if(!Vt.supportsWebP.initialized){Vt.supportsWebP.initialize();return}if(c._state===or.LOADED){c._state=or.PROCESSING;let f=new t1({webp:Vt.supportsWebP(),basis:l.context.supportsBasis}),d;u(c._gltfJsonLoader)?d=c._gltfJsonLoader.gltf:d=c._gltfJson,q2e(c,d,f,l,r,a),u(c._gltfJsonLoader)&&c._releaseGltfJson&&(Ui.unload(c._gltfJsonLoader),c._gltfJsonLoader=void 0)}c._state===or.PROCESSING&&QFe(c,l),c._state===or.POST_PROCESSING&&($Fe(c,l.context),c._state=or.PROCESSED),c._state===or.PROCESSED&&(qne(c),c._typedArray=void 0,c._state=or.READY,o(c))},t._processTextures=function(c,l){if(c._textureState===or.LOADED&&(c._textureState=or.PROCESSING),c._textureState===or.PROCESSING){let f,d=c._textureLoaders,p=d.length;for(f=0;f<p;++f)d[f].process(l)}c._textureState===or.PROCESSED&&(c._textureState=or.READY,s(c))}})});return this._promise=e.promise.then(function(){if(!t.isDestroyed())return t._state=or.LOADED,t._textureState=or.LOADED,i}).catch(function(o){if(!t.isDestroyed())return t._state=or.FAILED,t._textureState=or.FAILED,Lne(t,o)}),this._texturesLoadedPromise=n.catch(function(o){if(!t.isDestroyed())return t._textureState=or.FAILED,Lne(t,o)}),this._promise};function Lne(e,t){e.unload();let n="Failed to load glTF";return t=e.getError(n,t),Promise.reject(t)}function QFe(e,t){let n=e._bufferViewLoaders,i=n.length;for(let s=0;s<i;++s)n[s].process(t);let o=e._geometryLoaders,r=o.length;for(let s=0;s<r;++s)o[s].process(t);u(e._structuralMetadataLoader)&&e._structuralMetadataLoader.process(t)}function $Fe(e,t){let n=e._primitiveLoadPlans,i=n.length;for(let o=0;o<i;o++){let r=n[o];r.postProcess(t),r.needsOutlines&&e2e(e,r)}}function e2e(e,t){let n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;u(o)&&n.push(o.buffer);let r=i.attributes,s=r.length;for(let c=0;c<s;c++){let l=r[c];u(l.buffer)&&n.push(l.buffer)}let a=i.indices;u(a)&&u(a.buffer)&&n.push(a.buffer)}xp.prototype.process=function(e){this._process(this,e),this._processTextures(this,e)};function t2e(e,t,n,i,o,r,s,a){let l=t.accessors[n].bufferView,f=Ui.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:l,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s});return e._geometryLoaders.push(f),f}function n2e(e,t,n,i,o,r,s){let a=Ui.loadIndexBuffer({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r});return e._geometryLoaders.push(a),a}function i2e(e,t,n){let i=Ui.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function Une(e,t,n){let i=t.byteOffset,o=dl(e,t),r=t.count,s=Kl(t.type),a=t.componentType,c=q.getSizeInBytes(a),l=c*s,f=r*s;if(o===l)return n=new Uint8Array(n),q.createArrayBufferView(a,n.buffer,n.byteOffset+i,f);let d=q.createTypedArray(a,f),p=new DataView(n.buffer),g=new Array(s),m=gp(t.componentType);i=n.byteOffset+i;for(let A=0;A<r;++A){m(p,i,s,c,g);for(let x=0;x<s;++x)d[A*s+x]=g[x];i+=o}return d}function o2e(e,t){let n=e.type;if(n===rn.SCALAR)return t.fill(0);let i=rn.getMathType(n);return t.fill(i.clone(i.ZERO))}function r2e(e,t,n,i){let o=e.type,r=e.count;if(o===rn.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===rn.VEC4&&i)for(let s=0;s<r;s++)n[s]=Le.unpack(t,s*4);else{let s=rn.getMathType(o),a=rn.getNumberOfComponents(o);for(let c=0;c<r;c++)n[c]=s.unpack(t,c*a)}return n}function UV(e,t,n,i){let o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(u(a)){let l=i2e(e,t,a).promise.then(function(f){if(e.isDestroyed())return;let d=f.typedArray,p=Une(t,o,d);i=y(i,!1),r2e(o,p,s,i)});return e._loaderPromises.push(l),s}return o2e(o,s)}function Xu(e,t){if(u(t))return e===Number?t[0]:e.unpack(t)}function s2e(e){return e===Number?0:new e}function a2e(e){switch(e){case q.BYTE:return 127;case q.UNSIGNED_BYTE:return 255;case q.SHORT:return 32767;case q.UNSIGNED_SHORT:return 65535;default:return 1}}var c2e={VEC2:new H(-1,-1),VEC3:new h(-1,-1,-1),VEC4:new oe(-1,-1,-1,-1)};function l2e(e,t){let n=a2e(e.componentDatatype),i=c2e[e.type],o=e.min;u(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;u(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function u2e(e,t,n){let i=e.decodeMatrix,o=Xu(n,e.decodedMin),r=Xu(n,e.decodedMax);u(o)&&u(r)&&(t.min=o,t.max=r);let s=new Rt.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 h(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new h(i[0],i[5],i[10])):i.length===25&&(s.quantizedVolumeOffset=new oe(i[20],i[21],i[22],i[23]),s.quantizedVolumeStepSize=new oe(i[0],i[6],i[12],i[18])),t.quantization=s}function f2e(e,t,n,i,o,r){let s=e.accessors[t],a=rn.getMathType(s.type),c=y(s.normalized,!1),l=new RFe;l.name=n,l.semantic=i,l.setIndex=o,l.constant=s2e(a),l.componentDatatype=s.componentType,l.normalized=c,l.count=s.count,l.type=s.type,l.min=Xu(a,s.min),l.max=Xu(a,s.max),l.byteOffset=s.byteOffset,l.byteStride=dl(e,s),ai(s,"WEB3D_quantized_attributes")&&u2e(s.extensions.WEB3D_quantized_attributes,l,a);let f=l.semantic===Ct.POSITION||l.semantic===Ct.NORMAL||l.semantic===Ct.TANGENT||l.semantic===Ct.TEXCOORD;return r&&c&&f&&l2e(l,a),l}function kne(e){let n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}var d2e={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function B5(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");let o=t.fromGltfSemantic(i),r=d2e;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function h2e(e){let t=e===Ct.POSITION,n=e===Ct.FEATURE_ID,i=e===Ct.TEXCOORD;return t||n||i}function m2e(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){let o=u(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=q.createArrayBufferView(o,t.typedArray.buffer)}}function p2e(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){let s=i.typedArray;n.typedArray=Une(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function zne(e,t,n,i,o,r,s,a){let c=t.accessors[n],l=c.bufferView,f=i.gltfSemantic,d=i.renamedSemantic,p=i.modelSemantic,g=u(p)?kne(d):void 0,A=f2e(t,n,f,p,g,e._hasKhrMeshQuantization);if(!u(o)&&!u(l))return A;let C=t2e(e,t,n,f,o,r,s,a).promise.then(function(T){e.isDestroyed()||(u(o)&&u(o.attributes)&&u(o.attributes[f])?m2e(A,T,r,s):p2e(t,c,A,T,r,s))});return e._loaderPromises.push(C),A}function Hne(e,t,n,i,o,r,s,a){let c=i.modelSemantic,l=c===Ct.POSITION,f=c===Ct.FEATURE_ID,d=l&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,p=e._loadForClassification&&f,g=e._loadAttributesAsTypedArray,m=!g,A=g||d||p,T=zne(e,t,n,i,o,s?!1:m,s?!0:A,a),E=new bA.AttributeLoadPlan(T);return E.loadBuffer=m,E.loadTypedArray=A,E}function _2e(e,t,n,i,o,r){let s=u(i.ROTATION),a=u(i.TRANSLATION)&&u(t.accessors[i.TRANSLATION].min)&&u(t.accessors[i.TRANSLATION].max),c=B5(e,zr,o),l=c.modelSemantic,f=l===zr.TRANSLATION||l===zr.ROTATION||l===zr.SCALE,d=l===zr.TRANSLATION,p=e._loadAttributesAsTypedArray||s&&f||!r.context.instancedArrays,g=!p,m=e._loadAttributesFor2D&&!r.scene3DOnly;return zne(e,t,n,c,void 0,g,p||d&&(!a||m),r)}function g2e(e,t,n,i,o,r,s){let a=t.accessors[n],c=a.bufferView;if(!u(i)&&!u(c))return;let l=new BFe;l.count=a.count;let f=e._loadAttributesAsTypedArray,d=e._loadIndicesForWireframe&&!s.context.webgl2,p=e._loadForClassification&&o,m=!f,A=f||d||p,E=n2e(e,t,n,i,r?!1:m,r?!0:A,s).promise.then(function(D){e.isDestroyed()||(l.indexDatatype=D.indexDatatype,l.buffer=D.buffer,l.typedArray=D.typedArray)});e._loaderPromises.push(E);let S=new bA.IndicesLoadPlan(l);return S.loadBuffer=m,S.loadTypedArray=A,S}function Ap(e,t,n,i,o,r){let s=hl.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!u(s))return;let a=Ui.loadTexture({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous});e._textureLoaders.push(a);let c=hl.createModelTextureReader({textureInfo:n}),l=a.promise.then(function(f){e.isUnloaded()||e.isDestroyed()||(c.texture=f.texture,u(r)&&(c.texture.sampler=r))});return e._texturesPromises.push(l),c}function y2e(e,t,n,i,o){let r=new JFe,s=y(n.extensions,y.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,c=n.pbrMetallicRoughness;if(r.unlit=u(s.KHR_materials_unlit),u(a)){let l=new ZFe;r.specularGlossiness=l,u(a.diffuseTexture)&&(l.diffuseTexture=Ap(e,t,a.diffuseTexture,i,o)),u(a.specularGlossinessTexture)&&u(a.specularGlossinessTexture)&&(l.specularGlossinessTexture=Ap(e,t,a.specularGlossinessTexture,i,o)),l.diffuseFactor=Xu(oe,a.diffuseFactor),l.specularFactor=Xu(h,a.specularFactor),l.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(u(c)){let l=new KFe;u(c.baseColorTexture)&&(l.baseColorTexture=Ap(e,t,c.baseColorTexture,i,o)),u(c.metallicRoughnessTexture)&&(l.metallicRoughnessTexture=Ap(e,t,c.metallicRoughnessTexture,i,o)),l.baseColorFactor=Xu(oe,c.baseColorFactor),l.metallicFactor=c.metallicFactor,l.roughnessFactor=c.roughnessFactor,r.metallicRoughness=l}return u(n.emissiveTexture)&&(r.emissiveTexture=Ap(e,t,n.emissiveTexture,i,o)),u(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=Ap(e,t,n.normalTexture,i,o)),u(n.occlusionTexture)&&(r.occlusionTexture=Ap(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=Xu(h,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function Gne(e,t){let n=new Nne;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 Wne(e,t,n,i){let o=new Nne,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=kne(r.attribute),o.positionalLabel=i,o}function jne(e,t){let n=new Vne;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 Yne(e,t,n,i){let o=new Vne,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=y(r.constant,0);let s=y(r.divisor,0);return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function A2e(e,t,n,i,o,r){let s=new Fne;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;let a=n.texture;s.textureReader=Ap(e,t,a,i,o,ln.NEAREST);let l=(u(a.channels)?a.channels:[0]).map(function(f){return"rgba".charAt(f)}).join("");return s.textureReader.channels=l,s}function x2e(e,t,n,i,o,r,s,a){let c=new Fne,l=n.featureIds,f=l.texture;return c.featureCount=s,c.propertyTableId=i,c.textureReader=Ap(e,t,f,o,r,ln.NEAREST),c.textureReader.channels=l.channels,c.positionalLabel=a,c}function C2e(e,t,n,i,o,r){let s=new MFe,a=void 0,c=!1;for(let l in n)if(n.hasOwnProperty(l)){let f=n[l],d=B5(e,Ct,l),p=Hne(e,t,f,d,a,c,i,r);s.attributes.push(p.attribute),o.attributePlans.push(p)}return s}function T2e(e,t,n,i,o,r){let s=new LFe,a=new bA(s);e._primitiveLoadPlans.push(a);let c=n.material;u(c)&&(s.material=y2e(e,t,t.materials[c],o,r));let l=y(n.extensions,y.EMPTY_OBJECT),f=!1,d=l.CESIUM_primitive_outline;e._loadPrimitiveOutline&&u(d)&&(f=!0,a.needsOutlines=!0,a.outlineIndices=E2e(e,t,d,a));let p=e._loadForClassification,g=l.KHR_draco_mesh_compression,m=!1,A=n.attributes;if(u(A)){for(let R in A)if(A.hasOwnProperty(R)){let O=A[R],L=B5(e,Ct,R),N=L.modelSemantic;if(p&&!h2e(N))continue;N===Ct.FEATURE_ID&&(m=!0);let _=Hne(e,t,O,L,g,i,f,r);a.attributePlans.push(_),s.attributes.push(_.attribute)}}let x=n.targets;if(u(x)&&!p){let R=x.length;for(let O=0;O<R;++O)s.morphTargets.push(C2e(e,t,x[O],f,a,r))}let C=n.indices;if(u(C)){let R=g2e(e,t,C,g,m,f,r);u(R)&&(a.indicesPlan=R,s.indices=R.indices)}let T=l.EXT_structural_metadata,E=l.EXT_mesh_features,S=l.EXT_feature_metadata,D=u(S);u(E)?b2e(e,t,s,E,o,r):D&&S2e(e,t,s,S,o,r),u(T)?D2e(s,T):D&&v2e(e,s,S);let w=n.mode;if(p&&w!==Me.TRIANGLES)throw new ue("Only triangle meshes can be used for classification.");return s.primitiveType=w,s}function E2e(e,t,n){let i=n.indices;return UV(e,t,i,!1)}function b2e(e,t,n,i,o,r){let s;u(i)&&u(i.featureIds)?s=i.featureIds:s=[];for(let a=0;a<s.length;a++){let c=s[a],l=`featureId_${a}`,f;u(c.texture)?f=A2e(e,t,c,o,r,l):u(c.attribute)?f=Gne(c,l):f=jne(c,l),n.featureIds.push(f)}}function S2e(e,t,n,i,o,r){let s=t.extensions.EXT_feature_metadata.featureTables,a=0,c=i.featureIdAttributes;if(u(c)){let f=c.length;for(let d=0;d<f;++d){let p=c[d],g=p.featureTable,m=e._sortedPropertyTableIds.indexOf(g),A=s[g].count,x=`featureId_${a}`;a++;let C;u(p.featureIds.attribute)?C=Wne(p,m,A,x):C=Yne(p,m,A,x),n.featureIds.push(C)}}let l=i.featureIdTextures;if(u(l)){let f=l.length;for(let d=0;d<f;++d){let p=l[d],g=p.featureTable,m=e._sortedPropertyTableIds.indexOf(g),A=s[g].count,x=`featureId_${a}`;a++;let C=x2e(e,t,p,m,o,r,A,x);n.featureIds.push(C)}}}function D2e(e,t){u(t)&&(u(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),u(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function v2e(e,t,n){u(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function w2e(e,t,n,i){let o=n.EXT_mesh_gpu_instancing,r=new NFe,s=o.attributes;if(u(s)){for(let f in s)if(s.hasOwnProperty(f)){let d=s[f];r.attributes.push(_2e(e,t,d,s,f,i))}}let a=y(o.extensions,y.EMPTY_OBJECT),c=n.EXT_instance_features,l=a.EXT_feature_metadata;return u(c)?I2e(r,c):u(l)&&P2e(t,r,l,e._sortedPropertyTableIds),r}function I2e(e,t){let n=t.featureIds;for(let i=0;i<n.length;i++){let o=n[i],r=`instanceFeatureId_${i}`,s;u(o.attribute)?s=Gne(o,r):s=jne(o,r),e.featureIds.push(s)}}function P2e(e,t,n,i){let o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(u(r)){let s=r.length;for(let a=0;a<s;++a){let c=r[a],l=c.featureTable,f=i.indexOf(l),d=o[l].count,p=`instanceFeatureId_${a}`,g;u(c.featureIds.attribute)?g=Wne(c,f,d,p):g=Yne(c,f,d,p),t.featureIds.push(g)}}}function O2e(e,t,n,i,o){let r=new VFe;r.name=n.name,r.matrix=Xu(M,n.matrix),r.translation=Xu(h,n.translation),r.rotation=Xu(Le,n.rotation),r.scale=Xu(h,n.scale);let s=y(n.extensions,y.EMPTY_OBJECT),a=s.EXT_mesh_gpu_instancing,c=s.AGI_articulations;if(u(a)){if(e._loadForClassification)throw new ue("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=w2e(e,t,s,o)}u(c)&&(r.articulationName=c.articulationName);let l=n.mesh;if(u(l)){let f=t.meshes[l],d=f.primitives,p=d.length;for(let x=0;x<p;++x)r.primitives.push(T2e(e,t,d[x],u(r.instances),i,o));let g=y(n.weights,f.weights),A=r.primitives[0].morphTargets.length;r.morphWeights=u(g)?g.slice():new Array(A).fill(0)}return r}function R2e(e,t,n,i){if(!u(t.nodes))return[];let o,r,s=t.nodes.length,a=new Array(s);for(o=0;o<s;++o){let c=O2e(e,t,t.nodes[o],n,i);c.index=o,a[o]=c}for(o=0;o<s;++o){let c=t.nodes[o].children;if(u(c)){let l=c.length;for(r=0;r<l;++r)a[o].children.push(a[c[r]])}}return a}function B2e(e,t,n,i){let o=new FFe,r=n.joints,s=r.length,a=new Array(s);for(let l=0;l<s;++l)a[l]=i[r[l]];o.joints=a;let c=n.inverseBindMatrices;return u(c)?o.inverseBindMatrices=UV(e,t,c):o.inverseBindMatrices=new Array(s).fill(M.IDENTITY),o}function M2e(e,t,n){let i=t.skins;if(e._loadForClassification||!u(i))return[];let o=t.skins.length,r=new Array(o);for(let a=0;a<o;++a){let c=B2e(e,t,t.skins[a],n);c.index=a,r[a]=c}let s=n.length;for(let a=0;a<s;++a){let c=t.nodes[a].skin;u(c)&&(n[a].skin=r[c])}return r}function L2e(e,t,n,i,o,r){let s=new e1({gltf:t,extension:n,extensionLegacy:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:o,frameState:r,asynchronous:e._asynchronous});return s.load(),e._structuralMetadataLoader=s,s}function N2e(e,t,n){let i=new kFe,o=n.input;i.input=UV(e,t,o);let r=n.interpolation;i.interpolation=y(ud[r],ud.LINEAR);let s=n.output;return i.output=UV(e,t,s,!0),i}function F2e(e,t){let n=new zFe,i=e.node;if(!u(i))return;n.node=t[i];let o=e.path.toUpperCase();return n.path=UFe[o],n}function V2e(e,t,n){let i=new HFe,o=e.sampler;return i.sampler=t[o],i.target=F2e(e.target,n),i}function U2e(e,t,n,i){let o,r=new GFe;r.name=n.name;let s=n.samplers,a=s.length,c=new Array(a);for(o=0;o<a;o++){let p=N2e(e,t,s[o]);p.index=o,c[o]=p}let l=n.channels,f=l.length,d=new Array(f);for(o=0;o<f;o++)d[o]=V2e(l[o],c,i);return r.samplers=c,r.channels=d,r}function k2e(e,t,n){let i=t.animations;if(e._loadForClassification||!u(i))return[];let o=t.animations.length,r=new Array(o);for(let s=0;s<o;++s){let a=U2e(e,t,t.animations[s],n);a.index=s,r[s]=a}return r}function z2e(e){let t=new WFe;t.name=e.name;let n=e.type.toUpperCase();return t.type=Ya[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function H2e(e){let t=new jFe;t.name=e.name;let n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){let s=z2e(n[r]);o[r]=s}return t.stages=o,t}function G2e(e){let n=y(e.extensions,y.EMPTY_OBJECT).AGI_articulations;if(!u(n))return[];let i=n.articulations;if(!u(i))return[];let o=i.length,r=new Array(o);for(let s=0;s<o;s++){let a=H2e(i[s]);r[s]=a}return r}function W2e(e){let t;return u(e.scenes)&&u(e.scene)&&(t=e.scenes[e.scene].nodes),t=y(t,e.nodes),t=u(t)?t:[],t}function j2e(e,t){let n=new qFe,i=W2e(e);return n.nodes=i.map(function(o){return t[o]}),n}var Y2e=new h;function q2e(e,t,n,i,o,r){let s=t.asset.version;if(s!=="1.0"&&s!=="2.0"){let D=e._gltfResource.url;throw new ue(`Failed to load ${D}: 
Unsupported glTF version: ${s}`)}let a=t.extensionsRequired;u(a)&&(sn.checkSupportedExtensions(a),e._hasKhrMeshQuantization=a.includes("KHR_mesh_quantization"));let c=y(t.extensions,y.EMPTY_OBJECT),l=c.EXT_structural_metadata,f=c.EXT_feature_metadata,d=c.CESIUM_RTC;if(u(f)){let D=f.featureTables,w=f.featureTextures,R=u(D)?D:[],O=u(w)?w:[];e._sortedPropertyTableIds=Object.keys(R).sort(),e._sortedFeatureTextureIds=Object.keys(O).sort()}let p=R2e(e,t,n,i),g=M2e(e,t,p),m=k2e(e,t,p),A=G2e(t),x=j2e(t,p),C=new XFe,T=new YFe,E=t.asset.copyright;if(u(E)){let D=E.split(";").map(function(w){return new Zt(w.trim())});T.credits=D}if(C.asset=T,C.scene=x,C.nodes=p,C.skins=g,C.animations=m,C.articulations=A,C.upAxis=e._upAxis,C.forwardAxis=e._forwardAxis,u(d)){let D=h.fromArray(d.center,0,Y2e);C.transform=M.fromTranslation(D,C.transform)}if(e._components=C,u(l)||u(f)){let w=L2e(e,t,l,f,n,i).promise.then(function(R){e.isDestroyed()||(C.structuralMetadata=R.structuralMetadata)});e._loaderPromises.push(w)}let S=[];S.push.apply(S,e._loaderPromises),e._incrementallyLoadTextures||S.push.apply(S,e._texturesPromises),Promise.all(S).then(function(){e.isDestroyed()||(e._state=or.POST_PROCESSING)}).catch(o),Promise.all(e._texturesPromises).then(function(){e.isDestroyed()||(e._textureState=or.PROCESSED)}).catch(r)}function X2e(e){let t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)Ui.unload(t[i]);e._textureLoaders.length=0}function qne(e){let t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)Ui.unload(t[i]);e._bufferViewLoaders.length=0}function K2e(e){let t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)Ui.unload(t[i]);e._geometryLoaders.length=0}function Z2e(e){let t=e._postProcessBuffers,n=t.length;for(let i=0;i<n;i++){let o=t[i];o.isDestroyed()||o.destroy()}t.length=0}function J2e(e){u(e._structuralMetadataLoader)&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}xp.prototype.isUnloaded=function(){return this._state===or.UNLOADED};xp.prototype.unload=function(){u(this._gltfJsonLoader)&&Ui.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,X2e(this),qne(this),K2e(this),Z2e(this),J2e(this),this._components=void 0,this._typedArray=void 0,this._state=or.UNLOADED};var Cp=xp;var n1=`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));

    // ignore depth values that are the clear depth
    if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {
        return vec2(0.0);
    }

    // interpolate the two adjacent depth values
    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) // 0.0 is the clear value for the gbuffer
    {
        discard;
    }

    vec4 color = texture(u_pointCloud_colorGBuffer, v_textureCoordinates);

    // sample from neighbors left, right, down, up
    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);

    // Input and output depth are the same.
    gl_FragDepth = depthOrLogDepth;
}
`;function NT(){this._framebuffer=new mi({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(NT.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 Q2e(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}var M5=new H;function $2e(e,t){let n=new ke({defines:["LOG_DEPTH_WRITE"],sources:[n1]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return M5.x=e._radius,M5.y=e._strength,M5}},o=Ue.fromCache({blending:un.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:Bt.setCesium3DTileBit(),stencilMask:Bt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:Ee.CESIUM_3D_TILE,owner:e}),e._clearCommand=new ii({framebuffer:e.framebuffer,color:new z(0,0,0,0),depth:1,renderState:Ue.fromCache(),pass:Ee.CESIUM_3D_TILE,owner:e})}function e3e(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),$2e(e,t)}function Xne(e){return e.drawBuffers&&e.fragmentDepth}NT.isSupported=Xne;function t3e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!u(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=ke.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}NT.prototype.update=function(e,t,n,i){if(!Xne(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,e3e(this,e.context);let o,r=e.commandList,s=r.length;for(o=t;o<s;++o){let l=r[o];if(l.primitiveType!==Me.POINTS||l.pass===Ee.TRANSLUCENT)continue;let f,d,p=l.derivedCommands.pointCloudProcessor;u(p)&&(f=p.command,d=p.originalShaderProgram),(!u(f)||l.dirty||d!==l.shaderProgram||f.framebuffer!==this.framebuffer)&&(f=tt.shallowClone(l,f),f.framebuffer=this.framebuffer,f.shaderProgram=t3e(e.context,l.shaderProgram),f.castShadows=!1,f.receiveShadows=!1,u(p)||(p={command:f,originalShaderProgram:l.shaderProgram},l.derivedCommands.pointCloudProcessor=p),p.originalShaderProgram=l.shaderProgram),r[o]=f}let a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)};NT.prototype.isDestroyed=function(){return!1};NT.prototype.destroy=function(){return Q2e(this),le(this)};var Tp=NT;function Kne(e){let t=y(e,{});this.attenuation=y(t.attenuation,!1),this.geometricErrorScale=y(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=y(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=y(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=y(t.eyeDomeLightingRadius,1),this.backFaceCulling=y(t.backFaceCulling,!1),this.normalShading=y(t.normalShading,!0)}Kne.isSupported=function(e){return Tp.isSupported(e.context)};var Oh=Kne;var ha={},n3e=new oe(0,0,0,1),Ka=new oe,i3e=new Ye,L5=new H,N5=new H;ha.wgs84ToWindowCoordinates=function(e,t,n){return ha.wgs84WithEyeOffsetToWindowCoordinates(e,t,h.ZERO,n)};var Zne=new oe,Jne=new h;function i1(e,t,n,i){let o=n.viewMatrix,r=M.multiplyByVector(o,oe.fromElements(e.x,e.y,e.z,1,Zne),Zne),s=h.multiplyComponents(t,h.normalize(r,Jne),Jne);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,M.multiplyByVector(n.frustum.projectionMatrix,r,i)}var o3e=new he(Math.PI,P.PI_OVER_TWO),r3e=new h,s3e=new h;ha.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){let o=e.frameState,r=ha.computeActualWgs84Position(o,t,n3e);if(!u(r))return;let s=e.canvas,a=i3e;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;let c=e.camera,l=!1;if(o.mode===te.SCENE2D){let f=e.mapProjection,d=o3e,p=f.project(d,r3e),g=h.clone(c.position,s3e),m=c.frustum.clone(),A=M.computeViewportTransformation(a,0,1,new M),x=c.frustum.projectionMatrix,C=c.positionWC.y,T=h.fromElements(P.sign(C)*p.x-C,0,-c.positionWC.x),E=Ot.pointToGLWindowCoordinates(x,A,T);if(C===0||E.x<=0||E.x>=s.clientWidth)l=!0;else{if(E.x>s.clientWidth*.5){a.width=E.x,c.frustum.right=p.x-C,Ka=i1(r,n,c,Ka),ha.clipToGLWindowCoordinates(a,Ka,L5),a.x+=E.x,c.position.x=-c.position.x;let S=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-S,Ka=i1(r,n,c,Ka),ha.clipToGLWindowCoordinates(a,Ka,N5)}else{a.x+=E.x,a.width-=E.x,c.frustum.left=-p.x-C,Ka=i1(r,n,c,Ka),ha.clipToGLWindowCoordinates(a,Ka,L5),a.x=a.x-a.width,c.position.x=-c.position.x;let S=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-S,Ka=i1(r,n,c,Ka),ha.clipToGLWindowCoordinates(a,Ka,N5)}h.clone(g,c.position),c.frustum=m.clone(),i=H.clone(L5,i),(i.x<0||i.x>s.clientWidth)&&(i.x=N5.x)}}if(o.mode!==te.SCENE2D||l){if(Ka=i1(r,n,c,Ka),Ka.z<0&&!(c.frustum instanceof en)&&!(c.frustum instanceof Tr))return;i=ha.clipToGLWindowCoordinates(a,Ka,i)}return i.y=s.clientHeight-i.y,i};ha.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=ha.wgs84ToWindowCoordinates(e,t,n),!!u(n))return ha.transformWindowToDrawingBuffer(e,n,n)};var Ep=new h,a3e=new he;ha.computeActualWgs84Position=function(e,t,n){let i=e.mode;if(i===te.SCENE3D)return h.clone(t,n);let o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,a3e);if(!u(r))return;if(o.project(r,Ep),i===te.COLUMBUS_VIEW)return h.fromElements(Ep.z,Ep.x,Ep.y,n);if(i===te.SCENE2D)return h.fromElements(0,Ep.x,Ep.y,n);let s=e.morphTime;return h.fromElements(P.lerp(Ep.z,t.x,s),P.lerp(Ep.x,t.y,s),P.lerp(Ep.y,t.z,s),n)};var Qne=new h,$ne=new h,eie=new M;ha.clipToGLWindowCoordinates=function(e,t,n){return h.divideByScalar(t,t.w,Qne),M.computeViewportTransformation(e,0,1,eie),M.multiplyByPoint(eie,Qne,$ne),H.fromCartesian3($ne,n)};ha.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 c3e=new oe,tie=new oe;ha.drawingBufferToWgs84Coordinates=function(e,t,n,i){let r=e.context.uniformState,s=r.currentFrustum,a=s.x,c=s.y;if(e.frameState.useLogDepth){let g=n*r.log2FarDepthFromNearPlusOne,m=Math.pow(2,g)-1;n=c*(1-a/(m+a))/(c-a)}let l=e.view.passState.viewport,f=oe.clone(oe.UNIT_W,c3e);f.x=(t.x-l.x)/l.width*2-1,f.y=(t.y-l.y)/l.height*2-1,f.z=n*2-1,f.w=1;let d,p=e.camera.frustum;if(!u(p.fovy))u(p._offCenterFrustum)&&(p=p._offCenterFrustum),d=tie,d.x=(f.x*(p.right-p.left)+p.left+p.right)*.5,d.y=(f.y*(p.top-p.bottom)+p.bottom+p.top)*.5,d.z=(f.z*(a-c)-a-c)*.5,d.w=1,d=M.multiplyByVector(r.inverseView,d,d);else{d=M.multiplyByVector(r.inverseViewProjection,f,tie);let g=1/d.w;h.multiplyByScalar(d,g,d)}return h.fromCartesian4(d,i)};var qi=ha;var l3e={LEFT:-1,NONE:0,RIGHT:1},Pc=Object.freeze(l3e);var FT={};FT._deprecationWarning=nr;var bp=Uint32Array.BYTES_PER_ELEMENT;FT.parse=function(e,t){let n=y(t,0);t=n;let i=new Uint8Array(e),o=new DataView(e);t+=bp;let r=o.getUint32(t,!0);if(r!==1)throw new ue(`Only Batched 3D Model version 1 is supported.  Version ${r} is not.`);t+=bp;let s=o.getUint32(t,!0);t+=bp;let a=o.getUint32(t,!0);t+=bp;let c=o.getUint32(t,!0);t+=bp;let l=o.getUint32(t,!0);t+=bp;let f=o.getUint32(t,!0);t+=bp;let d;l>=570425344?(t-=bp*2,d=a,l=c,f=0,a=0,c=0,FT._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-=bp,d=l,l=a,f=c,a=0,c=0,FT._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:y(d,0)}:(p=Oo(i,t,a),t+=a);let g=new Uint8Array(e,t,c);t+=c;let m,A;l>0&&(m=Oo(i,t,l),t+=l,f>0&&(A=new Uint8Array(e,t,f),A=new Uint8Array(A),t+=f));let x=n+s-t;if(x===0)throw new ue("glTF byte length must be greater than 0.");let C;return t%4===0?C=new Uint8Array(e,t,x):(FT._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),C=new Uint8Array(i.subarray(t,t+x))),{batchLength:d,featureTableJson:p,featureTableBinary:g,batchTableJson:m,batchTableBinary:A,gltf:C}};var o1=FT;function r1(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function nie(e,t,n,i,o,r){let s=e._cachedTypedArrays,a=s[t];return u(a)||(a=q.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function u3e(e,t,n,i){let o=e._cachedTypedArrays,r=o[t];return u(r)||(r=q.createTypedArray(n,i),o[t]=r),r}r1.prototype.getGlobalProperty=function(e,t,n){let i=this.json[e];if(u(i))return u(i.byteOffset)?(t=y(t,q.UNSIGNED_INT),n=y(n,1),nie(this,e,t,n,1,i.byteOffset)):i};r1.prototype.hasProperty=function(e){return u(this.json[e])};r1.prototype.getPropertyArray=function(e,t,n){let i=this.json[e];if(u(i))return u(i.byteOffset)?(u(i.componentType)&&(t=q.fromName(i.componentType)),nie(this,e,t,n,this.featuresLength,i.byteOffset)):u3e(this,e,t,i)};r1.prototype.getProperty=function(e,t,n,i,o){let r=this.json[e];if(!u(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 fd=r1;function s1(e){let t=e.count,n=e.batchTable,i=e.binaryBody,o=y(e.parseAsPropertyAttributes,!1),r=e.customAttributeOutput,s=f3e(n),a;u(s.jsonProperties)&&(a=new yp({count:t,properties:s.jsonProperties}));let c;u(s.hierarchy)&&(c=new oA({extension:s.hierarchy,binaryBody:i}));let l=ad.BATCH_TABLE_CLASS_NAME,f=s.binaryProperties,d,p,g;if(o){let x=h3e(t,l,f,i,r);g=x.transcodedSchema,p=[new TA({propertyAttribute:x.propertyAttributeJson,class:x.transcodedClass})]}else{let x=d3e(t,l,f,i);g=x.transcodedSchema;let C=x.featureTableJson;d=new fl({count:C.count,properties:C.properties,class:x.transcodedClass,bufferViews:x.bufferViewsTypedArrays}),p=[]}let m=[];if(u(d)||u(a)||u(c)){let x=new Ic({id:0,name:"Batch Table",count:t,metadataTable:d,jsonMetadataTable:a,batchTableHierarchy:c});m.push(x)}let A={schema:g,propertyTables:m,propertyAttributes:p,extensions:s.extensions,extras:s.extras};return new da(A)}function f3e(e){let t=e.HIERARCHY,n=e.extras,i=e.extensions,o;u(t)?(s1._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):u(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 c=e[a];Array.isArray(c)?(r=u(r)?r:{},r[a]=c):s[a]=c}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}function d3e(e,t,n,i){let o={},r={},s={},a=0;for(let d in n){if(!n.hasOwnProperty(d))continue;if(!u(i))throw new ue(`Property ${d} requires a batch table binary.`);let p=n[d],g=ql(p);r[d]={bufferView:a},o[d]=iie(p),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+p.byteOffset,e),a++}let c={classes:{}};c.classes[t]={properties:o};let l=cd.fromJson(c);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:l,transcodedClass:l.classes[t]}}function h3e(e,t,n,i,o){let r={},s={},a=0;for(let d in n){if(!n.hasOwnProperty(d))continue;let p=n[d];if(!u(i)&&!u(p.typedArray))throw new ue(`Property ${d} requires a batch table binary.`);let g=sn.sanitizeGlslIdentifier(d);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);let m=iie(p);m.name=d,r[g]=m;let A=g.toUpperCase();A.startsWith("_")||(A=`_${A}`);let x=p.typedArray;u(x)||(x=ql(p).createArrayBufferView(i.buffer,i.byteOffset+p.byteOffset,e));let C=new Rt.Attribute;C.name=A,C.count=e,C.type=p.type;let T=q.fromTypedArray(x);(T===q.INT||T===q.UNSIGNED_INT||T===q.DOUBLE)&&(s1._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${A}" 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.`),x=new Float32Array(x)),C.componentDatatype=q.fromTypedArray(x),C.typedArray=x,o.push(C),s[g]={attribute:A}}let c={classes:{}};c.classes[t]={properties:r};let l=cd.fromJson(c);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:l,transcodedClass:l.classes[t]}}function iie(e){let t=m3e(e.componentType);return{type:e.type,componentType:t}}function m3e(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"}}s1._deprecationWarning=nr;s1._oneTimeWarning=wt;var Sp=s1;var SA={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},p3e=Rt.FeatureIdAttribute;function Sg(e){e=y(e,y.EMPTY_OBJECT);let t=e.b3dmResource,n=e.baseResource,i=e.arrayBuffer,o=y(e.byteOffset,0),r=y(e.releaseGltfJson,!1),s=y(e.asynchronous,!0),a=y(e.incrementallyLoadTextures,!0),c=y(e.upAxis,Po.Y),l=y(e.forwardAxis,Po.X),f=y(e.loadAttributesAsTypedArray,!1),d=y(e.loadAttributesFor2D,!1),p=y(e.loadIndicesForWireframe,!1),g=y(e.loadPrimitiveOutline,!0),m=y(e.loadForClassification,!1);n=u(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=c,this._forwardAxis=l,this._loadAttributesAsTypedArray=f,this._loadAttributesFor2D=d,this._loadIndicesForWireframe=p,this._loadPrimitiveOutline=g,this._loadForClassification=m,this._state=SA.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=M.IDENTITY}u(Object.create)&&(Sg.prototype=Object.create(no.prototype),Sg.prototype.constructor=Sg);Object.defineProperties(Sg.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Sg.prototype.load=function(){let e=o1.parse(this._arrayBuffer,this._byteOffset),t=e.batchLength,n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new fd(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;let a=s.getGlobalProperty("RTC_CENTER",q.FLOAT,3);u(a)&&(this._transform=M.fromTranslation(h.fromArray(a))),this._batchTable={json:o,binary:r};let c=new Cp({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,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline,loadForClassification:this._loadForClassification,renameBatchIdSemantic:!0});this._gltfLoader=c,this._state=SA.LOADING;let l=this;return c.load(),this._promise=c.promise.then(function(){if(l.isDestroyed())return;let f=c.components;return f.transform=M.multiplyTransformation(l._transform,f.transform,f.transform),g3e(l,f),l._components=f,l._arrayBuffer=void 0,l._state=SA.READY,l}).catch(function(f){if(!l.isDestroyed())return _3e(l,f)}),this._promise};function _3e(e,t){e.unload(),e._state=SA.FAILED;let n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}Sg.prototype.process=function(e){this._state===SA.LOADING&&(this._state=SA.PROCESSING),this._state===SA.PROCESSING&&this._gltfLoader.process(e)};function g3e(e,t){let n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(u(n.json))o=Sp({count:i,batchTable:n.json,binaryBody:n.binary});else{let a=new Ic({name:ad.BATCH_TABLE_CLASS_NAME,count:i});o=new da({schema:{},propertyTables:[a]})}let r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)oie(r[a]);t.structuralMetadata=o}function oie(e){let t=e.children.length;for(let i=0;i<t;i++)oie(e.children[i]);let n=e.primitives.length;for(let i=0;i<n;i++){let o=e.primitives[i],r=sn.getAttributeBySemantic(o,Ct.FEATURE_ID);if(u(r)){r.setIndex=0;let s=new p3e;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}Sg.prototype.unload=function(){u(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};var a1=Sg;function Dg(e){e=y(e,y.EMPTY_OBJECT),this._geoJson=e.geoJson,this._promise=void 0,this._process=function(t,n){},this._components=void 0}u(Object.create)&&(Dg.prototype=Object.create(no.prototype),Dg.prototype.constructor=Dg);Object.defineProperties(Dg.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Dg.prototype.load=function(){let e=this,t=new Promise(function(n){e._process=function(i,o){u(i._components)||(i._components=P3e(i._geoJson,o),i._geoJson=void 0,n(i))}});return this._promise=t,t};Dg.prototype.process=function(e){this._process(this,e)};function y3e(){this.lines=void 0,this.points=void 0,this.properties=void 0}function A3e(){this.features=[]}function F5(e){let t=e[0],n=e[1],i=y(e[2],0);return new h(t,n,i)}function V5(e){let t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=F5(e[o]);return[n]}function x3e(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=V5(e[i])[0];return n}function rie(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=V5(e[i])[0];return n}function C3e(e){let t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,rie(e[i]));return n}function T3e(e){return[F5(e)]}function E3e(e){let t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=F5(e[i]);return n}var b3e={LineString:V5,MultiLineString:x3e,MultiPolygon:C3e,Polygon:rie,MultiPoint:E3e,Point:T3e},S3e={LineString:Me.LINES,MultiLineString:Me.LINES,MultiPolygon:Me.LINES,Polygon:Me.LINES,MultiPoint:Me.POINTS,Point:Me.POINTS};function sie(e,t){if(!u(e.geometry))return;let n=e.geometry.type,i=b3e[n],o=S3e[n],r=e.geometry.coordinates;if(!u(i)||!u(r))return;let s=new y3e;o===Me.LINES?s.lines=i(r):o===Me.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function D3e(e,t){let n=e.features,i=n.length;for(let o=0;o<i;o++)sie(n[o],t)}var v3e={FeatureCollection:D3e,Feature:sie},kV=new h;function w3e(e,t,n){let i=0,o=0,r=e.length;for(let L=0;L<r;L++){let N=e[L];if(u(N.lines)){let _=N.lines.length;for(let b=0;b<_;b++){let v=N.lines[b];i+=v.length,o+=(v.length-1)*2}}}let s=new Float32Array(i*3),a=new Float32Array(i),c=Fe.createTypedArray(i,o),l=Fe.fromTypedArray(c),f=new h(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),d=new h(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),p=0,g=0;for(let L=0;L<r;L++){let N=e[L];if(!u(N.lines))continue;let _=N.lines.length;for(let b=0;b<_;b++){let v=N.lines[b],I=v.length;for(let B=0;B<I;B++){let F=v[B],k=h.fromDegrees(F.x,F.y,F.z,ie.WGS84,kV),U=M.multiplyByPoint(t,k,kV);h.minimumByComponent(f,U,f),h.maximumByComponent(d,U,d),h.pack(U,s,p*3),a[p]=L,B<I-1&&(c[g*2]=p,c[g*2+1]=p+1,g++),p++}}}let m=lt.createVertexBuffer({typedArray:s,context:n.context,usage:Ne.STATIC_DRAW});m.vertexArrayDestroyable=!1;let A=lt.createVertexBuffer({typedArray:a,context:n.context,usage:Ne.STATIC_DRAW});A.vertexArrayDestroyable=!1;let x=lt.createIndexBuffer({typedArray:c,context:n.context,usage:Ne.STATIC_DRAW,indexDatatype:l});x.vertexArrayDestroyable=!1;let C=new Rt.Attribute;C.semantic=Ct.POSITION,C.componentDatatype=q.FLOAT,C.type=rn.VEC3,C.count=i,C.min=f,C.max=d,C.buffer=m;let T=new Rt.Attribute;T.semantic=Ct.FEATURE_ID,T.setIndex=0,T.componentDatatype=q.FLOAT,T.type=rn.SCALAR,T.count=i,T.buffer=A;let E=[C,T],S=new Rt.Material;S.unlit=!0;let D=new Rt.Indices;D.indexDatatype=l,D.count=c.length,D.buffer=x;let w=new Rt.FeatureIdAttribute;w.featureCount=r,w.propertyTableId=0,w.setIndex=0,w.positionalLabel="featureId_0";let R=[w],O=new Rt.Primitive;return O.attributes=E,O.indices=D,O.featureIds=R,O.primitiveType=Me.LINES,O.material=S,O}function I3e(e,t,n){let i=0,o=e.length;for(let E=0;E<o;E++){let S=e[E];u(S.points)&&(i+=S.points.length)}let r=new Float32Array(i*3),s=new Float32Array(i),a=new h(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),c=new h(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),l=0;for(let E=0;E<o;E++){let S=e[E];if(!u(S.points))continue;let D=S.points.length;for(let w=0;w<D;w++){let R=S.points[w],O=h.fromDegrees(R.x,R.y,R.z,ie.WGS84,kV),L=M.multiplyByPoint(t,O,kV);h.minimumByComponent(a,L,a),h.maximumByComponent(c,L,c),h.pack(L,r,l*3),s[l]=E,l++}}let f=lt.createVertexBuffer({typedArray:r,context:n.context,usage:Ne.STATIC_DRAW});f.vertexArrayDestroyable=!1;let d=lt.createVertexBuffer({typedArray:s,context:n.context,usage:Ne.STATIC_DRAW});d.vertexArrayDestroyable=!1;let p=new Rt.Attribute;p.semantic=Ct.POSITION,p.componentDatatype=q.FLOAT,p.type=rn.VEC3,p.count=i,p.min=a,p.max=c,p.buffer=f;let g=new Rt.Attribute;g.semantic=Ct.FEATURE_ID,g.setIndex=0,g.componentDatatype=q.FLOAT,g.type=rn.SCALAR,g.count=i,g.buffer=d;let m=[p,g],A=new Rt.Material;A.unlit=!0;let x=new Rt.FeatureIdAttribute;x.featureCount=o,x.propertyTableId=0,x.setIndex=0,x.positionalLabel="featureId_0";let C=[x],T=new Rt.Primitive;return T.attributes=m,T.featureIds=C,T.primitiveType=Me.POINTS,T.material=A,T}function P3e(e,t){let n=new A3e,i=v3e[e.type];u(i)&&i(e,n);let o=n.features,r=o.length;if(r===0)throw new ue("GeoJSON must have at least one feature");let s={};for(let L=0;L<r;L++){let N=o[L],_=y(N.properties,y.EMPTY_OBJECT);for(let b in _)_.hasOwnProperty(b)&&(u(s[b])||(s[b]=new Array(r)))}for(let L=0;L<r;L++){let N=o[L];for(let _ in s)if(s.hasOwnProperty(_)){let b=y(N.properties[_],"");s[_][L]=b}}let a=new yp({count:r,properties:s}),l=[new Ic({id:0,count:r,jsonMetadataTable:a})],f=cd.fromJson({}),d=new da({schema:f,propertyTables:l}),p=new h(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new h(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),m=!1,A=!1;for(let L=0;L<r;L++){let N=o[L];if(u(N.lines)){m=!0;let _=N.lines.length;for(let b=0;b<_;b++){let v=N.lines[b],I=v.length;for(let B=0;B<I;B++)h.minimumByComponent(p,v[B],p),h.maximumByComponent(g,v[B],g)}}if(u(N.points)){A=!0;let _=N.points.length;for(let b=0;b<_;b++){let v=N.points[b];h.minimumByComponent(p,v,p),h.maximumByComponent(g,v,g)}}}let x=h.midpoint(p,g,new h),C=h.fromDegrees(x.x,x.y,x.z,ie.WGS84,new h),T=Ot.eastNorthUpToFixedFrame(C,ie.WGS84,new M),E=M.inverseTransformation(T,new M),S=[];m&&S.push(w3e(o,E,t)),A&&S.push(I3e(o,E,t));let D=new Rt.Node;D.index=0,D.primitives=S;let w=[D],R=new Rt.Scene;R.nodes=w;let O=new Rt.Components;return O.scene=R,O.nodes=w,O.transform=T,O.structuralMetadata=d,O}Dg.prototype.unload=function(){this._components=void 0};var c1=Dg;var zV={};zV._deprecationWarning=nr;var vg=Uint32Array.BYTES_PER_ELEMENT;zV.parse=function(e,t){let n=y(t,0);t=n;let i=new Uint8Array(e),o=new DataView(e);t+=vg;let r=o.getUint32(t,!0);if(r!==1)throw new ue(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=vg;let s=o.getUint32(t,!0);t+=vg;let a=o.getUint32(t,!0);if(a===0)throw new ue("featureTableJsonByteLength is zero, the feature table must be defined.");t+=vg;let c=o.getUint32(t,!0);t+=vg;let l=o.getUint32(t,!0);t+=vg;let f=o.getUint32(t,!0);t+=vg;let d=o.getUint32(t,!0);if(d!==1&&d!==0)throw new ue(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${d} is not.`);t+=vg;let p=Oo(i,t,a);t+=a;let g=new Uint8Array(e,t,c);t+=c;let m,A;l>0&&(m=Oo(i,t,l),t+=l,f>0&&(A=new Uint8Array(e,t,f),A=new Uint8Array(A),t+=f));let x=n+s-t;if(x===0)throw new ue("glTF byte length must be greater than 0.");let C;return t%4===0?C=new Uint8Array(e,t,x):(zV._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),C=new Uint8Array(i.subarray(t,t+x))),{gltfFormat:d,featureTableJson:p,featureTableBinary:g,batchTableJson:m,batchTableBinary:A,gltf:C}};var l1=zV;var dd={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},HV=Rt.Attribute,O3e=Rt.FeatureIdAttribute,cie=Rt.Instances;function Dp(e){e=y(e,y.EMPTY_OBJECT);let t=e.i3dmResource,n=e.arrayBuffer,i=e.baseResource,o=y(e.byteOffset,0),r=y(e.releaseGltfJson,!1),s=y(e.asynchronous,!0),a=y(e.incrementallyLoadTextures,!0),c=y(e.upAxis,Po.Y),l=y(e.forwardAxis,Po.X),f=y(e.loadAttributesAsTypedArray,!1),d=y(e.loadIndicesForWireframe,!1),p=y(e.loadPrimitiveOutline,!0);i=u(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=c,this._forwardAxis=l,this._loadAttributesAsTypedArray=f,this._loadIndicesForWireframe=d,this._loadPrimitiveOutline=p,this._state=dd.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._gltfLoaderPromise=void 0,this._process=function(g,m){},this._postProcess=function(g,m){},this._buffers=[],this._components=void 0,this._transform=M.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}u(Object.create)&&(Dp.prototype=Object.create(no.prototype),Dp.prototype.constructor=Dp);Object.defineProperties(Dp.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Dp.prototype.load=function(){let e=l1.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new fd(t,n);this._featureTable=s;let a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!u(a))throw new ue("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;let c=s.getGlobalProperty("RTC_CENTER",q.FLOAT,3);u(c)&&(this._transform=M.fromTranslation(h.fromArray(c))),this._batchTable={json:i,binary:o};let l={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(r===0){let g=ll(e.gltf);g=g.replace(/[\s\0]+$/,"");let m=this._baseResource.getDerivedResource({url:g});l.gltfResource=m,l.baseResource=m}else l.gltfResource=this._i3dmResource,l.typedArray=e.gltf;let f=new Cp(l);this._gltfLoader=f,this._state=dd.LOADING,f.load();let d=this,p=new Promise(function(g){d._process=function(m,A){m._gltfLoader.process(A)},d._postProcess=function(m,A){let C=m._gltfLoader.components;C.transform=M.multiplyTransformation(m._transform,C.transform,C.transform),L3e(m,C,A),B3e(m,C),m._components=C,m._arrayBuffer=void 0,m._state=dd.READY,g(m)}});return this._promise=f.promise.then(function(){if(!d.isDestroyed())return d._state=dd.POST_PROCESSING,p}).catch(function(g){if(!d.isDestroyed())return R3e(d,g)}),this._promise};function R3e(e,t){e.unload(),e._state=dd.FAILED;let n="Failed to load i3dm";return t=e.getError(n,t),Promise.reject(t)}Dp.prototype.process=function(e){this._state===dd.LOADING&&(this._state=dd.PROCESSING),this._state===dd.PROCESSING&&this._process(this,e),this._state===dd.POST_PROCESSING&&this._postProcess(this,e)};function B3e(e,t){let n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(u(n.json))o=Sp({count:i,batchTable:n.json,binaryBody:n.binary});else{let r=new Ic({name:ad.BATCH_TABLE_CLASS_NAME,count:i});o=new da({schema:{},propertyTables:[r]})}t.structuralMetadata=o}var GV=new h,U5=new Array(4),M3e=new M;function L3e(e,t,n){let i,o=e._featureTable,r=e._instancesLength;if(r===0)return;let s=o.getGlobalProperty("RTC_CENTER",q.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),c=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,l=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),f=F3e(o,r),d;c&&(d=new Float32Array(4*r));let p;l&&(p=new Float32Array(3*r));let g=new Float32Array(r),m=h.unpackArray(f),A=new h,x=new h,C=new h,T=new h,E=new Z,S=new Le,D=new Array(4),w=new h,R=new Array(3),O=new M;if(!u(s)){let U=se.fromPoints(m);for(i=0;i<m.length;i++)h.subtract(m[i],U.center,GV),f[3*i+0]=GV.x,f[3*i+1]=GV.y,f[3*i+2]=GV.z;let G=M.fromTranslation(U.center,M3e);t.transform=M.multiplyTransformation(G,t.transform,t.transform)}for(i=0;i<r;i++){A=h.clone(m[i]),u(s)&&h.add(A,h.unpack(s),A),c&&(V3e(o,a,i,S,A,C,x,T,E,O),Le.pack(S,D,0),d[4*i+0]=D[0],d[4*i+1]=D[1],d[4*i+2]=D[2],d[4*i+3]=D[3]),l&&(U3e(o,i,w),h.pack(w,R,0),p[3*i+0]=R[0],p[3*i+1]=R[1],p[3*i+2]=R[2]);let U=o.getProperty("BATCH_ID",q.UNSIGNED_SHORT,1,i);u(U)||(U=i),g[i]=U}let L=new cie;L.transformInWorldSpace=!0;let N=e._buffers,_=new HV;if(_.name="Instance Translation",_.semantic=zr.TRANSLATION,_.componentDatatype=q.FLOAT,_.type=rn.VEC3,_.count=r,_.typedArray=f,!c){let U=lt.createVertexBuffer({context:n.context,typedArray:f,usage:Ne.STATIC_DRAW});U.vertexArrayDestroyable=!1,N.push(U),_.buffer=U}if(L.attributes.push(_),c){let U=new HV;U.name="Instance Rotation",U.semantic=zr.ROTATION,U.componentDatatype=q.FLOAT,U.type=rn.VEC4,U.count=r,U.typedArray=d,L.attributes.push(U)}if(l){let U=new HV;if(U.name="Instance Scale",U.semantic=zr.SCALE,U.componentDatatype=q.FLOAT,U.type=rn.VEC3,U.count=r,c)U.typedArray=p;else{let G=lt.createVertexBuffer({context:n.context,typedArray:p,usage:Ne.STATIC_DRAW});G.vertexArrayDestroyable=!1,N.push(G),U.buffer=G}L.attributes.push(U)}let b=new HV;b.name="Instance Feature ID",b.setIndex=0,b.semantic=zr.FEATURE_ID,b.componentDatatype=q.FLOAT,b.type=rn.SCALAR,b.count=r;let v=lt.createVertexBuffer({context:n.context,typedArray:g,usage:Ne.STATIC_DRAW});v.vertexArrayDestroyable=!1,N.push(v),b.buffer=v,L.attributes.push(b);let I=new O3e;I.propertyTableId=0,I.setIndex=0,I.positionalLabel="instanceFeatureId_0",L.featureIds.push(I);let B=t.nodes,F=B.length,k=!1;for(i=0;i<F;i++){let U=B[i];U.primitives.length>0&&(U.instances=k?N3e(L):L,k=!0)}}function N3e(e){let t=new cie;t.transformInWorldSpace=e.transformInWorldSpace;let n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=Ge(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function F3e(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",q.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",q.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",q.FLOAT,3);if(!u(i))throw new ue("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let o=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",q.FLOAT,3);if(!u(o))throw new ue("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 c=3*s+a;r[c]=n[c]/65535*o[a]+i[a]}return r}else throw new ue("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}var aie=new Array(4);function V3e(e,t,n,i,o,r,s,a,c,l){let f=e.getProperty("NORMAL_UP",q.FLOAT,3,n,U5),d=e.getProperty("NORMAL_RIGHT",q.FLOAT,3,n,aie),p=!1;if(u(f)){if(!u(d))throw new ue("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");h.unpack(f,0,r),h.unpack(d,0,s),p=!0}else{let g=e.getProperty("NORMAL_UP_OCT32P",q.UNSIGNED_SHORT,2,n,U5),m=e.getProperty("NORMAL_RIGHT_OCT32P",q.UNSIGNED_SHORT,2,n,aie);if(u(g)){if(!u(m))throw new ue("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");Gn.octDecodeInRange(g[0],g[1],65535,r),Gn.octDecodeInRange(m[0],m[1],65535,s),p=!0}else t?(Ot.eastNorthUpToFixedFrame(o,ie.WGS84,l),M.getMatrix3(l,c)):Z.clone(Z.IDENTITY,c)}p&&(h.cross(s,r,a),h.normalize(a,a),Z.setColumn(c,0,s,c),Z.setColumn(c,1,r,c),Z.setColumn(c,2,a,c)),Le.fromRotationMatrix(c,i)}function U3e(e,t,n){n=h.fromElements(1,1,1,n);let i=e.getProperty("SCALE",q.FLOAT,1,t);u(i)&&h.multiplyByScalar(n,i,n);let o=e.getProperty("SCALE_NON_UNIFORM",q.FLOAT,3,t,U5);u(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function k3e(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}Dp.prototype.isUnloaded=function(){return this._state===dd.UNLOADED};Dp.prototype.unload=function(){u(this._gltfLoader)&&this._gltfLoader.unload(),k3e(this),this._components=void 0,this._arrayBuffer=void 0,this._state=dd.UNLOADED};var u1=Dp;var z3e={STOPPED:0,ANIMATING:1},hd=Object.freeze(z3e);function VT(){this.times=void 0,this.points=void 0,de.throwInstantiationError()}VT.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof h)return h;if(e instanceof Le)return Le};VT.prototype.evaluate=de.throwInstantiationError;VT.prototype.findTimeInterval=function(e,t){let n=this.times,i=n.length;if(t=y(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};VT.prototype.wrapTime=function(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};VT.prototype.clampTime=function(e){let t=this.times;return P.clamp(e,t[0],t[t.length-1])};var io=VT;function UT(e){this._value=e,this._valueType=io.getPointType(e)}Object.defineProperties(UT.prototype,{value:{get:function(){return this._value}}});UT.prototype.findTimeInterval=function(e){};UT.prototype.wrapTime=function(e){return 0};UT.prototype.clampTime=function(e){return 0};UT.prototype.evaluate=function(e,t){let n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};var f1=UT;function kT(e){e=y(e,y.EMPTY_OBJECT);let t=e.points,n=e.times;this._times=n,this._points=t,this._pointType=io.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(kT.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});kT.prototype.findTimeInterval=io.prototype.findTimeInterval;kT.prototype.wrapTime=io.prototype.wrapTime;kT.prototype.clampTime=io.prototype.clampTime;kT.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]:(u(t)||(t=new h),h.lerp(n[o],n[o+1],r,t))};var wg=kT;var lie={};lie.solve=function(e,t,n,i){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 h,s[a]=new h;o[0]=n[0]/t[0],r[0]=h.multiplyByScalar(i[0],1/t[0],r[0]);let c;for(a=1;a<o.length;++a)c=1/(t[a]-o[a-1]*e[a-1]),o[a]=n[a]*c,r[a]=h.subtract(i[a],h.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=h.multiplyByScalar(r[a],c,r[a]);for(c=1/(t[a]-o[a-1]*e[a-1]),r[a]=h.subtract(i[a],h.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=h.multiplyByScalar(r[a],c,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=h.subtract(r[a],h.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};var zT=lie;var uie=[],fie=[],die=[],hie=[];function H3e(e,t,n){let i=uie,o=die,r=fie,s=hie;i.length=o.length=e.length-1,r.length=s.length=e.length;let a;i[0]=r[0]=1,o[0]=0;let c=s[0];for(u(c)||(c=s[0]=new h),h.clone(t,c),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,c=s[a],u(c)||(c=s[a]=new h),h.subtract(e[a+1],e[a-1],c),h.multiplyByScalar(c,3,c);return i[a]=0,o[a]=1,r[a]=4,c=s[a],u(c)||(c=s[a]=new h),h.subtract(e[a+1],e[a-1],c),h.multiplyByScalar(c,3,c),r[a+1]=1,c=s[a+1],u(c)||(c=s[a+1]=new h),h.clone(n,c),zT.solve(i,r,o,s)}function G3e(e){let t=uie,n=die,i=fie,o=hie;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(u(s)||(s=o[0]=new h),h.subtract(e[1],e[0],s),h.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],u(s)||(s=o[r]=new h),h.subtract(e[r+1],e[r-1],s),h.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],u(s)||(s=o[r]=new h),h.subtract(e[r],e[r-1],s),h.multiplyByScalar(s,3,s),zT.solve(t,i,n,o)}function pl(e){e=y(e,y.EMPTY_OBJECT);let t=e.points,n=e.times,i=e.inTangents,o=e.outTangents;this._times=n,this._points=t,this._pointType=io.getPointType(t[0]),this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(pl.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}}});pl.createC1=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.times,n=e.points,i=e.tangents,o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new pl({times:t,points:n,inTangents:r,outTangents:o})};pl.createNaturalCubic=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.times,n=e.points;if(n.length<3)return new wg({points:n,times:t});let i=G3e(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new pl({times:t,points:n,inTangents:r,outTangents:o})};pl.createClampedCubic=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.times,n=e.points,i=e.firstTangent,o=e.lastTangent,r=io.getPointType(n[0]);if(n.length<3)return new wg({points:n,times:t});let s=H3e(n,i,o),a=s.slice(0,s.length-1),c=s.slice(1,s.length);return new pl({times:t,points:n,inTangents:c,outTangents:a})};pl.hermiteCoefficientMatrix=new M(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);pl.prototype.findTimeInterval=io.prototype.findTimeInterval;var W3e=new oe,HT=new h;pl.prototype.wrapTime=io.prototype.wrapTime;pl.prototype.clampTime=io.prototype.clampTime;pl.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],c=(e-i[s])/a,l=W3e;l.z=c,l.y=c*c,l.x=l.y*c,l.w=1;let f=M.multiplyByVector(pl.hermiteCoefficientMatrix,l,l);f.z*=a,f.w*=a;let d=this._pointType;return d===Number?n[s]*f.x+n[s+1]*f.y+r[s]*f.z+o[s]*f.w:(u(t)||(t=new d),t=d.multiplyByScalar(n[s],f.x,t),d.multiplyByScalar(n[s+1],f.y,HT),d.add(t,HT,t),d.multiplyByScalar(r[s],f.z,HT),d.add(t,HT,t),d.multiplyByScalar(o[s],f.w,HT),d.add(t,HT,t))};var Ig=pl;function GT(e){e=y(e,y.EMPTY_OBJECT);let t=e.points,n=e.times;this._times=n,this._points=t,this._pointType=io.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(GT.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});GT.prototype.findTimeInterval=io.prototype.findTimeInterval;GT.prototype.wrapTime=io.prototype.wrapTime;GT.prototype.clampTime=io.prototype.clampTime;GT.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]:(u(t)||(t=new o),o.clone(n[i],t))};var d1=GT;function j3e(e){let t=e.points,n=e.times;return function(i,o){u(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],c=t[r+1];return Le.fastSlerp(a,c,s,o)}}function WT(e){e=y(e,y.EMPTY_OBJECT);let t=e.points,n=e.times;this._times=n,this._points=t,this._evaluateFunction=j3e(this),this._lastTimeIndex=0}Object.defineProperties(WT.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});WT.prototype.findTimeInterval=io.prototype.findTimeInterval;WT.prototype.wrapTime=io.prototype.wrapTime;WT.prototype.clampTime=io.prototype.clampTime;WT.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};var h1=WT;var DA=Rt.AnimatedPropertyType;function z5(e){e=y(e,y.EMPTY_OBJECT);let t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,X3e(this)}Object.defineProperties(z5.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 Y3e(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 Ig({times:e,points:n,inTangents:i,outTangents:o})}function mie(e,t,n,i){if(e.length===1&&t.length===1)return new f1(t[0]);switch(n){case ud.STEP:return new d1({times:e,points:t});case ud.CUBICSPLINE:return Y3e(e,t);case ud.LINEAR:return i===DA.ROTATION?new h1({times:e,points:t}):new wg({times:e,points:t})}}function q3e(e,t,n,i,o){let r=[];if(i===DA.WEIGHTS){let a=t.length/o,c,l;for(c=0;c<o;c++){let f=new Array(a),d=c;if(n===ud.CUBICSPLINE)for(l=0;l<a;l+=3)f[l]=t[d],f[l+1]=t[d+o],f[l+2]=t[d+2*o],d+=o*3;else for(l=0;l<a;l++)f[l]=t[d],d+=o;r.push(mie(e,f,n,i))}}else r.push(mie(e,t,n,i));return r}var k5;function X3e(e){let t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,a=t.target.path,c=e._runtimeNode,l=u(c.morphWeights)?c.morphWeights.length:1,f=q3e(i,o,r,a,l);switch(e._splines=f,e._path=a,a){case DA.TRANSLATION:case DA.SCALE:k5=new h;break;case DA.ROTATION:k5=new Le;break;case DA.WEIGHTS:break}}z5.prototype.animate=function(e){let t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===DA.WEIGHTS){let r=o.morphWeights,s=r.length;for(let a=0;a<s;a++){let c=t[a],l=i.clampAnimations?c.clampTime(e):c.wrapTime(e);r[a]=c.evaluate(l)}}else{if(o.userAnimated)return;{let r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);o[n]=r.evaluate(s,k5)}}};var m1=z5;function H5(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=$.clone(n.startTime),this._delay=y(n.delay,0),this._stopTime=$.clone(n.stopTime),this.removeOnStop=y(n.removeOnStop,!1),this._multiplier=y(n.multiplier,1),this._reverse=y(n.reverse,!1),this._loop=y(n.loop,Ga.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new Ae,this.update=new Ae,this.stop=new Ae,this._state=hd.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,K3e(this)}Object.defineProperties(H5.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}},animationTime:{get:function(){return this._animationTime}}});function K3e(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=e._model.sceneGraph,r=e._animation.channels,s=r.length,a=[];for(let c=0;c<s;c++){let l=r[c],f=l.target;if(!u(f))continue;let d=f.node.index,p=i._runtimeNodes[d],g=new m1({channel:l,runtimeAnimation:e,runtimeNode:p}),m=l.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}H5.prototype.animate=function(e){let t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};var p1=H5;function vp(e){this.animationAdded=new Ae,this.animationRemoved=new Ae,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(vp.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function G5(e,t,n){let i=e._model,o=new p1(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}vp.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);let n=this._model.sceneGraph.components.animations,i=e.index;if(u(i))return G5(this,n[i],e);let o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}return G5(this,n[i],e)};vp.prototype.addAll=function(e){e=y(e,y.EMPTY_OBJECT);let n=this._model.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){let s=G5(this,n[r],e);i.push(s)}return i};vp.prototype.remove=function(e){if(!u(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};vp.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])};vp.prototype.contains=function(e){return u(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};vp.prototype.get=function(e){return this._runtimeAnimations[e]};var WV=[];function Z3e(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}vp.prototype.update=function(e){let t=this._runtimeAnimations,n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&$.equals(e.time,this._previousTime))return!1;this._previousTime=$.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];u(a._computedStartTime)||(a._computedStartTime=$.addSeconds(y(a.startTime,o),a.delay,new $)),u(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));let c=a._computedStartTime,l=a._duration,f=a.stopTime,d=$.lessThanOrEquals(c,o),p=u(f)&&$.greaterThan(o,f),g=0;if(l!==0){let x=$.secondsDifference(p?f:o,c);g=u(a._animationTime)?a._animationTime(l,x):x/l}let m=a.loop===Ga.REPEAT||a.loop===Ga.MIRRORED_REPEAT,A=(d||m&&!u(a.startTime))&&(g<=1||m)&&!p;if(g===a._prevAnimationDelta){let x=a._state===hd.STOPPED;if(A!==x)continue}if(a._prevAnimationDelta=g,A||a._state===hd.ANIMATING){if(A&&a._state===hd.STOPPED&&(a._state=hd.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Ga.REPEAT)g=g-Math.floor(g);else if(a.loop===Ga.MIRRORED_REPEAT){let C=Math.floor(g),T=g-C;g=C%2===1?1-T:T}a.reverse&&(g=1-g);let x=g*l*a.multiplier;x=P.clamp(x,a.localStartTime,a.localStopTime),a.animate(x),a.update.numberOfListeners>0&&(a._updateEventTime=x,e.afterRender.push(a._raiseUpdateEvent)),i=!0,A||(a._state=hd.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&WV.push(a))}}n=WV.length;for(let s=0;s<n;++s){let a=WV[s];t.splice(t.indexOf(a),1),e.afterRender.push(Z3e(this,r,a))}return WV.length=0,i};var _1=vp;function vA(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(vA.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return u(this._color)||(this._color=new z),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}}});vA.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};vA.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};vA.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};vA.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};vA.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};var g1=vA;var y1={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};y1.getStyleCommandsNeeded=function(e,t){return t===0?y1.ALL_OPAQUE:t===e?y1.ALL_TRANSLUCENT:y1.OPAQUE_AND_TRANSLUCENT};var md=Object.freeze(y1);var Pg={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};Pg.is3DTiles=function(e){switch(e){case Pg.TILE_GLTF:case Pg.TILE_B3DM:case Pg.TILE_I3DM:case Pg.TILE_PNTS:case Pg.TILE_GEOJSON:return!0;case Pg.GLTF:return!1}};var rr=Object.freeze(Pg);function br(e){let t=e.model,n=e.propertyTable;this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=md.ALL_OPAQUE,J3e(this)}Object.defineProperties(br.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return u(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}});function J3e(e){let t=e._model,n=rr.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 xs(s,o)}else for(o=0;o<i;o++)r[o]=new g1({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new wc({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}br.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);let t=md.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};br.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};br.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};br.prototype.getShow=function(e){return this._batchTexture.getShow(e)};br.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};br.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};br.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};br.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};br.prototype.getFeature=function(e){return this._features[e]};br.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};br.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};br.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};br.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};br.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};br.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};br.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};br.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};br.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};var Q3e=new z;br.prototype.applyStyle=function(e){if(!u(e)){this.setAllColor(wc.DEFAULT_COLOR_VALUE),this.setAllShow(wc.DEFAULT_SHOW_VALUE);return}for(let t=0;t<this._featuresLength;t++){let n=this.getFeature(t),i=u(e.color)?y(e.color.evaluateColor(n,Q3e),wc.DEFAULT_COLOR_VALUE):wc.DEFAULT_COLOR_VALUE,o=u(e.show)?y(e.show.evaluate(n),wc.DEFAULT_SHOW_VALUE):wc.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};br.prototype.isDestroyed=function(){return!1};br.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),le(this)};var A1=br;var x1=`#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)
    #ifdef GL_OES_standard_derivatives
    #extension GL_OES_standard_derivatives : enable
    #endif
#endif

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_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);

    #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);

    #ifdef HAS_CLIPPING_PLANES
    modelClippingPlanesStage(color);
    #endif

    #if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
    silhouetteStage(color);
    #endif

    out_FragColor = color;
}
`;var C1=`precision highp float;

czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {
    czm_modelVertexOutput vsOutput;
    vsOutput.positionMC = positionMC;
    vsOutput.pointSize = 1.0;
    return vsOutput;
}

void main() 
{
    // Initialize the attributes struct with all
    // attributes except quantized ones.
    ProcessedAttributes attributes;
    initializeAttributes(attributes);

    // Dequantize the quantized ones and add them to the
    // attributes struct.
    #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

    // Compute the bitangent according to the formula in the glTF spec.
    // Normal and tangents can be affected by morphing and skinning, so
    // the bitangent should not be computed until their values are finalized.
    #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);
    // Handle any show properties that come from the style.
    cpuStylingStage(attributes.positionMC, feature);
    #endif

    #if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
    // The scene mode 2D pipeline stage and instancing stage add a different
    // model view matrix to accurately project the model to 2D. However, the
    // output positions and normals should be transformed by the 3D matrices
    // to keep the data the same for the fragment shader.
    mat4 modelView = czm_modelView3D;
    mat3 normal = czm_normal3D;
    #else
    // These are used for individual model projection because they will
    // automatically change based on the scene mode.
    mat4 modelView = czm_modelView;
    mat3 normal = czm_normal;
    #endif

    // Update the position for this instance in place
    #ifdef HAS_INSTANCING

        // The legacy instance stage is used when rendering i3dm models that 
        // encode instances transforms in world space, as opposed to glTF models
        // that use EXT_mesh_gpu_instancing, where instance transforms are encoded
        // in object space.
        #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_CUSTOM_VERTEX_SHADER
    czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
    customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);
    #endif

    // Compute the final position in each coordinate system needed.
    // This returns the value that will be assigned to gl_Position.
    vec4 positionClip = geometryStage(attributes, modelView, normal);    

    #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 = show * positionClip;
}
`;function j5(e){e=y(e,y.EMPTY_OBJECT);let t=e.command,n=e.primitiveRenderResources,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=[],nVe(this)}function $3e(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:ut.KEEP,zFail:ut.DECREMENT_WRAP,zPass:ut.KEEP},backFunction:e,backOperation:{fail:ut.KEEP,zFail:ut.INCREMENT_WRAP,zPass:ut.KEEP},reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Fa.LESS_OR_EQUAL},depthMask:!1}}var eVe={stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND},tVe={stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},backFunction:kn.NOT_EQUAL,backOperation:{fail:ut.ZERO,zFail:ut.ZERO,zPass:ut.ZERO},reference:0,mask:Bt.CLASSIFICATION_MASK},stencilMask:Bt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},gie=[];function nVe(e){let t=e._command,n=gie;if(e._useDebugWireframe){t.pass=Ee.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=T1(e,n,e._commandListDebugWireframe);let r=e._commandListDebugWireframe,s=r.length;for(let a=0;a<s;a++){let c=r[a];c.count*=2,c.offset*=2}return}let o=e.model.allowPicking;if(e._classifiesTerrain){let r=Ee.TERRAIN_CLASSIFICATION,s=W5(t,r),a=pie(t,r);n.length=0,n.push(s,a),e._commandListTerrain=T1(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=_ie(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){let r=Ee.CESIUM_3D_TILE_CLASSIFICATION,s=W5(t,r),a=pie(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=T1(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=_ie(e,n,e._commandList3DTilesPicking))}}function T1(e,t,n){let i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let c=0;c<s;c++){let l=o[c],f=r[c];for(let d=0;d<a;d++){let p=t[d],g=tt.shallowClone(p);g.count=l,g.offset=f,n.push(g)}}return n}function W5(e,t){let n=tt.shallowClone(e);n.cull=!1,n.pass=t;let i=t===Ee.TERRAIN_CLASSIFICATION?kn.ALWAYS:kn.EQUAL,o=$3e(i);return n.renderState=Ue.fromCache(o),n}function pie(e,t){let n=tt.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=Ue.fromCache(eVe),n}var iVe=[];function _ie(e,t,n){let i=Ue.fromCache(tVe),o=t[0],r=t[1],s=tt.shallowClone(o);s.cull=!0,s.pickOnly=!0;let a=tt.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;let c=iVe;return c.length=0,c.push(s,a),T1(e,c,n)}Object.defineProperties(j5.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=M.clone(e,this._modelMatrix);let t=this._runtimePrimitive.boundingSphere;this._boundingVolume=se.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}});j5.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=Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=W5(this._command,o),s=gie;s.length=0,s.push(r),this._commandListIgnoreShow=T1(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 E1=j5;function jV(e){e=y(e,y.EMPTY_OBJECT);let t=e.command,n=e.primitiveRenderResources,i=n.model;this._model=i;let o=n.runtimePrimitive;this._runtimePrimitive=o;let r=t.pass===Ee.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,c=n.hasSilhouette,l=!r&&!c,f=n.hasSkipLevelOfDetail&&!r,d=c;this._command=t,this._modelMatrix=M.clone(t.modelMatrix),this._boundingVolume=se.clone(t.boundingVolume),this._modelMatrix2D=new M,this._boundingVolume2D=new se,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=l,this._needsSkipLevelOfDetailCommands=f,this._needsSilhouetteCommands=d,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,oVe(this)}function wp(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=y(e.is2D,!1),this.derivedCommand2D=void 0}wp.clone=function(e){return new wp({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function oVe(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 wp({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new wp({command:fVe(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new wp({command:gVe(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new wp({command:yVe(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new wp({command:dVe(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new wp({command:hVe(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(jV.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=M.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=se.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,sVe(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,aVe(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,cVe(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,lVe(this))}}});function rVe(e,t){let n=e._modelMatrix;e._modelMatrix2D=M.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=P.sign(n[13])*2*P.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=se.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function sVe(e){let t=e.shadows,n=gn.castShadows(t),i=gn.receiveShadows(t),o=e._derivedCommands,r=o.length;for(let s=0;s<r;++s){let a=o[s];if(a.updateShadows){let c=a.command;c.castShadows=n,c.receiveShadows=i}}}function aVe(e){let t=e.backFaceCulling,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.updateBackFaceCulling){let s=r.command,a=Ge(s.renderState,!0);a.cull.enabled=t,s.renderState=Ue.fromCache(a)}}}function cVe(e){let t=e.cullFace,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.updateCullFace){let s=r.command,a=Ge(s.renderState,!0);a.cull.face=t,s.renderState=Ue.fromCache(a)}}}function lVe(e){let t=e.debugShowBoundingVolume,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(r.updateDebugShowBoundingVolume){let s=r.command;s.debugShowBoundingVolume=t}}}jV.prototype.pushCommands=function(e,t){let n=yie(this,e);n&&!this._has2DCommands&&(uVe(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(rVe(this,e),this._modelMatrix2DDirty=!1);let i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&u(i)&&(i!==md.ALL_OPAQUE&&YT(t,this._translucentCommand,n),i===md.ALL_TRANSLUCENT))){if(this._needsSkipLevelOfDetailCommands){let o=this._model.content,r=o.tileset,s=o.tile,a=r._hasMixedContent,c=s._finalResolution;if(a){c||YT(r._backfaceCommands,this._skipLodBackfaceCommand,n),mVe(this,s,n),YT(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){YT(t,this._silhouetteModelCommand,n);return}return YT(t,this._originalCommand,n),t}};jV.prototype.pushSilhouetteCommands=function(e,t){let n=yie(this,e);return YT(t,this._silhouetteColorCommand,n),t};function YT(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function yie(e,t){if(t.mode!==te.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*P.PI;return o<s&&r>s||o<-s&&r>-s}function jT(e,t){if(!u(t))return;let n=wp.clone(t),i=tt.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 uVe(e){jT(e,e._originalCommand),jT(e,e._translucentCommand),jT(e,e._skipLodBackfaceCommand),jT(e,e._skipLodStencilCommand),jT(e,e._silhouetteModelCommand),jT(e,e._silhouetteColorCommand)}function fVe(e){let t=tt.shallowClone(e);t.pass=Ee.TRANSLUCENT;let n=Ge(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=un.ALPHA_BLEND,t.renderState=Ue.fromCache(n),t}function dVe(e,t){let n=t._silhouetteId%255,i=tt.shallowClone(e),o=Ge(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:ee.ALWAYS,backFunction:ee.ALWAYS,reference:n,mask:-1,frontOperation:{fail:ee.KEEP,zFail:ee.KEEP,zPass:ee.REPLACE},backOperation:{fail:ee.KEEP,zFail:ee.KEEP,zPass:ee.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=Ue.fromCache(o),i}function hVe(e,t){let n=t._silhouetteId%255,i=tt.shallowClone(e),o=Ge(e.renderState,!0);o.cull.enabled=!1,(e.pass===Ee.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=Ee.TRANSLUCENT,o.depthMask=!1,o.blending=un.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:ee.NOTEQUAL,backFunction:ee.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:ee.KEEP,zFail:ee.KEEP,zPass:ee.KEEP},backOperation:{fail:ee.KEEP,zFail:ee.KEEP,zPass:ee.KEEP}};let s=Ge(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=Ue.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function mVe(e,t,n){let i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=pVe(o);if(r!==s){let a=_Ve(r),c=Ge(o.renderState,!0);c.stencilTest.reference=a,o.renderState=Ue.fromCache(c),n&&(i.derivedCommand2D.renderState=c)}}function pVe(e){return(e.renderState.stencilTest.reference&Bt.SKIP_LOD_MASK)>>>Bt.SKIP_LOD_BIT_SHIFT}function _Ve(e){return Bt.CESIUM_3D_TILE_MASK|e<<Bt.SKIP_LOD_BIT_SHIFT}function gVe(e){let t=tt.shallowClone(e),n=Ge(e.renderState,!0);n.cull.enabled=!0,n.cull.face=gi.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};let i=Ge(t.uniformMap),o=new H(5,5);return i.u_polygonOffset=function(){return o},t.renderState=Ue.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function yVe(e){let t=tt.shallowClone(e),n=Ge(e.renderState,!0);return n.stencilTest.enabled=!0,n.stencilTest.mask=Bt.SKIP_LOD_MASK,n.stencilTest.reference=Bt.CESIUM_3D_TILE_MASK,n.stencilTest.frontFunction=kn.GREATER_OR_EQUAL,n.stencilTest.frontOperation.zPass=ut.REPLACE,n.stencilTest.backFunction=kn.GREATER_OR_EQUAL,n.stencilTest.backOperation.zPass=ut.REPLACE,n.stencilMask=Bt.CESIUM_3D_TILE_MASK|Bt.SKIP_LOD_MASK,t.renderState=Ue.fromCache(n),t}var b1=jV;function AVe(e,t){let n=e.shaderBuilder;n.addVertexLines(C1),n.addFragmentLines(x1);let i=xVe(e),o=new oi({context:t.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);let s=n.buildShaderProgram(t.context);r._pipelineResources.push(s);let a=e.alphaOptions.pass,c=r.sceneGraph,l=t.mode===te.SCENE3D,f,d;if(!l&&!t.scene3DOnly&&r._projectTo2D)f=M.multiplyTransformation(c._computedModelMatrix,e.runtimeNode.computedTransform,new M),d=e.runtimePrimitive.boundingSphere2D;else{let T=l?c._computedModelMatrix:c._computedModelMatrix2D;f=M.multiplyTransformation(T,e.runtimeNode.computedTransform,new M),d=se.transform(e.boundingSphere,f,e.boundingSphere)}let p=Ge(Ue.fromCache(e.renderStateOptions),!0);p.cull.face=sn.getCullFace(f,e.primitiveType),p=Ue.fromCache(p);let g=u(r.classificationType),m=g?!1:gn.castShadows(r.shadows),A=g?!1:gn.receiveShadows(r.shadows),x=g?void 0:e.pickId,C=new tt({boundingVolume:d,modelMatrix:f,uniformMap:e.uniformMap,renderState:p,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:x,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:m,receiveShadows:A});return g?new E1({primitiveRenderResources:e,command:C}):new b1({primitiveRenderResources:e,command:C})}function xVe(e){let t=e.wireframeIndexBuffer;if(u(t))return t;let n=e.indices;if(u(n))return n.buffer}var S1=AVe;var Aie={name:"TilesetPipelineStage"};Aie.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,Te.FRAGMENT);let r={u_polygonOffset:function(){return H.ZERO}};e.uniformMap=_t(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}let i=e.renderStateOptions;i.stencilTest=Bt.setCesium3DTileBit(),i.stencilMask=Bt.CESIUM_3D_TILE_MASK};var D1=Aie;var v1=`vec3 proceduralIBL(
    vec3 positionEC,
    vec3 normalEC,
    vec3 lightDirectionEC,
    vec3 lightColorHdr,
    czm_pbrParameters pbrParameters
) {
    vec3 v = -positionEC;
    vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));
    vec3 vWC = -normalize(positionWC);
    vec3 l = normalize(lightDirectionEC);
    vec3 n = normalEC;
    vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));

    float NdotL = clamp(dot(n, l), 0.001, 1.0);
    float NdotV = abs(dot(n, v)) + 0.001;

    // Figure out if the reflection vector hits the ellipsoid
    float vertexRadius = length(positionWC);
    float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);
    float reflectionDotNadir = dot(r, normalize(positionWC));
    // Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.
    r.x = -r.x;
    r = -normalize(czm_temeToPseudoFixed * r);
    r.x = -r.x;

    vec3 diffuseColor = pbrParameters.diffuseColor;
    float roughness = pbrParameters.roughness;
    vec3 specularColor = pbrParameters.f0;

    float inverseRoughness = 1.04 - roughness;
    inverseRoughness *= inverseRoughness;
    vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, r).rgb * inverseRoughness;

    float atmosphereHeight = 0.05;
    float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);
    float blendRegionOffset = roughness * -1.0;
    float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);
    float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);
    float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);
    float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);
    vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);
    vec3 nadirColor = belowHorizonColor * 0.5;
    vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);
    vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);
    vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);
    vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9); 
    float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;  
    float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));
    vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);
    float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);
    vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);
    specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);
    specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);

    // Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf
    #ifdef USE_SUN_LUMINANCE 
    // Angle between sun and zenith
    float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);
    float S = acos(LdotZenith);
    // Angle between zenith and current pixel
    float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);
    // Angle between sun and current pixel
    float gamma = acos(NdotL);
    float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));
    float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));
    float luminance = model_luminanceAtZenith * (numerator / denominator);
    #endif 

    vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
    vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);
    float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);
    vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);
    iblColor *= lightColor;

    #ifdef USE_SUN_LUMINANCE 
    iblColor *= luminance;
    #endif

    return iblColor;
}

#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
vec3 textureIBL(
    vec3 positionEC,
    vec3 normalEC,
    vec3 lightDirectionEC,
    czm_pbrParameters pbrParameters
) {
    vec3 diffuseColor = pbrParameters.diffuseColor;
    float roughness = pbrParameters.roughness;
    vec3 specularColor = pbrParameters.f0;

    vec3 v = -positionEC;
    vec3 n = normalEC;
    vec3 l = normalize(lightDirectionEC);
    vec3 h = normalize(v + l);

    float NdotV = abs(dot(n, v)) + 0.001;
    float VdotH = clamp(dot(v, h), 0.0, 1.0);

    const mat3 yUpToZUp = mat3(
        -1.0, 0.0, 0.0,
        0.0, 0.0, -1.0, 
        0.0, 1.0, 0.0
    ); 
    vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n))); 

    #ifdef DIFFUSE_IBL 
        #ifdef CUSTOM_SPHERICAL_HARMONICS
        vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); 
        #else
        vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); 
        #endif 
    #else 
    vec3 diffuseIrradiance = vec3(0.0); 
    #endif 

    #ifdef SPECULAR_IBL
    vec3 r0 = specularColor.rgb;
    float reflectance = max(max(r0.r, r0.g), r0.b);
    vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
    vec3 F = fresnelSchlick2(r0, r90, VdotH);
    
    vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
      #ifdef CUSTOM_SPECULAR_IBL 
      vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);
      #else 
      vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir,  roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);
      #endif 
    specularIBL *= F * brdfLut.x + brdfLut.y;
    #else 
    vec3 specularIBL = vec3(0.0); 
    #endif

    return diffuseColor * diffuseIrradiance + specularColor * specularIBL;
}
#endif

vec3 imageBasedLightingStage(
    vec3 positionEC,
    vec3 normalEC,
    vec3 lightDirectionEC,
    vec3 lightColorHdr,
    czm_pbrParameters pbrParameters
) {
  #if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
  // Environment maps were provided, use them for IBL
  return textureIBL(
      positionEC,
      normalEC,
      lightDirectionEC,
      pbrParameters
  );
  #else
  // Use the procedural IBL if there are no environment maps
  return proceduralIBL(
      positionEC,
      normalEC,
      lightDirectionEC,
      lightColorHdr,
      pbrParameters
  );
  #endif
}`;var xie={name:"ImageBasedLightingPipelineStage"};xie.process=function(e,t,n){let i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,Te.FRAGMENT),o.addUniform("vec2","model_iblFactor",Te.FRAGMENT),id.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",Te.FRAGMENT),u(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,Te.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,Te.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",Te.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,Te.FRAGMENT),u(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,Te.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,Te.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",Te.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",Te.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",Te.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,Te.FRAGMENT)),u(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,Te.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",Te.FRAGMENT)),o.addFragmentLines(v1);let r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=_t(r,e.uniformMap)};var w1=xie;var CVe=P.EPSILON16;function q5(e){e=y(e,y.EMPTY_OBJECT);let t=e.stage,n=e.runtimeArticulation;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(q5.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){e=P.clamp(e,this.minimumValue,this.maximumValue),P.equalsEpsilon(this._currentValue,e,CVe)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});var TVe=new h,Y5=new Z;q5.prototype.applyStageToMatrix=function(e){let t=this.type,n=this.currentValue,i=TVe,o;switch(t){case Ya.XROTATE:o=Z.fromRotationX(P.toRadians(n),Y5),e=M.multiplyByMatrix3(e,o,e);break;case Ya.YROTATE:o=Z.fromRotationY(P.toRadians(n),Y5),e=M.multiplyByMatrix3(e,o,e);break;case Ya.ZROTATE:o=Z.fromRotationZ(P.toRadians(n),Y5),e=M.multiplyByMatrix3(e,o,e);break;case Ya.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=M.multiplyByTranslation(e,i,e);break;case Ya.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=M.multiplyByTranslation(e,i,e);break;case Ya.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=M.multiplyByTranslation(e,i,e);break;case Ya.XSCALE:i.x=n,i.y=1,i.z=1,e=M.multiplyByScale(e,i,e);break;case Ya.YSCALE:i.x=1,i.y=n,i.z=1,e=M.multiplyByScale(e,i,e);break;case Ya.ZSCALE:i.x=1,i.y=1,i.z=n,e=M.multiplyByScale(e,i,e);break;case Ya.UNIFORMSCALE:e=M.multiplyByUniformScale(e,n,e);break;default:break}return e};var I1=q5;function YV(e){e=y(e,y.EMPTY_OBJECT);let t=e.articulation,n=e.sceneGraph;this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,EVe(this)}Object.defineProperties(YV.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 EVe(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],c=new I1({stage:a,runtimeArticulation:e});o.push(c);let l=a.name;r[l]=c}}YV.prototype.setArticulationStage=function(e,t){let n=this._runtimeStagesByName[e];u(n)&&(n.currentValue=t)};var bVe=new M,SVe=new M;YV.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=M.clone(M.IDENTITY,bVe),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=M.multiplyTransformation(s.originalTransform,e,SVe);s.transform=a}};var P1=YV;var O1=`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 qT={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};qT.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,Te.FRAGMENT),i.addFragmentLines(O1);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=Ee.TRANSLUCENT),i.addUniform("vec4",qT.COLOR_UNIFORM_NAME,Te.FRAGMENT),o[qT.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",qT.COLOR_BLEND_UNIFORM_NAME,Te.FRAGMENT),o[qT.COLOR_BLEND_UNIFORM_NAME]=function(){return ja.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=_t(o,e.uniformMap)};var Og=qT;var R1=`#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; // sample from center of pixel
    float v = (float(pixY) + 0.5) * pixelHeight;
    vec4 plane = texture(packedClippingPlanes, vec2(u, v));
    return czm_transformPlane(plane, transform);
}
#else
// Handle uint8 clipping texture instead
vec4 getClippingPlane(
    highp sampler2D packedClippingPlanes,
    int clippingPlaneNumber,
    mat4 transform
) {
    int clippingPlaneStartIndex = clippingPlaneNumber * 2; // clipping planes are two pixels each
    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; // sample from center of pixel
    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; // For union planes, we want to get the min distance. So we set the initial value to the first plane distance in the loop below.
    #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 Cie={name:"ModelClippingPlanesPipelineStage"},DVe=new H;Cie.process=function(e,t,n){let i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,Te.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,Te.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,Te.FRAGMENT),ss.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,Te.FRAGMENT);let s=ss.getTextureResolution(i,o,DVe);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,Te.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,Te.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",Te.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",Te.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",Te.FRAGMENT),r.addFragmentLines(R1);let a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){let c=z.clone(i.edgeColor);return c.alpha=i.edgeWidth,c},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=_t(a,e.uniformMap)};var B1=Cie;function Tie(e,t){this._model=e,this._runtimeNode=t}Object.defineProperties(Tie.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){u(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 M1=Tie;var L1=`mat4 getInstancingTransform()
{
    mat4 instancingTransform;

    #ifdef HAS_INSTANCE_MATRICES
    instancingTransform = mat4(
        a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1
        a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2
        a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3
        a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0  // Column 4
    );
    #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, // Column 1
        a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0, // Column 2
        a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0, // Column 3
        a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0  // Column 4
    );
    #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 N1=`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 F1=`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 qV=new M,vVe=new M,wVe=new M,bie={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:Iie,_transformsToTypedArray:K5};bie.process=function(e,t,n){let i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(L1);let s=e.model,a=s.sceneGraph,c=e.runtimeNode,l=n.mode!==te.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,f=[];GVe(e,n,i,f,l),YVe(e,n,i,f);let d={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,Te.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",Te.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",Te.VERTEX),d.u_instance_modifiedModelView=function(){let p=M.multiplyTransformation(s.modelMatrix,a.components.transform,qV);return l?M.multiplyTransformation(n.context.uniformState.view3D,p,qV):(n.mode!==te.SCENE3D&&(p=Ot.basisTo2D(n.mapProjection,p,qV)),M.multiplyTransformation(n.context.uniformState.view,p,qV))},d.u_instance_nodeTransform=function(){return M.multiplyTransformation(a.axisCorrectionMatrix,c.computedTransform,vVe)},r.addVertexLines(F1)):r.addVertexLines(N1),l){r.addDefine("USE_2D_INSTANCING",void 0,Te.VERTEX),r.addUniform("mat4","u_modelView2D",Te.VERTEX);let p=n.context,g=M.fromTranslation(c.instancingReferencePoint2D,new M);d.u_modelView2D=function(){return M.multiplyTransformation(p.uniformState.view,g,wVe)}}e.uniformMap=_t(d,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};var V1=new M,IVe=new h;function PVe(e,t,n,i,o){let r=M.multiplyTransformation(t,e,V1);return r=M.multiplyTransformation(r,n,V1),o=Ot.basisTo2D(i.mapProjection,r,o),o}function OVe(e,t,n,i,o){let r=M.fromTranslation(e,V1),s=M.multiplyTransformation(t,r,V1);s=M.multiplyTransformation(s,n,V1);let a=M.getTranslation(s,IVe);return o=qi.computeActualWgs84Position(i,a,o),o}function Sie(e,t,n){let i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=M.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=M.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=M.clone(o.computedModelMatrix,t),t=M.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=M.clone(M.IDENTITY,n))}var Die=new M,vie=new M,RVe=new M,BVe=new h;function MVe(e,t,n,i){let o=Die,r=vie;Sie(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let l=0;l<c;l++){let f=e[l],d=PVe(f,o,r,n,RVe),p=M.getTranslation(d,BVe),g=h.subtract(p,a,p);i[l]=M.setTranslation(d,g,i[l])}return i}function LVe(e,t,n,i){let o=Die,r=vie;Sie(t,o,r);let a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let l=0;l<c;l++){let f=e[l],d=OVe(f,o,r,n,f);i[l]=h.subtract(d,a,i[l])}return i}var NVe=new h,FVe=new h;function wie(e,t){let n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=M.multiplyByPoint(i,n.instancingTranslationMin,NVe),r=qi.computeActualWgs84Position(t,o,o),s=M.multiplyByPoint(i,n.instancingTranslationMax,FVe),a=qi.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=h.lerp(r,a,.5,new h)}function K5(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 VVe(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 UVe=new h,kVe=new Le,zVe=new h;function Iie(e,t,n){let i=new Array(t),o=sn.getAttributeBySemantic(e,zr.TRANSLATION),r=sn.getAttributeBySemantic(e,zr.ROTATION),s=sn.getAttributeBySemantic(e,zr.SCALE),a=new h(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new h(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),l=u(o),f=u(r),d=u(s),p=l?o.typedArray:new Float32Array(t*3),g=f?r.typedArray:new Float32Array(t*4);f&&r.normalized&&(g=Gn.dequantize(g,r.componentDatatype,r.type,t));let m;d?m=s.typedArray:(m=new Float32Array(t*3),m.fill(1));for(let x=0;x<t;x++){let C=new h(p[x*3],p[x*3+1],p[x*3+2],UVe);h.maximumByComponent(a,C,a),h.minimumByComponent(c,C,c);let T=new Le(g[x*4],g[x*4+1],g[x*4+2],f?g[x*4+3]:1,kVe),E=new h(m[x*3],m[x*3+1],m[x*3+2],zVe),S=M.fromTranslationQuaternionRotationScale(C,T,E,new M);i[x]=S}let A=n.runtimeNode;return A.instancingTranslationMin=c,A.instancingTranslationMax=a,l&&(o.typedArray=void 0),f&&(r.typedArray=void 0),d&&(s.typedArray=void 0),i}function HVe(e,t,n){let i=new Array(t),o=e.typedArray,r=new h(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new h(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let c=0;c<t;c++){let l=new h(o[c*3],o[c*3+1],o[c*3+2]);i[c]=l,h.minimumByComponent(r,l,r),h.maximumByComponent(s,l,s)}let a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function Z5(e,t){let n=lt.createVertexBuffer({context:t.context,typedArray:e,usage:Ne.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function GVe(e,t,n,i,o){let r=sn.getAttributeBySemantic(n,zr.ROTATION);u(r)?WVe(e,n,i,t,o):jVe(e,n,i,t,o)}function WVe(e,t,n,i,o){let r=e.shaderBuilder,s=t.attributes[0].count,a=e.model,c=e.runtimeNode;r.addDefine("HAS_INSTANCE_MATRICES");let l="Transform",f,d=c.instancingTransformsBuffer;if(!u(d)){f=Iie(t,s,e);let A=K5(f);d=Z5(A,i),a._modelResources.push(d),c.instancingTransformsBuffer=d}if(Eie(e,d,n,l),!o)return;let p=Ge(i);p.mode=te.COLUMBUS_VIEW,wie(e,p);let g=c.instancingTransformsBuffer2D;if(!u(g)){let A=MVe(f,e,p,f),x=K5(A);g=Z5(x,i),a._modelResources.push(g),c.instancingTransformsBuffer2D=g}Eie(e,g,n,"Transform2D")}function jVe(e,t,n,i,o){let r=e.shaderBuilder,s=e.runtimeNode,a=sn.getAttributeBySemantic(t,zr.TRANSLATION),c=sn.getAttributeBySemantic(t,zr.SCALE);if(u(c)){r.addDefine("HAS_INSTANCE_SCALE");let C="Scale";X5(e,c.buffer,c.byteOffset,c.byteStride,n,C)}if(!u(a))return;let l,f=a.typedArray;u(f)?l=HVe(a,a.count,e):u(s.instancingTranslationMin)||(s.instancingTranslationMin=a.min,s.instancingTranslationMax=a.max),r.addDefine("HAS_INSTANCE_TRANSLATION");let d="Translation";if(X5(e,a.buffer,a.byteOffset,a.byteStride,n,d),!o)return;let p=Ge(i);p.mode=te.COLUMBUS_VIEW,wie(e,p);let g=s.instancingTranslationBuffer2D;if(!u(g)){let C=LVe(l,e,p,l),T=VVe(C);g=Z5(T,i),e.model._modelResources.push(g),s.instancingTranslationBuffer2D=g}X5(e,g,0,void 0,n,"Translation2D")}function Eie(e,t,n,i){let r=q.getSizeInBytes(q.FLOAT),s=r*12,a=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:q.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:q.FLOAT,normalize:!1,offsetInBytes:r*4,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:q.FLOAT,normalize:!1,offsetInBytes:r*8,strideInBytes:s,instanceDivisor:1}],c=e.shaderBuilder;c.addAttribute("vec4",`a_instancing${i}Row0`),c.addAttribute("vec4",`a_instancing${i}Row1`),c.addAttribute("vec4",`a_instancing${i}Row2`),n.push.apply(n,a)}function X5(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:q.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1}),e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}function YVe(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===zr.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:rn.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}var U1=bie;var J5={};J5.name="ModelMatrixUpdateStage";J5.update=function(e,t,n){let i=n.mode!==te.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){let o=i?t._computedModelMatrix2D:t._computedModelMatrix;Pie(e,t,o,e.transformToRoot),e._transformDirty=!1}};function Pie(e,t,n,i){let o;i=M.multiplyTransformation(i,e.transform,new M),e.updateComputedTransform();let r=e.runtimePrimitives.length;for(o=0;o<r;o++){let c=e.runtimePrimitives[o].drawCommand;c.modelMatrix=M.multiplyTransformation(n,i,c.modelMatrix),c.cullFace=sn.getCullFace(c.modelMatrix,c.primitiveType)}let s=e.children.length;for(o=0;o<s;o++){let a=t._runtimeNodes[e.children[o]];a._transformToRoot=M.clone(i,a._transformToRoot),Pie(a,t,n,i),a._transformDirty=!1}}var k1=J5;var Oie={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:Rie,_countGeneratedBuffers:Bie};Oie.process=function(e,t,n){let i=e.model.statistics,o=t.instances,r=e.runtimeNode;Rie(i,o),Bie(i,r)};function Rie(e,t){if(!u(t))return;let n=t.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];u(r.buffer)&&e.addBuffer(r.buffer,!1)}}function Bie(e,t){u(t.instancingTransformsBuffer)&&e.addBuffer(t.instancingTransformsBuffer,!1),u(t.instancingTransformsBuffer2D)&&e.addBuffer(t.instancingTransformsBuffer2D,!1),u(t.instancingTranslationBuffer2D)&&e.addBuffer(t.instancingTranslationBuffer2D,!1)}var z1=Oie;function XT(e){e=y(e,y.EMPTY_OBJECT);let t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=M.clone(n,this._originalTransform),this._transform=M.clone(n,this._transform),this._transformToRoot=M.clone(i,this._transformToRoot),this._computedTransform=new M,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,qVe(this)}Object.defineProperties(XT.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=M.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 u(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){let t=this._transformParameters,n=t.translation;h.equals(n,e)||(t.translation=h.clone(e,t.translation),Q5(this,t))}},rotation:{get:function(){return u(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){let t=this._transformParameters,n=t.rotation;Le.equals(n,e)||(t.rotation=Le.clone(e,t.rotation),Q5(this,t))}},scale:{get:function(){return u(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){let t=this._transformParameters,n=t.scale;h.equals(n,e)||(t.scale=h.clone(e,t.scale),Q5(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){let t=e.length;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 qVe(e){let t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=M.multiply(n,t,i);let o=e.node;u(o.matrix)||(e._transformParameters=new rg(o.translation,o.rotation,o.scale)),u(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());let r=o.articulationName;if(u(r)){let c=e.sceneGraph._runtimeArticulations[r];u(c)&&c.runtimeNodes.push(e)}}function Q5(e,t){e._transformDirty=!0,e._transform=M.fromTranslationRotationScale(t,e._transform)}XT.prototype.getChild=function(e){return this.sceneGraph._runtimeNodes[this.children[e]]};XT.prototype.configurePipeline=function(){let e=this.node,t=this.pipelineStages;t.length=0;let n=this.updateStages;n.length=0,u(e.instances)&&t.push(U1),t.push(z1),n.push(k1)};XT.prototype.updateComputedTransform=function(){this._computedTransform=M.multiply(this._transformToRoot,this._transform,this._computedTransform)};XT.prototype.updateJointMatrices=function(){let e=this._runtimeSkin;if(!u(e))return;e.updateJointMatrices();let t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){u(t[o])||(t[o]=new M);let r=M.multiplyTransformation(this.transformToRoot,this.transform,t[o]),s=M.inverseTransformation(r,t[o]);t[o]=M.multiplyTransformation(s,n[o],t[o])}};var H1=XT;var Mie={name:"AlphaPipelineStage"};Mie.process=function(e,t,n){let i=e.alphaOptions,o=e.model;i.pass=y(i.pass,o.opaquePass);let r=e.renderStateOptions;i.pass===Ee.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=un.ALPHA_BLEND);let s=e.shaderBuilder,a=e.uniformMap;u(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,Te.FRAGMENT),s.addUniform("float","u_alphaCutoff",Te.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};var G1=Mie;var Lie={name:"BatchTexturePipelineStage"};Lie.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 c=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return y(c.batchTexture,c.defaultTexture)},i.addUniform("vec4","model_textureStep"),o.model_textureStep=function(){return c.textureStep},c.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return c.textureDimensions}),e.uniformMap=_t(o,e.uniformMap)};var W1=Lie;var Nie={name:"ClassificationPipelineStage"};Nie.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,Te.BOTH);let o=e.runtimePrimitive;u(o.batchLengths)||XVe(t,o)};function XVe(e,t){let n=sn.getAttributeBySemantic(e,Ct.POSITION);if(!u(n))throw new ue("Primitives must have a position attribute to be used for classification.");let i,o=e.indices,r=u(o);r&&(i=o.typedArray,o.typedArray=void 0);let s=r?o.count:n.count,a=sn.getAttributeBySemantic(e,Ct.FEATURE_ID,0);if(!u(a)){t.batchLengths=[s],t.batchOffsets=[0];return}let c=a.typedArray;a.typedArray=void 0;let l=[],f=[0],d=r?i[0]:0,p=c[d],g=0;for(let A=1;A<s;A++){let x=r?i[A]:A,C=c[x];if(C!==p){let T=A-g,E=A;l.push(T),f.push(E),g=E,p=C}}let m=s-g;l.push(m),t.batchLengths=l,t.batchOffsets=f}var j1=Nie;var Y1=`void filterByPassType(inout vec3 positionMC, vec4 featureColor)
{
    bool styleTranslucent = (featureColor.a != 1.0);
    // Only render translucent features in the translucent pass (if the style or the original command has translucency).
    if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
    {
        // If the model has a translucent silhouette, it needs to render during the silhouette color command,
        // (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
        #ifdef HAS_SILHOUETTE
        positionMC *= float(model_silhouettePass);
        #else
        positionMC *= 0.0;
        #endif
    }
    // If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
    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 q1=`void filterByPassType(vec4 featureColor)
{
    bool styleTranslucent = (featureColor.a != 1.0);
    // Only render translucent features in the translucent pass (if the style or the original command has translucency).
    if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
    {   
        // If the model has a translucent silhouette, it needs to render during the silhouette color command,
        // (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
        #ifdef HAS_SILHOUETTE
        if(!model_silhouettePass) {
            discard;
        }
        #else
        discard;
        #endif
    }
    // If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
    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 a feature ID vertex attribute is used, the pass type filter is applied in the vertex shader.
    // So, we only apply in in the fragment shader if the feature ID texture is used.
    #if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)
    filterByPassType(featureColor);
    #endif

    featureColor = czm_gammaCorrect(featureColor);

    // Classification models compute the diffuse differently.
    #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 Fie={name:"CPUStylingPipelineStage"};Fie.process=function(e,t,n){let i=e.model,o=e.shaderBuilder;o.addVertexLines(Y1),o.addFragmentLines(q1),o.addDefine("USE_CPU_STYLING",void 0,Te.BOTH),u(i.color)||(o.addUniform("float",Og.COLOR_BLEND_UNIFORM_NAME,Te.FRAGMENT),e.uniformMap[Og.COLOR_BLEND_UNIFORM_NAME]=function(){return ja.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",Te.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Ee.TRANSLUCENT}};var X1=Fie;var Vie={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};Vie.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};var Ip=Object.freeze(Vie);var K1=`void customShaderStage(
    inout czm_modelVertexOutput vsOutput, 
    inout ProcessedAttributes attributes, 
    FeatureIds featureIds,
    Metadata metadata,
    MetadataClass metadataClass,
    MetadataStatistics metadataStatistics
) {
    // VertexInput and initializeInputStruct() are dynamically generated in JS, 
    // see CustomShaderPipelineStage.js
    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 Z1=`void customShaderStage(
    inout czm_modelMaterial material,
    ProcessedAttributes attributes,
    FeatureIds featureIds,
    Metadata metadata,
    MetadataClass metadataClass,
    MetadataStatistics metadataStatistics
) {
    // FragmentInput and initializeInputStruct() are dynamically generated in JS, 
    // see CustomShaderPipelineStage.js
    FragmentInput fsInput;
    initializeInputStruct(fsInput, attributes);
    fsInput.featureIds = featureIds;
    fsInput.metadata = metadata;
    fsInput.metadataClass = metadataClass;
    fsInput.metadataStatistics = metadataStatistics;
    fragmentMain(fsInput, material);
}
`;var J1=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
  initializeFeatureIds(featureIds, attributes);
  initializeFeatureIdAliases(featureIds);
}
`;var Q1=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) 
{
  initializeFeatureIds(featureIds, attributes);
  initializeFeatureIdAliases(featureIds);
  setFeatureIdVaryings();
}
`;var Bi={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()"};Bi.process=function(e,t,n){let i=e.shaderBuilder;KVe(i);let o=e.runtimeNode.node.instances;u(o)&&ZVe(e,o,n),JVe(e,t,n),i.addVertexLines(Q1),i.addFragmentLines(J1)};function KVe(e){e.addStruct(Bi.STRUCT_ID_FEATURE_IDS_VS,Bi.STRUCT_NAME_FEATURE_IDS,Te.VERTEX),e.addStruct(Bi.STRUCT_ID_FEATURE_IDS_FS,Bi.STRUCT_NAME_FEATURE_IDS,Te.FRAGMENT),e.addFunction(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,Bi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Te.VERTEX),e.addFunction(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,Bi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,Te.FRAGMENT),e.addFunction(Bi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,Bi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Te.VERTEX),e.addFunction(Bi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,Bi.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,Te.FRAGMENT),e.addFunction(Bi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,Bi.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,Te.VERTEX)}function ZVe(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 Rt.FeatureIdAttribute?QVe(e,s,a):Uie(e,s,a,o,1,n);let c=s.label;u(c)&&kie(e,a,c,Te.BOTH)}}function JVe(e,t,n){let i=t.featureIds,r=sn.getAttributeBySemantic(t,Ct.POSITION).count;for(let s=0;s<i.length;s++){let a=i[s],c=a.positionalLabel,l=Te.BOTH;a instanceof Rt.FeatureIdAttribute?$Ve(e,a,c):a instanceof Rt.FeatureIdImplicitRange?Uie(e,a,c,r,void 0,n):(eUe(e,a,c,s,n),l=Te.FRAGMENT);let f=a.label;u(f)&&kie(e,c,f,l)}}function QVe(e,t,n){let i=e.shaderBuilder;i.addStructField(Bi.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Bi.STRUCT_ID_FEATURE_IDS_FS,"int",n);let o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,c=`featureIds.${n} = int(czm_round(${s}));`,l=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[l]),i.addVarying("float",a),i.addFunctionLines(Bi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function $Ve(e,t,n){let i=e.shaderBuilder;i.addStructField(Bi.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Bi.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(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function Uie(e,t,n,i,o,r){tUe(e,t,i,o,r);let s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);let c=`v_implicit_${n}`;s.addVarying("float",c),s.addStructField(Bi.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(Bi.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(Bi.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function eUe(e,t,n,i,o){let r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return y(a.texture,o.context.defaultTexture)};let c=a.channels,l=e.shaderBuilder;l.addStructField(Bi.STRUCT_ID_FEATURE_IDS_FS,"int",n),l.addUniform("sampler2D",r,Te.FRAGMENT);let f=`v_texCoord_${a.texCoord}`,d=`texture(${r}, ${f}).${c}`,p=`featureIds.${n} = czm_unpackUint(${d});`;l.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[p])}function kie(e,t,n,i){let o=e.shaderBuilder,r=Te.includesVertexShader(i);r&&o.addStructField(Bi.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(Bi.STRUCT_ID_FEATURE_IDS_FS,"int",n);let s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(Bi.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function tUe(e,t,n,i,o){let r=e.model,s,a;if(u(t.repeat)){let l=nUe(t,n);s=lt.createVertexBuffer({context:o.context,typedArray:l,usage:Ne.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);let f=!1;r.statistics.addBuffer(s,f)}else a=[t.offset];let c={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:q.FLOAT,strideInBytes:q.getSizeInBytes(q.FLOAT),offsetInBytes:0};e.attributes.push(c)}function nUe(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 Rg=Bi;var $1=`void metadataStage(
  out Metadata metadata,
  out MetadataClass metadataClass,
  out MetadataStatistics metadataStatistics,
  ProcessedAttributes attributes
  )
{
  initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
}
`;var eO=`void metadataStage(
  out Metadata metadata,
  out MetadataClass metadataClass,
  out MetadataStatistics metadataStatistics,
  ProcessedAttributes attributes
  )
{
  initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
  setMetadataVaryings();
}
`;var xi={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"}]};xi.process=function(e,t,n){let{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=s?.tileset.metadataExtension?.statistics,c=iUe(r.propertyAttributes,t,a),l=rUe(r.propertyTextures,a),f=c.concat(l);aUe(i,f),uUe(i),i.addVertexLines(eO),i.addFragmentLines($1);for(let d=0;d<c.length;d++){let p=c[d];fUe(e,p)}for(let d=0;d<l.length;d++){let p=l[d];hUe(e,p)}};function iUe(e,t,n){return u(e)?e.flatMap(i=>oUe(i,t,n)):[]}function oUe(e,t,n){let{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=sn,s=e.class.id,a=n?.classes[s],c=Object.entries(e.properties),l=new Array(c.length);for(let f=0;f<c.length;f++){let[d,p]=c[f],g=i(t,p.attribute),{glslType:m,variableName:A}=o(g);l[f]={metadataVariable:r(d),property:p,type:p.classProperty.type,glslType:m,variableName:A,propertyStatistics:a?.properties[d],shaderDestination:Te.BOTH}}return l}function rUe(e,t){return u(e)?e.flatMap(n=>sUe(n,t)):[]}function sUe(e,t){let{sanitizeGlslIdentifier:n}=sn,i=e.class.id,o=t?.classes[i],r=Object.entries(e.properties).filter(([a,c])=>c.isGpuCompatible()),s=new Array(r.length);for(let a=0;a<r.length;a++){let[c,l]=r[a];s[a]={metadataVariable:n(c),property:l,type:l.classProperty.type,glslType:l.getGlslType(),propertyStatistics:o?.properties[c],shaderDestination:Te.FRAGMENT}}return s}function aUe(e,t){let n=new Set,i=new Set;for(let a=0;a<t.length;a++){let{type:c,glslType:l,propertyStatistics:f}=t[a];n.add(l),u(f)&&c!==zt.ENUM&&i.add(l)}let o=xi.METADATA_CLASS_FIELDS;for(let a of n){let c=`${a}MetadataClass`;s(c,a,o)}let r=xi.METADATA_STATISTICS_FIELDS;for(let a of i){let c=`${a}MetadataStatistics`;s(c,a,r)}function s(a,c,l){e.addStruct(a,a,Te.BOTH);for(let f=0;f<l.length;f++){let{shaderName:d}=l[f],p=l[f].type==="float"?lUe(c):c;e.addStructField(a,p,d)}}}var cUe={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function lUe(e){let t=cUe[e];return u(t)?t:e}function uUe(e){e.addStruct(xi.STRUCT_ID_METADATA_VS,xi.STRUCT_NAME_METADATA,Te.VERTEX),e.addStruct(xi.STRUCT_ID_METADATA_FS,xi.STRUCT_NAME_METADATA,Te.FRAGMENT),e.addStruct(xi.STRUCT_ID_METADATA_CLASS_VS,xi.STRUCT_NAME_METADATA_CLASS,Te.VERTEX),e.addStruct(xi.STRUCT_ID_METADATA_CLASS_FS,xi.STRUCT_NAME_METADATA_CLASS,Te.FRAGMENT),e.addStruct(xi.STRUCT_ID_METADATA_STATISTICS_VS,xi.STRUCT_NAME_METADATA_STATISTICS,Te.VERTEX),e.addStruct(xi.STRUCT_ID_METADATA_STATISTICS_FS,xi.STRUCT_NAME_METADATA_STATISTICS,Te.FRAGMENT),e.addFunction(xi.FUNCTION_ID_INITIALIZE_METADATA_VS,xi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Te.VERTEX),e.addFunction(xi.FUNCTION_ID_INITIALIZE_METADATA_FS,xi.FUNCTION_SIGNATURE_INITIALIZE_METADATA,Te.FRAGMENT),e.addFunction(xi.FUNCTION_ID_SET_METADATA_VARYINGS,xi.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,Te.VERTEX)}function fUe(e,t){dUe(e,t),zie(e.shaderBuilder,t),Hie(e.shaderBuilder,t)}function dUe(e,t){let{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=Wie({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:Te.BOTH,property:o});n.addStructField(xi.STRUCT_ID_METADATA_VS,r,i),n.addStructField(xi.STRUCT_ID_METADATA_FS,r,i);let a=`metadata.${i} = ${s};`;n.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function hUe(e,t){mUe(e,t),zie(e.shaderBuilder,t),Hie(e.shaderBuilder,t)}function mUe(e,t){let{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:c,index:l,texture:f}=s.textureReader,d=`u_propertyTexture_${l}`;i.hasOwnProperty(d)||(n.addUniform("sampler2D",d,Te.FRAGMENT),i[d]=()=>f),n.addStructField(xi.STRUCT_ID_METADATA_FS,r,o);let p=`attributes.texCoord_${a}`,g=`texture(${d}, ${p}).${c}`,m=s.unpackInShader(g),A=Wie({valueExpression:m,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:Te.FRAGMENT,property:s}),x=`metadata.${o} = ${A};`;n.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_FS,[x])}function zie(e,t){let{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=Gie(xi.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(xi.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_FS,s),Te.includesVertexShader(r)&&(e.addStructField(xi.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function Hie(e,t){let{propertyStatistics:n}=t;if(!u(n))return;let{metadataVariable:i,type:o,glslType:r}=t;if(o===zt.ENUM)return;let s=xi.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,c=Gie(s,n,a,r),l=`${r}MetadataStatistics`;e.addStructField(xi.STRUCT_ID_METADATA_STATISTICS_FS,l,i),e.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_FS,c),Te.includesVertexShader(t.shaderDestination)&&(e.addStructField(xi.STRUCT_ID_METADATA_STATISTICS_VS,l,i),e.addFunctionLines(xi.FUNCTION_ID_INITIALIZE_METADATA_VS,c))}function Gie(e,t,n,i){return u(t)?e.map(o).filter(u):[];function o(r){let s=t[r.specName];if(u(s))return`${n}.${r.shaderName} = ${i}(${s});`}}function Wie(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:c,shaderDestination:l}=e;s.addUniform(c,o,l),s.addUniform(c,r,l);let{offset:f,scale:d}=n;return a[o]=()=>f,a[r]=()=>d,`czm_valueTransform(${o}, ${r}, ${t})`}var Ku=xi;var pUe={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},Bg=Object.freeze(pUe);var zs={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:wt};zs.process=function(e,t,n){let i=e.shaderBuilder,o=e.model.customShader;u(o.lightingModel)&&(e.lightingOptions.lightingModel=o.lightingModel);let r=e.alphaOptions;o.translucencyMode===Bg.TRANSLUCENT?r.pass=Ee.TRANSLUCENT:o.translucencyMode===Bg.OPAQUE&&(r.pass=void 0);let s=EUe(o,t);if(!s.customShaderEnabled)return;if(vUe(i,o,s),s.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,Te.BOTH),u(o.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,Te.VERTEX),u(o.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,Te.FRAGMENT);let l=Ip.getDefineName(o.mode);i.addDefine(l,void 0,Te.FRAGMENT)}let a=o.uniforms;for(let l in a)if(a.hasOwnProperty(l)){let f=a[l];i.addUniform(f.type,l)}let c=o.varyings;for(let l in c)if(c.hasOwnProperty(l)){let f=c[l];i.addVarying(f,l)}e.uniformMap=_t(e.uniformMap,o.uniformMap)};function _Ue(e){let t={};for(let n=0;n<e.length;n++){let i=e[n],o=sn.getAttributeInfo(i);t[o.variableName]=o}return t}var gUe={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},yUe={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 jie(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");let n=gUe[t],i=yUe[t];if(u(n))return{attributeField:[n,e],value:i}}function AUe(e,t,n){let i=Yie(t,e.usedVariablesVertex.attributeSet,!1),o=i.addToShader,r=i.missingAttributes,s,a,c=[],l=[];for(s in o)if(o.hasOwnProperty(s)){let d=[o[s].glslType,s];c.push(d),a=`vsInput.attributes.${s} = attributes.${s};`,l.push(a)}for(let f=0;f<r.length;f++){s=r[f];let d=jie(s);if(!u(d)){zs._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${s}, disabling custom vertex shader`);return}c.push(d.attributeField),a=`vsInput.attributes.${s} = ${d.value};`,l.push(a)}n.enabled=!0,n.attributeFields=c,n.initializationLines=l}function xUe(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 CUe(e,t,n){let i=Yie(t,e.usedVariablesFragment.attributeSet,!0),o=i.addToShader,r=i.missingAttributes,s,a,c=[],l=[];for(s in o)if(o.hasOwnProperty(s)){let p=[o[s].glslType,s];c.push(p),a=`fsInput.attributes.${s} = attributes.${s};`,l.push(a)}for(let d=0;d<r.length;d++){s=r[d];let p=jie(s);if(!u(p)){zs._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${s}, disabling custom fragment shader.`);return}c.push(p.attributeField),a=`fsInput.attributes.${s} = ${p.value};`,l.push(a)}let f=xUe(e);n.enabled=!0,n.attributeFields=c.concat(f.attributeFields),n.initializationLines=f.initializationLines.concat(l)}var TUe={positionWC:!0,positionEC:!0};function Yie(e,t,n){let i,o,r={};for(o in e)if(e.hasOwnProperty(o)){let a=e[o];i=o,n&&o==="normalMC"?i="normalEC":n&&o==="tangentMC"&&(i="tangentEC"),t.hasOwnProperty(i)&&(r[i]=a)}let s=[];for(o in t)if(t.hasOwnProperty(o)){if(TUe.hasOwnProperty(o))continue;i=o,n&&o==="normalEC"?i="normalMC":n&&o==="tangentEC"&&(i="tangentMC"),e.hasOwnProperty(i)||s.push(o)}return{addToShader:r,missingAttributes:s}}function EUe(e,t){let n={enabled:!1},i={enabled:!1},o=_Ue(t.attributes);u(e.vertexShaderText)&&AUe(e,o,n),u(e.fragmentShaderText)&&CUe(e,o,i);let s=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&i.enabled;return{vertexLines:n,fragmentLines:i,vertexLinesEnabled:n.enabled,fragmentLinesEnabled:i.enabled,customShaderEnabled:n.enabled||i.enabled,shouldComputePositionWC:s}}function bUe(e,t){let n,i=zs.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(i,zs.STRUCT_NAME_ATTRIBUTES,Te.VERTEX);let o=t.attributeFields;for(n=0;n<o.length;n++){let a=o[n],c=a[0],l=a[1];e.addStructField(i,c,l)}i=zs.STRUCT_ID_VERTEX_INPUT,e.addStruct(i,zs.STRUCT_NAME_VERTEX_INPUT,Te.VERTEX),e.addStructField(i,zs.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,Rg.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,Ku.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,Ku.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,Ku.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");let r=zs.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,zs.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,Te.VERTEX);let s=t.initializationLines;e.addFunctionLines(r,s)}function SUe(e,t){let n,i=zs.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(i,zs.STRUCT_NAME_ATTRIBUTES,Te.FRAGMENT);let o,r,s,a=t.attributeFields;for(n=0;n<a.length;n++)o=a[n],r=o[0],s=o[1],e.addStructField(i,r,s);i=zs.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(i,zs.STRUCT_NAME_FRAGMENT_INPUT,Te.FRAGMENT),e.addStructField(i,zs.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,Rg.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,Ku.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,Ku.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,Ku.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");let c=zs.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,zs.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,Te.FRAGMENT);let l=t.initializationLines;e.addFunctionLines(c,l)}var DUe=[];function vUe(e,t,n){let i=n.vertexLines,o=DUe;i.enabled&&(bUe(e,i),o.length=0,o.push("#line 0",t.vertexShaderText,K1),e.addVertexLines(o));let r=n.fragmentLines;r.enabled&&(SUe(e,r),o.length=0,o.push("#line 0",t.fragmentShaderText,Z1),e.addFragmentLines(o))}var tO=zs;var nO={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};nO.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=u(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,Te.VERTEX),i.addFunction(nO.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,nO.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,Te.VERTEX);let s=t.attributes;for(let a=0;a<s.length;a++){let c=s[a],l=c.quantization;if(!u(l))continue;let f=c.semantic===Ct.POSITION,d=c.semantic===Ct.TEXCOORD;if(r&&!f&&!d)continue;let p=sn.getAttributeInfo(c);IUe(i,p),wUe(e,p)}};function wUe(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,Te.VERTEX),i[s]=function(){return r.normalizationRange}}else{let s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,c=t.glslType;n.addUniform(c,s,Te.VERTEX),n.addUniform(c,a,Te.VERTEX);let l=r.quantizedVolumeOffset,f=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(l=qie(l,0),f=qie(f,1)),i[s]=function(){return l},i[a]=function(){return f}}}function qie(e,t){return e instanceof oe?e:new oe(e.x,e.y,e.z,t)}function IUe(e,t){let n=t.variableName,i=t.attribute.quantization,o;i.octEncoded?o=PUe(n,i):o=OUe(n),e.addFunctionLines(nO.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function PUe(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 OUe(e){let t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}var iO=nO;var oO=`void geometryStage(out ProcessedAttributes attributes)
{
  attributes.positionMC = v_positionMC;
  attributes.positionEC = v_positionEC;

  #ifdef COMPUTE_POSITION_WC_CUSTOM_SHADER
  attributes.positionWC = v_positionWC;
  #endif

  #ifdef HAS_NORMALS
  // renormalize after interpolation
  attributes.normalEC = normalize(v_normalEC);
  #endif

  #ifdef HAS_TANGENTS
  attributes.tangentEC = normalize(v_tangentEC);
  #endif

  #ifdef HAS_BITANGENTS
  attributes.bitangentEC = normalize(v_bitangentEC);
  #endif

  // Everything else is dynamically generated in GeometryPipelineStage
  setDynamicVaryings(attributes);
}
`;var rO=`vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal) 
{
    vec4 computedPosition;

    // Compute positions in different coordinate systems
    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

    // Sometimes the custom shader and/or style needs this
    #if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE)
    // Note that this is a 32-bit position which may result in jitter on small
    // scales.
    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

    // All other varyings need to be dynamically generated in
    // GeometryPipelineStage
    setDynamicVaryings(attributes);
    
    return computedPosition;
}
`;var KT=`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);
    }
    // Floating point comparisons can be unreliable in GLSL, so we
    // increment the feature ID to make sure it's always greater
    // then the model_featuresLength - a condition we check for in the
    // pick ID, to avoid sampling the pick texture if the feature ID is
    // greater than the number of features.
    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 sO={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature",FUNCTION_ID_FEATURE_VARYINGS_VS:"updateFeatureStructVS",FUNCTION_ID_FEATURE_VARYINGS_FS:"updateFeatureStructFS",FUNCTION_SIGNATURE_UPDATE_FEATURE:"void updateFeatureStruct(inout SelectedFeature feature)"};sO.process=function(e,t,n){let i=e.shaderBuilder;e.hasPropertyTable=!0;let o=e.model,r=e.runtimeNode.node,s=RUe(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),BUe(i);let c=s.featureIds.nullFeatureId,l=e.uniformMap;u(c)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),l.model_nullFeatureId=function(){return c}),s.shaderDestination===Te.BOTH&&i.addVertexLines(KT),i.addFragmentLines(KT)};function Xie(e){return e instanceof Rt.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function Kie(e){return e instanceof Rt.FeatureIdTexture?Te.FRAGMENT:Te.BOTH}function RUe(e,t,n){let i,o;return u(t.instances)&&(o=sn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),u(o))?(i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:Kie(o),featureIdDefine:Xie(o)}):(o=sn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:Kie(o),featureIdDefine:Xie(o)})}function BUe(e){e.addStructField(sO.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(sO.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(sO.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}var Mg=sO;var Ts={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)"};Ts.process=function(e,t,n){let i=e.shaderBuilder,o=e.model;i.addStruct(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",Te.VERTEX),i.addStruct(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",Te.FRAGMENT),i.addStruct(Mg.STRUCT_ID_SELECTED_FEATURE,Mg.STRUCT_NAME_SELECTED_FEATURE,Te.BOTH),i.addFunction(Ts.FUNCTION_ID_INITIALIZE_ATTRIBUTES,Ts.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,Te.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(Ts.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,Ts.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Te.VERTEX),i.addFunction(Ts.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,Ts.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,Te.FRAGMENT),o.type===rr.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,Te.FRAGMENT);let s=n.mode!==te.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,a=u(e.runtimeNode.node.instances),c=s&&!a,l=t.attributes.length;for(let f=0;f<l;f++){let d=t.attributes[f],p=rn.getAttributeLocationCount(d.type),g=d.semantic===Ct.POSITION,m;p>1?(m=e.attributeIndex,e.attributeIndex+=p):g&&!c?m=0:m=e.attributeIndex++,MUe(e,d,m,p,s,a)}GUe(i,t.attributes),t.primitiveType===Me.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(rO),i.addFragmentLines(oO)};function MUe(e,t,n,i,o,r){let s=e.shaderBuilder,a=sn.getAttributeInfo(t),c=o&&!r;i>1?FUe(e,t,n,i):NUe(e,t,n,c),UUe(s,a,c),VUe(s,a),u(t.semantic)&&LUe(s,t),kUe(s,a,o),zUe(s,a,c),HUe(s,a)}function LUe(e,t){let n=t.semantic,i=t.setIndex;switch(n){case Ct.NORMAL:e.addDefine("HAS_NORMALS");break;case Ct.TANGENT:e.addDefine("HAS_TANGENTS");break;case Ct.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case Ct.TEXCOORD:case Ct.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function NUe(e,t,n,i){let o=t.quantization,r,s;u(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);let a=t.semantic,c=t.setIndex;a===Ct.FEATURE_ID&&c>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=c+1);let l=a===Ct.POSITION,f=l?0:n,d=rn.getNumberOfComponents(r),p={index:f,value:u(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:d,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(p),!l||!i)return;let g=e.runtimePrimitive.positionBuffer2D,m={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:d,componentDatatype:q.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(m)}function FUe(e,t,n,i){let o=t.quantization,r,s;u(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);let a=t.normalized,l=rn.getNumberOfComponents(r)/i,f=q.getSizeInBytes(s),d=l*f,p=t.byteStride;for(let g=0;g<i;g++){let m=t.byteOffset+g*d,A={index:n+g,vertexBuffer:t.buffer,componentsPerAttribute:l,componentDatatype:s,offsetInBytes:m,strideInBytes:p,normalize:a};e.attributes.push(A)}}function VUe(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 UUe(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===Ct.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function kUe(e,t,n){let i=Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;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,t.glslType,r),e.addStructField(o,t.glslType,r)),r==="positionMC"&&n&&e.addStructField(i,"vec3","position2D")}function zUe(e,t,n){let i=Ts.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName;if(o==="positionMC"&&n){let a="attributes.position2D = a_position2D;";e.addFunctionLines(i,[a])}if(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 HUe(e,t){let n=t.attribute.semantic,i=t.attribute.setIndex;if(u(n)&&!u(i))return;let o=Ts.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,r=t.variableName,s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=Ts.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function GUe(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){let r=t[o];r.semantic===Ct.NORMAL?n=!0:r.semantic===Ct.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(Ts.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}var aO=Ts;var cO=`#ifdef LIGHTING_PBR
vec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)
{
    czm_pbrParameters pbrParameters;
    pbrParameters.diffuseColor = inputMaterial.diffuse;
    pbrParameters.f0 = inputMaterial.specular;
    pbrParameters.roughness = inputMaterial.roughness;
    
    #ifdef USE_CUSTOM_LIGHT_COLOR
    vec3 lightColorHdr = model_lightColorHdr;
    #else
    vec3 lightColorHdr = czm_lightColorHdr;
    #endif

    vec3 color = inputMaterial.diffuse;
    #ifdef HAS_NORMALS
    color = czm_pbrLighting(
        attributes.positionEC,
        inputMaterial.normalEC,
        czm_lightDirectionEC,
        lightColorHdr,
        pbrParameters
    );

        #ifdef USE_IBL_LIGHTING
        color += imageBasedLightingStage(
            attributes.positionEC,
            inputMaterial.normalEC,
            czm_lightDirectionEC,
            lightColorHdr,
            pbrParameters
        );
        #endif
    #endif

    color *= inputMaterial.occlusion;
    color += inputMaterial.emissive;

    // In HDR mode, the frame buffer is in linear color space. The
    // post-processing stages (see PostProcessStageCollection) will handle
    // tonemapping. However, if HDR is not enabled, we must tonemap else large
    // values may be clamped to 1.0
    #ifndef HDR 
    color = czm_acesTonemapping(color);
    #endif 

    return color;
}
#endif

void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
{
    // Even though the lighting will only set the diffuse color,
    // pass all other properties so further stages have access to them.
    vec3 color = vec3(0.0);

    #ifdef LIGHTING_PBR
    color = computePbrLighting(material, attributes);
    #else // unlit
    color = material.diffuse;
    #endif

    #ifdef HAS_POINT_CLOUD_COLOR_STYLE
    // The colors resulting from point cloud styles are adjusted differently.
    color = czm_gammaCorrect(color);
    #elif !defined(HDR)
    // If HDR is not enabled, the frame buffer stores sRGB colors rather than
    // linear colors so the linear value must be converted.
    color = czm_linearToSrgb(color);
    #endif

    material.diffuse = color;
}
`;var WUe={UNLIT:0,PBR:1},Rh=Object.freeze(WUe);var Zie={name:"LightingPipelineStage"};Zie.process=function(e,t){let n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(u(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,Te.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",Te.FRAGMENT);let s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===Rh.PBR?o.addDefine("LIGHTING_PBR",void 0,Te.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,Te.FRAGMENT),o.addFragmentLines(cO)};var lO=Zie;var uO=`// If the style color is white, it implies the feature has not been styled.
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_NORMALS
vec3 computeNormal(ProcessedAttributes attributes)
{
    // Geometry normal. This is already normalized 
    vec3 ng = attributes.normalEC;

    vec3 normal = ng;
    #if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
    vec2 normalTexCoords = TEXCOORD_NORMAL;
        #ifdef HAS_NORMAL_TEXTURE_TRANSFORM
        normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);
        #endif

        // If HAS_BITANGENTS is set, then HAS_TANGENTS is also set
        #ifdef HAS_BITANGENTS
        vec3 t = attributes.tangentEC;
        vec3 b = attributes.bitangentEC;
        mat3 tbn = mat3(t, b, ng);
        vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
        normal = normalize(tbn * (2.0 * n - 1.0));
        #elif (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
        // If derivatives are available (not IE 10), compute tangents
        vec3 positionEC = attributes.positionEC;
        vec3 pos_dx = dFdx(positionEC);
        vec3 pos_dy = dFdy(positionEC);
        vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));
        vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));
        vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
        t = normalize(t - ng * dot(ng, t));
        vec3 b = normalize(cross(ng, t));
        mat3 tbn = mat3(t, b, ng);
        vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
        normal = normalize(tbn * (2.0 * n - 1.0));
        #endif
    #endif

    #ifdef HAS_DOUBLE_SIDED_MATERIAL
    if (czm_backFacing()) {
        normal = -normal;
    }
    #endif

    return normal;
}
#endif

void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
{
    #ifdef HAS_NORMALS
    material.normalEC = computeNormal(attributes);
    #endif

    vec4 baseColorWithAlpha = vec4(1.0);
    // Regardless of whether we use PBR, set a base color
    #ifdef HAS_BASE_COLOR_TEXTURE
    vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;

        #ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
        baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
        #endif

    baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));

        #ifdef HAS_BASE_COLOR_FACTOR
        baseColorWithAlpha *= u_baseColorFactor;
        #endif
    #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;
        // .pnts files store colors in the sRGB color space
        #ifdef HAS_SRGB_COLOR
        color = czm_srgbToLinear(color);
        #endif
    baseColorWithAlpha *= color;
    #endif

    material.diffuse = baseColorWithAlpha.rgb;
    material.alpha = baseColorWithAlpha.a;

    #ifdef USE_CPU_STYLING
    material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
    #endif

    #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
    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
    material.emissive = emissive;
    #elif defined(HAS_EMISSIVE_FACTOR)
    material.emissive = u_emissiveFactor;
    #endif

    #if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
        #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_SPECULAR_FACTOR
            specular *= u_specularFactor;
            #endif

            #ifdef HAS_GLOSSINESS_FACTOR
            glossiness *= u_glossinessFactor;
            #endif
        #else
            #ifdef HAS_SPECULAR_FACTOR
            vec3 specular = clamp(u_specularFactor, 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
    czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(
      diffuse.rgb,
      specular,
      glossiness
    );
    material.diffuse = parameters.diffuseColor;
    // the specular glossiness extension's alpha overrides anything set
    // by the base material.
    material.alpha = diffuse.a;
    material.specular = parameters.f0;
    material.roughness = parameters.roughness;
    #elif defined(LIGHTING_PBR)
        #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.04, 1.0);
            #ifdef HAS_METALLIC_FACTOR
            metalness *= u_metallicFactor;
            #endif

            #ifdef HAS_ROUGHNESS_FACTOR
            roughness *= u_roughnessFactor;
            #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.04, 1.0);
            #else
            float roughness = 1.0;
            #endif
        #endif
    czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(
      material.diffuse,
      metalness,
      roughness
    );
    material.diffuse = parameters.diffuseColor;
    material.specular = parameters.f0;
    material.roughness = parameters.roughness;
    #endif
}
`;var jUe=Rt.Material,$5=Rt.MetallicRoughness,e6=Rt.SpecularGlossiness,Jie={name:"MaterialPipelineStage",_processTexture:Lg,_processTextureTransform:Qie};Jie.process=function(e,t,n){let i=t.material,o=e.model,r=u(o.classificationType),s=r,a=e.uniformMap,c=e.shaderBuilder,l=n.context.defaultTexture,f=n.context.defaultNormalTexture,d=n.context.defaultEmissiveTexture;YUe(i,a,c,l,f,d,s),u(i.specularGlossiness)?qUe(i,a,c,l,s):XUe(i,a,c,l,s);let p=sn.getAttributeBySemantic(t,Ct.NORMAL),g=e.lightingOptions;i.unlit||!p||r?g.lightingModel=Rh.UNLIT:g.lightingModel=Rh.PBR;let m=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=m;let A=e.alphaOptions;i.alphaMode===Ph.BLEND?A.pass=Ee.TRANSLUCENT:i.alphaMode===Ph.MASK&&(A.alphaCutoff=i.alphaCutoff),c.addFragmentLines(uO),i.doubleSided&&c.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,Te.BOTH)};function Qie(e,t,n,i,o){let r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,Te.FRAGMENT);let s=`${i}Transform`;e.addUniform("mat3",s,Te.FRAGMENT),t[s]=function(){return n.transform}}function Lg(e,t,n,i,o,r){e.addUniform("sampler2D",i,Te.FRAGMENT),t[i]=function(){return y(n.texture,r)};let s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,Te.FRAGMENT);let c=`v_texCoord_${n.texCoord}`,l=`TEXCOORD_${o}`;e.addDefine(l,c,Te.FRAGMENT);let f=n.transform;u(f)&&!Z.equals(f,Z.IDENTITY)&&Qie(e,t,n,i,o)}function YUe(e,t,n,i,o,r,s){let a=e.emissiveTexture;u(a)&&!s&&Lg(n,t,a,"u_emissiveTexture","EMISSIVE",r);let c=e.emissiveFactor;u(c)&&!h.equals(c,jUe.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",Te.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,Te.FRAGMENT));let l=e.normalTexture;u(l)&&!s&&Lg(n,t,l,"u_normalTexture","NORMAL",o);let f=e.occlusionTexture;u(f)&&!s&&Lg(n,t,f,"u_occlusionTexture","OCCLUSION",i)}function qUe(e,t,n,i,o){let r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,Te.FRAGMENT);let s=r.diffuseTexture;u(s)&&!o&&Lg(n,t,s,"u_diffuseTexture","DIFFUSE",i);let a=r.diffuseFactor;u(a)&&!oe.equals(a,e6.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",Te.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,Te.FRAGMENT));let c=r.specularGlossinessTexture;u(c)&&!o&&Lg(n,t,c,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);let l=r.specularFactor;u(l)&&!h.equals(l,e6.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",Te.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,Te.FRAGMENT));let f=r.glossinessFactor;u(f)&&f!==e6.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",Te.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,Te.FRAGMENT))}function XUe(e,t,n,i,o){let r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,Te.FRAGMENT);let s=r.baseColorTexture;u(s)&&!o&&Lg(n,t,s,"u_baseColorTexture","BASE_COLOR",i);let a=r.baseColorFactor;u(a)&&!oe.equals(a,$5.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",Te.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,Te.FRAGMENT));let c=r.metallicRoughnessTexture;u(c)&&!o&&Lg(n,t,c,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);let l=r.metallicFactor;u(l)&&l!==$5.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",Te.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,Te.FRAGMENT));let f=r.roughnessFactor;u(f)&&f!==$5.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",Te.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,Te.FRAGMENT))}var fO=Jie;var dO=`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 ma={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)"};ma.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,Te.VERTEX),eke(n);let i=t.morphTargets.length;for(let a=0;a<i;a++){let c=t.morphTargets[a].attributes,l=c.length;for(let f=0;f<l;f++){let d=c[f],p=d.semantic;p!==Ct.POSITION&&p!==Ct.NORMAL&&p!==Ct.TANGENT||(ZUe(e,d,e.attributeIndex,a),e.attributeIndex++)}}tke(n);let r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,Te.VERTEX),n.addVertexLines(dO);let s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=_t(s,e.uniformMap)};var KUe={attributeString:void 0,functionId:void 0};function ZUe(e,t,n,i){let o=e.shaderBuilder;JUe(e,t,n);let r=QUe(t,KUe);$Ue(o,r,i)}function JUe(e,t,n){let i={index:n,value:u(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:rn.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function QUe(e,t){switch(e.semantic){case Ct.POSITION:t.attributeString="Position",t.functionId=ma.FUNCTION_ID_GET_MORPHED_POSITION;break;case Ct.NORMAL:t.attributeString="Normal",t.functionId=ma.FUNCTION_ID_GET_MORPHED_NORMAL;break;case Ct.TANGENT:t.attributeString="Tangent",t.functionId=ma.FUNCTION_ID_GET_MORPHED_TANGENT;break;default:break}return t}function $Ue(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 eke(e){e.addFunction(ma.FUNCTION_ID_GET_MORPHED_POSITION,ma.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,Te.VERTEX);let t="vec3 morphedPosition = position;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(ma.FUNCTION_ID_GET_MORPHED_NORMAL,ma.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,Te.VERTEX);let n="vec3 morphedNormal = normal;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(ma.FUNCTION_ID_GET_MORPHED_TANGENT,ma.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,Te.VERTEX);let i="vec3 morphedTangent = tangent;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function tke(e){let t="return morphedPosition;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_POSITION,[t]);let n="return morphedNormal;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);let i="return morphedTangent;";e.addFunctionLines(ma.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}var hO=ma;var $ie={name:"PickingPipelineStage"};$ie.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)nke(e,t,a,i);else if(u(a))ike(e,i);else{let c=eoe(e),l=i.createPickId(c);s._pipelineResources.push(l),s._pickIds.push(l),r.addUniform("vec4","czm_pickColor",Te.FRAGMENT);let f=e.uniformMap;f.czm_pickColor=function(){return l.color},e.pickId="czm_pickColor"}};function eoe(e,t){let n=e.model;if(u(n.pickObject))return n.pickObject;let i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive},o;if(rr.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,u(t)&&(o.instanceId=t),o}function nke(e,t,n){let i=e.model,o,r,s=i.featureIdLabel,a=i.instanceFeatureIdLabel;u(i.featureTableId)?o=i.featureTableId:u(n)?(r=sn.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=sn.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);let c=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",Te.FRAGMENT);let f=c.batchTexture;e.uniformMap.model_pickTexture=function(){return y(f.pickTexture,f.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function ike(e,t){let n=e.instanceCount,i=new Array(n),o=new Uint8Array(n*4),r=e.model,s=r._pipelineResources;for(let d=0;d<n;d++){let p=eoe(e,d),g=t.createPickId(p);s.push(g),i[d]=g;let m=g.color;o[d*4+0]=z.floatToByte(m.red),o[d*4+1]=z.floatToByte(m.green),o[d*4+2]=z.floatToByte(m.blue),o[d*4+3]=z.floatToByte(m.alpha)}r._pickIds=i;let a=lt.createVertexBuffer({context:t,typedArray:o,usage:Ne.STATIC_DRAW});a.vertexArrayDestroyable=!1;let c=!1;r.statistics.addBuffer(a,c),s.push(a);let l={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:q.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(l);let f=e.shaderBuilder;f.addDefine("USE_PICKING",void 0,Te.BOTH),f.addAttribute("vec4","a_pickColor"),f.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}var mO=$ie;var oke={ADD:0,REPLACE:1},Sr=Object.freeze(oke);var pO=`float getPointSizeFromAttenuation(vec3 positionEC) {
  // Variables are packed into a single vector to minimize gl.uniformXXX() calls
  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)
  // This needs to be computed in eye coordinates so we can't use attributes.normalMC
  return step(-v_normalEC.z, 0.0);
  #else
  return 1.0;
  #endif
}
#endif`;var rke=new oe,noe={name:"PointCloudStylingPipelineStage"};noe.process=function(e,t,n){let i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=u(s)?s.propertyAttributes:void 0,c=u(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,l=!u(a)&&c;if(u(r)&&!l){let A=lke(a),x=uke(r,A);fke(i,x);let T=dke(x).indexOf("normalMC")>=0,E=sn.getAttributeBySemantic(t,Ct.NORMAL);if(T&&!E)throw new ue("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,Te.VERTEX),x.styleTranslucent&&(e.alphaOptions.pass=Ee.TRANSLUCENT)}let f=o.pointCloudShading;f.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,Te.VERTEX),f.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,Te.VERTEX);let d,p,g;rr.is3DTiles(o.type)&&(p=!0,d=o.content,g=d.tile.refine===Sr.ADD),i.addUniform("vec4","model_pointCloudParameters",Te.VERTEX),i.addVertexLines(pO);let m=e.uniformMap;m.model_pointCloudParameters=function(){let A=rke,x=1;p&&(x=g?5:d.tileset.maximumScreenSpaceError),A.x=y(f.maximumAttenuation,x),A.x*=n.pixelRatio;let C=ske(e,t,f,d);A.y=C*f.geometricErrorScale;let T=n.context,E=n.camera.frustum,S;return n.mode===te.SCENE2D||E instanceof en?S=Number.POSITIVE_INFINITY:S=T.drawingBufferHeight/n.camera.frustum.sseDenominator,A.z=S,p&&(A.w=d.tileset.timeSinceLoad),A}};var toe=new h;function ske(e,t,n,i){if(u(i)){let f=i.tile.geometricError;if(f>0)return f}if(u(n.baseResolution))return n.baseResolution;let o=sn.getAttributeBySemantic(t,Ct.POSITION),r=o.count,s=e.runtimeNode.transform,a=h.subtract(o.max,o.min,toe);a=M.multiplyByPointAsVector(s,a,toe);let c=a.x*a.y*a.z;return P.cbrt(c/r)}var ake={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},cke={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function lke(e){let t=Ge(cke);if(!u(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 t6="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function uke(e,t){let n=ake,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${t6})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${t6})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${t6})`,t,i),n.styleTranslucent=u(n.colorStyleFunction)&&i.translucent,n}function fke(e,t){let n=t.colorStyleFunction;u(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,Te.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));let i=t.showStyleFunction;u(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,Te.VERTEX),e.addVertexLines(i));let o=t.pointSizeStyleFunction;u(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,Te.VERTEX),e.addVertexLines(o))}function n6(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 dke(e){let t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return u(t)&&n6(t,o),u(n)&&n6(n,o),u(i)&&n6(i,o),o}var _O=noe;var gO=`void primitiveOutlineStage() {
    v_outlineCoordinates = a_outlineCoordinates;
}
`;var yO=`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 ioe={name:"PrimitiveOutlinePipelineStage"};ioe.process=function(e,t,n){let i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,Te.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");let r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:rn.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",Te.FRAGMENT);let a=EA.createTexture(n.context);o.model_outlineTexture=function(){return a};let c=e.model;i.addUniform("vec4","model_outlineColor",Te.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",Te.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines(gO),i.addFragmentLines(yO)};var AO=ioe;var ooe={name:"PrimitiveStatisticsPipelineStage",_countGeometry:roe,_count2DPositions:soe,_countMorphTargetAttributes:aoe,_countMaterialTextures:coe,_countFeatureIdTextures:loe,_countBinaryMetadata:uoe};ooe.process=function(e,t,n){let i=e.model,o=i.statistics;roe(o,t),soe(o,e.runtimePrimitive),aoe(o,t),coe(o,t.material),loe(o,t.featureIds),uoe(o,i)};function roe(e,t){let n=u(t.indices)?t.indices.count:sn.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===Me.POINTS?e.pointsLength+=n:Me.isTriangles(i)&&(e.trianglesLength+=hke(i,n));let o=t.attributes,r=o.length;for(let c=0;c<r;c++){let l=o[c];if(u(l.buffer)){let f=u(l.typedArray);e.addBuffer(l.buffer,f)}}let s=t.outlineCoordinates;u(s)&&u(s.buffer)&&e.addBuffer(s.buffer,!1);let a=t.indices;if(u(a)&&u(a.buffer)){let c=u(a.typedArray);e.addBuffer(a.buffer,c)}}function hke(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 soe(e,t){let n=t.positionBuffer2D;u(n)&&e.addBuffer(n,!0)}function aoe(e,t){let n=t.morphTargets;if(!u(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 c=0;c<a;c++){let l=s[c];u(l.buffer)&&e.addBuffer(l.buffer,i)}}}function coe(e,t){let n=mke(t),i=n.length;for(let o=0;o<i;o++){let r=n[o];u(r)&&u(r.texture)&&e.addTexture(r.texture)}}function mke(e){let t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return u(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function loe(e,t){let n=t.length;for(let i=0;i<n;i++){let o=t[i];if(o instanceof Rt.FeatureIdTexture){let r=o.textureReader;u(r.texture)&&e.addTexture(r.texture)}}}function uoe(e,t){let n=t.structuralMetadata;u(n)&&(pke(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);let i=t.featureTables;if(!u(i))return;let o=i.length;for(let r=0;r<o;r++){let s=i[r];e.addBatchTexture(s.batchTexture)}}function pke(e,t){let n=t.propertyTextures;if(!u(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 l=s[a].textureReader;u(l.texture)&&e.addTexture(l.texture)}}}var xO=ooe;var _ke=new M,gke=new M,foe={name:"SceneMode2DPipelineStage"};foe.process=function(e,t,n){let i=sn.getAttributeBySemantic(t,Ct.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=M.multiplyTransformation(s,a,_ke),l=xke(e,c,n),f=e.runtimePrimitive;f.boundingSphere2D=l;let d=e.runtimeNode.node.instances;if(u(d))return;if(u(i.typedArray)){let A=Eke(i,c,l,n);f.positionBuffer2D=A,r._modelResources.push(A),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,Te.VERTEX),o.addUniform("mat4","u_modelView2D",Te.VERTEX);let p=M.fromTranslation(l.center,new M),g=n.context,m={u_modelView2D:function(){return M.multiplyTransformation(g.uniformState.view,p,gke)}};e.uniformMap=_t(m,e.uniformMap)};var yke=new h,Ake=new h;function xke(e,t,n){let i=M.multiplyByPoint(t,e.positionMin,yke),o=qi.computeActualWgs84Position(n,i,i),r=M.multiplyByPoint(t,e.positionMax,Ake),s=qi.computeActualWgs84Position(n,r,r);return se.fromCornerPoints(o,s,new se)}var doe=new h;function Cke(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=h.fromArray(e,s,doe),c=h.multiplyComponents(a,r,a),l=h.add(c,o,c);i[s]=l.x,i[s+1]=l.y,i[s+2]=l.z}return i}function Tke(e,t,n,i){let o;u(e.quantization)?o=Cke(e.typedArray,e.quantization):o=e.typedArray.slice();let r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=u(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let c=r;c<s;c+=a){let l=h.fromArray(o,c,doe);if(isNaN(l.x)||isNaN(l.y)||isNaN(l.z))continue;let f=M.multiplyByPoint(t,l,l),d=qi.computeActualWgs84Position(i,f,f),p=h.subtract(d,n,d);o[c]=p.x,o[c+1]=p.y,o[c+2]=p.z}return o}function Eke(e,t,n,i){let o=Ge(i);o.mode=te.COLUMBUS_VIEW;let r=n.center,s=Tke(e,t,r,o),a=lt.createVertexBuffer({context:i.context,typedArray:s,usage:Ne.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}var CO=foe;var TO=`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 wA={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};wA.process=function(e,t){let n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,Te.VERTEX),Ske(n,t);let i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,Te.VERTEX),n.addVertexLines(TO);let r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=_t(r,e.uniformMap)};function bke(e){let t=-1,n=e.attributes,i=n.length;for(let o=0;o<i;o++){let r=n[o];(r.semantic===Ct.JOINTS||r.semantic===Ct.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function Ske(e,t){e.addFunction(wA.FUNCTION_ID_GET_SKINNING_MATRIX,wA.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,Te.VERTEX);let n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(wA.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o,r=["x","y","z","w"],s=bke(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){let c=r[o],l=`skinnedMatrix += a_weights_${i}.${c} * u_jointMatrices[int(a_joints_${i}.${c})];`;e.addFunctionLines(wA.FUNCTION_ID_GET_SKINNING_MATRIX,[l])}let a="return skinnedMatrix;";e.addFunctionLines(wA.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}var EO=wA;var i6={};function Dke(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 vke(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],c=t[r+2];i[o++]=s,i[o++]=a,i[o++]=a,i[o++]=c,i[o++]=c,i[o++]=s}return i}function wke(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 Ike(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 c=t[a],l=t[a+1],f=t[a+2];r[s++]=l,r[s++]=f,r[s++]=f,r[s++]=c}return r}function Pke(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 Oke(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 c=0;c<i;c++){let l=t[c+1],f=t[c+2];r[s++]=l,r[s++]=f,r[s++]=f,r[s++]=a}return r}i6.createWireframeIndices=function(e,t,n){let i=u(n);if(e===Me.TRIANGLES)return i?vke(t,n):Dke(t);if(e===Me.TRIANGLE_STRIP)return i?Ike(t,n):wke(t);if(e===Me.TRIANGLE_FAN)return i?Oke(t,n):Pke(t)};i6.getWireframeIndicesCount=function(e,t){return e===Me.TRIANGLES?t*2:e===Me.TRIANGLE_STRIP||e===Me.TRIANGLE_FAN?2+(t-2)*4:t};var ZT=i6;var hoe={name:"WireframePipelineStage"};hoe.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,Te.FRAGMENT);let o=e.model,r=Rke(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r;let s=!1;o.statistics.addBuffer(r,s);let a=e.primitiveType,c=e.count;e.primitiveType=Me.LINES,e.count=ZT.getWireframeIndicesCount(a,c)};function Rke(e,t,n){let o=sn.getAttributeBySemantic(e,Ct.POSITION).count,r=n.context.webgl2,s;if(u(t)){let f=t.buffer,d=t.count;u(f)&&r?(s=f.sizeInBytes===d?new Uint8Array(d):Fe.createTypedArray(o,d),f.getBufferData(s)):s=t.typedArray}let a=e.primitiveType,c=ZT.createWireframeIndices(a,o,s),l=Fe.fromSizeInBytes(c.BYTES_PER_ELEMENT);return lt.createIndexBuffer({context:n.context,typedArray:c,usage:Ne.STATIC_DRAW,indexDatatype:l})}var bO=hoe;function moe(e){e=y(e,y.EMPTY_OBJECT);let t=e.primitive,n=e.node,i=e.model;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=[]}moe.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,l=e.mode!==te.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,f=u(n.morphTargets)&&n.morphTargets.length>0,d=u(i.skin),p=u(r),m=!(p&&u(r.fragmentShaderText))||r.mode!==Ip.REPLACE_MATERIAL,A=sn.hasQuantizedAttributes(n.attributes),x=o.debugWireframe&&Me.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),C=o.pointCloudShading,T=u(C)&&C.attenuation,E=u(C)&&C.backFaceCulling,S=n.primitiveType===Me.POINTS&&(u(s)||T||E),D=o._enableShowOutline&&u(n.outlineCoordinates),w=Bke(o,i,n),R=u(o.classificationType);l&&t.push(CO),t.push(aO),x&&t.push(bO),R&&t.push(j1),f&&t.push(hO),d&&t.push(EO),S&&t.push(_O),A&&t.push(iO),m&&t.push(fO),t.push(Rg),t.push(Ku),w.hasPropertyTable&&(t.push(Mg),t.push(W1),t.push(X1)),p&&t.push(tO),t.push(lO),o.allowPicking&&t.push(mO),D&&t.push(AO),t.push(G1),t.push(xO)};function Bke(e,t,n){let i;return u(t.instances)&&(i=sn.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),u(i))?{hasFeatureIds:!0,hasPropertyTable:u(i.propertyTableId)}:(i=sn.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),u(i)?{hasFeatureIds:!0,hasPropertyTable:u(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}var SO=moe;function o6(e){e=y(e,y.EMPTY_OBJECT),this._sceneGraph=e.sceneGraph;let t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],Mke(this)}Object.defineProperties(o6.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 Mke(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 c=0;c<o;c++){let l=i[c].index,f=r[l];s.push(f);let d=n[c],p=poe(f,d,new M);a.push(p)}}function poe(e,t,n){let i=M.multiplyTransformation(e.transformToRoot,e.transform,n);return n=M.multiplyTransformation(i,t,n),n}o6.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]=poe(i,o,e[n])}};var DO=o6;function Lke(){this.pass=void 0,this.alphaCutoff=void 0}var vO=Lke;function Nke(e){this.shaderBuilder=new S0,this.model=e,this.uniformMap={},this.alphaOptions=new vO,this.renderStateOptions=Ue.getState(Ue.fromCache({depthTest:{enabled:!0,func:Fa.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}var wO=Nke;var IO=`void silhouetteStage(inout vec4 color) {
    if(model_silhouettePass) {
        color = czm_gammaCorrect(model_silhouetteColor);
    }
}`;var PO=`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 XV={name:"ModelSilhouettePipelineStage"};XV.silhouettesLength=0;XV.process=function(e,t,n){u(t._silhouetteId)||(t._silhouetteId=++XV.silhouettesLength);let i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,Te.BOTH),i.addVertexLines(PO),i.addFragmentLines(IO),i.addUniform("vec4","model_silhouetteColor",Te.FRAGMENT),i.addUniform("float","model_silhouetteSize",Te.VERTEX),i.addUniform("bool","model_silhouettePass",Te.BOTH);let o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=_t(o,e.uniformMap),e.hasSilhouette=!0};var OO=XV;var RO=`void modelSplitterStage()
{
    // Don't split when rendering the shadow map, because it is rendered from
    // the perspective of a totally different camera.
#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 KV={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};KV.process=function(e,t,n){let i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,Te.FRAGMENT),i.addFragmentLines(RO);let o={};i.addUniform("float",KV.SPLIT_DIRECTION_UNIFORM_NAME,Te.FRAGMENT),o[KV.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=_t(o,e.uniformMap)};var BO=KV;function Fke(e,t){this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=Ge(e.uniformMap),this.alphaOptions=Ge(e.alphaOptions),this.renderStateOptions=Ge(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 MO=Fke;function Vke(e){e=y(e,y.EMPTY_OBJECT),this.lightingModel=y(e.lightingModel,Rh.UNLIT)}var LO=Vke;function Uke(e,t){this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=Ge(e.uniformMap),this.alphaOptions=Ge(e.alphaOptions),this.renderStateOptions=Ge(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=u(n.indices)?n.indices.count:sn.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;let i=sn.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=h.clone(i.min,new h),this.positionMax=h.clone(i.max,new h),this.boundingSphere=se.fromCornerPoints(this.positionMin,this.positionMax,new se),this.lightingOptions=new LO,this.pickId=void 0}var NO=Uke;function Zl(e){e=y(e,y.EMPTY_OBJECT);let t=e.modelComponents;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=M.clone(M.IDENTITY),this._computedModelMatrix2D=M.clone(M.IDENTITY),this._axisCorrectionMatrix=sn.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new M),this._runtimeArticulations={},kke(this)}Object.defineProperties(Zl.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 kke(e){let t=e._components,n=t.scene,o=e._model.modelMatrix;_oe(e,o);let r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let T=0;T<s;T++){let E=r[T],S=new P1({articulation:E,sceneGraph:e}),D=S.name;a[D]=S}let c=t.nodes,l=c.length;e._runtimeNodes=new Array(l);let d=n.nodes.length,p=M.IDENTITY;for(let T=0;T<d;T++){let E=n.nodes[T],S=goe(e,E,p);e._rootNodes.push(S)}let g=t.skins,m=e._runtimeSkins,A=g.length;for(let T=0;T<A;T++){let E=g[T];m.push(new DO({skin:E,sceneGraph:e}))}let x=e._skinnedNodes,C=x.length;for(let T=0;T<C;T++){let E=x[T],S=e._runtimeNodes[E],w=c[E].skin.index;S._runtimeSkin=m[w],S.updateJointMatrices()}e.applyArticulations()}function _oe(e,t){let n=e._components,i=e._model;e._computedModelMatrix=M.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=M.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=M.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}var zke=new h;function Hke(e,t){let n=e._computedModelMatrix,i=M.getTranslation(n,zke);if(!h.equals(i,h.ZERO))e._computedModelMatrix2D=Ot.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{let o=e.boundingSphere.center,r=Ot.wgs84To2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=M.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=se.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function goe(e,t,n){let i=[],o=sn.getNodeTransform(t),r=t.children.length;for(let f=0;f<r;f++){let d=t.children[f],p=M.multiplyTransformation(n,o,new M),g=goe(e,d,p);i.push(g)}let s=new H1({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 SO({primitive:t.primitives[f],node:t,model:e._model}));let c=t.index;e._runtimeNodes[c]=s,u(t.skin)&&e._skinnedNodes.push(c);let l=t.name;if(u(l)){let f=e._model,d=new M1(f,s);f._nodesByName[l]=d}return c}var Gke=new h,Wke=new h,jke=new h,Yke=new h;Zl.prototype.buildDrawCommands=function(e){let t=this._model,n=new wO(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=h.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Gke),c=h.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Wke);for(o=0;o<this._runtimeNodes.length;o++){let l=this._runtimeNodes[o];if(!u(l))continue;l.configurePipeline();let f=l.pipelineStages,d=new MO(n,l);for(r=0;r<f.length;r++)f[r].process(d,l.node,e);let p=l.computedTransform;for(r=0;r<l.runtimePrimitives.length;r++){let g=l.runtimePrimitives[r];g.configurePipeline(e);let m=g.pipelineStages,A=new NO(d,g);for(s=0;s<m.length;s++)m[s].process(A,g.primitive,e);g.boundingSphere=se.clone(A.boundingSphere,new se);let x=M.multiplyByPoint(p,A.positionMin,jke),C=M.multiplyByPoint(p,A.positionMax,Yke);h.minimumByComponent(a,x,a),h.maximumByComponent(c,C,c);let T=S1(A,e);g.drawCommand=T}}this._boundingSphere=se.fromCornerPoints(a,c,new se),this._boundingSphere=se.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=se.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=se.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale};Zl.prototype.configurePipeline=function(e){let t=this.modelPipelineStages;t.length=0;let n=this._model;u(n.color)&&t.push(Og),!u(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(w1),n.isClippingEnabled()&&t.push(B1),n.hasSilhouette(e)&&t.push(OO),u(n.splitDirection)&&n.splitDirection!==Pc.NONE&&t.push(BO),rr.is3DTiles(n.type)&&t.push(D1))};Zl.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){let r=this._runtimeNodes[n];if(!u(r))continue;for(i=0;i<r.updateStages.length;i++)r.updateStages[i].update(r,this,e);let s=e.mode!==te.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)}}};Zl.prototype.updateModelMatrix=function(e,t){_oe(this,e),t.mode!==te.SCENE3D&&Hke(this,t);let n=this._rootNodes;for(let i=0;i<n.length;i++){let o=this._runtimeNodes[n[i]];o._transformDirty=!0}};Zl.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 yoe(e,t,n,i,o){if(n&&!t.show)return;let r=t.children.length;for(let c=0;c<r;c++){let l=t.getChild(c);yoe(e,l,n,i,o)}let s=t.runtimePrimitives,a=s.length;for(let c=0;c<a;c++){let l=s[c];i(l,o)}}function ZV(e,t,n,i){let o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){let a=o[s],c=e._runtimeNodes[a];yoe(e,c,t,n,i)}}var qke={backFaceCulling:void 0};Zl.prototype.updateBackFaceCulling=function(e){let t=qke;t.backFaceCulling=e,ZV(this,!1,Xke,t)};function Xke(e,t){let n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}var Kke={shadowMode:void 0};Zl.prototype.updateShadows=function(e){let t=Kke;t.shadowMode=e,ZV(this,!1,Zke,t)};function Zke(e,t){let n=e.drawCommand;n.shadows=t.shadowMode}var Jke={debugShowBoundingVolume:void 0};Zl.prototype.updateShowBoundingVolume=function(e){let t=Jke;t.debugShowBoundingVolume=e,ZV(this,!1,Qke,t)};function Qke(e,t){let n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}var Aoe=[],$ke={frameState:void 0,hasSilhouette:void 0};Zl.prototype.pushDrawCommands=function(e){let t=Aoe;t.length=0;let n=$ke;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,ZV(this,!0,eze,n),e.commandList.push.apply(e.commandList,t)};function eze(e,t){let n=t.frameState,i=t.hasSilhouette,o=n.passes,r=Aoe,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}Zl.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];u(r)&&r.setArticulationStage(o,t)};Zl.prototype.applyArticulations=function(){let e=this._runtimeArticulations;for(let t in e)e.hasOwnProperty(t)&&e[t].apply()};var FO=Zl;function JT(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new xt}Object.defineProperties(JT.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}}});JT.prototype.clear=function(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap.removeAll()};JT.prototype.addBuffer=function(e,t){if(!this._bufferIdSet.hasOwnProperty(e._id)){let n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};JT.prototype.addTexture=function(e){this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0};JT.prototype.addBatchTexture=function(e){this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};var VO=JT;var Eoe=vo(i3(),1);var xoe={},IA=Uint32Array.BYTES_PER_ELEMENT;xoe.parse=function(e,t){t=y(t,0);let n=new Uint8Array(e),i=new DataView(e);t+=IA;let o=i.getUint32(t,!0);if(o!==1)throw new ue(`Only Point Cloud tile version 1 is supported.  Version ${o} is not.`);t+=IA,t+=IA;let r=i.getUint32(t,!0);if(r===0)throw new ue("Feature table must have a byte length greater than zero");t+=IA;let s=i.getUint32(t,!0);t+=IA;let a=i.getUint32(t,!0);t+=IA;let c=i.getUint32(t,!0);t+=IA;let l=Oo(n,t,r);t+=r;let f=new Uint8Array(e,t,s);t+=s;let d,p;a>0&&(d=Oo(n,t,a),t+=a,c>0&&(p=new Uint8Array(e,t,c),t+=c));let g=new fd(l,f),m=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=m,!u(m))throw new ue("Feature table global property: POINTS_LENGTH must be defined");let A=g.getGlobalProperty("RTC_CENTER",q.FLOAT,3);u(A)&&(A=h.unpack(A));let x=tze(g,d);if(x.rtcCenter=A,x.pointsLength=m,!x.hasPositions){let C=nze(g);x.positions=C,x.hasPositions=x.hasPositions||u(C)}if(!x.hasPositions)throw new ue("Either POSITION or POSITION_QUANTIZED must be defined.");if(!x.hasNormals){let C=oze(g);x.normals=C,x.hasNormals=x.hasNormals||u(C)}if(!x.hasColors){let C=ize(g);x.colors=C,x.hasColors=x.hasColors||u(C),x.hasConstantColor=u(x.constantColor),x.isTranslucent=u(C)&&C.isTranslucent}if(!x.hasBatchIds){let C=rze(g);x.batchIds=C,x.hasBatchIds=x.hasBatchIds||u(C)}if(x.hasBatchIds){let C=g.getGlobalProperty("BATCH_LENGTH");if(!u(C))throw new ue("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");x.batchLength=C}return u(p)&&(p=new Uint8Array(p),x.batchTableJson=d,x.batchTableBinary=p),x};function tze(e,t){let n=e.json,i,o,r,s=u(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=u(t)&&u(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;u(a)&&(r=a.properties);let c,l,f,d,p;if(u(s)){o=s.properties;let m=s.byteOffset,A=s.byteLength;if(!u(o)||!u(m)||!u(A))throw new ue("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(m,m+A),c=u(o.POSITION),l=u(o.RGB)||u(o.RGBA),f=u(o.NORMAL),d=u(o.BATCH_ID),p=u(o.RGBA)}let g;return u(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:_t(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:c,hasColors:l,isTranslucent:p,hasNormals:f,hasBatchIds:d}}function nze(e){let t=e.json,n;if(u(t.POSITION))return n=e.getPropertyArray("POSITION",q.FLOAT,3),{name:Ct.POSITION,semantic:Ct.POSITION,typedArray:n,isQuantized:!1,componentDatatype:q.FLOAT,type:rn.VEC3};if(u(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",q.UNSIGNED_SHORT,3);let i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",q.FLOAT,3);if(!u(i))throw new ue("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let o=(1<<16)-1,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",q.FLOAT,3);if(!u(r))throw new ue("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:Ct.POSITION,semantic:Ct.POSITION,typedArray:n,isQuantized:!0,componentDatatype:q.FLOAT,type:rn.VEC3,quantizedRange:o,quantizedVolumeOffset:h.unpack(r),quantizedVolumeScale:h.unpack(i),quantizedComponentDatatype:q.UNSIGNED_SHORT,quantizedType:rn.VEC3}}}function ize(e){let t=e.json,n;if(u(t.RGBA))return n=e.getPropertyArray("RGBA",q.UNSIGNED_BYTE,4),{name:Ct.COLOR,semantic:Ct.COLOR,setIndex:0,typedArray:n,componentDatatype:q.UNSIGNED_BYTE,type:rn.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(u(t.RGB))return n=e.getPropertyArray("RGB",q.UNSIGNED_BYTE,3),{name:"COLOR",semantic:Ct.COLOR,setIndex:0,typedArray:n,componentDatatype:q.UNSIGNED_BYTE,type:rn.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(u(t.RGB565))return n=e.getPropertyArray("RGB565",q.UNSIGNED_SHORT,1),{name:"COLOR",semantic:Ct.COLOR,setIndex:0,typedArray:n,componentDatatype:q.FLOAT,type:rn.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(u(t.CONSTANT_RGBA)){let i=e.getGlobalProperty("CONSTANT_RGBA",q.UNSIGNED_BYTE,4),o=i[3],r=z.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:Ct.COLOR,semantic:Ct.COLOR,setIndex:0,constantColor:r,componentDatatype:q.FLOAT,type:rn.VEC4,isQuantized:!1,isTranslucent:s}}}function oze(e){let t=e.json,n;if(u(t.NORMAL))return n=e.getPropertyArray("NORMAL",q.FLOAT,3),{name:Ct.NORMAL,semantic:Ct.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:q.FLOAT,type:rn.VEC3};if(u(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",q.UNSIGNED_BYTE,2);let i=8;return{name:Ct.NORMAL,semantic:Ct.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<i)-1,quantizedType:rn.VEC2,quantizedComponentDatatype:q.UNSIGNED_BYTE,componentDatatype:q.FLOAT,type:rn.VEC3}}}function rze(e){let t=e.json;if(u(t.BATCH_ID)){let n=e.getPropertyArray("BATCH_ID",q.UNSIGNED_SHORT,1);return{name:Ct.FEATURE_ID,semantic:Ct.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:q.fromTypedArray(n),type:rn.SCALAR}}}var PA=xoe;var sze=Rt.Components,aze=Rt.Scene,cze=Rt.Node,lze=Rt.Primitive,uze=Rt.Attribute,Coe=Rt.Quantization,fze=Rt.FeatureIdAttribute,dze=Rt.Material,hze=Rt.MetallicRoughness;function Ng(e){e=y(e,y.EMPTY_OBJECT);let t=e.arrayBuffer,n=y(e.byteOffset,0);this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=y(e.loadAttributesFor2D,!1),this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=void 0,this._process=function(i){},this._state=Ut.UNLOADED,this._buffers=[],this._components=void 0,this._transform=M.IDENTITY}u(Object.create)&&(Ng.prototype=Object.create(no.prototype),Ng.prototype.constructor=Ng);Object.defineProperties(Ng.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});Ng.prototype.load=function(){this._parsedContent=PA.parse(this._arrayBuffer,this._byteOffset),this._state=Ut.PROCESSING;let e=this;this._promise=new Promise(function(t,n){e._process=function(i){if(e._state===Ut.PROCESSING){if(u(e._decodePromise))return;let o=mze(e,i.context);u(o)&&o.then(t).catch(n)}}})};Ng.prototype.process=function(e){this._process(e)};function mze(e,t){let i=e._parsedContent.draco,o;if(u(i)?o=pp.decodePointCloud(i,t):o=Promise.resolve(),!!u(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return u(r)&&pze(e,i,r),Dze(e,t),e._state=Ut.READY,e}).catch(function(r){e.unload(),e._state=Ut.FAILED;let s="Failed to load Draco pnts";return Promise.reject(e.getError(s,r))})}function pze(e,t,n){e._state=Ut.READY;let i=e._parsedContent,o;if(u(n.POSITION)){if(o={name:"POSITION",semantic:Ct.POSITION,typedArray:n.POSITION.array,componentDatatype:q.FLOAT,type:rn.VEC3,isQuantized:!1},u(n.POSITION.data.quantization)){let a=n.POSITION.data.quantization,c=a.range,l=h.fromElements(c,c,c),f=h.unpack(a.minValues),d=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=d,o.quantizedVolumeOffset=f,o.quantizedVolumeScale=l,o.quantizedComponentDatatype=d<=255?q.UNSIGNED_BYTE:q.UNSIGNED_SHORT,o.quantizedType=rn.VEC3}i.positions=o}if(u(n.NORMAL)){if(o={name:"NORMAL",semantic:Ct.NORMAL,typedArray:n.NORMAL.array,componentDatatype:q.FLOAT,type:rn.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},u(n.NORMAL.data.quantization)){let a=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=a,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=q.UNSIGNED_BYTE,o.quantizedType=rn.VEC2}i.normals=o}if(u(n.RGBA)?i.colors={name:"COLOR",semantic:Ct.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:q.UNSIGNED_BYTE,type:rn.VEC4,normalized:!0,isTranslucent:!0}:u(n.RGB)&&(i.colors={name:"COLOR",semantic:Ct.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:q.UNSIGNED_BYTE,type:rn.VEC3,normalized:!0,isTranslucent:!1}),u(n.BATCH_ID)){let a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:Ct.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:q.fromTypedArray(a),type:rn.SCALAR}}let r=i.batchTableJson,s=t.batchTableProperties;for(let a in s)if(s.hasOwnProperty(a)){let c=n[a];u(r)||(r={}),i.hasDracoBatchTable=!0;let l=c.data;r[a]={byteOffset:l.byteOffset,type:_ze(l.componentsPerAttribute),componentType:gze(l.componentDatatype),typedArray:c.array}}i.batchTableJson=r}function _ze(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4"}}function gze(e){switch(e){case ee.BYTE:return"BYTE";case ee.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case ee.SHORT:return"SHORT";case ee.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case ee.INT:return"INT";case ee.UNSIGNED_INT:return"UNSIGNED_INT";case ee.DOUBLE:return"DOUBLE";case ee.FLOAT:return"FLOAT"}}function UO(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new Coe,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new Coe;let a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=h.ZERO;let c=t.quantizedVolumeScale;o.quantizedVolumeDimensions=c,o.quantizedVolumeStepSize=h.divideByScalar(c,a,new h),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}let r=new uze;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=y(t.normalized,!1),r.min=t.min,r.max=t.max,r.quantization=o,t.isRGB565&&(i=Gn.decodeRGB565(i)),u(t.constantColor)){let a=new Array(4);r.constant=z.pack(t.constantColor,a)}else{let a=lt.createVertexBuffer({typedArray:i,context:n,usage:Ne.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}let s=e._loadAttributesFor2D;return r.semantic===Ct.POSITION&&s&&(r.typedArray=i),r}var Toe,JV;function yze(e){if(!u(JV)){Toe=new Eoe.default(0),JV=new Array(e);for(let t=0;t<e;++t)JV[t]=Toe.random()}return JV}var Aze=new h,xze=new h,Cze=new h;function Tze(e){let t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=yze(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE,c=h.fromElements(s,s,s,Aze),l=h.fromElements(a,a,a,xze),f,d,p;if(e.isQuantized)c=h.ZERO,l=e.quantizedVolumeScale;else for(f=0;f<o;++f)d=Math.floor(r[f]*i),p=h.unpack(t,d*3,Cze),h.minimumByComponent(c,p,c),h.maximumByComponent(l,p,l);e.min=h.clone(c),e.max=h.clone(l)}var Eze={name:Ct.COLOR,semantic:Ct.COLOR,setIndex:0,constantColor:z.DARKGRAY,componentDatatype:q.FLOAT,type:rn.VEC4,isQuantized:!1,isTranslucent:!1};function bze(e,t,n){let i=[],o,r=t.positions;return u(r)&&(Tze(r),o=UO(e,r,n),o.count=t.pointsLength,i.push(o)),u(t.normals)&&(o=UO(e,t.normals,n),i.push(o)),u(t.colors)?(o=UO(e,t.colors,n),i.push(o)):(o=UO(e,Eze,n),i.push(o)),u(t.batchIds)&&(o=UO(e,t.batchIds,n),i.push(o)),i}function Sze(e,t){let n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!u(e.batchIds);if(u(o)||e.hasDracoBatchTable){let s=y(n,i);return Sp({count:s,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new da({schema:{},propertyTables:[]})}function Dze(e,t){let n=e._parsedContent,i=new hze;i.metallicFactor=0,i.roughnessFactor=.9;let o=new dze;o.metallicRoughness=i;let r=n.colors;u(r)&&r.isTranslucent&&(o.alphaMode=Ph.BLEND);let s=!u(n.normals);o.unlit=s;let a=new lze;if(a.attributes=bze(e,n,t),a.primitiveType=Me.POINTS,a.material=o,u(n.batchIds)){let g=new fze;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}let c=new cze;c.index=0,c.primitives=[a];let l=new aze;l.nodes=[c],l.upAxis=Po.Z,l.forwardAxis=Po.X;let f=new sze;f.scene=l,f.nodes=[c];let d=[];f.structuralMetadata=Sze(n,d),d.length>0&&vze(e,a,d,t),u(n.rtcCenter)&&(f.transform=M.multiplyByTranslation(f.transform,n.rtcCenter,f.transform));let p=n.positions;u(p)&&p.isQuantized&&(f.transform=M.multiplyByTranslation(f.transform,p.quantizedVolumeOffset,f.transform)),e._components=f,e._parsedContent=void 0,e._arrayBuffer=void 0}function vze(e,t,n,i){let o=t.attributes,r=n.length;for(let s=0;s<r;s++){let a=n[s],c=lt.createVertexBuffer({typedArray:a.typedArray,context:i,usage:Ne.STATIC_DRAW});c.vertexArrayDestroyable=!1,e._buffers.push(c),a.buffer=c,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}Ng.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 kO=Ng;function Co(e){e=y(e,y.EMPTY_OBJECT),this._loader=e.loader,this._resource=e.resource,this.type=y(e.type,rr.GLTF),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=M.clone(this.modelMatrix),this._scale=y(e.scale,1),this._minimumPixelSize=y(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=u(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=Z.clone(Z.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 _1(this),this._clampAnimations=y(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=z.clone(e.color),this._colorBlendMode=y(e.colorBlendMode,ja.HIGHLIGHT),this._colorBlendAmount=y(e.colorBlendAmount,.5);let t=y(e.silhouetteColor,z.RED);this._silhouetteColor=z.clone(t),this._silhouetteSize=y(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=y(e.cull,!0),this._opaquePass=y(e.opaquePass,Ee.OPAQUE),this._allowPicking=y(e.allowPicking,!0),this._show=y(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=y(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=y(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 se,this._initialRadius=void 0,this._heightReference=y(e.heightReference,We.NONE),this._heightDirty=this._heightReference!==We.NONE,this._removeUpdateHeightCallback=void 0,this._clampedModelMatrix=void 0;let o=e.scene;u(o)&&u(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(function(){this._heightDirty=!0},this)),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;let r=new Oh(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;let s=e.clippingPlanes;u(s)&&s.owner===void 0?ss.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=M.clone(M.IDENTITY),this._lightColor=h.clone(e.lightColor),this._imageBasedLighting=u(e.imageBasedLighting)?e.imageBasedLighting:new nA,this._shouldDestroyImageBasedLighting=!u(e.imageBasedLighting),this._backFaceCulling=y(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=y(e.shadows,gn.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=y(e.enableDebugWireframe,!1),this._enableShowOutline=y(e.enableShowOutline,!0),this._debugWireframe=y(e.debugWireframe,!1),this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===rr.GLTF&&wt("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.");let a=e.credit;typeof a=="string"&&(a=new Zt(a)),this._credit=a,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=y(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=y(e.splitDirection,Pc.NONE),this._enableShowOutline=y(e.enableShowOutline,!0),this.showOutline=y(e.showOutline,!0),this.outlineColor=y(e.outlineColor,z.BLACK),this._classificationType=e.classificationType,this._statistics=new VO,this._sceneMode=void 0,this._projectTo2D=y(e.projectTo2D,!1),this._skipLevelOfDetail=!1,this._ignoreCommands=y(e.ignoreCommands,!1),this._completeLoad=function(c,l){},this._texturesLoadedPromise=void 0,this._readyPromise=Pze(this),this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function wze(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 A1({model:e,propertyTable:s});n.push(a)}return n}function Ize(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],u(a.instances)&&(s=sn.getFeatureIdsByLabel(a.instances.featureIds,i),u(s)&&u(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 c=a.primitives[r],l=sn.getFeatureIdsByLabel(c.featureIds,n);if(u(l))return l.propertyTableId}if(t._featureTables.length===1)return 0}function s6(e,t){if(!u(e)&&!u(t))return!1;if(u(e)!==u(t))return!0;let n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}function Pze(e){let t=e._loader,n=e._resource;t.load();let i=t.promise.then(function(s){if(!u(s))return;let a=s.components;if(!u(a)){if(s.isUnloaded())return;throw new ue("Failed to load model.")}let c=a.structuralMetadata;u(c)&&c.propertyTableCount>0&&wze(e,c);let l=new FO({model:e,modelComponents:a});e._sceneGraph=l,e._gltfCredits=l.components.asset.credits;let f=e._resource.credits;if(u(f)){let d=f.length;for(let p=0;p<d;p++)e._resourceCredits.push(f[p])}e._resourcesLoaded=!0}),o=y(t.texturesLoadedPromise,Promise.resolve());e._texturesLoadedPromise=o.then(function(){!u(e)||e.isDestroyed()||(e._texturesLoaded=!0,t._incrementallyLoadTextures&&e.resetDrawCommands())}).catch(sn.getFailedLoadFunction(e,"model",n));let r=new Promise(function(s,a){e._completeLoad=function(c,l){l.afterRender.push(function(){return c._ready=!0,s(c),!0})}});return i.then(function(){return r}).catch(sn.getFailedLoadFunction(e,"model",n))}Object.defineProperties(Co.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}},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){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){this._distanceDisplayCondition=bt.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){s6(e,this._color)&&this.resetDrawCommands(),this._color=z.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(!z.equals(e,this._silhouetteColor)){let t=s6(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=z.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(){let e=u(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return Doe(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===rr.GLTF&&wt("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, 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}`),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(ss.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){u(e)!==u(this._lightColor)&&this.resetDrawCommands(),this._lightColor=h.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,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){return this._nodesByName[e]};Co.prototype.setArticulationStage=function(e,t){this._sceneGraph.setArticulationStage(e,t)};Co.prototype.applyArticulations=function(){this._sceneGraph.applyArticulations()};Co.prototype.makeStyleDirty=function(){this._styleDirty=!0};Co.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};var Oze=new M,Rze=new Z,Bze=new M;Co.prototype.update=function(e){if(Mze(this,e),Lze(this,e),Nze(this,e),!this._resourcesLoaded||e.mode===te.MORPHING)return;Fze(this),Vze(this),Uze(this,e),kze(this),zze(this,e),Hze(this,e),Gze(this,e),Wze(this,e),this._defaultTexture=e.context.defaultTexture,jze(this,e),Yze(this,e),qze(this),Xze(this,e),Jze(this,e);let t=this;if(!t._ready){t._completeLoad(t,e);return}Zze(this),Qze(this,e),$ze(this),e4e(this,e)};function Mze(e,t){(!e._resourcesLoaded||!e._texturesLoaded)&&e._loader.process(t)}function Lze(e,t){u(e._customShader)&&e._customShader.update(t)}function Nze(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function Fze(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;let t=e._sceneGraph.components,n=t.structuralMetadata;u(n)&&n.propertyTableCount>0&&(e.featureTableId=Ize(t,e),e._styleDirty=!0,e.resetDrawCommands())}function Vze(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function Uze(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&&Soe(e)}function Soe(e){let t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=md.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function kze(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 zze(e,t){e._silhouetteDirty&&(voe(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function Hze(e,t){let n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function Gze(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 Wze(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function jze(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function Yze(e,t){M.equals(e.modelMatrix,e._modelMatrix)||(e._updateModelMatrix=!0,e._modelMatrix=M.clone(e.modelMatrix,e._modelMatrix))}var Bh=new h,QV=new he;function qze(e){if(!e._updateModelMatrix&&!e._heightDirty&&e._minimumPixelSize===0)return;u(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);let t=e._scene;if(!u(t)||!u(t.globe)||e.heightReference===We.NONE){e._clampedModelMatrix=void 0;return}let n=t.globe,i=n.ellipsoid,o=e.modelMatrix;Bh.x=o[12],Bh.y=o[13],Bh.z=o[14];let r=i.cartesianToCartographic(Bh);u(e._clampedModelMatrix)||(e._clampedModelMatrix=M.clone(o,new M));let s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,boe(e,i,r));let a=n.getHeight(r);if(u(a)){let c=boe(e,i,r);he.clone(r,QV),QV.height=a,i.cartographicToCartesian(QV,Bh),c(Bh)}e._heightDirty=!1,e._updateModelMatrix=!0}function Xze(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;let n=u(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;Doe(e,n),Kze(e,n,t)}function Doe(e,t){e._clampedScale=u(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=h.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=se.transform(e._boundingSphere,t,e._boundingSphere)}function Kze(e,t,n){let i=e.scale;if(e.minimumPixelSize!==0&&!e._projectTo2D){let o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);M.getTranslation(t,Bh),e._sceneMode!==te.SCENE3D&&qi.computeActualWgs84Position(n,Bh,Bh);let s=e._boundingSphere.radius,a=t4e(Bh,s,n),c=1/a;Math.min(c*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=u(e.maximumScale)?Math.min(e.maximumScale,i):i}function Zze(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}function Jze(e,t){let n=u(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=y(e.referenceMatrix,n),o=t.context,r=e._imageBasedLighting;if(r.useSphericalHarmonicCoefficients||r.useSpecularEnvironmentMaps){let s=Rze,a=Oze;a=M.multiply(o.uniformState.view3D,i,a),s=M.getMatrix3(a,s),s=Z.getRotation(s,s),e._iblReferenceFrameMatrix=Z.transpose(s,e._iblReferenceFrameMatrix)}if(e.isClippingEnabled()){let s=Bze;s=M.multiply(o.uniformState.view3D,i,s),s=M.multiply(s,e._clippingPlanes.modelMatrix,s),e._clippingPlanesMatrix=M.inverseTranspose(s,e._clippingPlanesMatrix)}}function Qze(e,t){let n=e._sceneGraph;if(e._updateModelMatrix||e._minimumPixelSize!==0){let o=u(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;u(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t)),n.update(t,i),e._userAnimationDirty=!1}function $ze(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1;let t=e._showCreditsOnScreen;u(e._credit)&&(e._credit.showOnScreen=t);let n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++)n[s].showOnScreen=t;let o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++)o[s].showOnScreen=t}function e4e(e,t){let n=i4e(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&&(o4e(e,t),e._sceneGraph.pushDrawCommands(t))}var r6=new se;function t4e(e,t,n){return r6.center=e,r6.radius=t,n.camera.getPixelSize(r6,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}function boe(e,t,n){return function(i){if(e.heightReference===We.RELATIVE_TO_GROUND){let r=t.cartesianToCartographic(i,QV);r.height+=n.height,t.cartographicToCartesian(r,i)}let o=e._clampedModelMatrix;M.clone(e.modelMatrix,o),o[12]=i.x,o[13]=i.y,o[14]=i.z,e._heightDirty=!0}}var n4e=new h;function i4e(e,t){let n=e.distanceDisplayCondition;if(!u(n))return!0;let i=n.near*n.near,o=n.far*n.far,r;if(t.mode===te.SCENE2D){let a=(t.camera.frustum.right-t.camera.frustum.left)*.5;r=a*a}else{let s=M.getTranslation(e.modelMatrix,n4e);qi.computeActualWgs84Position(t,s,s),r=h.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function o4e(e,t){let n=t.creditDisplay,i=e._credit;u(i)&&n.addCredit(i);let o=e._resourceCredits,r=o.length;for(let c=0;c<r;c++)n.addCredit(o[c]);let s=e._gltfCredits,a=s.length;for(let c=0;c<a;c++)n.addCredit(s[c])}Co.prototype.isTranslucent=function(){let e=this.color;return u(e)&&e.alpha>0&&e.alpha<1};Co.prototype.isInvisible=function(){let e=this.color;return u(e)&&e.alpha===0};function voe(e){return e.context.stencilBuffer}Co.prototype.hasSilhouette=function(e){return voe(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!u(this._classificationType)};function r4e(e){return e.context.stencilBuffer}Co.prototype.hasSkipLevelOfDetail=function(e){if(!rr.is3DTiles(this.type))return!1;let n=this._content.tileset;return r4e(e)&&n.skipLevelOfDetail};Co.prototype.isClippingEnabled=function(){let e=this._clippingPlanes;return u(e)&&e.enabled&&e.length!==0};Co.prototype.isDestroyed=function(){return!1};Co.prototype.destroy=function(){let e=this._loader;u(e)&&e.destroy();let t=this._featureTables;if(u(t)){let i=t.length;for(let o=0;o<i;o++)t[o].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),u(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),u(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);let n=this._clippingPlanes;u(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,le(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.fromGltf=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.url,e.gltf),n={releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:u(e.classificationType)},i=y(e.basePath,""),o=Oe.createIfNeeded(i);u(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=Oe.createIfNeeded(t);let r=new Cp(n),a=u(e.content)?rr.TILE_GLTF:rr.GLTF,c=zO(r,a,e);return c.resource=n.gltfResource,new Co(c)};Co.fromB3dm=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,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:u(e.classificationType)},n=new a1(t),i=zO(n,rr.TILE_B3DM,e);return new Co(i)};Co.fromPnts=function(e){let t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new kO(t),i=zO(n,rr.TILE_PNTS,e);return new Co(i)};Co.fromI3dm=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,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline},n=new u1(t),i=zO(n,rr.TILE_I3DM,e);return new Co(i)};Co.fromGeoJson=function(e){let t={geoJson:e.geoJson},n=new c1(t),i=zO(n,rr.TILE_GEOJSON,e);return new Co(i)};Co.prototype.applyColorAndShow=function(e){let t=this._color,n=u(e)&&u(e.color),i=u(e)&&u(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):z.clone(z.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,s6(t,this._color)&&this.resetDrawCommands()};Co.prototype.applyStyle=function(e){let t=this.type===rr.TILE_PNTS,n=u(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=u(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=u(i)&&u(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),Soe(this,e)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function zO(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,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,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}var pd=Co;function Es(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._readyPromise=void 0,this._metadata=void 0,this._group=void 0}Object.defineProperties(Es.prototype,{featuresLength:{get:function(){let e=this._model,t=e.featureTables,n=e.featureTableId;return u(t)&&u(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(){}},readyPromise:{get:function(){return this._readyPromise}},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(u(t)&&u(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}}});Es.prototype.getFeature=function(e){let t=this._model,n=t.featureTableId;return t.featureTables[n].getFeature(e)};Es.prototype.hasProperty=function(e,t){let n=this._model,i=n.featureTableId;return u(i)?n.featureTables[i].hasProperty(e,t):!1};Es.prototype.applyDebugSettings=function(e,t){t=e?t:z.WHITE,this.featuresLength===0?this._model.color=t:u(this.batchTable)&&this.batchTable.setAllColor(t)};Es.prototype.applyStyle=function(e){this._model.style=e};Es.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,u(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),u(o)&&u(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0),n.update(t)};Es.prototype.isDestroyed=function(){return!1};Es.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),le(this)};Es.fromGltf=function(e,t,n,i){let o=new Es(e,t,n),s=HO(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;let c=pd.fromGltf(s);return o._model=c,o._readyPromise=c.readyPromise.then(function(l){return l.activeAnimations.addAll({loop:Ga.REPEAT}),l}),o};Es.fromB3dm=function(e,t,n,i,o){let r=new Es(e,t,n),a=HO(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=c;let l=pd.fromB3dm(a);return r._model=l,r._readyPromise=l.readyPromise.then(function(f){return f.activeAnimations.addAll({loop:Ga.REPEAT}),f}),r};Es.fromI3dm=function(e,t,n,i,o){let r=new Es(e,t,n),a=HO(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=pd.fromI3dm(a);return r._model=c,r._readyPromise=c.readyPromise.then(function(l){return l.activeAnimations.addAll({loop:Ga.REPEAT}),l}),r};Es.fromPnts=function(e,t,n,i,o){let r=new Es(e,t,n),a=HO(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=pd.fromPnts(a);return r._model=c,r._readyPromise=c.readyPromise,r};Es.fromGeoJson=function(e,t,n,i){let o=new Es(e,t,n),s=HO(e,t,o,{geoJson:i,resource:n}),a=pd.fromGeoJson(s);return o._model=a,o._readyPromise=a.readyPromise,o};function HO(e,t,n,i){let o={cull:!1,releaseGltfJson:!0,opaquePass:Ee.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,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor};return _t(i,o)}var Mh=Es;function Pp(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._readyPromise=s4e(this,i)}Object.defineProperties(Pp.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(){}},readyPromise:{get:function(){return this._readyPromise}},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}}});function s4e(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}Pp.prototype.hasProperty=function(e,t){return!1};Pp.prototype.getFeature=function(e){};Pp.prototype.applyDebugSettings=function(e,t){};Pp.prototype.applyStyle=function(e){};Pp.prototype.update=function(e,t){};Pp.prototype.isDestroyed=function(){return!1};Pp.prototype.destroy=function(){return le(this)};var GO=Pp;var WO=`#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif

uniform sampler2D u_atlas;

#ifdef VECTOR_TILE
uniform vec4 u_highlightColor;
#endif

in vec2 v_textureCoordinates;
in vec4 v_pickColor;
in vec4 v_color;

#ifdef SDF
in vec4 v_outlineColor;
in float v_outlineWidth;
#endif

#ifdef FRAGMENT_DEPTH_CHECK
in vec4 v_textureCoordinateBounds;                  // the min and max x and y values for the texture coordinates
in vec4 v_originTextureCoordinateAndTranslate;      // texture coordinate at the origin, billboard translate (used for label glyphs)
in vec4 v_compressed;                               // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
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)); // aligns label glyph with bounding rectangle.  Will be zero for billboards because dimensions and imageSize will be equal

    vec2 translation = v_originTextureCoordinateAndTranslate.zw;

    if (applyTranslate)
    {
        // this is only needed for labels where the horizontal origin is not LEFT
        // it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT
        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; // not on the globe
    }

    vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
    return eyeCoordinate.z / eyeCoordinate.w;
}
#endif


#ifdef SDF

// Get the distance from the edge of a glyph at a given position sampling an SDF texture.
float getDistance(vec2 position)
{
    return texture(u_atlas, position).r;
}

// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
{
    float distance = getDistance(position);

    if (outlineWidth > 0.0)
    {
        // Don't get the outline edge exceed the SDF_EDGE
        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()
{
    vec4 color = texture(u_atlas, v_textureCoordinates);

#ifdef SDF
    float outlineWidth = v_outlineWidth;
    vec4 outlineColor = v_outlineColor;

    // Get the current distance
    float distance = getDistance(v_textureCoordinates);

#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
    float smoothing = fwidth(distance);
    // Get an offset that is approximately half the distance to the neighbor pixels
    // 0.354 is approximately half of 1/sqrt(2)
    vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));

    // Sample the center point
    vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);

    // Sample the 4 neighbors
    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);

    // Equally weight the center sample and the 4 neighboring samples
    color = (center + color1 + color2 + color3 + color4)/5.0;
#else
    // If no derivatives available (IE 10?), just do a single sample
    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

// Fully transparent parts of the billboard are not pickable.
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
    if (color.a < 0.005)   // matches 0/255 and 1/255
    {
        discard;
    }
#else
// The billboard is rendered twice. The opaque pass discards translucent fragments
// and the translucent pass discards opaque fragments.
#ifdef OPAQUE
    if (color.a < 0.995)   // matches < 254/255
    {
        discard;
    }
#else
    if (color.a >= 0.995)  // matches 254/255 and 255/255
    {
        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);

        // negative values go into the screen
        if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
        {
            float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner
            if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
            {
                float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner
                if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
                {
                    discard;
                }
            }
        }
    }
#endif

}
`;var jO=`#ifdef INSTANCED
in vec2 direction;
#endif
in vec4 positionHighAndScale;
in vec4 positionLowAndRotation;
in vec4 compressedAttribute0;                       // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
in vec4 compressedAttribute1;                       // aligned axis, translucency by distance, image width
in vec4 compressedAttribute2;                       // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
in vec4 eyeOffset;                                  // eye offset in meters, 4 bytes free (texture range)
in vec4 scaleByDistance;                            // near, nearScale, far, farScale
in vec4 pixelOffsetScaleByDistance;                 // near, nearScale, far, farScale
in vec4 compressedAttribute3;                       // distance display condition near, far, disableDepthTestDistance, dimensions
in vec2 sdf;                                        // sdf outline color (rgb) and width (w)
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
in vec4 textureCoordinateBoundsOrLabelTranslate;    // the min and max x and y values for the texture coordinates
#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;                                 // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
out mat2 v_rotationMatrix;
#endif

out vec4 v_pickColor;
out vec4 v_color;
#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)
{
    // Note the halfSize cannot be computed in JavaScript because it is sent via
    // compressed vertex attributes that coerce it to an integer.
    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; // not on the globe
    }

    vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
    return eyeCoordinate.z / eyeCoordinate.w;
}
#endif
void main()
{
    // Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition

    // unpack attributes
    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) // is a billboard, so set apply translate to false
    {
        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)
    {
        // 2D camera distance is a special case
        // treat all billboards as flattened to the z=0.0 plane
        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;
    // push vertex behind near plane for clipping
    if (scale == 0.0)
    {
        positionEC.xyz = vec3(0.0);
    }
#endif

    float translucency = 1.0;
#ifdef EYE_DISTANCE_TRANSLUCENCY
    translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
    // push vertex behind near plane for clipping
    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)
    {
        // Don't try to "multiply both sides" by w.  Greater/less-than comparisons won't work for negative values of w.
        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)))
        {
            // Position z on the near plane.
            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;

}
`;function Ci(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;u(n)&&(n=Pt.clone(n)),u(i)&&(i=Pt.clone(i)),u(o)&&(o=Pt.clone(o)),u(r)&&(r=bt.clone(r)),this._show=y(e.show,!0),this._position=h.clone(y(e.position,h.ZERO)),this._actualPosition=h.clone(this._position),this._pixelOffset=H.clone(y(e.pixelOffset,H.ZERO)),this._translate=new H(0,0),this._eyeOffset=h.clone(y(e.eyeOffset,h.ZERO)),this._heightReference=y(e.heightReference,We.NONE),this._verticalOrigin=y(e.verticalOrigin,On.CENTER),this._horizontalOrigin=y(e.horizontalOrigin,_i.CENTER),this._scale=y(e.scale,1),this._color=z.clone(y(e.color,z.WHITE)),this._rotation=y(e.rotation,0),this._alignedAxis=h.clone(y(e.alignedAxis,h.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=y(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=y(e.collection,t),this._pickId=void 0,this._pickPrimitive=y(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,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;u(s)&&(u(a)||(typeof s=="string"?a=s:u(s.src)?a=s.src:a=zn()),this._imageId=a,this._image=s),u(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),u(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=te.SCENE3D,this._clusterShow=!0,this._outlineColor=z.clone(y(e.outlineColor,z.BLACK)),this._outlineWidth=y(e.outlineWidth,0),this._updateClamping()}var woe=Ci.SHOW_INDEX=0,eU=Ci.POSITION_INDEX=1,Boe=Ci.PIXEL_OFFSET_INDEX=2,a4e=Ci.EYE_OFFSET_INDEX=3,c4e=Ci.HORIZONTAL_ORIGIN_INDEX=4,l4e=Ci.VERTICAL_ORIGIN_INDEX=5,u4e=Ci.SCALE_INDEX=6,tU=Ci.IMAGE_INDEX_INDEX=7,Ioe=Ci.COLOR_INDEX=8,f4e=Ci.ROTATION_INDEX=9,d4e=Ci.ALIGNED_AXIS_INDEX=10,h4e=Ci.SCALE_BY_DISTANCE_INDEX=11,m4e=Ci.TRANSLUCENCY_BY_DISTANCE_INDEX=12,p4e=Ci.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,_4e=Ci.DISTANCE_DISPLAY_CONDITION=14,g4e=Ci.DISABLE_DEPTH_DISTANCE=15;Ci.TEXTURE_COORDINATE_BOUNDS=16;var Poe=Ci.SDF_INDEX=17;Ci.NUMBER_OF_PROPERTIES=18;function Lo(e,t){let n=e._billboardCollection;u(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(Ci.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,Lo(this,woe))}},position:{get:function(){return this._position},set:function(e){let t=this._position;h.equals(t,e)||(h.clone(e,t),h.clone(e,this._actualPosition),this._updateClamping(),Lo(this,eU))}},heightReference:{get:function(){return this._heightReference},set:function(e){let t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),Lo(this,eU))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){let t=this._pixelOffset;H.equals(t,e)||(H.clone(e,t),Lo(this,Boe))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){let t=this._scaleByDistance;Pt.equals(t,e)||(this._scaleByDistance=Pt.clone(e,t),Lo(this,h4e))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){let t=this._translucencyByDistance;Pt.equals(t,e)||(this._translucencyByDistance=Pt.clone(e,t),Lo(this,m4e))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){let t=this._pixelOffsetScaleByDistance;Pt.equals(t,e)||(this._pixelOffsetScaleByDistance=Pt.clone(e,t),Lo(this,p4e))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){let t=this._eyeOffset;h.equals(t,e)||(h.clone(e,t),Lo(this,a4e))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,Lo(this,c4e))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin!==e&&(this._verticalOrigin=e,Lo(this,l4e))}},scale:{get:function(){return this._scale},set:function(e){this._scale!==e&&(this._scale=e,Lo(this,u4e))}},color:{get:function(){return this._color},set:function(e){let t=this._color;z.equals(t,e)||(z.clone(e,t),Lo(this,Ioe))}},rotation:{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,Lo(this,f4e))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){let t=this._alignedAxis;h.equals(t,e)||(h.clone(e,t),Lo(this,d4e))}},width:{get:function(){return y(this._width,this._imageWidth)},set:function(e){this._width!==e&&(this._width=e,Lo(this,tU))}},height:{get:function(){return y(this._height,this._imageHeight)},set:function(e){this._height!==e&&(this._height=e,Lo(this,tU))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters!==e&&(this._sizeInMeters=e,Lo(this,Ioe))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){bt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=bt.clone(e,this._distanceDisplayCondition),Lo(this,_4e))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,Lo(this,g4e))}},id:{get:function(){return this._id},set:function(e){this._id=e,u(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,u(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){u(e)?typeof e=="string"?this.setImage(e,e):e instanceof Oe?this.setImage(e.url,e):u(e.src)?this.setImage(e.src,e):this.setImage(zn(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,Lo(this,tU))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=h.clone(e,this._actualClampedPosition),Lo(this,eU)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,Lo(this,woe))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){let t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),Lo(this,Poe))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,Lo(this,Poe))}}});Ci.prototype.getPickId=function(e){return u(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};Ci.prototype._updateClamping=function(){Ci._updateClamping(this._billboardCollection,this)};var YO=new he,Ooe=new h;Ci._updateClamping=function(e,t){let n=e._scene;if(!u(n)||!u(n.globe))return;let i=n.globe,o=i.ellipsoid,r=i._surface,s=n.frameState.mode,a=s!==t._mode;if(t._mode=s,(t._heightReference===We.NONE||a)&&u(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===We.NONE||!u(t._position))return;let c=o.cartesianToCartographic(t._position);if(!u(c)){t._actualClampedPosition=void 0;return}u(t._removeCallbackFunc)&&t._removeCallbackFunc();function l(d){if(t._heightReference===We.RELATIVE_TO_GROUND)if(t._mode===te.SCENE3D){let p=o.cartesianToCartographic(d,YO);p.height+=c.height,o.cartographicToCartesian(p,d)}else d.x+=c.height;t._clampedPosition=h.clone(d,t._clampedPosition)}t._removeCallbackFunc=r.updateHeight(c,l),he.clone(c,YO);let f=i.getHeight(c);u(f)&&(YO.height=f),o.cartographicToCartesian(YO,Ooe),l(Ooe)};Ci.prototype._loadImage=function(){let e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion,o,r=this;function s(a){if(r._imageId!==t||r._image!==n||!Ye.equals(r._imageSubRegion,i))return;let c=e.textureCoordinates[a];r._imageWidth=e.texture.width*c.width,r._imageHeight=e.texture.height*c.height,r._imageIndex=a,r._ready=!0,r._image=void 0,r._imageIndexPromise=void 0,Lo(r,tU)}if(u(n)){let a=e.getImageIndex(t);if(u(a)){s(a);return}o=e.addImage(t,n)}u(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,u(o)&&o.then(s).catch(function(a){console.error(`Error loading image for billboard: ${a}`),r._imageIndexPromise=void 0})};Ci.prototype.setImage=function(e,t){this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,u(this._billboardCollection._textureAtlas)&&this._loadImage())};Ci.prototype.setImageSubRegion=function(e,t){this._imageId===e&&Ye.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=Ye.clone(t),u(this._billboardCollection._textureAtlas)&&this._loadImage())};Ci.prototype._setTranslate=function(e){let t=this._translate;H.equals(t,e)||(H.clone(e,t),Lo(this,Boe))};Ci.prototype._getActualPosition=function(){return u(this._clampedPosition)?this._clampedPosition:this._actualPosition};Ci.prototype._setActualPosition=function(e){u(this._clampedPosition)||h.clone(e,this._actualPosition),Lo(this,eU)};var Roe=new oe;Ci._computeActualPosition=function(e,t,n,i){return u(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===te.SCENE3D?t:(M.multiplyByPoint(i,t,Roe),qi.computeActualWgs84Position(n,Roe))};var Moe=new h;Ci._computeScreenSpacePosition=function(e,t,n,i,o,r){let s=M.multiplyByPoint(e,t,Moe),a=qi.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(u(a))return H.add(a,i,a),a};var $V=new H(0,0);Ci.prototype.computeScreenSpacePosition=function(e,t){let n=this._billboardCollection;u(t)||(t=new H),H.clone(this._pixelOffset,$V),H.add($V,this._translate,$V);let i=n.modelMatrix,o=this._position;if(u(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==te.SCENE3D)){let s=e.mapProjection,a=s.ellipsoid,c=s.unproject(o,YO);o=a.cartographicToCartesian(c,Moe),i=M.IDENTITY}return Ci._computeScreenSpacePosition(i,o,this._eyeOffset,$V,e,t)};Ci.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===_i.RIGHT?s-=i:e.horizontalOrigin===_i.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===On.BOTTOM||e.verticalOrigin===On.BASELINE?a-=o:e.verticalOrigin===On.CENTER&&(a-=o*.5),u(n)||(n=new Ye),n.x=s,n.y=a,n.width=i,n.height=o,n};Ci.prototype.equals=function(e){return this===e||u(e)&&this._id===e._id&&h.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&Ye.equals(this._imageSubRegion,e._imageSubRegion)&&z.equals(this._color,e._color)&&H.equals(this._pixelOffset,e._pixelOffset)&&H.equals(this._translate,e._translate)&&h.equals(this._eyeOffset,e._eyeOffset)&&Pt.equals(this._scaleByDistance,e._scaleByDistance)&&Pt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Pt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&bt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Ci.prototype._destroy=function(){u(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),u(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=Ci;var y4e={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},To=Object.freeze(y4e);var A4e={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},bs=Object.freeze(A4e);function Op(e,t,n,i,o){this.bottomLeft=y(e,H.ZERO),this.topRight=y(t,H.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}var x4e=new H(16,16);function Fg(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.borderWidthInPixels,1),n=y(e.initialSize,x4e);this._context=e.context,this._pixelFormat=y(e.pixelFormat,rt.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=zn(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties(Fg.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return u(this._texture)||(this._texture=new It({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}});function C4e(e,t){let n=e._context,i=e.numberOfImages,o=2,r=e._borderWidthInPixels;if(i>0){let s=e._texture.width,a=e._texture.height,c=o*(s+t.width+r),l=o*(a+t.height+r),f=s/c,d=a/l,p=new Op(new H(s+r,r),new H(c,a)),g=new Op(new H,new H(c,a),e._root,p),m=new Op(new H(r,a+r),new H(c,l)),A=new Op(new H,new H(c,l),g,m);for(let T=0;T<e._textureCoordinates.length;T++){let E=e._textureCoordinates[T];u(E)&&(E.x*=f,E.y*=d,E.width*=f,E.height*=d)}let x=new It({context:e._context,width:c,height:l,pixelFormat:e._pixelFormat}),C=new Ns({context:n,colorTextures:[e._texture],destroyAttachments:!1});C._bind(),x.copyFromFramebuffer(0,0,0,0,c,l),C._unBind(),C.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=x,e._root=A}else{let s=o*(t.width+2*r),a=o*(t.height+2*r);s<e._initialSize.x&&(s=e._initialSize.x),a<e._initialSize.y&&(a=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new It({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),e._root=new Op(new H(r,r),new H(s,a))}}function nU(e,t,n){if(u(t)){if(!u(t.childNode1)&&!u(t.childNode2)){if(u(t.imageIndex))return;let i=t.topRight.x-t.bottomLeft.x,o=t.topRight.y-t.bottomLeft.y,r=i-n.width,s=o-n.height;if(r<0||s<0)return;if(r===0&&s===0)return t;if(r>s){t.childNode1=new Op(new H(t.bottomLeft.x,t.bottomLeft.y),new H(t.bottomLeft.x+n.width,t.topRight.y));let a=t.bottomLeft.x+n.width+e._borderWidthInPixels;a<t.topRight.x&&(t.childNode2=new Op(new H(a,t.bottomLeft.y),new H(t.topRight.x,t.topRight.y)))}else{t.childNode1=new Op(new H(t.bottomLeft.x,t.bottomLeft.y),new H(t.topRight.x,t.bottomLeft.y+n.height));let a=t.bottomLeft.y+n.height+e._borderWidthInPixels;a<t.topRight.y&&(t.childNode2=new Op(new H(t.bottomLeft.x,a),new H(t.topRight.x,t.topRight.y)))}return nU(e,t.childNode1,n)}return nU(e,t.childNode1,n)||nU(e,t.childNode2,n)}}function Loe(e,t,n){let i=nU(e,e._root,t);if(u(i)){i.imageIndex=n;let o=e._texture.width,r=e._texture.height,s=i.topRight.x-i.bottomLeft.x,a=i.topRight.y-i.bottomLeft.y,c=i.bottomLeft.x/o,l=i.bottomLeft.y/r,f=s/o,d=a/r;e._textureCoordinates[n]=new Ye(c,l,f,d),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else C4e(e,t),Loe(e,t,n);e._guid=zn()}function Noe(e,t){if(!u(e)||e.isDestroyed())return-1;let n=e.numberOfImages;return Loe(e,t,n),n}Fg.prototype.getImageIndex=function(e){return this._indexHash[e]};Fg.prototype.addImageSync=function(e,t){let n=this._indexHash[e];return u(n)||(n=Noe(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n};Fg.prototype.addImage=function(e,t){let n=this._idHash[e];if(u(n))return n;typeof t=="function"?t=t(e):(typeof t=="string"||t instanceof Oe)&&(t=Oe.createIfNeeded(t).fetchImage());let i=this;return n=Promise.resolve(t).then(function(o){let r=Noe(i,o);return i._indexHash[e]=r,r}),this._idHash[e]=n,n};Fg.prototype.addSubRegion=function(e,t){let n=this._idHash[e];if(!u(n))throw new ue(`image with id "${e}" not found in the atlas.`);let i=this;return Promise.resolve(n).then(function(o){if(o===-1)return-1;let r=i._texture.width,s=i._texture.height,a=i._textureCoordinates[o],c=a.x+t.x/r,l=a.y+t.y/s,f=t.width/r,d=t.height/s,p=i._textureCoordinates.push(new Ye(c,l,f,d))-1;return i._indexHash[e]=p,i._guid=zn(),p})};Fg.prototype.isDestroyed=function(){return!1};Fg.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),le(this)};var Vg=Fg;var T4e=lo.SHOW_INDEX,XO=lo.POSITION_INDEX,Foe=lo.PIXEL_OFFSET_INDEX,Voe=lo.EYE_OFFSET_INDEX,E4e=lo.HORIZONTAL_ORIGIN_INDEX,b4e=lo.VERTICAL_ORIGIN_INDEX,S4e=lo.SCALE_INDEX,qO=lo.IMAGE_INDEX_INDEX,Uoe=lo.COLOR_INDEX,D4e=lo.ROTATION_INDEX,v4e=lo.ALIGNED_AXIS_INDEX,koe=lo.SCALE_BY_DISTANCE_INDEX,zoe=lo.TRANSLUCENCY_BY_DISTANCE_INDEX,Hoe=lo.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,Goe=lo.DISTANCE_DISPLAY_CONDITION,w4e=lo.DISABLE_DEPTH_DISTANCE,I4e=lo.TEXTURE_COORDINATE_BOUNDS,Woe=lo.SDF_INDEX,h6=lo.NUMBER_OF_PROPERTIES,yo,P4e={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},O4e={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};function Qu(e){e=y(e,y.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,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(h6),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new se,this._baseVolumeWC=new se,this._baseVolume2D=new se,this._boundingVolume=new se,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=M.clone(M.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=y(e.debugShowTextureAtlas,!1),this.blendOption=y(e.blendOption,To.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=te.SCENE3D,this._buffersUsage=[Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW],this._highlightColor=z.clone(z.WHITE);let t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};let n=this._scene;u(n)&&u(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener(function(){let i=this._billboards,o=i.length;for(let r=0;r<o;++r)u(i[r])&&i[r]._updateClamping()},this))}Object.defineProperties(Qu.prototype,{length:{get:function(){return m6(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}});function joe(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Qu.prototype.add=function(e){let t=new lo(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};Qu.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Qu.prototype.removeAll=function(){joe(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function m6(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];u(s)&&(s._index=r++,t.push(s))}e._billboards=t}}Qu.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};Qu.prototype.contains=function(e){return u(e)&&e._billboardCollection===this};Qu.prototype.get=function(e){return m6(this),this._billboards[e]};var a6;function R4e(e){let n=e.cache.billboardCollection_indexBufferBatched;if(u(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=lt.createIndexBuffer({context:e,typedArray:o,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function B4e(e){let t=e.cache.billboardCollection_indexBufferInstanced;return u(t)||(t=lt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function M4e(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return u(t)||(t=lt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:Ne.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}Qu.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<h6;++i){let o=n[i]===0?Ne.STATIC_DRAW:Ne.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function L4e(e,t,n,i,o,r){let s=[{index:yo.positionHighAndScale,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[XO]},{index:yo.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[XO]},{index:yo.compressedAttribute0,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Foe]},{index:yo.compressedAttribute1,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[zoe]},{index:yo.compressedAttribute2,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Uoe]},{index:yo.eyeOffset,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Voe]},{index:yo.scaleByDistance,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[koe]},{index:yo.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Hoe]},{index:yo.compressedAttribute3,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Goe]},{index:yo.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[I4e]}];i&&s.push({index:yo.direction,componentsPerAttribute:2,componentDatatype:q.FLOAT,vertexBuffer:M4e(e)}),u(o)&&s.push({index:yo.a_batchId,componentsPerAttribute:1,componentDatatype:q.FLOAT,bufferUsage:Ne.STATIC_DRAW}),r&&s.push({index:yo.sdf,componentsPerAttribute:2,componentDatatype:q.FLOAT,usage:n[Woe]});let a=i?t:4*t;return new Wm(e,s,a,i)}var c6=new Hn;function Yoe(e,t,n,i,o){let r,s=i[yo.positionHighAndScale],a=i[yo.positionLowAndRotation],c=o._getActualPosition();e._mode===te.SCENE3D&&(se.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),Hn.fromCartesian(c,c6);let l=o.scale,f=o.rotation;f!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,l);let d=c6.high,p=c6.low;e._instanced?(r=o._index,s(r,d.x,d.y,d.z,l),a(r,p.x,p.y,p.z,f)):(r=o._index*4,s(r+0,d.x,d.y,d.z,l),s(r+1,d.x,d.y,d.z,l),s(r+2,d.x,d.y,d.z,l),s(r+3,d.x,d.y,d.z,l),a(r+0,p.x,p.y,p.z,f),a(r+1,p.x,p.y,p.z,f),a(r+2,p.x,p.y,p.z,f),a(r+3,p.x,p.y,p.z,f))}var Ju=new H,Zu=32768,QT=65536,l6=4096,Lh=256,N4e=128,F4e=32,V4e=8,qoe=4,U4e=1/256,Xoe=0,Koe=2,Zoe=3,Joe=1;function Qoe(e,t,n,i,o){let r,s=i[yo.compressedAttribute0],a=o.pixelOffset,c=a.x,l=a.y,f=o._translate,d=f.x,p=f.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+d),Math.abs(-l+p));let g=o.horizontalOrigin,m=o._verticalOrigin,A=o.show&&o.clusterShow;o.color.alpha===0&&(A=!1),m===On.BASELINE&&(m=On.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&g===_i.CENTER,e._allVerticalCenter=e._allVerticalCenter&&m===On.CENTER;let x=0,C=0,T=0,E=0,S=o._imageIndex;if(S!==-1){let k=n[S];x=k.x,C=k.y,T=k.width,E=k.height}let D=x+T,w=C+E,R=Math.floor(P.clamp(c,-Zu,Zu)+Zu)*N4e;R+=(g+1)*F4e,R+=(m+1)*V4e,R+=(A?1:0)*qoe;let O=Math.floor(P.clamp(l,-Zu,Zu)+Zu)*Lh,L=Math.floor(P.clamp(d,-Zu,Zu)+Zu)*Lh,N=(P.clamp(p,-Zu,Zu)+Zu)*U4e,_=Math.floor(N),b=Math.floor((N-_)*Lh);O+=_,L+=b,Ju.x=x,Ju.y=C;let v=Gn.compressTextureCoordinates(Ju);Ju.x=D;let I=Gn.compressTextureCoordinates(Ju);Ju.y=w;let B=Gn.compressTextureCoordinates(Ju);Ju.x=x;let F=Gn.compressTextureCoordinates(Ju);e._instanced?(r=o._index,s(r,R,O,L,v)):(r=o._index*4,s(r+0,R+Xoe,O,L,v),s(r+1,R+Koe,O,L,I),s(r+2,R+Zoe,O,L,B),s(r+3,R+Joe,O,L,F))}function $oe(e,t,n,i,o){let r,s=i[yo.compressedAttribute1],a=o.alignedAxis;h.equals(a,h.ZERO)||(e._shaderAlignedAxis=!0);let c=0,l=1,f=1,d=1,p=o.translucencyByDistance;u(p)&&(c=p.near,l=p.nearValue,f=p.far,d=p.farValue,(l!==1||d!==1)&&(e._shaderTranslucencyByDistance=!0));let g=0,m=o._imageIndex;m!==-1&&(g=n[m].width);let A=e._textureAtlas.texture.width,x=Math.round(y(o.width,A*g));e._maxSize=Math.max(e._maxSize,x);let C=P.clamp(x,0,QT),T=0;Math.abs(h.magnitudeSquared(a)-1)<P.EPSILON6&&(T=Gn.octEncodeFloat(a)),l=P.clamp(l,0,1),l=l===1?255:l*255|0,C=C*Lh+l,d=P.clamp(d,0,1),d=d===1?255:d*255|0,T=T*Lh+d,e._instanced?(r=o._index,s(r,C,T,c,f)):(r=o._index*4,s(r+0,C,T,c,f),s(r+1,C,T,c,f),s(r+2,C,T,c,f),s(r+3,C,T,c,f))}function f6(e,t,n,i,o){let r,s=i[yo.compressedAttribute2],a=o.color,c=u(e._batchTable)?z.WHITE:o.getPickId(t.context).color,l=o.sizeInMeters?1:0,f=Math.abs(h.magnitudeSquared(o.alignedAxis)-1)<P.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&l===1;let d=0,p=o._imageIndex;p!==-1&&(d=n[p].height);let g=e._textureAtlas.texture.dimensions,m=Math.round(y(o.height,g.y*d));e._maxSize=Math.max(e._maxSize,m);let A=y(o._labelHorizontalOrigin,-2);A+=2;let x=m*qoe+A,C=z.floatToByte(a.red),T=z.floatToByte(a.green),E=z.floatToByte(a.blue),S=C*QT+T*Lh+E;C=z.floatToByte(c.red),T=z.floatToByte(c.green),E=z.floatToByte(c.blue);let D=C*QT+T*Lh+E,w=z.floatToByte(a.alpha)*QT+z.floatToByte(c.alpha)*Lh;w+=l*2+f,e._instanced?(r=o._index,s(r,S,D,w,x)):(r=o._index*4,s(r+0,S,D,w,x),s(r+1,S,D,w,x),s(r+2,S,D,w,x),s(r+3,S,D,w,x))}function d6(e,t,n,i,o){let r,s=i[yo.eyeOffset],a=o.eyeOffset,c=a.z;if(o._heightReference!==We.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(a.x),Math.abs(a.y),Math.abs(c)),e._instanced){let l=0,f=0,d=o._imageIndex;if(d!==-1){let g=n[d];l=g.width,f=g.height}Ju.x=l,Ju.y=f;let p=Gn.compressTextureCoordinates(Ju);r=o._index,s(r,a.x,a.y,c,p)}else r=o._index*4,s(r+0,a.x,a.y,c,0),s(r+1,a.x,a.y,c,0),s(r+2,a.x,a.y,c,0),s(r+3,a.x,a.y,c,0)}function ere(e,t,n,i,o){let r,s=i[yo.scaleByDistance],a=0,c=1,l=1,f=1,d=o.scaleByDistance;u(d)&&(a=d.near,c=d.nearValue,l=d.far,f=d.farValue,(c!==1||f!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,l,f)):(r=o._index*4,s(r+0,a,c,l,f),s(r+1,a,c,l,f),s(r+2,a,c,l,f),s(r+3,a,c,l,f))}function tre(e,t,n,i,o){let r,s=i[yo.pixelOffsetScaleByDistance],a=0,c=1,l=1,f=1,d=o.pixelOffsetScaleByDistance;u(d)&&(a=d.near,c=d.nearValue,l=d.far,f=d.farValue,(c!==1||f!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,l,f)):(r=o._index*4,s(r+0,a,c,l,f),s(r+1,a,c,l,f),s(r+2,a,c,l,f),s(r+3,a,c,l,f))}function nre(e,t,n,i,o){let r,s=i[yo.compressedAttribute3],a=0,c=Number.MAX_VALUE,l=o.distanceDisplayCondition;u(l)&&(a=l.near,c=l.far,a*=a,c*=c,e._shaderDistanceDisplayCondition=!0);let f=o.disableDepthTestDistance,d=o.heightReference===We.CLAMP_TO_GROUND&&t.context.depthTexture;u(f)||(f=d?5e3:0),f*=f,(d||f>0)&&(e._shaderDisableDepthDistance=!0,f===Number.POSITIVE_INFINITY&&(f=-1));let p,g;if(u(o._labelDimensions))g=o._labelDimensions.x,p=o._labelDimensions.y;else{let C=0,T=0,E=o._imageIndex;if(E!==-1){let D=n[E];C=D.height,T=D.width}p=Math.round(y(o.height,e._textureAtlas.texture.dimensions.y*C));let S=e._textureAtlas.texture.width;g=Math.round(y(o.width,S*T))}let m=Math.floor(P.clamp(g,0,l6)),A=Math.floor(P.clamp(p,0,l6)),x=m*l6+A;e._instanced?(r=o._index,s(r,a,c,f,x)):(r=o._index*4,s(r+0,a,c,f,x),s(r+1,a,c,f,x),s(r+2,a,c,f,x),s(r+3,a,c,f,x))}function ire(e,t,n,i,o){if(o.heightReference===We.CLAMP_TO_GROUND){let m=e._scene,A=t.context,x=t.globeTranslucencyState.translucent,C=u(m.globe)&&m.globe.depthTestAgainstTerrain;e._shaderClampToGround=A.depthTexture&&!x&&C}let r,s=i[yo.textureCoordinateBoundsOrLabelTranslate];if(Ft.maximumVertexTextureImageUnits>0){let m=0,A=0;u(o._labelTranslate)&&(m=o._labelTranslate.x,A=o._labelTranslate.y),e._instanced?(r=o._index,s(r,m,A,0,0)):(r=o._index*4,s(r+0,m,A,0,0),s(r+1,m,A,0,0),s(r+2,m,A,0,0),s(r+3,m,A,0,0));return}let a=0,c=0,l=0,f=0,d=o._imageIndex;if(d!==-1){let m=n[d];a=m.x,c=m.y,l=m.width,f=m.height}let p=a+l,g=c+f;e._instanced?(r=o._index,s(r,a,c,p,g)):(r=o._index*4,s(r+0,a,c,p,g),s(r+1,a,c,p,g),s(r+2,a,c,p,g),s(r+3,a,c,p,g))}function k4e(e,t,n,i,o){if(!u(e._batchTable))return;let r=i[yo.a_batchId],s=o._batchIndex,a;e._instanced?(a=o._index,r(a,s)):(a=o._index*4,r(a+0,s),r(a+1,s),r(a+2,s),r(a+3,s))}function ore(e,t,n,i,o){if(!e._sdf)return;let r,s=i[yo.sdf],a=o.outlineColor,c=o.outlineWidth,l=z.floatToByte(a.red),f=z.floatToByte(a.green),d=z.floatToByte(a.blue),p=l*QT+f*Lh+d,g=c/bs.RADIUS,m=z.floatToByte(a.alpha)*QT+z.floatToByte(g)*Lh;e._instanced?(r=o._index,s(r,p,m)):(r=o._index*4,s(r+0,p+Xoe,m),s(r+1,p+Koe,m),s(r+2,p+Zoe,m),s(r+3,p+Joe,m))}function z4e(e,t,n,i,o){Yoe(e,t,n,i,o),Qoe(e,t,n,i,o),$oe(e,t,n,i,o),f6(e,t,n,i,o),d6(e,t,n,i,o),ere(e,t,n,i,o),tre(e,t,n,i,o),nre(e,t,n,i,o),ire(e,t,n,i,o),k4e(e,t,n,i,o),ore(e,t,n,i,o)}function u6(e,t,n,i,o,r){let s;i.mode===te.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;let a=[];for(let c=0;c<n;++c){let l=t[c],f=l.position,d=lo._computeActualPosition(l,f,i,o);u(d)&&(l._setActualPosition(d),r?a.push(d):se.expand(s,d,s))}r&&se.fromPoints(a,s)}function H4e(e,t){let n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==te.SCENE3D&&!M.equals(r,e.modelMatrix)?(e._mode=n,M.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===te.SCENE3D||n===te.SCENE2D||n===te.COLUMBUS_VIEW)&&u6(e,i,i.length,t,r,!0)):n===te.MORPHING?u6(e,i,i.length,t,r,!0):(n===te.SCENE2D||n===te.COLUMBUS_VIEW)&&u6(e,o,e._billboardsToUpdateIndex,t,r,!1)}function G4e(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 W4e(e,t){let n=`uniform sampler2D billboard_texture; 
in vec2 v_textureCoordinates; 
void main() 
{ 
    out_FragColor = texture(billboard_texture, v_textureCoordinates); 
} 
`,i=t.createViewportQuadCommand(n,{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Ee.OVERLAY,i}var j4e=[];Qu.prototype.update=function(e){if(m6(this),!this.show)return;let t=this._billboards,n=t.length,i=e.context;this._instanced=i.instancedArrays,yo=this._instanced?O4e:P4e,a6=this._instanced?B4e:R4e;let o=this._textureAtlas;if(!u(o)){o=this._textureAtlas=new Vg({context:i});for(let O=0;O<n;++O)t[O]._loadImage()}let r=o.textureCoordinates;if(r.length===0)return;H4e(this,e),t=this._billboards,n=t.length;let s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,l=o.guid,f=this._createVertexArray||this._textureAtlasGUID!==l;this._textureAtlasGUID=l;let d,p=e.passes,g=p.pick;if(f||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let O=0;O<h6;++O)c[O]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=L4e(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),d=this._vaf.writers;for(let O=0;O<n;++O){let L=this._billboards[O];L._dirty=!1,z4e(this,e,r,d,L)}this._vaf.commit(a6(i))}this._billboardsToUpdateIndex=0}else if(a>0){let O=j4e;O.length=0,(c[XO]||c[D4e]||c[S4e])&&O.push(Yoe),(c[qO]||c[Foe]||c[E4e]||c[b4e]||c[T4e])&&(O.push(Qoe),this._instanced&&O.push(d6)),(c[qO]||c[v4e]||c[zoe])&&(O.push($oe),O.push(f6)),(c[qO]||c[Uoe])&&O.push(f6),c[Voe]&&O.push(d6),c[koe]&&O.push(ere),c[Hoe]&&O.push(tre),(c[Goe]||c[w4e]||c[qO]||c[XO])&&O.push(nre),(c[qO]||c[XO])&&O.push(ire),c[Woe]&&O.push(ore);let L=O.length;if(d=this._vaf.writers,a/n>.1){for(let N=0;N<a;++N){let _=s[N];_._dirty=!1;for(let b=0;b<L;++b)O[b](this,e,r,d,_)}this._vaf.commit(a6(i))}else{for(let N=0;N<a;++N){let _=s[N];_._dirty=!1;for(let b=0;b<L;++b)O[b](this,e,r,d,_);this._instanced?this._vaf.subCommit(_._index,1):this._vaf.subCommit(_._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>n*1.5&&(s.length=n),!u(this._vaf)||!u(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m,A=M.IDENTITY;e.mode===te.SCENE3D?(A=this.modelMatrix,m=se.clone(this._baseVolumeWC,this._boundingVolume)):m=se.clone(this._baseVolume2D,this._boundingVolume),G4e(this,e,m);let x=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,x){this._blendOption===To.OPAQUE||this._blendOption===To.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:ee.LESS},depthMask:!0}):this._rsOpaque=void 0;let O=this._blendOption===To.TRANSLUCENT;this._blendOption===To.TRANSLUCENT||this._blendOption===To.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:O?ee.LEQUAL:ee.LESS},depthMask:O,blending:un.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let C,T,E,S,D,w=Ft.maximumVertexTextureImageUnits>0;if(x||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){C=jO,T=WO,D=[],u(this._batchTable)&&(D.push("VECTOR_TILE"),C=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(C),T=this._batchTable.getFragmentShaderCallback(!1,void 0)(T)),E=new ke({defines:D,sources:[C]}),this._instanced&&E.defines.push("INSTANCED"),this._shaderRotation&&E.defines.push("ROTATION"),this._shaderAlignedAxis&&E.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&E.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&E.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&E.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&E.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&E.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(w?E.defines.push("VERTEX_DEPTH_CHECK"):E.defines.push("FRAGMENT_DEPTH_CHECK"));let O=1-bs.CUTOFF;this._sdf&&E.defines.push("SDF");let L=u(this._batchTable)?"VECTOR_TILE":"";this._blendOption===To.OPAQUE_AND_TRANSLUCENT&&(S=new ke({defines:["OPAQUE",L],sources:[T]}),this._shaderClampToGround&&(w?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${O}`)),this._sp=Xt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:E,fragmentShaderSource:S,attributeLocations:yo}),S=new ke({defines:["TRANSLUCENT",L],sources:[T]}),this._shaderClampToGround&&(w?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${O}`)),this._spTranslucent=Xt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:E,fragmentShaderSource:S,attributeLocations:yo})),this._blendOption===To.OPAQUE&&(S=new ke({defines:[L],sources:[T]}),this._shaderClampToGround&&(w?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${O}`)),this._sp=Xt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:E,fragmentShaderSource:S,attributeLocations:yo})),this._blendOption===To.TRANSLUCENT&&(S=new ke({defines:[L],sources:[T]}),this._shaderClampToGround&&(w?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${O}`)),this._spTranslucent=Xt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:E,fragmentShaderSource:S,attributeLocations:yo})),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 R=e.commandList;if(p.render||p.pick){let O=this._colorCommands,L=this._blendOption===To.OPAQUE,N=this._blendOption===To.OPAQUE_AND_TRANSLUCENT,_=this._vaf.va,b=_.length,v=this._uniforms,I;u(this._batchTable)?(v=this._batchTable.getUniformMapCallback()(v),I=this._batchTable.getPickId()):I="v_pickColor",O.length=b;let B=N?b*2:b;for(let F=0;F<B;++F){let k=O[F];u(k)||(k=O[F]=new tt);let U=L||N&&F%2===0;k.pass=U||!N?Ee.OPAQUE:Ee.TRANSLUCENT,k.owner=this;let G=N?Math.floor(F/2):F;k.boundingVolume=m,k.modelMatrix=A,k.count=_[G].indicesCount,k.shaderProgram=U?this._sp:this._spTranslucent,k.uniformMap=v,k.vertexArray=_[G].va,k.renderState=U?this._rsOpaque:this._rsTranslucent,k.debugShowBoundingVolume=this.debugShowBoundingVolume,k.pickId=I,this._instanced&&(k.count=6,k.instanceCount=n),R.push(k)}this.debugShowTextureAtlas&&(u(this.debugCommand)||(this.debugCommand=W4e(this,e.context)),R.push(this.debugCommand))}};Qu.prototype.isDestroyed=function(){return!1};Qu.prototype.destroy=function(){return u(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(),joe(this._billboards),le(this)};var Jl=Qu;function Y4e(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 OA=Y4e;function Hs(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),$T(this)}var q4e=new he;Object.defineProperties(Hs.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=z.clone(e,this._color),$T(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,$T(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=z.clone(e,this._pointOutlineColor),$T(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,$T(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){u(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=y(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,q4e);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=z.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&&$T(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}}});Hs.defaultColor=z.WHITE;Hs.defaultPointOutlineColor=z.BLACK;Hs.defaultPointOutlineWidth=0;Hs.defaultPointSize=8;function $T(e){let t=e._billboard;if(u(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(u(e._billboardImage))return;let n=y(e._color,Hs.defaultColor),i=y(e._pointOutlineColor,Hs.defaultPointOutlineColor),o=y(e._pointOutlineWidth,Hs.defaultPointOutlineWidth),r=y(e._pointSize,Hs.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,c=e._billboardOutlineWidth,l=e._billboardSize;if(z.equals(n,s)&&z.equals(i,a)&&o===c&&r===l)return;e._billboardColor=z.clone(n,e._billboardColor),e._billboardOutlineColor=z.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;let f=n.alpha,d=n.toCssColorString(),p=i.toCssColorString(),g=JSON.stringify([d,r,p,o]);t.setImage(g,OA(f,d,p,o,r))}Hs.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Hs.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Hs.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Hs.prototype.getPropertyInherited=function(e){return xs.getPropertyInherited(this._content,this._batchId,e)};Hs.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Hs.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Hs.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Hs.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};var Rp=Hs;function X4e(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",""),c=document.createElement("canvas"),l=100,f=r.width+l|0,d=3*a,p=d/2;c.width=f,c.height=d;let g=c.getContext("2d");g.font=n,g.fillStyle="white",g.fillRect(0,0,c.width+1,c.height+1),i&&(g.strokeStyle="black",g.lineWidth=e.lineWidth,g.strokeText(t,l/2,p)),o&&(g.fillStyle="black",g.fillText(t,l/2,p));let m=g.getImageData(0,0,f,d).data,A=m.length,x=f*4,C,T,E,S;for(C=0;C<A;++C)if(m[C]!==255){E=C/x|0;break}for(C=A-1;C>=0;--C)if(m[C]!==255){S=C/x|0;break}let D=-1;for(C=0;C<f&&D===-1;++C)for(T=0;T<d;++T){let w=C*4+T*x;if(m[w]!==255||m[w+1]!==255||m[w+2]!==255||m[w+3]!==255){D=C;break}}return{width:r.width,height:S-E,ascent:p-E,descent:S-p,minx:D-l/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}var RA;function K4e(e,t){if(e==="")return;t=y(t,y.EMPTY_OBJECT);let n=y(t.font,"10px sans-serif"),i=y(t.stroke,!1),o=y(t.fill,!0),r=y(t.strokeWidth,1),s=y(t.backgroundColor,z.TRANSPARENT),a=y(t.padding,0),c=a*2,l=document.createElement("canvas");l.width=1,l.height=1,l.style.font=n;let f=l.getContext("2d");u(RA)||(u(f.imageSmoothingEnabled)?RA="imageSmoothingEnabled":u(f.mozImageSmoothingEnabled)?RA="mozImageSmoothingEnabled":u(f.webkitImageSmoothingEnabled)?RA="webkitImageSmoothingEnabled":u(f.msImageSmoothingEnabled)&&(RA="msImageSmoothingEnabled")),f.font=n,f.lineJoin="round",f.lineWidth=r,f[RA]=!1,l.style.visibility="hidden",document.body.appendChild(l);let d=X4e(f,e,n,i,o);l.dimensions=d,document.body.removeChild(l),l.style.visibility="";let p=-d.minx,g=Math.ceil(d.width)+p+c,m=d.height+c,A=m-d.ascent+a,x=m-A+c;if(l.width=g,l.height=m,f.font=n,f.lineJoin="round",f.lineWidth=r,f[RA]=!1,s!==z.TRANSPARENT&&(f.fillStyle=s.toCssColorString(),f.fillRect(0,0,l.width,l.height)),i){let C=y(t.strokeColor,z.BLACK);f.strokeStyle=C.toCssColorString(),f.strokeText(e,p+a,x)}if(o){let C=y(t.fillColor,z.WHITE);f.fillStyle=C.toCssColorString(),f.fillText(e,p+a,x)}return l}var BA=K4e;var pre=vo(cre(),1);var J4e={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},No=Object.freeze(J4e);var lre={},ure=0,Q4e=256,$4e=new z(.165,.165,.165,.8),eHe=new H(7,5),ts=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function MA(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function ZO(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function JO(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function dre(e){let t=lre[e._font];if(!u(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(JO(n,"line-height"));isNaN(i)&&(i=void 0),t={family:JO(n,"font-family"),size:JO(n,"font-size").replace("px",""),style:JO(n,"font-style"),weight:JO(n,"font-weight"),lineHeight:i},document.body.removeChild(n),ure<Q4e&&(lre[e._font]=t,ure++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Bp(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;u(n)&&(n=Pt.clone(n)),u(i)&&(i=Pt.clone(i)),u(o)&&(o=Pt.clone(o)),u(r)&&(r=bt.clone(r)),this._renderedText=void 0,this._text=void 0,this._show=y(e.show,!0),this._font=y(e.font,"30px sans-serif"),this._fillColor=z.clone(y(e.fillColor,z.WHITE)),this._outlineColor=z.clone(y(e.outlineColor,z.BLACK)),this._outlineWidth=y(e.outlineWidth,1),this._showBackground=y(e.showBackground,!1),this._backgroundColor=z.clone(y(e.backgroundColor,$4e)),this._backgroundPadding=H.clone(y(e.backgroundPadding,eHe)),this._style=y(e.style,No.FILL),this._verticalOrigin=y(e.verticalOrigin,On.BASELINE),this._horizontalOrigin=y(e.horizontalOrigin,_i.LEFT),this._pixelOffset=H.clone(y(e.pixelOffset,H.ZERO)),this._eyeOffset=h.clone(y(e.eyeOffset,h.ZERO)),this._position=h.clone(y(e.position,h.ZERO)),this._scale=y(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=y(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=y(e.text,""),this._relativeSize=1,dre(this),this._updateClamping()}Object.defineProperties(Bp.prototype,{show:{get:function(){return this._show},set:function(e){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;u(r)&&(r.show=e)}let n=this._backgroundBillboard;u(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){let t=this._position;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].billboard;u(s)&&(s.position=e)}let i=this._backgroundBillboard;u(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){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;u(r)&&(r.heightReference=e)}let n=this._backgroundBillboard;u(n)&&(n.heightReference=e),ZO(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(this._text!==e){this._text=e;let t=e.replace(/\u00ad/g,"");this._renderedText=Bp.enableRightToLeftDetection?sHe(t):t,MA(this)}}},font:{get:function(){return this._font},set:function(e){this._font!==e&&(this._font=e,MA(this),dre(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){let t=this._fillColor;z.equals(t,e)||(z.clone(e,t),MA(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){let t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),MA(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,MA(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){this._showBackground!==e&&(this._showBackground=e,MA(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){let t=this._backgroundColor;if(!z.equals(t,e)){z.clone(e,t);let n=this._backgroundBillboard;u(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){let t=this._backgroundPadding;H.equals(t,e)||(H.clone(e,t),ZO(this))}},style:{get:function(){return this._style},set:function(e){this._style!==e&&(this._style=e,MA(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){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];u(s.billboard)&&(s.billboard.pixelOffset=e)}let i=this._backgroundBillboard;u(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){let t=this._translucencyByDistance;if(!Pt.equals(t,e)){this._translucencyByDistance=Pt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];u(s.billboard)&&(s.billboard.translucencyByDistance=e)}let i=this._backgroundBillboard;u(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){let t=this._pixelOffsetScaleByDistance;if(!Pt.equals(t,e)){this._pixelOffsetScaleByDistance=Pt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];u(s.billboard)&&(s.billboard.pixelOffsetScaleByDistance=e)}let i=this._backgroundBillboard;u(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){let t=this._scaleByDistance;if(!Pt.equals(t,e)){this._scaleByDistance=Pt.clone(e,t);let n=this._glyphs;for(let o=0,r=n.length;o<r;o++){let s=n[o];u(s.billboard)&&(s.billboard.scaleByDistance=e)}let i=this._backgroundBillboard;u(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){let t=this._eyeOffset;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];u(s.billboard)&&(s.billboard.eyeOffset=e)}let i=this._backgroundBillboard;u(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin!==e&&(this._horizontalOrigin=e,ZO(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){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];u(r.billboard)&&(r.billboard.verticalOrigin=e)}let n=this._backgroundBillboard;u(n)&&(n.verticalOrigin=e),ZO(this)}}},scale:{get:function(){return this._scale},set:function(e){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];u(r.billboard)&&(r.billboard.scale=e*this._relativeSize)}let n=this._backgroundBillboard;u(n)&&(n.scale=e*this._relativeSize),ZO(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!bt.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=bt.clone(e,this._distanceDisplayCondition);let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];u(r.billboard)&&(r.billboard.distanceDisplayCondition=e)}let n=this._backgroundBillboard;u(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){this._disableDepthTestDistance=e;let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];u(r.billboard)&&(r.billboard.disableDepthTestDistance=e)}let n=this._backgroundBillboard;u(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];u(r.billboard)&&(r.billboard.id=e)}let n=this._backgroundBillboard;u(n)&&(n.id=e)}}},pickId:{get:function(){if(!(this._glyphs.length===0||!u(this._glyphs[0].billboard)))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=h.clone(e,this._actualClampedPosition);let t=this._glyphs;for(let i=0,o=t.length;i<o;i++){let r=t[i];u(r.billboard)&&(r.billboard._clampedPosition=e)}let n=this._backgroundBillboard;u(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];u(r.billboard)&&(r.billboard.clusterShow=e)}let n=this._backgroundBillboard;u(n)&&(n.clusterShow=e)}}}});Bp.prototype._updateClamping=function(){lo._updateClamping(this._labelCollection,this)};Bp.prototype.computeScreenSpacePosition=function(e,t){u(t)||(t=new H);let i=this._labelCollection.modelMatrix,o=u(this._actualClampedPosition)?this._actualClampedPosition:this._position;return lo._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};Bp.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0,a=e.totalScale,c=e._backgroundBillboard;if(u(c))i=t.x+c._translate.x,o=t.y-c._translate.y,r=c.width*a,s=c.height*a,e.verticalOrigin===On.BOTTOM||e.verticalOrigin===On.BASELINE?o-=s:e.verticalOrigin===On.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let l=0,f=0,d=e._glyphs,p=d.length;for(let g=0;g<p;++g){let m=d[g],A=m.billboard;if(!u(A))continue;let x=t.x+A._translate.x,C=t.y-A._translate.y,T=m.dimensions.width*a,E=m.dimensions.height*a;e.verticalOrigin===On.BOTTOM||e.verticalOrigin===On.BASELINE?C-=E:e.verticalOrigin===On.CENTER&&(C-=E*.5),e._verticalOrigin===On.TOP?C+=bs.PADDING*a:(e._verticalOrigin===On.BOTTOM||e._verticalOrigin===On.BASELINE)&&(C-=bs.PADDING*a),i=Math.min(i,x),o=Math.min(o,C),l=Math.max(l,x+T),f=Math.max(f,C+E)}r=l-i,s=f-o}return u(n)||(n=new Ye),n.x=i,n.y=o,n.width=r,n.height=s,n};Bp.prototype.equals=function(e){return this===e||u(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&&h.equals(this._position,e._position)&&z.equals(this._fillColor,e._fillColor)&&z.equals(this._outlineColor,e._outlineColor)&&z.equals(this._backgroundColor,e._backgroundColor)&&H.equals(this._backgroundPadding,e._backgroundPadding)&&H.equals(this._pixelOffset,e._pixelOffset)&&h.equals(this._eyeOffset,e._eyeOffset)&&Pt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Pt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Pt.equals(this._scaleByDistance,e._scaleByDistance)&&bt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};Bp.prototype.isDestroyed=function(){return!1};Bp.enableRightToLeftDetection=!1;function tHe(e,t){let n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[],r="",s=ts.LTR,a="",c=e.length;for(let l=0;l<c;++l){let f=e.charAt(l);t.test(f)?a=ts.RTL:n.test(f)?a=ts.LTR:i.test(f)?a=ts.BRACKETS:a=ts.WEAK,l===0&&(s=a),s===a&&a!==ts.BRACKETS?r+=f:(r!==""&&o.push({Type:s,Word:r}),s=a,r=f)}return o.push({Type:a,Word:r}),o}function nHe(e){return e.split("").reverse().join("")}function QO(e,t,n){return e.slice(0,t)+n+e.slice(t)}function iHe(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}var oHe="\u05D0-\u05EA",rHe="\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF",fre=new RegExp(`[${oHe}${rHe}]`);function sHe(e){let t=e.split(`
`),n="";for(let i=0;i<t.length;i++){let o=t[i],r=fre.test(o.charAt(0)),s=tHe(o,fre),a=0,c="";for(let l=0;l<s.length;++l){let f=s[l],d=f.Type===ts.BRACKETS?iHe(f.Word):nHe(f.Word);r?f.Type===ts.RTL?(c=d+c,a=0):f.Type===ts.LTR?(c=QO(c,a,f.Word),a+=f.Word.length):(f.Type===ts.WEAK||f.Type===ts.BRACKETS)&&(f.Type===ts.WEAK&&s[l-1].Type===ts.BRACKETS?c=d+c:s[l-1].Type===ts.RTL?(c=d+c,a=0):s.length>l+1?s[l+1].Type===ts.RTL?(c=d+c,a=0):(c=QO(c,a,f.Word),a+=f.Word.length):c=QO(c,0,d)):f.Type===ts.RTL?c=QO(c,a,d):f.Type===ts.LTR?(c+=f.Word,a=c.length):(f.Type===ts.WEAK||f.Type===ts.BRACKETS)&&(l>0&&s[l-1].Type===ts.RTL?s.length>l+1?s[l+1].Type===ts.RTL?c=QO(c,a,d):(c+=f.Word,a=c.length):c+=f.Word:(c+=f.Word,a=c.length))}n+=c,i<t.length-1&&(n+=`
`)}return n}var Ug=Bp;var _re=vo(hre(),1);function cHe(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function lHe(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}var uHe=1.2,gre="ID_WHITE_PIXEL",p6=new H(4,4),fHe=new Ye(1,1,1,1);function dHe(e){let t=document.createElement("canvas");t.width=p6.x,t.height=p6.y;let n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(gre,t)}var $u={};function hHe(e,t,n,i,o,r,s){return $u.font=t,$u.fillColor=n,$u.strokeColor=i,$u.strokeWidth=o,$u.padding=bs.PADDING,s===On.CENTER?$u.textBaseline="middle":s===On.TOP?$u.textBaseline="top":$u.textBaseline="bottom",$u.fill=r===No.FILL||r===No.FILL_AND_OUTLINE,$u.stroke=r===No.OUTLINE||r===No.FILL_AND_OUTLINE,$u.backgroundColor=z.BLACK,BA(e,$u)}function _6(e,t){t.textureInfo=void 0,t.dimensions=void 0;let n=t.billboard;u(n)&&(n.show=!1,n.image=void 0,u(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function mHe(e,t,n,i){i.index=e.addImageSync(t,n)}var pHe=new _re.default;function _He(e,t){let n=t._renderedText,i=pHe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length,a,c,l;if(t._relativeSize=t._fontSize/bs.FONT_SIZE,o<s)for(c=o;c<s;++c)_6(e,r[c]);r.length=o;let f=t._showBackground&&n.split(`
`).join("").length>0,d=t._backgroundBillboard,p=e._backgroundBillboardCollection;f?(u(d)||(d=p.add({collection:e,image:gre,imageSubRegion:fHe}),t._backgroundBillboard=d),d.color=t._backgroundColor,d.show=t._show,d.position=t._position,d.eyeOffset=t._eyeOffset,d.pixelOffset=t._pixelOffset,d.horizontalOrigin=_i.LEFT,d.verticalOrigin=t._verticalOrigin,d.heightReference=t._heightReference,d.scale=t.totalScale,d.pickPrimitive=t,d.id=t._id,d.translucencyByDistance=t._translucencyByDistance,d.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,d.scaleByDistance=t._scaleByDistance,d.distanceDisplayCondition=t._distanceDisplayCondition,d.disableDepthTestDistance=t._disableDepthTestDistance):u(d)&&(p.remove(d),t._backgroundBillboard=d=void 0);let g=e._glyphTextureCache;for(l=0;l<o;++l){let m=i[l],A=t._verticalOrigin,x=JSON.stringify([m,t._fontFamily,t._fontStyle,t._fontWeight,+A]),C=g[x];if(!u(C)){let T=`${t._fontStyle} ${t._fontWeight} ${bs.FONT_SIZE}px ${t._fontFamily}`,E=hHe(m,T,z.WHITE,z.WHITE,0,No.FILL,A);if(C=new lHe(e,-1,E.dimensions),g[x]=C,E.width>0&&E.height>0){let S=(0,pre.default)(E,{cutoff:bs.CUTOFF,radius:bs.RADIUS}),D=E.getContext("2d"),w=E.width,R=E.height,O=D.getImageData(0,0,w,R);for(let L=0;L<w;L++)for(let N=0;N<R;N++){let _=N*w+L,b=S[_]*255,v=_*4;O.data[v+0]=b,O.data[v+1]=b,O.data[v+2]=b,O.data[v+3]=b}D.putImageData(O,0,0),m!==" "&&mHe(e._textureAtlas,x,E,C)}}if(a=r[l],u(a)?C.index===-1?_6(e,a):u(a.textureInfo)&&(a.textureInfo=void 0):(a=new cHe,r[l]=a),a.textureInfo=C,a.dimensions=C.dimensions,C.index!==-1){let T=a.billboard,E=e._spareBillboards;u(T)||(E.length>0?T=E.pop():(T=e._billboardCollection.add({collection:e}),T._labelDimensions=new H,T._labelTranslate=new H),a.billboard=T),T.show=t._show,T.position=t._position,T.eyeOffset=t._eyeOffset,T.pixelOffset=t._pixelOffset,T.horizontalOrigin=_i.LEFT,T.verticalOrigin=t._verticalOrigin,T.heightReference=t._heightReference,T.scale=t.totalScale,T.pickPrimitive=t,T.id=t._id,T.image=x,T.translucencyByDistance=t._translucencyByDistance,T.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,T.scaleByDistance=t._scaleByDistance,T.distanceDisplayCondition=t._distanceDisplayCondition,T.disableDepthTestDistance=t._disableDepthTestDistance,T._batchIndex=t._batchIndex,T.outlineColor=t.outlineColor,t.style===No.FILL_AND_OUTLINE?(T.color=t._fillColor,T.outlineWidth=t.outlineWidth):t.style===No.FILL?(T.color=t._fillColor,T.outlineWidth=0):t.style===No.OUTLINE&&(T.color=z.TRANSPARENT,T.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function mre(e,t,n){return t===_i.CENTER?-e/2:t===_i.RIGHT?-(e+n.x):n.x}var sr=new H,gHe=new H;function yHe(e){let t=e._glyphs,n=e._renderedText,i,o,r=0,s=0,a=[],c=Number.NEGATIVE_INFINITY,l=0,f=1,d,p=t.length,g=e._backgroundBillboard,m=H.clone(u(g)?e._backgroundPadding:H.ZERO,gHe);for(m.x/=e._relativeSize,m.y/=e._relativeSize,d=0;d<p;++d)n.charAt(d)===`
`?(a.push(r),++f,r=0):(i=t[d],o=i.dimensions,l=Math.max(l,o.height-o.descent),c=Math.max(c,o.descent),r+=o.width-o.minx,d<p-1&&(r+=t[d+1].dimensions.minx),s=Math.max(s,r));a.push(r);let A=l+c,x=e.totalScale,C=e._horizontalOrigin,T=e._verticalOrigin,E=0,S=a[E],D=mre(S,C,m),w=(u(e._lineHeight)?e._lineHeight:uHe*e._fontSize)/e._relativeSize,R=w*(f-1),O=s,L=A+R;u(g)&&(O+=m.x*2,L+=m.y*2,g._labelHorizontalOrigin=C),sr.x=D*x,sr.y=0;let N=!0,_=0;for(d=0;d<p;++d)if(n.charAt(d)===`
`)++E,_+=w,S=a[E],D=mre(S,C,m),sr.x=D*x,N=!0;else if(i=t[d],o=i.dimensions,T===On.TOP?(sr.y=o.height-l-m.y,sr.y+=bs.PADDING):T===On.CENTER?sr.y=(R+o.height-l)/2:T===On.BASELINE?(sr.y=R,sr.y-=bs.PADDING):(sr.y=R+c+m.y,sr.y-=bs.PADDING),sr.y=(sr.y-o.descent-_)*x,N&&(sr.x-=bs.PADDING*x,N=!1),u(i.billboard)&&(i.billboard._setTranslate(sr),i.billboard._labelDimensions.x=O,i.billboard._labelDimensions.y=L,i.billboard._labelHorizontalOrigin=C),d<p-1){let b=t[d+1];sr.x+=(o.width-o.minx+b.dimensions.minx)*x}if(u(g)&&n.split(`
`).join("").length>0&&(C===_i.CENTER?D=-s/2-m.x:C===_i.RIGHT?D=-(s+m.x*2):D=0,sr.x=D*x,T===On.TOP?sr.y=A-l-c:T===On.CENTER?sr.y=(A-l)/2-c:T===On.BASELINE?sr.y=-m.y-c:sr.y=0,sr.y=sr.y*x,g.width=O,g.height=L,g._setTranslate(sr),g._labelTranslate=H.clone(sr,g._labelTranslate)),e.heightReference===We.CLAMP_TO_GROUND)for(d=0;d<p;++d){i=t[d];let b=i.billboard;u(b)&&(b._labelTranslate=H.clone(sr,b._labelTranslate))}}function yre(e,t){let n=t._glyphs;for(let i=0,o=n.length;i<o;++i)_6(e,n[i]);u(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,u(t._removeCallbackFunc)&&t._removeCallbackFunc(),le(t)}function Nh(e){e=y(e,y.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new Jl({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new Jl({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=z.clone(z.WHITE),this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,To.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(Nh.prototype,{length:{get:function(){return this._labels.length}}});Nh.prototype.add=function(e){let t=new Ug(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Nh.prototype.remove=function(e){if(u(e)&&e._labelCollection===this){let t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),yre(this,e),!0}return!1};Nh.prototype.removeAll=function(){let e=this._labels;for(let t=0,n=e.length;t<n;++t)yre(this,e[t]);e.length=0};Nh.prototype.contains=function(e){return u(e)&&e._labelCollection===this};Nh.prototype.get=function(e){return this._labels[e]};Nh.prototype.update=function(e){if(!this.show)return;let t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;let i=e.context;u(this._textureAtlas)||(this._textureAtlas=new Vg({context:i}),t.textureAtlas=this._textureAtlas),u(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new Vg({context:i,initialSize:p6}),n.textureAtlas=this._backgroundTextureAtlas,dHe(this._backgroundTextureAtlas));let o=this._labelsToUpdate.length;for(let s=0;s<o;++s){let a=this._labelsToUpdate[s];if(a.isDestroyed())continue;let c=a._glyphs.length;a._rebindAllGlyphs&&(_He(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(yHe(a),a._repositionAllGlyphs=!1);let l=a._glyphs.length-c;this._totalGlyphCount+=l}let r=n.length>0?To.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Nh.prototype.isDestroyed=function(){return!1};Nh.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),le(this)};var Fh=Nh;var $O=`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 Oc={};Oc.numberOfPoints=function(e,t,n){let i=h.distance(e,t);return Math.ceil(i/n)};Oc.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 AHe=new he;Oc.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,AHe).height}return i};var xHe=new M,CHe=new h,Are=new h,THe=new cn(h.UNIT_X,0),xre=new h,EHe=new cn(h.UNIT_X,0),bHe=new h,SHe=new h,y6=[];function Tre(e,t,n){let i=y6;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 rU=new he,oU=new he,kg=new h,A6=new h,DHe=new h,g6=new Gu,eR=new la;function vHe(e,t,n,i,o,r,s,a){let c=i.scaleToGeodeticSurface(e,A6),l=i.scaleToGeodeticSurface(t,DHe),f=Oc.numberOfPoints(e,t,n),d=i.cartesianToCartographic(c,rU),p=i.cartesianToCartographic(l,oU),g=Tre(f,o,r);g6.setEndPoints(d,p);let m=g6.surfaceDistance/f,A=a;d.height=o;let x=i.cartographicToCartesian(d,kg);h.pack(x,s,A),A+=3;for(let C=1;C<f;C++){let T=g6.interpolateUsingSurfaceDistance(C*m,oU);T.height=g[C],x=i.cartographicToCartesian(T,kg),h.pack(x,s,A),A+=3}return A}function wHe(e,t,n,i,o,r,s,a){let c=i.cartesianToCartographic(e,rU),l=i.cartesianToCartographic(t,oU),f=Oc.numberOfPointsRhumbLine(c,l,n);c.height=0,l.height=0;let d=Tre(f,o,r);eR.ellipsoid.equals(i)||(eR=new la(void 0,void 0,i)),eR.setEndPoints(c,l);let p=eR.surfaceDistance/f,g=a;c.height=o;let m=i.cartographicToCartesian(c,kg);h.pack(m,s,g),g+=3;for(let A=1;A<f;A++){let x=eR.interpolateUsingSurfaceDistance(A*p,oU);x.height=d[A],m=i.cartographicToCartesian(x,kg),h.pack(m,s,g),g+=3}return g}Oc.wrapLongitude=function(e,t){let n=[],i=[];if(u(e)&&e.length>0){t=y(t,M.IDENTITY);let o=M.inverseTransformation(t,xHe),r=M.multiplyByPoint(o,h.ZERO,CHe),s=h.normalize(M.multiplyByPointAsVector(o,h.UNIT_Y,Are),Are),a=cn.fromPointNormal(r,s,THe),c=h.normalize(M.multiplyByPointAsVector(o,h.UNIT_X,xre),xre),l=cn.fromPointNormal(r,c,EHe),f=1;n.push(h.clone(e[0]));let d=n[0],p=e.length;for(let g=1;g<p;++g){let m=e[g];if(cn.getPointDistance(l,d)<0||cn.getPointDistance(l,m)<0){let A=Yi.lineSegmentPlane(d,m,a,bHe);if(u(A)){let x=h.multiplyByScalar(s,5e-9,SHe);cn.getPointDistance(a,d)<0&&h.negate(x,x),n.push(h.add(A,x,new h)),i.push(f+1),h.negate(x,x),n.push(h.add(A,x,new h)),f=1}}n.push(h.clone(e[g])),f++,d=m}i.push(f)}return{positions:n,lengths:i}};Oc.generateArc=function(e){u(e)||(e={});let t=e.positions,n=t.length,i=y(e.ellipsoid,ie.WGS84),o=y(e.height,0),r=Array.isArray(o);if(n<1)return[];if(n===1){let A=i.scaleToGeodeticSurface(t[0],A6);if(o=r?o[0]:o,o!==0){let x=i.geodeticSurfaceNormal(A,kg);h.multiplyByScalar(x,o,x),h.add(A,x,A)}return[A.x,A.y,A.z]}let s=e.minDistance;if(!u(s)){let A=y(e.granularity,P.RADIANS_PER_DEGREE);s=P.chordLength(A,i.maximumRadius)}let a=0,c;for(c=0;c<n-1;c++)a+=Oc.numberOfPoints(t[c],t[c+1],s);let l=(a+1)*3,f=new Array(l),d=0;for(c=0;c<n-1;c++){let A=t[c],x=t[c+1],C=r?o[c]:o,T=r?o[c+1]:o;d=vHe(A,x,s,i,C,T,f,d)}y6.length=0;let p=t[n-1],g=i.cartesianToCartographic(p,rU);g.height=r?o[n-1]:o;let m=i.cartographicToCartesian(g,kg);return h.pack(m,f,l-3),f};var Cre=new he,IHe=new he;Oc.generateRhumbArc=function(e){u(e)||(e={});let t=e.positions,n=t.length,i=y(e.ellipsoid,ie.WGS84),o=y(e.height,0),r=Array.isArray(o);if(n<1)return[];if(n===1){let C=i.scaleToGeodeticSurface(t[0],A6);if(o=r?o[0]:o,o!==0){let T=i.geodeticSurfaceNormal(C,kg);h.multiplyByScalar(T,o,T),h.add(C,T,C)}return[C.x,C.y,C.z]}let s=y(e.granularity,P.RADIANS_PER_DEGREE),a=0,c,l=i.cartesianToCartographic(t[0],Cre),f;for(c=0;c<n-1;c++)f=i.cartesianToCartographic(t[c+1],IHe),a+=Oc.numberOfPointsRhumbLine(l,f,s),l=he.clone(f,Cre);let d=(a+1)*3,p=new Array(d),g=0;for(c=0;c<n-1;c++){let C=t[c],T=t[c+1],E=r?o[c]:o,S=r?o[c+1]:o;g=wHe(C,T,s,i,E,S,p,g)}y6.length=0;let m=t[n-1],A=i.cartesianToCartographic(m,rU);A.height=r?o[n-1]:o;let x=i.cartographicToCartesian(A,kg);return h.pack(x,p,d-3),p};Oc.generateCartesianArc=function(e){let t=Oc.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=h.unpack(t,o*3);return i};Oc.generateCartesianRhumbArc=function(e){let t=Oc.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=h.unpack(t,o*3);return i};var Di=Oc;function Ql(e,t){e=y(e,y.EMPTY_OBJECT),this._show=y(e.show,!0),this._width=y(e.width,1),this._loop=y(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,u(this._material)||(this._material=Vi.fromType(Vi.ColorType,{color:new z(1,1,1,1)}));let n=e.positions;u(n)||(n=[]),this._positions=n,this._actualPositions=go(n,h.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(h.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;u(t)&&(i=M.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=Di.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(bre),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=se.fromPoints(this._actualPositions),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new se}var Ere=Ql.POSITION_INDEX=0,PHe=Ql.SHOW_INDEX=1,OHe=Ql.WIDTH_INDEX=2,RHe=Ql.MATERIAL_INDEX=3,tR=Ql.POSITION_SIZE_INDEX=4,BHe=Ql.DISTANCE_DISPLAY_CONDITION=5,bre=Ql.NUMBER_OF_PROPERTIES=6;function Mp(e,t){++e._propertiesChanged[t];let n=e._polylineCollection;u(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(Ql.prototype,{show:{get:function(){return this._show},set:function(e){e!==this._show&&(this._show=e,Mp(this,PHe))}},positions:{get:function(){return this._positions},set:function(e){let t=go(e,h.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(h.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Mp(this,tR),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=se.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Mp(this,Ere),this.update()}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,Mp(this,RHe))}},width:{get:function(){return this._width},set:function(e){let t=this._width;e!==t&&(this._width=e,Mp(this,OHe))}},loop:{get:function(){return this._loop},set:function(e){if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!h.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(h.clone(t[0]))):t.length>2&&h.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Mp(this,tR)}}},id:{get:function(){return this._id},set:function(e){this._id=e,u(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!u(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){bt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=bt.clone(e,this._distanceDisplayCondition),Mp(this,BHe))}}});Ql.prototype.update=function(){let e=M.IDENTITY;u(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);let t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[Ere]>0||this._propertiesChanged[tR]>0;if((!M.equals(e,this._modelMatrix)||i)&&(this._segments=Di.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=se.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=M.clone(e,this._modelMatrix),this._segments.positions.length!==t)Mp(this,tR);else{let o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Mp(this,tR);break}}};Ql.prototype.getPickId=function(e){return u(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};Ql.prototype._clean=function(){this._dirty=!1;let e=this._propertiesChanged;for(let t=0;t<bre-1;++t)e[t]=0};Ql.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};var ef=Ql;var MHe=ef.SHOW_INDEX,LHe=ef.WIDTH_INDEX,C6=ef.POSITION_INDEX,NHe=ef.MATERIAL_INDEX,Sre=ef.POSITION_SIZE_INDEX,FHe=ef.DISTANCE_DISPLAY_CONDITION,Rre=ef.NUMBER_OF_PROPERTIES,_l={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 _d(e){e=y(e,y.EMPTY_OBJECT),this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=M.clone(M.IDENTITY),this.debugShowBoundingVolume=y(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(Rre),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:Ne.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=z.clone(z.WHITE);let t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(_d.prototype,{length:{get:function(){return T6(this),this._polylines.length}}});_d.prototype.add=function(e){let t=new ef(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};_d.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,u(e._bucket)){let t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1};_d.prototype.removeAll=function(){E6(this),Fre(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};_d.prototype.contains=function(e){return u(e)&&e._polylineCollection===this};_d.prototype.get=function(e){return T6(this),this._polylines[e]};function VHe(e,t){u(e._batchTable)&&e._batchTable.destroy();let n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:q.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:q.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:q.FLOAT,componentsPerAttribute:2}];e._batchTable=new O0(t,n,e._polylines.length)}var Bre=new Hn,Mre=new oe,Lre=new H;_d.prototype.update=function(e){if(T6(this),this._polylines.length===0||!this.show)return;WHe(this,e);let t=e.context,n=e.mapProjection,i,o=this._propertiesChanged;if(this._createBatchTable){if(Ft.maximumVertexTextureImageUnits===0)throw new ue("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");VHe(this,t),this._createBatchTable=!1}if(this._createVertexArray||kHe(this))wre(this,t,n);else if(this._polylinesUpdated){let c=this._polylinesToUpdate;if(this._mode!==te.SCENE3D){let l=c.length;for(let f=0;f<l;++f)i=c[f],i.update()}if(o[Sre]||o[NHe])wre(this,t,n);else{let l=c.length,f=this._polylineBuckets;for(let d=0;d<l;++d){i=c[d],o=i._propertiesChanged;let p=i._bucket,g=0;for(let m in f)if(f.hasOwnProperty(m)){if(f[m]===p){o[C6]&&p.writeUpdate(g,i,this._positionBuffer,n);break}g+=f[m].lengthOfPositions}if((o[MHe]||o[LHe])&&this._batchTable.setBatchedAttribute(i._index,0,new H(i._width,i._show)),this._batchTable.attributes.length>2){if(o[C6]||o[Sre]){let m=e.mode===te.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,A=Hn.fromCartesian(m.center,Bre),x=oe.fromElements(A.low.x,A.low.y,A.low.z,m.radius,Mre);this._batchTable.setBatchedAttribute(i._index,2,A.high),this._batchTable.setBatchedAttribute(i._index,3,x)}if(o[FHe]){let m=Lre;m.x=0,m.y=Number.MAX_VALUE;let A=i.distanceDisplayCondition;u(A)&&(m.x=A.near,m.y=A.far),this._batchTable.setBatchedAttribute(i._index,4,m)}}i._clean()}}c.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let c=0;c<Rre;++c)o[c]=0;let r=M.IDENTITY;e.mode===te.SCENE3D&&(r=this.modelMatrix);let s=e.passes,a=e.morphTime!==0;if((!u(this._opaqueRS)||this._opaqueRS.depthTest.enabled!==a)&&(this._opaqueRS=Ue.fromCache({depthMask:a,depthTest:{enabled:a}})),(!u(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=Ue.fromCache({blending:un.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){let c=this._colorCommands;UHe(this,e,c,r)}};var nR=new se,Dre=new se;function UHe(e,t,n,i){let o=t.context,r=t.commandList,s=n.length,a=0,c=!0,l=e._vertexArrays,f=e.debugShowBoundingVolume,p=e._batchTable.getUniformMapCallback(),g=l.length;for(let m=0;m<g;++m){let A=l[m],x=A.buckets,C=x.length;for(let T=0;T<C;++T){let E=x[T],S=E.offset,D=E.bucket.shaderProgram,w=E.bucket.polylines,R=w.length,O,L,N=0,_,b;for(let v=0;v<R;++v){let I=w[v],B=HHe(I._material);if(B!==O){if(u(O)&&N>0){let G=L.isTranslucent();a>=s?(_=new tt({owner:e}),n.push(_)):_=n[a],++a,b=_t(p(L._uniforms),e._uniformMap),_.boundingVolume=se.clone(nR,_.boundingVolume),_.modelMatrix=i,_.shaderProgram=D,_.vertexArray=A.va,_.renderState=G?e._translucentRS:e._opaqueRS,_.pass=G?Ee.TRANSLUCENT:Ee.OPAQUE,_.debugShowBoundingVolume=f,_.pickId="v_pickColor",_.uniformMap=b,_.count=N,_.offset=S,S+=N,N=0,c=!0,r.push(_)}L=I._material,L.update(o),O=B}let F=I._locatorBuckets,k=F.length;for(let G=0;G<k;++G){let V=F[G];V.locator===E&&(N+=V.count)}let U;t.mode===te.SCENE3D?U=I._boundingVolumeWC:t.mode===te.COLUMBUS_VIEW?U=I._boundingVolume2D:t.mode===te.SCENE2D?u(I._boundingVolume2D)&&(U=se.clone(I._boundingVolume2D,Dre),U.center.x=0):u(I._boundingVolumeWC)&&u(I._boundingVolume2D)&&(U=se.union(I._boundingVolumeWC,I._boundingVolume2D,Dre)),c?(c=!1,se.clone(U,nR)):se.union(U,nR,nR)}u(O)&&N>0&&(a>=s?(_=new tt({owner:e}),n.push(_)):_=n[a],++a,b=_t(p(L._uniforms),e._uniformMap),_.boundingVolume=se.clone(nR,_.boundingVolume),_.modelMatrix=i,_.shaderProgram=D,_.vertexArray=A.va,_.renderState=L.isTranslucent()?e._translucentRS:e._opaqueRS,_.pass=L.isTranslucent()?Ee.TRANSLUCENT:Ee.OPAQUE,_.debugShowBoundingVolume=f,_.pickId="v_pickColor",_.uniformMap=b,_.count=N,_.offset=S,c=!0,r.push(_)),O=void 0}}n.length=a}_d.prototype.isDestroyed=function(){return!1};_d.prototype.destroy=function(){return Nre(this),E6(this),Fre(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),le(this)};function kHe(e){let t=!1,n=e._propertiesChanged,i=e._positionBufferUsage;return n[C6]?(i.bufferUsage!==Ne.STREAM_DRAW&&(t=!0,i.bufferUsage=Ne.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==Ne.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=Ne.STATIC_DRAW):i.frameCount--),t}var vre=[0,0,0];function wre(e,t,n){e._createVertexArray=!1,E6(e),Nre(e),GHe(e);let i=[[]],o=i[0],r=e._batchTable,s=e._useHighlightColor,a=[0],c=0,l=[[]],f=0,d=e._polylineBuckets,p,g;for(p in d)d.hasOwnProperty(p)&&(g=d[p],g.updateShader(t,r,s),f+=g.lengthOfPositions);if(f>0){let m=e._mode,A=new Float32Array(6*f*3),x=new Float32Array(f*4),C,T=0,E=0,S=0;for(p in d)if(d.hasOwnProperty(p)){g=d[p],g.write(A,x,T,E,S,r,t,n),m===te.MORPHING&&(u(C)||(C=new Float32Array(6*f*3)),g.writeForMorph(C,T));let b=g.lengthOfPositions;T+=6*b*3,E+=b*4,S+=b*4,c=g.updateIndices(i,a,l,c)}let D=e._positionBufferUsage.bufferUsage,w=Ne.STATIC_DRAW;e._positionBuffer=lt.createVertexBuffer({context:t,typedArray:A,usage:D});let R;u(C)&&(R=lt.createVertexBuffer({context:t,typedArray:C,usage:D})),e._texCoordExpandAndBatchIndexBuffer=lt.createVertexBuffer({context:t,typedArray:x,usage:w});let O=3*Float32Array.BYTES_PER_ELEMENT,L=4*Float32Array.BYTES_PER_ELEMENT,N=0,_=i.length;for(let b=0;b<_;++b)if(o=i[b],o.length>0){let v=new Uint16Array(o),I=lt.createIndexBuffer({context:t,typedArray:v,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});N+=a[b];let B=6*(b*(O*P.SIXTY_FOUR_KILOBYTES)-N*O),F=O+B,k=O+F,U=O+k,G=O+U,V=O+G,X=b*(L*P.SIXTY_FOUR_KILOBYTES)-N*L,j=[{index:_l.position3DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:B,strideInBytes:6*O},{index:_l.position3DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:F,strideInBytes:6*O},{index:_l.position2DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:B,strideInBytes:6*O},{index:_l.position2DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:F,strideInBytes:6*O},{index:_l.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:k,strideInBytes:6*O},{index:_l.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:U,strideInBytes:6*O},{index:_l.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:k,strideInBytes:6*O},{index:_l.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:U,strideInBytes:6*O},{index:_l.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:G,strideInBytes:6*O},{index:_l.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:V,strideInBytes:6*O},{index:_l.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:G,strideInBytes:6*O},{index:_l.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:q.FLOAT,offsetInBytes:V,strideInBytes:6*O},{index:_l.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:q.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:X}],Q,W,K,J;m===te.SCENE3D?(W=e._positionBuffer,Q="vertexBuffer",K=vre,J="value"):m===te.SCENE2D||m===te.COLUMBUS_VIEW?(W=vre,Q="value",K=e._positionBuffer,J="vertexBuffer"):(W=R,Q="vertexBuffer",K=e._positionBuffer,J="vertexBuffer"),j[0][Q]=W,j[1][Q]=W,j[2][J]=K,j[3][J]=K,j[4][Q]=W,j[5][Q]=W,j[6][J]=K,j[7][J]=K,j[8][Q]=W,j[9][Q]=W,j[10][J]=K,j[11][J]=K;let _e=new oi({context:t,attributes:j,indexBuffer:I});e._vertexArrays.push({va:_e,buckets:l[b]})}}}function zHe(e,t){return t instanceof It?t.id:t}var sU=[];function HHe(e){let t=Vi._uniformList[e.type],n=t.length;sU.length=2*n;let i=0;for(let o=0;o<n;++o){let r=t[o];sU[i]=r,sU[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify(sU,zHe)}`}function GHe(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 c=a.material,l=i[c.type];u(l)||(l=i[c.type]=new Vh(c,t,n)),l.addPolyline(a)}}}function WHe(e,t){let n=t.mode;(e._mode!==n||!M.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=M.clone(e.modelMatrix),e._createVertexArray=!0)}function T6(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 E6(e){let t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){let o=t[i]._bucket;u(o)&&(o.shaderProgram=o.shaderProgram&&o.shaderProgram.destroy())}}function Nre(e){let t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}_d.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function Fre(e){let t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function x6(e,t,n){this.count=e,this.offset=t,this.bucket=n}function Vh(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}Vh.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};Vh.prototype.updateShader=function(e,t,n){if(u(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 ke({defines:i,sources:[`in vec4 v_pickColor;
`,this.material.shaderSource,H0]}),r=t.getVertexShaderCallback()($O),s=new ke({defines:i,sources:[Wl,r]});this.shaderProgram=Xt.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:_l})};function Vre(e){return h.dot(h.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(cn.ORIGIN_ZX_PLANE)===Qt.INTERSECTING}Vh.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===te.SCENE3D||!Vre(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 as=new h,tf=new h,nf=new h,aU=new h,jHe=new oe,YHe=new H;Vh.prototype.write=function(e,t,n,i,o,r,s,a){let c=this.mode,l=a.ellipsoid.maximumRadius*P.PI,f=this.polylines,d=f.length;for(let p=0;p<d;++p){let g=f[p],m=g.width,A=g.show&&m>0,x=g._index,C=this.getSegments(g,a),T=C.positions,E=C.lengths,S=T.length,D=g.getPickId(s).color,w=0,R=0,O;for(let k=0;k<S;++k){k===0?g._loop?O=T[S-2]:(O=aU,h.subtract(T[0],T[1],O),h.add(T[0],O,O)):O=T[k-1],h.clone(O,tf),h.clone(T[k],as),k===S-1?g._loop?O=T[1]:(O=aU,h.subtract(T[S-1],T[S-2],O),h.add(T[S-1],O,O)):O=T[k+1],h.clone(O,nf);let U=E[w];k===R+U&&(R+=U,++w);let G=k-R===0,V=k===R+E[w]-1;c===te.SCENE2D&&(tf.z=0,as.z=0,nf.z=0),(c===te.SCENE2D||c===te.MORPHING)&&(G||V)&&l-Math.abs(as.x)<1&&((as.x<0&&tf.x>0||as.x>0&&tf.x<0)&&h.clone(as,tf),(as.x<0&&nf.x>0||as.x>0&&nf.x<0)&&h.clone(as,nf));let X=G?2:0,j=V?2:4;for(let Q=X;Q<j;++Q){Hn.writeElements(as,e,n),Hn.writeElements(tf,e,n+6),Hn.writeElements(nf,e,n+12);let W=Q-2<0?-1:1;t[o]=k/(S-1),t[o+1]=2*(Q%2)-1,t[o+2]=W,t[o+3]=x,n+=6*3,o+=4}}let L=jHe;L.x=z.floatToByte(D.red),L.y=z.floatToByte(D.green),L.z=z.floatToByte(D.blue),L.w=z.floatToByte(D.alpha);let N=YHe;N.x=m,N.y=A?1:0;let _=c===te.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,b=Hn.fromCartesian(_.center,Bre),v=b.high,I=oe.fromElements(b.low.x,b.low.y,b.low.z,_.radius,Mre),B=Lre;B.x=0,B.y=Number.MAX_VALUE;let F=g.distanceDisplayCondition;u(F)&&(B.x=F.near,B.y=F.far),r.setBatchedAttribute(x,0,N),r.setBatchedAttribute(x,1,L),r.attributes.length>2&&(r.setBatchedAttribute(x,2,v),r.setBatchedAttribute(x,3,I),r.setBatchedAttribute(x,4,B))}};var qHe=new h,XHe=new h,KHe=new h,Ire=new h;Vh.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,c=s._segments.lengths,l=a.length,f=0,d=0;for(let p=0;p<l;++p){let g;p===0?s._loop?g=a[l-2]:(g=Ire,h.subtract(a[0],a[1],g),h.add(a[0],g,g)):g=a[p-1],g=M.multiplyByPoint(n,g,XHe);let m=M.multiplyByPoint(n,a[p],qHe),A;p===l-1?s._loop?A=a[1]:(A=Ire,h.subtract(a[l-1],a[l-2],A),h.add(a[l-1],A,A)):A=a[p+1],A=M.multiplyByPoint(n,A,KHe);let x=c[f];p===d+x&&(d+=x,++f);let C=p-d===0,T=p===d+c[f]-1,E=C?2:0,S=T?2:4;for(let D=E;D<S;++D)Hn.writeElements(m,e,t),Hn.writeElements(g,e,t+6),Hn.writeElements(A,e,t+12),t+=6*3}}};var ZHe=new Array(1);Vh.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new x6(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],c=0;a.length>0&&(c=a[a.length-1]+1);let l=this.polylines,f=l.length;for(let d=0;d<f;++d){let p=l[d];p._locatorBuckets=[];let g;if(this.mode===te.SCENE3D){g=ZHe;let A=p._actualPositions.length;if(A>0)g[0]=A;else continue}else g=p._segments.lengths;let m=g.length;if(m>0){let A=0;for(let x=0;x<m;++x){let C=g[x]-1;for(let T=0;T<C;++T)c+4>P.SIXTY_FOUR_KILOBYTES&&(p._locatorBuckets.push({locator:r,count:A}),A=0,t.push(4),a=[],e.push(a),c=0,r.count=s,s=0,i=0,r=new x6(0,0,this),n[++o]=[r]),a.push(c,c+2,c+1),a.push(c+1,c+2,c+3),A+=6,s+=6,i+=6,c+=4}p._locatorBuckets.push({locator:r,count:A}),c+4>P.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new x6(0,0,this),n[++o]=[r])}p._clean()}return r.count=s,i};Vh.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 eE={positions:void 0,lengths:void 0},Pre=new Array(1),JHe=new h,QHe=new he;Vh.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===te.SCENE3D)return Pre[0]=n.length,eE.positions=n,eE.lengths=Pre,eE;Vre(e)&&(n=e._segments.positions);let i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length,a,c=JHe;for(let l=0;l<s;++l)a=n[l],c=M.multiplyByPoint(r,a,c),o.push(t.project(i.cartesianToCartographic(c,QHe)));if(o.length>0){e._boundingVolume2D=se.fromPoints(o,e._boundingVolume2D);let l=e._boundingVolume2D.center;e._boundingVolume2D.center=new h(l.z,l.x,l.y)}return eE.positions=o,eE.lengths=e._segments.lengths,eE};var Ore;Vh.prototype.writeUpdate=function(e,t,n,i){let o=this.mode,r=i.ellipsoid.maximumRadius*P.PI,s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=Ore,c=6*s*3;!u(a)||a.length<c?a=Ore=new Float32Array(c):a.length>c&&(a=new Float32Array(a.buffer,0,c));let l=this.getSegments(t,i),f=l.positions,d=l.lengths,p=0,g=0,m=0,A;s=f.length;for(let x=0;x<s;++x){x===0?t._loop?A=f[s-2]:(A=aU,h.subtract(f[0],f[1],A),h.add(f[0],A,A)):A=f[x-1],h.clone(A,tf),h.clone(f[x],as),x===s-1?t._loop?A=f[1]:(A=aU,h.subtract(f[s-1],f[s-2],A),h.add(f[s-1],A,A)):A=f[x+1],h.clone(A,nf);let C=d[g];x===m+C&&(m+=C,++g);let T=x-m===0,E=x===m+d[g]-1;o===te.SCENE2D&&(tf.z=0,as.z=0,nf.z=0),(o===te.SCENE2D||o===te.MORPHING)&&(T||E)&&r-Math.abs(as.x)<1&&((as.x<0&&tf.x>0||as.x>0&&tf.x<0)&&h.clone(as,tf),(as.x<0&&nf.x>0||as.x>0&&nf.x<0)&&h.clone(as,nf));let S=T?2:0,D=E?2:4;for(let w=S;w<D;++w)Hn.writeElements(as,a,p),Hn.writeElements(tf,a,p+6),Hn.writeElements(nf,a,p+12),p+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};var gd=_d;function zg(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 Jl({batchTable:e.batchTable}),this._labelCollection=new Fh({batchTable:e.batchTable}),this._polylineCollection=new gd,this._polylineCollection._useHighlightColor=!0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=uGe(this)}Object.defineProperties(zg.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){let e=this._billboardCollection.textureAtlas.texture.sizeInBytes,t=this._labelCollection._textureAtlas.texture.sizeInBytes;return e+t}},readyPromise:{get:function(){return this._readyPromise}}});function $He(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 eGe=new pi("createVectorTilePoints",5),tGe=new h;function nGe(e,t){let n;if(!u(e._verticesPromise)){n=e._positions;let i=e._packedBuffer;u(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=$He(e,t));let o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=e._verticesPromise=eGe.scheduleTask(r,o);return u(s)?s.then(function(a){e._positions=new Float64Array(a.positions);let c=e._billboardCollection,l=e._labelCollection,f=e._polylineCollection;n=e._positions;let d=e._batchIds,p=n.length/3;for(let g=0;g<p;++g){let m=d[g],A=h.unpack(n,g*3,tGe),x=c.add();x.position=A,x._batchIndex=m;let C=l.add();C.text=" ",C.position=A,C._batchIndex=m;let T=f.add();T.positions=[h.clone(A),h.clone(A)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}):void 0}}zg.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 c=r[a],l=n.get(a),f=i.get(a),d=o.get(a);t[c]=new Rp(e,c,l,f,d)}};zg.prototype.applyDebugSettings=function(e,t){e?(z.clone(t,this._billboardCollection._highlightColor),z.clone(t,this._labelCollection._highlightColor),z.clone(t,this._polylineCollection._highlightColor)):(z.clone(z.WHITE,this._billboardCollection._highlightColor),z.clone(z.WHITE,this._labelCollection._highlightColor),z.clone(z.WHITE,this._polylineCollection._highlightColor))};function iGe(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=Rp.defaultPointSize,s.color=Rp.defaultColor,s.pointOutlineColor=Rp.defaultPointOutlineColor,s.pointOutlineWidth=Rp.defaultPointOutlineWidth,s.labelColor=z.WHITE,s.labelOutlineColor=z.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=No.FILL,s.labelText=void 0,s.backgroundColor=new z(.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=z.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=_i.CENTER,s.verticalOrigin=On.CENTER,s.labelHorizontalOrigin=_i.RIGHT,s.labelVerticalOrigin=On.BASELINE}}var oGe=new z,rGe=new z,sGe=new z,aGe=new z,cGe=new z,lGe=new z,iR=new Pt,oR=new Pt,b6=new bt;zg.prototype.applyStyle=function(e,t){if(!u(e)){iGe(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(u(e.show)&&(s.show=e.show.evaluate(s)),u(e.pointSize)&&(s.pointSize=e.pointSize.evaluate(s)),u(e.color)&&(s.color=e.color.evaluateColor(s,oGe)),u(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,rGe)),u(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),u(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,sGe)),u(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,aGe)),u(e.labelOutlineWidth)&&(s.labelOutlineWidth=e.labelOutlineWidth.evaluate(s)),u(e.font)&&(s.font=e.font.evaluate(s)),u(e.labelStyle)&&(s.labelStyle=e.labelStyle.evaluate(s)),u(e.labelText)?s.labelText=e.labelText.evaluate(s):s.labelText=void 0,u(e.backgroundColor)&&(s.backgroundColor=e.backgroundColor.evaluateColor(s,cGe)),u(e.backgroundPadding)&&(s.backgroundPadding=e.backgroundPadding.evaluate(s)),u(e.backgroundEnabled)&&(s.backgroundEnabled=e.backgroundEnabled.evaluate(s)),u(e.scaleByDistance)){let a=e.scaleByDistance.evaluate(s);iR.near=a.x,iR.nearValue=a.y,iR.far=a.z,iR.farValue=a.w,s.scaleByDistance=iR}else s.scaleByDistance=void 0;if(u(e.translucencyByDistance)){let a=e.translucencyByDistance.evaluate(s);oR.near=a.x,oR.nearValue=a.y,oR.far=a.z,oR.farValue=a.w,s.translucencyByDistance=oR}else s.translucencyByDistance=void 0;if(u(e.distanceDisplayCondition)){let a=e.distanceDisplayCondition.evaluate(s);b6.near=a.x,b6.far=a.y,s.distanceDisplayCondition=b6}else s.distanceDisplayCondition=void 0;u(e.heightOffset)&&(s.heightOffset=e.heightOffset.evaluate(s)),u(e.anchorLineEnabled)&&(s.anchorLineEnabled=e.anchorLineEnabled.evaluate(s)),u(e.anchorLineColor)&&(s.anchorLineColor=e.anchorLineColor.evaluateColor(s,lGe)),u(e.image)?s.image=e.image.evaluate(s):s.image=void 0,u(e.disableDepthTestDistance)&&(s.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(s)),u(e.horizontalOrigin)&&(s.horizontalOrigin=e.horizontalOrigin.evaluate(s)),u(e.verticalOrigin)&&(s.verticalOrigin=e.verticalOrigin.evaluate(s)),u(e.labelHorizontalOrigin)&&(s.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(s)),u(e.labelVerticalOrigin)&&(s.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(s))}};function uGe(e){return new Promise(function(t,n){e._update=function(i,o){let r=nGe(i,o.mapProjection.ellipsoid);i._ready&&(i._polylineCollection.update(o),i._billboardCollection.update(o),i._labelCollection.update(o)),u(r)&&r.then(function(){t()}).catch(function(s){n(s)})}})}zg.prototype.update=function(e){this._update(this,e)};zg.prototype.isDestroyed=function(){return!1};zg.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(),le(this)};var rR=zg;function Lp(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=y(e.ellipsoid,ie.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=y(e.center,h.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._update=function(t,n){},this._readyPromise=gGe(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Un.BOTH}Object.defineProperties(Lp.prototype,{trianglesLength:{get:function(){return u(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return u(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});function fGe(e){let t=new Float64Array(3+h.packedLength+ie.packedLength+ce.packedLength),n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,h.pack(e._center,t,n),n+=h.packedLength,ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,ce.pack(e._rectangle,t,n),t}function dGe(e,t){let n=1,i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=Rn.unpack(t,n),n+=Rn.packedLength;let r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){let c=z.unpack(t,n);n+=z.packedLength;let l=t[n++],f=t[n++],d=t[n++],p=new Array(d);for(let g=0;g<d;++g)p[g]=t[n++];s[a]=new vh({color:c,offset:l,count:f,batchIds:p})}}var hGe=new pi("createVectorTilePolygons",5),mGe=new z;function pGe(e){if(!u(e._primitive)&&!u(e._verticesPromise)){let t=e._positions,n=e._counts,i=e._indexCounts,o=e._indices,r=e._transferrableBatchIds,s=e._batchTableColors,a=e._packedBuffer;if(!u(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 A=0;A<m;++A){let x=g.getColor(A,mGe);s[A]=x.toRgba()}a=e._packedBuffer=fGe(e)}let c=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],l={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer},f=e._polygonMinimumHeights,d=e._polygonMaximumHeights;u(f)&&u(d)&&(f=f.slice(),d=d.slice(),c.push(f.buffer,d.buffer),l.minimumHeights=f,l.maximumHeights=d);let p=e._verticesPromise=hGe.scheduleTask(l,c);return u(p)?p.then(function(g){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;let m=new Float64Array(g.packedBuffer),A=m[0];dGe(e,m),e._indices=Fe.getSizeInBytes(A)===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),e._ready=!0}):void 0}}function _Ge(e){e._ready&&!u(e._primitive)&&(e._primitive=new aA({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,e._verticesPromise=void 0)}Lp.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Lp.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Lp.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Lp.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function gGe(e){return new Promise(function(t,n){e._update=function(i,o){let r=pGe(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),u(r)&&r.then(function(){_Ge(i),t(i)}).catch(function(s){n(s)})}})}Lp.prototype.update=function(e){this._update(this,e)};Lp.prototype.isDestroyed=function(){return!1};Lp.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),le(this)};var sR=Lp;var aR=`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 yd(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(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=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=OGe(this),this._verticesPromise=void 0}Object.defineProperties(yd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function yGe(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ie.packedLength+h.packedLength,a=new Float64Array(s),c=0;return a[c++]=n,a[c++]=i,ce.pack(t,a,c),c+=ce.packedLength,ie.pack(o,a,c),c+=ie.packedLength,h.pack(r,a,c),a}var AGe=new pi("createVectorTilePolylines",5),tE={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function xGe(e,t){if(!u(e._va)&&!u(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;u(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=yGe(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},l=e._verticesPromise=AGe.scheduleTask(c,a);return u(l)?l.then(function(f){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 d=f.indexDatatype;e._indices=d===Fe.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function CGe(e,t){if(e._ready&&!u(e._va)){let n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices,c=i.byteLength+n.byteLength+o.byteLength;c+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=c;let l=lt.createVertexBuffer({context:t,typedArray:i,usage:Ne.STATIC_DRAW}),f=lt.createVertexBuffer({context:t,typedArray:n,usage:Ne.STATIC_DRAW}),d=lt.createVertexBuffer({context:t,typedArray:o,usage:Ne.STATIC_DRAW}),p=lt.createVertexBuffer({context:t,typedArray:r,usage:Ne.STATIC_DRAW}),g=lt.createVertexBuffer({context:t,typedArray:s,usage:Ne.STATIC_DRAW}),m=lt.createIndexBuffer({context:t,typedArray:a,usage:Ne.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),A=[{index:tE.previousPosition,vertexBuffer:l,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:tE.currentPosition,vertexBuffer:f,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:tE.nextPosition,vertexBuffer:d,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:tE.expandAndWidth,vertexBuffer:p,componentDatatype:q.FLOAT,componentsPerAttribute:2},{index:tE.a_batchId,vertexBuffer:g,componentDatatype:q.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new oi({context:t,attributes:A,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 cR=new M,Ure=new h;function TGe(e,t){u(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){let n=t.uniformState.view;return M.clone(n,cR),M.multiplyByPoint(cR,e._center,Ure),M.setTranslation(cR,Ure,cR),cR},u_highlightColor:function(){return e._highlightColor}})}function EGe(e){if(u(e._rs))return;let t={enabled:!0,factor:-5,units:-5};e._rs=Ue.fromCache({blending:un.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}var bGe=`uniform vec4 u_highlightColor; 
void main()
{
    out_FragColor = u_highlightColor;
}
`;function SGe(e,t){if(u(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(aR),o=n.getFragmentShaderCallback(!1,void 0,!1)(bGe),r=new ke({defines:["VECTOR_TILE",Vt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[Wl,i]}),s=new ke({defines:["VECTOR_TILE"],sources:[o]});e._sp=Xt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:tE})}function DGe(e,t){if(!u(e._command)){let n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new tt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:Ee.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}yd.getPolylinePositions=function(e,t){let n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!u(n)||!u(i))return;let r,s,a=n.length,c=0,l=0;for(r=0;r<a;++r)n[r]===t&&(c+=o[r+1]-o[r]);if(c===0)return;let f=new Float64Array(c*3);for(r=0;r<a;++r)if(n[r]===t){let d=o[r],p=o[r+1]-d;for(s=0;s<p;++s){let g=(d+s)*3;f[l++]=i[g],f[l++]=i[g+1],f[l++]=i[g+2]}}return f};yd.prototype.getPositions=function(e){return yd.getPolylinePositions(this,e)};yd.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 xs(e,r)}};yd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function vGe(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=z.WHITE}}var wGe=new z,IGe=z.WHITE,PGe=!0;yd.prototype.applyStyle=function(e,t){if(!u(e)){vGe(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=u(e.color)?e.color.evaluateColor(s,wGe):IGe,s.show=u(e.show)?e.show.evaluate(s):PGe}};function OGe(e){return new Promise(function(t,n){e._update=function(i,o){let r=o.context,s=xGe(i,r);if(TGe(i,r),SGe(i,r),EGe(i),i._ready){let a=o.passes;(a.render||a.pick)&&DGe(i,o)}u(s)&&s.then(function(){CGe(i,r),t()}).catch(function(a){n(a)})}})}yd.prototype.update=function(e){this._update(this,e)};yd.prototype.isDestroyed=function(){return!1};yd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),le(this)};var LA=yd;var lR=`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()
{
    // vertex corner IDs
    //          3-----------7
    //         /|   left   /|
    //        / | 1       / |
    //       2-----------6  5  end
    //       | /         | /
    // start |/  right   |/
    //       0-----------4
    //
    float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251); // 0 for front, 1 for end
    float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd)); // 0 for bottom, 1 for top

    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));

    // Push for volume height
    float offset;
    vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);

    // offset height to create volume
    offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);
    offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;
    position.xyz += offset * ellipsoidNormal;

    // move from RTC to EC
    position = u_modifiedModelView * position;
    right = czm_normal * right;

    // Push for width in a direction that is in the start or end plane and in a plane with right
    // N = normalEC ("right-facing" direction for push)
    // R = right
    // p = angle between N and R
    // w = distance to push along R if R == N
    // d = distance to push along N
    //
    //   N   R
    //  {  p| }      * cos(p) = dot(N, R) = w / d
    //  d  |  |w    * d = w / dot(N, R)
    //    { | }
    //       o---------- polyline segment ---->
    //
    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 = widthEC
    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 uR=`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)));

    // Discard for sky
    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);

    // Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction
    halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));

    // Check distance of the eye coordinate against the right-facing plane
    float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);

    // Check eye coordinate against the mitering planes
    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 Np(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(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(fi._defaultMinTerrainHeight,fi._defaultMaxTerrainHeight),this._boundingVolume=Rn.fromRectangle(e.rectangle,fi._defaultMinTerrainHeight,fi._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=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=jGe(this),this._verticesPromise=void 0}Object.defineProperties(Np.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function RGe(e,t,n){let i=fi.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;let a=e._boundingVolume,c=e._rectangle;Rn.fromRectangle(c,o,r,n,a)}function BGe(e){let t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ie.packedLength+h.packedLength,a=new Float64Array(s),c=0;return a[c++]=n,a[c++]=i,ce.pack(t,a,c),c+=ce.packedLength,ie.pack(o,a,c),c+=ie.packedLength,h.pack(r,a,c),a}var MGe=new pi("createVectorTileClampedPolylines"),Hg={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function LGe(e,t){if(!u(e._va)&&!u(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;u(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=BGe(e));let a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],c={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},l=e._verticesPromise=MGe.scheduleTask(c,a);return u(l)?l.then(function(f){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 d=f.indexDatatype;e._indices=d===Fe.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function NGe(e,t){if(e._ready&&!u(e._va)){let n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,l=e._indices,f=n.byteLength+i.byteLength;f+=o.byteLength+r.byteLength,f+=s.byteLength+a.byteLength,f+=c.byteLength+l.byteLength,e._trianglesLength=l.length/3,e._geometryByteLength=f;let d=lt.createVertexBuffer({context:t,typedArray:n,usage:Ne.STATIC_DRAW}),p=lt.createVertexBuffer({context:t,typedArray:i,usage:Ne.STATIC_DRAW}),g=lt.createVertexBuffer({context:t,typedArray:o,usage:Ne.STATIC_DRAW}),m=lt.createVertexBuffer({context:t,typedArray:r,usage:Ne.STATIC_DRAW}),A=lt.createVertexBuffer({context:t,typedArray:s,usage:Ne.STATIC_DRAW}),x=lt.createVertexBuffer({context:t,typedArray:a,usage:Ne.STATIC_DRAW}),C=lt.createVertexBuffer({context:t,typedArray:c,usage:Ne.STATIC_DRAW}),T=lt.createIndexBuffer({context:t,typedArray:l,usage:Ne.STATIC_DRAW,indexDatatype:l.BYTES_PER_ELEMENT===2?Fe.UNSIGNED_SHORT:Fe.UNSIGNED_INT}),E=[{index:Hg.startEllipsoidNormal,vertexBuffer:d,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:Hg.endEllipsoidNormal,vertexBuffer:p,componentDatatype:q.FLOAT,componentsPerAttribute:3},{index:Hg.startPositionAndHeight,vertexBuffer:g,componentDatatype:q.FLOAT,componentsPerAttribute:4},{index:Hg.endPositionAndHeight,vertexBuffer:m,componentDatatype:q.FLOAT,componentsPerAttribute:4},{index:Hg.startFaceNormalAndVertexCorner,vertexBuffer:A,componentDatatype:q.FLOAT,componentsPerAttribute:4},{index:Hg.endFaceNormalAndHalfWidth,vertexBuffer:x,componentDatatype:q.FLOAT,componentsPerAttribute:4},{index:Hg.a_batchId,vertexBuffer:C,componentDatatype:q.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new oi({context:t,attributes:E,indexBuffer:T}),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 fR=new M,kre=new h;function FGe(e,t){u(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){let n=t.uniformState.view;return M.clone(n,fR),M.multiplyByPoint(fR,e._center,kre),M.setTranslation(fR,kre,fR),fR},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function zre(e){return Ue.fromCache({cull:{enabled:!0,face:gi.FRONT},blending:un.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:kn.EQUAL,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},backFunction:kn.EQUAL,backOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK}})}function VGe(e){u(e._rs)||(e._rs=zre(!1),e._rs3DTiles=zre(!0))}function UGe(e,t){if(u(e._sp))return;let n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(lR),o=n.getFragmentShaderCallback(!1,void 0,!0)(uR),r=new ke({defines:["VECTOR_TILE",Vt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[Wl,i]}),s=new ke({defines:["VECTOR_TILE"],sources:[o]});e._sp=Xt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:Hg})}function kGe(e,t){let n=e._command;if(!u(e._command)){let o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new tt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:Ee.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});let r=tt.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=Ee.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)}Np.prototype.getPositions=function(e){return LA.getPolylinePositions(this,e)};Np.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 xs(e,r)}};Np.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function zGe(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=z.WHITE}}var HGe=new z,GGe=z.WHITE,WGe=!0;Np.prototype.applyStyle=function(e,t){if(!u(e)){zGe(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=u(e.color)?e.color.evaluateColor(s,HGe):GGe,s.show=u(e.show)?e.show.evaluate(s):WGe}};function jGe(e){return fi.initialize().then(function(){return RGe(e,e._rectangle,e._ellipsoid),new Promise(function(t,n){e._update=function(i,o){let r=o.context,s=LGe(i,r);if(FGe(i,r),UGe(i,r),VGe(i),i._ready){let a=o.passes;(a.render||a.pick)&&kGe(i,o)}u(s)&&s.then(function(){NGe(i,r),t(i)}).catch(function(a){n(a)})}})})}Np.prototype.update=function(e){this._update(this,e)};Np.prototype.isDestroyed=function(){return!1};Np.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),le(this)};var dR=Np;var S6=32767,YGe=new he,qGe=new h;function XGe(e,t,n,i,o){let r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),c=e.subarray(2*r,3*r);Gn.zigZagDeltaDecode(s,a,c);let l=new Float64Array(e.length);for(let f=0;f<r;++f){let d=s[f],p=a[f],g=c[f],m=P.lerp(t.west,t.east,d/S6),A=P.lerp(t.south,t.north,p/S6),x=P.lerp(n,i,g/S6),C=he.fromRadians(m,A,x,YGe),T=o.cartographicToCartesian(C,qGe);h.pack(T,l,f*3)}return l}var hR=XGe;function Uh(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,$Ge(this,i,o)}Object.defineProperties(Uh.prototype,{featuresLength:{get:function(){return u(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return u(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return u(this._polygons)&&(e+=this._polygons.trianglesLength),u(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return u(this._polygons)&&(e+=this._polygons.geometryByteLength),u(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return u(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return u(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){let e=u(this._points)?this._points.readyPromise:void 0,t=u(this._polygons)?this._polygons.readyPromise:void 0,n=u(this._polylines)?this._polylines.readyPromise:void 0,i=this;return Promise.all([e,t,n]).then(function(){return i})}},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 KGe(e){return function(t,n){u(e._polygons)&&e._polygons.updateCommands(t,n)}}function ZGe(e,t){let n,i,o,r,s=y(e.POLYGONS_LENGTH,0),a=y(e.POLYLINES_LENGTH,0),c=y(e.POINTS_LENGTH,0);if(s>0&&u(e.POLYGON_BATCH_IDS)){let p=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,s)}if(a>0&&u(e.POLYLINE_BATCH_IDS)){let p=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,p,a)}if(c>0&&u(e.POINT_BATCH_IDS)){let p=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,p,c)}let l=u(n)||u(i)||u(o),f=s>0&&!u(n)||a>0&&!u(i)||c>0&&!u(o);if(l&&f)throw new ue("If one group of batch ids is defined, then all batch ids must be defined.");if(!u(n)&&!u(i)&&!u(o)){let p=0;if(!u(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=p++;if(!u(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=p++;if(!u(o)&&c>0)for(o=new Uint16Array(c),r=0;r<c;++r)o[r]=p++}return{polygons:n,polylines:i,points:o}}var Ad=Uint32Array.BYTES_PER_ELEMENT;function JGe(e){return new LA(e)}function QGe(e){return new dR(e)}function $Ge(e,t,n){n=y(n,0);let i=new Uint8Array(t),o=new DataView(t);n+=Ad;let r=o.getUint32(n,!0);if(r!==1)throw new ue(`Only Vector tile version 1 is supported.  Version ${r} is not.`);n+=Ad;let s=o.getUint32(n,!0);if(n+=Ad,s===0)return Promise.resolve(e);let a=o.getUint32(n,!0);if(n+=Ad,a===0)throw new ue("Feature table must have a byte length greater than zero");let c=o.getUint32(n,!0);n+=Ad;let l=o.getUint32(n,!0);n+=Ad;let f=o.getUint32(n,!0);n+=Ad;let d=o.getUint32(n,!0);n+=Ad;let p=o.getUint32(n,!0);n+=Ad;let g=o.getUint32(n,!0);n+=Ad;let m=o.getUint32(n,!0);n+=Ad;let A=Oo(i,n,a);n+=a;let x=new Uint8Array(t,n,c);n+=c;let C,T;l>0&&(C=Oo(i,n,l),n+=l,f>0&&(T=new Uint8Array(t,n,f),T=new Uint8Array(T),n+=f));let E=y(A.POLYGONS_LENGTH,0),S=y(A.POLYLINES_LENGTH,0),D=y(A.POINTS_LENGTH,0),w=E+S+D,R=new ap(e,w,C,T,KGe(e));if(e._batchTable=R,w===0)return;let O=new fd(A,x),L=O.getGlobalProperty("REGION");if(!u(L))throw new ue("Feature table global property: REGION must be defined");let N=ce.unpack(L),_=L[4],b=L[5],v=e._tile.computedTransform,I=O.getGlobalProperty("RTC_CENTER",q.FLOAT,3);u(I)?(I=h.unpack(I),M.multiplyByPoint(v,I,I)):(I=ce.center(N),I.height=P.lerp(_,b,.5),I=ie.WGS84.cartographicToCartesian(I));let B=ZGe(A,x);if(n+=(4-n%4)%4,E>0){O.featuresLength=E;let F=y(O.getPropertyArray("POLYGON_COUNTS",q.UNSIGNED_INT,1),O.getPropertyArray("POLYGON_COUNT",q.UNSIGNED_INT,1));if(!u(F))throw new ue("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");let k=y(O.getPropertyArray("POLYGON_INDEX_COUNTS",q.UNSIGNED_INT,1),O.getPropertyArray("POLYGON_INDEX_COUNT",q.UNSIGNED_INT,1));if(!u(k))throw new ue("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");let U=F.reduce(function(W,K){return W+K*2},0),G=k.reduce(function(W,K){return W+K},0),V=new Uint32Array(t,n,G);n+=d;let X=new Uint16Array(t,n,U);n+=p;let j,Q;u(A.POLYGON_MINIMUM_HEIGHTS)&&u(A.POLYGON_MAXIMUM_HEIGHTS)&&(j=O.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",q.FLOAT,1),Q=O.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",q.FLOAT,1)),e._polygons=new sR({positions:X,counts:F,indexCounts:k,indices:V,minimumHeight:_,maximumHeight:b,polygonMinimumHeights:j,polygonMaximumHeights:Q,center:I,rectangle:N,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:R,batchIds:B.polygons,modelMatrix:v})}if(S>0){O.featuresLength=S;let F=y(O.getPropertyArray("POLYLINE_COUNTS",q.UNSIGNED_INT,1),O.getPropertyArray("POLYLINE_COUNT",q.UNSIGNED_INT,1));if(!u(F))throw new ue("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let k=O.getPropertyArray("POLYLINE_WIDTHS",q.UNSIGNED_SHORT,1);if(!u(k)){k=new Uint16Array(S);for(let Q=0;Q<S;++Q)k[Q]=2}let U=F.reduce(function(Q,W){return Q+W*3},0),G=new Uint16Array(t,n,U);n+=g;let V=e._tileset,X=V.examineVectorLinesFunction;if(u(X)){let Q=hR(new Uint16Array(G),N,_,b,ie.WGS84);e8e(Q,F,B.polylines,R,e.url,X)}let j=JGe;u(V.classificationType)&&(j=QGe),e._polylines=j({positions:G,widths:k,counts:F,batchIds:B.polylines,minimumHeight:_,maximumHeight:b,center:I,rectangle:N,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:R,classificationType:V.classificationType,keepDecodedPositions:V.vectorKeepDecodedPositions})}if(D>0){let F=new Uint16Array(t,n,D*3);n+=m,e._points=new rR({positions:F,batchIds:B.points,minimumHeight:_,maximumHeight:b,rectangle:N,batchTable:R})}return Promise.resolve(e)}function D6(e){let t=e.featuresLength;if(!u(e._features)&&t>0){let n=new Array(t);u(e._polygons)&&e._polygons.createFeatures(e,n),u(e._polylines)&&e._polylines.createFeatures(e,n),u(e._points)&&e._points.createFeatures(e,n),e._features=n}}Uh.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Uh.prototype.getFeature=function(e){return u(this._features)||D6(this),this._features[e]};Uh.prototype.applyDebugSettings=function(e,t){u(this._polygons)&&this._polygons.applyDebugSettings(e,t),u(this._polylines)&&this._polylines.applyDebugSettings(e,t),u(this._points)&&this._points.applyDebugSettings(e,t)};Uh.prototype.applyStyle=function(e){u(this._features)||D6(this),u(this._polygons)&&this._polygons.applyStyle(e,this._features),u(this._polylines)&&this._polylines.applyStyle(e,this._features),u(this._points)&&this._points.applyStyle(e,this._features)};Uh.prototype.update=function(e,t){let n=!0;u(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons._ready),u(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines._ready),u(this._points)&&(this._points.update(t),n=n&&this._points._ready),u(this._batchTable)&&n&&(u(this._features)||D6(this),this._batchTable.update(e,t))};Uh.prototype.getPolylinePositions=function(e){let t=this._polylines;if(u(t))return t.getPositions(e)};Uh.prototype.isDestroyed=function(){return!1};Uh.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(),le(this)};function e8e(e,t,n,i,o,r){let s=t.length,a=0;for(let c=0;c<s;c++){let l=t[c]*3,f=e.slice(a,a+l);a+=l,r(f,n[c],o,i)}}var mR=Uh;var Hre={b3dm:function(e,t,n,i,o){return Mh.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return Mh.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return Mh.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return new xP(e,t,n,i,o,Hre)},externalTileset:function(e,t,n,i){return new GO(e,t,n,i)},geom:function(e,t,n,i,o){return new TP(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new mR(e,t,n,i,o)},subt:function(e,t,n,i,o){return new BT(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return new BT(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new ue("Invalid glb content");let a=new DataView(i,o).getUint32(8,!0),c=new Uint8Array(i,o,a);return Mh.fromGltf(e,t,n,c)},gltf:function(e,t,n,i){return Mh.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return Mh.fromGeoJson(e,t,n,i)}},NA=Hre;var t8e={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Eo=Object.freeze(t8e);var xd={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"};xd.isBinaryFormat=function(e){switch(e){case xd.BATCHED_3D_MODEL:case xd.INSTANCED_3D_MODEL:case xd.COMPOSITE:case xd.POINT_CLOUD:case xd.VECTOR:case xd.GEOMETRY:case xd.IMPLICIT_SUBTREE:case xd.VOXEL_BINARY:case xd.GLTF_BINARY:return!0;default:return!1}};var cs=Object.freeze(xd);var n8e={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},of=Object.freeze(n8e);function Gre(){}var pR={stack:new Yl,stackMaximumLength:0};Gre.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),!Wre(i))return n;let o=pR.stack;for(o.push(e.root);o.length>0;){pR.stackMaximumLength=Math.max(pR.stackMaximumLength,o.length);let r=o.pop(),s=r.refine===Sr.ADD,a=r.refine===Sr.REPLACE,c=o8e(e,r);c&&r8e(e,r,o,t),(s||a&&!c)&&(s8e(e,r),a8e(e,r,t),l8e(e,r,t),!jre(r)&&!r.contentAvailable&&(n=!1)),c8e(e)}return pR.stack.trim(pR.stackMaximumLength),n};function Wre(e){return e._visible&&e._inRequestVolume}function jre(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function i8e(e){return!jre(e)&&e.contentUnloaded}function o8e(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0)}function r8e(e,t,n,i){let o=t.children,r=o.length;for(let s=0;s<r;++s){let a=o[s];a.updateVisibility(i),Wre(a)&&n.push(a)}}function s8e(e,t){(i8e(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function a8e(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function c8e(e){++e.statistics.visited}function l8e(e,t,n){t.contentAvailable&&t.contentVisibility(n)!==Qt.OUTSIDE&&e._selectedTiles.push(t)}var nE=Gre;function Yre(){}function VA(e){return e._visible&&e._inRequestVolume}var _R={stack:new Yl,stackMaximumLength:0},gR={stack:new Yl,stackMaximumLength:0},yR={stack:new Yl,stackMaximumLength:0},kh={stack:new Yl,stackMaximumLength:0,ancestorStack:new Yl,ancestorStackMaximumLength:0},u8e=2;Yre.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(uU(e,n,t),!VA(n)||n.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;xR(e)?e.immediatelyLoadDesiredLevelOfDetail?d8e(e,n,t):h8e(e,n,t):f8e(e,n,t),_R.stack.trim(_R.stackMaximumLength),gR.stack.trim(gR.stackMaximumLength),yR.stack.trim(yR.stackMaximumLength),kh.stack.trim(kh.stackMaximumLength),kh.ancestorStack.trim(kh.ancestorStackMaximumLength);let i=e._requestedTiles,o=i.length;for(let r=0;r<o;++r)i[r].updatePriority()};function f8e(e,t,n){let i=e._maximumScreenSpaceError,o=e._maximumScreenSpaceError;w6(e,t,i,o,n)}function d8e(e,t,n){let i=Number.MAX_VALUE,o=e._maximumScreenSpaceError;w6(e,t,i,o,n),Zre(e,t,n)}function h8e(e,t,n){let i=Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),o=e.maximumScreenSpaceError;w6(e,t,i,o,n),Zre(e,t,n)}function xR(e){return e._skipLevelOfDetail}function m8e(e,t){e._emptyTiles.push(t)}function AR(e,t,n){if(t.contentVisibility(n)!==Qt.OUTSIDE){let i=t.content;i.featurePropertiesDirty?(i.featurePropertiesDirty=!1,t.lastStyleTime=0,e._selectedTilesToStyle.push(t)):t._selectedFrame<n.frameNumber-1&&e._selectedTilesToStyle.push(t),t._selectedFrame=n.frameNumber,e._selectedTiles.push(t)}}function p8e(e,t,n){let i=yR.stack;for(i.push(t);i.length>0;){yR.stackMaximumLength=Math.max(yR.stackMaximumLength,i.length);let r=i.pop().children,s=r.length;for(let a=0;a<s;++a){let c=r[a];VA(c)&&(c.contentAvailable?(uU(e,c,n),lU(e,c,n),AR(e,c,n)):c._depth-t._depth<u8e&&i.push(c))}}}function cU(e,t,n){if(!xR(e)){t.contentAvailable&&AR(e,t,n);return}let i=t.contentAvailable?t:t._ancestorWithContentAvailable;u(i)?i._shouldSelect=!0:p8e(e,t,n)}function _8e(e,t,n){++e._statistics.visited,t._visitedFrame=n.frameNumber}function lU(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function g8e(e,t){e._maximumPriority.distance=Math.max(t._priorityHolder._distanceToCamera,e._maximumPriority.distance),e._minimumPriority.distance=Math.min(t._priorityHolder._distanceToCamera,e._minimumPriority.distance),e._maximumPriority.depth=Math.max(t._depth,e._maximumPriority.depth),e._minimumPriority.depth=Math.min(t._depth,e._minimumPriority.depth),e._maximumPriority.foveatedFactor=Math.max(t._priorityHolder._foveatedFactor,e._maximumPriority.foveatedFactor),e._minimumPriority.foveatedFactor=Math.min(t._priorityHolder._foveatedFactor,e._minimumPriority.foveatedFactor),e._maximumPriority.reverseScreenSpaceError=Math.max(t._priorityReverseScreenSpaceError,e._maximumPriority.reverseScreenSpaceError),e._minimumPriority.reverseScreenSpaceError=Math.min(t._priorityReverseScreenSpaceError,e._minimumPriority.reverseScreenSpaceError)}function y8e(e,t,n){if(!e._cullRequestsWhileMoving)return!0;let i=t.boundingSphere,o=Math.max(i.radius*2,1),r=n.camera,s=r.positionWCDeltaMagnitude!==0?r.positionWCDeltaMagnitude:r.positionWCDeltaMagnitudeLastFrame;return e.cullRequestsWhileMovingMultiplier*s/o<1}function FA(e,t,n){if(t._requestedFrame===n.frameNumber||!Kre(t)&&!t.contentExpired||!y8e(e,t,n))return;let i=n.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&i||(t._requestedFrame=n.frameNumber,e._requestedTiles.push(t))}function qre(e,t,n){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(n),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function A8e(e,t,n){let i=!1,o=t.children,r=o.length;for(let s=0;s<r;++s){let a=o[s];qre(e,a,n),i=i||VA(a)}return i}function x8e(e,t,n){let i=t.parent;return!u(i)||i.hasTilesetContent||i.hasImplicitContent||i.refine!==Sr.ADD?!1:t.getScreenSpaceError(n,!0)<=e._maximumScreenSpaceError}function Xre(e,t,n){if(qre(e,t,n),!VA(t))return;let i=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&i){let s=t.children[0];Xre(e,s,n),t._visible=s._visible;return}if(x8e(e,t,n)){t._visible=!1;return}let o=t.refine===Sr.REPLACE,r=t._optimChildrenWithinParent===of.USE_OPTIMIZATION;if(o&&r&&i&&!A8e(e,t,n)){++e._statistics.numberOfTilesCulledWithChildrenUnion,t._visible=!1;return}}function uU(e,t,n){Xre(e,t,n),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,g8e(e,t),t._shouldSelect=!1,t._finalResolution=!0}function C8e(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;let n=e.parent;if(u(n)){let i=!Kre(n)||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}}function CR(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function Kre(e){return!CR(e)&&e.contentUnloaded}function T8e(e,t){let n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||u(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function E8e(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function b8e(e,t,n,i){let o,r=t.refine===Sr.REPLACE,s=t.children,a=s.length;for(o=0;o<a;++o)uU(e,s[o],i);s.sort(E8e);let c=!xR(e)&&r&&!CR(t),l=!0,f=!1,d=-1,p=Number.MAX_VALUE,g;for(o=0;o<a;++o)if(g=s[o],VA(g)?(n.push(g),g._foveatedFactor<p&&(d=o,p=g._foveatedFactor),f=!0):(c||e.loadSiblings)&&(g._foveatedFactor<p&&(d=o,p=g._foveatedFactor),FA(e,g,i),lU(e,g,i)),c){let m;g._inRequestVolume?CR(g)?m=D8e(e,g,i):m=g.contentAvailable:m=!1,l=l&&m}if(f||(l=!1),d!==-1&&!xR(e)&&r){let m=s[d];m._wasMinPriorityChild=!0;let A=(t._wasMinPriorityChild||t===e.root)&&p<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(A._foveatedFactor=Math.min(m._foveatedFactor,A._foveatedFactor),A._distanceToCamera=Math.min(m._distanceToCamera,A._distanceToCamera),o=0;o<a;++o)g=s[o],g._priorityHolder=A}return l}function S8e(e,t,n){return xR(e)?e.immediatelyLoadDesiredLevelOfDetail?!1:u(t._ancestorWithContent)?t._screenSpaceError===0?t.parent._screenSpaceError>n:t._screenSpaceError>n:!0:!0}function v6(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError}function w6(e,t,n,i,o){let r=_R.stack;for(r.push(t);r.length>0;){_R.stackMaximumLength=Math.max(_R.stackMaximumLength,r.length);let s=r.pop();C8e(s,o);let a=S8e(e,s,n),c=s.refine===Sr.ADD,l=s.refine===Sr.REPLACE,f=s.parent,d=!u(f)||f._refines,p=!1;v6(e,s)&&(p=b8e(e,s,r,o)&&d);let g=!p&&d;CR(s)?(m8e(e,s,o),FA(e,s,o),g&&cU(e,s,o)):c?(cU(e,s,o),FA(e,s,o)):l&&(a?(FA(e,s,o),g&&cU(e,s,o)):g?(cU(e,s,o),FA(e,s,o)):T8e(e,s)&&FA(e,s,o)),_8e(e,s,o),lU(e,s,o),s._refines=p}}function D8e(e,t,n){let i=!0,o=gR.stack;for(o.push(t);o.length>0;){gR.stackMaximumLength=Math.max(gR.stackMaximumLength,o.length);let r=o.pop(),s=r.children,a=s.length,c=CR(r),l=c&&v6(e,r),f=c&&r.children.length===0;if(!l&&!r.contentAvailable&&!f&&(i=!1),uU(e,r,n),VA(r)||(FA(e,r,n),lU(e,r,n)),l)for(let d=0;d<a;++d){let p=s[d];o.push(p)}}return i}function Zre(e,t,n){let i=kh.stack,o=kh.ancestorStack,r;for(i.push(t);i.length>0||o.length>0;){if(kh.stackMaximumLength=Math.max(kh.stackMaximumLength,i.length),kh.ancestorStackMaximumLength=Math.max(kh.ancestorStackMaximumLength,o.length),o.length>0){let p=o.peek();if(p._stackLength===i.length){o.pop(),p!==r&&(p._finalResolution=!1),AR(e,p,n);continue}}let s=i.pop();if(!u(s))continue;let a=s.refine===Sr.ADD,c=s._shouldSelect,l=s.children,f=l.length,d=v6(e,s);if(c)if(a)AR(e,s,n);else{if(s._selectionDepth=o.length,s._selectionDepth>0&&(e._hasMixedContent=!0),r=s,!d){AR(e,s,n);continue}o.push(s),s._stackLength=i.length}if(d)for(let p=0;p<f;++p){let g=l[p];VA(g)&&i.push(g)}}}var zh=Yre;var Cd={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},Fp=new Array(Cd.NUMBER_OF_PASSES);Fp[Cd.RENDER]=Object.freeze({traversal:zh,isRender:!0,requestTiles:!0,ignoreCommands:!1});Fp[Cd.PICK]=Object.freeze({traversal:zh,isRender:!1,requestTiles:!1,ignoreCommands:!1});Fp[Cd.SHADOW]=Object.freeze({traversal:zh,isRender:!1,requestTiles:!0,ignoreCommands:!1});Fp[Cd.PRELOAD]=Object.freeze({traversal:zh,isRender:!1,requestTiles:!0,ignoreCommands:!0});Fp[Cd.PRELOAD_FLIGHT]=Object.freeze({traversal:zh,isRender:!1,requestTiles:!0,ignoreCommands:!0});Fp[Cd.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:zh,isRender:!1,requestTiles:!0,ignoreCommands:!0});Fp[Cd.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:nE,isRender:!1,requestTiles:!0,ignoreCommands:!0});Fp[Cd.MOST_DETAILED_PICK]=Object.freeze({traversal:nE,isRender:!1,requestTiles:!1,ignoreCommands:!1});Cd.getPassOptions=function(e){return Fp[e]};var qo=Object.freeze(Cd);function Vp(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(Vp.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(){}},readyPromise:{get:function(){}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){}}});Vp.prototype.hasProperty=function(e,t){return!1};Vp.prototype.getFeature=function(e){};Vp.prototype.applyDebugSettings=function(e,t){};Vp.prototype.applyStyle=function(e){};Vp.prototype.update=function(e,t){};Vp.prototype.isDestroyed=function(){return!1};Vp.prototype.destroy=function(){return le(this)};var iE=Vp;function Up(e){e=y(e,y.EMPTY_OBJECT);let t=e.content,n=e.class;this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(Up.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Up.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};Up.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};Up.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};Up.prototype.getProperty=function(e){return Nn.getProperty(e,this._properties,this._class)};Up.prototype.setProperty=function(e,t){return Nn.setProperty(e,t,this._properties,this._class)};Up.prototype.getPropertyBySemantic=function(e){return Nn.getPropertyBySemantic(e,this._properties,this._class)};Up.prototype.setPropertyBySemantic=function(e,t){return Nn.setPropertyBySemantic(e,t,this._properties,this._class)};var TR=Up;function I6(e,t){let n=ai(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!u(n))return;if(!u(e.schema)){I6._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=y(e.schema.classes,y.EMPTY_OBJECT);if(u(n.class)){let o=i[n.class];return new TR({content:n,class:o})}}I6._oneTimeWarning=wt;var UA=I6;function v8e(e,t){let n=e.metadataExtension;if(!u(n))return;let i=n.groups,o=ai(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 kA=v8e;function kp(e){e=y(e,y.EMPTY_OBJECT);let t=e.tile,n=e.class;this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(kp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});kp.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};kp.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};kp.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};kp.prototype.getProperty=function(e){return Nn.getProperty(e,this._properties,this._class)};kp.prototype.setProperty=function(e,t){return Nn.setProperty(e,t,this._properties,this._class)};kp.prototype.getPropertyBySemantic=function(e){return Nn.getPropertyBySemantic(e,this._properties,this._class)};kp.prototype.setPropertyBySemantic=function(e,t){return Nn.setPropertyBySemantic(e,t,this._properties,this._class)};var ER=kp;function P6(e,t){let n=ai(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!u(n))return;if(!u(e.schema)){P6._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=y(e.schema.classes,y.EMPTY_OBJECT);if(u(n.class)){let o=i[n.class];return new ER({tile:n,class:o})}}P6._oneTimeWarning=wt;var bR=P6;function w8e(e){let t=new Uint8Array(e),n=od(t);if(n==="glTF"&&(n="glb"),cs.isBinaryFormat(n))return{contentType:n,binaryPayload:t};let i=I8e(t);if(u(i.root))return{contentType:cs.EXTERNAL_TILESET,jsonPayload:i};if(u(i.asset))return{contentType:cs.GLTF,jsonPayload:i};if(u(i.tileAvailability))return{contentType:cs.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(u(i.type))return{contentType:cs.GEOJSON,jsonPayload:i};if(u(i.voxelTable))return{contentType:cs.VOXEL_JSON,jsonPayload:i};throw new ue("Invalid tile content.")}function I8e(e){let t;try{t=Oo(e)}catch{throw new ue("Invalid tile content.")}return t}var Hh=w8e;function Td(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;let o=u(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;let r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),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}),c=Oa.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=c}this._contentsFetchedPromise=void 0}Object.defineProperties(Td.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}},readyPromise:{get:function(){if(!this._contentsCreated)return;let e=this._contents.map(function(n){return n.readyPromise}),t=this;return Promise.all(e).then(function(){return t})}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){}},batchTable:{get:function(){}},group:{get:function(){},set:function(){}},innerContentUrls:{get:function(){return this._innerContentHeaders.map(function(e){return e.uri})}},contentsFetchedPromise:{get:function(){return this._contentsFetchedPromise}}});function O6(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function P8e(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)}Td.prototype.requestInnerContents=function(){if(!O8e(this._serverKeys))return this._serverKeys.length;let e=this._innerContentHeaders;O6(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=R8e(this,t,this._cancelCount,this._tile._contentState);return this._contentsFetchedPromise=B8e(this),0};function O8e(e){let t={};for(let n=0;n<e.length;n++){let i=e[n];u(t[i])?t[i]++:t[i]=1}for(let n in t)if(t.hasOwnProperty(n)&&!Oa.serverHasOpenSlots(n,t[n]))return!1;return Oa.heapHasOpenSlots(e.length)}function R8e(e,t,n,i){let o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],c=new zo({throttle:!0,throttleByServer:!0,type:Qr.TILES3D,priorityFunction:s,serverKey:a});o.request=c,e._requests[t]=c;let l=o.fetchArrayBuffer();return u(l)?l.then(function(f){if(!(n<e._cancelCount))return O6(e,-1),f}).catch(function(f){if(!(n<e._cancelCount)){if(o.request.state===hi.CANCELLED){P8e(e,i);return}O6(e,-1),Jre(e,t,f)}}):Promise.resolve(void 0)}function B8e(e){let t=e._cancelCount;return Promise.all(e._arrayFetchPromises).then(function(n){if(t<e._cancelCount)return;let i=n.map(function(o,r){if(u(o))return M8e(e,o,r)});e._contentsCreated=!0,e._contents=i.filter(u)})}function M8e(e,t,n){let i=Hh(t);if(i.contentType===cs.EXTERNAL_TILESET){let d=new ue("External tilesets are disallowed inside multiple contents");return Jre(e,n,d)}e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===cs.GEOMETRY||i.contentType===cs.VECTOR;let o=e._tileset,r=e._innerContentResources[n],s=e._tile,a,c=NA[i.contentType];u(i.binaryPayload)?a=c(o,s,r,i.binaryPayload.buffer,0):a=c(o,s,r,i.jsonPayload);let l=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){let d=s.implicitSubtree,p=s.implicitCoordinates;a.metadata=d.getContentMetadataView(p,n)}else s.hasImplicitContent||(a.metadata=UA(o,l));let f=kA(o,l);return u(f)&&(a.group=new iA({metadata:f})),a}function Jre(e,t,n){let i=e._tileset,o=e._innerContentResources[t].url,r=u(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}`))}Td.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){let t=this._requests[e];u(t)&&t.cancel()}};Td.prototype.hasProperty=function(e,t){return!1};Td.prototype.getFeature=function(e){};Td.prototype.applyDebugSettings=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Td.prototype.applyStyle=function(e){let t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Td.prototype.update=function(e,t){let n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};Td.prototype.isDestroyed=function(){return!1};Td.prototype.destroy=function(){let e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return le(this)};var SR=Td;var sse=vo(nse(),1);var Z8e=new h,J8e=new h,Gg={};Gg.computeArea2D=function(e){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};Gg.computeWindingOrder2D=function(e){return Gg.computeArea2D(e)>0?Zr.COUNTER_CLOCKWISE:Zr.CLOCKWISE};Gg.triangulate=function(e,t){let n=H.packArray(e);return(0,sse.default)(n,t,2)};var ase=new h,cse=new h,lse=new h,ise=new h,ose=new h,rse=new h,zp=new h,use=new H,fse=new H,dse=new H,rE=new H;Gg.computeSubdivision=function(e,t,n,i,o){o=y(o,P.RADIANS_PER_DEGREE);let r=u(i),s=n.slice(0),a,c=t.length,l=new Array(c*3),f=new Array(c*2),d=0,p=0;for(a=0;a<c;a++){let E=t[a];if(l[d++]=E.x,l[d++]=E.y,l[d++]=E.z,r){let S=i[a];f[p++]=S.x,f[p++]=S.y}}let g=[],m={},A=e.maximumRadius,x=P.chordLength(o,A),C=x*x;for(;s.length>0;){let E=s.pop(),S=s.pop(),D=s.pop(),w=h.fromArray(l,D*3,ase),R=h.fromArray(l,S*3,cse),O=h.fromArray(l,E*3,lse),L,N,_;r&&(L=H.fromArray(f,D*2,use),N=H.fromArray(f,S*2,fse),_=H.fromArray(f,E*2,dse));let b=h.multiplyByScalar(h.normalize(w,ise),A,ise),v=h.multiplyByScalar(h.normalize(R,ose),A,ose),I=h.multiplyByScalar(h.normalize(O,rse),A,rse),B=h.magnitudeSquared(h.subtract(b,v,zp)),F=h.magnitudeSquared(h.subtract(v,I,zp)),k=h.magnitudeSquared(h.subtract(I,b,zp)),U=Math.max(B,F,k),G,V,X;U>C?B===U?(G=`${Math.min(D,S)} ${Math.max(D,S)}`,a=m[G],u(a)||(V=h.add(w,R,zp),h.multiplyByScalar(V,.5,V),l.push(V.x,V.y,V.z),a=l.length/3-1,m[G]=a,r&&(X=H.add(L,N,rE),H.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(D,a,E),s.push(a,S,E)):F===U?(G=`${Math.min(S,E)} ${Math.max(S,E)}`,a=m[G],u(a)||(V=h.add(R,O,zp),h.multiplyByScalar(V,.5,V),l.push(V.x,V.y,V.z),a=l.length/3-1,m[G]=a,r&&(X=H.add(N,_,rE),H.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(S,a,D),s.push(a,E,D)):k===U&&(G=`${Math.min(E,D)} ${Math.max(E,D)}`,a=m[G],u(a)||(V=h.add(O,w,zp),h.multiplyByScalar(V,.5,V),l.push(V.x,V.y,V.z),a=l.length/3-1,m[G]=a,r&&(X=H.add(_,L,rE),H.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(E,a,S),s.push(a,D,S)):(g.push(D),g.push(S),g.push(E))}let T={attributes:{position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:l})},indices:g,primitiveType:Me.TRIANGLES};return r&&(T.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:f})),new ct(T)};var Q8e=new he,$8e=new he,e5e=new he,N6=new he;Gg.computeRhumbLineSubdivision=function(e,t,n,i,o){o=y(o,P.RADIANS_PER_DEGREE);let r=u(i),s=n.slice(0),a,c=t.length,l=new Array(c*3),f=new Array(c*2),d=0,p=0;for(a=0;a<c;a++){let D=t[a];if(l[d++]=D.x,l[d++]=D.y,l[d++]=D.z,r){let w=i[a];f[p++]=w.x,f[p++]=w.y}}let g=[],m={},A=e.maximumRadius,x=P.chordLength(o,A),C=new la(void 0,void 0,e),T=new la(void 0,void 0,e),E=new la(void 0,void 0,e);for(;s.length>0;){let D=s.pop(),w=s.pop(),R=s.pop(),O=h.fromArray(l,R*3,ase),L=h.fromArray(l,w*3,cse),N=h.fromArray(l,D*3,lse),_,b,v;r&&(_=H.fromArray(f,R*2,use),b=H.fromArray(f,w*2,fse),v=H.fromArray(f,D*2,dse));let I=e.cartesianToCartographic(O,Q8e),B=e.cartesianToCartographic(L,$8e),F=e.cartesianToCartographic(N,e5e);C.setEndPoints(I,B);let k=C.surfaceDistance;T.setEndPoints(B,F);let U=T.surfaceDistance;E.setEndPoints(F,I);let G=E.surfaceDistance,V=Math.max(k,U,G),X,j,Q,W,K;V>x?k===V?(X=`${Math.min(R,w)} ${Math.max(R,w)}`,a=m[X],u(a)||(j=C.interpolateUsingFraction(.5,N6),Q=(I.height+B.height)*.5,W=h.fromRadians(j.longitude,j.latitude,Q,e,zp),l.push(W.x,W.y,W.z),a=l.length/3-1,m[X]=a,r&&(K=H.add(_,b,rE),H.multiplyByScalar(K,.5,K),f.push(K.x,K.y))),s.push(R,a,D),s.push(a,w,D)):U===V?(X=`${Math.min(w,D)} ${Math.max(w,D)}`,a=m[X],u(a)||(j=T.interpolateUsingFraction(.5,N6),Q=(B.height+F.height)*.5,W=h.fromRadians(j.longitude,j.latitude,Q,e,zp),l.push(W.x,W.y,W.z),a=l.length/3-1,m[X]=a,r&&(K=H.add(b,v,rE),H.multiplyByScalar(K,.5,K),f.push(K.x,K.y))),s.push(w,a,R),s.push(a,D,R)):G===V&&(X=`${Math.min(D,R)} ${Math.max(D,R)}`,a=m[X],u(a)||(j=E.interpolateUsingFraction(.5,N6),Q=(F.height+I.height)*.5,W=h.fromRadians(j.longitude,j.latitude,Q,e,zp),l.push(W.x,W.y,W.z),a=l.length/3-1,m[X]=a,r&&(K=H.add(v,_,rE),H.multiplyByScalar(K,.5,K),f.push(K.x,K.y))),s.push(D,a,w),s.push(a,R,w)):(g.push(R),g.push(w),g.push(D))}let S={attributes:{position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:l})},indices:g,primitiveType:Me.TRIANGLES};return r&&(S.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:f})),new ct(S)};Gg.scaleToGeodeticHeight=function(e,t,n,i){n=y(n,ie.WGS84);let o=Z8e,r=J8e;if(t=y(t,0),i=y(i,!0),u(e)){let s=e.length;for(let a=0;a<s;a+=3)h.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),h.multiplyByScalar(o,t,o),h.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};var li=Gg;var hse=Math.cos,mse=Math.sin,t5e=Math.sqrt,V6={};V6.computePosition=function(e,t,n,i,o,r,s){let a=t.radiiSquared,c=e.nwCorner,l=e.boundingRectangle,f=c.latitude-e.granYCos*i+o*e.granXSin,d=hse(f),p=mse(f),g=a.z*p,m=c.longitude+i*e.granYSin+o*e.granXCos,A=d*hse(m),x=d*mse(m),C=a.x*A,T=a.y*x,E=t5e(C*A+T*x+g*p);if(r.x=C/E,r.y=T/E,r.z=g/E,n){let S=e.stNwCorner;u(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-l.west)*e.lonScalar,s.y=(f-l.south)*e.latScalar)}};var n5e=new Ji,rf=new h,i5e=new he,pU=new h,F6=new Ei;function pse(e,t,n,i,o,r,s){let a=Math.cos(t),c=i*a,l=n*a,f=Math.sin(t),d=i*f,p=n*f;rf=F6.project(e,rf),rf=h.subtract(rf,pU,rf);let g=Ji.fromRotation(t,n5e);rf=Ji.multiplyByVector(g,rf,rf),rf=h.add(rf,pU,rf),e=F6.unproject(rf,e),r-=1,s-=1;let m=e.latitude,A=m+r*p,x=m-c*s,C=m-c*s+r*p,T=Math.max(m,A,x,C),E=Math.min(m,A,x,C),S=e.longitude,D=S+r*l,w=S+s*d,R=S+s*d+r*l,O=Math.max(S,D,w,R),L=Math.min(S,D,w,R);return{north:T,south:E,east:O,west:L,granYCos:c,granYSin:d,granXCos:l,granXSin:p,nwCorner:e}}V6.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,c=e.west,l=e.north,f=e.south,d=!1,p=!1;l===P.PI_OVER_TWO&&(d=!0),f===-P.PI_OVER_TWO&&(p=!0);let g,m=l-f;c>a?g=P.TWO_PI-c+a:g=a-c;let A=Math.ceil(g/t)+1,x=Math.ceil(m/t)+1,C=g/(A-1),T=m/(x-1),E=ce.northwest(e,r),S=ce.center(e,i5e);(n!==0||i!==0)&&(S.longitude<E.longitude&&(S.longitude+=P.TWO_PI),pU=F6.project(S,pU));let D=T,w=C,R=0,O=0,L=ce.clone(e,o),N={granYCos:D,granYSin:R,granXCos:w,granXSin:O,nwCorner:E,boundingRectangle:L,width:A,height:x,northCap:d,southCap:p};if(n!==0){let _=pse(E,n,C,T,S,A,x);l=_.north,f=_.south,a=_.east,c=_.west,N.granYCos=_.granYCos,N.granYSin=_.granYSin,N.granXCos=_.granXCos,N.granXSin=_.granXSin,L.north=l,L.south=f,L.east=a,L.west=c}if(i!==0){n=n-i;let _=ce.northwest(L,s),b=pse(_,n,C,T,S,A,x);N.stGranYCos=b.granYCos,N.stGranXCos=b.granXCos,N.stGranYSin=b.granYSin,N.stGranXSin=b.granXSin,N.stNwCorner=_,N.stWest=b.west,N.stSouth=b.south}return N};var ls=V6;var o5e=new se,r5e=new se,s5e=new h,a5e=new ce;function _se(e,t){let n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap,a=i,c=2,l=0,f=4;r&&(c-=1,a-=1,l+=1,f-=2),s&&(c-=1,a-=1,l+=1,f-=2),l+=c*o+2*a-f;let d=new Float64Array(l*3),p=0,g=0,m,A=s5e;if(r)ls.computePosition(t,n,!1,g,0,A),d[p++]=A.x,d[p++]=A.y,d[p++]=A.z;else for(m=0;m<o;m++)ls.computePosition(t,n,!1,g,m,A),d[p++]=A.x,d[p++]=A.y,d[p++]=A.z;for(m=o-1,g=1;g<i;g++)ls.computePosition(t,n,!1,g,m,A),d[p++]=A.x,d[p++]=A.y,d[p++]=A.z;if(g=i-1,!s)for(m=o-2;m>=0;m--)ls.computePosition(t,n,!1,g,m,A),d[p++]=A.x,d[p++]=A.y,d[p++]=A.z;for(m=0,g=i-2;g>0;g--)ls.computePosition(t,n,!1,g,m,A),d[p++]=A.x,d[p++]=A.y,d[p++]=A.z;let x=d.length/3*2,C=Fe.createTypedArray(d.length/3,x),T=0;for(let S=0;S<d.length/3-1;S++)C[T++]=S,C[T++]=S+1;C[T++]=d.length/3-1,C[T++]=0;let E=new ct({attributes:new dn,primitiveType:Me.LINES});return E.attributes.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:d}),E.indices=C,E}function c5e(e,t){let n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=i,s=n,a=_se(e,t),c=t.height,l=t.width,f=li.scaleToGeodeticHeight(a.attributes.position.values,s,o,!1),d=f.length,p=new Float64Array(d*2);p.set(f);let g=li.scaleToGeodeticHeight(a.attributes.position.values,r,o);p.set(g,d),a.attributes.position.values=p;let m=t.northCap,A=t.southCap,x=4;m&&(x-=1),A&&(x-=1);let C=(p.length/3+x)*2,T=Fe.createTypedArray(p.length/3,C);d=p.length/6;let E=0;for(let D=0;D<d-1;D++)T[E++]=D,T[E++]=D+1,T[E++]=D+d,T[E++]=D+d+1;T[E++]=d-1,T[E++]=0,T[E++]=d+d-1,T[E++]=d,T[E++]=0,T[E++]=d;let S;if(m)S=c-1;else{let D=l-1;T[E++]=D,T[E++]=D+d,S=l+c-2}if(T[E++]=S,T[E++]=S+d,!A){let D=l+S-1;T[E++]=D,T[E]=D+d}return a.indices=T,a}function aE(e){e=y(e,y.EMPTY_OBJECT);let t=e.rectangle,n=y(e.granularity,P.RADIANS_PER_DEGREE),i=y(e.ellipsoid,ie.WGS84),o=y(e.rotation,0),r=y(e.height,0),s=y(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"}aE.packedLength=ce.packedLength+ie.packedLength+5;aE.pack=function(e,t,n){return n=y(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]=y(e._offsetAttribute,-1),t};var gse=new ce,yse=ie.clone(ie.UNIT_SPHERE),sE={rectangle:gse,ellipsoid:yse,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};aE.unpack=function(e,t,n){t=y(t,0);let i=ce.unpack(e,t,gse);t+=ce.packedLength;let o=ie.unpack(e,t,yse);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t];return u(n)?(n._rectangle=ce.clone(i,n._rectangle),n._ellipsoid=ie.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=c,n._offsetAttribute=l===-1?void 0:l,n):(sE.granularity=r,sE.height=s,sE.rotation=a,sE.extrudedHeight=c,sE.offsetAttribute=l===-1?void 0:l,new aE(sE))};var l5e=new he;aE.createGeometry=function(e){let t=e._rectangle,n=e._ellipsoid,i=ls.computeOptions(t,e._granularity,e._rotation,0,a5e,l5e),o,r;if(P.equalsEpsilon(t.north,t.south,P.EPSILON10)||P.equalsEpsilon(t.east,t.west,P.EPSILON10))return;let s=e._surfaceHeight,a=e._extrudedHeight,c=!P.equalsEpsilon(s,a,0,P.EPSILON2),l;if(c){if(o=c5e(e,i),u(e._offsetAttribute)){let p=o.attributes.position.values.length/3,g=new Uint8Array(p);e._offsetAttribute===nn.TOP?g=g.fill(1,0,p/2):(l=e._offsetAttribute===nn.NONE?0:1,g=g.fill(l)),o.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}let f=se.fromRectangle3D(t,n,s,r5e),d=se.fromRectangle3D(t,n,a,o5e);r=se.union(f,d)}else{if(o=_se(e,i),o.attributes.position.values=li.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),u(e._offsetAttribute)){let f=o.attributes.position.values.length;l=e._offsetAttribute===nn.NONE?0:1;let d=new Uint8Array(f/3).fill(l);o.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}r=se.fromRectangle3D(t,n,s)}return new ct({attributes:o.attributes,indices:o.indices,primitiveType:Me.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};var HA=aE;function lE(e){this.rectangle=ce.clone(e.rectangle),this.minimumHeight=y(e.minimumHeight,0),this.maximumHeight=y(e.maximumHeight,0),this.southwestCornerCartesian=new h,this.northeastCornerCartesian=new h,this.westNormal=new h,this.southNormal=new h,this.eastNormal=new h,this.northNormal=new h;let t=y(e.ellipsoid,ie.WGS84);m5e(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,y(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(lE.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});lE.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=Rn.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=se.fromOrientedBoundingBox(this._orientedBoundingBox)};var Ase=new h,_U=new h,xse=new h,u5e=new h,f5e=new h,d5e=new h,h5e=new h,sf=new he,Cse=new cn(h.UNIT_X,0),cE=new wn;function m5e(e,t,n){n.cartographicToCartesian(ce.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(ce.northeast(t),e.northeastCornerCartesian),sf.longitude=t.west,sf.latitude=(t.south+t.north)*.5,sf.height=0;let i=n.cartographicToCartesian(sf,d5e),o=h.cross(i,h.UNIT_Z,u5e);h.normalize(o,e.westNormal),sf.longitude=t.east;let r=n.cartographicToCartesian(sf,h5e),s=h.cross(h.UNIT_Z,r,Ase);h.normalize(s,e.eastNormal);let a=h.subtract(i,r,Ase);h.magnitude(a)===0&&(a=h.clone(o,a));let c=h.normalize(a,f5e),l=t.south,f;if(l>0){sf.longitude=(t.west+t.east)*.5,sf.latitude=l;let A=n.cartographicToCartesian(sf,cE.origin);h.clone(c,cE.direction);let x=cn.fromPointNormal(e.southwestCornerCartesian,e.westNormal,Cse);Yi.rayPlane(cE,x,e.southwestCornerCartesian),f=n.geodeticSurfaceNormal(A,_U)}else f=n.geodeticSurfaceNormalCartographic(ce.southeast(t),_U);let d=h.cross(f,a,xse);h.normalize(d,e.southNormal);let p=t.north,g;if(p<0){sf.longitude=(t.west+t.east)*.5,sf.latitude=p;let A=n.cartographicToCartesian(sf,cE.origin);h.negate(c,cE.direction);let x=cn.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,Cse);Yi.rayPlane(cE,x,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(A,_U)}else g=n.geodeticSurfaceNormalCartographic(ce.northwest(t),_U);let m=h.cross(a,g,xse);h.normalize(m,e.northNormal)}var p5e=new h,_5e=new h,g5e=new h(0,-1,0),y5e=new h(0,0,-1),Tse=new h;function A5e(e,t){let n=t.camera,i=n.positionWC,o=n.positionCartographic,r=0;if(!ce.contains(e.rectangle,o)){let l=e.southwestCornerCartesian,f=e.northeastCornerCartesian,d=e.westNormal,p=e.southNormal,g=e.eastNormal,m=e.northNormal;t.mode!==te.SCENE3D&&(l=t.mapProjection.project(ce.southwest(e.rectangle),p5e),l.z=l.y,l.y=l.x,l.x=0,f=t.mapProjection.project(ce.northeast(e.rectangle),_5e),f.z=f.y,f.y=f.x,f.x=0,d=g5e,g=h.UNIT_Y,p=y5e,m=h.UNIT_Z);let A=h.subtract(i,l,Tse),x=h.dot(A,d),C=h.dot(A,p),T=h.subtract(i,f,Tse),E=h.dot(T,g),S=h.dot(T,m);x>0?r+=x*x:E>0&&(r+=E*E),C>0?r+=C*C:S>0&&(r+=S*S)}let s,a,c;if(t.mode===te.SCENE3D?(s=o.height,a=e.minimumHeight,c=e.maximumHeight):(s=i.x,a=0,c=0),s>c){let l=s-c;r+=l*l}else if(s<a){let l=a-s;r+=l*l}return Math.sqrt(r)}lE.prototype.distanceToCamera=function(e){let t=A5e(this,e);if(e.mode===te.SCENE3D&&u(this._orientedBoundingBox)){let n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t};lE.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)};lE.prototype.createDebugVolume=function(e){let t=new M.clone(M.IDENTITY),n=new HA({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new At({geometry:n,id:"outline",modelMatrix:t,attributes:{color:Nt.fromColor(e)}});return new Dn({geometryInstances:i,appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})};var af=lE;var IR={},x5e=new h,Ese=new h,bse=new h,Sse=new h,Dse=new Rn;IR.validOutline=function(e){let n=Rn.fromPoints(e,Dse).halfAxes,i=Z.getColumn(n,0,Ese),o=Z.getColumn(n,1,bse),r=Z.getColumn(n,2,Sse),s=h.magnitude(i),a=h.magnitude(o),c=h.magnitude(r);return!(s===0&&(a===0||c===0)||a===0&&c===0)};IR.computeProjectTo2DArguments=function(e,t,n,i){let o=Rn.fromPoints(e,Dse),r=o.halfAxes,s=Z.getColumn(r,0,Ese),a=Z.getColumn(r,1,bse),c=Z.getColumn(r,2,Sse),l=h.magnitude(s),f=h.magnitude(a),d=h.magnitude(c),p=Math.min(l,f,d);if(l===0&&(f===0||d===0)||f===0&&d===0)return!1;let g,m;return(p===f||p===d)&&(g=s),p===l?g=a:p===d&&(m=a),(p===l||p===f)&&(m=c),h.normalize(g,n),h.normalize(m,i),h.clone(o.center,t),!0};function vse(e,t,n,i,o){let r=h.subtract(e,t,x5e),s=h.dot(n,r),a=h.dot(i,r);return H.fromElements(s,a,o)}IR.createProjectPointsTo2DFunction=function(e,t,n){return function(i){let o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=vse(i[r],e,t,n);return o}};IR.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return vse(i,e,t,n,o)}};var Hp=IR;function Wg(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(Wg.prototype,{length:{get:function(){return this._length}}});Wg.prototype.enqueue=function(e){this._array.push(e),this._length++};Wg.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};Wg.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};Wg.prototype.contains=function(e){return this._array.indexOf(e)!==-1};Wg.prototype.clear=function(){this._array.length=this._offset=this._length=0};Wg.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};var jg=Wg;var ar={};ar.computeHierarchyPackedLength=function(e,t){let n=0,i=[e];for(;i.length>0;){let o=i.pop();if(!u(o))continue;n+=2;let r=o.positions,s=o.holes;if(u(r)&&r.length>0&&(n+=r.length*t.packedLength),u(s)){let a=s.length;for(let c=0;c<a;++c)i.push(s[c])}}return n};ar.packPolygonHierarchy=function(e,t,n,i){let o=[e];for(;o.length>0;){let r=o.pop();if(!u(r))continue;let s=r.positions,a=r.holes;if(t[n++]=u(s)?s.length:0,t[n++]=u(a)?a.length:0,u(s)){let c=s.length;for(let l=0;l<c;++l,n+=i.packedLength)i.pack(s[l],t,n)}if(u(a)){let c=a.length;for(let l=0;l<c;++l)o.push(a[l])}}return n};ar.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]=ar.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};var GA=new H;function Ose(e,t,n,i){return H.subtract(t,e,GA),H.multiplyByScalar(GA,n/i,GA),H.add(e,GA,GA),[GA.x,GA.y]}var Yg=new h;function C5e(e,t,n,i){return h.subtract(t,e,Yg),h.multiplyByScalar(Yg,n/i,Yg),h.add(e,Yg,Yg),[Yg.x,Yg.y,Yg.z]}ar.subdivideLineCount=function(e,t,n){let o=h.distance(e,t)/n,r=Math.max(0,Math.ceil(P.log2(o)));return Math.pow(2,r)};var U6=new he,k6=new he,T5e=new he,E5e=new h,wse=new la;ar.subdivideRhumbLineCount=function(e,t,n,i){let o=e.cartesianToCartographic(t,U6),r=e.cartesianToCartographic(n,k6),a=new la(o,r,e).surfaceDistance/i,c=Math.max(0,Math.ceil(P.log2(a)));return Math.pow(2,c)};ar.subdivideTexcoordLine=function(e,t,n,i,o,r){let s=ar.subdivideLineCount(n,i,o),a=H.distance(e,t),c=a/s,l=r;l.length=s*2;let f=0;for(let d=0;d<s;d++){let p=Ose(e,t,d*c,a);l[f++]=p[0],l[f++]=p[1]}return l};ar.subdivideLine=function(e,t,n,i){let o=ar.subdivideLineCount(e,t,n),r=h.distance(e,t),s=r/o;u(i)||(i=[]);let a=i;a.length=o*3;let c=0;for(let l=0;l<o;l++){let f=C5e(e,t,l*s,r);a[c++]=f[0],a[c++]=f[1],a[c++]=f[2]}return a};ar.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){let a=n.cartesianToCartographic(i,U6),c=n.cartesianToCartographic(o,k6);wse.setEndPoints(a,c);let l=wse.surfaceDistance/r,f=Math.max(0,Math.ceil(P.log2(l))),d=Math.pow(2,f),p=H.distance(e,t),g=p/d,m=s;m.length=d*2;let A=0;for(let x=0;x<d;x++){let C=Ose(e,t,x*g,p);m[A++]=C[0],m[A++]=C[1]}return m};ar.subdivideRhumbLine=function(e,t,n,i,o){let r=e.cartesianToCartographic(t,U6),s=e.cartesianToCartographic(n,k6),a=new la(r,s,e),c=a.surfaceDistance/i,l=Math.max(0,Math.ceil(P.log2(c))),f=Math.pow(2,l),d=a.surfaceDistance/f;u(o)||(o=[]);let p=o;p.length=f*3;let g=0;for(let m=0;m<f;m++){let A=a.interpolateUsingSurfaceDistance(m*d,T5e),x=e.cartographicToCartesian(A,E5e);p[g++]=x.x,p[g++]=x.y,p[g++]=x.z}return p};var b5e=new h,S5e=new h,D5e=new h,v5e=new h;ar.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=y(i,ie.WGS84);let r=b5e,s=S5e,a=D5e,c=v5e;if(u(e)&&u(e.attributes)&&u(e.attributes.position)){let l=e.attributes.position.values,f=l.length/2;for(let d=0;d<f;d+=3)h.fromArray(l,d,a),i.geodeticSurfaceNormal(a,r),c=i.scaleToGeodeticSurface(a,c),s=h.multiplyByScalar(r,n,s),s=h.add(c,s,s),l[d+f]=s.x,l[d+1+f]=s.y,l[d+2+f]=s.z,o&&(c=h.clone(a,c)),s=h.multiplyByScalar(r,t,s),s=h.add(c,s,s),l[d]=s.x,l[d+1]=s.y,l[d+2]=s.z}return e};ar.polygonOutlinesFromHierarchy=function(e,t,n){let i=[],o=new jg;o.enqueue(e);let r,s,a;for(;o.length!==0;){let c=o.dequeue(),l=c.positions;if(t)for(a=l.length,r=0;r<a;r++)n.scaleToGeodeticSurface(l[r],l[r]);if(l=go(l,h.equalsEpsilon,!0),l.length<3)continue;let f=c.holes?c.holes.length:0;for(r=0;r<f;r++){let d=c.holes[r],p=d.positions;if(t)for(a=p.length,s=0;s<a;++s)n.scaleToGeodeticSurface(p[s],p[s]);if(p=go(p,h.equalsEpsilon,!0),p.length<3)continue;i.push(p);let g=0;for(u(d.holes)&&(g=d.holes.length),s=0;s<g;s++)o.enqueue(d.holes[s])}i.push(l)}return i};ar.polygonsFromHierarchy=function(e,t,n,i,o){let r=[],s=[],a=new jg;for(a.enqueue(e);a.length!==0;){let c=a.dequeue(),l=c.positions,f=c.holes,d,p;if(i)for(p=l.length,d=0;d<p;d++)o.scaleToGeodeticSurface(l[d],l[d]);if(t||(l=go(l,h.equalsEpsilon,!0)),l.length<3)continue;let g=n(l);if(!u(g))continue;let m=[],A=li.computeWindingOrder2D(g);A===Zr.CLOCKWISE&&(g.reverse(),l=l.slice().reverse());let x=l.slice(),C=u(f)?f.length:0,T=[],E;for(d=0;d<C;d++){let S=f[d],D=S.positions;if(i)for(p=D.length,E=0;E<p;++E)o.scaleToGeodeticSurface(D[E],D[E]);if(t||(D=go(D,h.equalsEpsilon,!0)),D.length<3)continue;let w=n(D);if(!u(w))continue;A=li.computeWindingOrder2D(w),A===Zr.CLOCKWISE&&(w.reverse(),D=D.slice().reverse()),T.push(D),m.push(x.length),x=x.concat(D),g=g.concat(w);let R=0;for(u(S.holes)&&(R=S.holes.length),E=0;E<R;E++)a.enqueue(S.holes[E])}r.push({outerRing:l,holes:T}),s.push({positions:x,positions2D:g,holes:m})}return{hierarchy:r,polygons:s}};var w5e=new H,I5e=new h,P5e=new Le,O5e=new Z;ar.computeBoundingRectangle=function(e,t,n,i,o){let r=Le.fromAxisAngle(e,i,P5e),s=Z.fromQuaternion(r,O5e),a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,d=n.length;for(let p=0;p<d;++p){let g=h.clone(n[p],I5e);Z.multiplyByVector(s,g,g);let m=t(g,w5e);u(m)&&(a=Math.min(a,m.x),c=Math.max(c,m.x),l=Math.min(l,m.y),f=Math.max(f,m.y))}return o.x=a,o.y=l,o.width=c-a,o.height=f-l,o};ar.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=li.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);let c=t.positions,l=u(n),f=l?n.positions:void 0;if(o){let d=c.length,p=new Array(d*3),g=0;for(let x=0;x<d;x++){let C=c[x];p[g++]=C.x,p[g++]=C.y,p[g++]=C.z}let m={attributes:{position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:p})},indices:a,primitiveType:Me.TRIANGLES};l&&(m.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:H.packArray(f)}));let A=new ct(m);return r.normal?Ln.computeNormal(A):A}if(s===Kt.GEODESIC)return li.computeSubdivision(e,c,a,f,i);if(s===Kt.RHUMB)return li.computeRhumbLineSubdivision(e,c,a,f,i)};var Ise=[],Pse=[],R5e=new h,B5e=new h;ar.computeWallGeometry=function(e,t,n,i,o,r){let s,a,c,l,f,d,p,g,m,A=e.length,x=0,C=0,T=u(t),E=T?t.positions:void 0;if(o)for(a=A*3*2,s=new Array(a*2),T&&(m=A*2*2,g=new Array(m*2)),c=0;c<A;c++)l=e[c],f=e[(c+1)%A],s[x]=s[x+a]=l.x,++x,s[x]=s[x+a]=l.y,++x,s[x]=s[x+a]=l.z,++x,s[x]=s[x+a]=f.x,++x,s[x]=s[x+a]=f.y,++x,s[x]=s[x+a]=f.z,++x,T&&(d=E[c],p=E[(c+1)%A],g[C]=g[C+m]=d.x,++C,g[C]=g[C+m]=d.y,++C,g[C]=g[C+m]=p.x,++C,g[C]=g[C+m]=p.y,++C);else{let O=P.chordLength(i,n.maximumRadius),L=0;if(r===Kt.GEODESIC)for(c=0;c<A;c++)L+=ar.subdivideLineCount(e[c],e[(c+1)%A],O);else if(r===Kt.RHUMB)for(c=0;c<A;c++)L+=ar.subdivideRhumbLineCount(n,e[c],e[(c+1)%A],O);for(a=(L+A)*3,s=new Array(a*2),T&&(m=(L+A)*2,g=new Array(m*2)),c=0;c<A;c++){l=e[c],f=e[(c+1)%A];let N,_;T&&(d=E[c],p=E[(c+1)%A]),r===Kt.GEODESIC?(N=ar.subdivideLine(l,f,O,Pse),T&&(_=ar.subdivideTexcoordLine(d,p,l,f,O,Ise))):r===Kt.RHUMB&&(N=ar.subdivideRhumbLine(n,l,f,O,Pse),T&&(_=ar.subdivideTexcoordRhumbLine(d,p,n,l,f,O,Ise)));let b=N.length;for(let v=0;v<b;++v,++x)s[x]=N[v],s[x+a]=N[v];if(s[x]=f.x,s[x+a]=f.x,++x,s[x]=f.y,s[x+a]=f.y,++x,s[x]=f.z,s[x+a]=f.z,++x,T){let v=_.length;for(let I=0;I<v;++I,++C)g[C]=_[I],g[C+m]=_[I];g[C]=p.x,g[C+m]=p.x,++C,g[C]=p.y,g[C+m]=p.y,++C}}}A=s.length;let S=Fe.createTypedArray(A/3,A-e.length*6),D=0;for(A/=6,c=0;c<A;c++){let O=c,L=O+1,N=O+A,_=N+1;l=h.fromArray(s,O*3,R5e),f=h.fromArray(s,L*3,B5e),!h.equalsEpsilon(l,f,P.EPSILON10,P.EPSILON10)&&(S[D++]=O,S[D++]=N,S[D++]=L,S[D++]=L,S[D++]=N,S[D++]=_)}let w={attributes:new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:s})}),indices:S,primitiveType:Me.TRIANGLES};return T&&(w.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:g})),new ct(w)};var Wn=ar;function M5e(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 c=e[a];n[o++]=c.x,n[o++]=c.y,n[o++]=c.z,i[r++]=a,i[r++]=(a+1)%t}let s=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:n})});return new ct({attributes:s,indices:i,primitiveType:Me.LINES})}function WA(e){e=y(e,y.EMPTY_OBJECT);let t=e.polygonHierarchy;this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=Wn.computeHierarchyPackedLength(t,h)+1}WA.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT);let t={polygonHierarchy:{positions:e.positions}};return new WA(t)};WA.pack=function(e,t,n){return n=y(n,0),n=Wn.packPolygonHierarchy(e._polygonHierarchy,t,n,h),t[n]=e.packedLength,t};var L5e={polygonHierarchy:{}};WA.unpack=function(e,t,n){t=y(t,0);let i=Wn.unpackPolygonHierarchy(e,t,h);t=i.startingIndex,delete i.startingIndex;let o=e[t];return u(n)||(n=new WA(L5e)),n._polygonHierarchy=i,n.packedLength=o,n};WA.createGeometry=function(e){let t=e._polygonHierarchy,n=t.positions;if(n=go(n,h.equalsEpsilon,!0),n.length<3||!Hp.validOutline(n))return;let o=Wn.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;let r=[];for(let c=0;c<o.length;c++){let l=new At({geometry:M5e(o[c])});r.push(l)}let s=Ln.combineInstances(r)[0],a=se.fromPoints(t.positions);return new ct({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};var cf=WA;var gU=new he;function PR(e){let t=fp.fromToken(e.token),n=y(e.minimumHeight,0),i=y(e.maximumHeight,0),o=y(e.ellipsoid,ie.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;let r=W5e(t,n,i,o);this._boundingPlanes=r;let s=X5e(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=X6(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=h.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=X6(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=X6(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 c=t.getCenter();gU=o.cartesianToCartographic(c,gU),gU.height=(i+n)/2,this.center=o.cartographicToCartesian(gU,c),this._boundingSphere=se.fromPoints(s)}var N5e=new h,F5e=new he,V5e=new h,U5e=new he,k5e=new h,z5e=new h,H5e=new h,G5e=new h;function W5e(e,t,n,i){let o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,N5e),a=i.cartesianToCartographic(r,F5e);a.height=n;let c=i.cartographicToCartesian(a,V5e),l=cn.fromPointNormal(c,s);o[0]=l;let f=0,d,p=[],g,m;for(d=0;d<4;d++){g=e.getVertex(d),p[d]=g,m=i.cartesianToCartographic(g,U5e),m.height=t;let x=cn.getPointDistance(l,i.cartographicToCartesian(m,k5e));x<f&&(f=x)}let A=cn.clone(l);for(A.normal=h.negate(A.normal,A.normal),A.distance=A.distance*-1+f,o[1]=A,d=0;d<4;d++){g=p[d];let x=p[(d+1)%4],C=i.geodeticSurfaceNormal(g,z5e),T=h.subtract(x,g,G5e),E=h.cross(T,C,H5e);E=h.normalize(E,E),o[2+d]=cn.fromPointNormal(g,E)}return o}var jA=new h,YA=new h,qA=new h,z6=new h,H6=new h,G6=new h,j5e=new h,Y5e=new h,q5e=new h,W6=new h,j6=new h,Y6=new h,qg=new h,Gh=new Z;function Rse(e,t,n){jA=e.normal,YA=t.normal,qA=n.normal,z6=h.multiplyByScalar(e.normal,-e.distance,z6),H6=h.multiplyByScalar(t.normal,-t.distance,H6),G6=h.multiplyByScalar(n.normal,-n.distance,G6),W6=h.multiplyByScalar(h.cross(YA,qA,j5e),h.dot(z6,jA),W6),j6=h.multiplyByScalar(h.cross(qA,jA,Y5e),h.dot(H6,YA),j6),Y6=h.multiplyByScalar(h.cross(jA,YA,q5e),h.dot(G6,qA),Y6),Gh[0]=jA.x,Gh[1]=YA.x,Gh[2]=qA.x,Gh[3]=jA.y,Gh[4]=YA.y,Gh[5]=qA.y,Gh[6]=jA.z,Gh[7]=YA.z,Gh[8]=qA.z;let i=Z.determinant(Gh);return qg=h.add(W6,j6,qg),qg=h.add(qg,Y6,qg),new h(qg.x/i,qg.y/i,qg.z/i)}function X5e(e){let t=new Array(8);for(let n=0;n<4;n++)t[n]=Rse(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=Rse(e[1],e[2+(n+3)%4],e[2+n%4]);return t}var q6=new h,uE=new h;function X6(e,t){let n=[];for(let i=0;i<4;i++)q6=h.subtract(t[(i+1)%4],t[i],q6),uE=h.cross(e.normal,q6,uE),uE=h.normalize(uE,uE),n[i]=h.clone(uE);return n}Object.defineProperties(PR.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});var K6=new h;PR.prototype.distanceToCamera=function(e){let t=e.camera.positionWC,n=[],i=[],o;cn.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):cn.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,cn.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,c;if(n.length===1)return c=this._boundingPlanes[n[0]],a=Z6(cn.projectPointOntoPlane(c,t,K6),i[0],c,o),h.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=Bse(t,p[0],p[1]),h.distance(a,t)}let f=Number.MAX_VALUE,d;for(r=0;r<2;r++)c=this._boundingPlanes[n[r]],a=Z6(cn.projectPointOntoPlane(c,t,K6),i[r],c,this._edgeNormals[n[r]]),d=h.distanceSquared(a,t),d<f&&(f=d);return Math.sqrt(f)}else if(n.length>3)return a=Z6(cn.projectPointOntoPlane(this._boundingPlanes[1],t,K6),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),h.distance(a,t);let l=n[1]===2&&n[2]===5?0:1;return n[0]===0?h.distance(t,this._vertices[(n[1]-2+l)%4]):h.distance(t,this._vertices[4+(n[1]-2+l)%4])};var K5e=new h,Z5e=new h;function Bse(e,t,n){let i=h.subtract(n,t,K5e),o=h.subtract(e,t,Z5e),r=h.dot(i,o);if(r<=0)return t;let s=h.dot(i,i);return r>=s?n:(r=r/s,new h((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}var J5e=new cn(h.UNIT_X,0);function Z6(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let c=0;c<t.length;c++){let l=cn.fromPointNormal(t[c],i[c],J5e);cn.getPointDistance(l,e)<0||(a=Bse(e,t[c],t[(c+1)%4]),r=h.distance(e,a),r<o&&(o=r,s=a))}return u(s)?s:e}PR.prototype.intersectPlane=function(e){let t=0,n=0;for(let i=0;i<this._vertices.length;i++)h.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?Qt.INSIDE:n===this._vertices.length?Qt.OUTSIDE:Qt.INTERSECTING};PR.prototype.createDebugVolume=function(e){let t=new M.clone(M.IDENTITY),n=new cf({polygonHierarchy:{positions:this._planeVertices[0]}}),i=cf.createGeometry(n),o=new At({geometry:i,id:"outline",modelMatrix:t,attributes:{color:Nt.fromColor(e)}}),r=new cf({polygonHierarchy:{positions:this._planeVertices[1]}}),s=cf.createGeometry(r),a=new At({geometry:s,id:"outline",modelMatrix:t,attributes:{color:Nt.fromColor(e)}}),c=[];for(let l=0;l<4;l++){let f=new cf({polygonHierarchy:{positions:this._planeVertices[2+l]}}),d=cf.createGeometry(f);c[l]=new At({geometry:d,id:"outline",modelMatrix:t,attributes:{color:Nt.fromColor(e)}})}return new Dn({geometryInstances:[c[0],c[1],c[2],c[3],a,o],appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})};var OR=PR;var Q5e=new h(1,1,1),yU=Math.cos,AU=Math.sin;function fE(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.radii,Q5e),n=y(e.innerRadii,t),i=y(e.minimumClock,0),o=y(e.maximumClock,P.TWO_PI),r=y(e.minimumCone,0),s=y(e.maximumCone,P.PI),a=Math.round(y(e.stackPartitions,10)),c=Math.round(y(e.slicePartitions,8)),l=Math.round(y(e.subdivisions,128));this._radii=h.clone(t),this._innerRadii=h.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._subdivisions=l,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}fE.packedLength=2*h.packedLength+8;fE.pack=function(e,t,n){return n=y(n,0),h.pack(e._radii,t,n),n+=h.packedLength,h.pack(e._innerRadii,t,n),n+=h.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]=y(e._offsetAttribute,-1),t};var Mse=new h,Lse=new h,Gp={radii:Mse,innerRadii:Lse,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};fE.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,Mse);t+=h.packedLength;let o=h.unpack(e,t,Lse);t+=h.packedLength;let r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++],p=e[t];return u(n)?(n._radii=h.clone(i,n._radii),n._innerRadii=h.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=c,n._stackPartitions=l,n._slicePartitions=f,n._subdivisions=d,n._offsetAttribute=p===-1?void 0:p,n):(Gp.minimumClock=r,Gp.maximumClock=s,Gp.minimumCone=a,Gp.maximumCone=c,Gp.stackPartitions=l,Gp.slicePartitions=f,Gp.subdivisions=d,Gp.offsetAttribute=p===-1?void 0:p,new fE(Gp))};fE.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,c=ie.fromCartesian3(t),l=e._slicePartitions+1,f=e._stackPartitions+1;l=Math.round(l*Math.abs(o-i)/P.TWO_PI),f=Math.round(f*Math.abs(s-r)/P.PI),l<2&&(l=2),f<2&&(f=2);let d=0,p=1,g=n.x!==t.x||n.y!==t.y||n.z!==t.z,m=!1,A=!1;g&&(p=2,r>0&&(m=!0,d+=l),s<Math.PI&&(A=!0,d+=l));let x=a*p*(f+l),C=new Float64Array(x*3),T=2*(x+d-(l+f)*p),E=Fe.createTypedArray(x,T),S,D,w,R,O=0,L=new Array(f),N=new Array(f);for(S=0;S<f;S++)R=r+S*(s-r)/(f-1),L[S]=AU(R),N[S]=yU(R);let _=new Array(a),b=new Array(a);for(S=0;S<a;S++)w=i+S*(o-i)/(a-1),_[S]=AU(w),b[S]=yU(w);for(S=0;S<f;S++)for(D=0;D<a;D++)C[O++]=t.x*L[S]*b[D],C[O++]=t.y*L[S]*_[D],C[O++]=t.z*N[S];if(g)for(S=0;S<f;S++)for(D=0;D<a;D++)C[O++]=n.x*L[S]*b[D],C[O++]=n.y*L[S]*_[D],C[O++]=n.z*N[S];for(L.length=a,N.length=a,S=0;S<a;S++)R=r+S*(s-r)/(a-1),L[S]=AU(R),N[S]=yU(R);for(_.length=l,b.length=l,S=0;S<l;S++)w=i+S*(o-i)/(l-1),_[S]=AU(w),b[S]=yU(w);for(S=0;S<a;S++)for(D=0;D<l;D++)C[O++]=t.x*L[S]*b[D],C[O++]=t.y*L[S]*_[D],C[O++]=t.z*N[S];if(g)for(S=0;S<a;S++)for(D=0;D<l;D++)C[O++]=n.x*L[S]*b[D],C[O++]=n.y*L[S]*_[D],C[O++]=n.z*N[S];for(O=0,S=0;S<f*p;S++){let B=S*a;for(D=0;D<a-1;D++)E[O++]=B+D,E[O++]=B+D+1}let v=f*a*p;for(S=0;S<l;S++)for(D=0;D<a-1;D++)E[O++]=v+S+D*l,E[O++]=v+S+(D+1)*l;if(g)for(v=f*a*p+l*a,S=0;S<l;S++)for(D=0;D<a-1;D++)E[O++]=v+S+D*l,E[O++]=v+S+(D+1)*l;if(g){let B=f*a*p,F=B+a*l;if(m)for(S=0;S<l;S++)E[O++]=B+S,E[O++]=F+S;if(A)for(B+=a*l-l,F+=a*l-l,S=0;S<l;S++)E[O++]=B+S,E[O++]=F+S}let I=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:C})});if(u(e._offsetAttribute)){let B=C.length,F=e._offsetAttribute===nn.NONE?0:1,k=new Uint8Array(B/3).fill(F);I.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:k})}return new ct({attributes:I,indices:E,primitiveType:Me.LINES,boundingSphere:se.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})};var $l=fE;function dE(e){let t=y(e.radius,1),i={radii:new h(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new $l(i),this._workerName="createSphereOutlineGeometry"}dE.packedLength=$l.packedLength;dE.pack=function(e,t,n){return $l.pack(e._ellipsoidGeometry,t,n)};var $5e=new $l,XA={radius:void 0,radii:new h,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};dE.unpack=function(e,t,n){let i=$l.unpack(e,t,$5e);return XA.stackPartitions=i._stackPartitions,XA.slicePartitions=i._slicePartitions,XA.subdivisions=i._subdivisions,u(n)?(h.clone(i._radii,XA.radii),n._ellipsoidGeometry=new $l(XA),n):(XA.radius=i._radii.x,new dE(XA))};dE.createGeometry=function(e){return $l.createGeometry(e._ellipsoidGeometry)};var Wp=dE;function hE(e,t){t===0&&(t=P.EPSILON7),this._boundingSphere=new se(e,t)}Object.defineProperties(hE.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}}});hE.prototype.distanceToCamera=function(e){let t=this._boundingSphere;return Math.max(0,h.distance(t.center,e.camera.positionWC)-t.radius)};hE.prototype.intersectPlane=function(e){return se.intersectPlane(this._boundingSphere,e)};hE.prototype.update=function(e,t){h.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};hE.prototype.createDebugVolume=function(e){let t=new Wp({radius:this.radius}),n=M.fromTranslation(this.center,new M.clone(M.IDENTITY)),i=new At({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Nt.fromColor(e)}});return new Dn({geometryInstances:i,appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})};var jp=hE;var e6e=new h,t6e=new h,n6e=new h,i6e=new h;function KA(e,t,n){n=h.cross(e,t,n);let i=h.magnitude(n);return h.multiplyByScalar(n,P.EPSILON7/i,n)}function J6(e,t){let n=h.normalize(e,i6e),i=h.equalsEpsilon(n,h.UNIT_X,P.EPSILON6)?h.UNIT_Y:h.UNIT_X;return KA(e,i,t)}function Nse(e){let t=Z.getColumn(e,0,e6e),n=Z.getColumn(e,1,t6e),i=Z.getColumn(e,2,n6e),o=h.equals(t,h.ZERO),r=h.equals(n,h.ZERO),s=h.equals(i,h.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=P.EPSILON7,e[4]=P.EPSILON7,e[8]=P.EPSILON7,e):(o&&!r&&!s?t=KA(n,i,t):!o&&r&&!s?n=KA(t,i,n):!o&&!r&&s?i=KA(n,t,i):o?r?s||(t=J6(i,t),n=KA(i,t,n)):(t=J6(n,t),i=KA(n,t,i)):(n=J6(t,n),i=KA(n,t,i)),Z.setColumn(e,0,t,e),Z.setColumn(e,1,n,e),Z.setColumn(e,2,i,e),e)}function mE(e,t){t=Nse(t),this._orientedBoundingBox=new Rn(e,t),this._boundingSphere=se.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(mE.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});mE.prototype.distanceToCamera=function(e){return Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};mE.prototype.intersectPlane=function(e){return this._orientedBoundingBox.intersectPlane(e)};mE.prototype.update=function(e,t){h.clone(e,this._orientedBoundingBox.center),t=Nse(t),Z.clone(t,this._orientedBoundingBox.halfAxes),se.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};mE.prototype.createDebugVolume=function(e){let t=new Xf({minimum:new h(-1,-1,-1),maximum:new h(1,1,1)}),n=M.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new At({geometry:t,id:"outline",modelMatrix:n,attributes:{color:Nt.fromColor(e)}});return new Dn({geometryInstances:i,appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})};var lf=mE;function Xo(e,t,n,i){this._tileset=e,this._header=n;let o=u(n.contents),r=o&&n.contents.length>1||ai(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=u(n.transform)?M.unpack(n.transform):M.clone(M.IDENTITY);let a=u(i)?i.computedTransform:e.modelMatrix,c=M.multiply(a,this.transform,new M),l=u(i)?i._initialTransform:M.IDENTITY;this._initialTransform=M.multiply(l,this.transform,new M),this.computedTransform=c,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,c),this._boundingVolume2D=void 0;let f;u(s)&&u(s.boundingVolume)&&(f=this.createBoundingVolume(s.boundingVolume,c)),this._contentBoundingVolume=f,this._contentBoundingVolume2D=void 0;let d;u(n.viewerRequestVolume)&&(d=this.createBoundingVolume(n.viewerRequestVolume,c)),this._viewerRequestVolume=d,this.geometricError=n.geometricError,this._geometricError=n.geometricError,u(this._geometricError)||(this._geometricError=u(i)?i._geometricError:e._geometricError,Xo._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let p;u(n.refine)?((n.refine==="replace"||n.refine==="add")&&Xo._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),p=n.refine.toUpperCase()==="REPLACE"?Sr.REPLACE:Sr.ADD):u(i)?p=i.refine:p=Sr.REPLACE,this.refine=p,this.children=[],this.parent=i;let g,m=!1,A,x,C;if(t=Oe.createIfNeeded(t),r)A=Eo.UNLOADED,x=t.clone();else if(u(s)){let D=s.uri;u(s.url)&&(Xo._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),D=s.url),D===""?(Xo._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 iE(e,this),m=!0,A=Eo.READY):(A=Eo.UNLOADED,x=t.getDerivedResource({url:D}),C=Oa.getServerKey(x.getUrlComponent()))}else g=new iE(e,this),m=!0,A=Eo.READY;this._content=g,this._contentResource=x,this._contentState=A,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=C,this.hasEmptyContent=m,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.metadata=bR(e,n),this.cacheNode=void 0;let T=n.expire,E,S;u(T)&&(E=T.duration,u(T.date)&&(S=$.fromIso8601(T.date))),this.expireDuration=E,this.expireDate=S,this.lastStyleTime=0,this._optimChildrenWithinParent=of.NOT_COMPUTED,this.clippingPlanesDirty=!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._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._clippingPlanesState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=z.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 $,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Xo._deprecationWarning=nr;Object.defineProperties(Xo.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return y(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return u(this._color)||(this._color=new z),z.clone(this._color)},set:function(e){this._color=z.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||u(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Eo.READY}},contentUnloaded:{get:function(){return this._contentState===Eo.UNLOADED}},contentExpired:{get:function(){return this._contentState===Eo.EXPIRED}},contentFailed:{get:function(){return this._contentState===Eo.FAILED}},contentReadyToProcessPromise:{get:function(){return this._contentReadyToProcessPromise}},contentReadyPromise:{get:function(){return this._contentReadyPromise}},commandsLength:{get:function(){return this._commandsLength}}});var Xg=new h;function o6e(e,t){let n=e._tileset,i=t.camera,o=e.boundingSphere,r=o.radius,s=h.multiplyByScalar(i.directionWC,e._centerZDepth,Xg),a=h.add(i.positionWC,s,Xg),c=h.subtract(a,o.center,Xg);if(h.magnitude(c)>r){let E=h.normalize(c,Xg),S=h.multiplyByScalar(E,r,Xg),D=h.add(o.center,S,Xg),w=h.subtract(D,i.positionWC,Xg),R=h.normalize(w,Xg);e._foveatedFactor=1-Math.abs(h.dot(i.directionWC,R))}else e._foveatedFactor=0;let d=e.refine===Sr.REPLACE,p=n._skipLevelOfDetail;if(d&&!p||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&d&&p||n._pass===qo.PRELOAD_FLIGHT||n._pass===qo.PRELOAD)return!1;let g=1-Math.cos(i.frustum.fov*.5),m=n.foveatedConeSize*g;if(e._foveatedFactor<=m)return!1;let A=g-m,x=P.clamp((e._foveatedFactor-m)/A,0,1),C=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.maximumScreenSpaceError,x),T=e._screenSpaceError===0&&u(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.maximumScreenSpaceError-C<=T}var Use=new $;Xo.prototype.getScreenSpaceError=function(e,t,n){let i=this._tileset,o=y(n,1),r=u(this.parent)?this.parent.geometricError:i._scaledGeometricError,s=t?r:this.geometricError;if(s===0)return 0;let a=e.camera,c=a.frustum,l=e.context,f=l.drawingBufferWidth,d=l.drawingBufferHeight*o,p;if(e.mode===te.SCENE2D||c instanceof en){u(c._offCenterFrustum)&&(c=c._offCenterFrustum);let g=Math.max(c.top-c.bottom,c.right-c.left)/Math.max(f,d);p=s/g}else{let g=Math.max(this._distanceToCamera,P.EPSILON7),m=a.frustum.sseDenominator;if(p=s*d/(g*m),i.dynamicScreenSpaceError){let A=i._dynamicScreenSpaceErrorComputedDensity,x=i.dynamicScreenSpaceErrorFactor,C=P.fog(g,A)*x;p-=C}}return p/=e.pixelRatio,p};function r6e(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let n=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;let i=t.parent,o=e._maximumScreenSpaceError,r=t._screenSpaceErrorProgressiveResolution<=o,s=u(i)&&i._screenSpaceErrorProgressiveResolution>o;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,n=!0),n}function s6e(e,t){let n=t.parent,o=u(n)&&(!e._skipLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}Xo.prototype.updateVisibility=function(e){let t=this.parent,n=this._tileset,i=u(t)?t.computedTransform:n.modelMatrix,o=u(t)?t._visibilityPlaneMask:$r.MASK_INDETERMINATE;this.updateTransform(i),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!==$r.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=s6e(n,this),this._priorityProgressiveResolution=r6e(n,this),this.priorityDeferred=o6e(this,e)};Xo.prototype.updateExpiration=function(){if(u(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){let e=$.now(Use);$.lessThan(this.expireDate,e)&&(this._contentState=Eo.EXPIRED,this._expiredContent=this._content)}};function a6e(e){if(u(e.expireDuration)){let t=$.now(Use);$.addSeconds(t,e.expireDuration,t),u(e.expireDate)?$.lessThan(e.expireDate,t)&&$.clone(t,e.expireDate):e.expireDate=$.clone(t)}}function c6e(e){return function(){return e._priority}}Xo.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?l6e(this):u6e(this)};function l6e(e){let t=e._content,n=e._tileset;if(!u(t)){let r=ai(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new SR(n,e,e._contentResource.clone(),r),e._content=t}let i=t.requestInnerContents();if(i>0)return i;e._contentState=Eo.LOADING;let o=t.contentsFetchedPromise.then(function(){if(!(e._contentState!==Eo.LOADING||!u(t.readyPromise))){if(e.isDestroyed()){Q6(e,n,"Tile was unloaded while content was loading");return}return e._contentState=Eo.PROCESSING,t}});return e._contentReadyToProcessPromise=o,e._contentReadyPromise=o.then(function(r){if(u(r))return t.readyPromise}).then(function(r){if(u(r)){if(e.isDestroyed()){Q6(e,n,"Tile was unloaded while content was processing");return}return e._selectedFrame=0,e.lastStyleTime=0,$.now(e._loadTimestamp),e._contentState=Eo.READY,r}}).catch(function(r){Q6(e,n,r)}),0}function Q6(e,t,n){e._contentState===Eo.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Eo.FAILED}function u6e(e){let t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});let i=new zo({throttle:!0,throttleByServer:!0,type:Qr.TILES3D,priorityFunction:c6e(e),serverKey:e._serverKey});e._request=i,t.request=i;let o=t.fetchArrayBuffer();if(!u(o))return 1;let r=e._contentState,s=e._tileset;e._contentState=Eo.LOADING,++s.statistics.numberOfPendingRequests;let a=o.then(function(c){if(e.isDestroyed()){$6(e,s);return}let l=f6e(e,c);return n&&(e.expireDate=void 0),e._content=l,e._contentState=Eo.PROCESSING,l});return e._contentReadyToProcessPromise=a,e._contentReadyPromise=a.then(function(c){if(u(c))return--s.statistics.numberOfPendingRequests,c.readyPromise}).then(function(c){if(u(c)){if(e.isDestroyed()){$6(e,s);return}return a6e(e),e._selectedFrame=0,e.lastStyleTime=0,$.now(e._loadTimestamp),e._contentState=Eo.READY,c}}).catch(function(c){return i.state===hi.CANCELLED?(e._contentState=r,--s.statistics.numberOfPendingRequests,++s.statistics.numberOfAttemptedRequests,Promise.reject("Cancelled")):($6(e,s),Promise.reject(c))}),0}function $6(e,t){e._contentState===Eo.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Eo.FAILED}function f6e(e,t){let n=Hh(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===cs.GEOMETRY||n.contentType===cs.VECTOR,(n.contentType===cs.IMPLICIT_SUBTREE||n.contentType===cs.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===cs.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o,r=NA[n.contentType];u(n.binaryPayload)?o=r(i,e,e._contentResource,n.binaryPayload.buffer,0):o=r(i,e,e._contentResource,n.jsonPayload);let s=e._contentHeader;if(e.hasImplicitContentMetadata){let c=e.implicitSubtree,l=e.implicitCoordinates;o.metadata=c.getContentMetadataView(l,0)}else e.hasImplicitContent||(o.metadata=UA(i,s));let a=kA(i,s);return u(a)&&(o.group=new iA({metadata:a})),o}Xo.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};Xo.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Eo.UNLOADED,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this.lastStyleTime=0,this.clippingPlanesDirty=this._clippingPlanesState===0,this._clippingPlanesState=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 kse=new se;function t9(e,t){if(t.mode!==te.SCENE3D&&!u(e._boundingVolume2D)){let n=e._boundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,kse);e._boundingVolume2D=new jp(i.center,i.radius)}return t.mode!==te.SCENE3D?e._boundingVolume2D:e._boundingVolume}function d6e(e,t){if(t.mode!==te.SCENE3D&&!u(e._contentBoundingVolume2D)){let n=e._contentBoundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,kse);e._contentBoundingVolume2D=new jp(i.center,i.radius)}return t.mode!==te.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Xo.prototype.visibility=function(e,t){let n=e.cullingVolume,i=t9(this,e),o=this._tileset,r=o.clippingPlanes;if(u(r)&&r.enabled){let s=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=s!==Qt.INSIDE,s===Qt.OUTSIDE)return $r.MASK_OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};Xo.prototype.contentVisibility=function(e){if(!u(this._contentBoundingVolume))return Qt.INSIDE;if(this._visibilityPlaneMask===$r.MASK_INSIDE)return Qt.INSIDE;let t=e.cullingVolume,n=d6e(this,e),i=this._tileset,o=i.clippingPlanes;if(u(o)&&o.enabled){let r=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=r!==Qt.INSIDE,r===Qt.OUTSIDE)return Qt.OUTSIDE}return t.computeVisibility(n)};Xo.prototype.distanceToTile=function(e){return t9(this,e).distanceToCamera(e)};var h6e=new h;Xo.prototype.distanceToTileCenter=function(e){let n=t9(this,e).boundingVolume,i=h.subtract(n.center,e.camera.positionWC,h6e);return h.dot(e.camera.directionWC,i)};Xo.prototype.insideViewerRequestVolume=function(e){let t=this._viewerRequestVolume;return!u(t)||t.distanceToCamera(e)===0};var zse=new Z,Hse=new h,m6e=new Z,Gse=new h,Wse=new ce,p6e=new Rn,e9=new M;function _6e(e,t,n){let i=h.fromElements(e[0],e[1],e[2],Gse),o=Z.fromArray(e,3,m6e);i=M.multiplyByPoint(t,i,i);let r=M.getMatrix3(t,zse);return o=Z.multiply(r,o,o),u(n)?(n.update(i,o),n):new lf(i,o)}function g6e(e,t,n,i){let o=ce.unpack(e,0,Wse),r=e[4],s=e[5],a=Rn.fromRectangle(o,r,s,ie.WGS84,p6e),c=a.center,l=a.halfAxes;t=M.multiplyTransformation(t,M.inverseTransformation(n,e9),e9),c=M.multiplyByPoint(t,c,c);let f=M.getMatrix3(t,zse);return l=Z.multiply(f,l,l),u(i)&&i instanceof lf?(i.update(c,l),i):new lf(c,l)}function y6e(e,t,n,i){if(!M.equalsEpsilon(t,n,P.EPSILON8))return g6e(e,t,n,i);if(u(i))return i;let o=ce.unpack(e,0,Wse);return new af({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function A6e(e,t,n){let i=h.fromElements(e[0],e[1],e[2],Gse),o=e[3];i=M.multiplyByPoint(t,i,i);let r=M.getScale(t,Hse),s=h.maximumComponent(r);return o*=s,u(n)?(n.update(i,o),n):new jp(i,o)}Xo.prototype.createBoundingVolume=function(e,t,n){if(!u(e))throw new ue("boundingVolume must be defined");if(ai(e,"3DTILES_bounding_volume_S2"))return new OR(e.extensions["3DTILES_bounding_volume_S2"]);if(u(e.box))return _6e(e.box,t,n);if(u(e.region))return y6e(e.region,t,this._initialTransform,n);if(u(e.sphere))return A6e(e.sphere,t,n);throw new ue("boundingVolume must contain a sphere, region, or box")};Xo.prototype.updateTransform=function(e){e=y(e,M.IDENTITY);let t=M.multiply(e,this.transform,e9);if(!!M.equals(t,this.computedTransform))return;M.clone(t,this.computedTransform);let i=this._header,o=this._contentHeader;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),u(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(o.boundingVolume,this.computedTransform,this._contentBoundingVolume)),u(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(i.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()};Xo.prototype.updateGeometricErrorScale=function(){let e=M.getScale(this.computedTransform,Hse),t=h.maximumComponent(e);if(this.geometricError=this._geometricError*t,!u(this.parent)){let n=this._tileset;n._scaledGeometricError=n._geometricError*t}};function x6e(e,t,n,i){if(!i.isRender)return;let o=u(e._contentHeader)&&u(e._contentHeader.boundingVolume),r=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,s=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(s){let l;e._finalResolution?r?l=z.DARKGRAY:l=z.WHITE:l=z.YELLOW,u(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(l)),e._debugBoundingVolume.update(n);let f=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");f.color=Nt.toValue(l,f.color)}else!s&&u(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(u(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(z.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&u(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&u(e._viewerRequestVolume)?(u(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(z.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&u(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());let a=t.debugColorizeTiles&&!e._debugColorizeTiles||u(t._heatmap.tilePropertyName),c=!t.debugColorizeTiles&&e._debugColorizeTiles;a?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):c&&(e._debugColorizeTiles=!1,e.color=z.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function C6e(e,t,n){let i=e._content,o=e._expiredContent;if(!e.hasMultipleContents&&u(o)){if(!e.contentReady){o.update(t,n);return}e._expiredContent.destroy(),e._expiredContent=void 0}i.update(t,n)}function T6e(e,t){let n=t.clippingPlanes,i=0;u(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}Xo.prototype.update=function(e,t,n){let i=t.commandList.length;T6e(this,e),x6e(this,e,t,n),C6e(this,e,t);let r=t.commandList.length-i;this._commandsLength=r;for(let s=0;s<r;++s){let a=t.commandList[i+s],c=a.pass===Ee.TRANSLUCENT;a.depthForTranslucentClassification=c}this.clippingPlanesDirty=!1};var Fse=[];Xo.prototype.process=function(e,t){let n=t.commandList;t.commandList=Fse,this._content.update(e,t),Fse.length=0,t.commandList=n};function Vse(e,t,n){let i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function xU(e,t,n){return Math.max(P.normalize(e,t,n)-P.EPSILON7,0)}Xo.prototype.updatePriority=function(){let e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=4,r=1,s=0,a=o,c=s+a,l=o,f=c+l,d=r,p=Math.pow(10,f),g=f+d,m=r,A=Math.pow(10,g),x=g+m,C=Math.pow(10,x),T=xU(this._depth,n.depth,i.depth);T=t?1-T:T;let S=!e._skipLevelOfDetail&&this.refine===Sr.REPLACE?xU(this._priorityHolder._distanceToCamera,n.distance,i.distance):xU(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),D=Vse(S,a,s),w=this._priorityProgressiveResolution?0:p,R=xU(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),O=Vse(R,l,c),L=this.priorityDeferred?A:0,N=e._pass===qo.PRELOAD_FLIGHT?0:C;this._priority=T+D+w+O+L+N};Xo.prototype.isDestroyed=function(){return!1};Xo.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(),le(this)};var eu=Xo;function Yp(e){e=y(e,y.EMPTY_OBJECT);let t=e.id,n=e.group,i=e.class,o=u(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}Object.defineProperties(Yp.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}}});Yp.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};Yp.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};Yp.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};Yp.prototype.getProperty=function(e){return Nn.getProperty(e,this._properties,this._class)};Yp.prototype.setProperty=function(e,t){return Nn.setProperty(e,t,this._properties,this._class)};Yp.prototype.getPropertyBySemantic=function(e){return Nn.getPropertyBySemantic(e,this._properties,this._class)};Yp.prototype.setPropertyBySemantic=function(e,t){return Nn.setPropertyBySemantic(e,t,this._properties,this._class)};var pE=Yp;function qp(e){e=y(e,y.EMPTY_OBJECT);let t=e.tileset,n=e.class,i=u(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(qp.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});qp.prototype.hasProperty=function(e){return Nn.hasProperty(e,this._properties,this._class)};qp.prototype.hasPropertyBySemantic=function(e){return Nn.hasPropertyBySemantic(e,this._properties,this._class)};qp.prototype.getPropertyIds=function(e){return Nn.getPropertyIds(this._properties,this._class,e)};qp.prototype.getProperty=function(e){return Nn.getProperty(e,this._properties,this._class)};qp.prototype.setProperty=function(e,t){return Nn.setProperty(e,t,this._properties,this._class)};qp.prototype.getPropertyBySemantic=function(e){return Nn.getPropertyBySemantic(e,this._properties,this._class)};qp.prototype.setPropertyBySemantic=function(e,t){return Nn.setPropertyBySemantic(e,t,this._properties,this._class)};var RR=qp;function jse(e){e=y(e,y.EMPTY_OBJECT);let t=e.metadataJson,n=e.schema,i=y(t.metadata,t.tileset),o;u(i)&&(o=new RR({tileset:i,class:n.classes[i.class]}));let r=[],s=[],a=t.groups;if(Array.isArray(a)){let c=a.length;for(let l=0;l<c;l++){let f=a[l];s.push(new pE({group:f,class:n.classes[f.class]}))}}else if(u(a)){r=Object.keys(a).sort();let c=r.length;for(let l=0;l<c;l++){let f=r[l];if(a.hasOwnProperty(f)){let d=a[f];s.push(new pE({id:f,group:a[f],class:n.classes[d.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(jse.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 ZA=jse;var Yse={},E6e=new h;Yse.checkChildrenWithinParent=function(e){let t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof lf||i instanceof af){let o=i._orientedBoundingBox;e._optimChildrenWithinParent=of.USE_OPTIMIZATION;for(let r=0;r<n;++r){let a=t[r].boundingVolume;if(!(a instanceof lf||a instanceof af)){e._optimChildrenWithinParent=of.SKIP_OPTIMIZATION;break}let c=a._orientedBoundingBox,l=h.subtract(c.center,o.center,E6e),f=h.magnitude(l);h.divideByScalar(l,f,l);let d=Math.abs(o.halfAxes[0]*l.x)+Math.abs(o.halfAxes[1]*l.y)+Math.abs(o.halfAxes[2]*l.z)+Math.abs(o.halfAxes[3]*l.x)+Math.abs(o.halfAxes[4]*l.y)+Math.abs(o.halfAxes[5]*l.z)+Math.abs(o.halfAxes[6]*l.x)+Math.abs(o.halfAxes[7]*l.y)+Math.abs(o.halfAxes[8]*l.z),p=Math.abs(c.halfAxes[0]*l.x)+Math.abs(c.halfAxes[1]*l.y)+Math.abs(c.halfAxes[2]*l.z)+Math.abs(c.halfAxes[3]*l.x)+Math.abs(c.halfAxes[4]*l.y)+Math.abs(c.halfAxes[5]*l.z)+Math.abs(c.halfAxes[6]*l.x)+Math.abs(c.halfAxes[7]*l.y)+Math.abs(c.halfAxes[8]*l.z);if(d<=p+f){e._optimChildrenWithinParent=of.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===of.USE_OPTIMIZATION};var BR=Yse;function MR(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(MR.prototype,{length:{get:function(){return this._length}}});function b6e(e,t,n){this.item=e,this.previous=t,this.next=n}MR.prototype.add=function(e){let t=new b6e(e,this.tail,void 0);return u(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t};function qse(e,t){u(t.previous)&&u(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):u(t.previous)?(t.previous.next=void 0,e.tail=t.previous):u(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}MR.prototype.remove=function(e){u(e)&&(qse(this,e),--this._length)};MR.prototype.splice=function(e,t){if(e===t)return;qse(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 LR=MR;function JA(){this._list=new LR,this._sentinel=this._list.add(),this._trimTiles=!1}JA.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};JA.prototype.touch=function(e){let t=e.cacheNode;u(t)&&this._list.splice(this._sentinel,t)};JA.prototype.add=function(e){u(e.cacheNode)||(e.cacheNode=this._list.add(e))};JA.prototype.unloadTile=function(e,t,n){let i=t.cacheNode;u(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))};JA.prototype.unloadTiles=function(e,t){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=e.maximumMemoryUsage*1024*1024,r=this._sentinel,s=i.head;for(;s!==r&&(e.totalMemoryUsageInBytes>o||n);){let a=s.item;s=s.next,this.unloadTile(e,a,t)}};JA.prototype.trim=function(){this._trimTiles=!0};var NR=JA;function CU(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 i9(e,t){let n;return t==="_loadTimestamp"?n=$.toDate(e).getTime():n=e,n}CU.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=i9(e,n),this._referenceMaximum[n]=i9(t,n)};function S6e(e,t){let n=e.tilePropertyName;if(u(n)){let i=i9(t[n],n);return u(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}var n9=[new z(.1,.1,.1,1),new z(.153,.278,.878,1),new z(.827,.231,.49,1),new z(.827,.188,.22,1),new z(1,.592,.259,1),new z(1,.843,0,1)];CU.prototype.colorize=function(e,t){let n=this.tilePropertyName;if(!u(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;let i=S6e(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;let s=r-o+P.EPSILON7,c=P.clamp(i-o,0,s)/s,l=n9.length-1,f=c*l,d=Math.floor(f),p=Math.ceil(f),g=f-d,m=n9[d],A=n9[p],x=z.clone(z.WHITE);x.red=P.lerp(m.red,A.red,g),x.green=P.lerp(m.green,A.green,g),x.blue=P.lerp(m.blue,A.blue,g),e._debugColor=x};CU.prototype.resetMinimumMaximum=function(){let e=this.tilePropertyName;if(u(e)){let t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=u(t)&&u(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};var FR=CU;function _E(){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.batchTableByteLength=0}_E.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};function TU(e,t,n,i){let o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,c=t.geometryByteLength,l=t.texturesByteLength,f=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-l:l,e.batchTableByteLength+=n?-f:f):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),u(o)){let d=o.length;for(let p=0;p<d;++p)TU(e,o[p],n,i)}}_E.prototype.incrementSelectionCounts=function(e){TU(this,e,!1,!1)};_E.prototype.incrementLoadCounts=function(e){TU(this,e,!1,!0)};_E.prototype.decrementLoadCounts=function(e){TU(this,e,!0,!0)};_E.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,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.batchTableByteLength=e.batchTableByteLength};var Xp=_E;function VR(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(VR.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});VR.prototype.makeDirty=function(){this._styleDirty=!0};VR.prototype.resetDirty=function(){this._styleDirty=!1};VR.prototype.applyStyle=function(e){if(!e.ready||u(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 c=a.content;a.lastStyleTime=n,c.applyStyle(this._style),i.numberOfFeaturesStyled+=c.featuresLength,++i.numberOfTilesStyled}}};var UR=VR;function D6e(e,t,n){let i=ai(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;let o=t.boundingVolume;if(!u(o.box)&&!u(o.region)&&!ai(o,"3DTILES_bounding_volume_S2")&&!ai(o,"3DTILES_bounding_volume_cylinder"))throw new ue("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 Oe({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];let r=v6e(t);for(let s=0;s<r.length;s++){let a=r[s];this.contentHeaders.push(Ge(a,!0));let c=new Oe({url:a.uri});this.contentUriTemplates.push(c)}this.contentCount=this.contentHeaders.length,this.tileHeader=w6e(t),this.subdivisionScheme=kr[i.subdivisionScheme],this.branchingFactor=kr.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,u(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function v6e(e){if(ai(e,"3DTILES_multiple_contents")){let t=e.extensions["3DTILES_multiple_contents"];return u(t.contents)?t.contents:t.content}return u(e.contents)?e.contents:u(e.content)?[e.content]:[]}function w6e(e){let t=Ge(e,!0);return u(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 QA=D6e;var kR={};function Xse(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function o9(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function Kse(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 r9(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}kR.encode2D=function(e,t){return(Xse(e)|Xse(t)<<1)>>>0};kR.decode2D=function(e,t){return u(t)||(t=new Array(2)),t[0]=Kse(e),t[1]=Kse(e>>1),t};kR.encode3D=function(e,t,n){return o9(e)|o9(t)<<1|o9(n)<<2};kR.decode3D=function(e,t){return u(t)||(t=new Array(3)),t[0]=r9(e),t[1]=r9(e>>1),t[2]=r9(e>>2),t};var Kg=kR;function Fo(e){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===kr.OCTREE&&(this.z=e.z)}Object.defineProperties(Fo.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===kr.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===kr.OCTREE?Kg.encode3D(this.x,this.y,this.z):Kg.encode2D(this.x,this.y)}},tileIndex:{get:function(){let e=this.subdivisionScheme===kr.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});Fo.prototype.getDescendantCoordinates=function(e){let t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===kr.OCTREE){let o=(this.z<<e.level)+e.z;return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};Fo.prototype.getAncestorCoordinates=function(e){let t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===kr.OCTREE){let r=Math.floor(this.z/t);return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};Fo.prototype.getOffsetCoordinates=function(e){let t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===kr.OCTREE){let r=e.z%n;return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})};Fo.prototype.getChildCoordinates=function(e){let t=this.level+1,n=2*this.x+e%2,i=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===kr.OCTREE){let o=2*this.z+Math.floor(e/4)%2;return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new Fo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};Fo.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)};Fo.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)};Fo.prototype.isAncestor=function(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===kr.OCTREE){let s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};Fo.prototype.isEqual=function(e){return this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===kr.OCTREE?this.z===e.z:!0)};Fo.prototype.isImplicitTilesetRoot=function(){return this.level===0};Fo.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};Fo.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};Fo.prototype.getTemplateValues=function(){let e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===kr.OCTREE&&(e.z=this.z),e};var Zse=[0,0,0];Fo.fromMortonIndex=function(e,t,n,i){let o;return e===kr.OCTREE?(o=Kg.decode3D(i,Zse),new Fo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=Kg.decode2D(i,Zse),new Fo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};Fo.fromTileIndex=function(e,t,n){let i,o,r;return e===kr.OCTREE?(i=Math.floor(P.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(P.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),Fo.fromMortonIndex(e,t,i,r)};var $A=Fo;function Gs(e){e=y(e,y.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 NR,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=y(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=y(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new Yl,this._maximumScreenSpaceError=y(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=y(e.maximumMemoryUsage,512),this._styleEngine=new UR,this._styleApplied=!1,this._modelMatrix=u(e.modelMatrix)?M.clone(e.modelMatrix):M.clone(M.IDENTITY),this._statistics=new Xp,this._statisticsLast=new Xp,this._statisticsPerPass=new Array(qo.NUMBER_OF_PASSES);for(let r=0;r<qo.NUMBER_OF_PASSES;++r)this._statisticsPerPass[r]=new Xp;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 FR(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=y(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=y(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=P.clamp(y(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=y(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=y(e.ellipsoid,ie.WGS84),this._initialClippingPlanesOriginMatrix=M.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=y(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=y(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=y(e.preloadWhenHidden,!1),this.preloadFlightDestinations=y(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=y(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=y(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=y(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=y(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=y(e.foveatedInterpolationCallback,P.lerp),this.foveatedTimeDelay=y(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=y(e.shadows,gn.ENABLED),this.show=y(e.show,!0),this.colorBlendMode=ul.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new Oh(e.pointCloudShading),this._pointCloudEyeDomeLighting=new Tp,this.loadProgress=new Ae,this.allTilesLoaded=new Ae,this.initialTilesLoaded=new Ae,this.tileLoad=new Ae,this.tileUnload=new Ae,this.tileFailed=new Ae,this.tileVisible=new Ae,this.skipLevelOfDetail=y(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=y(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=y(e.skipScreenSpaceErrorFactor,16),this.skipLevels=y(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=y(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=y(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,u(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new nA,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=y(e.backFaceCulling,!0),this._enableShowOutline=y(e.enableShowOutline,!0),this.showOutline=y(e.showOutline,!0),this.outlineColor=y(e.outlineColor,z.BLACK),this.splitDirection=y(e.splitDirection,Pc.NONE),this._projectTo2D=y(e.projectTo2D,!1),this.debugFreezeFrame=y(e.debugFreezeFrame,!1),this.debugColorizeTiles=y(e.debugColorizeTiles,!1),this._enableDebugWireframe=y(e.enableDebugWireframe,!1),this.debugWireframe=y(e.debugWireframe,!1),this.debugWireframe===!0&&this._enableDebugWireframe===!1&&wt("tileset-debug-wireframe-ignored","enableDebugWireframe must be set to true in the Cesium3DTileset constructor, otherwise debugWireframe will be ignored."),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=y(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=y(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=y(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=y(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=y(e.debugShowMemoryUsage,!1),this.debugShowUrl=y(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let t=y(e.featureIdLabel,"featureId_0");typeof t=="number"&&(t=`featureId_${t}`),this._featureIdLabel=t;let n=y(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof n=="number"&&(n=`instanceFeatureId_${n}`),this._instanceFeatureIdLabel=n,this._schemaLoader=void 0;let i=this,o;this._readyPromise=Promise.resolve(e.url).then(function(r){let s;return o=Oe.createIfNeeded(r),i._resource=o,i._credits=o.credits,o.extension==="json"?s=o.getBaseUri(!0):o.isDataUri&&(s=""),i._url=o.url,i._basePath=s,Gs.loadJson(o)}).then(function(r){if(!i.isDestroyed())return I6e(i,r)}).then(function(r){if(i.isDestroyed())return;i._geometricError=r.geometricError,i._scaledGeometricError=r.geometricError,i._root=i.loadTileset(o,r);let s=u(r.asset.gltfUpAxis)?Po.fromName(r.asset.gltfUpAxis):Po.Y,a=y(e.modelUpAxis,s),c=y(e.modelForwardAxis,Po.X),l=r.asset;i._asset=l,i._properties=r.properties,i._extensionsUsed=r.extensionsUsed,i._extensions=r.extensions,i._modelUpAxis=a,i._modelForwardAxis=c,i._extras=r.extras;let f=l.extras;if(u(f)&&u(f.cesium)&&u(f.cesium.credits)){let m=f.cesium.credits,A=i._credits;u(A)||(A=[],i._credits=A);for(let x=0;x<m.length;++x){let C=m[x];A.push(new Zt(C.html,i._showCreditsOnScreen))}}let p=i._root.createBoundingVolume(r.root.boundingVolume,M.IDENTITY).boundingSphere.center,g=i._ellipsoid.cartesianToCartographic(p);return u(g)&&g.height>fi._defaultMinTerrainHeight&&(i._initialClippingPlanesOriginMatrix=Ot.eastNorthUpToFixedFrame(p)),i._clippingPlanesOriginMatrix=M.clone(i._initialClippingPlanesOriginMatrix),i})}Object.defineProperties(Gs.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){ss.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){return this._properties}},ready:{get:function(){return u(this._root)}},readyPromise:{get:function(){return this._readyPromise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return nr("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}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(u(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(u(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(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=M.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 u(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(M.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):M.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){this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),this._instanceFeatureIdLabel=e}}});Gs.loadJson=function(e){return Oe.createIfNeeded(e).fetchJson()};Gs.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};Gs.prototype.loadTileset=function(e,t,n){let i=t.asset;if(!u(i))throw new ue("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new ue("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");u(t.extensionsRequired)&&Gs.checkSupportedExtensions(t.extensionsRequired);let o=this._statistics,r=i.tilesetVersion;u(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));let s=Jse(this,e,t.root,n);u(n)&&(n.children.push(s),s._depth=n._depth+1);let a=[];for(a.push(s);a.length>0;){let c=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&c.refine===Sr.ADD;let l=c._header.children;if(u(l)){let f=l.length;for(let d=0;d<f;++d){let p=l[d],g=Jse(this,e,p,c);c.children.push(g),g._depth=c._depth+1,a.push(g)}}this._cullWithChildrenBounds&&BR.checkChildrenWithinParent(c)}return s};function Jse(e,t,n,i){if(u(n.implicitTiling)||ai(n,"3DTILES_implicit_tiling")){let r=e.schema,s=new QA(t,n,r),a=new $A({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),c=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,f=Ge(n,!0);f.contents=[{uri:c}],delete f.content,delete f.extensions;let d=new eu(e,t,f,i);return d.implicitTileset=s,d.implicitCoordinates=a,d}return new eu(e,t,n,i)}function I6e(e,t){let n=ai(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t,i;if(u(n.schemaUri)){let o=e._resource.getDerivedResource({url:n.schemaUri});i=Ui.loadSchema({resource:o})}else if(u(n.schema))i=Ui.loadSchema({schema:n.schema});else return Promise.resolve(t);return e._schemaLoader=i,i.promise.then(function(o){return e._metadataExtension=new ZA({schema:o.schema,metadataJson:n}),t})}var Qse=new h,P6e=new he,O6e=new M,R6e=new h,B6e=new h,M6e=new h;function L6e(e,t){let n,i,o,r,s,a=t.camera,c=e._root,l=c.contentBoundingVolume;if(l instanceof af)n=h.normalize(a.positionWC,Qse),i=a.directionWC,o=a.positionCartographic.height,r=l.minimumHeight,s=l.maximumHeight;else{let C=M.inverseTransformation(c.computedTransform,O6e),T=t.mapProjection.ellipsoid,E=l.boundingVolume,S=M.multiplyByPoint(C,E.center,R6e);if(h.magnitude(S)>T.minimumRadius){let D=he.fromCartesian(S,T,P6e);n=h.normalize(a.positionWC,Qse),i=a.directionWC,o=a.positionCartographic.height,r=0,s=D.height*2}else{let D=M.multiplyByPoint(C,a.positionWC,B6e);if(n=h.UNIT_Z,i=M.multiplyByPointAsVector(C,a.directionWC,M6e),i=h.normalize(i,i),o=D.z,l instanceof lf){let w=c._header.boundingVolume.box[11];r=S.z-w,s=S.z+w}else if(l instanceof jp){let w=E.radius;r=S.z-w,s=S.z+w}}}let f=e.dynamicScreenSpaceErrorHeightFalloff,d=r+(s-r)*f,p=s,g=P.clamp((o-d)/(p-d),0,1),A=1-Math.abs(h.dot(i,n));A=A*(1-g);let x=e.dynamicScreenSpaceErrorDensity;x*=A,e._dynamicScreenSpaceErrorComputedDensity=x}function N6e(e,t){if(t.hasEmptyContent)return;let n=e._statistics,i=t.contentExpired,o=t.requestContent();if(o>0){n.numberOfAttemptedRequests+=o;return}i&&(t.hasTilesetContent||t.hasImplicitContent?X6e(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(k6e(e,t)).catch(function(r){}),t.contentReadyPromise.then(H6e(e,t)).catch(z6e(e,t))}function F6e(e,t){return e._priority-t._priority}Gs.prototype.postPassesUpdate=function(e){this.ready&&(V6e(this,e),Z6e(this,e),this._cache.unloadTiles(this,tae),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};Gs.prototype.prePassesUpdate=function(e){if(!this.ready)return;W6e(this,e);let t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,u(t)&&t.enabled&&t.update(e),u(this._loadTimestamp)||(this._loadTimestamp=$.clone(e.time)),this._timeSinceLoad=Math.max($.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!u(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&L6e(this,e),e.newFrame&&this._cache.reset()};function V6e(e,t){let n=e._requestedTilesInFlight,i=0,o=n.length;for(let r=0;r<o;++r){let s=n[r],a=t.frameNumber-s._touchedFrame>=1;if(s._contentState!==Eo.LOADING){++i;continue}else if(a){s.cancelRequests(),++i;continue}i>0&&(n[r-i]=s)}n.length-=i}function U6e(e,t){let n=e._requestedTiles,i=n.length;n.sort(F6e);for(let o=0;o<i;++o)N6e(e,n[o])}function k6e(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function z6e(e,t){return function(n){if(t._contentState!==Eo.FAILED)return;let i=t._contentResource.url,o=u(n.message)?n.message:n.toString();e.tileFailed.numberOfListeners>0?e.tileFailed.raiseEvent({url:i,message:o}):(console.log(`A 3D tile failed to load: ${i}`),console.log(`Error: ${o}`))}}function H6e(e,t){return function(n){--e._statistics.numberOfTilesProcessing,u(n)&&(!t.hasTilesetContent&&!t.hasImplicitContent&&(e._statistics.incrementLoadCounts(t.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(t)),e.tileLoad.raiseEvent(t))}}function G6e(e){let t=e._processingQueue,n=t.length,i=0;for(let o=0;o<n;++o){let r=t[o];if(r._contentState!==Eo.PROCESSING){++i;continue}i>0&&(t[o-i]=r)}t.length-=i}function W6e(e,t){G6e(e);let n=e._processingQueue,i=n.length;for(let o=0;o<i;++o)n[o].process(e,t)}var EU=new h,j6e={maximumFractionDigits:3};function $se(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,j6e):Math.round(t).toLocaleString()}function s9(e){let t=e.boundingVolume.boundingVolume,n=t.halfAxes,i=t.radius,o=h.clone(t.center,EU);if(u(n))o.x+=.75*(n[0]+n[3]+n[6]),o.y+=.75*(n[1]+n[4]+n[7]),o.z+=.75*(n[2]+n[5]+n[8]);else if(u(i)){let r=h.normalize(t.center,EU);r=h.multiplyByScalar(r,.75*i,EU),o=h.add(r,t.center,EU)}return o}function a9(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: ${$se(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${$se(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 Y6e(e,t){let n,i,o=e._selectedTiles,r=o.length,s=e._emptyTiles,a=s.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(u(e.debugPickedTile)){let c=u(e.debugPickPosition)?e.debugPickPosition:s9(e.debugPickedTile),l=a9(e.debugPickedTile,e,c);l.pixelOffset=new H(15,-15)}}else{for(n=0;n<r;++n)i=o[n],a9(i,e,s9(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&a9(i,e,s9(i))}e._tileDebugLabels.update(t)}function q6e(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;let i=n.isRender,o=e._statistics,r=t.commandList,s=r.length,a=e._selectedTiles,c=a.length,l=e._emptyTiles,f=l.length,d=e.tileVisible,p,g,m=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,m&&(u(e._stencilClearCommand)||(e._stencilClearCommand=new ii({stencil:0,pass:Ee.CESIUM_3D_TILE,renderState:Ue.fromCache({stencilMask:Bt.SKIP_LOD_MASK})})),r.push(e._stencilClearCommand));let A=r.length;for(p=0;p<c;++p)g=a[p],i&&d.raiseEvent(g),g.update(e,t,n),o.incrementSelectionCounts(g.content),++o.selected;for(p=0;p<f;++p)g=l[p],g.update(e,t,n);let x=r.length-A;if(e._backfaceCommands.trim(),m){let C=e._backfaceCommands.values,T=C.length;for(r.length+=T,p=x-1;p>=0;--p)r[A+T+p]=r[A+p];for(p=0;p<T;++p)r[A+p]=C[p]}x=r.length-s,o.numberOfCommands=x,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&x>0&&e._pointCloudEyeDomeLighting.update(t,s,e.pointCloudShading,e.boundingSphere),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(u(e._tileDebugLabels)||(e._tileDebugLabels=new Fh),Y6e(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}var eae=[];function X6e(e,t){let n=t,i=eae;for(i.push(t);i.length>0;){t=i.pop();let o=t.children,r=o.length;for(let s=0;s<r;++s)i.push(o[s]);t!==n&&(K6e(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function tae(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function K6e(e,t){e._cache.unloadTile(e,t,tae),t.destroy()}Gs.prototype.trimLoadedTiles=function(){this._cache.trim()};function Z6e(e,t){let n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;Xp.clone(n,i);let c=o!==s||r!==a;c&&t.afterRender.push(function(){return e.loadProgress.raiseEvent(o,r),!0}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,c&&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 J6e(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 Q6e(e,t){(t.frameNumber!==e._updatedModelMatrixFrame||!u(e._previousModelMatrix))&&(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!M.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=M.clone(e.modelMatrix,e._previousModelMatrix)))}function $6e(e,t,n,i){if(t.mode===te.MORPHING||!e.ready)return!1;let o=e._statistics;o.clear();let r=i.isRender;++e._updatedVisibilityFrame,J6e(e),Q6e(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;let s=i.traversal.selectTiles(e,t);if(i.requestTiles&&U6e(e),q6e(e,t,i),Xp.clone(o,n),r){let a=e._credits;if(u(a)&&o.selected!==0){let c=a.length;for(let l=0;l<c;++l){let f=a[l];f.showOnScreen=e._showCreditsOnScreen,t.creditDisplay.addCredit(f)}}}return s}Gs.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};Gs.prototype.updateForPass=function(e,t){let n=t.pass;if(n===qo.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===qo.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===qo.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=qo.getPassOptions(n),a=s.ignoreCommands,c=y(t.commandList,i),l=c.length;e.commandList=c,e.camera=y(t.camera,o),e.cullingVolume=y(t.cullingVolume,r);let f=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=$6e(this,e,f,s)),a&&(c.length=l),e.commandList=i,e.camera=o,e.cullingVolume=r};Gs.prototype.hasExtension=function(e){return u(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};Gs.prototype.isDestroyed=function(){return!1};Gs.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),u(this._schemaLoader)&&Ui.unload(this._schemaLoader),u(this._root)){let e=eae;for(e.push(this._root);e.length>0;){let t=e.pop();t.destroy();let n=t.children,i=n.length;for(let o=0;o<i;++o)e.push(n[o])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,le(this)};Gs.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};Gs.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!Gs.supportedExtensions[e[t]])throw new ue(`Unsupported 3D Tiles Extension: ${e[t]}`)};var Rc=Gs;var e9e=new M;function Zg(e,t){t.collectionChanged.addEventListener(Zg.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new xt,this._onCollectionChanged(t,t.values,[],[])}Zg.prototype.update=function(e){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,c,l=n[s.id],f=s.isShowing&&s.isAvailable(e)&&Y.getValueOrDefault(a._show,e,!0),d;if(f&&(d=s.computeModelMatrix(e,e9e),c=Oe.createIfNeeded(Y.getValueOrUndefined(a._uri,e))),!f){u(l)&&(l.tilesetPrimitive.show=!1);continue}let p=u(l)?l.tilesetPrimitive:void 0;(!u(p)||c.url!==l.url)&&(u(p)&&(i.removeAndDestroy(p),delete n[s.id]),p=new Rc({url:c}),p.id=s,i.add(p),l={tilesetPrimitive:p,url:c.url,loadFail:!1},n[s.id]=l,t9e(p,s,n)),p.show=!0,u(d)&&(p.modelMatrix=d),p.maximumScreenSpaceError=Y.getValueOrDefault(a.maximumScreenSpaceError,e,p.maximumScreenSpaceError)}return!0};Zg.prototype.isDestroyed=function(){return!1};Zg.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Zg.prototype._onCollectionChanged,this);let e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)c9(this,e[i],t,n);return le(this)};Zg.prototype.getBoundingSphere=function(e,t){let n=this._tilesetHash[e.id];if(!u(n)||n.loadFail)return at.FAILED;let i=n.tilesetPrimitive;return!u(i)||!i.show?at.FAILED:i.ready?(se.clone(i.boundingSphere,t),at.DONE):at.PENDING};Zg.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._entitiesToVisualize,a=this._tilesetHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],u(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],u(r._tileset)?s.set(r.id,r):(c9(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],c9(this,r,a,c),s.remove(r.id)};function c9(e,t,n,i){let o=n[t.id];u(o)&&(i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}function t9e(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}var zR=Zg;var n9e=z.WHITE,i9e=z.BLACK,o9e=new H(2,2);function gE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(gE.prototype,{isConstant:{get:function(){return Y.isConstant(this._evenColor)&&Y.isConstant(this._oddColor)&&Y.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},evenColor:ae("evenColor"),oddColor:ae("oddColor"),repeat:ae("repeat")});gE.prototype.getType=function(e){return"Checkerboard"};gE.prototype.getValue=function(e,t){return u(t)||(t={}),t.lightColor=Y.getValueOrClonedDefault(this._evenColor,e,n9e,t.lightColor),t.darkColor=Y.getValueOrClonedDefault(this._oddColor,e,i9e,t.darkColor),t.repeat=Y.getValueOrDefault(this._repeat,e,o9e),t};gE.prototype.equals=function(e){return this===e||e instanceof gE&&Y.equals(this._evenColor,e._evenColor)&&Y.equals(this._oddColor,e._oddColor)&&Y.equals(this._repeat,e._repeat)};var yE=gE;var nae={id:void 0};function HR(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 Za(e){this._owner=e,this._entities=new xt,this._addedEntities=new xt,this._removedEntities=new xt,this._changedEntities=new xt,this._suspendCount=0,this._collectionChanged=new Ae,this._id=zn(),this._show=!0,this._firing=!1,this._refire=!1}Za.prototype.suspendEvents=function(){this._suspendCount++};Za.prototype.resumeEvents=function(){this._suspendCount--,HR(this)};Object.defineProperties(Za.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(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}}});Za.prototype.computeAvailability=function(){let e=ze.MAXIMUM_VALUE,t=ze.MINIMUM_VALUE,n=this._entities.values;for(let i=0,o=n.length;i<o;i++){let s=n[i].availability;if(u(s)){let a=s.start,c=s.stop;$.lessThan(a,e)&&!a.equals(ze.MINIMUM_VALUE)&&(e=a),$.greaterThan(c,t)&&!c.equals(ze.MAXIMUM_VALUE)&&(t=c)}}return ze.MAXIMUM_VALUE.equals(e)&&(e=ze.MINIMUM_VALUE),ze.MINIMUM_VALUE.equals(t)&&(t=ze.MAXIMUM_VALUE),new An({start:e,stop:t})};Za.prototype.add=function(e){e instanceof jo||(e=new jo(e));let t=e.id,n=this._entities;if(n.contains(t))throw new ue(`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(Za.prototype._onEntityDefinitionChanged,this),HR(this),e};Za.prototype.remove=function(e){return u(e)?this.removeById(e.id):!1};Za.prototype.contains=function(e){return this._entities.get(e.id)===e};Za.prototype.removeById=function(e){if(!u(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(Za.prototype._onEntityDefinitionChanged,this),HR(this),!0):!1};Za.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,c=i.get(a);u(c)||(s.definitionChanged.removeEventListener(Za.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),HR(this)};Za.prototype.getById=function(e){return this._entities.get(e)};Za.prototype.getOrCreateEntity=function(e){let t=this._entities.get(e);return u(t)||(nae.id=e,t=new jo(nae),this.add(t)),t};Za.prototype._onEntityDefinitionChanged=function(e){let t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),HR(this)};var Ss=Za;var bU={id:void 0},AE=new Array(2);function l9(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 iae(e,t,n,i){AE[0]=n,AE[1]=i.id,t[JSON.stringify(AE)]=i.definitionChanged.addEventListener(vr.prototype._onDefinitionChanged,e)}function oae(e,t,n,i){AE[0]=n,AE[1]=i.id;let o=JSON.stringify(AE);t[o](),t[o]=void 0}function Jg(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,c,l,f=e._composite,d=new Ss(e),p=e._eventHash,g;for(r=0;r<o;r++)for(l=i[r],l.collectionChanged.removeEventListener(vr.prototype._onCollectionChanged,e),a=l.values,g=l.id,c=a.length-1;c>-1;c--)s=a[c],oae(e,p,g,s);for(r=n-1;r>=0;r--)for(l=t[r],l.collectionChanged.addEventListener(vr.prototype._onCollectionChanged,e),a=l.values,g=l.id,c=a.length-1;c>-1;c--){s=a[c],iae(e,p,g,s);let A=d.getById(s.id);u(A)||(A=f.getById(s.id),u(A)?l9(A):(bU.id=s.id,A=new jo(bU)),d.add(A)),A.merge(s)}e._collectionsCopy=t.slice(0),f.suspendEvents(),f.removeAll();let m=d.values;for(r=0;r<m.length;r++)f.add(m[r]);f.resumeEvents()}function vr(e,t){this._owner=t,this._composite=new Ss(this),this._suspendCount=0,this._collections=u(e)?e.slice():[],this._collectionsCopy=[],this._id=zn(),this._eventHash={},Jg(this),this._shouldRecomposite=!1}Object.defineProperties(vr.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}}});vr.prototype.addCollection=function(e,t){u(t)?this._collections.splice(t,0,e):(t=this._collections.length,this._collections.push(e)),Jg(this)};vr.prototype.removeCollection=function(e){let t=this._collections.indexOf(e);return t!==-1?(this._collections.splice(t,1),Jg(this),!0):!1};vr.prototype.removeAllCollections=function(){this._collections.length=0,Jg(this)};vr.prototype.containsCollection=function(e){return this._collections.indexOf(e)!==-1};vr.prototype.contains=function(e){return this._composite.contains(e)};vr.prototype.indexOfCollection=function(e){return this._collections.indexOf(e)};vr.prototype.getCollection=function(e){return this._collections[e]};vr.prototype.getCollectionsLength=function(){return this._collections.length};function SU(e,t){return e.indexOf(t)}function rae(e,t,n){let i=e._collections;if(t=P.clamp(t,0,i.length-1),n=P.clamp(n,0,i.length-1),t===n)return;let o=i[t];i[t]=i[n],i[n]=o,Jg(e)}vr.prototype.raiseCollection=function(e){let t=SU(this._collections,e);rae(this,t,t+1)};vr.prototype.lowerCollection=function(e){let t=SU(this._collections,e);rae(this,t,t-1)};vr.prototype.raiseCollectionToTop=function(e){let t=SU(this._collections,e);t!==this._collections.length-1&&(this._collections.splice(t,1),this._collections.push(e),Jg(this))};vr.prototype.lowerCollectionToBottom=function(e){let t=SU(this._collections,e);t!==0&&(this._collections.splice(t,1),this._collections.splice(0,0,e),Jg(this))};vr.prototype.suspendEvents=function(){this._suspendCount++,this._composite.suspendEvents()};vr.prototype.resumeEvents=function(){this._suspendCount--,this._shouldRecomposite&&this._suspendCount===0&&(Jg(this),this._shouldRecomposite=!1),this._composite.resumeEvents()};vr.prototype.computeAvailability=function(){return this._composite.computeAvailability()};vr.prototype.getById=function(e){return this._composite.getById(e)};vr.prototype._onCollectionChanged=function(e,t,n){let i=this._collectionsCopy,o=i.length,r=this._composite;r.suspendEvents();let s,a,c,l,f=n.length,d=this._eventHash,p=e.id;for(s=0;s<f;s++){let m=n[s];oae(this,d,p,m);let A=m.id;for(a=o-1;a>=0;a--)c=i[a].getById(A),u(c)&&(u(l)||(l=r.getById(A),l9(l)),l.merge(c));u(l)||r.removeById(A),l=void 0}let g=t.length;for(s=0;s<g;s++){let m=t[s];iae(this,d,p,m);let A=m.id;for(a=o-1;a>=0;a--)c=i[a].getById(A),u(c)&&(u(l)||(l=r.getById(A),u(l)?l9(l):(bU.id=A,l=new jo(bU),r.add(l))),l.merge(c));l=void 0}r.resumeEvents()};vr.prototype._onDefinitionChanged=function(e,t,n,i){let o=this._collections,r=this._composite,s=o.length,a=e.id,c=r.getById(a),l=c[t],f=!u(l),d=!0;for(let p=s-1;p>=0;p--){let g=o[p].getById(e.id);if(u(g)){let m=g[t];if(u(m)){if(d)if(d=!1,u(m.merge)&&u(m.clone))l=m.clone(l);else{l=m;break}l.merge(m)}}}f&&c.propertyNames.indexOf(t)===-1&&c.addProperty(t),c[t]=l};var u9=vr;function f9(){this._removalFunctions=[]}f9.prototype.add=function(e,t,n){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)}};f9.prototype.removeAll=function(){let e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};var wr=f9;function m9(e,t){return $.compare(e.start,t.start)}function Ir(e){if(this._intervals=[],this._changedEvent=new Ae,u(e)){let t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(Ir.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}}});Ir.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof Ir))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(!An.equals(n[r],i[r],t))return!1;return!0};Ir.prototype.get=function(e){return this._intervals[e]};Ir.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};Ir.prototype.findIntervalContainingDate=function(e){let t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};Ir.prototype.findDataForIntervalContainingDate=function(e){let t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};Ir.prototype.contains=function(e){return this.indexOf(e)>=0};var d9=new An;Ir.prototype.indexOf=function(e){let t=this._intervals;d9.start=e,d9.stop=e;let n=wo(t,d9,m9);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&&An.contains(t[n-1],e)?n-1:~n)};Ir.prototype.findInterval=function(e){e=y(e,y.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 c=r[s];if((!u(t)||c.start.equals(t))&&(!u(n)||c.stop.equals(n))&&(!u(i)||c.isStartIncluded===i)&&(!u(o)||c.isStopIncluded===o))return r[s]}};Ir.prototype.addInterval=function(e,t){if(e.isEmpty)return;let n=this._intervals;if(n.length===0||$.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=wo(n,e,m9);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=$.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((u(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?($.greaterThan(e.stop,n[i-1].stop)?e=new An({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new An({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=$.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new An({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 An({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=$.compare(e.stop,n[i].start),o>0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(u(t)?t(n[i].data,e.data):n[i].data===e.data)e=new An({start:e.start,stop:$.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:$.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new An({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)};Ir.prototype.removeInterval=function(e){if(e.isEmpty)return!1;let t=this._intervals,n=wo(t,e,m9);n<0&&(n=~n);let i=!1;for(n>0&&($.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,($.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 An({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 An({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 An({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&$.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 An({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new An({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&($.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new An({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};Ir.prototype.intersect=function(e,t,n){let i=new Ir,o=0,r=0,s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){let c=s[o],l=a[r];if($.lessThan(c.stop,l.start))++o;else if($.lessThan(l.stop,c.start))++r;else{if(u(n)||u(t)&&t(c.data,l.data)||!u(t)&&l.data===c.data){let f=An.intersect(c,l,new An,n);f.isEmpty||i.addInterval(f,t)}$.lessThan(c.stop,l.stop)||c.stop.equals(l.stop)&&!c.isStopIncluded&&l.isStopIncluded?++o:++r}}return i};Ir.fromJulianDateArray=function(e,t){u(t)||(t=new Ir);let n=e.julianDates,i=n.length,o=e.dataCallback,r=y(e.isStartIncluded,!0),s=y(e.isStopIncluded,!0),a=y(e.leadingInterval,!1),c=y(e.trailingInterval,!1),l,f=0;a&&(++f,l=new An({start:ze.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),l.data=u(o)?o(l,t.length):t.length,t.addInterval(l));for(let d=0;d<i-1;++d){let p=n[d],g=n[d+1];l=new An({start:p,stop:g,isStartIncluded:t.length===f?r:!0,isStopIncluded:d===i-2?s:!1}),l.data=u(o)?o(l,t.length):t.length,t.addInterval(l),p=g}return c&&(l=new An({start:n[i-1],stop:ze.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),l.data=u(o)?o(l,t.length):t.length,t.addInterval(l)),t};var Ja=new Lm,GR=[0,31,28,31,30,31,30,31,31,30,31,30,31];function h9(e,t,n){u(n)||(n=new $),$.toGregorianDate(e,Ja);let i=Ja.millisecond+t.millisecond,o=Ja.second+t.second,r=Ja.minute+t.minute,s=Ja.hour+t.hour,a=Ja.day+t.day,c=Ja.month+t.month,l=Ja.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),GR[2]=Nm(l)?29:28;a>GR[c]||c>=13;)a>GR[c]&&(a-=GR[c],++c),c>=13&&(--c,l+=Math.floor(c/12),c=c%12,++c),GR[2]=Nm(l)?29:28;return Ja.millisecond=i,Ja.second=o,Ja.minute=r,Ja.hour=s,Ja.day=a,Ja.month=c,Ja.year=l,$.fromGregorianDate(Ja,n)}var r9e=new $,s9e=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function sae(e,t){if(!u(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(s9e);if(!u(n))return!1;if(u(n[1])&&(t.year=Number(n[1].replace(",","."))),u(n[2])&&(t.month=Number(n[2].replace(",","."))),u(n[3])&&(t.day=Number(n[3].replace(",","."))*7),u(n[4])&&(t.day+=Number(n[4].replace(",","."))),u(n[5])&&(t.hour=Number(n[5].replace(",","."))),u(n[6])&&(t.minute=Number(n[6].replace(",","."))),u(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"),$.toGregorianDate($.fromIso8601(e,r9e),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}var WR=new Lm;Ir.fromIso8601=function(e,t){let n=e.iso8601.split("/"),i=$.fromIso8601(n[0]),o=$.fromIso8601(n[1]),r=[];if(!sae(n[2],WR))r.push(i,o);else{let s=$.clone(i);for(r.push(s);$.compare(s,o)<0;)s=h9(s,WR),$.compare(o,s)<=0&&$.clone(o,s),r.push(s)}return Ir.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ir.fromIso8601DateArray=function(e,t){return Ir.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return $.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ir.fromIso8601DurationArray=function(e,t){let n=e.epoch,i=e.iso8601Durations,o=y(e.relativeToPrevious,!1),r=[],s,a,c=i.length;for(let l=0;l<c;++l)(sae(i[l],WR)||l===0)&&(o&&u(a)?s=h9(a,WR):s=h9(n,WR),r.push(s),a=s);return Ir.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};var Pr=Ir;function a9e(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 c=i.get(a);u(c.data)&&r.indexOf(c.data)===-1&&t.add(c.data.definitionChanged,o)}}function ex(){this._eventHelper=new wr,this._definitionChanged=new Ae,this._intervals=new Pr,this._intervals.changedEvent.addEventListener(ex.prototype._intervalsChanged,this)}Object.defineProperties(ex.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});ex.prototype.getValue=function(e,t){let n=this._intervals.findDataForIntervalContainingDate(e);if(u(n))return n.getValue(e,t)};ex.prototype.equals=function(e){return this===e||e instanceof ex&&this._intervals.equals(e._intervals,Y.equals)};ex.prototype._intervalsChanged=function(){a9e(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};var Qa=ex;function Qg(){this._definitionChanged=new Ae,this._composite=new Qa,this._composite.definitionChanged.addEventListener(Qg.prototype._raiseDefinitionChanged,this)}Object.defineProperties(Qg.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite._intervals}}});Qg.prototype.getType=function(e){let t=this._composite._intervals.findDataForIntervalContainingDate(e);if(u(t))return t.getType(e)};Qg.prototype.getValue=function(e,t){let n=this._composite._intervals.findDataForIntervalContainingDate(e);if(u(n))return n.getValue(e,t)};Qg.prototype.equals=function(e){return this===e||e instanceof Qg&&this._composite.equals(e._composite,Y.equals)};Qg.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var xE=Qg;function $g(e){this._referenceFrame=y(e,to.FIXED),this._definitionChanged=new Ae,this._composite=new Qa,this._composite.definitionChanged.addEventListener($g.prototype._raiseDefinitionChanged,this)}Object.defineProperties($g.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}}});$g.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};$g.prototype.getValueInReferenceFrame=function(e,t,n){let i=this._composite._intervals.findDataForIntervalContainingDate(e);if(u(i))return i.getValueInReferenceFrame(e,t,n)};$g.prototype.equals=function(e){return this===e||e instanceof $g&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Y.equals)};$g.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var Ws=$g;var c9e={ROUNDED:0,MITERED:1,BEVELED:2},vi=Object.freeze(c9e);var js=[new h,new h],l9e=new h,u9e=new h,f9e=new h,d9e=new h,h9e=new h,m9e=new h,p9e=new h,_9e=new h,g9e=new h,CE=new h,DU=new h,jR={},p9=new he;function y9e(e,t){let n=new Array(e.length);for(let i=0;i<e.length;i++){let o=e[i];p9=t.cartesianToCartographic(o,p9),n[i]=p9.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function _9(e,t,n,i){let o=e[0],r=e[1],s=h.angleBetween(o,r),a=Math.ceil(s/i),c=new Array(a),l;if(t===n){for(l=0;l<a;l++)c[l]=t;return c.push(n),c}let d=(n-t)/a;for(l=1;l<a;l++){let p=t+l*d;c[l]=p}return c[0]=t,c.push(n),c}var vU=new h,wU=new h;function A9e(e,t,n,i){let o=new ca(n,i),r=o.projectPointOntoPlane(h.add(n,e,vU),vU),s=o.projectPointOntoPlane(h.add(n,t,wU),wU),a=H.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}var x9e=new h(-1,0,0),tx=new M,C9e=new M,g9=new Z,T9e=Z.IDENTITY.clone(),E9e=new h,b9e=new oe,aae=new h;function Kp(e,t,n,i,o,r,s,a){let c=E9e,l=b9e;tx=Ot.eastNorthUpToFixedFrame(e,o,tx),c=M.multiplyByPointAsVector(tx,x9e,c),c=h.normalize(c,c);let f=A9e(c,t,e,o);g9=Z.fromRotationZ(f,g9),aae.z=r,tx=M.multiplyTransformation(tx,M.fromRotationTranslation(g9,aae,C9e),tx);let d=T9e;d[0]=s;for(let p=0;p<a;p++)for(let g=0;g<n.length;g+=3)l=h.fromArray(n,g,l),l=Z.multiplyByVector(d,l,l),l=M.multiplyByPoint(tx,l,l),i.push(l.x,l.y,l.z);return i}var S9e=new h;function y9(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){let c=h.fromArray(e,a,S9e);i=Kp(c,t,n,i,o,r[a/3],s,1)}return i}function D9e(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 c=1;c<n;c++){a=e[c];let l=a.x-r,f=a.y-s;i[o++]=l,i[o++]=0,i[o++]=f,i[o++]=l,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 cae(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 lae=new Le,uae=new h,fae=new Z;function dae(e,t,n,i,o,r,s,a,c,l){let f=h.angleBetween(h.subtract(t,e,CE),h.subtract(n,e,DU)),d=i===vi.BEVELED?0:Math.ceil(f/P.toRadians(5)),p;o?p=Z.fromQuaternion(Le.fromAxisAngle(h.negate(e,CE),f/(d+1),lae),fae):p=Z.fromQuaternion(Le.fromAxisAngle(e,f/(d+1),lae),fae);let g,m;if(t=h.clone(t,uae),d>0){let A=l?2:1;for(let x=0;x<d;x++)t=Z.multiplyByVector(p,t,t),g=h.subtract(t,e,CE),g=h.normalize(g,g),o||(g=h.negate(g,g)),m=r.scaleToGeodeticSurface(t,DU),s=Kp(m,g,a,s,r,c,1,A)}else g=h.subtract(t,e,CE),g=h.normalize(g,g),o||(g=h.negate(g,g)),m=r.scaleToGeodeticSurface(t,DU),s=Kp(m,g,a,s,r,c,1,1),n=h.clone(n,uae),g=h.subtract(n,e,CE),g=h.normalize(g,g),o||(g=h.negate(g,g)),m=r.scaleToGeodeticSurface(n,DU),s=Kp(m,g,a,s,r,c,1,1);return s}jR.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};jR.angleIsGreaterThanPi=function(e,t,n,i){let o=new ca(n,i),r=o.projectPointOntoPlane(h.add(n,e,vU),vU),s=o.projectPointOntoPlane(h.add(n,t,wU),wU);return s.x*r.y-s.y*r.x>=0};var v9e=new h,w9e=new h;jR.computePositions=function(e,t,n,i,o){let r=i._ellipsoid,s=y9e(e,r),a=i._granularity,c=i._cornerType,l=o?D9e(t,n):cae(t,n),f=o?cae(t,n):void 0,d=n.height/2,p=n.width/2,g=e.length,m=[],A=o?[]:void 0,x=l9e,C=u9e,T=f9e,E=d9e,S=h9e,D=m9e,w=p9e,R=_9e,O=g9e,L=e[0],N=e[1];E=r.geodeticSurfaceNormal(L,E),x=h.subtract(N,L,x),x=h.normalize(x,x),R=h.cross(E,x,R),R=h.normalize(R,R);let _=s[0],b=s[1];o&&(A=Kp(L,R,f,A,r,_+d,1,1)),O=h.clone(L,O),L=N,C=h.negate(x,C);let v,I;for(let k=1;k<g-1;k++){let U=o?2:1;if(N=e[k+1],L.equals(N)){wt("Positions are too close and are considered equivalent with rounding error.");continue}x=h.subtract(N,L,x),x=h.normalize(x,x),T=h.add(x,C,T),T=h.normalize(T,T),E=r.geodeticSurfaceNormal(L,E);let G=h.multiplyByScalar(E,h.dot(x,E),v9e);h.subtract(x,G,G),h.normalize(G,G);let V=h.multiplyByScalar(E,h.dot(C,E),w9e);if(h.subtract(C,V,V),h.normalize(V,V),!P.equalsEpsilon(Math.abs(h.dot(G,V)),1,P.EPSILON7)){T=h.cross(T,E,T),T=h.cross(E,T,T),T=h.normalize(T,T);let j=1/Math.max(.25,h.magnitude(h.cross(T,C,CE))),Q=jR.angleIsGreaterThanPi(x,C,L,r);Q?(S=h.add(L,h.multiplyByScalar(T,j*p,T),S),D=h.add(S,h.multiplyByScalar(R,p,D),D),js[0]=h.clone(O,js[0]),js[1]=h.clone(D,js[1]),v=_9(js,_+d,b+d,a),I=Di.generateArc({positions:js,granularity:a,ellipsoid:r}),m=y9(I,R,l,m,r,v,1),R=h.cross(E,x,R),R=h.normalize(R,R),w=h.add(S,h.multiplyByScalar(R,p,w),w),c===vi.ROUNDED||c===vi.BEVELED?dae(S,D,w,c,Q,r,m,l,b+d,o):(T=h.negate(T,T),m=Kp(L,T,l,m,r,b+d,j,U)),O=h.clone(w,O)):(S=h.add(L,h.multiplyByScalar(T,j*p,T),S),D=h.add(S,h.multiplyByScalar(R,-p,D),D),js[0]=h.clone(O,js[0]),js[1]=h.clone(D,js[1]),v=_9(js,_+d,b+d,a),I=Di.generateArc({positions:js,granularity:a,ellipsoid:r}),m=y9(I,R,l,m,r,v,1),R=h.cross(E,x,R),R=h.normalize(R,R),w=h.add(S,h.multiplyByScalar(R,-p,w),w),c===vi.ROUNDED||c===vi.BEVELED?dae(S,D,w,c,Q,r,m,l,b+d,o):m=Kp(L,T,l,m,r,b+d,j,U),O=h.clone(w,O)),C=h.negate(x,C)}else m=Kp(O,R,l,m,r,_+d,1,1),O=L;_=b,b=s[k+1],L=N}js[0]=h.clone(O,js[0]),js[1]=h.clone(L,js[1]),v=_9(js,_+d,b+d,a),I=Di.generateArc({positions:js,granularity:a,ellipsoid:r}),m=y9(I,R,l,m,r,v,1),o&&(A=Kp(L,R,f,A,r,b+d,1,1)),g=m.length;let B=o?g+A.length:g,F=new Float64Array(B);return F.set(m),o&&F.set(A,g),F};var Ed=jR;var x9={},TE=new h,gae=new h,I9e=new h,hae=new h,Bc=[new h,new h],yae=new h,Aae=new h,xae=new h,P9e=new h,O9e=new h,R9e=new h,B9e=new h,M9e=new h,L9e=new h,N9e=new h,mae=new Le,pae=new Z;function IU(e,t,n,i,o){let r=h.angleBetween(h.subtract(t,e,TE),h.subtract(n,e,gae)),s=i===vi.BEVELED?1:Math.ceil(r/P.toRadians(5))+1,a=s*3,c=new Array(a);c[a-3]=n.x,c[a-2]=n.y,c[a-1]=n.z;let l;o?l=Z.fromQuaternion(Le.fromAxisAngle(h.negate(e,TE),r/s,mae),pae):l=Z.fromQuaternion(Le.fromAxisAngle(e,r/s,mae),pae);let f=0;t=h.clone(t,TE);for(let d=0;d<s;d++)t=Z.multiplyByVector(l,t,t),c[f++]=t.x,c[f++]=t.y,c[f++]=t.z;return c}function F9e(e){let t=yae,n=Aae,i=xae,o=e[1];n=h.fromArray(e[1],o.length-3,n),i=h.fromArray(e[0],0,i),t=h.midpoint(n,i,t);let r=IU(t,n,i,vi.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=h.fromArray(a,a.length-3,n),i=h.fromArray(o,0,i),t=h.midpoint(n,i,t);let c=IU(t,n,i,vi.ROUNDED,!1);return[r,c]}function _ae(e,t,n,i){let o=TE;return i?o=h.add(e,t,o):(t=h.negate(t,t),o=h.add(e,t,o)),[o.x,o.y,o.z,n.x,n.y,n.z]}function A9(e,t,n,i){let o=new Array(e.length),r=new Array(e.length),s=h.multiplyByScalar(t,n,TE),a=h.negate(s,gae),c=0,l=e.length-1;for(let f=0;f<e.length;f+=3){let d=h.fromArray(e,f,I9e),p=h.add(d,a,hae);o[c++]=p.x,o[c++]=p.y,o[c++]=p.z;let g=h.add(d,s,hae);r[l--]=g.z,r[l--]=g.y,r[l--]=g.x}return i.push(o,r),i}x9.addAttribute=function(e,t,n,i){let o=t.x,r=t.y,s=t.z;u(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),u(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};var V9e=new h,U9e=new h;x9.computePositions=function(e){let t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes,a=yae,c=Aae,l=xae,f=P9e,d=O9e,p=R9e,g=B9e,m=M9e,A=L9e,x=N9e,C=[],T=s?[]:void 0,E=s?[]:void 0,S=n[0],D=n[1];c=h.normalize(h.subtract(D,S,c),c),a=i.geodeticSurfaceNormal(S,a),f=h.normalize(h.cross(a,c,f),f),s&&(T.push(f.x,f.y,f.z),E.push(a.x,a.y,a.z)),g=h.clone(S,g),S=D,l=h.negate(c,l);let w,R=[],O,L=n.length;for(O=1;O<L-1;O++){a=i.geodeticSurfaceNormal(S,a),D=n[O+1],c=h.normalize(h.subtract(D,S,c),c),d=h.normalize(h.add(c,l,d),d);let _=h.multiplyByScalar(a,h.dot(c,a),V9e);h.subtract(c,_,_),h.normalize(_,_);let b=h.multiplyByScalar(a,h.dot(l,a),U9e);if(h.subtract(l,b,b),h.normalize(b,b),!P.equalsEpsilon(Math.abs(h.dot(_,b)),1,P.EPSILON7)){d=h.cross(d,a,d),d=h.cross(a,d,d),d=h.normalize(d,d);let I=o/Math.max(.25,h.magnitude(h.cross(d,l,TE))),B=Ed.angleIsGreaterThanPi(c,l,S,i);d=h.multiplyByScalar(d,I,d),B?(m=h.add(S,d,m),x=h.add(m,h.multiplyByScalar(f,o,x),x),A=h.add(m,h.multiplyByScalar(f,o*2,A),A),Bc[0]=h.clone(g,Bc[0]),Bc[1]=h.clone(x,Bc[1]),w=Di.generateArc({positions:Bc,granularity:t,ellipsoid:i}),C=A9(w,f,o,C),s&&(T.push(f.x,f.y,f.z),E.push(a.x,a.y,a.z)),p=h.clone(A,p),f=h.normalize(h.cross(a,c,f),f),A=h.add(m,h.multiplyByScalar(f,o*2,A),A),g=h.add(m,h.multiplyByScalar(f,o,g),g),r===vi.ROUNDED||r===vi.BEVELED?R.push({leftPositions:IU(m,p,A,r,B)}):R.push({leftPositions:_ae(S,h.negate(d,d),A,B)})):(A=h.add(S,d,A),x=h.add(A,h.negate(h.multiplyByScalar(f,o,x),x),x),m=h.add(A,h.negate(h.multiplyByScalar(f,o*2,m),m),m),Bc[0]=h.clone(g,Bc[0]),Bc[1]=h.clone(x,Bc[1]),w=Di.generateArc({positions:Bc,granularity:t,ellipsoid:i}),C=A9(w,f,o,C),s&&(T.push(f.x,f.y,f.z),E.push(a.x,a.y,a.z)),p=h.clone(m,p),f=h.normalize(h.cross(a,c,f),f),m=h.add(A,h.negate(h.multiplyByScalar(f,o*2,m),m),m),g=h.add(A,h.negate(h.multiplyByScalar(f,o,g),g),g),r===vi.ROUNDED||r===vi.BEVELED?R.push({rightPositions:IU(A,p,m,r,B)}):R.push({rightPositions:_ae(S,d,m,B)})),l=h.negate(c,l)}S=D}a=i.geodeticSurfaceNormal(S,a),Bc[0]=h.clone(g,Bc[0]),Bc[1]=h.clone(S,Bc[1]),w=Di.generateArc({positions:Bc,granularity:t,ellipsoid:i}),C=A9(w,f,o,C),s&&(T.push(f.x,f.y,f.z),E.push(a.x,a.y,a.z));let N;return r===vi.ROUNDED&&(N=F9e(C)),{positions:C,corners:R,lefts:T,normals:E,endPositions:N}};var Mi=x9;var Eae=new h,bae=new h,PU=new h,OU=new h,k9e=new h,Sae=new h,ey=new h,EE=new h;function Dae(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function bd(e,t,n,i,o,r){let s=e.normals,a=e.tangents,c=e.bitangents,l=h.normalize(h.cross(n,t,ey),ey);r.normal&&Mi.addAttribute(s,t,i,o),r.tangent&&Mi.addAttribute(a,l,i,o),r.bitangent&&Mi.addAttribute(c,n,i,o)}function vae(e,t,n){let i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,c=new dn,l,f=0,d=0,p,g=0,m;for(p=0;p<i.length;p+=2)m=i[p].length-3,f+=m,g+=m*2,d+=i[p+1].length-3;for(f+=3,d+=3,p=0;p<o.length;p++){l=o[p];let J=o[p].leftPositions;u(J)?(m=J.length,f+=m,g+=m):(m=o[p].rightPositions.length,d+=m,g+=m)}let A=u(r),x;A&&(x=r[0].length-3,f+=x,d+=x,x/=3,g+=x*6);let C=f+d,T=new Float64Array(C),E=t.normal?new Float32Array(C):void 0,S=t.tangent?new Float32Array(C):void 0,D=t.bitangent?new Float32Array(C):void 0,w={normals:E,tangents:S,bitangents:D},R=0,O=C-1,L,N,_,b,v=Eae,I=bae,B,F,k=x/2,U=Fe.createTypedArray(C/3,g),G=0;if(A){F=PU,B=OU;let J=r[0];for(v=h.fromArray(a,0,v),I=h.fromArray(s,0,I),p=0;p<k;p++)F=h.fromArray(J,(k-1-p)*3,F),B=h.fromArray(J,(k+p)*3,B),Mi.addAttribute(T,B,R),Mi.addAttribute(T,F,void 0,O),bd(w,v,I,R,O,t),N=R/3,b=N+1,L=(O-2)/3,_=L-1,U[G++]=L,U[G++]=N,U[G++]=_,U[G++]=_,U[G++]=N,U[G++]=b,R+=3,O-=3}let V=0,X=0,j=i[V++],Q=i[V++];T.set(j,R),T.set(Q,O-Q.length+1),I=h.fromArray(s,X,I);let W,K;for(m=Q.length-3,p=0;p<m;p+=3)W=n.geodeticSurfaceNormal(h.fromArray(j,p,ey),ey),K=n.geodeticSurfaceNormal(h.fromArray(Q,m-p,EE),EE),v=h.normalize(h.add(W,K,v),v),bd(w,v,I,R,O,t),N=R/3,b=N+1,L=(O-2)/3,_=L-1,U[G++]=L,U[G++]=N,U[G++]=_,U[G++]=_,U[G++]=N,U[G++]=b,R+=3,O-=3;for(W=n.geodeticSurfaceNormal(h.fromArray(j,m,ey),ey),K=n.geodeticSurfaceNormal(h.fromArray(Q,m,EE),EE),v=h.normalize(h.add(W,K,v),v),X+=3,p=0;p<o.length;p++){let J;l=o[p];let _e=l.leftPositions,xe=l.rightPositions,re,ye,fe=Sae,Se=PU,we=OU;if(v=h.fromArray(a,X,v),u(_e)){for(bd(w,v,I,void 0,O,t),O-=3,re=b,ye=_,J=0;J<_e.length/3;J++)fe=h.fromArray(_e,J*3,fe),U[G++]=re,U[G++]=ye-J-1,U[G++]=ye-J,Mi.addAttribute(T,fe,void 0,O),Se=h.fromArray(T,(ye-J-1)*3,Se),we=h.fromArray(T,re*3,we),I=h.normalize(h.subtract(Se,we,I),I),bd(w,v,I,void 0,O,t),O-=3;fe=h.fromArray(T,re*3,fe),Se=h.subtract(h.fromArray(T,ye*3,Se),fe,Se),we=h.subtract(h.fromArray(T,(ye-J)*3,we),fe,we),I=h.normalize(h.add(Se,we,I),I),bd(w,v,I,R,void 0,t),R+=3}else{for(bd(w,v,I,R,void 0,t),R+=3,re=_,ye=b,J=0;J<xe.length/3;J++)fe=h.fromArray(xe,J*3,fe),U[G++]=re,U[G++]=ye+J,U[G++]=ye+J+1,Mi.addAttribute(T,fe,R),Se=h.fromArray(T,re*3,Se),we=h.fromArray(T,(ye+J)*3,we),I=h.normalize(h.subtract(Se,we,I),I),bd(w,v,I,R,void 0,t),R+=3;fe=h.fromArray(T,re*3,fe),Se=h.subtract(h.fromArray(T,(ye+J)*3,Se),fe,Se),we=h.subtract(h.fromArray(T,ye*3,we),fe,we),I=h.normalize(h.negate(h.add(we,Se,I),I),I),bd(w,v,I,void 0,O,t),O-=3}for(j=i[V++],Q=i[V++],j.splice(0,3),Q.splice(Q.length-3,3),T.set(j,R),T.set(Q,O-Q.length+1),m=Q.length-3,X+=3,I=h.fromArray(s,X,I),J=0;J<Q.length;J+=3)W=n.geodeticSurfaceNormal(h.fromArray(j,J,ey),ey),K=n.geodeticSurfaceNormal(h.fromArray(Q,m-J,EE),EE),v=h.normalize(h.add(W,K,v),v),bd(w,v,I,R,O,t),b=R/3,N=b-1,_=(O-2)/3,L=_+1,U[G++]=L,U[G++]=N,U[G++]=_,U[G++]=_,U[G++]=N,U[G++]=b,R+=3,O-=3;R-=3,O+=3}if(v=h.fromArray(a,a.length-3,v),bd(w,v,I,R,O,t),A){R+=3,O-=3,F=PU,B=OU;let J=r[1];for(p=0;p<k;p++)F=h.fromArray(J,(x-p-1)*3,F),B=h.fromArray(J,p*3,B),Mi.addAttribute(T,F,void 0,O),Mi.addAttribute(T,B,R),bd(w,v,I,R,O,t),b=R/3,N=b-1,_=(O-2)/3,L=_+1,U[G++]=L,U[G++]=N,U[G++]=_,U[G++]=_,U[G++]=N,U[G++]=b,R+=3,O-=3}if(c.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:T}),t.st){let J=new Float32Array(C/3*2),_e,xe,re=0;if(A){f/=3,d/=3;let ye=Math.PI/(x+1);xe=1/(f-x+1),_e=1/(d-x+1);let fe,Se=x/2;for(p=Se+1;p<x+1;p++)fe=P.PI_OVER_TWO+ye*p,J[re++]=_e*(1+Math.cos(fe)),J[re++]=.5*(1+Math.sin(fe));for(p=1;p<d-x+1;p++)J[re++]=p*_e,J[re++]=0;for(p=x;p>Se;p--)fe=P.PI_OVER_TWO-p*ye,J[re++]=1-_e*(1+Math.cos(fe)),J[re++]=.5*(1+Math.sin(fe));for(p=Se;p>0;p--)fe=P.PI_OVER_TWO-ye*p,J[re++]=1-xe*(1+Math.cos(fe)),J[re++]=.5*(1+Math.sin(fe));for(p=f-x;p>0;p--)J[re++]=p*xe,J[re++]=1;for(p=1;p<Se+1;p++)fe=P.PI_OVER_TWO+ye*p,J[re++]=xe*(1+Math.cos(fe)),J[re++]=.5*(1+Math.sin(fe))}else{for(f/=3,d/=3,xe=1/(f-1),_e=1/(d-1),p=0;p<d;p++)J[re++]=p*_e,J[re++]=0;for(p=f;p>0;p--)J[re++]=(p-1)*xe,J[re++]=1}c.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:J})}return t.normal&&(c.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:w.normals})),t.tangent&&(c.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:w.tangents})),t.bitangent&&(c.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:w.bitangents})),{attributes:c,indices:U}}function z9e(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,c=s*2,l;if(t.normal||t.bitangent||t.tangent){let f=t.normal?new Float32Array(s*6):void 0,d=t.tangent?new Float32Array(s*6):void 0,p=t.bitangent?new Float32Array(s*6):void 0,g=Eae,m=bae,A=PU,x=OU,C=k9e,T=Sae,E=c;for(l=0;l<s;l+=3){let S=E+c;g=h.fromArray(n,l,g),m=h.fromArray(n,l+s,m),A=h.fromArray(n,(l+3)%s,A),m=h.subtract(m,g,m),A=h.subtract(A,g,A),x=h.normalize(h.cross(m,A,x),x),t.normal&&(Mi.addAttribute(f,x,S),Mi.addAttribute(f,x,S+3),Mi.addAttribute(f,x,E),Mi.addAttribute(f,x,E+3)),(t.tangent||t.bitangent)&&(T=h.fromArray(i,l,T),t.bitangent&&(Mi.addAttribute(p,T,S),Mi.addAttribute(p,T,S+3),Mi.addAttribute(p,T,E),Mi.addAttribute(p,T,E+3)),t.tangent&&(C=h.normalize(h.cross(T,x,C),C),Mi.addAttribute(d,C,S),Mi.addAttribute(d,C,S+3),Mi.addAttribute(d,C,E),Mi.addAttribute(d,C,E+3))),E+=6}if(t.normal){for(f.set(i),l=0;l<s;l+=3)f[l+s]=-i[l],f[l+s+1]=-i[l+1],f[l+s+2]=-i[l+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;d.set(S),d.set(S,s),e.tangent.values=d}}if(t.st){let f=e.st.values,d=new Float32Array(a*6);d.set(f),d.set(f,a);let p=a*2;for(let g=0;g<2;g++){for(d[p++]=f[0],d[p++]=f[1],l=2;l<a;l+=2){let m=f[l],A=f[l+1];d[p++]=m,d[p++]=A,d[p++]=m,d[p++]=A}d[p++]=f[0],d[p++]=f[1]}e.st.values=d}return e}function C9(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 H9e(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=Mi.computePositions(e),r=vae(o,n,i),s=e.height,a=e.extrudedHeight,c=r.attributes,l=r.indices,f=c.position.values,d=f.length,p=new Float64Array(d*6),g=new Float64Array(d);g.set(f);let m=new Float64Array(d*4);f=li.scaleToGeodeticHeight(f,s,i),m=C9(f,0,m),g=li.scaleToGeodeticHeight(g,a,i),m=C9(g,d*2,m),p.set(f),p.set(g,d),p.set(m,d*2),c.position.values=p,c=z9e(c,t);let A,x=d/3;if(e.shadowVolume){let L=c.normal.values;d=L.length;let N=new Float32Array(d*6);for(A=0;A<d;A++)L[A]=-L[A];N.set(L,d),N=C9(L,d*4,N),c.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:N}),t.normal||(c.normal=void 0)}if(u(e.offsetAttribute)){let L=new Uint8Array(x*6);if(e.offsetAttribute===nn.TOP)L=L.fill(1,0,x).fill(1,x*2,x*4);else{let N=e.offsetAttribute===nn.NONE?0:1;L=L.fill(N)}c.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:L})}let C=l.length,T=x+x,E=Fe.createTypedArray(p.length/3,C*2+T*3);E.set(l);let S=C;for(A=0;A<C;A+=3){let L=l[A],N=l[A+1],_=l[A+2];E[S++]=_+x,E[S++]=N+x,E[S++]=L+x}let D,w,R,O;for(A=0;A<T;A+=2)D=A+T,w=D+T,R=D+1,O=w+1,E[S++]=D,E[S++]=w,E[S++]=R,E[S++]=R,E[S++]=w,E[S++]=O;return{attributes:c,indices:E}}var Cae=new h,YR=new h,ff=new he;function Tae(e,t,n,i,o,r){let s=h.subtract(t,e,Cae);h.normalize(s,s);let a=n.geodeticSurfaceNormal(e,YR),c=h.cross(s,a,Cae);h.multiplyByScalar(c,i,c);let l=o.latitude,f=o.longitude,d=r.latitude,p=r.longitude;h.add(e,c,YR),n.cartesianToCartographic(YR,ff);let g=ff.latitude,m=ff.longitude;l=Math.min(l,g),f=Math.min(f,m),d=Math.max(d,g),p=Math.max(p,m),h.subtract(e,c,YR),n.cartesianToCartographic(YR,ff),g=ff.latitude,m=ff.longitude,l=Math.min(l,g),f=Math.min(f,m),d=Math.max(d,g),p=Math.max(p,m),o.latitude=l,o.longitude=f,r.latitude=d,r.longitude=p}var uf=new h,qR=new h,gl=new he,yl=new he;function wae(e,t,n,i,o){e=Dae(e,t);let r=go(e,h.equalsEpsilon),s=r.length;if(s<2||n<=0)return new ce;let a=n*.5;gl.latitude=Number.POSITIVE_INFINITY,gl.longitude=Number.POSITIVE_INFINITY,yl.latitude=Number.NEGATIVE_INFINITY,yl.longitude=Number.NEGATIVE_INFINITY;let c,l;if(i===vi.ROUNDED){let p=r[0];h.subtract(p,r[1],uf),h.normalize(uf,uf),h.multiplyByScalar(uf,a,uf),h.add(p,uf,qR),t.cartesianToCartographic(qR,ff),c=ff.latitude,l=ff.longitude,gl.latitude=Math.min(gl.latitude,c),gl.longitude=Math.min(gl.longitude,l),yl.latitude=Math.max(yl.latitude,c),yl.longitude=Math.max(yl.longitude,l)}for(let p=0;p<s-1;++p)Tae(r[p],r[p+1],t,a,gl,yl);let f=r[s-1];h.subtract(f,r[s-2],uf),h.normalize(uf,uf),h.multiplyByScalar(uf,a,uf),h.add(f,uf,qR),Tae(f,qR,t,a,gl,yl),i===vi.ROUNDED&&(t.cartesianToCartographic(qR,ff),c=ff.latitude,l=ff.longitude,gl.latitude=Math.min(gl.latitude,c),gl.longitude=Math.min(gl.longitude,l),yl.latitude=Math.max(yl.latitude,c),yl.longitude=Math.max(yl.longitude,l));let d=u(o)?o:new ce;return d.north=yl.latitude,d.south=gl.latitude,d.east=yl.longitude,d.west=gl.longitude,d}function Jp(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.width,i=y(e.height,0),o=y(e.extrudedHeight,i);this._positions=t,this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._vertexFormat=Ie.clone(y(e.vertexFormat,Ie.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=y(e.cornerType,vi.ROUNDED),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*h.packedLength+ie.packedLength+Ie.packedLength+7}Jp.pack=function(e,t,n){n=y(n,0);let i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=h.packedLength)h.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]=y(e._offsetAttribute,-1),t};var Iae=ie.clone(ie.UNIT_SPHERE),Pae=new Ie,Zp={positions:void 0,ellipsoid:Iae,vertexFormat:Pae,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};Jp.unpack=function(e,t,n){t=y(t,0);let i=e[t++],o=new Array(i);for(let m=0;m<i;++m,t+=h.packedLength)o[m]=h.unpack(e,t);let r=ie.unpack(e,t,Iae);t+=ie.packedLength;let s=Ie.unpack(e,t,Pae);t+=Ie.packedLength;let a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++],p=e[t++]===1,g=e[t];return u(n)?(n._positions=o,n._ellipsoid=ie.clone(r,n._ellipsoid),n._vertexFormat=Ie.clone(s,n._vertexFormat),n._width=a,n._height=c,n._extrudedHeight=l,n._cornerType=f,n._granularity=d,n._shadowVolume=p,n._offsetAttribute=g===-1?void 0:g,n):(Zp.positions=o,Zp.width=a,Zp.height=c,Zp.extrudedHeight=l,Zp.cornerType=f,Zp.granularity=d,Zp.shadowVolume=p,Zp.offsetAttribute=g===-1?void 0:g,new Jp(Zp))};Jp.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.positions,i=e.width,o=y(e.ellipsoid,ie.WGS84),r=y(e.cornerType,vi.ROUNDED);return wae(n,o,i,r,t)};Jp.createGeometry=function(e){let t=e._positions,n=e._width,i=e._ellipsoid;t=Dae(t,i);let o=go(t,h.equalsEpsilon);if(o.length<2||n<=0)return;let r=e._height,s=e._extrudedHeight,a=!P.equalsEpsilon(r,s,0,P.EPSILON2),c=e._vertexFormat,l={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0},f;if(a)l.height=r,l.extrudedHeight=s,l.shadowVolume=e._shadowVolume,l.offsetAttribute=e._offsetAttribute,f=H9e(l,c);else{let g=Mi.computePositions(l);if(f=vae(g,c,i),f.attributes.position.values=li.scaleToGeodeticHeight(f.attributes.position.values,r,i),u(e._offsetAttribute)){let m=e._offsetAttribute===nn.NONE?0:1,A=f.attributes.position.values.length,x=new Uint8Array(A/3).fill(m);f.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:x})}}let d=f.attributes,p=se.fromVertices(d.position.values,void 0,3);return c.position||(f.attributes.position.values=void 0),new ct({attributes:d,indices:f.indices,primitiveType:Me.TRIANGLES,boundingSphere:p,offsetAttribute:e._offsetAttribute})};Jp.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Jp({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(Jp.prototype,{rectangle:{get:function(){return u(this._rectangle)||(this._rectangle=wae(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});var nx=Jp;var Oae=new h,Rae=new h,G9e=new h;function W9e(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function Bae(e,t){let n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new dn,a,c=0,l=0,f,d=0,p;for(f=0;f<i.length;f+=2)p=i[f].length-3,c+=p,d+=p/3*4,l+=i[f+1].length-3;for(c+=3,l+=3,f=0;f<o.length;f++){a=o[f];let B=o[f].leftPositions;u(B)?(p=B.length,c+=p,d+=p/3*2):(p=o[f].rightPositions.length,l+=p,d+=p/3*2)}let g=u(r),m;g&&(m=r[0].length-3,c+=m,l+=m,m/=3,d+=m*4);let A=c+l,x=new Float64Array(A),C=0,T=A-1,E,S,D,w,R,O,L=m/2,N=Fe.createTypedArray(A/3,d+4),_=0;if(N[_++]=C/3,N[_++]=(T-2)/3,g){n.push(C/3),O=Oae,R=Rae;let B=r[0];for(f=0;f<L;f++)O=h.fromArray(B,(L-1-f)*3,O),R=h.fromArray(B,(L+f)*3,R),Mi.addAttribute(x,R,C),Mi.addAttribute(x,O,void 0,T),S=C/3,w=S+1,E=(T-2)/3,D=E-1,N[_++]=E,N[_++]=D,N[_++]=S,N[_++]=w,C+=3,T-=3}let b=0,v=i[b++],I=i[b++];for(x.set(v,C),x.set(I,T-I.length+1),p=I.length-3,n.push(C/3,(T-2)/3),f=0;f<p;f+=3)S=C/3,w=S+1,E=(T-2)/3,D=E-1,N[_++]=E,N[_++]=D,N[_++]=S,N[_++]=w,C+=3,T-=3;for(f=0;f<o.length;f++){let B;a=o[f];let F=a.leftPositions,k=a.rightPositions,U,G=G9e;if(u(F)){for(T-=3,U=D,n.push(w),B=0;B<F.length/3;B++)G=h.fromArray(F,B*3,G),N[_++]=U-B-1,N[_++]=U-B,Mi.addAttribute(x,G,void 0,T),T-=3;n.push(U-Math.floor(F.length/6)),t===vi.BEVELED&&n.push((T-2)/3+1),C+=3}else{for(C+=3,U=w,n.push(D),B=0;B<k.length/3;B++)G=h.fromArray(k,B*3,G),N[_++]=U+B,N[_++]=U+B+1,Mi.addAttribute(x,G,C),C+=3;n.push(U+Math.floor(k.length/6)),t===vi.BEVELED&&n.push(C/3-1),T-=3}for(v=i[b++],I=i[b++],v.splice(0,3),I.splice(I.length-3,3),x.set(v,C),x.set(I,T-I.length+1),p=I.length-3,B=0;B<I.length;B+=3)w=C/3,S=w-1,D=(T-2)/3,E=D+1,N[_++]=E,N[_++]=D,N[_++]=S,N[_++]=w,C+=3,T-=3;C-=3,T+=3,n.push(C/3,(T-2)/3)}if(g){C+=3,T-=3,O=Oae,R=Rae;let B=r[1];for(f=0;f<L;f++)O=h.fromArray(B,(m-f-1)*3,O),R=h.fromArray(B,f*3,R),Mi.addAttribute(x,O,void 0,T),Mi.addAttribute(x,R,C),w=C/3,S=w-1,D=(T-2)/3,E=D+1,N[_++]=E,N[_++]=D,N[_++]=S,N[_++]=w,C+=3,T-=3;n.push(C/3)}else n.push(C/3,(T-2)/3);return N[_++]=C/3,N[_++]=(T-2)/3,s.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:x}),{attributes:s,indices:N,wallIndices:n}}function j9e(e){let t=e.ellipsoid,n=Mi.computePositions(e),i=Bae(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,c=i.indices,l=a.position.values,f=l.length,d=new Float64Array(f);d.set(l);let p=new Float64Array(f*2);if(l=li.scaleToGeodeticHeight(l,r,t),d=li.scaleToGeodeticHeight(d,s,t),p.set(l),p.set(d,f),a.position.values=p,f/=3,u(e.offsetAttribute)){let E=new Uint8Array(f*2);if(e.offsetAttribute===nn.TOP)E=E.fill(1,0,f);else{let S=e.offsetAttribute===nn.NONE?0:1;E=E.fill(S)}a.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}let g,m=c.length,A=Fe.createTypedArray(p.length/3,(m+o.length)*2);A.set(c);let x=m;for(g=0;g<m;g+=2){let E=c[g],S=c[g+1];A[x++]=E+f,A[x++]=S+f}let C,T;for(g=0;g<o.length;g++)C=o[g],T=C+f,A[x++]=C,A[x++]=T;return{attributes:a,indices:A}}function XR(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.width,i=y(e.height,0),o=y(e.extrudedHeight,i);this._positions=t,this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=y(e.cornerType,vi.ROUNDED),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*h.packedLength+ie.packedLength+6}XR.pack=function(e,t,n){n=y(n,0);let i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=h.packedLength)h.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]=y(e._offsetAttribute,-1),t};var Mae=ie.clone(ie.UNIT_SPHERE),ty={positions:void 0,ellipsoid:Mae,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};XR.unpack=function(e,t,n){t=y(t,0);let i=e[t++],o=new Array(i);for(let p=0;p<i;++p,t+=h.packedLength)o[p]=h.unpack(e,t);let r=ie.unpack(e,t,Mae);t+=ie.packedLength;let s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t];return u(n)?(n._positions=o,n._ellipsoid=ie.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=c,n._cornerType=l,n._granularity=f,n._offsetAttribute=d===-1?void 0:d,n):(ty.positions=o,ty.width=s,ty.height=a,ty.extrudedHeight=c,ty.cornerType=l,ty.granularity=f,ty.offsetAttribute=d===-1?void 0:d,new XR(ty))};XR.createGeometry=function(e){let t=e._positions,n=e._width,i=e._ellipsoid;t=W9e(t,i);let o=go(t,h.equalsEpsilon);if(o.length<2||n<=0)return;let r=e._height,s=e._extrudedHeight,a=!P.equalsEpsilon(r,s,0,P.EPSILON2),c={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1},l;if(a)c.height=r,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,l=j9e(c);else{let p=Mi.computePositions(c);if(l=Bae(p,c.cornerType),l.attributes.position.values=li.scaleToGeodeticHeight(l.attributes.position.values,r,i),u(e._offsetAttribute)){let g=l.attributes.position.values.length,m=e._offsetAttribute===nn.NONE?0:1,A=new Uint8Array(g/3).fill(m);l.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}}let f=l.attributes,d=se.fromVertices(f.position.values,void 0,3);return new ct({attributes:f,indices:l.indices,primitiveType:Me.LINES,boundingSphere:d,offsetAttribute:e._offsetAttribute})};var KR=XR;var Y9e=new ei(0);function Mc(e){si.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}u(Object.create)&&(Mc.prototype=Object.create(si.prototype),Mc.prototype.constructor=Mc);Object.defineProperties(Mc.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Mc.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!u(t.height)&&!u(t.extrudedHeight)&&Ec.isSupported(this._scene)};Mc.prototype._getIsClosed=function(e){let t=e.height,n=e.extrudedHeight;return t===0||u(n)&&n!==t};Mc.prototype._computeCenter=de.throwInstantiationError;Mc.prototype._onEntityPropertyChanged=function(e,t,n,i){if(si.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;let o=this._entity[this._geometryPropertyName];if(!u(o))return;u(o.zIndex)&&(u(o.height)||u(o.extrudedHeight))&&wt(wt.geometryZIndex),this._zIndex=y(o.zIndex,Y9e),u(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);let r=o.heightReference,s=o.extrudedHeightReference;if(u(r)||u(s)){let a=new nd(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new eA(this._scene,a,r,s)}};Mc.prototype.destroy=function(){u(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),si.prototype.destroy.call(this)};Mc.getGeometryHeight=function(e,t){if(!u(e)){t!==We.NONE&&wt(wt.geometryHeightReference);return}return t!==We.CLAMP_TO_GROUND?e:0};Mc.getGeometryExtrudedHeight=function(e,t){if(!u(e)){t!==We.NONE&&wt(wt.geometryExtrudedHeightReference);return}return t!==We.CLAMP_TO_GROUND?e:Mc.CLAMP_TO_GROUND};Mc.CLAMP_TO_GROUND="clamp";Mc.computeGeometryOffsetAttribute=function(e,t,n,i){(!u(e)||!u(t))&&(t=We.NONE),(!u(n)||!u(i))&&(i=We.NONE);let o=0;if(t!==We.NONE&&o++,i===We.RELATIVE_TO_GROUND&&o++,o===2)return nn.ALL;if(o===1)return nn.TOP};var jn=Mc;var Lae=new z,Nae=h.ZERO,Fae=new h,Vae=new ce;function q9e(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 Sd(e,t){jn.call(this,{entity:e,scene:t,geometryOptions:new q9e(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}u(Object.create)&&(Sd.prototype=Object.create(jn.prototype),Sd.prototype.constructor=Sd);Sd.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Mt){let o;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Lae)),u(o)||(o=z.WHITE),i.color=Nt.fromColor(o)}return u(this._options.offsetAttribute)&&(i.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,Nae,Fae))),new At({id:t,geometry:new nx(this._options),attributes:i})};Sd.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Lae),o={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return u(this._options.offsetAttribute)&&(o.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,Nae,Fae))),new At({id:t,geometry:new KR(this._options),attributes:o})};Sd.prototype._computeCenter=function(e,t){let n=Y.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!u(n)||n.length===0))return h.clone(n[Math.floor(n.length/2)],t)};Sd.prototype._isHidden=function(e,t){return!u(t.positions)||!u(t.width)||si.prototype._isHidden.call(this,e,t)};Sd.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Y.isConstant(t.height)||!Y.isConstant(t.extrudedHeight)||!Y.isConstant(t.granularity)||!Y.isConstant(t.width)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.cornerType)||!Y.isConstant(t.zIndex)||this._onTerrain&&!Y.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Mt)};Sd.prototype._setStaticOptions=function(e,t){let n=Y.getValueOrUndefined(t.height,ze.MINIMUM_VALUE),i=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),o=Y.getValueOrUndefined(t.extrudedHeight,ze.MINIMUM_VALUE),r=Y.getValueOrDefault(t.extrudedHeightReference,ze.MINIMUM_VALUE,We.NONE);u(o)&&!u(n)&&(n=0);let s=this._options;s.vertexFormat=this._materialProperty instanceof Mt?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ze.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(ze.MINIMUM_VALUE),s.granularity=Y.getValueOrUndefined(t.granularity,ze.MINIMUM_VALUE),s.cornerType=Y.getValueOrUndefined(t.cornerType,ze.MINIMUM_VALUE),s.offsetAttribute=jn.computeGeometryOffsetAttribute(n,i,o,r),s.height=jn.getGeometryHeight(n,i),o=jn.getGeometryExtrudedHeight(o,r),o===jn.CLAMP_TO_GROUND&&(o=fi.getMinimumMaximumHeights(nx.computeRectangle(s,Vae)).minimumTerrainHeight),s.extrudedHeight=o};Sd.DynamicGeometryUpdater=bE;function bE(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(bE.prototype=Object.create(ri.prototype),bE.prototype.constructor=bE);bE.prototype._isHidden=function(e,t,n){let i=this._options;return!u(i.positions)||!u(i.width)||ri.prototype._isHidden.call(this,e,t,n)};bE.prototype._setOptions=function(e,t,n){let i=this._options,o=Y.getValueOrUndefined(t.height,n),r=Y.getValueOrDefault(t.heightReference,n,We.NONE),s=Y.getValueOrUndefined(t.extrudedHeight,n),a=Y.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);u(s)&&!u(o)&&(o=0),i.positions=Y.getValueOrUndefined(t.positions,n),i.width=Y.getValueOrUndefined(t.width,n),i.granularity=Y.getValueOrUndefined(t.granularity,n),i.cornerType=Y.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=jn.computeGeometryOffsetAttribute(o,r,s,a),i.height=jn.getGeometryHeight(o,r),s=jn.getGeometryExtrudedHeight(s,a),s===jn.CLAMP_TO_GROUND&&(s=fi.getMinimumMaximumHeights(nx.computeRectangle(i,Vae)).minimumTerrainHeight),i.extrudedHeight=s};var ZR=Sd;function RU(){de.throwInstantiationError()}Object.defineProperties(RU.prototype,{name:{get:de.throwInstantiationError},clock:{get:de.throwInstantiationError},entities:{get:de.throwInstantiationError},isLoading:{get:de.throwInstantiationError},changedEvent:{get:de.throwInstantiationError},errorEvent:{get:de.throwInstantiationError},loadingEvent:{get:de.throwInstantiationError},show:{get:de.throwInstantiationError},clustering:{get:de.throwInstantiationError}});RU.prototype.update=function(e){de.throwInstantiationError()};RU.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};var Or=RU;function Wh(e,t){this._ellipsoid=e,this._cameraPosition=new h,this._cameraPositionInScaledSpace=new h,this._distanceToLimbInScaledSpaceSquared=0,u(t)&&(this.cameraPosition=t)}Object.defineProperties(Wh.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=h.magnitudeSquared(n)-1;h.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});var Uae=new h;Wh.prototype.isPointVisible=function(e){let n=this._ellipsoid.transformPositionToScaledSpace(e,Uae);return E9(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};Wh.prototype.isScaledSpacePointVisible=function(e){return E9(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var X9e=new h;Wh.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){let n=this._ellipsoid,i,o;return u(t)&&t<0&&n.minimumRadius>-t?(o=X9e,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),E9(e,o,i)};Wh.prototype.computeHorizonCullingPoint=function(e,t,n){return Hae(this._ellipsoid,e,t,n)};var kae=ie.clone(ie.UNIT_SPHERE);Wh.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){let o=zae(this._ellipsoid,n,kae);return Hae(o,e,t,i)};Wh.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return Gae(this._ellipsoid,e,t,n,i,o)};Wh.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){let s=zae(this._ellipsoid,o,kae);return Gae(s,e,t,n,i,r)};var K9e=[];Wh.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){let i=ce.subsample(e,t,0,K9e),o=se.fromPoints(i);if(!(h.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};var Z9e=new h;function zae(e,t,n){if(u(t)&&t<0&&e.minimumRadius>-t){let i=h.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,Z9e);e=ie.fromCartesian3(i,n)}return e}function Hae(e,t,n,i){u(i)||(i=new h);let o=Yae(e,t),r=0;for(let s=0,a=n.length;s<a;++s){let c=n[s],l=Wae(e,c,o);if(l<0)return;r=Math.max(r,l)}return jae(o,r,i)}var BU=new h;function Gae(e,t,n,i,o,r){u(r)||(r=new h),i=y(i,3),o=y(o,h.ZERO);let s=Yae(e,t),a=0;for(let c=0,l=n.length;c<l;c+=i){BU.x=n[c]+o.x,BU.y=n[c+1]+o.y,BU.z=n[c+2]+o.z;let f=Wae(e,BU,s);if(f<0)return;a=Math.max(a,f)}return jae(s,a,r)}function E9(e,t,n){let i=t,o=n,r=h.subtract(e,i,Uae),s=-h.dot(r,i);return!(o<0?s>0:s>o&&s*s/h.magnitudeSquared(r)>o)}var J9e=new h,Q9e=new h;function Wae(e,t,n){let i=e.transformPositionToScaledSpace(t,J9e),o=h.magnitudeSquared(i),r=Math.sqrt(o),s=h.divideByScalar(i,r,Q9e);o=Math.max(1,o),r=Math.max(1,r);let a=h.dot(s,n),c=h.magnitude(h.cross(s,n,s)),l=1/r,f=Math.sqrt(o-1)*l;return 1/(a*l-c*f)}function jae(e,t,n){if(!(t<=0||t===1/0||t!==t))return h.multiplyByScalar(e,t,n)}var T9=new h;function Yae(e,t){return h.equals(t,h.ZERO)?t:(e.transformPositionToScaledSpace(t,T9),h.normalize(T9,T9))}var Qp=Wh;function Rr(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;u(n)&&(n=Pt.clone(n)),u(i)&&(i=Pt.clone(i)),u(o)&&(o=bt.clone(o)),this._show=y(e.show,!0),this._position=h.clone(y(e.position,h.ZERO)),this._actualPosition=h.clone(this._position),this._color=z.clone(y(e.color,z.WHITE)),this._outlineColor=z.clone(y(e.outlineColor,z.TRANSPARENT)),this._outlineWidth=y(e.outlineWidth,0),this._pixelSize=y(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=y(e.disableDepthTestDistance,0),this._id=e.id,this._collection=y(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}var qae=Rr.SHOW_INDEX=0,Zae=Rr.POSITION_INDEX=1,$9e=Rr.COLOR_INDEX=2,eWe=Rr.OUTLINE_COLOR_INDEX=3,tWe=Rr.OUTLINE_WIDTH_INDEX=4,nWe=Rr.PIXEL_SIZE_INDEX=5,iWe=Rr.SCALE_BY_DISTANCE_INDEX=6,oWe=Rr.TRANSLUCENCY_BY_DISTANCE_INDEX=7,rWe=Rr.DISTANCE_DISPLAY_CONDITION_INDEX=8,sWe=Rr.DISABLE_DEPTH_DISTANCE_INDEX=9;Rr.NUMBER_OF_PROPERTIES=10;function df(e,t){let n=e._pointPrimitiveCollection;u(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(Rr.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,df(this,qae))}},position:{get:function(){return this._position},set:function(e){let t=this._position;h.equals(t,e)||(h.clone(e,t),h.clone(e,this._actualPosition),df(this,Zae))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){let t=this._scaleByDistance;Pt.equals(t,e)||(this._scaleByDistance=Pt.clone(e,t),df(this,iWe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){let t=this._translucencyByDistance;Pt.equals(t,e)||(this._translucencyByDistance=Pt.clone(e,t),df(this,oWe))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){this._pixelSize!==e&&(this._pixelSize=e,df(this,nWe))}},color:{get:function(){return this._color},set:function(e){let t=this._color;z.equals(t,e)||(z.clone(e,t),df(this,$9e))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){let t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),df(this,eWe))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,df(this,tWe))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){bt.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=bt.clone(e,this._distanceDisplayCondition),df(this,rWe))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,df(this,sWe))}},id:{get:function(){return this._id},set:function(e){this._id=e,u(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,df(this,qae))}}});Rr.prototype.getPickId=function(e){return u(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){h.clone(e,this._actualPosition),df(this,Zae)};var Xae=new oe;Rr._computeActualPosition=function(e,t,n){return t.mode===te.SCENE3D?e:(M.multiplyByPoint(n,e,Xae),qi.computeActualWgs84Position(t,Xae))};var Kae=new oe;Rr._computeScreenSpacePosition=function(e,t,n,i){let o=M.multiplyByVector(e,oe.fromElements(t.x,t.y,t.z,1,Kae),Kae);return qi.wgs84ToWindowCoordinates(n,o,i)};Rr.prototype.computeScreenSpacePosition=function(e,t){let n=this._pointPrimitiveCollection;u(t)||(t=new H);let i=n.modelMatrix,o=Rr._computeScreenSpacePosition(i,this._actualPosition,e,t);if(u(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,c=i;return u(n)||(n=new Ye),n.x=r,n.y=s,n.width=a,n.height=c,n};Rr.prototype.equals=function(e){return this===e||u(e)&&this._id===e._id&&h.equals(this._position,e._position)&&z.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&z.equals(this._outlineColor,e._outlineColor)&&Pt.equals(this._scaleByDistance,e._scaleByDistance)&&Pt.equals(this._translucencyByDistance,e._translucencyByDistance)&&bt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Rr.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};var Ds=Rr;var ny=`in vec4 v_color;
in vec4 v_outlineColor;
in float v_innerPercent;
in float v_pixelDistance;
in vec4 v_pickColor;

void main()
{
    // The distance in UV space from this fragment to the center of the point, at most 0.5.
    float distanceToCenter = length(gl_PointCoord - vec2(0.5));
    // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.
    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;

// Fully transparent parts of the billboard are not pickable.
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
    if (color.a < 0.005)   // matches 0/255 and 1/255
    {
        discard;
    }
#else
// The billboard is rendered twice. The opaque pass discards translucent fragments
// and the translucent pass discards opaque fragments.
#ifdef OPAQUE
    if (color.a < 0.995)   // matches < 254/255
    {
        discard;
    }
#else
    if (color.a >= 0.995)  // matches 254/255 and 255/255
    {
        discard;
    }
#endif
#endif

    out_FragColor = czm_gammaCorrect(color);
    czm_writeLogDepth();
}
`;var JR=`uniform float u_maxTotalPointSize;

in vec4 positionHighAndSize;
in vec4 positionLowAndOutline;
in vec4 compressedAttribute0;                       // color, outlineColor, pick color
in vec4 compressedAttribute1;                       // show, translucency by distance, some free space
in vec4 scaleByDistance;                            // near, nearScale, far, farScale
in vec3 distanceDisplayConditionAndDisableDepth;    // near, far, disableDepthTestDistance

out vec4 v_color;
out vec4 v_outlineColor;
out float v_innerPercent;
out float v_pixelDistance;
out vec4 v_pickColor;

const float SHIFT_LEFT8 = 256.0;
const float SHIFT_RIGHT8 = 1.0 / 256.0;

void main()
{
    // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition

    // unpack attributes
    vec3 positionHigh = positionHighAndSize.xyz;
    vec3 positionLow = positionLowAndOutline.xyz;
    float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
    float totalSize = positionHighAndSize.w + outlineWidthBothSides;
    float outlinePercent = outlineWidthBothSides / totalSize;
    // Scale in response to browser-zoom.
    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;

    // compressedAttribute0.z => pickColor.rgb

    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);

    // compressedAttribute0.x => color.rgb

    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);

    // compressedAttribute0.y => outlineColor.rgb

    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);

    // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a

    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)
    {
        // 2D camera distance is a special case
        // treat all billboards as flattened to the z=0.0 plane
        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) {
        // Add padding for anti-aliasing on both sides.
        totalSize += 3.0;
    }

    // Clamp to max point size.
    totalSize = min(totalSize, u_maxTotalPointSize);
    // If size is too small, push vertex behind near plane for clipping.
    // Note that context.minimumAliasedPointSize "will be at most 1.0".
    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);
    // push vertex behind near plane for clipping
    if (translucency < 0.004)
    {
        positionEC.xyz = vec3(0.0);
    }
#endif

#ifdef DISTANCE_DISPLAY_CONDITION
    float nearSq = distanceDisplayConditionAndDisableDepth.x;
    float farSq = distanceDisplayConditionAndDisableDepth.y;
    if (lengthSq < nearSq || lengthSq > farSq) {
        // push vertex behind camera to force it to be clipped
        positionEC.xyz = vec3(0.0, 0.0, 1.0);
    }
#endif

    gl_Position = czm_projection * positionEC;
    czm_vertexLogDepth();

#ifdef DISABLE_DEPTH_DISTANCE
    float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
    if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
    {
        disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
    }

    if (disableDepthTestDistance != 0.0)
    {
        // Don't try to "multiply both sides" by w.  Greater/less-than comparisons won't work for negative values of w.
        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)))
        {
            // Position z on the near plane.
            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;
}
`;var aWe=Ds.SHOW_INDEX,D9=Ds.POSITION_INDEX,Jae=Ds.COLOR_INDEX,cWe=Ds.OUTLINE_COLOR_INDEX,lWe=Ds.OUTLINE_WIDTH_INDEX,uWe=Ds.PIXEL_SIZE_INDEX,Qae=Ds.SCALE_BY_DISTANCE_INDEX,$ae=Ds.TRANSLUCENCY_BY_DISTANCE_INDEX,ece=Ds.DISTANCE_DISPLAY_CONDITION_INDEX,fWe=Ds.DISABLE_DEPTH_DISTANCE_INDEX,v9=Ds.NUMBER_OF_PROPERTIES,$a={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function hf(e){e=y(e,y.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(v9),this._maxPixelSize=1,this._baseVolume=new se,this._baseVolumeWC=new se,this._baseVolume2D=new se,this._boundingVolume=new se,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=M.clone(M.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,To.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=te.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW,Ne.STATIC_DRAW];let t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(hf.prototype,{length:{get:function(){return w9(this),this._pointPrimitives.length}}});function tce(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 Ds(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};hf.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};hf.prototype.removeAll=function(){tce(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function w9(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}}hf.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};hf.prototype.contains=function(e){return u(e)&&e._pointPrimitiveCollection===this};hf.prototype.get=function(e){return w9(this),this._pointPrimitives[e]};hf.prototype.computeNewBuffersUsage=function(){let e=this._buffersUsage,t=!1,n=this._propertiesChanged;for(let i=0;i<v9;++i){let o=n[i]===0?Ne.STATIC_DRAW:Ne.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function dWe(e,t,n){return new Wm(e,[{index:$a.positionHighAndSize,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[D9]},{index:$a.positionLowAndShow,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[D9]},{index:$a.compressedAttribute0,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Jae]},{index:$a.compressedAttribute1,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[$ae]},{index:$a.scaleByDistance,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:n[Qae]},{index:$a.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:q.FLOAT,usage:n[ece]}],t)}var b9=new Hn;function nce(e,t,n,i){let o=i._index,r=i._getActualPosition();e._mode===te.SCENE3D&&(se.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),Hn.fromCartesian(r,b9);let s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);let c=n[$a.positionHighAndSize],l=b9.high;c(o,l.x,l.y,l.z,s);let f=n[$a.positionLowAndOutline],d=b9.low;f(o,d.x,d.y,d.z,a)}var MU=65536,QR=256;function ice(e,t,n,i){let o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor,c=z.floatToByte(r.red),l=z.floatToByte(r.green),f=z.floatToByte(r.blue),d=c*MU+l*QR+f;c=z.floatToByte(a.red),l=z.floatToByte(a.green),f=z.floatToByte(a.blue);let p=c*MU+l*QR+f;c=z.floatToByte(s.red),l=z.floatToByte(s.green),f=z.floatToByte(s.blue);let g=c*MU+l*QR+f,m=z.floatToByte(r.alpha)*MU+z.floatToByte(a.alpha)*QR+z.floatToByte(s.alpha),A=n[$a.compressedAttribute0];A(o,d,p,g,m)}function oce(e,t,n,i){let o=i._index,r=0,s=1,a=1,c=1,l=i.translucencyByDistance;u(l)&&(r=l.near,s=l.nearValue,a=l.far,c=l.farValue,(s!==1||c!==1)&&(e._shaderTranslucencyByDistance=!0));let f=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(f=!1),s=P.clamp(s,0,1),s=s===1?255:s*255|0;let d=(f?1:0)*QR+s;c=P.clamp(c,0,1),c=c===1?255:c*255|0;let p=c,g=n[$a.compressedAttribute1];g(o,d,p,r,a)}function rce(e,t,n,i){let o=i._index,r=n[$a.scaleByDistance],s=0,a=1,c=1,l=1,f=i.scaleByDistance;u(f)&&(s=f.near,a=f.nearValue,c=f.far,l=f.farValue,(a!==1||l!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,c,l)}function sce(e,t,n,i){let o=i._index,r=n[$a.distanceDisplayConditionAndDisableDepth],s=0,a=Number.MAX_VALUE,c=i.distanceDisplayCondition;u(c)&&(s=c.near,a=c.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let l=i.disableDepthTestDistance;l*=l,l>0&&(e._shaderDisableDepthDistance=!0,l===Number.POSITIVE_INFINITY&&(l=-1)),r(o,s,a,l)}function hWe(e,t,n,i){nce(e,t,n,i),ice(e,t,n,i),oce(e,t,n,i),rce(e,t,n,i),sce(e,t,n,i)}function S9(e,t,n,i,o,r){let s;i.mode===te.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;let a=[];for(let c=0;c<n;++c){let l=t[c],f=l.position,d=Ds._computeActualPosition(f,i,o);u(d)&&(l._setActualPosition(d),r?a.push(d):se.expand(s,d,s))}r&&se.fromPoints(a,s)}function mWe(e,t){let n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==te.SCENE3D&&!M.equals(r,e.modelMatrix)?(e._mode=n,M.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===te.SCENE3D||n===te.SCENE2D||n===te.COLUMBUS_VIEW)&&S9(e,i,i.length,t,r,!0)):n===te.MORPHING?S9(e,i,i.length,t,r,!0):(n===te.SCENE2D||n===te.COLUMBUS_VIEW)&&S9(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function pWe(e,t,n){let o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}var _We=[];hf.prototype.update=function(e){if(w9(this),!this.show)return;this._maxTotalPointSize=Ft.maximumAliasedPointSize,mWe(this,e);let n=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,o=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,s=this._createVertexArray,a,c=e.context,l=e.passes,f=l.pick;if(s||!f&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let D=0;D<v9;++D)r[D]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=dWe(c,n,this._buffersUsage),a=this._vaf.writers;for(let D=0;D<n;++D){let w=this._pointPrimitives[D];w._dirty=!1,hWe(this,c,a,w)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){let D=_We;D.length=0,(r[D9]||r[lWe]||r[uWe])&&D.push(nce),(r[Jae]||r[cWe])&&D.push(ice),(r[aWe]||r[$ae])&&D.push(oce),r[Qae]&&D.push(rce),(r[ece]||r[fWe])&&D.push(sce);let w=D.length;if(a=this._vaf.writers,o/n>.1){for(let R=0;R<o;++R){let O=i[R];O._dirty=!1;for(let L=0;L<w;++L)D[L](this,c,a,O)}this._vaf.commit()}else{for(let R=0;R<o;++R){let O=i[R];O._dirty=!1;for(let L=0;L<w;++L)D[L](this,c,a,O);this._vaf.subCommit(O._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(o>n*1.5&&(i.length=n),!u(this._vaf)||!u(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let d,p=M.IDENTITY;e.mode===te.SCENE3D?(p=this.modelMatrix,d=se.clone(this._baseVolumeWC,this._boundingVolume)):d=se.clone(this._baseVolume2D,this._boundingVolume),pWe(this,e,d);let g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===To.OPAQUE||this._blendOption===To.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:ee.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===To.TRANSLUCENT||this._blendOption===To.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:ee.LEQUAL},depthMask:!1,blending:un.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let m,A;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(m=new ke({sources:[JR]}),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===To.OPAQUE_AND_TRANSLUCENT&&(A=new ke({defines:["OPAQUE"],sources:[ny]}),this._sp=Xt.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:A,attributeLocations:$a}),A=new ke({defines:["TRANSLUCENT"],sources:[ny]}),this._spTranslucent=Xt.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:A,attributeLocations:$a})),this._blendOption===To.OPAQUE&&(A=new ke({sources:[ny]}),this._sp=Xt.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:A,attributeLocations:$a})),this._blendOption===To.TRANSLUCENT&&(A=new ke({sources:[ny]}),this._spTranslucent=Xt.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:A,attributeLocations:$a})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let x,C,T,E,S=e.commandList;if(l.render||f){let D=this._colorCommands,w=this._blendOption===To.OPAQUE,R=this._blendOption===To.OPAQUE_AND_TRANSLUCENT;x=this._vaf.va,C=x.length,D.length=C;let O=R?C*2:C;for(E=0;E<O;++E){let L=w||R&&E%2===0;T=D[E],u(T)||(T=D[E]=new tt),T.primitiveType=Me.POINTS,T.pass=L||!R?Ee.OPAQUE:Ee.TRANSLUCENT,T.owner=this;let N=R?Math.floor(E/2):E;T.boundingVolume=d,T.modelMatrix=p,T.shaderProgram=L?this._sp:this._spTranslucent,T.uniformMap=this._uniforms,T.vertexArray=x[N].va,T.renderState=L?this._rsOpaque:this._rsTranslucent,T.debugShowBoundingVolume=this.debugShowBoundingVolume,T.pickId="v_pickColor",S.push(T)}}};hf.prototype.isDestroyed=function(){return!1};hf.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(),tce(this._pointPrimitives),le(this)};var SE=hf;function eB(e,t,n,i,o,r){if(o-i<=n)return;let s=i+o>>1;ace(e,t,s,i,o,r%2),eB(e,t,n,i,s-1,r+1),eB(e,t,n,s+1,o,r+1)}function ace(e,t,n,i,o,r){for(;o>i;){if(o-i>600){let l=o-i+1,f=n-i+1,d=Math.log(l),p=.5*Math.exp(2*d/3),g=.5*Math.sqrt(d*p*(l-p)/l)*(f-l/2<0?-1:1),m=Math.max(i,Math.floor(n-f*p/l+g)),A=Math.min(o,Math.floor(n+(l-f)*p/l+g));ace(e,t,n,m,A,r)}let s=t[2*n+r],a=i,c=o;for($R(e,t,i,n),t[2*o+r]>s&&$R(e,t,i,o);a<c;){for($R(e,t,a,c),a++,c--;t[2*a+r]<s;)a++;for(;t[2*c+r]>s;)c--}t[2*i+r]===s?$R(e,t,i,c):(c++,$R(e,t,c,o)),c<=n&&(i=c+1),n<=c&&(o=c-1)}}function $R(e,t,n,i){I9(e,n,i),I9(t,2*n,2*i),I9(t,2*n+1,2*i+1)}function I9(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function P9(e,t,n,i,o,r,s){let a=[0,e.length-1,0],c=[],l,f;for(;a.length;){let d=a.pop(),p=a.pop(),g=a.pop();if(p-g<=s){for(let x=g;x<=p;x++)l=t[2*x],f=t[2*x+1],l>=n&&l<=o&&f>=i&&f<=r&&c.push(e[x]);continue}let m=Math.floor((g+p)/2);l=t[2*m],f=t[2*m+1],l>=n&&l<=o&&f>=i&&f<=r&&c.push(e[m]);let A=(d+1)%2;(d===0?n<=l:i<=f)&&(a.push(g),a.push(m-1),a.push(A)),(d===0?o>=l:r>=f)&&(a.push(m+1),a.push(p),a.push(A))}return c}function O9(e,t,n,i,o,r){let s=[0,e.length-1,0],a=[],c=o*o;for(;s.length;){let l=s.pop(),f=s.pop(),d=s.pop();if(f-d<=r){for(let x=d;x<=f;x++)cce(t[2*x],t[2*x+1],n,i)<=c&&a.push(e[x]);continue}let p=Math.floor((d+f)/2),g=t[2*p],m=t[2*p+1];cce(g,m,n,i)<=c&&a.push(e[p]);let A=(l+1)%2;(l===0?n-o<=g:i-o<=m)&&(s.push(d),s.push(p-1),s.push(A)),(l===0?n+o>=g:i+o>=m)&&(s.push(p+1),s.push(f),s.push(A))}return a}function cce(e,t,n,i){let o=e-n,r=t-i;return o*o+r*r}var gWe=e=>e[0],yWe=e=>e[1],tB=class{constructor(t,n=gWe,i=yWe,o=64,r=Float64Array){this.nodeSize=o,this.points=t;let s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),c=this.coords=new r(t.length*2);for(let l=0;l<t.length;l++)a[l]=l,c[2*l]=n(t[l]),c[2*l+1]=i(t[l]);eB(a,c,o,0,a.length-1,0)}range(t,n,i,o){return P9(this.ids,this.coords,t,n,i,o,this.nodeSize)}within(t,n,i){return O9(this.ids,this.coords,t,n,i,this.nodeSize)}};function Dd(e){e=y(e,y.EMPTY_OBJECT),this._enabled=y(e.enabled,!1),this._pixelRange=y(e.pixelRange,80),this._minimumClusterSize=y(e.minimumClusterSize,2),this._clusterBillboards=y(e.clusterBillboards,!0),this._clusterLabels=y(e.clusterLabels,!0),this._clusterPoints=y(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 Ae,this.show=y(e.show,!0)}function AWe(e){return e.coord.x}function xWe(e){return e.coord.y}function lce(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}var CWe=new Ye;function uce(e,t,n,i,o){if(u(e._labelCollection)&&i._clusterLabels?o=Ug.getScreenSpaceBoundingBox(e,t,o):u(e._billboardCollection)&&i._clusterBillboards?o=lo.getScreenSpaceBoundingBox(e,t,o):u(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=Ds.getScreenSpaceBoundingBox(e,t,o)),lce(o,n),i._clusterLabels&&!u(e._labelCollection)&&u(e.id)&&dce(i,e.id.id)&&u(e.id._label)){let r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Ug.getScreenSpaceBoundingBox(s,t,CWe);lce(a,n),o=Ye.union(o,a,o)}return o}function TWe(e,t){if(e.clusterShow=!0,!u(e._labelCollection)&&u(e.id)&&dce(t,e.id.id)&&u(e.id._label)){let n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function fce(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 dce(e,t){return u(e)&&u(e._collectionIndicesByEntity[t])&&u(e._collectionIndicesByEntity[t].labelIndex)}function R9(e,t,n,i,o){if(!u(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===te.SCENE3D&&!i.isPointVisible(a.position))continue;let c=o._clusterLabels&&u(a._labelCollection),l=o._clusterBillboards&&u(a.id._billboard),f=o._clusterPoints&&u(a.id._point);if(c&&(f||l))continue;let d=a.computeScreenSpacePosition(n);u(d)&&t.push({index:s,collection:e,clustered:!1,coord:d})}}var EWe=new Ye,bWe=new Ye,SWe=new Ye;function DWe(e){return function(t){if(u(t)&&t<.05||!e.enabled)return;let n=e._scene,i=e._labelCollection,o=e._billboardCollection,r=e._pointCollection;if(!u(i)&&!u(o)&&!u(r)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let s=e._clusterLabelCollection,a=e._clusterBillboardCollection,c=e._clusterPointCollection;u(s)?s.removeAll():s=e._clusterLabelCollection=new Fh({scene:n}),u(a)?a.removeAll():a=e._clusterBillboardCollection=new Jl({scene:n}),u(c)?c.removeAll():c=e._clusterPointCollection=new SE;let l=e._pixelRange,f=e._minimumClusterSize,d=e._previousClusters,p=[],g=e._previousHeight,m=n.camera.positionCartographic.height,A=n.mapProjection.ellipsoid,x=n.camera.positionWC,C=new Qp(A,x),T=[];e._clusterLabels&&R9(i,T,n,C,e),e._clusterBillboards&&R9(o,T,n,C,e),e._clusterPoints&&R9(r,T,n,C,e);let E,S,D,w,R,O,L,N,_,b,v,I,B=new tB(T,AWe,xWe,64,Int32Array);if(m<g)for(D=d.length,E=0;E<D;++E){let F=d[E];if(!C.isPointVisible(F.position))continue;let k=lo._computeScreenSpacePosition(M.IDENTITY,F.position,h.ZERO,H.ZERO,n);if(!u(k))continue;let U=1-m/g,G=F.width=F.width*U,V=F.height=F.height*U;G=Math.max(G,F.minimumWidth),V=Math.max(V,F.minimumHeight);let X=k.x-G*.5,j=k.y-V*.5,Q=k.x+G,W=k.y+V;for(R=B.range(X,j,Q,W),O=R.length,b=0,_=[],S=0;S<O;++S)L=R[S],N=T[L],N.clustered||(++b,v=N.collection,I=N.index,_.push(v.get(I).id));if(b>=f)for(fce(F.position,b,_,e),p.push(F),S=0;S<O;++S)T[R[S]].clustered=!0}for(D=T.length,E=0;E<D;++E){let F=T[E];if(F.clustered)continue;F.clustered=!0,v=F.collection,I=F.index;let k=v.get(I);w=uce(k,F.coord,l,e,EWe);let U=Ye.clone(w,bWe);R=B.range(w.x,w.y,w.x+w.width,w.y+w.height),O=R.length;let G=h.clone(k.position);for(b=1,_=[k.id],S=0;S<O;++S)if(L=R[S],N=T[L],!N.clustered){let V=N.collection.get(N.index),X=uce(V,N.coord,l,e,SWe);h.add(V.position,G,G),Ye.union(U,X,U),++b,_.push(V.id)}if(b>=f){let V=h.multiplyByScalar(G,1/b,G);for(fce(V,b,_,e),p.push({position:V,width:U.width,height:U.height,minimumWidth:w.width,minimumHeight:w.height}),S=0;S<O;++S)T[R[S]].clustered=!0}else TWe(k,e)}s.length===0&&(s.destroy(),e._clusterLabelCollection=void 0),a.length===0&&(a.destroy(),e._clusterBillboardCollection=void 0),c.length===0&&(c.destroy(),e._clusterPointCollection=void 0),e._previousClusters=p,e._previousHeight=m}}Dd.prototype._initialize=function(e){this._scene=e;let t=DWe(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(Dd.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}}});function M9(e,t,n,i){return function(o){let r=this[e];u(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s=this._collectionIndicesByEntity[o.id];if(u(s)||(s=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),u(r)&&u(s[i]))return r.get(s[i]);u(r)||(r=this[e]=new t({scene:this._scene}));let a,c,l=this[n];l.length>0?(a=l.pop(),c=r.get(a)):(c=r.add(),a=r.length-1),s[i]=a;let f=this;return Promise.resolve().then(function(){f._clusterDirty=!0}),c}}function L9(e,t){let n=e._collectionIndicesByEntity[t];!u(n.billboardIndex)&&!u(n.labelIndex)&&!u(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Dd.prototype.getLabel=M9("_labelCollection",Fh,"_unusedLabelIndices","labelIndex");Dd.prototype.removeLabel=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!u(this._labelCollection)||!u(t)||!u(t.labelIndex))return;let n=t.labelIndex;t.labelIndex=void 0,L9(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};Dd.prototype.getBillboard=M9("_billboardCollection",Jl,"_unusedBillboardIndices","billboardIndex");Dd.prototype.removeBillboard=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!u(this._billboardCollection)||!u(t)||!u(t.billboardIndex))return;let n=t.billboardIndex;t.billboardIndex=void 0,L9(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};Dd.prototype.getPoint=M9("_pointCollection",SE,"_unusedPointIndices","pointIndex");Dd.prototype.removePoint=function(e){let t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!u(this._pointCollection)||!u(t)||!u(t.pointIndex))return;let n=t.pointIndex;t.pointIndex=void 0,L9(this,e.id);let i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function B9(e){if(!u(e))return;let t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function vWe(e){e.enabled||(u(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),u(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),u(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,B9(e._labelCollection),B9(e._billboardCollection),B9(e._pointCollection))}Dd.prototype.update=function(e){if(!this.show)return;let t;u(this._labelCollection)&&this._labelCollection.length>0&&this._labelCollection.get(0)._glyphs.length===0&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),u(this._billboardCollection)&&this._billboardCollection.length>0&&!u(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,vWe(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),u(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),u(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),u(this._clusterPointCollection)&&this._clusterPointCollection.update(e),u(this._labelCollection)&&this._labelCollection.update(e),u(this._billboardCollection)&&this._billboardCollection.update(e),u(this._pointCollection)&&this._pointCollection.update(e)};Dd.prototype.destroy=function(){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(),u(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 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=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};var tu=Dd;function N9(e){this._name=e,this._clock=void 0,this._changed=new Ae,this._error=new Ae,this._isLoading=!1,this._loading=new Ae,this._entityCollection=new Ss(this),this._entityCluster=new tu}Object.defineProperties(N9.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){Or.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){this._entityCluster=e}}});N9.prototype.update=function(e){return!0};var nB=N9;var hce={};hce.computePositions=function(e,t,n,i,o){let r=e*.5,s=-r,a=i+i,c=o?2*a:a,l=new Float64Array(c*3),f,d=0,p=0,g=o?a*3:0,m=o?(a+i)*3:i*3;for(f=0;f<i;f++){let A=f/i*P.TWO_PI,x=Math.cos(A),C=Math.sin(A),T=x*n,E=C*n,S=x*t,D=C*t;l[p+g]=T,l[p+g+1]=E,l[p+g+2]=s,l[p+m]=S,l[p+m+1]=D,l[p+m+2]=r,p+=3,o&&(l[d++]=T,l[d++]=E,l[d++]=s,l[d++]=S,l[d++]=D,l[d++]=r)}return l};var ix=hce;var F9=new H,wWe=new h,IWe=new h,PWe=new h,OWe=new h;function $p(e){e=y(e,y.EMPTY_OBJECT);let t=e.length,n=e.topRadius,i=e.bottomRadius,o=y(e.vertexFormat,Ie.DEFAULT),r=y(e.slices,128);this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Ie.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}$p.packedLength=Ie.packedLength+5;$p.pack=function(e,t,n){return n=y(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]=y(e._offsetAttribute,-1),t};var mce=new Ie,DE={vertexFormat:mce,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};$p.unpack=function(e,t,n){t=y(t,0);let i=Ie.unpack(e,t,mce);t+=Ie.packedLength;let o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return u(n)?(n._vertexFormat=Ie.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=c===-1?void 0:c,n):(DE.length=o,DE.topRadius=r,DE.bottomRadius=s,DE.slices=a,DE.offsetAttribute=c===-1?void 0:c,new $p(DE))};$p.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,c=s+s,l=ix.computePositions(t,n,i,r,!0),f=o.st?new Float32Array(c*2):void 0,d=o.normal?new Float32Array(c*3):void 0,p=o.tangent?new Float32Array(c*3):void 0,g=o.bitangent?new Float32Array(c*3):void 0,m,A=o.normal||o.tangent||o.bitangent;if(A){let R=o.tangent||o.bitangent,O=0,L=0,N=0,_=Math.atan2(i-n,t),b=wWe;b.z=Math.sin(_);let v=Math.cos(_),I=PWe,B=IWe;for(m=0;m<r;m++){let F=m/r*P.TWO_PI,k=v*Math.cos(F),U=v*Math.sin(F);A&&(b.x=k,b.y=U,R&&(I=h.normalize(h.cross(h.UNIT_Z,b,I),I)),o.normal&&(d[O++]=b.x,d[O++]=b.y,d[O++]=b.z,d[O++]=b.x,d[O++]=b.y,d[O++]=b.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&&(B=h.normalize(h.cross(b,I,B),B),g[N++]=B.x,g[N++]=B.y,g[N++]=B.z,g[N++]=B.x,g[N++]=B.y,g[N++]=B.z))}for(m=0;m<r;m++)o.normal&&(d[O++]=0,d[O++]=0,d[O++]=-1),o.tangent&&(p[L++]=1,p[L++]=0,p[L++]=0),o.bitangent&&(g[N++]=0,g[N++]=-1,g[N++]=0);for(m=0;m<r;m++)o.normal&&(d[O++]=0,d[O++]=0,d[O++]=1),o.tangent&&(p[L++]=1,p[L++]=0,p[L++]=0),o.bitangent&&(g[N++]=0,g[N++]=1,g[N++]=0)}let x=12*r-12,C=Fe.createTypedArray(c,x),T=0,E=0;for(m=0;m<r-1;m++)C[T++]=E,C[T++]=E+2,C[T++]=E+3,C[T++]=E,C[T++]=E+3,C[T++]=E+1,E+=2;for(C[T++]=s-2,C[T++]=0,C[T++]=1,C[T++]=s-2,C[T++]=1,C[T++]=s-1,m=1;m<r-1;m++)C[T++]=s+m+1,C[T++]=s+m,C[T++]=s;for(m=1;m<r-1;m++)C[T++]=a,C[T++]=a+m,C[T++]=a+m+1;let S=0;if(o.st){let R=Math.max(n,i);for(m=0;m<c;m++){let O=h.fromArray(l,m*3,OWe);f[S++]=(O.x+R)/(2*R),f[S++]=(O.y+R)/(2*R)}}let D=new dn;o.position&&(D.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:l})),o.normal&&(D.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:d})),o.tangent&&(D.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:p})),o.bitangent&&(D.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(D.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:f})),F9.x=t*.5,F9.y=Math.max(i,n);let w=new se(h.ZERO,H.magnitude(F9));if(u(e._offsetAttribute)){t=l.length;let R=e._offsetAttribute===nn.NONE?0:1,O=new Uint8Array(t/3).fill(R);D.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:O})}return new ct({attributes:D,indices:C,primitiveType:Me.TRIANGLES,boundingSphere:w,offsetAttribute:e._offsetAttribute})};var V9;$p.getUnitCylinder=function(){return u(V9)||(V9=$p.createGeometry(new $p({topRadius:1,bottomRadius:1,length:1,vertexFormat:Ie.POSITION_ONLY}))),V9};var iB=$p;var U9=new H;function vE(e){e=y(e,y.EMPTY_OBJECT);let t=e.length,n=e.topRadius,i=e.bottomRadius,o=y(e.slices,128),r=Math.max(y(e.numberOfVerticalLines,16),0);this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}vE.packedLength=6;vE.pack=function(e,t,n){return n=y(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=y(e._offsetAttribute,-1),t};var ox={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};vE.unpack=function(e,t,n){t=y(t,0);let i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return u(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=c===-1?void 0:c,n):(ox.length=i,ox.topRadius=o,ox.bottomRadius=r,ox.slices=s,ox.numberOfVerticalLines=a,ox.offsetAttribute=c===-1?void 0:c,new vE(ox))};vE.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=ix.computePositions(t,n,i,o,!1),c=o*2,l;if(r>0){let A=Math.min(r,o);l=Math.round(o/A),c+=A}let f=Fe.createTypedArray(s,c*2),d=0,p;for(p=0;p<o-1;p++)f[d++]=p,f[d++]=p+1,f[d++]=p+o,f[d++]=p+1+o;if(f[d++]=o-1,f[d++]=0,f[d++]=o+o-1,f[d++]=o,r>0)for(p=0;p<o;p+=l)f[d++]=p,f[d++]=p+o;let g=new dn;g.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:a}),U9.x=t*.5,U9.y=Math.max(i,n);let m=new se(h.ZERO,H.magnitude(U9));if(u(e._offsetAttribute)){t=a.length;let A=e._offsetAttribute===nn.NONE?0:1,x=new Uint8Array(t/3).fill(A);g.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:x})}return new ct({attributes:g,indices:f,primitiveType:Me.LINES,boundingSphere:m,offsetAttribute:e._offsetAttribute})};var oB=vE;var pce=h.ZERO,_ce=new h,RWe=new h,gce=new z;function BWe(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 nu(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new BWe(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}u(Object.create)&&(nu.prototype=Object.create(si.prototype),nu.prototype.constructor=nu);Object.defineProperties(nu.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});nu.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Mt){let a;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,gce)),u(a)||(a=z.WHITE),s.color=Nt.fromColor(a)}return u(this._options.offsetAttribute)&&(s.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,pce,_ce))),new At({id:t,geometry:new iB(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:s})};nu.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,gce),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return u(this._options.offsetAttribute)&&(r.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,pce,_ce))),new At({id:t,geometry:new oB(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:r})};nu.prototype._computeCenter=function(e,t){return Y.getValueOrUndefined(this._entity.position,e,t)};nu.prototype._isHidden=function(e,t){return!u(e.position)||!u(t.length)||!u(t.topRadius)||!u(t.bottomRadius)||si.prototype._isHidden.call(this,e,t)};nu.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Y.isConstant(e.orientation)||!t.length.isConstant||!t.topRadius.isConstant||!t.bottomRadius.isConstant||!Y.isConstant(t.slices)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.numberOfVerticalLines)};nu.prototype._setStaticOptions=function(e,t){let n=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Mt?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(ze.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(ze.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(ze.MINIMUM_VALUE),i.slices=Y.getValueOrUndefined(t.slices,ze.MINIMUM_VALUE),i.numberOfVerticalLines=Y.getValueOrUndefined(t.numberOfVerticalLines,ze.MINIMUM_VALUE),i.offsetAttribute=n!==We.NONE?nn.ALL:void 0};nu.prototype._onEntityPropertyChanged=np;nu.DynamicGeometryUpdater=wE;function wE(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(wE.prototype=Object.create(ri.prototype),wE.prototype.constructor=wE);wE.prototype._isHidden=function(e,t,n){let i=this._options,o=Y.getValueOrUndefined(e.position,n,RWe);return!u(o)||!u(i.length)||!u(i.topRadius)||!u(i.bottomRadius)||ri.prototype._isHidden.call(this,e,t,n)};wE.prototype._setOptions=function(e,t,n){let i=Y.getValueOrDefault(t.heightReference,n,We.NONE),o=this._options;o.length=Y.getValueOrUndefined(t.length,n),o.topRadius=Y.getValueOrUndefined(t.topRadius,n),o.bottomRadius=Y.getValueOrUndefined(t.bottomRadius,n),o.slices=Y.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=Y.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==We.NONE?nn.ALL:void 0};var rB=nu;var MWe={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},Br=Object.freeze(MWe);var LWe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},uo=Object.freeze(LWe);var NWe={NONE:0,HOLD:1,EXTRAPOLATE:2},iu=Object.freeze(NWe);var yce=vo(Ll(),1);function FWe(e){let t=new yce.default(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),n}var e_=FWe;var VWe=P.factorial;function k9(e,t,n,i,o,r){let s=0,a,c,l;if(i>0){for(c=0;c<o;c++){for(a=!1,l=0;l<r.length&&!a;l++)c===r[l]&&(a=!0);a||(r.push(c),s+=k9(e,t,n,i-1,o,r),r.splice(r.length-1,1))}return s}for(s=1,c=0;c<o;c++){for(a=!1,l=0;l<r.length&&!a;l++)c===r[l]&&(a=!0);a||(s*=e-n[t[c]])}return s}var LU={type:"Hermite"};LU.getRequiredDataPoints=function(e,t){return t=y(t,0),Math.max(Math.floor((e+1)/(t+1)),2)};LU.interpolateOrderZero=function(e,t,n,i,o){u(o)||(o=new Array(i));let r,s,a,c,l,f,d=t.length,p=new Array(i);for(r=0;r<i;r++){o[r]=0;let x=new Array(d);for(p[r]=x,s=0;s<d;s++)x[s]=[]}let g=d,m=new Array(g);for(r=0;r<g;r++)m[r]=r;let A=d-1;for(c=0;c<i;c++){for(s=0;s<g;s++)f=m[s]*i+c,p[c][0].push(n[f]);for(r=1;r<g;r++){let x=!1;for(s=0;s<g-r;s++){let C=t[m[s]],T=t[m[s+r]],E;T-C<=0?(f=m[s]*i+i*r+c,E=n[f],p[c][r].push(E/VWe(r))):(E=p[c][r-1][s+1]-p[c][r-1][s],p[c][r].push(E/(T-C))),x=x||E!==0}x||(A=r-1)}}for(a=0,l=0;a<=l;a++)for(r=a;r<=A;r++){let x=k9(e,m,t,a,r,[]);for(c=0;c<i;c++){let C=p[c][r][0];o[c+a*i]+=C*x}}return o};var UWe=[];LU.interpolate=function(e,t,n,i,o,r,s){let a=i*(r+1);u(s)||(s=new Array(a));for(let C=0;C<a;C++)s[C]=0;let c=t.length,l=new Array(c*(o+1)),f;for(f=0;f<c;f++)for(let C=0;C<o+1;C++)l[f*(o+1)+C]=f;let d=l.length,p=UWe,g=kWe(p,l,t,n,i,o),m=[],A=d*(d+1)/2,x=Math.min(g,r);for(let C=0;C<=x;C++)for(f=C;f<=g;f++){m.length=0;let T=k9(e,l,t,C,f,m),E=Math.floor(f*(1-f)/2)+d*f;for(let S=0;S<i;S++){let D=Math.floor(S*A),w=p[D+E];s[S+C*i]+=w*T}}return s};function kWe(e,t,n,i,o,r){let s,a,c=-1,l=t.length,f=l*(l+1)/2;for(let d=0;d<o;d++){let p=Math.floor(d*f);for(s=0;s<l;s++)a=t[s]*o*(r+1)+d,e[p+s]=i[a];for(let g=1;g<l;g++){let m=0,A=Math.floor(g*(1-g)/2)+l*g,x=!1;for(s=0;s<l-g;s++){let C=n[t[s]],T=n[t[s+g]],E,S;if(T-C<=0)a=t[s]*o*(r+1)+o*g+d,E=i[a],S=E/P.factorial(g),e[p+A+m]=S,m++;else{let D=Math.floor((g-1)*(2-g)/2)+l*(g-1);E=e[p+D+s+1]-e[p+D+s],S=E/(T-C),e[p+A+m]=S,m++}x=x||E!==0}x&&(c=Math.max(c,g))}}return c}var sB=LU;var z9={type:"Lagrange"};z9.getRequiredDataPoints=function(e){return Math.max(e+1,2)};z9.interpolateOrderZero=function(e,t,n,i,o){u(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 c=1;for(s=0;s<a;s++)if(s!==r){let l=t[r]-t[s];c*=(e-t[s])/l}for(s=0;s<i;s++)o[s]+=c*n[r*i+s]}return o};var aB=z9;var H9={type:"Linear"};H9.getRequiredDataPoints=function(e){return 2};H9.interpolateOrderZero=function(e,t,n,i,o){u(o)||(o=new Array(i));let r,s,a,c=t[0],l=t[1];for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+l*s-c*a)/(l-c);return o};var rx=H9;function ec(e,t,n){this.clock=y(e,0),this.cone=y(t,0),this.magnitude=y(n,1)}ec.fromCartesian3=function(e,t){let n=e.x,i=e.y,o=e.z,r=n*n+i*i;return u(t)||(t=new ec),t.clock=Math.atan2(i,n),t.cone=Math.atan2(Math.sqrt(r),o),t.magnitude=Math.sqrt(r+o*o),t};ec.clone=function(e,t){if(u(e))return u(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=e.magnitude,t):new ec(e.clock,e.cone,e.magnitude)};ec.normalize=function(e,t){return u(t)?(t.clock=e.clock,t.cone=e.cone,t.magnitude=1,t):new ec(e.clock,e.cone,1)};ec.equals=function(e,t){return e===t||u(e)&&u(t)&&e.clock===t.clock&&e.cone===t.cone&&e.magnitude===t.magnitude};ec.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||u(e)&&u(t)&&Math.abs(e.clock-t.clock)<=n&&Math.abs(e.cone-t.cone)<=n&&Math.abs(e.magnitude-t.magnitude)<=n};ec.prototype.equals=function(e){return ec.equals(this,e)};ec.prototype.clone=function(e){return ec.clone(this,e)};ec.prototype.equalsEpsilon=function(e,t){return ec.equalsEpsilon(this,e,t)};ec.prototype.toString=function(){return`(${this.clock}, ${this.cone}, ${this.magnitude})`};var cB=ec;var hB=vo(Ll(),1);var G9;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?G9=function(){return performance.now()}:G9=function(){return Date.now()};var di=G9;function W9(e){e=y(e,y.EMPTY_OBJECT);let t=e.currentTime,n=e.startTime,i=e.stopTime;u(t)?t=$.clone(t):u(n)?t=$.clone(n):u(i)?t=$.addDays(i,-1,new $):t=$.now(),u(n)?n=$.clone(n):n=$.clone(t),u(i)?i=$.clone(i):i=$.addDays(n,1,new $),this.startTime=n,this.stopTime=i,this.clockRange=y(e.clockRange,Br.UNBOUNDED),this.canAnimate=y(e.canAnimate,!0),this.onTick=new Ae,this.onStop=new Ae,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=di(),this.currentTime=t,this.multiplier=y(e.multiplier,1),this.shouldAnimate=y(e.shouldAnimate,!1),this.clockStep=y(e.clockStep,uo.SYSTEM_CLOCK_MULTIPLIER)}Object.defineProperties(W9.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){$.equals(this._currentTime,e)||(this._clockStep===uo.SYSTEM_CLOCK&&(this._clockStep=uo.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===uo.SYSTEM_CLOCK&&(this._clockStep=uo.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===uo.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=$.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===uo.SYSTEM_CLOCK&&(this._clockStep=uo.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});W9.prototype.tick=function(){let e=di(),t=$.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){let n=this._clockStep;if(n===uo.SYSTEM_CLOCK)t=$.now(t);else{let i=this._multiplier;if(n===uo.TICK_DEPENDENT)t=$.addSeconds(t,i,t);else{let a=e-this._lastSystemTime;t=$.addSeconds(t,i*(a/1e3),t)}let o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===Br.CLAMPED)$.lessThan(t,r)?t=$.clone(r,t):$.greaterThan(t,s)&&(t=$.clone(s,t),this.onStop.raiseEvent(this));else if(o===Br.LOOP_STOP)for($.lessThan(t,r)&&(t=$.clone(r,t));$.greaterThan(t,s);)t=$.addSeconds(r,$.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};var vd=W9;function sx(){this._definitionChanged=new Ae,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(sx.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},startTime:al("startTime"),stopTime:al("stopTime"),currentTime:al("currentTime"),clockRange:al("clockRange"),clockStep:al("clockStep"),multiplier:al("multiplier")});sx.prototype.clone=function(e){return u(e)||(e=new sx),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};sx.prototype.equals=function(e){return this===e||u(e)&&$.equals(this.startTime,e.startTime)&&$.equals(this.stopTime,e.stopTime)&&$.equals(this.currentTime,e.currentTime)&&this.clockRange===e.clockRange&&this.clockStep===e.clockStep&&this.multiplier===e.multiplier};sx.prototype.merge=function(e){this.startTime=y(this.startTime,e.startTime),this.stopTime=y(this.stopTime,e.stopTime),this.currentTime=y(this.currentTime,e.currentTime),this.clockRange=y(this.clockRange,e.clockRange),this.clockStep=y(this.clockStep,e.clockStep),this.multiplier=y(this.multiplier,e.multiplier)};sx.prototype.getValue=function(e){return u(e)||(e=new vd),e.startTime=y(this.startTime,e.startTime),e.stopTime=y(this.stopTime,e.stopTime),e.currentTime=y(this.currentTime,e.currentTime),e.clockRange=y(this.clockRange,e.clockRange),e.multiplier=y(this.multiplier,e.multiplier),e.clockStep=y(this.clockStep,e.clockStep),e};var wd=sx;var zWe=z.WHITE,HWe=.1,GWe=new H(8,8),WWe=new H(0,0),jWe=new H(1,1);function IE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(IE.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)&&Y.isConstant(this._cellAlpha)&&Y.isConstant(this._lineCount)&&Y.isConstant(this._lineThickness)&&Y.isConstant(this._lineOffset)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color"),cellAlpha:ae("cellAlpha"),lineCount:ae("lineCount"),lineThickness:ae("lineThickness"),lineOffset:ae("lineOffset")});IE.prototype.getType=function(e){return"Grid"};IE.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,zWe,t.color),t.cellAlpha=Y.getValueOrDefault(this._cellAlpha,e,HWe),t.lineCount=Y.getValueOrClonedDefault(this._lineCount,e,GWe,t.lineCount),t.lineThickness=Y.getValueOrClonedDefault(this._lineThickness,e,jWe,t.lineThickness),t.lineOffset=Y.getValueOrClonedDefault(this._lineOffset,e,WWe,t.lineOffset),t};IE.prototype.equals=function(e){return this===e||e instanceof IE&&Y.equals(this._color,e._color)&&Y.equals(this._cellAlpha,e._cellAlpha)&&Y.equals(this._lineCount,e._lineCount)&&Y.equals(this._lineThickness,e._lineThickness)&&Y.equals(this._lineOffset,e._lineOffset)};var PE=IE;function OE(e){this._definitionChanged=new Ae,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(OE.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color")});OE.prototype.getType=function(e){return"PolylineArrow"};OE.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,z.WHITE,t.color),t};OE.prototype.equals=function(e){return this===e||e instanceof OE&&Y.equals(this._color,e._color)};var RE=OE;var YWe=z.WHITE,qWe=z.TRANSPARENT,XWe=16,KWe=255;function BE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(BE.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)&&Y.isConstant(this._gapColor)&&Y.isConstant(this._dashLength)&&Y.isConstant(this._dashPattern)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color"),gapColor:ae("gapColor"),dashLength:ae("dashLength"),dashPattern:ae("dashPattern")});BE.prototype.getType=function(e){return"PolylineDash"};BE.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,YWe,t.color),t.gapColor=Y.getValueOrClonedDefault(this._gapColor,e,qWe,t.gapColor),t.dashLength=Y.getValueOrDefault(this._dashLength,e,XWe,t.dashLength),t.dashPattern=Y.getValueOrDefault(this._dashPattern,e,KWe,t.dashPattern),t};BE.prototype.equals=function(e){return this===e||e instanceof BE&&Y.equals(this._color,e._color)&&Y.equals(this._gapColor,e._gapColor)&&Y.equals(this._dashLength,e._dashLength)&&Y.equals(this._dashPattern,e._dashPattern)};var ME=BE;var ZWe=z.WHITE,JWe=.25,QWe=1;function LE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(LE.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)&&Y.isConstant(this._glow)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color"),glowPower:ae("glowPower"),taperPower:ae("taperPower")});LE.prototype.getType=function(e){return"PolylineGlow"};LE.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,ZWe,t.color),t.glowPower=Y.getValueOrDefault(this._glowPower,e,JWe,t.glowPower),t.taperPower=Y.getValueOrDefault(this._taperPower,e,QWe,t.taperPower),t};LE.prototype.equals=function(e){return this===e||e instanceof LE&&Y.equals(this._color,e._color)&&Y.equals(this._glowPower,e._glowPower)&&Y.equals(this._taperPower,e._taperPower)};var NE=LE;var $We=z.WHITE,e7e=z.BLACK,t7e=1;function FE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(FE.prototype,{isConstant:{get:function(){return Y.isConstant(this._color)&&Y.isConstant(this._outlineColor)&&Y.isConstant(this._outlineWidth)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ae("color"),outlineColor:ae("outlineColor"),outlineWidth:ae("outlineWidth")});FE.prototype.getType=function(e){return"PolylineOutline"};FE.prototype.getValue=function(e,t){return u(t)||(t={}),t.color=Y.getValueOrClonedDefault(this._color,e,$We,t.color),t.outlineColor=Y.getValueOrClonedDefault(this._outlineColor,e,e7e,t.outlineColor),t.outlineWidth=Y.getValueOrDefault(this._outlineWidth,e,t7e),t};FE.prototype.equals=function(e){return this===e||e instanceof FE&&Y.equals(this._color,e._color)&&Y.equals(this._outlineColor,e._outlineColor)&&Y.equals(this._outlineWidth,e._outlineWidth)};var iy=FE;function t_(e,t){this._value=void 0,this._definitionChanged=new Ae,this._eventHelper=new wr,this._referenceFrame=y(t,to.FIXED),this.setValue(e)}Object.defineProperties(t_.prototype,{isConstant:{get:function(){let e=this._value;if(!u(e))return!0;let t=e.length;for(let n=0;n<t;n++)if(!Y.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});t_.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};t_.prototype.getValueInReferenceFrame=function(e,t,n){let i=this._value;if(!u(i))return;let o=i.length;u(n)||(n=new Array(o));let r=0,s=0;for(;r<o;){let c=i[r].getValueInReferenceFrame(e,t,n[r]);u(c)&&(n[s]=c,s++),r++}return n.length=s,n};t_.prototype.setValue=function(e){let t=this._eventHelper;if(t.removeAll(),u(e)){this._value=e.slice();let n=e.length;for(let i=0;i<n;i++){let o=e[i];u(o)&&t.add(o.definitionChanged,t_.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)};t_.prototype.equals=function(e){return this===e||e instanceof t_&&this._referenceFrame===e._referenceFrame&&Y.arrayEquals(this._value,e._value)};t_.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var n_=t_;function oy(e){this._value=void 0,this._definitionChanged=new Ae,this._eventHelper=new wr,this.setValue(e)}Object.defineProperties(oy.prototype,{isConstant:{get:function(){let e=this._value;if(!u(e))return!0;let t=e.length;for(let n=0;n<t;n++)if(!Y.isConstant(e[n]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});oy.prototype.getValue=function(e,t){let n=this._value;if(!u(n))return;let i=n.length;u(t)||(t=new Array(i));let o=0,r=0;for(;o<i;){let a=this._value[o].getValue(e,t[o]);u(a)&&(t[r]=a,r++),o++}return t.length=r,t};oy.prototype.setValue=function(e){let t=this._eventHelper;if(t.removeAll(),u(e)){this._value=e.slice();let n=e.length;for(let i=0;i<n;i++){let o=e[i];u(o)&&t.add(o.definitionChanged,oy.prototype._raiseDefinitionChanged,this)}}else this._value=void 0;this._definitionChanged.raiseEvent(this)};oy.prototype.equals=function(e){return this===e||e instanceof oy&&Y.arrayEquals(this._value,e._value)};oy.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var VE=oy;function ax(e){let t=e._targetProperty;if(!u(t)){let n=e._targetEntity;if(!u(n)){if(n=e._targetCollection.getById(e._targetId),!u(n)){e._targetEntity=e._targetProperty=void 0;return}n.definitionChanged.addEventListener(ou.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}let i=e._targetPropertyNames;t=e._targetEntity;for(let o=0,r=i.length;o<r&&u(t);++o)t=t[i[o]];e._targetProperty=t}return t}function ou(e,t,n){this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Ae,e.collectionChanged.addEventListener(ou.prototype._onCollectionChanged,this)}Object.defineProperties(ou.prototype,{isConstant:{get:function(){return Y.isConstant(ax(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){let e=ax(this);return u(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 ax(this)}}});ou.fromString=function(e,t){let n,i=[],o=!0,r=!1,s="";for(let a=0;a<t.length;++a){let c=t.charAt(a);r?(s+=c,r=!1):c==="\\"?r=!0:o&&c==="#"?(n=s,o=!1,s=""):!o&&c==="."?(i.push(s),s=""):s+=c}return i.push(s),new ou(e,n,i)};ou.prototype.getValue=function(e,t){let n=ax(this);return u(n)?n.getValue(e,t):void 0};ou.prototype.getValueInReferenceFrame=function(e,t,n){let i=ax(this);return u(i)?i.getValueInReferenceFrame(e,t,n):void 0};ou.prototype.getType=function(e){let t=ax(this);return u(t)?t.getType(e):void 0};ou.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};ou.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){u(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};ou.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;u(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(ou.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):u(i)||(i=ax(this),u(i)&&this._definitionChanged.raiseEvent(this))};var i_=ou;var n7e={packedLength:1,pack:function(e,t,n){return n=y(n,0),t[n]=e,t},unpack:function(e,t,n){return t=y(t,0),e[t]},convertPackedArrayForInterpolation:function(e,t,n,i){u(i)||(i=[]),t=y(t,0),n=y(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-P.TWO_PI,o=a}},unpackInterpolationResult:function(e,t,n,i,o){return o=e[0],o<0?o+P.TWO_PI:o}},mf=n7e;var Ace={packedLength:1,pack:function(e,t,n){n=y(n,0),t[n]=e},unpack:function(e,t,n){return t=y(t,0),e[t]}};function xce(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 Cce(e,t){return e instanceof $?e:typeof e=="string"?$.fromIso8601(e):$.addSeconds(t,e,new $)}var j9=[],Y9=[];function NU(e,t,n,i,o){let r=0,s,a,c,l,f,d;for(;r<i.length;){f=Cce(i[r],e),c=wo(t,f,$.compare);let p=0,g=0;if(c<0){for(c=~c,l=c*o,a=void 0,d=t[c];r<i.length&&(f=Cce(i[r],e),!(u(a)&&$.compare(a,f)>=0||u(d)&&$.compare(f,d)>=0));){for(j9[p++]=f,r=r+1,s=0;s<o;s++)Y9[g++]=i[r],r=r+1;a=f}p>0&&(Y9.length=g,xce(n,l,Y9),j9.length=p,xce(t,c,j9))}else{for(s=0;s<o;s++)r++,n[c*o+s]=i[r];r++}}}function Id(e,t){let n=e;n===Number&&(n=Ace);let i=n.packedLength,o=y(n.packedInterpolationLength,i),r=0,s;if(u(t)){let a=t.length;s=new Array(a);for(let c=0;c<a;c++){let l=t[c];l===Number&&(l=Ace);let f=l.packedLength;i+=f,o+=y(l.packedInterpolationLength,f),s[c]=l}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=rx,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 Ae,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=iu.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=iu.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(Id.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))}}});Id.prototype.getValue=function(e,t){let n=this._times,i=n.length;if(i===0)return;let o,r=this._innerType,s=this._values,a=wo(n,e,$.compare);if(a<0){if(a=~a,a===0){let S=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===iu.NONE||o!==0&&$.secondsDifference(S,e)>o)return;if(this._backwardExtrapolationType===iu.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;let S=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===iu.NONE||o!==0&&$.secondsDifference(e,S)>o)return;if(this._forwardExtrapolationType===iu.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}let c=this._xTable,l=this._yTable,f=this._interpolationAlgorithm,d=this._packedInterpolationLength,p=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;let S=Math.min(f.getRequiredDataPoints(this._interpolationDegree,p),i);S!==this._numberOfPoints&&(this._numberOfPoints=S,c.length=S,l.length=S*d)}let g=this._numberOfPoints-1;if(g<1)return;let m=0,A=i-1;if(A-m+1>=g+1){let S=a-(g/2|0)-1;S<m&&(S=m);let D=S+g;D>A&&(D=A,S=D-g,S<m&&(S=m)),m=S,A=D}let C=A-m+1;for(let S=0;S<C;++S)c[S]=$.secondsDifference(n[m+S],n[A]);if(u(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,m,A,l);else{let S=0,D=this._packedLength,w=m*D,R=(A+1)*D;for(;w<R;)l[S]=s[w],w++,S++}let T=$.secondsDifference(e,n[A]),E;if(p===0||!u(f.interpolate))E=f.interpolateOrderZero(T,c,l,d,this._interpolationResult);else{let S=Math.floor(d/(p+1));E=f.interpolate(T,c,l,S,p,p,this._interpolationResult)}return u(r.unpackInterpolationResult)?r.unpackInterpolationResult(E,s,m,A,t):r.unpack(E,0,t)}return r.unpack(s,a*this._packedLength,t)};Id.prototype.setInterpolationOptions=function(e){if(!u(e))return;let t=!1,n=e.interpolationAlgorithm,i=e.interpolationDegree;u(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),u(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))};Id.prototype.addSample=function(e,t,n){let i=this._innerDerivativeTypes,o=u(i),r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){let a=i.length;for(let c=0;c<a;c++)i[c].pack(n[c],s,s.length)}NU(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Id.prototype.addSamples=function(e,t,n){let i=this._innerDerivativeTypes,o=u(i),r=this._innerType,s=e.length,a=[];for(let c=0;c<s;c++)if(a.push(e[c]),r.pack(t[c],a,a.length),o){let l=n[c],f=i.length;for(let d=0;d<f;d++)i[d].pack(l[d],a,a.length)}NU(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Id.prototype.addSamplesPackedArray=function(e,t){NU(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Id.prototype.removeSample=function(e){let t=wo(this._times,e,$.compare);return t<0?!1:(Tce(this,t,1),!0)};function Tce(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)}Id.prototype.removeSamples=function(e){let t=this._times,n=wo(t,e.start,$.compare);n<0?n=~n:e.isStartIncluded||++n;let i=wo(t,e.stop,$.compare);i<0?i=~i:e.isStopIncluded&&++i,Tce(this,n,i-n)};Id.prototype.equals=function(e){if(this===e)return!0;if(!u(e)||this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;let t=this._derivativeTypes,n=u(t),i=e._derivativeTypes,o=u(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,c=e._times;if(s=a.length,s!==c.length)return!1;for(r=0;r<s;r++)if(!$.equals(a[r],c[r]))return!1;let l=this._values,f=e._values;for(s=l.length,r=0;r<s;r++)if(l[r]!==f[r])return!1;return!0};Id._mergeNewSamples=NU;var ru=Id;function pf(e,t){t=y(t,0);let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=h}this._numberOfDerivatives=t,this._property=new ru(h,n),this._definitionChanged=new Ae,this._referenceFrame=y(e,to.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(pf.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}}});pf.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};pf.prototype.getValueInReferenceFrame=function(e,t,n){if(n=this._property.getValue(e,n),u(n))return Jm.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};pf.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};pf.prototype.addSample=function(e,t,n){let i=this._numberOfDerivatives;this._property.addSample(e,t,n)};pf.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};pf.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};pf.prototype.removeSample=function(e){return this._property.removeSample(e)};pf.prototype.removeSamples=function(e){this._property.removeSamples(e)};pf.prototype.equals=function(e){return this===e||e instanceof pf&&Y.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};var Ys=pf;var i7e={HORIZONTAL:0,VERTICAL:1},Pd=Object.freeze(i7e);var o7e=Pd.HORIZONTAL,r7e=z.WHITE,s7e=z.BLACK,a7e=0,c7e=1;function UE(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Ae,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(UE.prototype,{isConstant:{get:function(){return Y.isConstant(this._orientation)&&Y.isConstant(this._evenColor)&&Y.isConstant(this._oddColor)&&Y.isConstant(this._offset)&&Y.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},orientation:ae("orientation"),evenColor:ae("evenColor"),oddColor:ae("oddColor"),offset:ae("offset"),repeat:ae("repeat")});UE.prototype.getType=function(e){return"Stripe"};UE.prototype.getValue=function(e,t){return u(t)||(t={}),t.horizontal=Y.getValueOrDefault(this._orientation,e,o7e)===Pd.HORIZONTAL,t.evenColor=Y.getValueOrClonedDefault(this._evenColor,e,r7e,t.evenColor),t.oddColor=Y.getValueOrClonedDefault(this._oddColor,e,s7e,t.oddColor),t.offset=Y.getValueOrDefault(this._offset,e,a7e),t.repeat=Y.getValueOrDefault(this._repeat,e,c7e),t};UE.prototype.equals=function(e){return this===e||e instanceof UE&&Y.equals(this._orientation,e._orientation)&&Y.equals(this._evenColor,e._evenColor)&&Y.equals(this._oddColor,e._oddColor)&&Y.equals(this._offset,e._offset)&&Y.equals(this._repeat,e._repeat)};var kE=UE;function ry(e){this._definitionChanged=new Ae,this._intervals=new Pr,this._intervals.changedEvent.addEventListener(ry.prototype._intervalsChanged,this),this._referenceFrame=y(e,to.FIXED)}Object.defineProperties(ry.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}}});ry.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};ry.prototype.getValueInReferenceFrame=function(e,t,n){let i=this._intervals.findDataForIntervalContainingDate(e);if(u(i))return Jm.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};ry.prototype.equals=function(e){return this===e||e instanceof ry&&this._intervals.equals(e._intervals,Y.equals)&&this._referenceFrame===e._referenceFrame};ry.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};var o_=ry;function cx(){this._definitionChanged=new Ae,this._intervals=new Pr,this._intervals.changedEvent.addEventListener(cx.prototype._intervalsChanged,this)}Object.defineProperties(cx.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});cx.prototype.getValue=function(e,t){let n=this._intervals.findDataForIntervalContainingDate(e);return u(n)&&typeof n.clone=="function"?n.clone(t):n};cx.prototype.equals=function(e){return this===e||e instanceof cx&&this._intervals.equals(e._intervals,Y.equals)};cx.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};var r_=cx;function zE(e,t){this._position=void 0,this._subscription=void 0,this._definitionChanged=new Ae,this._normalize=y(t,!0),this.position=e}Object.defineProperties(zE.prototype,{isConstant:{get:function(){return Y.isConstant(this._position)}},definitionChanged:{get:function(){return this._definitionChanged}},position:{get:function(){return this._position},set:function(e){let t=this._position;t!==e&&(u(t)&&this._subscription(),this._position=e,u(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 l7e=new h,Ece=new h,bce=new $,q9=1/60;zE.prototype.getValue=function(e,t){return this._getValue(e,t)};zE.prototype._getValue=function(e,t,n){u(t)||(t=new h);let i=this._position;if(Y.isConstant(i))return this._normalize?void 0:h.clone(h.ZERO,t);let o=i.getValue(e,l7e),r=i.getValue($.addSeconds(e,q9,bce),Ece);if(!u(o)||!u(r)&&(r=o,o=i.getValue($.addSeconds(e,-q9,bce),Ece),!u(o)))return;if(h.equals(o,r))return this._normalize?void 0:h.clone(h.ZERO,t);u(n)&&o.clone(n);let s=h.subtract(r,o,t);return this._normalize?h.normalize(s,t):h.divideByScalar(s,q9,t)};zE.prototype.equals=function(e){return this===e||e instanceof zE&&Y.equals(this._position,e._position)};var lx=zE;function lB(e,t){this._velocityVectorProperty=new lx(e,!0),this._subscription=void 0,this._ellipsoid=void 0,this._definitionChanged=new Ae,this.ellipsoid=y(t,ie.WGS84);let n=this;this._velocityVectorProperty.definitionChanged.addEventListener(function(){n._definitionChanged.raiseEvent(n)})}Object.defineProperties(lB.prototype,{isConstant:{get:function(){return Y.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 Sce=new h,u7e=new h,Dce=new Z;lB.prototype.getValue=function(e,t){let n=this._velocityVectorProperty._getValue(e,u7e,Sce);if(u(n))return Ot.rotationMatrixFromPositionVelocity(Sce,n,this._ellipsoid,Dce),Le.fromRotationMatrix(Dce,t)};lB.prototype.equals=function(e){return this===e||e instanceof lB&&Y.equals(this._velocityVectorProperty,e._velocityVectorProperty)&&(this._ellipsoid===e._ellipsoid||this._ellipsoid.equals(e._ellipsoid))};var uB=lB;function sy(){}sy.packedLength=h.packedLength;sy.unpack=h.unpack;sy.pack=h.pack;var X9;function fB(e,t){return t[0]==="#"&&(t=X9+t),i_.fromString(e,t)}function vce(e,t,n){if(u(n.reference))return fB(t,n.reference);if(u(n.velocityReference)){let i=fB(t,n.velocityReference);switch(e){case h:case sy:return new lx(i,e===sy);case Le:return new uB(i)}}throw new ue(`${JSON.stringify(n)} is not valid CZML.`)}function f7e(e,t){return new nd(function(n,i){return t(e.getValue(n,i))},e.isConstant)}var Li=new h,Lc=new cB,tc=new he,ux=new An,FU=new Le;function d7e(e){let t=e.rgbaf;if(u(t))return t;let n=e.rgba;if(!u(n))return;let i=n.length;if(i===z.packedLength)return[z.byteToFloat(n[0]),z.byteToFloat(n[1]),z.byteToFloat(n[2]),z.byteToFloat(n[3])];t=new Array(i);for(let o=0;o<i;o+=5)t[o]=n[o],t[o+1]=z.byteToFloat(n[o+1]),t[o+2]=z.byteToFloat(n[o+2]),t[o+3]=z.byteToFloat(n[o+3]),t[o+4]=z.byteToFloat(n[o+4]);return t}function wce(e,t){let n=y(e.uri,e);return u(t)?t.getDerivedResource({url:n}):Oe.createIfNeeded(n)}function h7e(e){let t=e.wsen;if(u(t))return t;let n=e.wsenDegrees;if(!u(n))return;let i=n.length;if(i===ce.packedLength)return[P.toRadians(n[0]),P.toRadians(n[1]),P.toRadians(n[2]),P.toRadians(n[3])];t=new Array(i);for(let o=0;o<i;o+=5)t[o]=n[o],t[o+1]=P.toRadians(n[o+1]),t[o+2]=P.toRadians(n[o+2]),t[o+3]=P.toRadians(n[o+3]),t[o+4]=P.toRadians(n[o+4]);return t}function m7e(e){let t=e.length;if(Lc.magnitude=1,t===2)return Lc.clock=e[0],Lc.cone=e[1],h.fromSpherical(Lc,Li),[Li.x,Li.y,Li.z];let n=new Array(t/3*4);for(let i=0,o=0;i<t;i+=3,o+=4)n[o]=e[i],Lc.clock=e[i+1],Lc.cone=e[i+2],h.fromSpherical(Lc,Li),n[o+1]=Li.x,n[o+2]=Li.y,n[o+3]=Li.z;return n}function p7e(e){let t=e.length;if(t===3)return Lc.clock=e[0],Lc.cone=e[1],Lc.magnitude=e[2],h.fromSpherical(Lc,Li),[Li.x,Li.y,Li.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],Lc.clock=e[i+1],Lc.cone=e[i+2],Lc.magnitude=e[i+3],h.fromSpherical(Lc,Li),n[i+1]=Li.x,n[i+2]=Li.y,n[i+3]=Li.z;return n}function _7e(e){let t=e.length;if(t===3)return tc.longitude=e[0],tc.latitude=e[1],tc.height=e[2],ie.WGS84.cartographicToCartesian(tc,Li),[Li.x,Li.y,Li.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],tc.longitude=e[i+1],tc.latitude=e[i+2],tc.height=e[i+3],ie.WGS84.cartographicToCartesian(tc,Li),n[i+1]=Li.x,n[i+2]=Li.y,n[i+3]=Li.z;return n}function g7e(e){let t=e.length;if(t===3)return tc.longitude=P.toRadians(e[0]),tc.latitude=P.toRadians(e[1]),tc.height=e[2],ie.WGS84.cartographicToCartesian(tc,Li),[Li.x,Li.y,Li.z];let n=new Array(t);for(let i=0;i<t;i+=4)n[i]=e[i],tc.longitude=P.toRadians(e[i+1]),tc.latitude=P.toRadians(e[i+2]),tc.height=e[i+3],ie.WGS84.cartographicToCartesian(tc,Li),n[i+1]=Li.x,n[i+2]=Li.y,n[i+3]=Li.z;return n}function K9(e){let t=e.cartesian;if(u(t))return t;let n=e.cartesianVelocity;if(u(n))return n;let i=e.unitCartesian;if(u(i))return i;let o=e.unitSpherical;if(u(o))return m7e(o);let r=e.spherical;if(u(r))return p7e(r);let s=e.cartographicRadians;if(u(s))return _7e(s);let a=e.cartographicDegrees;if(u(a))return g7e(a);throw new ue(`${JSON.stringify(e)} is not a valid CZML interval.`)}function Ice(e,t){h.unpack(e,t,Li),h.normalize(Li,Li),h.pack(Li,e,t)}function y7e(e){let t=K9(e);if(t.length===3)return Ice(t,0),t;for(let n=1;n<t.length;n+=4)Ice(t,n);return t}function Pce(e,t){Le.unpack(e,t,FU),Le.normalize(FU,FU),Le.pack(FU,e,t)}function A7e(e){let t=e.unitQuaternion;if(u(t)){if(t.length===4)return Pce(t,0),t;for(let n=1;n<t.length;n+=5)Pce(t,n)}return t}function Oce(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")?Ye:e.hasOwnProperty("cartesian2")?H:e.hasOwnProperty("cartesian")||e.hasOwnProperty("spherical")||e.hasOwnProperty("cartographicRadians")||e.hasOwnProperty("cartographicDegrees")?h:e.hasOwnProperty("unitCartesian")||e.hasOwnProperty("unitSpherical")?sy:e.hasOwnProperty("rgba")||e.hasOwnProperty("rgbaf")?z:e.hasOwnProperty("arcType")?Kt:e.hasOwnProperty("classificationType")?Un:e.hasOwnProperty("colorBlendMode")?ja:e.hasOwnProperty("cornerType")?vi:e.hasOwnProperty("heightReference")?We:e.hasOwnProperty("horizontalOrigin")?_i:e.hasOwnProperty("date")?$:e.hasOwnProperty("labelStyle")?No:e.hasOwnProperty("number")?Number:e.hasOwnProperty("nearFarScalar")?Pt:e.hasOwnProperty("distanceDisplayCondition")?bt:e.hasOwnProperty("object")||e.hasOwnProperty("value")?Object:e.hasOwnProperty("unitQuaternion")?Le:e.hasOwnProperty("shadowMode")?gn:e.hasOwnProperty("string")?String:e.hasOwnProperty("stripeOrientation")?Pd:e.hasOwnProperty("wsen")||e.hasOwnProperty("wsenDegrees")?ce:e.hasOwnProperty("uri")?hB.default:e.hasOwnProperty("verticalOrigin")?On:Object}function x7e(e,t,n){switch(e){case Kt:return Kt[y(t.arcType,t)];case Array:return t.array;case Boolean:return y(t.boolean,t);case Ye:return t.boundingRectangle;case H:return t.cartesian2;case h:return K9(t);case sy:return y7e(t);case z:return d7e(t);case Un:return Un[y(t.classificationType,t)];case ja:return ja[y(t.colorBlendMode,t)];case vi:return vi[y(t.cornerType,t)];case We:return We[y(t.heightReference,t)];case _i:return _i[y(t.horizontalOrigin,t)];case Image:return wce(t,n);case $:return $.fromIso8601(y(t.date,t));case No:return No[y(t.labelStyle,t)];case Number:return y(t.number,t);case Pt:return t.nearFarScalar;case bt:return t.distanceDisplayCondition;case Object:return y(y(t.object,t.value),t);case Le:return A7e(t);case mf:return y(t.number,t);case gn:return gn[y(y(t.shadowMode,t.shadows),t)];case String:return y(t.string,t);case Pd:return Pd[y(t.stripeOrientation,t)];case ce:return h7e(t);case hB.default:return wce(t,n);case On:return On[y(t.verticalOrigin,t)];default:throw new ue(e)}}var C7e={HERMITE:sB,LAGRANGE:aB,LINEAR:rx};function VU(e,t){let n=e.interpolationAlgorithm,i=e.interpolationDegree;(u(n)||u(i))&&t.setInterpolationOptions({interpolationAlgorithm:C7e[n],interpolationDegree:i});let o=e.forwardExtrapolationType;u(o)&&(t.forwardExtrapolationType=iu[o]);let r=e.forwardExtrapolationDuration;u(r)&&(t.forwardExtrapolationDuration=r);let s=e.backwardExtrapolationType;u(s)&&(t.backwardExtrapolationType=iu[s]);let a=e.backwardExtrapolationDuration;u(a)&&(t.backwardExtrapolationDuration=a)}var Rce={iso8601:void 0};function cr(e){if(u(e))return Rce.iso8601=e,An.fromIso8601(Rce)}function Z9(e){let t=ze.MAXIMUM_INTERVAL.clone();return t.data=e,t}function Bce(e){let t=new Qa;return t.intervals.addInterval(Z9(e)),t}function Mce(e){let t=new Ws(e.referenceFrame);return t.intervals.addInterval(Z9(e)),t}function UU(e,t,n,i,o,r,s){let a=cr(i.interval);u(o)&&(u(a)?a=An.intersect(a,o,ux):a=o);let c,l,f,d=!u(i.reference)&&!u(i.velocityReference),p=u(a)&&!a.equals(ze.MAXIMUM_INTERVAL);if(i.delete===!0){if(!p){t[n]=void 0;return}return jce(t[n],a)}let g=!1;if(d){if(l=x7e(e,i,r),!u(l))return;c=y(e.packedLength,1),f=y(l.length,1),g=!u(i.array)&&typeof l!="string"&&f>c&&e!==Object}let m=typeof e.unpack=="function"&&e!==mf;if(!g&&!p){d?t[n]=new ei(m?e.unpack(l,0):l):t[n]=vce(e,s,i);return}let A=t[n],x,C=i.epoch;if(u(C)&&(x=$.fromIso8601(C)),g&&!p){A instanceof ru||(t[n]=A=new ru(e)),A.addSamplesPackedArray(l,x),VU(i,A);return}let T;if(!g&&p){a=a.clone(),d?a.data=m?e.unpack(l,0):l:a.data=vce(e,s,i),u(A)||(t[n]=A=d?new r_:new Qa),d&&A instanceof r_?A.intervals.addInterval(a):A instanceof Qa?(d&&(a.data=new ei(a.data)),A.intervals.addInterval(a)):(t[n]=A=Bce(A),d&&(a.data=new ei(a.data)),A.intervals.addInterval(a));return}u(A)||(t[n]=A=new Qa),A instanceof Qa||(t[n]=A=Bce(A));let E=A.intervals;T=E.findInterval(a),(!u(T)||!(T.data instanceof ru))&&(T=a.clone(),T.data=new ru(e),E.addInterval(T)),T.data.addSamplesPackedArray(l,x),VU(i,T.data)}function jce(e,t){if(e instanceof ru){e.removeSamples(t);return}else if(e instanceof r_){e.intervals.removeInterval(t);return}else if(e instanceof Qa){let n=e.intervals;for(let i=0;i<n.length;++i){let o=An.intersect(n.get(i),t,ux);o.isEmpty||jce(o.data,t)}n.removeInterval(t);return}}function ge(e,t,n,i,o,r,s){if(u(i))if(Array.isArray(i))for(let a=0,c=i.length;a<c;++a)UU(e,t,n,i[a],o,r,s);else UU(e,t,n,i,o,r,s)}function Lce(e,t,n,i,o,r){let s=cr(n.interval);u(i)&&(u(s)?s=An.intersect(s,i,ux):s=i);let a=u(n.cartesianVelocity)?1:0,c=h.packedLength*(a+1),l,f,d=!u(n.reference),p=u(s)&&!s.equals(ze.MAXIMUM_INTERVAL);if(n.delete===!0){if(!p){e[t]=void 0;return}return Yce(e[t],s)}let g,m=!1;if(d&&(u(n.referenceFrame)&&(g=to[n.referenceFrame]),g=y(g,to.FIXED),l=K9(n),f=y(l.length,1),m=f>c),!m&&!p){d?e[t]=new Sc(h.unpack(l),g):e[t]=fB(r,n.reference);return}let A=e[t],x,C=n.epoch;if(u(C)&&(x=$.fromIso8601(C)),m&&!p){(!(A instanceof Ys)||u(g)&&A.referenceFrame!==g)&&(e[t]=A=new Ys(g,a)),A.addSamplesPackedArray(l,x),VU(n,A);return}let T;if(!m&&p){s=s.clone(),d?s.data=h.unpack(l):s.data=fB(r,n.reference),u(A)||(d?A=new o_(g):A=new Ws(g),e[t]=A),d&&A instanceof o_&&u(g)&&A.referenceFrame===g?A.intervals.addInterval(s):A instanceof Ws?(d&&(s.data=new Sc(s.data,g)),A.intervals.addInterval(s)):(e[t]=A=Mce(A),d&&(s.data=new Sc(s.data,g)),A.intervals.addInterval(s));return}u(A)?A instanceof Ws||(e[t]=A=Mce(A)):e[t]=A=new Ws(g);let E=A.intervals;T=E.findInterval(s),(!u(T)||!(T.data instanceof Ys)||u(g)&&T.data.referenceFrame!==g)&&(T=s.clone(),T.data=new Ys(g,a),E.addInterval(T)),T.data.addSamplesPackedArray(l,x),VU(n,T.data)}function Yce(e,t){if(e instanceof Ys){e.removeSamples(t);return}else if(e instanceof o_){e.intervals.removeInterval(t);return}else if(e instanceof Ws){let n=e.intervals;for(let i=0;i<n.length;++i){let o=An.intersect(n.get(i),t,ux);o.isEmpty||Yce(o.data,t)}n.removeInterval(t);return}}function qce(e,t,n,i,o,r){if(u(n))if(Array.isArray(n))for(let s=0,a=n.length;s<a;++s)Lce(e,t,n[s],i,o,r);else Lce(e,t,n,i,o,r)}function Nce(e,t,n,i){u(n.references)?kU(e,t,n.references,n.interval,i,VE,Qa):(u(n.cartesian2)?n.array=H.unpackArray(n.cartesian2):u(n.cartesian)&&(n.array=H.unpackArray(n.cartesian)),u(n.array)&&ge(Array,e,t,n,void 0,void 0,i))}function Fce(e,t,n,i,o,r){let s=cr(n.interval);u(i)&&(u(s)?s=An.intersect(s,i,ux):s=i);let a=e[t],c,l;if(u(s)){a instanceof xE||(a=new xE,e[t]=a);let d=a.intervals;l=d.findInterval({start:s.start,stop:s.stop}),u(l)?c=l.data:(l=s.clone(),d.addInterval(l))}else c=a;let f;u(n.solidColor)?(c instanceof Mt||(c=new Mt),f=n.solidColor,ge(z,c,"color",f.color,void 0,void 0,r)):u(n.grid)?(c instanceof PE||(c=new PE),f=n.grid,ge(z,c,"color",f.color,void 0,o,r),ge(Number,c,"cellAlpha",f.cellAlpha,void 0,o,r),ge(H,c,"lineCount",f.lineCount,void 0,o,r),ge(H,c,"lineThickness",f.lineThickness,void 0,o,r),ge(H,c,"lineOffset",f.lineOffset,void 0,o,r)):u(n.image)?(c instanceof og||(c=new og),f=n.image,ge(Image,c,"image",f.image,void 0,o,r),ge(H,c,"repeat",f.repeat,void 0,o,r),ge(z,c,"color",f.color,void 0,o,r),ge(Boolean,c,"transparent",f.transparent,void 0,o,r)):u(n.stripe)?(c instanceof kE||(c=new kE),f=n.stripe,ge(Pd,c,"orientation",f.orientation,void 0,o,r),ge(z,c,"evenColor",f.evenColor,void 0,o,r),ge(z,c,"oddColor",f.oddColor,void 0,o,r),ge(Number,c,"offset",f.offset,void 0,o,r),ge(Number,c,"repeat",f.repeat,void 0,o,r)):u(n.polylineOutline)?(c instanceof iy||(c=new iy),f=n.polylineOutline,ge(z,c,"color",f.color,void 0,o,r),ge(z,c,"outlineColor",f.outlineColor,void 0,o,r),ge(Number,c,"outlineWidth",f.outlineWidth,void 0,o,r)):u(n.polylineGlow)?(c instanceof NE||(c=new NE),f=n.polylineGlow,ge(z,c,"color",f.color,void 0,o,r),ge(Number,c,"glowPower",f.glowPower,void 0,o,r),ge(Number,c,"taperPower",f.taperPower,void 0,o,r)):u(n.polylineArrow)?(c instanceof RE||(c=new RE),f=n.polylineArrow,ge(z,c,"color",f.color,void 0,void 0,r)):u(n.polylineDash)?(c instanceof ME||(c=new ME),f=n.polylineDash,ge(z,c,"color",f.color,void 0,void 0,r),ge(z,c,"gapColor",f.gapColor,void 0,void 0,r),ge(Number,c,"dashLength",f.dashLength,void 0,o,r),ge(Number,c,"dashPattern",f.dashPattern,void 0,o,r)):u(n.checkerboard)&&(c instanceof yE||(c=new yE),f=n.checkerboard,ge(z,c,"evenColor",f.evenColor,void 0,o,r),ge(z,c,"oddColor",f.oddColor,void 0,o,r),ge(H,c,"repeat",f.repeat,void 0,o,r)),u(l)?l.data=c:e[t]=c}function su(e,t,n,i,o,r){if(u(n))if(Array.isArray(n))for(let s=0,a=n.length;s<a;++s)Fce(e,t,n[s],i,o,r);else Fce(e,t,n,i,o,r)}function T7e(e,t,n,i){let o=t.name;u(o)&&(e.name=t.name)}function E7e(e,t,n,i){let o=t.description;u(o)&&ge(String,e,"description",o,void 0,i,n)}function b7e(e,t,n,i){let o=t.position;u(o)&&qce(e,"position",o,void 0,i,n)}function S7e(e,t,n,i){let o=t.viewFrom;u(o)&&ge(h,e,"viewFrom",o,void 0,i,n)}function D7e(e,t,n,i){let o=t.orientation;u(o)&&ge(Le,e,"orientation",o,void 0,i,n)}function v7e(e,t,n,i){let o=t.properties;if(u(o)){u(e.properties)||(e.properties=new cl);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,c=s.length;a<c;++a)UU(Oce(s[a]),e.properties,r,s[a],void 0,i,n);else UU(Oce(s),e.properties,r,s,void 0,i,n)}}}function kU(e,t,n,i,o,r,s){let a=n.map(function(c){return fB(o,c)});if(u(i)){i=cr(i);let c=e[t];if(!(c instanceof s)){let l=new s;l.intervals.addInterval(Z9(c)),e[t]=c=l}i.data=new r(a),c.intervals.addInterval(i)}else e[t]=new r(a)}function Vce(e,t,n,i){let o=n.references;u(o)?kU(e,t,o,n.interval,i,VE,Qa):ge(Array,e,t,n,void 0,void 0,i)}function Uce(e,t,n,i){if(u(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)Vce(e,t,n[o],i);else Vce(e,t,n,i)}function kce(e,t,n,i){let o=n.references;u(o)?kU(e,t,o,n.interval,i,n_,Ws):(u(n.cartesian)?n.array=h.unpackArray(n.cartesian):u(n.cartographicRadians)?n.array=h.fromRadiansArrayHeights(n.cartographicRadians):u(n.cartographicDegrees)&&(n.array=h.fromDegreesArrayHeights(n.cartographicDegrees)),u(n.array)&&ge(Array,e,t,n,void 0,void 0,i))}function mB(e,t,n,i){if(u(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)kce(e,t,n[o],i);else kce(e,t,n,i)}function w7e(e){return h.unpackArray(e)}function I7e(e){return h.fromRadiansArrayHeights(e)}function P7e(e){return h.fromDegreesArrayHeights(e)}function zce(e,t,n,i){let o=n.references;if(u(o)){let r=o.map(function(s){let a={};return kU(a,"positions",s,n.interval,i,n_,Ws),a.positions});e[t]=new n_(r)}else u(n.cartesian)?n.array=n.cartesian.map(w7e):u(n.cartographicRadians)?n.array=n.cartographicRadians.map(I7e):u(n.cartographicDegrees)&&(n.array=n.cartographicDegrees.map(P7e)),u(n.array)&&ge(Array,e,t,n,void 0,void 0,i)}function O7e(e,t,n,i){if(u(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)zce(e,t,n[o],i);else zce(e,t,n,i)}function R7e(e,t,n,i){if(u(n))if(Array.isArray(n))for(let o=0,r=n.length;o<r;o++)Nce(e,t,n[o],i);else Nce(e,t,n,i)}function B7e(e,t,n,i){let o=t.availability;if(!u(o))return;let r;if(Array.isArray(o))for(let s=0,a=o.length;s<a;++s)u(r)||(r=new Pr),r.addInterval(cr(o[s]));else r=new Pr,r.addInterval(cr(o));e.availability=r}function M7e(e,t,n,i,o){u(t)&&ge(sy,e,"alignedAxis",t,n,i,o)}function L7e(e,t,n,i){let o=t.billboard;if(!u(o))return;let r=cr(o.interval),s=e.billboard;u(s)||(e.billboard=s=new Na),ge(Boolean,s,"show",o.show,r,i,n),ge(Image,s,"image",o.image,r,i,n),ge(Number,s,"scale",o.scale,r,i,n),ge(H,s,"pixelOffset",o.pixelOffset,r,i,n),ge(h,s,"eyeOffset",o.eyeOffset,r,i,n),ge(_i,s,"horizontalOrigin",o.horizontalOrigin,r,i,n),ge(On,s,"verticalOrigin",o.verticalOrigin,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(z,s,"color",o.color,r,i,n),ge(mf,s,"rotation",o.rotation,r,i,n),M7e(s,o.alignedAxis,r,i,n),ge(Boolean,s,"sizeInMeters",o.sizeInMeters,r,i,n),ge(Number,s,"width",o.width,r,i,n),ge(Number,s,"height",o.height,r,i,n),ge(Pt,s,"scaleByDistance",o.scaleByDistance,r,i,n),ge(Pt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),ge(Pt,s,"pixelOffsetScaleByDistance",o.pixelOffsetScaleByDistance,r,i,n),ge(Ye,s,"imageSubRegion",o.imageSubRegion,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function N7e(e,t,n,i){let o=t.box;if(!u(o))return;let r=cr(o.interval),s=e.box;u(s)||(e.box=s=new W0),ge(Boolean,s,"show",o.show,r,i,n),ge(h,s,"dimensions",o.dimensions,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function F7e(e,t,n,i){let o=t.corridor;if(!u(o))return;let r=cr(o.interval),s=e.corridor;u(s)||(e.corridor=s=new Y0),ge(Boolean,s,"show",o.show,r,i,n),mB(s,"positions",o.positions,n),ge(Number,s,"width",o.width,r,i,n),ge(Number,s,"height",o.height,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),ge(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),ge(vi,s,"cornerType",o.cornerType,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Un,s,"classificationType",o.classificationType,r,i,n),ge(Number,s,"zIndex",o.zIndex,r,i,n)}function V7e(e,t,n,i){let o=t.cylinder;if(!u(o))return;let r=cr(o.interval),s=e.cylinder;u(s)||(e.cylinder=s=new q0),ge(Boolean,s,"show",o.show,r,i,n),ge(Number,s,"length",o.length,r,i,n),ge(Number,s,"topRadius",o.topRadius,r,i,n),ge(Number,s,"bottomRadius",o.bottomRadius,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Number,s,"numberOfVerticalLines",o.numberOfVerticalLines,r,i,n),ge(Number,s,"slices",o.slices,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function U7e(e,t){let n=e.version;if(u(n)&&typeof n=="string"){let r=n.split(".");if(r.length===2){if(r[0]!=="1")throw new ue("Cesium only supports CZML version 1.");t._version=n}}if(!u(t._version))throw new ue("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;u(e.name)&&(i.name=e.name);let o=e.clock;if(u(o)){let r=i.clock;u(r)?(r.interval=y(o.interval,r.interval),r.currentTime=y(o.currentTime,r.currentTime),r.range=y(o.range,r.range),r.step=y(o.step,r.step),r.multiplier=y(o.multiplier,r.multiplier)):i.clock={interval:o.interval,currentTime:o.currentTime,range:o.range,step:o.step,multiplier:o.multiplier}}}function k7e(e,t,n,i){let o=t.ellipse;if(!u(o))return;let r=cr(o.interval),s=e.ellipse;u(s)||(e.ellipse=s=new X0),ge(Boolean,s,"show",o.show,r,i,n),ge(Number,s,"semiMajorAxis",o.semiMajorAxis,r,i,n),ge(Number,s,"semiMinorAxis",o.semiMinorAxis,r,i,n),ge(Number,s,"height",o.height,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),ge(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),ge(mf,s,"rotation",o.rotation,r,i,n),ge(mf,s,"stRotation",o.stRotation,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Number,s,"numberOfVerticalLines",o.numberOfVerticalLines,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Un,s,"classificationType",o.classificationType,r,i,n),ge(Number,s,"zIndex",o.zIndex,r,i,n)}function z7e(e,t,n,i){let o=t.ellipsoid;if(!u(o))return;let r=cr(o.interval),s=e.ellipsoid;u(s)||(e.ellipsoid=s=new K0),ge(Boolean,s,"show",o.show,r,i,n),ge(h,s,"radii",o.radii,r,i,n),ge(h,s,"innerRadii",o.innerRadii,r,i,n),ge(Number,s,"minimumClock",o.minimumClock,r,i,n),ge(Number,s,"maximumClock",o.maximumClock,r,i,n),ge(Number,s,"minimumCone",o.minimumCone,r,i,n),ge(Number,s,"maximumCone",o.maximumCone,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Number,s,"stackPartitions",o.stackPartitions,r,i,n),ge(Number,s,"slicePartitions",o.slicePartitions,r,i,n),ge(Number,s,"subdivisions",o.subdivisions,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function H7e(e,t,n,i){let o=t.label;if(!u(o))return;let r=cr(o.interval),s=e.label;u(s)||(e.label=s=new $f),ge(Boolean,s,"show",o.show,r,i,n),ge(String,s,"text",o.text,r,i,n),ge(String,s,"font",o.font,r,i,n),ge(No,s,"style",o.style,r,i,n),ge(Number,s,"scale",o.scale,r,i,n),ge(Boolean,s,"showBackground",o.showBackground,r,i,n),ge(z,s,"backgroundColor",o.backgroundColor,r,i,n),ge(H,s,"backgroundPadding",o.backgroundPadding,r,i,n),ge(H,s,"pixelOffset",o.pixelOffset,r,i,n),ge(h,s,"eyeOffset",o.eyeOffset,r,i,n),ge(_i,s,"horizontalOrigin",o.horizontalOrigin,r,i,n),ge(On,s,"verticalOrigin",o.verticalOrigin,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(z,s,"fillColor",o.fillColor,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Pt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),ge(Pt,s,"pixelOffsetScaleByDistance",o.pixelOffsetScaleByDistance,r,i,n),ge(Pt,s,"scaleByDistance",o.scaleByDistance,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function G7e(e,t,n,i){let o=t.model;if(!u(o))return;let r=cr(o.interval),s=e.model;u(s)||(e.model=s=new $m),ge(Boolean,s,"show",o.show,r,i,n),ge(hB.default,s,"uri",o.gltf,r,i,n),ge(Number,s,"scale",o.scale,r,i,n),ge(Number,s,"minimumPixelSize",o.minimumPixelSize,r,i,n),ge(Number,s,"maximumScale",o.maximumScale,r,i,n),ge(Boolean,s,"incrementallyLoadTextures",o.incrementallyLoadTextures,r,i,n),ge(Boolean,s,"runAnimations",o.runAnimations,r,i,n),ge(Boolean,s,"clampAnimations",o.clampAnimations,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(z,s,"silhouetteColor",o.silhouetteColor,r,i,n),ge(Number,s,"silhouetteSize",o.silhouetteSize,r,i,n),ge(z,s,"color",o.color,r,i,n),ge(ja,s,"colorBlendMode",o.colorBlendMode,r,i,n),ge(Number,s,"colorBlendAmount",o.colorBlendAmount,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n);let a,c,l=o.nodeTransformations;if(u(l))if(Array.isArray(l))for(a=0,c=l.length;a<c;++a)Hce(s,l[a],r,i,n);else Hce(s,l,r,i,n);let f=o.articulations;if(u(f))if(Array.isArray(f))for(a=0,c=f.length;a<c;++a)Gce(s,f[a],r,i,n);else Gce(s,f,r,i,n)}function Hce(e,t,n,i,o){let r=cr(t.interval);u(n)&&(u(r)?r=An.intersect(r,n,ux):r=n);let s=e.nodeTransformations,a=Object.keys(t);for(let c=0,l=a.length;c<l;++c){let f=a[c];if(f==="interval")continue;let d=t[f];if(!u(d))continue;u(s)||(e.nodeTransformations=s=new cl),s.hasProperty(f)||s.addProperty(f);let p=s[f];u(p)||(s[f]=p=new Z0),ge(h,p,"translation",d.translation,r,i,o),ge(Le,p,"rotation",d.rotation,r,i,o),ge(h,p,"scale",d.scale,r,i,o)}}function Gce(e,t,n,i,o){let r=cr(t.interval);u(n)&&(u(r)?r=An.intersect(r,n,ux):r=n);let s=e.articulations,a=Object.keys(t);for(let c=0,l=a.length;c<l;++c){let f=a[c];if(f==="interval")continue;let d=t[f];u(d)&&(u(s)||(e.articulations=s=new cl),s.hasProperty(f)||s.addProperty(f),ge(Number,s,f,d,r,i,o))}}function W7e(e,t,n,i){let o=t.path;if(!u(o))return;let r=cr(o.interval),s=e.path;u(s)||(e.path=s=new ep),ge(Boolean,s,"show",o.show,r,i,n),ge(Number,s,"leadTime",o.leadTime,r,i,n),ge(Number,s,"trailTime",o.trailTime,r,i,n),ge(Number,s,"width",o.width,r,i,n),ge(Number,s,"resolution",o.resolution,r,i,n),su(s,"material",o.material,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function j7e(e,t,n,i){let o=t.point;if(!u(o))return;let r=cr(o.interval),s=e.point;u(s)||(e.point=s=new Q0),ge(Boolean,s,"show",o.show,r,i,n),ge(Number,s,"pixelSize",o.pixelSize,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(z,s,"color",o.color,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Pt,s,"scaleByDistance",o.scaleByDistance,r,i,n),ge(Pt,s,"translucencyByDistance",o.translucencyByDistance,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Number,s,"disableDepthTestDistance",o.disableDepthTestDistance,r,i,n)}function dB(e){this.polygon=e,this._definitionChanged=new Ae}Object.defineProperties(dB.prototype,{isConstant:{get:function(){let e=this.polygon._positions,t=this.polygon._holes;return(!u(e)||e.isConstant)&&(!u(t)||t.isConstant)}},definitionChanged:{get:function(){return this._definitionChanged}}});dB.prototype.getValue=function(e,t){let n;u(this.polygon._positions)&&(n=this.polygon._positions.getValue(e));let i;return u(this.polygon._holes)&&(i=this.polygon._holes.getValue(e),u(i)&&(i=i.map(function(o){return new Dc(o)}))),u(t)?(t.positions=n,t.holes=i,t):new Dc(n,i)};dB.prototype.equals=function(e){return this===e||e instanceof dB&&Y.equals(this.polygon._positions,e.polygon._positions)&&Y.equals(this.polygon._holes,e.polygon._holes)};function Y7e(e,t,n,i){let o=t.polygon;if(!u(o))return;let r=cr(o.interval),s=e.polygon;u(s)||(e.polygon=s=new ed),ge(Boolean,s,"show",o.show,r,i,n),mB(s,"_positions",o.positions,n),O7e(s,"_holes",o.holes,n),(u(s._positions)||u(s._holes))&&(s.hierarchy=new dB(s)),ge(Number,s,"height",o.height,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),ge(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),ge(mf,s,"stRotation",o.stRotation,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Boolean,s,"perPositionHeight",o.perPositionHeight,r,i,n),ge(Boolean,s,"closeTop",o.closeTop,r,i,n),ge(Boolean,s,"closeBottom",o.closeBottom,r,i,n),ge(Kt,s,"arcType",o.arcType,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Un,s,"classificationType",o.classificationType,r,i,n),ge(Number,s,"zIndex",o.zIndex,r,i,n)}function q7e(e){return e?Kt.GEODESIC:Kt.NONE}function X7e(e,t,n,i){let o=t.polyline;if(!u(o))return;let r=cr(o.interval),s=e.polyline;if(u(s)||(e.polyline=s=new Ua),ge(Boolean,s,"show",o.show,r,i,n),mB(s,"positions",o.positions,n),ge(Number,s,"width",o.width,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),su(s,"material",o.material,r,i,n),su(s,"depthFailMaterial",o.depthFailMaterial,r,i,n),ge(Kt,s,"arcType",o.arcType,r,i,n),ge(Boolean,s,"clampToGround",o.clampToGround,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Un,s,"classificationType",o.classificationType,r,i,n),ge(Number,s,"zIndex",o.zIndex,r,i,n),u(o.followSurface)&&!u(o.arcType)){let a={};ge(Boolean,a,"followSurface",o.followSurface,r,i,n),s.arcType=f7e(a.followSurface,q7e)}}function K7e(e,t,n,i){let o=t.polylineVolume;if(!u(o))return;let r=cr(o.interval),s=e.polylineVolume;u(s)||(e.polylineVolume=s=new $0),mB(s,"positions",o.positions,n),R7e(s,"shape",o.shape,n),ge(Boolean,s,"show",o.show,r,i,n),ge(vi,s,"cornerType",o.cornerType,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function Z7e(e,t,n,i){let o=t.rectangle;if(!u(o))return;let r=cr(o.interval),s=e.rectangle;u(s)||(e.rectangle=s=new td),ge(Boolean,s,"show",o.show,r,i,n),ge(ce,s,"coordinates",o.coordinates,r,i,n),ge(Number,s,"height",o.height,r,i,n),ge(We,s,"heightReference",o.heightReference,r,i,n),ge(Number,s,"extrudedHeight",o.extrudedHeight,r,i,n),ge(We,s,"extrudedHeightReference",o.extrudedHeightReference,r,i,n),ge(mf,s,"rotation",o.rotation,r,i,n),ge(mf,s,"stRotation",o.stRotation,r,i,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n),ge(Un,s,"classificationType",o.classificationType,r,i,n),ge(Number,s,"zIndex",o.zIndex,r,i,n)}function J7e(e,t,n,i){let o=t.tileset;if(!u(o))return;let r=cr(o.interval),s=e.tileset;u(s)||(e.tileset=s=new J0),ge(Boolean,s,"show",o.show,r,i,n),ge(hB.default,s,"uri",o.uri,r,i,n),ge(Number,s,"maximumScreenSpaceError",o.maximumScreenSpaceError,r,i,n)}function Q7e(e,t,n,i){let o=t.wall;if(!u(o))return;let r=cr(o.interval),s=e.wall;u(s)||(e.wall=s=new tp),ge(Boolean,s,"show",o.show,r,i,n),mB(s,"positions",o.positions,n),Uce(s,"minimumHeights",o.minimumHeights,n),Uce(s,"maximumHeights",o.maximumHeights,n),ge(Number,s,"granularity",o.granularity,r,i,n),ge(Boolean,s,"fill",o.fill,r,i,n),su(s,"material",o.material,r,i,n),ge(Boolean,s,"outline",o.outline,r,i,n),ge(z,s,"outlineColor",o.outlineColor,r,i,n),ge(Number,s,"outlineWidth",o.outlineWidth,r,i,n),ge(gn,s,"shadows",o.shadows,r,i,n),ge(bt,s,"distanceDisplayCondition",o.distanceDisplayCondition,r,i,n)}function Wce(e,t,n,i,o){let r=e.id;if(u(r)||(r=zn()),X9=r,!u(o._version)&&r!=="document")throw new ue("The first CZML packet is required to be the document object.");if(e.delete===!0)t.removeById(r);else if(r==="document")U7e(e,o);else{let s=t.getOrCreateEntity(r),a=e.parent;u(a)&&(s.parent=t.getOrCreateEntity(a));for(let c=n.length-1;c>-1;c--)n[c](s,e,t,i)}X9=void 0}function $7e(e){let t,n=e._documentPacket.clock;if(!u(n)){if(!u(e._clock)){let o=e._entityCollection.computeAvailability();if(!o.start.equals(ze.MINIMUM_VALUE)){let r=o.start,s=o.stop,a=$.secondsDifference(s,r),c=Math.round(a/120);return t=new wd,t.startTime=$.clone(r),t.stopTime=$.clone(s),t.clockRange=Br.LOOP_STOP,t.multiplier=c,t.currentTime=$.clone(r),t.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,e._clock=t,!0}}return!1}u(e._clock)?t=e._clock.clone():(t=new wd,t.startTime=ze.MINIMUM_VALUE.clone(),t.stopTime=ze.MAXIMUM_VALUE.clone(),t.currentTime=ze.MINIMUM_VALUE.clone(),t.clockRange=Br.LOOP_STOP,t.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,t.multiplier=1);let i=cr(n.interval);return u(i)&&(t.startTime=i.start,t.stopTime=i.stop),u(n.currentTime)&&(t.currentTime=$.fromIso8601(n.currentTime)),u(n.range)&&(t.clockRange=y(Br[n.range],Br.LOOP_STOP)),u(n.step)&&(t.clockStep=y(uo[n.step],uo.SYSTEM_CLOCK_MULTIPLIER)),u(n.multiplier)&&(t.multiplier=n.multiplier),t.equals(e._clock)?!1:(e._clock=t.clone(e._clock),!0)}function Xce(e,t,n,i){n=y(n,y.EMPTY_OBJECT);let o=t,r=n.sourceUri,s=n.credit;if(typeof s=="string"&&(s=new Zt(s)),e._credit=s,typeof t=="string"||t instanceof Oe){t=Oe.createIfNeeded(t),o=t.fetchJson(),r=y(r,t.clone());let a=e._resourceCredits,c=t.credits;if(u(c)){let l=c.length;for(let f=0;f<l;f++)a.push(c[f])}}return r=Oe.createIfNeeded(r),Or.setLoading(e,!0),Promise.resolve(o).then(function(a){return eje(e,a,r,i)}).catch(function(a){return Or.setLoading(e,!1),e._error.raiseEvent(e,a),console.log(a),Promise.reject(a)})}function eje(e,t,n,i){Or.setLoading(e,!0);let o=e._entityCollection;i&&(e._version=void 0,e._documentPacket=new Kce,o.removeAll()),Al._processCzml(t,o,n,void 0,e);let r=$7e(e),s=e._documentPacket;return u(s.name)&&e._name!==s.name?(e._name=s.name,r=!0):!u(e._name)&&u(n)&&(e._name=e_(n.getUrlComponent()),r=!0),Or.setLoading(e,!1),r&&e._changed.raiseEvent(e),e}function Kce(){this.name=void 0,this.clock=void 0}function Al(e){this._name=e,this._changed=new Ae,this._error=new Ae,this._isLoading=!1,this._loading=new Ae,this._clock=void 0,this._documentPacket=new Kce,this._version=void 0,this._entityCollection=new Ss(this),this._entityCluster=new tu,this._credit=void 0,this._resourceCredits=[]}Al.load=function(e,t){return new Al().load(e,t)};Object.defineProperties(Al.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){this._entityCluster=e}},credit:{get:function(){return this._credit}}});Al.updaters=[L7e,N7e,F7e,V7e,k7e,z7e,H7e,G7e,T7e,E7e,W7e,j7e,Y7e,X7e,K7e,v7e,Z7e,b7e,J7e,S7e,Q7e,D7e,B7e];Al.prototype.process=function(e,t){return Xce(this,e,t,!1)};Al.prototype.load=function(e,t){return Xce(this,e,t,!0)};Al.prototype.update=function(e){return!0};Al.processPacketData=ge;Al.processPositionPacketData=qce;Al.processMaterialPacketData=su;Al._processCzml=function(e,t,n,i,o){if(i=y(i,Al.updaters),Array.isArray(e))for(let r=0,s=e.length;r<s;++r)Wce(e[r],t,i,n,o);else Wce(e,t,i,n,o)};var pB=Al;function Nc(){this._dataSources=[],this._dataSourceAdded=new Ae,this._dataSourceRemoved=new Ae,this._dataSourceMoved=new Ae}Object.defineProperties(Nc.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}}});Nc.prototype.add=function(e){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})};Nc.prototype.remove=function(e,t){t=y(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};Nc.prototype.removeAll=function(e){e=y(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=[]};Nc.prototype.contains=function(e){return this.indexOf(e)!==-1};Nc.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};Nc.prototype.get=function(e){return this._dataSources[e]};Nc.prototype.getByName=function(e){return this._dataSources.filter(function(t){return t.name===e})};function zU(e,t){return e.indexOf(t)}function Zce(e,t,n){let i=e._dataSources,o=i.length-1;if(t=P.clamp(t,0,o),n=P.clamp(n,0,o),t===n)return;let r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}Nc.prototype.raise=function(e){let t=zU(this._dataSources,e);Zce(this,t,t+1)};Nc.prototype.lower=function(e){let t=zU(this._dataSources,e);Zce(this,t,t-1)};Nc.prototype.raiseToTop=function(e){let t=zU(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))};Nc.prototype.lowerToBottom=function(e){let t=zU(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};Nc.prototype.isDestroyed=function(){return!1};Nc.prototype.destroy=function(){return this.removeAll(!0),le(this)};var _B=Nc;function qs(e){e=y(e,y.EMPTY_OBJECT),this._primitives=[],this._guid=zn(),this._zIndex=void 0,this.show=y(e.show,!0),this.destroyPrimitives=y(e.destroyPrimitives,!0)}Object.defineProperties(qs.prototype,{length:{get:function(){return this._primitives.length}}});qs.prototype.add=function(e,t){let n=u(t),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),e};qs.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(),!0}return!1};qs.prototype.removeAndDestroy=function(e){let t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};qs.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._primitives=[]};qs.prototype.contains=function(e){return!!(u(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function HU(e,t){return e._primitives.indexOf(t)}qs.prototype.raise=function(e){if(u(e)){let t=HU(this,e),n=this._primitives;if(t!==n.length-1){let i=n[t];n[t]=n[t+1],n[t+1]=i}}};qs.prototype.raiseToTop=function(e){if(u(e)){let t=HU(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};qs.prototype.lower=function(e){if(u(e)){let t=HU(this,e),n=this._primitives;if(t!==0){let i=n[t];n[t]=n[t-1],n[t-1]=i}}};qs.prototype.lowerToBottom=function(e){if(u(e)){let t=HU(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};qs.prototype.get=function(e){return this._primitives[e]};qs.prototype.update=function(e){if(!this.show)return;let t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};qs.prototype.prePassesUpdate=function(e){let t=this._primitives;for(let n=0;n<t.length;++n){let i=t[n];u(i.prePassesUpdate)&&i.prePassesUpdate(e)}};qs.prototype.updateForPass=function(e,t){let n=this._primitives;for(let i=0;i<n.length;++i){let o=n[i];u(o.updateForPass)&&o.updateForPass(e,t)}};qs.prototype.postPassesUpdate=function(e){let t=this._primitives;for(let n=0;n<t.length;++n){let i=t[n];u(i.postPassesUpdate)&&i.postPassesUpdate(e)}};qs.prototype.isDestroyed=function(){return!1};qs.prototype.destroy=function(){return this.removeAll(),le(this)};var xl=qs;function jh(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties(jh.prototype,{length:{get:function(){return this._length}}});jh.prototype.add=function(e,t){t=y(t,0);let n=this._collections[t];if(!u(n)){n=new xl({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};jh.prototype.set=function(e,t){return t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};jh.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};jh.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};jh.prototype.contains=function(e){if(!u(e))return!1;let t=this._collections[e._zIndex];return u(t)&&t.contains(e)};jh.prototype.update=function(e){if(!this.show)return;let t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};jh.prototype.isDestroyed=function(){return!1};jh.prototype.destroy=function(){return this.removeAll(),le(this)};var gB=jh;function HE(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new xt}HE.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};HE.prototype.remove=function(e){let t=e.id,n=this._dynamicUpdaters.get(t);u(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};HE.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};HE.prototype.removeAllPrimitives=function(){let e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};HE.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),u(e)&&u(e.getBoundingSphere)?e.getBoundingSphere(t):at.FAILED};var fx=HE;var Q9={},GU=new h,Jce=new h,Qce=new Le,$ce=new Z;function GE(e,t,n,i,o,r,s,a,c,l){let f=e+t;h.multiplyByScalar(i,Math.cos(f),GU),h.multiplyByScalar(n,Math.sin(f),Jce),h.add(GU,Jce,GU);let d=Math.cos(e);d=d*d;let p=Math.sin(e);p=p*p;let m=r/Math.sqrt(s*d+o*p)/a;return Le.fromAxisAngle(GU,m,Qce),Z.fromQuaternion(Qce,$ce),Z.multiplyByVector($ce,c,l),h.normalize(l,l),h.multiplyByScalar(l,a,l),l}var ele=new h,tle=new h,J9=new h,tje=new h;Q9.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),c=e.length,l=n?c:0;for(let f=0;f<c;f+=3){let d=f+1,p=f+2,g=h.fromArray(e,f,ele);i.scaleToGeodeticSurface(g,g);let m=h.clone(g,tle),A=i.geodeticSurfaceNormal(g,tje),x=h.multiplyByScalar(A,o,J9);h.add(g,x,g),n&&(h.multiplyByScalar(A,r,x),h.add(m,x,m),a[f+l]=m.x,a[d+l]=m.y,a[p+l]=m.z),a[f]=g.x,a[d]=g.y,a[p]=g.z}return a};var nje=new h,ije=new h,oje=new h;Q9.computeEllipsePositions=function(e,t,n){let i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=e.granularity*8,c=i*i,l=o*o,f=o*i,d=h.magnitude(s),p=h.normalize(s,nje),g=h.cross(h.UNIT_Z,s,ije);g=h.normalize(g,g);let m=h.cross(p,g,oje),A=1+Math.ceil(P.PI_OVER_TWO/a),x=P.PI_OVER_TWO/(A-1),C=P.PI_OVER_TWO-A*x;C<0&&(A-=Math.ceil(Math.abs(C)/x));let T=2*(A*(A+2)),E=t?new Array(T*3):void 0,S=0,D=ele,w=tle,R=A*4*3,O=R-1,L=0,N=n?new Array(R):void 0,_,b,v,I,B;for(C=P.PI_OVER_TWO,D=GE(C,r,m,g,c,f,l,d,p,D),t&&(E[S++]=D.x,E[S++]=D.y,E[S++]=D.z),n&&(N[O--]=D.z,N[O--]=D.y,N[O--]=D.x),C=P.PI_OVER_TWO-x,_=1;_<A+1;++_){if(D=GE(C,r,m,g,c,f,l,d,p,D),w=GE(Math.PI-C,r,m,g,c,f,l,d,p,w),t){for(E[S++]=D.x,E[S++]=D.y,E[S++]=D.z,v=2*_+2,b=1;b<v-1;++b)I=b/(v-1),B=h.lerp(D,w,I,J9),E[S++]=B.x,E[S++]=B.y,E[S++]=B.z;E[S++]=w.x,E[S++]=w.y,E[S++]=w.z}n&&(N[O--]=D.z,N[O--]=D.y,N[O--]=D.x,N[L++]=w.x,N[L++]=w.y,N[L++]=w.z),C=P.PI_OVER_TWO-(_+1)*x}for(_=A;_>1;--_){if(C=P.PI_OVER_TWO-(_-1)*x,D=GE(-C,r,m,g,c,f,l,d,p,D),w=GE(C+Math.PI,r,m,g,c,f,l,d,p,w),t){for(E[S++]=D.x,E[S++]=D.y,E[S++]=D.z,v=2*(_-1)+2,b=1;b<v-1;++b)I=b/(v-1),B=h.lerp(D,w,I,J9),E[S++]=B.x,E[S++]=B.y,E[S++]=B.z;E[S++]=w.x,E[S++]=w.y,E[S++]=w.z}n&&(N[O--]=D.z,N[O--]=D.y,N[O--]=D.x,N[L++]=w.x,N[L++]=w.y,N[L++]=w.z)}C=P.PI_OVER_TWO,D=GE(-C,r,m,g,c,f,l,d,p,D);let F={};return t&&(E[S++]=D.x,E[S++]=D.y,E[S++]=D.z,F.positions=E,F.numPts=A),n&&(N[O--]=D.z,N[O--]=D.y,N[O--]=D.x,F.outerPositions=N),F};var Cl=Q9;var WE=new h,$9=new h,eW=new h,nle=new h,us=new H,ile=new Z,rje=new Z,tW=new Le,ole=new h,rle=new h,sle=new h,YU=new he,ale=new h,cle=new H,lle=new H;function ule(e,t,n){let i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,c=t.stRotation,l=n?e.length/3*2:e.length/3,f=t.shadowVolume,d=i.st?new Float32Array(l*2):void 0,p=i.normal?new Float32Array(l*3):void 0,g=i.tangent?new Float32Array(l*3):void 0,m=i.bitangent?new Float32Array(l*3):void 0,A=f?new Float32Array(l*3):void 0,x=0,C=ole,T=rle,E=sle,S=new Ei(a),D=S.project(a.cartesianToCartographic(o,YU),ale),w=a.scaleToGeodeticSurface(o,WE);a.geodeticSurfaceNormal(w,w);let R=ile,O=rje;if(c!==0){let B=Le.fromAxisAngle(w,c,tW);R=Z.fromQuaternion(B,R),B=Le.fromAxisAngle(w,-c,tW),O=Z.fromQuaternion(B,O)}else R=Z.clone(Z.IDENTITY,R),O=Z.clone(Z.IDENTITY,O);let L=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,cle),N=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,lle),_=e.length,b=n?_:0,v=b/3*2;for(let B=0;B<_;B+=3){let F=B+1,k=B+2,U=h.fromArray(e,B,WE);if(i.st){let G=Z.multiplyByVector(R,U,$9),V=S.project(a.cartesianToCartographic(G,YU),eW);h.subtract(V,D,V),us.x=(V.x+r)/(2*r),us.y=(V.y+s)/(2*s),L.x=Math.min(us.x,L.x),L.y=Math.min(us.y,L.y),N.x=Math.max(us.x,N.x),N.y=Math.max(us.y,N.y),n&&(d[x+v]=us.x,d[x+1+v]=us.y),d[x++]=us.x,d[x++]=us.y}(i.normal||i.tangent||i.bitangent||f)&&(C=a.geodeticSurfaceNormal(U,C),f&&(A[B+b]=-C.x,A[F+b]=-C.y,A[k+b]=-C.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(T=h.normalize(h.cross(h.UNIT_Z,C,T),T),Z.multiplyByVector(O,T,T)),i.normal&&(p[B]=C.x,p[F]=C.y,p[k]=C.z,n&&(p[B+b]=-C.x,p[F+b]=-C.y,p[k+b]=-C.z)),i.tangent&&(g[B]=T.x,g[F]=T.y,g[k]=T.z,n&&(g[B+b]=-T.x,g[F+b]=-T.y,g[k+b]=-T.z)),i.bitangent&&(E=h.normalize(h.cross(C,T,E),E),m[B]=E.x,m[F]=E.y,m[k]=E.z,n&&(m[B+b]=E.x,m[F+b]=E.y,m[k+b]=E.z))))}if(i.st){_=d.length;for(let B=0;B<_;B+=2)d[B]=(d[B]-L.x)/(N.x-L.x),d[B+1]=(d[B+1]-L.y)/(N.y-L.y)}let I=new dn;if(i.position){let B=Cl.raisePositionsToHeight(e,t,n);I.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:B})}if(i.st&&(I.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:d})),i.normal&&(I.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:p})),i.tangent&&(I.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(I.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:m})),f&&(I.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:A})),n&&u(t.offsetAttribute)){let B=new Uint8Array(l);if(t.offsetAttribute===nn.TOP)B=B.fill(1,0,l/2);else{let F=t.offsetAttribute===nn.NONE?0:1;B=B.fill(F)}I.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:B})}return I}function fle(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 dx=new h;function sje(e){let t=e.center;dx=h.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,dx),e.height,dx),dx=h.add(t,dx,dx);let n=new se(dx,e.semiMajorAxis),i=Cl.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=ule(o,e,!1),a=fle(r);return a=Fe.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function aje(e,t){let n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,c=t.extrudedHeight,l=t.stRotation,f=e.length/3*2,d=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,A=n.bitangent?new Float32Array(f*3):void 0,x=t.shadowVolume,C=x?new Float32Array(f*3):void 0,T=0,E=ole,S=rle,D=sle,w=new Ei(s),R=w.project(s.cartesianToCartographic(i,YU),ale),O=s.scaleToGeodeticSurface(i,WE);s.geodeticSurfaceNormal(O,O);let L=Le.fromAxisAngle(O,l,tW),N=Z.fromQuaternion(L,ile),_=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,cle),b=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,lle),v=e.length,I=v/3*2;for(let F=0;F<v;F+=3){let k=F+1,U=F+2,G=h.fromArray(e,F,WE),V;if(n.st){let j=Z.multiplyByVector(N,G,$9),Q=w.project(s.cartesianToCartographic(j,YU),eW);h.subtract(Q,R,Q),us.x=(Q.x+o)/(2*o),us.y=(Q.y+r)/(2*r),_.x=Math.min(us.x,_.x),_.y=Math.min(us.y,_.y),b.x=Math.max(us.x,b.x),b.y=Math.max(us.y,b.y),p[T+I]=us.x,p[T+1+I]=us.y,p[T++]=us.x,p[T++]=us.y}G=s.scaleToGeodeticSurface(G,G),V=h.clone(G,$9),E=s.geodeticSurfaceNormal(G,E),x&&(C[F+v]=-E.x,C[k+v]=-E.y,C[U+v]=-E.z);let X=h.multiplyByScalar(E,a,nle);if(G=h.add(G,X,G),X=h.multiplyByScalar(E,c,X),V=h.add(V,X,V),n.position&&(d[F+v]=V.x,d[k+v]=V.y,d[U+v]=V.z,d[F]=G.x,d[k]=G.y,d[U]=G.z),n.normal||n.tangent||n.bitangent){D=h.clone(E,D);let j=h.fromArray(e,(F+3)%v,nle);h.subtract(j,G,j);let Q=h.subtract(V,G,eW);E=h.normalize(h.cross(Q,j,E),E),n.normal&&(g[F]=E.x,g[k]=E.y,g[U]=E.z,g[F+v]=E.x,g[k+v]=E.y,g[U+v]=E.z),n.tangent&&(S=h.normalize(h.cross(D,E,S),S),m[F]=S.x,m[k]=S.y,m[U]=S.z,m[F+v]=S.x,m[F+1+v]=S.y,m[F+2+v]=S.z),n.bitangent&&(A[F]=D.x,A[k]=D.y,A[U]=D.z,A[F+v]=D.x,A[k+v]=D.y,A[U+v]=D.z)}}if(n.st){v=p.length;for(let F=0;F<v;F+=2)p[F]=(p[F]-_.x)/(b.x-_.x),p[F+1]=(p[F+1]-_.y)/(b.y-_.y)}let B=new dn;if(n.position&&(B.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:d})),n.st&&(B.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:p})),n.normal&&(B.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(B.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:m})),n.bitangent&&(B.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:A})),x&&(B.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:C})),u(t.offsetAttribute)){let F=new Uint8Array(f);if(t.offsetAttribute===nn.TOP)F=F.fill(1,0,f/2);else{let k=t.offsetAttribute===nn.NONE?0:1;F=F.fill(k)}B.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}return B}function cje(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,c=a+t;n[i++]=r,n[i++]=s,n[i++]=a,n[i++]=a,n[i++]=s,n[i++]=c}return n}var WU=new se,jU=new se;function lje(e){let t=e.center,n=e.ellipsoid,i=e.semiMajorAxis,o=h.multiplyByScalar(n.geodeticSurfaceNormal(t,WE),e.height,WE);WU.center=h.add(t,o,WU.center),WU.radius=i,o=h.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),jU.center=h.add(t,o,jU.center),jU.radius=i;let r=Cl.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,c=r.outerPositions,l=se.union(WU,jU),f=ule(s,e,!0),d=fle(a),p=d.length;d.length=p*2;let g=s.length/3;for(let S=0;S<p;S+=3)d[S+p]=d[S+2]+g,d[S+1+p]=d[S+1]+g,d[S+2+p]=d[S]+g;let m=Fe.createTypedArray(g*2/3,d),A=new ct({attributes:f,indices:m,primitiveType:Me.TRIANGLES}),x=aje(c,e);d=cje(c);let C=Fe.createTypedArray(c.length*2/3,d),T=new ct({attributes:x,indices:C,primitiveType:Me.TRIANGLES}),E=Ln.combineInstances([new At({geometry:A}),new At({geometry:T})]);return{boundingSphere:l,attributes:E[0].attributes,indices:E[0].indices}}function dle(e,t,n,i,o,r,s){let c=Cl.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,l=c.length/3,f=new Array(l);for(let p=0;p<l;++p)f[p]=h.fromArray(c,p*3);let d=ce.fromCartesianArray(f,r,s);return d.width>P.PI&&(d.north=d.north>0?P.PI_OVER_TWO-P.EPSILON7:d.north,d.south=d.south<0?P.EPSILON7-P.PI_OVER_TWO:d.south,d.east=P.PI,d.west=-P.PI),d}function qh(e){e=y(e,y.EMPTY_OBJECT);let t=e.center,n=y(e.ellipsoid,ie.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=y(e.granularity,P.RADIANS_PER_DEGREE),s=y(e.vertexFormat,Ie.DEFAULT),a=y(e.height,0),c=y(e.extrudedHeight,a);this._center=h.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ie.clone(n),this._rotation=y(e.rotation,0),this._stRotation=y(e.stRotation,0),this._height=Math.max(c,a),this._granularity=r,this._vertexFormat=Ie.clone(s),this._extrudedHeight=Math.min(c,a),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}qh.packedLength=h.packedLength+ie.packedLength+Ie.packedLength+9;qh.pack=function(e,t,n){return n=y(n,0),h.pack(e._center,t,n),n+=h.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]=y(e._offsetAttribute,-1),t};var hle=new h,mle=new ie,ple=new Ie,Yh={center:hle,ellipsoid:mle,vertexFormat:ple,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};qh.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,hle);t+=h.packedLength;let o=ie.unpack(e,t,mle);t+=ie.packedLength;let r=Ie.unpack(e,t,ple);t+=Ie.packedLength;let s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++],p=e[t++],g=e[t++]===1,m=e[t];return u(n)?(n._center=h.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=c,n._stRotation=l,n._height=f,n._granularity=d,n._extrudedHeight=p,n._shadowVolume=g,n._offsetAttribute=m===-1?void 0:m,n):(Yh.height=f,Yh.extrudedHeight=p,Yh.granularity=d,Yh.stRotation=l,Yh.rotation=c,Yh.semiMajorAxis=s,Yh.semiMinorAxis=a,Yh.shadowVolume=g,Yh.offsetAttribute=m===-1?void 0:m,new qh(Yh))};qh.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.center,i=y(e.ellipsoid,ie.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=y(e.granularity,P.RADIANS_PER_DEGREE),a=y(e.rotation,0);return dle(n,o,r,a,s,i,t)};qh.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;let t=e._height,n=e._extrudedHeight,i=!P.equalsEpsilon(t,n,0,P.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=lje(o);else if(r=sje(o),u(e._offsetAttribute)){let s=r.attributes.position.values.length,a=e._offsetAttribute===nn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new ct({attributes:r.attributes,indices:r.indices,primitiveType:Me.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};qh.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new qh({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 uje(e){let t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];let i=Cl.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 c=0;c<o;++c)r[c]=h.fromArray(i,c*3);let s=e._ellipsoid,a=e.rectangle;return ct._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(qh.prototype,{rectangle:{get:function(){return u(this._rectangle)||(this._rectangle=dle(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return u(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=uje(this)),this._textureCoordinateRotationPoints}}});var Fc=qh;var _le=new h,hx=new h;function fje(e){let t=e.center;hx=h.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,hx),e.height,hx),hx=h.add(t,hx,hx);let n=new se(hx,e.semiMajorAxis),i=Cl.computeEllipsePositions(e,!1,!0).outerPositions,o=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:Cl.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=Fe.createTypedArray(r,r*2),a=0;for(let c=0;c<r;++c)s[a++]=c,s[a++]=(c+1)%r;return{boundingSphere:n,attributes:o,indices:s}}var qU=new se,XU=new se;function dje(e){let t=e.center,n=e.ellipsoid,i=e.semiMajorAxis,o=h.multiplyByScalar(n.geodeticSurfaceNormal(t,_le),e.height,_le);qU.center=h.add(t,o,qU.center),qU.radius=i,o=h.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),XU.center=h.add(t,o,XU.center),XU.radius=i;let r=Cl.computeEllipsePositions(e,!1,!0).outerPositions,s=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:Cl.raisePositionsToHeight(r,e,!0)})});r=s.position.values;let a=se.union(qU,XU),c=r.length/3;if(u(e.offsetAttribute)){let m=new Uint8Array(c);if(e.offsetAttribute===nn.TOP)m=m.fill(1,0,c/2);else{let A=e.offsetAttribute===nn.NONE?0:1;m=m.fill(A)}s.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}let l=y(e.numberOfVerticalLines,16);l=P.clamp(l,0,c/2);let f=Fe.createTypedArray(c,c*2+l*2);c/=2;let d=0,p;for(p=0;p<c;++p)f[d++]=p,f[d++]=(p+1)%c,f[d++]=p+c,f[d++]=(p+1)%c+c;let g;if(l>0){let m=Math.min(l,c);g=Math.round(c/m);let A=Math.min(g*l,c);for(p=0;p<A;p+=g)f[d++]=p,f[d++]=p+c}return{boundingSphere:a,attributes:s,indices:f}}function jE(e){e=y(e,y.EMPTY_OBJECT);let t=e.center,n=y(e.ellipsoid,ie.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=y(e.granularity,P.RADIANS_PER_DEGREE),s=y(e.height,0),a=y(e.extrudedHeight,s);this._center=h.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ie.clone(n),this._rotation=y(e.rotation,0),this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(y(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}jE.packedLength=h.packedLength+ie.packedLength+8;jE.pack=function(e,t,n){return n=y(n,0),h.pack(e._center,t,n),n+=h.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]=y(e._offsetAttribute,-1),t};var gle=new h,yle=new ie,s_={center:gle,ellipsoid:yle,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};jE.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,gle);t+=h.packedLength;let o=ie.unpack(e,t,yle);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++],p=e[t];return u(n)?(n._center=h.clone(i,n._center),n._ellipsoid=ie.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=c,n._granularity=l,n._extrudedHeight=f,n._numberOfVerticalLines=d,n._offsetAttribute=p===-1?void 0:p,n):(s_.height=c,s_.extrudedHeight=f,s_.granularity=l,s_.rotation=a,s_.semiMajorAxis=r,s_.semiMinorAxis=s,s_.numberOfVerticalLines=d,s_.offsetAttribute=p===-1?void 0:p,new jE(s_))};jE.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;let t=e._height,n=e._extrudedHeight,i=!P.equalsEpsilon(t,n,0,P.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=dje(o);else if(r=fje(o),u(e._offsetAttribute)){let s=r.attributes.position.values.length,a=e._offsetAttribute===nn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new ct({attributes:r.attributes,indices:r.indices,primitiveType:Me.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};var au=jE;var Ale=new z,xle=h.ZERO,Cle=new h,Tle=new ce;function hje(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 Od(e,t){jn.call(this,{entity:e,scene:t,geometryOptions:new hje(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}u(Object.create)&&(Od.prototype=Object.create(jn.prototype),Od.prototype.constructor=Od);Od.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Mt){let o;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Ale)),u(o)||(o=z.WHITE),i.color=Nt.fromColor(o)}return u(this._options.offsetAttribute)&&(i.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,xle,Cle))),new At({id:t,geometry:new Fc(this._options),attributes:i})};Od.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Ale),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return u(this._options.offsetAttribute)&&(r.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,xle,Cle))),new At({id:t,geometry:new au(this._options),attributes:r})};Od.prototype._computeCenter=function(e,t){return Y.getValueOrUndefined(this._entity.position,e,t)};Od.prototype._isHidden=function(e,t){let n=e.position;return!u(n)||!u(t.semiMajorAxis)||!u(t.semiMinorAxis)||si.prototype._isHidden.call(this,e,t)};Od.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Y.isConstant(t.rotation)||!Y.isConstant(t.height)||!Y.isConstant(t.extrudedHeight)||!Y.isConstant(t.granularity)||!Y.isConstant(t.stRotation)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.numberOfVerticalLines)||!Y.isConstant(t.zIndex)||this._onTerrain&&!Y.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Mt)};Od.prototype._setStaticOptions=function(e,t){let n=Y.getValueOrUndefined(t.height,ze.MINIMUM_VALUE),i=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),o=Y.getValueOrUndefined(t.extrudedHeight,ze.MINIMUM_VALUE),r=Y.getValueOrDefault(t.extrudedHeightReference,ze.MINIMUM_VALUE,We.NONE);u(o)&&!u(n)&&(n=0);let s=this._options;s.vertexFormat=this._materialProperty instanceof Mt?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(ze.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(ze.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(ze.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=Y.getValueOrUndefined(t.rotation,ze.MINIMUM_VALUE),s.granularity=Y.getValueOrUndefined(t.granularity,ze.MINIMUM_VALUE),s.stRotation=Y.getValueOrUndefined(t.stRotation,ze.MINIMUM_VALUE),s.numberOfVerticalLines=Y.getValueOrUndefined(t.numberOfVerticalLines,ze.MINIMUM_VALUE),s.offsetAttribute=jn.computeGeometryOffsetAttribute(n,i,o,r),s.height=jn.getGeometryHeight(n,i),o=jn.getGeometryExtrudedHeight(o,r),o===jn.CLAMP_TO_GROUND&&(o=fi.getMinimumMaximumHeights(Fc.computeRectangle(s,Tle)).minimumTerrainHeight),s.extrudedHeight=o};Od.DynamicGeometryUpdater=YE;function YE(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(YE.prototype=Object.create(ri.prototype),YE.prototype.constructor=YE);YE.prototype._isHidden=function(e,t,n){let i=this._options;return!u(i.center)||!u(i.semiMajorAxis)||!u(i.semiMinorAxis)||ri.prototype._isHidden.call(this,e,t,n)};YE.prototype._setOptions=function(e,t,n){let i=this._options,o=Y.getValueOrUndefined(t.height,n),r=Y.getValueOrDefault(t.heightReference,n,We.NONE),s=Y.getValueOrUndefined(t.extrudedHeight,n),a=Y.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);u(s)&&!u(o)&&(o=0),i.center=Y.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=Y.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=Y.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=Y.getValueOrUndefined(t.rotation,n),i.granularity=Y.getValueOrUndefined(t.granularity,n),i.stRotation=Y.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=Y.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=jn.computeGeometryOffsetAttribute(o,r,s,a),i.height=jn.getGeometryHeight(o,r),s=jn.getGeometryExtrudedHeight(s,a),s===jn.CLAMP_TO_GROUND&&(s=fi.getMinimumMaximumHeights(Fc.computeRectangle(i,Tle)).minimumTerrainHeight),i.extrudedHeight=s};var yB=Od;var mje=new h,pje=new h,_je=new h,gje=new h,yje=new h,Aje=new h(1,1,1),Ele=Math.cos,ble=Math.sin;function a_(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.radii,Aje),n=y(e.innerRadii,t),i=y(e.minimumClock,0),o=y(e.maximumClock,P.TWO_PI),r=y(e.minimumCone,0),s=y(e.maximumCone,P.PI),a=Math.round(y(e.stackPartitions,64)),c=Math.round(y(e.slicePartitions,64)),l=y(e.vertexFormat,Ie.DEFAULT);this._radii=h.clone(t),this._innerRadii=h.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._vertexFormat=Ie.clone(l),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}a_.packedLength=2*h.packedLength+Ie.packedLength+7;a_.pack=function(e,t,n){return n=y(n,0),h.pack(e._radii,t,n),n+=h.packedLength,h.pack(e._innerRadii,t,n),n+=h.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]=y(e._offsetAttribute,-1),t};var Sle=new h,Dle=new h,vle=new Ie,ay={radii:Sle,innerRadii:Dle,vertexFormat:vle,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};a_.unpack=function(e,t,n){t=y(t,0);let i=h.unpack(e,t,Sle);t+=h.packedLength;let o=h.unpack(e,t,Dle);t+=h.packedLength;let r=Ie.unpack(e,t,vle);t+=Ie.packedLength;let s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++],p=e[t];return u(n)?(n._radii=h.clone(i,n._radii),n._innerRadii=h.clone(o,n._innerRadii),n._vertexFormat=Ie.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=c,n._maximumCone=l,n._stackPartitions=f,n._slicePartitions=d,n._offsetAttribute=p===-1?void 0:p,n):(ay.minimumClock=s,ay.maximumClock=a,ay.minimumCone=c,ay.maximumCone=l,ay.stackPartitions=f,ay.slicePartitions=d,ay.offsetAttribute=p===-1?void 0:p,new a_(ay))};a_.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,c=e._slicePartitions+1,l=e._stackPartitions+1;c=Math.round(c*Math.abs(o-i)/P.TWO_PI),l=Math.round(l*Math.abs(s-r)/P.PI),c<2&&(c=2),l<2&&(l=2);let f,d,p=0,g=[r],m=[i];for(f=0;f<l;f++)g.push(r+f*(s-r)/(l-1));for(g.push(s),d=0;d<c;d++)m.push(i+d*(o-i)/(c-1));m.push(o);let A=g.length,x=m.length,C=0,T=1,E=n.x!==t.x||n.y!==t.y||n.z!==t.z,S=!1,D=!1,w=!1;E&&(T=2,r>0&&(S=!0,C+=c-1),s<Math.PI&&(D=!0,C+=c-1),(o-i)%P.TWO_PI?(w=!0,C+=(l-1)*2+1):C+=1);let R=x*A*T,O=new Float64Array(R*3),L=new Array(R).fill(!1),N=new Array(R).fill(!1),_=c*l*T,b=6*(_+C+1-(c+l)*T),v=Fe.createTypedArray(_,b),I=a.normal?new Float32Array(R*3):void 0,B=a.tangent?new Float32Array(R*3):void 0,F=a.bitangent?new Float32Array(R*3):void 0,k=a.st?new Float32Array(R*2):void 0,U=new Array(A),G=new Array(A);for(f=0;f<A;f++)U[f]=ble(g[f]),G[f]=Ele(g[f]);let V=new Array(x),X=new Array(x);for(d=0;d<x;d++)X[d]=Ele(m[d]),V[d]=ble(m[d]);for(f=0;f<A;f++)for(d=0;d<x;d++)O[p++]=t.x*U[f]*X[d],O[p++]=t.y*U[f]*V[d],O[p++]=t.z*G[f];let j=R/2;if(E)for(f=0;f<A;f++)for(d=0;d<x;d++)O[p++]=n.x*U[f]*X[d],O[p++]=n.y*U[f]*V[d],O[p++]=n.z*G[f],L[j]=!0,f>0&&f!==A-1&&d!==0&&d!==x-1&&(N[j]=!0),j++;p=0;let Q,W;for(f=1;f<A-2;f++)for(Q=f*x,W=(f+1)*x,d=1;d<x-2;d++)v[p++]=W+d,v[p++]=W+d+1,v[p++]=Q+d+1,v[p++]=W+d,v[p++]=Q+d+1,v[p++]=Q+d;if(E){let mt=A*x;for(f=1;f<A-2;f++)for(Q=mt+f*x,W=mt+(f+1)*x,d=1;d<x-2;d++)v[p++]=W+d,v[p++]=Q+d,v[p++]=Q+d+1,v[p++]=W+d,v[p++]=Q+d+1,v[p++]=W+d+1}let K,J;if(E){if(S)for(J=A*x,f=1;f<x-2;f++)v[p++]=f,v[p++]=f+1,v[p++]=J+f+1,v[p++]=f,v[p++]=J+f+1,v[p++]=J+f;if(D)for(K=A*x-x,J=A*x*T-x,f=1;f<x-2;f++)v[p++]=K+f+1,v[p++]=K+f,v[p++]=J+f,v[p++]=K+f+1,v[p++]=J+f,v[p++]=J+f+1}if(w){for(f=1;f<A-2;f++)J=x*A+x*f,K=x*f,v[p++]=J,v[p++]=K+x,v[p++]=K,v[p++]=J,v[p++]=J+x,v[p++]=K+x;for(f=1;f<A-2;f++)J=x*A+x*(f+1)-1,K=x*(f+1)-1,v[p++]=K+x,v[p++]=J,v[p++]=K,v[p++]=K+x,v[p++]=J+x,v[p++]=J}let _e=new dn;a.position&&(_e.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:O}));let xe=0,re=0,ye=0,fe=0,Se=R/2,we,Ve=ie.fromCartesian3(t),qe=ie.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(f=0;f<R;f++){we=L[f]?qe:Ve;let mt=h.fromArray(O,f*3,mje),Ht=we.geodeticSurfaceNormal(mt,pje);if(N[f]&&h.negate(Ht,Ht),a.st){let fn=H.negate(Ht,yje);k[xe++]=Math.atan2(fn.y,fn.x)/P.TWO_PI+.5,k[xe++]=Math.asin(Ht.z)/Math.PI+.5}if(a.normal&&(I[re++]=Ht.x,I[re++]=Ht.y,I[re++]=Ht.z),a.tangent||a.bitangent){let fn=_je,dt=0,Tn;if(L[f]&&(dt=Se),!S&&f>=dt&&f<dt+x*2?Tn=h.UNIT_X:Tn=h.UNIT_Z,h.cross(Tn,Ht,fn),h.normalize(fn,fn),a.tangent&&(B[ye++]=fn.x,B[ye++]=fn.y,B[ye++]=fn.z),a.bitangent){let Jn=h.cross(Ht,fn,gje);h.normalize(Jn,Jn),F[fe++]=Jn.x,F[fe++]=Jn.y,F[fe++]=Jn.z}}}a.st&&(_e.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:k})),a.normal&&(_e.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:I})),a.tangent&&(_e.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:B})),a.bitangent&&(_e.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:F}))}if(u(e._offsetAttribute)){let mt=O.length,Ht=e._offsetAttribute===nn.NONE?0:1,fn=new Uint8Array(mt/3).fill(Ht);_e.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:fn})}return new ct({attributes:_e,indices:v,primitiveType:Me.TRIANGLES,boundingSphere:se.fromEllipsoid(Ve),offsetAttribute:e._offsetAttribute})};var nW;a_.getUnitEllipsoid=function(){return u(nW)||(nW=a_.createGeometry(new a_({radii:new h(1,1,1),vertexFormat:Ie.POSITION_ONLY}))),nW};var vs=a_;var xje=new Mt(z.WHITE),iW=h.ZERO,oW=new h,Cje=new h,Tje=new h,rW=new z,Eje=new h(1,1,1);function bje(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 cu(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new bje(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}u(Object.create)&&(cu.prototype=Object.create(si.prototype),cu.prototype.constructor=cu);Object.defineProperties(cu.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});cu.prototype.createFillGeometryInstance=function(e,t,n){let i=this._entity,o=i.isAvailable(e),r,s=new _n(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),c=Vn.fromDistanceDisplayCondition(a),l={show:s,distanceDisplayCondition:c,color:void 0,offset:void 0};if(this._materialProperty instanceof Mt){let f;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(f=this._materialProperty.color.getValue(e,rW)),u(f)||(f=z.WHITE),r=Nt.fromColor(f),l.color=r}return u(this._options.offsetAttribute)&&(l.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,iW,oW))),new At({id:i,geometry:new vs(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:l})};cu.prototype.createOutlineGeometryInstance=function(e,t,n){let i=this._entity,o=i.isAvailable(e),r=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,rW),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new _n(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(r),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(s),offset:void 0};return u(this._options.offsetAttribute)&&(a.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,iW,oW))),new At({id:i,geometry:new $l(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:a})};cu.prototype._computeCenter=function(e,t){return Y.getValueOrUndefined(this._entity.position,e,t)};cu.prototype._isHidden=function(e,t){return!u(e.position)||!u(t.radii)||si.prototype._isHidden.call(this,e,t)};cu.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Y.isConstant(e.orientation)||!t.radii.isConstant||!Y.isConstant(t.innerRadii)||!Y.isConstant(t.stackPartitions)||!Y.isConstant(t.slicePartitions)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.minimumClock)||!Y.isConstant(t.maximumClock)||!Y.isConstant(t.minimumCone)||!Y.isConstant(t.maximumCone)||!Y.isConstant(t.subdivisions)};cu.prototype._setStaticOptions=function(e,t){let n=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Mt?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(ze.MINIMUM_VALUE,i.radii),i.innerRadii=Y.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=Y.getValueOrUndefined(t.minimumClock,ze.MINIMUM_VALUE),i.maximumClock=Y.getValueOrUndefined(t.maximumClock,ze.MINIMUM_VALUE),i.minimumCone=Y.getValueOrUndefined(t.minimumCone,ze.MINIMUM_VALUE),i.maximumCone=Y.getValueOrUndefined(t.maximumCone,ze.MINIMUM_VALUE),i.stackPartitions=Y.getValueOrUndefined(t.stackPartitions,ze.MINIMUM_VALUE),i.slicePartitions=Y.getValueOrUndefined(t.slicePartitions,ze.MINIMUM_VALUE),i.subdivisions=Y.getValueOrUndefined(t.subdivisions,ze.MINIMUM_VALUE),i.offsetAttribute=n!==We.NONE?nn.ALL:void 0};cu.prototype._onEntityPropertyChanged=np;cu.DynamicGeometryUpdater=AB;function AB(e,t,n){ri.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new M,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 h,this._material={}}u(Object.create)&&(AB.prototype=Object.create(ri.prototype),AB.prototype.constructor=AB);AB.prototype.update=function(e){let t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Y.getValueOrDefault(n.show,e,!0)){u(this._primitive)&&(this._primitive.show=!1),u(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}let i=Y.getValueOrUndefined(n.radii,e,Cje),o=u(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,i.z*.5,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!u(o)||!u(i)){u(this._primitive)&&(this._primitive.show=!1),u(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}let r=Y.getValueOrDefault(n.fill,e,!0),s=Y.getValueOrDefault(n.outline,e,!1),a=Y.getValueOrClonedDefault(n.outlineColor,e,z.BLACK,rW),c=Wo.getValue(e,y(n.material,xje),this._material),l=Y.getValueOrUndefined(n.innerRadii,e,Tje),f=Y.getValueOrUndefined(n.minimumClock,e),d=Y.getValueOrUndefined(n.maximumClock,e),p=Y.getValueOrUndefined(n.minimumCone,e),g=Y.getValueOrUndefined(n.maximumCone,e),m=Y.getValueOrUndefined(n.stackPartitions,e),A=Y.getValueOrUndefined(n.slicePartitions,e),x=Y.getValueOrUndefined(n.subdivisions,e),C=Y.getValueOrDefault(n.outlineWidth,e,1),T=Y.getValueOrDefault(n.heightReference,e,We.NONE),E=T!==We.NONE?nn.ALL:void 0,S=this._scene.mode,D=S===te.SCENE3D&&T===We.NONE,w=this._options,R=this._geometryUpdater.shadowsProperty.getValue(e),L=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),N=Y.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,iW,oW);if(!D||this._lastSceneMode!==S||!u(this._primitive)||w.stackPartitions!==m||w.slicePartitions!==A||u(l)&&!h.equals(w.innerRadii!==l)||w.minimumClock!==f||w.maximumClock!==d||w.minimumCone!==p||w.maximumCone!==g||w.subdivisions!==x||this._lastOutlineWidth!==C||w.offsetAttribute!==E){let b=this._primitives;if(b.removeAndDestroy(this._primitive),b.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=S,this._lastOutlineWidth=C,w.stackPartitions=m,w.slicePartitions=A,w.subdivisions=x,w.offsetAttribute=E,w.radii=h.clone(D?Eje:i,w.radii),u(l))if(D){let F=h.magnitude(i);w.innerRadii=h.fromElements(l.x/F,l.y/F,l.z/F,w.innerRadii)}else w.innerRadii=h.clone(l,w.innerRadii);else w.innerRadii=void 0;w.minimumClock=f,w.maximumClock=d,w.minimumCone=p,w.maximumCone=g;let v=new oo({material:c,translucent:c.isTranslucent(),closed:!0});w.vertexFormat=v.vertexFormat;let I=this._geometryUpdater.createFillGeometryInstance(e,D,this._modelMatrix);this._primitive=b.add(new Dn({geometryInstances:I,appearance:v,asynchronous:!1,shadows:R}));let B=this._geometryUpdater.createOutlineGeometryInstance(e,D,this._modelMatrix);this._outlinePrimitive=b.add(new Dn({geometryInstances:B,appearance:new on({flat:!0,translucent:B.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(C)}}),asynchronous:!1,shadows:R})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=z.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=L,this._lastOffset=h.clone(N,this._lastOffset)}else if(this._primitive.ready){let b=this._primitive,v=this._outlinePrimitive;b.show=!0,v.show=!0,b.appearance.material=c;let I=this._attributes;u(I)||(I=b.getGeometryInstanceAttributes(t),this._attributes=I),r!==this._lastShow&&(I.show=_n.toValue(r,I.show),this._lastShow=r);let B=this._outlineAttributes;u(B)||(B=v.getGeometryInstanceAttributes(t),this._outlineAttributes=B),s!==this._lastOutlineShow&&(B.show=_n.toValue(s,B.show),this._lastOutlineShow=s),z.equals(a,this._lastOutlineColor)||(B.color=Nt.toValue(a,B.color),z.clone(a,this._lastOutlineColor)),bt.equals(L,this._lastDistanceDisplayCondition)||(I.distanceDisplayCondition=Vn.toValue(L,I.distanceDisplayCondition),B.distanceDisplayCondition=Vn.toValue(L,B.distanceDisplayCondition),bt.clone(L,this._lastDistanceDisplayCondition)),h.equals(N,this._lastOffset)||(I.offset=Wi.toValue(N,I.offset),B.offset=Wi.toValue(N,I.offset),h.clone(N,this._lastOffset))}D&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=M.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)};var xB=cu;function qE(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.vertexFormat,Ie.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}qE.packedLength=Ie.packedLength;qE.pack=function(e,t,n){return n=y(n,0),Ie.pack(e._vertexFormat,t,n),t};var wle=new Ie,Sje={vertexFormat:wle};qE.unpack=function(e,t,n){t=y(t,0);let i=Ie.unpack(e,t,wle);return u(n)?(n._vertexFormat=Ie.clone(i,n._vertexFormat),n):new qE(Sje)};var KU=new h(-.5,-.5,0),ZU=new h(.5,.5,0);qE.createGeometry=function(e){let t=e._vertexFormat,n=new dn,i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=KU.x,o[1]=KU.y,o[2]=0,o[3]=ZU.x,o[4]=KU.y,o[5]=0,o[6]=ZU.x,o[7]=ZU.y,o[8]=0,o[9]=KU.x,o[10]=ZU.y,o[11]=0,n.position=new ve({componentDatatype:q.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:q.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:q.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:q.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:q.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 se(h.ZERO,Math.sqrt(2))})};var CB=qE;function XE(){this._workerName="createPlaneOutlineGeometry"}XE.packedLength=0;XE.pack=function(e,t){return t};XE.unpack=function(e,t,n){return u(n)?n:new XE};var cy=new h(-.5,-.5,0),JU=new h(.5,.5,0);XE.createGeometry=function(){let e=new dn,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=cy.x,n[1]=cy.y,n[2]=cy.z,n[3]=JU.x,n[4]=cy.y,n[5]=cy.z,n[6]=JU.x,n[7]=JU.y,n[8]=cy.z,n[9]=cy.x,n[10]=JU.y,n[11]=cy.z,e.position=new ve({componentDatatype:q.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 se(h.ZERO,Math.sqrt(2))})};var TB=XE;var Dje=new h,Ile=new z;function vje(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function _f(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new vje(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}u(Object.create)&&(_f.prototype=Object.create(si.prototype),_f.prototype.constructor=_f);_f.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i,o,r=new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Mt){let g;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,Ile)),u(g)||(g=z.WHITE),o=Nt.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};let c=t.plane,l=this._options,f=t.computeModelMatrix(e),d=Y.getValueOrDefault(c.plane,e,l.plane),p=Y.getValueOrUndefined(c.dimensions,e,l.dimensions);return l.plane=d,l.dimensions=p,f=sW(d,p,f,f),new At({id:t,geometry:new CB(this._options),modelMatrix:f,attributes:i})};_f.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Ile),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options,a=t.computeModelMatrix(e),c=Y.getValueOrDefault(r.plane,e,s.plane),l=Y.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=c,s.dimensions=l,a=sW(c,l,a,a),new At({id:t,geometry:new TB,modelMatrix:a,attributes:{show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};_f.prototype._isHidden=function(e,t){return!u(t.plane)||!u(t.dimensions)||!u(e.position)||si.prototype._isHidden.call(this,e,t)};_f.prototype._getIsClosed=function(e){return!1};_f.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Y.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!Y.isConstant(t.outlineWidth)};_f.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Mt,i=this._options;i.vertexFormat=n?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(ze.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(ze.MINIMUM_VALUE,i.dimensions)};_f.DynamicGeometryUpdater=KE;function KE(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(KE.prototype=Object.create(ri.prototype),KE.prototype.constructor=KE);KE.prototype._isHidden=function(e,t,n){let i=this._options,o=Y.getValueOrUndefined(e.position,n,Dje);return!u(o)||!u(i.plane)||!u(i.dimensions)||ri.prototype._isHidden.call(this,e,t,n)};KE.prototype._setOptions=function(e,t,n){let i=this._options;i.plane=Y.getValueOrDefault(t.plane,n,i.plane),i.dimensions=Y.getValueOrUndefined(t.dimensions,n,i.dimensions)};var wje=new h,Ije=new h,Pje=new h,Oje=new h,Rje=new Z,Bje=new Z,Mje=new M;function sW(e,t,n,i){let o=e.normal,r=e.distance,s=h.multiplyByScalar(o,-r,Pje),a=h.clone(h.UNIT_Z,Ije);P.equalsEpsilon(Math.abs(h.dot(a,o)),1,P.EPSILON8)&&(a=h.clone(h.UNIT_Y,a));let c=h.cross(a,o,wje);a=h.cross(o,c,a),h.normalize(c,c),h.normalize(a,a);let l=Rje;Z.setColumn(l,0,c,l),Z.setColumn(l,1,a,l),Z.setColumn(l,2,o,l);let f=h.fromElements(t.x,t.y,1,Oje),d=Z.multiplyByScale(l,f,Bje),p=M.fromRotationTranslation(d,s,Mje);return M.multiplyTransformation(n,p,i)}_f.createPrimitiveMatrix=sW;var EB=_f;var Lje=new h,Nje=new Ye,Fje=new H,Vje=new H,Uje=new h,kje=new h,zje=new h,bB=new h,Hje=new h,Gje=new h,Ple=new Le,Wje=new Z,jje=new Z,Yje=new h;function qje(e,t,n,i,o,r,s,a,c){let l=e.positions,f=li.triangulate(e.positions2D,e.holes);f.length<3&&(f=[0,1,2]);let d=Fe.createTypedArray(l.length,f.length);d.set(f);let p=Wje;if(i!==0){let _=Le.fromAxisAngle(s,i,Ple);if(p=Z.fromQuaternion(_,p),t.tangent||t.bitangent){_=Le.fromAxisAngle(s,-i,Ple);let b=Z.fromQuaternion(_,jje);a=h.normalize(Z.multiplyByVector(b,a,a),a),t.bitangent&&(c=h.normalize(h.cross(s,a,c),c))}}else p=Z.clone(Z.IDENTITY,p);let g=Vje;t.st&&(g.x=n.x,g.y=n.y);let m=l.length,A=m*3,x=new Float64Array(A),C=t.normal?new Float32Array(A):void 0,T=t.tangent?new Float32Array(A):void 0,E=t.bitangent?new Float32Array(A):void 0,S=t.st?new Float32Array(m*2):void 0,D=0,w=0,R=0,O=0,L=0;for(let _=0;_<m;_++){let b=l[_];if(x[D++]=b.x,x[D++]=b.y,x[D++]=b.z,t.st)if(u(o)&&o.positions.length===m)S[L++]=o.positions[_].x,S[L++]=o.positions[_].y;else{let v=Z.multiplyByVector(p,b,Lje),I=r(v,Fje);H.subtract(I,g,I);let B=P.clamp(I.x/n.width,0,1),F=P.clamp(I.y/n.height,0,1);S[L++]=B,S[L++]=F}t.normal&&(C[w++]=s.x,C[w++]=s.y,C[w++]=s.z),t.tangent&&(T[O++]=a.x,T[O++]=a.y,T[O++]=a.z),t.bitangent&&(E[R++]=c.x,E[R++]=c.y,E[R++]=c.z)}let N=new dn;return t.position&&(N.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:x})),t.normal&&(N.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:C})),t.tangent&&(N.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:T})),t.bitangent&&(N.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:E})),t.st&&(N.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:S})),new ct({attributes:N,indices:d,primitiveType:Me.TRIANGLES})}function mx(e){e=y(e,y.EMPTY_OBJECT);let t=e.polygonHierarchy,n=e.textureCoordinates,i=y(e.vertexFormat,Ie.DEFAULT);this._vertexFormat=Ie.clone(i),this._polygonHierarchy=t,this._stRotation=y(e.stRotation,0),this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=Wn.computeHierarchyPackedLength(t,h)+Ie.packedLength+ie.packedLength+(u(n)?Wn.computeHierarchyPackedLength(n,H):1)+2}mx.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT);let t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new mx(t)};mx.pack=function(e,t,n){return n=y(n,0),n=Wn.packPolygonHierarchy(e._polygonHierarchy,t,n,h),ie.pack(e._ellipsoid,t,n),n+=ie.packedLength,Ie.pack(e._vertexFormat,t,n),n+=Ie.packedLength,t[n++]=e._stRotation,u(e._textureCoordinates)?n=Wn.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};var Xje=ie.clone(ie.UNIT_SPHERE),Kje=new Ie,Zje={polygonHierarchy:{}};mx.unpack=function(e,t,n){t=y(t,0);let i=Wn.unpackPolygonHierarchy(e,t,h);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,Xje);t+=ie.packedLength;let r=Ie.unpack(e,t,Kje);t+=Ie.packedLength;let s=e[t++],a=e[t]===-1?void 0:Wn.unpackPolygonHierarchy(e,t,H);u(a)?(t=a.startingIndex,delete a.startingIndex):t++;let c=e[t++];return u(n)||(n=new mx(Zje)),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=c,n};mx.createGeometry=function(e){let t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=u(o),s=n.positions;if(s=go(s,h.equalsEpsilon,!0),s.length<3)return;let a=Uje,c=kje,l=zje,f=Hje,d=Gje;if(!Hp.computeProjectTo2DArguments(s,bB,f,d))return;if(a=h.cross(f,d,a),a=h.normalize(a,a),!h.equalsEpsilon(bB,h.ZERO,P.EPSILON6)){let L=e._ellipsoid.geodeticSurfaceNormal(bB,Yje);h.dot(a,L)<0&&(a=h.negate(a,a),f=h.negate(f,f))}let g=Hp.createProjectPointsTo2DFunction(bB,f,d),m=Hp.createProjectPointTo2DFunction(bB,f,d);t.tangent&&(c=h.clone(f,c)),t.bitangent&&(l=h.clone(d,l));let A=Wn.polygonsFromHierarchy(n,r,g,!1),x=A.hierarchy,C=A.polygons,T=function(L){return L},E=r?Wn.polygonsFromHierarchy(o,!0,T,!1).polygons:void 0;if(x.length===0)return;s=x[0].outerRing;let S=se.fromPoints(s),D=Wn.computeBoundingRectangle(a,m,s,i,Nje),w=[];for(let L=0;L<C.length;L++){let N=new At({geometry:qje(C[L],t,D,i,r?E[L]:void 0,m,a,c,l)});w.push(N)}let R=Ln.combineInstances(w)[0];R.attributes.position.values=new Float64Array(R.attributes.position.values),R.indices=Fe.createTypedArray(R.attributes.position.values.length/3,R.indices);let O=R.attributes;return t.position||delete O.position,new ct({attributes:O,indices:R.indices,primitiveType:R.primitiveType,boundingSphere:S})};var SB=mx;var Jje=new he,Ole=new he;function Qje(e,t,n,i){let r=i.cartesianToCartographic(e,Jje).height,s=i.cartesianToCartographic(t,Ole);s.height=r,i.cartographicToCartesian(s,t);let a=i.cartesianToCartographic(n,Ole);a.height=r-100,i.cartographicToCartesian(a,n)}var $je=new Ye,eYe=new h,tYe=new h,nYe=new h,iYe=new h,oYe=new h,rYe=new h,QU=new h,Xh=new h,ZE=new h,sYe=new H,aYe=new H,cYe=new h,Rle=new Le,lYe=new Z,uYe=new Z;function aW(e){let t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=u(n.attributes.st)?n.attributes.st.values:void 0,s=o.length,a=e.wall,c=e.top||a,l=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){let f=e.boundingRectangle,d=e.tangentPlane,p=e.ellipsoid,g=e.stRotation,m=e.perPositionHeight,A=sYe;A.x=f.x,A.y=f.y;let x=t.st?new Float32Array(2*(s/3)):void 0,C;t.normal&&(m&&c&&!a?C=n.attributes.normal.values:C=new Float32Array(s));let T=t.tangent?new Float32Array(s):void 0,E=t.bitangent?new Float32Array(s):void 0,S=i?new Float32Array(s):void 0,D=0,w=0,R=tYe,O=nYe,L=iYe,N=!0,_=lYe,b=uYe;if(g!==0){let B=Le.fromAxisAngle(d._plane.normal,g,Rle);_=Z.fromQuaternion(B,_),B=Le.fromAxisAngle(d._plane.normal,-g,Rle),b=Z.fromQuaternion(B,b)}else _=Z.clone(Z.IDENTITY,_),b=Z.clone(Z.IDENTITY,b);let v=0,I=0;c&&l&&(v=s/2,I=s/3,s/=2);for(let B=0;B<s;B+=3){let F=h.fromArray(o,B,cYe);if(t.st&&!u(r)){let k=Z.multiplyByVector(_,F,eYe);k=p.scaleToGeodeticSurface(k,k);let U=d.projectPointOntoPlane(k,aYe);H.subtract(U,A,U);let G=P.clamp(U.x/f.width,0,1),V=P.clamp(U.y/f.height,0,1);l&&(x[D+I]=G,x[D+1+I]=V),c&&(x[D]=G,x[D+1]=V),D+=2}if(t.normal||t.tangent||t.bitangent||i){let k=w+1,U=w+2;if(a){if(B+3<s){let G=h.fromArray(o,B+3,oYe);if(N){let V=h.fromArray(o,B+s,rYe);m&&Qje(F,G,V,p),h.subtract(G,F,G),h.subtract(V,F,V),R=h.normalize(h.cross(V,G,R),R),N=!1}h.equalsEpsilon(G,F,P.EPSILON10)&&(N=!0)}(t.tangent||t.bitangent)&&(L=p.geodeticSurfaceNormal(F,L),t.tangent&&(O=h.normalize(h.cross(L,R,O),O)))}else R=p.geodeticSurfaceNormal(F,R),(t.tangent||t.bitangent)&&(m&&(QU=h.fromArray(C,w,QU),Xh=h.cross(h.UNIT_Z,QU,Xh),Xh=h.normalize(Z.multiplyByVector(b,Xh,Xh),Xh),t.bitangent&&(ZE=h.normalize(h.cross(QU,Xh,ZE),ZE))),O=h.cross(h.UNIT_Z,R,O),O=h.normalize(Z.multiplyByVector(b,O,O),O),t.bitangent&&(L=h.normalize(h.cross(R,O,L),L)));t.normal&&(e.wall?(C[w+v]=R.x,C[k+v]=R.y,C[U+v]=R.z):l&&(C[w+v]=-R.x,C[k+v]=-R.y,C[U+v]=-R.z),(c&&!m||a)&&(C[w]=R.x,C[k]=R.y,C[U]=R.z)),i&&(a&&(R=p.geodeticSurfaceNormal(F,R)),S[w+v]=-R.x,S[k+v]=-R.y,S[U+v]=-R.z),t.tangent&&(e.wall?(T[w+v]=O.x,T[k+v]=O.y,T[U+v]=O.z):l&&(T[w+v]=-O.x,T[k+v]=-O.y,T[U+v]=-O.z),c&&(m?(T[w]=Xh.x,T[k]=Xh.y,T[U]=Xh.z):(T[w]=O.x,T[k]=O.y,T[U]=O.z))),t.bitangent&&(l&&(E[w+v]=L.x,E[k+v]=L.y,E[U+v]=L.z),c&&(m?(E[w]=ZE.x,E[k]=ZE.y,E[U]=ZE.z):(E[w]=L.x,E[k]=L.y,E[U]=L.z))),w+=3}}t.st&&!u(r)&&(n.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:x})),t.normal&&(n.attributes.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:C})),t.tangent&&(n.attributes.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:T})),t.bitangent&&(n.attributes.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:E})),i&&(n.attributes.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:S}))}if(e.extrude&&u(e.offsetAttribute)){let f=o.length/3,d=new Uint8Array(f);if(e.offsetAttribute===nn.TOP)c&&l||a?d=d.fill(1,0,f/2):c&&(d=d.fill(1));else{let p=e.offsetAttribute===nn.NONE?0:1;d=d.fill(p)}n.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}return n}var fYe=new he,dYe=new he,ly={westOverIDL:0,eastOverIDL:0},JE=new Gu;function Lle(e,t,n,i,o){if(o=y(o,new ce),!u(e)||e.length<3)return o.west=0,o.north=0,o.south=0,o.east=0,o;if(n===Kt.RHUMB)return ce.fromCartesianArray(e,t,o);JE.ellipsoid.equals(t)||(JE=new Gu(void 0,void 0,t)),o.west=Number.POSITIVE_INFINITY,o.east=Number.NEGATIVE_INFINITY,o.south=Number.POSITIVE_INFINITY,o.north=Number.NEGATIVE_INFINITY,ly.westOverIDL=Number.POSITIVE_INFINITY,ly.eastOverIDL=Number.NEGATIVE_INFINITY;let r=1/P.chordLength(i,t.maximumRadius),s=e.length,a=t.cartesianToCartographic(e[0],dYe),c=fYe,l;for(let f=1;f<s;f++)l=c,c=a,a=t.cartesianToCartographic(e[f],l),JE.setEndPoints(c,a),Ble(JE,r,o,ly);return l=c,c=a,a=t.cartesianToCartographic(e[0],l),JE.setEndPoints(c,a),Ble(JE,r,o,ly),o.east-o.west>ly.eastOverIDL-ly.westOverIDL&&(o.west=ly.westOverIDL,o.east=ly.eastOverIDL,o.east>P.PI&&(o.east=o.east-P.TWO_PI),o.west>P.PI&&(o.west=o.west-P.TWO_PI)),o}var hYe=new he;function Ble(e,t,n,i){let o=e.surfaceDistance,r=Math.ceil(o*t),s=r>0?o/(r-1):Number.POSITIVE_INFINITY,a=0;for(let c=0;c<r;c++){let l=e.interpolateUsingSurfaceDistance(a,hYe);a+=s;let f=l.longitude,d=l.latitude;n.west=Math.min(n.west,f),n.east=Math.max(n.east,f),n.south=Math.min(n.south,d),n.north=Math.max(n.north,d);let p=f>=0?f:f+P.TWO_PI;i.westOverIDL=Math.min(i.westOverIDL,p),i.eastOverIDL=Math.max(i.eastOverIDL,p)}}var Mle=[];function mYe(e,t,n,i,o,r,s,a,c,l){let f={walls:[]},d;if(s||a){let T=Wn.createGeometryFromPositions(e,t,n,i,r,c,l),E=T.attributes.position.values,S=T.indices,D,w;if(s&&a){let R=E.concat(E);D=R.length/3,w=Fe.createTypedArray(D,S.length*2),w.set(S);let O=S.length,L=D/2;for(d=0;d<O;d+=3){let N=w[d]+L,_=w[d+1]+L,b=w[d+2]+L;w[d+O]=b,w[d+1+O]=_,w[d+2+O]=N}if(T.attributes.position.values=R,r&&c.normal){let N=T.attributes.normal.values;T.attributes.normal.values=new Float32Array(R.length),T.attributes.normal.values.set(N)}if(c.st&&u(n)){let N=T.attributes.st.values;T.attributes.st.values=new Float32Array(D*2),T.attributes.st.values=N.concat(N)}T.indices=w}else if(a){for(D=E.length/3,w=Fe.createTypedArray(D,S.length),d=0;d<S.length;d+=3)w[d]=S[d+2],w[d+1]=S[d+1],w[d+2]=S[d];T.indices=w}f.topAndBottom=new At({geometry:T})}let p=o.outerRing,g=ca.fromPoints(p,e),m=g.projectPointsOntoPlane(p,Mle),A=li.computeWindingOrder2D(m);A===Zr.CLOCKWISE&&(p=p.slice().reverse());let x=Wn.computeWallGeometry(p,n,e,i,r,l);f.walls.push(new At({geometry:x}));let C=o.holes;for(d=0;d<C.length;d++){let T=C[d];g=ca.fromPoints(T,e),m=g.projectPointsOntoPlane(T,Mle),A=li.computeWindingOrder2D(m),A===Zr.COUNTER_CLOCKWISE&&(T=T.slice().reverse()),x=Wn.computeWallGeometry(T,n,e,i,r,l),f.walls.push(new At({geometry:x}))}return f}function Rd(e){let t=e.polygonHierarchy,n=y(e.vertexFormat,Ie.DEFAULT),i=y(e.ellipsoid,ie.WGS84),o=y(e.granularity,P.RADIANS_PER_DEGREE),r=y(e.stRotation,0),s=e.textureCoordinates,a=y(e.perPositionHeight,!1),c=a&&u(e.extrudedHeight),l=y(e.height,0),f=y(e.extrudedHeight,l);if(!c){let d=Math.max(l,f);f=Math.min(l,f),l=d}this._vertexFormat=Ie.clone(n),this._ellipsoid=ie.clone(i),this._granularity=o,this._stRotation=r,this._height=l,this._extrudedHeight=f,this._closeTop=y(e.closeTop,!0),this._closeBottom=y(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=c,this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=y(e.arcType,Kt.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=Wn.computeHierarchyPackedLength(t,h)+ie.packedLength+Ie.packedLength+(s?Wn.computeHierarchyPackedLength(s,H):1)+12}Rd.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT);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 Rd(t)};Rd.pack=function(e,t,n){return n=y(n,0),n=Wn.packPolygonHierarchy(e._polygonHierarchy,t,n,h),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++]=y(e._offsetAttribute,-1),t[n++]=e._arcType,u(e._textureCoordinates)?n=Wn.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};var pYe=ie.clone(ie.UNIT_SPHERE),_Ye=new Ie,gYe={polygonHierarchy:{}};Rd.unpack=function(e,t,n){t=y(t,0);let i=Wn.unpackPolygonHierarchy(e,t,h);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,pYe);t+=ie.packedLength;let r=Ie.unpack(e,t,_Ye);t+=Ie.packedLength;let s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++]===1,d=e[t++]===1,p=e[t++]===1,g=e[t++]===1,m=e[t++]===1,A=e[t++],x=e[t++],C=e[t]===-1?void 0:Wn.unpackPolygonHierarchy(e,t,H);u(C)?(t=C.startingIndex,delete C.startingIndex):t++;let T=e[t++];return u(n)||(n=new Rd(gYe)),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=c,n._stRotation=l,n._perPositionHeightExtrude=f,n._perPositionHeight=d,n._closeTop=p,n._closeBottom=g,n._shadowVolume=m,n._offsetAttribute=A===-1?void 0:A,n._arcType=x,n._textureCoordinates=C,n.packedLength=T,n};Rd.computeRectangle=function(e,t){let n=y(e.granularity,P.RADIANS_PER_DEGREE),i=y(e.arcType,Kt.GEODESIC),o=e.polygonHierarchy,r=y(e.ellipsoid,ie.WGS84);return Lle(o.positions,r,i,n,t)};Rd.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,c=e._closeBottom,l=e._arcType,f=e._textureCoordinates,d=u(f),p=r.positions;if(p.length<3)return;let g=ca.fromPoints(p,n),m=Wn.polygonsFromHierarchy(r,d,g.projectPointsOntoPlane.bind(g),!s,n),A=m.hierarchy,x=m.polygons,C=function(v){return v},T=d?Wn.polygonsFromHierarchy(f,!0,C,!1).polygons:void 0;if(A.length===0)return;p=A[0].outerRing;let E=Wn.computeBoundingRectangle(g.plane.normal,g.projectPointOntoPlane.bind(g),p,o,$je),S=[],D=e._height,w=e._extrudedHeight,R=e._perPositionHeightExtrude||!P.equalsEpsilon(D,w,0,P.EPSILON2),O={perPositionHeight:s,vertexFormat:t,geometry:void 0,tangentPlane:g,boundingRectangle:E,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:l},L;if(R)for(O.extrude=!0,O.top=a,O.bottom=c,O.shadowVolume=e._shadowVolume,O.offsetAttribute=e._offsetAttribute,L=0;L<x.length;L++){let v=mYe(n,x[L],d?T[L]:void 0,i,A[L],s,a,c,t,l),I;a&&c?(I=v.topAndBottom,O.geometry=Wn.scaleToGeodeticHeightExtruded(I.geometry,D,w,n,s)):a?(I=v.topAndBottom,I.geometry.attributes.position.values=li.scaleToGeodeticHeight(I.geometry.attributes.position.values,D,n,!s),O.geometry=I.geometry):c&&(I=v.topAndBottom,I.geometry.attributes.position.values=li.scaleToGeodeticHeight(I.geometry.attributes.position.values,w,n,!0),O.geometry=I.geometry),(a||c)&&(O.wall=!1,I.geometry=aW(O),S.push(I));let B=v.walls;O.wall=!0;for(let F=0;F<B.length;F++){let k=B[F];O.geometry=Wn.scaleToGeodeticHeightExtruded(k.geometry,D,w,n,s),k.geometry=aW(O),S.push(k)}}else for(L=0;L<x.length;L++){let v=new At({geometry:Wn.createGeometryFromPositions(n,x[L],d?T[L]:void 0,i,s,t,l)});if(v.geometry.attributes.position.values=li.scaleToGeodeticHeight(v.geometry.attributes.position.values,D,n,!s),O.geometry=v.geometry,v.geometry=aW(O),u(e._offsetAttribute)){let I=v.geometry.attributes.position.values.length,B=e._offsetAttribute===nn.NONE?0:1,F=new Uint8Array(I/3).fill(B);v.geometry.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}S.push(v)}let N=Ln.combineInstances(S)[0];N.attributes.position.values=new Float64Array(N.attributes.position.values),N.indices=Fe.createTypedArray(N.attributes.position.values.length/3,N.indices);let _=N.attributes,b=se.fromVertices(_.position.values);return t.position||delete _.position,new ct({attributes:_,indices:N.indices,primitiveType:N.primitiveType,boundingSphere:b,offsetAttribute:e._offsetAttribute})};Rd.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Rd({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 yYe(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(Rd.prototype,{rectangle:{get:function(){if(!u(this._rectangle)){let e=this._polygonHierarchy.positions;this._rectangle=Lle(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return u(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=yYe(this)),this._textureCoordinateRotationPoints}}});var px=Rd;var Nle=[],$U=[];function AYe(e,t,n,i,o){let s=ca.fromPoints(t,e).projectPointsOntoPlane(t,Nle);li.computeWindingOrder2D(s)===Zr.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,l,f=t.length,d=0;if(i)for(c=new Float64Array(f*2*3),l=0;l<f;l++){let m=t[l],A=t[(l+1)%f];c[d++]=m.x,c[d++]=m.y,c[d++]=m.z,c[d++]=A.x,c[d++]=A.y,c[d++]=A.z}else{let m=0;if(o===Kt.GEODESIC)for(l=0;l<f;l++)m+=Wn.subdivideLineCount(t[l],t[(l+1)%f],n);else if(o===Kt.RHUMB)for(l=0;l<f;l++)m+=Wn.subdivideRhumbLineCount(e,t[l],t[(l+1)%f],n);for(c=new Float64Array(m*3),l=0;l<f;l++){let A;o===Kt.GEODESIC?A=Wn.subdivideLine(t[l],t[(l+1)%f],n,$U):o===Kt.RHUMB&&(A=Wn.subdivideRhumbLine(e,t[l],t[(l+1)%f],n,$U));let x=A.length;for(let C=0;C<x;++C)c[d++]=A[C]}}f=c.length/3;let p=f*2,g=Fe.createTypedArray(f,p);for(d=0,l=0;l<f-1;l++)g[d++]=l,g[d++]=l+1;return g[d++]=f-1,g[d++]=0,new At({geometry:new ct({attributes:new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:c})}),indices:g,primitiveType:Me.LINES})})}function xYe(e,t,n,i,o){let s=ca.fromPoints(t,e).projectPointsOntoPlane(t,Nle);li.computeWindingOrder2D(s)===Zr.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,l,f=t.length,d=new Array(f),p=0;if(i)for(c=new Float64Array(f*2*3*2),l=0;l<f;++l){d[l]=p/3;let x=t[l],C=t[(l+1)%f];c[p++]=x.x,c[p++]=x.y,c[p++]=x.z,c[p++]=C.x,c[p++]=C.y,c[p++]=C.z}else{let x=0;if(o===Kt.GEODESIC)for(l=0;l<f;l++)x+=Wn.subdivideLineCount(t[l],t[(l+1)%f],n);else if(o===Kt.RHUMB)for(l=0;l<f;l++)x+=Wn.subdivideRhumbLineCount(e,t[l],t[(l+1)%f],n);for(c=new Float64Array(x*3*2),l=0;l<f;++l){d[l]=p/3;let C;o===Kt.GEODESIC?C=Wn.subdivideLine(t[l],t[(l+1)%f],n,$U):o===Kt.RHUMB&&(C=Wn.subdivideRhumbLine(e,t[l],t[(l+1)%f],n,$U));let T=C.length;for(let E=0;E<T;++E)c[p++]=C[E]}}f=c.length/(3*2);let g=d.length,m=(f*2+g)*2,A=Fe.createTypedArray(f+g,m);for(p=0,l=0;l<f;++l)A[p++]=l,A[p++]=(l+1)%f,A[p++]=l+f,A[p++]=(l+1)%f+f;for(l=0;l<g;l++){let x=d[l];A[p++]=x,A[p++]=x+f}return new At({geometry:new ct({attributes:new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:c})}),indices:A,primitiveType:Me.LINES})})}function _x(e){let t=e.polygonHierarchy,n=y(e.ellipsoid,ie.WGS84),i=y(e.granularity,P.RADIANS_PER_DEGREE),o=y(e.perPositionHeight,!1),r=o&&u(e.extrudedHeight),s=y(e.arcType,Kt.GEODESIC),a=y(e.height,0),c=y(e.extrudedHeight,a);if(!r){let l=Math.max(a,c);c=Math.min(a,c),a=l}this._ellipsoid=ie.clone(n),this._granularity=i,this._height=a,this._extrudedHeight=c,this._arcType=s,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=Wn.computeHierarchyPackedLength(t,h)+ie.packedLength+8}_x.pack=function(e,t,n){return n=y(n,0),n=Wn.packPolygonHierarchy(e._polygonHierarchy,t,n,h),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++]=y(e._offsetAttribute,-1),t[n]=e.packedLength,t};var CYe=ie.clone(ie.UNIT_SPHERE),TYe={polygonHierarchy:{}};_x.unpack=function(e,t,n){t=y(t,0);let i=Wn.unpackPolygonHierarchy(e,t,h);t=i.startingIndex,delete i.startingIndex;let o=ie.unpack(e,t,CYe);t+=ie.packedLength;let r=e[t++],s=e[t++],a=e[t++],c=e[t++]===1,l=e[t++]===1,f=e[t++],d=e[t++],p=e[t];return u(n)||(n=new _x(TYe)),n._polygonHierarchy=i,n._ellipsoid=ie.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=l,n._perPositionHeightExtrude=c,n._arcType=f,n._offsetAttribute=d===-1?void 0:d,n.packedLength=p,n};_x.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT);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 _x(t)};_x.createGeometry=function(e){let t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=Wn.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a,c=[],l=P.chordLength(n,t.maximumRadius),f=e._height,d=e._extrudedHeight,p=e._perPositionHeightExtrude||!P.equalsEpsilon(f,d,0,P.EPSILON2),g,m;if(p)for(m=0;m<s.length;m++){if(a=xYe(t,s[m],l,o,r),a.geometry=Wn.scaleToGeodeticHeightExtruded(a.geometry,f,d,t,o),u(e._offsetAttribute)){let C=a.geometry.attributes.position.values.length/3,T=new Uint8Array(C);e._offsetAttribute===nn.TOP?T=T.fill(1,0,C/2):(g=e._offsetAttribute===nn.NONE?0:1,T=T.fill(g)),a.geometry.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}c.push(a)}else for(m=0;m<s.length;m++){if(a=AYe(t,s[m],l,o,r),a.geometry.attributes.position.values=li.scaleToGeodeticHeight(a.geometry.attributes.position.values,f,t,!o),u(e._offsetAttribute)){let C=a.geometry.attributes.position.values.length;g=e._offsetAttribute===nn.NONE?0:1;let T=new Uint8Array(C/3).fill(g);a.geometry.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}c.push(a)}let A=Ln.combineInstances(c)[0],x=se.fromVertices(A.attributes.position.values);return new ct({attributes:A.attributes,indices:A.indices,primitiveType:A.primitiveType,boundingSphere:x,offsetAttribute:e._offsetAttribute})};var DB=_x;var Fle="Entity polygons cannot have both height and perPositionHeight.  height will be ignored",Vle="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",Ule=new z,kle=h.ZERO,zle=new h,Hle=new ce,EYe=[],bYe=new H;function SYe(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 lu(e,t){jn.call(this,{entity:e,scene:t,geometryOptions:new SYe(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}u(Object.create)&&(lu.prototype=Object.create(jn.prototype),lu.prototype.constructor=lu);lu.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Mt){let s;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,Ule)),u(s)||(s=z.WHITE),o.color=Nt.fromColor(s)}u(i.offsetAttribute)&&(o.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,kle,zle)));let r;return i.perPositionHeight&&!u(i.extrudedHeight)?r=new SB(i):r=new px(i),new At({id:t,geometry:r,attributes:o})};lu.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=this._options,o=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Ule),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(o),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(r),offset:void 0};u(i.offsetAttribute)&&(s.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,kle,zle)));let a;return i.perPositionHeight&&!u(i.extrudedHeight)?a=new cf(i):a=new DB(i),new At({id:t,geometry:a,attributes:s})};lu.prototype._computeCenter=function(e,t){let n=Y.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!u(n))return;let i=n.positions;if(i.length===0)return;let o=this._scene.mapProjection.ellipsoid,r=ca.fromPoints(i,o),s=r.projectPointsOntoPlane(i,EYe),a=s.length,c=0,l=a-1,f=new H;for(let p=0;p<a;l=p++){let g=s[p],m=s[l],A=g.x*m.y-m.x*g.y,x=H.add(g,m,bYe);x=H.multiplyByScalar(x,A,x),f=H.add(f,x,f),c+=A}let d=1/(c*3);return f=H.multiplyByScalar(f,d,f),r.projectPointOntoEllipsoid(f,t)};lu.prototype._isHidden=function(e,t){return!u(t.hierarchy)||si.prototype._isHidden.call(this,e,t)};lu.prototype._isOnTerrain=function(e,t){let n=jn.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=u(i)&&(i.isConstant?i.getValue(ze.MINIMUM_VALUE):!0);return n&&!o};lu.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Y.isConstant(t.height)||!Y.isConstant(t.extrudedHeight)||!Y.isConstant(t.granularity)||!Y.isConstant(t.stRotation)||!Y.isConstant(t.textureCoordinates)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.perPositionHeight)||!Y.isConstant(t.closeTop)||!Y.isConstant(t.closeBottom)||!Y.isConstant(t.zIndex)||!Y.isConstant(t.arcType)||this._onTerrain&&!Y.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Mt)};lu.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Mt,i=this._options;i.vertexFormat=n?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat;let o=t.hierarchy.getValue(ze.MINIMUM_VALUE),r=Y.getValueOrUndefined(t.height,ze.MINIMUM_VALUE),s=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),a=Y.getValueOrUndefined(t.extrudedHeight,ze.MINIMUM_VALUE),c=Y.getValueOrDefault(t.extrudedHeightReference,ze.MINIMUM_VALUE,We.NONE),l=Y.getValueOrDefault(t.perPositionHeight,ze.MINIMUM_VALUE,!1);r=jn.getGeometryHeight(r,s);let f;l?(u(r)&&(r=void 0,wt(Fle)),s!==We.NONE&&l&&(r=void 0,wt(Vle))):(u(a)&&!u(r)&&(r=0),f=jn.computeGeometryOffsetAttribute(r,s,a,c)),i.polygonHierarchy=o,i.granularity=Y.getValueOrUndefined(t.granularity,ze.MINIMUM_VALUE),i.stRotation=Y.getValueOrUndefined(t.stRotation,ze.MINIMUM_VALUE),i.perPositionHeight=l,i.closeTop=Y.getValueOrDefault(t.closeTop,ze.MINIMUM_VALUE,!0),i.closeBottom=Y.getValueOrDefault(t.closeBottom,ze.MINIMUM_VALUE,!0),i.offsetAttribute=f,i.height=r,i.arcType=Y.getValueOrDefault(t.arcType,ze.MINIMUM_VALUE,Kt.GEODESIC),i.textureCoordinates=Y.getValueOrUndefined(t.textureCoordinates,ze.MINIMUM_VALUE),a=jn.getGeometryExtrudedHeight(a,c),a===jn.CLAMP_TO_GROUND&&(a=fi.getMinimumMaximumHeights(px.computeRectangle(i,Hle)).minimumTerrainHeight),i.extrudedHeight=a};lu.prototype._getIsClosed=function(e){let t=e.height,n=e.extrudedHeight,i=u(n)&&n!==t;return!e.perPositionHeight&&(!i&&t===0||i&&e.closeTop&&e.closeBottom)};lu.DynamicGeometryUpdater=QE;function QE(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(QE.prototype=Object.create(ri.prototype),QE.prototype.constructor=QE);QE.prototype._isHidden=function(e,t,n){return!u(this._options.polygonHierarchy)||ri.prototype._isHidden.call(this,e,t,n)};QE.prototype._setOptions=function(e,t,n){let i=this._options;i.polygonHierarchy=Y.getValueOrUndefined(t.hierarchy,n);let o=Y.getValueOrUndefined(t.height,n),r=Y.getValueOrDefault(t.heightReference,n,We.NONE),s=Y.getValueOrDefault(t.extrudedHeightReference,n,We.NONE),a=Y.getValueOrUndefined(t.extrudedHeight,n),c=Y.getValueOrUndefined(t.perPositionHeight,n);o=jn.getGeometryHeight(o,s);let l;c?(u(o)&&(o=void 0,wt(Fle)),r!==We.NONE&&c&&(o=void 0,wt(Vle))):(u(a)&&!u(o)&&(o=0),l=jn.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=Y.getValueOrUndefined(t.granularity,n),i.stRotation=Y.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=Y.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=Y.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=Y.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=Y.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=l,i.height=o,i.arcType=Y.getValueOrDefault(t.arcType,n,Kt.GEODESIC),a=jn.getGeometryExtrudedHeight(a,s),a===jn.CLAMP_TO_GROUND&&(a=fi.getMinimumMaximumHeights(px.computeRectangle(i,Hle)).minimumTerrainHeight),i.extrudedHeight=a};var vB=lu;function DYe(e,t,n,i){let o=new dn;i.position&&(o.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:e}));let r=t.length,s=e.length/3,a=(s-r*2)/(r*2),c=li.triangulate(t),l=(a-1)*r*6+c.length*2,f=Fe.createTypedArray(s,l),d,p,g,m,A,x,C=r*2,T=0;for(d=0;d<a-1;d++){for(p=0;p<r-1;p++)g=p*2+d*r*2,x=g+C,m=g+1,A=m+C,f[T++]=m,f[T++]=g,f[T++]=A,f[T++]=A,f[T++]=g,f[T++]=x;g=r*2-2+d*r*2,m=g+1,A=m+C,x=g+C,f[T++]=m,f[T++]=g,f[T++]=A,f[T++]=A,f[T++]=g,f[T++]=x}if(i.st||i.tangent||i.bitangent){let D=new Float32Array(s*2),w=1/(a-1),R=1/n.height,O=n.height/2,L,N,_=0;for(d=0;d<a;d++){for(L=d*w,N=R*(t[0].y+O),D[_++]=L,D[_++]=N,p=1;p<r;p++)N=R*(t[p].y+O),D[_++]=L,D[_++]=N,D[_++]=L,D[_++]=N;N=R*(t[0].y+O),D[_++]=L,D[_++]=N}for(p=0;p<r;p++)L=0,N=R*(t[p].y+O),D[_++]=L,D[_++]=N;for(p=0;p<r;p++)L=(a-1)*w,N=R*(t[p].y+O),D[_++]=L,D[_++]=N;o.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:new Float32Array(D)})}let E=s-r*2;for(d=0;d<c.length;d+=3){let D=c[d]+E,w=c[d+1]+E,R=c[d+2]+E;f[T++]=D,f[T++]=w,f[T++]=R,f[T++]=R+r,f[T++]=w+r,f[T++]=D+r}let S=new ct({attributes:o,indices:f,boundingSphere:se.fromVertices(e),primitiveType:Me.TRIANGLES});if(i.normal&&(S=Ln.computeNormal(S)),i.tangent||i.bitangent){try{S=Ln.computeTangentAndBitangent(S)}catch{wt("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 IB(e){e=y(e,y.EMPTY_OBJECT);let t=e.polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._cornerType=y(e.cornerType,vi.ROUNDED),this._vertexFormat=Ie.clone(y(e.vertexFormat,Ie.DEFAULT)),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*h.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ie.packedLength+Ie.packedLength+2}IB.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.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 Gle=ie.clone(ie.UNIT_SPHERE),Wle=new Ie,wB={polylinePositions:void 0,shapePositions:void 0,ellipsoid:Gle,vertexFormat:Wle,cornerType:void 0,granularity:void 0};IB.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.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,Gle);t+=ie.packedLength;let c=Ie.unpack(e,t,Wle);t+=Ie.packedLength;let l=e[t++],f=e[t];return u(n)?(n._positions=r,n._shape=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._vertexFormat=Ie.clone(c,n._vertexFormat),n._cornerType=l,n._granularity=f,n):(wB.polylinePositions=r,wB.shapePositions=s,wB.cornerType=l,wB.granularity=f,new IB(wB))};var vYe=new Ye;IB.createGeometry=function(e){let t=e._positions,n=go(t,h.equalsEpsilon),i=e._shape;if(i=Ed.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;li.computeWindingOrder2D(i)===Zr.CLOCKWISE&&i.reverse();let o=Ye.fromPoints(i,vYe),r=Ed.computePositions(n,i,o,e,!0);return DYe(r,i,o,e._vertexFormat)};var PB=IB;function wYe(e,t){let n=new dn;n.position=new ve({componentDatatype:q.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)),c,l,f=0;c=0;let d=c*i;for(l=0;l<i-1;l++)a[f++]=l+d,a[f++]=l+d+1;for(a[f++]=i-1+d,a[f++]=d,c=s-1,d=c*i,l=0;l<i-1;l++)a[f++]=l+d,a[f++]=l+d+1;for(a[f++]=i-1+d,a[f++]=d,c=0;c<s-1;c++){let g=i*c,m=g+i;for(l=0;l<i;l++)a[f++]=l+g,a[f++]=l+m}return new ct({attributes:n,indices:Fe.createTypedArray(o,a),boundingSphere:se.fromVertices(e),primitiveType:Me.LINES})}function RB(e){e=y(e,y.EMPTY_OBJECT);let t=e.polylinePositions,n=e.shapePositions;this._positions=t,this._shape=n,this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._cornerType=y(e.cornerType,vi.ROUNDED),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*h.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ie.packedLength+2}RB.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.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 jle=ie.clone(ie.UNIT_SPHERE),OB={polylinePositions:void 0,shapePositions:void 0,ellipsoid:jle,height:void 0,cornerType:void 0,granularity:void 0};RB.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.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,jle);t+=ie.packedLength;let c=e[t++],l=e[t];return u(n)?(n._positions=r,n._shape=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._cornerType=c,n._granularity=l,n):(OB.polylinePositions=r,OB.shapePositions=s,OB.cornerType=c,OB.granularity=l,new RB(OB))};var IYe=new Ye;RB.createGeometry=function(e){let t=e._positions,n=go(t,h.equalsEpsilon),i=e._shape;if(i=Ed.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;li.computeWindingOrder2D(i)===Zr.CLOCKWISE&&i.reverse();let o=Ye.fromPoints(i,IYe),r=Ed.computePositions(n,i,o,e,!1);return wYe(r,i)};var BB=RB;var Yle=new z;function PYe(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 Kh(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new PYe(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}u(Object.create)&&(Kh.prototype=Object.create(si.prototype),Kh.prototype.constructor=Kh);Kh.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i,o,r=new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Mt){let c;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,Yle)),u(c)||(c=z.WHITE),o=Nt.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new At({id:t,geometry:new PB(this._options),attributes:i})};Kh.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Yle),o=this._distanceDisplayConditionProperty.getValue(e);return new At({id:t,geometry:new BB(this._options),attributes:{show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};Kh.prototype._isHidden=function(e,t){return!u(t.positions)||!u(t.shape)||si.prototype._isHidden.call(this,e,t)};Kh.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!Y.isConstant(t.granularity)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.cornerType)};Kh.prototype._setStaticOptions=function(e,t){let n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof Mt;o.vertexFormat=r?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(ze.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(ze.MINIMUM_VALUE,o.shape),o.granularity=u(n)?n.getValue(ze.MINIMUM_VALUE):void 0,o.cornerType=u(i)?i.getValue(ze.MINIMUM_VALUE):void 0};Kh.DynamicGeometryUpdater=$E;function $E(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&($E.prototype=Object.create(ri.prototype),$E.prototype.constructor=$E);$E.prototype._isHidden=function(e,t,n){let i=this._options;return!u(i.polylinePositions)||!u(i.shapePositions)||ri.prototype._isHidden.call(this,e,t,n)};$E.prototype._setOptions=function(e,t,n){let i=this._options;i.polylinePositions=Y.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=Y.getValueOrUndefined(t.shape,n),i.granularity=Y.getValueOrUndefined(t.granularity,n),i.cornerType=Y.getValueOrUndefined(t.cornerType,n)};var MB=Kh;var cW=new h,Kle=new h,Zle=new h,Jle=new h,Qle=new ce,OYe=new H,RYe=new se,BYe=new se;function $le(e,t){let n=new ct({attributes:new dn,primitiveType:Me.TRIANGLES});return n.attributes.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function MYe(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,c=0,l=Jle,f=Zle,d=Kle;if(t.normal||t.tangent||t.bitangent)for(let p=0;p<o;p+=3){let g=h.fromArray(e,p,cW),m=c+1,A=c+2;d=n.geodeticSurfaceNormal(g,d),(t.tangent||t.bitangent)&&(h.cross(h.UNIT_Z,d,f),Z.multiplyByVector(i,f,f),h.normalize(f,f),t.bitangent&&h.normalize(h.cross(d,f,l),l)),t.normal&&(r[c]=d.x,r[m]=d.y,r[A]=d.z),t.tangent&&(s[c]=f.x,s[m]=f.y,s[A]=f.z),t.bitangent&&(a[c]=l.x,a[m]=l.y,a[A]=l.z),c+=3}return $le(t,{positions:e,normals:r,tangents:s,bitangents:a})}var lW=new h,eue=new h;function LYe(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,c=0,l=0,f=!0,d=Jle,p=Zle,g=Kle;if(t.normal||t.tangent||t.bitangent)for(let m=0;m<i;m+=6){let A=h.fromArray(e,m,cW),x=h.fromArray(e,(m+6)%i,lW);if(f){let C=h.fromArray(e,(m+3)%i,eue);h.subtract(x,A,x),h.subtract(C,A,C),g=h.normalize(h.cross(C,x,g),g),f=!1}h.equalsEpsilon(x,A,P.EPSILON10)&&(f=!0),(t.tangent||t.bitangent)&&(d=n.geodeticSurfaceNormal(A,d),t.tangent&&(p=h.normalize(h.cross(d,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[c++]=p.x,r[c++]=p.y,r[c++]=p.z,r[c++]=p.x,r[c++]=p.y,r[c++]=p.z),t.bitangent&&(s[l++]=d.x,s[l++]=d.y,s[l++]=d.z,s[l++]=d.x,s[l++]=d.y,s[l++]=d.z)}return $le(t,{positions:e,normals:o,tangents:r,bitangents:s})}function tue(e,t){let n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap,c=0,l=o,f=o,d=0;s&&(c=1,f-=1,d+=1),a&&(l-=1,f-=1,d+=1),d+=r*f;let p=n.position?new Float64Array(d*3):void 0,g=n.st?new Float32Array(d*2):void 0,m=0,A=0,x=cW,C=OYe,T=Number.MAX_VALUE,E=Number.MAX_VALUE,S=-Number.MAX_VALUE,D=-Number.MAX_VALUE;for(let b=c;b<l;++b)for(let v=0;v<r;++v)ls.computePosition(t,i,n.st,b,v,x,C),p[m++]=x.x,p[m++]=x.y,p[m++]=x.z,n.st&&(g[A++]=C.x,g[A++]=C.y,T=Math.min(T,C.x),E=Math.min(E,C.y),S=Math.max(S,C.x),D=Math.max(D,C.y));if(s&&(ls.computePosition(t,i,n.st,0,0,x,C),p[m++]=x.x,p[m++]=x.y,p[m++]=x.z,n.st&&(g[A++]=C.x,g[A++]=C.y,T=C.x,E=C.y,S=C.x,D=C.y)),a&&(ls.computePosition(t,i,n.st,o-1,0,x,C),p[m++]=x.x,p[m++]=x.y,p[m]=x.z,n.st&&(g[A++]=C.x,g[A]=C.y,T=Math.min(T,C.x),E=Math.min(E,C.y),S=Math.max(S,C.x),D=Math.max(D,C.y))),n.st&&(T<0||E<0||S>1||D>1))for(let b=0;b<g.length;b+=2)g[b]=(g[b]-T)/(S-T),g[b+1]=(g[b+1]-E)/(D-E);let w=MYe(p,n,i,t.tangentRotationMatrix),R=6*(r-1)*(f-1);s&&(R+=3*(r-1)),a&&(R+=3*(r-1));let O=Fe.createTypedArray(d,R),L=0,N=0,_;for(_=0;_<f-1;++_){for(let b=0;b<r-1;++b){let v=L,I=v+r,B=I+1,F=v+1;O[N++]=v,O[N++]=I,O[N++]=F,O[N++]=F,O[N++]=I,O[N++]=B,++L}++L}if(s||a){let b=d-1,v=d-1;s&&a&&(b=d-2);let I,B;if(L=0,s)for(_=0;_<r-1;_++)I=L,B=I+1,O[N++]=b,O[N++]=I,O[N++]=B,++L;if(a)for(L=(f-1)*r,_=0;_<r-1;_++)I=L,B=I+1,O[N++]=I,O[N++]=v,O[N++]=B,++L}return w.indices=O,n.st&&(w.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:g})),w}function eb(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 tb(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 uW=new Ie;function NYe(e,t){let n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,c=t.height,l=t.width,f;if(n){let dt=Ie.clone(o,uW);dt.normal=!0,e._vertexFormat=dt}let d=tue(e,t);n&&(e._vertexFormat=o);let p=li.scaleToGeodeticHeight(d.attributes.position.values,s,a,!1);p=new Float64Array(p);let g=p.length,m=g*2,A=new Float64Array(m);A.set(p);let x=li.scaleToGeodeticHeight(d.attributes.position.values,r,a);A.set(x,g),d.attributes.position.values=A;let C=o.normal?new Float32Array(m):void 0,T=o.tangent?new Float32Array(m):void 0,E=o.bitangent?new Float32Array(m):void 0,S=o.st?new Float32Array(m/3*2):void 0,D,w;if(o.normal){for(w=d.attributes.normal.values,C.set(w),f=0;f<g;f++)w[f]=-w[f];C.set(w,g),d.attributes.normal.values=C}if(n){w=d.attributes.normal.values,o.normal||(d.attributes.normal=void 0);let dt=new Float32Array(m);for(f=0;f<g;f++)w[f]=-w[f];dt.set(w,g),d.attributes.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:dt})}let R,O=u(i);if(O){let dt=g/3*2,Tn=new Uint8Array(dt);i===nn.TOP?Tn=Tn.fill(1,0,dt/2):(R=i===nn.NONE?0:1,Tn=Tn.fill(R)),d.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:Tn})}if(o.tangent){let dt=d.attributes.tangent.values;for(T.set(dt),f=0;f<g;f++)dt[f]=-dt[f];T.set(dt,g),d.attributes.tangent.values=T}if(o.bitangent){let dt=d.attributes.bitangent.values;E.set(dt),E.set(dt,g),d.attributes.bitangent.values=E}o.st&&(D=d.attributes.st.values,S.set(D),S.set(D,g/3*2),d.attributes.st.values=S);let L=d.indices,N=L.length,_=g/3,b=Fe.createTypedArray(m/3,N*2);for(b.set(L),f=0;f<N;f+=3)b[f+N]=L[f+2]+_,b[f+1+N]=L[f+1]+_,b[f+2+N]=L[f]+_;d.indices=b;let v=t.northCap,I=t.southCap,B=c,F=2,k=0,U=4,G=4;v&&(F-=1,B-=1,k+=1,U-=2,G-=1),I&&(F-=1,B-=1,k+=1,U-=2,G-=1),k+=F*l+2*B-U;let V=(k+G)*2,X=new Float64Array(V*3),j=n?new Float32Array(V*3):void 0,Q=O?new Uint8Array(V):void 0,W=o.st?new Float32Array(V*2):void 0,K=i===nn.TOP;O&&!K&&(R=i===nn.ALL?1:0,Q=Q.fill(R));let J=0,_e=0,xe=0,re=0,ye=l*B,fe;for(f=0;f<ye;f+=l)fe=f*3,X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,f*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1);if(I){let dt=v?ye+1:ye;for(fe=dt*3,f=0;f<2;f++)X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,dt*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1)}else for(f=ye-l;f<ye;f++)fe=f*3,X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,f*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1);for(f=ye-1;f>0;f-=l)fe=f*3,X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,f*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1);if(v){let dt=ye;for(fe=dt*3,f=0;f<2;f++)X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,dt*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1)}else for(f=l-1;f>=0;f--)fe=f*3,X=eb(X,J,fe,p,x),J+=6,o.st&&(W=tb(W,_e,f*2,D),_e+=4),n&&(xe+=3,j[xe++]=w[fe],j[xe++]=w[fe+1],j[xe++]=w[fe+2]),K&&(Q[re++]=1,re+=1);let Se=LYe(X,o,a);o.st&&(Se.attributes.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:W})),n&&(Se.attributes.extrudeDirection=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:j})),O&&(Se.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:Q}));let we=Fe.createTypedArray(V,k*6),Ve,qe,mt,Ht;g=X.length/3;let fn=0;for(f=0;f<g-1;f+=2){Ve=f,Ht=(Ve+2)%g;let dt=h.fromArray(X,Ve*3,lW),Tn=h.fromArray(X,Ht*3,eue);h.equalsEpsilon(dt,Tn,P.EPSILON10)||(qe=(Ve+1)%g,mt=(qe+2)%g,we[fn++]=Ve,we[fn++]=qe,we[fn++]=Ht,we[fn++]=Ht,we[fn++]=qe,we[fn++]=mt)}return Se.indices=we,Se=Ln.combineInstances([new At({geometry:d}),new At({geometry:Se})]),Se[0]}var FYe=[new h,new h,new h,new h],nue=new he,VYe=new he;function fW(e,t,n,i,o){if(n===0)return ce.clone(e,o);let r=ls.computeOptions(e,t,n,0,Qle,nue),s=r.height,a=r.width,c=FYe;return ls.computePosition(r,i,!1,0,0,c[0]),ls.computePosition(r,i,!1,0,a-1,c[1]),ls.computePosition(r,i,!1,s-1,0,c[2]),ls.computePosition(r,i,!1,s-1,a-1,c[3]),ce.fromCartesianArray(c,i,o)}function Zh(e){e=y(e,y.EMPTY_OBJECT);let t=e.rectangle,n=y(e.height,0),i=y(e.extrudedHeight,n);this._rectangle=ce.clone(t),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=y(e.rotation,0),this._stRotation=y(e.stRotation,0),this._vertexFormat=Ie.clone(y(e.vertexFormat,Ie.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Zh.packedLength=ce.packedLength+ie.packedLength+Ie.packedLength+7;Zh.pack=function(e,t,n){return n=y(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]=y(e._offsetAttribute,-1),t};var iue=new ce,oue=ie.clone(ie.UNIT_SPHERE),uy={rectangle:iue,ellipsoid:oue,vertexFormat:uW,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Zh.unpack=function(e,t,n){t=y(t,0);let i=ce.unpack(e,t,iue);t+=ce.packedLength;let o=ie.unpack(e,t,oue);t+=ie.packedLength;let r=Ie.unpack(e,t,uW);t+=Ie.packedLength;let s=e[t++],a=e[t++],c=e[t++],l=e[t++],f=e[t++],d=e[t++]===1,p=e[t];return u(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=c,n._stRotation=l,n._extrudedHeight=f,n._shadowVolume=d,n._offsetAttribute=p===-1?void 0:p,n):(uy.granularity=s,uy.height=a,uy.rotation=c,uy.stRotation=l,uy.extrudedHeight=f,uy.shadowVolume=d,uy.offsetAttribute=p===-1?void 0:p,new Zh(uy))};Zh.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.rectangle,i=y(e.granularity,P.RADIANS_PER_DEGREE),o=y(e.ellipsoid,ie.WGS84),r=y(e.rotation,0);return fW(n,i,r,o,t)};var UYe=new Z,qle=new Le,kYe=new he;Zh.createGeometry=function(e){if(P.equalsEpsilon(e._rectangle.north,e._rectangle.south,P.EPSILON10)||P.equalsEpsilon(e._rectangle.east,e._rectangle.west,P.EPSILON10))return;let t=e._rectangle,n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=ls.computeOptions(t,e._granularity,i,o,Qle,nue,VYe),a=UYe;if(o!==0||i!==0){let g=ce.center(t,kYe),m=n.geodeticSurfaceNormalCartographic(g,lW);Le.fromAxisAngle(m,-o,qle),Z.fromQuaternion(qle,a)}else Z.clone(Z.IDENTITY,a);let c=e._surfaceHeight,l=e._extrudedHeight,f=!P.equalsEpsilon(c,l,0,P.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let d,p;if(t=e._rectangle,f){d=NYe(e,s);let g=se.fromRectangle3D(t,n,c,BYe),m=se.fromRectangle3D(t,n,l,RYe);p=se.union(g,m)}else{if(d=tue(e,s),d.attributes.position.values=li.scaleToGeodeticHeight(d.attributes.position.values,c,n,!1),u(e._offsetAttribute)){let g=d.attributes.position.values.length,m=e._offsetAttribute===nn.NONE?0:1,A=new Uint8Array(g/3).fill(m);d.attributes.applyOffset=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}p=se.fromRectangle3D(t,n,c)}return r.position||delete d.attributes.position,new ct({attributes:d.attributes,indices:d.indices,primitiveType:d.primitiveType,boundingSphere:p,offsetAttribute:e._offsetAttribute})};Zh.createShadowVolume=function(e,t,n){let i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Zh({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Ie.POSITION_ONLY,shadowVolume:!0})};var Xle=new ce,zYe=[new H,new H,new H],HYe=new Ji,GYe=new he;function WYe(e){if(e._stRotation===0)return[0,0,0,1,1,0];let t=ce.clone(e._rectangle,Xle),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=fW(t,n,o,i,Xle),s=zYe;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,c=Ji.fromRotation(e._stRotation,HYe),l=ce.center(a,GYe);for(let m=0;m<3;++m){let A=s[m];A.x-=l.longitude,A.y-=l.latitude,Ji.multiplyByVector(c,A,A),A.x+=l.longitude,A.y+=l.latitude,A.x=(A.x-a.west)/a.width,A.y=(A.y-a.south)/a.height}let f=s[0],d=s[1],p=s[2],g=new Array(6);return H.pack(f,g),H.pack(d,g,2),H.pack(p,g,4),g}Object.defineProperties(Zh.prototype,{rectangle:{get:function(){return u(this._rotatedRectangle)||(this._rotatedRectangle=fW(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return u(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=WYe(this)),this._textureCoordinateRotationPoints}}});var gx=Zh;var rue=new z,sue=h.ZERO,aue=new h,cue=new ce,jYe=new ce,YYe=new he;function qYe(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 Bd(e,t){jn.call(this,{entity:e,scene:t,geometryOptions:new qYe(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}u(Object.create)&&(Bd.prototype=Object.create(jn.prototype),Bd.prototype.constructor=Bd);Bd.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Mt){let o;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,rue)),u(o)||(o=z.WHITE),i.color=Nt.fromColor(o)}return u(this._options.offsetAttribute)&&(i.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,sue,aue))),new At({id:t,geometry:new gx(this._options),attributes:i})};Bd.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,rue),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return u(this._options.offsetAttribute)&&(r.offset=Wi.fromCartesian3(Y.getValueOrDefault(this._terrainOffsetProperty,e,sue,aue))),new At({id:t,geometry:new HA(this._options),attributes:r})};Bd.prototype._computeCenter=function(e,t){let n=Y.getValueOrUndefined(this._entity.rectangle.coordinates,e,jYe);if(!u(n))return;let i=ce.center(n,YYe);return he.toCartesian(i,ie.WGS84,t)};Bd.prototype._isHidden=function(e,t){return!u(t.coordinates)||si.prototype._isHidden.call(this,e,t)};Bd.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Y.isConstant(t.height)||!Y.isConstant(t.extrudedHeight)||!Y.isConstant(t.granularity)||!Y.isConstant(t.stRotation)||!Y.isConstant(t.rotation)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.zIndex)||this._onTerrain&&!Y.isConstant(this._materialProperty)&&!(this._materialProperty instanceof Mt)};Bd.prototype._setStaticOptions=function(e,t){let n=this._materialProperty instanceof Mt,i=Y.getValueOrUndefined(t.height,ze.MINIMUM_VALUE),o=Y.getValueOrDefault(t.heightReference,ze.MINIMUM_VALUE,We.NONE),r=Y.getValueOrUndefined(t.extrudedHeight,ze.MINIMUM_VALUE),s=Y.getValueOrDefault(t.extrudedHeightReference,ze.MINIMUM_VALUE,We.NONE);u(r)&&!u(i)&&(i=0);let a=this._options;a.vertexFormat=n?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(ze.MINIMUM_VALUE,a.rectangle),a.granularity=Y.getValueOrUndefined(t.granularity,ze.MINIMUM_VALUE),a.stRotation=Y.getValueOrUndefined(t.stRotation,ze.MINIMUM_VALUE),a.rotation=Y.getValueOrUndefined(t.rotation,ze.MINIMUM_VALUE),a.offsetAttribute=jn.computeGeometryOffsetAttribute(i,o,r,s),a.height=jn.getGeometryHeight(i,o),r=jn.getGeometryExtrudedHeight(r,s),r===jn.CLAMP_TO_GROUND&&(r=fi.getMinimumMaximumHeights(gx.computeRectangle(a,cue)).minimumTerrainHeight),a.extrudedHeight=r};Bd.DynamicGeometryUpdater=nb;function nb(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(nb.prototype=Object.create(ri.prototype),nb.prototype.constructor=nb);nb.prototype._isHidden=function(e,t,n){return!u(this._options.rectangle)||ri.prototype._isHidden.call(this,e,t,n)};nb.prototype._setOptions=function(e,t,n){let i=this._options,o=Y.getValueOrUndefined(t.height,n),r=Y.getValueOrDefault(t.heightReference,n,We.NONE),s=Y.getValueOrUndefined(t.extrudedHeight,n),a=Y.getValueOrDefault(t.extrudedHeightReference,n,We.NONE);u(s)&&!u(o)&&(o=0),i.rectangle=Y.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=Y.getValueOrUndefined(t.granularity,n),i.stRotation=Y.getValueOrUndefined(t.stRotation,n),i.rotation=Y.getValueOrUndefined(t.rotation,n),i.offsetAttribute=jn.computeGeometryOffsetAttribute(o,r,s,a),i.height=jn.getGeometryHeight(o,r),s=jn.getGeometryExtrudedHeight(s,a),s===jn.CLAMP_TO_GROUND&&(s=fi.getMinimumMaximumHeights(gx.computeRectangle(i,cue)).minimumTerrainHeight),i.extrudedHeight=s};var LB=Bd;var lue=new z,XYe=new bt,KYe=new bt,ZYe=h.ZERO,JYe=new h;function Md(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 xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.subscriptions=new xt,this.showsUpdated=new xt,this.itemsToRemove=[],this.invalidated=!1;let a;u(o)&&(a=o.definitionChanged.addEventListener(Md.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}Md.prototype.onMaterialChanged=function(){this.invalidated=!0};Md.prototype.isMaterial=function(e){let t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:u(t)?t.equals(n):!1};Md.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||!Y.isConstant(e.distanceDisplayConditionProperty)||!Y.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)}))}};Md.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 u(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Md.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){u(i)&&(u(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let c;u(this.depthFailAppearanceType)&&(u(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Wo.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),c=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Dn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:c,shadows:this.shadows}),o.add(i),t=!1}else{u(i)&&(o.remove(i),i=void 0);let c=this.oldPrimitive;u(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(u(i)&&i.ready){i.show=!0,u(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),u(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof Mt)&&(this.depthFailMaterial=Wo.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);let s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){let l=s[r],f=this.geometry.get(l.id),d=this.attributes.get(f.id.id);if(u(d)||(d=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d)),!l.fillMaterialProperty.isConstant||c){let x=l.fillMaterialProperty.color,C=Y.getValueOrDefault(x,e,z.WHITE,lue);z.equals(d._lastColor,C)||(d._lastColor=z.clone(C,d._lastColor),d.color=Nt.toValue(C,d.color),(this.translucent&&d.color[3]===255||!this.translucent&&d.color[3]!==255)&&(this.itemsToRemove[n++]=l))}if(u(this.depthFailAppearanceType)&&l.depthFailMaterialProperty instanceof Mt&&(!l.depthFailMaterialProperty.isConstant||c)){let x=l.depthFailMaterialProperty.color,C=Y.getValueOrDefault(x,e,z.WHITE,lue);z.equals(d._lastDepthFailColor,C)||(d._lastDepthFailColor=z.clone(C,d._lastDepthFailColor),d.depthFailColor=Nt.toValue(C,d.depthFailColor))}let p=l.entity.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=l.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let x=Y.getValueOrDefault(m,e,KYe,XYe);bt.equals(x,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(x,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(x,d.distanceDisplayCondition))}let A=l.terrainOffsetProperty;if(!Y.isConstant(A)){let x=Y.getValueOrDefault(A,e,ZYe,JYe);h.equals(x,d._lastOffset)||(d._lastOffset=h.clone(x,d._lastOffset),d.offset=Wi.toValue(x,d.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else u(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Md.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);u(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=_n.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Md.prototype.contains=function(e){return this.updaters.contains(e.id)};Md.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!u(i)||!u(i.boundingSphere)||u(i.show)&&i.show[0]===0?at.FAILED:(i.boundingSphere.clone(t),at.DONE)};Md.prototype.destroy=function(){let e=this.primitive,t=this.primitives;u(e)&&t.remove(e);let n=this.oldPrimitive;u(n)&&t.remove(n),u(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};function ib(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}ib.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 c=n[a];if(c.isMaterial(t)){c.add(t,o);return}}let s=new Md(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function uue(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}ib.prototype.remove=function(e){uue(this._solidItems,e)||uue(this._translucentItems,e)};function fue(e,t,n){let i=!1,o=t.length;for(let r=0;r<o;++r){let s=t[r],a=s.itemsToRemove,c=a.length;if(c>0)for(r=0;r<c;r++){let l=a[r];s.remove(l),e.add(n,l),i=!0}}return i}function ek(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,c=a.length;for(let l=0;l<c;l++)e.add(n,a[l]);s.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}ib.prototype.update=function(e){let t=ek(this,this._solidItems,e,!0);t=ek(this,this._translucentItems,e,t)&&t;let n=fue(this,this._solidItems,e),i=fue(this,this._translucentItems,e);return(n||i)&&(t=ek(this,this._solidItems,e,t)&&t,t=ek(this,this._translucentItems,e,t)&&t),t};function due(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 at.FAILED}ib.prototype.getBoundingSphere=function(e,t){let n=due(this._solidItems,e,t);return n===at.FAILED?due(this._translucentItems,e,t):n};function hue(e){let t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}ib.prototype.removeAllPrimitives=function(){hue(this._solidItems),hue(this._translucentItems)};var gf=ib;var QYe=new bt,$Ye=new bt,eqe=h.ZERO,tqe=new h;function Ld(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 xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Ld.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt}Ld.prototype.onMaterialChanged=function(){this.invalidated=!0};Ld.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=u(t)&&t.equals(n);return r=(!u(i)&&!u(o)||u(i)&&i.equals(o))&&r,r};Ld.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||!Y.isConstant(t.distanceDisplayConditionProperty)||!Y.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};Ld.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 u(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};var nqe=new z;Ld.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){u(n)&&(u(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Wo.getValue(e,this.materialProperty,this.material);let a;u(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Wo.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Dn({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{u(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;u(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(u(n)&&n.ready){n.show=!0,u(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Wo.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,u(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof Mt)&&(this.depthFailMaterial=Wo.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 c=s[r],l=c.entity,f=this.geometry.get(c.id),d=this.attributes.get(f.id.id);if(u(d)||(d=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d)),u(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof Mt&&!c.depthFailMaterialProperty.isConstant){let x=c.depthFailMaterialProperty.color,C=Y.getValueOrDefault(x,e,z.WHITE,nqe);z.equals(d._lastDepthFailColor,C)||(d._lastDepthFailColor=z.clone(C,d._lastDepthFailColor),d.depthFailColor=Nt.toValue(C,d.depthFailColor))}let p=l.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=c.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let x=Y.getValueOrDefault(m,e,$Ye,QYe);bt.equals(x,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(x,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(x,d.distanceDisplayCondition))}let A=c.terrainOffsetProperty;if(!Y.isConstant(A)){let x=Y.getValueOrDefault(A,e,eqe,tqe);h.equals(x,d._lastOffset)||(d._lastOffset=h.clone(x,d._lastOffset),d.offset=Wi.toValue(x,d.offset))}}this.updateShows(n)}else u(n)&&!n.ready&&(t=!1);return t};Ld.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);u(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let c=r.isShowing,l=a.show[0]===1;c!==l&&(a.show=_n.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Ld.prototype.contains=function(e){return this.updaters.contains(e.id)};Ld.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!u(i)||!u(i.boundingSphere)||u(i.show)&&i.show[0]===0?at.FAILED:(i.boundingSphere.clone(t),at.DONE)};Ld.prototype.destroy=function(){let e=this.primitive,t=this.primitives;u(e)&&t.remove(e);let n=this.oldPrimitive;u(n)&&t.remove(n),this.removeMaterialSubscription()};function ob(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}ob.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 Ld(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};ob.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}}};ob.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 c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};ob.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 at.FAILED};ob.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 yf=ob;var pue=vo(mue(),1);function tk(){this._tree=new pue.default}function yx(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}yx.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};tk.prototype.insert=function(e,t){let n=yx.fromRectangleAndId(e,t,new yx);this._tree.insert(n)};function iqe(e,t){return e.id===t.id}var oqe=new yx;tk.prototype.remove=function(e,t){let n=yx.fromRectangleAndId(e,t,oqe);this._tree.remove(n,iqe)};var rqe=new yx;tk.prototype.collides=function(e){let t=yx.fromRectangleAndId("",e,rqe);return this._tree.collides(t)};var Ax=tk;var sqe=new z,aqe=new bt,cqe=new bt;function c_(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 xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.subscriptions=new xt,this.showsUpdated=new xt,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new Ax}c_.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};c_.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||!Y.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)}))}};c_.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 u(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};c_.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)u(i)&&(u(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Ec({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{u(i)&&(o.remove(i),i=void 0);let c=this.oldPrimitive;u(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(u(i)&&i.ready){i.show=!0,u(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);let s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){let l=s[r],f=this.geometry.get(l.id),d=this.attributes.get(f.id.id);if(u(d)||(d=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d)),!l.fillMaterialProperty.isConstant||c){let A=l.fillMaterialProperty.color,x=Y.getValueOrDefault(A,e,z.WHITE,sqe);z.equals(d._lastColor,x)||(d._lastColor=z.clone(x,d._lastColor),d.color=Nt.toValue(x,d.color))}let p=l.entity.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=l.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let A=Y.getValueOrDefault(m,e,cqe,aqe);bt.equals(A,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(A,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(A,d.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else u(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};c_.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);u(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=_n.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};c_.prototype.contains=function(e){return this.updaters.contains(e.id)};c_.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getBoundingSphere(e.entity);return u(i)?(i.clone(t),at.DONE):at.FAILED};c_.prototype.removeAllPrimitives=function(){let e=this.primitives,t=this.primitive;u(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());let n=this.oldPrimitive;u(n)&&(e.remove(n),this.oldPrimitive=void 0)};function rb(e,t){this._batches=[],this._primitives=e,this._classificationType=t}rb.prototype.add=function(e,t){let n=t.createFillGeometryInstance(e),i=this._batches,o=Y.getValueOrDefault(t.zIndex,0),r,s=i.length;for(let a=0;a<s;++a){let c=i[a];if(c.zIndex===o&&!c.overlapping(n.geometry.rectangle)){r=c;break}}return u(r)||(r=new c_(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};rb.prototype.remove=function(e){let t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};rb.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,c=a.length;for(let l=0;l<c;l++){n=a[l],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};rb.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 at.FAILED};rb.prototype.removeAllPrimitives=function(){let e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};var sb=rb;var lqe=new bt,uqe=new bt;function Af(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Af.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new Ax}Af.prototype.onMaterialChanged=function(){this.invalidated=!0};Af.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};Af.prototype.isMaterial=function(e){let t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Mt&&t instanceof Mt?!0:u(t)&&t.equals(n)};Af.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||!Y.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{let o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,c){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Af.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 u(i)&&(i(),this.subscriptions.remove(t)),!0}return!1};Af.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)u(n)&&(u(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Wo.getValue(e,this.materialProperty,this.material),n=new Ec({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{u(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;u(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(u(n)&&n.ready){n.show=!0,u(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Wo.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 c=s[r],l=c.entity,f=this.geometry.get(c.id),d=this.attributes.get(f.id.id);u(d)||(d=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d));let p=l.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=c.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let A=Y.getValueOrDefault(m,e,uqe,lqe);bt.equals(A,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(A,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(A,d.distanceDisplayCondition))}}this.updateShows(n)}else u(n)&&!n.ready&&(t=!1);return t};Af.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);u(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let c=r.isShowing,l=a.show[0]===1;c!==l&&(a.show=_n.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Af.prototype.contains=function(e){return this.updaters.contains(e.id)};Af.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!u(i)||!u(i.boundingSphere)||u(i.show)&&i.show[0]===0?at.FAILED:(i.boundingSphere.clone(t),at.DONE)};Af.prototype.destroy=function(){let e=this.primitive,t=this.primitives;u(e)&&t.remove(e);let n=this.oldPrimitive;u(n)&&t.remove(n),this.removeMaterialSubscription()};function ab(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}ab.prototype.add=function(e,t){let n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Gl.shouldUseSphericalCoordinates(o.geometry.rectangle),s=Y.getValueOrDefault(t.zIndex,0);for(let c=0;c<i;++c){let l=n[c];if(l.isMaterial(t)&&l.usingSphericalTextureCoordinates===r&&l.zIndex===s&&!l.overlapping(o.geometry.rectangle)){l.add(e,t,o);return}}let a=new Af(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};ab.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}}};ab.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 c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};ab.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 at.FAILED};ab.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 NB=ab;var fqe=new z,dqe=new bt,hqe=new bt,mqe=h.ZERO,pqe=new h;function l_(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 xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.itemsToRemove=[],this.subscriptions=new xt,this.showsUpdated=new xt}l_.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||!Y.isConstant(e.distanceDisplayConditionProperty)||!Y.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)}))}};l_.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 u(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};l_.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)u(i)&&(u(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Dn({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new on({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{u(i)&&(o.remove(i),i=void 0);let c=this.oldPrimitive;u(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(u(i)&&i.ready){i.show=!0,u(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);let s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){let l=s[r],f=this.geometry.get(l.id),d=this.attributes.get(f.id.id);if(u(d)||(d=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d)),!l.outlineColorProperty.isConstant||c){let x=l.outlineColorProperty,C=Y.getValueOrDefault(x,e,z.WHITE,fqe);z.equals(d._lastColor,C)||(d._lastColor=z.clone(C,d._lastColor),d.color=Nt.toValue(C,d.color),(this.translucent&&d.color[3]===255||!this.translucent&&d.color[3]!==255)&&(this.itemsToRemove[n++]=l))}let p=l.entity.isShowing&&(l.hasConstantOutline||l.isOutlineVisible(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=l.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let x=Y.getValueOrDefault(m,e,hqe,dqe);bt.equals(x,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(x,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(x,d.distanceDisplayCondition))}let A=l.terrainOffsetProperty;if(!Y.isConstant(A)){let x=Y.getValueOrDefault(A,e,mqe,pqe);h.equals(x,d._lastOffset)||(d._lastOffset=h.clone(x,d._lastOffset),d.offset=Wi.toValue(x,d.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else u(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};l_.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);u(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));let a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=_n.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};l_.prototype.contains=function(e){return this.updaters.contains(e.id)};l_.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!u(i)||!u(i.boundingSphere)||u(i.show)&&i.show[0]===0?at.FAILED:(i.boundingSphere.clone(t),at.DONE)};l_.prototype.removeAllPrimitives=function(){let e=this.primitives,t=this.primitive;u(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());let n=this.oldPrimitive;u(n)&&(e.remove(n),this.oldPrimitive=void 0)};function cb(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new xt,this._translucentBatches=new xt}cb.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),u(r)||(r=new l_(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),u(r)||(r=new l_(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};cb.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};cb.prototype.update=function(e){let t,n,i,o,r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,c=a.length,l,f=!0,d=!1;do{for(d=!1,n=0;n<s;n++){o=r[n],f=o.update(e),l=o.itemsToRemove;let p=l.length;if(p>0)for(d=!0,t=0;t<p;t++)i=l[t],o.remove(i),this.add(e,i)}for(n=0;n<c;n++){o=a[n],f=o.update(e),l=o.itemsToRemove;let p=l.length;if(p>0)for(d=!0,t=0;t<p;t++)i=l[t],o.remove(i),this.add(e,i)}}while(d);return f};cb.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 at.FAILED};cb.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 lb=cb;var _ue={};function _qe(e,t){return P.equalsEpsilon(e.latitude,t.latitude,P.EPSILON10)&&P.equalsEpsilon(e.longitude,t.longitude,P.EPSILON10)}var gqe=new he,yqe=new he;function Aqe(e,t,n,i){t=go(t,h.equalsEpsilon);let o=t.length;if(o<2)return;let r=u(i),s=u(n),a=new Array(o),c=new Array(o),l=new Array(o),f=t[0];a[0]=f;let d=e.cartesianToCartographic(f,gqe);s&&(d.height=n[0]),c[0]=d.height,r?l[0]=i[0]:l[0]=0;let p=c[0],g=l[0],m=p===g,A=1;for(let x=1;x<o;++x){let C=t[x],T=e.cartesianToCartographic(C,yqe);s&&(T.height=n[x]),m=m&&T.height===0,_qe(d,T)?d.height<T.height&&(c[A-1]=T.height):(a[A]=C,c[A]=T.height,r?l[A]=i[x]:l[A]=0,m=m&&c[A]===l[A],he.clone(T,d),++A)}if(!(m||A<2))return a.length=A,c.length=A,l.length=A,{positions:a,topHeights:c,bottomHeights:l}}var xqe=new Array(2),Cqe=new Array(2),Tqe={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};_ue.computePositions=function(e,t,n,i,o,r){let s=Aqe(e,t,n,i);if(!u(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;let a=t.length,c=a-2,l,f,d=P.chordLength(o,e.maximumRadius),p=Tqe;if(p.minDistance=d,p.ellipsoid=e,r){let g=0,m;for(m=0;m<a-1;m++)g+=Di.numberOfPoints(t[m],t[m+1],d)+1;l=new Float64Array(g*3),f=new Float64Array(g*3);let A=xqe,x=Cqe;p.positions=A,p.height=x;let C=0;for(m=0;m<a-1;m++){A[0]=t[m],A[1]=t[m+1],x[0]=n[m],x[1]=n[m+1];let T=Di.generateArc(p);l.set(T,C),x[0]=i[m],x[1]=i[m+1],f.set(Di.generateArc(p),C),C+=T.length}}else p.positions=t,p.height=n,l=new Float64Array(Di.generateArc(p)),p.height=i,f=new Float64Array(Di.generateArc(p));return{bottomPositions:f,topPositions:l,numCorners:c}};var xx=_ue;var mW=new h,nk=new h,Eqe=new h,gue=new h,bqe=new h,Sqe=new h,Dqe=new h;function Cx(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.maximumHeights,i=e.minimumHeights,o=y(e.vertexFormat,Ie.DEFAULT),r=y(e.granularity,P.RADIANS_PER_DEGREE),s=y(e.ellipsoid,ie.WGS84);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*h.packedLength+2;u(i)&&(a+=i.length),u(n)&&(a+=n.length),this.packedLength=a+ie.packedLength+Ie.packedLength+1}Cx.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.pack(o[i],t,n);let s=e._minimumHeights;if(r=u(s)?s.length:0,t[n++]=r,u(s))for(i=0;i<r;++i)t[n++]=s[i];let a=e._maximumHeights;if(r=u(a)?a.length:0,t[n++]=r,u(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 yue=ie.clone(ie.UNIT_SPHERE),Aue=new Ie,FB={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:yue,vertexFormat:Aue,granularity:void 0};Cx.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.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 c=ie.unpack(e,t,yue);t+=ie.packedLength;let l=Ie.unpack(e,t,Aue);t+=Ie.packedLength;let f=e[t];return u(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ie.clone(c,n._ellipsoid),n._vertexFormat=Ie.clone(l,n._vertexFormat),n._granularity=f,n):(FB.positions=r,FB.minimumHeights=s,FB.maximumHeights=a,FB.granularity=f,new Cx(FB))};Cx.fromConstantHeights=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n,i,o=e.minimumHeight,r=e.maximumHeight,s=u(o),a=u(r);if(s||a){let l=t.length;n=s?new Array(l):void 0,i=a?new Array(l):void 0;for(let f=0;f<l;++f)s&&(n[f]=o),a&&(i[f]=r)}let c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new Cx(c)};Cx.createGeometry=function(e){let t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=xx.computePositions(s,t,i,n,r,!0);if(!u(a))return;let c=a.bottomPositions,l=a.topPositions,f=a.numCorners,d=l.length,p=d*2,g=o.position?new Float64Array(p):void 0,m=o.normal?new Float32Array(p):void 0,A=o.tangent?new Float32Array(p):void 0,x=o.bitangent?new Float32Array(p):void 0,C=o.st?new Float32Array(p/3*2):void 0,T=0,E=0,S=0,D=0,w=0,R=Dqe,O=Sqe,L=bqe,N=!0;d/=3;let _,b=0,v=1/(d-f-1);for(_=0;_<d;++_){let U=_*3,G=h.fromArray(l,U,mW),V=h.fromArray(c,U,nk);if(o.position&&(g[T++]=V.x,g[T++]=V.y,g[T++]=V.z,g[T++]=G.x,g[T++]=G.y,g[T++]=G.z),o.st&&(C[w++]=b,C[w++]=0,C[w++]=b,C[w++]=1),o.normal||o.tangent||o.bitangent){let X=h.clone(h.ZERO,gue),j=h.subtract(G,s.geodeticSurfaceNormal(G,nk),nk);if(_+1<d&&(X=h.fromArray(l,U+3,gue)),N){let Q=h.subtract(X,G,Eqe),W=h.subtract(j,G,mW);R=h.normalize(h.cross(W,Q,R),R),N=!1}h.equalsEpsilon(G,X,P.EPSILON10)?N=!0:(b+=v,o.tangent&&(O=h.normalize(h.subtract(X,G,O),O)),o.bitangent&&(L=h.normalize(h.cross(R,O,L),L))),o.normal&&(m[E++]=R.x,m[E++]=R.y,m[E++]=R.z,m[E++]=R.x,m[E++]=R.y,m[E++]=R.z),o.tangent&&(A[D++]=O.x,A[D++]=O.y,A[D++]=O.z,A[D++]=O.x,A[D++]=O.y,A[D++]=O.z),o.bitangent&&(x[S++]=L.x,x[S++]=L.y,x[S++]=L.z,x[S++]=L.x,x[S++]=L.y,x[S++]=L.z)}}let I=new dn;o.position&&(I.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(I.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:m})),o.tangent&&(I.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:A})),o.bitangent&&(I.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:x})),o.st&&(I.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:C}));let B=p/3;p-=6*(f+1);let F=Fe.createTypedArray(B,p),k=0;for(_=0;_<B-2;_+=2){let U=_,G=_+2,V=h.fromArray(g,U*3,mW),X=h.fromArray(g,G*3,nk);if(h.equalsEpsilon(V,X,P.EPSILON10))continue;let j=_+1,Q=_+3;F[k++]=j,F[k++]=U,F[k++]=Q,F[k++]=Q,F[k++]=U,F[k++]=G}return new ct({attributes:I,indices:F,primitiveType:Me.TRIANGLES,boundingSphere:new se.fromVertices(g)})};var VB=Cx;var xue=new h,Cue=new h;function Tx(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.maximumHeights,i=e.minimumHeights,o=y(e.granularity,P.RADIANS_PER_DEGREE),r=y(e.ellipsoid,ie.WGS84);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*h.packedLength+2;u(i)&&(s+=i.length),u(n)&&(s+=n.length),this.packedLength=s+ie.packedLength+1}Tx.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.pack(o[i],t,n);let s=e._minimumHeights;if(r=u(s)?s.length:0,t[n++]=r,u(s))for(i=0;i<r;++i)t[n++]=s[i];let a=e._maximumHeights;if(r=u(a)?a.length:0,t[n++]=r,u(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 Tue=ie.clone(ie.UNIT_SPHERE),UB={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:Tue,granularity:void 0};Tx.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.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 c=ie.unpack(e,t,Tue);t+=ie.packedLength;let l=e[t];return u(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ie.clone(c,n._ellipsoid),n._granularity=l,n):(UB.positions=r,UB.minimumHeights=s,UB.maximumHeights=a,UB.granularity=l,new Tx(UB))};Tx.fromConstantHeights=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n,i,o=e.minimumHeight,r=e.maximumHeight,s=u(o),a=u(r);if(s||a){let l=t.length;n=s?new Array(l):void 0,i=a?new Array(l):void 0;for(let f=0;f<l;++f)s&&(n[f]=o),a&&(i[f]=r)}let c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid};return new Tx(c)};Tx.createGeometry=function(e){let t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=xx.computePositions(r,t,i,n,o,!1);if(!u(s))return;let a=s.bottomPositions,c=s.topPositions,l=c.length,f=l*2,d=new Float64Array(f),p=0;l/=3;let g;for(g=0;g<l;++g){let T=g*3,E=h.fromArray(c,T,xue),S=h.fromArray(a,T,Cue);d[p++]=S.x,d[p++]=S.y,d[p++]=S.z,d[p++]=E.x,d[p++]=E.y,d[p++]=E.z}let m=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:d})}),A=f/3;f=2*A-4+A;let x=Fe.createTypedArray(A,f),C=0;for(g=0;g<A-2;g+=2){let T=g,E=g+2,S=h.fromArray(d,T*3,xue),D=h.fromArray(d,E*3,Cue);if(h.equalsEpsilon(S,D,P.EPSILON10))continue;let w=g+1,R=g+3;x[C++]=w,x[C++]=T,x[C++]=w,x[C++]=R,x[C++]=T,x[C++]=E}return x[C++]=A-2,x[C++]=A-1,new ct({attributes:m,indices:x,primitiveType:Me.LINES,boundingSphere:new se.fromVertices(d)})};var kB=Tx;var Eue=new z;function vqe(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 Nd(e,t){si.call(this,{entity:e,scene:t,geometryOptions:new vqe(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}u(Object.create)&&(Nd.prototype=Object.create(si.prototype),Nd.prototype.constructor=Nd);Nd.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i,o,r=new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Mt){let c;u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,Eue)),u(c)||(c=z.WHITE),o=Nt.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new At({id:t,geometry:new VB(this._options),attributes:i})};Nd.prototype.createOutlineGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=Y.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Eue),o=this._distanceDisplayConditionProperty.getValue(e);return new At({id:t,geometry:new kB(this._options),attributes:{show:new _n(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:Nt.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};Nd.prototype._isHidden=function(e,t){return!u(t.positions)||si.prototype._isHidden.call(this,e,t)};Nd.prototype._getIsClosed=function(e){return!1};Nd.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Y.isConstant(t.minimumHeights)||!Y.isConstant(t.maximumHeights)||!Y.isConstant(t.outlineWidth)||!Y.isConstant(t.granularity)};Nd.prototype._setStaticOptions=function(e,t){let n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof Mt,s=this._options;s.vertexFormat=r?on.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ze.MINIMUM_VALUE,s.positions),s.minimumHeights=u(n)?n.getValue(ze.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=u(i)?i.getValue(ze.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=u(o)?o.getValue(ze.MINIMUM_VALUE):void 0};Nd.DynamicGeometryUpdater=ub;function ub(e,t,n){ri.call(this,e,t,n)}u(Object.create)&&(ub.prototype=Object.create(ri.prototype),ub.prototype.constructor=ub);ub.prototype._isHidden=function(e,t,n){return!u(this._options.positions)||ri.prototype._isHidden.call(this,e,t,n)};ub.prototype._setOptions=function(e,t,n){let i=this._options;i.positions=Y.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=Y.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=Y.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=Y.getValueOrUndefined(t.granularity,n)};var zB=Nd;var wqe=[],bue=[hP,rB,ZR,yB,xB,EB,vB,MB,LB,zB];function HB(e,t){this.entity=e,this.scene=t;let n=new Array(bue.length),i=new Ae;function o(s){i.raiseEvent(s)}let r=new wr;for(let s=0;s<n.length;s++){let a=new bue[s](e,t);r.add(a.geometryChanged,o),n[s]=a}this.updaters=n,this.geometryChanged=i,this.eventHelper=r,this._removeEntitySubscription=e.definitionChanged.addEventListener(HB.prototype._onEntityPropertyChanged,this)}HB.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)};HB.prototype.forEach=function(e){let t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};HB.prototype.destroy=function(){this.eventHelper.removeAll();let e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),le(this)};function xf(e,t,n,i){n=y(n,e.primitives),i=y(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new xt,this._removedObjects=new xt,this._changedObjects=new xt;let o=gn.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=jo.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new lb(n,e,s,!1),this._outlineBatches[o+s]=new lb(n,e,s,!0),this._closedColorBatches[s]=new gf(n,on,void 0,!0,s,!0),this._closedColorBatches[o+s]=new gf(n,on,void 0,!0,s,!1),this._closedMaterialBatches[s]=new yf(n,oo,void 0,!0,s,!0),this._closedMaterialBatches[o+s]=new yf(n,oo,void 0,!0,s,!1),this._openColorBatches[s]=new gf(n,on,void 0,!1,s,!0),this._openColorBatches[o+s]=new gf(n,on,void 0,!1,s,!1),this._openMaterialBatches[s]=new yf(n,oo,void 0,!1,s,!0),this._openMaterialBatches[o+s]=new yf(n,oo,void 0,!1,s,!1);let a=Un.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(a),l=[];if(r)for(s=0;s<a;++s)l.push(new NB(i,s,oo)),c[s]=new sb(i,s);else for(s=0;s<a;++s)c[s]=new sb(i,s);this._groundColorBatches=c,this._groundMaterialBatches=l,this._dynamicBatch=new fx(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new xt,this._updaterSets=new xt,this._entityCollection=t,t.collectionChanged.addEventListener(xf.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,wqe)}xf.prototype.update=function(e){let t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values,a,c,l,f,d=this;for(a=s.length-1;a>-1;a--)c=s[a],l=c.id,f=this._updaterSets.get(l),f.entity===c?f.forEach(function(A){d._removeUpdater(A),d._insertUpdaterIntoBatch(e,A)}):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],l=c.id,f=this._updaterSets.get(l),f.forEach(this._removeUpdater.bind(this)),f.destroy(),this._updaterSets.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(a=n.length-1;a>-1;a--)c=n[a],l=c.id,f=new HB(c,this._scene),this._updaterSets.set(l,f),f.forEach(function(A){d._insertUpdaterIntoBatch(e,A)}),this._subscriptions.set(l,f.geometryChanged.addEventListener(xf._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 Iqe=[],Pqe=new se;xf.prototype.getBoundingSphere=function(e,t){let n=Iqe,i=Pqe,o=0,r=at.DONE,s=this._batches,a=s.length,c=e.id,l=this._updaterSets.get(c).updaters;for(let f=0;f<l.length;f++){let d=l[f];for(let p=0;p<a;p++){if(r=s[p].getBoundingSphere(d,i),r===at.PENDING)return at.PENDING;r===at.DONE&&(n[o]=se.clone(i,n[o]),o++)}}return o===0?at.FAILED:(n.length=o,se.fromBoundingSpheres(n,t),at.DONE)};xf.prototype.isDestroyed=function(){return!1};xf.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(xf.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(),le(this)};xf.prototype._removeUpdater=function(e){let t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};xf.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=gn.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(u(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 Mt?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof Mt?u(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):u(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof Mt?u(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):u(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)};xf._onGeometryChanged=function(e){let t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!u(t.get(o))&&!u(n.get(o))&&n.set(o,i)};xf.prototype._onCollectionChanged=function(e,t,n){let i=this._addedObjects,o=this._removedObjects,r=this._changedObjects,s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};var GB=xf;var Oqe=1,Rqe="30px sans-serif",Bqe=No.FILL,Mqe=z.WHITE,Lqe=z.BLACK,Nqe=1,Fqe=!1,Vqe=new z(.165,.165,.165,.8),Uqe=new H(7,5),kqe=H.ZERO,zqe=h.ZERO,Hqe=We.NONE,Gqe=_i.CENTER,Wqe=On.CENTER,jqe=new h,Yqe=new z,qqe=new z,Xqe=new z,Kqe=new H,Zqe=new h,Jqe=new H,Qqe=new Pt,$qe=new Pt,eXe=new Pt,tXe=new bt;function Sue(e){this.entity=e,this.label=void 0,this.index=void 0}function fy(e,t){t.collectionChanged.addEventListener(fy.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}fy.prototype.update=function(e){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,c,l=r.label,f=s.isShowing&&s.isAvailable(e)&&Y.getValueOrDefault(a._show,e,!0),d;if(f&&(d=Y.getValueOrUndefined(s._position,e,jqe),c=Y.getValueOrUndefined(a._text,e),f=u(d)&&u(c)),!f){pW(r,s,n);continue}Y.isConstant(s._position)||(n._clusterDirty=!0);let p=!1,g=Y.getValueOrDefault(a._heightReference,e,Hqe);u(l)||(l=n.getLabel(s),l.id=s,r.label=l,p=h.equals(l.position,d)&&l.heightReference===g),l.show=!0,l.position=d,l.text=c,l.scale=Y.getValueOrDefault(a._scale,e,Oqe),l.font=Y.getValueOrDefault(a._font,e,Rqe),l.style=Y.getValueOrDefault(a._style,e,Bqe),l.fillColor=Y.getValueOrDefault(a._fillColor,e,Mqe,Yqe),l.outlineColor=Y.getValueOrDefault(a._outlineColor,e,Lqe,qqe),l.outlineWidth=Y.getValueOrDefault(a._outlineWidth,e,Nqe),l.showBackground=Y.getValueOrDefault(a._showBackground,e,Fqe),l.backgroundColor=Y.getValueOrDefault(a._backgroundColor,e,Vqe,Xqe),l.backgroundPadding=Y.getValueOrDefault(a._backgroundPadding,e,Uqe,Kqe),l.pixelOffset=Y.getValueOrDefault(a._pixelOffset,e,kqe,Jqe),l.eyeOffset=Y.getValueOrDefault(a._eyeOffset,e,zqe,Zqe),l.heightReference=g,l.horizontalOrigin=Y.getValueOrDefault(a._horizontalOrigin,e,Gqe),l.verticalOrigin=Y.getValueOrDefault(a._verticalOrigin,e,Wqe),l.translucencyByDistance=Y.getValueOrUndefined(a._translucencyByDistance,e,Qqe),l.pixelOffsetScaleByDistance=Y.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,$qe),l.scaleByDistance=Y.getValueOrUndefined(a._scaleByDistance,e,eXe),l.distanceDisplayCondition=Y.getValueOrUndefined(a._distanceDisplayCondition,e,tXe),l.disableDepthTestDistance=Y.getValueOrUndefined(a._disableDepthTestDistance,e),p&&l._updateClamping()}return!0};fy.prototype.getBoundingSphere=function(e,t){let n=this._items.get(e.id);if(!u(n)||!u(n.label))return at.FAILED;let i=n.label;return t.center=h.clone(y(i._clampedPosition,i.position),t.center),t.radius=0,at.DONE};fy.prototype.isDestroyed=function(){return!1};fy.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(fy.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return le(this)};fy.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],u(r._label)&&u(r._position)&&s.set(r.id,new Sue(r));for(o=i.length-1;o>-1;o--)r=i[o],u(r._label)&&u(r._position)?s.contains(r.id)||s.set(r.id,new Sue(r)):(pW(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],pW(s.get(r.id),r,a),s.remove(r.id)};function pW(e,t,n){u(e)&&(e.label=void 0,n.removeLabel(t))}var WB=fy;function nXe(e,t,n){return e.readyPromise.then(function(){return rXe(e,t,n)})}function iXe(e,t){let n=e[0],i=n.terrainProvider.requestTileGeometry(n.x,n.y,n.level);if(!i)return!1;let o=i.then(sXe(n)).catch(aXe(n));return e.shift(),t.push(o),!0}function oXe(e){return new Promise(function(t){setTimeout(t,e)})}function _W(e,t){return e.length?iXe(e,t)?_W(e,t):oXe(100).then(()=>_W(e,t)):Promise.resolve()}function rXe(e,t,n){let i=e.tilingScheme,o,r=[],s={};for(o=0;o<n.length;++o){let c=i.positionToTileXY(n[o],t);if(!u(c))continue;let l=c.toString();if(!s.hasOwnProperty(l)){let f={x:c.x,y:c.y,level:t,tilingScheme:i,terrainProvider:e,positions:[]};s[l]=f,r.push(f)}s[l].positions.push(n[o])}let a=[];return _W(r,a).then(function(){return Promise.all(a).then(function(){return n})})}function Due(e,t,n){let i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function sXe(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(!Due(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];Due(s,i,n)}}):Promise.resolve()}}function aXe(e){let t=e.positions;return function(){for(let n=0;n<t.length;++n){let i=t[n];i.height=void 0}}}var jB=nXe;var gW=new H;function vue(e,t){return e.readyPromise.then(function(){let n=[],i=[],o=e.availability,r=[];for(let s=0;s<t.length;++s){let a=t[s],c=o.computeMaximumLevelAtPosition(a);if(i[s]=c,c===0){e.tilingScheme.positionToTileXY(a,1,gW);let f=e.loadTileDataAvailability(gW.x,gW.y,1);u(f)&&r.push(f)}let l=n[c];u(l)||(n[c]=l=[]),l.push(a)}return Promise.all(r).then(function(){return Promise.all(n.map(function(s,a){if(u(s))return jB(e,a,s)}))}).then(function(){let s=[];for(let a=0;a<t.length;++a){let c=t[a];o.computeMaximumLevelAtPosition(c)!==i[a]&&s.push(c)}if(s.length>0)return vue(e,s)}).then(function(){return t})})}var u_=vue;var cXe=1,lXe=0,uXe=!0,fXe=!0,dXe=gn.ENABLED,hXe=We.NONE,mXe=z.RED,pXe=0,_Xe=z.WHITE,gXe=ja.HIGHLIGHT,yXe=.5,AXe=new H(1,1),xXe=new M,CXe=new M,wue=new z;function Jh(e,t){t.collectionChanged.addEventListener(Jh.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new xt,this._onCollectionChanged(t,t.values,[],[])}Jh.prototype.update=function(e){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,c,l=n[s.id],f=s.isShowing&&s.isAvailable(e)&&Y.getValueOrDefault(a._show,e,!0),d;if(f&&(d=s.computeModelMatrix(e,xXe),c=Oe.createIfNeeded(Y.getValueOrUndefined(a._uri,e)),f=u(d)&&u(c)),!f){u(l)&&(l.modelPrimitive.show=!1);continue}let p=u(l)?l.modelPrimitive:void 0;if((!u(p)||c.url!==l.url)&&(u(p)&&(i.removeAndDestroy(p),delete n[s.id]),p=pd.fromGltf({url:c,incrementallyLoadTextures:Y.getValueOrDefault(a._incrementallyLoadTextures,e,uXe),scene:this._scene}),p.id=s,i.add(p),l={modelPrimitive:p,url:c.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1,awaitingSampleTerrain:!1,clampedBoundingSphere:void 0,sampleTerrainFailed:!1},n[s.id]=l,EXe(p,s,n)),p.show=!0,p.scale=Y.getValueOrDefault(a._scale,e,cXe),p.minimumPixelSize=Y.getValueOrDefault(a._minimumPixelSize,e,lXe),p.maximumScale=Y.getValueOrUndefined(a._maximumScale,e),p.modelMatrix=M.clone(d,p.modelMatrix),p.shadows=Y.getValueOrDefault(a._shadows,e,dXe),p.heightReference=Y.getValueOrDefault(a._heightReference,e,hXe),p.distanceDisplayCondition=Y.getValueOrUndefined(a._distanceDisplayCondition,e),p.silhouetteColor=Y.getValueOrDefault(a._silhouetteColor,e,mXe,wue),p.silhouetteSize=Y.getValueOrDefault(a._silhouetteSize,e,pXe),p.color=Y.getValueOrDefault(a._color,e,_Xe,wue),p.colorBlendMode=Y.getValueOrDefault(a._colorBlendMode,e,gXe),p.colorBlendAmount=Y.getValueOrDefault(a._colorBlendAmount,e,yXe),p.clippingPlanes=Y.getValueOrUndefined(a._clippingPlanes,e),p.clampAnimations=Y.getValueOrDefault(a._clampAnimations,e,fXe),p.imageBasedLighting.imageBasedLightingFactor=Y.getValueOrDefault(a._imageBasedLightingFactor,e,AXe),p.lightColor=Y.getValueOrUndefined(a._lightColor,e),p.customShader=Y.getValueOrUndefined(a._customShader,e),p.ready){let g=Y.getValueOrDefault(a._runAnimations,e,!0);l.animationsRunning!==g&&(g?p.activeAnimations.addAll({loop:Ga.REPEAT}):p.activeAnimations.removeAll(),l.animationsRunning=g);let m=Y.getValueOrUndefined(a._nodeTransformations,e,l.nodeTransformationsScratch);if(u(m)){let C=Object.keys(m);for(let T=0,E=C.length;T<E;++T){let S=C[T],D=m[S];if(!u(D))continue;let w=p.getNode(S);if(!u(w))continue;let R=M.fromTranslationRotationScale(D,CXe);w.matrix=M.multiply(w.originalMatrix,R,R)}}let A=!1,x=Y.getValueOrUndefined(a._articulations,e,l.articulationsScratch);if(u(x)){let C=Object.keys(x);for(let T=0,E=C.length;T<E;++T){let S=C[T],D=x[S];u(D)&&(A=!0,p.setArticulationStage(S,D))}}A&&p.applyArticulations()}}return!0};Jh.prototype.isDestroyed=function(){return!1};Jh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Jh.prototype._onCollectionChanged,this);let e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)yW(this,e[i],t,n);return le(this)};Jh._sampleTerrainMostDetailed=u_;var fb=new h,Iue=new he;Jh.prototype.getBoundingSphere=function(e,t){let n=this._modelHash[e.id];if(!u(n)||n.loadFail)return at.FAILED;let i=n.modelPrimitive;if(!u(i)||!i.show)return at.FAILED;if(!i.ready)return at.PENDING;let r=this._scene.globe,s=r.ellipsoid,a=r.terrainProvider;if(i.heightReference!==We.NONE){if(!a.ready)return at.PENDING;let l=i.modelMatrix;fb.x=l[12],fb.y=l[13],fb.z=l[14];let f=s.cartesianToCartographic(fb);if(!u(a.availability)){i.heightReference===We.CLAMP_TO_GROUND&&(f.height=0);let g=s.cartographicToCartesian(f);return se.clone(i.boundingSphere,t),t.center=g,at.DONE}let d=this._modelHash[e.id].clampedBoundingSphere;return this._modelHash[e.id].sampleTerrainFailed?(this._modelHash[e.id].sampleTerrainFailed=!1,at.FAILED):u(d)?(se.clone(d,t),this._modelHash[e.id].clampedBoundingSphere=void 0,at.DONE):(d=new se,this._modelHash[e.id].awaitingSampleTerrain||(he.clone(f,Iue),this._modelHash[e.id].awaitingSampleTerrain=!0,Jh._sampleTerrainMostDetailed(a,[Iue]).then(m=>{this._modelHash[e.id].awaitingSampleTerrain=!1;let A=m[0];i.heightReference===We.RELATIVE_TO_GROUND&&(A.height+=f.height),s.cartographicToCartesian(A,fb),se.clone(i.boundingSphere,d),d.center=fb,this._modelHash[e.id].clampedBoundingSphere=se.clone(d)}).catch(m=>{this._modelHash[e.id].sampleTerrainFailed=!0,this._modelHash[e.id].awaitingSampleTerrain=!1})),at.PENDING)}return se.clone(i.boundingSphere,t),at.DONE};Jh.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s=this._entitiesToVisualize,a=this._modelHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],u(r._model)&&u(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],u(r._model)&&u(r._position)?(TXe(r,a),s.set(r.id,r)):(yW(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],yW(this,r,a,c),s.remove(r.id)};function yW(e,t,n,i){let o=n[t.id];u(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function TXe(e,t){let n=t[e.id];u(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function EXe(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}var YB=Jh;function dy(e){this._definitionChanged=new Ae,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(dy.prototype,{isConstant:{get:function(){return Y.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return u(this._value)?this._value.referenceFrame:to.FIXED}}});dy.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,to.FIXED,t)};dy.prototype.setValue=function(e){this._value!==e&&(this._value=e,u(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),u(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};dy.prototype.getValueInReferenceFrame=function(e,t,n){if(u(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),u(n)?ie.WGS84.scaleToGeodeticSurface(n,n):void 0};dy.prototype.equals=function(e){return this===e||e instanceof dy&&this._value===e._value};dy.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};var Qh=dy;var bXe=60,SXe=1,Rue=new An,AW=new An,xW=new An;function Pue(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function DXe(e,t,n,i,o,r,s,a,c){let l=a,f;f=e.getValueInReferenceFrame(t,r,c[l]),u(f)&&(c[l++]=f);let d=!u(o)||$.lessThanOrEquals(o,t)||$.greaterThanOrEquals(o,n),p=0,g=i.length,m=i[p],A=n,x=!1,C,T,E;for(;p<g;){if(!d&&$.greaterThanOrEquals(m,o)&&(f=e.getValueInReferenceFrame(o,r,c[l]),u(f)&&(c[l++]=f),d=!0),$.greaterThan(m,t)&&$.lessThan(m,A)&&!m.equals(o)&&(f=e.getValueInReferenceFrame(m,r,c[l]),u(f)&&(c[l++]=f)),p<g-1){if(s>0&&!x){let S=i[p+1],D=$.secondsDifference(S,m);x=D>s,x&&(C=Math.ceil(D/s),T=0,E=D/Math.max(C,2),C=Math.max(C-1,1))}if(x&&T<C){m=$.addSeconds(m,E,new $),T++;continue}}x=!1,p++,m=i[p]}return f=e.getValueInReferenceFrame(n,r,c[l]),u(f)&&(c[l++]=f),l}function vXe(e,t,n,i,o,r,s,a){let c,l=0,f=s,d=t,p=Math.max(r,60),g=!u(i)||$.lessThanOrEquals(i,t)||$.greaterThanOrEquals(i,n);for(;$.lessThan(d,n);)!g&&$.greaterThanOrEquals(d,i)&&(g=!0,c=e.getValueInReferenceFrame(i,o,a[f]),u(c)&&(a[f]=c,f++)),c=e.getValueInReferenceFrame(d,o,a[f]),u(c)&&(a[f]=c,f++),l++,d=$.addSeconds(t,p*l,new $);return c=e.getValueInReferenceFrame(n,o,a[f]),u(c)&&(a[f]=c,f++),f}function wXe(e,t,n,i,o,r,s,a){xW.start=t,xW.stop=n;let c=s,l=e.intervals;for(let f=0;f<l.length;f++){let d=l.get(f);if(!An.intersect(d,xW,Rue).isEmpty){let p=d.start;d.isStartIncluded||(d.isStopIncluded?p=d.stop:p=$.addSeconds(d.start,$.secondsDifference(d.stop,d.start)/2,new $));let g=e.getValueInReferenceFrame(p,o,a[c]);u(g)&&(a[c]=g,c++)}}return c}function IXe(e,t,n,i,o,r,s,a){let c=e.getValueInReferenceFrame(t,o,a[s]);return u(c)&&(a[s++]=c),s}function PXe(e,t,n,i,o,r,s,a){AW.start=t,AW.stop=n;let c=s,l=e.intervals;for(let f=0;f<l.length;f++){let d=l.get(f);if(!An.intersect(d,AW,Rue).isEmpty){let p=d.start,g=d.stop,m=t;$.greaterThan(p,m)&&(m=p);let A=n;$.lessThan(g,A)&&(A=g),c=Bue(d.data,m,A,i,o,r,c,a)}}return c}function Bue(e,t,n,i,o,r,s,a){for(;e instanceof i_;)e=e.resolvedProperty;if(e instanceof Ys){let c=e._property._times;s=DXe(e,t,n,c,i,o,r,s,a)}else e instanceof Ws?s=PXe(e,t,n,i,o,r,s,a):e instanceof o_?s=wXe(e,t,n,i,o,r,s,a):e instanceof Sc||e instanceof Qh&&Y.isConstant(e)?s=IXe(e,t,n,i,o,r,s,a):s=vXe(e,t,n,i,o,r,s,a);return s}function Mue(e,t,n,i,o,r,s){u(s)||(s=[]);let a=Bue(e,t,n,i,o,r,0,s);return s.length=a,s}var Oue=new Z;function qB(e,t){this._unusedIndexes=[],this._polylineCollection=new gd,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}qB.prototype.update=function(e){if(this._referenceFrame===to.INERTIAL){let t=Ot.computeIcrfToFixedMatrix(e,Oue);u(t)||(t=Ot.computeTemeToPseudoFixedMatrix(e,Oue)),M.fromRotationTranslation(t,h.ZERO,this._polylineCollection.modelMatrix)}};qB.prototype.updateObject=function(e,t){let n=t.entity,i=n._path,o=n._position,r,s,a=i._show,c=t.polyline,l=n.isShowing&&n.isAvailable(e)&&(!u(a)||a.getValue(e));if(l){let d=Y.getValueOrUndefined(i._leadTime,e),p=Y.getValueOrUndefined(i._trailTime,e),g=n._availability,m=u(g),A=u(d),x=u(p);if(l=m||A&&x,l){if(x&&(r=$.addSeconds(e,-p,new $)),A&&(s=$.addSeconds(e,d,new $)),m){let C=g.start,T=g.stop;(!x||$.greaterThan(C,r))&&(r=C),(!A||$.lessThan(T,s))&&(s=T)}l=$.lessThan(r,s)}}if(!l){u(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0);return}if(!u(c)){let d=this._unusedIndexes;if(d.length>0){let g=d.pop();c=this._polylineCollection.get(g),t.index=g}else t.index=this._polylineCollection.length,c=this._polylineCollection.add();c.id=n,t.polyline=c}let f=Y.getValueOrDefault(i._resolution,e,bXe);c.show=!0,c.positions=Mue(o,r,s,e,this._referenceFrame,f,c.positions.slice()),c.material=Wo.getValue(e,i._material,c.material),c.width=Y.getValueOrDefault(i._width,e,SXe),c.distanceDisplayCondition=Y.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)};qB.prototype.removeObject=function(e){let t=e.polyline;u(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};qB.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),le(this)};function hy(e,t){t.collectionChanged.addEventListener(hy.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}hy.prototype.update=function(e){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&&u(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,c=r.updater,l=to.FIXED;this._scene.mode===te.SCENE3D&&(l=a.referenceFrame);let f=this._updaters[l];if(c===f&&u(f)){f.updateObject(e,r);continue}u(c)&&c.removeObject(r),u(f)||(f=new qB(this._scene,l),f.update(e),this._updaters[l]=f),r.updater=f,u(f)&&f.updateObject(e,r)}return!0};hy.prototype.isDestroyed=function(){return!1};hy.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(hy.prototype._onCollectionChanged,this);let e=this._updaters;for(let t in e)e.hasOwnProperty(t)&&e[t].destroy();return le(this)};hy.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],u(r._path)&&u(r._position)&&a.set(r.id,new Pue(r));for(o=i.length-1;o>-1;o--)r=i[o],u(r._path)&&u(r._position)?a.contains(r.id)||a.set(r.id,new Pue(r)):(s=a.get(r.id),u(s)&&(u(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),u(s)&&(u(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};hy._subSample=Mue;var XB=hy;var Lue=z.WHITE,Nue=z.BLACK,Fue=0,Vue=1,Uue=0,kue=new z,OXe=new h,zue=new z,Hue=new Pt,Gue=new Pt,Wue=new bt;function jue(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 my(e,t){t.collectionChanged.addEventListener(my.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}my.prototype.update=function(e){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,c=r.pointPrimitive,l=r.billboard,f=Y.getValueOrDefault(a._heightReference,e,We.NONE),d=s.isShowing&&s.isAvailable(e)&&Y.getValueOrDefault(a._show,e,!0),p;if(d&&(p=Y.getValueOrUndefined(s._position,e,OXe),d=u(p)),!d){KB(r,s,n);continue}Y.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,m=!1;if(f!==We.NONE&&!u(l)?(u(c)&&(KB(r,s,n),c=void 0),l=n.getBillboard(s),l.id=s,l.image=void 0,r.billboard=l,g=!0,m=h.equals(l.position,p)&&l.heightReference===f):f===We.NONE&&!u(c)&&(u(l)&&(KB(r,s,n),l=void 0),c=n.getPoint(s),c.id=s,r.pointPrimitive=c),u(c))c.show=!0,c.position=p,c.scaleByDistance=Y.getValueOrUndefined(a._scaleByDistance,e,Hue),c.translucencyByDistance=Y.getValueOrUndefined(a._translucencyByDistance,e,Gue),c.color=Y.getValueOrDefault(a._color,e,Lue,kue),c.outlineColor=Y.getValueOrDefault(a._outlineColor,e,Nue,zue),c.outlineWidth=Y.getValueOrDefault(a._outlineWidth,e,Fue),c.pixelSize=Y.getValueOrDefault(a._pixelSize,e,Vue),c.distanceDisplayCondition=Y.getValueOrUndefined(a._distanceDisplayCondition,e,Wue),c.disableDepthTestDistance=Y.getValueOrDefault(a._disableDepthTestDistance,e,Uue);else if(u(l)){l.show=!0,l.position=p,l.scaleByDistance=Y.getValueOrUndefined(a._scaleByDistance,e,Hue),l.translucencyByDistance=Y.getValueOrUndefined(a._translucencyByDistance,e,Gue),l.distanceDisplayCondition=Y.getValueOrUndefined(a._distanceDisplayCondition,e,Wue),l.disableDepthTestDistance=Y.getValueOrDefault(a._disableDepthTestDistance,e,Uue),l.heightReference=f;let A=Y.getValueOrDefault(a._color,e,Lue,kue),x=Y.getValueOrDefault(a._outlineColor,e,Nue,zue),C=Math.round(Y.getValueOrDefault(a._outlineWidth,e,Fue)),T=Math.max(1,Math.round(Y.getValueOrDefault(a._pixelSize,e,Vue)));if(C>0?(l.scale=1,g=g||C!==r.outlineWidth||T!==r.pixelSize||!z.equals(A,r.color)||!z.equals(x,r.outlineColor)):(l.scale=T/50,T=50,g=g||C!==r.outlineWidth||!z.equals(A,r.color)||!z.equals(x,r.outlineColor)),g){r.color=z.clone(A,r.color),r.outlineColor=z.clone(x,r.outlineColor),r.pixelSize=T,r.outlineWidth=C;let E=A.alpha,S=A.toCssColorString(),D=x.toCssColorString(),w=JSON.stringify([S,T,D,C]);l.setImage(w,OA(E,S,D,C,T))}m&&l._updateClamping()}}return!0};my.prototype.getBoundingSphere=function(e,t){let n=this._items.get(e.id);if(!u(n)||!(u(n.pointPrimitive)||u(n.billboard)))return at.FAILED;if(u(n.pointPrimitive))t.center=h.clone(n.pointPrimitive.position,t.center);else{let i=n.billboard;if(!u(i._clampedPosition))return at.PENDING;t.center=h.clone(i._clampedPosition,t.center)}return t.radius=0,at.DONE};my.prototype.isDestroyed=function(){return!1};my.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(my.prototype._onCollectionChanged,this);let e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return le(this)};my.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],u(r._point)&&u(r._position)&&s.set(r.id,new jue(r));for(o=i.length-1;o>-1;o--)r=i[o],u(r._point)&&u(r._position)?s.contains(r.id)||s.set(r.id,new jue(r)):(KB(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],KB(s.get(r.id),r,a),s.remove(r.id)};function KB(e,t,n){if(u(e)){let i=e.pointPrimitive;if(u(i)){e.pointPrimitive=void 0,n.removePoint(t);return}let o=e.billboard;u(o)&&(e.billboard=void 0,n.removeBillboard(t))}}var ZB=my;var Zue=[];function RXe(e,t,n,i,o){let r=Zue;r.length=o;let s,a=n.red,c=n.green,l=n.blue,f=n.alpha,d=i.red,p=i.green,g=i.blue,m=i.alpha;if(z.equals(n,i)){for(s=0;s<o;s++)r[s]=z.clone(n);return r}let A=(d-a)/o,x=(p-c)/o,C=(g-l)/o,T=(m-f)/o;for(s=0;s<o;s++)r[s]=new z(a+s*A,c+s*x,l+s*C,f+s*T);return r}function JB(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.colors,i=y(e.width,1),o=y(e.colorsPerVertex,!1);this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Ie.clone(y(e.vertexFormat,Ie.DEFAULT)),this._arcType=y(e.arcType,Kt.GEODESIC),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._ellipsoid=ie.clone(y(e.ellipsoid,ie.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*h.packedLength;r+=u(n)?1+n.length*z.packedLength:1,this.packedLength=r+ie.packedLength+Ie.packedLength+4}JB.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.pack(o[i],t,n);let s=e._colors;for(r=u(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=z.packedLength)z.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 Jue=ie.clone(ie.UNIT_SPHERE),Que=new Ie,Ex={positions:void 0,colors:void 0,ellipsoid:Jue,vertexFormat:Que,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};JB.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.unpack(e,t);o=e[t++];let s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=z.packedLength)s[i]=z.unpack(e,t);let a=ie.unpack(e,t,Jue);t+=ie.packedLength;let c=Ie.unpack(e,t,Que);t+=Ie.packedLength;let l=e[t++],f=e[t++]===1,d=e[t++],p=e[t];return u(n)?(n._positions=r,n._colors=s,n._ellipsoid=ie.clone(a,n._ellipsoid),n._vertexFormat=Ie.clone(c,n._vertexFormat),n._width=l,n._colorsPerVertex=f,n._arcType=d,n._granularity=p,n):(Ex.positions=r,Ex.colors=s,Ex.width=l,Ex.colorsPerVertex=f,Ex.arcType=d,Ex.granularity=p,new JB(Ex))};var Yue=new h,que=new h,Xue=new h,Kue=new h;JB.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,c,l,f,d=[],p=go(e._positions,h.equalsEpsilon,!1,d);if(u(i)&&d.length>0){let B=0,F=d[0];i=i.filter(function(k,U){let G=!1;return o?G=U===F||U===0&&F===1:G=U+1===F,G?(B++,F=d[B],!1):!0})}let g=p.length;if(g<2||t<=0)return;if(r===Kt.GEODESIC||r===Kt.RHUMB){let B,F;r===Kt.GEODESIC?(B=P.chordLength(s,a.maximumRadius),F=Di.numberOfPoints):(B=s,F=Di.numberOfPointsRhumbLine);let k=Di.extractHeights(p,a);if(u(i)){let U=1;for(c=0;c<g-1;++c)U+=F(p[c],p[c+1],B);let G=new Array(U),V=0;for(c=0;c<g-1;++c){let X=p[c],j=p[c+1],Q=i[c],W=F(X,j,B);if(o&&c<U){let K=i[c+1],J=RXe(X,j,Q,K,W),_e=J.length;for(l=0;l<_e;++l)G[V++]=J[l]}else for(l=0;l<W;++l)G[V++]=z.clone(Q)}G[V]=z.clone(i[i.length-1]),i=G,Zue.length=0}r===Kt.GEODESIC?p=Di.generateCartesianArc({positions:p,minDistance:B,ellipsoid:a,height:k}):p=Di.generateCartesianRhumbArc({positions:p,granularity:B,ellipsoid:a,height:k})}g=p.length;let m=g*4-4,A=new Float64Array(m*3),x=new Float64Array(m*3),C=new Float64Array(m*3),T=new Float32Array(m*2),E=n.st?new Float32Array(m*2):void 0,S=u(i)?new Uint8Array(m*4):void 0,D=0,w=0,R=0,O=0,L;for(l=0;l<g;++l){l===0?(L=Yue,h.subtract(p[0],p[1],L),h.add(p[0],L,L)):L=p[l-1],h.clone(L,Xue),h.clone(p[l],que),l===g-1?(L=Yue,h.subtract(p[g-1],p[g-2],L),h.add(p[g-1],L,L)):L=p[l+1],h.clone(L,Kue);let B,F;u(S)&&(l!==0&&!o?B=i[l-1]:B=i[l],l!==g-1&&(F=i[l]));let k=l===0?2:0,U=l===g-1?2:4;for(f=k;f<U;++f){h.pack(que,A,D),h.pack(Xue,x,D),h.pack(Kue,C,D),D+=3;let G=f-2<0?-1:1;if(T[w++]=2*(f%2)-1,T[w++]=G*t,n.st&&(E[R++]=l/(g-1),E[R++]=Math.max(T[w-2],0)),u(S)){let V=f<2?B:F;S[O++]=z.floatToByte(V.red),S[O++]=z.floatToByte(V.green),S[O++]=z.floatToByte(V.blue),S[O++]=z.floatToByte(V.alpha)}}}let N=new dn;N.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:A}),N.prevPosition=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:x}),N.nextPosition=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:C}),N.expandAndWidth=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:T}),n.st&&(N.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:E})),u(S)&&(N.color=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:4,values:S,normalize:!0}));let _=Fe.createTypedArray(m,g*6-6),b=0,v=0,I=g-1;for(l=0;l<I;++l)_[v++]=b,_[v++]=b+2,_[v++]=b+1,_[v++]=b+1,_[v++]=b+2,_[v++]=b+3,b+=4;return new ct({attributes:N,indices:_,primitiveType:Me.TRIANGLES,boundingSphere:se.fromPoints(p),geometryType:Nu.POLYLINES})};var f_=JB;var BXe=new ei(0),ik={},$ue=new z,MXe=new Mt(z.WHITE),LXe=new ei(!0),NXe=new ei(gn.DISABLED),FXe=new ei(new bt),VXe=new ei(Un.BOTH);function UXe(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function kXe(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Fd(e,t){this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Fd.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Ae,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 UXe,this._groundGeometryOptions=new kXe,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=jo.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Fd.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||!u(this._entity.availability)&&Y.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}}});Fd.prototype.isOutlineVisible=function(e){return!1};Fd.prototype.isFilled=function(e){let t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e);return y(n,!1)};Fd.prototype.createFillGeometryInstance=function(e){let t=this._entity,n=t.isAvailable(e),i=new _n(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r},a;return this._materialProperty instanceof Mt&&(u(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,$ue)),u(a)||(a=z.WHITE),s.color=Nt.fromColor(a)),this.clampToGround?new At({id:t,geometry:new k0(this._groundGeometryOptions),attributes:s}):(u(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof Mt&&(u(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,$ue)),u(a)||(a=z.WHITE),s.depthFailColor=Nt.fromColor(a)),new At({id:t,geometry:new f_(this._geometryOptions),attributes:s}))};Fd.prototype.createOutlineGeometryInstance=function(e){};Fd.prototype.isDestroyed=function(){return!1};Fd.prototype.destroy=function(){this._entitySubscription(),le(this)};Fd.prototype._onEntityPropertyChanged=function(e,t,n,i){if(!(t==="availability"||t==="polyline"))return;let o=this._entity.polyline;if(!u(o)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let r=o.positions,s=o.show;if(u(s)&&s.isConstant&&!s.getValue(ze.MINIMUM_VALUE)||!u(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let a=o.zIndex,c=y(o.material,MXe),l=c instanceof Mt;this._materialProperty=c,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=y(s,LXe),this._shadowsProperty=y(o.shadows,NXe),this._distanceDisplayConditionProperty=y(o.distanceDisplayCondition,FXe),this._classificationTypeProperty=y(o.classificationType,VXe),this._fillEnabled=!0,this._zIndex=y(a,BXe);let f=o.width,d=o.arcType,p=o.clampToGround,g=o.granularity;if(!r.isConstant||!Y.isConstant(f)||!Y.isConstant(d)||!Y.isConstant(g)||!Y.isConstant(p)||!Y.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{let m=this._geometryOptions,A=r.getValue(ze.MINIMUM_VALUE,m.positions);if(!u(A)||A.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let x;l&&(!u(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof Mt)?x=Vr.VERTEX_FORMAT:x=Vs.VERTEX_FORMAT,m.vertexFormat=x,m.positions=A,m.width=u(f)?f.getValue(ze.MINIMUM_VALUE):void 0,m.arcType=u(d)?d.getValue(ze.MINIMUM_VALUE):void 0,m.granularity=u(g)?g.getValue(ze.MINIMUM_VALUE):void 0;let C=this._groundGeometryOptions;C.positions=A,C.width=m.width,C.arcType=m.arcType,C.granularity=m.granularity,this._clampToGround=u(p)?p.getValue(ze.MINIMUM_VALUE):!1,!this._clampToGround&&u(a)&&wt("Entity polylines must have clampToGround: true when using zIndex.  zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Fd.prototype.createDynamicUpdater=function(e,t){return new QB(e,t,this)};var db={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function QB(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 efe(e){if(u(e._line))return e._line;let t=e._geometryUpdater._scene.id,n=ik[t],i=e._primitives;!u(n)||n.isDestroyed()?(n=new gd,ik[t]=n,i.add(n)):i.contains(n)||i.add(n);let o=n.add();return o.id=e._geometryUpdater._entity,e._line=o,o}QB.prototype.update=function(e){let t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions,r=Y.getValueOrUndefined(o,e,this._positions);t._clampToGround=Y.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=Y.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=Y.getValueOrDefault(i._arcType,e,Kt.GEODESIC),t._groundGeometryOptions.granularity=Y.getValueOrDefault(i._granularity,e,9999);let s=this._groundPrimitives;if(u(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!Y.getValueOrDefault(i._show,e,!0)||!u(r)||r.length<2)return;let f=t.fillMaterialProperty,d;if(f instanceof Mt)d=new Vr;else{let p=Wo.getValue(e,f,this._material);d=new Vs({material:p,translucent:p.isTranslucent()}),this._material=p}this._groundPolylinePrimitive=s.add(new Qf({geometryInstances:t.createFillGeometryInstance(e),appearance:d,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Y.getValueOrUndefined(t.zIndex,e)),u(this._line)&&(this._line.show=!1);return}let a=efe(this);if(!n.isShowing||!n.isAvailable(e)||!Y.getValueOrDefault(i._show,e,!0)){a.show=!1;return}if(!u(r)||r.length<2){a.show=!1;return}let c=Kt.GEODESIC;c=Y.getValueOrDefault(i._arcType,e,c);let l=t._scene.globe;c!==Kt.NONE&&u(l)&&(db.ellipsoid=l.ellipsoid,db.positions=r,db.granularity=Y.getValueOrUndefined(i._granularity,e),db.height=Di.extractHeights(r,l.ellipsoid),c===Kt.GEODESIC?r=Di.generateCartesianArc(db):r=Di.generateCartesianRhumbArc(db)),a.show=!0,a.positions=r.slice(),a.material=Wo.getValue(e,t.fillMaterialProperty,a.material),a.width=Y.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=Y.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};QB.prototype.getBoundingSphere=function(e){if(this._geometryUpdater.clampToGround){let t=this._groundPolylinePrimitive;if(u(t)&&t.show&&t.ready){let n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(u(n)&&u(n.boundingSphere))return se.clone(n.boundingSphere,e),at.DONE}return u(t)&&!t.ready?at.PENDING:at.DONE}else{let t=efe(this);if(t.show&&t.positions.length>0)return se.fromPoints(t.positions,e),at.DONE}return at.FAILED};QB.prototype.isDestroyed=function(){return!1};QB.prototype.destroy=function(){let t=this._geometryUpdater._scene.id,n=ik[t];u(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete ik[t])),u(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),le(this)};var $B=Fd;var zXe=new z,HXe=new bt,GXe=new bt;function Vd(e,t,n,i,o){let r;n instanceof Mt?r=Vr:r=Vs,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Vd.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt,this.zIndex=i,this._asynchronous=o}Vd.prototype.onMaterialChanged=function(){this.invalidated=!0};Vd.prototype.isMaterial=function(e){let t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Mt&&t instanceof Mt?!0:u(t)&&t.equals(n)};Vd.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||!Y.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{let o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,c){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Vd.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 u(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};Vd.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)u(n)&&(u(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new Qf({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===Vs&&(this.material=Wo.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{u(n)&&(i.remove(n),n=void 0);let a=this.oldPrimitive;u(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(u(n)&&n.ready){n.show=!0,u(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===Vs&&(this.material=Wo.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 c=s[r],l=c.entity,f=this.geometry.get(c.id),d=this.attributes.get(f.id.id);if(u(d)||(d=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,d)),!c.fillMaterialProperty.isConstant){let A=c.fillMaterialProperty.color,x=Y.getValueOrDefault(A,e,z.WHITE,zXe);z.equals(d._lastColor,x)||(d._lastColor=z.clone(x,d._lastColor),d.color=Nt.toValue(x,d.color))}let p=l.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=d.show[0]===1;p!==g&&(d.show=_n.toValue(p,d.show));let m=c.distanceDisplayConditionProperty;if(!Y.isConstant(m)){let A=Y.getValueOrDefault(m,e,GXe,HXe);bt.equals(A,d._lastDistanceDisplayCondition)||(d._lastDistanceDisplayCondition=bt.clone(A,d._lastDistanceDisplayCondition),d.distanceDisplayCondition=Vn.toValue(A,d.distanceDisplayCondition))}}this.updateShows(n)}else u(n)&&!n.ready&&(t=!1);return t};Vd.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);u(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));let c=r.isShowing,l=a.show[0]===1;c!==l&&(a.show=_n.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Vd.prototype.contains=function(e){return this.updaters.contains(e.id)};Vd.prototype.getBoundingSphere=function(e,t){let n=this.primitive;if(!n.ready)return at.PENDING;let i=n.getGeometryInstanceAttributes(e.entity);return!u(i)||!u(i.boundingSphere)||u(i.show)&&i.show[0]===0?at.FAILED:(i.boundingSphere.clone(t),at.DONE)};Vd.prototype.destroy=function(){let e=this.primitive,t=this.orderedGroundPrimitives;u(e)&&t.remove(e);let n=this.oldPrimitive;u(n)&&t.remove(n),this.removeMaterialSubscription()};function hb(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=y(n,!0)}hb.prototype.add=function(e,t){let n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Y.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){let c=n[a];if(c.isMaterial(t)&&c.zIndex===r){c.add(e,t,o);return}}let s=new Vd(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};hb.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}}};hb.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 c=0;c<a;c++)this.add(e,s[c]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};hb.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 at.FAILED};hb.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 eM=hb;var WXe=[];function tfe(e,t){let n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function nfe(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;u(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof Mt?1:2);let r;u(i)&&(r=i+o*gn.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof Mt?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function $h(e,t,n,i){i=y(i,e.groundPrimitives),n=y(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new xt,this._removedObjects=new xt,this._changedObjects=new xt;let o,r=gn.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 gf(n,Vr,void 0,!1,o),this._materialBatches[o]=new yf(n,Vs,void 0,!1,o),this._colorBatches[o+r]=new gf(n,Vr,Vr,!1,o),this._materialBatches[o+r]=new yf(n,Vs,Vr,!1,o),this._colorBatches[o+r*2]=new gf(n,Vr,Vs,!1,o),this._materialBatches[o+r*2]=new yf(n,Vs,Vs,!1,o);this._dynamicBatch=new fx(n,i);let s=Un.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new eM(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new xt,this._updaters=new xt,this._entityCollection=t,t.collectionChanged.addEventListener($h.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,WXe)}$h.prototype.update=function(e){let t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values,a,c,l,f;for(a=s.length-1;a>-1;a--)c=s[a],l=c.id,f=this._updaters.get(l),f.entity===c?(tfe(this,f),nfe(this,e,f)):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],l=c.id,f=this._updaters.get(l),tfe(this,f),f.destroy(),this._updaters.remove(l),this._subscriptions.get(l)(),this._subscriptions.remove(l);for(a=n.length-1;a>-1;a--)c=n[a],l=c.id,f=new $B(c,this._scene),this._updaters.set(l,f),nfe(this,e,f),this._subscriptions.set(l,f.geometryChanged.addEventListener($h._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let d=!0,p=this._batches,g=p.length;for(a=0;a<g;a++)d=p[a].update(e)&&d;return d};var jXe=[],YXe=new se;$h.prototype.getBoundingSphere=function(e,t){let n=jXe,i=YXe,o=0,r=at.DONE,s=this._batches,a=s.length,c=this._updaters.get(e.id);for(let l=0;l<a;l++){if(r=s[l].getBoundingSphere(c,i),r===at.PENDING)return at.PENDING;r===at.DONE&&(n[o]=se.clone(i,n[o]),o++)}return o===0?at.FAILED:(n.length=o,se.fromBoundingSpheres(n,t),at.DONE)};$h.prototype.isDestroyed=function(){return!1};$h.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener($h.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(),le(this)};$h._onGeometryChanged=function(e){let t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!u(t.get(o))&&!u(n.get(o))&&n.set(o,i)};$h.prototype._onCollectionChanged=function(e,t,n){let i=this._addedObjects,o=this._removedObjects,r=this._changedObjects,s,a,c;for(s=n.length-1;s>-1;s--)c=n[s],a=c.id,i.remove(a)||(o.set(a,c),r.remove(a));for(s=t.length-1;s>-1;s--)c=t[s],a=c.id,o.remove(a)?r.set(a,c):i.set(a,c)};var tM=$h;function Cf(e){Ec.initializeTerrainHeights(),Qf.initializeTerrainHeights();let t=e.scene,n=e.dataSourceCollection;this._eventHelper=new wr,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=y(e.visualizersCallback,Cf.defaultVisualizersCallback);let i=!1,o=new xl,r=new xl;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let l=0,f=n.length;l<f;l++)this._onDataSourceAdded(n,n.get(l));let s=new nB;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,c;if(!i){let l=this,f=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),c(),l._removeDefaultDataSourceListener=void 0,l._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(f),c=n.dataSourceAdded.addEventListener(f)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=c,this._ready=!1}Cf.defaultVisualizersCallback=function(e,t,n){let i=n.entities;return[new Zw(t,i),new GB(e,i,n._primitives,n._groundPrimitives),new WB(t,i),new YB(e,i),new zR(e,i),new ZB(t,i),new XB(e,i),new tM(e,i,n._primitives,n._groundPrimitives)]};Object.defineProperties(Cf.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}}});Cf.prototype.isDestroyed=function(){return!1};Cf.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),u(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),le(this)};Cf.prototype.update=function(e){if(!fi.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 c=s.get(n);for(u(c.update)&&(t=c.update(e)&&t),o=c._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,t};Cf.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;u(r)&&e.creditDisplay.addCredit(r);let s=o._resourceCredits;if(u(s)){let a=s.length;for(let c=0;c<a;c++)e.creditDisplay.addCredit(s[c])}}};var qXe=[],XXe=new se;Cf.prototype.getBoundingSphere=function(e,t,n){if(!this._ready)return at.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(!u(r))return at.FAILED;let s=qXe,a=XXe,c=0,l=at.DONE,f=r._visualizers,d=f.length;for(i=0;i<d;i++){let p=f[i];if(u(p.getBoundingSphere)){if(l=f[i].getBoundingSphere(e,a),!t&&l===at.PENDING)return at.PENDING;l===at.DONE&&(s[c]=se.clone(a,s[c]),c++)}}return c===0?at.FAILED:(s.length=c,se.fromBoundingSpheres(s,n),at.DONE)};Cf.prototype._onDataSourceAdded=function(e,t){let n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new xl),s=o.add(new gB);t._primitives=r,t._groundPrimitives=s;let a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};Cf.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,c=a.length;for(let l=0;l<c;l++)a[l].destroy();n.remove(o),i.remove(r),t._visualizers=void 0};Cf.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 nM=Cf;function CW(e,t,n){this.heading=y(e,0),this.pitch=y(t,0),this.range=y(n,0)}CW.clone=function(e,t){if(u(e))return u(t)||(t=new CW),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};var uu=CW;var ife=new Z,ofe=new Z,rfe=new Z,KXe=new M,ok=new h,sfe=new h,TW=new h,EW=new h,afe=new h,cfe=new h,mb=new $,ZXe=1.25;function JXe(e,t,n,i,o,r,s){let a=e.scene.mode,c=o.getValue(r,e._lastCartesian);if(u(c)){let l=!1,f=!1,d,p,g;if(a===te.SCENE3D){$.addSeconds(r,.001,mb);let T=o.getValue(mb,ok);if(u(T)||($.addSeconds(r,-.001,mb),T=o.getValue(mb,ok),f=!0),u(T)){let E=Ot.computeFixedToIcrfMatrix(r,ife),S=Ot.computeFixedToIcrfMatrix(mb,ofe),D;!u(E)||!u(S)?(D=Ot.computeTemeToPseudoFixedMatrix(r,rfe),E=Z.transpose(D,ife),S=Ot.computeTemeToPseudoFixedMatrix(mb,ofe),Z.transpose(S,S)):D=Z.transpose(E,rfe);let w=Z.multiplyByVector(E,c,afe),R=Z.multiplyByVector(S,T,cfe);h.subtract(w,R,EW);let O=h.magnitude(EW)*1e3,L=P.GRAVITATIONALPARAMETER,N=-L/(O*O-2*L/h.magnitude(w));N<0||N>ZXe*s.maximumRadius?(d=sfe,h.normalize(c,d),h.negate(d,d),g=h.clone(h.UNIT_Z,TW),p=h.cross(g,d,ok),h.magnitude(p)>P.EPSILON7&&(h.normalize(d,d),h.normalize(p,p),g=h.cross(d,p,TW),h.normalize(g,g),l=!0)):h.equalsEpsilon(c,T,P.EPSILON7)||(g=sfe,h.normalize(w,g),h.normalize(R,R),p=h.cross(g,R,TW),f&&(p=h.multiplyByScalar(p,-1,p)),h.equalsEpsilon(p,h.ZERO,P.EPSILON7)||(d=h.cross(p,g,ok),Z.multiplyByVector(D,d,d),Z.multiplyByVector(D,p,p),Z.multiplyByVector(D,g,g),h.normalize(d,d),h.normalize(p,p),h.normalize(g,g),l=!0))}}u(e.boundingSphere)&&(c=e.boundingSphere.center);let m,A,x;i&&(m=h.clone(t.position,EW),A=h.clone(t.direction,afe),x=h.clone(t.up,cfe));let C=KXe;l?(C[0]=d.x,C[1]=d.y,C[2]=d.z,C[3]=0,C[4]=p.x,C[5]=p.y,C[6]=p.z,C[7]=0,C[8]=g.x,C[9]=g.y,C[10]=g.z,C[11]=0,C[12]=c.x,C[13]=c.y,C[14]=c.z,C[15]=0):Ot.eastNorthUpToFixedFrame(c,s,C),t._setTransform(C),i&&(h.clone(m,t.position),h.clone(A,t.direction),h.clone(x,t.up),h.cross(A,x,t.right))}if(n){let l=a===te.SCENE2D||h.equals(e._offset3D,h.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,l)}}function iM(e,t,n){this.entity=e,this.scene=t,this.ellipsoid=y(n,ie.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new h,this._defaultOffset3D=void 0,this._offset3D=new h}Object.defineProperties(iM,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=h.clone(e,new h)}}});iM.defaultOffset3D=new h(-14e3,3500,3500);var rk=new uu,QXe=new h;iM.prototype.update=function(e,t){let n=this.scene,i=this.ellipsoid,o=n.mode;if(o===te.MORPHING)return;let r=this.entity,s=r.position;if(!u(s))return;let a=r!==this._lastEntity,c=o!==this._mode,l=n.camera,f=a||c,d=!0;if(a){let p=r.viewFrom,g=u(p);if(!g&&u(t)){rk.pitch=-P.PI_OVER_FOUR,rk.range=0;let m=s.getValue(e,QXe);if(u(m)){let A=2-1/Math.max(1,h.magnitude(m)/i.maximumRadius);rk.pitch*=A}l.viewBoundingSphere(t,rk),this.boundingSphere=t,f=!1,d=!1}else(!g||!u(p.getValue(e,this._offset3D)))&&h.clone(iM._defaultOffset3D,this._offset3D)}else!c&&this._mode!==te.SCENE2D&&h.clone(l.position,this._offset3D);this._lastEntity=r,this._mode=o,JXe(this,l,f,d,s,e,i)};var oM=iM;function sM(){this._cache={}}sM.prototype.fromColor=function(e,t){return sk(void 0,void 0,e,t,this._cache)};sM.prototype.fromUrl=function(e,t,n){return sk(e,void 0,t,n,this._cache)};sM.prototype.fromMakiIconId=function(e,t,n){return sk($t(`Assets/Textures/maki/${encodeURIComponent(e)}.png`),void 0,t,n,this._cache)};sM.prototype.fromText=function(e,t,n){return sk(void 0,e,t,n,this._cache)};var $Xe=new z;function eKe(e,t,n){e.save(),e.scale(n/24,n/24),e.fillStyle=t.toCssColorString(),e.strokeStyle=t.brighten(.6,$Xe).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 lfe(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=z.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=z.WHITE.toCssColorString(),e.fillRect(s-1,a-2,o+2,r+2)}var rM=new Array(4);function sk(e,t,n,i,o){rM[0]=e,rM[1]=t,rM[2]=n,rM[3]=i;let r=JSON.stringify(rM),s=o[r];if(u(s))return s;let a=document.createElement("canvas");a.width=i,a.height=i;let c=a.getContext("2d");if(eKe(c,n,i),u(e)){let f=Oe.createIfNeeded(e).fetchImage().then(function(d){return lfe(c,d,i),o[r]=a,a});return o[r]=f,f}else if(u(t)){let l=BA(t,{font:`bold ${i}px sans-serif`});lfe(c,l,i)}return o[r]=a,a}var d_=sM;function bW(e){return e}function ak(e){if(e==null)return bW;var t,n,i=e.scale[0],o=e.scale[1],r=e.translate[0],s=e.translate[1];return function(a,c){c||(t=n=0);var l=2,f=a.length,d=new Array(f);for(d[0]=(t+=a[0])*i+r,d[1]=(n+=a[1])*o+s;l<f;)d[l]=a[l],++l;return d}}function ufe(e,t){for(var n,i=e.length,o=i-t;o<--i;)n=e[o],e[o++]=e[i],e[i]=n}function SW(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return ffe(e,n)})}:ffe(e,t)}function ffe(e,t){var n=t.id,i=t.bbox,o=t.properties==null?{}:t.properties,r=DW(e,t);return n==null&&i==null?{type:"Feature",properties:o,geometry:r}:i==null?{type:"Feature",id:n,properties:o,geometry:r}:{type:"Feature",id:n,bbox:i,properties:o,geometry:r}}function DW(e,t){var n=ak(e.transform),i=e.arcs;function o(f,d){d.length&&d.pop();for(var p=i[f<0?~f:f],g=0,m=p.length;g<m;++g)d.push(n(p[g],g));f<0&&ufe(d,m)}function r(f){return n(f)}function s(f){for(var d=[],p=0,g=f.length;p<g;++p)o(f[p],d);return d.length<2&&d.push(d[0]),d}function a(f){for(var d=s(f);d.length<4;)d.push(d[0]);return d}function c(f){return f.map(a)}function l(f){var d=f.type,p;switch(d){case"GeometryCollection":return{type:d,geometries:f.geometries.map(l)};case"Point":p=r(f.coordinates);break;case"MultiPoint":p=f.coordinates.map(r);break;case"LineString":p=s(f.arcs);break;case"MultiLineString":p=f.arcs.map(s);break;case"Polygon":p=c(f.arcs);break;case"MultiPolygon":p=f.arcs.map(c);break;default:return null}return{type:d,coordinates:p}}return l(t)}function ck(e){return h.fromDegrees(e[0],e[1],e[2])}var vW={"urn:ogc:def:crs:OGC:1.3:CRS84":ck,"EPSG:4326":ck,"urn:ogc:def:crs:EPSG::4326":ck},dfe={},hfe={},wW=48,IW,PW=z.ROYALBLUE,OW=z.YELLOW,RW=2,BW=z.fromBytes(255,255,0,100),MW=!1,rKe={small:24,medium:48,large:64},sKe=["title","description","marker-size","marker-symbol","marker-color","stroke","stroke-opacity","stroke-width","fill","fill-opacity"];function mfe(e,t){let n="";for(let i in e)if(e.hasOwnProperty(i)){if(i===t||sKe.indexOf(i)!==-1)continue;let o=e[i];u(o)&&(typeof o=="object"?n+=`<tr><th>${i}</th><td>${mfe(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 aKe(e,t,n){let i;return function(o,r){return u(i)||(i=e(t,n)),i}}function cKe(e,t){return new nd(aKe(mfe,e,t),!0)}function lk(e,t,n){let i=e.id;if(!u(i)||e.type!=="Feature")i=zn();else{let s=2,a=i;for(;u(t.getById(a));)a=`${i}_${s}`,s++;i=a}let o=t.getOrCreateEntity(i),r=e.properties;if(u(r)){o.properties=r;let s,a=r.title;if(u(a))o.name=a,s="title";else{let l=Number.MAX_VALUE;for(let f in r)if(r.hasOwnProperty(f)&&r[f]){let d=f.toLowerCase();if(l>1&&d==="title"){l=1,s=f;break}else l>2&&d==="name"?(l=2,s=f):l>3&&/title/i.test(f)?(l=3,s=f):l>4&&/name/i.test(f)&&(l=4,s=f)}u(s)&&(o.name=r[s])}let c=r.description;c!==null&&(o.description=u(c)?new ei(c):n(r,s))}return o}function LW(e,t){let n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=t(e[i]);return n}var pfe={Feature:gfe,FeatureCollection:lKe,GeometryCollection:yfe,LineString:Efe,MultiLineString:bfe,MultiPoint:Cfe,MultiPolygon:vfe,Point:xfe,Polygon:Dfe,Topology:wfe},_fe={GeometryCollection:yfe,LineString:Efe,MultiLineString:bfe,MultiPoint:Cfe,MultiPolygon:vfe,Point:xfe,Polygon:Dfe,Topology:wfe};function gfe(e,t,n,i,o){if(t.geometry===null){lk(t,e._entityCollection,o.describe);return}if(!u(t.geometry))throw new ue("feature.geometry is required.");let r=t.geometry.type,s=_fe[r];if(!u(s))throw new ue(`Unknown geometry type: ${r}`);s(e,t,t.geometry,i,o)}function lKe(e,t,n,i,o){let r=t.features;for(let s=0,a=r.length;s<a;s++)gfe(e,r[s],void 0,i,o)}function yfe(e,t,n,i,o){let r=n.geometries;for(let s=0,a=r.length;s<a;s++){let c=r[s],l=c.type,f=_fe[l];if(!u(f))throw new ue(`Unknown geometry type: ${l}`);f(e,t,c,i,o)}}function Afe(e,t,n,i,o){let r=o.markerSymbol,s=o.markerColor,a=o.markerSize,c=t.properties;if(u(c)){let g=c["marker-color"];u(g)&&(s=z.fromCssColorString(g)),a=y(rKe[c["marker-size"]],a);let m=c["marker-symbol"];u(m)&&(r=m)}let l;u(r)?r.length===1?l=e._pinBuilder.fromText(r.toUpperCase(),s,a):l=e._pinBuilder.fromMakiIconId(r,s,a):l=e._pinBuilder.fromColor(s,a);let f=new Na;f.verticalOrigin=new ei(On.BOTTOM),i.length===2&&o.clampToGround&&(f.heightReference=We.CLAMP_TO_GROUND);let d=lk(t,e._entityCollection,o.describe);d.billboard=f,d.position=new Sc(n(i));let p=Promise.resolve(l).then(function(g){f.image=new ei(g)}).catch(function(){f.image=new ei(e._pinBuilder.fromColor(s,a))});e._promises.push(p)}function xfe(e,t,n,i,o){Afe(e,t,i,n.coordinates,o)}function Cfe(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Afe(e,t,i,r[s],o)}function Tfe(e,t,n,i,o){let r=o.strokeMaterialProperty,s=o.strokeWidthProperty,a=t.properties;if(u(a)){let f=a["stroke-width"];u(f)&&(s=new ei(f));let d,p=a.stroke;u(p)&&(d=z.fromCssColorString(p));let g=a["stroke-opacity"];u(g)&&g!==1&&(u(d)||(d=r.color.getValue().clone()),d.alpha=g),u(d)&&(r=new Mt(d))}let c=lk(t,e._entityCollection,o.describe),l=new Ua;c.polyline=l,l.clampToGround=o.clampToGround,l.material=r,l.width=s,l.positions=new ei(LW(i,n)),l.arcType=Kt.RHUMB}function Efe(e,t,n,i,o){Tfe(e,t,i,n.coordinates,o)}function bfe(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Tfe(e,t,i,r[s],o)}function Sfe(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,c=t.properties;if(u(c)){let g=c["stroke-width"];u(g)&&(a=new ei(g));let m,A=c.stroke;u(A)&&(m=z.fromCssColorString(A));let x=c["stroke-opacity"];u(x)&&x!==1&&(u(m)||(m=r.getValue().clone()),m.alpha=x),u(m)&&(r=new ei(m));let C,T=c.fill,E=s.color.getValue();u(T)&&(C=z.fromCssColorString(T),C.alpha=E.alpha),x=c["fill-opacity"],u(x)&&x!==E.alpha&&(u(C)||(C=E.clone()),C.alpha=x),u(C)&&(s=new Mt(C))}let l=new ed;l.outline=new ei(!0),l.outlineColor=r,l.outlineWidth=a,l.material=s,l.arcType=Kt.RHUMB;let f=[];for(let g=1,m=i.length;g<m;g++)f.push(new Dc(LW(i[g],n)));let d=i[0];l.hierarchy=new ei(new Dc(LW(d,n),f)),d[0].length>2?l.perPositionHeight=new ei(!0):o.clampToGround||(l.height=0);let p=lk(t,e._entityCollection,o.describe);p.polygon=l}function Dfe(e,t,n,i,o){Sfe(e,t,i,n.coordinates,o)}function vfe(e,t,n,i,o){let r=n.coordinates;for(let s=0;s<r.length;s++)Sfe(e,t,i,r[s],o)}function wfe(e,t,n,i,o){for(let r in n.objects)if(n.objects.hasOwnProperty(r)){let s=SW(n,n.objects[r]),a=pfe[s.type];a(e,s,s,i,o)}}function py(e){this._name=e,this._changed=new Ae,this._error=new Ae,this._isLoading=!1,this._loading=new Ae,this._entityCollection=new Ss(this),this._promises=[],this._pinBuilder=new d_,this._entityCluster=new tu,this._credit=void 0,this._resourceCredits=[]}py.load=function(e,t){return new py().load(e,t)};Object.defineProperties(py,{markerSize:{get:function(){return wW},set:function(e){wW=e}},markerSymbol:{get:function(){return IW},set:function(e){IW=e}},markerColor:{get:function(){return PW},set:function(e){PW=e}},stroke:{get:function(){return OW},set:function(e){OW=e}},strokeWidth:{get:function(){return RW},set:function(e){RW=e}},fill:{get:function(){return BW},set:function(e){BW=e}},clampToGround:{get:function(){return MW},set:function(e){MW=e}},crsNames:{get:function(){return vW}},crsLinkHrefs:{get:function(){return dfe}},crsLinkTypes:{get:function(){return hfe}}});Object.defineProperties(py.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){this._entityCluster=e}},credit:{get:function(){return this._credit}}});py.prototype.load=function(e,t){return Ife(this,e,t,!0)};py.prototype.process=function(e,t){return Ife(this,e,t,!1)};function Ife(e,t,n,i){Or.setLoading(e,!0),n=y(n,y.EMPTY_OBJECT);let o=n.credit;typeof o=="string"&&(o=new Zt(o)),e._credit=o;let r=t,s=n.sourceUri;if(typeof t=="string"||t instanceof Oe){t=Oe.createIfNeeded(t),r=t.fetchJson(),s=y(s,t.getUrlComponent());let a=e._resourceCredits,c=t.credits;if(u(c)){let l=c.length;for(let f=0;f<l;f++)a.push(c[f])}}return n={describe:y(n.describe,cKe),markerSize:y(n.markerSize,wW),markerSymbol:y(n.markerSymbol,IW),markerColor:y(n.markerColor,PW),strokeWidthProperty:new ei(y(n.strokeWidth,RW)),strokeMaterialProperty:new Mt(y(n.stroke,OW)),fillMaterialProperty:new Mt(y(n.fill,BW)),clampToGround:y(n.clampToGround,MW)},Promise.resolve(r).then(function(a){return uKe(e,a,n,s,i)}).catch(function(a){throw Or.setLoading(e,!1),e._error.raiseEvent(e,a),a})}py.prototype.update=function(e){return!0};function uKe(e,t,n,i,o){let r;u(i)&&(r=e_(i)),u(r)&&e._name!==r&&(e._name=r,e._changed.raiseEvent(e));let s=pfe[t.type];if(!u(s))throw new ue(`Unsupported GeoJSON object type: ${t.type}`);let a=t.crs,c=a!==null?ck:null;if(u(a)){if(!u(a.properties))throw new ue("crs.properties is undefined.");let l=a.properties;if(a.type==="name"){if(c=vW[l.name],!u(c))throw new ue(`Unknown crs name: ${l.name}`)}else if(a.type==="link"){let f=dfe[l.href];if(u(f)||(f=hfe[l.type]),!u(f))throw new ue(`Unable to resolve crs link: ${JSON.stringify(l)}`);c=f(l)}else if(a.type==="EPSG"){if(c=vW[`EPSG:${l.code}`],!u(c))throw new ue(`Unknown crs EPSG code: ${l.code}`)}else throw new ue(`Unknown crs type: ${a.type}`)}return Promise.resolve(c).then(function(l){return o&&e._entityCollection.removeAll(),l!==null&&s(e,t,t,l,n),Promise.all(e._promises).then(function(){return e._promises.length=0,Or.setLoading(e,!1),e})})}var aM=py;var Pfe="4.0.0";function fKe(e){return e===void 0}function fu(e){return typeof e=="boolean"}function Ofe(e,t){for(var n in t)t.hasOwnProperty(n)&&fKe(e[n])&&(e[n]=t[n]);return e}function Rfe(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 Vo(e,t){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)}function _y(e,t){for(var n=e.length-1;n>=0;n--)t(e[n])===!0&&e.splice(n,1)}function gy(e){throw new Error("Unhandled case for value: '".concat(e,"'"))}var yy=/[A-Za-z]/,ws=/[\d]/;var du=/\s/,uk=/['"]/,Bfe=/[\x00-\x1F\x7F]/,Mfe=/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,dKe=/\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,hKe=/\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,mKe=Mfe+dKe+hKe,Lfe=/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,P8n=new RegExp("[".concat(Mfe+Lfe,"]")),NW=mKe+Lfe,Ud=new RegExp("[".concat(NW,"]"));var fk=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(du):[],o=t.split(du),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(du):[],o=t.split(du),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}();function Nfe(e,t,n){var i,o;n==null?(n="&hellip;",o=3,i=8):(o=n.length,i=n.length);var r=function(T){var E={},S=T,D=S.match(/^([a-z]+):\/\//i);return D&&(E.scheme=D[1],S=S.substr(D[0].length)),D=S.match(/^(.*?)(?=(\?|#|\/|$))/i),D&&(E.host=D[1],S=S.substr(D[0].length)),D=S.match(/^\/(.*?)(?=(\?|#|$))/i),D&&(E.path=D[1],S=S.substr(D[0].length)),D=S.match(/^\?(.*?)(?=(#|$))/i),D&&(E.query=D[1],S=S.substr(D[0].length)),D=S.match(/^#(.*?)$/i),D&&(E.fragment=D[1]),E},s=function(T){var E="";return T.scheme&&T.host&&(E+=T.scheme+"://"),T.host&&(E+=T.host),T.path&&(E+="/"+T.path),T.query&&(E+="?"+T.query),T.fragment&&(E+="#"+T.fragment),E},a=function(T,E){var S=E/2,D=Math.ceil(S),w=-1*Math.floor(S),R="";return w<0&&(R=T.substr(w)),T.substr(0,D)+n+R};if(e.length<=t)return e;var c=t-o,l=r(e);if(l.query){var f=l.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);f&&(l.query=l.query.substr(0,f[1].length),e=s(l))}if(e.length<=t||(l.host&&(l.host=l.host.replace(/^www\./,""),e=s(l)),e.length<=t))return e;var d="";if(l.host&&(d+=l.host),d.length>=c)return l.host.length==t?(l.host.substr(0,t-o)+n).substr(0,c+i):a(d,c).substr(0,c+i);var p="";if(l.path&&(p+="/"+l.path),l.query&&(p+="?"+l.query),p)if((d+p).length>=c){if((d+p).length==t)return(d+p).substr(0,t);var g=c-d.length;return(d+a(p,g)).substr(0,c+i)}else d+=p;if(l.fragment){var m="#"+l.fragment;if((d+m).length>=c){if((d+m).length==t)return(d+m).substr(0,t);var A=c-d.length;return(d+a(m,A)).substr(0,c+i)}else d+=m}if(l.scheme&&l.host){var x=l.scheme+"://";if((d+x).length<c)return(x+d).substr(0,t)}if(d.length<=t)return d;var C="";return c>0&&(C=d.substr(-1*Math.floor(c/2))),(d.substr(0,Math.ceil(c/2))+n+C).substr(0,c+i)}function Ffe(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)}function Vfe(e,t,n){return Rfe(e,t,n)}var Ufe=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 fk({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"?Nfe(t,i):o==="middle"?Ffe(t,i):Vfe(t,i)},e}();var FW=function(e,t){return FW=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])},FW(e,t)};function em(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");FW(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Is=function(){return Is=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},Is.apply(this,arguments)};var tm=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}();var pKe="(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|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--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|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|foodnetwork|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|volkswagen|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|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|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|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|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|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|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|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|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|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|\u043A\u0430\u0442\u043E\u043B\u0438\u043A|\u0627\u062A\u0635\u0627\u0644\u0627\u062A|\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|abarth|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|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|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|vuelos|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|dabur|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|linde|lipsy|loans|locus|lotte|lotto|macys|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|adac|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|fiat|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|hgtv|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|loft|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|shaw|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|cbs|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|sca|scb|ses|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|\u8BFA\u57FA\u4E9A|\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)",kfe=new RegExp("^"+pKe+"$");var _Ke=/[\/?#]/,gKe=/[-+&@#/%=~_()|'$*\[\]{}\u2713]/,zfe=/[?!:,.;^]/,VW=/https?:\/\//i,Hfe=new RegExp("^"+VW.source,"i"),Gfe=new RegExp(zfe.source+"$"),yKe=/^(javascript|vbscript):/i,AKe=/^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/,xKe=/^(?:\/\/)?([^/#?:]+)/;function dk(e){return yy.test(e)}function UW(e){return yy.test(e)||ws.test(e)||e==="+"||e==="-"||e==="."}function h_(e){return Ud.test(e)}function hk(e){return e==="_"||h_(e)}function kW(e){return Ud.test(e)||gKe.test(e)||zfe.test(e)}function mk(e){return _Ke.test(e)}function zW(e){return kfe.test(e.toLowerCase())}function Wfe(e){if(yKe.test(e))return!1;var t=e.match(AKe);if(!t)return!1;var n=!!t[1],i=t[2];return n?!0:!(i.indexOf(".")===-1||!yy.test(i))}function jfe(e){var t=e.match(xKe);if(!t)return!1;var n=t[0],i=n.split(".");if(i.length<2)return!1;var o=i[i.length-1];return!!zW(o)}var CKe=/^(?:(?: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]?)$/,TKe=/[:/?#]/;function Yfe(e){var t=e.split(TKe,1)[0];return CKe.test(t)}var EKe=/^(https?:\/\/)?(www\.)?/i,bKe=/^\/\//,qfe=function(e){em(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=vKe(n)),this.stripPrefix.scheme&&(n=SKe(n)),this.stripPrefix.www&&(n=DKe(n)),this.stripTrailingSlash&&(n=wKe(n)),this.decodePercentEncoding&&(n=IKe(n)),n},t}(tm);function SKe(e){return e.replace(Hfe,"")}function DKe(e){return e.replace(EKe,"$1")}function vKe(e){return e.replace(bKe,"")}function wKe(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e}function IKe(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 Xfe=/^mailto:/i,PKe=new RegExp("[".concat(NW,"!#$%&'*+/=?^_`{|}~-]"));function Kfe(e){return Ud.test(e)}function pk(e){return PKe.test(e)}function Zfe(e){var t=e.split(".").pop()||"";return zW(t)}var Jfe=function(e){em(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}(tm);function HW(e){return e==="_"||Ud.test(e)}function Qfe(e){return e.length<=140}var $fe=["twitter","facebook","instagram","tiktok"];var ede=function(e){em(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;default:throw gy(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}(tm);var OKe={twitter:/^@\w{1,15}$/,instagram:/^@[_\w]{1,30}$/,soundcloud:/^@[-a-z0-9_]{3,25}$/,tiktok:/^@[.\w]{1,23}[\w]$/},RKe=/[-\w.]/;function GW(e){return RKe.test(e)}function tde(e,t){var n=OKe[t];return n.test(e)}var nde=["twitter","instagram","soundcloud","tiktok"];var ide=function(e){em(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;default:throw 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}(tm);var BKe=/[-. ]/,MKe=/[-. ()]/,LKe=/[,;]/,NKe=/(?:(?:(?:(\+)?\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]+#?)*/,FKe=/(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})/,VKe=new RegExp("^".concat(NKe.source,"|").concat(FKe.source,"$"));function WW(e){return BKe.test(e)}function _k(e){return LKe.test(e)}function ode(e){var t=e.charAt(0)==="+"||MKe.test(e);return t&&VKe.test(e)}var rde=function(e){em(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}(tm);function cde(e,t){for(var n=t.tagBuilder,i=t.stripPrefix,o=t.stripTrailingSlash,r=t.decodePercentEncoding,s=t.hashtagServiceName,a=t.mentionServiceName,c=[],l=e.length,f=[],d=0;d<l;d++){var p=e.charAt(d);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:w(m,p);break;case 12:R(m,p);break;case 0:C(m,p);break;case 1:T(m,p);break;case 2:E(m,p);break;case 3:S(m,p);break;case 4:D(m,p);break;case 5:O(m,p);break;case 6:L(m,p);break;case 7:N(m,p);break;case 13:_(m,p);break;case 14:b(m,p);break;case 8:v(m,p);break;case 9:I(m,p);break;case 10:B(m,p);break;case 15:F(m,p);break;case 16:k(m,p);break;case 17:U(m,p);break;case 18:G(m,p);break;case 19:V(m,p);break;case 20:X(m,p);break;case 21:j(m,p);break;case 22:Q(m,p);break;case 23:W(m,p);break;case 24:K(m,p);break;case 25:J(m,p);break;case 26:_e(m,p);break;case 27:xe(m,p);break;case 28:re(m,p);break;case 29:ye(m,p);break;case 30:fe(m,p);break;case 31:Se(m,p);break;case 32:Ve(m,p);break;case 33:qe(m,p);break;case 34:mt(m,p);break;case 35:Ht(m,p);break;case 36:fn(m,p);break;case 37:we(m,p);break;case 38:dt(m,p);break;case 39:Tn(m,p);break;case 40:Jn(m,p);break;case 41:Gt(m,p);break;default:gy(m.state)}}}for(var A=f.length-1;A>=0;A--)f.forEach(function(pe){return Je(pe)});return c;function x(pe){if(pe==="#")f.push(GKe(d,28));else if(pe==="@")f.push(WKe(d,30));else if(pe==="/")f.push(YW(d,11));else if(pe==="+")f.push(qW(d,37));else if(pe==="(")f.push(qW(d,32));else{if(ws.test(pe)&&(f.push(qW(d,38)),f.push(zKe(d,13))),Kfe(pe)){var me=pe.toLowerCase()==="m"?15:22;f.push(HKe(d,me))}dk(pe)&&f.push(jW(d,0)),Ud.test(pe)&&f.push(YW(d,5))}}function C(pe,me){me===":"?pe.state=2:me==="-"?pe.state=1:UW(me)||Vo(f,pe)}function T(pe,me){me==="-"||(me==="/"?(Vo(f,pe),f.push(YW(d,11))):UW(me)?pe.state=0:Vo(f,pe))}function E(pe,me){me==="/"?pe.state=3:me==="."?Vo(f,pe):h_(me)?(pe.state=5,dk(me)&&f.push(jW(d,0))):Vo(f,pe)}function S(pe,me){me==="/"?pe.state=4:kW(me)?(pe.state=10,pe.acceptStateReached=!0):Je(pe)}function D(pe,me){me==="/"?pe.state=10:h_(me)?(pe.state=5,pe.acceptStateReached=!0):Vo(f,pe)}function w(pe,me){me==="/"?pe.state=12:Vo(f,pe)}function R(pe,me){h_(me)?pe.state=5:Vo(f,pe)}function O(pe,me){me==="."?pe.state=7:me==="-"?pe.state=6:me===":"?pe.state=8:mk(me)?pe.state=10:hk(me)||Je(pe)}function L(pe,me){me==="-"||(me==="."?Je(pe):h_(me)?pe.state=5:Je(pe))}function N(pe,me){me==="."?Je(pe):h_(me)?(pe.state=5,pe.acceptStateReached=!0):Je(pe)}function _(pe,me){me==="."?pe.state=14:me===":"?pe.state=8:ws.test(me)||(mk(me)?pe.state=10:Ud.test(me)?Vo(f,pe):Je(pe))}function b(pe,me){ws.test(me)?(pe.octetsEncountered++,pe.octetsEncountered===4&&(pe.acceptStateReached=!0),pe.state=13):Je(pe)}function v(pe,me){ws.test(me)?pe.state=9:Je(pe)}function I(pe,me){ws.test(me)||(mk(me)?pe.state=10:Je(pe))}function B(pe,me){kW(me)||Je(pe)}function F(pe,me){me.toLowerCase()==="a"?pe.state=16:Q(pe,me)}function k(pe,me){me.toLowerCase()==="i"?pe.state=17:Q(pe,me)}function U(pe,me){me.toLowerCase()==="l"?pe.state=18:Q(pe,me)}function G(pe,me){me.toLowerCase()==="t"?pe.state=19:Q(pe,me)}function V(pe,me){me.toLowerCase()==="o"?pe.state=20:Q(pe,me)}function X(pe,me){me.toLowerCase()===":"?pe.state=21:Q(pe,me)}function j(pe,me){pk(me)?pe.state=22:Vo(f,pe)}function Q(pe,me){me==="."?pe.state=23:me==="@"?pe.state=24:pk(me)?pe.state=22:Vo(f,pe)}function W(pe,me){me==="."?Vo(f,pe):me==="@"?Vo(f,pe):pk(me)?pe.state=22:Vo(f,pe)}function K(pe,me){h_(me)?pe.state=25:Vo(f,pe)}function J(pe,me){me==="."?pe.state=27:me==="-"?pe.state=26:hk(me)||Je(pe)}function _e(pe,me){me==="-"||me==="."?Je(pe):hk(me)?pe.state=25:Je(pe)}function xe(pe,me){me==="."||me==="-"?Je(pe):h_(me)?(pe.state=25,pe.acceptStateReached=!0):Je(pe)}function re(pe,me){HW(me)?(pe.state=29,pe.acceptStateReached=!0):Vo(f,pe)}function ye(pe,me){HW(me)||Je(pe)}function fe(pe,me){GW(me)?(pe.state=31,pe.acceptStateReached=!0):Vo(f,pe)}function Se(pe,me){GW(me)||(Ud.test(me)?Vo(f,pe):Je(pe))}function we(pe,me){ws.test(me)?pe.state=38:(Vo(f,pe),x(me))}function Ve(pe,me){ws.test(me)?pe.state=33:Vo(f,pe),x(me)}function qe(pe,me){ws.test(me)?pe.state=34:Vo(f,pe)}function mt(pe,me){ws.test(me)?pe.state=35:Vo(f,pe)}function Ht(pe,me){me===")"?pe.state=36:Vo(f,pe)}function fn(pe,me){ws.test(me)?pe.state=38:WW(me)?pe.state=39:Vo(f,pe)}function dt(pe,me){pe.acceptStateReached=!0,_k(me)?pe.state=40:me==="#"?pe.state=41:ws.test(me)||(me==="("?pe.state=32:WW(me)?pe.state=39:(Je(pe),dk(me)&&f.push(jW(d,0))))}function Tn(pe,me){ws.test(me)?pe.state=38:me==="("?pe.state=32:(Je(pe),x(me))}function Jn(pe,me){_k(me)||(me==="#"?pe.state=41:ws.test(me)?pe.state=38:Je(pe))}function Gt(pe,me){_k(me)?pe.state=40:ws.test(me)?Vo(f,pe):Je(pe)}function Je(pe){if(Vo(f,pe),!!pe.acceptStateReached){var me=pe.startIdx,be=e.slice(pe.startIdx,d);if(be=kKe(be),pe.type==="url"){var St=e.charAt(pe.startIdx-1);if(St==="@")return;var qt=pe.matchType;if(qt==="scheme"){var Kn=VW.exec(be);if(Kn&&(me=me+Kn.index,be=be.slice(Kn.index)),!Wfe(be))return}else if(qt==="tld"){if(!jfe(be))return}else if(qt==="ipV4"){if(!Yfe(be))return}else gy(qt);c.push(new qfe({tagBuilder:n,matchedText:be,offset:me,urlMatchType:qt,url:be,protocolRelativeMatch:be.slice(0,2)==="//",stripPrefix:i,stripTrailingSlash:o,decodePercentEncoding:r}))}else if(pe.type==="email")Zfe(be)&&c.push(new Jfe({tagBuilder:n,matchedText:be,offset:me,email:be.replace(Xfe,"")}));else if(pe.type==="hashtag")Qfe(be)&&c.push(new ede({tagBuilder:n,matchedText:be,offset:me,serviceName:s,hashtag:be.slice(1)}));else if(pe.type==="mention")tde(be,a)&&c.push(new ide({tagBuilder:n,matchedText:be,offset:me,serviceName:a,mention:be.slice(1)}));else if(pe.type==="phone"){if(be=be.replace(/ +$/g,""),ode(be)){var Ro=be.replace(/[^0-9,;#]/g,"");c.push(new rde({tagBuilder:n,matchedText:be,offset:me,number:Ro,plusSign:be.charAt(0)==="+"}))}}else gy(pe)}}}var UKe=/[\(\{\[]/,sde=/[\)\}\]]/,ade={")":"(","}":"{","]":"["};function kKe(e){for(var t={"(":0,"{":0,"[":0},n=0;n<e.length;n++){var i=e.charAt(n);UKe.test(i)?t[i]++:sde.test(i)&&t[ade[i]]--}for(var o=e.length-1,r;o>=0;)if(r=e.charAt(o),sde.test(r)){var s=ade[r];if(t[s]<0)t[s]++,o--;else break}else if(Gfe.test(r))o--;else break;return e.slice(0,o+1)}function jW(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"scheme"}}function YW(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"tld"}}function zKe(e,t){return{type:"url",startIdx:e,state:t,acceptStateReached:!1,matchType:"ipV4",octetsEncountered:1}}function HKe(e,t){return{type:"email",startIdx:e,state:t,acceptStateReached:!1}}function GKe(e,t){return{type:"hashtag",startIdx:e,state:t,acceptStateReached:!1}}function WKe(e,t){return{type:"mention",startIdx:e,state:t,acceptStateReached:!1}}function qW(e,t){return{type:"phone",startIdx:e,state:t,acceptStateReached:!1}}function lde(e,t){for(var n=t.onOpenTag,i=t.onCloseTag,o=t.onText,r=t.onComment,s=t.onDoctype,a=new nm,c=0,l=e.length,f=0,d=0,p=a;c<l;){var g=e.charAt(c);switch(f){case 0:m(g);break;case 1:A(g);break;case 2:C(g);break;case 3:x(g);break;case 4:T(g);break;case 5:E(g);break;case 6:S(g);break;case 7:D(g);break;case 8:w(g);break;case 9:R(g);break;case 10:O(g);break;case 11:L(g);break;case 12:N(g);break;case 13:_(g);break;case 14:b(g);break;case 15:v(g);break;case 16:I(g);break;case 17:B(g);break;case 18:F(g);break;case 19:k(g);break;case 20:U(g);break;default:gy(f)}c++}d<c&&j();function m(K){K==="<"&&V()}function A(K){K==="!"?f=13:K==="/"?(f=2,p=new nm(Is(Is({},p),{isClosing:!0}))):K==="<"?V():yy.test(K)?(f=3,p=new nm(Is(Is({},p),{isOpening:!0}))):(f=0,p=a)}function x(K){du.test(K)?(p=new nm(Is(Is({},p),{name:Q()})),f=4):K==="<"?V():K==="/"?(p=new nm(Is(Is({},p),{name:Q()})),f=12):K===">"?(p=new nm(Is(Is({},p),{name:Q()})),X()):!yy.test(K)&&!ws.test(K)&&K!==":"&&G()}function C(K){K===">"?G():yy.test(K)?f=3:G()}function T(K){du.test(K)||(K==="/"?f=12:K===">"?X():K==="<"?V():K==="="||uk.test(K)||Bfe.test(K)?G():f=5)}function E(K){du.test(K)?f=6:K==="/"?f=12:K==="="?f=7:K===">"?X():K==="<"?V():uk.test(K)&&G()}function S(K){du.test(K)||(K==="/"?f=12:K==="="?f=7:K===">"?X():K==="<"?V():uk.test(K)?G():f=5)}function D(K){du.test(K)||(K==='"'?f=8:K==="'"?f=9:/[>=`]/.test(K)?G():K==="<"?V():f=10)}function w(K){K==='"'&&(f=11)}function R(K){K==="'"&&(f=11)}function O(K){du.test(K)?f=4:K===">"?X():K==="<"&&V()}function L(K){du.test(K)?f=4:K==="/"?f=12:K===">"?X():K==="<"?V():(f=4,W())}function N(K){K===">"?(p=new nm(Is(Is({},p),{isClosing:!0})),X()):f=4}function _(K){e.substr(c,2)==="--"?(c+=2,p=new nm(Is(Is({},p),{type:"comment"})),f=14):e.substr(c,7).toUpperCase()==="DOCTYPE"?(c+=7,p=new nm(Is(Is({},p),{type:"doctype"})),f=20):G()}function b(K){K==="-"?f=15:K===">"?G():f=16}function v(K){K==="-"?f=18:K===">"?G():f=16}function I(K){K==="-"&&(f=17)}function B(K){K==="-"?f=18:f=16}function F(K){K===">"?X():K==="!"?f=19:K==="-"||(f=16)}function k(K){K==="-"?f=17:K===">"?X():f=16}function U(K){K===">"?X():K==="<"&&V()}function G(){f=0,p=a}function V(){f=1,p=new nm({idx:c})}function X(){var K=e.slice(d,p.idx);K&&o(K,d),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)),G(),d=c+1}function j(){var K=e.slice(d,c);o(K,d),d=c+1}function Q(){var K=p.idx+(p.isClosing?2:1);return e.slice(K,c).toLowerCase()}function W(){c--}}var nm=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 jKe=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=YKe(t.urls),this.email=fu(t.email)?t.email:this.email,this.phone=fu(t.phone)?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=fu(t.newWindow)?t.newWindow:this.newWindow,this.stripPrefix=qKe(t.stripPrefix),this.stripTrailingSlash=fu(t.stripTrailingSlash)?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=fu(t.decodePercentEncoding)?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(n!==!1&&nde.indexOf(n)===-1)throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var i=this.hashtag;if(i!==!1&&$fe.indexOf(i)===-1)throw new Error("invalid `hashtag` cfg '".concat(i,"' - see docs"));this.truncate=XKe(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 lde(t,{onOpenTag:function(s){i.indexOf(s)>=0&&o++},onText:function(s,a){if(o===0){var c=/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi,l=s.split(c),f=a;l.forEach(function(d,p){if(p%2===0){var g=n.parseText(d,f);r.push.apply(r,g)}f+=d.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(c,l){return c.getOffset()-l.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||_y(t,function(n){return n.getType()==="hashtag"}),this.email||_y(t,function(n){return n.getType()==="email"}),this.phone||_y(t,function(n){return n.getType()==="phone"}),this.mention||_y(t,function(n){return n.getType()==="mention"}),this.urls.schemeMatches||_y(t,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="scheme"}),this.urls.tldMatches||_y(t,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="tld"}),this.urls.ipV4Matches||_y(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=cde(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 fk)return n.toAnchorString();var i=t.buildTag();return i.toAnchorString()},e.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new Ufe({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},e.version=Pfe,e}(),ude=jKe;function YKe(e){return e==null&&(e=!0),fu(e)?{schemeMatches:e,tldMatches:e,ipV4Matches:e}:{schemeMatches:fu(e.schemeMatches)?e.schemeMatches:!0,tldMatches:fu(e.tldMatches)?e.tldMatches:!0,ipV4Matches:fu(e.ipV4Matches)?e.ipV4Matches:!0}}function qKe(e){return e==null&&(e=!0),fu(e)?{scheme:e,www:e}:{scheme:fu(e.scheme)?e.scheme:!0,www:fu(e.www)?e.www:!0}}function XKe(e){return typeof e=="number"?{length:e,location:"end"}:Ofe(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})}var gk=ude;var Ade;typeof DOMParser<"u"&&(Ade=new DOMParser);var KKe=new gk({stripPrefix:!1,email:!1,replaceFn:function(e,t){return t.urlMatchType==="scheme"||t.urlMatchType==="www"}}),yk=32,fde=2414016,dde=1,hde=16093e3,mde=.1,ZKe=[null,void 0,"http://www.topografix.com/GPX/1/1"],bo={gpx:ZKe};function JKe(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 XW(e,t){let n=uM(e,"id");return n=u(n)?n:zn(),t.getOrCreateEntity(n)}function KW(e){let t=pde(e,"lon"),n=pde(e,"lat"),i=cM(e,"ele",bo.gpx);return h.fromDegrees(t,n,i)}function pde(e,t){if(!u(e))return;let n=e.getAttribute(t);if(n!==null){let i=parseFloat(n);return isNaN(i)?void 0:i}}function uM(e,t){if(!u(e))return;let n=e.getAttribute(t);return n!==null?n:void 0}function Ay(e,t,n){if(!u(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 ZW(e,t,n){if(!u(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 cM(e,t,n){let i=Ay(e,t,n);if(u(i)){let o=parseFloat(i.textContent);return isNaN(o)?void 0:o}}function Tl(e,t,n){let i=Ay(e,t,n);if(u(i))return i.textContent.trim()}function xde(e){let t=new Na;return t.width=yk,t.height=yk,t.scaleByDistance=new Pt(fde,dde,hde,mde),t.pixelOffsetScaleByDistance=new Pt(fde,dde,hde,mde),t.verticalOrigin=new ei(On.BOTTOM),t.image=e,t}function QKe(){let e=new $f;return e.translucencyByDistance=new Pt(3e6,1,5e6,0),e.pixelOffset=new H(17,0),e.horizontalOrigin=_i.LEFT,e.font="16px sans-serif",e.style=No.FILL_AND_OUTLINE,e}function Cde(e){let t=new Ua;return t.width=4,t.material=new iy,t.material.color=u(e)?e:z.RED,t.material.outlineWidth=2,t.material.outlineColor=z.BLACK,t}var _de={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"}},lM;typeof document<"u"&&(lM=document.createElement("div"));function JW(e,t){let n,i="",o=Object.keys(_de),r=o.length;for(n=0;n<r;n++){let f=o[n],d=_de[f];d.value=y(Tl(e,d.tag,bo.gpx),""),u(d.value)&&d.value!==""&&(i=`${i}<p>${d.text}: ${d.value}</p>`)}if(!u(i)||i==="")return;i=KKe.link(i),lM.innerHTML=i;let s=lM.querySelectorAll("a");for(n=0;n<s.length;n++)s[n].setAttribute("target","_blank");let a=z.WHITE,c=z.BLACK,l='<div class="cesium-infoBox-description-lighter" style="';return l+="overflow:auto;",l+="word-wrap:break-word;",l+=`background-color:${a.toCssColorString()};`,l+=`color:${c.toCssColorString()};`,l+='">',l+=`${lM.innerHTML}</div>`,lM.innerHTML="",l}function Tde(e,t,n,i){let o=KW(t),r=XW(t,n);r.position=o;let s=u(i.waypointImage)?i.waypointImage:e._pinBuilder.fromMakiIconId("marker",z.RED,yk);r.billboard=xde(s);let a=Tl(t,"name",bo.gpx);r.name=a,r.label=QKe(),r.label.text=a,r.description=JW(t,r),i.clampToGround&&(r.billboard.heightReference=We.CLAMP_TO_GROUND,r.label.heightReference=We.CLAMP_TO_GROUND)}function $Ke(e,t,n,i){let o=XW(t,n);o.description=JW(t,o);let r=ZW(t,"rtept",bo.gpx),s=new Array(r.length);for(let a=0;a<r.length;a++)Tde(e,r[a],n,i),s[a]=KW(r[a]);o.polyline=Cde(i.routeColor),i.clampToGround&&(o.polyline.clampToGround=!0),o.polyline.positions=s}function eZe(e,t,n,i){let o=XW(t,n);o.description=JW(t,o);let r=ZW(t,"trkseg",bo.gpx),s=[],a=[],c,l=!0,f=new Ys;for(let d=0;d<r.length;d++)c=tZe(r[d]),s=s.concat(c.positions),c.times.length>0?(a=a.concat(c.times),f.addSamples(a,s),l=l&&!0):l=!1;if(l){let d=u(i.waypointImage)?i.waypointImage:e._pinBuilder.fromMakiIconId("marker",z.RED,yk);o.billboard=xde(d),o.position=f,i.clampToGround&&(o.billboard.heightReference=We.CLAMP_TO_GROUND),o.availability=new Pr,o.availability.addInterval(new An({start:a[0],stop:a[a.length-1]}))}o.polyline=Cde(i.trackColor),o.polyline.positions=s,i.clampToGround&&(o.polyline.clampToGround=!0)}function tZe(e){let t={positions:[],times:[]},n=ZW(e,"trkpt",bo.gpx),i;for(let o=0;o<n.length;o++){let r=KW(n[o]);t.positions.push(r),i=Tl(n[o],"time",bo.gpx),u(i)&&t.times.push($.fromIso8601(i))}return t}function nZe(e){let t=Ay(e,"metadata",bo.gpx);if(u(t)){let n={name:Tl(t,"name",bo.gpx),desc:Tl(t,"desc",bo.gpx),author:iZe(t),copyright:rZe(t),link:Ede(t),time:Tl(t,"time",bo.gpx),keywords:Tl(t,"keywords",bo.gpx),bounds:sZe(t)};if(u(n.name)||u(n.desc)||u(n.author)||u(n.copyright)||u(n.link)||u(n.time)||u(n.keywords)||u(n.bounds))return n}}function iZe(e){let t=Ay(e,"author",bo.gpx);if(u(t)){let n={name:Tl(t,"name",bo.gpx),email:oZe(t),link:Ede(t)};if(u(n.name)||u(n.email)||u(n.link))return n}}function oZe(e){let t=Ay(e,"email",bo.gpx);if(u(t)){let n=Tl(t,"id",bo.gpx),i=Tl(t,"domain",bo.gpx);return`${n}@${i}`}}function Ede(e){let t=Ay(e,"link",bo.gpx);if(u(t)){let n={href:uM(t,"href"),text:Tl(t,"text",bo.gpx),mimeType:Tl(t,"type",bo.gpx)};if(u(n.href)||u(n.text)||u(n.mimeType))return n}}function rZe(e){let t=Ay(e,"copyright",bo.gpx);if(u(t)){let n={author:uM(t,"author"),year:Tl(t,"year",bo.gpx),license:Tl(t,"license",bo.gpx)};if(u(n.author)||u(n.year)||u(n.license))return n}}function sZe(e){let t=Ay(e,"bounds",bo.gpx);if(u(t)){let n={minLat:cM(t,"minlat",bo.gpx),maxLat:cM(t,"maxlat",bo.gpx),minLon:cM(t,"minlon",bo.gpx),maxLon:cM(t,"maxlon",bo.gpx)};if(u(n.minLat)||u(n.maxLat)||u(n.minLon)||u(n.maxLon))return n}}var gde={wpt:Tde,rte:$Ke,trk:eZe};function aZe(e,t,n,i){let o=Object.keys(gde),r=o.length;for(let s=0;s<r;s++){let a=o[s],c=gde[a],l=t.childNodes,f=l.length;for(let d=0;d<f;d++){let p=l[d];p.localName===a&&bo.gpx.indexOf(p.namespaceURI)!==-1&&c(e,p,n,i)}}}function yde(e,t,n){let i=e._entityCollection;i.removeAll();let o=t.documentElement,r=uM(o,"version"),s=uM(o,"creator"),a,c=nZe(o);u(c)&&(a=c.name),o.localName==="gpx"?aZe(e,o,i,n):console.log(`GPX - Unsupported node: ${o.localName}`);let l,f=i.computeAvailability(),d=f.start,p=f.stop,g=$.equals(d,ze.MINIMUM_VALUE),m=$.equals(p,ze.MAXIMUM_VALUE);if(!g||!m){let x;g&&(x=new Date,x.setHours(0,0,0,0),d=$.fromDate(x)),m&&(x=new Date,x.setHours(24,0,0,0),p=$.fromDate(x)),l=new wd,l.startTime=d,l.stopTime=p,l.currentTime=$.clone(d),l.clockRange=Br.LOOP_STOP,l.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,l.multiplier=Math.round(Math.min(Math.max($.secondsDifference(p,d)/60,1),31556900))}let A=!1;return e._name!==a&&(e._name=a,A=!0),e._creator!==s&&(e._creator=s,A=!0),cZe(e._metadata,c)&&(e._metadata=c,A=!0),e._version!==r&&(e._version=r,A=!0),l!==e._clock&&(A=!0,e._clock=l),A&&e._changed.raiseEvent(e),Or.setLoading(e,!1),e}function cZe(e,t){return!u(e)&&!u(t)?!1:u(e)&&u(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 lZe(e,t,n,i){i=y(i,y.EMPTY_OBJECT);let o=n;if(typeof n=="string"||n instanceof Oe){n=Oe.createIfNeeded(n),o=n.fetchBlob();let r=e._resourceCredits,s=n.credits;if(u(s)){let a=s.length;for(let c=0;c<a;c++)r.push(s[c])}}return Promise.resolve(o).then(function(r){return r instanceof Blob?JKe(r).then(function(s){let a,c;try{a=Ade.parseFromString(s,"application/xml")}catch(l){c=l.toString()}if(u(c)||a.body||a.documentElement.tagName==="parsererror"){let l=u(c)?c:a.documentElement.firstChild.nodeValue;throw l||(l=a.body.innerText),new ue(l)}return yde(e,a,i)}):yde(e,r,i)}).catch(function(r){return e._error.raiseEvent(e,r),console.log(r),Promise.reject(r)})}function pb(){this._changed=new Ae,this._error=new Ae,this._loading=new Ae,this._clock=void 0,this._entityCollection=new Ss(this),this._entityCluster=new tu,this._name=void 0,this._version=void 0,this._creator=void 0,this._metadata=void 0,this._isLoading=!1,this._pinBuilder=new d_}pb.load=function(e,t){return new pb().load(e,t)};Object.defineProperties(pb.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){this._entityCluster=e}}});pb.prototype.update=function(e){return!0};pb.prototype.load=function(e,t){if(!u(e))throw new de("data is required.");t=y(t,y.EMPTY_OBJECT),Or.setLoading(this,!0);let n=this._name,i=this;return lZe(this,this._entityCollection,e,t).then(function(){let o,r=i._entityCollection.computeAvailability(),s=r.start,a=r.stop,c=$.equals(s,ze.MINIMUM_VALUE),l=$.equals(a,ze.MAXIMUM_VALUE);if(!c||!l){let d;c&&(d=new Date,d.setHours(0,0,0,0),s=$.fromDate(d)),l&&(d=new Date,d.setHours(24,0,0,0),a=$.fromDate(d)),o=new wd,o.startTime=s,o.stopTime=a,o.currentTime=$.clone(s),o.clockRange=Br.LOOP_STOP,o.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,o.multiplier=Math.round(Math.min(Math.max($.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),Or.setLoading(i,!1),i}).catch(function(o){return Or.setLoading(i,!1),i._error.raiseEvent(i,o),console.log(o),Promise.reject(o)})};var fM=pb;function uZe(e,t){this.position=e,this.headingPitchRoll=t}var dM=uZe;var vM=vo(Ll(),1);function Sk(e){return Dk(e.map(([t,n])=>new Array(t).fill(n,0,t)))}function Dk(e){return e.reduce((t,n)=>t.concat(Array.isArray(n)?Dk(n):n),[])}var bde=[0,1,2,3].concat(...Sk([[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 lr(){let e=this;function t(o){let r=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,l=e.stat_desc.max_length,f,d,p,g,m,A,x=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++)d=o.heap[f],g=r[r[d*2+1]*2+1]+1,g>l&&(g=l,x++),r[d*2+1]=g,!(d>e.max_code)&&(o.bl_count[g]++,m=0,d>=c&&(m=a[d-c]),A=r[d*2],o.opt_len+=A*(g+m),s&&(o.static_len+=A*(s[d*2+1]+m)));if(x!==0){do{for(g=l-1;o.bl_count[g]===0;)g--;o.bl_count[g]--,o.bl_count[g+1]+=2,o.bl_count[l]--,x-=2}while(x>0);for(g=l;g!==0;g--)for(d=o.bl_count[g];d!==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),d--)}}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=[],c=0,l,f,d;for(l=1;l<=15;l++)a[l]=c=c+s[l-1]<<1;for(f=0;f<=r;f++)d=o[f*2+1],d!==0&&(o[f*2]=n(a[d]++,d))}e.build_tree=function(o){let r=e.dyn_tree,s=e.stat_desc.static_tree,a=e.stat_desc.elems,c,l,f=-1,d;for(o.heap_len=0,o.heap_max=573,c=0;c<a;c++)r[c*2]!==0?(o.heap[++o.heap_len]=f=c,o.depth[c]=0):r[c*2+1]=0;for(;o.heap_len<2;)d=o.heap[++o.heap_len]=f<2?++f:0,r[d*2]=1,o.depth[d]=0,o.opt_len--,s&&(o.static_len-=s[d*2+1]);for(e.max_code=f,c=Math.floor(o.heap_len/2);c>=1;c--)o.pqdownheap(r,c);d=a;do c=o.heap[1],o.heap[1]=o.heap[o.heap_len--],o.pqdownheap(r,1),l=o.heap[1],o.heap[--o.heap_max]=c,o.heap[--o.heap_max]=l,r[d*2]=r[c*2]+r[l*2],o.depth[d]=Math.max(o.depth[c],o.depth[l])+1,r[c*2+1]=r[l*2+1]=d,o.heap[1]=d++,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)}}lr._length_code=[0,1,2,3,4,5,6,7].concat(...Sk([[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]]));lr.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];lr.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];lr.d_code=function(e){return e<256?bde[e]:bde[256+(e>>>7)]};lr.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];lr.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];lr.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];lr.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function pa(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 fZe=[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],dZe=Sk([[144,8],[112,9],[24,7],[8,8]]);pa.static_ltree=Dk(fZe.map((e,t)=>[e,dZe[t]]));var hZe=[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],mZe=Sk([[30,5]]);pa.static_dtree=Dk(hZe.map((e,t)=>[e,mZe[t]]));pa.static_l_desc=new pa(pa.static_ltree,lr.extra_lbits,256+1,286,15);pa.static_d_desc=new pa(pa.static_dtree,lr.extra_dbits,0,30,15);pa.static_bl_desc=new pa(null,lr.extra_blbits,0,19,7);var pZe=9,_Ze=8;function im(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 Dde=0,Ek=1,bx=2,kd=[new im(0,0,0,0,Dde),new im(4,4,8,4,Ek),new im(4,5,16,8,Ek),new im(4,6,32,32,Ek),new im(4,4,16,16,bx),new im(8,16,32,32,bx),new im(8,16,128,128,bx),new im(8,32,128,256,bx),new im(32,128,258,1024,bx),new im(32,258,258,4096,bx)],Ak=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],Tf=0,xk=1,hM=2,Ck=3,gZe=32,QW=42,Tk=113,mM=666,$W=8,yZe=0,e7=1,AZe=2,gr=3,bk=258,hu=bk+gr+1;function Sde(e,t,n,i){let o=e[t*2],r=e[n*2];return o<r||o==r&&i[t]<=i[n]}function xZe(){let e=this,t,n,i,o,r,s,a,c,l,f,d,p,g,m,A,x,C,T,E,S,D,w,R,O,L,N,_,b,v,I,B,F,k,U=new lr,G=new lr,V=new lr;e.depth=[];let X,j,Q,W,K,J;e.bl_count=[],e.heap=[],B=[],F=[],k=[];function _e(){l=2*r,d[g-1]=0;for(let Be=0;Be<g-1;Be++)d[Be]=0;N=kd[_].max_lazy,v=kd[_].good_length,I=kd[_].nice_length,L=kd[_].max_chain,D=0,C=0,R=0,T=O=gr-1,S=0,p=0}function xe(){let Be;for(Be=0;Be<286;Be++)B[Be*2]=0;for(Be=0;Be<30;Be++)F[Be*2]=0;for(Be=0;Be<19;Be++)k[Be*2]=0;B[256*2]=1,e.opt_len=e.static_len=0,j=Q=0}function re(){U.dyn_tree=B,U.stat_desc=pa.static_l_desc,G.dyn_tree=F,G.stat_desc=pa.static_d_desc,V.dyn_tree=k,V.stat_desc=pa.static_bl_desc,K=0,J=0,W=8,xe()}e.pqdownheap=function(Be,it){let Ke=e.heap,Ze=Ke[it],ft=it<<1;for(;ft<=e.heap_len&&(ft<e.heap_len&&Sde(Be,Ke[ft+1],Ke[ft],e.depth)&&ft++,!Sde(Be,Ze,Ke[ft],e.depth));)Ke[it]=Ke[ft],it=ft,ft<<=1;Ke[it]=Ze};function ye(Be,it){let Ke=-1,Ze,ft=Be[0*2+1],Lt=0,En=7,so=4;ft===0&&(En=138,so=3),Be[(it+1)*2+1]=65535;for(let So=0;So<=it;So++)Ze=ft,ft=Be[(So+1)*2+1],!(++Lt<En&&Ze==ft)&&(Lt<so?k[Ze*2]+=Lt:Ze!==0?(Ze!=Ke&&k[Ze*2]++,k[16*2]++):Lt<=10?k[17*2]++:k[18*2]++,Lt=0,Ke=Ze,ft===0?(En=138,so=3):Ze==ft?(En=6,so=3):(En=7,so=4))}function fe(){let Be;for(ye(B,U.max_code),ye(F,G.max_code),V.build_tree(e),Be=19-1;Be>=3&&k[lr.bl_order[Be]*2+1]===0;Be--);return e.opt_len+=3*(Be+1)+5+5+4,Be}function Se(Be){e.pending_buf[e.pending++]=Be}function we(Be){Se(Be&255),Se(Be>>>8&255)}function Ve(Be){Se(Be>>8&255),Se(Be&255&255)}function qe(Be,it){let Ke,Ze=it;J>16-Ze?(Ke=Be,K|=Ke<<J&65535,we(K),K=Ke>>>16-J,J+=Ze-16):(K|=Be<<J&65535,J+=Ze)}function mt(Be,it){let Ke=Be*2;qe(it[Ke]&65535,it[Ke+1]&65535)}function Ht(Be,it){let Ke,Ze=-1,ft,Lt=Be[0*2+1],En=0,so=7,So=4;for(Lt===0&&(so=138,So=3),Ke=0;Ke<=it;Ke++)if(ft=Lt,Lt=Be[(Ke+1)*2+1],!(++En<so&&ft==Lt)){if(En<So)do mt(ft,k);while(--En!==0);else ft!==0?(ft!=Ze&&(mt(ft,k),En--),mt(16,k),qe(En-3,2)):En<=10?(mt(17,k),qe(En-3,3)):(mt(18,k),qe(En-11,7));En=0,Ze=ft,Lt===0?(so=138,So=3):ft==Lt?(so=6,So=3):(so=7,So=4)}}function fn(Be,it,Ke){let Ze;for(qe(Be-257,5),qe(it-1,5),qe(Ke-4,4),Ze=0;Ze<Ke;Ze++)qe(k[lr.bl_order[Ze]*2+1],3);Ht(B,Be-1),Ht(F,it-1)}function dt(){J==16?(we(K),K=0,J=0):J>=8&&(Se(K&255),K>>>=8,J-=8)}function Tn(){qe(e7<<1,3),mt(256,pa.static_ltree),dt(),1+W+10-J<9&&(qe(e7<<1,3),mt(256,pa.static_ltree),dt()),W=7}function Jn(Be,it){let Ke,Ze,ft;if(e.dist_buf[j]=Be,e.lc_buf[j]=it&255,j++,Be===0?B[it*2]++:(Q++,Be--,B[(lr._length_code[it]+256+1)*2]++,F[lr.d_code(Be)*2]++),!(j&8191)&&_>2){for(Ke=j*8,Ze=D-C,ft=0;ft<30;ft++)Ke+=F[ft*2]*(5+lr.extra_dbits[ft]);if(Ke>>>=3,Q<Math.floor(j/2)&&Ke<Math.floor(Ze/2))return!0}return j==X-1}function Gt(Be,it){let Ke,Ze,ft=0,Lt,En;if(j!==0)do Ke=e.dist_buf[ft],Ze=e.lc_buf[ft],ft++,Ke===0?mt(Ze,Be):(Lt=lr._length_code[Ze],mt(Lt+256+1,Be),En=lr.extra_lbits[Lt],En!==0&&(Ze-=lr.base_length[Lt],qe(Ze,En)),Ke--,Lt=lr.d_code(Ke),mt(Lt,it),En=lr.extra_dbits[Lt],En!==0&&(Ke-=lr.base_dist[Lt],qe(Ke,En)));while(ft<j);mt(256,Be),W=Be[256*2+1]}function Je(){J>8?we(K):J>0&&Se(K&255),K=0,J=0}function pe(Be,it,Ke){Je(),W=8,Ke&&(we(it),we(~it)),e.pending_buf.set(c.subarray(Be,Be+it),e.pending),e.pending+=it}function me(Be,it,Ke){qe((yZe<<1)+(Ke?1:0),3),pe(Be,it,!0)}function be(Be,it,Ke){let Ze,ft,Lt=0;_>0?(U.build_tree(e),G.build_tree(e),Lt=fe(),Ze=e.opt_len+3+7>>>3,ft=e.static_len+3+7>>>3,ft<=Ze&&(Ze=ft)):Ze=ft=it+5,it+4<=Ze&&Be!=-1?me(Be,it,Ke):ft==Ze?(qe((e7<<1)+(Ke?1:0),3),Gt(pa.static_ltree,pa.static_dtree)):(qe((AZe<<1)+(Ke?1:0),3),fn(U.max_code+1,G.max_code+1,Lt+1),Gt(B,F)),xe(),Ke&&Je()}function St(Be){be(C>=0?C:-1,D-C,Be),C=D,t.flush_pending()}function qt(){let Be,it,Ke,Ze;do{if(Ze=l-R-D,Ze===0&&D===0&&R===0)Ze=r;else if(Ze==-1)Ze--;else if(D>=r+r-hu){c.set(c.subarray(r,r+r),0),w-=r,D-=r,C-=r,Be=g,Ke=Be;do it=d[--Ke]&65535,d[Ke]=it>=r?it-r:0;while(--Be!==0);Be=r,Ke=Be;do it=f[--Ke]&65535,f[Ke]=it>=r?it-r:0;while(--Be!==0);Ze+=r}if(t.avail_in===0)return;Be=t.read_buf(c,D+R,Ze),R+=Be,R>=gr&&(p=c[D]&255,p=(p<<x^c[D+1]&255)&A)}while(R<hu&&t.avail_in!==0)}function Kn(Be){let it=65535,Ke;for(it>i-5&&(it=i-5);;){if(R<=1){if(qt(),R===0&&Be==0)return Tf;if(R===0)break}if(D+=R,R=0,Ke=C+it,(D===0||D>=Ke)&&(R=D-Ke,D=Ke,St(!1),t.avail_out===0)||D-C>=r-hu&&(St(!1),t.avail_out===0))return Tf}return St(Be==4),t.avail_out===0?Be==4?hM:Tf:Be==4?Ck:xk}function Ro(Be){let it=L,Ke=D,Ze,ft,Lt=O,En=D>r-hu?D-(r-hu):0,so=I,So=a,ns=D+bk,Nr=c[Ke+Lt-1],Hi=c[Ke+Lt];O>=v&&(it>>=2),so>R&&(so=R);do if(Ze=Be,!(c[Ze+Lt]!=Hi||c[Ze+Lt-1]!=Nr||c[Ze]!=c[Ke]||c[++Ze]!=c[Ke+1])){Ke+=2,Ze++;do;while(c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&c[++Ke]==c[++Ze]&&Ke<ns);if(ft=bk-(ns-Ke),Ke=ns-bk,ft>Lt){if(w=Be,Lt=ft,ft>=so)break;Nr=c[Ke+Lt-1],Hi=c[Ke+Lt]}}while((Be=f[Be&So]&65535)>En&&--it!==0);return Lt<=R?Lt:R}function Uo(Be){let it=0,Ke;for(;;){if(R<hu){if(qt(),R<hu&&Be==0)return Tf;if(R===0)break}if(R>=gr&&(p=(p<<x^c[D+(gr-1)]&255)&A,it=d[p]&65535,f[D&a]=d[p],d[p]=D),it!==0&&(D-it&65535)<=r-hu&&b!=2&&(T=Ro(it)),T>=gr)if(Ke=Jn(D-w,T-gr),R-=T,T<=N&&R>=gr){T--;do D++,p=(p<<x^c[D+(gr-1)]&255)&A,it=d[p]&65535,f[D&a]=d[p],d[p]=D;while(--T!==0);D++}else D+=T,T=0,p=c[D]&255,p=(p<<x^c[D+1]&255)&A;else Ke=Jn(0,c[D]&255),R--,D++;if(Ke&&(St(!1),t.avail_out===0))return Tf}return St(Be==4),t.avail_out===0?Be==4?hM:Tf:Be==4?Ck:xk}function Ao(Be){let it=0,Ke,Ze;for(;;){if(R<hu){if(qt(),R<hu&&Be==0)return Tf;if(R===0)break}if(R>=gr&&(p=(p<<x^c[D+(gr-1)]&255)&A,it=d[p]&65535,f[D&a]=d[p],d[p]=D),O=T,E=w,T=gr-1,it!==0&&O<N&&(D-it&65535)<=r-hu&&(b!=2&&(T=Ro(it)),T<=5&&(b==1||T==gr&&D-w>4096)&&(T=gr-1)),O>=gr&&T<=O){Ze=D+R-gr,Ke=Jn(D-1-E,O-gr),R-=O-1,O-=2;do++D<=Ze&&(p=(p<<x^c[D+(gr-1)]&255)&A,it=d[p]&65535,f[D&a]=d[p],d[p]=D);while(--O!==0);if(S=0,T=gr-1,D++,Ke&&(St(!1),t.avail_out===0))return Tf}else if(S!==0){if(Ke=Jn(0,c[D-1]&255),Ke&&St(!1),D++,R--,t.avail_out===0)return Tf}else S=1,D++,R--}return S!==0&&(Ke=Jn(0,c[D-1]&255),S=0),St(Be==4),t.avail_out===0?Be==4?hM:Tf:Be==4?Ck:xk}function Yr(Be){return Be.total_in=Be.total_out=0,Be.msg=null,e.pending=0,e.pending_out=0,n=Tk,o=0,re(),_e(),0}e.deflateInit=function(Be,it,Ke,Ze,ft,Lt){return Ze||(Ze=$W),ft||(ft=_Ze),Lt||(Lt=0),Be.msg=null,it==-1&&(it=6),ft<1||ft>pZe||Ze!=$W||Ke<9||Ke>15||it<0||it>9||Lt<0||Lt>2?-2:(Be.dstate=e,s=Ke,r=1<<s,a=r-1,m=ft+7,g=1<<m,A=g-1,x=Math.floor((m+gr-1)/gr),c=new Uint8Array(r*2),f=[],d=[],X=1<<ft+6,e.pending_buf=new Uint8Array(X*4),i=X*4,e.dist_buf=new Uint16Array(X),e.lc_buf=new Uint8Array(X),_=it,b=Lt,Yr(Be))},e.deflateEnd=function(){return n!=QW&&n!=Tk&&n!=mM?-2:(e.lc_buf=null,e.dist_buf=null,e.pending_buf=null,d=null,f=null,c=null,e.dstate=null,n==Tk?-3:0)},e.deflateParams=function(Be,it,Ke){let Ze=0;return it==-1&&(it=6),it<0||it>9||Ke<0||Ke>2?-2:(kd[_].func!=kd[it].func&&Be.total_in!==0&&(Ze=Be.deflate(1)),_!=it&&(_=it,N=kd[_].max_lazy,v=kd[_].good_length,I=kd[_].nice_length,L=kd[_].max_chain),b=Ke,Ze)},e.deflateSetDictionary=function(Be,it,Ke){let Ze=Ke,ft,Lt=0;if(!it||n!=QW)return-2;if(Ze<gr)return 0;for(Ze>r-hu&&(Ze=r-hu,Lt=Ke-Ze),c.set(it.subarray(Lt,Lt+Ze),0),D=Ze,C=Ze,p=c[0]&255,p=(p<<x^c[1]&255)&A,ft=0;ft<=Ze-gr;ft++)p=(p<<x^c[ft+(gr-1)]&255)&A,f[ft&a]=d[p],d[p]=ft;return 0},e.deflate=function(Be,it){let Ke,Ze,ft,Lt,En;if(it>4||it<0)return-2;if(!Be.next_out||!Be.next_in&&Be.avail_in!==0||n==mM&&it!=4)return Be.msg=Ak[2- -2],-2;if(Be.avail_out===0)return Be.msg=Ak[2- -5],-5;if(t=Be,Lt=o,o=it,n==QW&&(Ze=$W+(s-8<<4)<<8,ft=(_-1&255)>>1,ft>3&&(ft=3),Ze|=ft<<6,D!==0&&(Ze|=gZe),Ze+=31-Ze%31,n=Tk,Ve(Ze)),e.pending!==0){if(t.flush_pending(),t.avail_out===0)return o=-1,0}else if(t.avail_in===0&&it<=Lt&&it!=4)return t.msg=Ak[2- -5],-5;if(n==mM&&t.avail_in!==0)return Be.msg=Ak[2- -5],-5;if(t.avail_in!==0||R!==0||it!=0&&n!=mM){switch(En=-1,kd[_].func){case Dde:En=Kn(it);break;case Ek:En=Uo(it);break;case bx:En=Ao(it);break;default:}if((En==hM||En==Ck)&&(n=mM),En==Tf||En==hM)return t.avail_out===0&&(o=-1),0;if(En==xk){if(it==1)Tn();else if(me(0,0,!1),it==3)for(Ke=0;Ke<g;Ke++)d[Ke]=0;if(t.flush_pending(),t.avail_out===0)return o=-1,0}}return it!=4?0:1}}function vde(){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}vde.prototype={deflateInit:function(e,t){let n=this;return n.dstate=new xZe,t||(t=15),n.dstate.deflateInit(n,e,t)},deflate:function(e){let t=this;return t.dstate?t.dstate.deflate(t,e):-2},deflateEnd:function(){let e=this;if(!e.dstate)return-2;let t=e.dstate.deflateEnd();return e.dstate=null,t},deflateParams:function(e,t){let n=this;return n.dstate?n.dstate.deflateParams(n,e,t):-2},deflateSetDictionary:function(e,t){let n=this;return n.dstate?n.dstate.deflateSetDictionary(n,e,t):-2},read_buf:function(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:function(){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 CZe(e){let t=this,n=new vde,i=TZe(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,c){let l,f,d=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,l=n.deflate(o),l!=0)throw new Error("deflating: "+n.msg);n.next_out_index&&(n.next_out_index==i?m.push(new Uint8Array(r)):m.push(r.slice(0,n.next_out_index))),g+=n.next_out_index,c&&n.next_in_index>0&&n.next_in_index!=d&&(c(n.next_in_index),d=n.next_in_index)}while(n.avail_in>0||n.avail_out===0);return m.length>1?(f=new Uint8Array(g),m.forEach(function(A){f.set(A,p),p+=A.length})):f=m[0]||new Uint8Array(0),f}},t.flush=function(){let a,c,l=0,f=0,d=[];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&&d.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(),c=new Uint8Array(f),d.forEach(function(p){c.set(p,l),l+=p.length}),c}}function TZe(e){return e+5*(Math.floor(e/16383)+1)}var wde=CZe;var mu=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],Xde=1440,EZe=0,bZe=4,SZe=9,DZe=5,vZe=[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],wZe=[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],IZe=[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],PZe=[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],OZe=[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],RZe=[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],xy=15;function o7(){let e=this,t,n,i,o,r,s;function a(l,f,d,p,g,m,A,x,C,T,E){let S,D,w,R,O,L,N,_,b,v,I,B,F,k,U;v=0,O=d;do i[l[f+v]]++,v++,O--;while(O!==0);if(i[0]==d)return A[0]=-1,x[0]=0,0;for(_=x[0],L=1;L<=xy&&i[L]===0;L++);for(N=L,_<L&&(_=L),O=xy;O!==0&&i[O]===0;O--);for(w=O,_>O&&(_=O),x[0]=_,k=1<<L;L<O;L++,k<<=1)if((k-=i[L])<0)return-3;if((k-=i[O])<0)return-3;for(i[O]+=k,s[1]=L=0,v=1,F=2;--O!==0;)s[F]=L+=i[v],F++,v++;O=0,v=0;do(L=l[f+v])!==0&&(E[s[L]++]=O),v++;while(++O<d);for(d=s[w],s[0]=O=0,v=0,R=-1,B=-_,r[0]=0,I=0,U=0;N<=w;N++)for(S=i[N];S--!==0;){for(;N>B+_;){if(R++,B+=_,U=w-B,U=U>_?_:U,(D=1<<(L=N-B))>S+1&&(D-=S+1,F=N,L<U))for(;++L<U&&!((D<<=1)<=i[++F]);)D-=i[F];if(U=1<<L,T[0]+U>Xde)return-3;r[R]=I=T[0],T[0]+=U,R!==0?(s[R]=O,o[0]=L,o[1]=_,L=O>>>B-_,o[2]=I-r[R-1]-L,C.set(o,(r[R-1]+L)*3)):A[0]=I}for(o[1]=N-B,v>=d?o[0]=128+64:E[v]<p?(o[0]=E[v]<256?0:32+64,o[2]=E[v++]):(o[0]=m[E[v]-p]+16+64,o[2]=g[E[v++]-p]),D=1<<N-B,L=O>>>B;L<U;L+=D)C.set(o,(I+L)*3);for(L=1<<N-1;O&L;L>>>=1)O^=L;for(O^=L,b=(1<<B)-1;(O&b)!=s[R];)R--,B-=_,b=(1<<B)-1}return k!==0&&w!=1?-5:0}function c(l){let f;for(t||(t=[],n=[],i=new Int32Array(xy+1),o=[],r=new Int32Array(xy),s=new Int32Array(xy+1)),n.length<l&&(n=[]),f=0;f<l;f++)n[f]=0;for(f=0;f<xy+1;f++)i[f]=0;for(f=0;f<3;f++)o[f]=0;r.set(i.subarray(0,xy),0),s.set(i.subarray(0,xy+1),0)}e.inflate_trees_bits=function(l,f,d,p,g){let m;return c(19),t[0]=0,m=a(l,0,19,19,null,null,d,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(l,f,d,p,g,m,A,x,C){let T;return c(288),t[0]=0,T=a(d,0,l,257,IZe,PZe,m,p,x,t,n),T!=0||p[0]===0?(T==-3?C.msg="oversubscribed literal/length tree":T!=-4&&(C.msg="incomplete literal/length tree",T=-3),T):(c(288),T=a(d,l,f,0,OZe,RZe,A,g,x,t,n),T!=0||g[0]===0&&l>257?(T==-3?C.msg="oversubscribed distance tree":T==-5?(C.msg="incomplete distance tree",T=-3):T!=-4&&(C.msg="empty distance tree with lengths",T=-3),T):0)}}o7.inflate_trees_fixed=function(e,t,n,i){return e[0]=SZe,t[0]=DZe,n[0]=vZe,i[0]=wZe,0};var vk=0,Ide=1,Pde=2,Ode=3,Rde=4,Bde=5,Mde=6,t7=7,Lde=8,wk=9;function BZe(){let e=this,t,n=0,i,o=0,r=0,s=0,a=0,c=0,l=0,f=0,d,p=0,g,m=0;function A(x,C,T,E,S,D,w,R){let O,L,N,_,b,v,I,B,F,k,U,G,V,X,j,Q;I=R.next_in_index,B=R.avail_in,b=w.bitb,v=w.bitk,F=w.write,k=F<w.read?w.read-F-1:w.end-F,U=mu[x],G=mu[C];do{for(;v<20;)B--,b|=(R.read_byte(I++)&255)<<v,v+=8;if(O=b&U,L=T,N=E,Q=(N+O)*3,(_=L[Q])===0){b>>=L[Q+1],v-=L[Q+1],w.win[F++]=L[Q+2],k--;continue}do{if(b>>=L[Q+1],v-=L[Q+1],_&16){for(_&=15,V=L[Q+2]+(b&mu[_]),b>>=_,v-=_;v<15;)B--,b|=(R.read_byte(I++)&255)<<v,v+=8;O=b&G,L=S,N=D,Q=(N+O)*3,_=L[Q];do if(b>>=L[Q+1],v-=L[Q+1],_&16){for(_&=15;v<_;)B--,b|=(R.read_byte(I++)&255)<<v,v+=8;if(X=L[Q+2]+(b&mu[_]),b>>=_,v-=_,k-=V,F>=X)j=F-X,F-j>0&&2>F-j?(w.win[F++]=w.win[j++],w.win[F++]=w.win[j++],V-=2):(w.win.set(w.win.subarray(j,j+2),F),F+=2,j+=2,V-=2);else{j=F-X;do j+=w.end;while(j<0);if(_=w.end-j,V>_){if(V-=_,F-j>0&&_>F-j)do w.win[F++]=w.win[j++];while(--_!==0);else w.win.set(w.win.subarray(j,j+_),F),F+=_,j+=_,_=0;j=0}}if(F-j>0&&V>F-j)do w.win[F++]=w.win[j++];while(--V!==0);else w.win.set(w.win.subarray(j,j+V),F),F+=V,j+=V,V=0;break}else if(!(_&64))O+=L[Q+2],O+=b&mu[_],Q=(N+O)*3,_=L[Q];else return R.msg="invalid distance code",V=R.avail_in-B,V=v>>3<V?v>>3:V,B+=V,I-=V,v-=V<<3,w.bitb=b,w.bitk=v,R.avail_in=B,R.total_in+=I-R.next_in_index,R.next_in_index=I,w.write=F,-3;while(!0);break}if(_&64)return _&32?(V=R.avail_in-B,V=v>>3<V?v>>3:V,B+=V,I-=V,v-=V<<3,w.bitb=b,w.bitk=v,R.avail_in=B,R.total_in+=I-R.next_in_index,R.next_in_index=I,w.write=F,1):(R.msg="invalid literal/length code",V=R.avail_in-B,V=v>>3<V?v>>3:V,B+=V,I-=V,v-=V<<3,w.bitb=b,w.bitk=v,R.avail_in=B,R.total_in+=I-R.next_in_index,R.next_in_index=I,w.write=F,-3);if(O+=L[Q+2],O+=b&mu[_],Q=(N+O)*3,(_=L[Q])===0){b>>=L[Q+1],v-=L[Q+1],w.win[F++]=L[Q+2],k--;break}}while(!0)}while(k>=258&&B>=10);return V=R.avail_in-B,V=v>>3<V?v>>3:V,B+=V,I-=V,v-=V<<3,w.bitb=b,w.bitk=v,R.avail_in=B,R.total_in+=I-R.next_in_index,R.next_in_index=I,w.write=F,0}e.init=function(x,C,T,E,S,D){t=vk,l=x,f=C,d=T,p=E,g=S,m=D,i=null},e.proc=function(x,C,T){let E,S,D,w=0,R=0,O=0,L,N,_,b;for(O=C.next_in_index,L=C.avail_in,w=x.bitb,R=x.bitk,N=x.write,_=N<x.read?x.read-N-1:x.end-N;;)switch(t){case vk:if(_>=258&&L>=10&&(x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,T=A(l,f,d,p,g,m,x,C),O=C.next_in_index,L=C.avail_in,w=x.bitb,R=x.bitk,N=x.write,_=N<x.read?x.read-N-1:x.end-N,T!=0)){t=T==1?t7:wk;break}r=l,i=d,o=p,t=Ide;case Ide:for(E=r;R<E;){if(L!==0)T=0;else return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);L--,w|=(C.read_byte(O++)&255)<<R,R+=8}if(S=(o+(w&mu[E]))*3,w>>>=i[S+1],R-=i[S+1],D=i[S],D===0){s=i[S+2],t=Mde;break}if(D&16){a=D&15,n=i[S+2],t=Pde;break}if(!(D&64)){r=D,o=S/3+i[S+2];break}if(D&32){t=t7;break}return t=wk,C.msg="invalid literal/length code",T=-3,x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);case Pde:for(E=a;R<E;){if(L!==0)T=0;else return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);L--,w|=(C.read_byte(O++)&255)<<R,R+=8}n+=w&mu[E],w>>=E,R-=E,r=f,i=g,o=m,t=Ode;case Ode:for(E=r;R<E;){if(L!==0)T=0;else return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);L--,w|=(C.read_byte(O++)&255)<<R,R+=8}if(S=(o+(w&mu[E]))*3,w>>=i[S+1],R-=i[S+1],D=i[S],D&16){a=D&15,c=i[S+2],t=Rde;break}if(!(D&64)){r=D,o=S/3+i[S+2];break}return t=wk,C.msg="invalid distance code",T=-3,x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);case Rde:for(E=a;R<E;){if(L!==0)T=0;else return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);L--,w|=(C.read_byte(O++)&255)<<R,R+=8}c+=w&mu[E],w>>=E,R-=E,t=Bde;case Bde:for(b=N-c;b<0;)b+=x.end;for(;n!==0;){if(_===0&&(N==x.end&&x.read!==0&&(N=0,_=N<x.read?x.read-N-1:x.end-N),_===0&&(x.write=N,T=x.inflate_flush(C,T),N=x.write,_=N<x.read?x.read-N-1:x.end-N,N==x.end&&x.read!==0&&(N=0,_=N<x.read?x.read-N-1:x.end-N),_===0)))return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);x.win[N++]=x.win[b++],_--,b==x.end&&(b=0),n--}t=vk;break;case Mde:if(_===0&&(N==x.end&&x.read!==0&&(N=0,_=N<x.read?x.read-N-1:x.end-N),_===0&&(x.write=N,T=x.inflate_flush(C,T),N=x.write,_=N<x.read?x.read-N-1:x.end-N,N==x.end&&x.read!==0&&(N=0,_=N<x.read?x.read-N-1:x.end-N),_===0)))return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);T=0,x.win[N++]=s,_--,t=vk;break;case t7:if(R>7&&(R-=8,L++,O--),x.write=N,T=x.inflate_flush(C,T),N=x.write,_=N<x.read?x.read-N-1:x.end-N,x.read!=x.write)return x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);t=Lde;case Lde:return T=1,x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);case wk:return T=-3,x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T);default:return T=-2,x.bitb=w,x.bitk=R,C.avail_in=L,C.total_in+=O-C.next_in_index,C.next_in_index=O,x.write=N,x.inflate_flush(C,T)}},e.free=function(){}}var Nde=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_b=0,n7=1,Fde=2,Vde=3,Ude=4,kde=5,Ik=6,Pk=7,zde=8,Sx=9;function MZe(e,t){let n=this,i=_b,o=0,r=0,s=0,a,c=[0],l=[0],f=new BZe,d=0,p=new Int32Array(Xde*3),g=0,m=new o7;n.bitk=0,n.bitb=0,n.win=new Uint8Array(t),n.end=t,n.read=0,n.write=0,n.reset=function(A,x){x&&(x[0]=g),i==Ik&&f.free(A),i=_b,n.bitk=0,n.bitb=0,n.read=n.write=0},n.reset(e,null),n.inflate_flush=function(A,x){let C,T,E;return T=A.next_out_index,E=n.read,C=(E<=n.write?n.write:n.end)-E,C>A.avail_out&&(C=A.avail_out),C!==0&&x==-5&&(x=0),A.avail_out-=C,A.total_out+=C,A.next_out.set(n.win.subarray(E,E+C),T),T+=C,E+=C,E==n.end&&(E=0,n.write==n.end&&(n.write=0),C=n.write-E,C>A.avail_out&&(C=A.avail_out),C!==0&&x==-5&&(x=0),A.avail_out-=C,A.total_out+=C,A.next_out.set(n.win.subarray(E,E+C),T),T+=C,E+=C),A.next_out_index=T,n.read=E,x},n.proc=function(A,x){let C,T,E,S,D,w,R,O;for(S=A.next_in_index,D=A.avail_in,T=n.bitb,E=n.bitk,w=n.write,R=w<n.read?n.read-w-1:n.end-w;;){let L,N,_,b,v,I,B,F;switch(i){case _b:for(;E<3;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}switch(C=T&7,d=C&1,C>>>1){case 0:T>>>=3,E-=3,C=E&7,T>>>=C,E-=C,i=n7;break;case 1:L=[],N=[],_=[[]],b=[[]],o7.inflate_trees_fixed(L,N,_,b),f.init(L[0],N[0],_[0],0,b[0],0),T>>>=3,E-=3,i=Ik;break;case 2:T>>>=3,E-=3,i=Vde;break;case 3:return T>>>=3,E-=3,i=Sx,A.msg="invalid block type",x=-3,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x)}break;case n7:for(;E<32;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}if((~T>>>16&65535)!=(T&65535))return i=Sx,A.msg="invalid stored block lengths",x=-3,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);o=T&65535,T=E=0,i=o!==0?Fde:d!==0?Pk:_b;break;case Fde:if(D===0||R===0&&(w==n.end&&n.read!==0&&(w=0,R=w<n.read?n.read-w-1:n.end-w),R===0&&(n.write=w,x=n.inflate_flush(A,x),w=n.write,R=w<n.read?n.read-w-1:n.end-w,w==n.end&&n.read!==0&&(w=0,R=w<n.read?n.read-w-1:n.end-w),R===0)))return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);if(x=0,C=o,C>D&&(C=D),C>R&&(C=R),n.win.set(A.read_buf(S,C),w),S+=C,D-=C,w+=C,R-=C,(o-=C)!==0)break;i=d!==0?Pk:_b;break;case Vde:for(;E<14;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}if(r=C=T&16383,(C&31)>29||(C>>5&31)>29)return i=Sx,A.msg="too many length or distance symbols",x=-3,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);if(C=258+(C&31)+(C>>5&31),!a||a.length<C)a=[];else for(O=0;O<C;O++)a[O]=0;T>>>=14,E-=14,s=0,i=Ude;case Ude:for(;s<4+(r>>>10);){for(;E<3;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}a[Nde[s++]]=T&7,T>>>=3,E-=3}for(;s<19;)a[Nde[s++]]=0;if(c[0]=7,C=m.inflate_trees_bits(a,c,l,p,A),C!=0)return x=C,x==-3&&(a=null,i=Sx),n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);s=0,i=kde;case kde:for(;C=r,!(s>=258+(C&31)+(C>>5&31));){let k,U;for(C=c[0];E<C;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}if(C=p[(l[0]+(T&mu[C]))*3+1],U=p[(l[0]+(T&mu[C]))*3+2],U<16)T>>>=C,E-=C,a[s++]=U;else{for(O=U==18?7:U-14,k=U==18?11:3;E<C+O;){if(D!==0)x=0;else return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);D--,T|=(A.read_byte(S++)&255)<<E,E+=8}if(T>>>=C,E-=C,k+=T&mu[O],T>>>=O,E-=O,O=s,C=r,O+k>258+(C&31)+(C>>5&31)||U==16&&O<1)return a=null,i=Sx,A.msg="invalid bit length repeat",x=-3,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);U=U==16?a[O-1]:0;do a[O++]=U;while(--k!==0);s=O}}if(l[0]=-1,v=[],I=[],B=[],F=[],v[0]=9,I[0]=6,C=r,C=m.inflate_trees_dynamic(257+(C&31),1+(C>>5&31),a,v,I,B,F,p,A),C!=0)return C==-3&&(a=null,i=Sx),x=C,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);f.init(v[0],I[0],p,B[0],p,F[0]),i=Ik;case Ik:if(n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,(x=f.proc(n,A,x))!=1)return n.inflate_flush(A,x);if(x=0,f.free(A),S=A.next_in_index,D=A.avail_in,T=n.bitb,E=n.bitk,w=n.write,R=w<n.read?n.read-w-1:n.end-w,d===0){i=_b;break}i=Pk;case Pk:if(n.write=w,x=n.inflate_flush(A,x),w=n.write,R=w<n.read?n.read-w-1:n.end-w,n.read!=n.write)return n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);i=zde;case zde:return x=1,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);case Sx:return x=-3,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x);default:return x=-2,n.bitb=T,n.bitk=E,A.avail_in=D,A.total_in+=S-A.next_in_index,A.next_in_index=S,n.write=w,n.inflate_flush(A,x)}}},n.free=function(A){n.reset(A,null),n.win=null,p=null},n.set_dictionary=function(A,x,C){n.win.set(A.subarray(x,x+C),0),n.read=n.write=C},n.sync_point=function(){return i==n7?1:0}}var LZe=32,NZe=8,FZe=0,Hde=1,Gde=2,Wde=3,jde=4,Yde=5,i7=6,pM=7,qde=12,Cy=13,VZe=[0,0,255,255];function UZe(){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=pM,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 MZe(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==bZe?-5:0,o=-5;;)switch(s.mode){case FZe: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)!=NZe){s.mode=Cy,n.msg="unknown compression method",s.marker=5;break}if((s.method>>4)+8>s.wbits){s.mode=Cy,n.msg="invalid win size",s.marker=5;break}s.mode=Hde;case Hde: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=Cy,n.msg="incorrect header check",s.marker=5;break}if(!(r&LZe)){s.mode=pM;break}s.mode=Gde;case Gde: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=Wde;case Wde: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=jde;case jde: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=Yde;case Yde: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=i7,2);case i7:return s.mode=Cy,n.msg="need dictionary",s.marker=0,-2;case pM:if(o=s.blocks.proc(n,o),o==-3){s.mode=Cy,s.marker=0;break}if(o==0&&(o=i),o!=1)return o;o=i,s.blocks.reset(n,s.was),s.mode=qde;case qde:return n.avail_in=0,1;case Cy:return-3;default:return-2}},e.inflateSetDictionary=function(n,i,o){let r=0,s=o;if(!n||!n.istate||n.istate.mode!=i7)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=pM,0},e.inflateSync=function(n){let i,o,r,s,a;if(!n||!n.istate)return-2;let c=n.istate;if(c.mode!=Cy&&(c.mode=Cy,c.marker=0),(i=n.avail_in)===0)return-5;for(o=n.next_in_index,r=c.marker;i!==0&&r<4;)n.read_byte(o)==VZe[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,c.marker=r,r!=4?-3:(s=n.total_in,a=n.total_out,t(n),n.total_in=s,n.total_out=a,c.mode=pM,0)},e.inflateSyncPoint=function(n){return!n||!n.istate||!n.istate.blocks?-2:n.istate.blocks.sync_point()}}function Kde(){}Kde.prototype={inflateInit:function(e){let t=this;return t.istate=new UZe,e||(e=15),t.istate.inflateInit(t,e)},inflate:function(e){let t=this;return t.istate?t.istate.inflate(t,e):-2},inflateEnd:function(){let e=this;if(!e.istate)return-2;let t=e.istate.inflateEnd(e);return e.istate=null,t},inflateSync:function(){let e=this;return e.istate?e.istate.inflateSync(e):-2},inflateSetDictionary:function(e,t){let n=this;return n.istate?n.istate.inflateSetDictionary(n,e,t):-2},read_byte:function(e){return this.next_in[e]},read_buf:function(e,t){return this.next_in.subarray(e,e+t)}};function kZe(e){let t=this,n=new Kde,i=e&&e.chunkSize?Math.floor(e.chunkSize*2):128*1024,o=EZe,r=new Uint8Array(i),s=!1;n.inflateInit(),n.next_out=r,t.append=function(a,c){let l=[],f,d,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?l.push(new Uint8Array(r)):l.push(r.slice(0,n.next_out_index))),m+=n.next_out_index,c&&n.next_in_index>0&&n.next_in_index!=p&&(c(n.next_in_index),p=n.next_in_index)}while(n.avail_in>0||n.avail_out===0);return l.length>1?(d=new Uint8Array(m),l.forEach(function(A){d.set(A,g),g+=A.length})):d=l[0]||new Uint8Array(0),d}},t.flush=function(){n.inflateEnd()}}var Zde=kZe;var zZe={chunkSize:524288,maxWorkers:typeof navigator<"u"&&navigator.hardwareConcurrency||2,terminateWorkerTimeout:5e3,useWebWorkers:!0,workerScripts:void 0},El=Object.assign({},zZe);function Ok(){return El}function gb(e){if(e.baseURL!==void 0&&(El.baseURL=e.baseURL),e.chunkSize!==void 0&&(El.chunkSize=e.chunkSize),e.maxWorkers!==void 0&&(El.maxWorkers=e.maxWorkers),e.terminateWorkerTimeout!==void 0&&(El.terminateWorkerTimeout=e.terminateWorkerTimeout),e.useWebWorkers!==void 0&&(El.useWebWorkers=e.useWebWorkers),e.Deflate!==void 0&&(El.Deflate=e.Deflate),e.Inflate!==void 0&&(El.Inflate=e.Inflate),e.workerScripts!==void 0){if(e.workerScripts.deflate){if(!Array.isArray(e.workerScripts.deflate))throw new Error("workerScripts.deflate must be an array");El.workerScripts||(El.workerScripts={}),El.workerScripts.deflate=e.workerScripts.deflate}if(e.workerScripts.inflate){if(!Array.isArray(e.workerScripts.inflate))throw new Error("workerScripts.inflate must be an array");El.workerScripts||(El.workerScripts={}),El.workerScripts.inflate=e.workerScripts.inflate}}}var Jde=[];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;Jde[e]=t}var r7=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^Jde[(n^t[i])&255];this.crc=n}get(){return~this.crc}},Ty=r7;var _M=HZe;function HZe(e){if(typeof TextEncoder>"u"){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 Vc={concat(e,t){if(e.length===0||t.length===0)return e.concat(t);let n=e[e.length-1],i=Vc.getPartial(n);return i===32?e.concat(t):Vc._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+Vc.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]=Vc.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=Vc.getPartial(o);return i.push(Vc.partial(t+r&31,t+r>32?n:i.pop(),1)),i}},gM={bytes:{fromBits(e){let n=Vc.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(Vc.partial(8*(n&3),i)),t}}},s7={};s7.sha1=function(e){e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()};s7.sha1.prototype={blockSize:512,reset:function(){let e=this;return e._h=this._init.slice(0),e._buffer=[],e._length=0,e},update:function(e){let t=this;typeof e=="string"&&(e=gM.utf8String.toBits(e));let n=t._buffer=Vc.concat(t._buffer,e),i=t._length,o=t._length=i+Vc.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:function(){let e=this,t=e._buffer,n=e._h;t=Vc.concat(t,[Vc.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},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(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:function(e,t){return t<<e|t>>>32-e},_block:function(e){let t=this,n=t._h,i=Array(80);for(let l=0;l<16;l++)i[l]=e[l];let o=n[0],r=n[1],s=n[2],a=n[3],c=n[4];for(let l=0;l<=79;l++){l>=16&&(i[l]=t._S(1,i[l-3]^i[l-8]^i[l-14]^i[l-16]));let f=t._S(5,o)+t._f(l,r,s,a)+c+i[l]+t._key[Math.floor(l/20)]|0;c=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]+c|0}};var a7={};a7.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,c=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 l=s[r-1];(r%o===0||o===8&&r%o===4)&&(l=n[l>>>24]<<24^n[l>>16&255]<<16^n[l>>8&255]<<8^n[l&255],r%o===0&&(l=l<<8^l>>>24^c<<24,c=c<<1^(c>>7)*283)),s[r]=s[r-o]^l}for(let l=0;r;l++,r--){let f=s[l&3?r:r-4];r<=4||l<4?a[l]=f:a[l]=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,c,l;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 d=s^s<<1^s<<2^s<<3^s<<4;d=d>>8^d&255^99,n[f]=d,i[d]=f,l=o[c=o[a=o[f]]];let p=l*16843009^c*65537^a*257^f*16843008,g=o[d]*257^d*16843008;for(let m=0;m<4;m++)e[m][f]=g=g<<24^g>>>8,t[m][d]=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],c=r[2],l=r[3],f=r[4],d=e[0]^n[0],p=e[t?3:1]^n[1],g=e[2]^n[2],m=e[t?1:3]^n[3],A=4,x,C,T;for(let E=0;E<i;E++)x=s[d>>>24]^a[p>>16&255]^c[g>>8&255]^l[m&255]^n[A],C=s[p>>>24]^a[g>>16&255]^c[m>>8&255]^l[d&255]^n[A+1],T=s[g>>>24]^a[m>>16&255]^c[d>>8&255]^l[p&255]^n[A+2],m=s[m>>>24]^a[d>>16&255]^c[p>>8&255]^l[g&255]^n[A+3],A+=4,d=x,p=C,g=T;for(let E=0;E<4;E++)o[t?3&-E:E]=f[d>>>24]<<24^f[p>>16&255]<<16^f[g>>8&255]<<8^f[m&255]^n[A++],x=d,d=p,p=g,g=m,m=x;return o}};var Qde={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}},c7={};c7.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=Vc.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 Vc.clamp(t,o)}};var yb={importKey(e){return new yb.hmacSha1(gM.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,c,l,f=new ArrayBuffer(o),d=new DataView(f),p=0,g=Vc;for(t=gM.bytes.toBits(t),l=1;p<(o||1);l++){for(r=s=e.encrypt(g.concat(t,[l])),a=1;a<n;a++)for(s=e.encrypt(s),c=0;c<s.length;c++)r[c]^=s[c];for(a=0;p<(o||1)&&a<r.length;a++)d.setInt32(p,r[a]),p+=4}return f.slice(0,i/8)}};yb.hmacSha1=class{constructor(e){let t=this,n=t._hash=s7.sha1,i=[[],[]],o=n.prototype.blockSize/32;t._baseHash=[new n,new n],e.length>o&&(e=n.hash(e));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 xb="Invalid pasword",Ab=16,GZe="raw",$de={name:"PBKDF2"},WZe={name:"HMAC"},jZe="SHA-1",YZe=Object.assign({hash:WZe},$de),ehe=Object.assign({iterations:1e3,hash:{name:jZe}},$de),qZe=["deriveBits"],AM=[8,12,16],yM=[16,24,32],Ey=10,the=[0,0,0,0],Mk=typeof crypto<"u",nhe=Mk&&typeof crypto.subtle<"u",om=gM.bytes,ihe=a7.aes,ohe=c7.ctrGladman,rhe=yb.hmacSha1,Rk=class{constructor(t,n,i){Object.assign(this,{password:t,signed:n,strength:i-1,pendingInput:new Uint8Array(0)})}async append(t){let n=this;if(n.password){let o=pu(t,0,AM[n.strength]+2);await XZe(n,o,n.password),n.password=null,n.aesCtrGladman=new ohe(new ihe(n.keys.key),Array.from(the)),n.hmac=new rhe(n.keys.authentication),t=pu(t,AM[n.strength]+2)}let i=new Uint8Array(t.length-Ey-(t.length-Ey)%Ab);return she(n,t,i,0,Ey,!0)}flush(){let t=this,n=t.pendingInput,i=pu(n,0,n.length-Ey),o=pu(n,n.length-Ey),r=new Uint8Array(0);if(i.length){let a=om.toBits(i);t.hmac.update(a);let c=t.aesCtrGladman.update(a);r=om.fromBits(c)}let s=!0;if(t.signed){let a=pu(om.fromBits(t.hmac.digest()),0,Ey);for(let c=0;c<Ey;c++)a[c]!=o[c]&&(s=!1)}return{valid:s,data:r}}},Bk=class{constructor(t,n){Object.assign(this,{password:t,strength:n-1,pendingInput:new Uint8Array(0)})}async append(t){let n=this,i=new Uint8Array(0);n.password&&(i=await KZe(n,n.password),n.password=null,n.aesCtrGladman=new ohe(new ihe(n.keys.key),Array.from(the)),n.hmac=new rhe(n.keys.authentication));let o=new Uint8Array(i.length+t.length-t.length%Ab);return o.set(i,0),she(n,t,o,i.length,0)}flush(){let t=this,n=new Uint8Array(0);if(t.pendingInput.length){let o=t.aesCtrGladman.update(om.toBits(t.pendingInput));t.hmac.update(o),n=om.fromBits(o)}let i=pu(om.fromBits(t.hmac.digest()),0,Ey);return{data:l7(n,i),signature:i}}};function she(e,t,n,i,o,r){let s=t.length-o;e.pendingInput.length&&(t=l7(e.pendingInput,t),n=$Ze(n,s-s%Ab));let a;for(a=0;a<=s-Ab;a+=Ab){let c=om.toBits(pu(t,a,a+Ab));r&&e.hmac.update(c);let l=e.aesCtrGladman.update(c);r||e.hmac.update(l),n.set(om.fromBits(l),a+i)}return e.pendingInput=pu(t,a),n}async function XZe(e,t,n){await ahe(e,n,pu(t,0,AM[e.strength]));let i=pu(t,AM[e.strength]),o=e.keys.passwordVerification;if(o[0]!=i[0]||o[1]!=i[1])throw new Error(xb)}async function KZe(e,t){let n=ZZe(new Uint8Array(AM[e.strength]));return await ahe(e,t,n),l7(n,e.keys.passwordVerification)}async function ahe(e,t,n){let i=_M(t),o=await JZe(GZe,i,YZe,!1,qZe),r=await QZe(Object.assign({salt:n},ehe),o,8*(yM[e.strength]*2+2)),s=new Uint8Array(r);e.keys={key:om.toBits(pu(s,0,yM[e.strength])),authentication:om.toBits(pu(s,yM[e.strength],yM[e.strength]*2)),passwordVerification:pu(s,yM[e.strength]*2)}}function ZZe(e){return Mk&&typeof crypto.getRandomValues=="function"?crypto.getRandomValues(e):Qde.getRandomValues(e)}function JZe(e,t,n,i,o){return Mk&&nhe&&typeof crypto.subtle.importKey=="function"?crypto.subtle.importKey(e,t,n,i,o):yb.importKey(t)}async function QZe(e,t,n){return Mk&&nhe&&typeof crypto.subtle.deriveBits=="function"?await crypto.subtle.deriveBits(e,t,n):yb.pbkdf2(t,e.salt,ehe.iterations,n)}function l7(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 $Ze(e,t){if(t&&t>e.length){let n=e;e=new Uint8Array(t),e.set(n,0)}return e}function pu(e,t,n){return e.subarray(t,n)}var Cb=12,Lk=class{constructor(t,n){let i=this;Object.assign(i,{password:t,passwordVerification:n}),fhe(i,t)}append(t){let n=this;if(n.password){let i=che(n,t.subarray(0,Cb));if(n.password=null,i[Cb-1]!=n.passwordVerification)throw new Error(xb);t=t.subarray(Cb)}return che(n,t)}flush(){return{valid:!0,data:new Uint8Array(0)}}},Nk=class{constructor(t,n){let i=this;Object.assign(i,{password:t,passwordVerification:n}),fhe(i,t)}append(t){let n=this,i,o;if(n.password){n.password=null;let r=crypto.getRandomValues(new Uint8Array(Cb));r[Cb-1]=n.passwordVerification,i=new Uint8Array(t.length+r.length),i.set(lhe(n,r),0),o=Cb}else i=new Uint8Array(t.length),o=0;return i.set(lhe(n,t),o),i}flush(){return{data:new Uint8Array(0)}}};function che(e,t){let n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=dhe(e)^t[i],u7(e,n[i]);return n}function lhe(e,t){let n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=dhe(e)^t[i],u7(e,t[i]);return n}function fhe(e,t){e.keys=[305419896,591751049,878082192],e.crcKey0=new Ty(e.keys[0]),e.crcKey2=new Ty(e.keys[2]);for(let n=0;n<t.length;n++)u7(e,t.charCodeAt(n))}function u7(e,t){e.crcKey0.append([t]),e.keys[0]=~e.crcKey0.get(),e.keys[1]=uhe(e.keys[1]+hhe(e.keys[0])),e.keys[1]=uhe(Math.imul(e.keys[1],134775813)+1),e.crcKey2.append([e.keys[1]>>>24]),e.keys[2]=~e.crcKey2.get()}function dhe(e){let t=e.keys[2]|2;return hhe(Math.imul(t,t^1)>>>8)}function hhe(e){return e&255}function uhe(e){return e&4294967295}var Vk="deflate",Uk="inflate",Fk="Invalid signature",f7=class{constructor(t,{signature:n,password:i,signed:o,compressed:r,zipCrypto:s,passwordVerification:a,encryptionStrength:c},{chunkSize:l}){let f=Boolean(i);Object.assign(this,{signature:n,encrypted:f,signed:o,compressed:r,inflate:r&&new t({chunkSize:l}),crc32:o&&new Ty,zipCrypto:s,decrypt:f&&s?new Lk(i,a):new Rk(i,o,c)})}async append(t){let n=this;return n.encrypted&&t.length&&(t=await n.decrypt.append(t)),n.compressed&&t.length&&(t=await n.inflate.append(t)),(!n.encrypted||n.zipCrypto)&&n.signed&&t.length&&n.crc32.append(t),t}async flush(){let t=this,n,i=new Uint8Array(0);if(t.encrypted){let o=t.decrypt.flush();if(!o.valid)throw new Error(Fk);i=o.data}if((!t.encrypted||t.zipCrypto)&&t.signed){let o=new DataView(new Uint8Array(4).buffer);if(n=t.crc32.get(),o.setUint32(0,n),t.signature!=o.getUint32(0,!1))throw new Error(Fk)}return t.compressed&&(i=await t.inflate.append(i)||new Uint8Array(0),await t.inflate.flush()),{data:i,signature:n}}},d7=class{constructor(t,{encrypted:n,signed:i,compressed:o,level:r,zipCrypto:s,password:a,passwordVerification:c,encryptionStrength:l},{chunkSize:f}){Object.assign(this,{encrypted:n,signed:i,compressed:o,deflate:o&&new t({level:r||5,chunkSize:f}),crc32:i&&new Ty,zipCrypto:s,encrypt:n&&s?new Nk(a,c):new Bk(a,l)})}async append(t){let n=this,i=t;return n.compressed&&t.length&&(i=await n.deflate.append(t)),n.encrypted&&i.length&&(i=await n.encrypt.append(i)),(!n.encrypted||n.zipCrypto)&&n.signed&&t.length&&n.crc32.append(t),i}async flush(){let t=this,n,i=new Uint8Array(0);if(t.compressed&&(i=await t.deflate.flush()||new Uint8Array(0)),t.encrypted){i=await t.encrypt.append(i);let o=t.encrypt.flush();n=o.signature;let r=new Uint8Array(i.length+o.data.length);r.set(i,0),r.set(o.data,i.length),i=r}return(!t.encrypted||t.zipCrypto)&&t.signed&&(n=t.crc32.get()),{data:i,signature:n}}};function mhe(e,t,n){if(t.codecType.startsWith(Vk))return new d7(e,t,n);if(t.codecType.startsWith(Uk))return new f7(e,t,n)}var phe="init",_he="append",h7="flush",eJe="message",ghe=!0,kk=(e,t,n,i,o,r,s)=>(Object.assign(e,{busy:!0,codecConstructor:t,options:Object.assign({},n),scripts:s,terminate(){e.worker&&!e.busy&&(e.worker.terminate(),e.interface=null)},onTaskFinished(){e.busy=!1,o(e)}}),r?nJe(e,i):tJe(e,i));function tJe(e,t){let n=mhe(e.codecConstructor,e.options,t);return{async append(i){try{return await n.append(i)}catch(o){throw e.onTaskFinished(),o}},async flush(){try{return await n.flush()}finally{e.onTaskFinished()}},abort(){e.onTaskFinished()}}}function nJe(e,t){let n,i={type:"module"};if(!e.interface){if(!ghe)e.worker=o(i,t.baseURL);else try{e.worker=o({},t.baseURL)}catch{ghe=!1,e.worker=o(i,t.baseURL)}e.worker.addEventListener(eJe,a,!1),e.interface={append(c){return r({type:_he,data:c})},flush(){return r({type:h7})},abort(){e.onTaskFinished()}}}return e.interface;function o(c,l){let f,d;f=e.scripts[0],typeof f=="function"&&(f=f());try{d=new URL(f,l)}catch{d=f}return new Worker(d,c)}async function r(c){if(!n){let l=e.options,f=e.scripts.slice(1);await s({scripts:f,type:phe,options:l,config:{chunkSize:t.chunkSize}})}return s(c)}function s(c){let l=e.worker,f=new Promise((d,p)=>n={resolve:d,reject:p});try{if(c.data)try{c.data=c.data.buffer,l.postMessage(c,[c.data])}catch{l.postMessage(c)}else l.postMessage(c)}catch(d){n.reject(d),n=null,e.onTaskFinished()}return f}function a(c){let l=c.data;if(n){let f=l.error,d=l.type;if(f){let p=new Error(f.message);p.stack=f.stack,n.reject(p),n=null,e.onTaskFinished()}else if(d==phe||d==h7||d==_he){let p=l.data;d==h7?(n.resolve({data:new Uint8Array(p),signature:l.signature}),n=null,e.onTaskFinished()):n.resolve(p&&new Uint8Array(p))}}}}var Dx=[],m7=[];function zk(e,t,n){let o=!(!t.compressed&&!t.signed&&!t.encrypted)&&(t.useWebWorkers||t.useWebWorkers===void 0&&n.useWebWorkers),r=o&&n.workerScripts?n.workerScripts[t.codecType]:[];if(Dx.length<n.maxWorkers){let a={};return Dx.push(a),kk(a,e,t,n,s,o,r)}else{let a=Dx.find(c=>!c.busy);return a?(yhe(a),kk(a,e,t,n,s,o,r)):new Promise(c=>m7.push({resolve:c,codecConstructor:e,options:t,webWorker:o,scripts:r}))}function s(a){if(m7.length){let[{resolve:c,codecConstructor:l,options:f,webWorker:d,scripts:p}]=m7.splice(0,1);c(kk(a,l,f,n,s,d,p))}else a.worker?(yhe(a),Number.isFinite(n.terminateWorkerTimeout)&&n.terminateWorkerTimeout>=0&&(a.terminateTimeout=setTimeout(()=>{Dx=Dx.filter(c=>c!=a),a.terminate()},n.terminateWorkerTimeout))):Dx=Dx.filter(c=>c!=a)}}function yhe(e){e.terminateTimeout&&(clearTimeout(e.terminateTimeout),e.terminateTimeout=null)}var xhe="Abort error";async function Hk(e,t,n,i,o,r,s){let a=Math.max(r.chunkSize,64);return c();async function c(l=0,f=0){let d=s.signal,p=o();if(l<p){p7(d,e);let g=await t.readUint8Array(l+i,Math.min(a,p-l)),m=g.length;p7(d,e);let A=await e.append(g);if(p7(d,e),f+=await Ahe(n,A),s.onprogress)try{s.onprogress(l+m,p)}catch{}return c(l+a,f)}else{let g=await e.flush();return f+=await Ahe(n,g.data),{signature:g.signature,length:f}}}}function p7(e,t){if(e&&e.aborted)throw t.abort(),new Error(xhe)}async function Ahe(e,t){return t.length&&await e.writeUint8Array(t),t.length}var _7="text/plain";var Gk=class{constructor(){this.size=0}init(){this.initialized=!0}},Wk=class extends Gk{},xM=class extends Gk{writeUint8Array(t){this.size+=t.length}},jk=class extends Wk{constructor(t){super(),this.blobReader=new vx(new Blob([t],{type:_7}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,n){return this.blobReader.readUint8Array(t,n)}},Yk=class extends xM{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:_7})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:_7})}getData(){if(this.blob.text)return this.blob.text();{let t=new FileReader;return new Promise((n,i)=>{t.onload=o=>n(o.target.result),t.onerror=()=>i(t.error),t.readAsText(this.blob,this.encoding)})}}};var qk=class extends xM{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let n=0,i=this.pending,o=this.pending.length;for(this.pending="",n=0;n<Math.floor((o+t.length)/3)*3-o;n++)i+=String.fromCharCode(t[n]);for(;n<t.length;n++)this.pending+=String.fromCharCode(t[n]);i.length>2?this.data+=btoa(i):this.pending=i}getData(){return this.data+btoa(this.pending)}},vx=class extends Wk{constructor(t){super(),this.blob=t,this.size=t.size}async readUint8Array(t,n){if(this.blob.arrayBuffer)return new Uint8Array(await this.blob.slice(t,t+n).arrayBuffer());{let i=new FileReader;return new Promise((o,r)=>{i.onload=s=>o(new Uint8Array(s.target.result)),i.onerror=()=>r(i.error),i.readAsArrayBuffer(this.blob.slice(t,t+n))})}}},Tb=class extends xM{constructor(t){super(),this.contentType=t,this.arrayBuffersMaxlength=8,Che(this)}writeUint8Array(t){super.writeUint8Array(t),this.arrayBuffers.length==this.arrayBuffersMaxlength&&The(this),this.arrayBuffers.push(t.buffer)}getData(){return this.blob||(this.arrayBuffers.length&&The(this),this.blob=this.pendingBlob,Che(this)),this.blob}};function Che(e){e.pendingBlob=new Blob([],{type:e.contentType}),e.arrayBuffers=[]}function The(e){e.pendingBlob=new Blob([e.pendingBlob,...e.arrayBuffers],{type:e.contentType}),e.arrayBuffers=[]}var Eb="/",g7=new Date(2107,11,31),y7=new Date(1980,0,1);var iJe="\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(""),Ehe=e=>{let t="";for(let n=0;n<e.length;n++)t+=iJe[e[n]];return t};var Xk=oJe;function oJe(e,t){if(t&&t.trim().toLowerCase()=="cp437")return Ehe(e);if(typeof TextDecoder>"u"){let n=new FileReader;return new Promise((i,o)=>{n.onload=r=>i(r.target.result),n.onerror=()=>o(n.error),n.readAsText(new Blob([e]))})}else return new TextDecoder(t).decode(e)}var rJe=["filename","rawFilename","directory","encrypted","compressedSize","uncompressedSize","lastModDate","rawLastModDate","comment","rawComment","signature","extraField","rawExtraField","bitFlag","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","filenameUTF8","commentUTF8","offset","zip64","compressionMethod","extraFieldNTFS","lastAccessDate","creationDate","extraFieldExtendedTimestamp","version","versionMadeBy","msDosCompatible","internalFileAttribute","externalFileAttribute"],m_=class{constructor(t){rJe.forEach(n=>this[n]=t[n])}};var C7="File format is not recognized",lJe="End of central directory not found",uJe="End of Zip64 central directory not found",fJe="End of Zip64 central directory locator not found",dJe="Central directory header not found",hJe="Local file header not found",mJe="Zip64 extra field not found",pJe="File contains encrypted entry",_Je="Encryption method not supported",bhe="Compression method not supported",She="utf-8",Dhe="cp437",vhe=["uncompressedSize","compressedSize","offset"],iz=class{constructor(t,n={}){Object.assign(this,{reader:t,options:n,config:Ok()})}async*getEntriesGenerator(t={}){let n=this,i=n.reader;if(i.initialized||await i.init(),i.size<22)throw new Error(C7);let o=await CJe(i,101010256,i.size,22,65535*16);if(!o)throw new Error(lJe);let r=nc(o),s=Xs(r,12),a=Xs(r,16),c=_u(r,8),l=0;if(a==4294967295||s==4294967295||c==65535){let g=await by(i,o.offset-20,20),m=nc(g);if(Xs(m,0)!=117853008)throw new Error(uJe);a=Kk(m,8);let A=await by(i,a,56),x=nc(A),C=o.offset-20-56;if(Xs(x,0)!=101075792&&a!=C){let T=a;a=C,l=a-T,A=await by(i,a,56),x=nc(A)}if(Xs(x,0)!=101075792)throw new Error(fJe);c=Kk(x,32),s=Kk(x,40),a-=s}if(a<0||a>=i.size)throw new Error(C7);let f=0,d=await by(i,a,s),p=nc(d);if(s){let g=o.offset-s;if(Xs(p,f)!=33639248&&a!=g){let m=a;a=g,l=a-m,d=await by(i,a,s),p=nc(d)}}if(a<0||a>=i.size)throw new Error(C7);for(let g=0;g<c;g++){let m=new E7(i,n.config,n.options);if(Xs(p,f)!=33639248)throw new Error(dJe);Ihe(m,p,f+6);let A=Boolean(m.bitFlag.languageEncodingFlag),x=f+46,C=x+m.filenameLength,T=C+m.extraFieldLength,E=_u(p,f+4),S=(E&0)==0;Object.assign(m,{versionMadeBy:E,msDosCompatible:S,compressedSize:0,uncompressedSize:0,commentLength:_u(p,f+32),directory:S&&(Sb(p,f+38)&16)==16,offset:Xs(p,f+42)+l,internalFileAttribute:Xs(p,f+34),externalFileAttribute:Xs(p,f+38),rawFilename:d.subarray(x,C),filenameUTF8:A,commentUTF8:A,rawExtraField:d.subarray(C,T)});let D=T+m.commentLength;m.rawComment=d.subarray(T,D);let w=bb(n,t,"filenameEncoding"),R=bb(n,t,"commentEncoding"),[O,L]=await Promise.all([Xk(m.rawFilename,m.filenameUTF8?She:w||Dhe),Xk(m.rawComment,m.commentUTF8?She:R||Dhe)]);m.filename=O,m.comment=L,!m.directory&&m.filename.endsWith(Eb)&&(m.directory=!0),await Phe(m,m,p,f+6);let N=new m_(m);if(N.getData=(_,b)=>m.getData(_,N,b),f=D,t.onprogress)try{t.onprogress(g+1,c,new m_(m))}catch{}yield N}return!0}async getEntries(t={}){let n=[],i=this.getEntriesGenerator(t),o=i.next();for(;!(await o).done;)n.push((await o).value),o=i.next();return n}async close(){}};var E7=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,extraFieldAES:a,compressionMethod:c,config:l,bitFlag:f,signature:d,rawLastModDate:p,compressedSize:g}=o,m=o.localDirectory={};r.initialized||await r.init();let A=await by(r,s,30),x=nc(A),C=bb(o,i,"password");if(C=C&&C.length&&C,a&&a.originalCompressionMethod!=99)throw new Error(bhe);if(c!=0&&c!=8)throw new Error(bhe);if(Xs(x,0)!=67324752)throw new Error(hJe);Ihe(m,x,4),A=await by(r,s,30+m.filenameLength+m.extraFieldLength),m.rawExtraField=A.subarray(30+m.filenameLength),await Phe(o,m,x,4),n.lastAccessDate=m.lastAccessDate,n.creationDate=m.creationDate;let T=o.encrypted&&m.encrypted,E=T&&!a;if(T){if(!E&&a.strength===void 0)throw new Error(_Je);if(!C)throw new Error(pJe)}let S=await zk(l.Inflate,{codecType:Uk,password:C,zipCrypto:E,encryptionStrength:a&&a.strength,signed:bb(o,i,"checkSignature"),passwordVerification:E&&(f.dataDescriptor?p>>>8&255:d>>>24&255),signature:d,compressed:c!=0,encrypted:T,useWebWorkers:bb(o,i,"useWebWorkers")},l);t.initialized||await t.init();let D=bb(o,i,"signal"),w=s+30+m.filenameLength+m.extraFieldLength;return await Hk(S,r,t,w,()=>g,l,{onprogress:i.onprogress,signal:D}),t.getData()}};function Ihe(e,t,n){let i=e.rawBitFlag=_u(t,n+2),o=(i&1)==1,r=Xs(t,n+6);Object.assign(e,{encrypted:o,version:_u(t,n),bitFlag:{level:(i&6)>>1,dataDescriptor:(i&8)==8,languageEncodingFlag:(i&2048)==2048},rawLastModDate:r,lastModDate:TJe(r),filenameLength:_u(t,n+22),extraFieldLength:_u(t,n+24)})}async function Phe(e,t,n,i){let o=t.rawExtraField,r=t.extraField=new Map,s=nc(new Uint8Array(o)),a=0;try{for(;a<o.length;){let A=_u(s,a),x=_u(s,a+2);r.set(A,{type:A,data:o.slice(a+4,a+4+x)}),a+=4+x}}catch{}let c=_u(n,i+4);t.signature=Xs(n,i+10),t.uncompressedSize=Xs(n,i+18),t.compressedSize=Xs(n,i+14);let l=r.get(1);l&&(gJe(l,t),t.extraFieldZip64=l);let f=r.get(28789);f&&(await whe(f,"filename","rawFilename",t,e),t.extraFieldUnicodePath=f);let d=r.get(25461);d&&(await whe(d,"comment","rawComment",t,e),t.extraFieldUnicodeComment=d);let p=r.get(39169);p?(yJe(p,t,c),t.extraFieldAES=p):t.compressionMethod=c;let g=r.get(10);g&&(AJe(g,t),t.extraFieldNTFS=g);let m=r.get(21589);m&&(xJe(m,t),t.extraFieldExtendedTimestamp=m)}function gJe(e,t){t.zip64=!0;let n=nc(e.data);e.values=[];for(let o=0;o<Math.floor(e.data.length/8);o++)e.values.push(Kk(n,0+o*8));let i=vhe.filter(o=>t[o]==4294967295);for(let o=0;o<i.length;o++)e[i[o]]=e.values[o];vhe.forEach(o=>{if(t[o]==4294967295)if(e[o]!==void 0)t[o]=e[o];else throw new Error(mJe)})}async function whe(e,t,n,i,o){let r=nc(e.data);e.version=Sb(r,0),e.signature=Xs(r,1);let s=new Ty;s.append(o[n]);let a=nc(new Uint8Array(4));a.setUint32(0,s.get(),!0),e[t]=await Xk(e.data.subarray(5)),e.valid=!o.bitFlag.languageEncodingFlag&&e.signature==Xs(a,0),e.valid&&(i[t]=e[t],i[t+"UTF8"]=!0)}function yJe(e,t,n){let i=nc(e.data);e.vendorVersion=Sb(i,0),e.vendorId=Sb(i,2);let o=Sb(i,4);e.strength=o,e.originalCompressionMethod=n,t.compressionMethod=e.compressionMethod=_u(i,5)}function AJe(e,t){let n=nc(e.data),i=4,o;try{for(;i<e.data.length&&!o;){let r=_u(n,i),s=_u(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=nc(o),s=r.getBigUint64(0,!0),a=r.getBigUint64(8,!0),c=r.getBigUint64(16,!0);Object.assign(e,{rawLastModDate:s,rawLastAccessDate:a,rawCreationDate:c});let l=T7(s),f=T7(a),d=T7(c),p={lastModDate:l,lastAccessDate:f,creationDate:d};Object.assign(e,p),Object.assign(t,p)}}catch{}}function xJe(e,t){let n=nc(e.data),i=Sb(n,0),o=[],r=[];(i&1)==1&&(o.push("lastModDate"),r.push("rawLastModDate")),(i&2)==2&&(o.push("lastAccessDate"),r.push("rawLastAccessDate")),(i&4)==4&&(o.push("creationDate"),r.push("rawCreationDate"));let s=1;o.forEach((a,c)=>{if(e.data.length>=s+4){let l=Xs(n,s);t[a]=e[a]=new Date(l*1e3);let f=r[c];e[f]=l}s+=4})}async function CJe(e,t,n,i,o){let r=new Uint8Array(4),s=nc(r);EJe(s,0,t);let a=i+o;return await c(i)||await c(Math.min(a,n));async function c(l){let f=n-l,d=await by(e,f,l);for(let p=d.length-i;p>=0;p--)if(d[p]==r[0]&&d[p+1]==r[1]&&d[p+2]==r[2]&&d[p+3]==r[3])return{offset:f+p,buffer:d.slice(p,p+i).buffer}}}function bb(e,t,n){return t[n]===void 0?e.options[n]:t[n]}function TJe(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 T7(e){return new Date(Number(e/BigInt(1e4)-BigInt(116444736e5)))}function Sb(e,t){return e.getUint8(t)}function _u(e,t){return e.getUint16(t,!0)}function Xs(e,t){return e.getUint32(t,!0)}function Kk(e,t){return Number(e.getBigUint64(t,!0))}function EJe(e,t,n){e.setUint32(t,n,!0)}function nc(e){return new DataView(e.buffer)}function by(e,t,n){return e.readUint8Array(t,n)}var wJe="File already exists",IJe="Zip file comment exceeds 64KB",PJe="File entry comment exceeds 64KB",OJe="File entry name exceeds 64KB",Bhe="Version exceeds 65535",RJe="The strength must equal 1, 2, or 3",BJe="Extra field type exceeds 65535",MJe="Extra field data exceeds 64KB",L7="Zip64 is not supported",Mhe=new Uint8Array([7,0,2,0,65,69,3,0,0]),Lhe=24,B7=0,sz=class{constructor(t,n={}){Object.assign(this,{writer:t,options:n,config:Ok(),files:new Map,offset:t.size,pendingCompressedSize:0,pendingEntries:[],pendingAddFileCalls:new Set})}async add(t="",n,i={}){let o=this;if(B7<o.config.maxWorkers){B7++;let r;try{return r=LJe(o,t,n,i),this.pendingAddFileCalls.add(r),await r}finally{this.pendingAddFileCalls.delete(r),B7--;let s=o.pendingEntries.shift();s&&o.add(s.name,s.reader,s.options).then(s.resolve).catch(s.reject)}}else return new Promise((r,s)=>o.pendingEntries.push({name:t,reader:n,options:i,resolve:r,reject:s}))}async close(t=new Uint8Array(0),n={}){for(;this.pendingAddFileCalls.size;)await Promise.all(Array.from(this.pendingAddFileCalls));return await VJe(this,t,n),this.writer.getData()}};async function LJe(e,t,n,i){if(t=t.trim(),i.directory&&!t.endsWith(Eb)?t+=Eb:i.directory=t.endsWith(Eb),e.files.has(t))throw new Error(wJe);let o=_M(t);if(o.length>65535)throw new Error(OJe);let r=i.comment||"",s=_M(r);if(s.length>65535)throw new Error(PJe);let a=e.options.version||i.version||0;if(a>65535)throw new Error(Bhe);let c=e.options.versionMadeBy||i.versionMadeBy||20;if(c>65535)throw new Error(Bhe);let l=_a(e,i,"lastModDate")||new Date,f=_a(e,i,"lastAccessDate"),d=_a(e,i,"creationDate"),p=_a(e,i,"password"),g=_a(e,i,"encryptionStrength")||3,m=_a(e,i,"zipCrypto");if(p!==void 0&&g!==void 0&&(g<1||g>3))throw new Error(RJe);let A=new Uint8Array(0),x=i.extraField;if(x){let F=0,k=0;x.forEach(U=>F+=4+U.length),A=new Uint8Array(F),x.forEach((U,G)=>{if(G>65535)throw new Error(BJe);if(U.length>65535)throw new Error(MJe);Zs(A,new Uint16Array([G]),k),Zs(A,new Uint16Array([U.length]),k+2),Zs(A,U,k+4),k+=4+U.length})}let C=_a(e,i,"extendedTimestamp");C===void 0&&(C=!0);let T=0,E=_a(e,i,"keepOrder");E===void 0&&(E=!0);let S=0,D=_a(e,i,"msDosCompatible");D===void 0&&(D=!0);let w=_a(e,i,"internalFileAttribute")||0,R=_a(e,i,"externalFileAttribute")||0;n&&(n.initialized||await n.init(),S=n.size,T=kJe(S));let O=i.zip64||e.options.zip64||!1;if(e.offset+e.pendingCompressedSize>=4294967295||S>=4294967295||T>=4294967295){if(i.zip64===!1||e.options.zip64===!1||!E)throw new Error(L7);O=!0}e.pendingCompressedSize+=T,await Promise.resolve();let L=_a(e,i,"level"),N=_a(e,i,"useWebWorkers"),_=_a(e,i,"bufferedWrite"),b=_a(e,i,"dataDescriptor"),v=_a(e,i,"dataDescriptorSignature"),I=_a(e,i,"signal");b===void 0&&(b=!0),b&&v===void 0&&(v=!1);let B=await NJe(e,t,n,Object.assign({},i,{rawFilename:o,rawComment:s,version:a,versionMadeBy:c,lastModDate:l,lastAccessDate:f,creationDate:d,rawExtraField:A,zip64:O,password:p,level:L,useWebWorkers:N,encryptionStrength:g,extendedTimestamp:C,zipCrypto:m,bufferedWrite:_,keepOrder:E,dataDescriptor:b,dataDescriptorSignature:v,signal:I,msDosCompatible:D,internalFileAttribute:w,externalFileAttribute:R}));return T&&(e.pendingCompressedSize-=T),Object.assign(B,{name:t,comment:r,extraField:x}),new m_(B)}async function NJe(e,t,n,i){let o=e.files,r=e.writer,s=Array.from(o.values()).pop(),a={},c,l,f;o.set(t,a);try{let d,p,g;if(i.keepOrder&&(d=s&&s.lock),a.lock=g=new Promise(m=>f=m),i.bufferedWrite||e.lockWrite||!i.dataDescriptor?(p=new Tb,p.init(),c=!0):(e.lockWrite=new Promise(m=>l=m),r.initialized||await r.init(),p=r),a=await FJe(n,p,e.config,i),a.lock=g,o.set(t,a),a.filename=t,c){let m=0,A=p.getData();await Promise.all([e.lockWrite,d]);let x;do x=Array.from(o.values()).find(C=>C.writingBufferedData),x&&await x.lock;while(x&&x.lock);if(a.writingBufferedData=!0,!i.dataDescriptor){let T=await Nhe(A,0,26),E=new DataView(T);(!a.encrypted||i.zipCrypto)&&fo(E,14,a.signature),a.zip64?(fo(E,18,4294967295),fo(E,22,4294967295)):(fo(E,18,a.compressedSize),fo(E,22,a.uncompressedSize)),await r.writeUint8Array(new Uint8Array(T)),m=26}await UJe(r,A,m),delete a.writingBufferedData}if(a.offset=e.offset,a.zip64){let m=zd(a.rawExtraFieldZip64);bl(m,20,BigInt(a.offset))}else if(a.offset>=4294967295)throw new Error(L7);return e.offset+=a.length,a}catch(d){throw(c&&a.writingBufferedData||!c&&a.dataWritten)&&(d.corruptedEntry=e.hasCorruptedEntries=!0,a.uncompressedSize&&(e.offset+=a.uncompressedSize)),o.delete(t),d}finally{f(),l&&l()}}async function FJe(e,t,n,i){let{rawFilename:o,lastAccessDate:r,creationDate:s,password:a,level:c,zip64:l,zipCrypto:f,dataDescriptor:d,dataDescriptorSignature:p,directory:g,version:m,versionMadeBy:A,rawComment:x,rawExtraField:C,useWebWorkers:T,onprogress:E,signal:S,encryptionStrength:D,extendedTimestamp:w,msDosCompatible:R,internalFileAttribute:O,externalFileAttribute:L}=i,N=Boolean(a&&a.length),_=c!==0&&!g,b;if(N&&!f){b=new Uint8Array(Mhe.length+2);let Ve=zd(b);Ko(Ve,0,39169),Zs(b,Mhe,2),az(Ve,8,D)}else b=new Uint8Array(0);let v,I;if(w){I=new Uint8Array(9+(r?4:0)+(s?4:0));let Ve=zd(I);Ko(Ve,0,21589),Ko(Ve,2,I.length-4);let qe=1+(r?2:0)+(s?4:0);az(Ve,4,qe),fo(Ve,5,Math.floor(i.lastModDate.getTime()/1e3)),r&&fo(Ve,9,Math.floor(r.getTime()/1e3)),s&&fo(Ve,13,Math.floor(s.getTime()/1e3));try{v=new Uint8Array(36);let mt=zd(v),Ht=M7(i.lastModDate);Ko(mt,0,10),Ko(mt,2,32),Ko(mt,8,1),Ko(mt,10,24),bl(mt,12,Ht),bl(mt,20,M7(r)||Ht),bl(mt,28,M7(s)||Ht)}catch{v=new Uint8Array(0)}}else v=I=new Uint8Array(0);let B={version:m||20,versionMadeBy:A,zip64:l,directory:Boolean(g),filenameUTF8:!0,rawFilename:o,commentUTF8:!0,rawComment:x,rawExtraFieldZip64:l?new Uint8Array(Lhe+4):new Uint8Array(0),rawExtraFieldExtendedTimestamp:I,rawExtraFieldNTFS:v,rawExtraFieldAES:b,rawExtraField:C,extendedTimestamp:w,msDosCompatible:R,internalFileAttribute:O,externalFileAttribute:L},F=B.uncompressedSize=0,k=2048;d&&(k=k|8);let U=0;_&&(U=8),l&&(B.version=B.version>45?B.version:45),N&&(k=k|1,f||(B.version=B.version>51?B.version:51,U=99,_&&(B.rawExtraFieldAES[9]=8))),B.compressionMethod=U;let G=B.headerArray=new Uint8Array(26),V=zd(G);Ko(V,0,B.version),Ko(V,2,k),Ko(V,4,U);let X=new Uint32Array(1),j=zd(X),Q;i.lastModDate<y7?Q=y7:i.lastModDate>g7?Q=g7:Q=i.lastModDate,Ko(j,0,(Q.getHours()<<6|Q.getMinutes())<<5|Q.getSeconds()/2),Ko(j,2,(Q.getFullYear()-1980<<4|Q.getMonth()+1)<<5|Q.getDate());let W=X[0];fo(V,6,W),Ko(V,22,o.length);let K=b.length+I.length+v.length+B.rawExtraField.length;Ko(V,24,K);let J=new Uint8Array(30+o.length+K),_e=zd(J);fo(_e,0,67324752),Zs(J,G,4),Zs(J,o,30),Zs(J,b,30+o.length),Zs(J,I,30+o.length+b.length),Zs(J,v,30+o.length+b.length+I.length),Zs(J,B.rawExtraField,30+o.length+b.length+I.length+v.length);let xe,re=0;if(e){let Ve=await zk(n.Deflate,{codecType:Vk,level:c,password:a,encryptionStrength:D,zipCrypto:N&&f,passwordVerification:N&&f&&W>>8&255,signed:!0,compressed:_,encrypted:N,useWebWorkers:T},n);await t.writeUint8Array(J),B.dataWritten=!0,xe=await Hk(Ve,e,t,0,()=>e.size,n,{onprogress:E,signal:S}),F=B.uncompressedSize=e.size,re=xe.length}else await t.writeUint8Array(J),B.dataWritten=!0;let ye=new Uint8Array(0),fe,Se=0;if(d&&(ye=new Uint8Array(l?p?24:20:p?16:12),fe=zd(ye),p&&(Se=4,fo(fe,0,134695760))),e){let Ve=xe.signature;if((!N||f)&&Ve!==void 0&&(fo(V,10,Ve),B.signature=Ve,d&&fo(fe,Se,Ve)),l){let qe=zd(B.rawExtraFieldZip64);Ko(qe,0,1),Ko(qe,2,Lhe),fo(V,14,4294967295),bl(qe,12,BigInt(re)),fo(V,18,4294967295),bl(qe,4,BigInt(F)),d&&(bl(fe,Se+4,BigInt(re)),bl(fe,Se+12,BigInt(F)))}else fo(V,14,re),fo(V,18,F),d&&(fo(fe,Se+4,re),fo(fe,Se+8,F))}d&&await t.writeUint8Array(ye);let we=J.length+re+ye.length;return Object.assign(B,{compressedSize:re,lastModDate:Q,rawLastModDate:W,creationDate:s,lastAccessDate:r,encrypted:N,length:we}),B}async function VJe(e,t,n){let i=e.writer,o=e.files,r=0,s=0,a=e.offset,c=o.size;for(let[,p]of o)s+=46+p.rawFilename.length+p.rawComment.length+p.rawExtraFieldZip64.length+p.rawExtraFieldAES.length+p.rawExtraFieldExtendedTimestamp.length+p.rawExtraFieldNTFS.length+p.rawExtraField.length;let l=n.zip64||e.options.zip64||!1;if(a>=4294967295||s>=4294967295||c>=65535){if(n.zip64===!1||e.options.zip64===!1)throw new Error(L7);l=!0}let f=new Uint8Array(s+(l?98:22)),d=zd(f);if(t&&t.length)if(t.length<=65535)Ko(d,r+20,t.length);else throw new Error(IJe);for(let[p,g]of Array.from(o.values()).entries()){let{rawFilename:m,rawExtraFieldZip64:A,rawExtraFieldAES:x,rawExtraField:C,rawComment:T,versionMadeBy:E,headerArray:S,directory:D,zip64:w,msDosCompatible:R,internalFileAttribute:O,externalFileAttribute:L}=g,N,_;if(g.extendedTimestamp){_=g.rawExtraFieldNTFS,N=new Uint8Array(9);let v=zd(N);Ko(v,0,21589),Ko(v,2,N.length-4),az(v,4,1),fo(v,5,Math.floor(g.lastModDate.getTime()/1e3))}else _=N=new Uint8Array(0);let b=A.length+x.length+N.length+_.length+C.length;if(fo(d,r,33639248),Ko(d,r+4,E),Zs(f,S,r+6),Ko(d,r+30,b),Ko(d,r+32,T.length),fo(d,r+34,O),L?fo(d,r+38,L):D&&R&&az(d,r+38,16),w?fo(d,r+42,4294967295):fo(d,r+42,g.offset),Zs(f,m,r+46),Zs(f,A,r+46+m.length),Zs(f,x,r+46+m.length+A.length),Zs(f,N,r+46+m.length+A.length+x.length),Zs(f,_,r+46+m.length+A.length+x.length+N.length),Zs(f,C,r+46+m.length+A.length+x.length+N.length+_.length),Zs(f,T,r+46+m.length+b),r+=46+m.length+b+T.length,n.onprogress)try{n.onprogress(p+1,o.size,new m_(g))}catch{}}l&&(fo(d,r,101075792),bl(d,r+4,BigInt(44)),Ko(d,r+12,45),Ko(d,r+14,45),bl(d,r+24,BigInt(c)),bl(d,r+32,BigInt(c)),bl(d,r+40,BigInt(s)),bl(d,r+48,BigInt(a)),fo(d,r+56,117853008),bl(d,r+64,BigInt(a)+BigInt(s)),fo(d,r+72,1),c=65535,a=4294967295,s=4294967295,r+=76),fo(d,r,101010256),Ko(d,r+8,c),Ko(d,r+10,c),fo(d,r+12,s),fo(d,r+16,a),await i.writeUint8Array(f),t&&t.length&&await i.writeUint8Array(t)}function Nhe(e,t,n){if(e.arrayBuffer)return t||n?e.slice(t,n).arrayBuffer():e.arrayBuffer();{let i=new FileReader;return new Promise((o,r)=>{i.onload=s=>o(s.target.result),i.onerror=()=>r(i.error),i.readAsArrayBuffer(t||n?e.slice(t,n):e)})}}async function UJe(e,t,n=0){await o();async function o(){if(n<t.size){let r=await Nhe(t,n,n+536870912);await e.writeUint8Array(new Uint8Array(r)),n+=536870912,await o()}}}function M7(e){if(e)return(BigInt(e.getTime())+BigInt(116444736e5))*BigInt(1e4)}function _a(e,t,n){return t[n]===void 0?e.options[n]:t[n]}function kJe(e){return e+5*(Math.floor(e/16383)+1)}function az(e,t,n){e.setUint8(t,n)}function Ko(e,t,n){e.setUint16(t,n,!0)}function fo(e,t,n){e.setUint32(t,n,!0)}function bl(e,t,n){e.setBigUint64(t,n,!0)}function Zs(e,t,n){e.set(t,n)}function zd(e){return new DataView(e.buffer)}gb({Deflate:wde,Inflate:Zde});function zJe(e){return typeof e=="string"&&(e=document.getElementById(e)),e}var In=zJe;function HJe(e,t){this.position=e,this.headingPitchRange=t}var CM=HJe;function cz(e,t){this.id=t,this.name=e,this.playlistIndex=0,this.playlist=[],this.tourStart=new Ae,this.tourEnd=new Ae,this.entryStart=new Ae,this.entryEnd=new Ae,this._activeEntries=[]}cz.prototype.addPlaylistEntry=function(e){this.playlist.push(e)};cz.prototype.play=function(e,t){u(e.cesiumWidget)&&nr("viewer","The viewer parameter has been deprecated in Cesium 1.99. It will be removed in 1.100. Instead of a Viewer, pass a CesiumWidget instead."),this.tourStart.raiseEvent();let n=this;Uhe.call(this,e,t,function(i){n.playlistIndex=0,i||Vhe(n._activeEntries),n.tourEnd.raiseEvent(i)})};cz.prototype.stop=function(){Vhe(this._activeEntries)};function Vhe(e){for(let t=e.pop();t!==void 0;t=e.pop())t.stop()}function Uhe(e,t,n){let i=this.playlist[this.playlistIndex];if(i){let o=GJe.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 u(n)&&n(!1)}function GJe(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++,Uhe.call(this,e,t,n)}}var TM=cz;var Ni={Linear:{None:function(e){return e}},Quadratic:{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:{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:{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:{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:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.cos(Math.PI*e))}},Exponential:{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:{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:{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:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--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:{In:function(e){return 1-Ni.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?Ni.Bounce.In(e*2)*.5:Ni.Bounce.Out(e*2-1)*.5+.5}}},EM;typeof self>"u"&&typeof process<"u"&&process.hrtime?EM=function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?EM=self.performance.now.bind(self.performance):Date.now!==void 0?EM=Date.now:EM=function(){return new Date().getTime()};var Db=EM,WJe=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}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(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},e.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},e.prototype.update=function(t,n){t===void 0&&(t=Db()),n===void 0&&(n=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;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&&delete this._tweens[i[o]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),bM={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=bM.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=bM.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=bM.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=bM.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,c=o*a;return(2*t-2*n+r+s)*c+(-3*t+3*n-2*r-s)*a+r*o+t}}},khe=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),zhe=new WJe,Hhe=function(){function e(t,n){n===void 0&&(n=zhe),this._object=t,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ni.Linear.None,this._interpolationFunction=bM.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=khe.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(t,n){return this._valuesEnd=Object.create(t),n!==void 0&&(this._duration=n),this},e.prototype.duration=function(t){return this._duration=t,this},e.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t!==void 0?typeof t=="string"?Db()+parseFloat(t):t:Db(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(t,n,i,o){for(var r in i){var s=t[r],a=Array.isArray(s),c=a?"array":typeof s,l=!a&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(l){var f=i[r];if(f.length===0)continue;f=f.map(this._handleRelativeValue.bind(this,s)),i[r]=[s].concat(f)}if((c==="object"||a)&&s&&!l){n[r]=a?[]:{};for(var d in s)n[r][d]=s[d];o[r]=a?[]:{},this._setupProperties(s,n[r],i[r],o[r])}else typeof n[r]>"u"&&(n[r]=s),a||(n[r]*=1),l?o[r]=i[r].slice().reverse():o[r]=n[r]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(t){return t===void 0&&(t=Db()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},e.prototype.resume=function(t){return t===void 0&&(t=Db()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),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 this._group=t,this},e.prototype.delay=function(t){return this._delayTime=t,this},e.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return this._yoyo=t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return 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.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){if(t===void 0&&(t=Db()),n===void 0&&(n=!0),this._isPaused)return!0;var i,o,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;n&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),o=(t-this._startTime)/this._duration,o=this._duration===0||o>1?1:o;var s=this._easingFunction(o);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,o),o===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,c=this._chainedTweens.length;a<c;a++)this._chainedTweens[a].start(this._startTime+this._duration);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],c=Array.isArray(t[r]),l=Array.isArray(a),f=!c&&l;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}();var eWn=khe.nextId,rm=zhe,tWn=rm.getAll.bind(rm),nWn=rm.removeAll.bind(rm),iWn=rm.add.bind(rm),oWn=rm.remove.bind(rm),rWn=rm.update.bind(rm);var jJe={LINEAR_NONE:Ni.Linear.None,QUADRATIC_IN:Ni.Quadratic.In,QUADRATIC_OUT:Ni.Quadratic.Out,QUADRATIC_IN_OUT:Ni.Quadratic.InOut,CUBIC_IN:Ni.Cubic.In,CUBIC_OUT:Ni.Cubic.Out,CUBIC_IN_OUT:Ni.Cubic.InOut,QUARTIC_IN:Ni.Quartic.In,QUARTIC_OUT:Ni.Quartic.Out,QUARTIC_IN_OUT:Ni.Quartic.InOut,QUINTIC_IN:Ni.Quintic.In,QUINTIC_OUT:Ni.Quintic.Out,QUINTIC_IN_OUT:Ni.Quintic.InOut,SINUSOIDAL_IN:Ni.Sinusoidal.In,SINUSOIDAL_OUT:Ni.Sinusoidal.Out,SINUSOIDAL_IN_OUT:Ni.Sinusoidal.InOut,EXPONENTIAL_IN:Ni.Exponential.In,EXPONENTIAL_OUT:Ni.Exponential.Out,EXPONENTIAL_IN_OUT:Ni.Exponential.InOut,CIRCULAR_IN:Ni.Circular.In,CIRCULAR_OUT:Ni.Circular.Out,CIRCULAR_IN_OUT:Ni.Circular.InOut,ELASTIC_IN:Ni.Elastic.In,ELASTIC_OUT:Ni.Elastic.Out,ELASTIC_IN_OUT:Ni.Elastic.InOut,BACK_IN:Ni.Back.In,BACK_OUT:Ni.Back.Out,BACK_IN_OUT:Ni.Back.InOut,BOUNCE_IN:Ni.Bounce.In,BOUNCE_OUT:Ni.Bounce.Out,BOUNCE_IN_OUT:Ni.Bounce.InOut},Mr=Object.freeze(jJe);function lz(e,t,n){this.type="KmlTourFlyTo",this.blocking=!0,this.activeCamera=null,this.activeCallback=null,this.duration=e,this.view=n,this.flyToMode=t}lz.prototype.play=function(e,t,n){if(this.activeCamera=t,u(e)&&e!==null){let o=this;this.activeCallback=function(r){delete o.activeCallback,delete o.activeCamera,e(u(r)?!1:r)}}let i=this.getCameraOptions(n);if(this.view.headingPitchRoll)t.flyTo(i);else if(this.view.headingPitchRange){let o=new se(this.view.position);t.flyToBoundingSphere(o,i)}};lz.prototype.stop=function(){u(this.activeCamera)&&this.activeCamera.cancelFlight(),u(this.activeCallback)&&this.activeCallback(!0)};lz.prototype.getCameraOptions=function(e){let t={duration:this.duration};return u(this.activeCallback)&&(t.complete=this.activeCallback),this.flyToMode==="smooth"&&(t.easingFunction=Mr.LINEAR_NONE),this.view.headingPitchRoll?(t.destination=this.view.position,t.orientation=this.view.headingPitchRoll):this.view.headingPitchRange&&(t.offset=this.view.headingPitchRange),u(e)&&(t=_t(t,e)),t};var SM=lz;function N7(e){this.type="KmlTourWait",this.blocking=!0,this.duration=e,this.timeout=null}N7.prototype.play=function(e){let t=this;this.activeCallback=e,this.timeout=setTimeout(function(){delete t.activeCallback,e(!1)},this.duration*1e3)};N7.prototype.stop=function(){clearTimeout(this.timeout),u(this.activeCallback)&&this.activeCallback(!0)};var DM=N7;var Qhe={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=f0(t),Qhe[t]}},G7;typeof DOMParser<"u"&&(G7=new DOMParser);var YJe=new gk({stripPrefix:!1,email:!1,replaceFn:function(e){return e.urlMatchType==="scheme"||e.urlMatchType==="www"}}),Sy=32,Ghe=2414016,Whe=1,jhe=16093e3,Yhe=.1,qhe=[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"],Xhe=["http://www.google.com/kml/ext/2.2"],qJe=["http://www.w3.org/2005/Atom"],Re={kml:qhe,gx:Xhe,atom:qJe,kmlgx:qhe.concat(Xhe)},W7={Document:cme,Folder:dQe,Placemark:hQe,NetworkLink:TQe,GroundOverlay:AQe,PhotoOverlay:fme,ScreenOverlay:yQe,Tour:pQe};function sm(e){this._dataSource=e,this._deferred=Jr(),this._stack=[],this._promises=[],this._timeoutSet=!1,this._used=!1,this._started=0,this._timeThreshold=1e3}Object.defineProperties(sm.prototype,{dataSource:{get:function(){return this._dataSource}}});sm.prototype.addNodes=function(e,t){this._stack.push({nodes:e,index:0,processingData:t}),this._used=!0};sm.prototype.addPromise=function(e){this._promises.push(e)};sm.prototype.wait=function(){let e=this._deferred;return this._used||e.resolve(),Promise.all([e.promise,Promise.all(this._promises)])};sm.prototype.process=function(){let e=this._stack.length===1;return e&&(this._started=Au._getTimestamp()),this._process(e)};sm.prototype._giveUpTime=function(){if(this._timeoutSet)return;this._timeoutSet=!0,this._timeThreshold=50;let e=this;setTimeout(function(){e._timeoutSet=!1,e._started=Au._getTimestamp(),e._process(!0)},0)};sm.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]};sm.prototype._pop=function(){let e=this._stack;return e.pop(),e.length===0?(this._deferred.resolve(),!1):!0};sm.prototype._process=function(e){let t=this.dataSource,n=this._stack[this._stack.length-1].processingData,i=this._nextNode();for(;u(i);){let o=W7[i.localName];if(u(o)&&(Re.kml.indexOf(i.namespaceURI)!==-1||Re.gx.indexOf(i.namespaceURI)!==-1)&&(o(t,i,n,this),this._timeoutSet||Au._getTimestamp()>this._started+this._timeThreshold)){this._giveUpTime();return}i=this._nextNode()}this._pop()&&e&&this._process(!0)};function XJe(e){let t=e.slice(0,Math.min(4,e.size)),n=Jr(),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 KJe(e){let t=Jr(),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 $he(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&&(u(n)||(n=e.substr(0,e.indexOf("<kml")+4),i=e.substr(n.length)),n+=` ${r}"${t[s]}"`));return u(n)&&(e=n+i),e}function eme(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 ZJe(e,t){return Promise.resolve(e.getData(new Yk)).then(function(n){n=$he(n),n=eme(n),t.kml=G7.parseFromString(n,"application/xml")})}function F7(e,t){let n=y(Qhe.detectFromFilename(e.filename),"application/octet-stream");return Promise.resolve(e.getData(new qk(n))).then(function(i){t[e.filename]=i})}function gu(e,t,n,i){let o=i.keys,r=new vM.default("."),s=e.querySelectorAll(t);for(let a=0;a<s.length;a++){let c=s[a],l=c.getAttribute(n);if(u(l)){let d=new vM.default(l).absoluteTo(r).toString(),p=o.indexOf(d);if(p!==-1){let g=o[p];c.setAttribute(n,i[g]),t==="a"&&c.getAttribute("download")===null&&c.setAttribute("download",g)}}}}function yu(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),c=j7(a,i);u(c)&&s.setAttribute(n,c.url)}}function tme(e,t,n){let i=fs(e,"id");i=u(i)&&i.length!==0?i:zn(),u(n)&&(i=n+i);let o=t.getById(i);return u(o)&&(i=zn(),u(n)&&(i=n+i)),o=t.add(new jo({id:i})),u(o.kml)||(o.addProperty("kml"),o.kml=new DQe),o}function wM(e,t){return e==="absolute"||e==="relativeToGround"||t==="relativeToSeaFloor"}function hz(e,t){if(!u(e))return h.fromDegrees(0,0,0,t);let n=e.match(/[^\s,\n]+/g);if(!u(n))return h.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,h.fromDegrees(i,o,r,t)}function uz(e,t){if(!u(e))return;let n=e.textContent.match(/[^\s\n]+/g);if(!u(n))return;let i=n.length,o=new Array(i),r=0;for(let s=0;s<i;s++)o[r++]=hz(n[s],t);return o}function Dy(e,t){if(!u(e))return;let n=e.getAttribute(t);if(n!==null){let i=parseFloat(n);return isNaN(i)?void 0:i}}function fs(e,t){if(!u(e))return;let n=e.getAttribute(t);return n!==null?n:void 0}function wi(e,t,n){if(!u(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 Khe(e,t,n){if(!u(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 Hd(e,t,n){if(!u(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 ni(e,t,n){let i=wi(e,t,n);if(u(i)){let o=parseFloat(i.textContent);return isNaN(o)?void 0:o}}function Pn(e,t,n){let i=wi(e,t,n);if(u(i))return i.textContent.trim()}function Gd(e,t,n){let i=wi(e,t,n);if(u(i)){let o=i.textContent.trim();return o==="1"||/^true$/i.test(o)}}function j7(e,t,n){if(!u(e))return;let i;if(u(n)){e=e.replace(/\\/g,"/");let o=n[e];if(u(o))i=new Oe({url:o});else{let r=new vM.default(t.getUrlComponent()),s=new vM.default(e);o=n[s.absoluteTo(r)],u(o)&&(i=new Oe({url:o}))}}return u(i)||(i=t.getDerivedResource({url:e})),i}var Sl={maximumRed:void 0,red:void 0,maximumGreen:void 0,green:void 0,maximumBlue:void 0,blue:void 0};function z7(e,t){if(!u(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?(Sl.maximumRed=r,Sl.red=void 0):(Sl.maximumRed=void 0,Sl.red=0),o>0?(Sl.maximumGreen=o,Sl.green=void 0):(Sl.maximumGreen=void 0,Sl.green=0),i>0?(Sl.maximumBlue=i,Sl.blue=void 0):(Sl.maximumBlue=void 0,Sl.blue=0),Sl.alpha=n,z.fromRandom(Sl)):new z(r,o,i,n)}function wx(e,t,n){let i=Pn(e,t,n);if(u(i))return z7(i,Pn(e,"colorMode",n)==="random")}function JJe(e){let t=wi(e,"TimeStamp",Re.kmlgx),n=Pn(t,"when",Re.kmlgx);if(!u(t)||!u(n)||n.length===0)return;let i=$.fromIso8601(n),o=new Pr;return o.addInterval(new An({start:i,stop:ze.MAXIMUM_VALUE})),o}function QJe(e){let t=wi(e,"TimeSpan",Re.kmlgx);if(!u(t))return;let n,i=wi(t,"begin",Re.kmlgx),o=u(i)?$.fromIso8601(i.textContent):void 0,r=wi(t,"end",Re.kmlgx),s=u(r)?$.fromIso8601(r.textContent):void 0;if(u(o)&&u(s)){if($.lessThan(s,o)){let a=o;o=s,s=a}n=new Pr,n.addInterval(new An({start:o,stop:s}))}else u(o)?(n=new Pr,n.addInterval(new An({start:o,stop:ze.MAXIMUM_VALUE}))):u(s)&&(n=new Pr,n.addInterval(new An({start:ze.MINIMUM_VALUE,stop:s})));return n}function nme(){let e=new Na;return e.width=Sy,e.height=Sy,e.scaleByDistance=new Pt(Ghe,Whe,jhe,Yhe),e.pixelOffsetScaleByDistance=new Pt(Ghe,Whe,jhe,Yhe),e}function Y7(){let e=new ed;return e.outline=!0,e.outlineColor=z.WHITE,e}function ime(){let e=new $f;return e.translucencyByDistance=new Pt(3e6,1,5e6,0),e.pixelOffset=new H(17,0),e.horizontalOrigin=_i.LEFT,e.font="16px sans-serif",e.style=No.FILL_AND_OUTLINE,e}function q7(e,t,n,i,o){let r=Pn(e,"href",Re.kml);if(!u(r)||r.length===0)return;if(r.indexOf("root://icons/palette-")===0){let a=r.charAt(21),c=y(ni(e,"x",Re.gx),0),l=y(ni(e,"y",Re.gx),0);c=Math.min(c/32,7),l=7-Math.min(l/32,7);let f=8*l+c;r=`https://maps.google.com/mapfiles/kml/pal${a}/icon${f}.png`}let s=j7(r,n,i);if(o){let a=Pn(e,"refreshMode",Re.kml),c=Pn(e,"viewRefreshMode",Re.kml);a==="onInterval"||a==="onExpire"?wt(`kml-refreshMode-${a}`,`KML - Unsupported Icon refreshMode: ${a}`):(c==="onStop"||c==="onRegion")&&wt(`kml-refreshMode-${c}`,`KML - Unsupported Icon viewRefreshMode: ${c}`);let l=y(Pn(e,"viewBoundScale",Re.kml),1),f=c==="onStop"?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",d=y(Pn(e,"viewFormat",Re.kml),f),p=Pn(e,"httpQuery",Re.kml);u(d)&&s.setQueryParameters(Nl(dz(d))),u(p)&&s.setQueryParameters(Nl(dz(p)));let g=t._ellipsoid;return K7(s,t.camera,t.canvas,l,t._lastCameraView.bbox,g),s}return s}function $Je(e,t,n,i,o){let r=ni(t,"scale",Re.kml),s=ni(t,"heading",Re.kml),a=wx(t,"color",Re.kml),c=wi(t,"Icon",Re.kml),l=q7(c,e,i,o,!1);u(c)&&!u(l)&&(l=!1);let f=ni(c,"x",Re.gx),d=ni(c,"y",Re.gx),p=ni(c,"w",Re.gx),g=ni(c,"h",Re.gx),m=wi(t,"hotSpot",Re.kml),A=Dy(m,"x"),x=Dy(m,"y"),C=fs(m,"xunits"),T=fs(m,"yunits"),E=n.billboard;u(E)||(E=nme(),n.billboard=E),E.image=l,E.scale=r,E.color=a,(u(f)||u(d)||u(p)||u(g))&&(E.imageSubRegion=new Ye(f,d,p,g)),u(s)&&s!==0&&(E.rotation=P.toRadians(-s),E.alignedAxis=h.UNIT_Z),r=y(r,1);let S,D;u(A)&&(C==="pixels"?S=-A*r:C==="insetPixels"?S=(A-Sy)*r:C==="fraction"&&(S=-A*Sy*r),S+=Sy*.5*r),u(x)&&(T==="pixels"?D=x*r:T==="insetPixels"?D=(-x+Sy)*r:T==="fraction"&&(D=x*Sy*r),D-=Sy*.5*r),(u(S)||u(D))&&(E.pixelOffset=new H(S,D))}function fz(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")$Je(e,a,n,i,o);else if(a.localName==="LabelStyle"){let c=n.label;u(c)||(c=ime(),n.label=c),c.scale=y(ni(a,"scale",Re.kml),c.scale),c.fillColor=y(wx(a,"color",Re.kml),c.fillColor),c.text=n.name}else if(a.localName==="LineStyle"){let c=n.polyline;u(c)||(c=new Ua,n.polyline=c),c.width=ni(a,"width",Re.kml),c.material=wx(a,"color",Re.kml),u(wx(a,"outerColor",Re.gx))&&wt("kml-gx:outerColor","KML - gx:outerColor is not supported in a LineStyle"),u(ni(a,"outerWidth",Re.gx))&&wt("kml-gx:outerWidth","KML - gx:outerWidth is not supported in a LineStyle"),u(ni(a,"physicalWidth",Re.gx))&&wt("kml-gx:physicalWidth","KML - gx:physicalWidth is not supported in a LineStyle"),u(Gd(a,"labelVisibility",Re.gx))&&wt("kml-gx:labelVisibility","KML - gx:labelVisibility is not supported in a LineStyle")}else if(a.localName==="PolyStyle"){let c=n.polygon;u(c)||(c=Y7(),n.polygon=c),c.material=y(wx(a,"color",Re.kml),c.material),c.fill=y(Gd(a,"fill",Re.kml),c.fill),c.outline=y(Gd(a,"outline",Re.kml),c.outline)}else if(a.localName==="BalloonStyle"){let c=y(z7(Pn(a,"bgColor",Re.kml)),z.WHITE),l=y(z7(Pn(a,"textColor",Re.kml)),z.BLACK),f=Pn(a,"text",Re.kml);n.addProperty("balloonStyle"),n.balloonStyle={bgColor:c,textColor:l,text:f}}else if(a.localName==="ListStyle"){let c=Pn(a,"listItemType",Re.kml);(c==="radioFolder"||c==="checkOffOnly")&&wt(`kml-listStyle-${c}`,`KML - Unsupported ListStyle with listItemType: ${c}`)}}}function eQe(e,t,n,i,o){let r=new jo,s,a=-1,c=t.childNodes,l=c.length;for(let d=0;d<l;d++){let p=c[d];(p.localName==="Style"||p.localName==="StyleMap")&&(a=d)}if(a!==-1){let d=c[a];if(d.localName==="Style")fz(e,d,r,i,o);else{let p=Hd(d,"Pair",Re.kml);for(let g=0;g<p.length;g++){let m=p[g],A=Pn(m,"key",Re.kml);if(A==="normal"){let x=Pn(m,"styleUrl",Re.kml);if(u(x))s=n.getById(x),u(s)||(s=n.getById(`#${x}`)),u(s)&&r.merge(s);else{let C=wi(m,"Style",Re.kml);fz(e,C,r,i,o)}}else wt(`kml-styleMap-${A}`,`KML - Unsupported StyleMap key: ${A}`)}}}let f=Pn(t,"styleUrl",Re.kml);if(u(f)){let d=f;if(f[0]!=="#"&&f.indexOf("#")!==-1){let p=f.split("#"),g=p[0];d=`${i.getDerivedResource({url:g}).getUrlComponent()}#${p[1]}`}s=n.getById(d),u(s)||(s=n.getById(`#${d}`)),u(s)&&r.merge(s)}return r}function tQe(e,t,n){return t.fetchXML().then(function(i){return ome(e,i,n,t,!0)})}function ome(e,t,n,i,o,r){let s,a,c,l,f=Khe(t,"Style",Re.kml);if(u(f)){let A=f.length;for(s=0;s<A;s++)l=f[s],a=fs(l,"id"),u(a)&&(a=`#${a}`,o&&u(i)&&(a=i.getUrlComponent()+a),u(n.getById(a))||(c=new jo({id:a}),n.add(c),fz(e,l,c,i,r)))}let d=Khe(t,"StyleMap",Re.kml);if(u(d)){let A=d.length;for(s=0;s<A;s++){let x=d[s];if(a=fs(x,"id"),u(a)){let C=Hd(x,"Pair",Re.kml);for(let T=0;T<C.length;T++){let E=C[T],S=Pn(E,"key",Re.kml);if(S==="normal"){if(a=`#${a}`,o&&u(i)&&(a=i.getUrlComponent()+a),!u(n.getById(a))){c=n.getOrCreateEntity(a);let D=Pn(E,"styleUrl",Re.kml);if(u(D)){D[0]!=="#"&&(D=`#${D}`),o&&u(i)&&(D=i.getUrlComponent()+D);let w=n.getById(D);u(w)&&c.merge(w)}else l=wi(E,"Style",Re.kml),fz(e,l,c,i,r)}}else wt(`kml-styleMap-${S}`,`KML - Unsupported StyleMap key: ${S}`)}}}}let p=[],g=t.getElementsByTagName("styleUrl"),m=g.length;for(s=0;s<m;s++){let A=g[s].textContent;if(A[0]!=="#"){let x=A.split("#");if(x.length===2){let C=x[0],T=i.getDerivedResource({url:C});p.push(tQe(e,T,n))}}}return p}function X7(e,t,n){let i=new i_(e,t.id,["position"]),o=new Qh(t.position);t.polyline=u(n.polyline)?n.polyline.clone():new Ua,t.polyline.positions=new n_([i,o])}function rme(e,t){return!u(e)&&!u(t)||e==="clampToGround"?We.CLAMP_TO_GROUND:e==="relativeToGround"?We.RELATIVE_TO_GROUND:e==="absolute"?We.NONE:t==="clampToSeaFloor"?(wt("kml-gx:altitudeMode-clampToSeaFloor","KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."),We.CLAMP_TO_GROUND):t==="relativeToSeaFloor"?(wt("kml-gx:altitudeMode-relativeToSeaFloor","KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."),We.RELATIVE_TO_GROUND):(u(e)?wt("kml-altitudeMode-unknown",`KML - Unknown <kml:altitudeMode>:${e}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`):wt("kml-gx:altitudeMode-unknown",`KML - Unknown <gx:altitudeMode>:${t}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`),We.CLAMP_TO_GROUND)}function nQe(e,t,n){return n==="relativeToSeaFloor"||t==="absolute"||t==="relativeToGround"?e:((u(t)&&t!=="clampToGround"||u(n)&&n!=="clampToSeaFloor")&&wt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${y(t,n)}`),new Qh(e))}function iQe(e,t,n,i){if(!u(e))return;if(n==="relativeToSeaFloor"||t==="absolute"||t==="relativeToGround")return e;(u(t)&&t!=="clampToGround"||u(n)&&n!=="clampToSeaFloor")&&wt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${y(t,n)}`);let o=e.length;for(let r=0;r<o;r++){let s=e[r];i.scaleToGeodeticSurface(s,s)}return e}function mz(e,t,n,i){let o=t.label;u(o)||(o=u(n.label)?n.label.clone():ime(),t.label=o),o.text=t.name;let r=t.billboard;u(r)||(r=u(n.billboard)?n.billboard.clone():nme(),t.billboard=r),u(r.image)?r.image.getValue()||(r.image=void 0):r.image=e._pinBuilder.fromColor(z.YELLOW,64);let s=1;u(r.scale)&&(s=r.scale.getValue(),s!==0?o.pixelOffset=new H(s*16+1,0):(o.pixelOffset=void 0,o.horizontalOrigin=void 0)),u(i)&&e._clampToGround&&(r.heightReference=i,o.heightReference=i)}function sme(e,t){let n=e.path;u(n)||(n=new ep,n.leadTime=0,e.path=n);let i=t.polyline;u(i)&&(n.material=i.material,n.width=i.width)}function oQe(e,t,n,i,o){let r=Pn(n,"coordinates",Re.kml),s=Pn(n,"altitudeMode",Re.kml),a=Pn(n,"altitudeMode",Re.gx),c=Gd(n,"extrude",Re.kml),l=e._ellipsoid,f=hz(r,l);return i.position=f,mz(e,i,o,rme(s,a)),c&&wM(s,a)&&X7(t,i,o),!0}function Zhe(e,t,n,i,o){let r=wi(n,"coordinates",Re.kml),s=Pn(n,"altitudeMode",Re.kml),a=Pn(n,"altitudeMode",Re.gx),c=Gd(n,"extrude",Re.kml),l=Gd(n,"tessellate",Re.kml),f=wM(s,a),d=ni(n,"drawOrder",Re.gx),p=e._ellipsoid,g=uz(r,p),m=o.polyline;if(f&&c){let A=new tp;i.wall=A,A.positions=g;let x=o.polygon;u(x)&&(A.fill=x.fill,A.material=x.material),A.outline=!0,u(m)?(A.outlineColor=u(m.material)?m.material.color:z.WHITE,A.outlineWidth=m.width):u(x)&&(A.outlineColor=u(x.material)?x.material.color:z.WHITE)}else if(e._clampToGround&&!f&&l){let A=new Ua;A.clampToGround=!0,i.polyline=A,A.positions=g,u(m)?(A.material=u(m.material)?m.material.color.getValue(ze.MINIMUM_VALUE):z.WHITE,A.width=y(m.width,1)):(A.material=z.WHITE,A.width=1),A.zIndex=d}else u(d)&&wt("kml-gx:drawOrder","KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"),e._clampToGround&&!l&&wt("kml-line-tesselate","Ignoring clampToGround for KML lines without the tessellate flag."),m=u(m)?m.clone():new Ua,i.polyline=m,m.positions=iQe(g,s,a,p),(!l||f)&&(m.arcType=Kt.NONE);return!0}function rQe(e,t,n,i,o){let r=wi(n,"outerBoundaryIs",Re.kml),s=wi(r,"LinearRing",Re.kml),a=wi(s,"coordinates",Re.kml),c=e._ellipsoid,l=uz(a,c),f=Gd(n,"extrude",Re.kml),d=Pn(n,"altitudeMode",Re.kml),p=Pn(n,"altitudeMode",Re.gx),g=wM(d,p),m=u(o.polygon)?o.polygon.clone():Y7(),A=o.polyline;if(u(A)&&(m.outlineColor=u(A.material)?A.material.color:z.WHITE,m.outlineWidth=A.width),i.polygon=m,g?(m.perPositionHeight=!0,m.extrudedHeight=f?0:void 0):e._clampToGround||(m.height=0),u(l)){let x=new Dc(l),C=Hd(n,"innerBoundaryIs",Re.kml);for(let T=0;T<C.length;T++){s=Hd(C[T],"LinearRing",Re.kml);for(let E=0;E<s.length;E++)a=wi(s[E],"coordinates",Re.kml),l=uz(a,c),u(l)&&x.holes.push(new Dc(l))}m.hierarchy=x}return!0}function sQe(e,t,n,i,o){let r=Pn(n,"altitudeMode",Re.kml),s=Pn(n,"altitudeMode",Re.gx),a=Hd(n,"coord",Re.gx),c=Hd(n,"angles",Re.gx),l=Hd(n,"when",Re.kml),f=Gd(n,"extrude",Re.kml),d=wM(r,s),p=e._ellipsoid;c.length>0&&wt("kml-gx:angles","KML - gx:angles are not supported in gx:Tracks");let g=Math.min(a.length,l.length),m=[],A=[];for(let C=0;C<g;C++){let T=hz(a[C].textContent,p);m.push(T),A.push($.fromIso8601(l[C].textContent))}let x=new Ys;return x.addSamples(A,m),i.position=x,mz(e,i,o,rme(r,s)),sme(i,o),i.availability=new Pr,l.length>0&&i.availability.addInterval(new An({start:A[0],stop:A[A.length-1]})),d&&f&&X7(t,i,o),!0}function Jhe(e,t,n,i,o,r,s,a,c){let l=e[0],f=e[e.length-1],d=new Ys;d.addSamples(e,t),n.intervals.addInterval(new An({start:l,stop:f,isStartIncluded:c,isStopIncluded:c,data:nQe(d,s,a)})),i.addInterval(new An({start:l,stop:f,isStartIncluded:c,isStopIncluded:c})),o.intervals.addInterval(new An({start:l,stop:f,isStartIncluded:c,isStopIncluded:c,data:r}))}function aQe(e,t,n,i,o){let r=Gd(n,"interpolate",Re.gx),s=Hd(n,"Track",Re.gx),a,c,l,f=!1,d=new r_,p=new Pr,g=new Ws,m=e._ellipsoid;for(let A=0,x=s.length;A<x;A++){let C=s[A],T=Hd(C,"when",Re.kml),E=Hd(C,"coord",Re.gx),S=Pn(C,"altitudeMode",Re.kml),D=Pn(C,"altitudeMode",Re.gx),w=wM(S,D),R=Gd(C,"extrude",Re.kml),O=Math.min(E.length,T.length),L=[];a=[];for(let N=0;N<O;N++){let _=hz(E[N].textContent,m);L.push(_),a.push($.fromIso8601(T[N].textContent))}r&&(u(c)&&Jhe([c,a[0]],[l,L[0]],g,p,d,!1,"absolute",void 0,!1),c=a[O-1],l=L[L.length-1]),Jhe(a,L,g,p,d,w&&R,S,D,!0),f=f||w&&R}return i.availability=p,i.position=g,mz(e,i,o),sme(i,o),f&&(X7(t,i,o),i.polyline.show=d),!0}var ame={Point:oQe,LineString:Zhe,LinearRing:Zhe,Polygon:rQe,Track:sQe,MultiTrack:aQe,MultiGeometry:cQe,Model:lQe};function cQe(e,t,n,i,o,r){let s=n.childNodes,a=!1;for(let c=0,l=s.length;c<l;c++){let f=s.item(c),d=ame[f.localName];if(u(d)){let p=tme(f,t,r);p.parent=i,p.name=i.name,p.availability=i.availability,p.description=i.description,p.kml=i.kml,d(e,t,f,p,o)&&(a=!0)}}return a}function lQe(e,t,n,i,o){return wt("kml-unsupportedGeometry",`KML - Unsupported geometry: ${n.localName}`),!1}function uQe(e,t){let n=wi(e,"ExtendedData",Re.kml);if(!u(n))return;u(wi(n,"SchemaData",Re.kml))&&wt("kml-schemaData","KML - SchemaData is unsupported"),u(fs(n,"xmlns:prefix"))&&wt("kml-extendedData","KML - ExtendedData with xmlns:prefix is unsupported");let i={},o=Hd(n,"Data",Re.kml);if(u(o)){let r=o.length;for(let s=0;s<r;s++){let a=o[s],c=fs(a,"name");u(c)&&(i[c]={displayName:Pn(a,"displayName",Re.kml),value:Pn(a,"value",Re.kml)})}}t.kml.extendedData=i}var ho;typeof document<"u"&&(ho=document.createElement("div"));function fQe(e,t,n,i,o){let r,s,a,c=t.kml,l=c.extendedData,f=Pn(e,"description",Re.kml),d=y(t.balloonStyle,n.balloonStyle),p=z.WHITE,g=z.BLACK,m=f;u(d)&&(p=y(d.bgColor,z.WHITE),g=y(d.textColor,z.BLACK),m=y(d.text,f));let A;if(u(m)){if(m=m.replace("$[name]",y(t.name,"")),m=m.replace("$[description]",y(f,"")),m=m.replace("$[address]",y(c.address,"")),m=m.replace("$[Snippet]",y(c.snippet,"")),m=m.replace("$[id]",t.id),m=m.replace("$[geDirections]",""),u(l)){let T=m.match(/\$\[.+?\]/g);if(T!==null)for(r=0;r<T.length;r++){let E=T[r],S=E.substr(2,E.length-3),D=/\/displayName$/.test(S);S=S.replace(/\/displayName$/,""),A=l[S],u(A)&&(A=D?A.displayName:A.value),u(A)&&(m=m.replace(E,y(A,"")))}}}else if(u(l)&&(a=Object.keys(l),a.length>0)){for(m='<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>',r=0;r<a.length;r++)s=a[r],A=l[s],m+=`<tr><th>${y(A.displayName,s)}</th><td>${y(A.value,"")}</td></tr>`;m+="</tbody></table>"}if(!u(m))return;m=YJe.link(m),ho.innerHTML=m;let x=ho.querySelectorAll("a");for(r=0;r<x.length;r++)x[r].setAttribute("target","_blank");u(i)&&i.keys.length>1&&(gu(ho,"a","href",i),gu(ho,"link","href",i),gu(ho,"area","href",i),gu(ho,"img","src",i),gu(ho,"iframe","src",i),gu(ho,"video","src",i),gu(ho,"audio","src",i),gu(ho,"source","src",i),gu(ho,"track","src",i),gu(ho,"input","src",i),gu(ho,"embed","src",i),gu(ho,"script","src",i),gu(ho,"video","poster",i)),yu(ho,"a","href",o),yu(ho,"link","href",o),yu(ho,"area","href",o),yu(ho,"img","src",o),yu(ho,"iframe","src",o),yu(ho,"video","src",o),yu(ho,"audio","src",o),yu(ho,"source","src",o),yu(ho,"track","src",o),yu(ho,"input","src",o),yu(ho,"embed","src",o),yu(ho,"script","src",o),yu(ho,"video","poster",o);let C='<div class="cesium-infoBox-description-lighter" style="';C+="overflow:auto;",C+="word-wrap:break-word;",C+=`background-color:${p.toCssColorString()};`,C+=`color:${g.toCssColorString()};`,C+='">',C+=`${ho.innerHTML}</div>`,ho.innerHTML="",t.description=C}function pz(e,t,n){let i=n.entityCollection,o=n.parentEntity,r=n.sourceResource,s=n.uriResolver,a=tme(t,i,n.context),c=a.kml,l=eQe(e,t,n.styleCollection,r,s),f=Pn(t,"name",Re.kml);a.name=f,a.parent=o;let d=QJe(t);u(d)||(d=JJe(t)),a.availability=d,J7(a);function p(E){return E?E.show&&p(E.parent):!0}let g=Gd(t,"visibility",Re.kml);a.show=p(o)&&y(g,!0);let m=wi(t,"author",Re.atom),A=c.author;A.name=Pn(m,"name",Re.atom),A.uri=Pn(m,"uri",Re.atom),A.email=Pn(m,"email",Re.atom);let x=wi(t,"link",Re.atom),C=c.link;C.href=fs(x,"href"),C.hreflang=fs(x,"hreflang"),C.rel=fs(x,"rel"),C.type=fs(x,"type"),C.title=fs(x,"title"),C.length=fs(x,"length"),c.address=Pn(t,"address",Re.kml),c.phoneNumber=Pn(t,"phoneNumber",Re.kml),c.snippet=Pn(t,"Snippet",Re.kml),uQe(t,a),fQe(t,a,l,s,r);let T=e._ellipsoid;return ume(t,a,T),lme(t,a,T),u(wi(t,"Region",Re.kml))&&wt("kml-region","KML - Placemark Regions are unsupported"),{entity:a,styleEntity:l}}function cme(e,t,n,i){i.addNodes(t.childNodes,n),i.process()}function dQe(e,t,n,i){let o=pz(e,t,n),r=Ge(n);r.parentEntity=o.entity,cme(e,t,r,i)}function hQe(e,t,n,i){let o=pz(e,t,n),r=o.entity,s=o.styleEntity,a=!1,c=t.childNodes;for(let l=0,f=c.length;l<f&&!a;l++){let d=c.item(l),p=ame[d.localName];u(p)&&(p(e,n.entityCollection,d,r,s,r.id),a=!0)}a||(r.merge(s),mz(e,r,s))}var mQe={FlyTo:gQe,Wait:_Qe,SoundCue:V7,AnimatedUpdate:V7,TourControl:V7};function pQe(e,t,n,i){let o=Pn(t,"name",Re.kml),r=fs(t,"id"),s=new TM(o,r),a=wi(t,"Playlist",Re.gx);if(a){let c=e._ellipsoid,l=a.childNodes;for(let f=0;f<l.length;f++){let d=l[f];if(d.localName){let p=mQe[d.localName];p?p(s,d,c):console.log(`Unknown KML Tour playlist entry type ${d.localName}`)}}}e._kmlTours.push(s)}function V7(e,t){wt(`KML Tour unsupported node ${t.localName}`)}function _Qe(e,t){let n=ni(t,"duration",Re.gx);e.addPlaylistEntry(new DM(n))}function gQe(e,t,n){let i=ni(t,"duration",Re.gx),o=Pn(t,"flyToMode",Re.gx),r={kml:{}};ume(t,r,n),lme(t,r,n);let s=r.kml.lookAt||r.kml.camera,a=new SM(i,o,s);e.addPlaylistEntry(a)}function lme(e,t,n){let i=wi(e,"Camera",Re.kml);if(u(i)){let o=y(ni(i,"longitude",Re.kml),0),r=y(ni(i,"latitude",Re.kml),0),s=y(ni(i,"altitude",Re.kml),0),a=y(ni(i,"heading",Re.kml),0),c=y(ni(i,"tilt",Re.kml),0),l=y(ni(i,"roll",Re.kml),0),f=h.fromDegrees(o,r,s,n),d=Ba.fromDegrees(a,c-90,l);t.kml.camera=new dM(f,d)}}function ume(e,t,n){let i=wi(e,"LookAt",Re.kml);if(u(i)){let o=y(ni(i,"longitude",Re.kml),0),r=y(ni(i,"latitude",Re.kml),0),s=y(ni(i,"altitude",Re.kml),0),a=ni(i,"heading",Re.kml),c=ni(i,"tilt",Re.kml),l=y(ni(i,"range",Re.kml),0);c=P.toRadians(y(c,0)),a=P.toRadians(y(a,0));let f=new uu(a,c-P.PI_OVER_TWO,l),d=h.fromDegrees(o,r,s,n);t.kml.lookAt=new CM(d,f)}}function yQe(e,t,n,i){let o=n.screenOverlayContainer;if(!u(o))return;let r=n.sourceResource,s=n.uriResolver,a=wi(t,"Icon",Re.kml),c=q7(a,e,r,s,!1);if(!u(c))return;let l=document.createElement("img");e._screenOverlays.push(l),l.src=c.url,l.onload=function(){let f=["position: absolute"],d=wi(t,"screenXY",Re.kml),p=wi(t,"overlayXY",Re.kml),g=wi(t,"size",Re.kml),m,A,x,C,T,E;u(g)&&(m=Dy(g,"x"),A=Dy(g,"y"),x=fs(g,"xunits"),C=fs(g,"yunits"),u(m)&&m!==-1&&m!==0&&(x==="fraction"?T=`width: ${Math.floor(m*100)}%`:x==="pixels"&&(T=`width: ${m}px`),f.push(T)),u(A)&&A!==-1&&A!==0&&(C==="fraction"?E=`height: ${Math.floor(A*100)}%`:C==="pixels"&&(E=`height: ${A}px`),f.push(E))),l.style=f.join(";");let S=0,D=l.height;u(p)&&(m=Dy(p,"x"),A=Dy(p,"y"),x=fs(p,"xunits"),C=fs(p,"yunits"),u(m)&&(x==="fraction"?S=m*l.width:(x==="pixels"||x==="insetPixels")&&(S=m)),u(A)&&(C==="fraction"?D=A*l.height:(C==="pixels"||C==="insetPixels")&&(D=A))),u(d)&&(m=Dy(d,"x"),A=Dy(d,"y"),x=fs(d,"xunits"),C=fs(d,"yunits"),u(m)&&(x==="fraction"?T=`left: calc(${Math.floor(m*100)}% - ${S}px)`:x==="pixels"?T=`left: ${m-S}px`:x==="insetPixels"&&(T=`right: ${m-S}px`),f.push(T)),u(A)&&(C==="fraction"?E=`bottom: calc(${Math.floor(A*100)}% - ${D}px)`:C==="pixels"?E=`bottom: ${A-D}px`:C==="insetPixels"&&(E=`top: ${A-D}px`),f.push(E))),l.style=f.join(";")},o.appendChild(l)}function AQe(e,t,n,i){let r=pz(e,t,n).entity,s,a=!1,c=e._ellipsoid,l=uz(wi(t,"LatLonQuad",Re.gx),c),f=ni(t,"drawOrder",Re.kml);if(u(l))s=Y7(),s.hierarchy=new Dc(l),s.zIndex=f,r.polygon=s,a=!0;else{s=new td,s.zIndex=f,r.rectangle=s;let m=wi(t,"LatLonBox",Re.kml);if(u(m)){let A=ni(m,"west",Re.kml),x=ni(m,"south",Re.kml),C=ni(m,"east",Re.kml),T=ni(m,"north",Re.kml);u(A)&&(A=P.negativePiToPi(P.toRadians(A))),u(x)&&(x=P.clampToLatitudeRange(P.toRadians(x))),u(C)&&(C=P.negativePiToPi(P.toRadians(C))),u(T)&&(T=P.clampToLatitudeRange(P.toRadians(T))),s.coordinates=new ce(A,x,C,T);let E=ni(m,"rotation",Re.kml);if(u(E)){let S=P.toRadians(E);s.rotation=S,s.stRotation=S}}}let d=wi(t,"Icon",Re.kml),p=q7(d,e,n.sourceResource,n.uriResolver,!0);if(u(p)){a&&wt("kml-gx:LatLonQuad","KML - gx:LatLonQuad Icon does not support texture projection.");let m=ni(d,"x",Re.gx),A=ni(d,"y",Re.gx),x=ni(d,"w",Re.gx),C=ni(d,"h",Re.gx);(u(m)||u(A)||u(x)||u(C))&&wt("kml-groundOverlay-xywh","KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"),s.material=p,s.material.color=wx(t,"color",Re.kml),s.material.transparent=!0}else s.material=wx(t,"color",Re.kml);let g=Pn(t,"altitudeMode",Re.kml);u(g)?g==="absolute"?(s.height=ni(t,"altitude",Re.kml),s.zIndex=void 0):g!=="clampToGround"&&wt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${g}`):(g=Pn(t,"altitudeMode",Re.gx),g==="relativeToSeaFloor"?(wt("kml-altitudeMode-relativeToSeaFloor","KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."),s.height=ni(t,"altitude",Re.kml),s.zIndex=void 0):g==="clampToSeaFloor"?wt("kml-altitudeMode-clampToSeaFloor","KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."):u(g)&&wt("kml-altitudeMode-unknown",`KML - Unknown altitudeMode: ${g}`))}function fme(e,t,n,i){e._unsupportedNode.raiseEvent(e,n.parentEntity,t,n.entityCollection,n.styleCollection,n.sourceResource,n.uriResolver),wt(`kml-unsupportedFeature-${t.nodeName}`,`KML - Unsupported feature: ${t.nodeName}`)}var vy={INTERVAL:0,EXPIRE:1,STOP:2};function dz(e){if(!u(e)||e.length===0)return"";let t=e[0];return(t==="&"||t==="?")&&(e=e.substring(1)),e}var xQe=new ce,vb=new he,U7=new H,CQe=new h;function K7(e,t,n,i,o,r){function s(l){return l<-P.PI_OVER_TWO?-P.PI_OVER_TWO:l>P.PI_OVER_TWO?P.PI_OVER_TWO:l}function a(l){return l>P.PI?l-P.TWO_PI:l<-P.PI?l+P.TWO_PI:l}let c=p0(e.queryParameters);if(c=c.replace(/%5B/g,"[").replace(/%5D/g,"]"),u(t)&&t._mode!==te.MORPHING){let l,f;if(o=y(o,xQe),u(n)&&(U7.x=n.clientWidth*.5,U7.y=n.clientHeight*.5,l=t.pickEllipsoid(U7,r,CQe)),u(l)?f=r.cartesianToCartographic(l,vb):(f=ce.center(o,vb),l=r.cartographicToCartesian(f)),u(i)&&!P.equalsEpsilon(i,1,P.EPSILON9)){let C=o.width*i*.5,T=o.height*i*.5;o=new ce(a(f.longitude-C),s(f.latitude-T),a(f.longitude+C),s(f.latitude+T))}c=c.replace("[bboxWest]",P.toDegrees(o.west).toString()),c=c.replace("[bboxSouth]",P.toDegrees(o.south).toString()),c=c.replace("[bboxEast]",P.toDegrees(o.east).toString()),c=c.replace("[bboxNorth]",P.toDegrees(o.north).toString());let d=P.toDegrees(f.longitude).toString(),p=P.toDegrees(f.latitude).toString();c=c.replace("[lookatLon]",d),c=c.replace("[lookatLat]",p),c=c.replace("[lookatTilt]",P.toDegrees(t.pitch).toString()),c=c.replace("[lookatHeading]",P.toDegrees(t.heading).toString()),c=c.replace("[lookatRange]",h.distance(t.positionWC,l)),c=c.replace("[lookatTerrainLon]",d),c=c.replace("[lookatTerrainLat]",p),c=c.replace("[lookatTerrainAlt]",f.height.toString()),r.cartesianToCartographic(t.positionWC,vb),c=c.replace("[cameraLon]",P.toDegrees(vb.longitude).toString()),c=c.replace("[cameraLat]",P.toDegrees(vb.latitude).toString()),c=c.replace("[cameraAlt]",P.toDegrees(vb.height).toString());let g=t.frustum,m=g.aspectRatio,A="",x="";if(u(m)){let C=P.toDegrees(g.fov);m>1?(A=C,x=C/m):(x=C,A=C*m)}c=c.replace("[horizFov]",A.toString()),c=c.replace("[vertFov]",x.toString())}else c=c.replace("[bboxWest]","-180"),c=c.replace("[bboxSouth]","-90"),c=c.replace("[bboxEast]","180"),c=c.replace("[bboxNorth]","90"),c=c.replace("[lookatLon]",""),c=c.replace("[lookatLat]",""),c=c.replace("[lookatRange]",""),c=c.replace("[lookatTilt]",""),c=c.replace("[lookatHeading]",""),c=c.replace("[lookatTerrainLon]",""),c=c.replace("[lookatTerrainLat]",""),c=c.replace("[lookatTerrainAlt]",""),c=c.replace("[cameraLon]",""),c=c.replace("[cameraLat]",""),c=c.replace("[cameraAlt]",""),c=c.replace("[horizFov]",""),c=c.replace("[vertFov]","");u(n)?(c=c.replace("[horizPixels]",n.clientWidth),c=c.replace("[vertPixels]",n.clientHeight)):(c=c.replace("[horizPixels]",""),c=c.replace("[vertPixels]","")),c=c.replace("[terrainEnabled]","1"),c=c.replace("[clientVersion]","1"),c=c.replace("[kmlVersion]","2.2"),c=c.replace("[clientName]","Cesium"),c=c.replace("[language]","English"),e.setQueryParameters(Nl(c))}function TQe(e,t,n,i){let r=pz(e,t,n).entity,s=n.sourceResource,a=n.uriResolver,c=wi(t,"Link",Re.kml);if(u(c)||(c=wi(t,"Url",Re.kml)),u(c)){let l=Pn(c,"href",Re.kml),f,d;if(u(l)){let p=l;if(l=j7(l,s,n.uriResolver),/^data:/.test(l.getUrlComponent()))/\.kmz/i.test(s.getUrlComponent())||(p=s.getDerivedResource({url:p}));else{if(p=l.clone(),f=Pn(c,"viewRefreshMode",Re.kml),f==="onRegion"){wt("kml-refrehMode-onRegion","KML - Unsupported viewRefreshMode: onRegion");return}d=y(Pn(c,"viewBoundScale",Re.kml),1);let x=f==="onStop"?"BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]":"",C=y(Pn(c,"viewFormat",Re.kml),x),T=Pn(c,"httpQuery",Re.kml);u(C)&&l.setQueryParameters(Nl(dz(C))),u(T)&&l.setQueryParameters(Nl(dz(T)));let E=e._ellipsoid;K7(l,e.camera,e.canvas,d,e._lastCameraView.bbox,E)}let g={sourceUri:p,uriResolver:a,context:r.id,screenOverlayContainer:n.screenOverlayContainer},m=new Ss,A=Z7(e,m,l,g).then(function(x){let C=e._entityCollection,T=m.values;C.suspendEvents();for(let D=0;D<T.length;D++){let w=T[D];u(w.parent)||(w.parent=r,J7(w)),C.add(w)}C.resumeEvents();let E=Pn(c,"refreshMode",Re.kml),S=y(ni(c,"refreshInterval",Re.kml),0);if(E==="onInterval"&&S>0||E==="onExpire"||f==="onStop"){let D=wi(x,"NetworkLinkControl",Re.kml),w=u(D),R=$.now(),O={id:zn(),href:l,cookie:{},lastUpdated:R,updating:!1,entity:r,viewBoundScale:d,needsUpdate:!1,cameraUpdateTime:R},L=0;if(w&&(O.cookie=Nl(y(Pn(D,"cookie",Re.kml),"")),L=y(ni(D,"minRefreshPeriod",Re.kml),0)),E==="onInterval")w&&(S=Math.max(L,S)),O.refreshMode=vy.INTERVAL,O.time=S;else if(E==="onExpire"){let N;if(w&&(N=Pn(D,"expires",Re.kml)),u(N))try{let _=$.fromIso8601(N),b=$.secondsDifference(_,R);b>0&&b<L&&$.addSeconds(R,L,_),O.refreshMode=vy.EXPIRE,O.time=_}catch{wt("kml-refreshMode-onInterval-onExpire","KML - NetworkLinkControl expires is not a valid date")}else wt("kml-refreshMode-onExpire","KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element")}else u(e.camera)?(O.refreshMode=vy.STOP,O.time=y(ni(c,"viewRefreshTime",Re.kml),0)):wt("kml-refrehMode-onStop-noCamera","A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined.");u(O.refreshMode)&&e._networkLinks.set(O.id,O)}}).catch(function(x){wt(`An error occured during loading ${l.url}`),e._error.raiseEvent(e,x)});i.addPromise(A)}}}function EQe(e,t,n,i){let o=W7[t.localName];return u(o)?o(e,t,n,i):fme(e,t,n,i)}function H7(e,t,n,i,o,r,s){t.removeAll();let a=n.documentElement,c=a.localName==="Document"?a:wi(a,"Document",Re.kml),l=Pn(c,"name",Re.kml);u(l)||(l=e_(i.getUrlComponent())),u(e._name)||(e._name=l);let f=new Au._DeferredLoading(e),d=new Ss(e);return Promise.all(ome(e,n,d,i,!1,o)).then(function(){let p=n.documentElement;if(p.localName==="kml"){let m=p.childNodes;for(let A=0;A<m.length;A++){let x=m[A];if(u(W7[x.localName])){p=x;break}}}let g={parentEntity:void 0,entityCollection:t,styleCollection:d,sourceResource:i,uriResolver:o,context:s,screenOverlayContainer:r};return t.suspendEvents(),EQe(e,p,g,f),t.resumeEvents(),f.wait().then(function(){return n.documentElement})})}function bQe(e,t,n,i,o){let r=$t("ThirdParty/Workers/z-worker-pako.js");gb({workerScripts:{deflate:[r,"./pako_deflate.min.js"],inflate:[r,"./pako_inflate.min.js"]}});let s=new iz(new vx(n));return Promise.resolve(s.getEntries()).then(function(a){let c=[],l={},f;for(let d=0;d<a.length;d++){let p=a[d];p.directory||(/\.kml$/i.test(p.filename)&&(!u(f)||!/\//i.test(p.filename))?(u(f)&&c.push(F7(f,l)),f=p):c.push(F7(p,l)))}return u(f)&&c.push(ZJe(f,l)),Promise.all(c).then(function(){if(s.close(),!u(l.kml))throw new ue("KMZ file does not contain a KML document.");return l.keys=Object.keys(l),H7(e,t,l.kml,i,l,o)})})}function Z7(e,t,n,i){i=y(i,y.EMPTY_OBJECT);let o=i.sourceUri,r=i.uriResolver,s=i.context,a=i.screenOverlayContainer,c=n;if(typeof n=="string"||n instanceof Oe){n=Oe.createIfNeeded(n),c=n.fetchBlob(),o=y(o,n.clone());let l=e._resourceCredits,f=n.credits;if(u(f)){let d=f.length;for(let p=0;p<d;p++)l.push(f[p])}}else o=y(o,Oe.DEFAULT.clone());return o=Oe.createIfNeeded(o),u(a)&&(a=In(a)),Promise.resolve(c).then(function(l){return l instanceof Blob?XJe(l).then(function(f){return f?bQe(e,t,l,o,a):KJe(l).then(function(d){d=$he(d),d=eme(d);let p,g;try{p=G7.parseFromString(d,"application/xml")}catch(m){g=m.toString()}if(u(g)||p.body||p.documentElement.tagName==="parsererror"){let m=u(g)?g:p.documentElement.firstChild.nodeValue;throw m||(m=p.body.innerText),new ue(m)}return H7(e,t,p,o,r,a,s)})}):H7(e,t,l,o,r,a,s)}).catch(function(l){return e._error.raiseEvent(e,l),console.log(l),Promise.reject(l)})}function Au(e){e=y(e,y.EMPTY_OBJECT);let t=e.camera,n=e.canvas;this._changed=new Ae,this._error=new Ae,this._loading=new Ae,this._refresh=new Ae,this._unsupportedNode=new Ae,this._clock=void 0,this._entityCollection=new Ss(this),this._name=void 0,this._isLoading=!1,this._pinBuilder=new d_,this._networkLinks=new xt,this._entityCluster=new tu,this.canvas=n,this.camera=t,this._lastCameraView={position:u(t)?h.clone(t.positionWC):void 0,direction:u(t)?h.clone(t.directionWC):void 0,up:u(t)?h.clone(t.upWC):void 0,bbox:u(t)?t.computeViewRectangle():ce.clone(ce.MAX_VALUE)},this._ellipsoid=y(e.ellipsoid,ie.WGS84);let i=e.credit;typeof i=="string"&&(i=new Zt(i)),this._credit=i,this._resourceCredits=[],this._kmlTours=[],this._screenOverlays=[]}Au.load=function(e,t){return t=y(t,y.EMPTY_OBJECT),new Au(t).load(e,t)};Object.defineProperties(Au.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){this._entityCluster=e}},credit:{get:function(){return this._credit}},kmlTours:{get:function(){return this._kmlTours}}});Au.prototype.load=function(e,t){t=y(t,y.EMPTY_OBJECT),Or.setLoading(this,!0);let n=this._name;this._name=void 0,this._clampToGround=y(t.clampToGround,!1);let i=this;return Z7(this,this._entityCollection,e,t).then(function(){let o,r=i._entityCollection.computeAvailability(),s=r.start,a=r.stop,c=$.equals(s,ze.MINIMUM_VALUE),l=$.equals(a,ze.MAXIMUM_VALUE);if(!c||!l){let d;c&&(d=new Date,d.setHours(0,0,0,0),s=$.fromDate(d)),l&&(d=new Date,d.setHours(24,0,0,0),a=$.fromDate(d)),o=new wd,o.startTime=s,o.stopTime=a,o.currentTime=$.clone(s),o.clockRange=Br.LOOP_STOP,o.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,o.multiplier=Math.round(Math.min(Math.max($.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),Or.setLoading(i,!1),i}).catch(function(o){return Or.setLoading(i,!1),i._error.raiseEvent(i,o),console.log(o),Promise.reject(o)})};Au.prototype.destroy=function(){for(;this._screenOverlays.length>0;)this._screenOverlays.pop().remove()};function J7(e){let t=e.parent;if(u(t)){let n=t.availability;if(u(n)){let i=e.availability;u(i)?i.intersect(n):e.availability=n}}}function SQe(e,t,n,i,o){return function(r){if(!i.contains(t.id))return;let s=!1,a=wi(r,"NetworkLinkControl",Re.kml),c=u(a),l=0;if(c){if(u(wi(a,"Update",Re.kml))){wt("kml-networkLinkControl-update","KML - NetworkLinkControl updates aren't supported."),t.updating=!1,i.remove(t.id);return}t.cookie=Nl(y(Pn(a,"cookie",Re.kml),"")),l=y(ni(a,"minRefreshPeriod",Re.kml),0)}let f=$.now(),d=t.refreshMode;if(d===vy.INTERVAL)u(a)&&(t.time=Math.max(l,t.time));else if(d===vy.EXPIRE){let R;if(u(a)&&(R=Pn(a,"expires",Re.kml)),u(R))try{let O=$.fromIso8601(R),L=$.secondsDifference(O,f);L>0&&L<l&&$.addSeconds(f,l,O),t.time=O}catch{wt("kml-networkLinkControl-expires","KML - NetworkLinkControl expires is not a valid date"),s=!0}else wt("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 A(R){g.remove(R);let O=R._children,L=O.length;for(let N=0;N<L;++N)A(O[N])}g.suspendEvents();let x=g.values.slice(),C;for(C=0;C<x.length;++C){let R=x[C];R.parent===p&&(R.parent=void 0,A(R))}for(g.resumeEvents(),g.suspendEvents(),C=0;C<m.length;C++){let R=m[C];u(R.parent)||(R.parent=p,J7(R)),g.add(R)}g.resumeEvents(),s?i.remove(t.id):t.lastUpdated=f;let T=g.computeAvailability(),E=T.start,S=T.stop,D=$.equals(E,ze.MINIMUM_VALUE),w=$.equals(S,ze.MAXIMUM_VALUE);if(!D||!w){let R=e._clock;(R.startTime!==E||R.stopTime!==S)&&(R.startTime=E,R.stopTime=S,e._changed.raiseEvent(e))}t.updating=!1,t.needsUpdate=!1,e._refresh.raiseEvent(e,o.getUrlComponent(!0))}}var k7=new xt;Au.prototype.update=function(e){let t=this._networkLinks;if(t.length===0)return!0;let n=$.now(),i=this;k7.removeAll();function o(f){let d=f._children,p=d.length;for(let g=0;g<p;++g){let m=d[g];k7.set(m.id,m),o(m)}}let r=!1,s=this._lastCameraView,a=this.camera;u(a)&&!(a.positionWC.equalsEpsilon(s.position,P.EPSILON7)&&a.directionWC.equalsEpsilon(s.direction,P.EPSILON7)&&a.upWC.equalsEpsilon(s.up,P.EPSILON7))&&(s.position=h.clone(a.positionWC),s.direction=h.clone(a.directionWC),s.up=h.clone(a.upWC),s.bbox=a.computeViewRectangle(),r=!0);let c=new xt,l=!1;return t.values.forEach(function(f){let d=f.entity;if(!k7.contains(d.id)){if(!f.updating){let p=!1;if(f.refreshMode===vy.INTERVAL?$.secondsDifference(n,f.lastUpdated)>f.time&&(p=!0):f.refreshMode===vy.EXPIRE?$.greaterThan(n,f.time)&&(p=!0):f.refreshMode===vy.STOP&&(r&&(f.needsUpdate=!0,f.cameraUpdateTime=n),f.needsUpdate&&$.secondsDifference(n,f.cameraUpdateTime)>=f.time&&(p=!0)),p){o(d),f.updating=!0;let g=new Ss,m=f.href.clone();m.setQueryParameters(f.cookie);let A=y(i._ellipsoid,ie.WGS84);K7(m,i.camera,i.canvas,f.viewBoundScale,s.bbox,A),Z7(i,g,m,{context:d.id}).then(SQe(i,f,g,c,m)).catch(function(x){let C=`NetworkLink ${f.href} refresh failed: ${x}`;console.log(C),i._error.raiseEvent(i,C)}),l=!0}}c.set(f.id,f)}}),l&&(this._networkLinks=c,this._changed.raiseEvent(this)),!0};function DQe(){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}Au._DeferredLoading=sm;Au._getTimestamp=di;var IM=Au;function PM(){de.throwInstantiationError()}PM.prototype.update=de.throwInstantiationError;PM.prototype.getBoundingSphere=de.throwInstantiationError;PM.prototype.isDestroyed=de.throwInstantiationError;PM.prototype.destroy=de.throwInstantiationError;var Q7=PM;var $7=32,vQe="http://www.opengis.net/kml/2.2",jd="http://www.google.com/kml/ext/2.2",wQe="http://www.w3.org/2000/xmlns/";function _z(e){this._files={},this._promises=[],this._count=0,this._modelCallback=e}var IQe=/^data:image\/([^,;]+)/;_z.prototype.texture=function(e){let t=this,n;if(typeof e=="string"||e instanceof Oe){if(e=Oe.createIfNeeded(e),!e.isDataUri)return e.url;let i=e.url.match(IQe);n=`texture_${++this._count}`,u(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 PQe(e,t){return function(n){e._files[t]=n}}_z.prototype.model=function(e,t){let n=this._modelCallback;if(!u(n))throw new ue("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(PQe(this,r))}return o};Object.defineProperties(_z.prototype,{promise:{get:function(){return Promise.all(this._promises)}},files:{get:function(){return this._files}}});function gz(e){this._time=e}gz.prototype.get=function(e,t,n){let i;return u(e)&&(i=u(e.getValue)?e.getValue(this._time,n):e),y(i,t)};gz.prototype.getColor=function(e,t){let n=this.get(e,t);if(u(n))return Px(n)};gz.prototype.getMaterialType=function(e){if(u(e))return e.getType(this._time)};function ej(){this._ids={},this._styles={},this._count=0}ej.prototype.get=function(e){let t=this._ids,n=e.innerHTML;if(u(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};ej.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 mme(){this._ids={}}mme.prototype.get=function(e){if(!u(e))return this.get(zn());let t=this._ids;return u(t[e])?`${e.toString()}-${++t[e]}`:(t[e]=0,e)};function tj(e){e=y(e,y.EMPTY_OBJECT);let t=e.entities,n=y(e.kmz,!1),i=tj._createState(e),o=t.values.filter(function(l){return!u(l.parent)}),r=i.kmlDoc,s=r.documentElement;s.setAttributeNS(wQe,"xmlns:gx",jd);let a=r.createElement("Document");s.appendChild(a),_me(i,a,o),i.styleCache.save(a);let c=i.externalFileHandler;return c.promise.then(function(){let f=new XMLSerializer().serializeToString(i.kmlDoc);return n?OQe(f,c.files):{kml:f,externalFiles:c.files}})}function OQe(e,t){let n=$t("ThirdParty/Workers/z-worker-pako.js");gb({workerScripts:{deflate:[n,"./pako_deflate.min.js"],inflate:[n,"./pako_inflate.min.js"]}});let i=new Tb,o=new sz(i);return o.add("doc.kml",new jk(e)).then(function(){let r=Object.keys(t);return pme(o,r,t,0)}).then(function(){return o.close()}).then(function(r){return{kmz:r}})}function pme(e,t,n,i){if(t.length===i)return;let o=t[i];return e.add(o,new vx(n[o])).then(function(){return pme(e,t,n,i+1)})}tj._createState=function(e){let t=e.entities,n=new ej,i=t.computeAvailability(),o=u(e.time)?e.time:i.start,r=y(e.defaultAvailability,i),s=y(e.sampleDuration,60);r.start===ze.MINIMUM_VALUE?r.stop===ze.MAXIMUM_VALUE?r=new An:$.addSeconds(r.stop,-10*s,r.start):r.stop===ze.MAXIMUM_VALUE&&$.addSeconds(r.start,10*s,r.stop);let a=new _z(e.modelCallback);return{kmlDoc:document.implementation.createDocument(vQe,"kml"),ellipsoid:y(e.ellipsoid,ie.WGS84),idManager:new mme,styleCache:n,externalFileHandler:a,time:o,valueGetter:new gz(o),sampleDuration:s,defaultAvailability:new Pr([r])}};function _me(e,t,n){let i=e.kmlDoc,o=e.styleCache,r=e.valueGetter,s=e.idManager,a=n.length,c,l,f;for(let d=0;d<a;++d){let p=n[d];c=[],l=[],f=[],RQe(e,p,l,f),BQe(e,p.polyline,l,f),hme(e,p.rectangle,l,f,c),hme(e,p.polygon,l,f,c),FQe(e,p,p.model,l,f);let g,m=p.availability;u(m)&&(g=i.createElement("TimeSpan"),$.equals(m.start,ze.MINIMUM_VALUE)||g.appendChild(hn(i,"begin",$.toIso8601(m.start))),$.equals(m.stop,ze.MAXIMUM_VALUE)||g.appendChild(hn(i,"end",$.toIso8601(m.stop))));for(let C=0;C<c.length;++C){let T=c[C];T.setAttribute("id",s.get(p.id)),T.appendChild(hn(i,"name",p.name)),T.appendChild(hn(i,"visibility",p.show)),T.appendChild(hn(i,"description",p.description)),u(g)&&T.appendChild(g),t.appendChild(T)}let A=l.length;if(A>0){let C=i.createElement("Placemark");C.setAttribute("id",s.get(p.id));let T=p.name,E=p.label;if(u(E)){let D=i.createElement("LabelStyle"),w=r.get(E.text);T=u(w)&&w.length>0?w:T;let R=r.getColor(E.fillColor);u(R)&&(D.appendChild(hn(i,"color",R)),D.appendChild(hn(i,"colorMode","normal")));let O=r.get(E.scale);u(O)&&D.appendChild(hn(i,"scale",O)),f.push(D)}C.appendChild(hn(i,"name",T)),C.appendChild(hn(i,"visibility",p.show)),C.appendChild(hn(i,"description",p.description)),u(g)&&C.appendChild(g),t.appendChild(C);let S=f.length;if(S>0){let D=i.createElement("Style");for(let w=0;w<S;++w)D.appendChild(f[w]);C.appendChild(hn(i,"styleUrl",o.get(D)))}if(l.length===1)C.appendChild(l[0]);else if(l.length>1){let D=i.createElement("MultiGeometry");for(let w=0;w<A;++w)D.appendChild(l[w]);C.appendChild(D)}}let x=p._children;if(x.length>0){let C=i.createElement("Folder");C.setAttribute("id",s.get(p.id)),C.appendChild(hn(i,"name",p.name)),C.appendChild(hn(i,"visibility",p.show)),C.appendChild(hn(i,"description",p.description)),t.appendChild(C),_me(e,C,x)}}}var Dl=new h,Uc=new he,Wd=new $;function RQe(e,t,n,i){let o=e.kmlDoc,r=e.ellipsoid,s=e.valueGetter,a=y(t.billboard,t.point);if(!u(a)&&!u(t.path))return;let c=t.position;if(!c.isConstant){gme(e,t,a,n,i);return}s.get(c,void 0,Dl);let l=hn(o,"coordinates",Ix(Dl,r)),f=o.createElement("Point"),d=o.createElement("altitudeMode");d.appendChild(Ox(e,a.heightReference)),f.appendChild(d),f.appendChild(l),n.push(f);let p=a instanceof Na?Ame(e,a):yme(e,a);i.push(p)}function gme(e,t,n,i,o){let r=e.kmlDoc,s=e.ellipsoid,a=e.valueGetter,c,l=t.position,f=!0;l instanceof Ws?(c=l.intervals,f=!1):c=y(t.availability,e.defaultAvailability);let d=n instanceof $m,p,g,m,A=[];for(p=0;p<c.length;++p){let C=c.get(p),T=f?l:C.data,E=r.createElement("altitudeMode");T instanceof Qh?(T=T._value,E.appendChild(Ox(e,We.CLAMP_TO_GROUND))):u(n)?E.appendChild(Ox(e,n.heightReference)):E.appendChild(Ox(e,We.NONE));let S=[],D=[];if(T.isConstant){a.get(T,void 0,Dl);let R=hn(r,"coordinates",Ix(Dl,s));S.push($.toIso8601(C.start)),D.push(R),S.push($.toIso8601(C.stop)),D.push(R)}else if(T instanceof Ys)for(m=T._property._times,g=0;g<m.length;++g)S.push($.toIso8601(m[g])),T.getValueInReferenceFrame(m[g],to.FIXED,Dl),D.push(Ix(Dl,s));else if(T instanceof ru){m=T._times;let R=T._values;for(g=0;g<m.length;++g)S.push($.toIso8601(m[g])),h.fromArray(R,g*3,Dl),D.push(Ix(Dl,s))}else{let R=e.sampleDuration;C.start.clone(Wd),C.isStartIncluded||$.addSeconds(Wd,R,Wd);let O=C.stop;for(;$.lessThan(Wd,O);)T.getValue(Wd,Dl),S.push($.toIso8601(Wd)),D.push(Ix(Dl,s)),$.addSeconds(Wd,R,Wd);C.isStopIncluded&&$.equals(Wd,O)&&(T.getValue(Wd,Dl),S.push($.toIso8601(Wd)),D.push(Ix(Dl,s)))}let w=r.createElementNS(jd,"Track");w.appendChild(E);for(let R=0;R<S.length;++R){let O=hn(r,"when",S[R]),L=hn(r,"coord",D[R],jd);w.appendChild(O),w.appendChild(L)}d&&w.appendChild(xme(e,n)),A.push(w)}if(A.length===1)i.push(A[0]);else if(A.length>1){let C=r.createElementNS(jd,"MultiTrack");for(p=0;p<A.length;++p)C.appendChild(A[p]);i.push(C)}if(u(n)&&!d){let C=n instanceof Na?Ame(e,n):yme(e,n);o.push(C)}let x=t.path;if(u(x)){let C=a.get(x.width),T=x.material;if(u(T)||u(C)){let E=r.createElement("LineStyle");u(C)&&E.appendChild(hn(r,"width",C)),nj(e,T,E),o.push(E)}}}function yme(e,t){let n=e.kmlDoc,i=e.valueGetter,o=n.createElement("IconStyle"),r=i.getColor(t.color);u(r)&&(o.appendChild(hn(n,"color",r)),o.appendChild(hn(n,"colorMode","normal")));let s=i.get(t.pixelSize);return u(s)&&o.appendChild(hn(n,"scale",s/$7)),o}function Ame(e,t){let n=e.kmlDoc,i=e.valueGetter,o=e.externalFileHandler,r=n.createElement("IconStyle"),s=i.get(t.image);if(u(s)){s=o.texture(s);let p=n.createElement("Icon");p.appendChild(hn(n,"href",s));let g=i.get(t.imageSubRegion);u(g)&&(p.appendChild(hn(n,"x",g.x,jd)),p.appendChild(hn(n,"y",g.y,jd)),p.appendChild(hn(n,"w",g.width,jd)),p.appendChild(hn(n,"h",g.height,jd))),r.appendChild(p)}let a=i.getColor(t.color);u(a)&&(r.appendChild(hn(n,"color",a)),r.appendChild(hn(n,"colorMode","normal")));let c=i.get(t.scale);u(c)&&r.appendChild(hn(n,"scale",c));let l=i.get(t.pixelOffset);if(u(l)){c=y(c,1),H.divideByScalar(l,c,l);let p=i.get(t.width,$7),g=i.get(t.height,$7),m=i.get(t.horizontalOrigin,_i.CENTER);m===_i.CENTER?l.x-=p*.5:m===_i.RIGHT&&(l.x-=p);let A=i.get(t.verticalOrigin,On.CENTER);A===On.TOP?l.y+=g:A===On.CENTER&&(l.y+=g*.5);let x=n.createElement("hotSpot");x.setAttribute("x",-l.x),x.setAttribute("y",l.y),x.setAttribute("xunits","pixels"),x.setAttribute("yunits","pixels"),r.appendChild(x)}let f=i.get(t.rotation),d=i.get(t.alignedAxis);return u(f)&&h.equals(h.UNIT_Z,d)&&(f=P.toDegrees(-f),f===0&&(f=360),r.appendChild(hn(n,"heading",f))),r}function BQe(e,t,n,i){let o=e.kmlDoc,r=e.ellipsoid,s=e.valueGetter;if(!u(t))return;let a=o.createElement("LineString"),c=o.createElement("altitudeMode"),l=s.get(t.clampToGround,!1),f;l?(a.appendChild(hn(o,"tessellate",!0)),f=o.createTextNode("clampToGround")):f=o.createTextNode("absolute"),c.appendChild(f),a.appendChild(c);let d=t.positions,p=s.get(d),g=hn(o,"coordinates",Ix(p,r));a.appendChild(g);let m=s.get(t.zIndex);l&&u(m)&&a.appendChild(hn(o,"drawOrder",m,jd)),n.push(a);let A=o.createElement("LineStyle"),x=s.get(t.width);u(x)&&A.appendChild(hn(o,"width",x)),nj(e,t.material,A),i.push(A)}function MQe(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),c=[],l=[ce.northeast,ce.southeast,ce.southwest,ce.northwest];for(let g=0;g<4;++g)l[g](a,Uc),c.push(`${P.toDegrees(Uc.longitude)},${P.toDegrees(Uc.latitude)},${r}`);let f=hn(i,"coordinates",c.join(" ")),d=i.createElement("outerBoundaryIs"),p=i.createElement("LinearRing");return p.appendChild(f),d.appendChild(p),[d]}function dme(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,Uc),s.push(`${P.toDegrees(Uc.longitude)},${P.toDegrees(Uc.latitude)},${i?Uc.height:n}`);let c=hn(o,"coordinates",s.join(" ")),l=o.createElement("LinearRing");return l.appendChild(c),l}function LQe(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=[],c=t.hierarchy,l=o.get(c),f=Array.isArray(l)?l:l.positions,d=i.createElement("outerBoundaryIs");d.appendChild(dme(e,f,r,s)),a.push(d);let p=l.holes;if(u(p)){let g=p.length;for(let m=0;m<g;++m){let A=i.createElement("innerBoundaryIs");A.appendChild(dme(e,p[m].positions,r,s)),a.push(A)}}return a}function hme(e,t,n,i,o){let r=e.kmlDoc,s=e.valueGetter;if(!u(t))return;let a=t instanceof td;if(a&&s.getMaterialType(t.material)==="Image"){NQe(e,t,o);return}let c=r.createElement("Polygon"),l=s.get(t.extrudedHeight,0);l>0&&c.appendChild(hn(r,"extrude",!0));let f=a?MQe(e,t,l):LQe(e,t,l),d=f.length;for(let x=0;x<d;++x)c.appendChild(f[x]);let p=r.createElement("altitudeMode");p.appendChild(Ox(e,t.heightReference)),c.appendChild(p),n.push(c);let g=r.createElement("PolyStyle"),m=s.get(t.fill,!1);m&&g.appendChild(hn(r,"fill",m)),nj(e,t.material,g);let A=s.get(t.outline,!1);if(A){g.appendChild(hn(r,"outline",A));let x=r.createElement("LineStyle"),C=s.get(t.outlineWidth,1);x.appendChild(hn(r,"width",C));let T=s.getColor(t.outlineColor,z.BLACK);x.appendChild(hn(r,"color",T)),x.appendChild(hn(r,"colorMode","normal")),i.push(x)}i.push(g)}function NQe(e,t,n){let i=e.kmlDoc,o=e.valueGetter,r=e.externalFileHandler,s=i.createElement("GroundOverlay"),a=i.createElement("altitudeMode");a.appendChild(Ox(e,t.heightReference)),s.appendChild(a);let c=o.get(t.height);u(c)&&s.appendChild(hn(i,"altitude",c));let l=o.get(t.coordinates),f=i.createElement("LatLonBox");f.appendChild(hn(i,"north",P.toDegrees(l.north))),f.appendChild(hn(i,"south",P.toDegrees(l.south))),f.appendChild(hn(i,"east",P.toDegrees(l.east))),f.appendChild(hn(i,"west",P.toDegrees(l.west))),s.appendChild(f);let d=o.get(t.material),p=r.texture(d.image),g=i.createElement("Icon");g.appendChild(hn(i,"href",p)),s.appendChild(g);let m=d.color;u(m)&&s.appendChild(hn(i,"color",Px(d.color))),n.push(s)}function xme(e,t){let n=e.kmlDoc,i=e.valueGetter,o=e.externalFileHandler,r=n.createElement("Model"),s=i.get(t.scale);if(u(s)){let l=n.createElement("scale");l.appendChild(hn(n,"x",s)),l.appendChild(hn(n,"y",s)),l.appendChild(hn(n,"z",s)),r.appendChild(l)}let a=n.createElement("Link"),c=o.model(t,e.time);return a.appendChild(hn(n,"href",c)),r.appendChild(a),r}function FQe(e,t,n,i,o){let r=e.kmlDoc,s=e.ellipsoid,a=e.valueGetter;if(!u(n))return;let c=t.position;if(!c.isConstant){gme(e,t,n,i,o);return}let l=xme(e,n),f=r.createElement("altitudeMode");f.appendChild(Ox(e,n.heightReference)),l.appendChild(f),a.get(c,void 0,Dl),he.fromCartesian(Dl,s,Uc);let d=r.createElement("Location");d.appendChild(hn(r,"longitude",P.toDegrees(Uc.longitude))),d.appendChild(hn(r,"latitude",P.toDegrees(Uc.latitude))),d.appendChild(hn(r,"altitude",Uc.height)),l.appendChild(d),i.push(l)}function nj(e,t,n){let i=e.kmlDoc,o=e.valueGetter;if(!u(t))return;let r=o.get(t);if(!u(r))return;let s,a=o.getMaterialType(t),c,l;switch(a){case"Image":s=Px(z.WHITE);break;case"Color":case"Grid":case"PolylineGlow":case"PolylineArrow":case"PolylineDash":s=Px(r.color);break;case"PolylineOutline":s=Px(r.color),c=Px(r.outlineColor),l=r.outlineWidth,n.appendChild(hn(i,"outerColor",c,jd)),n.appendChild(hn(i,"outerWidth",l,jd));break;case"Stripe":s=Px(r.oddColor);break}u(s)&&(n.appendChild(hn(i,"color",s)),n.appendChild(hn(i,"colorMode","normal")))}function Ox(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 Ix(e,t){Array.isArray(e)||(e=[e]);let n=e.length,i=[];for(let o=0;o<n;++o)he.fromCartesian(e[o],t,Uc),i.push(`${P.toDegrees(Uc.longitude)},${P.toDegrees(Uc.latitude)},${Uc.height}`);return i.join(" ")}function hn(e,t,n,i){n=y(n,""),typeof n=="boolean"&&(n=n?"1":"0");let o=u(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 Px(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 ij=tj;var wb=`#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 p_=`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; // The thickness of the atmosphere in meters.
const int PRIMARY_STEPS = 16; // Number of times the ray from the camera to the world position (primary ray) is sampled.
const int LIGHT_STEPS = 4; // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.

/**
 * This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
 * the transmittance value for the ray.
 *
 * @param {czm_ray} primaryRay The ray from the camera to the position.
 * @param {float} primaryRayLength The length of the primary ray.
 * @param {vec3} lightDirection The direction of the light to calculate the scattering from.
 * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
 * @param {vec3} mieColor The variable the Mie scattering will be written to.
 * @param {float} opacity The variable the transmittance will be written to.
 * @glslFunction
 */
void computeScattering(
    czm_ray primaryRay,
    float primaryRayLength,
    vec3 lightDirection,
    float atmosphereInnerRadius,
    out vec3 rayleighColor,
    out vec3 mieColor,
    out float opacity
) {

    // Initialize the default scattering amounts to 0.
    rayleighColor = vec3(0.0);
    mieColor = vec3(0.0);
    opacity = 0.0;

    float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;

    vec3 origin = vec3(0.0);

    // Calculate intersection from the camera to the outer ring of the atmosphere.
    czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);

    // Return empty colors if no intersection with the atmosphere geometry.
    if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
        return;
    }

    // The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
    primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
    // The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
    primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));

    // Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
    float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);
    float rayPositionLength = primaryRayAtmosphereIntersect.start;

    vec3 rayleighAccumulation = vec3(0.0);
    vec3 mieAccumulation = vec3(0.0);
    vec2 opticalDepth = vec2(0.0);
    vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);

    // Sample positions on the primary ray.
    for (int i = 0; i < PRIMARY_STEPS; i++) {
        // Calculate sample position along viewpoint ray.
        vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
        
        // Calculate height of sample position above ellipsoid.
        float sampleHeight = length(samplePosition) - atmosphereInnerRadius;

        // Calculate and accumulate density of particles at the sample position.
        vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
        opticalDepth += sampleDensity;

        // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
        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);

        // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
        for (int j = 0; j < LIGHT_STEPS; j++) {

            // Calculate sample position along light ray.
            vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);

            // Calculate height of the light sample position above ellipsoid.
            float lightHeight = length(lightPosition) - atmosphereInnerRadius;

            // Calculate density of photons at the light sample position.
            lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;

            // Increment distance on light ray.
            lightPositionLength += lightStepLength;
        }

        // Compute attenuation via the primary ray and the light ray.
        vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));

        // Accumulate the scattering.
        rayleighAccumulation += sampleDensity.x * attenuation;
        mieAccumulation += sampleDensity.y * attenuation;

        // Increment distance on primary ray.
        rayPositionLength += rayStepLength;
    }

    // Compute the scattering amount.
    rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
    mieColor = u_atmosphereMieCoefficient * mieAccumulation;

    // Compute the transmittance i.e. how much light is passing through the atmosphere.
    opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
}

vec4 computeAtmosphereColor(
    vec3 positionWC,
    vec3 lightDirection,
    vec3 rayleighColor,
    vec3 mieColor,
    float opacity
) {
    // Setup the primary ray: from the camera position to the vertex position.
    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;

    // The Rayleigh phase function.
    float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
    // The Mie phase function.
    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));

    // The final color is generated by combining the effects of the Rayleigh and Mie scattering.
    vec3 rayleigh = rayleighPhase * rayleighColor;
    vec3 mie = miePhase * mieColor;

    vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;

    return vec4(color, opacity);
}
`;var OM=`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 roughness, vec3 N)
{
    float a = roughness * roughness;
    float phi = 2.0 * M_PI * xi.x;
    float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 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 G1_Smith(float NdotV, float k)
{
    return NdotV / (NdotV * (1.0 - k) + k);
}

float G_Smith(float roughness, float NdotV, float NdotL)
{
    float k = roughness * roughness / 2.0;
    return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);
}

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;
    for (int i = 0; i < NumSamples; i++)
    {
        vec2 xi = hammersley2D(i, NumSamples);
        vec3 H = importanceSampleGGX(xi, roughness, 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 = G_Smith(roughness, NdotV, NdotL);
            float G_Vis = G * VdotH / (NdotH * NdotV);
            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 RM=`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;
}

// Interpolate a voxel with its neighbor (along the positive X-axis)
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);
}

// Intersection with a unit sphere with radius 0.5 at center (0, 0, 0).
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;
}

// Transforms the ray origin and direction into unit sphere space,
// then transforms the result back into the ellipsoid's space.
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;
}

// Assume that if phase shift is being called for octave i,
// the frequency is of i - 1. This saves us from doing extra
// division / multiplication operations.
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));
}

// The cloud texture function derived from Gardner's 1985 paper,
// "Visual Simulation of Clouds."
// https://www.cs.drexel.edu/~david/Classes/Papers/p297-gardner.pdf
const float T0    = 0.6;  // contrast of the texture pattern
const float k     = 0.1;  // computed to produce a maximum value of 1
const float C0    = 0.8;  // coefficient
const float FX0   = 0.6;  // frequency X
const float FY0   = 0.6;  // frequency Y
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;  // fraction of surface reflection due to ambient or scattered light,
const float t = 0.4;  // fraction of texture shading
const float s = 0.25; // fraction of specular reflection

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);  // diffuse reflection
    float Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0);   // specular reflection
    float It = T(cloudPoint);                                 // texture function
    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;

    // The dot product between the cloud's normal and the ray's direction is greatest
    // in the center of the ellipsoid's surface. It decreases towards the edge.
    // Thus, it is used to blur the areas leading to the edges of the ellipsoid,
    // so that no harsh lines appear.

    // The first (and biggest) layer of worley noise is then subtracted from this.
    // The final result is scaled up so that the base cloud is not too translucent.
    float ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);
    float TR = pow(ndDot, 3.0) - W; // translucency
    TR *= 1.3;

    // Subtracting the second and third layers of worley noise is more complicated.
    // If these layers of noise were simply subtracted from the current translucency,
    // the shape derived from the first layer of noise would be completely deleted.
    // The erosion of this noise should thus be constricted to the edges of the cloud.
    // However, because the edges of the ellipsoid were already blurred away, mapping
    // the noise to (1.0 - ndDot) will have no impact on most of the cloud's appearance.
    // The value of (0.5 - ndDot) provides the best compromise.
    float minusDot = 0.5 - ndDot;

    // Even with the previous calculation, subtracting the second layer of wnoise
    // erode too much of the cloud. The addition of it, however, will detailed
    // volume to the cloud. As long as the noise is only added and not subtracted,
    // the results are aesthetically pleasing.

    // The minusDot product is mapped in a way that it is larger at the edges of
    // the ellipsoid, so a subtraction and min operation are used instead of
    // an addition and max one.
    TR -= min(minusDot * W2, 0.0);

    // The third level of worley noise is subtracted from the result, with some
    // modifications. First, a scalar is added to minusDot so that the noise
    // starts affecting the shape farther away from the center of the ellipsoid's
    // surface. Then, it is scaled down so its impact is not too intense.
    TR -= 0.8 * (minusDot + 0.25) * W3;

    // The texture function's shading does not correlate with the shape of the cloud
    // produced by the layers of noise, so an extra shading scalar is calculated.
    // The darkest areas of the cloud are assigned to be where the noise erodes
    // the cloud the most. This is then interpolated based on the translucency
    // and the diffuse shading term of that point in the cloud.
    float shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);

    // To avoid values that are too dark, this scalar is increased by a small amount
    // and clamped so it never goes to zero.
    shading = clamp(shading + 0.2, 0.3, 1.0);

    // Finally, the contrast of the cloud's color is increased.
    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
    // To avoid calculations with high values,
    // we raycast from an arbitrarily smaller space.
    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 BM=`#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() {
    // Unpack attributes.
    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 MM=`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));
}

// Frequency corresponds to cell size.
// The higher the frequency, the smaller the cell size.
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 LM=`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 NM=`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 FM=`/**
 * Compositing for Weighted Blended Order-Independent Transparency. See:
 * - http://jcgt.org/published/0002/02/09/
 * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html
 */

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 VM=`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); // left, bottom
        vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top
        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 UM=`in vec4 position;

out vec4 positionEC;

void main()
{
    positionEC = czm_modelView * position;
    gl_Position = czm_projection * positionEC;

    czm_vertexLogDepth();
}
`;var Ib=`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;              // normalized surface normal (always facing the viewer) in model coordinates
    vec3 normalEC = normalize(czm_normal * normalMC);   // normalized surface normal in eye coordiantes

    vec2 st = czm_ellipsoidWgs84TextureCoordinates(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()
{
    // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii
    // in the vertex shader. Only when it is larger than some constant, march along the ray.
    // Otherwise perform one intersection test which will be the common case.

    // Test if the ray intersects a sphere with the ellipsoid's maximum radius.
    // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test
    // may cause false negatives. This will discard fragments before marching the ray forward.
    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;
    }

    // March ray forward to intersection with larger sphere and find
    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;
    }

    // If the viewer is outside, compute outsideFaceColor, with normals facing outward.
    vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);

    // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.
    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 Pb=`in vec3 position;

uniform vec3 u_radii;

out vec3 v_positionEC;

void main()
{
    // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.
    // Scale to consider the radii.  We could also do this once on the CPU when using the BoxGeometry,
    // but doing it here allows us to change the radii without rewriting the vertex data, and
    // allows all ellipsoids to reuse the same vertex data.
    vec4 p = vec4(u_radii * position, 1.0);

    v_positionEC = (czm_modelView * p).xyz;     // position in eye coordinates
    gl_Position = czm_modelViewProjection * p;  // position in clip coordinates

    // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums
    // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the
    // ellipsoid (does not write depth) that was rendered in the farther frustum.
    //
    // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates
    // artifacts since some fragments can be alpha blended twice.  This is solved by only rendering
    // the ellipsoid in the closest frustum to the viewer.
    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 kM=`/**
 * @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.
 */

// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h

// Steps used to integrate into Cesium:
// * The following defines are set:
//       #define FXAA_PC 1
//       #define FXAA_WEBGL_1 1
//       #define FXAA_GREEN_AS_LUMA 1
//       #define FXAA_EARLY_EXIT 1
//       #define FXAA_GLSL_120 1
// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.
// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace
//   /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.
// * There are no implicit conversions from ivec* to vec* so replace:
//       #define FxaaInt2 ivec2
//           with
//       #define FxaaInt2 vec2
// * The texture2DLod function is only available in vertex shaders so replace:
//       #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
//       #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
//           with
//       #define FxaaTexTop(t, p) texture(t, p)
//       #define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.
// * The following parameters to FxaaPixelShader are unused and can be removed:
//       fxaaConsolePosPos
//       fxaaConsoleRcpFrameOpt
//       fxaaConsoleRcpFrameOpt2
//       fxaaConsole360RcpFrameOpt2
//       fxaaConsoleEdgeSharpness
//       fxaaConsoleEdgeThreshold
//       fxaaConsoleEdgeThresholdMi
//       fxaaConsole360ConstDir

//
// Choose the quality preset.
// This needs to be compiled into the shader as it effects code.
// Best option to include multiple presets is to
// in each shader define the preset, then include this file.
//
// OPTIONS
// -----------------------------------------------------------------------
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
// 39       - no dither, very expensive
//
// NOTES
// -----------------------------------------------------------------------
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
// 13 = about same speed as FXAA 3.9 and better than 12
// 23 = closest to FXAA 3.9 visually and performance wise
//  _ = the lowest digit is directly related to performance
// _  = the highest digit is directly related to style
//
//#define FXAA_QUALITY_PRESET 12


#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(
    //
    // Use noperspective interpolation here (turn off perspective interpolation).
    // {xy} = center of pixel
    FxaaFloat2 pos,
    //
    // Input color texture.
    // {rgb_} = color in linear or perceptual color space
    // if (FXAA_GREEN_AS_LUMA == 0)
    //     {___a} = luma in perceptual color space (not linear)
    FxaaTex tex,
    //
    // Only used on FXAA Quality.
    // This must be from a constant/uniform.
    // {x_} = 1.0/screenWidthInPixels
    // {_y} = 1.0/screenHeightInPixels
    FxaaFloat2 fxaaQualityRcpFrame,
    //
    // Only used on FXAA Quality.
    // This used to be the FXAA_QUALITY_SUBPIX define.
    // It is here now to allow easier tuning.
    // Choose the amount of sub-pixel aliasing removal.
    // This can effect sharpness.
    //   1.00 - upper limit (softer)
    //   0.75 - default amount of filtering
    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)
    //   0.25 - almost off
    //   0.00 - completely off
    FxaaFloat fxaaQualitySubpix,
    //
    // Only used on FXAA Quality.
    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
    // It is here now to allow easier tuning.
    // The minimum amount of local contrast required to apply algorithm.
    //   0.333 - too little (faster)
    //   0.250 - low quality
    //   0.166 - default
    //   0.125 - high quality
    //   0.063 - overkill (slower)
    FxaaFloat fxaaQualityEdgeThreshold,
    //
    // Only used on FXAA Quality.
    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
    // It is here now to allow easier tuning.
    // Trims the algorithm from processing darks.
    //   0.0833 - upper limit (default, the start of visible unfiltered edges)
    //   0.0625 - high quality (faster)
    //   0.0312 - visible limit (slower)
    // Special notes when using FXAA_GREEN_AS_LUMA,
    //   Likely want to set this to zero.
    //   As colors that are mostly not-green
    //   will appear very dark in the green channel!
    //   Tune by looking at mostly non-green content,
    //   then start at zero and increase until aliasing is a problem.
    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 zM=`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

#ifdef SHOW_REFLECTIVE_OCEAN
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

#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; // Hue, saturation, brightness
#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)
{
    // This crazy step stuff sets the alpha to 0.0 if this following condition is true:
    //    tileTextureCoordinates.s < textureCoordinateRectangle.s ||
    //    tileTextureCoordinates.s > textureCoordinateRectangle.p ||
    //    tileTextureCoordinates.t < textureCoordinateRectangle.t ||
    //    tileTextureCoordinates.t > textureCoordinateRectangle.q
    // In other words, the alpha is zero if the fragment is outside the rectangle
    // covered by this texture.  Would an actual 'if' yield better performance?
    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 = max(max(colorDiff.r, colorDiff.g), colorDiff.b);
    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;
    // Split to the left
    if (split < 0.0 && gl_FragCoord.x > splitPosition) {
       alpha = 0.0;
    }
    // Split to the right
    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;

    // When rendering imagery for a tile in multiple passes,
    // some GPU/WebGL implementation combinations will not blend fragments in
    // additional passes correctly if their computation includes an unmasked
    // divide-by-zero operation,
    // even if it's not in the output or if the output has alpha zero.
    //
    // For example, without sanitization for outAlpha,
    // this renders without artifacts:
    //   if (outAlpha == 0.0) { outColor = vec3(0.0); }
    //
    // but using czm_branchFreeTernary will cause portions of the tile that are
    // alpha-zero in the additional pass to render as black instead of blending
    // with the previous pass:
    //   outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor);
    //
    // So instead, sanitize against divide-by-zero,
    // store this state on the sign of outAlpha, and correct on return.

    return vec4(outColor, max(outAlpha, 0.0));
}

vec3 colorCorrect(vec3 rgb) {
#ifdef COLOR_CORRECT
    // Convert rgb color to hsb
    vec3 hsb = czm_RGBToHSB(rgb);
    // Perform hsb shift
    hsb.x += u_hsbShift.x; // hue
    hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation
    hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness
    // Convert shifted hsb back to rgb
    rgb = czm_HSBToRGB(hsb);
#endif
    return rgb;
}

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 = 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));   // normalized surface normal in model coordinates
    vec3 normalEC = czm_normal3D * normalMC;                                         // normalized surface normal in eye coordiantes
#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

    // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0
    // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the
    // fragments on the edges of tiles even though the vertex shader is outputting
    // coordinates strictly in the 0-1 range.
    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

#ifdef SHOW_REFLECTIVE_OCEAN
    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;

    if (mask > 0.0)
    {
        mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);

        vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
        vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(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

#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;
    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 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;

        // When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader.
        // Otherwise, the scattering is computed in the vertex shader.
        #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

        rayleighColor = colorCorrect(rayleighColor);
        mieColor = colorCorrect(mieColor);

        vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);

        // Fog is applied to tiles selected for fog, close to the Earth.
        #ifdef FOG
            vec3 fogColor = groundAtmosphereColor.rgb;
            
            // If there is lighting, apply that to the fog.
            #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_acesTonemapping(fogColor.rgb);
                fogColor.rgb = czm_inverseGamma(fogColor.rgb);
            #endif
            
            const float modifier = 0.15;
            finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);

        #else
            // The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere.
            // This value is larger near the "circumference", as it is further away from the camera. We use it to
            // brighten up that area of the ground atmosphere.
            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);
}

// Based on water rendering by Jonas Wagner:
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog

// low altitude wave settings
const float oceanFrequencyLowAltitude = 825000.0;
const float oceanAnimationSpeedLowAltitude = 0.004;
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
const float oceanSpecularIntensity = 0.5;

// high altitude wave settings
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);

    // The double normalize below works around a bug in Firefox on Android devices.
    vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));

    // Fade out the waves as the camera moves far from the surface.
    float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);

#ifdef SHOW_OCEAN_WAVES
    // high altitude 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);

    // low altitude waves
    time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
    noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
    vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);

    // blend the 2 wave layers based on distance to surface
    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);

    // fade out the normal perturbation as we move farther from the water surface
    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);

    // Use diffuse light to highlight the waves
    float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
    vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);

#ifdef SHOW_OCEAN_WAVES
    // Where diffuse light is low or non-existent, use wave highlights based solely on
    // the wave bumpiness and no particular light direction.
    float tsPerturbationRatio = normalTangentSpace.z;
    vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
#else
    vec3 nonDiffuseHighlight = vec3(0.0);
#endif

    // Add specular highlights in 3D, and in all modes when zoomed in.
    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 HM=`#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_terrainExaggerationAndRelativeHeight;
#endif

uniform vec3 u_center3D;
uniform mat4 u_modifiedModelView;
uniform mat4 u_modifiedModelViewProjection;
uniform vec4 u_tileRectangle;

// Uniforms for 2D Mercator projection
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

// These functions are generated at runtime.
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)
{
    // The width of a tile at level 11, in radians and assuming a single root tile, is
    //   2.0 * czm_pi / pow(2.0, 11.0)
    // We want to just linearly interpolate the 2D position from the texture coordinates
    // when we're at this level or higher.  The constant below is the expression
    // above evaluated and then rounded up at the 4th significant digit.
    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)
{
    // We do not do RTC while morphing, so there is potential for jitter.
    // This is unlikely to be noticeable, though.
    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)
    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
    // A single float per element
    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_terrainExaggerationAndRelativeHeight.x;
    float relativeHeight = u_terrainExaggerationAndRelativeHeight.y;
    float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;

    // stop from going through center of earth
    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;  // position in model coordinates

    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

#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 Ob=`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 GM=`uniform sampler2D u_texture;

in vec2 v_textureCoordinates;

void main()
{
    out_FragColor = texture(u_texture, v_textureCoordinates);
}
`;var WM=`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 Rb=`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);
}

vec3 getLightDirection(vec3 positionWC)
{
    float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
    vec3 lightDirection =
        positionWC * float(lightEnum == 0.0) +
        czm_lightDirectionWC * float(lightEnum == 1.0) +
        czm_sunDirectionWC * float(lightEnum == 2.0);
    return normalize(lightDirection);
}

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;

    // Adjustment to the atmosphere radius applied based on the camera height.
    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);

    // Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit 
    // for the position on the ellipsoid.
    float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;
    float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;

    // Setup the primary ray: from the camera position to the vertex position.
    vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
    vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
    czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);

    underTranslucentGlobe = 0.0;

    // Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled.
    #if defined(GLOBE_TRANSLUCENT)

        // Check for intersection with the inner radius of the atmopshere.
        czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);
        if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {
            
            // Compute position on globe.
            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);

            // Control the color using the camera angle.
            float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));

            // Control the opacity using the distance from Earth.
            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);
            
            // Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton.
            underTranslucentGlobe = 1.0;
            return;
        }
    #endif

    computeScattering(
        primaryRay,
        length(cameraToPositionWC),
        lightDirection,
        atmosphereInnerRadius,
        rayleighColor,
        mieColor,
        opacity
    );

    // Alter the opacity based on how close the viewer is to the ground.
    // (0.0 = At edge of atmosphere, 1.0 = On ground)
    float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;
    float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
    opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);

    // Alter alpha based on time of day (0.0 = night , 1.0 = day)
    float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;
    opacity *= pow(nightAlpha, 0.5);
}
`;var jM=`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)
{
    vec3 lightDirection = getLightDirection(v_outerPositionWC);
   
    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_acesTonemapping(color.rgb);
        color.rgb = czm_inverseGamma(color.rgb);
    #endif

    #ifdef COLOR_CORRECT
        // Convert rgb color to hsb
        vec3 hsb = czm_RGBToHSB(color.rgb);
        // Perform hsb shift
        hsb.x += u_hsbShift.x; // hue
        hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation
        hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness
        // Convert shifted hsb back to rgb
        color.rgb = czm_HSBToRGB(hsb);
    #endif

    // For the parts of the sky atmosphere that are not behind a translucent globe,
    // we mix in the default opacity so that the sky atmosphere still appears at distance.
    // This is needed because the opacity in the sky atmosphere is initially adjusted based
    // on the camera height.
    if (translucent == 0.0) {
        color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
    }

    out_FragColor = color;
}
`;var YM=`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;
    vec3 lightDirection = getLightDirection(positionWC.xyz);

    #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 qM=`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 XM=`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 KM=`uniform sampler2D u_texture;

in vec2 v_textureCoordinates;

void main()
{
    vec4 color = texture(u_texture, v_textureCoordinates);
    out_FragColor = czm_gammaCorrect(color);
}
`;var ZM=`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);

    // The following loop has been manually unrolled for speed, to
    // avoid sin() and cos().
    //
    //for (float i = 0.4; i < 3.2; i += 1.047) {
    //    vec2 direction = vec2(sin(i), cos(i));
    //    burst += 0.4 * addBurst(position, direction, lengthScalar);
    //
    //    direction = vec2(sin(i - 0.08), cos(i - 0.08));
    //    burst += 0.3 * addBurst(position, direction, lengthScalar);
    //}

    burst += 0.4 * addBurst(position, vec2(0.38942,  0.92106), lengthScalar);  // angle == 0.4
    burst += 0.4 * addBurst(position, vec2(0.99235,  0.12348), lengthScalar);  // angle == 0.4 + 1.047
    burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar);  // angle == 0.4 + 1.047 * 2.0

    burst += 0.3 * addBurst(position, vec2(0.31457,  0.94924), lengthScalar);  // angle == 0.4 - 0.08
    burst += 0.3 * addBurst(position, vec2(0.97931,  0.20239), lengthScalar);  // angle == 0.4 + 1.047 - 0.08
    burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar);  // angle == 0.4 + 1.047 * 2.0 - 0.08

    // End of manual loop unrolling.

    color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;

    out_FragColor = clamp(color, vec4(0.0), vec4(1.0));
}
`;var JM=`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 QM=`
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);
}
`;var VQe={NONE:0,LERC:1},bf=Object.freeze(VQe);var UQe={NONE:0,BITS12:1},Ps=Object.freeze(UQe);var Rx=new h,kQe=new h,Sf=new H,yz=new M,zQe=new M,HQe=Math.pow(2,12);function ic(e,t,n,i,o,r,s,a,c,l){let f=Ps.NONE,d,p;if(u(t)&&u(n)&&u(i)&&u(o)){let g=t.minimum,m=t.maximum,A=h.subtract(m,g,kQe),x=i-n;Math.max(h.maximumComponent(A),x)<HQe-1?f=Ps.BITS12:f=Ps.NONE,d=M.inverseTransformation(o,new M);let T=h.negate(g,Rx);M.multiply(M.fromTranslation(T,yz),d,d);let E=Rx;E.x=1/A.x,E.y=1/A.y,E.z=1/A.z,M.multiply(M.fromScale(E,yz),d,d),p=M.clone(o),M.setTranslation(p,h.ZERO,p),o=M.clone(o,new M);let S=M.fromTranslation(g,yz),D=M.fromScale(A,zQe),w=M.multiply(S,D,yz);M.multiply(o,w,o),M.multiply(p,w,p)}this.quantization=f,this.minimumHeight=n,this.maximumHeight=i,this.center=h.clone(e),this.toScaledENU=d,this.fromScaledENU=o,this.matrix=p,this.hasVertexNormals=r,this.hasWebMercatorT=y(s,!1),this.hasGeodeticSurfaceNormals=y(a,!1),this.exaggeration=y(c,1),this.exaggerationRelativeHeight=y(l,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 c=i.x,l=i.y;if(this.quantization===Ps.BITS12){n=M.multiplyByPoint(this.toScaledENU,n,Rx),n.x=P.clamp(n.x,0,1),n.y=P.clamp(n.y,0,1),n.z=P.clamp(n.z,0,1);let f=this.maximumHeight-this.minimumHeight,d=P.clamp((o-this.minimumHeight)/f,0,1);H.fromElements(n.x,n.y,Sf);let p=Gn.compressTextureCoordinates(Sf);H.fromElements(n.z,d,Sf);let g=Gn.compressTextureCoordinates(Sf);H.fromElements(c,l,Sf);let m=Gn.compressTextureCoordinates(Sf);if(e[t++]=p,e[t++]=g,e[t++]=m,this.hasWebMercatorT){H.fromElements(s,0,Sf);let A=Gn.compressTextureCoordinates(Sf);e[t++]=A}}else h.subtract(n,this.center,Rx),e[t++]=Rx.x,e[t++]=Rx.y,e[t++]=Rx.z,e[t++]=o,e[t++]=c,e[t++]=l,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=Gn.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};var GQe=new h,Cme=new h;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 d=s*i+f,p=s*r+f;t[p]=e[d]}let a=this.decodePosition(t,s,GQe),c=n.geodeticSurfaceNormal(a,Cme),l=s*r+this._offsetGeodeticSurfaceNormal;t[l]=c.x,t[l+1]=c.y,t[l+2]=c.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,c=r*o+s;t[c]=e[a]}};ic.prototype.decodePosition=function(e,t,n){if(u(n)||(n=new h),t*=this.stride,this.quantization===Ps.BITS12){let i=Gn.decompressTextureCoordinates(e[t],Sf);n.x=i.x,n.y=i.y;let o=Gn.decompressTextureCoordinates(e[t+1],Sf);return n.z=o.x,M.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],h.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,Cme),a=this.decodeHeight(e,t),c=Cc.getHeight(a,i,o)-a;n.x+=s.x*c,n.y+=s.y*c,n.z+=s.z*c}return n};ic.prototype.decodeTextureCoordinates=function(e,t,n){return u(n)||(n=new H),t*=this.stride,this.quantization===Ps.BITS12?Gn.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===Ps.BITS12?Gn.decompressTextureCoordinates(e[t+1],Sf).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};ic.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===Ps.BITS12?Gn.decompressTextureCoordinates(e[t+3],Sf).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 Ps.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 Az={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},xz={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};ic.prototype.getAttributes=function(e){let t=q.FLOAT,n=q.getSizeInBytes(t),i=this.stride*n,o=0,r=[];function s(a,c){r.push({index:a,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:c,offsetInBytes:o,strideInBytes:i}),o+=c*n}if(this.quantization===Ps.NONE){s(Az.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(Az.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(Az.geodeticSurfaceNormal,3)}else{let a=this.hasWebMercatorT||this.hasVertexNormals,c=this.hasWebMercatorT&&this.hasVertexNormals;s(xz.compressed0,a?4:3),c&&s(xz.compressed1,1),this.hasGeodeticSurfaceNormals&&s(xz.geodeticSurfaceNormal,3)}return r};ic.prototype.getAttributeLocations=function(){return this.quantization===Ps.NONE?Az:xz};ic.clone=function(e,t){if(u(e))return u(t)||(t=new ic),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=h.clone(e.center),t.toScaledENU=M.clone(e.toScaledENU),t.fromScaledENU=M.clone(e.fromScaledENU),t.matrix=M.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 am={};am.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});var oj=new h,WQe=new M,jQe=new h,YQe=new h;am.computeVertices=function(e){let t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=P.PI_OVER_TWO,a=P.toRadians,c=e.heightmap,l=e.width,f=e.height,d=e.skirtHeight,p=d>0,g=y(e.isGeographic,!0),m=y(e.ellipsoid,ie.WGS84),A=1/m.maximumRadius,x=ce.clone(e.nativeRectangle),C=ce.clone(e.rectangle),T,E,S,D;u(C)?(T=C.west,E=C.south,S=C.east,D=C.north):g?(T=a(x.west),E=a(x.south),S=a(x.east),D=a(x.north)):(T=x.west*A,E=s-2*o(r(-x.south*A)),S=x.east*A,D=s-2*o(r(-x.north*A)));let w=e.relativeToCenter,R=u(w);w=R?w:h.ZERO;let O=y(e.includeWebMercatorT,!1),L=y(e.exaggeration,1),N=y(e.exaggerationRelativeHeight,0),b=L!==1,v=y(e.structure,am.DEFAULT_STRUCTURE),I=y(v.heightScale,am.DEFAULT_STRUCTURE.heightScale),B=y(v.heightOffset,am.DEFAULT_STRUCTURE.heightOffset),F=y(v.elementsPerHeight,am.DEFAULT_STRUCTURE.elementsPerHeight),k=y(v.stride,am.DEFAULT_STRUCTURE.stride),U=y(v.elementMultiplier,am.DEFAULT_STRUCTURE.elementMultiplier),G=y(v.isBigEndian,am.DEFAULT_STRUCTURE.isBigEndian),V=ce.computeWidth(x),X=ce.computeHeight(x),j=V/(l-1),Q=X/(f-1);g||(V*=A,X*=A);let W=m.radiiSquared,K=W.x,J=W.y,_e=W.z,xe=65536,re=-65536,ye=Ot.eastNorthUpToFixedFrame(w,m),fe=M.inverseTransformation(ye,WQe),Se,we;O&&(Se=Si.geodeticLatitudeToMercatorAngle(E),we=1/(Si.geodeticLatitudeToMercatorAngle(D)-Se));let Ve=jQe;Ve.x=Number.POSITIVE_INFINITY,Ve.y=Number.POSITIVE_INFINITY,Ve.z=Number.POSITIVE_INFINITY;let qe=YQe;qe.x=Number.NEGATIVE_INFINITY,qe.y=Number.NEGATIVE_INFINITY,qe.z=Number.NEGATIVE_INFINITY;let mt=Number.POSITIVE_INFINITY,Ht=l*f,fn=d>0?l*2+f*2:0,dt=Ht+fn,Tn=new Array(dt),Jn=new Array(dt),Gt=new Array(dt),Je=O?new Array(dt):[],pe=b?new Array(dt):[],me=0,be=f,St=0,qt=l;p&&(--me,++be,--St,++qt);let Kn=1e-5;for(let Ze=me;Ze<be;++Ze){let ft=Ze;ft<0&&(ft=0),ft>=f&&(ft=f-1);let Lt=x.north-Q*ft;g?Lt=a(Lt):Lt=s-2*o(r(-Lt*A));let En=(Lt-E)/(D-E);En=P.clamp(En,0,1);let so=Ze===me,So=Ze===be-1;d>0&&(so?Lt+=Kn*X:So&&(Lt-=Kn*X));let ns=t(Lt),Nr=n(Lt),Hi=_e*Nr,Oi;O&&(Oi=(Si.geodeticLatitudeToMercatorAngle(Lt)-Se)*we);for(let Ar=St;Ar<qt;++Ar){let Mn=Ar;Mn<0&&(Mn=0),Mn>=l&&(Mn=l-1);let Yn=ft*(l*k)+Mn*k,Zn;if(F===1)Zn=c[Yn];else{Zn=0;let mc;if(G)for(mc=0;mc<F;++mc)Zn=Zn*U+c[Yn+mc];else for(mc=F-1;mc>=0;--mc)Zn=Zn*U+c[Yn+mc]}Zn=Zn*I+B,re=Math.max(re,Zn),xe=Math.min(xe,Zn);let ti=x.west+j*Mn;g?ti=a(ti):ti=ti*A;let hc=(ti-T)/(S-T);hc=P.clamp(hc,0,1);let Do=ft*l+Mn;if(d>0){let mc=Ar===St,qr=Ar===qt-1,K2=so||So||mc||qr;if((so||So)&&(mc||qr))continue;K2&&(Zn-=d,mc?(Do=Ht+(f-ft-1),ti-=Kn*V):So?Do=Ht+f+(l-Mn-1):qr?(Do=Ht+f+l+ft,ti+=Kn*V):so&&(Do=Ht+f+l+f+Mn))}let Bo=ns*t(ti),kf=ns*n(ti),er=K*Bo,ba=J*kf,V_=1/i(er*Bo+ba*kf+Hi*Nr),Sa=er*V_,uh=ba*V_,i0=Hi*V_,tr=new h;tr.x=Sa+Bo*Zn,tr.y=uh+kf*Zn,tr.z=i0+Nr*Zn,M.multiplyByPoint(fe,tr,oj),h.minimumByComponent(oj,Ve,Ve),h.maximumByComponent(oj,qe,qe),mt=Math.min(mt,Zn),Tn[Do]=tr,Gt[Do]=new H(hc,En),Jn[Do]=Zn,O&&(Je[Do]=Oi),b&&(pe[Do]=m.geodeticSurfaceNormal(tr))}}let Ro=se.fromPoints(Tn),Uo;u(C)&&(Uo=Rn.fromRectangle(C,xe,re,m));let Ao;R&&(Ao=new Qp(m).computeHorizonCullingPointPossiblyUnderEllipsoid(w,Tn,xe));let Yr=new $_(Ve,qe,w),Be=new oc(w,Yr,mt,re,ye,!1,O,b,L,N),it=new Float32Array(dt*Be.stride),Ke=0;for(let Ze=0;Ze<dt;++Ze)Ke=Be.encode(it,Ke,Tn[Ze],Gt[Ze],Jn[Ze],void 0,Je[Ze],pe[Ze]);return{vertices:it,maximumHeight:re,minimumHeight:xe,encoding:Be,boundingSphere3D:Ro,orientedBoundingBox:Uo,occludeePointInScaledSpace:Ao}};var Bb=am;function wy(){de.throwInstantiationError()}Object.defineProperties(wy.prototype,{credits:{get:de.throwInstantiationError},waterMask:{get:de.throwInstantiationError}});wy.prototype.interpolateHeight=de.throwInstantiationError;wy.prototype.isChildAvailable=de.throwInstantiationError;wy.prototype.createMesh=de.throwInstantiationError;wy.prototype.upsample=de.throwInstantiationError;wy.prototype.wasCreatedByUpsampling=de.throwInstantiationError;wy.maximumAsynchronousTasks=5;var Yd=wy;function qQe(e,t,n,i,o,r,s,a,c,l,f,d,p,g,m,A){this.center=e,this.vertices=t,this.stride=y(l,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=c,this.orientedBoundingBox=f,this.encoding=d,this.westIndicesSouthToNorth=p,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=m,this.northIndicesWestToEast=A}var Df=qQe;function kc(){de.throwInstantiationError()}Object.defineProperties(kc.prototype,{errorEvent:{get:de.throwInstantiationError},credit:{get:de.throwInstantiationError},tilingScheme:{get:de.throwInstantiationError},ready:{get:de.throwInstantiationError},readyPromise:{get:de.throwInstantiationError},hasWaterMask:{get:de.throwInstantiationError},hasVertexNormals:{get:de.throwInstantiationError},availability:{get:de.throwInstantiationError}});var Tme=[];kc.getRegularGridIndices=function(e,t){let n=Tme[e];u(n)||(Tme[e]=n=[]);let i=n[t];return u(i)||(e*t<P.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),Dme(e,t,i,0)),i};var Eme=[];kc.getRegularGridIndicesAndEdgeIndices=function(e,t){let n=Eme[e];u(n)||(Eme[e]=n=[]);let i=n[t];if(!u(i)){let o=kc.getRegularGridIndices(e,t),r=Sme(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,c=r.eastIndicesNorthToSouth,l=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:c,northIndicesWestToEast:l}}return i};var bme=[];kc.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){let n=bme[e];u(n)||(bme[e]=n=[]);let i=n[t];if(!u(i)){let o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,c=o+s,l=r+a,f=Sme(e,t),d=f.westIndicesSouthToNorth,p=f.southIndicesEastToWest,g=f.eastIndicesNorthToSouth,m=f.northIndicesWestToEast,A=Fe.createTypedArray(c,l);Dme(e,t,A,0),kc.addSkirtIndices(d,p,g,m,o,A,r),i=n[t]={indices:A,westIndicesSouthToNorth:d,southIndicesEastToWest:p,eastIndicesNorthToSouth:g,northIndicesWestToEast:m,indexCountWithoutSkirts:r}}return i};kc.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=Cz(e,a,r,s),a+=e.length,s=Cz(t,a,r,s),a+=t.length,s=Cz(n,a,r,s),a+=n.length,Cz(i,a,r,s)};function Sme(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 Dme(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,c=a+e,l=c+1,f=a+1;n[i++]=a,n[i++]=c,n[i++]=f,n[i++]=f,n[i++]=c,n[i++]=l,++o}++o}}function Cz(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}kc.heightmapTerrainQuality=.25;kc.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*kc.heightmapTerrainQuality/(t*n)};kc.prototype.requestTileGeometry=de.throwInstantiationError;kc.prototype.getLevelMaximumGeometricError=de.throwInstantiationError;kc.prototype.getTileDataAvailable=de.throwInstantiationError;kc.prototype.loadTileDataAvailability=de.throwInstantiationError;var Hr=kc;function __(e){this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=y(e.childTileMask,15),this._encoding=y(e.encoding,bf.NONE);let t=Bb.DEFAULT_STRUCTURE,n=e.structure;u(n)?n!==t&&(n.heightScale=y(n.heightScale,t.heightScale),n.heightOffset=y(n.heightOffset,t.heightOffset),n.elementsPerHeight=y(n.elementsPerHeight,t.elementsPerHeight),n.stride=y(n.stride,t.stride),n.elementMultiplier=y(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=y(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=y(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===bf.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties(__.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});var vme="createVerticesFromHeightmap",XQe=new pi(vme),KQe=new pi(vme,Yd.maximumAsynchronousTasks);__.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,o),f=t.tileXYToRectangle(n,i,o),d=c.cartographicToCartesian(ce.center(f)),p=this._structure,m=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(m*4,1e3);let x=(a?KQe:XQe).scheduleTask({heightmap:this._buffer,structure:p,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:f,relativeToCenter:d,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Ei,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!u(x))return;let C=this;return Promise.resolve(x).then(function(T){let E;C._skirtHeight>0?E=Hr.getRegularGridAndSkirtIndicesAndEdgeIndices(T.gridWidth,T.gridHeight):E=Hr.getRegularGridIndicesAndEdgeIndices(T.gridWidth,T.gridHeight);let S=T.gridWidth*T.gridHeight;return C._mesh=new Df(d,new Float32Array(T.vertices),E.indices,E.indexCountWithoutSkirts,S,T.minimumHeight,T.maximumHeight,se.clone(T.boundingSphere3D),h.clone(T.occludeePointInScaledSpace),T.numberOfAttributes,Rn.clone(T.orientedBoundingBox),oc.clone(T.encoding),E.westIndicesSouthToNorth,E.southIndicesEastToWest,E.eastIndicesNorthToSouth,E.northIndicesWestToEast),C._buffer=void 0,C._mesh})};__.prototype._createMeshSync=function(e){let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=t.ellipsoid,c=t.tileXYToNativeRectangle(n,i,o),l=t.tileXYToRectangle(n,i,o),f=a.cartographicToCartesian(ce.center(l)),d=this._structure,g=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);let m=Bb.computeVertices({heightmap:this._buffer,structure:d,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:l,relativeToCenter:f,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof Ei,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let A;this._skirtHeight>0?A=Hr.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):A=Hr.getRegularGridIndicesAndEdgeIndices(this._width,this._height);let x=m.gridWidth*m.gridHeight;return this._mesh=new Df(f,m.vertices,A.indices,A.indexCountWithoutSkirts,x,m.minimumHeight,m.maximumHeight,m.boundingSphere3D,m.occludeePointInScaledSpace,m.encoding.stride,m.orientedBoundingBox,m.encoding,A.westIndicesSouthToNorth,A.southIndicesEastToWest,A.eastIndicesNorthToSouth,A.northIndicesWestToEast),this._mesh};__.prototype.interpolateHeight=function(e,t,n){let i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,c=r.elementMultiplier,l=r.isBigEndian,f=r.heightOffset,d=r.heightScale,p=u(this._mesh),g=this._encoding===bf.LERC;if(!p&&g)return;let A;if(p){let x=this._mesh.vertices,C=this._mesh.encoding;A=wme(x,C,f,d,e,i,o,t,n)}else A=ZQe(this._buffer,a,c,s,l,e,i,o,t,n),A=A*d+f;return A};__.prototype.upsample=function(e,t,n,i,o,r,s){let a=this._mesh;if(!u(a))return;let c=this._width,l=this._height,f=this._structure,d=f.stride,p=new this._bufferType(c*l*d),g=a.vertices,m=a.encoding,A=e.tileXYToRectangle(t,n,i),x=e.tileXYToRectangle(o,r,s),C=f.heightOffset,T=f.heightScale,E=f.elementsPerHeight,S=f.elementMultiplier,D=f.isBigEndian,w=Math.pow(S,E-1);for(let R=0;R<l;++R){let O=P.lerp(x.north,x.south,R/(l-1));for(let L=0;L<c;++L){let N=P.lerp(x.west,x.east,L/(c-1)),_=wme(g,m,C,T,A,c,l,N,O);_=_<f.lowestEncodedHeight?f.lowestEncodedHeight:_,_=_>f.highestEncodedHeight?f.highestEncodedHeight:_,JQe(p,E,S,w,d,D,R*c+L,_)}}return Promise.resolve(new __({buffer:p,width:c,height:l,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};__.prototype.isChildAvailable=function(e,t,n,i){let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};__.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function ZQe(e,t,n,i,o,r,s,a,c,l){let f=(c-r.west)*(s-1)/(r.east-r.west),d=(l-r.south)*(a-1)/(r.north-r.south),p=f|0,g=p+1;g>=s&&(g=s-1,p=s-2);let m=d|0,A=m+1;A>=a&&(A=a-1,m=a-2);let x=f-p,C=d-m;m=a-1-m,A=a-1-A;let T=Tz(e,t,n,i,o,m*s+p),E=Tz(e,t,n,i,o,m*s+g),S=Tz(e,t,n,i,o,A*s+p),D=Tz(e,t,n,i,o,A*s+g);return Ime(x,C,T,E,S,D)}function wme(e,t,n,i,o,r,s,a,c){let l=(a-o.west)*(r-1)/(o.east-o.west),f=(c-o.south)*(s-1)/(o.north-o.south),d=l|0,p=d+1;p>=r&&(p=r-1,d=r-2);let g=f|0,m=g+1;m>=s&&(m=s-1,g=s-2);let A=l-d,x=f-g;g=s-1-g,m=s-1-m;let C=(t.decodeHeight(e,g*r+d)-n)/i,T=(t.decodeHeight(e,g*r+p)-n)/i,E=(t.decodeHeight(e,m*r+d)-n)/i,S=(t.decodeHeight(e,m*r+p)-n)/i;return Ime(A,x,C,T,E,S)}function Ime(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function Tz(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 JQe(e,t,n,i,o,r,s,a){s*=o;let c;if(r)for(c=0;c<t-1;++c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;else for(c=t-1;c>0;--c)e[s+c]=a/i|0,a-=e[s+c]*i,i/=n;e[s+c]=a}var ga=__;function Nb(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}var Bx=new ce;function QQe(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}Nb.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)QQe(e,g,p,s)||s.push(new Mb(r,void 0,0,g,p));r.tileXYToRectangle(t,n,e,Bx);let a=Bx.west,c=Bx.north;r.tileXYToRectangle(i,o,e,Bx);let l=Bx.east,f=Bx.south,d=new i$e(e,a,f,l,c);for(let p=0;p<s.length;++p){let g=s[p];rj(g.extent,d)&&o$e(this._maximumLevel,g,d)}};Nb.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){let i=this._rootNodes[n];if(Lb(i.extent,e)){t=i;break}}return u(t)?$M(void 0,t,e):-1};var $Qe=[],e$e=[],t$e=new ce,n$e=new ce;Nb.prototype.computeBestAvailableLevelOverRectangle=function(e){let t=$Qe;t.length=0,e.east<e.west?(t.push(ce.fromRadians(-Math.PI,e.south,e.east,e.north,t$e)),t.push(ce.fromRadians(e.west,e.south,Math.PI,e.north,n$e))):t.push(e);let n=e$e;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)eL(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(u(n[i])&&n[i].length===0)return i;return 0};var Pme=new he;Nb.prototype.isTileAvailable=function(e,t,n){let i=this._tilingScheme.tileXYToRectangle(t,n,e,Bx);return ce.center(i,Pme),this.computeMaximumLevelAtPosition(Pme)>=e};Nb.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 Mb(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(Mb.prototype,{nw:{get:function(){return this._nw||(this._nw=new Mb(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new Mb(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new Mb(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new Mb(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function i$e(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function rj(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 o$e(e,t,n){for(;t.level<e;)if(Ez(t.nw.extent,n))t=t.nw;else if(Ez(t.ne.extent,n))t=t.ne;else if(Ez(t.sw.extent,n))t=t.sw;else if(Ez(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=wo(t.rectangles,n.level,r$e);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function r$e(e,t){return e.level-t}function Ez(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Lb(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function $M(e,t,n){let i=0,o=!1;for(;!o;){let r=t._nw&&Lb(t._nw.extent,n),s=t._ne&&Lb(t._ne.extent,n),a=t._sw&&Lb(t._sw.extent,n),c=t._se&&Lb(t._se.extent,n);if(r+s+a+c>1){r&&(i=Math.max(i,$M(t,t._nw,n))),s&&(i=Math.max(i,$M(t,t._ne,n))),a&&(i=Math.max(i,$M(t,t._sw,n))),c&&(i=Math.max(i,$M(t,t._se,n)));break}else r?t=t._nw:s?t=t._ne:a?t=t._sw:c?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];Lb(a,n)&&(i=a.level)}t=t.parent}return i}function eL(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||rj(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]=s$e(e[s.level],s)}eL(e,t._nw,n),eL(e,t._ne,n),eL(e,t._sw,n),eL(e,t._se,n)}function s$e(e,t){let n=[];for(let i=0;i<e.length;++i){let o=e[i];rj(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 qd=Nb;function a$e(e){let t,n=e.name,i=e.message;u(n)&&u(i)?t=`${n}: ${i}`:t=e.toString();let o=e.stack;return u(o)&&(t+=`
${o}`),t}var cm=a$e;function bz(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=y(r,0),this.retry=!1,this.error=s}bz.reportError=function(e,t,n,i,o,r,s,a){let c=e;return u(e)?(c.provider=t,c.message=i,c.x=o,c.y=r,c.level=s,c.retry=!1,c.error=a,++c.timesRetried):c=new bz(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${cm(i)}`),c};bz.reportSuccess=function(e){u(e)&&(e.timesRetried=-1)};var Xn=bz;function Iy(e){if(e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ie.WGS84),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1),this._projection=new Si(this._ellipsoid),u(e.rectangleSouthwestInMeters)&&u(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(Iy.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Iy.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Iy.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Iy.prototype.rectangleToNativeRectangle=function(e,t){let n=this._projection,i=n.project(ce.southwest(e)),o=n.project(ce.northeast(e));return u(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)};Iy.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,c=this._rectangleSouthwestInMeters.x+(e+1)*s,l=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,f=this._rectangleNortheastInMeters.y-t*l,d=this._rectangleNortheastInMeters.y-(t+1)*l;return u(i)?(i.west=a,i.south=d,i.east=c,i.north=f,i):new ce(a,d,c,f)};Iy.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};Iy.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,l=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,d=this._projection.project(e),p=d.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-d.y,m=p/a|0;m>=o&&(m=o-1);let A=g/l|0;return A>=r&&(A=r-1),u(n)?(n.x=m,n.y=A,n):new H(m,A)};var Gr=Iy;var c$e=15;function Fb(e){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._ready=!1,this._width=void 0,this._height=void 0,this._encoding=void 0;let t=e.token;this._hasAvailability=!1,this._tilesAvailable=void 0,this._tilesAvailablityLoaded=void 0,this._availableCache={};let n=this,i=y(e.ellipsoid,ie.WGS84);this._readyPromise=Promise.resolve(e.url).then(function(o){let r=Oe.createIfNeeded(o);return r.appendForwardSlash(),u(t)&&(r=r.getDerivedResource({queryParameters:{token:t}})),n._resource=r,r.getDerivedResource({queryParameters:{f:"pjson"}}).fetchJson()}).then(function(o){let r=o.copyrightText;u(r)&&(n._credit=new Zt(r));let s=o.spatialReference,a=y(s.latestWkid,s.wkid),c=o.extent,l={ellipsoid:i};if(a===4326)l.rectangle=ce.fromDegrees(c.xmin,c.ymin,c.xmax,c.ymax),n._tilingScheme=new ji(l);else if(a===3857){let p=Math.PI*i.maximumRadius;o.extent.xmax>p&&(o.extent.xmax=p),o.extent.ymax>p&&(o.extent.ymax=p),o.extent.xmin<-p&&(o.extent.xmin=-p),o.extent.ymin<-p&&(o.extent.ymin=-p),l.rectangleSouthwestInMeters=new H(c.xmin,c.ymin),l.rectangleNortheastInMeters=new H(c.xmax,c.ymax),n._tilingScheme=new Gr(l)}else return Promise.reject(new ue("Invalid spatial reference"));let f=o.tileInfo;return u(f)?(n._width=f.rows+1,n._height=f.cols+1,n._encoding=f.format==="LERC"?bf.LERC:bf.NONE,n._lodCount=f.lods.length-1,(n._hasAvailability=o.capabilities.indexOf("Tilemap")!==-1)&&(n._tilesAvailable=new qd(n._tilingScheme,n._lodCount),n._tilesAvailable.addAvailableTileRange(0,0,0,n._tilingScheme.getNumberOfXTilesAtLevel(0),n._tilingScheme.getNumberOfYTilesAtLevel(0)),n._tilesAvailablityLoaded=new qd(n._tilingScheme,n._lodCount)),n._levelZeroMaximumGeometricError=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._width,n._tilingScheme.getNumberOfXTilesAtLevel(0)),o.bandCount>1&&console.log("ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."),u(o.minValues)&&u(o.maxValues)?n._terrainDataStructure={elementMultiplier:1,lowestEncodedHeight:o.minValues[0],highestEncodedHeight:o.maxValues[0]}:n._terrainDataStructure={elementMultiplier:1},n._ready=!0,!0):Promise.reject(new ue("tileInfo is required"))}).catch(function(o){let r=`An error occurred while accessing ${n._resource.url}.`;return Xn.reportError(void 0,n,n._errorEvent,r),Promise.reject(o)}),this._errorEvent=new Ae}Object.defineProperties(Fb.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){return this._tilesAvailable}}});Fb.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&&!u(sj(this,n+1,e*2,t*2))){let d=Ome(this,n+1,e*2,t*2);s=d.promise,a=d.request}let c=o.fetchArrayBuffer();if(!u(c)||!u(s))return;let l=this,f=this._tilesAvailable;return Promise.all([c,s]).then(function(d){return new ga({buffer:d[0],width:l._width,height:l._height,childTileMask:r?f.computeChildMaskForTile(n,e,t):c$e,structure:l._terrainDataStructure,encoding:l._encoding})}).catch(function(d){return u(a)&&a.state===hi.CANCELLED?(i.cancel(),i.deferred.promise.finally(function(){return i.state=hi.CANCELLED,Promise.reject(d)})):Promise.reject(d)})};function sj(e,t,n,i){if(!e._hasAvailability)return;let o=e._tilesAvailablityLoaded,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}Fb.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};Fb.prototype.getTileDataAvailable=function(e,t,n){if(!this._hasAvailability)return;let i=sj(this,n,e,t);if(u(i))return i;Ome(this,n,e,t)};Fb.prototype.loadTileDataAvailability=function(e,t,n){};function l$e(e,t,n,i){let o=t-1,r=n-1,s=i[e.y*t+e.x],a=[],c={startX:e.x,startY:e.y,endX:0,endY:0},l=new H(e.x+1,e.y+1),f=!1,d=!1;for(;!(f&&d);){let p=l.x,g=d?l.y+1:l.y;if(!f){for(let m=e.y;m<g;++m)if(i[m*t+l.x]!==s){f=!0;break}f?(a.push(new H(l.x,e.y)),--l.x,--p,c.endX=l.x):l.x===o?(c.endX=l.x,f=!0):++l.x}if(!d){let m=l.y*t;for(let A=e.x;A<=p;++A)if(i[m+A]!==s){d=!0;break}d?(a.push(new H(e.x,l.y)),--l.y,c.endY=l.y):l.y===r?(c.endY=l.y,d=!0):++l.y}}return{endingIndices:a,range:c,value:s}}function u$e(e,t,n,i,o){let r=[];if(o.every(function(c){return c===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 c=a.pop(),l=l$e(c,n,i,o);if(l.value===1){let d=l.range;d.startX+=e,d.endX+=e,d.startY+=t,d.endY+=t,r.push(d)}let f=l.endingIndices;f.length>0&&(a=a.concat(f))}return r}function Ome(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}`,c=e._availableCache;if(u(c[a]))return c[a];let l=new zo({throttle:!1,throttleByServer:!0,type:Qr.TERRAIN}),d=e._resource.getDerivedResource({url:a,request:l}).fetchJson();return u(d)?(d=d.then(function(p){let g=u$e(o,r,s,s,p.data);e._tilesAvailablityLoaded.addAvailableTileRange(t,o,r,o+s,r+s);let m=e._tilesAvailable;for(let A=0;A<g.length;++A){let x=g[A];m.addAvailableTileRange(t,x.startX,x.startY,x.endX,x.endY)}return sj(e,t,n,i)}),c[a]={promise:d,request:l},d=d.finally(function(p){return delete c[a],p}),{promise:d,request:l}):{}}var aj=Fb;var Rme="https://dev.virtualearth.net/REST/v1/Locations";function cj(e){e=y(e,y.EMPTY_OBJECT);let t=e.key;this._key=t;let n={key:t};u(e.culture)&&(n.culture=e.culture),this._resource=new Oe({url:Rme,queryParameters:n})}Object.defineProperties(cj.prototype,{url:{get:function(){return Rme}},key:{get:function(){return this._key}}});cj.prototype.geocode=function(e){return 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],c=r[2],l=r[3];return{displayName:o.name,destination:ce.fromDegrees(a,s,l,c)}})})};var lj=cj;function Bme(){}Bme.prototype.geocode=function(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:h.fromDegrees(n,i,o)};return Promise.resolve([r])}}return Promise.resolve([])};var tL=Bme;var f$e=new oe,Mme=new h,Vb=new h;function d$e(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,c){u(c)||(c=new h);let l=(a-i)*o;return h.lerp(r,s,l,c)}}return function(i,o){u(o)||(o=new h);let r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=f$e;a.z=s,a.y=s*s,a.x=a.y*s,a.w=1;let c,l,f,d,p;return r===0?(c=t[0],l=t[1],f=e.firstTangent,d=h.subtract(t[2],c,Mme),h.multiplyByScalar(d,.5,d),p=M.multiplyByVector(Ig.hermiteCoefficientMatrix,a,a)):r===t.length-2?(c=t[r],l=t[r+1],d=e.lastTangent,f=h.subtract(l,t[r-1],Mme),h.multiplyByScalar(f,.5,f),p=M.multiplyByVector(Ig.hermiteCoefficientMatrix,a,a)):(c=t[r-1],l=t[r],f=t[r+1],d=t[r+2],p=M.multiplyByVector(Py.catmullRomCoefficientMatrix,a,a)),o=h.multiplyByScalar(c,p.x,o),h.multiplyByScalar(l,p.y,Vb),h.add(o,Vb,o),h.multiplyByScalar(f,p.z,Vb),h.add(o,Vb,o),h.multiplyByScalar(d,p.w,Vb),h.add(o,Vb,o)}}var h$e=new h,m$e=new h;function Py(e){e=y(e,y.EMPTY_OBJECT);let t=e.points,n=e.times,i=e.firstTangent,o=e.lastTangent;if(t.length>2&&(u(i)||(i=h$e,h.multiplyByScalar(t[1],2,i),h.subtract(i,t[2],i),h.subtract(i,t[0],i),h.multiplyByScalar(i,.5,i)),!u(o))){let r=t.length-1;o=m$e,h.multiplyByScalar(t[r-1],2,o),h.subtract(t[r],o,o),h.add(o,t[r-2],o),h.multiplyByScalar(o,.5,o)}this._times=n,this._points=t,this._firstTangent=h.clone(i),this._lastTangent=h.clone(o),this._evaluateFunction=d$e(this),this._lastTimeIndex=0}Object.defineProperties(Py.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}}});Py.catmullRomCoefficientMatrix=new M(-.5,1,-.5,0,1.5,-2.5,0,1,-1.5,2,.5,0,.5,-.5,0,0);Py.prototype.findTimeInterval=io.prototype.findTimeInterval;Py.prototype.wrapTime=io.prototype.wrapTime;Py.prototype.clampTime=io.prototype.clampTime;Py.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};var uj=Py;var Sz={};Sz.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){u(r)?r.length=0:r=[];let s,a,c;t?(s=n<e,a=i<e,c=o<e):(s=n>e,a=i>e,c=o>e);let l=s+a+c,f,d,p,g,m,A;return l===1?s?(f=(e-n)/(i-n),d=(e-n)/(o-n),r.push(1),r.push(2),d!==1&&(r.push(-1),r.push(0),r.push(2),r.push(d)),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))):c&&(m=(e-o)/(n-o),A=(e-o)/(i-o),r.push(0),r.push(1),A!==1&&(r.push(-1),r.push(2),r.push(1),r.push(A)),m!==1&&(r.push(-1),r.push(2),r.push(0),r.push(m))):l===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?(A=(e-o)/(i-o),f=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(A),r.push(-1),r.push(0),r.push(1),r.push(f)):!c&&o!==e&&(d=(e-n)/(o-n),p=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(d),r.push(-1),r.push(1),r.push(2),r.push(p)):l!==3&&(r.push(0),r.push(1),r.push(2)),r};Sz.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,c){let l=n-s,f=s-o,d=r-a,p=i-a,g=1/(d*l+f*p),m=t-a,A=e-s,x=(d*A+f*m)*g,C=(-p*A+l*m)*g,T=1-x-C;return u(c)?(c.x=x,c.y=C,c.z=T,c):new h(x,C,T)};Sz.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,c){let l=(s-o)*(t-r)-(a-r)*(e-o),f=(n-e)*(t-r)-(i-t)*(e-o),d=(a-r)*(n-e)-(s-o)*(i-t);if(d===0)return;let p=l/d,g=f/d;if(p>=0&&p<=1&&g>=0&&g<=1)return u(c)||(c=new H),c.x=e+p*(n-e),c.y=t+p*(i-t),c};var g_=Sz;function Oy(e){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=vz(e.westIndices,o,t),this._southIndices=vz(e.southIndices,r,t),this._eastIndices=vz(e.eastIndices,o,t),this._northIndices=vz(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=y(e.childTileMask,15),this._createdByUpsampling=y(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(Oy.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return u(this._mesh)}}});var Dz=[];function vz(e,t,n){Dz.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)Dz[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(Dz.sort(t),Fe.createTypedArray(n,Dz)):e}var Lme="createVerticesFromQuantizedTerrainMesh",p$e=new pi(Lme),_$e=new pi(Lme,Yd.maximumAsynchronousTasks);Oy.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),c=t.ellipsoid,l=t.tileXYToRectangle(n,i,o),d=(a?_$e:p$e).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:l,relativeToCenter:this._boundingSphere.center,ellipsoid:c,exaggeration:r,exaggerationRelativeHeight:s});if(!u(d))return;let p=this;return Promise.resolve(d).then(function(g){let m=p._quantizedVertices.length/3,A=m+p._westIndices.length+p._southIndices.length+p._eastIndices.length+p._northIndices.length,x=Fe.createTypedArray(A,g.indices),C=new Float32Array(g.vertices),T=g.center,E=g.minimumHeight,S=g.maximumHeight,D=p._boundingSphere,w=p._orientedBoundingBox,R=y(h.clone(g.occludeePointInScaledSpace),p._horizonOcclusionPoint),O=g.vertexStride,L=oc.clone(g.encoding);return p._mesh=new Df(T,C,x,g.indexCountWithoutSkirts,m,E,S,D,R,O,w,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 g$e=new pi("upsampleQuantizedTerrainMesh",Yd.maximumAsynchronousTasks);Oy.prototype.upsample=function(e,t,n,i,o,r,s){let a=this._mesh;if(!u(this._mesh))return;let c=t*2!==o,l=n*2===r,f=e.ellipsoid,d=e.tileXYToRectangle(o,r,s),p=g$e.scheduleTask({vertices:a.vertices,vertexCountWithoutSkirts:a.vertexCountWithoutSkirts,indices:a.indices,indexCountWithoutSkirts:a.indexCountWithoutSkirts,encoding:a.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:f});if(!u(p))return;let g=Math.min(this._westSkirtHeight,this._eastSkirtHeight);g=Math.min(g,this._southSkirtHeight),g=Math.min(g,this._northSkirtHeight);let m=c?g*.5:this._westSkirtHeight,A=l?g*.5:this._southSkirtHeight,x=c?this._eastSkirtHeight:g*.5,C=l?this._northSkirtHeight:g*.5,T=this._credits;return Promise.resolve(p).then(function(E){let S=new Uint16Array(E.vertices),D=Fe.createTypedArray(S.length/3,E.indices),w;return u(E.encodedNormals)&&(w=new Uint8Array(E.encodedNormals)),new Oy({quantizedVertices:S,indices:D,encodedNormals:w,minimumHeight:E.minimumHeight,maximumHeight:E.maximumHeight,boundingSphere:se.clone(E.boundingSphere),orientedBoundingBox:Rn.clone(E.orientedBoundingBox),horizonOcclusionPoint:h.clone(E.horizonOcclusionPoint),westIndices:E.westIndices,southIndices:E.southIndices,eastIndices:E.eastIndices,northIndices:E.northIndices,westSkirtHeight:m,southSkirtHeight:A,eastSkirtHeight:x,northSkirtHeight:C,childTileMask:0,credits:T,createdByUpsampling:!0})})};var fj=32767,Nme=new h;Oy.prototype.interpolateHeight=function(e,t,n){let i=P.clamp((t-e.west)/e.width,0,1);i*=fj;let o=P.clamp((n-e.south)/e.height,0,1);return o*=fj,u(this._mesh)?C$e(this,i,o):T$e(this,i,o)};function Fme(e,t,n,i,o,r,s,a){let c=Math.min(n,o,s),l=Math.max(n,o,s),f=Math.min(i,r,a),d=Math.max(i,r,a);return e>=c&&e<=l&&t>=f&&t<=d}var y$e=new H,A$e=new H,x$e=new H;function C$e(e,t,n){let i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,c=s.length;a<c;a+=3){let l=s[a],f=s[a+1],d=s[a+2],p=r.decodeTextureCoordinates(o,l,y$e),g=r.decodeTextureCoordinates(o,f,A$e),m=r.decodeTextureCoordinates(o,d,x$e);if(Fme(t,n,p.x,p.y,g.x,g.y,m.x,m.y)){let A=g_.computeBarycentricCoordinates(t,n,p.x,p.y,g.x,g.y,m.x,m.y,Nme);if(A.x>=-1e-15&&A.y>=-1e-15&&A.z>=-1e-15){let x=r.decodeHeight(o,l),C=r.decodeHeight(o,f),T=r.decodeHeight(o,d);return A.x*x+A.y*C+A.z*T}}}}function T$e(e,t,n){let i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,c=s.length;a<c;a+=3){let l=s[a],f=s[a+1],d=s[a+2],p=i[l],g=i[f],m=i[d],A=o[l],x=o[f],C=o[d];if(Fme(t,n,p,A,g,x,m,C)){let T=g_.computeBarycentricCoordinates(t,n,p,A,g,x,m,C,Nme);if(T.x>=-1e-15&&T.y>=-1e-15&&T.z>=-1e-15){let E=T.x*r[l]+T.y*r[f]+T.z*r[d];return P.lerp(e._minimumHeight,e._maximumHeight,E/fj)}}}}Oy.prototype.isChildAvailable=function(e,t,n,i){let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Oy.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var Mx=Oy;function E$e(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 Lx(e){this._heightmapWidth=65,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=y(e.requestVertexNormals,!1),this._requestWaterMask=y(e.requestWaterMask,!1),this._requestMetadata=y(e.requestMetadata,!0),this._errorEvent=new Ae;let t=e.credit;typeof t=="string"&&(t=new Zt(t)),this._credit=t,this._availability=void 0,this._ready=!1,this._tileCredits=void 0;let n=this,i,o,r,s=this._layers=[],a="",c=[],l=0;this._readyPromise=Promise.resolve(e.url).then(function(A){let x=Oe.createIfNeeded(A);return x.appendForwardSlash(),i=x,o=i.getDerivedResource({url:"layer.json"}),n._tileCredits=x.credits,m()});function f(A){let x;if(!A.format)return x="The tile format is not specified in the layer.json file.",r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x));if(!A.tiles||A.tiles.length===0)return x="The layer.json file does not specify any tile URL templates.",r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x));let C=!1,T=!1,E=!1,S=!0,D=!1;if(A.format==="heightmap-1.0")D=!0,u(n._heightmapStructure)||(n._heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),T=!0,n._requestWaterMask=!0;else if(A.format.indexOf("quantized-mesh-1.")!==0)return x=`The tile format "${A.format}" is invalid or not supported.`,r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x));let w=A.tiles,R=A.maxzoom;if(l=Math.max(l,R),!A.projection||A.projection==="EPSG:4326")n._tilingScheme=new ji({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else if(A.projection==="EPSG:3857")n._tilingScheme=new Gr({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else return x=`The projection "${A.projection}" is invalid or not supported.`,r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x));if(n._levelZeroMaximumGeometricError=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._heightmapWidth,n._tilingScheme.getNumberOfXTilesAtLevel(0)),!A.scheme||A.scheme==="tms"||A.scheme==="slippyMap")n._scheme=A.scheme;else return x=`The scheme "${A.scheme}" is invalid or not supported.`,r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x));let O;u(A.extensions)&&A.extensions.indexOf("octvertexnormals")!==-1?C=!0:u(A.extensions)&&A.extensions.indexOf("vertexnormals")!==-1&&(C=!0,S=!1),u(A.extensions)&&A.extensions.indexOf("watermask")!==-1&&(T=!0),u(A.extensions)&&A.extensions.indexOf("metadata")!==-1&&(E=!0);let L=A.metadataAvailability,N=A.available,_;if(u(N)&&!u(L)){_=new qd(n._tilingScheme,N.length);for(let v=0;v<N.length;++v){let I=N[v],B=n._tilingScheme.getNumberOfYTilesAtLevel(v);u(c[v])||(c[v]=[]);for(let F=0;F<I.length;++F){let k=I[F],U=B-k.endY-1,G=B-k.startY-1;c[v].push([k.startX,U,k.endX,G]),_.addAvailableTileRange(v,k.startX,U,k.endX,G)}}}else u(L)&&(O=new qd(n._tilingScheme,R),_=new qd(n._tilingScheme,R),c[0]=[[0,0,1,0]],_.addAvailableTileRange(0,0,0,1,0));n._hasWaterMask=n._hasWaterMask||T,n._hasVertexNormals=n._hasVertexNormals||C,n._hasMetadata=n._hasMetadata||E,u(A.attribution)&&(a.length>0&&(a+=" "),a+=A.attribution),s.push(new E$e({resource:i,version:A.version,isHeightmap:D,tileUrlTemplates:w,availability:_,hasVertexNormals:C,hasWaterMask:T,hasMetadata:E,availabilityLevels:L,availabilityTilesLoaded:O,littleEndianExtensionSize:S}));let b=A.parentUrl;if(u(b)){if(!u(_))return console.log("A layer.json can't have a parentUrl if it does't have an available array."),Promise.resolve(!0);i=i.getDerivedResource({url:b}),i.appendForwardSlash(),o=i.getDerivedResource({url:"layer.json"});let v=o.fetchJson();return Promise.resolve(v).then(f).catch(d)}return Promise.resolve(!0)}function d(A){let x=`An error occurred while accessing ${o.url}.`;return r=Xn.reportError(r,n,n._errorEvent,x),r.retry?m():Promise.reject(new ue(x))}function p(A){return f(A).then(function(){if(u(r))return;let x=c.length;if(x>0){let C=n._availability=new qd(n._tilingScheme,l);for(let T=0;T<x;++T){let E=c[T];for(let S=0;S<E.length;++S){let D=E[S];C.addAvailableTileRange(T,D[0],D[1],D[2],D[3])}}}if(a.length>0){let C=new Zt(a);u(n._tileCredits)?n._tileCredits.push(C):n._tileCredits=[C]}return n._ready=!0,Promise.resolve(!0)})}function g(A){return u(A)&&A.statusCode===404?p({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):d(A)}function m(){return Promise.resolve(o.fetchJson()).then(p).catch(g)}}var dj={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function Vme(e){return!u(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 b$e(e,t,n,i,o){let r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new ga({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 S$e(e,t,n,i,o,r){let s=r.littleEndianExtensionSize,a=0,c=3,l=c+1,f=Float64Array.BYTES_PER_ELEMENT*c,d=Float64Array.BYTES_PER_ELEMENT*l,p=3,g=Uint16Array.BYTES_PER_ELEMENT*p,m=3,A=Uint16Array.BYTES_PER_ELEMENT,x=A*m,C=new DataView(t),T=new h(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0));a+=f;let E=C.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let S=C.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;let D=new se(new h(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0)),C.getFloat64(a+f,!0));a+=d;let w=new h(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0));a+=f;let R=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let O=new Uint16Array(t,a,R*3);a+=R*g,R>64*1024&&(A=Uint32Array.BYTES_PER_ELEMENT,x=A*m);let L=O.subarray(0,R),N=O.subarray(R,2*R),_=O.subarray(R*2,3*R);Gn.zigZagDeltaDecode(L,N,_),a%A!==0&&(a+=A-a%A);let b=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let v=Fe.createTypedArrayFromArrayBuffer(R,t,a,b*m);a+=b*x;let I=0,B=v.length;for(let re=0;re<B;++re){let ye=v[re];v[re]=I-ye,ye===0&&++I}let F=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let k=Fe.createTypedArrayFromArrayBuffer(R,t,a,F);a+=F*A;let U=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let G=Fe.createTypedArrayFromArrayBuffer(R,t,a,U);a+=U*A;let V=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let X=Fe.createTypedArrayFromArrayBuffer(R,t,a,V);a+=V*A;let j=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;let Q=Fe.createTypedArrayFromArrayBuffer(R,t,a,j);a+=j*A;let W,K;for(;a<C.byteLength;){let re=C.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;let ye=C.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,re===dj.OCT_VERTEX_NORMALS&&e._requestVertexNormals)W=new Uint8Array(t,a,R*2);else if(re===dj.WATER_MASK&&e._requestWaterMask)K=new Uint8Array(t,a,ye);else if(re===dj.METADATA&&e._requestMetadata){let fe=C.getUint32(a,!0);if(fe>0){let we=Oo(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,fe).available;if(u(we))for(let Ve=0;Ve<we.length;++Ve){let qe=n+Ve+1,mt=we[Ve],Ht=e._tilingScheme.getNumberOfYTilesAtLevel(qe);for(let fn=0;fn<mt.length;++fn){let dt=mt[fn],Tn=Ht-dt.endY-1,Jn=Ht-dt.startY-1;e.availability.addAvailableTileRange(qe,dt.startX,Tn,dt.endX,Jn),r.availability.addAvailableTileRange(qe,dt.startX,Tn,dt.endX,Jn)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=ye}let J=e.getLevelMaximumGeometricError(n)*5,_e=e._tilingScheme.tileXYToRectangle(i,o,n),xe=Rn.fromRectangle(_e,E,S,e._tilingScheme.ellipsoid);return new Mx({center:T,minimumHeight:E,maximumHeight:S,boundingSphere:D,orientedBoundingBox:xe,horizonOcclusionPoint:w,quantizedVertices:O,encodedNormals:W,indices:v,westIndices:k,southIndices:G,eastIndices:X,northIndices:Q,westSkirtHeight:J,southSkirtHeight:J,eastSkirtHeight:J,northSkirtHeight:J,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:K,credits:e._tileCredits})}Lx.prototype.requestTileGeometry=function(e,t,n,i){let o=this._layers,r,s=o.length;if(s===1)r=o[0];else for(let a=0;a<s;++a){let c=o[a];if(!u(c.availability)||c.availability.isTileAvailable(n,e,t)){r=c;break}}return Ume(this,e,t,n,r,i)};function Ume(e,t,n,i,o,r){if(!u(o))return Promise.reject(new ue("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 c=[];e._requestVertexNormals&&o.hasVertexNormals&&c.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&c.push("watermask"),e._requestMetadata&&o.hasMetadata&&c.push("metadata");let l,f,d=s[(t+a+i)%s.length],p=o.resource;u(p._ionEndpoint)&&!u(p._ionEndpoint.externalType)?(c.length!==0&&(f={extensions:c.join("-")}),l=Vme(void 0)):l=Vme(c);let g=p.getDerivedResource({url:d,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:f,headers:l,request:r}).fetchArrayBuffer();if(u(g))return g.then(function(m){return u(m)?u(e._heightmapStructure)?b$e(e,m,i,t,n):S$e(e,m,i,t,n,o):Promise.reject(new ue("Mesh buffer doesn't exist."))})}Object.defineProperties(Lx.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},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}}});Lx.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};Lx.prototype.getTileDataAvailable=function(e,t,n){if(!u(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(kme(this,e,t,n,i[r],r===0).result)return;return!1};Lx.prototype.loadTileDataAvailability=function(e,t,n){if(!u(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=kme(this,e,t,n,i[r],r===0);if(u(s.promise))return s.promise}};function hj(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,c=n/s|0;return{level:r,x:a,y:c}}function kme(e,t,n,i,o,r){if(!u(o.availabilityLevels))return{result:!1};let s,a=function(){delete o.availabilityPromiseCache[s]},c=o.availabilityTilesLoaded,l=o.availability,f=hj(o,t,n,i);for(;u(f);){if(l.isTileAvailable(f.level,f.x,f.y)&&!c.isTileAvailable(f.level,f.x,f.y)){let d;if(!r&&(s=`${f.level}-${f.x}-${f.y}`,d=o.availabilityPromiseCache[s],!u(d))){let p=new zo({throttle:!1,throttleByServer:!0,type:Qr.TERRAIN});d=Ume(e,f.x,f.y,f.level,o,p),u(d)&&(o.availabilityPromiseCache[s]=d,d.then(a))}return{result:!0,promise:d}}f=hj(o,f.x,f.y,f.level)}return{result:!1}}Lx._getAvailabilityTile=hj;var nL=Lx;function y_(e){e=y(e,y.EMPTY_OBJECT);let t=e.radius,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 Fc(n),this._workerName="createCircleGeometry"}y_.packedLength=Fc.packedLength;y_.pack=function(e,t,n){return Fc.pack(e._ellipseGeometry,t,n)};var D$e=new Fc({center:new h,semiMajorAxis:1,semiMinorAxis:1}),rc={center:new h,radius:void 0,ellipsoid:ie.clone(ie.UNIT_SPHERE),height:void 0,extrudedHeight:void 0,granularity:void 0,vertexFormat:new Ie,stRotation:void 0,semiMajorAxis:void 0,semiMinorAxis:void 0,shadowVolume:void 0};y_.unpack=function(e,t,n){let i=Fc.unpack(e,t,D$e);return rc.center=h.clone(i._center,rc.center),rc.ellipsoid=ie.clone(i._ellipsoid,rc.ellipsoid),rc.height=i._height,rc.extrudedHeight=i._extrudedHeight,rc.granularity=i._granularity,rc.vertexFormat=Ie.clone(i._vertexFormat,rc.vertexFormat),rc.stRotation=i._stRotation,rc.shadowVolume=i._shadowVolume,u(n)?(rc.semiMajorAxis=i._semiMajorAxis,rc.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new Fc(rc),n):(rc.radius=i._semiMajorAxis,new y_(rc))};y_.createGeometry=function(e){return Fc.createGeometry(e._ellipseGeometry)};y_.createShadowVolume=function(e,t,n){let i=e._ellipseGeometry._granularity,o=e._ellipseGeometry._ellipsoid,r=t(i,o),s=n(i,o);return new y_({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(y_.prototype,{rectangle:{get:function(){return this._ellipseGeometry.rectangle}},textureCoordinateRotationPoints:{get:function(){return this._ellipseGeometry.textureCoordinateRotationPoints}}});var mj=y_;function Ub(e){e=y(e,y.EMPTY_OBJECT);let t=e.radius,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 au(n),this._workerName="createCircleOutlineGeometry"}Ub.packedLength=au.packedLength;Ub.pack=function(e,t,n){return au.pack(e._ellipseGeometry,t,n)};var v$e=new au({center:new h,semiMajorAxis:1,semiMinorAxis:1}),xu={center:new h,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};Ub.unpack=function(e,t,n){let i=au.unpack(e,t,v$e);return xu.center=h.clone(i._center,xu.center),xu.ellipsoid=ie.clone(i._ellipsoid,xu.ellipsoid),xu.height=i._height,xu.extrudedHeight=i._extrudedHeight,xu.granularity=i._granularity,xu.numberOfVerticalLines=i._numberOfVerticalLines,u(n)?(xu.semiMajorAxis=i._semiMajorAxis,xu.semiMinorAxis=i._semiMinorAxis,n._ellipseGeometry=new au(xu),n):(xu.radius=i._semiMajorAxis,new Ub(xu))};Ub.createGeometry=function(e){return au.createGeometry(e._ellipseGeometry)};var pj=Ub;function kb(e){e=y(e,y.EMPTY_OBJECT),this._callback=e.callback,this._tilingScheme=e.tilingScheme,u(this._tilingScheme)||(this._tilingScheme=new ji({ellipsoid:y(e.ellipsoid,ie.WGS84)})),this._width=e.width,this._height=e.height;let t=Math.max(this._width,this._height);this._levelZeroMaximumGeometricError=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,t,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Ae;let n=e.credit;typeof n=="string"&&(n=new Zt(n)),this._credit=n,this._readyPromise=Promise.resolve(!0)}Object.defineProperties(kb.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});kb.prototype.requestTileGeometry=function(e,t,n,i){let o=this._callback(e,t,n);if(!u(o))return;let r=this._width,s=this._height;return Promise.resolve(o).then(function(a){let c=a;return Array.isArray(c)&&(c=new Float64Array(c)),new ga({buffer:c,width:r,height:s})})};kb.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};kb.prototype.getTileDataAvailable=function(e,t,n){};kb.prototype.loadTileDataAvailability=function(e,t,n){};var _j=kb;function zme(e){this.proxy=e}zme.prototype.getURL=function(e){let t=this.proxy.indexOf("?")===-1?"?":"";return this.proxy+t+encodeURIComponent(e)};var gj=zme;function Xd(e){this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=u(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(Xd.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(u(e)){for(;this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});Xd.prototype.clone=function(){let e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new Xd({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};Xd.prototype.reset=function(){this._length=0;let e=this._maximumLength;if(u(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};Xd.prototype.resort=function(){let e=this._length;for(let t=0;t<e;t++)Hme(this,t)};Xd.prototype.insert=function(e){let t,n=this._maximumLength;if(u(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++,Hme(this,i),t};Xd.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],Gme(this,0)),this._array[e-1]=void 0,t};Xd.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=yj(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&Gme(this,n)}return this._array[e-1]=void 0,t};Xd.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};Xd.prototype.getMaximum=function(){let e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[yj(this,1,2)?1:2]};function wz(e,t,n){let i=e._array,o=i[t];i[t]=i[n],i[n]=o}function iL(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function yj(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function Hme(e,t){if(t===0)return;let n=Math.floor(P.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=iL(e,t,i);for(o!==n&&(wz(e,t,i),t=i);t>=3;){let r=Math.floor((t-3)/4);if(iL(e,t,r)!==o)break;wz(e,t,r),t=r}}function Gme(e,t){let n=e._length,i=Math.floor(P.log2(t+1))%2===0,o;for(;(o=2*t+1)<n;){let r=o,s=o+1;if(s<n){iL(e,s,r)===i&&(r=s);let a=2*o+1,c=Math.max(Math.min(n-a,4),0);for(let l=0;l<c;l++){let f=a+l;iL(e,f,r)===i&&(r=f)}}if(iL(e,r,t)===i&&(wz(e,r,t),r!==o&&r!==s)){let a=Math.floor((r-1)/2);yj(e,r,a)===i&&wz(e,r,a)}t=r}}var Nx=Xd;function zb(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,u(this._tilingScheme)||(this._tilingScheme=new ji({ellipsoid:y(e.ellipsoid,ie.WGS84)})),this._levelZeroMaximumGeometricError=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Ae,this._readyPromise=Promise.resolve(!0)}Object.defineProperties(zb.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});zb.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new ga({buffer:new Uint8Array(16*16),width:16,height:16}))};zb.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};zb.prototype.getTileDataAvailable=function(e,t,n){};zb.prototype.loadTileDataAvailability=function(e,t,n){};var A_=zb;function lm(e){e=y(e,y.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=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new $r,this._perspectiveMatrix=new M,this._infinitePerspective=new M}function Aj(e){let t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far)&&(e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=M.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=M.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective))}Object.defineProperties(lm.prototype,{projectionMatrix:{get:function(){return Aj(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return Aj(this),this._infinitePerspective}}});var w$e=new h,I$e=new h,P$e=new h,O$e=new h;lm.prototype.computeCullingVolume=function(e,t,n){let i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,l=this.far,f=h.cross(t,n,w$e),d=I$e;h.multiplyByScalar(t,c,d),h.add(e,d,d);let p=P$e;h.multiplyByScalar(t,l,p),h.add(e,p,p);let g=O$e;h.multiplyByScalar(f,a,g),h.add(d,g,g),h.subtract(g,e,g),h.normalize(g,g),h.cross(g,n,g),h.normalize(g,g);let m=i[0];return u(m)||(m=i[0]=new oe),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-h.dot(g,e),h.multiplyByScalar(f,s,g),h.add(d,g,g),h.subtract(g,e,g),h.cross(n,g,g),h.normalize(g,g),m=i[1],u(m)||(m=i[1]=new oe),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-h.dot(g,e),h.multiplyByScalar(n,r,g),h.add(d,g,g),h.subtract(g,e,g),h.cross(f,g,g),h.normalize(g,g),m=i[2],u(m)||(m=i[2]=new oe),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-h.dot(g,e),h.multiplyByScalar(n,o,g),h.add(d,g,g),h.subtract(g,e,g),h.cross(g,f,g),h.normalize(g,g),m=i[3],u(m)||(m=i[3]=new oe),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-h.dot(g,e),m=i[4],u(m)||(m=i[4]=new oe),m.x=t.x,m.y=t.y,m.z=t.z,m.w=-h.dot(t,d),h.negate(t,g),m=i[5],u(m)||(m=i[5]=new oe),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-h.dot(g,p),this._cullingVolume};lm.prototype.getPixelDimensions=function(e,t,n,i,o){Aj(this);let r=1/this.near,s=this.top*r,a=2*i*n*s/t;s=this.right*r;let c=2*i*n*s/e;return o.x=c,o.y=a,o};lm.prototype.clone=function(e){return u(e)||(e=new lm),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};lm.prototype.equals=function(e){return u(e)&&e instanceof lm&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};lm.prototype.equalsEpsilon=function(e,t,n){return e===this||u(e)&&e instanceof lm&&P.equalsEpsilon(this.right,e.right,t,n)&&P.equalsEpsilon(this.left,e.left,t,n)&&P.equalsEpsilon(this.top,e.top,t,n)&&P.equalsEpsilon(this.bottom,e.bottom,t,n)&&P.equalsEpsilon(this.near,e.near,t,n)&&P.equalsEpsilon(this.far,e.far,t,n)};var zc=lm;function vl(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new zc,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=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this.xOffset=y(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=y(e.yOffset,0),this._yOffset=this.yOffset}vl.packedLength=6;vl.pack=function(e,t,n){return n=y(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};vl.unpack=function(e,t,n){return t=y(t,0),u(n)||(n=new vl),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 um(e){let t=e._offCenterFrustum;(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset)&&(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,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}Object.defineProperties(vl.prototype,{projectionMatrix:{get:function(){return um(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return um(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return um(this),this._fovy}},sseDenominator:{get:function(){return um(this),this._sseDenominator}}});vl.prototype.computeCullingVolume=function(e,t,n){return um(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};vl.prototype.getPixelDimensions=function(e,t,n,i,o){return um(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};vl.prototype.clone=function(e){return u(e)||(e=new vl),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};vl.prototype.equals=function(e){return!u(e)||!(e instanceof vl)?!1:(um(this),um(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};vl.prototype.equalsEpsilon=function(e,t,n){return!u(e)||!(e instanceof vl)?!1:(um(this),um(e),P.equalsEpsilon(this.fov,e.fov,t,n)&&P.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};var Ti=vl;var Iz=0,R$e=1;function Fx(e){let t=e.frustum,n=e.orientation,i=e.origin,o=y(e.vertexFormat,Ie.DEFAULT),r=y(e._drawNearPlane,!0),s,a;t instanceof Ti?(s=Iz,a=Ti.packedLength):t instanceof en&&(s=R$e,a=en.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=h.clone(i),this._orientation=Le.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+h.packedLength+Le.packedLength+Ie.packedLength}Fx.pack=function(e,t,n){n=y(n,0);let i=e._frustumType,o=e._frustum;return t[n++]=i,i===Iz?(Ti.pack(o,t,n),n+=Ti.packedLength):(en.pack(o,t,n),n+=en.packedLength),h.pack(e._origin,t,n),n+=h.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 B$e=new Ti,M$e=new en,L$e=new Le,N$e=new h,F$e=new Ie;Fx.unpack=function(e,t,n){t=y(t,0);let i=e[t++],o;i===Iz?(o=Ti.unpack(e,t,B$e),t+=Ti.packedLength):(o=en.unpack(e,t,M$e),t+=en.packedLength);let r=h.unpack(e,t,N$e);t+=h.packedLength;let s=Le.unpack(e,t,L$e);t+=Le.packedLength;let a=Ie.unpack(e,t,F$e);t+=Ie.packedLength;let c=e[t]===1;if(!u(n))return new Fx({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:c});let l=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(l),n._frustumType=i,n._origin=h.clone(r,n._origin),n._orientation=Le.clone(s,n._orientation),n._vertexFormat=Ie.clone(a,n._vertexFormat),n._drawNearPlane=c,n};function Hb(e,t,n,i,o,r,s,a){let c=e/3*2;for(let l=0;l<4;++l)u(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),u(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),u(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[c]=0,o[c+1]=0,o[c+2]=1,o[c+3]=0,o[c+4]=1,o[c+5]=1,o[c+6]=0,o[c+7]=1}var V$e=new Z,U$e=new M,xj=new M,Wme=new h,jme=new h,Yme=new h,k$e=new h,z$e=new h,H$e=new h,Ry=new Array(3),oL=new Array(4);oL[0]=new oe(-1,-1,1,1);oL[1]=new oe(1,-1,1,1);oL[2]=new oe(1,1,1,1);oL[3]=new oe(-1,1,1,1);var qme=new Array(4);for(let e=0;e<4;++e)qme[e]=new oe;Fx._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){let c=Z.fromQuaternion(t,V$e),l=y(r,Wme),f=y(s,jme),d=y(a,Yme);l=Z.getColumn(c,0,l),f=Z.getColumn(c,1,f),d=Z.getColumn(c,2,d),h.normalize(l,l),h.normalize(f,f),h.normalize(d,d),h.negate(l,l);let p=M.computeView(e,d,f,l,U$e),g,m;if(n===Iz){let A=i.projectionMatrix,x=M.multiply(A,p,xj);m=M.inverse(x,xj)}else g=M.inverseTransformation(p,xj);u(m)?(Ry[0]=i.near,Ry[1]=i.far):(Ry[0]=0,Ry[1]=i.near,Ry[2]=i.far);for(let A=0;A<2;++A)for(let x=0;x<4;++x){let C=oe.clone(oL[x],qme[x]);if(u(m)){C=M.multiplyByVector(m,C,C);let T=1/C.w;h.multiplyByScalar(C,T,C),h.subtract(C,e,C),h.normalize(C,C);let E=h.dot(d,C);h.multiplyByScalar(C,Ry[A]/E,C),h.add(C,e,C)}else{u(i._offCenterFrustum)&&(i=i._offCenterFrustum);let T=Ry[A],E=Ry[A+1];C.x=(C.x*(i.right-i.left)+i.left+i.right)*.5,C.y=(C.y*(i.top-i.bottom)+i.bottom+i.top)*.5,C.z=(C.z*(T-E)-T-E)*.5,C.w=1,M.multiplyByVector(g,C,C)}o[12*A+x*3]=C.x,o[12*A+x*3+1]=C.y,o[12*A+x*3+2]=C.z}};Fx.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,c=new Float64Array(3*4*6);Fx._computeNearFarPlanes(i,o,t,n,c);let l=3*4*2;c[l]=c[3*4],c[l+1]=c[3*4+1],c[l+2]=c[3*4+2],c[l+3]=c[0],c[l+4]=c[1],c[l+5]=c[2],c[l+6]=c[3*3],c[l+7]=c[3*3+1],c[l+8]=c[3*3+2],c[l+9]=c[3*7],c[l+10]=c[3*7+1],c[l+11]=c[3*7+2],l+=3*4,c[l]=c[3*5],c[l+1]=c[3*5+1],c[l+2]=c[3*5+2],c[l+3]=c[3],c[l+4]=c[3+1],c[l+5]=c[3+2],c[l+6]=c[0],c[l+7]=c[1],c[l+8]=c[2],c[l+9]=c[3*4],c[l+10]=c[3*4+1],c[l+11]=c[3*4+2],l+=3*4,c[l]=c[3],c[l+1]=c[3+1],c[l+2]=c[3+2],c[l+3]=c[3*5],c[l+4]=c[3*5+1],c[l+5]=c[3*5+2],c[l+6]=c[3*6],c[l+7]=c[3*6+1],c[l+8]=c[3*6+2],c[l+9]=c[3*2],c[l+10]=c[3*2+1],c[l+11]=c[3*2+2],l+=3*4,c[l]=c[3*2],c[l+1]=c[3*2+1],c[l+2]=c[3*2+2],c[l+3]=c[3*6],c[l+4]=c[3*6+1],c[l+5]=c[3*6+2],c[l+6]=c[3*7],c[l+7]=c[3*7+1],c[l+8]=c[3*7+2],c[l+9]=c[3*3],c[l+10]=c[3*3+1],c[l+11]=c[3*3+2],r||(c=c.subarray(3*4));let f=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:c})});if(u(s.normal)||u(s.tangent)||u(s.bitangent)||u(s.st)){let p=u(s.normal)?new Float32Array(12*a):void 0,g=u(s.tangent)?new Float32Array(3*4*a):void 0,m=u(s.bitangent)?new Float32Array(3*4*a):void 0,A=u(s.st)?new Float32Array(2*4*a):void 0,x=Wme,C=jme,T=Yme,E=h.negate(x,k$e),S=h.negate(C,z$e),D=h.negate(T,H$e);l=0,r&&(Hb(l,p,g,m,A,D,x,C),l+=3*4),Hb(l,p,g,m,A,T,E,C),l+=3*4,Hb(l,p,g,m,A,E,D,C),l+=3*4,Hb(l,p,g,m,A,S,D,E),l+=3*4,Hb(l,p,g,m,A,x,T,C),l+=3*4,Hb(l,p,g,m,A,C,T,E),u(p)&&(f.normal=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:p})),u(g)&&(f.tangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:g})),u(m)&&(f.bitangent=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:m})),u(A)&&(f.st=new ve({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:A}))}let d=new Uint16Array(6*a);for(let p=0;p<a;++p){let g=p*6,m=p*4;d[g]=m,d[g+1]=m+1,d[g+2]=m+2,d[g+3]=m,d[g+4]=m+2,d[g+5]=m+3}return new ct({attributes:f,indices:d,primitiveType:Me.TRIANGLES,boundingSphere:se.fromVertices(c)})};var Vx=Fx;var Cj=0,G$e=1;function rL(e){let t=e.frustum,n=e.orientation,i=e.origin,o=y(e._drawNearPlane,!0),r,s;t instanceof Ti?(r=Cj,s=Ti.packedLength):t instanceof en&&(r=G$e,s=en.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=h.clone(i),this._orientation=Le.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+h.packedLength+Le.packedLength}rL.pack=function(e,t,n){n=y(n,0);let i=e._frustumType,o=e._frustum;return t[n++]=i,i===Cj?(Ti.pack(o,t,n),n+=Ti.packedLength):(en.pack(o,t,n),n+=en.packedLength),h.pack(e._origin,t,n),n+=h.packedLength,Le.pack(e._orientation,t,n),n+=Le.packedLength,t[n]=e._drawNearPlane?1:0,t};var W$e=new Ti,j$e=new en,Y$e=new Le,q$e=new h;rL.unpack=function(e,t,n){t=y(t,0);let i=e[t++],o;i===Cj?(o=Ti.unpack(e,t,W$e),t+=Ti.packedLength):(o=en.unpack(e,t,j$e),t+=en.packedLength);let r=h.unpack(e,t,q$e);t+=h.packedLength;let s=Le.unpack(e,t,Y$e);t+=Le.packedLength;let a=e[t]===1;if(!u(n))return new rL({frustum:o,origin:r,orientation:s,_drawNearPlane:a});let c=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(c),n._frustumType=i,n._origin=h.clone(r,n._origin),n._orientation=Le.clone(s,n._orientation),n._drawNearPlane=a,n};rL.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);Vx._computeNearFarPlanes(i,o,t,n,s);let a=new dn({position:new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:s})}),c,l,f=r?2:1,d=new Uint16Array(8*(f+1)),p=r?0:1;for(;p<2;++p)c=r?p*8:0,l=p*4,d[c]=l,d[c+1]=l+1,d[c+2]=l+1,d[c+3]=l+2,d[c+4]=l+2,d[c+5]=l+3,d[c+6]=l+3,d[c+7]=l;for(p=0;p<2;++p)c=(f+p)*8,l=p*4,d[c]=l,d[c+1]=l+4,d[c+2]=l+1,d[c+3]=l+5,d[c+4]=l+2,d[c+5]=l+6,d[c+6]=l+3,d[c+7]=l+7;return new ct({attributes:a,indices:d,primitiveType:Me.LINES,boundingSphere:se.fromVertices(s)})};var sL=rL;var X$e={SEARCH:0,AUTOCOMPLETE:1},By=Object.freeze(X$e);function Xme(){}Xme.prototype.geocode=de.throwInstantiationError;var Tj=Xme;function Kme(){de.throwInstantiationError()}Kme.createGeometry=function(e){de.throwInstantiationError()};var Ej=Kme;var eet=vo(bj(),1);function K$e(e,t){return(e&t)!==0}var sc=K$e;var Z$e=[1,2,4,8],Zme=15,J$e=16,Q$e=64,$$e=128;function fm(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}fm.clone=function(e,t){return u(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 fm(e._bits,e.cnodeVersion,e.imageryVersion,e.terrainVersion,e.imageryProvider,e.terrainProvider),t.ancestorHasTerrain=e.ancestorHasTerrain,t.terrainState=e.terrainState,t};fm.prototype.setParent=function(e){this.ancestorHasTerrain=e.ancestorHasTerrain||this.hasTerrain()};fm.prototype.hasSubtree=function(){return sc(this._bits,J$e)};fm.prototype.hasImagery=function(){return sc(this._bits,Q$e)};fm.prototype.hasTerrain=function(){return sc(this._bits,$$e)};fm.prototype.hasChildren=function(){return sc(this._bits,Zme)};fm.prototype.hasChild=function(e){return sc(this._bits,Z$e[e])};fm.prototype.getChildBitmask=function(){return this._bits&Zme};var aL=fm;function tet(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 net=tet(`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 Kd(e){let t=e;typeof t!="string"&&!(t instanceof Oe)&&(t=e.url);let n=Oe.createIfNeeded(t);n.appendForwardSlash(),this._resource=n,this.imageryPresent=!0,this.protoImagery=void 0,this.terrainPresent=!0,this.negativeAltitudeExponentBias=32,this.negativeAltitudeThreshold=P.EPSILON12,this.providers={},this.key=void 0,this._quadPacketVersion=1,this._tileInfo={},this._subtreePromises={};let i=this;this._readyPromise=iet(this).then(function(){return i.getQuadTreePacket("",i._quadPacketVersion)}).then(function(){return!0}).catch(function(o){let r=`An error occurred while accessing ${Qme(i,"",1).url}.`;return Promise.reject(new ue(r))})}Object.defineProperties(Kd.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},resource:{get:function(){return this._resource}},readyPromise:{get:function(){return this._readyPromise}}});Kd.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){let r=1<<o,s=0;sc(t,r)?sc(e,r)&&(s|=1):(s|=2,sc(e,r)||(s|=1)),i+=s}return i};Kd.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];sc(s,2)?sc(s,1)||(t|=r):(n|=r,sc(s,1)&&(t|=r))}return{x:t,y:n,level:i}};Kd.prototype.isValid=function(e){let t=this.getTileInformationFromQuadKey(e);if(u(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),u(t)){!t.hasSubtree()&&!t.hasChild(parseInt(o))&&(n=!1);break}else if(t===null){n=!1;break}return n};var Jme=new pi("decodeGoogleEarthEnterprisePacket");Kd.prototype.getQuadTreePacket=function(e,t,n){t=y(t,1),e=y(e,"");let o=Qme(this,e,t,n).fetchArrayBuffer();if(!u(o))return;let r=this._tileInfo,s=this.key;return o.then(function(a){return Jme.scheduleTask({buffer:a,quadKey:e,type:"Metadata",key:s},[a]).then(function(l){let f,d=-1;if(e!==""){d=e.length+1;let m=l[e];f=r[e],f._bits|=m._bits,delete l[e]}let p=Object.keys(l);p.sort(function(m,A){return m.length-A.length});let g=p.length;for(let m=0;m<g;++m){let A=p[m];if(l[A]!==null){let C=aL.clone(l[A]),T=A.length;if(T===d)C.setParent(f);else if(T>1){let E=r[A.substring(0,A.length-1)];C.setParent(E)}r[A]=C}else r[A]=null}})})};Kd.prototype.populateSubtree=function(e,t,n,i){let o=Kd.tileXYToQuadKey(e,t,n);return vj(this,o,i)};function vj(e,t,n){let i=e._tileInfo,o=t,r=i[o];if(u(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,c=a[o];if(u(c))return c.then(function(){return s=new zo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),vj(e,t,s)});if(!u(r)||!r.hasSubtree())return Promise.reject(new ue(`Couldn't load metadata for tile ${t}`));if(c=e.getQuadTreePacket(o,r.cnodeVersion,n),!!u(c))return a[o]=c,c.then(function(){return s=new zo({throttle:n.throttle,throttleByServer:n.throttleByServer,type:n.type,priorityFunction:n.priorityFunction}),vj(e,t,s)}).finally(function(){delete a[o]})}Kd.prototype.getTileInformation=function(e,t,n){let i=Kd.tileXYToQuadKey(e,t,n);return this._tileInfo[i]};Kd.prototype.getTileInformationFromQuadKey=function(e){return this._tileInfo[e]};function Qme(e,t,n,i){return e._resource.getDerivedResource({url:`flatfile?q2-0${t}-q.${n.toString()}`,request:i})}var Sj,Dj;function iet(e){let t=e._resource.getDerivedResource({url:"dbRoot.v5",queryParameters:{output:"proto"}});if(!u(Dj)){let n=$t("ThirdParty/google-earth-dbroot-parser.js"),i=window.cesiumGoogleEarthDbRootParser;Dj=m0(n).then(function(){Sj=window.cesiumGoogleEarthDbRootParser(eet),u(i)?window.cesiumGoogleEarthDbRootParser=i:delete window.cesiumGoogleEarthDbRootParser})}return Dj.then(function(){return t.fetchArrayBuffer()}).then(function(n){let i=Sj.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 c=o.buffer.slice(r,s);return Jme.scheduleTask({buffer:c,type:"DbRoot",key:a},[c])}).then(function(n){let i=Sj.DbRootProto.decode(new Uint8Array(n.buffer));if(e.imageryPresent=y(i.imageryPresent,e.imageryPresent),e.protoImagery=i.protoImagery,e.terrainPresent=y(i.terrainPresent,e.terrainPresent),u(i.endSnippet)&&u(i.endSnippet.model)){let a=i.endSnippet.model;e.negativeAltitudeExponentBias=y(a.negativeAltitudeExponentBias,e.negativeAltitudeExponentBias),e.negativeAltitudeThreshold=y(a.compressedNegativeAltitudeThreshold,e.negativeAltitudeThreshold)}u(i.databaseVersion)&&(e._quadPacketVersion=y(i.databaseVersion.quadtreeVersion,e._quadPacketVersion));let o=e.providers,r=y(i.providerInfo,[]),s=r.length;for(let a=0;a<s;++a){let c=r[a],l=c.copyrightString;u(l)&&(o[c.providerId]=new Zt(l.value))}}).catch(function(){console.log(`Failed to retrieve ${t.url}. Using defaults.`),e.key=net})}var Zd=Kd;function Ux(e){e=y(e,y.EMPTY_OBJECT),this._buffer=e.buffer,this._credits=e.credits,this._negativeAltitudeExponentBias=e.negativeAltitudeExponentBias,this._negativeElevationThreshold=e.negativeElevationThreshold;let t=y(e.childTileMask,15),n=t&3;n|=t&4?8:0,n|=t&8?4:0,this._childTileMask=n,this._createdByUpsampling=y(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(Ux.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){}}});var tpe="createVerticesFromGoogleEarthEnterpriseBuffer",oet=new pi(tpe),ret=new pi(tpe,Yd.maximumAsynchronousTasks),$me=new ce,wj=new ce;Ux.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),c=t.ellipsoid;t.tileXYToNativeRectangle(n,i,o,$me),t.tileXYToRectangle(n,i,o,wj);let l=c.cartographicToCartesian(ce.center(wj)),d=40075.16/(1<<o);this._skirtHeight=Math.min(d*8,1e3);let g=(a?ret:oet).scheduleTask({buffer:this._buffer,nativeRectangle:$me,rectangle:wj,relativeToCenter:l,ellipsoid:c,skirtHeight:this._skirtHeight,exaggeration:r,exaggerationRelativeHeight:s,includeWebMercatorT:!0,negativeAltitudeExponentBias:this._negativeAltitudeExponentBias,negativeElevationThreshold:this._negativeElevationThreshold});if(!u(g))return;let m=this;return g.then(function(A){return m._mesh=new Df(l,new Float32Array(A.vertices),new Uint16Array(A.indices),A.indexCountWithoutSkirts,A.vertexCountWithoutSkirts,A.minimumHeight,A.maximumHeight,se.clone(A.boundingSphere3D),h.clone(A.occludeePointInScaledSpace),A.numberOfAttributes,Rn.clone(A.orientedBoundingBox),oc.clone(A.encoding),A.westIndicesSouthToNorth,A.southIndicesEastToWest,A.eastIndicesNorthToSouth,A.northIndicesWestToEast),m._minimumHeight=A.minimumHeight,m._maximumHeight=A.maximumHeight,m._buffer=void 0,m._mesh})};Ux.prototype.interpolateHeight=function(e,t,n){let i=P.clamp((t-e.west)/e.width,0,1),o=P.clamp((n-e.south)/e.height,0,1);return u(this._mesh)?fet(this,i,o):met(this,i,o,e)};var set=new pi("upsampleQuantizedTerrainMesh",Yd.maximumAsynchronousTasks);Ux.prototype.upsample=function(e,t,n,i,o,r,s){let a=this._mesh;if(!u(this._mesh))return;let c=t*2!==o,l=n*2===r,f=e.ellipsoid,d=e.tileXYToRectangle(o,r,s),p=set.scheduleTask({vertices:a.vertices,indices:a.indices,indexCountWithoutSkirts:a.indexCountWithoutSkirts,vertexCountWithoutSkirts:a.vertexCountWithoutSkirts,encoding:a.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:c,isNorthChild:l,childRectangle:d,ellipsoid:f});if(!u(p))return;let g=this;return p.then(function(m){let A=new Uint16Array(m.vertices),x=Fe.createTypedArray(A.length/3,m.indices),C=g._skirtHeight;return new Mx({quantizedVertices:A,indices:x,minimumHeight:m.minimumHeight,maximumHeight:m.maximumHeight,boundingSphere:se.clone(m.boundingSphere),orientedBoundingBox:Rn.clone(m.orientedBoundingBox),horizonOcclusionPoint:h.clone(m.horizonOcclusionPoint),westIndices:m.westIndices,southIndices:m.southIndices,eastIndices:m.eastIndices,northIndices:m.northIndices,westSkirtHeight:C,southSkirtHeight:C,eastSkirtHeight:C,northSkirtHeight:C,childTileMask:0,createdByUpsampling:!0,credits:g._credits})})};Ux.prototype.isChildAvailable=function(e,t,n,i){let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Ux.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};var aet=new H,cet=new H,uet=new H,npe=new h;function fet(e,t,n){let i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,c=s.length;a<c;a+=3){let l=s[a],f=s[a+1],d=s[a+2],p=r.decodeTextureCoordinates(o,l,aet),g=r.decodeTextureCoordinates(o,f,cet),m=r.decodeTextureCoordinates(o,d,uet),A=g_.computeBarycentricCoordinates(t,n,p.x,p.y,g.x,g.y,m.x,m.y,npe);if(A.x>=-1e-15&&A.y>=-1e-15&&A.z>=-1e-15){let x=r.decodeHeight(o,l),C=r.decodeHeight(o,f),T=r.decodeHeight(o,d);return A.x*x+A.y*C+A.z*T}}}var det=Uint16Array.BYTES_PER_ELEMENT,epe=Uint32Array.BYTES_PER_ELEMENT,Ij=Int32Array.BYTES_PER_ELEMENT,het=Float32Array.BYTES_PER_ELEMENT,Pj=Float64Array.BYTES_PER_ELEMENT;function met(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 c=new DataView(o),l=0;for(let D=0;D<r;++D)l+=c.getUint32(l,!0),l+=epe;l+=epe,l+=2*Pj;let f=P.toRadians(c.getFloat64(l,!0)*180);l+=Pj;let d=P.toRadians(c.getFloat64(l,!0)*180);l+=Pj;let p=i.width/f/2,g=i.height/d/2,m=c.getInt32(l,!0);l+=Ij;let A=c.getInt32(l,!0)*3;l+=Ij,l+=Ij;let x=new Array(m),C=new Array(m),T=new Array(m),E;for(E=0;E<m;++E)x[E]=s+c.getUint8(l++)*p,C[E]=a+c.getUint8(l++)*g,T[E]=c.getFloat32(l,!0)*6371010,l+=het;let S=new Array(A);for(E=0;E<A;++E)S[E]=c.getUint16(l,!0),l+=det;for(E=0;E<A;E+=3){let D=S[E],w=S[E+1],R=S[E+2],O=x[D],L=x[w],N=x[R],_=C[D],b=C[w],v=C[R],I=g_.computeBarycentricCoordinates(t,n,O,_,L,b,N,v,npe);if(I.x>=-1e-15&&I.y>=-1e-15&&I.z>=-1e-15)return I.x*T[D]+I.y*T[w]+I.z*T[R]}}var Gb=Ux;var vf={UNKNOWN:0,NONE:1,SELF:2,PARENT:3},Pz=new $;function Oz(){this._terrainCache={},this._lastTidy=$.now()}Oz.prototype.add=function(e,t){this._terrainCache[e]={buffer:t,timestamp:$.now()}};Oz.prototype.get=function(e){let n=this._terrainCache[e];if(u(n))return delete this._terrainCache[e],n.buffer};Oz.prototype.tidy=function(){if($.now(Pz),$.secondsDifference(Pz,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];$.secondsDifference(Pz,r.timestamp)>10&&delete e[o]}$.clone(Pz,this._lastTidy)}};function Wb(e){e=y(e,y.EMPTY_OBJECT);let t;if(u(e.metadata))t=e.metadata;else{let r=Oe.createIfNeeded(e.url);t=new Zd(r)}this._metadata=t,this._tilingScheme=new ji({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-P.PI,-P.PI,P.PI,P.PI),ellipsoid:e.ellipsoid});let n=e.credit;typeof n=="string"&&(n=new Zt(n)),this._credit=n,this._levelZeroMaximumGeometricError=40075.16,this._terrainCache=new Oz,this._terrainPromises={},this._terrainRequests={},this._errorEvent=new Ae,this._ready=!1;let i=this,o;this._readyPromise=t.readyPromise.then(function(r){if(!t.terrainPresent){let s=new ue(`The server ${t.url} doesn't have terrain`);return o=Xn.reportError(o,i,i._errorEvent,s.message,void 0,void 0,void 0,s),Promise.reject(s)}return Xn.reportSuccess(o),i._ready=r,r}).catch(function(r){return o=Xn.reportError(o,i,i._errorEvent,r.message,void 0,void 0,void 0,r),Promise.reject(r)})}Object.defineProperties(Wb.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});var pet=new pi("decodeGoogleEarthEnterprisePacket");function ipe(e,t,n){let i=t.getChildBitmask();if(t.terrainState===vf.PARENT){i=0;for(let o=0;o<4;++o){let r=n.getTileInformationFromQuadKey(e+o.toString());u(r)&&r.hasTerrain()&&(i|=1<<o)}}return i}Wb.prototype.requestTileGeometry=function(e,t,n,i){let o=Zd.tileXYToQuadKey(e,t,n),r=this._terrainCache,s=this._metadata,a=s.getTileInformationFromQuadKey(o);if(!u(a))return Promise.reject(new ue("Terrain tile doesn't exist"));let c=a.terrainState;u(c)||(c=a.terrainState=vf.UNKNOWN);let l=r.get(o);if(u(l)){let C=s.providers[a.terrainProvider];return Promise.resolve(new Gb({buffer:l,childTileMask:ipe(o,a,s),credits:u(C)?[C]:void 0,negativeAltitudeExponentBias:s.negativeAltitudeExponentBias,negativeElevationThreshold:s.negativeAltitudeThreshold}))}if(r.tidy(),a.ancestorHasTerrain){if(c===vf.NONE)return Promise.reject(new ue("Terrain tile doesn't exist"))}else return Promise.resolve(new ga({buffer:new Uint8Array(16*16),width:16,height:16}));let f,d=o,p=-1;switch(c){case vf.SELF:p=a.terrainVersion;break;case vf.PARENT:d=d.substring(0,d.length-1),f=s.getTileInformationFromQuadKey(d),p=f.terrainVersion;break;case vf.UNKNOWN:a.hasTerrain()?p=a.terrainVersion:(d=d.substring(0,d.length-1),f=s.getTileInformationFromQuadKey(d),u(f)&&f.hasTerrain()&&(p=f.terrainVersion));break}if(p<0)return Promise.reject(new ue("Terrain tile doesn't exist"));let g=this._terrainPromises,m=this._terrainRequests,A,x;if(u(g[d]))A=g[d],x=m[d];else{x=i;let C=_et(this,d,p,x).fetchArrayBuffer();if(!u(C))return;A=C.then(function(T){return u(T)?pet.scheduleTask({buffer:T,type:"Terrain",key:s.key},[T]).then(function(E){let S=s.getTileInformationFromQuadKey(d);S.terrainState=vf.SELF,r.add(d,E[0]);let D=S.terrainProvider,w=E.length-1;for(let R=0;R<w;++R){let O=d+R.toString(),L=s.getTileInformationFromQuadKey(O);u(L)&&(r.add(O,E[R+1]),L.terrainState=vf.PARENT,L.terrainProvider===0&&(L.terrainProvider=D))}}):Promise.reject(new ue("Failed to load terrain."))}),g[d]=A,m[d]=x,A=A.finally(function(){delete g[d],delete m[d]})}return A.then(function(){let C=r.get(o);if(u(C)){let T=s.providers[a.terrainProvider];return new Gb({buffer:C,childTileMask:ipe(o,a,s),credits:u(T)?[T]:void 0,negativeAltitudeExponentBias:s.negativeAltitudeExponentBias,negativeElevationThreshold:s.negativeAltitudeThreshold})}return Promise.reject(new ue("Failed to load terrain."))}).catch(function(C){return x.state===hi.CANCELLED?(i.state=x.state,Promise.reject(C)):(a.terrainState=vf.NONE,Promise.reject(C))})};Wb.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};Wb.prototype.getTileDataAvailable=function(e,t,n){let i=this._metadata,o=Zd.tileXYToQuadKey(e,t,n),r=i.getTileInformation(e,t,n);if(r===null)return!1;if(u(r)){if(!r.ancestorHasTerrain)return!0;let s=r.terrainState;if(s===vf.NONE)return!1;if((!u(s)||s===vf.UNKNOWN)&&(r.terrainState=vf.UNKNOWN,!r.hasTerrain())){o=o.substring(0,o.length-1);let a=i.getTileInformationFromQuadKey(o);if(!u(a)||!a.hasTerrain())return!1}return!0}if(i.isValid(o)){let s=new zo({throttle:!1,throttleByServer:!0,type:Qr.TERRAIN});i.populateSubtree(e,t,n,s)}return!1};Wb.prototype.loadTileDataAvailability=function(e,t,n){};function _et(e,t,n,i){return n=u(n)&&n>0?n:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1c-0${t}-t.${n.toString()}`,request:i})}var Oj=Wb;function get(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}var cL=get;var gpe={},yet=32.184,Aet=2451545,ope=-.0529921,rpe=-.1059842,spe=13.0120009,ape=13.3407154,cpe=.9856003,lpe=26.4057084,upe=13.064993,fpe=.3287146,dpe=1.7484877,hpe=-.1589763,mpe=.0036096,ppe=.1643573,_pe=12.9590088,Rj=new $;gpe.ComputeMoon=function(e,t){u(e)||(e=$.now()),Rj=$.addSeconds(e,yet,Rj);let n=$.totalDays(Rj)-Aet,i=n/Qn.DAYS_PER_JULIAN_CENTURY,o=(125.045+ope*n)*P.RADIANS_PER_DEGREE,r=(250.089+rpe*n)*P.RADIANS_PER_DEGREE,s=(260.008+spe*n)*P.RADIANS_PER_DEGREE,a=(176.625+ape*n)*P.RADIANS_PER_DEGREE,c=(357.529+cpe*n)*P.RADIANS_PER_DEGREE,l=(311.589+lpe*n)*P.RADIANS_PER_DEGREE,f=(134.963+upe*n)*P.RADIANS_PER_DEGREE,d=(276.617+fpe*n)*P.RADIANS_PER_DEGREE,p=(34.226+dpe*n)*P.RADIANS_PER_DEGREE,g=(15.134+hpe*n)*P.RADIANS_PER_DEGREE,m=(119.743+mpe*n)*P.RADIANS_PER_DEGREE,A=(239.961+ppe*n)*P.RADIANS_PER_DEGREE,x=(25.053+_pe*n)*P.RADIANS_PER_DEGREE,C=Math.sin(o),T=Math.sin(r),E=Math.sin(s),S=Math.sin(a),D=Math.sin(c),w=Math.sin(l),R=Math.sin(f),O=Math.sin(d),L=Math.sin(p),N=Math.sin(g),_=Math.sin(m),b=Math.sin(A),v=Math.sin(x),I=Math.cos(o),B=Math.cos(r),F=Math.cos(s),k=Math.cos(a),U=Math.cos(c),G=Math.cos(l),V=Math.cos(f),X=Math.cos(d),j=Math.cos(p),Q=Math.cos(g),W=Math.cos(m),K=Math.cos(A),J=Math.cos(x),_e=(269.9949+.0031*i-3.8787*C-.1204*T+.07*E-.0172*S+.0072*w-.0052*N+.0043*v)*P.RADIANS_PER_DEGREE,xe=(66.5392+.013*i+1.5419*I+.0239*B-.0278*F+.0068*k-.0029*G+9e-4*V+8e-4*Q-9e-4*J)*P.RADIANS_PER_DEGREE,re=(38.3213+13.17635815*n-14e-13*n*n+3.561*C+.1208*T-.0642*E+.0158*S+.0252*D-.0066*w-.0047*R-.0046*O+.0028*L+.0052*N+.004*_+.0019*b-.0044*v)*P.RADIANS_PER_DEGREE,ye=(13.17635815-14e-13*(2*n)+3.561*I*ope+.1208*B*rpe-.0642*F*spe+.0158*k*ape+.0252*U*cpe-.0066*G*lpe-.0047*V*upe-.0046*X*fpe+.0028*j*dpe+.0052*Q*hpe+.004*W*mpe+.0019*K*ppe-.0044*J*_pe)/86400*P.RADIANS_PER_DEGREE;return u(t)||(t=new cL),t.rightAscension=_e,t.declination=xe,t.rotation=re,t.rotationRate=ye,t};var lL=gpe;function ype(e){(!u(e)||typeof e!="function")&&(e=lL.ComputeMoon),this._computeFunction=e}var xet=new h,Cet=new h,Tet=new h;function Eet(e,t,n){let i=xet;i.x=Math.cos(e+P.PI_OVER_TWO),i.y=Math.sin(e+P.PI_OVER_TWO),i.z=0;let o=Math.cos(t),r=Tet;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);let s=h.cross(r,i,Cet);return u(n)||(n=new Z),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 bet=new Z,Det=new Le;ype.prototype.evaluate=function(e,t){u(e)||(e=$.now());let n=this._computeFunction(e),i=Eet(n.rightAscension,n.declination,t),o=P.zeroToTwoPi(n.rotation),r=Le.fromAxisAngle(h.UNIT_Z,o,Det),s=Z.fromQuaternion(Le.conjugate(r,r),bet);return Z.multiply(s,i,i)};var uL=ype;var fL={};fL.type=void 0;fL.getRequiredDataPoints=de.throwInstantiationError;fL.interpolateOrderZero=de.throwInstantiationError;fL.interpolate=de.throwInstantiationError;var Bj=fL;var Mj,Ape="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3NTUwMzYxOS04YmYzLTRkMzAtYjIyMy03ZmY3MjExZWNiNzciLCJpZCI6MjU5LCJpYXQiOjE2NzUyNzM5NjF9.rR_X1Phio3WgkIiwLJfSPMVTJEdSHKzj6GY9oNwttfo",Rz={};Rz.defaultAccessToken=Ape;Rz.defaultServer=new Oe({url:"https://api.cesium.com/"});Rz.getDefaultTokenCredit=function(e){if(e===Ape){if(!u(Mj)){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>`;Mj=new Zt(t,!0)}return Mj}};var Jd=Rz;function Lj(e){this._url=Oe.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(Lj.prototype,{url:{get:function(){return this._url}}});Lj.prototype.geocode=function(e,t){return this._url.getDerivedResource({url:t===By.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r,s=o.bbox;if(u(s))r=ce.fromDegrees(s[0],s[1],s[2],s[3]);else{let a=o.geometry.coordinates[0],c=o.geometry.coordinates[1];r=h.fromDegrees(a,c)}return{displayName:o.properties.label,destination:r}})})};var dL=Lj;function xpe(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.accessToken,Jd.defaultAccessToken),n=Oe.createIfNeeded(y(e.server,Jd.defaultServer));n.appendForwardSlash();let i=Jd.getDefaultTokenCredit(t);u(i)&&e.scene.frameState.creditDisplay.addDefaultCredit(Zt.clone(i));let o=n.getDerivedResource({url:"v1/geocode"});u(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new dL(o)}xpe.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)};var hL=xpe;var Nj=vo(Ll(),1);function Hc(e,t){let n,i=e.externalType,o=u(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:vet};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new ue("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");Oe.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Nj.default(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}u(Object.create)&&(Hc.prototype=Object.create(Oe.prototype),Hc.prototype.constructor=Hc);Hc.fromAssetId=function(e,t){let n=Hc._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new Hc(i,n)})};Object.defineProperties(Hc.prototype,{credits:{get:function(){return u(this._ionRoot)?this._ionRoot.credits:u(this._credits)?this._credits:(this._credits=Hc.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});Hc.getCreditsFromEndpoint=function(e,t){let n=e.attributions.map(Zt.getIonCredit),i=Jd.getDefaultTokenCredit(t.queryParameters.access_token);return u(i)&&n.push(Zt.clone(i)),n};Hc.prototype.clone=function(e){let t=y(this._ionRoot,this);return u(e)||(e=new Hc(t._ionEndpoint,t._ionEndpointResource)),e=Oe.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};Hc.prototype.fetchImage=function(e){if(!this._isExternal){let t=e;e={preferBlob:!0},u(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Oe.prototype.fetchImage.call(this,e)};Hc.prototype._makeRequest=function(e){return this._isExternal||new Nj.default(this.url).authority()!==this._ionEndpointDomain?Oe.prototype._makeRequest.call(this,e):(u(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,Oe.prototype._makeRequest.call(this,e))};Hc._createEndpointResource=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=y(t.server,Jd.defaultServer),i=y(t.accessToken,Jd.defaultAccessToken);n=Oe.createIfNeeded(n);let o={url:`v1/assets/${e}/endpoint`};return u(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function vet(e,t){let n=y(e._ionRoot,e),i=n._ionEndpointResource,o=typeof Image<"u";return!u(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(u(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 Qd=Hc;var wet={SHIFT:0,CTRL:1,ALT:2},Js=Object.freeze(wet);function Bz(){de.throwInstantiationError()}Object.defineProperties(Bz.prototype,{ellipsoid:{get:de.throwInstantiationError}});Bz.prototype.project=de.throwInstantiationError;Bz.prototype.unproject=de.throwInstantiationError;var Fj=Bz;function jb(e){e=y(e,y.EMPTY_OBJECT);let t=e.weights,n=e.times;this._times=n,this._weights=t,this._count=t.length/n.length,this._lastTimeIndex=0}Object.defineProperties(jb.prototype,{times:{get:function(){return this._times}},weights:{get:function(){return this._weights}}});jb.prototype.findTimeInterval=io.prototype.findTimeInterval;jb.prototype.wrapTime=io.prototype.wrapTime;jb.prototype.clampTime=io.prototype.clampTime;jb.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]);u(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 Vj=jb;var Iet={NONE:-1,PARTIAL:0,FULL:1},ur=Object.freeze(Iet);function ac(e,t){this._occluderPosition=h.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 Mz=new h;Object.defineProperties(ac.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){e=h.clone(e,this._cameraPosition);let t=h.subtract(this._occluderPosition,e,Mz),n=h.magnitudeSquared(t),i=this._occluderRadius*this._occluderRadius,o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=h.multiplyByScalar(t,n,Mz);let a=o*o*n;s=h.add(e,h.multiplyByScalar(r,a,Mz),Mz)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});ac.fromBoundingSphere=function(e,t,n){return u(n)?(h.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new ac(e,t)};var Tpe=new h;ac.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=h.subtract(e,this._occluderPosition,Tpe),n=this._occluderRadius;if(n=h.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=h.subtract(e,this._cameraPosition,t),n*n>h.magnitudeSquared(t)}return!1};var Pet=new h;ac.prototype.isBoundingSphereVisible=function(e){let t=h.clone(e.center,Pet),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=h.subtract(t,this._occluderPosition,Tpe),o=this._occluderRadius-n;if(o=h.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=h.subtract(t,this._cameraPosition,i),o*o+n*n>h.magnitudeSquared(i)):!1;if(o>0){i=h.subtract(t,this._cameraPosition,i);let r=h.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 Oet=new h;ac.prototype.computeVisibility=function(e){let t=h.clone(e.center),n=e.radius;if(n>this._occluderRadius)return ur.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=h.subtract(t,this._occluderPosition,Oet),o=this._occluderRadius-n,r=h.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=h.subtract(t,this._cameraPosition,i);let s=h.magnitudeSquared(i);return o*o+n*n<s?ur.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?ur.FULL:ur.PARTIAL):(i=h.subtract(t,this._horizonPlanePosition,i),h.dot(i,this._horizonPlaneNormal)>-n?ur.PARTIAL:ur.FULL))}}return ur.NONE};var Lz=new h;ac.computeOccludeePoint=function(e,t,n){let i=h.clone(t),o=h.clone(e.center),r=e.radius,s=n.length,a=h.normalize(h.subtract(i,o,Lz),Lz),c=-h.dot(a,o),l=ac._anyRotationVector(o,a,c),f=ac._horizonToPlaneNormalDotProduct(e,a,c,l,n[0]);if(!f)return;let d;for(let g=1;g<s;++g){if(d=ac._horizonToPlaneNormalDotProduct(e,a,c,l,n[g]),!d)return;d<f&&(f=d)}if(f<.0017453283658983088)return;let p=r/f;return h.add(o,h.multiplyByScalar(a,p,Lz),Lz)};var Ret=[];ac.computeOccludeePointFromRectangle=function(e,t){t=y(t,ie.WGS84);let n=ce.subsample(e,t,0,Ret),i=se.fromPoints(n),o=h.ZERO;if(!h.equals(o,i.center))return ac.computeOccludeePoint(new se(o,t.minimumRadius),i.center,n)};var Bet=new h;ac._anyRotationVector=function(e,t,n){let i=h.abs(t,Bet),o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);let r=new h,s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=h.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=h.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=h.UNIT_Z);let a=(h.dot(t,i)+n)/-h.dot(t,s);return h.normalize(h.subtract(h.add(i,h.multiplyByScalar(s,a,r),i),e,i),i)};var Met=new h;ac._rotationVector=function(e,t,n,i,o){let r=h.subtract(i,e,Met);if(r=h.normalize(r,r),h.dot(t,r)<.9999999847691291){let s=h.cross(t,r,r);if(h.magnitude(s)>P.EPSILON13)return h.normalize(s,new h)}return o};var Uj=new h,Let=new h,Nz=new h,Cpe=new h;ac._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){let r=h.clone(o,Uj),s=h.clone(e.center,Let),a=e.radius,c=h.subtract(s,r,Nz),l=h.magnitudeSquared(c),f=a*a;if(l<f)return!1;let d=l-f,p=Math.sqrt(d),m=1/Math.sqrt(l),x=p*m*p;c=h.normalize(c,c);let C=h.add(r,h.multiplyByScalar(c,x,Cpe),Cpe),T=Math.sqrt(d-x*x),E=this._rotationVector(s,t,n,r,i),S=h.fromElements(E.x*E.x*c.x+(E.x*E.y-E.z)*c.y+(E.x*E.z+E.y)*c.z,(E.x*E.y+E.z)*c.x+E.y*E.y*c.y+(E.y*E.z-E.x)*c.z,(E.x*E.z-E.y)*c.x+(E.y*E.z+E.x)*c.y+E.z*E.z*c.z,Uj);S=h.normalize(S,S);let D=h.multiplyByScalar(S,T,Uj);E=h.normalize(h.subtract(h.add(C,D,Nz),s,Nz),Nz);let w=h.dot(t,E);E=h.normalize(h.subtract(h.subtract(C,D,E),s,E),E);let R=h.dot(t,E);return w<R?w:R};var mL=ac;function kj(e,t,n){e=Oe.createIfNeeded(e),e.appendForwardSlash(),e.setQueryParameters({key:t}),this._url=e,this._params=y(n,{})}Object.defineProperties(kj.prototype,{url:{get:function(){return this._url}},params:{get:function(){return this._params}}});kj.prototype.geocode=function(e){return this._url.getDerivedResource({url:"json",queryParameters:_t(this._params,{q:e})}).fetchJson().then(function(n){return n.results.map(function(i){let o,r=i.bounds;if(u(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=h.fromDegrees(s,a)}return{displayName:i.formatted,destination:o}})})};var zj=kj;var Net={packedLength:void 0,pack:de.throwInstantiationError,unpack:de.throwInstantiationError},Hj=Net;var Fet={packedInterpolationLength:void 0,convertPackedArrayForInterpolation:de.throwInstantiationError,unpackInterpolationResult:de.throwInstantiationError},Gj=Fet;function Epe(){de.throwInstantiationError()}Epe.prototype.getURL=de.throwInstantiationError;var Wj=Epe;var Vet={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},yn=Object.freeze(Vet);function My(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 Zj(e,t){let n=e;return u(t)&&(n+=`+${t}`),n}function kx(e){if(e.shiftKey)return Js.SHIFT;if(e.ctrlKey)return Js.CTRL;if(e.altKey)return Js.ALT}var ds={LEFT:0,MIDDLE:1,RIGHT:2};function Cu(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 Uet(e){let t=e._element,n=u(t.disableRootEvents)?t:document;Vt.supportsPointerEvents()?(Cu(e,"pointerdown",t,jet),Cu(e,"pointerup",t,Bpe),Cu(e,"pointermove",t,Yet),Cu(e,"pointercancel",t,Bpe)):(Cu(e,"mousedown",t,Mpe),Cu(e,"mouseup",n,Lpe),Cu(e,"mousemove",n,Npe),Cu(e,"touchstart",t,Get),Cu(e,"touchend",n,wpe),Cu(e,"touchmove",n,Wet),Cu(e,"touchcancel",n,wpe)),Cu(e,"dblclick",t,zet);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",Cu(e,i,t,Het)}function ket(e){let t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}var bpe={position:new H};function Jj(e){e._lastSeenTouchEvent=di()}function Qj(e){return di()-e._lastSeenTouchEvent>$d.mouseEmulationIgnoreMilliseconds}function Kj(e,t,n){let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function Mpe(e,t){if(!Qj(e))return;let n=t.button;e._buttonDown[n]=!0;let i;if(n===ds.LEFT)i=yn.LEFT_DOWN;else if(n===ds.MIDDLE)i=yn.MIDDLE_DOWN;else if(n===ds.RIGHT)i=yn.RIGHT_DOWN;else return;let o=My(e,t,e._primaryPosition);H.clone(o,e._primaryStartPosition),H.clone(o,e._primaryPreviousPosition);let r=kx(t),s=e.getInputAction(i,r);u(s)&&(H.clone(o,bpe.position),s(bpe),t.preventDefault())}var Spe={position:new H},Dpe={position:new H};function jj(e,t,n,i){let o=kx(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(u(r)||u(s)){let a=My(e,i,e._primaryPosition);if(u(r)&&(H.clone(a,Spe.position),r(Spe)),u(s)){let c=e._primaryStartPosition;Kj(c,a,e._clickPixelTolerance)&&(H.clone(a,Dpe.position),s(Dpe))}}}function Lpe(e,t){if(!Qj(e))return;let n=t.button;n!==ds.LEFT&&n!==ds.MIDDLE&&n!==ds.RIGHT||(e._buttonDown[ds.LEFT]&&(jj(e,yn.LEFT_UP,yn.LEFT_CLICK,t),e._buttonDown[ds.LEFT]=!1),e._buttonDown[ds.MIDDLE]&&(jj(e,yn.MIDDLE_UP,yn.MIDDLE_CLICK,t),e._buttonDown[ds.MIDDLE]=!1),e._buttonDown[ds.RIGHT]&&(jj(e,yn.RIGHT_UP,yn.RIGHT_CLICK,t),e._buttonDown[ds.RIGHT]=!1))}var Yj={startPosition:new H,endPosition:new H};function Npe(e,t){if(!Qj(e))return;let n=kx(t),i=My(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(yn.MOUSE_MOVE,n);u(r)&&(H.clone(o,Yj.startPosition),H.clone(i,Yj.endPosition),r(Yj)),H.clone(i,o),(e._buttonDown[ds.LEFT]||e._buttonDown[ds.MIDDLE]||e._buttonDown[ds.RIGHT])&&t.preventDefault()}var vpe={position:new H};function zet(e,t){let n=t.button,i;if(n===ds.LEFT)i=yn.LEFT_DOUBLE_CLICK;else return;let o=kx(t),r=e.getInputAction(i,o);u(r)&&(My(e,t,vpe.position),r(vpe))}function Het(e,t){let n;if(u(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(!u(n))return;let i=kx(t),o=e.getInputAction(yn.WHEEL,i);u(o)&&(o(n),t.preventDefault())}function Get(e,t){Jj(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,My(e,r,new H));Fz(e,t);let c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.set(s,H.clone(a.get(s)))}function wpe(e,t){Jj(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);Fz(e,t);let c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.remove(s)}var Ipe={position:new H},qj={position1:new H,position2:new H},Ppe={position:new H},Ope={position:new H},Rpe={position:new H};function Fz(e,t){let n=kx(t),i=e._positions,o=i.length,r,s,a=e._isPinching;if(o!==1&&e._buttonDown[ds.LEFT]){if(e._buttonDown[ds.LEFT]=!1,u(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(yn.LEFT_UP,n),u(r)&&(H.clone(e._primaryPosition,Ppe.position),r(Ppe)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(yn.LEFT_CLICK,n),u(s))){let c=e._primaryStartPosition,l=e._previousPositions.values[0];Kj(c,l,e._clickPixelTolerance)&&(H.clone(e._primaryPosition,Ope.position),s(Ope))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(yn.PINCH_END,n),u(r)&&r()),o===1&&!a){let c=i.values[0];H.clone(c,e._primaryPosition),H.clone(c,e._primaryStartPosition),H.clone(c,e._primaryPreviousPosition),e._buttonDown[ds.LEFT]=!0,r=e.getInputAction(yn.LEFT_DOWN,n),u(r)&&(H.clone(c,Ipe.position),r(Ipe)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(yn.RIGHT_CLICK,n),u(s))){let l=e._primaryStartPosition,f=e._previousPositions.values[0];Kj(l,f,e._holdPixelTolerance)&&(H.clone(e._primaryPosition,Rpe.position),s(Rpe))}},$d.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(yn.PINCH_START,n),u(r)&&(H.clone(i.values[0],qj.position1),H.clone(i.values[1],qj.position2),r(qj),t.preventDefault()))}function Wet(e,t){Jj(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 l=a.get(s);u(l)&&My(e,r,l)}Fpe(e,t);let c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,H.clone(a.get(s),c.get(s))}var Xj={startPosition:new H,endPosition:new H},pL={distance:{startPosition:new H,endPosition:new H},angleAndHeight:{startPosition:new H,endPosition:new H}};function Fpe(e,t){let n=kx(t),i=e._positions,o=e._previousPositions,r=i.length,s;if(r===1&&e._buttonDown[ds.LEFT]){let a=i.values[0];H.clone(a,e._primaryPosition);let c=e._primaryPreviousPosition;s=e.getInputAction(yn.MOUSE_MOVE,n),u(s)&&(H.clone(c,Xj.startPosition),H.clone(a,Xj.endPosition),s(Xj)),H.clone(a,c),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(yn.PINCH_MOVE,n),u(s))){let a=i.values[0],c=i.values[1],l=o.values[0],f=o.values[1],d=c.x-a.x,p=c.y-a.y,g=Math.sqrt(d*d+p*p)*.25,m=f.x-l.x,A=f.y-l.y,x=Math.sqrt(m*m+A*A)*.25,C=(c.y+a.y)*.125,T=(f.y+l.y)*.125,E=Math.atan2(p,d),S=Math.atan2(A,m);H.fromElements(0,x,pL.distance.startPosition),H.fromElements(0,g,pL.distance.endPosition),H.fromElements(S,T,pL.angleAndHeight.startPosition),H.fromElements(E,C,pL.angleAndHeight.endPosition),s(pL)}}function jet(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){let n=e._positions,i=t.pointerId;n.set(i,My(e,t,new H)),Fz(e,t),e._previousPositions.set(i,H.clone(n.get(i)))}else Mpe(e,t)}function Bpe(e,t){if(t.pointerType==="touch"){let n=e._positions,i=t.pointerId;n.remove(i),Fz(e,t),e._previousPositions.remove(i)}else Lpe(e,t)}function Yet(e,t){if(t.pointerType==="touch"){let n=e._positions,i=t.pointerId,o=n.get(i);if(!u(o))return;My(e,t,o),Fpe(e,t);let r=e._previousPositions;H.clone(n.get(i),r.get(i))}else Npe(e,t)}function $d(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-$d.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new H,this._primaryPosition=new H,this._primaryPreviousPosition=new H,this._positions=new xt,this._previousPositions=new xt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=y(e,document),Uet(this)}$d.prototype.setInputAction=function(e,t,n){let i=Zj(t,n);this._inputEvents[i]=e};$d.prototype.getInputAction=function(e,t){let n=Zj(e,t);return this._inputEvents[n]};$d.prototype.removeInputAction=function(e,t){let n=Zj(e,t);delete this._inputEvents[n]};$d.prototype.isDestroyed=function(){return!1};$d.prototype.destroy=function(){return ket(this),le(this)};$d.mouseEmulationIgnoreMilliseconds=800;$d.touchHoldDelayMilliseconds=1500;var Tu=$d;function qet(e,t,n,i,o,r,s){let a=Di.numberOfPoints(e,t,o),c,l=n.red,f=n.green,d=n.blue,p=n.alpha,g=i.red,m=i.green,A=i.blue,x=i.alpha;if(z.equals(n,i)){for(c=0;c<a;c++)r[s++]=z.floatToByte(l),r[s++]=z.floatToByte(f),r[s++]=z.floatToByte(d),r[s++]=z.floatToByte(p);return s}let C=(g-l)/a,T=(m-f)/a,E=(A-d)/a,S=(x-p)/a,D=s;for(c=0;c<a;c++)r[D++]=z.floatToByte(l+c*C),r[D++]=z.floatToByte(f+c*T),r[D++]=z.floatToByte(d+c*E),r[D++]=z.floatToByte(p+c*S);return D}function _L(e){e=y(e,y.EMPTY_OBJECT);let t=e.positions,n=e.colors,i=y(e.colorsPerVertex,!1);this._positions=t,this._colors=n,this._colorsPerVertex=i,this._arcType=y(e.arcType,Kt.GEODESIC),this._granularity=y(e.granularity,P.RADIANS_PER_DEGREE),this._ellipsoid=y(e.ellipsoid,ie.WGS84),this._workerName="createSimplePolylineGeometry";let o=1+t.length*h.packedLength;o+=u(n)?1+n.length*z.packedLength:1,this.packedLength=o+ie.packedLength+3}_L.pack=function(e,t,n){n=y(n,0);let i,o=e._positions,r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=h.packedLength)h.pack(o[i],t,n);let s=e._colors;for(r=u(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=z.packedLength)z.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};_L.unpack=function(e,t,n){t=y(t,0);let i,o=e[t++],r=new Array(o);for(i=0;i<o;++i,t+=h.packedLength)r[i]=h.unpack(e,t);o=e[t++];let s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=z.packedLength)s[i]=z.unpack(e,t);let a=ie.unpack(e,t);t+=ie.packedLength;let c=e[t++]===1,l=e[t++],f=e[t];return u(n)?(n._positions=r,n._colors=s,n._ellipsoid=a,n._colorsPerVertex=c,n._arcType=l,n._granularity=f,n):new _L({positions:r,colors:s,ellipsoid:a,colorsPerVertex:c,arcType:l,granularity:f})};var Vz=new Array(2),Uz=new Array(2),Xet={positions:Vz,height:Uz,ellipsoid:void 0,minDistance:void 0,granularity:void 0};_L.createGeometry=function(e){let t=e._positions,n=e._colors,i=e._colorsPerVertex,o=e._arcType,r=e._granularity,s=e._ellipsoid,a=P.chordLength(r,s.maximumRadius),c=u(n)&&!i,l,f=t.length,d,p,g,m,A=0;if(o===Kt.GEODESIC||o===Kt.RHUMB){let S,D,w;o===Kt.GEODESIC?(S=P.chordLength(r,s.maximumRadius),D=Di.numberOfPoints,w=Di.generateArc):(S=r,D=Di.numberOfPointsRhumbLine,w=Di.generateRhumbArc);let R=Di.extractHeights(t,s),O=Xet;if(o===Kt.GEODESIC?O.minDistance=a:O.granularity=r,O.ellipsoid=s,c){let L=0;for(l=0;l<f-1;l++)L+=D(t[l],t[l+1],S)+1;d=new Float64Array(L*3),g=new Uint8Array(L*4),O.positions=Vz,O.height=Uz;let N=0;for(l=0;l<f-1;++l){Vz[0]=t[l],Vz[1]=t[l+1],Uz[0]=R[l],Uz[1]=R[l+1];let _=w(O);if(u(n)){let b=_.length/3;m=n[l];for(let v=0;v<b;++v)g[N++]=z.floatToByte(m.red),g[N++]=z.floatToByte(m.green),g[N++]=z.floatToByte(m.blue),g[N++]=z.floatToByte(m.alpha)}d.set(_,A),A+=_.length}}else if(O.positions=t,O.height=R,d=new Float64Array(w(O)),u(n)){for(g=new Uint8Array(d.length/3*4),l=0;l<f-1;++l){let N=t[l],_=t[l+1],b=n[l],v=n[l+1];A=qet(N,_,b,v,a,g,A)}let L=n[f-1];g[A++]=z.floatToByte(L.red),g[A++]=z.floatToByte(L.green),g[A++]=z.floatToByte(L.blue),g[A++]=z.floatToByte(L.alpha)}}else{p=c?f*2-2:f,d=new Float64Array(p*3),g=u(n)?new Uint8Array(p*4):void 0;let S=0,D=0;for(l=0;l<f;++l){let w=t[l];if(c&&l>0&&(h.pack(w,d,S),S+=3,m=n[l-1],g[D++]=z.floatToByte(m.red),g[D++]=z.floatToByte(m.green),g[D++]=z.floatToByte(m.blue),g[D++]=z.floatToByte(m.alpha)),c&&l===f-1)break;h.pack(w,d,S),S+=3,u(n)&&(m=n[l],g[D++]=z.floatToByte(m.red),g[D++]=z.floatToByte(m.green),g[D++]=z.floatToByte(m.blue),g[D++]=z.floatToByte(m.alpha))}}let x=new dn;x.position=new ve({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:d}),u(n)&&(x.color=new ve({componentDatatype:q.UNSIGNED_BYTE,componentsPerAttribute:4,values:g,normalize:!0})),p=d.length/3;let C=(p-1)*2,T=Fe.createTypedArray(p,C),E=0;for(l=0;l<p-1;++l)T[E++]=l,T[E++]=l+1;return new ct({attributes:x,indices:T,primitiveType:Me.LINES,boundingSphere:se.fromPoints(t)})};var $j=_L;function Yb(e){let t=y(e.radius,1),i={radii:new h(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,vertexFormat:e.vertexFormat};this._ellipsoidGeometry=new vs(i),this._workerName="createSphereGeometry"}Yb.packedLength=vs.packedLength;Yb.pack=function(e,t,n){return vs.pack(e._ellipsoidGeometry,t,n)};var Ket=new vs,Ly={radius:void 0,radii:new h,vertexFormat:new Ie,stackPartitions:void 0,slicePartitions:void 0};Yb.unpack=function(e,t,n){let i=vs.unpack(e,t,Ket);return Ly.vertexFormat=Ie.clone(i._vertexFormat,Ly.vertexFormat),Ly.stackPartitions=i._stackPartitions,Ly.slicePartitions=i._slicePartitions,u(n)?(h.clone(i._radii,Ly.radii),n._ellipsoidGeometry=new vs(Ly),n):(Ly.radius=i._radii.x,new Yb(Ly))};Yb.createGeometry=function(e){return vs.createGeometry(e._ellipsoidGeometry)};var eY=Yb;var Zet={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},pn=Zet;function Ny(e){}Object.defineProperties(Ny.prototype,{ellipsoid:{get:de.throwInstantiationError},rectangle:{get:de.throwInstantiationError},projection:{get:de.throwInstantiationError}});Ny.prototype.getNumberOfXTilesAtLevel=de.throwInstantiationError;Ny.prototype.getNumberOfYTilesAtLevel=de.throwInstantiationError;Ny.prototype.rectangleToNativeRectangle=de.throwInstantiationError;Ny.prototype.tileXYToNativeRectangle=de.throwInstantiationError;Ny.prototype.tileXYToRectangle=de.throwInstantiationError;Ny.prototype.positionToTileXY=de.throwInstantiationError;var tY=Ny;function Jet(e,t){this.rectangle=e,this.maxLevel=t}function qb(e){e=y(e,y.EMPTY_OBJECT);let t=Oe.createIfNeeded(e.url);this._resource=t,this._errorEvent=new Ae,this._ready=!1,this._terrainDataStructure={heightScale:1/1e3,heightOffset:-1e3,elementsPerHeight:3,stride:4,elementMultiplier:256,isBigEndian:!0,lowestEncodedHeight:0,highestEncodedHeight:256*256*256-1};let n=e.credit;typeof n=="string"&&(n=new Zt(n)),this._credit=n,this._tilingScheme=void 0,this._rectangles=[];let i=this,o,r=y(e.ellipsoid,ie.WGS84);function s(l){let f=l.getElementsByTagName("SRS")[0].textContent;if(f==="EPSG:4326")i._tilingScheme=new ji({ellipsoid:r});else return Promise.reject(new ue(`SRS ${f} is not supported.`));let d=l.getElementsByTagName("TileFormat")[0];i._heightmapWidth=parseInt(d.getAttribute("width"),10),i._heightmapHeight=parseInt(d.getAttribute("height"),10),i._levelZeroMaximumGeometricError=Hr.getEstimatedLevelZeroGeometricErrorForAHeightmap(r,Math.min(i._heightmapWidth,i._heightmapHeight),i._tilingScheme.getNumberOfXTilesAtLevel(0));let p=l.getElementsByTagName("DataExtent");for(let g=0;g<p.length;++g){let m=p[g],A=P.toRadians(parseFloat(m.getAttribute("minx"))),x=P.toRadians(parseFloat(m.getAttribute("miny"))),C=P.toRadians(parseFloat(m.getAttribute("maxx"))),T=P.toRadians(parseFloat(m.getAttribute("maxy"))),E=parseInt(m.getAttribute("maxlevel"),10);i._rectangles.push(new Jet(new ce(A,x,C,T),E))}return i._ready=!0,Promise.resolve(!0)}function a(l){let f=y(u(l)?l.message:void 0,`An error occurred while accessing ${i._resource.url}.`);return o=Xn.reportError(o,i,i._errorEvent,f),o.retry?c():Promise.reject(new ue(f))}function c(){return i._resource.fetchXML().then(s).catch(a)}this._readyPromise=c()}Object.defineProperties(qb.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});qb.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(!u(s))return;let a=this;return Promise.resolve(s).then(function(c){return new ga({buffer:Wf(c),width:a._heightmapWidth,height:a._heightmapHeight,childTileMask:Qet(a,e,t,n),structure:a._terrainDataStructure})})};qb.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};var Vpe=new ce;function Qet(e,t,n,i){let o=e._tilingScheme,r=e._rectangles,s=o.tileXYToRectangle(t,n,i),a=0;for(let c=0;c<r.length&&a!==15;++c){let l=r[c];if(l.maxLevel<=i)continue;let f=l.rectangle,d=ce.intersection(f,s,Vpe);u(d)&&(kz(o,f,t*2,n*2,i+1)&&(a|=4),kz(o,f,t*2+1,n*2,i+1)&&(a|=8),kz(o,f,t*2,n*2+1,i+1)&&(a|=1),kz(o,f,t*2+1,n*2+1,i+1)&&(a|=2))}return a}function kz(e,t,n,i,o){let r=e.tileXYToRectangle(n,i,o);return u(ce.intersection(r,t,Vpe))}qb.prototype.getTileDataAvailable=function(e,t,n){};qb.prototype.loadTileDataAvailability=function(e,t,n){};var nY=qb;function zx(e){e=y(e,y.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=y(e.epoch,ze.MINIMUM_VALUE),this.tolerance=y(e.tolerance,1),this._seeking=!1,this._seekFunction=void 0,this._firstTickAfterSeek=!1}Object.defineProperties(zx.prototype,{clock:{get:function(){return this._clock},set:function(e){let t=this._clock;t!==e&&(u(t)&&(this._clockSubscription(),this._clockSubscription=void 0),u(e)&&(this._clockSubscription=e.onTick.addEventListener(zx.prototype._onTick,this)),this._clock=e)}},element:{get:function(){return this._element},set:function(e){let t=this._element;t!==e&&(u(t)&&t.removeEventListener("seeked",this._seekFunction,!1),u(e)&&(this._seeking=!1,this._seekFunction=$et(this),e.addEventListener("seeked",this._seekFunction,!1)),this._element=e,this._seeking=!1,this._firstTickAfterSeek=!1)}}});zx.prototype.destroy=function(){return this.element=void 0,this.clock=void 0,le(this)};zx.prototype.isDestroyed=function(){return!1};zx.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};zx.prototype._onTick=function(e){let t=this._element;if(!u(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=y(this.epoch,ze.MINIMUM_VALUE),s=$.secondsDifference(o,r),a=t.duration,c,l=t.currentTime;t.loop?(s=s%a,s<0&&(s=a-s),c=s):s>a?c=a:s<0?c=0:c=s;let f=i?y(this.tolerance,1):.001;Math.abs(c-l)>f&&(this._seeking=!0,t.currentTime=c)};function $et(e){return function(){e._seeking=!1,e._firstTickAfterSeek=!0}}var iY=zx;var ett={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},oY=Object.freeze(ett);var x_;typeof cancelAnimationFrame<"u"&&(x_=cancelAnimationFrame);(function(){if(!u(x_)&&typeof window<"u"){let e=["webkit","moz","ms","o"],t=0,n=e.length;for(;t<n&&!u(x_);)x_=window[`${e[t]}CancelAnimationFrame`],u(x_)||(x_=window[`${e[t]}CancelRequestAnimationFrame`]),++t}u(x_)||(x_=clearTimeout)})();function ttt(e){nr("Cesium.cancelAnimationFrame","Cesium.cancelAnimationFrame was deprecated in CesiumJS 1.96 and will be removed in 1.99. Use the native cancelAnimationFrame method instead."),x_(e)}var rY=ttt;function ntt(e){return e=y(e,y.EMPTY_OBJECT),new nL({url:Qd.fromAssetId(1),requestVertexNormals:y(e.requestVertexNormals,!1),requestWaterMask:y(e.requestWaterMask,!1)})}var gL=ntt;var itt=1953029805,ott=2917034100;function sY(e,t){if(sY.passThroughDataForTesting)return t;let n=e.byteLength;if(n===0||n%4!==0)throw new ue("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===itt||o===ott)return t;let r=new DataView(e),s=0,a=t.byteLength,c=a-a%8,l=n,f,d=8;for(;s<c;)for(d=(d+8)%24,f=d;s<c&&f<l;)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>=l&&(d=(d+8)%24,f=d);s<a;)i.setUint8(s,i.getUint8(s)^r.getUint8(f)),s++,f++}sY.passThroughDataForTesting=!1;var yL=sY;function rtt(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 AL=rtt;var aY=[],cY=[];function stt(e,t,n,i,o,r){let s=o-i+1,a=r-o,c=aY,l=cY,f,d;for(f=0;f<s;++f)c[f]=e[i+f];for(d=0;d<a;++d)l[d]=e[o+d+1];f=0,d=0;for(let p=i;p<=r;++p){let g=c[f],m=l[d];f<s&&(d>=a||t(g,m,n)<=0)?(e[p]=g,++f):d<a&&(e[p]=m,++d)}}function lY(e,t,n,i,o){if(i>=o)return;let r=Math.floor((i+o)*.5);lY(e,t,n,i,r),lY(e,t,n,r+1,o),stt(e,t,n,i,r,o)}function att(e,t,n){let i=e.length,o=Math.ceil(i*.5);aY.length=o,cY.length=o,lY(e,t,n,0,i-1),aY.length=0,cY.length=0}var C_=att;var ctt=new h;function ltt(e,t,n,i){let o=R0(e,t,n,i,ctt);return u(o)?o.x>0&&o.y>0&&o.z>0:!1}var uY=ltt;var Hx;typeof requestAnimationFrame<"u"&&(Hx=requestAnimationFrame);(function(){if(!u(Hx)&&typeof window<"u"){let e=["webkit","moz","ms","o"],t=0,n=e.length;for(;t<n&&!u(Hx);)Hx=window[`${e[t]}RequestAnimationFrame`],++t}if(!u(Hx)){let e=16.666666666666668,t=0;Hx=function(n){let i=di(),o=Math.max(e-(i-t),0);return t=i+o,setTimeout(function(){n(t)},o)}}})();function utt(e){return nr("Cesium.requestAnimationFrame","Cesium.requestAnimationFrame was deprecated in CesiumJS 1.96 and will be removed in 1.99. Use the native requestAnimationFrame method instead."),Hx(e)}var fY=utt;function ftt(e){switch(e){case ee.FLOAT:return"float";case ee.FLOAT_VEC2:return"vec2";case ee.FLOAT_VEC3:return"vec3";case ee.FLOAT_VEC4:return"vec4";case ee.FLOAT_MAT2:return"mat2";case ee.FLOAT_MAT3:return"mat3";case ee.FLOAT_MAT4:return"mat4";case ee.SAMPLER_2D:return"sampler2D";case ee.BOOL:return"bool"}}var dY=ftt;function dtt(e,t,n){return function(){n.apply(e,arguments),t.apply(e,arguments)}}var xL=dtt;function hY(e){e=y(e,y.EMPTY_OBJECT),this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;let t=Oe.createIfNeeded(e.missingImageUrl),n=this;function i(r){u(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=Wf(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0,c=r.width,l=e.pixelsToCheck;for(let f=0,d=l.length;a&&f<d;++f){let p=l[f],g=p.x*4+p.y*c;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)}hY.prototype.isReady=function(){return this._isReady};hY.prototype.shouldDiscardImage=function(e){let t=this._pixelsToCheck,n=this._missingImagePixels;if(!u(n)||u(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;let i=Wf(e),o=e.width;for(let r=0,s=t.length;r<s;++r){let a=t[r],c=a.x*4+a.y*o;for(let l=0;l<4;++l){let f=c+l;if(i[f]!==n[f])return!1}}return!0};var CL=hY;function mY(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}mY.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)}u(n)&&(this.name=e[n])};mY.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];u(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 eh=mY;function Xb(){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,de.throwInstantiationError()}Object.defineProperties(Xb.prototype,{ready:{get:de.throwInstantiationError},readyPromise:{get:de.throwInstantiationError},rectangle:{get:de.throwInstantiationError},tileWidth:{get:de.throwInstantiationError},tileHeight:{get:de.throwInstantiationError},maximumLevel:{get:de.throwInstantiationError},minimumLevel:{get:de.throwInstantiationError},tilingScheme:{get:de.throwInstantiationError},tileDiscardPolicy:{get:de.throwInstantiationError},errorEvent:{get:de.throwInstantiationError},credit:{get:de.throwInstantiationError},proxy:{get:de.throwInstantiationError},hasAlphaChannel:{get:de.throwInstantiationError}});Xb.prototype.getTileCredits=function(e,t,n){de.throwInstantiationError()};Xb.prototype.requestImage=function(e,t,n,i){de.throwInstantiationError()};Xb.prototype.pickFeatures=function(e,t,n,i,o){de.throwInstantiationError()};var htt=/\.ktx2$/i;Xb.loadImage=function(e,t){let n=Oe.createIfNeeded(t);return htt.test(n.url)?tl(n):u(e)&&u(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};var Gc=Xb;function TL(e){e=y(e,y.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=Oe.createIfNeeded(e.url);t.appendForwardSlash(),u(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=y(e.tilingScheme,new ji({ellipsoid:e.ellipsoid})),this._useTiles=y(e.usePreCachedTilesIfAvailable,!0),this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;let n=e.credit;typeof n=="string"&&(n=new Zt(n)),this._credit=n,this.enablePickFeatures=y(e.enablePickFeatures,!0),this._errorEvent=new Ae,this._ready=!1;let i=this,o;function r(c){let l=c.tileInfo;if(!u(l))i._useTiles=!1;else{if(i._tileWidth=l.rows,i._tileHeight=l.cols,l.spatialReference.wkid===102100||l.spatialReference.wkid===102113)i._tilingScheme=new Gr({ellipsoid:e.ellipsoid});else if(c.tileInfo.spatialReference.wkid===4326)i._tilingScheme=new ji({ellipsoid:e.ellipsoid});else{let f=`Tile spatial reference WKID ${c.tileInfo.spatialReference.wkid} is not supported.`;return o=Xn.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new ue(f))}if(i._maximumLevel=c.tileInfo.lods.length-1,u(c.fullExtent)){if(u(c.fullExtent.spatialReference)&&u(c.fullExtent.spatialReference.wkid))if(c.fullExtent.spatialReference.wkid===102100||c.fullExtent.spatialReference.wkid===102113){let f=new Si,d=c.fullExtent,p=f.unproject(new h(Math.max(d.xmin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(d.ymin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),g=f.unproject(new h(Math.min(d.xmax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(d.ymax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));i._rectangle=new ce(p.longitude,p.latitude,g.longitude,g.latitude)}else if(c.fullExtent.spatialReference.wkid===4326)i._rectangle=ce.fromDegrees(c.fullExtent.xmin,c.fullExtent.ymin,c.fullExtent.xmax,c.fullExtent.ymax);else{let f=`fullExtent.spatialReference WKID ${c.fullExtent.spatialReference.wkid} is not supported.`;return o=Xn.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new ue(f))}}else i._rectangle=i._tilingScheme.rectangle;u(i._tileDiscardPolicy)||(i._tileDiscardPolicy=new CL({missingImageUrl:Upe(i,0,0,i._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})),i._useTiles=!0}return u(c.copyrightText)&&c.copyrightText.length>0&&(i._credit=new Zt(c.copyrightText)),i._ready=!0,Xn.reportSuccess(o),Promise.resolve(!0)}function s(c){let l=`An error occurred while accessing ${i._resource.url}.`;return o=Xn.reportError(o,i,i._errorEvent,l,void 0,void 0,void 0),Promise.reject(new ue(l))}function a(){return i._resource.getDerivedResource({queryParameters:{f:"json"}}).fetchJsonp().then(r).catch(s)}this._useTiles?this._readyPromise=a():(this._ready=!0,this._readyPromise=Promise.resolve(!0))}function Upe(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),c={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof Ei?(c.bboxSR=4326,c.imageSR=4326):(c.bboxSR=3857,c.imageSR=3857),e.layers&&(c.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:c})}return r}Object.defineProperties(TL.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}});TL.prototype.getTileCredits=function(e,t,n){};TL.prototype.requestImage=function(e,t,n,i){return Gc.loadImage(this,Upe(this,e,t,n,i))};TL.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures)return;let r=this._tilingScheme.tileXYToNativeRectangle(e,t,n),s,a,c;if(this._tilingScheme.projection instanceof Ei)s=P.toDegrees(i),a=P.toDegrees(o),c="4326";else{let p=this._tilingScheme.projection.project(new he(i,o,0));s=p.x,a=p.y,c="3857"}let l="visible";u(this._layers)&&(l+=`:${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:c,layers:l};return this._resource.getDerivedResource({url:"identify",queryParameters:f}).fetchJson().then(function(p){let g=[],m=p.results;if(!u(m))return g;for(let A=0;A<m.length;++A){let x=m[A],C=new eh;if(C.data=x,C.name=x.value,C.properties=x.attributes,C.configureDescriptionFromProperties(x.attributes),x.geometryType==="esriGeometryPoint"&&x.geometry){let T=x.geometry.spatialReference&&x.geometry.spatialReference.wkid?x.geometry.spatialReference.wkid:4326;if(T===4326||T===4283)C.position=he.fromDegrees(x.geometry.x,x.geometry.y,x.geometry.z);else if(T===102100||T===900913||T===3857){let E=new Si;C.position=E.unproject(new h(x.geometry.x,x.geometry.y,x.geometry.z))}}g.push(C)}return g})};var T_=TL;var mtt={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"},EL=Object.freeze(mtt);function bL(e){}bL.prototype.isReady=function(){return!0};bL.prototype.shouldDiscardImage=function(e){return bL.EMPTY_IMAGE===e};var zz;Object.defineProperties(bL,{EMPTY_IMAGE:{get:function(){return u(zz)||(zz=new Image,zz.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),zz}}});var Kb=bL;function Qs(e){e=y(e,y.EMPTY_OBJECT);let t=e.key;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._key=t,this._resource=Oe.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=y(e.mapStyle,EL.AERIAL),this._culture=y(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,u(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new Kb),this._proxy=e.proxy,this._credit=new Zt(`<a href="https://www.microsoft.com/en-us/maps/product/enduserterms"><img src="${Qs.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new Gr({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._errorEvent=new Ae,this._ready=!1;let n=this._tileProtocol;u(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";let i=this._resource.getDerivedResource({url:`REST/v1/Imagery/Metadata/${this._mapStyle}`,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:n}}),o=this,r;function s(d){if(d.resourceSets.length!==1)return a();let p=d.resourceSets[0].resources[0];o._tileWidth=p.imageWidth,o._tileHeight=p.imageHeight,o._maximumLevel=p.zoomMax-1,o._imageUrlSubdomains=p.imageUrlSubdomains,o._imageUrlTemplate=p.imageUrl;let g=o._attributionList=p.imageryProviders;g||(g=o._attributionList=[]);for(let m=0,A=g.length;m<A;++m){let x=g[m];if(x.credit instanceof Zt)break;x.credit=new Zt(x.attribution);let C=x.coverageAreas;for(let T=0,E=x.coverageAreas.length;T<E;++T){let S=C[T],D=S.bbox;S.bbox=new ce(P.toRadians(D[1]),P.toRadians(D[0]),P.toRadians(D[3]),P.toRadians(D[2]))}}return o._ready=!0,Xn.reportSuccess(r),Promise.resolve(!0)}function a(d){let p=`An error occurred while accessing ${i.url}.`;return r=Xn.reportError(r,o,o._errorEvent,p,void 0,void 0,void 0),r.retry?l():Promise.reject(new ue(p))}let c=i.url;function l(){let d=i.fetchJsonp("jsonp");return Qs._metadataCache[c]=d,d.then(s).catch(a)}let f=Qs._metadataCache[c];u(f)?this._readyPromise=f.then(s).catch(a):this._readyPromise=l()}Object.defineProperties(Qs.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}},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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});var ptt=new ce;Qs.prototype.getTileCredits=function(e,t,n){let i=this._tilingScheme.tileXYToRectangle(e,t,n,ptt);return ytt(this._attributionList,n,i)};Qs.prototype.requestImage=function(e,t,n,i){let o=Gc.loadImage(this,_tt(this,e,t,n,i));if(u(o))return o.catch(function(r){return u(r.blob)&&r.blob.size===0?Kb.EMPTY_IMAGE:Promise.reject(r)})};Qs.prototype.pickFeatures=function(e,t,n,i,o){};Qs.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};Qs.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}};Qs._logoUrl=void 0;Object.defineProperties(Qs,{logoUrl:{get:function(){return u(Qs._logoUrl)||(Qs._logoUrl=$t("Assets/Images/bing_maps_credit.png")),Qs._logoUrl},set:function(e){Qs._logoUrl=e}}});function _tt(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:Qs.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}var gtt=new ce;function ytt(e,t,n){++t;let i=[];for(let o=0,r=e.length;o<r;++o){let s=e[o],a=s.coverageAreas,c=!1;for(let l=0,f=s.coverageAreas.length;!c&&l<f;++l){let d=a[l];if(t>=d.zoomMin&&t<=d.zoomMax){let p=ce.intersection(n,d.bbox,gtt);u(p)&&(c=!0)}}c&&i.push(s.credit)}return i}Qs._metadataCache={};var SL=Qs;var kpe=/{[^}]+}/g,zpe={x:Ttt,y:btt,z:vtt,s:wtt,reverseX:Ett,reverseY:Stt,reverseZ:Dtt,westDegrees:Itt,southDegrees:Ptt,eastDegrees:Ott,northDegrees:Rtt,westProjected:Btt,southProjected:Mtt,eastProjected:Ltt,northProjected:Ntt,width:Ftt,height:Vtt},Att=_t(zpe,{i:Utt,j:ktt,reverseI:ztt,reverseJ:Htt,longitudeDegrees:Wtt,latitudeDegrees:jtt,longitudeProjected:Ytt,latitudeProjected:qtt,format:Ktt});function Qb(e){this._errorEvent=new Ae,this._resource=void 0,this._urlSchemeZeroPadding=void 0,this._pickFeaturesResource=void 0,this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._minimumLevel=void 0,this._tilingScheme=void 0,this._rectangle=void 0,this._tileDiscardPolicy=void 0,this._credit=void 0,this._hasAlphaChannel=void 0,this._readyPromise=void 0,this._tags=void 0,this._pickFeaturesTags=void 0,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=!0,this.reinitialize(e)}Object.defineProperties(Qb.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}},ready:{get:function(){return u(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}});Qb.prototype.reinitialize=function(e){let t=this;t._readyPromise=Promise.resolve(e).then(function(n){let i=n.customTags,o=_t(zpe,i),r=_t(Att,i),s=Oe.createIfNeeded(n.url),a=Oe.createIfNeeded(n.pickFeaturesUrl);t.enablePickFeatures=y(n.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=y(n.urlSchemeZeroPadding,t.urlSchemeZeroPadding),t._tileDiscardPolicy=n.tileDiscardPolicy,t._getFeatureInfoFormats=n.getFeatureInfoFormats,t._subdomains=n.subdomains,Array.isArray(t._subdomains)?t._subdomains=t._subdomains.slice():u(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=y(n.tileWidth,256),t._tileHeight=y(n.tileHeight,256),t._minimumLevel=y(n.minimumLevel,0),t._maximumLevel=n.maximumLevel,t._tilingScheme=y(n.tilingScheme,new Gr({ellipsoid:n.ellipsoid})),t._rectangle=y(n.rectangle,t._tilingScheme.rectangle),t._rectangle=ce.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=y(n.hasAlphaChannel,!0);let c=n.credit;return typeof c=="string"&&(c=new Zt(c)),t._credit=c,t._resource=s,t._tags=o,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0})};Qb.prototype.getTileCredits=function(e,t,n){};Qb.prototype.requestImage=function(e,t,n,i){return Gc.loadImage(this,xtt(this,e,t,n,i))};Qb.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures||!u(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0,s=this;function a(l,f){return l.callback(f)}function c(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);let l=s._getFeatureInfoFormats[r],f=Ctt(s,e,t,n,i,o,l.format);return++r,l.type==="json"?f.fetchJson().then(l.callback).catch(c):l.type==="xml"?f.fetchXML().then(l.callback).catch(c):l.type==="text"||l.type==="html"?f.fetchText().then(l.callback).catch(c):f.fetch({responseType:l.format}).then(a.bind(void 0,l)).catch(c)}return c()};var Hz=!1,Eu=new ce,Gz=!1,DL=new ce;function xtt(e,t,n,i,o){Hz=!1,Gz=!1;let r=e._resource,s=r.getUrlComponent(!0),a=e._tags,c={},l=s.match(kpe);return u(l)&&l.forEach(function(f){let d=f.substring(1,f.length-1);u(a[d])&&(c[d]=a[d](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:c})}var pY=!1,Jb=new H,_Y=!1;function Ctt(e,t,n,i,o,r,s){Hz=!1,Gz=!1,pY=!1,_Y=!1;let a=e._pickFeaturesResource,c=a.getUrlComponent(!0),l=e._pickFeaturesTags,f={},d=c.match(kpe);return u(d)&&d.forEach(function(p){let g=p.substring(1,p.length-1);u(l[g])&&(f[g]=l[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:f})}function $b(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 Ttt(e,t,n,i){return $b(e,"{x}",t)}function Ett(e,t,n,i){let o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return $b(e,"{reverseX}",o)}function btt(e,t,n,i){return $b(e,"{y}",n)}function Stt(e,t,n,i){let o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return $b(e,"{reverseY}",o)}function Dtt(e,t,n,i){let o=e.maximumLevel,r=u(o)&&i<o?o-i-1:i;return $b(e,"{reverseZ}",r)}function vtt(e,t,n,i){return $b(e,"{z}",i)}function wtt(e,t,n,i){let o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function Wz(e,t,n,i){Hz||(e.tilingScheme.tileXYToRectangle(t,n,i,Eu),Eu.west=P.toDegrees(Eu.west),Eu.south=P.toDegrees(Eu.south),Eu.east=P.toDegrees(Eu.east),Eu.north=P.toDegrees(Eu.north),Hz=!0)}function Itt(e,t,n,i){return Wz(e,t,n,i),Eu.west}function Ptt(e,t,n,i){return Wz(e,t,n,i),Eu.south}function Ott(e,t,n,i){return Wz(e,t,n,i),Eu.east}function Rtt(e,t,n,i){return Wz(e,t,n,i),Eu.north}function jz(e,t,n,i){Gz||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,DL),Gz=!0)}function Btt(e,t,n,i){return jz(e,t,n,i),DL.west}function Mtt(e,t,n,i){return jz(e,t,n,i),DL.south}function Ltt(e,t,n,i){return jz(e,t,n,i),DL.east}function Ntt(e,t,n,i){return jz(e,t,n,i),DL.north}function Ftt(e,t,n,i){return e.tileWidth}function Vtt(e,t,n,i){return e.tileHeight}function Utt(e,t,n,i,o,r,s){return Yz(e,t,n,i,o,r),Jb.x}function ktt(e,t,n,i,o,r,s){return Yz(e,t,n,i,o,r),Jb.y}function ztt(e,t,n,i,o,r,s){return Yz(e,t,n,i,o,r),e.tileWidth-Jb.x-1}function Htt(e,t,n,i,o,r,s){return Yz(e,t,n,i,o,r),e.tileHeight-Jb.y-1}var Gtt=new ce,Zb=new h;function Yz(e,t,n,i,o,r,s){if(pY)return;gY(e,t,n,i,o,r);let a=Zb,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,Gtt);Jb.x=e.tileWidth*(a.x-c.west)/c.width|0,Jb.y=e.tileHeight*(c.north-a.y)/c.height|0,pY=!0}function Wtt(e,t,n,i,o,r,s){return P.toDegrees(o)}function jtt(e,t,n,i,o,r,s){return P.toDegrees(r)}function Ytt(e,t,n,i,o,r,s){return gY(e,t,n,i,o,r),Zb.x}function qtt(e,t,n,i,o,r,s){return gY(e,t,n,i,o,r),Zb.y}var Xtt=new he;function gY(e,t,n,i,o,r,s){if(!_Y){if(e.tilingScheme.projection instanceof Ei)Zb.x=P.toDegrees(o),Zb.y=P.toDegrees(r);else{let a=Xtt;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,Zb)}_Y=!0}}function Ktt(e,t,n,i,o,r,s){return s}var ya=Qb;function Gx(e){e=y(e,y.EMPTY_OBJECT),this._tmsResource=void 0,this._xmlResource=void 0,this._options=e,this._metadataError=void 0,this._metadataSuccess=this._metadataSuccess.bind(this),this._metadataFailure=this._metadataFailure.bind(this),this._requestMetadata=this._requestMetadata.bind(this);let t,n=this,i=Promise.resolve(e.url).then(function(o){return t=Oe.createIfNeeded(o),t.appendForwardSlash(),n._tmsResource=t,n._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),n._requestMetadata()}).catch(o=>Promise.reject(o));ya.call(this,i),this._promise=i}u(Object.create)&&(Gx.prototype=Object.create(ya.prototype),Gx.prototype.constructor=Gx);Gx.prototype._requestMetadata=function(){return this._xmlResource.fetchXML().then(this._metadataSuccess).catch(e=>e instanceof ph?this._metadataFailure():Promise.reject(e))};function Hpe(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 Gpe(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}Gx.prototype._metadataSuccess=function(e){let t=/tileformat/i,n=/tileset/i,i=/tilesets/i,o=/boundingbox/i,r,s,a,c=[],l=this._xmlResource,f=this._metadataError,d=this._requestMetadata,p=e.childNodes[0].childNodes;for(let O=0;O<p.length;O++)if(t.test(p.item(O).nodeName))r=p.item(O);else if(i.test(p.item(O).nodeName)){a=p.item(O);let L=p.item(O).childNodes;for(let N=0;N<L.length;N++)n.test(L.item(N).nodeName)&&c.push(L.item(N))}else o.test(p.item(O).nodeName)&&(s=p.item(O));let g;if(!u(a)||!u(s))return g=`Unable to find expected tilesets or bbox attributes in ${l.url}.`,f=Xn.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,d()):Promise.reject(new ue(g));let m=this._options,A=y(m.fileExtension,r.getAttribute("extension")),x=y(m.tileWidth,parseInt(r.getAttribute("width"),10)),C=y(m.tileHeight,parseInt(r.getAttribute("height"),10)),T=y(m.minimumLevel,parseInt(c[0].getAttribute("order"),10)),E=y(m.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),S=a.getAttribute("profile"),D=m.tilingScheme;if(!u(D))if(S==="geodetic"||S==="global-geodetic")D=new ji({ellipsoid:m.ellipsoid});else if(S==="mercator"||S==="global-mercator")D=new Gr({ellipsoid:m.ellipsoid});else return g=`${l.url}specifies an unsupported profile attribute, ${S}.`,f=Xn.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,d()):Promise.reject(new ue(g));let w=ce.clone(m.rectangle);if(!u(w)){let O,L,N,_;y(m.flipXY,!1)?(N=new H(parseFloat(s.getAttribute("miny")),parseFloat(s.getAttribute("minx"))),_=new H(parseFloat(s.getAttribute("maxy")),parseFloat(s.getAttribute("maxx")))):(N=new H(parseFloat(s.getAttribute("minx")),parseFloat(s.getAttribute("miny"))),_=new H(parseFloat(s.getAttribute("maxx")),parseFloat(s.getAttribute("maxy"))));let v=S==="geodetic"||S==="mercator";if(D.projection instanceof Ei||v)O=he.fromDegrees(N.x,N.y),L=he.fromDegrees(_.x,_.y);else{let I=D.projection;O=I.unproject(N),L=I.unproject(_)}w=new ce(O.longitude,O.latitude,L.longitude,L.latitude)}w=Hpe(w,D),T=Gpe(D,w,T);let R=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${A}`});return Promise.resolve({url:R,tilingScheme:D,rectangle:w,tileWidth:x,tileHeight:C,minimumLevel:T,maximumLevel:E,tileDiscardPolicy:m.tileDiscardPolicy,credit:m.credit})};Gx.prototype._metadataFailure=function(){let e=this._options,t=y(e.fileExtension,"png"),n=y(e.tileWidth,256),i=y(e.tileHeight,256),o=e.maximumLevel,r=u(e.tilingScheme)?e.tilingScheme:new Gr({ellipsoid:e.ellipsoid}),s=y(e.rectangle,r.rectangle);s=Hpe(s,r);let a=Gpe(r,s,e.minimumLevel),c=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${t}`});return Promise.resolve({url:c,tilingScheme:r,rectangle:s,tileWidth:n,tileHeight:i,minimumLevel:a,maximumLevel:o,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit})};var Fy=Gx;function wf(e){e=y(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;let t=e.url,n=y(e.path,"/default_map"),i=Oe.createIfNeeded(t).getDerivedResource({url:n[0]==="/"?n.substring(1):n});i.appendForwardSlash(),this._resource=i,this._url=t,this._path=n,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Zt(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${wf.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 Ae,this._ready=!1;let o=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),r=this,s;function a(f){let d;try{d=JSON.parse(f)}catch{d=JSON.parse(f.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let p;for(let m=0;m<d.layers.length;m++)if(d.layers[m].id===r._channel){p=d.layers[m];break}let g;if(!u(p))return g=`Could not find layer with channel (id) of ${r._channel}.`,s=Xn.reportError(s,r,r._errorEvent,g),s.retry?l():Promise.reject(new ue(g));if(!u(p.version))return g=`Could not find a version in channel (id) ${r._channel}.`,s=Xn.reportError(s,r,r._errorEvent,g),s.retry?l():Promise.reject(new ue(g));if(r._version=p.version,u(d.projection)&&d.projection==="flat")r._tilingScheme=new ji({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else if(!u(d.projection)||d.projection==="mercator")r._tilingScheme=new Gr({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid});else return g=`Unsupported projection ${d.projection}.`,s=Xn.reportError(s,r,r._errorEvent,g),s.retry?l():Promise.reject(new ue(g));return r._ready=!0,Xn.reportSuccess(s),Promise.resolve(!0)}function c(f){let d=y(f.message,`An error occurred while accessing ${o.url}.`);return s=Xn.reportError(s,r,r._errorEvent,d),Promise.reject(new ue(d))}function l(){return o.fetchText().then(a).catch(c)}this._readyPromise=l()}Object.defineProperties(wf.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});wf.prototype.getTileCredits=function(e,t,n){};wf.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 Gc.loadImage(this,o)};wf.prototype.pickFeatures=function(e,t,n,i,o){};wf._logoUrl=void 0;Object.defineProperties(wf,{logoUrl:{get:function(){return u(wf._logoUrl)||(wf._logoUrl=$t("Assets/Images/google_earth_credit.png")),wf._logoUrl},set:function(e){wf._logoUrl=e}}});var vL=wf;var Ztt=/\/$/,Wpe=new Zt('&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 eS(e){e=y(e,y.EMPTY_OBJECT);let t=e.mapId,n=e.accessToken;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=Oe.createIfNeeded(y(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=y(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();Ztt.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;u(e.credit)?(s=e.credit,typeof s=="string"&&(s=new Zt(s))):s=Wpe,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(eS.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},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}}});eS.prototype.getTileCredits=function(e,t,n){};eS.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};eS.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};eS._defaultCredit=Wpe;var wL=eS;function IL(e){e=y(e,y.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=Oe.createIfNeeded(e.url),n=y(e.rectangle,ce.MAX_VALUE),i=new ji({rectangle:n,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=i,this._resource=t,this._image=void 0,this._texture=void 0,this._tileWidth=0,this._tileHeight=0,this._errorEvent=new Ae,this._ready=!1;let o=e.credit;typeof o=="string"&&(o=new Zt(o)),this._credit=o;let r=this,s;function a(f){return r._image=f,r._tileWidth=f.width,r._tileHeight=f.height,r._ready=!0,Xn.reportSuccess(r._errorEvent),Promise.resolve(!0)}function c(f){let d=`Failed to load image ${t.url}.`;return s=Xn.reportError(s,r,r._errorEvent,d,0,0,0),s.retry?l():Promise.reject(new ue(d))}function l(){return Gc.loadImage(null,t).then(a).catch(c)}this._readyPromise=l()}Object.defineProperties(IL.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});IL.prototype.getTileCredits=function(e,t,n){};IL.prototype.requestImage=function(e,t,n,i){if(u(this._image))return Promise.resolve(this._image)};IL.prototype.pickFeatures=function(e,t,n,i,o){};var PL=IL;function Jtt(e,t,n){this.type=e,u(t)||(e==="json"?t="application/json":e==="xml"?t="text/xml":e==="html"?t="text/html":e==="text"&&(t="text/plain")),this.format=t,u(n)||(e==="json"?n=Qtt:e==="xml"?n=nnt:(e==="html"||e==="text")&&(n=jpe)),this.callback=n}function Qtt(e){let t=[],n=e.features;for(let i=0;i<n.length;++i){let o=n[i],r=new eh;if(r.data=o,r.properties=o.properties,r.configureNameFromProperties(o.properties),r.configureDescriptionFromProperties(o.properties),u(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 yY="http://www.mapinfo.com/mxp",$tt="http://www.esri.com/wms",ent="http://www.opengis.net/wfs",tnt="http://www.opengis.net/gml";function nnt(e){let t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===yY)return int(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===$tt)return ont(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===ent)return rnt(e);if(t.localName==="ServiceExceptionReport")throw new ue(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?snt(e):ant(e)}function int(e){let t=[],i=e.documentElement.getElementsByTagNameNS(yY,"Feature");for(let o=0;o<i.length;++o){let r=i[o],s={},a=r.getElementsByTagNameNS(yY,"Val");for(let l=0;l<a.length;++l){let f=a[l];if(f.hasAttribute("ref")){let d=f.getAttribute("ref"),p=f.textContent.trim();s[d]=p}}let c=new eh;c.data=r,c.properties=s,c.configureNameFromProperties(s),c.configureDescriptionFromProperties(s),t.push(c)}return t}function ont(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 c=0;c<a.length;++c){let l=a[c];i[l.name]=l.value}n.push(qz(s,i))}else{let r=t.getElementsByTagNameNS("*","FeatureInfo");for(let s=0;s<r.length;++s){let a=r[s];i={};let c=a.childNodes;for(let l=0;l<c.length;++l){let f=c[l];f.nodeType===Node.ELEMENT_NODE&&(i[f.localName]=f.textContent)}n.push(qz(a,i))}}return n}function rnt(e){let t=[],i=e.documentElement.getElementsByTagNameNS(tnt,"featureMember");for(let o=0;o<i.length;++o){let r=i[o],s={};AY(r,s),t.push(qz(r,s))}return t}function snt(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(!u(n))throw new ue("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={};AY(s,a),t.push(qz(s,a))}}return t}function AY(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()&&AY(o,t)&&(t[o.localName]=o.textContent)}return n}function qz(e,t){let n=new eh;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function ant(e){let t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);let o=new eh;return o.data=e,o.description=n.innerHTML,[o]}var cnt=/<body>\s*<\/body>/im,lnt=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,unt=/<title>([\s\S]*)<\/title>/im;function jpe(e){if(cnt.test(e)||lnt.test(e))return;let t,n=unt.exec(e);n&&n.length>1&&(t=n[1]);let i=new eh;return i.name=t,i.description=e,i.data=e,[i]}var Wx=Jtt;function OL(e){e=y(e,y.EMPTY_OBJECT),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(OL.prototype,{clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});OL.prototype.getFromCache=function(e,t,n,i){let o=Ype(e,t,n),r,s=this._tileCache[this._currentIntervalIndex];if(u(s)&&u(s[o])){let a=s[o];r=a.promise.catch(function(c){throw i.state=a.request.state,c}),delete s[o]}return r};OL.prototype.checkApproachingInterval=function(e,t,n,i){let o=Ype(e,t,n),r=this._tilesRequestedForInterval,s=qpe(this),a={key:o,priorityFunction:i.priorityFunction};(!u(s)||!Xpe(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};OL.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=qpe(this);if(u(r)){let s=this._tilesRequestedForInterval,a=!0;for(;a&&s.length!==0;){let c=s.pop();a=Xpe(this,c,r),a||s.push(c)}}};function Ype(e,t,n){return`${e}-${t}-${n}`}function fnt(e){let t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function qpe(e){let t=e._times;if(!u(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 c=t.get(a);return r>0?(s=$.secondsDifference(c.stop,i),++a):(s=$.secondsDifference(c.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function Xpe(e,t,n){let i=e._times.indexOf(n.start),o=e._tileCache,r=o[i];u(r)||(r=o[i]={});let s=t.key;if(u(r[s]))return!0;let a=fnt(s),c=new zo({throttle:!1,throttleByServer:!0,type:Qr.IMAGERY,priorityFunction:t.priorityFunction}),l=e._requestImageFunction(a.x,a.y,a.level,c,n);return u(l)?(r[s]={promise:l,request:c},!0):!1}var jx=OL;var dnt=[3034,3035,3042,3043,3044],hnt=[4471,4559];function th(e){if(e=y(e,y.EMPTY_OBJECT),u(e.times)&&!u(e.clock))throw new de("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=y(e.getFeatureInfoUrl,e.url);let t=Oe.createIfNeeded(e.url),n=Oe.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(th.DefaultParameters,!0),n.setQueryParameters(th.GetFeatureInfoDefaultParameters,!0),u(e.parameters)&&t.setQueryParameters(Kpe(e.parameters)),u(e.getFeatureInfoParameters)&&n.setQueryParameters(Kpe(e.getFeatureInfoParameters));let i=this;this._reload=void 0,u(e.times)&&(this._timeDynamicImagery=new jx({clock:e.clock,times:e.times,requestImageFunction:function(s,a,c,l,f){return Zpe(i,s,a,c,l,f)},reloadFunction:function(){u(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=y(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof Si?"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&&!hnt.includes(a)||dnt.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=y(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof Si?"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:y(e.tilingScheme,new ji({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:y(e.getFeatureInfoFormats,th.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function Zpe(e,t,n,i,o,r){let s=u(r)?r.data:void 0,a=e._tileProvider;return u(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function mnt(e,t,n,i,o,r,s){let a=u(s)?s.data:void 0,c=e._tileProvider;return u(a)&&c._pickFeaturesResource.setQueryParameters(a),c.pickFeatures(t,n,i,o,r)}Object.defineProperties(th.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}},ready:{get:function(){return this._tileProvider.ready}},readyPromise:{get:function(){return this._tileProvider.readyPromise}},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}}});th.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};th.prototype.requestImage=function(e,t,n,i){let o,r=this._timeDynamicImagery,s;return u(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),u(o)||(o=Zpe(this,e,t,n,i,s)),u(o)&&u(r)&&r.checkApproachingInterval(e,t,n,i),o};th.prototype.pickFeatures=function(e,t,n,i,o){let r=this._timeDynamicImagery,s=u(r)?r.currentInterval:void 0;return mnt(this,e,t,n,i,o,s)};th.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});th.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});th.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new Wx("json","application/json")),Object.freeze(new Wx("xml","text/xml")),Object.freeze(new Wx("text","text/html"))]);function Kpe(e){let t={};for(let n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}var RL=th;var pnt=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function BL(e){e=y(e,y.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=Oe.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!u(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(pnt),this._useKvp=!0;else{let d={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(d),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=y(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=u(e.tilingScheme)?e.tilingScheme:new Gr({ellipsoid:e.ellipsoid}),this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._minimumLevel=y(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;let s=this;this._reload=void 0,u(e.times)&&(this._timeDynamicImagery=new jx({clock:e.clock,times:e.times,requestImageFunction:function(d,p,g,m,A){return Jpe(s,d,p,g,m,A)},reloadFunction:function(){u(s._reload)&&s._reload()}})),this._readyPromise=Promise.resolve(!0);let a=this._tilingScheme.positionToTileXY(ce.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(ce.northeast(this._rectangle),this._minimumLevel),l=(Math.abs(c.x-a.x)+1)*(Math.abs(c.y-a.y)+1);this._errorEvent=new Ae;let f=e.credit;this._credit=typeof f=="string"?new Zt(f):f,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():u(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function Jpe(e,t,n,i,o,r){let s=e._tileMatrixLabels,a=u(s)?s[i]:i.toString(),c=e._subdomains,l=e._dimensions,f=u(r)?r.data:void 0,d,p;if(!e._useKvp)p={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({request:o}),d.setTemplateValues(p),u(l)&&d.setTemplateValues(l),u(f)&&d.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,u(l)&&(g=_t(g,l)),u(f)&&(g=_t(g,f)),p={s:c[(t+n+i)%c.length]},d=e._resource.getDerivedResource({queryParameters:g,request:o}),d.setTemplateValues(p)}return Gc.loadImage(e,d)}Object.defineProperties(BL.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}},ready:{value:!0},readyPromise:{get:function(){return this._readyPromise}},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,u(this._reload)&&this._reload())}}});BL.prototype.getTileCredits=function(e,t,n){};BL.prototype.requestImage=function(e,t,n,i){let o,r=this._timeDynamicImagery,s;return u(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),u(o)||(o=Jpe(this,e,t,n,i,s)),u(o)&&u(r)&&r.checkApproachingInterval(e,t,n,i),o};BL.prototype.pickFeatures=function(e,t,n,i,o){};var ML=BL;function E_(e){return function(t){return new e(t)}}var _nt={ARCGIS_MAPSERVER:E_(T_),BING:E_(SL),GOOGLE_EARTH:E_(vL),MAPBOX:E_(wL),SINGLE_TILE:E_(PL),TMS:E_(Fy),URL_TEMPLATE:E_(ya),WMS:E_(RL),WMTS:E_(ML)};function Vy(e){e=y(e,y.EMPTY_OBJECT);let t=e.assetId;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._ready=!1,this._tileCredits=void 0,this._errorEvent=new Ae;let n=this,i=Qd._createEndpointResource(t,e),o=e.assetId.toString()+e.accessToken+e.server,r=Vy._endpointCache[o];u(r)||(r=i.fetchJson(),Vy._endpointCache[o]=r),this._readyPromise=r.then(function(s){if(s.type!=="IMAGERY")return Promise.reject(new ue(`Cesium ion asset ${t} is not an imagery asset.`));let a,c=s.externalType;if(!u(c))a=new Fy({url:new Qd(s,i)});else{let l=_nt[c];if(!u(l))return Promise.reject(new ue(`Unrecognized Cesium ion imagery type: ${c}`));a=l(s.options)}return n._tileCredits=Qd.getCreditsFromEndpoint(s,i),a.errorEvent.addEventListener(function(l){l.provider=n,n._errorEvent.raiseEvent(l)}),n._imageryProvider=a,a.readyPromise.then(function(){return n._ready=!0,!0})})}Object.defineProperties(Vy.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},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(){}}}});Vy.prototype.getTileCredits=function(e,t,n){let i=this._imageryProvider.getTileCredits(e,t,n);return u(i)?this._tileCredits.concat(i):this._tileCredits};Vy.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};Vy.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};Vy._endpointCache={};var b_=Vy;var gnt={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},S_=Object.freeze(gnt);function ynt(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.style,S_.AERIAL);return new b_({assetId:t})}var D_=ynt;var Ant=new H;function xnt(e,t){let n=e.unionClippingRegions,i=e.length,o=ss.useFloatTexture(t),r=ss.getTextureResolution(e,t,Ant),s=r.x,a=r.y,c=o?Ent(s,a):bnt(s,a);return c+=`
`,c+=n?Cnt(i):Tnt(i),c}function Cnt(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 Tnt(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 Ent(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 bnt(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 v_=xnt;function Snt(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function xY(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function Dnt(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 te.SCENE3D:o=t;break;case te.SCENE2D:case te.COLUMBUS_VIEW:o=n;break;case te.MORPHING:o=i;break}return o}function vnt(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}xY.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,c=e.applyGamma,l=e.applyAlpha,f=e.applyDayNightAlpha,d=e.applySplit,p=e.showReflectiveOcean,g=e.showOceanWaves,m=e.enableLighting,A=e.dynamicAtmosphereLighting,x=e.dynamicAtmosphereLightingFromSun,C=e.showGroundAtmosphere,T=e.perFragmentGroundAtmosphere,E=e.hasVertexNormals,S=e.useWebMercatorProjection,D=e.enableFog,w=e.enableClippingPlanes,R=e.clippingPlanes,O=e.clippedByBoundaries,L=e.hasImageryLayerCutout,N=e.colorCorrect,_=e.highlightFillTile,b=e.colorToAlpha,v=e.hasGeodeticSurfaceNormals,I=e.hasExaggeration,B=e.showUndergroundColor,F=e.translucent,k=0,U="",V=n.renderedMesh.encoding;V.quantization===Ps.BITS12&&(k=1,U="QUANTIZATION_BITS12");let j=0,Q="";O&&(j=1,Q="TILE_LIMIT_RECTANGLE");let W=0,K="";L&&(W=1,K="APPLY_IMAGERY_CUTOUT");let J=t.mode,_e=J|o<<2|r<<3|s<<4|a<<5|c<<6|l<<7|p<<8|g<<9|m<<10|A<<11|x<<12|C<<13|T<<14|E<<15|S<<16|D<<17|k<<18|d<<19|w<<20|j<<21|W<<22|N<<23|_<<24|b<<25|v<<26|I<<27|B<<28|F<<29|f<<30,xe=0;u(R)&&R.length>0&&(xe=w?R.clippingPlanesState:0);let re=n.surfaceShader;if(u(re)&&re.numberOfDayTextures===i&&re.flags===_e&&re.material===this.material&&re.clippingShaderState===xe)return re.shaderProgram;let ye=this._shadersByTexturesFlags[i];if(u(ye)||(ye=this._shadersByTexturesFlags[i]=[]),re=ye[_e],!u(re)||re.material!==this.material||re.clippingShaderState!==xe){let fe=this.baseVertexShaderSource.clone(),Se=this.baseFragmentShaderSource.clone();xe!==0&&Se.sources.unshift(v_(R,t.context)),fe.defines.push(U),Se.defines.push(`TEXTURE_UNITS ${i}`,Q,K),o&&Se.defines.push("APPLY_BRIGHTNESS"),r&&Se.defines.push("APPLY_CONTRAST"),s&&Se.defines.push("APPLY_HUE"),a&&Se.defines.push("APPLY_SATURATION"),c&&Se.defines.push("APPLY_GAMMA"),l&&Se.defines.push("APPLY_ALPHA"),f&&Se.defines.push("APPLY_DAY_NIGHT_ALPHA"),p&&(Se.defines.push("SHOW_REFLECTIVE_OCEAN"),fe.defines.push("SHOW_REFLECTIVE_OCEAN")),g&&Se.defines.push("SHOW_OCEAN_WAVES"),b&&Se.defines.push("APPLY_COLOR_TO_ALPHA"),B&&(fe.defines.push("UNDERGROUND_COLOR"),Se.defines.push("UNDERGROUND_COLOR")),F&&(fe.defines.push("TRANSLUCENT"),Se.defines.push("TRANSLUCENT")),m&&(E?(fe.defines.push("ENABLE_VERTEX_LIGHTING"),Se.defines.push("ENABLE_VERTEX_LIGHTING")):(fe.defines.push("ENABLE_DAYNIGHT_SHADING"),Se.defines.push("ENABLE_DAYNIGHT_SHADING"))),A&&(fe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),Se.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),x&&(fe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),Se.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),C&&(fe.defines.push("GROUND_ATMOSPHERE"),Se.defines.push("GROUND_ATMOSPHERE"),T&&(fe.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),Se.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),fe.defines.push("INCLUDE_WEB_MERCATOR_Y"),Se.defines.push("INCLUDE_WEB_MERCATOR_Y"),D&&(fe.defines.push("FOG"),Se.defines.push("FOG")),d&&Se.defines.push("APPLY_SPLIT"),w&&Se.defines.push("ENABLE_CLIPPING_PLANES"),N&&Se.defines.push("COLOR_CORRECT"),_&&Se.defines.push("HIGHLIGHT_FILL_TILE"),v&&fe.defines.push("GEODETIC_SURFACE_NORMALS"),I&&fe.defines.push("EXAGGERATION");let we=`    vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
    {
        vec4 color = initialColor;
`;L&&(we+=`        vec4 cutoutAndColorResult;
        bool texelUnclipped;
`);for(let qe=0;qe<i;++qe)L?we+=`        cutoutAndColorResult = u_dayTextureCutoutRectangles[${qe}];
        texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
        cutoutAndColorResult = sampleAndBlend(
`:we+=`        color = sampleAndBlend(
`,we+=`            color,
            u_dayTextures[${qe}],
            u_dayTextureUseWebMercatorT[${qe}] ? textureCoordinates.xz : textureCoordinates.xy,
            u_dayTextureTexCoordsRectangle[${qe}],
            u_dayTextureTranslationAndScale[${qe}],
            ${l?`u_dayTextureAlpha[${qe}]`:"1.0"},
            ${f?`u_dayTextureNightAlpha[${qe}]`:"1.0"},
${f?`u_dayTextureDayAlpha[${qe}]`:"1.0"},
${o?`u_dayTextureBrightness[${qe}]`:"0.0"},
            ${r?`u_dayTextureContrast[${qe}]`:"0.0"},
            ${s?`u_dayTextureHue[${qe}]`:"0.0"},
            ${a?`u_dayTextureSaturation[${qe}]`:"0.0"},
            ${c?`u_dayTextureOneOverGamma[${qe}]`:"0.0"},
            ${d?`u_dayTextureSplit[${qe}]`:"0.0"},
            ${b?`u_colorsToAlpha[${qe}]`:"vec4(0.0)"},
        nightBlend        );
`,L&&(we+=`        color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);we+=`        return color;
    }`,Se.sources.push(we),fe.sources.push(Dnt(J)),fe.sources.push(vnt(S));let Ve=Xt.fromCache({context:t.context,vertexShaderSource:fe,fragmentShaderSource:Se,attributeLocations:V.getAttributeLocations()});re=ye[_e]=new Snt(i,_e,this.material,Ve,xe)}return n.surfaceShader=re,re.shaderProgram};xY.prototype.destroy=function(){let e,t,n=this._shadersByTexturesFlags;for(let i in n)if(n.hasOwnProperty(i)){let o=n[i];if(!u(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],u(t)&&t.shaderProgram.destroy())}return le(this)};var LL=xY;var wnt={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ui=Object.freeze(wnt);var Int={START:0,LOADING:1,DONE:2,FAILED:3},Os=Object.freeze(Int);var Pnt={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},mo=Object.freeze(Pnt);function Zo(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new oe(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new h,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=mo.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new se,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(Zo.prototype,{eligibleForUnloading:{get:function(){let e=this.terrainState,n=!(e===mo.RECEIVING||e===mo.TRANSFORMING),i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){let s=i[o];n=!u(s.loadingImagery)||s.loadingImagery.state!==ui.TRANSITIONING}return n}},renderedMesh:{get:function(){if(u(this.vertexArray))return this.mesh;if(u(this.fill))return this.fill.mesh}}});var Ont=new he;function CY(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(u(t)&&t!==te.SCENE3D){let c=n.ellipsoid.cartesianToCartographic(s,Ont);s=n.project(c,r),s=h.fromElements(s.z,s.x,s.y,r)}return s}var Rnt=new h,Bnt=new h,Mnt=new h;Zo.prototype.pick=function(e,t,n,i,o){let r=this.renderedMesh;if(!u(r))return;let s=r.vertices,a=r.indices,c=r.encoding,l=a.length,f=Number.MAX_VALUE;for(let d=0;d<l;d+=3){let p=a[d],g=a[d+1],m=a[d+2],A=CY(c,t,n,s,p,Rnt),x=CY(c,t,n,s,g,Bnt),C=CY(c,t,n,s,m,Mnt),T=Yi.rayTriangleParametric(e,A,x,C,i);u(T)&&T<f&&T>=0&&(f=T)}return f!==Number.MAX_VALUE?wn.getPoint(e,f,o):void 0};Zo.prototype.freeResources=function(){u(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=mo.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()};Zo.prototype.freeVertexArray=function(){Zo._freeVertexArray(this.vertexArray),this.vertexArray=void 0,Zo._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};Zo.initialize=function(e,t,n){let i=e.data;u(i)||(i=e.data=new Zo),e.state===Os.START&&(Lnt(e,t,n),e.state=Os.LOADING)};Zo.processStateMachine=function(e,t,n,i,o,r,s){Zo.initialize(e,n,i);let a=e.data;if(e.state===Os.LOADING&&Nnt(e,t,n,i,o,r),s)return;let c=e.renderable;e.renderable=u(a.vertexArray);let l=a.terrainState===mo.READY;e.upsampledFromParent=u(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();let f=a.processImagery(e,n,t);if(l&&f){let d=e._loadedCallbacks,p={};for(let g in d)d.hasOwnProperty(g)&&(d[g](e)||(p[g]=d[g]));e._loadedCallbacks=p,e.state=Os.DONE}c&&(e.renderable=!0)};Zo.prototype.processImagery=function(e,t,n,i){let o=e.data,r=e.upsampledFromParent,s=!1,a=!0,c=o.imagery,l,f;for(l=0,f=c.length;l<f;++l){let d=c[l];if(!u(d.loadingImagery)){r=!1;continue}if(d.loadingImagery.state===ui.PLACEHOLDER){let g=d.loadingImagery.imageryLayer;if(g.imageryProvider.ready){d.freeResources(),c.splice(l,1),g._createTileImagerySkeletons(e,t,l),--l,f=c.length;continue}else r=!1}let p=d.processStateMachine(e,n,i);a=a&&p,s=s||p||u(d.readyImagery),r=r&&u(d.loadingImagery)&&(d.loadingImagery.state===ui.FAILED||d.loadingImagery.state===ui.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a};function Qpe(e,t,n,i){let o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride,c=oc.clone(s);c.hasGeodeticSurfaceNormals=t,c=oc.clone(c);let l=c.stride,f=new Float32Array(a*l);t?s.addGeodeticSurfaceNormals(r,f,n):s.removeGeodeticSurfaceNormals(r,f),o.vertices=f,o.stride=l,o!==e.mesh?(Zo._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=Zo._createVertexArrayForMesh(i.context,o)):(Zo._freeVertexArray(e.vertexArray),e.vertexArray=Zo._createVertexArrayForMesh(i.context,o)),Zo._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}Zo.prototype.addGeodeticSurfaceNormals=function(e,t){Qpe(this,!0,e,t)};Zo.prototype.removeGeodeticSurfaceNormals=function(e){Qpe(this,!1,void 0,e)};Zo.prototype.updateExaggeration=function(e,t,n){let i=this,o=i.renderedMesh;if(o===void 0)return;let r=t.terrainExaggeration,s=t.terrainExaggerationRelativeHeight,a=r!==1,c=o.encoding,l=c.exaggeration!==r,f=c.exaggerationRelativeHeight!==s;if(l||f){if(l)if(a&&!c.hasGeodeticSurfaceNormals){let d=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(d,t)}else!a&&c.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(c.exaggeration=r,c.exaggerationRelativeHeight=s,n!==void 0){n._tileToUpdateHeights.push(e);let d=e.customData,p=d.length;for(let g=0;g<p;g++){let m=d[g];m.level=-1}}}};function Lnt(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!u(i)&&u(e.parent)){let o=e.parent,r=o.data;u(r)&&u(r.terrainData)&&(i=r.terrainData.isChildAvailable(o.x,o.y,e.x,e.y))}i===!1&&(e.data.terrainState=mo.FAILED);for(let o=0,r=n.length;o<r;++o){let s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function Nnt(e,t,n,i,o,r){let s=e.data,a=e.parent;if(s.terrainState===mo.FAILED&&a!==void 0&&(a.data!==void 0&&a.data.terrainData!==void 0&&a.data.terrainData.canUpsample!==!1||Zo.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===mo.FAILED&&Fnt(s,e,t,n,e.x,e.y,e.level),s.terrainState===mo.UNLOADED&&Vnt(s,n,e.x,e.y,e.level),s.terrainState===mo.RECEIVED&&knt(s,t,n,e.x,e.y,e.level),s.terrainState===mo.TRANSFORMED&&(znt(s,t.context,n,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o)),s.terrainState>=mo.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)Gnt(t.context,s);else{let l=s._findAncestorTileWithTerrainData(e);u(l)&&u(l.data.waterMaskTexture)&&(s.waterMaskTexture=l.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,l,s.waterMaskTranslationAndScale))}}function Fnt(e,t,n,i,o,r,s){let a=t.parent;if(!a){t.state=Os.FAILED;return}let c=a.data.terrainData,l=a.x,f=a.y,d=a.level;if(!u(c))return;let p=c.upsample(i.tilingScheme,l,f,d,o,r,s);u(p)&&(e.terrainState=mo.RECEIVING,Promise.resolve(p).then(function(g){e.terrainData=g,e.terrainState=mo.RECEIVED}).catch(function(){e.terrainState=mo.FAILED}))}function Vnt(e,t,n,i,o){function r(c){e.terrainData=c,e.terrainState=mo.RECEIVED,e.request=void 0}function s(c){if(e.request.state===hi.CANCELLED){e.terrainData=void 0,e.terrainState=mo.UNLOADED,e.request=void 0;return}e.terrainState=mo.FAILED,e.request=void 0;let l=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${c}"`;t._requestError=Xn.reportError(t._requestError,t,t.errorEvent,l,n,i,o),t._requestError.retry&&a()}function a(){let c=new zo({throttle:!1,throttleByServer:!0,type:Qr.TERRAIN});e.request=c;let l=t.requestTileGeometry(n,i,o,c);u(l)?(e.terrainState=mo.RECEIVING,Promise.resolve(l).then(function(f){r(f)}).catch(function(f){s(f)})):(e.terrainState=mo.UNLOADED,e.request=void 0)}a()}var Unt={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function knt(e,t,n,i,o,r){let s=n.tilingScheme,a=Unt;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.terrainExaggeration,a.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,a.throttle=!0;let l=e.terrainData.createMesh(a);u(l)&&(e.terrainState=mo.TRANSFORMING,Promise.resolve(l).then(function(f){e.mesh=f,e.terrainState=mo.TRANSFORMED}).catch(function(){e.terrainState=mo.FAILED}))}Zo._createVertexArrayForMesh=function(e,t){let n=t.vertices,i=lt.createVertexBuffer({context:e,typedArray:n,usage:Ne.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{},s=r[e.id];if(!u(s)||s.isDestroyed()){let a=t.indices;s=lt.createIndexBuffer({context:e,typedArray:a,usage:Ne.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 oi({context:e,attributes:o,indexBuffer:s})};Zo._freeVertexArray=function(e){if(u(e)){let t=e.indexBuffer;e.isDestroyed()||e.destroy(),u(t)&&!t.isDestroyed()&&u(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function znt(e,t,n,i,o,r,s){e.vertexArray=Zo._createVertexArrayForMesh(t,e.mesh),e.terrainState=mo.READY,e.fill=e.fill&&e.fill.destroy(s)}function Hnt(e){let t=e.cache.tile_waterMaskData;if(!u(t)){let n=It.create({context:e,pixelFormat:rt.LUMINANCE,pixelDatatype:Xe.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;let i=new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.LINEAR,magnificationFilter:yi.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function Gnt(e,t){let n=t.terrainData.waterMask,i=Hnt(e),o,r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{let s=Math.sqrt(r);o=It.create({context:e,pixelFormat:rt.LUMINANCE,pixelDatatype:Xe.UNSIGNED_BYTE,source:{width:s,height:s,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,oe.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}Zo.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;u(t)&&(!u(t.data)||!u(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};Zo.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){let i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,c=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=c*(o.south-i.south)/s,n.z=a,n.w=c,n};var If=Zo;function tS(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=ui.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!u(o)&&e.imageryProvider.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}tS.createPlaceholder=function(e){let t=new tS(e,0,0,0);return t.addReference(),t.state=ui.PLACEHOLDER,t};tS.prototype.addReference=function(){++this.referenceCount};tS.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),u(this.parent)&&this.parent.releaseReference(),u(this.image)&&u(this.image.destroy)&&this.image.destroy(),u(this.texture)&&this.texture.destroy(),u(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),le(this),0):this.referenceCount};tS.prototype.processStateMachine=function(e,t,n){this.state===ui.UNLOADED&&!n&&(this.state=ui.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===ui.RECEIVED&&(this.state=ui.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));let i=this.state===ui.READY&&t&&!this.texture;(this.state===ui.TEXTURE_LOADED||i)&&(this.state=ui.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};var nS=tS;function TY(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}TY.prototype.freeResources=function(){u(this.readyImagery)&&this.readyImagery.releaseReference(),u(this.loadingImagery)&&this.loadingImagery.releaseReference()};TY.prototype.processStateMachine=function(e,t,n){let i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===ui.READY)return u(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(;u(r)&&(r.state!==ui.READY||!this.useWebMercatorT&&!u(r.texture));)r.state!==ui.FAILED&&r.state!==ui.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(u(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,u(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===ui.FAILED||i.state===ui.INVALID?u(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};var iS=TY;function ki(e,t){this._imageryProvider=e,t=y(t,y.EMPTY_OBJECT),this.alpha=y(t.alpha,y(e.defaultAlpha,1)),this.nightAlpha=y(t.nightAlpha,y(e.defaultNightAlpha,1)),this.dayAlpha=y(t.dayAlpha,y(e.defaultDayAlpha,1)),this.brightness=y(t.brightness,y(e.defaultBrightness,ki.DEFAULT_BRIGHTNESS)),this.contrast=y(t.contrast,y(e.defaultContrast,ki.DEFAULT_CONTRAST)),this.hue=y(t.hue,y(e.defaultHue,ki.DEFAULT_HUE)),this.saturation=y(t.saturation,y(e.defaultSaturation,ki.DEFAULT_SATURATION)),this.gamma=y(t.gamma,y(e.defaultGamma,ki.DEFAULT_GAMMA)),this.splitDirection=y(t.splitDirection,y(e.defaultSplit,ki.DEFAULT_SPLIT)),this.minificationFilter=y(t.minificationFilter,y(e.defaultMinificationFilter,ki.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=y(t.magnificationFilter,y(e.defaultMagnificationFilter,ki.DEFAULT_MAGNIFICATION_FILTER)),this.show=y(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=y(t.rectangle,ce.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new iS(nS.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=y(t.colorToAlphaThreshold,ki.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(ki.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}});ki.DEFAULT_BRIGHTNESS=1;ki.DEFAULT_CONTRAST=1;ki.DEFAULT_HUE=0;ki.DEFAULT_SATURATION=1;ki.DEFAULT_GAMMA=1;ki.DEFAULT_SPLIT=Pc.NONE;ki.DEFAULT_MINIFICATION_FILTER=an.LINEAR;ki.DEFAULT_MAGNIFICATION_FILTER=yi.LINEAR;ki.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;ki.prototype.isBaseLayer=function(){return this._isBaseLayer};ki.prototype.isDestroyed=function(){return!1};ki.prototype.destroy=function(){return le(this)};var t_e=new ce,$pe=new ce,EY=new ce,n_e=new ce;ki.prototype.getViewableRectangle=function(){let e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return ce.intersection(e.rectangle,t)})};ki.prototype._createTileImagerySkeletons=function(e,t,n){let i=e.data;if(u(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||u(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;let o=this._imageryProvider;if(u(n)||(n=i.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;let r=o.tilingScheme.projection instanceof Si&&e.rectangle.north<Si.MaximumLatitude&&e.rectangle.south>-Si.MaximumLatitude,s=ce.intersection(o.rectangle,this._rectangle,t_e),a=ce.intersection(e.rectangle,s,$pe);if(!u(a)){if(!this.isBaseLayer())return!1;let v=s,I=e.rectangle;a=$pe,I.south>=v.north?a.north=a.south=v.north:I.north<=v.south?a.north=a.south=v.south:(a.south=Math.max(I.south,v.south),a.north=Math.min(I.north,v.north)),I.west>=v.east?a.west=a.east=v.east:I.east<=v.west?a.west=a.east=v.west:(a.west=Math.max(I.west,v.west),a.east=Math.min(I.east,v.east))}let c=0;a.south>0?c=a.south:a.north<0&&(c=a.north);let f=1*t.getLevelMaximumGeometricError(e.level),d=Ynt(this,f,c);d=Math.max(0,d);let p=o.maximumLevel;if(d>p&&(d=p),u(o.minimumLevel)){let v=o.minimumLevel;d<v&&(d=v)}let g=o.tilingScheme,m=g.positionToTileXY(ce.northwest(a),d),A=g.positionToTileXY(ce.southeast(a),d),x=e.rectangle.width/512,C=e.rectangle.height/512,T=g.tileXYToRectangle(m.x,m.y,d);Math.abs(T.south-e.rectangle.north)<C&&m.y<A.y&&++m.y,Math.abs(T.east-e.rectangle.west)<x&&m.x<A.x&&++m.x;let E=g.tileXYToRectangle(A.x,A.y,d);Math.abs(E.north-e.rectangle.south)<C&&A.y>m.y&&--A.y,Math.abs(E.west-e.rectangle.east)<x&&A.x>m.x&&--A.x;let S=ce.clone(e.rectangle,n_e),D=g.tileXYToRectangle(m.x,m.y,d),w=ce.intersection(D,s,EY),R;r?(g.rectangleToNativeRectangle(S,S),g.rectangleToNativeRectangle(D,D),g.rectangleToNativeRectangle(w,w),g.rectangleToNativeRectangle(s,s),R=g.tileXYToNativeRectangle.bind(g),x=S.width/512,C=S.height/512):R=g.tileXYToRectangle.bind(g);let O,L=0,N=1,_;!this.isBaseLayer()&&Math.abs(w.west-S.west)>=x&&(L=Math.min(1,(w.west-S.west)/S.width)),!this.isBaseLayer()&&Math.abs(w.north-S.north)>=C&&(N=Math.max(0,(w.north-S.south)/S.height));let b=N;for(let v=m.x;v<=A.x;v++)if(O=L,D=R(v,m.y,d),w=ce.simpleIntersection(D,s,EY),!!u(w)){L=Math.min(1,(w.east-S.west)/S.width),v===A.x&&(this.isBaseLayer()||Math.abs(w.east-S.east)<x)&&(L=1),N=b;for(let I=m.y;I<=A.y;I++){if(_=N,D=R(v,I,d),w=ce.simpleIntersection(D,s,EY),!u(w))continue;N=Math.max(0,(w.south-S.south)/S.height),I===A.y&&(this.isBaseLayer()||Math.abs(w.south-S.south)<C)&&(N=0);let B=new oe(O,N,L,_),F=this.getImageryFromCache(v,I,d);i.imagery.splice(n,0,new iS(F,B,r)),++n}}return!0};ki.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){let c=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=c.rectangleToNativeRectangle(n,t_e),i=c.rectangleToNativeRectangle(i,n_e)}let o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new oe(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)};ki.prototype._requestImagery=function(e){let t=this._imageryProvider,n=this;function i(s){if(!u(s))return o();e.image=s,e.state=ui.RECEIVED,e.request=void 0,Xn.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===hi.CANCELLED){e.state=ui.UNLOADED,e.request=void 0;return}e.state=ui.FAILED,e.request=void 0;let a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=Xn.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){let s=new zo({throttle:!1,throttleByServer:!0,type:Qr.IMAGERY});e.request=s,e.state=ui.TRANSITIONING;let a=t.requestImage(e.x,e.y,e.level,s);if(!u(a)){e.state=ui.UNLOADED,e.request=void 0;return}u(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(c){i(c)}).catch(function(c){o(c)})}r()};ki.prototype._createTextureWebGL=function(e,t){let n=new ln({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return u(i.internalFormat)?new It({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new It({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?rt.RGBA:rt.RGB,sampler:n})};ki.prototype._createTexture=function(e,t){let n=this._imageryProvider,i=t.image;if(u(n.tileDiscardPolicy)){let r=n.tileDiscardPolicy;if(u(r)){if(!r.isReady()){t.state=ui.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=ui.INVALID;return}}}let o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof Si?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=ui.TEXTURE_LOADED};function e_e(e,t,n){return`${e}:${t}:${n}`}ki.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter,i=this.magnificationFilter;if(n===an.LINEAR&&i===yi.LINEAR&&!rt.isCompressedFormat(t.pixelFormat)&&P.isPowerOfTwo(t.width)&&P.isPowerOfTwo(t.height)){n=an.LINEAR_MIPMAP_LINEAR;let r=Ft.maximumTextureFilterAnisotropy,s=Math.min(r,y(this._maximumAnisotropy,r)),a=e_e(n,i,s),c=e.cache.imageryLayerMipmapSamplers;u(c)||(c={},e.cache.imageryLayerMipmapSamplers=c);let l=c[a];u(l)||(l=c[a]=new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(Ah.NICEST),t.sampler=l}else{let r=e_e(n,i,0),s=e.cache.imageryLayerNonMipmapSamplers;u(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];u(a)||(a=s[r]=new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};ki.prototype._reprojectTexture=function(e,t,n){let i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=y(n,!0),n&&!(this._imageryProvider.tilingScheme.projection instanceof Ei)&&o.width/i.width>1e-5){let s=this;t.addReference();let a=new Lu({persists:!0,owner:this,preExecute:function(c){jnt(c,r,i,t.rectangle)},postExecute:function(c){t.texture=c,s._finalizeReprojectTexture(r,c),t.state=ui.READY,t.releaseReference()},canceled:function(){t.state=ui.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=ui.READY};ki.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};ki.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){u(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};ki.prototype.getImageryFromCache=function(e,t,n,i){let o=i_e(e,t,n),r=this._imageryCache[o];return u(r)||(r=new nS(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};ki.prototype.removeImageryFromCache=function(e){let t=i_e(e.x,e.y,e.level);delete this._imageryCache[t]};function i_e(e,t,n){return JSON.stringify([e,t,n])}var Xz={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new H,texture:void 0},Wnt=Vt.supportsTypedArrays()?new Float32Array(2*64):void 0;function jnt(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!u(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){u(this.framebuffer)&&this.framebuffer.destroy(),u(this.vertexArray)&&this.vertexArray.destroy(),u(this.shaderProgram)&&this.shaderProgram.destroy()}};let x=new Float32Array(2*64*2),C=0;for(let w=0;w<64;++w){let R=w/63;x[C++]=0,x[C++]=R,x[C++]=1,x[C++]=R}let T={position:0,webMercatorT:1},E=Hr.getRegularGridIndices(2,64),S=lt.createIndexBuffer({context:t,typedArray:E,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});o.vertexArray=new oi({context:t,attributes:[{index:T.position,vertexBuffer:lt.createVertexBuffer({context:t,typedArray:x,usage:Ne.STATIC_DRAW}),componentsPerAttribute:2},{index:T.webMercatorT,vertexBuffer:lt.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:Ne.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:S});let D=new ke({sources:[WM]});o.shaderProgram=Xt.fromCache({context:t,vertexShaderSource:D,fragmentShaderSource:GM,attributeLocations:T}),o.sampler=new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.LINEAR,magnificationFilter:yi.LINEAR})}n.sampler=o.sampler;let r=n.width,s=n.height;Xz.textureDimensions.x=r,Xz.textureDimensions.y=s,Xz.texture=n;let a=Math.sin(i.south),c=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);let f=1/(.5*Math.log((1+a)/(1-a))-c),d=new It({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});P.isPowerOfTwo(r)&&P.isPowerOfTwo(s)&&d.generateMipmap(Ah.NICEST);let p=i.south,g=i.north,m=Wnt,A=0;for(let x=0;x<64;++x){let C=x/63,T=P.lerp(p,g,C);a=Math.sin(T);let S=(.5*Math.log((1+a)/(1-a))-c)*f;m[A++]=S,m[A++]=S}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(m),e.shaderProgram=o.shaderProgram,e.outputTexture=d,e.uniformMap=Xz,e.vertexArray=o.vertexArray}function Ynt(e,t,n){let i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof Ei?1:Math.cos(n),a=o.rectangle,l=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,f=Math.log(l)/Math.log(2);return Math.round(f)|0}var bu=ki;var o_e={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>=o_e.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},$n=o_e;function rS(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 oe}rS.prototype.update=function(e,t,n){this.changedThisFrame&&(f_e(e,t,this.tile,n),this.changedThisFrame=!1)};rS.prototype.destroy=function(e){this._destroyVertexArray(e),u(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};rS.prototype._destroyVertexArray=function(e){u(this.vertexArray)&&(u(e)?e.push(this.vertexArray):If._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};var qnt=new jg;rS.updateFillTiles=function(e,t,n,i){let o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=qnt;a.clear();for(let l=0;l<t.length;++l){let f=t[l];u(f.data.vertexArray)&&a.enqueue(t[l])}let c=a.dequeue();for(;c!==void 0;){let l=c.findTileToWest(r),f=c.findTileToSouth(r),d=c.findTileToEast(r),p=c.findTileToNorth(r);hs(e,n,c,l,s,pn.EAST,!1,a,i),hs(e,n,c,f,s,pn.NORTH,!1,a,i),hs(e,n,c,d,s,pn.WEST,!1,a,i),hs(e,n,c,p,s,pn.SOUTH,!1,a,i);let g=l.findTileToNorth(r),m=l.findTileToSouth(r),A=d.findTileToNorth(r),x=d.findTileToSouth(r);hs(e,n,c,g,s,pn.SOUTHEAST,!1,a,i),hs(e,n,c,A,s,pn.SOUTHWEST,!1,a,i),hs(e,n,c,m,s,pn.NORTHEAST,!1,a,i),hs(e,n,c,x,s,pn.NORTHWEST,!1,a,i),c=a.dequeue()}};function hs(e,t,n,i,o,r,s,a,c){if(i===void 0)return;let l=i;for(;l&&(l._lastSelectionResultFrame!==o||$n.wasKicked(l._lastSelectionResult)||$n.originalResult(l._lastSelectionResult)===$n.CULLED);){if(s)return;let f=l.parent;if(r>=pn.NORTHWEST&&f!==void 0)switch(r){case pn.NORTHWEST:l=l===f.northwestChild?f:void 0;break;case pn.NORTHEAST:l=l===f.northeastChild?f:void 0;break;case pn.SOUTHWEST:l=l===f.southwestChild?f:void 0;break;case pn.SOUTHEAST:l=l===f.southeastChild?f:void 0;break}else l=f}if(l!==void 0){if(l._lastSelectionResult===$n.RENDERED){if(u(l.data.vertexArray))return;Xnt(e,t,n,l,r,o,a,c);return}if($n.originalResult(i._lastSelectionResult)!==$n.CULLED)switch(r){case pn.WEST:hs(e,t,n,i.northwestChild,o,r,!0,a,c),hs(e,t,n,i.southwestChild,o,r,!0,a,c);break;case pn.EAST:hs(e,t,n,i.southeastChild,o,r,!0,a,c),hs(e,t,n,i.northeastChild,o,r,!0,a,c);break;case pn.SOUTH:hs(e,t,n,i.southwestChild,o,r,!0,a,c),hs(e,t,n,i.southeastChild,o,r,!0,a,c);break;case pn.NORTH:hs(e,t,n,i.northeastChild,o,r,!0,a,c),hs(e,t,n,i.northwestChild,o,r,!0,a,c);break;case pn.NORTHWEST:hs(e,t,n,i.northwestChild,o,r,!0,a,c);break;case pn.NORTHEAST:hs(e,t,n,i.northeastChild,o,r,!0,a,c);break;case pn.SOUTHWEST:hs(e,t,n,i.southwestChild,o,r,!0,a,c);break;case pn.SOUTHEAST:hs(e,t,n,i.southeastChild,o,r,!0,a,c);break;default:throw new de("Invalid edge")}}}function Xnt(e,t,n,i,o,r,s,a){let c=i.data;if(c.fill===void 0)c.fill=new rS(i);else if(c.fill.visitedFrame===r)return;c.fill.enqueuedFrame!==r&&(c.fill.enqueuedFrame=r,c.fill.changedThisFrame=!1,s.enqueue(i)),Knt(e,t,n,i,o,a)}function Knt(e,t,n,i,o,r){let s=i.data.fill,a,c=n.data.fill;u(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(f_e(e,t,n,r),c.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let l,f;switch(o){case pn.WEST:l=s.westMeshes,f=s.westTiles;break;case pn.SOUTH:l=s.southMeshes,f=s.southTiles;break;case pn.EAST:l=s.eastMeshes,f=s.eastTiles;break;case pn.NORTH:l=s.northMeshes,f=s.northTiles;break;case pn.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case pn.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case pn.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case pn.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||l[0]!==a||l.length!==1,l[0]=a,f[0]=n,l.length=1,f.length=1;return}let d,p,g,m,A=n.rectangle,x,C=i.rectangle;switch(o){case pn.WEST:for(x=(C.north-C.south)*P.EPSILON5,d=0;d<f.length&&(g=f[d],m=g.rectangle,!P.greaterThan(A.north,m.south,x));++d);for(p=d;p<f.length&&(g=f[p],m=g.rectangle,!P.greaterThanOrEquals(A.south,m.north,x));++p);break;case pn.SOUTH:for(x=(C.east-C.west)*P.EPSILON5,d=0;d<f.length&&(g=f[d],m=g.rectangle,!P.lessThan(A.west,m.east,x));++d);for(p=d;p<f.length&&(g=f[p],m=g.rectangle,!P.lessThanOrEquals(A.east,m.west,x));++p);break;case pn.EAST:for(x=(C.north-C.south)*P.EPSILON5,d=0;d<f.length&&(g=f[d],m=g.rectangle,!P.lessThan(A.south,m.north,x));++d);for(p=d;p<f.length&&(g=f[p],m=g.rectangle,!P.lessThanOrEquals(A.north,m.south,x));++p);break;case pn.NORTH:for(x=(C.east-C.west)*P.EPSILON5,d=0;d<f.length&&(g=f[d],m=g.rectangle,!P.greaterThan(A.east,m.west,x));++d);for(p=d;p<f.length&&(g=f[p],m=g.rectangle,!P.greaterThanOrEquals(A.west,m.east,x));++p);break}p-d===1?(s.changedThisFrame=s.changedThisFrame||l[d]!==a,l[d]=a,f[d]=n):(s.changedThisFrame=!0,l.splice(d,p-d,a),f.splice(d,p-d,n))}var Yx=new he,Znt=new he,oS=new h,vY=new h,bY=new H,SY=new H,Su=new H;function t4(){this.height=0,this.encodedNormal=new H}function Kz(e,t,n,i,o,r,s,a,c){if(u(o))return o;let l;if(u(r)&&u(s))l=(r.height+s.height)*.5;else if(u(r))l=r.height;else if(u(s))l=s.height;else if(u(a))l=a.height;else{let d=e.tile.data.tileBoundingRegion,p=0,g=0;u(d)&&(p=d.minimumHeight,g=d.maximumHeight),l=(p+g)*.5}return d_e(e,t,n,i,l,c),c}var Jnt={minimumHeight:0,maximumHeight:0},Qnt=new h,r_e=new t4,s_e=new t4,a_e=new t4,c_e=new t4,$nt=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,eit={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function f_e(e,t,n,i){If.initialize(n,e.terrainProvider,e._imageryLayers);let o=n.data,r=o.fill,s=n.rectangle,a=t.terrainExaggeration,c=t.terrainExaggerationRelativeHeight,l=a!==1,f=n.tilingScheme.ellipsoid,d=Jz(r,f,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,a_e),p=Jz(r,f,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,r_e),g=Jz(r,f,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,s_e),m=Jz(r,f,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,c_e);d=Kz(r,f,0,1,d,p,m,g,a_e),p=Kz(r,f,0,0,p,d,g,m,r_e),g=Kz(r,f,1,1,g,p,m,d,s_e),m=Kz(r,f,1,1,m,g,d,p,c_e);let A=p.height,x=g.height,C=d.height,T=m.height,E=Math.min(A,x,C,T),S=Math.max(A,x,C,T),D=(E+S)*.5,w,R,O=e.getLevelMaximumGeometricError(n.level),L=f.maximumRadius-O,N=Math.acos(L/f.maximumRadius)*4;if(N*=1.5,s.width>N&&S-E<=O){let v=new ga({width:9,height:9,buffer:$nt,structure:{heightOffset:S}}),I=eit;I.tilingScheme=n.tilingScheme,I.x=n.x,I.y=n.y,I.level=n.level,I.exaggeration=a,I.exaggerationRelativeHeight=c,r.mesh=v._createMeshSync(I)}else{let v=l,I=ce.center(s,Znt);I.height=D;let B=f.cartographicToCartesian(I,Qnt),F=new oc(B,void 0,void 0,void 0,void 0,!0,!0,v,a,c),k=5,U;for(U=r.westMeshes,w=0,R=U.length;w<R;++w)k+=U[w].eastIndicesNorthToSouth.length;for(U=r.southMeshes,w=0,R=U.length;w<R;++w)k+=U[w].northIndicesWestToEast.length;for(U=r.eastMeshes,w=0,R=U.length;w<R;++w)k+=U[w].westIndicesSouthToNorth.length;for(U=r.northMeshes,w=0,R=U.length;w<R;++w)k+=U[w].southIndicesEastToWest.length;let G=Jnt;G.minimumHeight=E,G.maximumHeight=S;let V=F.stride,X=new Float32Array(k*V),j=0,Q=j;j=Zz(f,s,F,X,j,0,1,d.height,d.encodedNormal,1,G),j=$z(r,f,F,X,j,r.westTiles,r.westMeshes,pn.EAST,G);let W=j;j=Zz(f,s,F,X,j,0,0,p.height,p.encodedNormal,0,G),j=$z(r,f,F,X,j,r.southTiles,r.southMeshes,pn.NORTH,G);let K=j;j=Zz(f,s,F,X,j,1,0,g.height,g.encodedNormal,0,G),j=$z(r,f,F,X,j,r.eastTiles,r.eastMeshes,pn.WEST,G);let J=j;j=Zz(f,s,F,X,j,1,1,m.height,m.encodedNormal,1,G),j=$z(r,f,F,X,j,r.northTiles,r.northMeshes,pn.SOUTH,G),E=G.minimumHeight,S=G.maximumHeight;let _e=Rn.fromRectangle(s,E,S,n.tilingScheme.ellipsoid),xe=Si.geodeticLatitudeToMercatorAngle(s.south),re=1/(Si.geodeticLatitudeToMercatorAngle(s.north)-xe),ye=(Si.geodeticLatitudeToMercatorAngle(I.latitude)-xe)*re,fe=f.geodeticSurfaceNormalCartographic(Yx,vY),Se=Gn.octEncode(fe,bY),we=j;F.encode(X,j*V,_e.center,H.fromElements(.5,.5,Su),D,Se,ye,fe),++j;let Ve=j,qe=Ve<256?1:2,mt=(Ve-1)*3,Ht=mt*qe,fn=(X.length-Ve*V)*Float32Array.BYTES_PER_ELEMENT,dt;if(fn>=Ht){let me=Ve*V*Float32Array.BYTES_PER_ELEMENT;dt=Ve<256?new Uint8Array(X.buffer,me,mt):new Uint16Array(X.buffer,me,mt)}else dt=Ve<256?new Uint8Array(mt):new Uint16Array(mt);X=new Float32Array(X.buffer,0,Ve*V);let Tn=0;for(w=0;w<Ve-2;++w)dt[Tn++]=we,dt[Tn++]=w,dt[Tn++]=w+1;dt[Tn++]=we,dt[Tn++]=w,dt[Tn++]=0;let Jn=[];for(w=W;w>=Q;--w)Jn.push(w);let Gt=[];for(w=K;w>=W;--w)Gt.push(w);let Je=[];for(w=J;w>=K;--w)Je.push(w);let pe=[];for(pe.push(0),w=we-1;w>=J;--w)pe.push(w);r.mesh=new Df(F.center,X,dt,mt,Ve,E,S,se.fromOrientedBoundingBox(_e),ait(e,_e.center,s,E,S),F.stride,_e,F,Jn,Gt,Je,pe)}let _=t.context;r._destroyVertexArray(i),r.vertexArray=If._createVertexArrayForMesh(_,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);let b=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){let v=o._findAncestorTileWithTerrainData(n);u(v)&&u(v.data.waterMaskTexture)&&(r.waterMaskTexture=v.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,v,r.waterMaskTranslationAndScale))}u(b)&&(--b.referenceCount,b.referenceCount===0&&b.destroy())}function Zz(e,t,n,i,o,r,s,a,c,l,f){let d=Yx;d.longitude=P.lerp(t.west,t.east,r),d.latitude=P.lerp(t.south,t.north,s),d.height=a;let p=e.cartographicToCartesian(d,oS),g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(p,vY));let m=SY;return m.x=r,m.y=s,n.encode(i,o*n.stride,p,m,a,c,l,g),f.minimumHeight=Math.min(f.minimumHeight,a),f.maximumHeight=Math.max(f.maximumHeight,a),o+1}var e4=new ce;function NL(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,e4),o.west-=P.TWO_PI,o.east-=P.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=ce.clone(e.rectangle,e4),o.west+=P.TWO_PI,o.east+=P.TWO_PI);let s=o.east-o.west,a=(r.west-o.west)/s,c=(r.east-o.west)/s,l=o.north-o.south,f=(r.south-o.south)/l,d=(r.north-o.south)/l,p=(n.x-a)/(c-a),g=(n.y-f)/(d-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 tit=new H;function DY(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 nit=new H,iit=new h;function oit(e,t,n,i,o,r,s,a,c,l){let f=i.encoding,d=i.vertices,p=NL(t,n,f.decodeTextureCoordinates(d,o,Su),Su),g=NL(t,n,f.decodeTextureCoordinates(d,r,SY),SY),m;c?m=(s-p.x)/(g.x-p.x):m=(a-p.y)/(g.y-p.y);let A=f.decodeHeight(d,o),x=f.decodeHeight(d,r),C=n.rectangle;Yx.longitude=P.lerp(C.west,C.east,s),Yx.latitude=P.lerp(C.south,C.north,a),l.height=Yx.height=P.lerp(A,x,m);let T;if(f.hasVertexNormals){let E=f.getOctEncodedNormal(d,o,tit),S=f.getOctEncodedNormal(d,r,nit),D=Gn.octDecode(E.x,E.y,oS),w=Gn.octDecode(S.x,S.y,iit);T=h.lerp(D,w,m,oS),h.normalize(T,T),Gn.octEncode(T,l.encodedNormal)}else T=e.geodeticSurfaceNormalCartographic(Yx,oS),Gn.octEncode(T,l.encodedNormal)}function d_e(e,t,n,i,o,r){r.height=o;let s=t.geodeticSurfaceNormalCartographic(Yx,oS);Gn.octEncode(s,r.encodedNormal)}function Jz(e,t,n,i,o,r,s,a,c,l,f){if(u_e(e,t,a,s,!1,n,i,f)||u_e(e,t,l,c,!0,n,i,f))return f;let p;if(wY(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],DY(r,p,n,i,f),f;let g;if(n===0?i===0?g=Qz(e.westMeshes,e.westTiles,pn.EAST,e.southMeshes,e.southTiles,pn.NORTH,n,i):g=Qz(e.northMeshes,e.northTiles,pn.SOUTH,e.westMeshes,e.westTiles,pn.EAST,n,i):i===0?g=Qz(e.southMeshes,e.southTiles,pn.NORTH,e.eastMeshes,e.eastTiles,pn.WEST,n,i):g=Qz(e.eastMeshes,e.eastTiles,pn.WEST,e.northMeshes,e.northTiles,pn.SOUTH,n,i),u(g))return d_e(e,t,n,i,g,f),f}function Qz(e,t,n,i,o,r,s,a){let c=l_e(e,t,!1,n,s,a),l=l_e(i,o,!0,r,s,a);return u(c)&&u(l)?(c+l)*.5:u(c)?c:l}function $z(e,t,n,i,o,r,s,a,c){for(let l=0;l<r.length;++l)o=rit(e,t,n,i,o,r[l],s[l],a,c);return o}function rit(e,t,n,i,o,r,s,a,c){let l=r.rectangle;a===pn.EAST&&e.tile.x===0?(l=ce.clone(r.rectangle,e4),l.west-=P.TWO_PI,l.east-=P.TWO_PI):a===pn.WEST&&r.x===0&&(l=ce.clone(r.rectangle,e4),l.west+=P.TWO_PI,l.east+=P.TWO_PI);let f=e.tile.rectangle,d,p;o>0&&(n.decodeTextureCoordinates(i,o-1,Su),d=Su.x,p=Su.y);let g,m;switch(a){case pn.WEST:g=s.westIndicesSouthToNorth,m=!1;break;case pn.NORTH:g=s.northIndicesWestToEast,m=!0;break;case pn.EAST:g=s.eastIndicesNorthToSouth,m=!1;break;case pn.SOUTH:g=s.southIndicesEastToWest,m=!0;break}let A=r,x=e.tile,C=s.encoding,T=s.vertices,E=n.stride,S,D;C.hasWebMercatorT&&(S=Si.geodeticLatitudeToMercatorAngle(f.south),D=1/(Si.geodeticLatitudeToMercatorAngle(f.north)-S));for(let w=0;w<g.length;++w){let R=g[w],O=C.decodeTextureCoordinates(T,R,Su);NL(A,x,O,O);let L=O.x,N=O.y,_=m?L:N;if(_<0||_>1||Math.abs(L-d)<P.EPSILON5&&Math.abs(N-p)<P.EPSILON5)continue;let b=Math.abs(L)<P.EPSILON5||Math.abs(L-1)<P.EPSILON5,v=Math.abs(N)<P.EPSILON5||Math.abs(N-1)<P.EPSILON5;if(b&&v)continue;let I=C.decodePosition(T,R,oS),B=C.decodeHeight(T,R),F;C.hasVertexNormals?F=C.getOctEncodedNormal(T,R,bY):(F=bY,F.x=0,F.y=0);let k=N;if(C.hasWebMercatorT){let G=P.lerp(f.south,f.north,N);k=(Si.geodeticLatitudeToMercatorAngle(G)-S)*D}let U;n.hasGeodeticSurfaceNormals&&(U=t.geodeticSurfaceNormal(I,vY)),n.encode(i,o*E,I,O,B,F,k,U),c.minimumHeight=Math.min(c.minimumHeight,B),c.maximumHeight=Math.max(c.maximumHeight,B),++o}return o}function l_e(e,t,n,i,o,r){let s,a,c;n?(s=0,a=e.length,c=1):(s=e.length-1,a=-1,c=-1);for(let l=s;l!==a;l+=c){let f=e[l],d=t[l];if(!wY(d,f))continue;let p;switch(i){case pn.WEST:p=f.westIndicesSouthToNorth;break;case pn.SOUTH:p=f.southIndicesEastToWest;break;case pn.EAST:p=f.eastIndicesNorthToSouth;break;case pn.NORTH:p=f.northIndicesWestToEast;break}let g=p[n?0:p.length-1];if(u(g))return f.encoding.decodeHeight(f.vertices,g)}}function wY(e,t){return u(t)&&(!u(e.data.fill)||!e.data.fill.changedThisFrame)}function u_e(e,t,n,i,o,r,s,a){let c,l,f,d,p,g=i[o?0:n.length-1],m=n[o?0:n.length-1];if(wY(g,m)&&(r===0?s===0?(c=o?m.northIndicesWestToEast:m.eastIndicesNorthToSouth,l=o,f=o):(c=o?m.eastIndicesNorthToSouth:m.southIndicesEastToWest,l=!o,f=!1):s===0?(c=o?m.westIndicesSouthToNorth:m.northIndicesWestToEast,l=!o,f=!0):(c=o?m.southIndicesEastToWest:m.westIndicesSouthToNorth,l=o,f=!o),c.length>0)){d=o?0:c.length-1,p=c[d],m.encoding.decodeTextureCoordinates(m.vertices,p,Su);let A=NL(g,e.tile,Su,Su);if(A.x===r&&A.y===s)return DY(m,p,r,s,a),!0;if(d=wo(c,l?r:s,function(x,C){m.encoding.decodeTextureCoordinates(m.vertices,x,Su);let T=NL(g,e.tile,Su,Su);return f?l?T.x-r:T.y-s:l?r-T.x:s-T.y}),d<0){if(d=~d,d>0&&d<c.length)return oit(t,g,e.tile,m,c[d-1],c[d],r,s,l,a),!0}else return DY(m,c[d],r,s,a),!0}return!1}var sit=[new h,new h,new h,new h];function ait(e,t,n,i,o,r){let s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=sit;return h.fromRadians(n.west,n.south,o,a,c[0]),h.fromRadians(n.east,n.south,o,a,c[1]),h.fromRadians(n.west,n.north,o,a,c[2]),h.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}var sS=rS;function Jo(e){this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=gn.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 Ae,this._imageryLayers.layerAdded.addEventListener(Jo.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(Jo.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(Jo.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(Jo.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Ae,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 z(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=ce.clone(ce.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}Object.defineProperties(Jo.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){this._baseColor=e,this._firstPassInitialColor=oe.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){this._quadtree=e}},ready:{get:function(){return this._terrainProvider.ready&&(this._imageryLayers.length===0||this._imageryLayers.get(0).imageryProvider.ready)}},tilingScheme:{get:function(){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,u(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ss.setOwner(e,this,"_clippingPlanes")}}});function cit(e,t){let n=e.loadingImagery;u(n)||(n=e.readyImagery);let i=t.loadingImagery;return u(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}Jo.prototype.update=function(e){this._imageryLayers._update()};function lit(e,t){let n=t.creditDisplay;e._terrainProvider.ready&&u(e._terrainProvider.credit)&&n.addCredit(e._terrainProvider.credit);let i=e._imageryLayers;for(let o=0,r=i.length;o<r;++o){let s=i.get(o).imageryProvider;s.ready&&u(s.credit)&&n.addCredit(s.credit)}}Jo.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(cit)})),lit(this,e);let t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)If._freeVertexArray(t[i]);t.length=0};Jo.prototype.beginUpdate=function(e){let t=this._tilesToRenderByTextureCount;for(let i=0,o=t.length;i<o;++i){let r=t[i];u(r)&&(r.length=0)}let n=this._clippingPlanes;u(n)&&n.enabled&&n.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};Jo.prototype.endUpdate=function(e){if(!u(this._renderState)){this._renderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Fa.LESS}}),this._blendRenderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Fa.LESS_OR_EQUAL},blending:un.ALPHA_BLEND});let s=Ge(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=Ue.fromCache(s),s=Ge(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=Ue.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&sS.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);let t=this.quadtree,n=e.terrainExaggeration,i=e.terrainExaggerationRelativeHeight,o=this._oldTerrainExaggeration!==n||this._oldTerrainExaggerationRelativeHeight!==i;this._oldTerrainExaggeration=n,this._oldTerrainExaggerationRelativeHeight=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 c=r[s];if(u(c))for(let l=0,f=c.length;l<f;++l){let d=c[l],p=d.data.tileBoundingRegion;Bit(this,d,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,p.minimumHeight)}}};function g_e(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)}Jo.prototype.updateForPick=function(e){let t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)g_e(t[n],e)};Jo.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};Jo.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)};Jo.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;u(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===$n.CULLED_BUT_NEEDED,o=n.terrainState),If.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)!==ur.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,If.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};var uit=new se,y_e=new ce,fit=new ce,dit=new he;function i4(e,t){if(t.west<t.east)return t;let n=ce.clone(t,fit);return ce.center(e,dit).longitude>0?n.east=P.PI:n.west=-P.PI,n}function A_e(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;let n=e._clippingPlanes;return!!(u(n)&&n.enabled||!ce.equals(e.cartographicLimitRectangle,ce.MAX_VALUE))}Jo.prototype.computeTileVisibility=function(e,t,n){let i=this.computeDistanceToTile(e,t);e._distance=i;let o=A_e(this,t);if(t.fog.enabled&&!o&&P.fog(i,t.fog.density)>=1)return ur.NONE;let r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return ur.PARTIAL;let a=t.cullingVolume,c=s.boundingVolume;u(c)||(c=s.boundingSphere),r.clippedByBoundaries=!1;let l=i4(e.rectangle,this.cartographicLimitRectangle),f=ce.simpleIntersection(l,e.rectangle,y_e);if(!u(f))return ur.NONE;if(ce.equals(f,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==te.SCENE3D&&(c=uit,se.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,c),h.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===te.MORPHING&&u(r.renderedMesh)&&(c=se.union(s.boundingSphere,c,c))),!u(c))return ur.PARTIAL;let d=this._clippingPlanes;if(u(d)&&d.enabled){let A=d.computeIntersectionWithBoundingVolume(c);if(e.isClipped=A!==Qt.INSIDE,A===Qt.OUTSIDE)return ur.NONE}let p,g=a.computeVisibility(c);if(g===Qt.OUTSIDE?p=ur.NONE:g===Qt.INTERSECTING?p=ur.PARTIAL:g===Qt.INSIDE&&(p=ur.FULL),p===ur.NONE)return p;let m=t.mode===te.SCENE3D&&t.camera.frustum instanceof en;if(t.mode===te.SCENE3D&&!m&&u(n)&&!o){let A=r.occludeePointInScaledSpace;return!u(A)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(A,s.minimumHeight)?p:ur.NONE}return p};Jo.prototype.canRefine=function(e){return u(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};var hit=[],mit=[];Jo.prototype.canRenderWithoutLosingDetail=function(e,t){let n=e.data,i=hit;i.length=this._imageryLayers.length;let o=!1,r=!1,s;u(n)&&(o=n.terrainState===mo.READY,r=!0,s=n.imagery);let a,c;for(a=0,c=i.length;a<c;++a)i[a]=r;if(u(s))for(a=0,c=s.length;a<c;++a){let d=s[a],p=d.loadingImagery,g=!u(p)||p.state===ui.FAILED||p.state===ui.INVALID,m=(d.loadingImagery||d.readyImagery).imageryLayer._layerIndex;i[m]=g&&i[m]}let l=this.quadtree._lastSelectionFrameNumber,f=mit;for(f.length=0,f.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);f.length>0;){let d=f.pop(),p=d._lastSelectionResultFrame===l?d._lastSelectionResult:$n.NONE;if(p===$n.RENDERED){let g=d.data;if(!u(g))continue;if(!o&&d.data.terrainState===mo.READY)return!1;let m=d.data.imagery;for(a=0,c=m.length;a<c;++a){let A=m[a],x=A.loadingImagery,C=!u(x)||x.state===ui.FAILED||x.state===ui.INVALID,T=(A.loadingImagery||A.readyImagery).imageryLayer._layerIndex;if(C&&!i[T])return!1}}else p===$n.REFINED&&f.push(d.southwestChild,d.southeastChild,d.northwestChild,d.northeastChild)}return!0};var pit=new h;Jo.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=h.subtract(i.center,o,pit),a=h.magnitude(s);return a<P.EPSILON5?0:(h.divideByScalar(s,a,s),(1-h.dot(s,r))*e._distance)};var h_e=new M,n4=new M,_it=new oe,git=new oe,yit=new oe,Ait=new h,m_e=new h,xit=new h,Cit=new h;Jo.prototype.showTileThisFrame=function(e,t){let n=0,i=e.data.imagery;for(let a=0,c=i.length;a<c;++a){let l=i[a];u(l.readyImagery)&&l.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];u(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);let r=e.data;u(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;let s=this._debug;++s.tilesRendered,s.texturesRendered+=n};var Tit=[new h,new h,new h,new h];function p_e(e,t,n,i,o,r){let s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=Tit;return h.fromRadians(n.west,n.south,o,a,c[0]),h.fromRadians(n.east,n.south,o,a,c[1]),h.fromRadians(n.west,n.north,o,a,c[2]),h.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}Jo.prototype.computeDistanceToTile=function(e,t){Eit(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 c=t.camera.positionCartographic.height,l=Math.abs(c-r),f=Math.abs(c-s);l>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 Eit(e,t,n){let i=e.data;i===void 0&&(i=e.data=new If);let o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new af({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));let r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight,c=!1,l=e,f=i.mesh,d=i.terrainData;if(f!==void 0&&f.minimumHeight!==void 0&&f.maximumHeight!==void 0)r.minimumHeight=f.minimumHeight,r.maximumHeight=f.maximumHeight,c=!0;else if(d!==void 0&&d._minimumHeight!==void 0&&d._maximumHeight!==void 0)r.minimumHeight=d._minimumHeight,r.maximumHeight=d._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,A=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(A!==void 0&&A._minimumHeight!==void 0&&A._maximumHeight!==void 0){r.minimumHeight=A._minimumHeight,r.maximumHeight=A._maximumHeight;break}}p=p.parent}l=p}if(l!==void 0){let p=n.terrainExaggeration,g=n.terrainExaggerationRelativeHeight;if(p!==1&&(c=!1,r.minimumHeight=Cc.getHeight(r.minimumHeight,p,g),r.maximumHeight=Cc.getHeight(r.maximumHeight,p,g)),c)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Rn.clone(f.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=se.clone(f.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=h.clone(f.occludeePointInScaledSpace,i.occludeePointInScaledSpace),u(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=p_e(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{let A=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||A)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=p_e(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=l,i.boundingVolumeIsFromMesh=c}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}Jo.prototype.isDestroyed=function(){return!1};Jo.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),le(this)};function bit(e,t,n){return function(i){let o,r,s=-1,a=i.data.imagery,c=a.length,l;for(l=0;l<c;++l)if(o=a[l],r=y(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=l;break}if(s!==-1){let f=s+e;if(o=a[f],r=u(o)?y(o.readyImagery,o.loadingImagery):void 0,!u(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,f);for(l=s;l<f;++l)a[l].freeResources();a.splice(s,e)}return!0}}Jo.prototype._onLayerAdded=function(e,t){if(e.show){let n=this._terrainProvider,i=this,o=e.imageryProvider,r=this._imageryLayersUpdatedEvent;o._reload=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(u(s._loadedCallbacks[e._layerIndex]))return;let a,c=s.data.imagery,l=c.length,f=-1,d=0;for(a=0;a<l;++a){let g=c[a];if(y(g.readyImagery,g.loadingImagery).imageryLayer===e)f===-1&&(f=a),++d;else if(f!==-1)break}if(f===-1)return;let p=f+d;e._createTileImagerySkeletons(s,n,p)&&(s._loadedCallbacks[e._layerIndex]=bit(d,e,n),s.state=Os.LOADING)})},this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=Os.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==$n.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,r.raiseEvent()}};Jo.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 c=i[s],l=c.loadingImagery;if(u(l)||(l=c.readyImagery),l.imageryLayer===e)o===-1&&(o=s),c.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),u(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};Jo.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};Jo.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};var Sit=new M,Dit=new M;function __e(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_terrainExaggerationAndRelativeHeight:function(){return this.properties.terrainExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){let i=e.context.uniformState.view,o=M.multiplyByPoint(i,this.properties.rtc,m_e);return M.setTranslation(i,o,h_e),h_e},u_modifiedModelViewProjection:function(){let i=e.context.uniformState.view,o=e.context.uniformState.projection,r=M.multiplyByPoint(i,this.properties.rtc,m_e);return M.setTranslation(i,r,n4),M.multiply(o,n4,n4),n4},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 u(i)&&u(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){let i=t._clippingPlanes,o=u(i)?M.multiply(e.context.uniformState.view,i.modelMatrix,Sit):M.IDENTITY;return M.inverseTranspose(o,Dit)},u_clippingPlanesEdgeStyle:function(){let i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},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 oe(0,0,.5,1),fillHighlightColor:new z(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new H(65e5,9e6),nightFadeDistance:new H(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new h(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new h(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new h,center3D:void 0,rtc:new h,modifiedModelView:new M,tileRectangle:new oe,terrainExaggerationAndRelativeHeight: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 oe,minMaxHeight:new H,scaleAndBias:new M,clippingPlanesEdgeColor:z.clone(z.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new oe,frontFaceAlphaByDistance:new oe,backFaceAlphaByDistance:new oe,localizedTranslucencyRectangle:new oe,undergroundColor:z.clone(z.TRANSPARENT),undergroundColorAlphaByDistance:new oe,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return u(t.materialUniformMap)?_t(n,t.materialUniformMap):n}function vit(e,t,n){let i=n.data,o,r;if(u(i.vertexArray)?(o=i.mesh,r=i.vertexArray):u(i.fill)&&u(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!u(o)||!u(r))){if(u(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=wit(e,r,o),i.wireframeVertexArray.mesh=o}}function wit(e,t,n){let o={indices:n.indices,primitiveType:Me.TRIANGLES};Ln.toWireframe(o);let r=o.indices,s=lt.createIndexBuffer({context:e,typedArray:r,usage:Ne.STATIC_DRAW,indexDatatype:Fe.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new oi({context:e,attributes:t._attributes,indexBuffer:s})}var x_e,C_e,o4;(function(){let e=new At({geometry:Xf.fromDimensions({dimensions:new h(2,2,2)})}),t=new At({geometry:new Wp({radius:1})}),n=new M,i,o;function r(s){return new Dn({geometryInstances:s,appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})}x_e=function(s,a){return s===i||(o4(),i=s,n=M.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=Nt.fromColor(a),o=r(e)),o},C_e=function(s,a){return s===i||(o4(),i=s,n=M.fromTranslation(s.center,n),n=M.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=Nt.fromColor(a),o=r(t)),o},o4=function(){u(o)&&(o.destroy(),o=void 0,i=void 0)}})();var Iit=new oe(0,0,0,0),Pit={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,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},Oit=z.TRANSPARENT,Rit=new Pt;function Bit(e,t,n){let i=t.data;u(i.vertexArray)||(i.fill===void 0&&(i.fill=new sS(t)),i.fill.update(e,n));let o=n.creditDisplay,r=i.terrainData;if(u(r)&&u(r.credits)){let Je=r.credits;for(let pe=0,me=Je.length;pe<me;++pe)o.addCredit(Je[pe])}let s=Ft.maximumTextureImageUnits,a=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!u(a)&&u(i.fill)&&(a=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);let l=n.cameraUnderground,f=n.globeTranslucencyState,d=f.translucent,p=f.frontFaceAlphaByDistance,g=f.backFaceAlphaByDistance,m=f.rectangle,A=y(e.undergroundColor,Oit),x=y(e.undergroundColorAlphaByDistance,Rit),C=A_e(e,n)&&n.mode===te.SCENE3D&&A.alpha>0&&(x.nearValue>0||x.farValue>0),T=e.lambertDiffuseMultiplier,E=e.vertexShadowDarkness,S=e.hasWaterMask&&u(a),D=e.oceanNormalMap,w=S&&u(D),R=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,O=n.fog.enabled&&n.fog.renderable&&!l,L=e.showGroundAtmosphere&&n.mode===te.SCENE3D,N=gn.castShadows(e.shadows)&&!d,_=gn.receiveShadows(e.shadows)&&!d,b=e.hueShift,v=e.saturationShift,I=e.brightnessShift,B=!(P.equalsEpsilon(b,0,P.EPSILON7)&&P.equalsEpsilon(v,0,P.EPSILON7)&&P.equalsEpsilon(I,0,P.EPSILON7)),F=!1;if(L){let Je=h.magnitude(n.camera.positionWC),pe=e.nightFadeOutDistance;F=Je>pe}S&&--s,w&&--s,u(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,u(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,s-=f.numberOfTextureUniforms;let k=i.renderedMesh,U=k.center,G=k.encoding,V=i.tileBoundingRegion,X=n.terrainExaggeration,j=n.terrainExaggerationRelativeHeight,Q=X!==1,W=G.hasGeodeticSurfaceNormals,K=_it,J=0,_e=0,xe=0,re=0,ye=!1;if(n.mode!==te.SCENE3D){let Je=n.mapProjection,pe=Je.project(ce.southwest(t.rectangle),xit),me=Je.project(ce.northeast(t.rectangle),Cit);if(K.x=pe.x,K.y=pe.y,K.z=me.x,K.w=me.y,n.mode!==te.MORPHING&&(U=Ait,U.x=0,U.y=(K.z+K.x)*.5,U.z=(K.w+K.y)*.5,K.x-=U.y,K.y-=U.z,K.z-=U.y,K.w-=U.z),n.mode===te.SCENE2D&&G.quantization===Ps.BITS12){let be=1/(Math.pow(2,12)-1)*.5,St=(K.z-K.x)*be,qt=(K.w-K.y)*be;K.x-=St,K.y-=qt,K.z+=St,K.w+=qt}Je instanceof Si&&(J=t.rectangle.south,_e=t.rectangle.north,xe=Si.geodeticLatitudeToMercatorAngle(J),re=1/(Si.geodeticLatitudeToMercatorAngle(_e)-xe),ye=!0)}let fe=Pit;fe.frameState=n,fe.surfaceTile=i,fe.showReflectiveOcean=S,fe.showOceanWaves=w,fe.enableLighting=e.enableLighting,fe.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,fe.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,fe.showGroundAtmosphere=L,fe.atmosphereLightIntensity=e.atmosphereLightIntensity,fe.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,fe.atmosphereMieCoefficient=e.atmosphereMieCoefficient,fe.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,fe.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,fe.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,fe.perFragmentGroundAtmosphere=F,fe.hasVertexNormals=R,fe.useWebMercatorProjection=ye,fe.clippedByBoundaries=i.clippedByBoundaries,fe.hasGeodeticSurfaceNormals=W,fe.hasExaggeration=Q;let Se=i.imagery,we=0,Ve=Se.length,qe=e.showSkirts&&!l&&!d,mt=e.backFaceCulling&&!l&&!d,Ht=mt?e._renderState:e._disableCullingRenderState,fn=mt?e._blendRenderState:e._disableCullingBlendRenderState,dt=Ht,Tn=e._firstPassInitialColor,Jn=n.context;if(u(e._debug.boundingSphereTile)||o4(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;let Je=e._drawCommands.length;for(let pe=0;pe<Je;++pe)e._uniformMaps[pe]=__e(n,e)}do{let Je=0,pe,me;if(e._drawCommands.length<=e._usedDrawCommands?(pe=new tt,pe.owner=t,pe.cull=!1,pe.boundingVolume=new se,pe.orientedBoundingBox=void 0,me=__e(n,e),e._drawCommands.push(pe),e._uniformMaps.push(me)):(pe=e._drawCommands[e._usedDrawCommands],me=e._uniformMaps[e._usedDrawCommands]),pe.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){let Do=V.boundingVolume,Bo=V.boundingSphere;u(Do)?x_e(Do,z.RED).update(n):u(Bo)&&C_e(Bo,z.RED).update(n)}let be=me.properties;oe.clone(Tn,be.initialColor),be.oceanNormalMap=D,be.lightingFadeDistance.x=e.lightingFadeOutDistance,be.lightingFadeDistance.y=e.lightingFadeInDistance,be.nightFadeDistance.x=e.nightFadeOutDistance,be.nightFadeDistance.y=e.nightFadeInDistance,be.atmosphereLightIntensity=e.atmosphereLightIntensity,be.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,be.atmosphereMieCoefficient=e.atmosphereMieCoefficient,be.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,be.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,be.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,be.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;let St=l?g:p,qt=l?p:g;u(St)&&(oe.fromElements(St.near,St.nearValue,St.far,St.farValue,be.frontFaceAlphaByDistance),oe.fromElements(qt.near,qt.nearValue,qt.far,qt.farValue,be.backFaceAlphaByDistance)),oe.fromElements(x.near,x.nearValue,x.far,x.farValue,be.undergroundColorAlphaByDistance),z.clone(A,be.undergroundColor),be.lambertDiffuseMultiplier=T,be.vertexShadowDarkness=E;let Kn=!u(i.vertexArray)&&u(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Kn&&z.clone(e.fillHighlightColor,be.fillHighlightColor),be.terrainExaggerationAndRelativeHeight.x=X,be.terrainExaggerationAndRelativeHeight.y=j,be.center3D=k.center,h.clone(U,be.rtc),oe.clone(K,be.tileRectangle),be.southAndNorthLatitude.x=J,be.southAndNorthLatitude.y=_e,be.southMercatorYAndOneOverHeight.x=xe,be.southMercatorYAndOneOverHeight.y=re;let Ro=git,Uo=i4(t.rectangle,e.cartographicLimitRectangle),Ao=yit,Yr=i4(t.rectangle,m);h.fromElements(b,v,I,be.hsbShift);let Be=t.rectangle,it=1/Be.width,Ke=1/Be.height;Ro.x=(Uo.west-Be.west)*it,Ro.y=(Uo.south-Be.south)*Ke,Ro.z=(Uo.east-Be.west)*it,Ro.w=(Uo.north-Be.south)*Ke,oe.clone(Ro,be.localizedCartographicLimitRectangle),Ao.x=(Yr.west-Be.west)*it,Ao.y=(Yr.south-Be.south)*Ke,Ao.z=(Yr.east-Be.west)*it,Ao.w=(Yr.north-Be.south)*Ke,oe.clone(Ao,be.localizedTranslucencyRectangle);let Ze=O&&P.fog(t._distance,n.fog.density)>P.EPSILON3;B=B&&(Ze||L);let ft=!1,Lt=!1,En=!1,so=!1,So=!1,ns=!1,Nr=!1,Hi=!1,Oi=!1,Ar=!1;for(;Je<s&&we<Ve;){let Do=Se[we],Bo=Do.readyImagery;if(++we,!u(Bo)||Bo.imageryLayer.alpha===0)continue;let kf=Do.useWebMercatorT?Bo.textureWebMercator:Bo.texture,er=Bo.imageryLayer;u(Do.textureTranslationAndScale)||(Do.textureTranslationAndScale=er._calculateTextureTranslationAndScale(t,Do)),be.dayTextures[Je]=kf,be.dayTextureTranslationAndScale[Je]=Do.textureTranslationAndScale,be.dayTextureTexCoordsRectangle[Je]=Do.textureCoordinateRectangle,be.dayTextureUseWebMercatorT[Je]=Do.useWebMercatorT,be.dayTextureAlpha[Je]=er.alpha,ns=ns||be.dayTextureAlpha[Je]!==1,be.dayTextureNightAlpha[Je]=er.nightAlpha,Nr=Nr||be.dayTextureNightAlpha[Je]!==1,be.dayTextureDayAlpha[Je]=er.dayAlpha,Nr=Nr||be.dayTextureDayAlpha[Je]!==1,be.dayTextureBrightness[Je]=er.brightness,ft=ft||be.dayTextureBrightness[Je]!==bu.DEFAULT_BRIGHTNESS,be.dayTextureContrast[Je]=er.contrast,Lt=Lt||be.dayTextureContrast[Je]!==bu.DEFAULT_CONTRAST,be.dayTextureHue[Je]=er.hue,En=En||be.dayTextureHue[Je]!==bu.DEFAULT_HUE,be.dayTextureSaturation[Je]=er.saturation,so=so||be.dayTextureSaturation[Je]!==bu.DEFAULT_SATURATION,be.dayTextureOneOverGamma[Je]=1/er.gamma,So=So||be.dayTextureOneOverGamma[Je]!==1/bu.DEFAULT_GAMMA,be.dayTextureSplit[Je]=er.splitDirection,Hi=Hi||be.dayTextureSplit[Je]!==0;let ba=be.dayTextureCutoutRectangles[Je];if(u(ba)||(ba=be.dayTextureCutoutRectangles[Je]=new oe),oe.clone(oe.ZERO,ba),u(er.cutoutRectangle)){let Sa=i4(Be,er.cutoutRectangle),uh=ce.simpleIntersection(Sa,Be,y_e);Oi=u(uh)||Oi,ba.x=(Sa.west-Be.west)*it,ba.y=(Sa.south-Be.south)*Ke,ba.z=(Sa.east-Be.west)*it,ba.w=(Sa.north-Be.south)*Ke}let lh=be.colorsToAlpha[Je];u(lh)||(lh=be.colorsToAlpha[Je]=new oe);let V_=u(er.colorToAlpha)&&er.colorToAlphaThreshold>0;if(Ar=Ar||V_,V_){let Sa=er.colorToAlpha;lh.x=Sa.red,lh.y=Sa.green,lh.z=Sa.blue,lh.w=er.colorToAlphaThreshold}else lh.w=-1;if(u(Bo.credits)){let Sa=Bo.credits;for(let uh=0,i0=Sa.length;uh<i0;++uh)o.addCredit(Sa[uh])}++Je}be.dayTextures.length=Je,be.waterMask=a,oe.clone(c,be.waterMaskTranslationAndScale),be.minMaxHeight.x=G.minimumHeight,be.minMaxHeight.y=G.maximumHeight,M.clone(G.matrix,be.scaleAndBias);let Mn=e._clippingPlanes,Yn=u(Mn)&&Mn.enabled&&t.isClipped;Yn&&(be.clippingPlanesEdgeColor=z.clone(Mn.edgeColor,be.clippingPlanesEdgeColor),be.clippingPlanesEdgeWidth=Mn.edgeWidth),fe.numberOfDayTextures=Je,fe.applyBrightness=ft,fe.applyContrast=Lt,fe.applyHue=En,fe.applySaturation=so,fe.applyGamma=So,fe.applyAlpha=ns,fe.applyDayNightAlpha=Nr,fe.applySplit=Hi,fe.enableFog=Ze,fe.enableClippingPlanes=Yn,fe.clippingPlanes=Mn,fe.hasImageryLayerCutout=Oi,fe.colorCorrect=B,fe.highlightFillTile=Kn,fe.colorToAlpha=Ar,fe.showUndergroundColor=C,fe.translucent=d;let Zn=i.renderedMesh.indices.length;qe||(Zn=i.renderedMesh.indexCountWithoutSkirts),pe.shaderProgram=e._surfaceShaderSet.getShaderProgram(fe),pe.castShadows=N,pe.receiveShadows=_,pe.renderState=dt,pe.primitiveType=Me.TRIANGLES,pe.vertexArray=i.vertexArray||i.fill.vertexArray,pe.count=Zn,pe.uniformMap=me,pe.pass=Ee.GLOBE,e._debug.wireframe&&(vit(Jn,e,t),u(i.wireframeVertexArray)&&(pe.vertexArray=i.wireframeVertexArray,pe.primitiveType=Me.LINES,pe.count=Zn*2));let ti=pe.boundingVolume,hc=pe.orientedBoundingBox;n.mode!==te.SCENE3D?(se.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,V.minimumHeight,V.maximumHeight,ti),h.fromElements(ti.center.z,ti.center.x,ti.center.y,ti.center),n.mode===te.MORPHING&&(ti=se.union(V.boundingSphere,ti,ti))):(pe.boundingVolume=se.clone(V.boundingSphere,ti),pe.orientedBoundingBox=Rn.clone(V.boundingVolume,hc)),pe.dirty=!0,d&&f.updateDerivedCommands(pe,n),g_e(pe,n),dt=fn,Tn=Iit}while(we<Ve)}var FL=Jo;function T_e(){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(T_e.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){this._frontFaceAlphaByDistance=Pt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){this._backFaceAlphaByDistance=Pt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){u(e)||(e=ce.clone(ce.MAX_VALUE)),ce.clone(e,this._rectangle)}}});var VL=T_e;function ms(){this._layers=[],this.layerAdded=new Ae,this.layerRemoved=new Ae,this.layerMoved=new Ae,this.layerShownOrHidden=new Ae}Object.defineProperties(ms.prototype,{length:{get:function(){return this._layers.length}}});ms.prototype.add=function(e,t){u(t)?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)};ms.prototype.addImageryProvider=function(e,t){let n=new bu(e);return this.add(n,t),n};ms.prototype.remove=function(e,t){t=y(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};ms.prototype.removeAll=function(e){e=y(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=[]};ms.prototype.contains=function(e){return this.indexOf(e)!==-1};ms.prototype.indexOf=function(e){return this._layers.indexOf(e)};ms.prototype.get=function(e){return this._layers[e]};function r4(e,t){return e.indexOf(t)}function E_e(e,t,n){let i=e._layers;if(t=P.clamp(t,0,i.length-1),n=P.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)}ms.prototype.raise=function(e){let t=r4(this._layers,e);E_e(this,t,t+1)};ms.prototype.lower=function(e){let t=r4(this._layers,e);E_e(this,t,t-1)};ms.prototype.raiseToTop=function(e){let t=r4(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))};ms.prototype.lowerToBottom=function(e){let t=r4(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 Mit=new ce;function b_e(e,t,n,i){let o=e.globe._surface._tilesToRender,r;for(let a=0;!u(r)&&a<o.length;++a){let c=o[a];ce.contains(c.rectangle,t)&&(r=c)}if(!u(r))return;let s=r.data.imagery;for(let a=s.length-1;a>=0;--a){let c=s[a],l=c.readyImagery;if(!u(l))continue;let f=l.imageryLayer.imageryProvider;if(n&&!u(f.pickFeatures)||!ce.contains(l.rectangle,t))continue;let d=Mit,p=1/1024;d.west=P.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.x-p),d.east=P.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.z+p),d.south=P.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.y-p),d.north=P.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.w+p),ce.contains(d,t)&&i(l)}}ms.prototype.pickImageryLayers=function(e,t){let n=t.globe.pick(e,t);if(!u(n))return;let i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];if(b_e(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};ms.prototype.pickImageryLayerFeatures=function(e,t){let n=t.globe.pick(e,t);if(!u(n))return;let i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(b_e(t,i,!0,function(s){let c=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);u(c)&&(o.push(c),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){let a=[];for(let c=0;c<s.length;++c){let l=s[c],f=r[c];if(u(l)&&l.length>0)for(let d=0;d<l.length;++d){let p=l[d];p.imageryLayer=f,u(p.position)||(p.position=i),a.push(p)}}return a})};ms.prototype.queueReprojectionCommands=function(e){let t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};ms.prototype.cancelReprojections=function(){let e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};ms.prototype.isDestroyed=function(){return!1};ms.prototype.destroy=function(){return this.removeAll(!0),le(this)};ms.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&&(u(i._show)&&(u(n)||(n=[]),n.push(i)),i._show=i.show);if(u(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};var UL=ms;function S_e(e){this._ellipsoid=new Qp(e.ellipsoid,h.ZERO)}Object.defineProperties(S_e.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var kL=S_e;function Wc(e){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=$n.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=Os.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}Wc.createLevelZeroTiles=function(e){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 Wc({tilingScheme:e,x:s,y:r,level:0});return i};Wc.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(u(t)&&u(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(u(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;let c=a.customData;for(o=0;o<c.length;++o)r=c[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(Wc.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 u(this._southwestChild)||(this._southwestChild=new Wc({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return u(this._southeastChild)||(this._southeastChild=new Wc({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 u(this._northwestChild)||(this._northwestChild=new Wc({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return u(this._northeastChild)||(this._northeastChild=new Wc({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<Os.DONE}},eligibleForUnloading:{get:function(){let e=!0;return u(this.data)&&(e=this.data.eligibleForUnloading,u(e)||(e=!0)),e}}});Wc.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]};Wc.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};Wc.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};Wc.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};Wc.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};Wc.prototype.freeResources=function(){this.state=Os.START,this.renderable=!1,this.upsampledFromParent=!1,u(this.data)&&u(this.data.freeResources)&&this.data.freeResources(),s4(this._southwestChild),this._southwestChild=void 0,s4(this._southeastChild),this._southeastChild=void 0,s4(this._northwestChild),this._northwestChild=void 0,s4(this._northeastChild),this._northeastChild=void 0};function s4(e){u(e)&&e.freeResources()}var zL=Wc;function a4(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}a4.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};a4.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&u(this._lastBeforeStartOfFrame)&&this.count>e&&u(t);){n=t!==this._lastBeforeStartOfFrame;let i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),D_e(this,t)),t=i}};function D_e(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}a4.prototype.markTileRendered=function(e){let t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!u(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(u(e.replacementPrevious)||u(e.replacementNext))&&D_e(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};var HL=a4;function Pf(e){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 HL,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=y(e.maximumScreenSpaceError,2),this.tileCacheSize=y(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new kL({ellipsoid:n}),this._tileLoadProgressEvent=new Ae,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(Pf.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});Pf.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function Lit(e){let t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,w_e(e);let n=e._levelZeroTiles;if(u(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 c=r[a];c.level=0,e._addHeightCallbacks.push(c)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}Pf.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;u(t);)t.state!==Os.START&&e(t),t=t.replacementNext};Pf.prototype.forEachRenderedTile=function(e){let t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};Pf.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};Pf.prototype.update=function(e){u(this._tileProvider.update)&&this._tileProvider.update(e)};function w_e(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}Pf.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(Lit(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),w_e(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};Pf.prototype.render=function(e){let t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),Uit(this,e),Kit(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function Nit(e,t){let n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){let o=Ae.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))}Pf.prototype.endFrame=function(e){!e.passes.render||e.mode===te.MORPHING||(jit(this,e),Xit(this,e),Nit(this,e))};Pf.prototype.isDestroyed=function(){return!1};Pf.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};var WL,v_e=new he;function Fit(e,t){let n=ce.center(e.rectangle,v_e),i=n.longitude-WL.longitude,o=n.latitude-WL.latitude;n=ce.center(t.rectangle,v_e);let r=n.longitude-WL.longitude,s=n.latitude-WL.latitude;return i*i+o*o-(r*r+s*s)}var Vit=new h,GL=[];function Uit(e,t){let n=e._debug;if(n.suspendLodUpdate)return;let i=e._tilesToRender;i.length=0;let o,r=e._tileProvider;if(!u(e._levelZeroTiles))if(r.ready){let A=r.tilingScheme;e._levelZeroTiles=zL.createLevelZeroTiles(A);let x=e._levelZeroTiles.length;if(GL.length<x)for(GL=new Array(x),o=0;o<x;++o)GL[o]===void 0&&(GL[o]=new jL)}else return;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s,a=e._levelZeroTiles,c=a.length>1?e._occluders:void 0;WL=t.camera.positionCartographic,a.sort(Fit);let l=e._addHeightCallbacks,f=e._removeHeightCallbacks,d=t.frameNumber,p;if(l.length>0||f.length>0){for(o=0,p=a.length;o<p;++o)s=a[o],s._updateCustomData(d,l,f);l.length=0,f.length=0}let g=t.camera;e._cameraPositionCartographic=g.positionCartographic;let m=M.getTranslation(g.transform,Vit);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?Aa(e,s,r,t,c,!1,GL[o]):(w_(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=d}function w_(e,t,n,i){n.needsLoading&&(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function jL(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function I_e(){this.southwest=new jL,this.southeast=new jL,this.northwest=new jL,this.northeast=new jL}I_e.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 OY=new Array(31);for(let e=0;e<OY.length;++e)OY[e]=new I_e;function kit(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=Git(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,c=n.southeastChild,l=n.northwestChild,f=n.northeastChild,d=e._lastSelectionFrameNumber,p=n._lastSelectionResultFrame===d?n._lastSelectionResult:$n.NONE,g=e.tileProvider;if(s||i){let m=$n.originalResult(p)===$n.RENDERED,A=$n.originalResult(p)===$n.CULLED||p===$n.NONE,x=n.state===Os.DONE,C=m||A||x;if(C||u(g.canRenderWithoutLosingDetail)&&(C=g.canRenderWithoutLosingDetail(n)),C){s&&w_(e,e._tileLoadQueueMedium,n,t),c4(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===$n.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=$n.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&w_(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&c.upsampledFromParent&&l.upsampledFromParent&&f.upsampledFromParent){c4(e,n),w_(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(f),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===$n.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=$n.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=$n.REFINED;let A=e._tilesToRender.length,x=e._tileLoadQueueLow.length,C=e._tileLoadQueueMedium.length,T=e._tileLoadQueueHigh.length,E=e._tileToUpdateHeights.length;if(zit(e,a,c,l,f,t,i,o),A!==e._tilesToRender.length){let S=o.allAreRenderable,D=o.anyWereRenderedLastFrame,w=o.notYetRenderableCount,R=!1;if(!S&&!D){let O=e._tilesToRender;for(let N=A;N<O.length;++N){let _=O[N];for(;_!==void 0&&_._lastSelectionResult!==$n.KICKED&&_!==n;)_._lastSelectionResult=$n.kick(_._lastSelectionResult),_=_.parent}e._tilesToRender.length=A,e._tileToUpdateHeights.length=E,c4(e,n),n._lastSelectionResult=$n.RENDERED;let L=p===$n.RENDERED;!L&&w>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=x,e._tileLoadQueueMedium.length=C,e._tileLoadQueueHigh.length=T,w_(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,R=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=L,L||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!R&&w_(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=$n.RENDERED,c4(e,n),w_(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=p===$n.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function zit(e,t,n,i,o,r,s,a){let c=r.camera.positionCartographic,l=e._tileProvider,f=e._occluders,d=OY[t.level],p=d.southwest,g=d.southeast,m=d.northwest,A=d.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(Aa(e,t,l,r,f,s,p),Aa(e,n,l,r,f,s,g),Aa(e,i,l,r,f,s,m),Aa(e,o,l,r,f,s,A)):(Aa(e,i,l,r,f,s,m),Aa(e,t,l,r,f,s,p),Aa(e,o,l,r,f,s,A),Aa(e,n,l,r,f,s,g)):c.latitude<t.rectangle.north?(Aa(e,n,l,r,f,s,g),Aa(e,t,l,r,f,s,p),Aa(e,o,l,r,f,s,A),Aa(e,i,l,r,f,s,m)):(Aa(e,o,l,r,f,s,A),Aa(e,i,l,r,f,s,m),Aa(e,n,l,r,f,s,g),Aa(e,t,l,r,f,s,p)),d.combine(a)}function Hit(e,t){let n=t.rectangle;return u(e._cameraPositionCartographic)&&ce.contains(n,e._cameraPositionCartographic)||u(e._cameraReferenceFrameOriginCartographic)&&ce.contains(n,e._cameraReferenceFrameOriginCartographic)}function Aa(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==ur.NONE)return kit(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,Hit(e,t)){(!u(t.data)||!u(t.data.vertexArray))&&w_(e,e._tileLoadQueueMedium,t,i);let a=e._lastSelectionFrameNumber,c=t._lastSelectionResultFrame===a?t._lastSelectionResult:$n.NONE;c!==$n.CULLED_BUT_NEEDED&&c!==$n.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=$n.CULLED_BUT_NEEDED}else e.preloadSiblings||t.level===0?(w_(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=$n.CULLED):t._lastSelectionResult=$n.CULLED;t._lastSelectionResultFrame=i.frameNumber}function Git(e,t,n){if(t.mode===te.SCENE2D||t.camera.frustum instanceof en||t.camera.frustum instanceof Tr)return Wit(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-=P.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function Wit(e,t,n){let o=t.camera.frustum;u(o._offCenterFrustum)&&(o=o._offCenterFrustum);let r=t.context,s=r.drawingBufferWidth,a=r.drawingBufferHeight,c=e._tileProvider.getLevelMaximumGeometricError(n.level),l=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(s,a),f=c/l;return t.fog.enabled&&t.mode!==te.SCENE2D&&(f-=P.fog(n._distance,t.fog.density)*t.fog.sse),f/=t.pixelRatio,f}function c4(e,t){e._tilesToRender.push(t)}function jit(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=di()+e._loadQueueTimeSlice,s=e._tileProvider,a=IY(e,t,s,r,n,!1);a=IY(e,t,s,r,i,a),IY(e,t,s,r,o,a)}function Yit(e,t){return e._loadPriority-t._loadPriority}function IY(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(Yit);for(let s=0,a=o.length;s<a&&(di()<i||!r);++s){let c=o[s];e._tileReplacementQueue.markTileRendered(c),n.loadTile(t,c),r=!0}return r}var aS=new wn,PY=new he,Uy=new h,qit=[];function Xit(e,t){if(!e.tileProvider.ready)return;let n=qit;n.length=0;let i=e._tileToUpdateHeights,o=di(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,c=t.mapProjection,l=e.tileProvider.tilingScheme.ellipsoid,f;for(;i.length>0;){let d=i[0];if(!u(d.data)||!u(d.data.mesh)){let A=d._lastSelectionResultFrame===e._lastSelectionFrameNumber?d._lastSelectionResult:$n.NONE;(A===$n.RENDERED||A===$n.CULLED_BUT_NEEDED)&&n.push(d),i.shift(),e._lastTileIndex=0;continue}let p=d.customData,g=p.length,m=!1;for(f=e._lastTileIndex;f<g;++f){let A=p[f],x=d.data.terrainData,C=u(x)&&x.wasCreatedByUpsampling();if(d.level>A.level&&!C){if(u(A.positionOnEllipsoidSurface)||(A.positionOnEllipsoidSurface=h.fromRadians(A.positionCartographic.longitude,A.positionCartographic.latitude,0,l)),a===te.SCENE3D){let E=l.geodeticSurfaceNormal(A.positionOnEllipsoidSurface,aS.direction),S=l.getSurfaceNormalIntersectionWithZAxis(A.positionOnEllipsoidSurface,11500,aS.origin);if(!u(S)){let D=0;u(d.data.tileBoundingRegion)&&(D=d.data.tileBoundingRegion.minimumHeight);let w=Math.min(D,-11500),R=h.multiplyByScalar(E,Math.abs(w)+1,Uy);h.subtract(A.positionOnEllipsoidSurface,R,aS.origin)}}else he.clone(A.positionCartographic,PY),PY.height=-11500,c.project(PY,Uy),h.fromElements(Uy.z,Uy.x,Uy.y,Uy),h.clone(Uy,aS.origin),h.clone(h.UNIT_X,aS.direction);let T=d.data.pick(aS,a,c,!1,Uy);u(T)&&(u(A.callback)&&A.callback(T),A.level=d.level)}if(di()>=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 Kit(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 YL=Pf;function nh(e){e=y(e,ie.WGS84);let t=new A_({ellipsoid:e}),n=new UL;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new LL,this._material=void 0,this._surface=new YL({tileProvider:new FL({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Ae,this._undergroundColor=z.clone(z.BLACK),this._undergroundColorAlphaByDistance=new Pt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new VL,BY(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Oe({url:$t("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=!0,this.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new h(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new h(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=gn.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}Object.defineProperties(nh.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 u(this._surface)?this._surface.tileProvider.ready&&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}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){u(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),u(this._material)&&BY(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,BY(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=z.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){this._undergroundColorAlphaByDistance=Pt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function BY(e){let t=[],n=u(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),i=[p_,Ob];u(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(zM),e._surfaceShaderSet.baseVertexShaderSource=new ke({sources:[p_,Ob,HM],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new ke({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function Zit(e){return function(t,n){let i=se.distanceSquaredTo(t.pickBoundingSphere,e),o=se.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}var Jit=[],Qit={start:0,stop:0};nh.prototype.pickWorldCoordinates=function(e,t,n,i){n=y(n,!0);let o=t.mode,r=t.mapProjection,s=Jit;s.length=0;let a=this._surface._tilesToRender,c=a.length,l,f;for(f=0;f<c;++f){l=a[f];let p=l.data;if(!u(p))continue;let g=p.pickBoundingSphere;if(o!==te.SCENE3D)p.pickBoundingSphere=g=se.fromRectangleWithHeights2D(l.rectangle,r,p.tileBoundingRegion.minimumHeight,p.tileBoundingRegion.maximumHeight,g),h.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(u(p.renderedMesh))se.clone(p.tileBoundingRegion.boundingSphere,g);else continue;let m=Yi.raySphere(e,g,Qit);u(m)&&s.push(p)}s.sort(Zit(e.origin));let d;for(c=s.length,f=0;f<c&&(d=s[f].pick(e,t.mode,t.mapProjection,n,i),!u(d));++f);return d};var $it=new he;nh.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),u(n)&&t.mode!==te.SCENE3D){n=h.fromElements(n.y,n.z,n.x,n);let i=t.mapProjection.unproject(n,$it);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};var eot=new h,P_e=new h,tot=new he,not=new wn;function RY(e,t){return u(e)&&ce.contains(e.rectangle,t)?e:void 0}nh.prototype.getHeight=function(e){let t=this._surface._levelZeroTiles;if(!u(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(;u(n);)n=RY(n._southwestChild,e)||RY(n._southeastChild,e)||RY(n._northwestChild,e)||n._northeastChild,u(n)&&u(n.data)&&u(n.data.renderedMesh)&&(r=n);if(n=r,!u(n)||!u(n.data)||!u(n.data.renderedMesh))return;let s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,c=h.fromRadians(e.longitude,e.latitude,0,a,eot),l=not,f=a.geodeticSurfaceNormal(c,l.direction),d=a.getSurfaceNormalIntersectionWithZAxis(c,11500,l.origin);if(!u(d)){let g;u(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);let m=Math.min(y(g,0),-11500),A=h.multiplyByScalar(f,Math.abs(m)+1,P_e);h.subtract(c,A,l.origin)}let p=n.data.pick(l,void 0,s,!1,P_e);if(u(p))return a.cartesianToCartographic(p,tot).height};nh.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)};nh.prototype.beginFrame=function(e){let t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&i.ready&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;let a=this._oceanNormalMapResource,c=a.url;if(u(c)){let l=this;a.fetchImage().then(function(f){c===l._oceanNormalMapResource.url&&(l._oceanNormalMap=l._oceanNormalMap&&l._oceanNormalMap.destroy(),l._oceanNormalMap=new It({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===te.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,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))};nh.prototype.render=function(e){this.show&&(u(this._material)&&this._material.update(e.context),this._surface.render(e))};nh.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)};nh.prototype.isDestroyed=function(){return!1};nh.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(),le(this)};var qL=nh;var MY={position:0};function l4(e){e=y(e,y.EMPTY_OBJECT),this.center=h.clone(y(e.center,h.ZERO)),this._center=new h,this.radii=h.clone(e.radii),this._radii=new h,this._oneOverEllipsoidRadiiSquared=new h,this._boundingSphere=new se,this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=new M,this._computedModelMatrix=new M,this.show=y(e.show,!0),this.material=y(e.material,Vi.fromType(Vi.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.onlySunLighting=y(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=y(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 tt({owner:y(e._owner,this)}),this._pickCommand=new tt({owner:y(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 iot(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(u(t))return t;let n=ol.createGeometry(ol.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Ie.POSITION_ONLY}));return t=oi.fromGeometry({context:e,geometry:n,attributeLocations:MY,bufferUsage:Ne.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}l4.prototype.update=function(e){if(!this.show||e.mode!==te.SCENE3D||!u(this.center)||!u(this.radii))return;let t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!u(this._rs)||i)&&(this._translucent=n,this._rs=Ue.fromCache({cull:{enabled:!0,face:gi.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?un.ALPHA_BLEND:void 0})),u(this._va)||(this._va=iot(t));let o=!1,r=this.radii;if(!h.equals(this._radii,r)){h.clone(r,this._radii);let A=this._oneOverEllipsoidRadiiSquared;A.x=1/(r.x*r.x),A.y=1/(r.y*r.y),A.z=1/(r.z*r.z),o=!0}(!M.equals(this.modelMatrix,this._modelMatrix)||!h.equals(this.center,this._center))&&(M.clone(this.modelMatrix,this._modelMatrix),h.clone(this.center,this._center),M.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(h.clone(h.ZERO,this._boundingSphere.center),this._boundingSphere.radius=h.maximumComponent(r),se.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 c=e.useLogDepth,l=this._useLogDepth!==c;this._useLogDepth=c;let f=this._colorCommand,d,p;(s||a||i||l)&&(d=new ke({sources:[Pb]}),p=new ke({sources:[this.material.shaderSource,Ib]}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH")),this._sp=Xt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:MY}),f.vertexArray=this._va,f.renderState=this._rs,f.shaderProgram=this._sp,f.uniformMap=_t(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?Ee.TRANSLUCENT:Ee.OPAQUE,g.push(f)),m.pick){let A=this._pickCommand;(!u(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||!u(this._pickSP)||l)&&(d=new ke({sources:[Pb]}),p=new ke({sources:[this.material.shaderSource,Ib],pickColorQualifier:"uniform"}),this.onlySunLighting&&p.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&p.defines.push("WRITE_DEPTH"),this._useLogDepth&&(d.defines.push("LOG_DEPTH"),p.defines.push("LOG_DEPTH")),this._pickSP=Xt.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:d,fragmentShaderSource:p,attributeLocations:MY}),A.vertexArray=this._va,A.renderState=this._rs,A.shaderProgram=this._pickSP,A.uniformMap=_t(_t(this._uniforms,this._pickUniforms),this.material._uniforms),A.executeInClosestFrustum=n),A.boundingVolume=this._boundingSphere,A.modelMatrix=this._computedModelMatrix,A.pass=n?Ee.TRANSLUCENT:Ee.OPAQUE,g.push(A)}};l4.prototype.isDestroyed=function(){return!1};l4.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(),le(this)};var XL=l4;function KL(e){e=y(e,y.EMPTY_OBJECT);let t=e.textureUrl;u(t)||(t=$t("Assets/Textures/moonSmall.jpg")),this.show=y(e.show,!0),this.textureUrl=t,this._ellipsoid=y(e.ellipsoid,ie.MOON),this.onlySunLighting=y(e.onlySunLighting,!0),this._ellipsoidPrimitive=new XL({radii:this.ellipsoid.radii,material:Vi.fromType(Vi.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new uL}Object.defineProperties(KL.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});var u4=new Z,oot=new Z,rot=new h,f4=[];KL.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;u(Ot.computeIcrfToFixedMatrix(n,u4))||Ot.computeTemeToPseudoFixedMatrix(n,u4);let i=this._axes.evaluate(n,oot);Z.transpose(i,i),Z.multiply(u4,i,i);let o=K_.computeMoonPositionInEarthInertialFrame(n,rot);Z.multiplyByVector(u4,o,o),M.fromRotationTranslation(i,o,t.modelMatrix);let r=e.commandList;return e.commandList=f4,f4.length=0,t.update(e),e.commandList=r,f4.length===1?f4[0]:void 0};KL.prototype.isDestroyed=function(){return!1};KL.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),le(this)};var ZL=KL;function JL(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(JL.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function sot(e,t,n){let i=t.createViewportQuadCommand(OM,{framebuffer:n,renderState:Ue.fromCache({viewport:new Ye(0,0,256,256)})});e._drawCommand=i}JL.prototype.update=function(e){if(!u(this._colorTexture)){let t=e.context,n=new It({context:t,width:256,height:256,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,sampler:ln.NEAREST});this._colorTexture=n;let i=new Ns({context:t,colorTextures:[n],destroyAttachments:!1});sot(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};JL.prototype.isDestroyed=function(){return!1};JL.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),le(this)};var QL=JL;var M_e={};function aot(e,t,n){let i,o,r;if(e instanceof Ti){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 zc)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}var cot=new h,O_e=new h;function L_e(e,t,n,i){if(u(i)&&n(.5)>i){let o=n(0),r=n(1),s=n(.5),a=s-o,c=s-r;return function(l){let f=n(l);if(l<=.5){let p=(f-o)/a;return P.lerp(e,-P.PI_OVER_TWO,p)}let d=(f-r)/c;return P.lerp(-P.PI_OVER_TWO,t,1-d)}}return function(o){return P.lerp(e,t,o)}}function NY(e,t,n,i,o){let r=o,s=Math.max(n,i);if(!u(r)){let a=e.position,c=t,l=e.up,f=e.right,d=e.frustum,p=h.subtract(a,c,cot),g=h.magnitude(h.multiplyByScalar(l,h.dot(p,l),O_e)),m=h.magnitude(h.multiplyByScalar(f,h.dot(p,f),O_e));r=Math.min(aot(d,g,m)*.2,1e9)}if(s<r){let l=-Math.pow((r-n)*1e6,.125),f=Math.pow((r-i)*1e6,1/8);return function(d){let p=d*(f-l)+l;return-Math.pow(p,8)/1e6+r}}return function(a){return P.lerp(n,i,a)}}function $L(e,t){return P.equalsEpsilon(e,P.TWO_PI,P.EPSILON11)&&(e=0),t>e+Math.PI?e+=P.TWO_PI:t<e-Math.PI&&(e-=P.TWO_PI),e}var N_e=new h;function lot(e,t,n,i,o,r,s,a){let c=e.camera,l=h.clone(c.position,N_e),f=c.pitch,d=$L(c.heading,i),p=$L(c.roll,r),g=NY(c,n,l.z,n.z,s),m=L_e(f,o,g,a);function A(x){let C=x.time/t;c.setView({orientation:{heading:P.lerp(d,i,C),pitch:m(C),roll:P.lerp(p,r,C)}}),H.lerp(l,n,C,c.position),c.position.z=g(C)}return A}function uot(e,t){e.longitude<t.longitude?e.longitude+=P.TWO_PI:t.longitude+=P.TWO_PI}function fot(e,t){let n=e.longitude-t.longitude;n<-P.PI?e.longitude+=P.TWO_PI:n>P.PI&&(t.longitude+=P.TWO_PI)}var dot=new he,hot=new he;function mot(e,t,n,i,o,r,s,a,c,l){let f=e.camera,p=e.mapProjection.ellipsoid,g=he.clone(f.positionCartographic,dot),m=f.pitch,A=$L(f.heading,i),x=$L(f.roll,r),C=p.cartesianToCartographic(n,hot);g.longitude=P.zeroToTwoPi(g.longitude),C.longitude=P.zeroToTwoPi(C.longitude);let T=!1;if(u(a)){let w=P.zeroToTwoPi(a),R=Math.min(g.longitude,C.longitude),O=Math.max(g.longitude,C.longitude),L=w>=R&&w<=O;if(u(c)){let N=Math.abs(g.longitude-C.longitude),_=P.TWO_PI-N;(L?N:_)<(L?_:N)*c&&!L&&(T=!0)}else L||(T=!0)}T?uot(g,C):fot(g,C);let E=NY(f,n,g.height,C.height,s),S=L_e(m,o,E,l);function D(){let w=g.longitude,R=C.longitude,O=g.latitude,L=C.latitude;return function(_){let b=_.time/t,v=h.fromRadians(P.lerp(w,R,b),P.lerp(O,L,b),E(b),p);f.setView({destination:v,orientation:{heading:P.lerp(A,i,b),pitch:S(b),roll:P.lerp(x,r,b)}})}}return D()}function pot(e,t,n,i,o,r,s){let a=e.camera,c=h.clone(a.position,N_e),l=$L(a.heading,i),f=a.frustum.right-a.frustum.left,d=NY(a,n,f,n.z,s);function p(g){let m=g.time/t;a.setView({orientation:{heading:P.lerp(l,i,m)}}),H.lerp(c,n,m,a.position);let A=d(m),x=a.frustum,C=x.top/x.right,T=(A-(x.right-x.left))*.5;x.right+=T,x.left-=T,x.top=C*x.right,x.bottom=-x.top}return p}var R_e=new he,_ot=new h;function LY(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function B_e(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}M_e.createTween=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.destination,i=e.mode;if(i===te.MORPHING)return LY();let o=y(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,c=t.flyOverLongitude,l=t.flyOverLongitudeWeight,f=t.pitchAdjustHeight,d=t.easingFunction;o&&i!==te.SCENE3D&&(s.cartesianToCartographic(n,R_e),n=r.project(R_e,_ot));let p=e.camera,g=t.endTransform;u(g)&&p._setTransform(g);let m=t.duration;u(m)||(m=Math.ceil(h.distance(p.position,n)/1e6)+2,m=Math.min(m,3));let A=y(t.heading,0),x=y(t.pitch,-P.PI_OVER_TWO),C=y(t.roll,0),T=e.screenSpaceCameraController;T.enableInputs=!1;let E=B_e(T,t.complete),S=B_e(T,t.cancel),D=p.frustum,w=e.mode===te.SCENE2D;if(w=w&&H.equalsEpsilon(p.position,n,P.EPSILON6),w=w&&P.equalsEpsilon(Math.max(D.right-D.left,D.top-D.bottom),n.z,P.EPSILON6),w=w||e.mode!==te.SCENE2D&&h.equalsEpsilon(n,p.position,P.EPSILON10),w=w&&P.equalsEpsilon(P.negativePiToPi(A),P.negativePiToPi(p.heading),P.EPSILON10)&&P.equalsEpsilon(P.negativePiToPi(x),P.negativePiToPi(p.pitch),P.EPSILON10)&&P.equalsEpsilon(P.negativePiToPi(C),P.negativePiToPi(p.roll),P.EPSILON10),w)return LY(E,S);let R=new Array(4);if(R[te.SCENE2D]=pot,R[te.SCENE3D]=mot,R[te.COLUMBUS_VIEW]=lot,m<=0)return LY(function(){R[i](e,1,n,A,x,C,a,c,l,f)({time:1}),typeof E=="function"&&E()},S);let O=R[i](e,m,n,A,x,C,a,c,l,f);if(!u(d)){let L=p.positionCartographic.height,N=i===te.SCENE3D?s.cartesianToCartographic(n).height:n.z;L>N&&L>11500?d=Mr.CUBIC_OUT:d=Mr.QUINTIC_IN_OUT}return{duration:m,easingFunction:d,startObject:{time:0},stopObject:{time:m},update:O,complete:E,cancel:S}};var eN=M_e;var got={ROTATE:0,INFINITE_SCROLL:1},wl=Object.freeze(got);function Jt(e){this._scene=e,this._transform=M.clone(M.IDENTITY),this._invTransform=M.clone(M.IDENTITY),this._actualTransform=M.clone(M.IDENTITY),this._actualInvTransform=M.clone(M.IDENTITY),this._transformChanged=!1,this.position=new h,this._position=new h,this._positionWC=new h,this._positionCartographic=new he,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new h,this._direction=new h,this._directionWC=new h,this.up=new h,this._up=new h,this._upWC=new h,this.right=new h,this._right=new h,this._rightWC=new h,this.frustum=new Ti,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=P.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 Ae,this._moveEnd=new Ae,this._changed=new Ae,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this.percentageChanged=.5,this._viewMatrix=new M,this._invViewMatrix=new M,W_e(this),this._mode=te.SCENE3D,this._modeChanged=!0;let t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new he(Math.PI,P.PI_OVER_TWO)),this._max2Dfrustum=void 0,nge(this,Jt.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=h.magnitude(this.position);n+=n*Jt.DEFAULT_VIEW_FACTOR,h.normalize(this.position,this.position),h.multiplyByScalar(this.position,n,this.position)}Jt.TRANSFORM_2D=new M(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Jt.TRANSFORM_2D_INVERSE=M.inverseTransformation(Jt.TRANSFORM_2D,new M);Jt.DEFAULT_VIEW_RECTANGLE=ce.fromDegrees(-95,-20,-70,90);Jt.DEFAULT_VIEW_FACTOR=.5;Jt.DEFAULT_OFFSET=new uu(0,-P.PI_OVER_FOUR,0);function W_e(e){M.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),M.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),M.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function yot(e){if(!u(e._oldPositionWC))e._oldPositionWC=h.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;let t=h.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=h.magnitude(t),e._oldPositionWC=h.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=di()):e.timeSinceMoved=Math.max(di()-e._lastMovedTimestamp,0)/1e3}}Jt.prototype.canPreloadFlight=function(){return u(this._currentFlight)&&this._mode!==te.SCENE2D};Jt.prototype._updateCameraChanged=function(){let e=this;if(yot(e),e._changed.numberOfListeners===0)return;let t=e.percentageChanged,n=e.heading;u(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%P.TWO_PI;i=i>P.PI?P.TWO_PI-i:i;let o=i/Math.PI;if(o>t&&(e._changed.raiseEvent(o),e._changedHeading=n),e._mode===te.SCENE2D){if(!u(e._changedFrustum)){e._changedPosition=h.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}let l=e.position,f=e._changedPosition,d=e.frustum,p=e._changedFrustum,g=l.x+d.left,m=l.x+d.right,A=f.x+p.left,x=f.x+p.right,C=l.y+d.bottom,T=l.y+d.top,E=f.y+p.bottom,S=f.y+p.top,D=Math.max(g,A),w=Math.min(m,x),R=Math.max(C,E),O=Math.min(T,S),L;if(D>=w||R>=T)L=1;else{let N=p;g<A&&m>x&&C<E&&T>S&&(N=d),L=1-(w-D)*(O-R)/((N.right-N.left)*(N.top-N.bottom))}L>t&&(e._changed.raiseEvent(L),e._changedPosition=h.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!u(e._changedDirection)){e._changedPosition=h.clone(e.positionWC,e._changedPosition),e._changedDirection=h.clone(e.directionWC,e._changedDirection);return}let r=P.acosClamped(h.dot(e.directionWC,e._changedDirection)),s;u(e.frustum.fovy)?s=r/(e.frustum.fovy*.5):s=r;let c=h.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(s>t||c>t)&&(e._changed.raiseEvent(Math.max(s,c)),e._changedPosition=h.clone(e.positionWC,e._changedPosition),e._changedDirection=h.clone(e.directionWC,e._changedDirection))};function Aot(e){Ot.basisTo2D(e._projection,e._transform,e._actualTransform)}var xot=new he,Cot=new h,d4=new h,Tot=new oe,Eot=new oe,bot=new oe,Sot=new oe,Dot=new oe;function vot(e){let t=e._projection,n=t.ellipsoid,i=M.getColumn(e._transform,3,Tot),o=n.cartesianToCartographic(i,xot),r=t.project(o,Cot),s=Eot;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;let a=oe.clone(oe.UNIT_X,Dot),c=oe.add(M.getColumn(e._transform,0,d4),i,d4);n.cartesianToCartographic(c,o),t.project(o,r);let l=bot;l.x=r.z,l.y=r.x,l.z=r.y,l.w=0,h.subtract(l,s,l),l.x=0;let f=Sot;if(h.magnitudeSquared(l)>P.EPSILON10)h.cross(a,l,f);else{let d=oe.add(M.getColumn(e._transform,1,d4),i,d4);n.cartesianToCartographic(d,o),t.project(o,r),f.x=r.z,f.y=r.x,f.z=r.y,f.w=0,h.subtract(f,s,f),f.x=0,h.magnitudeSquared(f)<P.EPSILON10&&(oe.clone(oe.UNIT_Y,l),oe.clone(oe.UNIT_Z,f))}h.cross(f,a,l),h.normalize(l,l),h.cross(a,l,f),h.normalize(f,f),M.setColumn(e._actualTransform,0,l,e._actualTransform),M.setColumn(e._actualTransform,1,f,e._actualTransform),M.setColumn(e._actualTransform,2,a,e._actualTransform),M.setColumn(e._actualTransform,3,s,e._actualTransform)}var FY=new h;function lc(e){let t=e._mode,n=!1,i=0;t===te.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position,r=!h.equals(o,e.position)||n;r&&(o=h.clone(e.position,e._position));let s=e._direction,a=!h.equals(s,e.direction);a&&(h.normalize(e.direction,e.direction),s=h.clone(e.direction,e._direction));let c=e._up,l=!h.equals(c,e.up);l&&(h.normalize(e.up,e.up),c=h.clone(e.up,e._up));let f=e._right,d=!h.equals(f,e.right);d&&(h.normalize(e.right,e.right),f=h.clone(e.right,e._right));let p=e._transformChanged||e._modeChanged;e._transformChanged=!1,p&&(M.inverseTransformation(e._transform,e._invTransform),e._mode===te.COLUMBUS_VIEW||e._mode===te.SCENE2D?M.equals(M.IDENTITY,e._transform)?M.clone(Jt.TRANSFORM_2D,e._actualTransform):e._mode===te.COLUMBUS_VIEW?Aot(e):vot(e):M.clone(e._transform,e._actualTransform),M.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);let g=e._actualTransform;if(r||p)if(e._positionWC=M.multiplyByPoint(g,o,e._positionWC),t===te.SCENE3D||t===te.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{let m=FY;m.x=e._positionWC.y,m.y=e._positionWC.z,m.z=e._positionWC.x,t===te.SCENE2D&&(m.z=i),e._projection.unproject(m,e._positionCartographic)}if(a||l||d){let m=h.dot(s,h.cross(c,f,FY));if(Math.abs(1-m)>P.EPSILON2){let A=1/h.magnitudeSquared(c),x=h.dot(c,s)*A,C=h.multiplyByScalar(s,x,FY);c=h.normalize(h.subtract(c,C,e._up),e._up),h.clone(c,e.up),f=h.cross(s,c,e._right),h.clone(f,e.right)}}(a||p)&&(e._directionWC=M.multiplyByPointAsVector(g,s,e._directionWC),h.normalize(e._directionWC,e._directionWC)),(l||p)&&(e._upWC=M.multiplyByPointAsVector(g,c,e._upWC),h.normalize(e._upWC,e._upWC)),(d||p)&&(e._rightWC=M.multiplyByPointAsVector(g,f,e._rightWC),h.normalize(e._rightWC,e._rightWC)),(r||a||l||d||p)&&W_e(e)}function j_e(e,t){let n;return P.equalsEpsilon(Math.abs(e.z),1,P.EPSILON3)?n=Math.atan2(t.y,t.x)-P.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-P.PI_OVER_TWO,P.TWO_PI-P.zeroToTwoPi(n)}function Y_e(e){return P.PI_OVER_TWO-P.acosClamped(e.z)}function q_e(e,t,n){let i=0;return P.equalsEpsilon(Math.abs(e.z),1,P.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=P.zeroToTwoPi(i+P.TWO_PI)),i}var p4=new M,_4=new M;Object.defineProperties(Jt.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!==te.MORPHING){let e=this._projection.ellipsoid,t=M.clone(this._transform,p4),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,_4);this._setTransform(n);let i=j_e(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==te.MORPHING){let e=this._projection.ellipsoid,t=M.clone(this._transform,p4),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,_4);this._setTransform(n);let i=Y_e(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==te.MORPHING){let e=this._projection.ellipsoid,t=M.clone(this._transform,p4),n=Ot.eastNorthUpToFixedFrame(this.positionWC,e,_4);this._setTransform(n);let i=q_e(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}}});Jt.prototype.update=function(e){let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==te.MORPHING,t=this._mode===te.SCENE2D),t){let n=this._max2Dfrustum=this.frustum.clone(),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===te.SCENE2D&&J_e(this,this.position)};var wot=new h,Iot=new h,Pot=new h;Jt.prototype._setTransform=function(e){let t=h.clone(this.positionWC,wot),n=h.clone(this.upWC,Iot),i=h.clone(this.directionWC,Pot);M.clone(e,this._transform),this._transformChanged=!0,lc(this);let o=this._actualInvTransform;M.multiplyByPoint(o,t,this.position),M.multiplyByPointAsVector(o,i,this.direction),M.multiplyByPointAsVector(o,n,this.up),h.cross(this.direction,this.up,this.right),lc(this)};var Oot=new H,Rot=new wn,Bot=new h,Mot=new h;function X_e(e){if(!M.equals(M.IDENTITY,e.transform))return h.magnitude(e.position);let t=e._scene,n=t.globe,i=Oot;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(u(n)){let a=e.getPickRay(i,Rot);o=n.pickWorldCoordinates(a,t,!0,Bot)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,Mot));let s;if(u(o)||u(r)){let a=u(r)?h.distance(r,e.positionWC):Number.POSITIVE_INFINITY,c=u(o)?h.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,c)}else s=Math.max(e.positionCartographic.height,0);return s}Jt.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof en&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=X_e(this)))};var g4=new h,HY=new M,Lot=new M,GY=new Le,WY=new Z,K_e=new he;function Not(e,t,n){let i=M.clone(e.transform,HY),o=Ot.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,Lot);e._setTransform(o),h.clone(h.ZERO,e.position),n.heading=n.heading-P.PI_OVER_TWO;let r=Le.fromHeadingPitchRoll(n,GY),s=Z.fromQuaternion(r,WY);Z.getColumn(s,0,e.direction),Z.getColumn(s,2,e.up),h.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function Fot(e,t,n,i){let o=M.clone(e.transform,HY);if(e._setTransform(M.IDENTITY),!h.equals(t,e.positionWC)){if(i){let a=e._projection,c=a.ellipsoid.cartesianToCartographic(t,K_e);t=a.project(c,g4)}h.clone(t,e.position)}n.heading=n.heading-P.PI_OVER_TWO;let r=Le.fromHeadingPitchRoll(n,GY),s=Z.fromQuaternion(r,WY);Z.getColumn(s,0,e.direction),Z.getColumn(s,2,e.up),h.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function Vot(e,t,n,i){let o=M.clone(e.transform,HY);if(e._setTransform(M.IDENTITY),!h.equals(t,e.positionWC)){if(i){let c=e._projection,l=c.ellipsoid.cartesianToCartographic(t,K_e);t=c.project(l,g4)}H.clone(t,e.position);let r=-t.z*.5,s=-r,a=e.frustum;if(s>r){let c=a.top/a.right;a.right=s,a.left=r,a.top=a.right*c,a.bottom=-a.top}}if(e._scene.mapMode2D===wl.ROTATE){n.heading=n.heading-P.PI_OVER_TWO,n.pitch=-P.PI_OVER_TWO,n.roll=0;let r=Le.fromHeadingPitchRoll(n,GY),s=Z.fromQuaternion(r,WY);Z.getColumn(s,2,e.up),h.cross(e.direction,e.up,e.right)}e._setTransform(o)}var Uot=new h,kot=new h,zot=new h;function Z_e(e,t,n,i){let o=h.clone(n.direction,Uot),r=h.clone(n.up,kot);if(e._scene.mode===te.SCENE3D){let a=e._projection.ellipsoid,c=Ot.eastNorthUpToFixedFrame(t,a,p4),l=M.inverseTransformation(c,_4);M.multiplyByPointAsVector(l,o,o),M.multiplyByPointAsVector(l,r,r)}let s=h.cross(o,r,zot);return i.heading=j_e(o,r),i.pitch=Y_e(o),i.roll=q_e(o,r,s),i}var zY={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},cS=new Ba;Jt.prototype.setView=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.orientation,y.EMPTY_OBJECT),n=this._mode;if(n===te.MORPHING)return;u(e.endTransform)&&this._setTransform(e.endTransform);let i=y(e.convert,!0),o=y(e.destination,h.clone(this.positionWC,g4));u(o)&&u(o.west)&&(o=this.getRectangleCameraCoordinates(o,g4),i=!1),u(t.direction)&&(t=Z_e(this,o,t,zY.orientation)),cS.heading=y(t.heading,0),cS.pitch=y(t.pitch,-P.PI_OVER_TWO),cS.roll=y(t.roll,0),n===te.SCENE3D?Not(this,o,cS):n===te.SCENE2D?Vot(this,o,cS,i):Fot(this,o,cS,i)};var Hot=new h;Jt.prototype.flyHome=function(e){let t=this._mode;if(t===te.MORPHING&&this._scene.completeMorph(),t===te.SCENE2D)this.flyTo({destination:Jt.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:M.IDENTITY});else if(t===te.SCENE3D){let n=this.getRectangleCameraCoordinates(Jt.DEFAULT_VIEW_RECTANGLE),i=h.magnitude(n);i+=i*Jt.DEFAULT_VIEW_FACTOR,h.normalize(n,n),h.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:M.IDENTITY})}else if(t===te.COLUMBUS_VIEW){let n=this._projection.ellipsoid.maximumRadius,i=new h(0,-1,1);i=h.multiplyByScalar(h.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(h.normalize(i,Hot).z),roll:0},endTransform:M.IDENTITY,convert:!1})}};Jt.prototype.worldToCameraCoordinates=function(e,t){return u(t)||(t=new oe),lc(this),M.multiplyByVector(this._actualInvTransform,e,t)};Jt.prototype.worldToCameraCoordinatesPoint=function(e,t){return u(t)||(t=new h),lc(this),M.multiplyByPoint(this._actualInvTransform,e,t)};Jt.prototype.worldToCameraCoordinatesVector=function(e,t){return u(t)||(t=new h),lc(this),M.multiplyByPointAsVector(this._actualInvTransform,e,t)};Jt.prototype.cameraToWorldCoordinates=function(e,t){return u(t)||(t=new oe),lc(this),M.multiplyByVector(this._actualTransform,e,t)};Jt.prototype.cameraToWorldCoordinatesPoint=function(e,t){return u(t)||(t=new h),lc(this),M.multiplyByPoint(this._actualTransform,e,t)};Jt.prototype.cameraToWorldCoordinatesVector=function(e,t){return u(t)||(t=new h),lc(this),M.multiplyByPointAsVector(this._actualTransform,e,t)};function J_e(e,t){let n=e._scene.mapMode2D===wl.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 F_e=new h;Jt.prototype.move=function(e,t){let n=this.position;h.multiplyByScalar(e,t,F_e),h.add(n,F_e,n),this._mode===te.SCENE2D&&J_e(this,n),this._adjustOrthographicFrustum(!0)};Jt.prototype.moveForward=function(e){e=y(e,this.defaultMoveAmount),this._mode===te.SCENE2D?y4(this,e):this.move(this.direction,e)};Jt.prototype.moveBackward=function(e){e=y(e,this.defaultMoveAmount),this._mode===te.SCENE2D?y4(this,-e):this.move(this.direction,-e)};Jt.prototype.moveUp=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,e)};Jt.prototype.moveDown=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,-e)};Jt.prototype.moveRight=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,e)};Jt.prototype.moveLeft=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,-e)};Jt.prototype.lookLeft=function(e){e=y(e,this.defaultLookAmount),this._mode!==te.SCENE2D&&this.look(this.up,-e)};Jt.prototype.lookRight=function(e){e=y(e,this.defaultLookAmount),this._mode!==te.SCENE2D&&this.look(this.up,e)};Jt.prototype.lookUp=function(e){e=y(e,this.defaultLookAmount),this._mode!==te.SCENE2D&&this.look(this.right,-e)};Jt.prototype.lookDown=function(e){e=y(e,this.defaultLookAmount),this._mode!==te.SCENE2D&&this.look(this.right,e)};var Got=new Le,Wot=new Z;Jt.prototype.look=function(e,t){let n=y(t,this.defaultLookAmount),i=Le.fromAxisAngle(e,-n,Got),o=Z.fromQuaternion(i,Wot),r=this.direction,s=this.up,a=this.right;Z.multiplyByVector(o,r,r),Z.multiplyByVector(o,s,s),Z.multiplyByVector(o,a,a)};Jt.prototype.twistLeft=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,e)};Jt.prototype.twistRight=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,-e)};var jot=new Le,Yot=new Z;Jt.prototype.rotate=function(e,t){let n=y(t,this.defaultRotateAmount),i=Le.fromAxisAngle(e,-n,jot),o=Z.fromQuaternion(i,Yot);Z.multiplyByVector(o,this.position,this.position),Z.multiplyByVector(o,this.direction,this.direction),Z.multiplyByVector(o,this.up,this.up),h.cross(this.direction,this.up,this.right),h.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};Jt.prototype.rotateDown=function(e){e=y(e,this.defaultRotateAmount),Q_e(this,e)};Jt.prototype.rotateUp=function(e){e=y(e,this.defaultRotateAmount),Q_e(this,-e)};var qot=new h,Xot=new h,Kot=new h,V_e=new h;function Q_e(e,t){let n=e.position;if(u(e.constrainedAxis)&&!h.equalsEpsilon(e.position,h.ZERO,P.EPSILON2)){let i=h.normalize(n,qot),o=h.equalsEpsilon(i,e.constrainedAxis,P.EPSILON2),r=h.equalsEpsilon(i,h.negate(e.constrainedAxis,V_e),P.EPSILON2);if(!o&&!r){let s=h.normalize(e.constrainedAxis,Xot),a=h.dot(i,s),c=P.acosClamped(a);t>0&&t>c&&(t=c-P.EPSILON4),a=h.dot(i,h.negate(s,V_e)),c=P.acosClamped(a),t<0&&-t>c&&(t=-c+P.EPSILON4);let l=h.cross(s,i,Kot);e.rotate(l,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}Jt.prototype.rotateRight=function(e){e=y(e,this.defaultRotateAmount),$_e(this,-e)};Jt.prototype.rotateLeft=function(e){e=y(e,this.defaultRotateAmount),$_e(this,e)};function $_e(e,t){u(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function y4(e,t){let n=e.frustum,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===wl.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===wl.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 ege(e,t){e.move(e.direction,t)}Jt.prototype.zoomIn=function(e){e=y(e,this.defaultZoomAmount),this._mode===te.SCENE2D?y4(this,e):ege(this,e)};Jt.prototype.zoomOut=function(e){e=y(e,this.defaultZoomAmount),this._mode===te.SCENE2D?y4(this,-e):ege(this,-e)};Jt.prototype.getMagnitude=function(){if(this._mode===te.SCENE3D)return h.magnitude(this.position);if(this._mode===te.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===te.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};var Zot=new M;Jt.prototype.lookAt=function(e,t){let n=Ot.eastNorthUpToFixedFrame(e,ie.WGS84,Zot);this.lookAtTransform(n,t)};var Jot=new h,Qot=new Le,$ot=new Le,ert=new Z;function tge(e,t,n){t=P.clamp(t,-P.PI_OVER_TWO,P.PI_OVER_TWO),e=P.zeroToTwoPi(e)-P.PI_OVER_TWO;let i=Le.fromAxisAngle(h.UNIT_Y,-t,Qot),o=Le.fromAxisAngle(h.UNIT_Z,-e,$ot),r=Le.multiply(o,i,o),s=Z.fromQuaternion(r,ert),a=h.clone(h.UNIT_X,Jot);return Z.multiplyByVector(s,a,a),h.negate(a,a),h.multiplyByScalar(a,n,a),a}Jt.prototype.lookAtTransform=function(e,t){if(this._setTransform(e),!u(t))return;let n;if(u(t.heading)?n=tge(t.heading,t.pitch,t.range):n=t,this._mode===te.SCENE2D){H.clone(H.ZERO,this.position),h.negate(n,this.up),this.up.z=0,h.magnitudeSquared(this.up)<P.EPSILON10&&h.clone(h.UNIT_Y,this.up),h.normalize(this.up,this.up),this._setTransform(M.IDENTITY),h.negate(h.UNIT_Z,this.direction),h.cross(this.direction,this.up,this.right),h.normalize(this.right,this.right);let i=this.frustum,o=i.top/i.right;i.right=h.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}h.clone(n,this.position),h.negate(this.position,this.direction),h.normalize(this.direction,this.direction),h.cross(this.direction,h.UNIT_Z,this.right),h.magnitudeSquared(this.right)<P.EPSILON10&&h.clone(h.UNIT_X,this.right),h.normalize(this.right,this.right),h.cross(this.right,this.direction,this.up),h.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};var tN=new he,trt=new he,nrt=new h,irt=new h,ort=new h,rrt=new h,srt=new h,art=new h,crt=new h,VY=new h,lrt={direction:new h,right:new h,up:new h},U_e;function cc(e,t,n,i){return Math.abs(h.dot(t,n))/i-h.dot(e,n)}function nge(e,t,n,i){let o=e._projection.ellipsoid,r=i?e:lrt,s=t.north,a=t.south,c=t.east,l=t.west;l>c&&(c+=P.TWO_PI);let f=(l+c)*.5,d;if(a<-P.PI_OVER_TWO+P.RADIANS_PER_DEGREE&&s>P.PI_OVER_TWO-P.RADIANS_PER_DEGREE)d=0;else{let L=tN;L.longitude=f,L.latitude=s,L.height=0;let N=trt;N.longitude=f,N.latitude=a,N.height=0;let _=U_e;(!u(_)||_.ellipsoid!==o)&&(U_e=_=new Gu(void 0,void 0,o)),_.setEndPoints(L,N),d=_.interpolateUsingFraction(.5,tN).latitude}let p=tN;p.longitude=f,p.latitude=d,p.height=0;let g=o.cartographicToCartesian(p,crt),m=tN;m.longitude=c,m.latitude=s;let A=o.cartographicToCartesian(m,nrt);m.longitude=l;let x=o.cartographicToCartesian(m,ort);m.longitude=f;let C=o.cartographicToCartesian(m,srt);m.latitude=a;let T=o.cartographicToCartesian(m,art);m.longitude=c;let E=o.cartographicToCartesian(m,rrt);m.longitude=l;let S=o.cartographicToCartesian(m,irt);h.subtract(x,g,x),h.subtract(E,g,E),h.subtract(A,g,A),h.subtract(S,g,S),h.subtract(C,g,C),h.subtract(T,g,T);let D=o.geodeticSurfaceNormal(g,r.direction);h.negate(D,D);let w=h.cross(D,h.UNIT_Z,r.right);h.normalize(w,w);let R=h.cross(w,D,r.up),O;if(e.frustum instanceof en){let L=Math.max(h.distance(A,x),h.distance(E,S)),N=Math.max(h.distance(A,E),h.distance(x,S)),_,b,v=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,I=N*v;L>I?(_=L,b=_/v):(b=N,_=I),O=Math.max(_,b)}else{let L=Math.tan(e.frustum.fovy*.5),N=e.frustum.aspectRatio*L;if(O=Math.max(cc(D,R,x,L),cc(D,R,E,L),cc(D,R,A,L),cc(D,R,S,L),cc(D,R,C,L),cc(D,R,T,L),cc(D,w,x,N),cc(D,w,E,N),cc(D,w,A,N),cc(D,w,S,N),cc(D,w,C,N),cc(D,w,T,N)),a<0&&s>0){let _=tN;_.longitude=l,_.latitude=0,_.height=0;let b=o.cartographicToCartesian(_,VY);h.subtract(b,g,b),O=Math.max(O,cc(D,R,b,L),cc(D,w,b,N)),_.longitude=c,b=o.cartographicToCartesian(_,VY),h.subtract(b,g,b),O=Math.max(O,cc(D,R,b,L),cc(D,w,b,N))}}return h.add(g,h.multiplyByScalar(D,-O,VY),n)}var urt=new he,frt=new h,drt=new h;function hrt(e,t,n){let i=e._projection;t.west>t.east&&(t=ce.MAX_VALUE);let o=e._actualTransform,r=e._actualInvTransform,s=urt;s.longitude=t.east,s.latitude=t.north;let a=i.project(s,frt);M.multiplyByPoint(o,a,a),M.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;let c=i.project(s,drt);if(M.multiplyByPoint(o,c,c),M.multiplyByPoint(r,c,c),n.x=(a.x-c.x)*.5+c.x,n.y=(a.y-c.y)*.5+c.y,u(e.frustum.fovy)){let l=Math.tan(e.frustum.fovy*.5),f=e.frustum.aspectRatio*l;n.z=Math.max((a.x-c.x)/f,(a.y-c.y)/l)*.5}else{let l=a.x-c.x,f=a.y-c.y;n.z=Math.max(l,f)}return n}var mrt=new he,prt=new h,_rt=new h;function grt(e,t,n){let i=e._projection,o=t.east;t.west>t.east&&(e._scene.mapMode2D===wl.INFINITE_SCROLL?o+=P.TWO_PI:(t=ce.MAX_VALUE,o=t.east));let r=mrt;r.longitude=o,r.latitude=t.north;let s=i.project(r,prt);r.longitude=t.west,r.latitude=t.south;let a=i.project(r,_rt),c=Math.abs(s.x-a.x)*.5,l=Math.abs(s.y-a.y)*.5,f,d,p=e.frustum.right/e.frustum.top,g=l*p;return c>g?(f=c,d=f/p):(d=l,f=g),l=Math.max(2*f,2*d),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=l,n=i.project(r,n),n}Jt.prototype.getRectangleCameraCoordinates=function(e,t){let n=this._mode;if(u(t)||(t=new h),n===te.SCENE3D)return nge(this,e,t);if(n===te.COLUMBUS_VIEW)return hrt(this,e,t);if(n===te.SCENE2D)return grt(this,e,t)};var yrt=new wn;function Art(e,t,n,i){n=y(n,ie.WGS84);let o=e.getPickRay(t,yrt),r=Yi.rayEllipsoid(o,n);if(!r)return;let s=r.start>0?r.start:r.stop;return wn.getPoint(o,s,i)}var xrt=new wn;function Crt(e,t,n,i){let r=e.getPickRay(t,xrt).origin;r=h.fromElements(r.y,r.z,0,r);let s=n.unproject(r);if(!(s.latitude<-P.PI_OVER_TWO||s.latitude>P.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}var Trt=new wn;function Ert(e,t,n,i){let o=e.getPickRay(t,Trt),r=-o.origin.x/o.direction.x;wn.getPoint(o,r,i);let s=n.unproject(new h(i.y,i.z,0));if(!(s.latitude<-P.PI_OVER_TWO||s.latitude>P.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}Jt.prototype.pickEllipsoid=function(e,t,n){let i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(u(n)||(n=new h),t=y(t,ie.WGS84),this._mode===te.SCENE3D)n=Art(this,e,t,n);else if(this._mode===te.SCENE2D)n=Crt(this,e,this._projection,n);else if(this._mode===te.COLUMBUS_VIEW)n=Ert(this,e,this._projection,n);else return;return n}};var brt=new h,Srt=new h,Drt=new h;function vrt(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,c=e.frustum.near,l=2/o*t.x-1,f=2/r*(r-t.y)-1,d=e.positionWC;h.clone(d,n.origin);let p=h.multiplyByScalar(e.directionWC,c,brt);h.add(d,p,p);let g=h.multiplyByScalar(e.rightWC,l*c*a,Srt),m=h.multiplyByScalar(e.upWC,f*c*s,Drt),A=h.add(p,g,n.direction);return h.add(A,m,A),h.subtract(A,d,A),h.normalize(A,A),n}var h4=new h;function wrt(e,t,n){let i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=e.frustum;u(s._offCenterFrustum)&&(s=s._offCenterFrustum);let a=2/o*t.x-1;a*=(s.right-s.left)*.5;let c=2/r*(r-t.y)-1;c*=(s.top-s.bottom)*.5;let l=n.origin;return h.clone(e.position,l),h.multiplyByScalar(e.right,a,h4),h.add(h4,l,l),h.multiplyByScalar(e.up,c,h4),h.add(h4,l,l),h.clone(e.directionWC,n.direction),(e._mode===te.COLUMBUS_VIEW||e._mode===te.SCENE2D)&&h.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}Jt.prototype.getPickRay=function(e,t){u(t)||(t=new wn);let n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;let i=this.frustum;return u(i.aspectRatio)&&u(i.fov)&&u(i.near)?vrt(this,e,t):wrt(this,e,t)};var Irt=new h,Prt=new h;Jt.prototype.distanceToBoundingSphere=function(e){let t=h.subtract(this.positionWC,e.center,Irt),n=h.multiplyByScalar(this.directionWC,h.dot(t,this.directionWC),Prt);return Math.max(0,h.magnitude(n)-e.radius)};var Ort=new H;Jt.prototype.getPixelSize=function(e,t,n){let i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,Ort);return Math.max(o.x,o.y)};function Rrt(e,t,n,i,o,r){let s=h.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(c){let l=h.lerp(t,s,c.time,new h);e.worldToCameraCoordinatesPoint(l,e.position)}return{easingFunction:Mr.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}var Brt=new h,k_e=new h,Mrt=new h,Lrt=new h;function Nrt(e,t){let n=e.position,i=e.direction,o=e.worldToCameraCoordinatesVector(h.UNIT_X,Brt),r=-h.dot(o,n)/h.dot(o,i),s=h.add(n,h.multiplyByScalar(i,r,k_e),k_e);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,Mrt);let a=Math.tan(e.frustum.fovy*.5),c=e.frustum.aspectRatio*a,l=h.magnitude(h.subtract(n,s,Lrt)),f=c*l,d=a*l,p=e._maxCoord.x,g=e._maxCoord.y,m=Math.max(f-p,p),A=Math.max(d-g,g);if(n.z<-m||n.z>m||n.y<-A||n.y>A){let x=s.y<-m||s.y>m,C=s.z<-A||s.z>A;if(x||C)return Rrt(e,n,s,m,A,t)}}Jt.prototype.createCorrectPositionTween=function(e){if(this._mode===te.COLUMBUS_VIEW)return Nrt(this,e)};var Frt=new h,Rs={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};Jt.prototype.cancelFlight=function(){u(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};Jt.prototype.completeFlight=function(){if(u(this._currentFlight)){this._currentFlight.cancelTween();let e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=Rs.destination,e.orientation.heading=Rs.heading,e.orientation.pitch=Rs.pitch,e.orientation.roll=Rs.roll,this.setView(e),u(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};Jt.prototype.flyTo=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.destination;if(this._mode===te.MORPHING)return;this.cancelFlight();let i=t instanceof ce;i&&(t=this.getRectangleCameraCoordinates(t,Frt));let o=y(e.orientation,y.EMPTY_OBJECT);if(u(o.direction)&&(o=Z_e(this,t,o,zY.orientation)),u(e.duration)&&e.duration<=0){let f=zY;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;Rs.destination=t,Rs.heading=o.heading,Rs.pitch=o.pitch,Rs.roll=o.roll,Rs.duration=e.duration,Rs.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),u(e.complete)&&e.complete()},Rs.cancel=e.cancel,Rs.endTransform=e.endTransform,Rs.convert=i?!1:e.convert,Rs.maximumHeight=e.maximumHeight,Rs.pitchAdjustHeight=e.pitchAdjustHeight,Rs.flyOverLongitude=e.flyOverLongitude,Rs.flyOverLongitudeWeight=e.flyOverLongitudeWeight,Rs.easingFunction=e.easingFunction;let a=this._scene,c=eN.createTween(a,Rs);if(c.duration===0){typeof c.complete=="function"&&c.complete();return}s=a.tweens.add(c),this._currentFlight=s;let l=this._scene.preloadFlightCamera;this._mode!==te.SCENE2D&&(u(l)||(l=Jt.clone(this)),l.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC))};function Vrt(e,t){let n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function Urt(e,t){let n=e.frustum;u(n._offCenterFrustum)&&(n=n._offCenterFrustum);let i,o,r=n.right/n.top,s=t*r;return t>s?(i=t,o=i/r):(o=t,i=s),Math.max(i,o)*1.5}var krt=100;function ige(e,t,n){n=uu.clone(u(n)?n:Jt.DEFAULT_OFFSET);let i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!u(r)||r===0){let s=t.radius;s===0?n.range=krt:e.frustum instanceof en||e._mode===te.SCENE2D?n.range=Urt(e,s):n.range=Vrt(e,s),n.range=P.clamp(n.range,i,o)}return n}Jt.prototype.viewBoundingSphere=function(e,t){t=ige(this,e,t),this.lookAt(e.center,t)};var zrt=new M,Hrt=new h,Grt=new h,Wrt=new h,jrt=new h,Yrt=new oe,qrt=new Le,Xrt=new Z;Jt.prototype.flyToBoundingSphere=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=this._mode===te.SCENE2D||this._mode===te.COLUMBUS_VIEW;this._setTransform(M.IDENTITY);let i=ige(this,e,t.offset),o;n?o=h.multiplyByScalar(h.UNIT_Z,i.range,Hrt):o=tge(i.heading,i.pitch,i.range);let r=Ot.eastNorthUpToFixedFrame(e.center,ie.WGS84,zrt);M.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=h.subtract(e.center,o,Grt),h.normalize(s,s),a=M.multiplyByPointAsVector(r,h.UNIT_Z,Wrt),1-Math.abs(h.dot(s,a))<P.EPSILON6){let l=Le.fromAxisAngle(s,i.heading,qrt),f=Z.fromQuaternion(l,Xrt);h.fromCartesian4(M.getColumn(r,1,Yrt),a),Z.multiplyByVector(f,a,a)}let c=h.cross(s,a,jrt);h.cross(c,s,a),h.normalize(a,a)}this.flyTo({destination:o,orientation:{direction:s,up:a},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 z_e=new h,H_e=new h,UY=new h,G_e=new h,nN=[new h,new h,new h,new h];function Krt(e,t){let n=t.radii,i=e.positionWC,o=h.multiplyComponents(t.oneOverRadii,i,z_e),r=h.magnitude(o),s=h.normalize(o,H_e),a,c;h.equalsEpsilon(s,h.UNIT_Z,P.EPSILON10)?(a=new h(0,1,0),c=new h(0,0,1)):(a=h.normalize(h.cross(h.UNIT_Z,s,UY),UY),c=h.normalize(h.cross(s,a,G_e),G_e));let l=Math.sqrt(h.magnitudeSquared(o)-1),f=h.multiplyByScalar(s,1/r,z_e),d=l/r,p=h.multiplyByScalar(a,d,H_e),g=h.multiplyByScalar(c,d,UY),m=h.add(f,g,nN[0]);h.subtract(m,p,m),h.multiplyComponents(n,m,m);let A=h.subtract(f,g,nN[1]);h.subtract(A,p,A),h.multiplyComponents(n,A,A);let x=h.subtract(f,g,nN[2]);h.add(x,p,x),h.multiplyComponents(n,x,x);let C=h.add(f,g,nN[3]);return h.add(C,p,C),h.multiplyComponents(n,C,C),nN}var kY=new H,Zrt=new h,ky=[new he,new he,new he,new he];function m4(e,t,n,i,o,r){kY.x=e,kY.y=t;let s=i.pickEllipsoid(kY,o,Zrt);return u(s)?(ky[n]=o.cartesianToCartographic(s,ky[n]),1):(ky[n]=o.cartesianToCartographic(r[n],ky[n]),0)}Jt.prototype.computeViewRectangle=function(e,t){e=y(e,ie.WGS84);let n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new se(h.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Qt.OUTSIDE)return;let r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight,c=0,l=Krt(this,e);if(c+=m4(0,0,0,this,e,l),c+=m4(0,a,1,this,e,l),c+=m4(s,a,2,this,e,l),c+=m4(s,0,3,this,e,l),c<2)return ce.MAX_VALUE;t=ce.fromCartographicArray(ky,t);let f=0,d=ky[3].longitude;for(let p=0;p<4;++p){let g=ky[p].longitude,m=Math.abs(g-d);m>P.PI?f+=P.TWO_PI-m:f+=m,d=g}return P.equalsEpsilon(Math.abs(f),P.TWO_PI,P.EPSILON9)&&(t.west=-P.PI,t.east=P.PI,ky[0].latitude>=0?t.north=P.PI_OVER_TWO:t.south=-P.PI_OVER_TWO),t};Jt.prototype.switchToPerspectiveFrustum=function(){if(this._mode===te.SCENE2D||this.frustum instanceof Ti)return;let e=this._scene;this.frustum=new Ti,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=P.toRadians(60)};Jt.prototype.switchToOrthographicFrustum=function(){if(this._mode===te.SCENE2D||this.frustum instanceof en)return;let e=X_e(this),t=this._scene;this.frustum=new en,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};Jt.clone=function(e,t){return u(t)||(t=new Jt(e._scene)),h.clone(e.position,t.position),h.clone(e.direction,t.direction),h.clone(e.up,t.up),h.clone(e.right,t.right),M.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};var ro=Jt;function Jrt(e){this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}var Of=Jrt;var cge=vo(Ll(),1),oge=576,Qrt=100,iN="#ffffff",jY="#48b";function lge(e,t){this.credit=e,this.count=y(t,1)}function $rt(e,t){let n=e.length;for(let i=0;i<n;i++){let o=e[i];if(Zt.equals(o,t))return!0}return!1}function est(e){let t=e._previousCesiumCredit,n=e._currentCesiumCredit;Zt.equals(n,t)||(u(t)&&e._cesiumCreditContainer.removeChild(t.element),u(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}var uge="cesium-credit-delimiter";function rge(e){let t=document.createElement("span");return t.textContent=e,t.className=uge,t}function sge(e,t){if(u(t)){let n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function age(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(u(a)){if(r=s,u(n)&&(r*=2,s>0)){let l=r-1;if(o.length<=l)e.appendChild(rge(n));else{let f=o[l];f.className!==uge&&e.replaceChild(rge(n),f)}}let c=a.element;if(o.length<=r)e.appendChild(sge(c,i));else{let l=o[r];l._creditId!==a._id&&e.replaceChild(sge(c,i),l)}}}for(++r;r<o.length;)e.removeChild(o[r])}function tst(e){let t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<oge?(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>=oge&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function uc(e,t){let n=`${e} {`;for(let i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` }
`,n}function nst(){let e="";e+=uc(".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)"}),e+=uc(".cesium-credit-lightbox",{"background-color":"#303336",color:iN,position:"relative","min-height":`${Qrt}px`,margin:"auto"}),e+=uc(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:iN}),e+=uc(".cesium-credit-lightbox > ul > li a:hover",{color:jY}),e+=uc(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=uc(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=uc(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=uc(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:iN}),e+=uc(".cesium-credit-lightbox-close:hover",{color:jY}),e+=uc(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=uc(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=uc(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=uc(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:iN}),e+=uc(".cesium-credit-expand-link:hover",{color:jY}),e+=uc(".cesium-credit-text",{color:iN}),e+=uc(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});let t=document.head,n=document.createElement("style");n.innerHTML=e,t.insertBefore(n,t.firstChild)}function yr(e,t,n){let i=this;n=y(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 c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="&times;",c.className="cesium-credit-lightbox-close",r.appendChild(c);let l=document.createElement("ul");r.appendChild(l);let f=document.createElement("div");f.className="cesium-credit-logoContainer",f.style.display="inline",e.appendChild(f);let d=document.createElement("div");d.className="cesium-credit-textContainer",d.style.display="inline",e.appendChild(d);let p=document.createElement("a");p.className="cesium-credit-expand-link",p.onclick=this.showLightbox.bind(this),p.textContent="Data attribution",e.appendChild(p),nst();let g=Zt.clone(yr.cesiumCredit);this._delimiter=y(t," \u2022 "),this._screenContainer=d,this._cesiumCreditContainer=f,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=l,this._lightbox=o,this._hideLightbox=s,this._expandLink=p,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new xt,lightboxCredits:new xt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function fge(e,t,n,i){i=y(i,1);let o=t.get(n.id);if(u(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 lge(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}yr.prototype.addCredit=function(e){if(e._isIon){u(this._defaultCredit)||(this._defaultCredit=Zt.clone(dge())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,fge(this,t,e)};yr.prototype.addDefaultCredit=function(e){let t=this._defaultCredits;$rt(t,e)||t.push(e)};yr.prototype.removeDefaultCredit=function(e){let t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};yr.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};yr.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};yr.prototype.update=function(){this._expanded&&tst(this)};yr.prototype.beginFrame=function(){let e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;let t=e.screenCredits;t.removeAll();let n=this._defaultCredits;for(let i=0;i<n.length;++i){let o=n[i];fge(this,t,o,Number.MAX_VALUE)}e.lightboxCredits.removeAll(),Zt.equals(yr.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Zt.clone(yr.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};yr.prototype.endFrame=function(){let e=this._currentFrameCredits.screenCredits.values;age(this._screenContainer,e,this._delimiter,void 0);let t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",age(this._creditList,t,void 0,"li"),est(this)};yr.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),le(this)};yr.prototype.isDestroyed=function(){return!1};yr._cesiumCredit=void 0;yr._cesiumCreditInitialized=!1;var A4;function dge(){if(!u(A4)){let e=$t("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new cge.default(e).path()),A4=new Zt(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return yr._cesiumCreditInitialized||(yr._cesiumCredit=A4,yr._cesiumCreditInitialized=!0),A4}Object.defineProperties(yr,{cesiumCredit:{get:function(){return dge(),yr._cesiumCredit},set:function(e){yr._cesiumCredit=e,yr._cesiumCreditInitialized=!0}}});yr.CreditDisplayElement=lge;var oN=yr;function x4(e){e=y(e,y.EMPTY_OBJECT),this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=y(e.color,z.CYAN),this._updateOnChange=y(e.updateOnChange,!0),this.show=y(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}var ist=new h,ost=new Z,rst=new Le,sst=new Ti,ast=new zc,cst=new en,lst=new Tr,ust=new z,fst=[1,1e5];x4.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 Ti?a=sst:s instanceof zc?a=ast:s instanceof en?a=cst:a=lst,a=s.clone(a);let c,l=this._frustumSplits;!u(l)||l.length<=1?(l=fst,l[0]=this._camera.frustum.near,l[1]=this._camera.frustum.far,c=1):c=l.length-1;let f=r.positionWC,d=r.directionWC,p=r.upWC,g=r.rightWC;g=h.negate(g,ist);let m=ost;Z.setColumn(m,0,g,m),Z.setColumn(m,1,p,m),Z.setColumn(m,2,d,m);let A=Le.fromRotationMatrix(m,rst);for(t.length=n.length=c,i=0;i<c;++i)a.near=l[i],a.far=l[i+1],t[i]=new Dn({geometryInstances:new At({geometry:new Vx({origin:f,orientation:A,frustum:a,_drawNearPlane:i===0}),attributes:{color:Nt.fromColor(z.fromAlpha(this._color,.1,ust))},id:this.id,pickPrimitive:this}),appearance:new on({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Dn({geometryInstances:new At({geometry:new sL({origin:f,orientation:A,frustum:a,_drawNearPlane:i===0}),attributes:{color:Nt.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new on({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};x4.prototype.isDestroyed=function(){return!1};x4.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 le(this)};var dm=x4;function sN(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=y(e,0)}var rN=Vt.supportsTypedArrays()?new Float32Array(12):[],hge=new h,mge=new h,YY=new h,pge=new h,C4=new h;function dst(e,t){let n=e.radii,i=t.camera,o,r,s;if(i.frustum instanceof en)o=h.ZERO,r=i.rightWC,s=i.upWC;else{let d=i.positionWC,p=h.multiplyComponents(e.oneOverRadii,d,hge),g=h.normalize(p,mge),m=h.normalize(h.cross(h.UNIT_Z,p,YY),YY),A=h.normalize(h.cross(g,m,pge),pge),x=h.magnitude(p),C=Math.sqrt(x*x-1);o=h.multiplyByScalar(g,1/x,hge);let T=C/x;r=h.multiplyByScalar(m,T,mge),s=h.multiplyByScalar(A,T,YY)}let a=h.add(o,s,C4);h.subtract(a,r,a),h.multiplyComponents(n,a,a),h.pack(a,rN,0);let c=h.subtract(o,s,C4);h.subtract(c,r,c),h.multiplyComponents(n,c,c),h.pack(c,rN,3);let l=h.add(o,s,C4);h.add(l,r,l),h.multiplyComponents(n,l,l),h.pack(l,rN,6);let f=h.subtract(o,s,C4);return h.add(f,r,f),h.multiplyComponents(n,f,f),h.pack(f,rN,9),rN}sN.prototype.update=function(e){if(this._mode=e.mode,e.mode!==te.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(u(this._command)||(this._rs=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new tt({renderState:this._rs,boundingVolume:new se(h.ZERO,i.maximumRadius),pass:Ee.OPAQUE,owner:this})),!u(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;let s=new ke({sources:[UM]}),a=new ke({sources:[VM]});o&&(a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")),this._sp=Xt.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}let r=dst(i,e);if(u(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{let s=new ct({attributes:{position:new ve({componentDatatype:q.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:Me.TRIANGLES});this._va=oi.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:Ne.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};sN.prototype.execute=function(e,t){this._mode===te.SCENE3D&&this._command.execute(e,t)};sN.prototype.isDestroyed=function(){return!1};sN.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};var aN=sN;function cN(){}var hst=/\bgl_FragDepth\b/,mst=/\bdiscard\b/;function pst(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!u(n)){let i=t._attributeLocations,o=t.fragmentShaderSource,r,s=!1,a=o.sources,c=a.length;for(r=0;r<c;++r)if(hst.test(a[r])||mst.test(a[r])){s=!0;break}let l=!1,f=o.defines;for(c=f.length,r=0;r<c;++r)if(f[r]==="LOG_DEPTH"){l=!0;break}let d;!s&&!l?(d=`void main() 
{ 
    out_FragColor = vec4(1.0); 
} 
`,o=new ke({sources:[d]})):!s&&l&&(d=`void main() 
{ 
    out_FragColor = vec4(1.0); 
    czm_writeLogDepth(); 
} 
`,o=new ke({defines:["LOG_DEPTH"],sources:[d]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function _st(e,t){let n=e._depthOnlyRenderStateCache,i=n[t.id];if(!u(i)){let o=Ue.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=Ue.fromCache(o),n[t.id]=i}return i}cN.createDepthOnlyDerivedCommand=function(e,t,n,i){u(i)||(i={});let o,r;return u(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=tt.shallowClone(t,i.depthOnlyCommand),!u(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=pst(n,t.shaderProgram),i.depthOnlyCommand.renderState=_st(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};var gst=/\s+czm_writeLogDepth\(/,yst=/\s+czm_vertexLogDepth\(/;function Ast(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!u(i)){let o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=u(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=u(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a,c,l=!1,f=r.sources,d=f.length;for(a=0;a<d;++a)if(yst.test(f[a])){l=!0;break}if(!l){for(a=0;a<d;++a)f[a]=ke.replaceMain(f[a],"czm_log_depth_main");c=`

void main() 
{ 
    czm_log_depth_main(); 
    czm_vertexLogDepth(); 
} 
`,f.push(c)}for(f=s.sources,d=f.length,l=!1,a=0;a<d;++a)gst.test(f[a])&&(l=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(l=!0);let p="";if(!l){for(a=0;a<d;a++)f[a]=ke.replaceMain(f[a],"czm_log_depth_main");p+=`
void main() 
{ 
    czm_log_depth_main(); 
    czm_writeLogDepth(); 
} 
`}f.push(p),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}cN.createLogDepthCommand=function(e,t,n){u(n)||(n={});let i;return u(n.command)&&(i=n.command.shaderProgram),n.command=tt.shallowClone(e,n.command),!u(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=Ast(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function xst(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!u(i)){let o=t._attributeLocations,r=t.fragmentShaderSource,s=r.sources,a=s.length,c=`void main() 
{ 
    czm_non_pick_main(); 
    if (out_FragColor.a == 0.0) { 
        discard; 
    } 
    out_FragColor = ${n}; 
} 
`,l=new Array(a+1);for(let f=0;f<a;++f)l[f]=ke.replaceMain(s[f],"czm_non_pick_main");l[a]=c,r=new ke({sources:l,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function Cst(e,t){let n=e.picking.pickRenderStateCache,i=n[t.id];if(!u(i)){let o=Ue.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=Ue.fromCache(o),n[t.id]=i}return i}cN.createPickDerivedCommand=function(e,t,n,i){u(i)||(i={});let o,r;return u(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=tt.shallowClone(t,i.pickCommand),!u(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=xst(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=Cst(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function Tst(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!u(n)){let i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=u(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=u(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}cN.createHdrCommand=function(e,t,n){u(n)||(n={});let i;return u(n.command)&&(i=n.command.shaderProgram),n.command=tt.shallowClone(e,n.command),!u(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=Tst(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};var I_=cN;function T4(e){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(!u(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=P.toRadians(o),t._beta=P.toRadians(i.beta),t._gamma=P.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}var Est=new Le,_ge=new Le,bst=new Z;function Sst(e,t,n,i){let o=e.direction,r=e.right,s=e.up,a=Le.fromAxisAngle(o,n,_ge),c=Le.fromAxisAngle(r,i,Est),l=Le.multiply(c,a,c),f=Le.fromAxisAngle(s,t,_ge);Le.multiply(f,l,l);let d=Z.fromQuaternion(l,bst);Z.multiplyByVector(d,r,r),Z.multiplyByVector(d,s,s),Z.multiplyByVector(d,o,o)}T4.prototype.update=function(){if(!u(this._alpha))return;u(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;Sst(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};T4.prototype.isDestroyed=function(){return!1};T4.prototype.destroy=function(){return this._removeListener(),le(this)};var lN=T4;function gge(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}var E4=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],hm=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let e=0;e<hm.length;++e)hm[e]*=1e6;var yge=hm[1],qY=hm[hm.length-1];for(let e=0;e<hm.length;++e)hm[e]=(hm[e]-qY)/(yge-qY);var $s=0;function Dst(e){let t=E4,n=t.length;if(e<t[0])return $s=0,$s;if(e>t[n-1])return $s=n-2,$s;if(e>=t[$s]){if($s+1<n&&e<t[$s+1])return $s;if($s+2<n&&e<t[$s+2])return++$s,$s}else if($s-1>=0&&e>=t[$s-1])return--$s,$s;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return $s=i,$s}var vst=new h;gge.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;let n=e.camera,i=n.positionCartographic;if(!u(i)||i.height>8e5||e.mode!==te.SCENE3D){e.fog.enabled=!1;return}let o=i.height,r=Dst(o),s=P.clamp((o-E4[r])/(E4[r+1]-E4[r]),0,1),a=P.lerp(hm[r],hm[r+1],s),c=this.density*1e6,l=c/yge*qY;a=a*(c-l)*1e-6;let f=h.normalize(n.positionWC,vst),d=Math.abs(h.dot(n.directionWC,f));a*=1-d,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};var uN=gge;function wst(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=te.SCENE3D,this.morphTime=te.getMorphTime(te.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,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.terrainExaggeration=1,this.terrainExaggerationRelativeHeight=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}var fN=wst;var ea={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},qx=ea.DERIVED_COMMANDS_MAXIMUM_LENGTH,wge=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function Xx(){this._frontFaceAlphaByDistance=new Pt(0,1,0,1),this._backFaceAlphaByDistance=new Pt(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(qx),this._derivedBlendCommandTypes=new Array(qx),this._derivedPickCommandTypes=new Array(qx),this._derivedCommandTypesToUpdate=new Array(qx),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(Xx.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}}});Xx.prototype.update=function(e){let t=e.globe;if(!u(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=Age(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=Age(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=xge(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=xge(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=Rst(this,e,t),this._sunVisibleThroughGlobe=Ist(this,e),this._environmentVisible=Pst(this,e),this._useDepthPlane=Ost(this,e),this._numberOfTextureUniforms=Bst(this),this._rectangle=ce.clone(t.translucency.rectangle,this._rectangle),Mst(this,e)};function Age(e,t,n,i){return e?u(n)?(Pt.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 xge(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function Ist(e,t){let n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function Pst(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function Ost(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function Rst(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==te.SCENE2D&&t.context.depthTexture}function Bst(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function Mst(e,t){e._derivedCommandsLength=XY(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=XY(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=XY(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<qx;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;let r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!u(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=Kst())}function XY(e,t,n,i,o){let r=0,s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;let c=t.cameraUnderground,l=e._requiresManualDepthTest,f=i?ea.PICK_FRONT_FACE:l?ea.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:ea.TRANSLUCENT_FRONT_FACE,d=i?ea.PICK_BACK_FACE:l?ea.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:ea.TRANSLUCENT_BACK_FACE;return t.mode===te.SCENE2D?(o[r++]=ea.DEPTH_ONLY_FRONT_FACE,o[r++]=f,r):(a?(n||(o[r++]=ea.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(o[r++]=f,o[r++]=d):(o[r++]=d,o[r++]=f)):c?(n||(o[r++]=ea.DEPTH_ONLY_BACK_FACE),o[r++]=ea.OPAQUE_FRONT_FACE,o[r++]=d):(n||(o[r++]=ea.DEPTH_ONLY_FRONT_FACE),o[r++]=ea.OPAQUE_BACK_FACE,o[r++]=f),r)}function Rf(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}function Cge(e,t){return e.indexOf(t)>-1}function Lst(e,t){Rf(e.defines,"TRANSLUCENT"),Rf(t.defines,"TRANSLUCENT")}function Nst(e,t){Rf(e.defines,"GROUND_ATMOSPHERE"),Rf(t.defines,"GROUND_ATMOSPHERE"),Rf(e.defines,"FOG"),Rf(t.defines,"FOG"),Rf(e.defines,"TRANSLUCENT"),Rf(t.defines,"TRANSLUCENT")}function KY(e,t){if(Cge(t.defines,"TILE_LIMIT_RECTANGLE")||Cge(t.defines,"ENABLE_CLIPPING_PLANES"))return;let n=`void main() 
{ 
    out_FragColor = vec4(1.0); 
} 
`;t.sources=[n]}function ZY(e,t){let n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=ke.replaceMain(n[r],"czm_globe_translucency_main");let o=`

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); 
} 
`;n.push(o)}function Ige(e,t){ZY(e,t),Rf(e.defines,"GROUND_ATMOSPHERE"),Rf(t.defines,"GROUND_ATMOSPHERE"),Rf(e.defines,"FOG"),Rf(t.defines,"FOG")}function Fst(e,t){ZY(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Vst(e,t){Ige(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function Tge(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 Ust(e,t,n,i,o,r){if(!u(o))return t;if(!i&&u(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!u(s)){let a=t._attributeLocations,c=t.vertexShaderSource.clone(),l=t.fragmentShaderSource.clone();c.defines=u(c.defines)?c.defines.slice(0):[],l.defines=u(l.defines)?l.defines.slice(0):[],o(c,l),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:c,fragmentShaderSource:l,attributeLocations:a})}return s}function kst(e){e.cull.face=gi.BACK,e.cull.enabled=!0}function zst(e){e.cull.face=gi.FRONT,e.cull.enabled=!0}function Hst(e){e.cull.face=gi.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Gst(e){e.cull.face=gi.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Wst(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function Ege(e){e.cull.face=gi.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=un.ALPHA_BLEND}function bge(e){e.cull.face=gi.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=un.ALPHA_BLEND}function jst(e){e.cull.face=gi.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function Yst(e){e.cull.face=gi.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function qst(e,t,n,i,o){if(!u(i))return e;if(!n&&u(t))return t;let r=o[e.id];if(!u(r)){let s=Ue.getState(e);i(s),r=Ue.fromCache(s),o[e.id]=r}return r}function lS(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function Xst(e,t,n,i,o){return u(o)?!i&&u(n)?n:_t(t,o(e),!1):t}function ih(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function Kst(){return[new ih({pass:Ee.GLOBE,pickOnly:!1,getShaderProgramFunction:Lst,getRenderStateFunction:kst,getUniformMapFunction:void 0}),new ih({pass:Ee.GLOBE,pickOnly:!1,getShaderProgramFunction:Nst,getRenderStateFunction:zst,getUniformMapFunction:void 0}),new ih({pass:Ee.GLOBE,pickOnly:!1,getShaderProgramFunction:KY,getRenderStateFunction:Hst,getUniformMapFunction:void 0}),new ih({pass:Ee.GLOBE,pickOnly:!1,getShaderProgramFunction:KY,getRenderStateFunction:Gst,getUniformMapFunction:void 0}),new ih({pass:Ee.GLOBE,pickOnly:!1,getShaderProgramFunction:KY,getRenderStateFunction:Wst,getUniformMapFunction:void 0}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:ZY,getRenderStateFunction:Ege,getUniformMapFunction:lS}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Ige,getRenderStateFunction:bge,getUniformMapFunction:lS}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Fst,getRenderStateFunction:Ege,getUniformMapFunction:lS}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:Vst,getRenderStateFunction:bge,getUniformMapFunction:lS}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Tge,getRenderStateFunction:jst,getUniformMapFunction:lS}),new ih({pass:Ee.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:Tge,getRenderStateFunction:Yst,getUniformMapFunction:lS})]}var Sge=new Array(qx),Dge=new Array(qx);Xx.prototype.updateDerivedCommands=function(e,t){let n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)Dge[o]=this._derivedCommandPacks[n[o]],Sge[o]=wge[n[o]];Zst(this,e,i,n,Sge,Dge,t)}};function Zst(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency,c=e._derivedCommandsDirty;if(t.dirty||!u(a)||c){t.dirty=!1,u(a)||(a={},t.derivedCommands.globeTranslucency=a);let l=s.frameNumber,f=y(a.uniformMapDirtyFrame,0),d=y(a.shaderProgramDirtyFrame,0),p=y(a.renderStateDirtyFrame,0),g=a.uniformMap!==t.uniformMap,m=a.shaderProgramId!==t.shaderProgram.id,A=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=l),m&&(a.shaderProgramDirtyFrame=l),A&&(a.renderStateDirtyFrame=l),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let x=0;x<n;++x){let C=r[x],T=i[x],E=o[x],S=a[E],D,w,R;u(S)?(D=S.uniformMap,w=S.shaderProgram,R=S.renderState):(D=void 0,w=void 0,R=void 0),S=tt.shallowClone(t,S),a[E]=S;let O=y(S.derivedCommands.uniformMapDirtyFrame,0),L=y(S.derivedCommands.shaderProgramDirtyFrame,0),N=y(S.derivedCommands.renderStateDirtyFrame,0),_=g||O<f,b=m||L<d,v=A||N<p;_&&(S.derivedCommands.uniformMapDirtyFrame=l),b&&(S.derivedCommands.shaderProgramDirtyFrame=l),v&&(S.derivedCommands.renderStateDirtyFrame=l),S.derivedCommands.type=T,S.pass=C.pass,S.pickOnly=C.pickOnly,S.uniformMap=Xst(e,t.uniformMap,D,_,C.getUniformMapFunction),S.shaderProgram=Ust(s.context,t.shaderProgram,w,b,C.getShaderProgramFunction,E),S.renderState=qst(t.renderState,R,v,C.getRenderStateFunction,C.renderStateCache)}}}Xx.prototype.pushDerivedCommands=function(e,t,n){let i=n.passes.pick;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 c=wge[o[a]];n.commandList.push(s[c])}};function Pge(e,t,n,i,o,r,s){for(let a=0;a<t;++a){let c=e[a],l=c.derivedCommands.type;(!u(s)||s.indexOf(l)>-1)&&n(c,i,o,r)}}function vge(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}var Jst=[ea.OPAQUE_FRONT_FACE,ea.OPAQUE_BACK_FACE],Qst=[ea.DEPTH_ONLY_FRONT_FACE,ea.DEPTH_ONLY_BACK_FACE,ea.DEPTH_ONLY_FRONT_AND_BACK_FACE];Xx.prototype.executeGlobeCommands=function(e,t,n,i,o){let r=i.context,s=e.commands[Ee.GLOBE],a=e.indices[Ee.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),Pge(s,a,t,i,r,o,Jst))};Xx.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){let r=i.context,s=e.commands[Ee.GLOBE],a=e.indices[Ee.GLOBE],c=e.commands[Ee.TERRAIN_CLASSIFICATION],l=e.indices[Ee.TERRAIN_CLASSIFICATION];if(a===0||l===0)return;let f=this._frontFaceTranslucent,d=this._backFaceTranslucent;if((!f||!d)&&vge(c,l,t,i,r,o),!f&&!d)return;this._globeTranslucencyFramebuffer=n;let p=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,Pge(s,a,t,i,r,o,Qst),r.depthTexture){let m=n.packDepth(r,o);r.uniformState.globeDepthTexture=m}vge(c,l,t,i,r,o),r.uniformState.globeDepthTexture=p,o.framebuffer=g};var dN=Xx;var Il=`uniform sampler2D colorTexture;

in vec2 v_textureCoordinates;

void main()
{
    out_FragColor = texture(colorTexture, v_textureCoordinates);
}
`;function mm(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new mi({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new mi({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 ii({color:new z(0,0,0,0),owner:this}),this._clearCommand=new ii({color:new z(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(mm.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});mm.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};var $st={depthMask:!1,stencilTest:{enabled:!0,frontFunction:kn.EQUAL,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},backFunction:kn.NEVER,reference:0,mask:Bt.CLASSIFICATION_MASK},blending:un.ALPHA_BLEND},eat={depthMask:!1,stencilTest:{enabled:!0,frontFunction:kn.NOT_EQUAL,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},backFunction:kn.NEVER,reference:0,mask:Bt.CLASSIFICATION_MASK},blending:un.ALPHA_BLEND},tat={depthMask:!0,depthTest:{enabled:!0},stencilTest:Bt.setCesium3DTileBit(),stencilMask:Bt.CESIUM_3D_TILE_MASK,blending:un.ALPHA_BLEND},nat=`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;
}
`,iat=`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
}
`;mm.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,c=!u(i)||i.width!==s||i.height!==a;if((c||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),u(this._previousFramebuffer)||(this._depthStencilTexture=new It({context:e,width:s,height:a,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Xe.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Ul({context:e,width:s,height:a,format:_c.DEPTH24_STENCIL8,numSamples:t})))),!u(this._fbo.framebuffer)||c||o||r){this._fbo.destroy(),this._fboClassified.destroy();let l,f;u(this._previousFramebuffer)?(l=n.getDepthStencilTexture(),f=n.getDepthStencilRenderbuffer()):(l=this._depthStencilTexture,f=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(l),u(f)&&this._fbo.setDepthStencilRenderbuffer(f),this._fbo.update(e,s,a,t),u(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(l),this._fboClassified.update(e,s,a))}if(u(this._rsUnclassified)||(this._rsUnclassified=Ue.fromCache($st),this._rsClassified=Ue.fromCache(eat),this._rsDefault=Ue.fromCache(tat)),!u(this._unclassifiedCommand)||o||r){u(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());let l=u(this._previousFramebuffer)?iat:nat,f=new ke({defines:["UNCLASSIFIED"],sources:[l]}),d=new ke({sources:[l]});this._unclassifiedCommand=e.createViewportQuadCommand(f,{renderState:u(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(d,{renderState:u(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),u(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),u(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(Il,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};mm.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};mm.prototype.clear=function(e,t){u(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};mm.prototype.executeClassified=function(e,t){if(!u(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)};mm.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};mm.prototype.isDestroyed=function(){return!1};mm.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),u(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),le(this)};var uS=mm;function b4(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(b4.prototype,{total:{get:function(){return this._total}}});function zy(e){let t=new Array(fa.NUMBER_OF_JOB_TYPES);t[fa.TEXTURE]=new b4(u(e)?e[fa.TEXTURE]:10),t[fa.PROGRAM]=new b4(u(e)?e[fa.PROGRAM]:10),t[fa.BUFFER]=new b4(u(e)?e[fa.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}zy.getTimestamp=di;Object.defineProperties(zy.prototype,{totalBudget:{get:function(){return this._totalBudget}}});zy.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};zy.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};zy.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 c=n.length,l;for(l=0;l<c&&(r=n[l],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++l);if(l===c&&o)return!1;o&&(i.starvedThisFrame=!0)}let s=zy.getTimestamp();e.execute();let a=zy.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};var hN=zy;function S4(e){e=y(e,y.EMPTY_OBJECT);let t=In(e.container);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=di(),this._lastMsSampleTime=di(),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(S4.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});S4.prototype.update=function(e){let t=di(),n=y(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}};S4.prototype.destroy=function(){return le(this)};var P_=S4;function Kx(){this._framebuffer=new mi,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(Kx.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function oat(e,t,n){let i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function rat(e,t,n){if(!u(e._copyDepthCommand)){let i=`uniform highp sampler2D u_texture;
in vec2 v_textureCoordinates;
void main()
{
    out_FragColor = czm_packDepth(texture(u_texture, v_textureCoordinates).r);
}
`;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:Ue.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}Kx.prototype.update=function(e,t){oat(this,e,t),rat(this,e,t)};var sat=new oe,aat=new oe(1,1/255,1/65025,1/16581375);Kx.prototype.getDepth=function(e,t,n){if(!u(this.framebuffer))return;let i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=oe.unpack(i,0,sat);return oe.divideByScalar(o,255,o),oe.dot(o,aat)};Kx.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};Kx.prototype.isDestroyed=function(){return!1};Kx.prototype.destroy=function(){return this._framebuffer.destroy(),u(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=u(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),le(this)};var mN=Kx;function cat(e,t){this.near=y(e,0),this.far=y(t,0);let n=Ee.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 pN=cat;var Hy=`uniform highp sampler2D u_depthTexture;

in vec2 v_textureCoordinates;

void main()
{
    out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r);
}
`;function pm(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new mi({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new mi({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new mi,this._tempCopyDepthFramebuffer=new mi,this._updateDepthFramebuffer=new mi({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 Ye,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(pm.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 lat(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function Oge(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;let r=!Ye.equals(e._viewport,o.viewport),s=r!==e._useScissorTest;e._useScissorTest=r,Ye.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ye.clone(o.viewport,e._scissorRectangle),s=!0),(!u(e._rs)||!Ye.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:un.ALPHA_BLEND}),e._rsUpdate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:kn.EQUAL,frontOperation:{fail:ut.KEEP,zFail:ut.KEEP,zPass:ut.KEEP},backFunction:kn.NEVER,reference:Bt.CESIUM_3D_TILE_MASK,mask:Bt.CESIUM_3D_TILE_MASK}})),u(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(Hy,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,u(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(Il,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,u(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(Hy,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,u(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(Il,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,u(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new ii({color:new z(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}pm.prototype.update=function(e,t,n,i,o,r){let s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT:Xe.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,c),this._copyDepthFramebuffer.update(e,s,a),Oge(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};pm.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};pm.prototype.executeCopyDepth=function(e,t){u(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};pm.prototype.executeUpdateDepth=function(e,t,n,i){let o=u(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(u(this._updateDepthCommand)){if(!u(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){let r=this._copyDepthFramebuffer.getColorTexture().width,s=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,r,s);let a=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(a,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,r,s),Oge(this,e,r,s,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}return}u(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)};pm.prototype.executeCopyColor=function(e,t){u(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};pm.prototype.clear=function(e,t,n){let i=this._clearGlobeColorCommand;u(i)&&(z.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};pm.prototype.isDestroyed=function(){return!1};pm.prototype.destroy=function(){return lat(this),u(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),u(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),u(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),u(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),le(this)};var _N=pm;function Zx(){this._framebuffer=new mi({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new mi,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new Ye,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(Zx.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 uat(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function fat(e,t,n,i,o){let r=o?t.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT:Xe.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function dat(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;let r=!Ye.equals(e._viewport,o.viewport),s=r!==e._useScissorTest;e._useScissorTest=r,Ye.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ye.clone(o.viewport,e._scissorRectangle),s=!0),(!u(e._renderState)||!Ye.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),u(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(Hy,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),u(e._clearCommand)||(e._clearCommand=new ii({color:new z(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}Zx.prototype.updateAndClear=function(e,t,n,i){let o=t.width,r=t.height;fat(this,n,o,r,e),dat(this,n,o,r,i),this._useHdr=e};Zx.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};Zx.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};Zx.prototype.isDestroyed=function(){return!1};Zx.prototype.destroy=function(){return uat(this),le(this)};var gN=Zx;function O_(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 mi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new mi({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new mi({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new mi({createColorAttachments:!1}),this._opaqueClearCommand=new ii({color:new z(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new ii({color:new z(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new ii({color:new z(0,0,0,0),owner:this}),this._alphaClearCommand=new ii({color:new z(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 Ye,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function Rge(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function JY(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function Bge(e){Rge(e),JY(e)}function hat(e,t,n,i){Rge(e),e._accumulationTexture=new It({context:t,width:n,height:i,pixelFormat:rt.RGBA,pixelDatatype:Xe.FLOAT});let o=new Float32Array(n*i*4);e._revealageTexture=new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:Xe.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function mat(e,t){JY(e);let n=ee.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)&&(JY(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,c=e._adjustTranslucentFBO.status===n,l=e._adjustAlphaFBO.status===n;(!s||!a||!c||!l)&&(Bge(e),e._translucentMultipassSupport=!1,i=!1)}return i}O_.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,c=!u(a)||a.width!==r||a.height!==s||i!==this._useHDR,l=this._numSamples!==o;if((c||l)&&(this._numSamples=o,hat(this,e,r,s)),(!u(this._translucentFBO.framebuffer)||c||l)&&!mat(this,e))return;this._useHDR=i;let f=this,d,p;u(this._compositeCommand)||(d=new ke({sources:[FM]}),this._translucentMRTSupport&&d.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(d,{uniformMap:p,owner:this})),u(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(d=new ke({defines:["MRT"],sources:[wb]}),p={u_bgColor:function(){return f._translucentMRTClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:p,owner:this})):this._translucentMultipassSupport&&(d=new ke({sources:[wb]}),p={u_bgColor:function(){return f._translucentMultipassClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(d,{uniformMap:p,owner:this}),p={u_bgColor:function(){return f._alphaClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(d,{uniformMap:p,owner:this}))),this._viewport.width=r,this._viewport.height=s;let g=!Ye.equals(this._viewport,t.viewport),m=g!==this._useScissorTest;this._useScissorTest=g,Ye.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Ye.clone(t.viewport,this._scissorRectangle),m=!0),(!u(this._rs)||!Ye.equals(this._viewport,this._rs.viewport)||m)&&(this._rs=Ue.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),u(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),u(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};var pat={enabled:!0,color:new z(0,0,0,0),equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.ONE,functionDestinationRgb:xo.ONE,functionSourceAlpha:xo.ZERO,functionDestinationAlpha:xo.ONE_MINUS_SOURCE_ALPHA},_at={enabled:!0,color:new z(0,0,0,0),equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.ONE,functionDestinationRgb:xo.ONE,functionSourceAlpha:xo.ONE,functionDestinationAlpha:xo.ONE},gat={enabled:!0,color:new z(0,0,0,0),equationRgb:aa.ADD,equationAlpha:aa.ADD,functionSourceRgb:xo.ZERO,functionDestinationRgb:xo.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:xo.ZERO,functionDestinationAlpha:xo.ONE_MINUS_SOURCE_ALPHA};function QY(e,t,n,i){let o=n[i.id];if(!u(o)){let r=Ue.getState(i);r.depthMask=!1,r.blending=t,o=Ue.fromCache(r),n[i.id]=o}return o}function yat(e,t,n){return QY(t,pat,e._translucentRenderStateCache,n)}function Aat(e,t,n){return QY(t,_at,e._translucentRenderStateCache,n)}function xat(e,t,n){return QY(t,gat,e._alphaRenderStateCache,n)}var Cat=`    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);
`,Tat=`    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;
`,Eat=`    float ai = czm_out_FragColor.a;
    out_FragColor = vec4(ai);
`;function $Y(e,t,n,i){let{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(u(r))return r;let s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map(function(f){return ke.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 c=[...i.matchAll(/out_FragData_(\d+)/g)],l="";for(let f=0;f<c.length;f++){let d=c[f];l=`layout (location = ${d[1]}) out vec4 ${d[0]};
${l}`}return a.sources.push(l),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 bat(e,t){return $Y(e,t,"translucentMRT",Cat)}function Sat(e,t){return $Y(e,t,"translucentMultipass",Tat)}function Dat(e,t){return $Y(e,t,"alphaMultipass",Eat)}O_.prototype.createDerivedCommands=function(e,t,n){if(u(n)||(n={}),this._translucentMRTSupport){let a,c;return u(n.translucentCommand)&&(a=n.translucentCommand.shaderProgram,c=n.translucentCommand.renderState),n.translucentCommand=tt.shallowClone(e,n.translucentCommand),!u(a)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=bat(t,e.shaderProgram),n.translucentCommand.renderState=yat(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=a,n.translucentCommand.renderState=c),n}let i,o,r,s;return u(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=tt.shallowClone(e,n.translucentCommand),n.alphaCommand=tt.shallowClone(e,n.alphaCommand),!u(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=Sat(t,e.shaderProgram),n.translucentCommand.renderState=Aat(this,t,e.renderState),n.alphaCommand.shaderProgram=Dat(t,e.shaderProgram),n.alphaCommand.renderState=xat(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 vat(e,t,n,i,o,r){let s,a,c,{context:l,frameState:f}=t,{useLogDepth:d,shadowState:p}=f,g=t._hdr,m=i.framebuffer,A=p.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(l,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(l,i);let x=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<o.length;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=A&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,l,i,x);for(u(r)&&(s=r.unclassifiedCommand,a=A&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,l,i,x)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<o.length;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=A&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,l,i,x);u(r)&&(s=r.unclassifiedCommand,a=A&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,l,i,x)),i.framebuffer=m}function wat(e,t,n,i,o,r){let{context:s,frameState:a}=t,{useLogDepth:c,shadowState:l}=a,f=t._hdr,d=i.framebuffer,p=l.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);let g=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let m,A;for(let x=0;x<o.length;++x)m=o[x],m=c?m.derivedCommands.logDepth.command:m,m=f?m.derivedCommands.hdr.command:m,A=p&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(A,t,s,i,g);u(r)&&(m=r.unclassifiedCommand,A=p&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(A,t,s,i,g)),i.framebuffer=d}O_.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){wat(this,e,t,n,i,o);return}vat(this,e,t,n,i,o)};O_.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};O_.prototype.clear=function(e,t,n){let i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,z.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};O_.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};O_.prototype.isDestroyed=function(){return!1};O_.prototype.destroy=function(){return Bge(this),u(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),u(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),u(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),le(this)};var yN=O_;function AN(){this._framebuffer=new mi({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(AN.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function Iat(e){e._framebuffer.destroy()}function Pat(e,t){let n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);let o=new La(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Ye},o.viewport=new Ye,e._passState=o}AN.prototype.update=function(e,t,n){let i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&Pat(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};AN.prototype.isDestroyed=function(){return!1};AN.prototype.destroy=function(){return Iat(this),le(this)};var xN=AN;function TN(e){let t=new La(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Ye},t.viewport=new Ye,this._context=e,this._fb=new mi({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}TN.prototype.begin=function(e,t){let n=this._context,i=t.width,o=t.height;return Ye.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 CN=new z;TN.prototype.end=function(e){let t=y(e.width,1),n=y(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),c=Math.floor(n*.5),l=0,f=0,d=0,p=-1;for(let g=0;g<s;++g){if(-a<=l&&l<=a&&-c<=f&&f<=c){let m=4*((c-f)*t+l+a);CN.red=z.byteToFloat(o[m]),CN.green=z.byteToFloat(o[m+1]),CN.blue=z.byteToFloat(o[m+2]),CN.alpha=z.byteToFloat(o[m+3]);let A=i.getObjectByPickColor(CN);if(u(A))return A}if(l===f||l<0&&-l===f||l>0&&l===1-f){let m=d;d=-p,p=m}l+=d,f+=p}};TN.prototype.isDestroyed=function(){return!1};TN.prototype.destroy=function(){return this._fb.destroy(),le(this)};var EN=TN;function R_(){this._numSamples=1,this._colorFramebuffer=new mi({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new mi({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new z(0,0,0,0),this._clearCommand=new ii({color:new z(0,0,0,0),depth:1,owner:this})}function Oat(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(R_.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});R_.prototype.update=function(e,t,n,i){let o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT:Xe.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};R_.prototype.clear=function(e,t,n){z.clone(n,this._clearCommand.color),z.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};R_.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};R_.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};R_.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};R_.prototype.isDestroyed=function(){return!1};R_.prototype.destroy=function(){return Oat(this),le(this)};var Jx=R_;function Qx(){}Qx.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};Qx.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=ke.findPositionVarying(e),s=u(r);if(t&&!s){let a=o.length;for(let l=0;l<a;++l)o[l]=ke.replaceMain(o[l],"czm_shadow_cast_main");let c=`in vec3 v_positionEC; 
void main() 
{ 
    czm_shadow_cast_main(); 
    v_positionEC = (czm_inverseProjection * gl_Position).xyz; 
}`;o.push(c)}return new ke({defines:i,sources:o})};Qx.createShadowCastFragmentShader=function(e,t,n,i){let o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=ke.findPositionVarying(e),a=u(s);a||(s="v_positionEC");let c=r.length;for(let f=0;f<c;++f)r[f]=ke.replaceMain(r[f],"czm_shadow_cast_main");let l="";return t&&(a||(l+=`in vec3 v_positionEC; 
`),l+=`uniform vec4 shadowMap_lightPositionEC; 
`),i?l+=`void main() 
{ 
`:l+=`void main() 
{ 
    czm_shadow_cast_main(); 
    if (out_FragColor.a == 0.0) 
    { 
       discard; 
    } 
`,t?l+=`    float distance = length(${s}); 
    if (distance >= shadowMap_lightPositionEC.w) 
    { 
        discard; 
    } 
    distance /= shadowMap_lightPositionEC.w; // radius 
    out_FragColor = czm_packDepth(distance); 
`:n?l+=`    out_FragColor = vec4(1.0); 
`:l+=`    out_FragColor = czm_packDepth(gl_FragCoord.z); 
`,l+=`} 
`,r.push(l),new ke({defines:o,sources:r})};Qx.getShadowReceiveShaderKeyword=function(e,t,n,i){let o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,c=e._numberOfCascades>1,l=e.debugCascadeColors,f=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${c}${l}${f}${t}${n}${i}`};Qx.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 ke({defines:i,sources:o})};Qx.createShadowReceiveFragmentShader=function(e,t,n,i,o){let r=ke.findNormalVarying(e),s=!i&&u(r)||i&&o,a=ke.findPositionVarying(e),c=u(a),l=t._usesDepthTexture,f=t._polygonOffsetSupported,d=t._isPointLight,p=t._isSpotLight,g=t._numberOfCascades>1,m=t.debugCascadeColors,A=t.softShadows,x=d?t._pointBias:i?t._terrainBias:t._primitiveBias,C=e.defines.slice(0),T=e.sources.slice(0),E=T.length;for(let w=0;w<E;++w)T[w]=ke.replaceMain(T[w],"czm_shadow_receive_main");d?C.push("USE_CUBE_MAP_SHADOW"):l&&C.push("USE_SHADOW_DEPTH_TEXTURE"),A&&!d&&C.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?C.push("ENABLE_VERTEX_LIGHTING"):C.push("ENABLE_DAYNIGHT_SHADING")),n&&x.normalShading&&s&&(C.push("USE_NORMAL_SHADING"),x.normalShadingSmooth>0&&C.push("USE_NORMAL_SHADING_SMOOTH"));let S="";d?S+=`uniform samplerCube shadowMap_textureCube; 
`:S+=`uniform sampler2D shadowMap_texture; 
`;let D;return c?D=`    return vec4(${a}, 1.0); 
`:D=`#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() 
{ 
${D}} 
vec3 getNormalEC() 
{ 
${s?`    return normalize(${r}); 
`:`    return vec3(1.0); 
`}} 
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL) 
{ 
${x.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); 
`),d?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; 
} 
`,T.push(S),new ke({defines:C,sources:T})};var _m=Qx;function gm(e){e=y(e,y.EMPTY_OBJECT);let t=e.context;this._enabled=y(e.enabled,!0),this._softShadows=y(e.softShadows,!1),this._normalOffset=y(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=y(e.fromLightSource,!0),this.darkness=y(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=y(e.fadingEnabled,!0),this.maximumDistance=y(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 M,this._shadowMapTexture=void 0,this._lightDirectionEC=new h,this._lightPositionEC=new oe,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new D4,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new se,this._isPointLight=y(e.isPointLight,!1),this._pointLightRadius=y(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:y(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?y(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 Tr:u(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new oe,new oe],this._cascadeMatrices=[new M,new M,new M,new M],this._cascadeDistances=new oe;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 Rat(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,tq(this),this._clearCommand=new ii({depth:1,color:new z}),this._clearPassState=new La(t),this._size=y(e.size,2048),this.size=this._size}gm.MAXIMUM_DISTANCE=2e4;function Rat(e){this.camera=new D4,this.passState=new La(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function eq(e,t){return Ue.fromCache({cull:{enabled:!0,face:gi.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 tq(e){let t=!e._usesDepthTexture;e._primitiveRenderState=eq(t,e._primitiveBias),e._terrainRenderState=eq(t,e._terrainBias),e._pointRenderState=eq(t,e._pointBias)}gm.prototype.debugCreateRenderStates=function(){tq(this)};Object.defineProperties(gm.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){Vat(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 nq(e){let t=e._passes.length;for(let n=0;n<t;++n){let i=e._passes[n],o=i.framebuffer;u(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function Bat(e,t){let n=new Ul({context:t,width:e._textureSize.x,height:e._textureSize.y,format:_c.DEPTH_COMPONENT16}),i=new It({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,sampler:ln.NEAREST}),o=new Ns({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 Mat(e,t){let n=new It({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Xe.UNSIGNED_INT_24_8,sampler:ln.NEAREST}),i=new Ns({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 Lat(e,t){let n=new Ul({context:t,width:e._textureSize.x,height:e._textureSize.y,format:_c.DEPTH_COMPONENT16}),i=new Ma({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,sampler:ln.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){let s=new Ns({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 Nge(e,t){e._isPointLight?Lat(e,t):e._usesDepthTexture?Mat(e,t):Bat(e,t)}function Nat(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==ee.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,tq(e),nq(e),Nge(e,t))}function Fat(e,t){(!u(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(nq(e),Nge(e,t),Nat(e,t),Fge(e,t))}function Fge(e,t,n){n=y(n,0),(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function Vat(e,t){e._size=t;let n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=Ft.maximumCubeMapSize>=t?t:Ft.maximumCubeMapSize,o.x=t,o.y=t;let r=new Ye(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=Ft.maximumTextureSize>=t?t:Ft.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Ye(0,0,t,t)):i===4&&(t=Ft.maximumTextureSize>=t*2?t:Ft.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new Ye(0,0,t,t),n[1].passState.viewport=new Ye(t,0,t,t),n[2].passState.viewport=new Ye(0,t,t,t),n[3].passState.viewport=new Ye(t,t,t,t));e._clearPassState.viewport=new Ye(0,0,o.x,o.y);for(let r=0;r<i;++r){let s=n[r],a=s.passState.viewport,c=a.x/o.x,l=a.y/o.y,f=a.width/o.x,d=a.height/o.y;s.textureOffsets=new M(f,0,0,c,0,d,0,l,0,0,1,0,0,0,0,1)}}var Uat=new Ye;function kat(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=Ee.OVERLAY,i}function zat(e,t){let n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=Uat;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;u(a)||(a=kat(e,n),e._debugShadowViewCommand=a),(!u(a.renderState)||!Ye.equals(a.renderState.viewport,s))&&(a.renderState=Ue.fromCache({viewport:Ye.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}var ym=new Array(8);ym[0]=new oe(-1,-1,-1,1);ym[1]=new oe(1,-1,-1,1);ym[2]=new oe(1,1,-1,1);ym[3]=new oe(-1,1,-1,1);ym[4]=new oe(-1,-1,1,1);ym[5]=new oe(1,-1,1,1);ym[6]=new oe(1,1,1,1);ym[7]=new oe(-1,1,1,1);var Gy=new M,iq=new Array(8);for(let e=0;e<8;++e)iq[e]=new oe;function Hat(e,t){let n=new At({geometry:new Xf({minimum:new h(-.5,-.5,-.5),maximum:new h(.5,.5,.5)}),attributes:{color:Nt.fromColor(t)}}),i=new At({geometry:new Wp({radius:.5}),attributes:{color:Nt.fromColor(t)}});return new Dn({geometryInstances:[n,i],appearance:new on({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}var Gat=[z.RED,z.GREEN,z.BLUE,z.MAGENTA],Wat=new h;function jat(e,t){zat(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 dm({camera:e._sceneCamera,color:z.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new dm({camera:e._shadowMapCamera,color:z.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 dm({camera:e._passes[i].camera,color:Gat[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!u(e._debugLightFrustum)||e._needsUpdate){let i=e._shadowMapCamera.positionWC,o=Le.IDENTITY,r=e._pointLightRadius*2,s=h.fromElements(r,r,r,Wat),a=M.fromTranslationQuaternionRotationScale(i,o,s,Gy);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=Hat(a,z.YELLOW)}e._debugLightFrustum.update(t)}else(!u(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new dm({camera:e._shadowMapCamera,color:z.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function D4(){this.viewMatrix=new M,this.inverseViewMatrix=new M,this.frustum=void 0,this.positionCartographic=new he,this.positionWC=new h,this.directionWC=h.clone(h.UNIT_Z),this.upWC=h.clone(h.UNIT_Y),this.rightWC=h.clone(h.UNIT_X),this.viewProjectionMatrix=new M}D4.prototype.clone=function(e){M.clone(e.viewMatrix,this.viewMatrix),M.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),he.clone(e.positionCartographic,this.positionCartographic),h.clone(e.positionWC,this.positionWC),h.clone(e.directionWC,this.directionWC),h.clone(e.upWC,this.upWC),h.clone(e.rightWC,this.rightWC)};var Yat=new M(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);D4.prototype.getViewProjection=function(){let e=this.viewMatrix,t=this.frustum.projectionMatrix;return M.multiply(t,e,this.viewProjectionMatrix),M.multiply(Yat,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};var qat=new Array(5),Xat=new Ti,Kat=new Array(4),Vge=new h,Uge=new h;function Zat(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades,a,c=r-o,l=r/o,f=.9,d=!1;t.shadowState.closestObjectSize<200&&(d=!0,f=.9);let p=Kat,g=qat;for(g[0]=o,g[s]=r,a=0;a<s;++a){let N=(a+1)/s,_=o*Math.pow(l,N),b=o+c*N,v=P.lerp(b,_,f);g[a+1]=v,p[a]=v-g[a]}if(d){for(a=0;a<s;++a)p[a]=Math.min(p[a],e._maximumCascadeDistances[a]);let N=g[0];for(a=0;a<s-1;++a)N+=p[a],g[a+1]=N}oe.unpack(g,0,e._cascadeSplits[0]),oe.unpack(g,1,e._cascadeSplits[1]),oe.unpack(p,0,e._cascadeDistances);let m=n.frustum,A=m.left,x=m.right,C=m.bottom,T=m.top,E=m.near,S=m.far,D=n.positionWC,w=n.directionWC,R=n.upWC,O=i.frustum.clone(Xat),L=n.getViewProjection();for(a=0;a<s;++a){O.near=g[a],O.far=g[a+1];let N=M.multiply(O.projectionMatrix,i.viewMatrix,Gy),_=M.inverse(N,Gy),b=M.multiply(L,_,Gy),v=h.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Vge),I=h.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Uge);for(let G=0;G<8;++G){let V=oe.clone(ym[G],iq[G]);M.multiplyByVector(b,V,V),h.divideByScalar(V,V.w,V),h.minimumByComponent(V,v,v),h.maximumByComponent(V,I,I)}v.x=Math.max(v.x,0),v.y=Math.max(v.y,0),v.z=0,I.x=Math.min(I.x,1),I.y=Math.min(I.y,1),I.z=Math.min(I.z,1);let B=e._passes[a],F=B.camera;F.clone(n);let k=F.frustum;k.left=A+v.x*(x-A),k.right=A+I.x*(x-A),k.bottom=C+v.y*(T-C),k.top=C+I.y*(T-C),k.near=E+v.z*(S-E),k.far=E+I.z*(S-E),B.cullingVolume=F.frustum.computeCullingVolume(D,w,R);let U=e._cascadeMatrices[a];M.multiply(F.getViewProjection(),i.inverseViewMatrix,U),M.multiply(B.textureOffsets,U,U)}}var Jat=new M,Qat=new h,$at=new h,Mge=new h;function ect(e,t){let n=e._shadowMapCamera,i=e._sceneCamera,o=M.multiply(i.frustum.projectionMatrix,i.viewMatrix,Gy),r=M.inverse(o,Gy),s=n.directionWC,a=i.directionWC;h.equalsEpsilon(s,a,P.EPSILON10)&&(a=i.upWC);let c=h.cross(s,a,Qat);a=h.cross(c,s,$at),h.normalize(a,a),h.normalize(c,c);let l=h.fromElements(0,0,0,Mge),f=M.computeView(l,s,a,c,Jat),d=M.multiply(f,r,Gy),p=h.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Vge),g=h.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Uge);for(let S=0;S<8;++S){let D=oe.clone(ym[S],iq[S]);M.multiplyByVector(d,D,D),h.divideByScalar(D,D.w,D),h.minimumByComponent(D,p,p),h.maximumByComponent(D,g,g)}g.z+=1e3,p.z-=10;let m=Mge;m.x=-(.5*(p.x+g.x)),m.y=-(.5*(p.y+g.y)),m.z=-g.z;let A=M.fromTranslation(m,Gy);f=M.multiply(A,f,f);let x=.5*(g.x-p.x),C=.5*(g.y-p.y),T=g.z-p.z,E=n.frustum;E.left=-x,E.right=x,E.bottom=-C,E.top=C,E.near=.01,E.far=T,M.clone(f,n.viewMatrix),M.inverse(f,n.inverseViewMatrix),M.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),h.clone(s,n.directionWC),h.clone(a,n.upWC),h.clone(c,n.rightWC)}var tct=[new h(-1,0,0),new h(0,-1,0),new h(0,0,-1),new h(1,0,0),new h(0,1,0),new h(0,0,1)],nct=[new h(0,-1,0),new h(0,0,-1),new h(0,-1,0),new h(0,-1,0),new h(0,0,1),new h(0,-1,0)],ict=[new h(0,0,1),new h(1,0,0),new h(-1,0,0),new h(0,0,-1),new h(1,0,0),new h(1,0,0)];function oct(e,t){let n=new Ti;n.fov=P.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=tct[i],o.upWC=nct[i],o.rightWC=ict[i],M.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),M.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}var rct=new h,sct=new h,kge=new se,Lge=kge.center;function act(e,t){let n=e._sceneCamera,i=e._shadowMapCamera,o=kge;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}let r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,rct),s=h.negate(i.directionWC,sct),a=h.dot(r,s);if(e.fadingEnabled){let c=P.clamp(a/.1,0,1);e._darkness=P.lerp(1,e.darkness,c)}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)===Qt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere);else{let r=i.frustum.far/2,s=h.add(i.positionWC,h.multiplyByScalar(i.directionWC,r,Lge),Lge);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===Qt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere)}}function cct(e,t){let n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?h.clone(i.directionWC,r.directionWC):e._isPointLight?h.clone(i.positionWC,r.positionWC):r.clone(i);let s=e._lightDirectionEC;M.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),h.normalize(s,s),h.negate(s,s),M.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,c;e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),c=Math.min(t.shadowState.farPlane,e.maximumDistance),c=Math.max(c,a+1)):(a=n.frustum.near,c=e.maximumDistance),e._sceneCamera=ro.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=c,e._distance=c-a,act(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}gm.prototype.update=function(e){if(cct(this,e),this._needsUpdate)if(Fat(this,e.context),this._isPointLight&&oct(this,e),this._cascadesEnabled&&(ect(this,e),this._numberOfCascades>1&&Zat(this,e)),this._isPointLight)this._shadowMapCullingVolume=$r.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;M.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&jat(this,e)};gm.prototype.updatePass=function(e,t){Fge(this,e,t)};var lct=new H;function zge(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=lct;return r.x=1/e._textureSize.x,r.y=1/e._textureSize.y,oe.fromElements(r.x,r.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return oe.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new oe,combinedUniforms2:new oe};return _t(t,o,!1)}function uct(e,t,n,i,o,r){let s,a,c;if(u(r)&&(s=r.shaderProgram,a=r.renderState,c=r.uniformMap),r=tt.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!u(s)||o!==n.shaderProgram.id||t){let l=n.shaderProgram,f=n.pass===Ee.GLOBE,d=n.pass!==Ee.TRANSLUCENT,p=e._isPointLight,g=e._usesDepthTexture,m=_m.getShadowCastShaderKeyword(p,f,g,d);if(s=i.shaderCache.getDerivedShaderProgram(l,m),!u(s)){let x=l.vertexShaderSource,C=l.fragmentShaderSource,T=_m.createShadowCastVertexShader(x,p,f),E=_m.createShadowCastFragmentShader(C,p,g,d);s=i.shaderCache.createDerivedShaderProgram(l,m,{vertexShaderSource:T,fragmentShaderSource:E,attributeLocations:l._attributeLocations})}a=e._primitiveRenderState,p?a=e._pointRenderState:f&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=Ge(a,!1),a.cull=Ge(a.cull,!1),a.cull.enabled=!1,a=Ue.fromCache(a)),c=zge(e,n.uniformMap,f)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=c,r}gm.createReceiveDerivedCommand=function(e,t,n,i,o){u(o)||(o={});let r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,c=s.fragmentShaderSource,l=t.pass===Ee.GLOBE,f=!1;if(l&&(f=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let d,p;u(o.receiveCommand)&&(d=o.receiveCommand.shaderProgram,p=o.receiveCommand.uniformMap),o.receiveCommand=tt.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;let g=o.receiveShaderCastShadows!==t.castShadows,m=o.receiveShaderProgramId!==t.shaderProgram.id;if(!u(d)||m||n||g){let A=_m.getShadowReceiveShaderKeyword(e[0],t.castShadows,l,f);if(d=i.shaderCache.getDerivedShaderProgram(s,A),!u(d)){let x=_m.createShadowReceiveVertexShader(a,l,f),C=_m.createShadowReceiveFragmentShader(c,e[0],t.castShadows,l,f);d=i.shaderCache.createDerivedShaderProgram(s,A,{vertexShaderSource:x,fragmentShaderSource:C,attributeLocations:s._attributeLocations})}p=zge(e[0],t.uniformMap,l)}o.receiveCommand.shaderProgram=d,o.receiveCommand.uniformMap=p,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};gm.createCastDerivedCommand=function(e,t,n,i,o){if(u(o)||(o={}),t.castShadows){let r=o.castCommands;u(r)||(r=o.castCommands=[]);let s=o.castShaderProgramId,a=e.length;r.length=a;for(let c=0;c<a;++c)r[c]=uct(e[c],n,t,i,s,r[c]);o.castShaderProgramId=t.shaderProgram.id}return o};gm.prototype.isDestroyed=function(){return!1};gm.prototype.destroy=function(){nq(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 le(this)};var B_=gm;var $x=`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
    // Reverse premultiplication process to get the correct composited result of the classification primitives
    color.rgb /= color.a;
#endif
    out_FragColor = color;
#endif
}
`;var fct=!1;function Wy(e){this._drawClassificationFBO=new mi({createDepthAttachments:!1}),this._accumulationFBO=new mi({createDepthAttachments:!1}),this._packFBO=new mi,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 ii({color:new z(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new ii({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new Ye,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(Wy.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function Hge(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function Gge(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function dct(e,t,n,i){Hge(e),e._translucentDepthStencilTexture=new It({context:t,width:n,height:i,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Xe.UNSIGNED_INT_24_8,sampler:ln.NEAREST})}function hct(e,t,n,i){Gge(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 mct(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)&&(dct(e,t,o,r),hct(e,t,o,r));let s,a;if(u(e._packDepthCommand)||(s=new ke({sources:[NM]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!u(e._compositeCommand)){s=new ke({sources:[$x]}),a={colorTexture:function(){return e._textureToComposite}},fct&&(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,d=f.shaderProgram,p=t.shaderCache.createDerivedShaderProgram(d,"pick",{vertexShaderSource:d.vertexShaderSource,fragmentShaderSource:new ke({sources:s.sources,defines:["PICK"]}),attributeLocations:d._attributeLocations}),g=tt.shallowClone(f);g.shaderProgram=p,f.derivedCommands.pick=g}u(e._copyCommand)||(s=new ke({sources:[$x]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),u(e._accumulateCommand)||(s=new ke({sources:[$x]}),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 c=!Ye.equals(e._viewport,n.viewport),l=c!==e._useScissorTest;e._useScissorTest=c,Ye.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Ye.clone(n.viewport,e._scissorRectangle),l=!0),(!u(e._rsDepth)||!Ye.equals(e._viewport,e._rsDepth.viewport)||l)&&(e._rsDepth=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),u(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!u(e._rsAccumulate)||!Ye.equals(e._viewport,e._rsAccumulate.viewport)||l)&&(e._rsAccumulate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:kn.EQUAL,reference:Bt.CESIUM_3D_TILE_MASK}})),u(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!u(e._rsComp)||!Ye.equals(e._viewport,e._rsComp.viewport)||l)&&(e._rsComp=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:un.ALPHA_BLEND})),u(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}Wy.prototype.executeTranslucentCommands=function(e,t,n,i,o){let r=i.length,s,a,c=e.frameState.useLogDepth,l=e.context,f=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(mct(this,l,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(l,n),a=0;a<r;++a){if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;let d=s.derivedCommands.depth.depthOnlyCommand;t(d,e,l,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(l,n)),n.framebuffer=f}};Wy.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;let o=e.context,r=o.uniformState,s=n.framebuffer;this._frustumsDrawn===2&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(o,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(Ee.CESIUM_3D_TILE_CLASSIFICATION);let a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();let c=i.commands[Ee.CESIUM_3D_TILE_CLASSIFICATION],l=i.indices[Ee.CESIUM_3D_TILE_CLASSIFICATION];for(let f=0;f<l;++f)t(c[f],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};Wy.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),pct(this,e,t)};function pct(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}Wy.prototype.isSupported=function(){return this._supported};Wy.prototype.isDestroyed=function(){return!1};Wy.prototype.destroy=function(){return Hge(this),Gge(this),u(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),u(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),le(this)};var bN=Wy;function _ct(){this.command=void 0,this.near=void 0,this.far=void 0}function v4(e,t,n){let i=e.context,o;i.depthTexture&&(o=new _N);let r;e._useOIT&&i.depthTexture&&(r=new yN(i));let s=new La(i);s.viewport=Ye.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 EN(i),this.pickDepthFramebuffer=new xN,this.sceneFramebuffer=new Jx,this.globeDepth=o,this.globeTranslucencyFramebuffer=new gN,this.oit=r,this.translucentTileClassification=new bN(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}var Wge=new h,jge=new h;function gct(e,t){let n=Math.max(Math.abs(e.x),Math.abs(t.x)),i=Math.max(Math.abs(e.y),Math.abs(t.y)),o=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),o)}function yct(e,t,n){let i=1/Math.max(1,gct(e.position,t.position));return h.multiplyByScalar(e.position,i,Wge),h.multiplyByScalar(t.position,i,jge),h.equalsEpsilon(Wge,jge,n)&&h.equalsEpsilon(e.direction,t.direction,n)&&h.equalsEpsilon(e.up,t.up,n)&&h.equalsEpsilon(e.right,t.right,n)&&M.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}v4.prototype.checkForCameraUpdates=function(e){let t=this.camera,n=this._cameraClone;return yct(t,n,P.EPSILON15)?(this._cameraStartFired&&di()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=di(),ro.clone(t,n),!0)};function Act(e,t,n,i){let o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===te.SCENE2D,c=t.nearToFarDistance2D;i*=1+P.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let l;a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),l=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):l=Math.ceil(Math.log(i/n)/Math.log(s));let f=e.frustumCommandsList;f.length=l;for(let d=0;d<l;++d){let p,g;a?(p=Math.min(i-c,n+d*c),g=Math.min(i,p+c)):(p=Math.max(n,Math.pow(s,d)*n),g=Math.min(i,s*p));let m=f[d];u(m)?(m.near=p,m.far=g):m=f[d]=new pN(p,g)}}function xct(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);let r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){let c=r[a],l=c.near,f=c.far;if(i>f)continue;if(o<l)break;let d=n.pass,p=c.indices[d]++;if(c.commands[d][p]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){let a=e.debugFrustumStatistics.commandsInFrustums;a[n.debugOverlappingFrustums]=u(a[n.debugOverlappingFrustums])?a[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}var Yge=new $r,Cct=new yc;v4.prototype.createPotentiallyVisibleSet=function(e){let t=e.frameState,n=t.camera,i=n.directionWC,o=n.positionWC,r=e._computeCommandList,s=e._overlayCommandList,a=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});let c=this.frustumCommandsList,l=c.length,f=Ee.NUMBER_OF_PASSES;for(let b=0;b<l;++b)for(let v=0;v<f;++v)c[b].indices[v]=0;r.length=0,s.length=0;let d=this._commandExtents,p=d.length,g=0,m=+Number.MAX_VALUE,A=-Number.MAX_VALUE,x=t.shadowState.shadowsEnabled,C=+Number.MAX_VALUE,T=-Number.MAX_VALUE,E=Number.MAX_VALUE,S=t.mode===te.SCENE3D?t.occluder:void 0,D=t.cullingVolume,w=Yge.planes;for(let b=0;b<5;++b)w[b]=D.planes[b];D=Yge;let R=a.length;for(let b=0;b<R;++b){let v=a[b],I=v.pass;if(I===Ee.COMPUTE)r.push(v);else if(I===Ee.OVERLAY)s.push(v);else{let B,F,k=v.boundingVolume;if(u(k)){if(!e.isVisible(v,D,S))continue;let G=k.computePlaneDistances(o,i,Cct);if(B=G.start,F=G.stop,m=Math.min(m,B),A=Math.max(A,F),x&&v.receiveShadows&&B<B_.MAXIMUM_DISTANCE&&!(I===Ee.GLOBE&&B<-100&&F>100)){let V=F-B;I!==Ee.GLOBE&&B<100&&(E=Math.min(E,V)),C=Math.min(C,B),T=Math.max(T,F)}}else v instanceof ii?(B=n.frustum.near,F=n.frustum.far):(B=n.frustum.near,F=n.frustum.far,m=Math.min(m,B),A=Math.max(A,F));let U=d[g];u(U)||(U=d[g]=new _ct),U.command=v,U.near=B,U.far=F,g++}}x&&(C=Math.min(Math.max(C,n.frustum.near),n.frustum.far),T=Math.max(Math.min(T,n.frustum.far),C)),x&&(t.shadowState.nearPlane=C,t.shadowState.farPlane=T,t.shadowState.closestObjectSize=E),Act(this,e,m,A);let O,L;for(O=0;O<g;O++)L=d[O],xct(this,e,L.command,L.near,L.far);if(g<p)for(O=g;O<p&&(L=d[O],!!u(L.command));O++)L.command=void 0;let N=c.length,_=t.frustumSplits;_.length=N+1;for(let b=0;b<N;++b)_[b]=c[b].near,b===N-1&&(_[b+1]=c[b].far)};v4.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,t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};var eC=v4;var Xge=.1,Tct=new Of({pass:qo.MOST_DETAILED_PRELOAD}),Ect=new Of({pass:qo.MOST_DETAILED_PICK}),oq=new Of({pass:qo.PICK});function xa(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;let t=new Ye(0,0,1,1),n=new ro(e);n.frustum=new en({width:Xge,aspectRatio:1,near:.1}),this._pickOffscreenView=new eC(e,n,t)}xa.prototype.update=function(){this._pickPositionCacheDirty=!0};xa.prototype.getPickDepth=function(e,t){let n=e.view.pickDepths,i=n[t];return u(i)||(i=new mN,n[t]=i),i};var bct=new Tr,Sct=new h,w4=new h,Dct=new H,vct=new M;function wct(e,t,n,i,o){let r=e.camera,s=r.frustum;u(s._offCenterFrustum)&&(s=s._offCenterFrustum);let a=2*(t.x-o.x)/o.width-1;a*=(s.right-s.left)*.5;let c=2*(o.height-t.y-o.y)/o.height-1;c*=(s.top-s.bottom)*.5;let l=M.clone(r.transform,vct);r._setTransform(M.IDENTITY);let f=h.clone(r.position,Sct);h.multiplyByScalar(r.right,a,w4),h.add(w4,f,f),h.multiplyByScalar(r.up,c,w4),h.add(w4,f,f),r._setTransform(l),e.mode===te.SCENE2D&&h.fromElements(f.z,f.x,f.y,f);let d=s.getPixelDimensions(o.width,o.height,1,1,Dct),p=bct;return p.right=d.x*.5,p.left=-p.right,p.top=d.y*.5,p.bottom=-p.top,p.near=s.near,p.far=s.far,p.computeCullingVolume(f,r.directionWC,r.upWC)}var Ict=new zc,Pct=new H;function Oct(e,t,n,i,o){let r=e.camera,s=r.frustum,a=s.near,c=Math.tan(s.fovy*.5),l=s.aspectRatio*c,f=2*(t.x-o.x)/o.width-1,d=2*(o.height-t.y-o.y)/o.height-1,p=f*a*l,g=d*a*c,m=s.getPixelDimensions(o.width,o.height,1,1,Pct),A=m.x*n*.5,x=m.y*i*.5,C=Ict;return C.top=g+x,C.bottom=g-x,C.right=p+A,C.left=p-A,C.near=a,C.far=s.far,C.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function Kge(e,t,n,i,o){let r=e.camera.frustum;return r instanceof en||r instanceof Tr?wct(e,t,n,i,o):Oct(e,t,n,i,o)}var fS=3,SN=3,Am=new Ye(0,0,fS,SN),Zge=new H,rq=new z(0,0,0,0);xa.prototype.pick=function(e,t,n,i){fS=y(n,3),SN=y(i,fS);let o=e.context,r=o.uniformState,s=e.frameState,a=e.defaultView;e.view=a;let c=a.viewport;c.x=0,c.y=0,c.width=o.drawingBufferWidth,c.height=o.drawingBufferHeight;let l=a.passState;l.viewport=Ye.clone(c,l.viewport);let f=qi.transformWindowToDrawingBuffer(e,t,Zge);e.jobScheduler.disableThisFrame(),e.updateFrameState(),s.cullingVolume=Kge(e,f,fS,SN,c),s.invertClassification=!1,s.passes.pick=!0,s.tilesetPassState=oq,r.update(s),e.updateEnvironment(),Am.x=f.x-(fS-1)*.5,Am.y=e.drawingBufferHeight-f.y-(SN-1)*.5,Am.width=fS,Am.height=SN,l=a.pickFramebuffer.begin(Am,a.viewport),e.updateAndExecuteCommands(l,rq),e.resolveFramebuffers(l);let d=a.pickFramebuffer.end(Am);return o.endFrame(),d};function Rct(e,t){let n=e.context,i=e.frameState,o=e.environmentState,r=e.defaultView;e.view=r;let s=r.viewport;s.x=0,s.y=0,s.width=n.drawingBufferWidth,s.height=n.drawingBufferHeight;let a=r.passState;a.viewport=Ye.clone(s,a.viewport),e.clearPasses(i.passes),i.passes.pick=!0,i.passes.depth=!0,i.cullingVolume=Kge(e,t,1,1,s),i.tilesetPassState=oq,e.updateEnvironment(),o.renderTranslucentDepthForPick=!0,a=r.pickDepthFramebuffer.update(n,t,s),e.updateAndExecuteCommands(a,rq),e.resolveFramebuffers(a),n.endFrame()}var Bct=new Ti,Mct=new zc,Lct=new en,Nct=new Tr;xa.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;let i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return h.clone(this._pickPositionCache[i],n);let o=e.frameState,r=e.context,s=r.uniformState,a=e.defaultView;e.view=a;let c=qi.transformWindowToDrawingBuffer(e,t,Zge);e.pickTranslucentDepth?Rct(e,c):(e.updateFrameState(),s.update(o),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;let l=e.camera,f;u(l.frustum.fov)?f=l.frustum.clone(Bct):u(l.frustum.infiniteProjectionMatrix)?f=l.frustum.clone(Mct):u(l.frustum.width)?f=l.frustum.clone(Lct):f=l.frustum.clone(Nct);let d=a.frustumCommandsList,p=d.length;for(let g=0;g<p;++g){let A=this.getPickDepth(e,g).getDepth(r,c.x,c.y);if(u(A)&&A>0&&A<1){let x=d[g],C;return e.mode===te.SCENE2D?(C=l.position.z,l.position.z=C-x.near+1,f.far=Math.max(1,x.far-x.near),f.near=1,s.update(o),s.updateFrustum(f)):(f.near=x.near*(g!==0?e.opaqueFrustumNearOffset:1),f.far=x.far,s.updateFrustum(f)),n=qi.drawingBufferToWgs84Coordinates(e,c,A,n),e.mode===te.SCENE2D&&(l.position.z=C,s.update(o)),this._pickPositionCache[i]=h.clone(n),n}}this._pickPositionCache[i]=void 0};var Fct=new he;xa.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),u(n)&&e.mode!==te.SCENE3D){h.fromElements(n.y,n.z,n.x,n);let i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,Fct);o.cartographicToCartesian(r,n)}return n};function Jge(e,t){let n,i,o=[],r=[],s=[],a=[];u(e)||(e=Number.MAX_VALUE);let c=t();for(;u(c);){let l=c.object,f=c.position,d=c.exclude;if(u(f)&&!u(l)){o.push(c);break}if(!u(l)||!u(l.primitive)||!d&&(o.push(c),0>=--e))break;let p=l.primitive,g=!1;typeof p.getGeometryInstanceAttributes=="function"&&u(l.id)&&(i=p.getGeometryInstanceAttributes(l.id),u(i)&&u(i.show)&&(g=!0,i.show=_n.toValue(!1,i.show),s.push(i))),l instanceof xs&&(g=!0,l.show=!1,a.push(l)),g||(p.show=!1,r.push(p)),c=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=_n.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}xa.prototype.drillPick=function(e,t,n,i,o){let r=this;return Jge(n,function(){let c=r.pick(e,t,i,o);if(u(c))return{object:c,position:void 0,exclude:!1}}).map(function(c){return c.object})};var qge=new h,Vct=new h;function Uct(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 Qge(e,t,n,i){let o=t.direction,r=h.mostOrthogonalAxis(o,qge),s=h.cross(o,r,qge),a=h.cross(o,s,Vct);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=y(n,Xge),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function kct(e,t,n){let i=t.frameState,o=n.ray,r=n.width,s=n.tilesets,a=e._pickOffscreenView.camera,c=Qge(e,o,r,a),l=Tct;l.camera=a,l.cullingVolume=c;let f=!0,d=s.length;for(let p=0;p<d;++p){let g=s[p];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,l),f=f&&l.ready)}return f&&n._completePick(),f}xa.prototype.updateMostDetailedRayPicks=function(e){let t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)kct(this,e,t[n])&&t.splice(n--,1)};function $ge(e,t,n){let i=e.length;for(let o=0;o<i;++o){let r=e.get(o);r.show&&(u(r.isCesium3DTileset)?(!u(t)||t.indexOf(r)===-1)&&n.push(r):r instanceof xl&&$ge(r,t,n))}}function I4(e,t,n,i,o,r){let s=[];if($ge(t.primitives,i,s),s.length===0)return Promise.resolve(r());let a=new Uct(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function zct(e,t){return!u(e)||!u(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function Hct(e,t,n,i,o,r,s){let a=t.context,c=a.uniformState,l=t.frameState,f=e._pickOffscreenView;t.view=f,Qge(e,n,o,f.camera),Am=Ye.clone(f.viewport,Am);let d=f.pickFramebuffer.begin(Am,f.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,s?l.tilesetPassState=Ect:l.tilesetPassState=oq,c.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(d,rq),t.resolveFramebuffers(d);let p,g=f.pickFramebuffer.end(Am);if(t.context.depthTexture){let m=f.frustumCommandsList.length;for(let A=0;A<m;++A){let C=e.getPickDepth(t,A).getDepth(a,0,0);if(u(C)&&C>0&&C<1){let T=f.frustumCommandsList[A],E=T.near*(A!==0?t.opaqueFrustumNearOffset:1),S=T.far,D=E+C*(S-E);p=wn.getPoint(n,D);break}}}if(t.view=t.defaultView,a.endFrame(),u(g)||u(p))return{object:g,position:p,exclude:!u(p)&&r||zct(g,i)}}function eye(e,t,n,i,o,r,s,a){return Jge(i,function(){return Hct(e,t,n,o,r,s,a)})}function dS(e,t,n,i,o,r,s){let a=eye(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function tye(e,t,n,i,o,r,s,a){return eye(e,t,n,i,o,r,s,a)}function P4(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)})})}xa.prototype.pickFromRay=function(e,t,n,i){return dS(this,e,t,n,i,!1,!1)};xa.prototype.drillPickFromRay=function(e,t,n,i,o){return tye(this,e,t,n,i,o,!1,!1)};xa.prototype.pickFromRayMostDetailed=function(e,t,n,i){let o=this;return t=wn.clone(t),n=u(n)?n.slice():n,P4(e,I4(o,e,t,n,i,function(){return dS(o,e,t,n,i,!1,!0)}))};xa.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){let r=this;return t=wn.clone(t),i=u(i)?i.slice():i,P4(e,I4(r,e,t,i,o,function(){return tye(r,e,t,n,i,o,!1,!0)}))};var Gct=new h,Wct=new h,jct=new wn,nye=new he;function sq(e,t){let n=e.globe,i=u(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=fi._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,Wct),s=he.toCartesian(t,i,Gct),a=jct;a.origin=s,a.direction=r;let c=new wn;return wn.getPoint(a,o,c.origin),h.negate(r,c.direction),c}function iye(e,t){let n=e.globe,i=u(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=he.fromCartesian(t,i,nye);return sq(e,o)}function oye(e,t){let n=e.globe,i=u(n)?n.ellipsoid:e.mapProjection.ellipsoid;return he.fromCartesian(t,i,nye).height}function Yct(e,t,n,i,o){let r=sq(t,n);return I4(e,t,r,i,o,function(){let s=dS(e,t,r,i,o,!0,!0);if(u(s))return oye(t,s.position)})}function qct(e,t,n,i,o,r){let s=iye(t,n);return I4(e,t,s,i,o,function(){let a=dS(e,t,s,i,o,!0,!0);if(u(a))return h.clone(a.position,r)})}xa.prototype.sampleHeight=function(e,t,n,i){let o=sq(e,t),r=dS(this,e,o,n,i,!0,!1);if(u(r))return oye(e,r.position)};xa.prototype.clampToHeight=function(e,t,n,i,o){let r=iye(e,t),s=dS(this,e,r,n,i,!0,!1);if(u(s))return h.clone(s.position,o)};xa.prototype.sampleHeightMostDetailed=function(e,t,n,i){n=u(n)?n.slice():n;let o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Yct(this,e,t[s],n,i);return P4(e,Promise.all(r).then(function(s){let a=s.length;for(let c=0;c<a;++c)t[c].height=s[c];return t}))};xa.prototype.clampToHeightMostDetailed=function(e,t,n,i){n=u(n)?n.slice():n;let o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=qct(this,e,t[s],n,i,t[s]);return P4(e,Promise.all(r).then(function(s){let a=s.length;for(let c=0;c<a;++c)t[c]=s[c];return t}))};xa.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};var DN=xa;var vN=`uniform sampler2D colorTexture;

in vec2 v_textureCoordinates;

#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif

void main()
{
    vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
    vec3 color = fragmentColor.rgb;

#ifdef AUTO_EXPOSURE
    color /= texture(autoExposure, vec2(0.5)).r;
#endif
    color = czm_acesTonemapping(color);
    color = czm_inverseGamma(color);

    out_FragColor = vec4(color, fragmentColor.a);
}
`;var wN=`uniform sampler2D randomTexture;
uniform sampler2D depthTexture;
uniform float intensity;
uniform float bias;
uniform float lengthCap;
uniform float stepSize;
uniform float frustumLength;

in vec2 v_textureCoordinates;

vec4 clipToEye(vec2 uv, float depth)
{
    vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
    vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
    posEC = posEC / posEC.w;
    return posEC;
}

//Reconstruct Normal Without Edge Removation
vec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)
{
    vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);
    vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);
    vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);
    vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);

    vec3 up = posInCamera.xyz - posInCameraUp.xyz;
    vec3 down = posInCameraDown.xyz - posInCamera.xyz;
    vec3 left = posInCamera.xyz - posInCameraLeft.xyz;
    vec3 right = posInCameraRight.xyz - posInCamera.xyz;

    vec3 DX = length(left) < length(right) ? left : right;
    vec3 DY = length(up) < length(down) ? up : down;

    return normalize(cross(DY, DX));
}

void main(void)
{
    float depth = czm_readDepth(depthTexture, v_textureCoordinates);
    vec4 posInCamera = clipToEye(v_textureCoordinates, depth);

    if (posInCamera.z > frustumLength)
    {
        out_FragColor = vec4(1.0);
        return;
    }

    vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
    float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));
    float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));
    float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));
    float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));
    vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);

    float ao = 0.0;
    vec2 sampleDirection = vec2(1.0, 0.0);
    float gapAngle = 90.0 * czm_radiansPerDegree;

    // RandomNoise
    float randomVal = texture(randomTexture, v_textureCoordinates).x;

    //Loop for each direction
    for (int i = 0; i < 4; i++)
    {
        float newGapAngle = gapAngle * (float(i) + randomVal);
        float cosVal = cos(newGapAngle);
        float sinVal = sin(newGapAngle);

        //Rotate Sampling Direction
        vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);
        float localAO = 0.0;
        float localStepSize = stepSize;

        //Loop for each step
        for (int j = 0; j < 6; j++)
        {
            vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;

            //Exception Handling
            if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)
            {
                break;
            }

            float stepDepthInfo = czm_readDepth(depthTexture, newCoords);
            vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);
            vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;
            float len = length(diffVec);

            if (len > lengthCap)
            {
                break;
            }

            float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );
            float weight = len / lengthCap;
            weight = 1.0 - weight * weight;

            if (dotVal < bias)
            {
                dotVal = 0.0;
            }

            localAO = max(localAO, dotVal * weight);
            localStepSize += stepSize;
        }
        ao += localAO;
    }

    ao /= 4.0;
    ao = 1.0 - clamp(ao, 0.0, 1.0);
    ao = pow(ao, intensity);
    out_FragColor = vec4(vec3(ao), 1.0);
}
`;var IN=`uniform sampler2D colorTexture;
uniform sampler2D ambientOcclusionTexture;
uniform bool ambientOcclusionOnly;
in vec2 v_textureCoordinates;

void main(void)
{
    vec3 color = texture(colorTexture, v_textureCoordinates).rgb;
    vec3 ao = texture(ambientOcclusionTexture, v_textureCoordinates).rgb;
    out_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;
}
`;var PN=`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 ON=`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 RN=`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 BN=`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 MN=`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 LN=`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 NN=`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 FN=`uniform sampler2D colorTexture;

in vec2 v_textureCoordinates;

#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif

// See slides 142 and 143:
//     http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting

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;
#endif

	const float A = 0.22; // shoulder strength
	const float B = 0.30; // linear strength
	const float C = 0.10; // linear angle
	const float D = 0.20; // toe strength
	const float E = 0.01; // toe numerator
	const float F = 0.30; // toe denominator

	const float white = 11.2; // linear white point value

	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 VN=`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 jy=`#define SAMPLES 8

uniform float delta;
uniform float sigma;
uniform float direction; // 0.0 for x direction, 1.0 for y direction

uniform sampler2D colorTexture;

#ifdef USE_STEP_SIZE
uniform float stepSize;
#else
uniform vec2 step;
#endif

in vec2 v_textureCoordinates;

//  Incremental Computation of the Gaussian:
//  https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html

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 UN=`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;

// whether it is in space or not
// 6500000.0 is empirical value
#define DISTANCE_TO_SPACE 6500000.0

// return ndc from world coordinate biased earthRadius
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);
}

// Check if current pixel is included Earth
// if then mask it gradually
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));
}

// For Chromatic effect
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;

    // Sun position
    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 sun is not in the screen space, use original color.
    if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))
    {
        // Lens flare is disabled when not in space until #5932 is fixed.
        //    https://github.com/CesiumGS/cesium/issues/5932
        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);

    // ghost vector to image centre:
    vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;
    vec3 direction = normalize(vec3(ghostVec, 0.0));

    // sample ghosts:
    vec4 result = vec4(0.0);
    vec4 ghost = vec4(0.0);
    for (int i = 0; i < 4; ++i)
    {
        vec2 offset = fract(texcoord + ghostVec * float(i));
        // Only bright spots from the centre of the source image
        ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);
    }
    result += ghost;

    // sample halo
    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;

    // dirt on lens
    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);

    // Rotating starburst texture's coordinate
    // dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0))
    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 kN=`uniform sampler2D colorTexture;
uniform vec3 white;

in vec2 v_textureCoordinates;

#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif

// See equation 4:
//    http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf

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;
#endif
    color = (color * (1.0 + color / white)) / (1.0 + color);
    color = czm_inverseGamma(color);
    out_FragColor = vec4(color, fragmentColor.a);
}
`;var zN=`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 HN=`uniform sampler2D colorTexture;

in vec2 v_textureCoordinates;

#ifdef AUTO_EXPOSURE
uniform sampler2D autoExposure;
#endif

// See equation 3:
//    http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf

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;
#endif
    color = color / (1.0 + color);
    color = czm_inverseGamma(color);
    out_FragColor = vec4(color, fragmentColor.a);
}
`;var GN=`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 tC(){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 mi,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(tC.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){let e=this._framebuffers;if(u(e))return e[e.length-1].getColorTexture(0)}}});function rye(e){let t=e._framebuffers;if(!u(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 Xct(e,t){rye(e);let n=e._width,i=e._height,o=t.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let c=0;c<r;++c)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[c]=new mi,s[c].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 sye(e){let t=e._commands;if(!u(t))return;let n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function Kct(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 Zct(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 Jct(e,t){sye(e);let n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(Zct(r,i),{framebuffer:n[r].framebuffer,uniformMap:Kct(e,r)});e._commands=o}tC.prototype.clear=function(e){let t=this._framebuffers;if(!u(t))return;let n=this._clearCommand;u(n)||(n=this._clearCommand=new ii({color:new z(0,0,0,0),framebuffer:void 0}));let i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};tC.prototype.update=function(e){let t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,Xct(this,e),Jct(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};tC.prototype.execute=function(e,t){this._colorTexture=t;let n=this._commands;if(!u(n))return;let i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};tC.prototype.isDestroyed=function(){return!1};tC.prototype.destroy=function(){return rye(this),sye(this),le(this)};var WN=tC;var Qct={NEAREST:0,LINEAR:1},Du=Qct;function nC(e){e=y(e,y.EMPTY_OBJECT);let t=e.fragmentShader,n=y(e.textureScale,1),i=y(e.pixelFormat,rt.RGBA);this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=y(e.forcePowerOfTwo,!1),this._sampleMode=y(e.sampleMode,Du.NEAREST),this._pixelFormat=i,this._pixelDatatype=y(e.pixelDatatype,Xe.UNSIGNED_BYTE),this._clearColor=y(e.clearColor,z.BLACK),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 o=new La;o.scissorTest={enabled:!0,rectangle:u(e.scissorRectangle)?Ye.clone(e.scissorRectangle):new Ye},this._passState=o,this._ready=!1;let r=e.name;u(r)||(r=zn()),this._name=r,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(nC.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(u(this._textureCache)){let e=this._textureCache.getFramebuffer(this._name);if(u(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 $ct=/uniform\s+sampler2D\s+depthTexture/g;nC.prototype._isSupported=function(e){return!$ct.test(this._fragmentShader)||e.depthTexture};function elt(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];u(a)&&a!==r&&a instanceof It&&!u(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof It&&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 tlt(e,t){return function(){let n=e._actualUniforms[t];return typeof n=="function"?n():n}}function nlt(e,t){return function(){let n=e[t]();if(u(n))return n.dimensions}}function ilt(e){if(u(e._uniformMap))return;let t={},n={},i=e._uniforms,o=e._actualUniforms;for(let r in i)if(i.hasOwnProperty(r)){typeof i[r]!="function"?(t[r]=tlt(e,r),n[r]=elt(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];let s=t[r]();(typeof s=="string"||s instanceof It||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=nlt(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=_t(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 olt(e,t){if(u(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(u(e._selectedIdTexture)){let o=e._selectedIdTexture.width;n=n.replace(/in\s+vec2\s+v_textureCoordinates;/g,""),n=`#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 < ${o}; ++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)); 
} 

${n}`}let i=new ke({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function rlt(e){let t=e._sampleMode,n,i;t===Du.LINEAR?(n=an.LINEAR,i=yi.LINEAR):(n=an.NEAREST,i=yi.NEAREST);let o=e._sampler;(!u(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function slt(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function alt(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function clt(e,t){let n,i,o,r=e._texturesToRelease,s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;let a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){let d=a[n];o=d.name;let p=d.source;e._actualUniforms[o]=new It({context:t,source:p})}a.length=0;let c=e._dirtyUniforms;if(c.length===0&&!u(e._texturePromise)){e._ready=!0;return}if(c.length===0||u(e._texturePromise))return;s=c.length;let l=e._uniforms,f=[];for(n=0;n<s;++n){o=c[n];let d=l[o],p=e._textureCache.getStageByName(d);if(u(p))e._actualUniforms[o]=alt(e,d);else if(typeof d=="string"){let g=new Oe({url:d});f.push(g.fetchImage().then(slt(e,o)))}else e._texturesToCreate.push({name:o,source:d})}c.length=0,f.length>0?(e._ready=!1,e._texturePromise=Promise.all(f).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function aye(e){u(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(!u(t))return;let n=e._uniforms,i=e._actualUniforms;for(let o in i)i.hasOwnProperty(o)&&i[o]instanceof It&&(u(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function llt(e){let t=u(e._selected)?e._selected.length:0,n=u(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,u(e._selected)&&u(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):u(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&u(e._combinedSelected)){if(!u(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}function ult(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;let n=e._combinedSelected;if(!u(n))return;let i,o,r=0,s=n.length;for(i=0;i<s;++i)o=n[i],u(o.pickIds)?r+=o.pickIds.length:u(o.pickId)&&++r;if(s===0||r===0){let f=new Uint8Array(4);f[0]=255,f[1]=255,f[2]=255,f[3]=255,e._selectedIdTexture=new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,source:{arrayBufferView:f,width:1,height:1},sampler:ln.NEAREST});return}let a,c=0,l=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],u(o.pickIds)){let f=o.pickIds,d=f.length;for(let p=0;p<d;++p)a=f[p].color,l[c]=z.floatToByte(a.red),l[c+1]=z.floatToByte(a.green),l[c+2]=z.floatToByte(a.blue),l[c+3]=z.floatToByte(a.alpha),c+=4}else u(o.pickId)&&(a=o.pickId.color,l[c]=z.floatToByte(a.red),l[c+1]=z.floatToByte(a.green),l[c+2]=z.floatToByte(a.blue),l[c+3]=z.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,source:{arrayBufferView:l,width:r,height:1},sampler:ln.NEAREST})}nC.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&aye(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=llt(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=u(this._selected)?this._selected.length:0,this._parentSelectedLength=u(this._parentSelected)?this._parentSelected.length:0,ult(this,e),ilt(this),clt(this,e),olt(this,e),rlt(this),this._selectedDirty=!1,!this._ready))return;let n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!u(n))return;let i=n.getColorTexture(0),o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!u(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=Ue.fromCache({viewport:new Ye(0,0,i.width,i.height)}))),this._command.renderState=o};nC.prototype.execute=function(e,t,n,i){if(!u(this._command)||!u(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,ln.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;u(o)&&(o.context=e),this._command.execute(e,o)};nC.prototype.isDestroyed=function(){return!1};nC.prototype.destroy=function(){return aye(this),le(this)};var po=nC;function iC(e){e=y(e,y.EMPTY_OBJECT),this._stages=e.stages,this._inputPreviousStageTexture=y(e.inputPreviousStageTexture,!0);let t=e.name;u(t)||(t=zn()),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(iC.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}}});iC.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};iC.prototype.get=function(e){return this._stages[e]};function flt(e){let t=u(e._selected)?e._selected.length:0,n=u(e._parentSelected)?e._parentSelected:0,i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,u(e._selected)&&u(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):u(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&u(e._combinedSelected)){if(!u(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}iC.prototype.update=function(e,t){this._selectedDirty=flt(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=u(this._selected)?this._selected.length:0,this._parentSelectedLength=u(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)}};iC.prototype.isDestroyed=function(){return!1};iC.prototype.destroy=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return le(this)};var jc=iC;var Lr={};function O4(e){let o=`#define USE_STEP_SIZE
${jy}`,r=new po({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:Du.LINEAR}),s=new po({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:Du.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(c){let l=r.uniforms,f=s.uniforms;l.delta=f.delta=c}},sigma:{get:function(){return r.uniforms.sigma},set:function(c){let l=r.uniforms,f=s.uniforms;l.sigma=f.sigma=c}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(c){let l=r.uniforms,f=s.uniforms;l.stepSize=f.stepSize=c}}}),new jc({name:e,stages:[r,s],uniforms:a})}Lr.createBlurStage=function(){return O4("czm_blur")};Lr.createDepthOfFieldStage=function(){let e=O4("czm_depth_of_field_blur"),t=new po({name:"czm_depth_of_field_composite",fragmentShader:MN,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 jc({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=zn();return new po({name:`czm_edge_detection_${e}`,fragmentShader:NN,uniforms:{length:.25,color:z.clone(z.BLACK)}})};Lr.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function dlt(e){if(!u(e))return Lr.createEdgeDetectionStage();let t=new jc({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 po({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new jc({name:"czm_edge_detection_composite",stages:[t,s]})}Lr.createSilhouetteStage=function(e){let t=dlt(e),n=new po({name:"czm_silhouette_color_edges",fragmentShader:GN,uniforms:{silhouetteTexture:t.name}});return new jc({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 po({name:"czm_bloom_contrast_bias",fragmentShader:BN,uniforms:{contrast:128,brightness:-.3}}),t=O4("czm_bloom_blur"),n=new jc({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new po({name:"czm_bloom_generate_composite",fragmentShader:ON,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 jc({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Lr.createAmbientOcclusionStage=function(){let e=new po({name:"czm_ambient_occlusion_generate",fragmentShader:wN,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=O4("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;let n=new jc({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new po({name:"czm_ambient_occlusion_composite",fragmentShader:IN,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(r){e.uniforms.intensity=r}},bias:{get:function(){return e.uniforms.bias},set:function(r){e.uniforms.bias=r}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(r){e.uniforms.lengthCap=r}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(r){e.uniforms.stepSize=r}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(r){e.uniforms.frustumLength=r}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(r){e.uniforms.randomTexture=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}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(r){i.uniforms.ambientOcclusionOnly=r}}}),new jc({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};Lr.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};var hlt=`#define FXAA_QUALITY_PRESET 39 
${kM}
${VN}`;Lr.createFXAAStage=function(){return new po({name:"czm_FXAA",fragmentShader:hlt,sampleMode:Du.LINEAR})};Lr.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=vN,new po({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=FN,new po({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=HN,new po({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};Lr.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=kN,new po({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:z.WHITE,autoExposure:void 0}})};Lr.createAutoExposureStage=function(){return new WN};Lr.createBlackAndWhiteStage=function(){return new po({name:"czm_black_and_white",fragmentShader:PN,uniforms:{gradations:5}})};Lr.createBrightnessStage=function(){return new po({name:"czm_brightness",fragmentShader:RN,uniforms:{brightness:.5}})};Lr.createNightVisionStage=function(){return new po({name:"czm_night_vision",fragmentShader:zN})};Lr.createDepthViewStage=function(){return new po({name:"czm_depth_view",fragmentShader:LN})};Lr.createLensFlareStage=function(){return new po({name:"czm_lens_flare",fragmentShader:UN,uniforms:{dirtTexture:$t("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:$t("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:ie.WGS84.maximumRadius}})};var Bf=Lr;function M_(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function YN(e){for(;u(e.length);)e=e.get(e.length-1);return e.name}function aq(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;let r=n[i.name]={};if(u(o)){let a=e.getStageByName(o);r[YN(a)]=!0}let s=i.uniforms;if(u(s)){let a=Object.getOwnPropertyNames(s),c=a.length;for(let l=0;l<c;++l){let f=s[a[l]];if(typeof f=="string"){let d=e.getStageByName(f);u(d)&&(r[YN(d)]=!0)}}}return i.name}function jN(e,t,n,i,o){if(u(i.enabled)&&!i.enabled||u(i._isSupported)&&!i._isSupported(t))return o;let r=o,s=!u(i.inputPreviousStageTexture)||i.inputPreviousStageTexture,a=o,c=i.length;for(let d=0;d<c;++d){let p=i.get(d);u(p.length)?a=jN(e,t,n,p,o):a=aq(e,t,n,p,o),s&&(o=a)}let l,f;if(s)for(l=1;l<c;++l)f=YN(i.get(l)),u(n[f])||(n[f]={}),n[f][r]=!0;else for(l=1;l<c;++l){f=YN(i.get(l));let d=n[f];for(let p=0;p<l;++p)d[YN(i.get(p))]=!0}return a}function mlt(e,t){let n={};if(u(e.ambientOcclusion)){let i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa,a=jN(e,t,n,i,void 0);a=jN(e,t,n,o,a),a=aq(e,t,n,r,a),a=jN(e,t,n,e,a),aq(e,t,n,s,a)}else jN(e,t,n,e,void 0);return n}function plt(e,t,n){let o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,c=o._pixelDatatype,l=o._clearColor,f,d,p=e._framebuffers,g=p.length;for(f=0;f<g;++f){if(d=p[f],r!==d.textureScale||s!==d.forcePowerOfTwo||a!==d.pixelFormat||c!==d.pixelDatatype||!z.equals(l,d.clearColor))continue;let m=d.stages,A=m.length,x=!1;for(let C=0;C<A;++C)if(n[m[C]]){x=!0;break}if(!x)break}return u(d)&&f<g?(d.stages.push(t),d):(d={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:c,clearColor:l,stages:[t],buffer:new mi({pixelFormat:a,pixelDatatype:c}),clear:void 0},p.push(d),d)}function _lt(e,t){let n=mlt(e._collection,t);for(let i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=plt(e,i,n[i]))}function cq(e){let t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function glt(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],c=a.textureScale,l=Math.ceil(n*c),f=Math.ceil(i*c),d=Math.min(l,f);a.forcePowerOfTwo&&(P.isPowerOfTwo(d)||(d=P.nextPowerOfTwo(d)),l=d,f=d),a.buffer.update(t,l,f),a.clear=new ii({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}M_.prototype.updateDependencies=function(){this._updateDependencies=!0};M_.prototype.update=function(e){let t=this._collection,n=this._updateDependencies,i=u(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=u(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=u(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=u(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!u(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(cq(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&_lt(this,e);let c=e.drawingBufferWidth,l=e.drawingBufferHeight,f=this._width!==c||this._height!==l;!n&&!f||(this._width=c,this._height=l,this._updateDependencies=!1,cq(this),glt(this,e))};M_.prototype.clear=function(e){let t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};M_.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};M_.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};M_.prototype.getFramebuffer=function(e){let t=this._stageNameToFramebuffer[e];if(u(t))return t.buffer.framebuffer};M_.prototype.isDestroyed=function(){return!1};M_.prototype.destroy=function(){return cq(this),le(this)};var oC=M_;var qN={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===qN.REINHARD||e===qN.MODIFIED_REINHARD||e===qN.FILMIC||e===qN.ACES}},Yy=Object.freeze(qN);var lq=[];function Yc(){let e=Bf.createFXAAStage(),t=Bf.createAmbientOcclusionStage(),n=Bf.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=Bf.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=Yy.ACES;let i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;let o=new oC(this),r={},s=lq;for(s.push(e,t,n,i);s.length>0;){let c=s.pop();r[c.name]=c,c._textureCache=o;let l=c.length;if(u(l))for(let f=0;f<l;++f)s.push(c.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(Yc.prototype,{ready:{get:function(){let e=!1,t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){let c=t[a];e=e||c.ready&&c.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 uq(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(u(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(!u(t))continue;if(u(t.selected))return!0;let n=t.length;if(u(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;u(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());let t=this._autoExposureEnabled,n;switch(e){case Yy.REINHARD:n=Bf.createReinhardTonemappingStage(t);break;case Yy.MODIFIED_REINHARD:n=Bf.createModifiedReinhardTonemappingStage(t);break;case Yy.FILMIC:n=Bf.createFilmicTonemappingStage(t);break;default:n=Bf.createAcesTonemappingStage(t);break}if(t){let i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}this._tonemapper=e,this._tonemapping=n,u(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}});function uq(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;let t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){let s=n[o];s&&(s._index=r++,t.push(s))}e._stages=t}Yc.prototype.add=function(e){let t=this._stageNames,n=lq;for(n.push(e);n.length>0;){let o=n.pop();t[o.name]=o,o._textureCache=this._textureCache;let r=o.length;if(u(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};Yc.prototype.remove=function(e){if(!this.contains(e))return!1;let t=this._stageNames,n=lq;for(n.push(e);n.length>0;){let i=n.pop();delete t[i.name];let o=i.length;if(u(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};Yc.prototype.contains=function(e){return u(e)&&u(e._index)&&e._textureCache===this._textureCache};Yc.prototype.get=function(e){return uq(this),this._stages[e]};Yc.prototype.removeAll=function(){let e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};Yc.prototype.getStageByName=function(e){return this._stageNames[e]};Yc.prototype.update=function(e,t,n){uq(this);let i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;let r=this._stages,s=o.length=r.length,a,c,l=0;for(a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&(o[l++]=c);o.length=l;let f=l!==i.length;if(!f){for(a=0;a<l;++a)if(o[a]!==i[a]){f=!0;break}}let d=this._ao,p=this._bloom,g=this._autoExposure,m=this._tonemapping,A=this._fxaa;m.enabled=n;let x=d.enabled&&d._isSupported(e),C=p.enabled&&p._isSupported(e),T=m.enabled&&m._isSupported(e),E=A.enabled&&A._isSupported(e);if((f||this._textureCacheDirty||x!==this._aoEnabled||C!==this._bloomEnabled||T!==this._tonemappingEnabled||E!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=x,this._bloomEnabled=C,this._tonemappingEnabled=T,this._fxaaEnabled=E,this._textureCacheDirty=!1),u(this._randomTexture)&&!x&&(this._randomTexture.destroy(),this._randomTexture=void 0),!u(this._randomTexture)&&x){s=256*256*3;let S=new Uint8Array(s);for(a=0;a<s;a+=3)S[a]=Math.floor(Math.random()*255);this._randomTexture=new It({context:e,pixelFormat:rt.RGB,pixelDatatype:Xe.UNSIGNED_BYTE,source:{arrayBufferView:S,width:256,height:256},sampler:new ln({wrapS:vn.REPEAT,wrapT:vn.REPEAT,minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST})})}for(this._textureCache.update(e),A.update(e,t),d.update(e,t),p.update(e,t),m.update(e,t),this._autoExposureEnabled&&g.update(e,t),s=r.length,a=0;a<s;++a)r[a].update(e,t);for(l=0,a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&l++;f=l!==o.length,f&&this.update(e,t,n)};Yc.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function rC(e){for(;u(e.length);)e=e.get(e.length-1);return e.outputTexture}Yc.prototype.getOutputTexture=function(e){let t=this.getStageByName(e);if(u(t))return rC(t)};function xm(e,t,n,i,o){if(u(e.execute)){e.execute(t,n,i,o);return}let r=e.length,s;if(e.inputPreviousStageTexture)for(xm(e.get(0),t,n,i,o),s=1;s<r;++s)xm(e.get(s),t,rC(e.get(s-1)),i,o);else for(s=0;s<r;++s)xm(e.get(s),t,n,i,o)}Yc.prototype.execute=function(e,t,n,i){let o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,c=this._bloom,l=this._autoExposure,f=this._tonemapping,d=a.enabled&&a._isSupported(e),p=c.enabled&&c._isSupported(e),g=this._autoExposureEnabled,m=f.enabled&&f._isSupported(e),A=s.enabled&&s._isSupported(e);if(!A&&!d&&!p&&!m&&r===0)return;let x=t;d&&a.ready&&(xm(a,e,x,n,i),x=rC(a)),p&&c.ready&&(xm(c,e,x,n,i),x=rC(c)),g&&l.ready&&xm(l,e,x,n,i),m&&f.ready&&(xm(f,e,x,n,i),x=rC(f));let C=x;if(r>0){xm(o[0],e,x,n,i);for(let T=1;T<r;++T)xm(o[T],e,rC(o[T-1]),n,i);C=rC(o[r-1])}A&&s.ready&&xm(s,e,C,n,i)};Yc.prototype.copy=function(e,t){if(!u(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(Il,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Yc.prototype.isDestroyed=function(){return!1};Yc.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(),le(this)};var XN=Yc;function sC(e){this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}sC.prototype.completeMorph=function(){u(this._completeMorph)&&this._completeMorph()};sC.prototype.morphTo2D=function(e,t){u(this._completeMorph)&&this._completeMorph();let n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof en,!(this._previousMode===te.SCENE2D||this._previousMode===te.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,te.SCENE2D,!0),n._mode=te.MORPHING,n.camera._setTransform(M.IDENTITY),this._previousMode===te.COLUMBUS_VIEW?Zlt(this,e):iut(this,e,t),e===0&&u(this._completeMorph)&&this._completeMorph())};var ylt=new h,Alt=new h,xlt=new h,Clt=new h,Tlt=new h,Elt=new h,blt=new h,Slt=new he,Dlt=new M,vlt=new Ti,wlt=new en,Ilt={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};sC.prototype.morphToColumbusView=function(e,t){u(this._completeMorph)&&this._completeMorph();let n=this._scene;if(this._previousMode=n.mode,this._previousMode===te.COLUMBUS_VIEW||this._previousMode===te.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,te.COLUMBUS_VIEW,!0),n.camera._setTransform(M.IDENTITY);let i=ylt,o=Alt,r=xlt;if(e>0)i.x=0,i.y=-1,i.z=1,i=h.multiplyByScalar(h.normalize(i,i),5*t.maximumRadius,i),h.negate(h.normalize(i,o),o),h.cross(h.UNIT_X,o,r);else{let l=n.camera;if(this._previousMode===te.SCENE2D)h.clone(l.position,i),i.z=l.frustum.right-l.frustum.left,h.negate(h.UNIT_Z,o),h.clone(h.UNIT_Y,r);else{h.clone(l.positionWC,i),h.clone(l.directionWC,o),h.clone(l.upWC,r);let f=t.scaleToGeodeticSurface(i,blt),d=Ot.eastNorthUpToFixedFrame(f,t,Dlt);M.inverseTransformation(d,d),n.mapProjection.project(t.cartesianToCartographic(i,Slt),i),M.multiplyByPointAsVector(d,o,o),M.multiplyByPointAsVector(d,r,r)}}let s;this._morphToOrthographic?(s=wlt,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=vlt,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=P.toRadians(60));let a=Ilt;a.position=i,a.direction=o,a.up=r,a.frustum=s;let c=rut(a);KN(this,c),this._previousMode===te.SCENE2D?out(this,e,a,c):(a.position2D=M.multiplyByPoint(ro.TRANSFORM_2D,i,Clt),a.direction2D=M.multiplyByPointAsVector(ro.TRANSFORM_2D,o,Tlt),a.up2D=M.multiplyByPointAsVector(ro.TRANSFORM_2D,r,Elt),n._mode=te.MORPHING,yye(this,e,a,c)),e===0&&u(this._completeMorph)&&this._completeMorph()};var hq={position:new h,direction:new h,up:new h,frustum:void 0},lye=new Ti;sC.prototype.morphTo3D=function(e,t){u(this._completeMorph)&&this._completeMorph();let n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===te.SCENE3D||this._previousMode===te.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,te.SCENE3D,!0),n._mode=te.MORPHING,n.camera._setTransform(M.IDENTITY),this._previousMode===te.SCENE2D)klt(this,e,t);else{let i;e>0?(i=hq,h.fromDegrees(0,0,5*t.maximumRadius,t,i.position),h.negate(i.position,i.direction),h.normalize(i.direction,i.direction),h.clone(h.UNIT_Z,i.up)):i=uye(this,t);let o,r=n.camera;r.frustum instanceof en?o=r.frustum.clone():(o=lye,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=P.toRadians(60)),i.frustum=o;let s=xye(i);KN(this,s),dq(this,e,i,s)}e===0&&u(this._completeMorph)&&this._completeMorph()}};sC.prototype.isDestroyed=function(){return!1};sC.prototype.destroy=function(){return R4(this),le(this)};function KN(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new Tu(e._scene.canvas);let n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,yn.LEFT_DOWN),e._morphHandler.setInputAction(n,yn.MIDDLE_DOWN),e._morphHandler.setInputAction(n,yn.RIGHT_DOWN),e._morphHandler.setInputAction(n,yn.WHEEL)}}function R4(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 Plt=new he,Olt=new h,Rlt=new M;function uye(e,t){let n=e._scene,i=n.camera,o=hq,r=o.position,s=o.direction,a=o.up,c=n.mapProjection.unproject(i.position,Plt);t.cartographicToCartesian(c,r);let l=t.scaleToGeodeticSurface(r,Olt),f=Ot.eastNorthUpToFixedFrame(l,t,Rlt);return M.multiplyByPointAsVector(f,i.direction,s),M.multiplyByPointAsVector(f,i.up,a),o}var Blt=new h,Mlt=new h,Llt=new h,Nlt=new h,Flt=new h,Vlt=new h;function dq(e,t,n,i){t*=.5;let o=e._scene,r=o.camera,s=h.clone(r.position,Blt),a=h.clone(r.direction,Mlt),c=h.clone(r.up,Llt),l=M.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,n.position,Nlt),f=M.multiplyByPointAsVector(ro.TRANSFORM_2D_INVERSE,n.direction,Flt),d=M.multiplyByPointAsVector(ro.TRANSFORM_2D_INVERSE,n.up,Vlt);function p(m){Mf(s,l,m.time,r.position),Mf(a,f,m.time,r.direction),Mf(c,d,m.time,r.up),h.cross(r.direction,r.up,r.right),h.normalize(r.right,r.right)}let g=o.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){Aye(e,o,0,1,t,i)}});e._currentTweens.push(g)}var Ult=new en,fye=new h,dye=new h,hye=new h,mq=new h,mye=new h,pye=new h;function klt(e,t,n){t/=3;let i=e._scene,o=i.camera,r;t>0?(r=hq,h.fromDegrees(0,0,5*n.maximumRadius,n,r.position),h.negate(r.position,r.direction),h.normalize(r.direction,r.direction),h.clone(h.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=uye(e,n));let s;e._morphToOrthographic?(s=Ult,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=lye,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=P.toRadians(60)),r.frustum=s;let a=xye(r);KN(e,a);let c;e._morphToOrthographic?c=function(){dq(e,t,r,a)}:c=function(){gye(e,t,r,function(){dq(e,t,r,a)})},t>0?(i._mode=te.SCENE2D,o.flyTo({duration:t,destination:h.fromDegrees(0,0,5*n.maximumRadius,n,mq),complete:function(){i._mode=te.MORPHING,c()}})):c()}function Mf(e,t,n,i){return h.lerp(e,t,n,i)}function _ye(e,t,n,i,o){let r=e._scene,s=r.camera;if(s.frustum instanceof en)return;let a=s.frustum.fov,c=P.RADIANS_PER_DEGREE*.5,l=n.position.z*Math.tan(a*.5);s.frustum.far=l/Math.tan(c*.5)+1e7;function f(p){s.frustum.fov=P.lerp(a,c,p.time);let g=l/Math.tan(s.frustum.fov*.5);i(s,g)}let d=r.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(d)}var zlt=new h,Hlt=new h,Glt=new h,fq=new h,Wlt=new h,jlt=new h,Ylt=new Tr,qlt=new wn,Xlt=new h,Klt={position:void 0,direction:void 0,up:void 0,frustum:void 0};function Zlt(e,t){t*=.5;let n=e._scene,i=n.camera,o=h.clone(i.position,zlt),r=h.clone(i.direction,Hlt),s=h.clone(i.up,Glt),a=h.negate(h.UNIT_Z,Wlt),c=h.clone(h.UNIT_Y,jlt),l=fq;if(t>0)h.clone(h.ZERO,fq),l.z=5*n.mapProjection.ellipsoid.maximumRadius;else{h.clone(o,fq);let x=qlt;M.multiplyByPoint(ro.TRANSFORM_2D,o,x.origin),M.multiplyByPointAsVector(ro.TRANSFORM_2D,r,x.direction);let C=n.globe;if(u(C)){let T=C.pickWorldCoordinates(x,n,!0,Xlt);u(T)&&(M.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,T,l),l.z+=h.distance(o,l))}}let f=Ylt;f.right=l.z*.5,f.left=-f.right,f.top=f.right*(n.drawingBufferHeight/n.drawingBufferWidth),f.bottom=-f.top;let d=Klt;d.position=l,d.direction=a,d.up=c,d.frustum=f;let p=Cye(d);KN(e,p);function g(x){Mf(o,l,x.time,i.position),Mf(r,a,x.time,i.direction),Mf(s,c,x.time,i.up),h.cross(i.direction,i.up,i.right),h.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function m(x,C){x.position.z=C}let A=n.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){_ye(e,t,d,m,p)}});e._currentTweens.push(A)}var cye=new he,Jlt={position:new h,direction:new h,up:new h,position2D:new h,direction2D:new h,up2D:new h,frustum:new Tr},Qlt={position:new h,direction:new h,up:new h,frustum:void 0},$lt=new h,eut=new wn,tut=new M,nut=new h;function iut(e,t,n){t*=.5;let i=e._scene,o=i.camera,r=Jlt;if(t>0)h.clone(h.ZERO,r.position),r.position.z=5*n.maximumRadius,h.negate(h.UNIT_Z,r.direction),h.clone(h.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,cye),i.mapProjection.project(cye,r.position),h.negate(h.UNIT_Z,r.direction),h.clone(h.UNIT_Y,r.up);let d=eut;h.clone(r.position2D,d.origin);let p=h.clone(o.directionWC,d.direction),g=n.scaleToGeodeticSurface(o.positionWC,nut),m=Ot.eastNorthUpToFixedFrame(g,n,tut);M.inverseTransformation(m,m),M.multiplyByPointAsVector(m,p,p),M.multiplyByPointAsVector(ro.TRANSFORM_2D,p,p);let A=i.globe;if(u(A)){let x=A.pickWorldCoordinates(d,i,!0,$lt);if(u(x)){let C=h.distance(r.position2D,x);x.x+=C,h.clone(x,r.position2D)}}}function s(d,p){d.position.x=p}M.multiplyByPoint(ro.TRANSFORM_2D,r.position,r.position2D),M.multiplyByPointAsVector(ro.TRANSFORM_2D,r.direction,r.direction2D),M.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 c=Qlt;M.multiplyByPoint(ro.TRANSFORM_2D_INVERSE,r.position2D,c.position),h.clone(r.direction,c.direction),h.clone(r.up,c.up),c.frustum=a;let l=Cye(c);KN(e,l);function f(){_ye(e,t,r,s,l)}yye(e,t,r,f)}function gye(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,c=P.RADIANS_PER_DEGREE*.5,l=s*Math.tan(a*.5);r.frustum.far=l/Math.tan(c*.5)+1e7,r.frustum.fov=c;function f(p){r.frustum.fov=P.lerp(c,a,p.time),r.position.z=l/Math.tan(r.frustum.fov*.5)}let d=o.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){i(e)}});e._currentTweens.push(d)}function out(e,t,n,i){t*=.5;let o=e._scene,r=o.camera,s=h.clone(n.position,mq),a=h.clone(n.direction,mye),c=h.clone(n.up,pye);o._mode=te.MORPHING;function l(){r.frustum=n.frustum.clone();let f=h.clone(r.position,fye),d=h.clone(r.direction,dye),p=h.clone(r.up,hye);f.z=s.z;function g(A){Mf(f,s,A.time,r.position),Mf(d,a,A.time,r.direction),Mf(p,c,A.time,r.up),h.cross(r.direction,r.up,r.right),h.normalize(r.right,r.right)}let m=o.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(m)}e._morphToOrthographic?l():gye(e,0,n,l)}function yye(e,t,n,i){let o=e._scene,r=o.camera,s=h.clone(r.position,fye),a=h.clone(r.direction,dye),c=h.clone(r.up,hye),l=h.clone(n.position2D,mq),f=h.clone(n.direction2D,mye),d=h.clone(n.up2D,pye);function p(m){Mf(s,l,m.time,r.position),Mf(a,f,m.time,r.direction),Mf(c,d,m.time,r.up),h.cross(r.direction,r.up,r.right),h.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}let g=o.tweens.add({duration:t,easingFunction:Mr.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:p,complete:function(){Aye(e,o,1,0,t,i)}});e._currentTweens.push(g)}function Aye(e,t,n,i,o,r){let s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:Mr.QUARTIC_OUT};u(r)&&(s.complete=function(){r(e)});let a=t.tweens.addProperty(s);e._currentTweens.push(a)}function xye(e){return function(t){let n=t._scene;n._mode=te.SCENE3D,n.morphTime=te.getMorphTime(te.SCENE3D),R4(t);let i=n.camera;(t._previousMode!==te.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,h.clone(e.position,i.position),h.clone(e.direction,i.direction),h.clone(e.up,i.up),h.cross(i.direction,i.up,i.right),h.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=u(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,te.SCENE3D,r)}}function Cye(e){return function(t){let n=t._scene;n._mode=te.SCENE2D,n.morphTime=te.getMorphTime(te.SCENE2D),R4(t);let i=n.camera;h.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,h.clone(e.direction,i.direction),h.clone(e.up,i.up),h.cross(i.direction,i.up,i.right),h.normalize(i.right,i.right),i.frustum=e.frustum.clone();let o=u(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,te.SCENE2D,o)}}function rut(e){return function(t){let n=t._scene;n._mode=te.COLUMBUS_VIEW,n.morphTime=te.getMorphTime(te.COLUMBUS_VIEW),R4(t);let i=n.camera;(t._previousModeMode!==te.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,h.clone(e.position,i.position),h.clone(e.direction,i.direction),h.clone(e.up,i.up),h.cross(i.direction,i.up,i.right),h.normalize(i.right,i.right));let o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);let r=u(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,te.COLUMBUS_VIEW,r)}}var ZN=sC;var sut={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Ii=Object.freeze(sut);function fc(e,t){let n=e;return u(t)&&(n+=`+${t}`),n}function aut(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 Tye(e,t,n){let i=fc(Ii.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,c=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new H;let l=e._movement[i];u(l)||(l=e._movement[i]={}),l.distance={startPosition:new H,endPosition:new H},l.angleAndHeight={startPosition:new H,endPosition:new H},l.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])},yn.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,c[i]=new Date},yn.PINCH_END,t),e._eventHandler.setInputAction(function(f){if(r[i]){o[i]?(aut(f,l),o[i]=!1,l.prevAngle=l.angleAndHeight.startPosition.x):(H.clone(f.distance.endPosition,l.distance.endPosition),H.clone(f.angleAndHeight.endPosition,l.angleAndHeight.endPosition));let d=l.angleAndHeight.endPosition.x,p=l.prevAngle,g=Math.PI*2;for(;d>=p+Math.PI;)d-=g;for(;d<p-Math.PI;)d+=g;l.angleAndHeight.endPosition.x=-d*n.clientWidth/12,l.angleAndHeight.startPosition.x=-p*n.clientWidth/12}},yn.PINCH_MOVE,t)}function Eye(e,t){let n=fc(Ii.WHEEL,t),i=e._update;i[n]=!0;let o=e._movement[n];u(o)||(o=e._movement[n]={}),o.startPosition=new H,o.endPosition=new H,e._eventHandler.setInputAction(function(r){let s=15*P.toRadians(r);i[n]?(H.clone(H.ZERO,o.startPosition),o.endPosition.x=0,o.endPosition.y=s,i[n]=!1):o.endPosition.y=o.endPosition.y+s},yn.WHEEL,t)}function hS(e,t,n){let i=fc(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new H;let c=e._lastMovement[i];u(c)||(c=e._lastMovement[i]={startPosition:new H,endPosition:new H,valid:!1});let l,f;n===Ii.LEFT_DRAG?(l=yn.LEFT_DOWN,f=yn.LEFT_UP):n===Ii.RIGHT_DRAG?(l=yn.RIGHT_DOWN,f=yn.RIGHT_UP):n===Ii.MIDDLE_DRAG&&(l=yn.MIDDLE_DOWN,f=yn.MIDDLE_UP),e._eventHandler.setInputAction(function(d){e._buttonsDown++,c.valid=!1,o[i]=!0,s[i]=new Date,H.clone(d.position,r[i])},l,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date},f,t)}function bye(e,t){H.clone(e.startPosition,t.startPosition),H.clone(e.endPosition,t.endPosition)}function Sye(e,t){let n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(let s in Ii)if(Ii.hasOwnProperty(s)){let a=Ii[s];if(u(a)){let c=fc(a,t);n[c]=!0,u(e._lastMovement[c])||(e._lastMovement[c]={startPosition:new H,endPosition:new H,valid:!1}),u(e._movement[c])||(e._movement[c]={startPosition:new H,endPosition:new H})}}e._eventHandler.setInputAction(function(s){for(let a in Ii)if(Ii.hasOwnProperty(a)){let c=Ii[a];if(u(c)){let l=fc(c,t);r[l]&&(n[l]?(bye(i[l],o[l]),o[l].valid=!0,bye(s,i[l]),n[l]=!1):H.clone(s.endPosition,i[l].endPosition))}}H.clone(s.endPosition,e._currentMousePosition)},yn.MOUSE_MOVE,t)}function Lf(e){this._eventHandler=new Tu(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new H,Eye(this,void 0),Tye(this,void 0,e),hS(this,void 0,Ii.LEFT_DRAG),hS(this,void 0,Ii.RIGHT_DRAG),hS(this,void 0,Ii.MIDDLE_DRAG),Sye(this,void 0);for(let t in Js)if(Js.hasOwnProperty(t)){let n=Js[t];u(n)&&(Eye(this,n),Tye(this,n,e),hS(this,n,Ii.LEFT_DRAG),hS(this,n,Ii.RIGHT_DRAG),hS(this,n,Ii.MIDDLE_DRAG),Sye(this,n))}}Object.defineProperties(Lf.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){let e=!this._update[fc(Ii.WHEEL)]||!this._update[fc(Ii.WHEEL,Js.SHIFT)]||!this._update[fc(Ii.WHEEL,Js.CTRL)]||!this._update[fc(Ii.WHEEL,Js.ALT)];return this._buttonsDown>0||e}}});Lf.prototype.isMoving=function(e,t){let n=fc(e,t);return!this._update[n]};Lf.prototype.getMovement=function(e,t){let n=fc(e,t);return this._movement[n]};Lf.prototype.getLastMovement=function(e,t){let n=fc(e,t),i=this._lastMovement[n];if(i.valid)return i};Lf.prototype.isButtonDown=function(e,t){let n=fc(e,t);return this._isDown[n]};Lf.prototype.getStartMousePosition=function(e,t){if(e===Ii.WHEEL)return this._currentMousePosition;let n=fc(e,t);return this._eventStartPosition[n]};Lf.prototype.getButtonPressTime=function(e,t){let n=fc(e,t);return this._pressTime[n]};Lf.prototype.getButtonReleaseTime=function(e,t){let n=fc(e,t);return this._releaseTime[n]};Lf.prototype.reset=function(){for(let e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};Lf.prototype.isDestroyed=function(){return!1};Lf.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),le(this)};var JN=Lf;function B4(e,t,n,i,o,r,s,a,c,l){this._tweens=e,this._tweenjs=t,this._startObject=Ge(n),this._stopObject=Ge(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=c,this.cancel=l,this.needsStart=!0}Object.defineProperties(B4.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}}});B4.prototype.cancelTween=function(){this._tweens.remove(this)};function oh(){this._tweens=[]}Object.defineProperties(oh.prototype,{length:{get:function(){return this._tweens.length}}});oh.prototype.add=function(e){if(e=y(e,y.EMPTY_OBJECT),e.duration===0)return u(e.complete)&&e.complete(),new B4(this);let t=e.duration/Qn.SECONDS_PER_MILLISECOND,n=y(e.delay,0),i=n/Qn.SECONDS_PER_MILLISECOND,o=y(e.easingFunction,Mr.LINEAR_NONE),r=e.startObject,s=new Hhe(r);s.to(Ge(e.stopObject),t),s.delay(i),s.easing(o),u(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(y(e.complete,null)),s.repeat(y(e._repeat,0));let a=new B4(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};oh.prototype.addProperty=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.object,n=e.property,i=e.startValue,o=e.stopValue;function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};oh.prototype.addAlpha=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.material,n=[];for(let o in t.uniforms)t.uniforms.hasOwnProperty(o)&&u(t.uniforms[o])&&u(t.uniforms[o].alpha)&&n.push(o);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:y(e.startValue,0)},stopObject:{alpha:y(e.stopValue,1)},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};oh.prototype.addOffsetIncrement=function(e){e=y(e,y.EMPTY_OBJECT);let n=e.material.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})};oh.prototype.remove=function(e){if(!u(e))return!1;let t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),u(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};oh.prototype.removeAll=function(){let e=this._tweens;for(let t=0;t<e.length;++t){let n=e[t];n.tweenjs.stop(),u(n.cancel)&&n.cancel()}e.length=0};oh.prototype.contains=function(e){return u(e)&&this._tweens.indexOf(e)!==-1};oh.prototype.get=function(e){return this._tweens[e]};oh.prototype.update=function(e){let t=this._tweens,n=0;for(e=u(e)?e/Qn.SECONDS_PER_MILLISECOND:di();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 aC=oh;function $N(e){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.translateEventTypes=Ii.LEFT_DRAG,this.zoomEventTypes=[Ii.RIGHT_DRAG,Ii.WHEEL,Ii.PINCH],this.rotateEventTypes=Ii.LEFT_DRAG,this.tiltEventTypes=[Ii.MIDDLE_DRAG,Ii.PINCH,{eventType:Ii.LEFT_DRAG,modifier:Js.CTRL},{eventType:Ii.RIGHT_DRAG,modifier:Js.CTRL}],this.lookEventTypes={eventType:Ii.LEFT_DRAG,modifier:Js.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._aggregator=new JN(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 aC,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new H(-1,-1),this._tiltCenter=new h,this._rotateMousePosition=new H(-1,-1),this._rotateStartPosition=new h,this._strafeStartPosition=new h,this._strafeMousePosition=new H,this._strafeEndMousePosition=new H,this._zoomMouseStart=new H(-1,-1),this._zoomWorldPosition=new h,this._useZoomWorldPosition=!1,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 t=e.mapProjection;this._maxCoord=t.project(new he(Math.PI,P.PI_OVER_TWO)),this._zoomFactor=5,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 cut(e,t){if(e<0)return 0;let n=(1-t)*25;return Math.exp(-n*e)}function lut(e){return H.equalsEpsilon(e.startPosition,e.endPosition,P.EPSILON14)}var uut=.4;function fut(e,t,n,i,o,r,s){let a=r[s];u(a)||(a=r[s]={startPosition:new H,endPosition:new H,motion:new H,inertiaEnabled:!0});let c=e.getButtonPressTime(t,n),l=e.getButtonReleaseTime(t,n),f=c&&l&&(l.getTime()-c.getTime())/1e3,d=new Date,p=l&&(d.getTime()-l.getTime())/1e3;if(c&&l&&f<uut){let g=cut(p,i),m=e.getLastMovement(t,n);if(!u(m)||lut(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 A=e.getStartMousePosition(t,n);o(r,A,a)}}}function dut(e,t){if(u(t)){let n=e[t];u(n)&&(n.inertiaEnabled=!0);let i=e._inertiaDisablers[t];if(u(i)){let o=i.length;for(let r=0;r<o;++r)n=e[i[r]],u(n)&&(n.inertiaEnabled=!1)}}}var Dye=[];function qc(e,t,n,i,o,r){if(!u(n))return;let s=e._aggregator;Array.isArray(n)||(Dye[0]=n,n=Dye);let a=n.length;for(let c=0;c<a;++c){let l=n[c],f=u(l.eventType)?l.eventType:l,d=l.modifier,p=s.isMoving(f,d)&&s.getMovement(f,d),g=s.getStartMousePosition(f,d);e.enableInputs&&t&&(p?(i(e,g,p),dut(e,r)):o<1&&fut(s,f,d,o,i,e,r))}}var M4=new wn,hut=new h,mut=new H,put=new h,_ut=new H,gut=new h,yut=new h,Aut=new h,xut=new h,Cut=new h,Tut=new h,Eut=new h,but=new h,Sut=new h,Dut=new h,vut=new h,wut=new h,Iut=new h,Put=new h,Out=new h,cC=new h,vye=new h,wye=new h,pq={orientation:new Ba};function Eq(e,t,n,i,o,r){let s=1;u(r)&&(s=P.clamp(Math.abs(r),.25,1));let a=n.endPosition.y-n.startPosition.y,l=a>0?e.minimumZoomDistance*s:0,f=e.maximumZoomDistance,d=o-l,p=i*d;p=P.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||!u(e._globe)){if(m>0&&Math.abs(o-l)<1||m<0&&Math.abs(o-f)<1)return;o-m<l?m=o-l-1:o-m>f&&(m=o-f)}let A=e._scene,x=A.camera,C=A.mode,T=pq.orientation;if(T.heading=x.heading,T.pitch=x.pitch,T.roll=x.roll,x.frustum instanceof en){Math.abs(m)>0&&(x.zoomIn(m),x._adjustOrthographicFrustum());return}let E=H.equals(t,e._zoomMouseStart),S=e._zoomingOnVector,D=e._rotatingZoom,w;if(E||(e._zoomMouseStart=H.clone(t,e._zoomMouseStart),u(e._globe)&&(C===te.SCENE2D?(w=x.getPickRay(t,M4).origin,w=h.fromElements(w.y,w.z,w.x)):w=qy(e,t,hut)),u(w)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=h.clone(w,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,S=e._zoomingOnVector=!1,D=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){x.zoomIn(m);return}let R=C===te.COLUMBUS_VIEW;if(x.positionCartographic.height<2e6&&(D=!0),!E||D){if(C===te.SCENE2D){let O=e._zoomWorldPosition,L=x.position;if(!h.equals(O,L)&&x.positionCartographic.height<e._maxCoord.x*2){let N=x.position.x,_=h.subtract(O,L,put);h.normalize(_,_);let b=h.distance(O,L)*m/(x.getMagnitude()*.5);x.move(_,b*.5),(x.position.x<0&&N>0||x.position.x>0&&N<0)&&(w=x.getPickRay(t,M4).origin,w=h.fromElements(w.y,w.z,w.x),e._zoomWorldPosition=h.clone(w,e._zoomWorldPosition))}}else if(C===te.SCENE3D){let O=h.normalize(x.position,Cut);if(e._cameraUnderground||e._zoomingUnderground||x.positionCartographic.height<3e3&&Math.abs(h.dot(x.direction,O))<.6)R=!0;else{let L=A.canvas,N=_ut;N.x=L.clientWidth/2,N.y=L.clientHeight/2;let _=qy(e,N,gut);if(!u(_))R=!0;else if(x.positionCartographic.height<1e6)if(h.dot(x.direction,O)>=-.5)R=!0;else{let b=Eut;h.clone(x.position,b);let v=e._zoomWorldPosition,I=Tut;if(I=h.normalize(v,I),h.dot(I,O)<0)return;let B=Out,F=Dut;h.clone(x.direction,F),h.add(b,h.multiplyByScalar(F,1e3,cC),B);let k=vut,U=wut;h.subtract(v,b,k),h.normalize(k,U);let G=h.dot(O,U);if(G>=0){e._zoomMouseStart.x=-1;return}let V=Math.acos(-G),X=h.magnitude(b),j=h.magnitude(v),Q=X-m,W=h.magnitude(k),K=Math.asin(P.clamp(W/j*Math.sin(V),-1,1)),J=Math.asin(P.clamp(Q/j*Math.sin(V),-1,1)),_e=K-J+V,xe=but;h.normalize(b,xe);let re=Sut;re=h.cross(U,xe,re),re=h.normalize(re,re),h.normalize(h.cross(xe,re,cC),F),h.multiplyByScalar(h.normalize(B,cC),h.magnitude(B)-m,B),h.normalize(b,b),h.multiplyByScalar(b,Q,b);let ye=Iut;h.multiplyByScalar(h.add(h.multiplyByScalar(xe,Math.cos(_e)-1,vye),h.multiplyByScalar(F,Math.sin(_e),wye),cC),Q,ye),h.add(b,ye,b),h.normalize(B,xe),h.normalize(h.cross(xe,re,cC),F);let fe=Put;h.multiplyByScalar(h.add(h.multiplyByScalar(xe,Math.cos(_e)-1,vye),h.multiplyByScalar(F,Math.sin(_e),wye),cC),h.magnitude(B),fe),h.add(B,fe,B),h.clone(b,x.position),h.normalize(h.subtract(B,b,cC),x.direction),h.clone(x.direction,x.direction),h.cross(x.direction,x.up,x.right),h.cross(x.right,x.direction,x.up),x.setView(pq);return}else{let b=h.normalize(_,yut),v=h.normalize(e._zoomWorldPosition,Aut),I=h.dot(v,b);if(I>0&&I<1){let B=P.acosClamped(I),F=h.cross(v,b,xut),k=Math.abs(B)>P.toRadians(20)?x.positionCartographic.height*.75:x.positionCartographic.height-m,U=m/k;x.rotate(F,B*U)}}}}e._rotatingZoom=!R}if(!E&&R||S){let O,L=qi.wgs84ToWindowCoordinates(A,e._zoomWorldPosition,mut);C!==te.COLUMBUS_VIEW&&H.equals(t,e._zoomMouseStart)&&u(L)?O=x.getPickRay(L,M4):O=x.getPickRay(t,M4);let N=O.direction;(C===te.COLUMBUS_VIEW||C===te.SCENE2D)&&h.fromElements(N.y,N.z,N.x,N),x.move(N,m),e._zoomingOnVector=!0}else x.zoomIn(m);e._cameraUnderground||x.setView(pq)}var Rut=new wn,But=new wn,Mut=new h;function Lut(e,t,n){let o=e._scene.camera,r=o.getPickRay(n.startPosition,Rut).origin,s=o.getPickRay(n.endPosition,But).origin;r=h.fromElements(r.y,r.z,r.x,r),s=h.fromElements(s.y,s.z,s.x,s);let a=h.subtract(r,s,Mut),c=h.magnitude(a);c>0&&(h.normalize(a,a),o.move(a,c))}function Iye(e,t,n){u(n.distance)&&(n=n.distance);let o=e._scene.camera;Eq(e,t,n,e._zoomFactor,o.getMagnitude())}var Nut=new H,Fut=new H;function Pye(e,t,n){if(u(n.angleAndHeight)){Vut(e,t,n.angleAndHeight);return}let i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight,c=Nut;c.x=2/s*n.startPosition.x-1,c.y=2/a*(a-n.startPosition.y)-1,c=H.normalize(c,c);let l=Fut;l.x=2/s*n.endPosition.x-1,l.y=2/a*(a-n.endPosition.y)-1,l=H.normalize(l,l);let f=P.acosClamped(c.x);c.y<0&&(f=P.TWO_PI-f);let d=P.acosClamped(l.x);l.y<0&&(d=P.TWO_PI-d);let p=d-f;o.twistRight(p)}function Vut(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 c=i*a*Math.PI*4;r.twistRight(c)}function Uut(e){let t=e._scene.mapMode2D===wl.ROTATE;M.equals(M.IDENTITY,e._scene.camera.transform)?(qc(e,e.enableTranslate,e.translateEventTypes,Lut,e.inertiaTranslate,"_lastInertiaTranslateMovement"),qc(e,e.enableZoom,e.zoomEventTypes,Iye,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&qc(e,e.enableRotate,e.tiltEventTypes,Pye,e.inertiaSpin,"_lastInertiaTiltMovement")):(qc(e,e.enableZoom,e.zoomEventTypes,Iye,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&qc(e,e.enableRotate,e.translateEventTypes,Pye,e.inertiaSpin,"_lastInertiaSpinMovement"))}var Lye=new wn,kut=new h,zut=new h;function qy(e,t,n){let i=e._scene,o=e._globe,r=i.camera;if(!u(o))return;let s=!e._cameraUnderground,a;i.pickPositionSupported&&(a=i.pickPositionWorldCoordinates(t,kut));let c=r.getPickRay(t,Lye),l=o.pickWorldCoordinates(c,i,s,zut),f=u(a)?h.distance(a,r.positionWC):Number.POSITIVE_INFINITY,d=u(l)?h.distance(l,r.positionWC):Number.POSITIVE_INFINITY;return f<d?h.clone(a,n):h.clone(l,n)}var Hut=new he;function k4(e){let t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode,r=0;if(o===te.SCENE3D){let c=t.cartesianToCartographic(i.position,Hut);u(c)&&(r=c.height)}else r=i.position.z;let s=y(e._scene.globeHeight,0);return Math.abs(s-r)}var Gut=new h;function Nye(e,t){let n=t.origin,i=t.direction,o=k4(e),r=h.normalize(n,Gut),s=Math.abs(h.dot(r,i));return s=Math.max(s,.5)*2,o*s}function Fye(e,t,n,i){let o=h.distance(t.origin,n),r=k4(e),s=P.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),wn.getPoint(t,o,i)}function Vye(e,t,n,i){let o;return u(n)?(o=h.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=k4(e))):o=k4(e),wn.getPoint(t,o,i)}var Wut=new H;function Uye(e,t){let n=t.endPosition,i=H.subtract(t.endPosition,t.startPosition,Wut),o=e._strafeEndMousePosition;H.add(o,i,o),t.endPosition=o,bq(e,t,e._strafeStartPosition),t.endPosition=n}var Oye=new wn,jut=new wn,_q=new h,Yut=new h,qut=new h,Xut=new h,Kut=new cn(h.UNIT_X,0),Zut=new H,Jut=new H;function Qut(e,t,n){if(h.equals(t,e._translateMousePosition)||(e._looking=!1),h.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){wu(e,t,n);return}if(e._strafing){Uye(e,n);return}let o=e._scene.camera,r=e._cameraUnderground,s=H.clone(n.startPosition,Zut),a=H.clone(n.endPosition,Jut),c=o.getPickRay(s,Oye),l=h.clone(h.ZERO,Xut),f=h.UNIT_X,d;if(o.position.z<e._minimumPickingTerrainHeight&&(d=qy(e,s,_q),u(d)&&(l.x=d.x)),r||l.x>o.position.z&&u(d)){let E=d;r&&(E=Vye(e,c,d,_q)),H.clone(t,e._strafeMousePosition),H.clone(t,e._strafeEndMousePosition),h.clone(E,e._strafeStartPosition),e._strafing=!0,bq(e,n,e._strafeStartPosition);return}let p=cn.fromPointNormal(l,f,Kut);c=o.getPickRay(s,Oye);let g=Yi.rayPlane(c,p,_q),m=o.getPickRay(a,jut),A=Yi.rayPlane(m,p,Yut);if(!u(g)||!u(A)){e._looking=!0,wu(e,t,n),H.clone(t,e._translateMousePosition);return}let x=h.subtract(g,A,qut),C=x.x;x.x=x.y,x.y=x.z,x.z=C;let T=h.magnitude(x);T>P.EPSILON6&&(h.normalize(x,x),o.move(x,T))}var kye=new H,N4=new wn,F4=new h,$ut=new h,zye=new M,eft=new M,tft=new h,nft=new cn(h.UNIT_X,0),gq=new h,xq=new he,Hye=new M,ift=new Le,oft=new Z,V4=new h;function rft(e,t,n){if(u(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){wu(e,t,n);return}let o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,sft(e,t,n)):aft(e,t,n)}function sft(e,t,n){let i=e._scene,o=i.camera,r=i.canvas,s=kye;s.x=r.clientWidth/2,s.y=r.clientHeight/2;let a=o.getPickRay(s,N4),c=h.UNIT_X,l=a.origin,f=a.direction,d,p=h.dot(c,f);if(Math.abs(p)>P.EPSILON6&&(d=-h.dot(c,l)/p),!u(d)||d<=0){e._looking=!0,wu(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}let g=h.multiplyByScalar(f,d,F4);h.add(l,g,g);let m=i.mapProjection,A=m.ellipsoid;h.fromElements(g.y,g.z,g.x,g);let x=m.unproject(g,xq);A.cartographicToCartesian(x,g);let C=Ot.eastNorthUpToFixedFrame(g,A,zye),T=e._globe,E=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let S=M.clone(o.transform,Hye);o._setTransform(C),vu(e,t,n,h.UNIT_Z),o._setTransform(S),e._globe=T,e._ellipsoid=E;let D=E.maximumRadius;e._rotateFactor=1/D,e._rotateRateRangeAdjustment=D}function aft(e,t,n){let i=e._scene,o=i.camera,r=e._cameraUnderground,s,a,c=h.UNIT_X;if(H.equals(t,e._tiltCenterMousePosition))s=h.clone(e._tiltCenter,F4);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=qy(e,t,F4)),!u(s)){a=o.getPickRay(t,N4);let _=a.origin,b=a.direction,v,I=h.dot(c,b);if(Math.abs(I)>P.EPSILON6&&(v=-h.dot(c,_)/I),!u(v)||v<=0){e._looking=!0,wu(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}s=h.multiplyByScalar(b,v,F4),h.add(_,s,s)}r&&(u(a)||(a=o.getPickRay(t,N4)),Fye(e,a,s,s)),H.clone(t,e._tiltCenterMousePosition),h.clone(s,e._tiltCenter)}let l=i.canvas,f=kye;f.x=l.clientWidth/2,f.y=e._tiltCenterMousePosition.y,a=o.getPickRay(f,N4);let d=h.clone(h.ZERO,tft);d.x=s.x;let p=cn.fromPointNormal(d,c,nft),g=Yi.rayPlane(a,p,$ut),m=o._projection,A=m.ellipsoid;h.fromElements(s.y,s.z,s.x,s);let x=m.unproject(s,xq);A.cartographicToCartesian(x,s);let C=Ot.eastNorthUpToFixedFrame(s,A,zye),T;u(g)?(h.fromElements(g.y,g.z,g.x,g),x=m.unproject(g,xq),A.cartographicToCartesian(x,g),T=Ot.eastNorthUpToFixedFrame(g,A,eft)):T=C;let E=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let D=h.UNIT_Z,w=M.clone(o.transform,Hye);o._setTransform(C);let R=h.cross(h.UNIT_Z,h.normalize(o.position,gq),gq),O=h.dot(o.right,R);if(vu(e,t,n,D,!1,!0),o._setTransform(T),O<0){let _=n.startPosition.y-n.endPosition.y;(r&&_<0||!r&&_>0)&&(D=void 0);let b=o.constrainedAxis;o.constrainedAxis=void 0,vu(e,t,n,D,!0,!1),o.constrainedAxis=b}else vu(e,t,n,D,!0,!1);if(u(o.constrainedAxis)){let _=h.cross(o.direction,o.constrainedAxis,V4);h.equalsEpsilon(_,h.ZERO,P.EPSILON6)||(h.dot(_,o.right)<0&&h.negate(_,_),h.cross(_,o.direction,o.up),h.cross(o.direction,o.up,o.right),h.normalize(o.up,o.up),h.normalize(o.right,o.right))}o._setTransform(w),e._globe=E,e._ellipsoid=S;let L=S.maximumRadius;e._rotateFactor=1/L,e._rotateRateRangeAdjustment=L;let N=h.clone(o.positionWC,gq);if(e.enableCollisionDetection&&vq(e),!h.equals(o.positionWC,N)){o._setTransform(T),o.worldToCameraCoordinatesPoint(N,N);let _=h.magnitudeSquared(N);h.magnitudeSquared(o.position)>_&&(h.normalize(o.position,o.position),h.multiplyByScalar(o.position,Math.sqrt(_),o.position));let b=h.angleBetween(N,o.position),v=h.cross(N,o.position,N);h.normalize(v,v);let I=Le.fromAxisAngle(v,b,ift),B=Z.fromQuaternion(I,oft);Z.multiplyByVector(B,o.direction,o.direction),Z.multiplyByVector(B,o.up,o.up),h.cross(o.direction,o.up,o.right),h.cross(o.right,o.direction,o.up),o._setTransform(w)}}var Gye=new H,Wye=new wn,jye=new h;function cft(e,t,n){u(n.distance)&&(n=n.distance);let i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground,a;s?a=t:(a=Gye,a.x=r.clientWidth/2,a.y=r.clientHeight/2);let c=o.getPickRay(a,Wye),l=c.origin,f=c.direction,d=o.position.z,p;d<e._minimumPickingTerrainHeight&&(p=qy(e,a,jye));let g;if(u(p)&&(g=h.distance(l,p)),s){let m=Nye(e,c,d);u(g)?g=Math.min(g,m):g=m}if(!u(g)){let m=h.UNIT_X;g=-h.dot(m,l)/h.dot(m,f)}Eq(e,t,n,e._zoomFactor,g)}function lft(e){let n=e._scene.camera;if(!M.equals(M.IDENTITY,n.transform))qc(e,e.enableRotate,e.rotateEventTypes,vu,e.inertiaSpin,"_lastInertiaSpinMovement"),qc(e,e.enableZoom,e.zoomEventTypes,Yye,e.inertiaZoom,"_lastInertiaZoomMovement");else{let i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),qc(e,e.enableTilt,e.tiltEventTypes,rft,e.inertiaSpin,"_lastInertiaTiltMovement"),qc(e,e.enableTranslate,e.translateEventTypes,Qut,e.inertiaTranslate,"_lastInertiaTranslateMovement"),qc(e,e.enableZoom,e.zoomEventTypes,cft,e.inertiaZoom,"_lastInertiaZoomMovement"),qc(e,e.enableLook,e.lookEventTypes,wu),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){let o=n.createCorrectPositionTween(e.bounceAnimationTime);u(o)&&(e._tween=i.add(o))}i.update()}}var uft=new wn,fft=new cn(h.UNIT_X,0),dft=new h,hft=new h,mft=new h;function bq(e,t,n){let i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,uft),s=h.clone(o.direction,hft);i.mode===te.COLUMBUS_VIEW&&h.fromElements(s.z,s.x,s.y,s);let a=cn.fromPointNormal(n,s,fft),c=Yi.rayPlane(r,a,dft);u(c)&&(s=h.subtract(n,c,s),i.mode===te.COLUMBUS_VIEW&&h.fromElements(s.y,s.z,s.x,s),h.add(o.position,s,o.position))}var Rye=new h,pft=new he,Cq=new h,Tq=new ie,_ft=new h,gft=new h;function yft(e,t,n){let o=e._scene.camera,r=e._cameraUnderground,s=e._ellipsoid;if(!M.equals(o.transform,M.IDENTITY)){vu(e,t,n);return}let a,c,l=s.geodeticSurfaceNormal(o.position,_ft);if(H.equals(t,e._rotateMousePosition)){if(e._looking)wu(e,t,n,l);else if(e._rotating)vu(e,t,n);else if(e._strafing)Uye(e,n);else{if(h.magnitude(o.position)<h.magnitude(e._rotateStartPosition))return;a=h.magnitude(e._rotateStartPosition),c=Cq,c.x=c.y=c.z=a,s=ie.fromCartesian3(c,Tq),Aq(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;let f=s.cartesianToCartographic(o.positionWC,pft).height,d=e._globe;if(u(d)&&f<e._minimumPickingTerrainHeight){let p=qy(e,n.startPosition,mft);if(u(p)){let g=!1,m=o.getPickRay(n.startPosition,Lye);if(r)g=!0,Vye(e,m,p,p);else{let A=s.geodeticSurfaceNormal(p,gft);Math.abs(h.dot(m.direction,A))<.05?g=!0:g=h.magnitude(o.position)<h.magnitude(p)}g?(H.clone(t,e._strafeEndMousePosition),h.clone(p,e._strafeStartPosition),e._strafing=!0,bq(e,n,e._strafeStartPosition)):(a=h.magnitude(p),c=Cq,c.x=c.y=c.z=a,s=ie.fromCartesian3(c,Tq),Aq(e,t,n,s),h.clone(p,e._rotateStartPosition))}else e._looking=!0,wu(e,t,n,l)}else u(o.pickEllipsoid(n.startPosition,e._ellipsoid,Rye))?(Aq(e,t,n,e._ellipsoid),h.clone(Rye,e._rotateStartPosition)):f>e._minimumTrackBallHeight?(e._rotating=!0,vu(e,t,n)):(e._looking=!0,wu(e,t,n,l));H.clone(t,e._rotateMousePosition)}function vu(e,t,n,i,o,r){o=y(o,!1),r=y(r,!1);let s=e._scene,a=s.camera,c=s.canvas,l=a.constrainedAxis;u(i)&&(a.constrainedAxis=i);let f=h.magnitude(a.position),d=e._rotateFactor*(f-e._rotateRateRangeAdjustment);d>e._maximumRotateRate&&(d=e._maximumRotateRate),d<e._minimumRotateRate&&(d=e._minimumRotateRate);let p=(n.startPosition.x-n.endPosition.x)/c.clientWidth,g=(n.startPosition.y-n.endPosition.y)/c.clientHeight;p=Math.min(p,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);let m=d*p*Math.PI*2,A=d*g*Math.PI;o||a.rotateRight(m),r||a.rotateUp(A),a.constrainedAxis=l}var Aft=oe.clone(oe.UNIT_W),xft=oe.clone(oe.UNIT_W),L4=new h,yq=new h,Cft=new h,Tft=new h,Eft=new H,bft=new H;function Aq(e,t,n,i){let r=e._scene.camera,s=H.clone(n.startPosition,Eft),a=H.clone(n.endPosition,bft),c=r.pickEllipsoid(s,i,Aft),l=r.pickEllipsoid(a,i,xft);if(!u(c)||!u(l)){e._rotating=!0,vu(e,t,n);return}if(c=r.worldToCameraCoordinates(c,c),l=r.worldToCameraCoordinates(l,l),u(r.constrainedAxis)){let f=r.constrainedAxis,d=h.mostOrthogonalAxis(f,L4);h.cross(d,f,d),h.normalize(d,d);let p=h.cross(f,d,yq),g=h.magnitude(c),m=h.dot(f,c),A=Math.acos(m/g),x=h.multiplyByScalar(f,m,Cft);h.subtract(c,x,x),h.normalize(x,x);let C=h.magnitude(l),T=h.dot(f,l),E=Math.acos(T/C),S=h.multiplyByScalar(f,T,Tft);h.subtract(l,S,S),h.normalize(S,S);let D=Math.acos(h.dot(x,d));h.dot(x,p)<0&&(D=P.TWO_PI-D);let w=Math.acos(h.dot(S,d));h.dot(S,p)<0&&(w=P.TWO_PI-w);let R=D-w,O;h.equalsEpsilon(f,r.position,P.EPSILON2)?O=r.right:O=h.cross(f,r.position,L4);let L=h.cross(f,O,L4),N=h.dot(L,h.subtract(c,f,yq)),_=h.dot(L,h.subtract(l,f,yq)),b;N>0&&_>0?b=E-A:N>0&&_<=0?h.dot(r.position,f)>0?b=-A-E:b=A+E:b=A-E,r.rotateRight(R),r.rotateUp(b)}else{h.normalize(c,c),h.normalize(l,l);let f=h.dot(c,l),d=h.cross(c,l,L4);if(f<1&&!h.equalsEpsilon(d,h.ZERO,P.EPSILON14)){let p=Math.acos(f);r.rotate(d,p)}}}var Sft=new h,Dft=new he;function Yye(e,t,n){u(n.distance)&&(n=n.distance);let i=e._ellipsoid,o=e._scene,r=o.camera,s=o.canvas,a=e._cameraUnderground,c;a?c=t:(c=Gye,c.x=s.clientWidth/2,c.y=s.clientHeight/2);let l=r.getPickRay(c,Wye),f,d=i.cartesianToCartographic(r.position,Dft).height;d<e._minimumPickingTerrainHeight&&(f=qy(e,c,jye));let p;if(u(f)&&(p=h.distance(l.origin,f)),a){let m=Nye(e,l,d);u(p)?p=Math.min(p,m):p=m}u(p)||(p=d);let g=h.normalize(r.position,Sft);Eq(e,t,n,e._zoomFactor,p,h.dot(g,r.direction))}var qye=new H,U4=new wn,QN=new h,vft=new h,Xye=new M,wft=new M,Kye=new M,Ift=new Le,Pft=new Z,Sq=new he,Dq=new h;function Oft(e,t,n){let o=e._scene.camera;if(!M.equals(o.transform,M.IDENTITY))return;if(u(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,Dq);wu(e,t,n,a);return}let s=e._ellipsoid.cartesianToCartographic(o.position,Sq);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,Bft(e,t,n)):Mft(e,t,n)}var Rft=new he;function Bft(e,t,n){let i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,Rft).height;if(a-s-1<P.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;let c=o.canvas,l=qye;l.x=c.clientWidth/2,l.y=c.clientHeight/2;let f=r.getPickRay(l,U4),d,p=Yi.rayEllipsoid(f,i);if(u(p))d=wn.getPoint(f,p.start,QN);else if(a>e._minimumTrackBallHeight){let T=Yi.grazingAltitudeLocation(f,i);if(!u(T))return;let E=i.cartesianToCartographic(T,Sq);E.height=0,d=i.cartographicToCartesian(E,QN)}else{e._looking=!0;let T=e._ellipsoid.geodeticSurfaceNormal(r.position,Dq);wu(e,t,n,T),H.clone(t,e._tiltCenterMousePosition);return}let g=Ot.eastNorthUpToFixedFrame(d,i,Xye),m=e._globe,A=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let x=M.clone(r.transform,Kye);r._setTransform(g),vu(e,t,n,h.UNIT_Z),r._setTransform(x),e._globe=m,e._ellipsoid=A;let C=A.maximumRadius;e._rotateFactor=1/C,e._rotateRateRangeAdjustment=C}function Mft(e,t,n){let i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground,a,c,l;if(H.equals(t,e._tiltCenterMousePosition))a=h.clone(e._tiltCenter,QN);else{if(a=qy(e,t,QN),!u(a)){if(c=r.getPickRay(t,U4),l=Yi.rayEllipsoid(c,i),!u(l)){if(i.cartesianToCartographic(r.position,Sq).height<=e._minimumTrackBallHeight){e._looking=!0;let b=e._ellipsoid.geodeticSurfaceNormal(r.position,Dq);wu(e,t,n,b),H.clone(t,e._tiltCenterMousePosition)}return}a=wn.getPoint(c,l.start,QN)}s&&(u(c)||(c=r.getPickRay(t,U4)),Fye(e,c,a,a)),H.clone(t,e._tiltCenterMousePosition),h.clone(a,e._tiltCenter)}let f=o.canvas,d=qye;d.x=f.clientWidth/2,d.y=e._tiltCenterMousePosition.y,c=r.getPickRay(d,U4);let p=h.magnitude(a),g=h.fromElements(p,p,p,Cq),m=ie.fromCartesian3(g,Tq);if(l=Yi.rayEllipsoid(c,m),!u(l))return;let A=h.magnitude(c.origin)>p?l.start:l.stop,x=wn.getPoint(c,A,vft),C=Ot.eastNorthUpToFixedFrame(a,i,Xye),T=Ot.eastNorthUpToFixedFrame(x,m,wft),E=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=ie.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let D=h.UNIT_Z,w=M.clone(r.transform,Kye);r._setTransform(T);let R=h.cross(x,r.positionWC,V4);if(h.dot(r.rightWC,R)<0){let _=n.startPosition.y-n.endPosition.y;(s&&_<0||!s&&_>0)&&(D=void 0);let b=r.constrainedAxis;r.constrainedAxis=void 0,vu(e,t,n,D,!0,!1),r.constrainedAxis=b}else vu(e,t,n,D,!0,!1);if(r._setTransform(C),vu(e,t,n,D,!1,!0),u(r.constrainedAxis)){let _=h.cross(r.direction,r.constrainedAxis,V4);h.equalsEpsilon(_,h.ZERO,P.EPSILON6)||(h.dot(_,r.right)<0&&h.negate(_,_),h.cross(_,r.direction,r.up),h.cross(r.direction,r.up,r.right),h.normalize(r.up,r.up),h.normalize(r.right,r.right))}r._setTransform(w),e._globe=E,e._ellipsoid=S;let L=S.maximumRadius;e._rotateFactor=1/L,e._rotateRateRangeAdjustment=L;let N=h.clone(r.positionWC,V4);if(e.enableCollisionDetection&&vq(e),!h.equals(r.positionWC,N)){r._setTransform(T),r.worldToCameraCoordinatesPoint(N,N);let _=h.magnitudeSquared(N);h.magnitudeSquared(r.position)>_&&(h.normalize(r.position,r.position),h.multiplyByScalar(r.position,Math.sqrt(_),r.position));let b=h.angleBetween(N,r.position),v=h.cross(N,r.position,N);h.normalize(v,v);let I=Le.fromAxisAngle(v,b,Ift),B=Z.fromQuaternion(I,Pft);Z.multiplyByVector(B,r.direction,r.direction),Z.multiplyByVector(B,r.up,r.up),h.cross(r.direction,r.up,r.right),h.cross(r.right,r.direction,r.up),r._setTransform(w)}}var Lft=new H,Nft=new H,Bye=new wn,Mye=new wn,Fft=new h,Vft=new h;function wu(e,t,n,i){let r=e._scene.camera,s=Lft;s.x=n.startPosition.x,s.y=0;let a=Nft;a.x=n.endPosition.x,a.y=0;let c=r.getPickRay(s,Bye),l=r.getPickRay(a,Mye),f=0,d,p;r.frustum instanceof en?(d=c.origin,p=l.origin,h.add(r.direction,d,d),h.add(r.direction,p,p),h.subtract(d,r.position,d),h.subtract(p,r.position,p),h.normalize(d,d),h.normalize(p,p)):(d=c.direction,p=l.direction);let g=h.dot(d,p);g<1&&(f=Math.acos(g)),f=n.startPosition.x>n.endPosition.x?-f:f;let m=e._horizontalRotationAxis;if(u(i)?r.look(i,-f):u(m)?r.look(m,-f):r.lookLeft(f),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,c=r.getPickRay(s,Bye),l=r.getPickRay(a,Mye),f=0,r.frustum instanceof en?(d=c.origin,p=l.origin,h.add(r.direction,d,d),h.add(r.direction,p,p),h.subtract(d,r.position,d),h.subtract(p,r.position,p),h.normalize(d,d),h.normalize(p,p)):(d=c.direction,p=l.direction),g=h.dot(d,p),g<1&&(f=Math.acos(g)),f=n.startPosition.y>n.endPosition.y?-f:f,i=y(i,m),u(i)){let A=r.direction,x=h.negate(i,Fft),C=h.equalsEpsilon(A,i,P.EPSILON2),T=h.equalsEpsilon(A,x,P.EPSILON2);if(!C&&!T){g=h.dot(A,i);let E=P.acosClamped(g);f>0&&f>E&&(f=E-P.EPSILON4),g=h.dot(A,x),E=P.acosClamped(g),f<0&&-f>E&&(f=-E+P.EPSILON4);let S=h.cross(i,A,Vft);r.look(S,f)}else(C&&f<0||T&&f>0)&&r.look(r.right,-f)}else r.lookUp(f)}function Uft(e){qc(e,e.enableRotate,e.rotateEventTypes,yft,e.inertiaSpin,"_lastInertiaSpinMovement"),qc(e,e.enableZoom,e.zoomEventTypes,Yye,e.inertiaZoom,"_lastInertiaZoomMovement"),qc(e,e.enableTilt,e.tiltEventTypes,Oft,e.inertiaSpin,"_lastInertiaTiltMovement"),qc(e,e.enableLook,e.lookEventTypes,wu)}var kft=new M,zft=new he;function vq(e){e._adjustedHeightForTerrain=!0;let t=e._scene,n=t.mode,i=t.globe;if(!u(i)||n===te.SCENE2D||n===te.MORPHING)return;let o=t.camera,r=i.ellipsoid,s=t.mapProjection,a,c;M.equals(o.transform,M.IDENTITY)||(a=M.clone(o.transform,kft),c=h.magnitude(o.position),o._setTransform(M.IDENTITY));let l=zft;n===te.SCENE3D?r.cartesianToCartographic(o.position,l):s.unproject(o.position,l);let f=!1;if(l.height<e._minimumCollisionTerrainHeight){let d=e._scene.globeHeight;if(u(d)){let p=d+e.minimumZoomDistance;l.height<p&&(l.height=p,n===te.SCENE3D?r.cartographicToCartesian(l,o.position):s.project(l,o.position),f=!0)}}u(a)&&(o._setTransform(a),f&&(h.normalize(o.position,o.position),h.negate(o.position,o.direction),h.multiplyByScalar(o.position,Math.max(c,e.minimumZoomDistance),o.position),h.normalize(o.direction,o.direction),h.cross(o.direction,o.up,o.right),h.cross(o.right,o.direction,o.up)))}$N.prototype.onMap=function(){let e=this._scene,t=e.mode,n=e.camera;return t===te.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};var Hft=new h,Gft=new h;$N.prototype.update=function(){let e=this._scene,t=e.camera,n=e.globe,i=e.mode;M.equals(t.transform,M.IDENTITY)?(this._globe=n,this._ellipsoid=u(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=ie.UNIT_SPHERE);let o=u(this._globe)?this._globe.terrainExaggeration:1,r=u(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=Cc.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=Cc.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=Cc.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&u(this._globe);let s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;let a=h.clone(t.positionWC,Hft),c=h.clone(t.directionWC,Gft);i===te.SCENE2D?Uut(this):i===te.COLUMBUS_VIEW?(this._horizontalRotationAxis=h.UNIT_Z,lft(this)):i===te.SCENE3D&&(this._horizontalRotationAxis=void 0,Uft(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain&&(!h.equals(a,t.positionWC)||!h.equals(c,t.directionWC))&&vq(this),this._aggregator.reset()};$N.prototype.isDestroyed=function(){return!1};$N.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),le(this)};var eF=$N;var tF=`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 nF=`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;
}

// See section 9. "The bright-pass filter" of Realtime HDR Rendering
// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf

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 L_(){this._sceneFramebuffer=new Jx;let e=.125,t=new Array(6);t[0]=new po({fragmentShader:Il,textureScale:e,forcePowerOfTwo:!0,sampleMode:Du.LINEAR});let n=t[1]=new po({fragmentShader:nF,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 po({fragmentShader:jy,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 po({fragmentShader:jy,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 po({fragmentShader:Il,sampleMode:Du.LINEAR}),this._uCenter=new H,this._uRadius=void 0,t[5]=new po({fragmentShader:tF,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new jc({stages:t});let o=new oC(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}L_.prototype.get=function(e){return this._stages.get(e)};L_.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 Wft=new oe,Zye=new H,jft=new H,Jye=new M;function Yft(e,t,n){let i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection,c=M.computeViewportTransformation(n,0,1,Jye),l=M.multiplyByPoint(r,o,Wft),f=Ot.pointToGLWindowCoordinates(s,c,o,Zye);l.x+=P.SOLAR_RADIUS;let d=Ot.pointToGLWindowCoordinates(a,c,l,l),p=H.magnitude(H.subtract(d,f,d))*30*2,g=jft;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,A=t.drawingBufferHeight,x=e._stages,C=x.get(0),T=C.outputTexture.width,E=C.outputTexture.height,S=new Ye;S.width=T,S.height=E,c=M.computeViewportTransformation(S,0,1,Jye),f=Ot.pointToGLWindowCoordinates(s,c,o,Zye),g.x*=T/m,g.y*=E/A;let D=C.scissorRectangle;D.x=Math.max(f.x-g.x*.5,0),D.y=Math.max(f.y-g.y*.5,0),D.width=Math.min(g.x,m),D.height=Math.min(g.y,A);for(let w=1;w<4;++w)Ye.clone(D,x.get(w).scissorRectangle)}L_.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};L_.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),Yft(this,t,n),o};L_.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)};L_.prototype.copy=function(e,t){if(!u(this._copyColorCommand)){let n=this;this._copyColorCommand=e.createViewportQuadCommand(Il,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};L_.prototype.isDestroyed=function(){return!1};L_.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),le(this)};var iF=L_;function Qye(){this._cachedShowFrustumsShaders={}}function qft(e){let t={},n=e.vertexAttributes;for(let i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function Xft(e,t){let n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(f){f=ke.replaceMain(f,"czm_Debug_main");let d=/out_FragData_(\d+)/g,p;for(;(p=d.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 c;if(s>0)for(c=0;c<s;++c)a+=`    out_FragData_${r[c]}.rgb *= debugShowCommandsColor;
`,a+=`    out_FragData_${r[c]}.rgb *= debugShowFrustumsColor;
`;else a+=`    out_FragColor.rgb *= debugShowCommandsColor;
`,a+=`    out_FragColor.rgb *= debugShowFrustumsColor;
`;a+="}",o.sources.push(a);let l=qft(i);return Xt.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:l})}var oF=new z;function Kft(e,t){let n;return u(t.uniformMap)?n=t.uniformMap:n={},u(n.debugShowCommandsColor)||u(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(u(t._debugColor)||(t._debugColor=z.fromRandom()),t._debugColor):z.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(oF.red=t.debugOverlappingFrustums&1<<0?1:0,oF.green=t.debugOverlappingFrustums&1<<1?1:0,oF.blue=t.debugOverlappingFrustums&1<<2?1:0,oF.alpha=1,oF):z.WHITE}),n}var Zft=new tt;Qye.prototype.executeDebugShowFrustumsCommand=function(e,t,n){let i=t.shaderProgram.id,o=this._cachedShowFrustumsShaders[i];u(o)||(o=Xft(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);let r=tt.shallowClone(t,Zft);r.shaderProgram=o,r.uniformMap=Kft(e,t),r.execute(e.context,n)};var rF=Qye;var H4=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function Xi(e){e=y(e,y.EMPTY_OBJECT);let t=e.canvas,n=e.creditContainer,i=e.creditViewport,o=Ge(e.contextOptions),r=u(n),s=new Gw(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)),u(i)||(i=t.parentNode),this._id=zn(),this._jobScheduler=new hN,this._frameState=new fN(s,new oN(n," \u2022 ",i),this._jobScheduler),this._frameState.scene3DOnly=y(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new XS(s),this._globe=void 0,this._globeTranslucencyState=new dN,this._primitives=new xl,this._groundPrimitives=new xl,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new aC,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=y(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new aN(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new ii({color:new z,stencil:0,owner:this}),this._depthClearCommand=new ii({depth:1,owner:this}),this._stencilClearCommand=new ii({stencil:0}),this._classificationStencilClearCommand=new ii({stencil:0,renderState:Ue.fromCache({stencilMask:Bt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new ZN(this),this._preUpdate=new Ae,this._postUpdate=new Ae,this._renderError=new Ae,this._preRender=new Ae,this._postRender=new Ae,this._minimumDisableDepthTestDistance=0,this._debugInspector=new rF,this._msaaSamples=y(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Ae,this.morphComplete=new Ae,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=z.clone(z.BLACK),this._mode=te.SCENE3D,this._mapProjection=u(e.mapProjection)?e.mapProjection:new Ei,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,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.fog=new uN,this._shadowMapCamera=new ro(this),this.shadowMap=new B_({context:s,lightCamera:this._shadowMapCamera,enabled:y(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=z.clone(z.WHITE),this._actualInvertClassificationColor=z.clone(this._invertClassificationColor),this._invertClassification=new uS,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new XN,this._brdfLutGenerator=new QL,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new eF(this),this._cameraUnderground=!1,this._mapMode2D=y(e.mapMode2D,wl.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=y(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=y(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=Oa.requestCompletedEvent.addEventListener(H4(this)),this._removeTaskProcessorListenerCallback=pi.taskCompletedEvent.addEventListener(H4(this)),this._removeGlobeCallbacks=[];let a=new Ye(0,0,s.drawingBufferWidth,s.drawingBufferHeight),c=new ro(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new ro(this),this.preloadFlightCullingVolume=void 0,this._picking=new DN(this),this._defaultView=new eC(this,c,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._specularEnvironmentMapAtlas=void 0,this.light=new Hm,n0e(this,0,$.now()),this.updateFrameState(),this.initializeFrame()}function Jft(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;let n=[];u(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(H4(e))),n.push(t.terrainProviderChanged.addEventListener(H4(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(Xi.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 Ft.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return Ft.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 id.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,Jft(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(u(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(u(this.globe))return this.globe.terrainProvider},set:function(e){u(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(u(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){e===te.SCENE2D?this.morphTo2D(0):e===te.SCENE3D?this.morphTo3D(0):e===te.COLUMBUS_VIEW&&this.morphToColumbusView(0),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){this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new ro(this),u(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new lN(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){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,Ft.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}}});Xi.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 $ye(e,t,n){let i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled,c=t.derivedCommands;u(t.pickId)&&(c.picking=I_.createPickDerivedCommand(e,t,o,c.picking)),t.pickOnly||(c.depth=I_.createDepthOnlyDerivedCommand(e,t,o,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=I_.createHdrCommand(t,o,c.hdr),t=c.hdr.command,c=t.derivedCommands),a&&t.receiveShadows&&(c.shadows=B_.createReceiveDerivedCommand(s,t,n,o,c.shadows)),t.pass===Ee.TRANSLUCENT&&u(r)&&r.isSupported()&&(a&&t.receiveShadows?(c.oit=u(c.oit)?c.oit:{},c.oit.shadows=r.createDerivedCommands(c.shadows.receiveCommand,o,c.oit.shadows)):c.oit=r.createDerivedCommands(t,o,c.oit))}Xi.prototype.updateDerivedCommands=function(e){if(!u(e.derivedCommands))return;let t=this._frameState,n=this._context,i=!1,o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);let r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,c=u(a.logDepth),l=u(a.hdr),f=u(a.originalCommand),d=r&&!c,p=s&&!l,g=(!r||!s)&&!f;if(e.dirty=e.dirty||d||p||g,e.dirty){e.dirty=!1;let m=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=B_.createCastDerivedCommand(m,e,i,n,a.shadows)),(c||d)&&(a.logDepth=I_.createLogDepthCommand(e,n,a.logDepth),$ye(this,a.logDepth.command,i)),(f||g)&&$ye(this,e,i)}};var Qft=new Of({pass:qo.RENDER}),wq=new Of({pass:qo.PRELOAD}),Iq=new Of({pass:qo.PRELOAD_FLIGHT}),$ft=new Of({pass:qo.REQUEST_RENDER_MODE_DEFER_CHECK}),e0e=new se,Pq;function edt(e){let t=e.globe;if(e._mode===te.SCENE3D&&u(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){let n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return e0e.radius=n.minimumRadius+i,Pq=mL.fromBoundingSphere(e0e,e.camera.positionWC,Pq),Pq}}Xi.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function n0e(e,t,n){let i=e._frameState;i.frameNumber=t,i.time=$.clone(n,i.time)}Xi.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=edt(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof en||this.camera.frustum instanceof Tr),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,u(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),u(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=z.clone(this.invertClassificationColor,this._actualInvertClassificationColor),uS.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,u(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0};Xi.prototype.isVisible=function(e,t,n){return u(e)&&(!u(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Qt.OUTSIDE&&(!u(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};var z4=new M(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);z4=M.inverseTransformation(z4,z4);function tdt(e,t,n,i){let o=t._frameState,r=o.context,s=e.boundingVolume;u(t._debugVolume)&&t._debugVolume.destroy();let a,c=h.clone(s.center);if(o.mode!==te.SCENE3D){c=M.multiplyByPoint(z4,c,c);let p=o.mapProjection,g=p.unproject(c);c=p.ellipsoid.cartographicToCartesian(g)}if(u(s.radius)){let p=s.radius;a=Ln.toWireframe(vs.createGeometry(new vs({radii:new h(p,p,p),vertexFormat:on.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Dn({geometryInstances:new At({geometry:a,modelMatrix:M.fromTranslation(c),attributes:{color:new Nt(1,0,0,1)}}),appearance:new on({flat:!0,translucent:!1}),asynchronous:!1})}else{let p=s.halfAxes;a=Ln.toWireframe(ol.createGeometry(ol.fromDimensions({dimensions:new h(2,2,2),vertexFormat:on.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Dn({geometryInstances:new At({geometry:a,modelMatrix:M.fromRotationTranslation(p,c,new M),attributes:{color:new Nt(1,0,0,1)}}),appearance:new on({flat:!0,translucent:!1}),asynchronous:!1})}let l=o.commandList,f=o.commandList=[];t._debugVolume.update(o),e=f[0],o.useLogDepth&&(e=I_.createLogDepthCommand(e,r).command);let d;u(i)&&(d=n.framebuffer,n.framebuffer=i),e.execute(r,n),u(d)&&(n.framebuffer=d),o.commandList=l}function Ca(e,t,n,i,o){let r=t._frameState;if(u(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof ii){e.execute(n,i);return}e.debugShowBoundingVolume&&u(e.boundingVolume)&&tdt(e,t,i,o),r.useLogDepth&&u(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);let s=r.passes;if(!s.pick&&!s.depth&&t._hdr&&u(e.derivedCommands)&&u(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&u(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(n,i);return}else if(u(e.derivedCommands.depth)){e=e.derivedCommands.depth.depthOnlyCommand,e.execute(n,i);return}}if(t.debugShowCommands||t.debugShowFrustums){t._debugInspector.executeDebugShowFrustumsCommand(t,e,i);return}r.shadowState.lightShadowsEnabled&&e.receiveShadows&&u(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function sF(e,t,n,i){let o=t._frameState,r=e.derivedCommands;u(r)&&(o.useLogDepth&&u(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,u(r.picking)?(e=r.picking.pickCommand,e.execute(n,i)):u(r.depth)&&(e=r.depth.depthOnlyCommand,e.execute(n,i)))}function i0e(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function ndt(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+P.EPSILON12}function idt(e,t,n,i,o){let r=e.context;C_(i,i0e,e.camera.positionWC),u(o)&&t(o.unclassifiedCommand,e,r,n);let s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function odt(e,t,n,i,o){let r=e.context;C_(i,ndt,e.camera.positionWC),u(o)&&t(o.unclassifiedCommand,e,r,n);let s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function rdt(e,t,n,i){let o=e.context;C_(i,i0e,e.camera.positionWC);let r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}var sdt=new Ti,adt=new zc,cdt=new en,ldt=new Tr;function Oq(e,t){let n=e.camera,i=e.context,o=e.frameState,r=i.uniformState;r.updateCamera(n);let s;u(n.frustum.fov)?s=n.frustum.clone(sdt):u(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(adt):u(n.frustum.width)?s=n.frustum.clone(cdt):s=n.frustum.clone(ldt),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(Ee.ENVIRONMENT);let a=o.passes,c=a.pick,l=e._environmentState,f=e._view,d=l.renderTranslucentDepthForPick,p=l.useWebVR;if(!c){let b=l.skyBoxCommand;if(u(b)&&Ca(b,e,i,t),l.isSkyAtmosphereVisible&&Ca(l.skyAtmosphereCommand,e,i,t),l.isSunVisible&&(l.sunDrawCommand.execute(i,t),e.sunBloom&&!p)){let v;l.useGlobeDepthFramebuffer?v=f.globeDepth.framebuffer:l.usePostProcess?v=f.sceneFramebuffer.framebuffer:v=l.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,v),t.framebuffer=v}l.isMoonVisible&&l.moonCommand.execute(i,t)}let g;l.useOIT?(u(e._executeOITFunction)||(e._executeOITFunction=function(b,v,I,B,F){f.globeDepth.prepareColorTextures(i),f.oit.executeCommands(b,v,I,B,F)}),g=e._executeOITFunction):a.render?g=idt:g=odt;let m=f.frustumCommandsList,A=m.length,x=l.clearGlobeDepth,C=l.useDepthPlane,T=e._globeTranslucencyState,E=T.translucent,S=e._view.globeTranslucencyFramebuffer,D=e._depthClearCommand,w=e._stencilClearCommand,R=e._classificationStencilClearCommand,O=e._depthPlane,L=l.usePostProcessSelected,N=n.position.z,_;for(let b=0;b<A;++b){let v=A-b-1,I=m[v];e.mode===te.SCENE2D?(n.position.z=N-I.near+1,s.far=Math.max(1,I.far-I.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=v!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s)),D.execute(i,t),i.stencilBuffer&&w.execute(i,t),r.updatePass(Ee.GLOBE);let B=I.commands[Ee.GLOBE],F=I.indices[Ee.GLOBE];if(E)T.executeGlobeCommands(I,Ca,S,e,t);else for(_=0;_<F;++_)Ca(B[_],e,i,t);let k=f.globeDepth;if(u(k)&&l.useGlobeDepthFramebuffer&&k.executeCopyDepth(i,t),!l.renderTranslucentDepthForPick)if(r.updatePass(Ee.TERRAIN_CLASSIFICATION),B=I.commands[Ee.TERRAIN_CLASSIFICATION],F=I.indices[Ee.TERRAIN_CLASSIFICATION],E)T.executeGlobeClassificationCommands(I,Ca,S,e,t);else for(_=0;_<F;++_)Ca(B[_],e,i,t);if(x&&(D.execute(i,t),C&&O.execute(i,t)),!l.useInvertClassification||c||l.renderTranslucentDepthForPick){for(r.updatePass(Ee.CESIUM_3D_TILE),B=I.commands[Ee.CESIUM_3D_TILE],F=I.indices[Ee.CESIUM_3D_TILE],_=0;_<F;++_)Ca(B[_],e,i,t);if(F>0&&(u(k)&&l.useGlobeDepthFramebuffer&&(k.prepareColorTextures(i,x),k.executeUpdateDepth(i,t,x,k.depthStencilTexture)),!l.renderTranslucentDepthForPick))for(r.updatePass(Ee.CESIUM_3D_TILE_CLASSIFICATION),B=I.commands[Ee.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[Ee.CESIUM_3D_TILE_CLASSIFICATION],_=0;_<F;++_)Ca(B[_],e,i,t)}else{e._invertClassification.clear(i,t);let X=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(Ee.CESIUM_3D_TILE),B=I.commands[Ee.CESIUM_3D_TILE],F=I.indices[Ee.CESIUM_3D_TILE],_=0;_<F;++_)Ca(B[_],e,i,t);for(u(k)&&l.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),k.executeUpdateDepth(i,t,x,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),B=I.commands[Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],F=I.indices[Ee.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],_=0;_<F;++_)Ca(B[_],e,i,t);for(t.framebuffer=X,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),F>0&&i.stencilBuffer&&R.execute(i,t),r.updatePass(Ee.CESIUM_3D_TILE_CLASSIFICATION),B=I.commands[Ee.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[Ee.CESIUM_3D_TILE_CLASSIFICATION],_=0;_<F;++_)Ca(B[_],e,i,t)}for(F>0&&i.stencilBuffer&&w.execute(i,t),r.updatePass(Ee.OPAQUE),B=I.commands[Ee.OPAQUE],F=I.indices[Ee.OPAQUE],_=0;_<F;++_)Ca(B[_],e,i,t);v!==0&&e.mode!==te.SCENE2D&&(s.near=I.near,r.updateFrustum(s));let U;if(!c&&l.useInvertClassification&&o.invertClassificationColor.alpha<1&&(U=e._invertClassification),r.updatePass(Ee.TRANSLUCENT),B=I.commands[Ee.TRANSLUCENT],B.length=I.indices[Ee.TRANSLUCENT],g(e,Ca,t,B,U),I.indices[Ee.CESIUM_3D_TILE_CLASSIFICATION]>0&&f.translucentTileClassification.isSupported()&&(f.translucentTileClassification.executeTranslucentCommands(e,Ca,t,B,k.depthStencilTexture),f.translucentTileClassification.executeClassificationCommands(e,Ca,t,I)),i.depthTexture&&e.useDepthPicking&&(l.useGlobeDepthFramebuffer||d)){let X=k.depthStencilTexture,j=e._picking.getPickDepth(e,v);j.update(i,X),j.executeCopyDepth(i,t)}if(r.updatePass(Ee.VOXELS),B=I.commands[Ee.VOXELS],F=I.indices[Ee.VOXELS],B.length=F,rdt(e,Ca,t,B),c||!L)continue;let V=t.framebuffer;if(t.framebuffer=f.sceneFramebuffer.getIdFramebuffer(),s.near=v!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s),r.updatePass(Ee.GLOBE),B=I.commands[Ee.GLOBE],F=I.indices[Ee.GLOBE],E)T.executeGlobeCommands(I,sF,S,e,t);else for(_=0;_<F;++_)sF(B[_],e,i,t);for(x&&(D.framebuffer=t.framebuffer,D.execute(i,t),D.framebuffer=void 0),x&&C&&O.execute(i,t),r.updatePass(Ee.CESIUM_3D_TILE),B=I.commands[Ee.CESIUM_3D_TILE],F=I.indices[Ee.CESIUM_3D_TILE],_=0;_<F;++_)sF(B[_],e,i,t);for(r.updatePass(Ee.OPAQUE),B=I.commands[Ee.OPAQUE],F=I.indices[Ee.OPAQUE],_=0;_<F;++_)sF(B[_],e,i,t);for(r.updatePass(Ee.TRANSLUCENT),B=I.commands[Ee.TRANSLUCENT],F=I.indices[Ee.TRANSLUCENT],_=0;_<F;++_)sF(B[_],e,i,t);t.framebuffer=V}}function o0e(e){e.context.uniformState.updatePass(Ee.COMPUTE);let n=e._environmentState.sunComputeCommand;u(n)&&n.execute(e._computeEngine);let i=e._computeCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(e._computeEngine)}function udt(e,t){e.context.uniformState.updatePass(Ee.OVERLAY);let i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function fdt(e,t,n){let i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let c=0;c<a;++c){let l=t[c];if(e.updateDerivedCommands(l),l.castShadows&&(l.pass===Ee.GLOBE||l.pass===Ee.CESIUM_3D_TILE||l.pass===Ee.OPAQUE||l.pass===Ee.TRANSLUCENT)&&e.isVisible(l,i))if(o)for(let f=0;f<s;++f)r[f].commandList.push(l);else if(s===1)r[0].commandList.push(l);else{let f=!1;for(let d=s-1;d>=0;--d){let p=r[d].cullingVolume;if(e.isVisible(l,p))r[d].commandList.push(l),f=!0;else if(f)break}}}}function r0e(e){let t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;let o=e.context,r=o.uniformState;for(let s=0;s<i;++s){let a=n[s];if(a.outOfView)continue;let c=a.passes,l=c.length;for(let d=0;d<l;++d)c[d].commandList.length=0;let f=e.frameState.commandList;fdt(e,f,a);for(let d=0;d<l;++d){let p=a.passes[d];r.updateCamera(p.camera),a.updatePass(o,d);let g=p.commandList.length;for(let m=0;m<g;++m){let A=p.commandList[m];r.updatePass(A.pass),Ca(A.derivedCommands.shadows.castCommands[s],e,o,p.passState)}}}}var ddt=new h;Xi.prototype.updateAndExecuteCommands=function(e,t){let i=this._frameState.mode;this._environmentState.useWebVR?hdt(this,e,t):i!==te.SCENE2D||this._mapMode2D===wl.ROTATE?Xy(!0,this,e,t):(Rq(this,e,t),Tdt(this,e))};function hdt(e,t,n){let i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;Rq(e,t,n),s0e(e),i.createPotentiallyVisibleSet(e),o0e(e),s||r0e(e);let a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;let c=ro.clone(o,e._cameraVR);c.frustum=o.frustum;let l=o.frustum.near,f=l*y(e.focalLength,5),d=y(e.eyeSeparation,f/30),p=h.multiplyByScalar(c.right,d*.5,ddt);o.frustum.aspectRatio=a.width/a.height;let g=.5*d*l/f;h.add(c.position,p,o.position),o.frustum.xOffset=g,Oq(e,t),a.x=a.width,h.subtract(c.position,p,o.position),o.frustum.xOffset=-g,Oq(e,t),ro.clone(c,o)}var mdt=new he(Math.PI,P.PI_OVER_TWO),pdt=new h,_dt=new h,gdt=new M,ydt=new M,Adt=new h,xdt=new h,Cdt=new Ye;function Tdt(e,t){let n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=Ye.clone(r,Cdt);t.viewport=s;let a=mdt,c=pdt;e.mapProjection.project(a,c);let f=h.clone(o.position,_dt),d=M.clone(o.transform,ydt),p=o.frustum.clone();o._setTransform(M.IDENTITY);let g=M.computeViewportTransformation(s,0,1,gdt),m=o.frustum.projectionMatrix,A=o.positionWC.y,x=h.fromElements(P.sign(A)*c.x-A,0,-o.positionWC.x,Adt),C=Ot.pointToGLWindowCoordinates(m,g,x,xdt);C.x=Math.floor(C.x);let T=s.x,E=s.width;if(A===0||C.x<=T||C.x>=T+E)Xy(!0,e,t);else if(Math.abs(T+E*.5-C.x)<1)s.width=C.x-s.x,o.position.x*=P.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!0,e,t),s.x=C.x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!1,e,t);else if(C.x>T+E*.5){s.width=C.x-T;let S=o.frustum.right;o.frustum.right=c.x-A,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!0,e,t),s.x=C.x,s.width=T+E-C.x,o.position.x=-o.position.x,o.frustum.left=-o.frustum.right,o.frustum.right=S-o.frustum.right*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!1,e,t)}else{s.x=C.x,s.width=T+E-C.x;let S=o.frustum.left;o.frustum.left=-c.x-A,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!0,e,t),s.x=T,s.width=C.x-T,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=S-o.frustum.left*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Xy(!1,e,t)}o._setTransform(d),h.clone(f,o.position),o.frustum=p.clone(),t.viewport=r}function Xy(e,t,n,i){let o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),s0e(t),r.createPotentiallyVisibleSet(t),e&&(u(i)&&Rq(t,n,i),o0e(t),s||r0e(t)),Oq(t,n)}var t0e=new $r;Xi.prototype.updateEnvironment=function(){let e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.skyAtmosphere,s=this.globe,a=this._globeTranslucencyState;if(!i||this._mode!==te.SCENE2D&&t.camera.frustum instanceof en||!a.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{u(r)?(u(s)&&(r.setDynamicAtmosphereColor(s.enableLighting&&s.dynamicAtmosphereLighting,s.dynamicAtmosphereLightingFromSun),n.isReadyForAtmosphere=n.isReadyForAtmosphere||s._surface._tilesToRender.length>0),n.skyAtmosphereCommand=r.update(e,s),u(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)):n.skyAtmosphereCommand=void 0,n.skyBoxCommand=u(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;let A=u(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=u(A)?A.drawCommand:void 0,n.sunComputeCommand=u(A)?A.computeCommand:void 0,n.moonCommand=u(this.moon)?this.moon.update(e):void 0}let c=n.clearGlobeDepth=u(s)&&s.show&&(!s.depthTestAgainstTerrain||this.mode===te.SCENE2D);(n.useDepthPlane=c&&this.mode===te.SCENE3D&&a.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==te.SCENE2D&&!o;let f=e.mode===te.SCENE3D&&!a.sunVisibleThroughGlobe?e.occluder:void 0,d=e.cullingVolume,p=t0e.planes;for(let A=0;A<5;++A)p[A]=d.planes[A];d=t0e,n.isSkyAtmosphereVisible=u(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,d,f),n.isMoonVisible=this.isVisible(n.moonCommand,d,f);let g=this.specularEnvironmentMaps,m=this._specularEnvironmentMapAtlas;u(g)&&(!u(m)||m.url!==g)?(m=m&&m.destroy(),this._specularEnvironmentMapAtlas=new id(g)):!u(g)&&u(m)&&(m.destroy(),this._specularEnvironmentMapAtlas=void 0),u(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function Edt(e){let t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new dm({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),u(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function bdt(e){let t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&e.mode===te.SCENE3D;if(o!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=o),t.shadowState.lightShadowsEnabled=!1,!!o){for(let r=0;r<i;++r)if(n[r]!==t.shadowState.shadowMaps[r]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let r=0;r<i;++r){let s=n[r];s.update(t),t.shadowState.shadowMaps.push(s),s.fromLightSource&&(t.shadowState.lightShadowMaps.push(s),t.shadowState.lightShadowsEnabled=!0),s.dirty&&(++t.shadowState.lastDirtyTime,s.dirty=!1)}}}function s0e(e){let t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),Edt(e),bdt(e),e._globe&&e._globe.render(t)}function Rq(e,t,n){let i=e._context,o=e._frameState,r=e._environmentState,s=e._view,c=e._frameState.passes.pick;u(s.globeDepth)&&(s.globeDepth.picking=c);let l=r.useWebVR;r.originalFramebuffer=t.framebuffer,u(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!l?e._sunPostProcess=new iF:u(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!u(e.sun)&&u(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);let f=e._clearColorCommand;z.clone(n,f.color),f.execute(i,t);let d=r.useGlobeDepthFramebuffer=u(s.globeDepth);d&&(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=!c&&u(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,A=r.usePostProcess=!c&&(e._hdr||m.length>0||m.ambientOcclusion.enabled||m.fxaa.enabled||m.bloom.enabled);if(r.usePostProcessSelected=!1,A&&(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),A=r.usePostProcess=m.ready,r.usePostProcessSelected=A&&m.hasSelected),r.isSunVisible&&e.sunBloom&&!l?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):d?t.framebuffer=s.globeDepth.framebuffer:A&&(t.framebuffer=s.sceneFramebuffer.framebuffer),u(t.framebuffer)&&f.execute(i,t),r.useInvertClassification=!c&&u(t.framebuffer)&&e.invertClassification){let C;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(C=s.globeDepth.framebuffer),u(C)||i.depthTexture){if(e._invertClassification.previousFramebuffer=C,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&g){let T=e._invertClassification.unclassifiedCommand,E=T.derivedCommands;E.oit=p.createDerivedCommands(T,i,E.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}Xi.prototype.resolveFramebuffers=function(e){let t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;u(o)&&o.prepareColorTextures(t);let r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,c=n.originalFramebuffer,l=s?o.colorFramebufferManager:void 0,f=i.sceneFramebuffer._colorFramebuffer,d=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?f.framebuffer:c,i.oit.execute(t,e));let p=i.translucentTileClassification;if(p.hasTranslucentDepth&&p.isSupported()&&p.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=f;s&&!r&&(g=l);let m=this.postProcessStages,A=g.getColorTexture(0),x=d.getColorTexture(0),C=y(l,f).getDepthStencilTexture();m.execute(t,A,C,x),m.copy(t,c)}!r&&!a&&s&&(e.framebuffer=c,o.executeCopyColor(t,e))};function Sdt(e){let t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function Ddt(e){let t=e._globe,i=e.camera.positionCartographic;if(u(t)&&t.show&&u(i))return t.getHeight(i)}function vdt(e){let t=e.camera,n=e._mode,i=e.globe,o=e._screenSpaceCameraController,r=t.positionCartographic;if(!u(r))return!1;if(!o.onMap()&&r.height<0)return!0;if(!u(i)||!i.show||n===te.SCENE2D||n===te.MORPHING)return!1;let s=e._globeHeight;return u(s)&&r.height<s}Xi.prototype.initializeFrame=function(){this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=Ddt(this),this._cameraUnderground=vdt(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),u(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function wdt(e,t){if(e.debugShowFramesPerSecond){if(!u(e._performanceDisplay)){let n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);let o=new P_({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else u(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function Idt(e){e._jobScheduler.resetBudgets();let t=e._frameState;e.primitives.prePassesUpdate(t),u(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function Pdt(e){let t=e._frameState;e.primitives.postPassesUpdate(t),Oa.update()}var Odt=new z;function Rdt(e){let t=e._frameState,n=e.context,i=n.uniformState,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=Qft;let r=y(e.backgroundColor,z.BLACK);e._hdr&&(r=z.clone(r,Odt),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,e.fog.update(t),i.update(t);let s=e.shadowMap;u(s)&&s.enabled&&(!u(e.light)||e.light instanceof Hm?h.negate(i.sunDirectionWC,e._shadowMapCamera.direction):h.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 c=o.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=Ye.clone(a,c.viewport),u(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,r),e.resolveFramebuffers(c),c.framebuffer=void 0,udt(e,c),u(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function lC(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function Bdt(e){return e._picking.updateMostDetailedRayPicks(e)}Xi.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);let t=this._frameState;t.newFrame=!1,u(e)||(e=$.now());let n=this._view.checkForCameraUpdates(this),i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===te.MORPHING;if(!i&&u(this.maximumRenderTimeChange)&&u(this._lastRenderTime)){let o=Math.abs($.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=$.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;let o=P.incrementWrap(t.frameNumber,15e6,1);n0e(this,o,e),t.newFrame=!0}lC(this,Idt),this.primitives.show&&(lC(this,Bdt),lC(this,Mdt),lC(this,Ldt),i||lC(this,Ndt)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),lC(this,Rdt)),wdt(this,i),lC(this,Pdt),Sdt(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};Xi.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};Xi.prototype.requestRender=function(){this._renderRequested=!0};Xi.prototype.clampLineWidth=function(e){return Math.max(Ft.minimumAliasedLineWidth,Math.min(e,Ft.maximumAliasedLineWidth))};Xi.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};Xi.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};Xi.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};Xi.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function Mdt(e){let t=e._frameState;wq.camera=t.camera,wq.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,wq)}function Ldt(e){let t=e._frameState;if(!t.camera.canPreloadFlight())return;Iq.camera=e.preloadFlightCamera,Iq.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,Iq)}function Ndt(e){e.primitives.updateForPass(e._frameState,$ft)}Xi.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};Xi.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};Xi.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};Xi.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};Xi.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};Xi.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};Xi.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};Xi.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};Xi.prototype.cartesianToCanvasCoordinates=function(e,t){return qi.wgs84ToWindowCoordinates(this,e,t)};Xi.prototype.completeMorph=function(){this._transitioner.completeMorph()};Xi.prototype.morphTo2D=function(e){let t,n=this.globe;u(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo2D(e,t)};Xi.prototype.morphToColumbusView=function(e){let t,n=this.globe;u(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphToColumbusView(e,t)};Xi.prototype.morphTo3D=function(e){let t,n=this.globe;u(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo3D(e,t)};Xi.prototype.isDestroyed=function(){return!1};Xi.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.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(),u(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,le(this)};var aF=Xi;function mS(e){e=y(e,ie.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;let t=1.025,n=h.multiplyByScalar(e.radii,t,new h);this._scaleMatrix=M.fromScale(n),this._modelMatrix=new M,this._command=new tt({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new h(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new h(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 h;let i=new h;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(mS.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});mS.prototype.setDynamicAtmosphereColor=function(e,t){let n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};var Bq=new M;mS.prototype.update=function(e,t){if(!this.show)return;let n=e.mode;if(n!==te.SCENE3D&&n!==te.MORPHING||!e.passes.render)return;let i=M.fromRotationTranslation(e.context.uniformState.inverseViewRotation,h.ZERO,Bq),o=M.multiplyTransformation(i,Po.Y_UP_TO_Z_UP,Bq),r=M.multiply(this._scaleMatrix,o,Bq);M.clone(r,this._modelMatrix);let s=e.context,a=Fdt(this),c=e.globeTranslucencyState.translucent,l=this.perFragmentAtmosphere||c||!u(t)||!t.show,f=this._command;if(!u(f.vertexArray)){let p=vs.createGeometry(new vs({radii:new h(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ie.POSITION_ONLY}));f.vertexArray=oi.fromGeometry({context:s,geometry:p,attributeLocations:Ln.createAttributeLocations(p),bufferUsage:Ne.STATIC_DRAW}),f.renderState=Ue.fromCache({cull:{enabled:!0,face:gi.FRONT},blending:un.ALPHA_BLEND,depthMask:!1})}let d=a|l<<2|c<<3;if(d!==this._flags){this._flags=d;let p=[];a&&p.push("COLOR_CORRECT"),l&&p.push("PER_FRAGMENT_ATMOSPHERE"),c&&p.push("GLOBE_TRANSLUCENT");let g=new ke({defines:p,sources:[p_,Rb,YM]}),m=new ke({defines:p,sources:[p_,Rb,jM]});this._spSkyAtmosphere=Xt.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:m}),f.shaderProgram=this._spSkyAtmosphere}return f};function Fdt(e){return!(P.equalsEpsilon(e.hueShift,0,P.EPSILON7)&&P.equalsEpsilon(e.saturationShift,0,P.EPSILON7)&&P.equalsEpsilon(e.brightnessShift,0,P.EPSILON7))}mS.prototype.isDestroyed=function(){return!1};mS.prototype.destroy=function(){let e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),le(this)};var cF=mS;function G4(e){this.sources=e.sources,this._sources=void 0,this.show=y(e.show,!0),this._command=new tt({modelMatrix:M.clone(M.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}G4.prototype.update=function(e,t){let n=this;if(!this.show||e.mode!==te.SCENE3D&&e.mode!==te.MORPHING||!e.passes.render)return;let i=e.context;if(this._sources!==this.sources){this._sources=this.sources;let r=this.sources;typeof r.positiveX=="string"?Xw(i,this._sources).then(function(s){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=s}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Ma({context:i,source:r}))}let o=this._command;if(!u(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};let r=ol.createGeometry(ol.fromDimensions({dimensions:new h(2,2,2),vertexFormat:Ie.POSITION_ONLY})),s=this._attributeLocations=Ln.createAttributeLocations(r);o.vertexArray=oi.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:Ne.STATIC_DRAW}),o.renderState=Ue.fromCache({blending:un.ALPHA_BLEND})}if(!u(o.shaderProgram)||this._useHdr!==t){let r=new ke({defines:[t?"HDR":""],sources:[qM]});o.shaderProgram=Xt.fromCache({context:i,vertexShaderSource:XM,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(u(this._cubeMap))return o};G4.prototype.isDestroyed=function(){return!1};G4.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(),le(this)};var lF=G4;function fF(){this.show=!0,this._drawCommand=new tt({primitiveType:Me.TRIANGLES,boundingVolume:new se,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new se,this._boundingVolume2D=new se,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(fF.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});var Vdt=new H,Udt=new H,kdt=new oe,uF=new oe;fF.prototype.update=function(e,t,n){if(!this.show)return;let i=e.mode;if(i===te.SCENE2D||i===te.MORPHING||!e.passes.render)return;let o=e.context,r=t.viewport.width,s=t.viewport.height;if(!u(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 D=n?o.halfFloatingPointTexture?Xe.HALF_FLOAT:Xe.FLOAT:Xe.UNSIGNED_BYTE;this._texture=new It({context:o,width:S,height:S,pixelFormat:rt.RGBA,pixelDatatype:D}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;let w=this,R={u_radiusTS:function(){return w._radiusTS}};this._commands.computeCommand=new Lu({fragmentShaderSource:ZM,outputTexture:this._texture,uniformMap:R,persists:!1,owner:this,postExecute:function(){w._commands.computeCommand=void 0}})}let a=this._drawCommand;if(!u(a.vertexArray)){let S={direction:0},D=new Uint8Array(4*2);D[0]=0,D[1]=0,D[2]=255,D[3]=0,D[4]=255,D[5]=255,D[6]=0,D[7]=255;let w=lt.createVertexBuffer({context:o,typedArray:D,usage:Ne.STATIC_DRAW}),R=[{index:S.direction,vertexBuffer:w,componentsPerAttribute:2,normalize:!0,componentDatatype:q.UNSIGNED_BYTE}],O=lt.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT});a.vertexArray=new oi({context:o,attributes:R,indexBuffer:O}),a.shaderProgram=Xt.fromCache({context:o,vertexShaderSource:JM,fragmentShaderSource:KM,attributeLocations:S}),a.renderState=Ue.fromCache({blending:un.ALPHA_BLEND}),a.uniformMap=this._uniformMap}let c=o.uniformState.sunPositionWC,l=o.uniformState.sunPositionColumbusView,f=this._boundingVolume,d=this._boundingVolume2D;h.clone(c,f.center),d.center.x=l.z,d.center.y=l.x,d.center.z=l.y,f.radius=P.SOLAR_RADIUS+P.SOLAR_RADIUS*this._glowLengthTS,d.radius=f.radius,i===te.SCENE3D?se.clone(f,a.boundingVolume):i===te.COLUMBUS_VIEW&&se.clone(d,a.boundingVolume);let p=qi.computeActualWgs84Position(e,c,uF),g=h.magnitude(h.subtract(p,e.camera.position,uF)),m=o.uniformState.projection,A=kdt;A.x=0,A.y=0,A.z=-g,A.w=1;let x=M.multiplyByVector(m,A,uF),C=qi.clipToGLWindowCoordinates(t.viewport,x,Vdt);A.x=P.SOLAR_RADIUS;let T=M.multiplyByVector(m,A,uF),E=qi.clipToGLWindowCoordinates(t.viewport,T,Udt);return this._size=H.magnitude(H.subtract(E,C,uF)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};fF.prototype.isDestroyed=function(){return!1};fF.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(),le(this)};var dF=fF;function pS(e){return $t(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function zdt(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{let o=e._targetFrameRate;if(!u(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){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){let r="An error occurred while rendering.  Rendering has stopped.";e.showErrorPanel(r,void 0,o)}}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function a0e(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,u(e._scene)&&(e._scene.pixelRatio=t),t}function c0e(e){let t=e._canvas,n=t.clientWidth,i=t.clientHeight,o=a0e(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 l0e(e){let t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){let o=e._scene.camera.frustum;u(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function uC(e,t){e=In(e),t=y(t,y.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()}y(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 c=u(t.creditContainer)?In(t.creditContainer):n;c.appendChild(a);let l=u(t.creditViewport)?In(t.creditViewport):n,f=y(t.showRenderLoopErrors,!0),d=y(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=l,this._creditContainer=c,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=f,this._resolutionScale=1,this._useBrowserRecommendedResolution=d,this._forceResize=!1,this._clock=u(t.clock)?t.clock:new vd,c0e(this);try{let p=new aF({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:l,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:y(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=p,p.camera.constrainedAxis=h.UNIT_Z,a0e(this),l0e(this);let g=y(p.mapProjection.ellipsoid,ie.WGS84),m=t.globe;u(m)||(m=new qL(g)),m!==!1&&(p.globe=m,p.globe.shadows=y(t.terrainShadows,gn.RECEIVE_ONLY));let A=t.skyBox;u(A)||(A=new lF({sources:{positiveX:pS("px"),negativeX:pS("mx"),positiveY:pS("py"),negativeY:pS("my"),positiveZ:pS("pz"),negativeZ:pS("mz")}})),A!==!1&&(p.skyBox=A,p.sun=new dF,p.moon=new ZL);let x=t.skyAtmosphere;u(x)||(x=new cF(g)),x!==!1&&(p.skyAtmosphere=x);let C=t.globe===!1?!1:t.imageryProvider;u(C)||(C=D_()),C!==!1&&p.imageryLayers.addImageryProvider(C),u(t.terrainProvider)&&t.globe!==!1&&(p.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new Tu(i),u(t.sceneMode)&&(t.sceneMode===te.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===te.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=y(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;let T=this;this._onRenderError=function(E,S){if(T._useDefaultRenderLoop=!1,T._renderLoopRunning=!1,T._showRenderLoopErrors){let D="An error occurred while rendering.  Rendering has stopped.";T.showErrorPanel(D,void 0,S)}},p.renderError.addEventListener(this._onRenderError)}catch(p){if(f){let g="Error constructing CesiumWidget.",m='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:';this.showErrorPanel(g,m,p)}throw p}}Object.defineProperties(uC.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}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&zdt(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){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)}}});uC.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 c(){a.style.maxHeight=`${Math.max(Math.round(i.clientHeight*.9-100),30)}px`}c(),u(window.addEventListener)&&window.addEventListener("resize",c,!1);let l=u(t),f=u(n);if(l||f){let g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),f){let m=cm(n);l||(typeof n=="string"&&(n=new Error(n)),t=cm({name:n.name,message:n.message}),m=n.stack),typeof console<"u"&&console.error(`${e}
${t}
${m}`);let A=document.createElement("div");A.className="cesium-widget-errorPanel-message-details collapsed";let x=document.createElement("span");x.className="cesium-widget-errorPanel-more-details",x.appendChild(document.createTextNode("See more...")),A.appendChild(x),A.onclick=function(C){A.removeChild(x),A.appendChild(document.createTextNode(m)),A.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",A.onclick=void 0},a.appendChild(A)}g.innerHTML=`<p>${t}</p>`}let d=document.createElement("div");d.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(d);let p=document.createElement("button");p.setAttribute("type","button"),p.className="cesium-button",p.appendChild(document.createTextNode("OK")),p.onclick=function(){u(c)&&u(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},d.appendChild(p),i.appendChild(o)};uC.prototype.isDestroyed=function(){return!1};uC.prototype.destroy=function(){u(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),le(this)};uC.prototype.resize=function(){let e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,c0e(this),l0e(this),this._scene.requestRender())};uC.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();let e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};var hF=uC;var Hdt=new h(1,1,1);function Mq(e){e=y(e,Hdt),this._dimensions=h.clone(e)}Object.defineProperties(Mq.prototype,{dimensions:{get:function(){return this._dimensions},set:function(e){h.clone(e,this._dimensions)}}});var Gdt=new h;Mq.prototype.emit=function(e){let t=this._dimensions,n=h.multiplyByScalar(t,.5,Gdt),i=P.randomBetween(-n.x,n.x),o=P.randomBetween(-n.y,n.y),r=P.randomBetween(-n.z,n.z);e.position=h.fromElements(i,o,r,e.position),e.velocity=h.normalize(e.position,e.velocity)};var Lq=Mq;function N_(){this.featurePropertiesDirty=!1}Object.defineProperties(N_.prototype,{featuresLength:{get:function(){de.throwInstantiationError()}},pointsLength:{get:function(){de.throwInstantiationError()}},trianglesLength:{get:function(){de.throwInstantiationError()}},geometryByteLength:{get:function(){de.throwInstantiationError()}},texturesByteLength:{get:function(){de.throwInstantiationError()}},batchTableByteLength:{get:function(){de.throwInstantiationError()}},innerContents:{get:function(){de.throwInstantiationError()}},readyPromise:{get:function(){de.throwInstantiationError()}},tileset:{get:function(){de.throwInstantiationError()}},tile:{get:function(){de.throwInstantiationError()}},url:{get:function(){de.throwInstantiationError()}},batchTable:{get:function(){de.throwInstantiationError()}},metadata:{get:function(){de.throwInstantiationError()},set:function(e){de.throwInstantiationError()}},group:{get:function(){de.throwInstantiationError()},set:function(e){de.throwInstantiationError()}}});N_.prototype.hasProperty=function(e,t){de.throwInstantiationError()};N_.prototype.getFeature=function(e){de.throwInstantiationError()};N_.prototype.applyDebugSettings=function(e,t){de.throwInstantiationError()};N_.prototype.applyStyle=function(e){de.throwInstantiationError()};N_.prototype.update=function(e,t){de.throwInstantiationError()};N_.prototype.isDestroyed=function(){de.throwInstantiationError()};N_.prototype.destroy=function(){de.throwInstantiationError()};var Nq=N_;function _S(e,t){this._conditionsExpression=Ge(e,!0),this._conditions=e.conditions,this._runtimeConditions=void 0,jdt(this,t)}Object.defineProperties(_S.prototype,{conditionsExpression:{get:function(){return this._conditionsExpression}}});function Wdt(e,t){this.condition=e,this.expression=t}function jdt(e,t){let n=[],i=e._conditions;if(!u(i))return;let o=i.length;for(let r=0;r<o;++r){let s=i[r],a=String(s[0]),c=String(s[1]);n.push(new Wdt(new ju(a,t),new ju(c,t)))}e._runtimeConditions=n}_S.prototype.evaluate=function(e,t){let n=this._runtimeConditions;if(!u(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)}};_S.prototype.evaluateColor=function(e,t){let n=this._runtimeConditions;if(!u(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)}};_S.prototype.getShaderFunction=function(e,t,n,i){let o=this._runtimeConditions;if(!u(o)||o.length===0)return;let r="",s=o.length;for(let a=0;a<s;++a){let c=o[a],l=c.condition.getShaderExpression(t,n),f=c.expression.getShaderExpression(t,n);r+=`    ${a===0?"if":"else if"} (${l})
    {
        return ${f};
    }
`}return r=`${i} ${e}
{
${r}    return ${i}(1.0);
}
`,r};_S.prototype.getVariables=function(){let e=[],t=this._runtimeConditions;if(!u(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 mF=_S;function Ky(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,Ydt(this,e)}function Ydt(e,t){t=y(Ge(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(u(t.meta)){let i=t.defines,o=y(t.meta,y.EMPTY_OBJECT);for(let r in o)o.hasOwnProperty(r)&&(n[r]=new ju(o[r],i))}e._meta=n,e._ready=!0}function Qo(e,t){let n=y(e._style,y.EMPTY_OBJECT).defines;if(u(t)){if(typeof t=="boolean"||typeof t=="number")return new ju(String(t));if(typeof t=="string")return new ju(t,n);if(u(t.conditions))return new mF(t,n)}else return;return t}function $o(e){if(u(e)){if(u(e.expression))return e.expression;if(u(e.conditionsExpression))return Ge(e.conditionsExpression,!0)}else return;return e}Object.defineProperties(Ky.prototype,{style:{get:function(){return this._style}},show:{get:function(){return this._show},set:function(e){this._show=Qo(this,e),this._style.show=$o(this._show),this._showShaderFunctionReady=!1}},color:{get:function(){return this._color},set:function(e){this._color=Qo(this,e),this._style.color=$o(this._color),this._colorShaderFunctionReady=!1}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=Qo(this,e),this._style.pointSize=$o(this._pointSize),this._pointSizeShaderFunctionReady=!1}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=Qo(this,e),this._style.pointOutlineColor=$o(this._pointOutlineColor)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=Qo(this,e),this._style.pointOutlineWidth=$o(this._pointOutlineWidth)}},labelColor:{get:function(){return this._labelColor},set:function(e){this._labelColor=Qo(this,e),this._style.labelColor=$o(this._labelColor)}},labelOutlineColor:{get:function(){return this._labelOutlineColor},set:function(e){this._labelOutlineColor=Qo(this,e),this._style.labelOutlineColor=$o(this._labelOutlineColor)}},labelOutlineWidth:{get:function(){return this._labelOutlineWidth},set:function(e){this._labelOutlineWidth=Qo(this,e),this._style.labelOutlineWidth=$o(this._labelOutlineWidth)}},font:{get:function(){return this._font},set:function(e){this._font=Qo(this,e),this._style.font=$o(this._font)}},labelStyle:{get:function(){return this._labelStyle},set:function(e){this._labelStyle=Qo(this,e),this._style.labelStyle=$o(this._labelStyle)}},labelText:{get:function(){return this._labelText},set:function(e){this._labelText=Qo(this,e),this._style.labelText=$o(this._labelText)}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=Qo(this,e),this._style.backgroundColor=$o(this._backgroundColor)}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){this._backgroundPadding=Qo(this,e),this._style.backgroundPadding=$o(this._backgroundPadding)}},backgroundEnabled:{get:function(){return this._backgroundEnabled},set:function(e){this._backgroundEnabled=Qo(this,e),this._style.backgroundEnabled=$o(this._backgroundEnabled)}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){this._scaleByDistance=Qo(this,e),this._style.scaleByDistance=$o(this._scaleByDistance)}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){this._translucencyByDistance=Qo(this,e),this._style.translucencyByDistance=$o(this._translucencyByDistance)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){this._distanceDisplayCondition=Qo(this,e),this._style.distanceDisplayCondition=$o(this._distanceDisplayCondition)}},heightOffset:{get:function(){return this._heightOffset},set:function(e){this._heightOffset=Qo(this,e),this._style.heightOffset=$o(this._heightOffset)}},anchorLineEnabled:{get:function(){return this._anchorLineEnabled},set:function(e){this._anchorLineEnabled=Qo(this,e),this._style.anchorLineEnabled=$o(this._anchorLineEnabled)}},anchorLineColor:{get:function(){return this._anchorLineColor},set:function(e){this._anchorLineColor=Qo(this,e),this._style.anchorLineColor=$o(this._anchorLineColor)}},image:{get:function(){return this._image},set:function(e){this._image=Qo(this,e),this._style.image=$o(this._image)}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){this._disableDepthTestDistance=Qo(this,e),this._style.disableDepthTestDistance=$o(this._disableDepthTestDistance)}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){this._horizontalOrigin=Qo(this,e),this._style.horizontalOrigin=$o(this._horizontalOrigin)}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){this._verticalOrigin=Qo(this,e),this._style.verticalOrigin=$o(this._verticalOrigin)}},labelHorizontalOrigin:{get:function(){return this._labelHorizontalOrigin},set:function(e){this._labelHorizontalOrigin=Qo(this,e),this._style.labelHorizontalOrigin=$o(this._labelHorizontalOrigin)}},labelVerticalOrigin:{get:function(){return this._labelVerticalOrigin},set:function(e){this._labelVerticalOrigin=Qo(this,e),this._style.labelVerticalOrigin=$o(this._labelVerticalOrigin)}},meta:{get:function(){return this._meta},set:function(e){this._meta=e}}});Ky.fromUrl=function(e){return Oe.createIfNeeded(e).fetchJson(e).then(function(n){return new Ky(n)})};Ky.prototype.getColorShaderFunction=function(e,t,n){return this._colorShaderFunctionReady?(n.translucent=this._colorShaderTranslucent,this._colorShaderFunction):(this._colorShaderFunctionReady=!0,u(this.color)&&u(this.color.getShaderFunction)?this._colorShaderFunction=this.color.getShaderFunction(e,t,n,"vec4"):this._colorShaderFunction=void 0,this._colorShaderTranslucent=n.translucent,this._colorShaderFunction)};Ky.prototype.getShowShaderFunction=function(e,t,n){return this._showShaderFunctionReady?this._showShaderFunction:(this._showShaderFunctionReady=!0,u(this.show)&&u(this.show.getShaderFunction)?this._showShaderFunction=this.show.getShaderFunction(e,t,n,"bool"):this._showShaderFunction=void 0,this._showShaderFunction)};Ky.prototype.getPointSizeShaderFunction=function(e,t,n){return this._pointSizeShaderFunctionReady?this._pointSizeShaderFunction:(this._pointSizeShaderFunctionReady=!0,u(this.pointSize)&&u(this.pointSize.getShaderFunction)?this._pointSizeShaderFunction=this.pointSize.getShaderFunction(e,t,n,"float"):this._pointSizeShaderFunction=void 0,this._pointSizeShaderFunction)};Ky.prototype.getVariables=function(){let e=[];return u(this.color)&&u(this.color.getVariables)&&e.push.apply(e,this.color.getVariables()),u(this.show)&&u(this.show.getVariables)&&e.push.apply(e,this.show.getVariables()),u(this.pointSize)&&u(this.pointSize.getVariables)&&e.push.apply(e,this.pointSize.getVariables()),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};var fC=Ky;function pF(e){e=y(e,y.EMPTY_OBJECT),this._maximumSubtreeCount=y(e.maximumSubtreeCount,0),this._subtreeRequestCounter=0,this._queue=new Nx({comparator:pF.comparator})}pF.prototype.addSubtree=function(e){let t=new qdt(e,this._subtreeRequestCounter);this._subtreeRequestCounter++,this._queue.insert(t);let n=e.implicitCoordinates;if(n.level>0){let i=n.getParentSubtreeCoordinates(),o=this.find(i)}if(this._maximumSubtreeCount>0)for(;this._queue.length>this._maximumSubtreeCount&&this._queue.getMinimum()!==t;)this._queue.removeMinimum()};pF.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}};pF.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 qdt(e,t){this.subtree=e,this.stamp=t}var _F=pF;function Pl(){this.orientedBoundingBox=new Rn,this.boundingSphere=new se,this.boundTransform=new M,this.shapeTransform=new M,this._minBounds=h.clone(Pl.DefaultMinBounds,new h),this._maxBounds=h.clone(Pl.DefaultMaxBounds,new h),this.shaderUniforms={boxUvToRenderBoundsTransform:new M,boxUvToRenderBoundsScale:new h,boxUvToRenderBoundsTranslate:new h,boxUvToShapeUvScale:new h,boxUvToShapeUvTranslate:new h},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_RENDER_BOUNDS:void 0,BOX_HAS_SHAPE_BOUNDS:void 0,BOX_IS_2D:void 0},this.shaderMaximumIntersectionsLength=0}var Xdt=new h,Fq=new h,Kdt=new Z,Zdt=new M,Jdt=new h,Qdt=new h,$dt=new Z,eht=new h,tht=new h,nht=new h,iht=new h,oht=M.fromRotationTranslation(Z.fromUniformScale(2,new Z),new h(-1,-1,-1),new M),rht=M.fromRotation(Z.fromColumnMajorArray([0,0,1,0,1,0,1,0,0],new Z),new M),sht=M.fromRotation(Z.fromColumnMajorArray([1,0,0,0,0,1,0,1,0],new Z),new M);Pl.prototype.update=function(e,t,n,i,o){i=y(i,Pl.DefaultMinBounds),o=y(o,Pl.DefaultMaxBounds);let r=Pl.DefaultMinBounds,s=Pl.DefaultMaxBounds;t=this._minBounds=h.clamp(t,r,s,this._minBounds),n=this._maxBounds=h.clamp(n,r,s,this._maxBounds),i=h.clamp(i,r,s,eht),o=h.clamp(o,r,s,tht);let a=h.clamp(t,i,o,nht),c=h.clamp(n,i,o,iht),l=M.getScale(e,Fq);if(a.x>c.x||a.y>c.y||a.z>c.z||(a.x===c.x)+(a.y===c.y)+(a.z===c.z)>=2||i.x>o.x||i.y>o.y||i.z>o.z||l.x===0||l.y===0||l.z===0)return!1;this.shapeTransform=M.clone(e,this.shapeTransform),this.orientedBoundingBox=u0e(a,c,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=M.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let f=this.shaderUniforms,d=this.shaderDefines;for(let A in d)d.hasOwnProperty(A)&&(d[A]=void 0);let p=a.x!==r.x||c.x!==s.x||a.y!==r.y||c.y!==s.y||a.z!==r.z||c.z!==s.z,g=t.x!==r.x||n.x!==s.x||t.y!==r.y||n.y!==s.y||t.z!==r.z||n.z!==s.z,m=0;if(d.BOX_INTERSECTION_INDEX=m,m+=1,p){d.BOX_HAS_RENDER_BOUNDS=!0;let A=a,x=c,C=h.fromElements(2/(A.x===x.x?1:x.x-A.x),2/(A.y===x.y?1:x.y-A.y),2/(A.z===x.z?1:x.z-A.z),Qdt),T=h.fromElements(-C.x*.5*(A.x+x.x),-C.y*.5*(A.y+x.y),-C.z*.5*(A.z+x.z),Jdt),E=M.fromRotationTranslation(Z.fromScale(C,$dt),T,Zdt);if(A.x===x.x||A.y===x.y||A.z===x.z){d.BOX_IS_2D=!0;let S;A.x===x.x?S=rht:A.y===x.y?S=sht:A.z===x.z&&(S=M.IDENTITY),E=M.multiplyTransformation(S,E,E)}f.boxUvToRenderBoundsTransform=M.multiplyTransformation(E,oht,f.boxUvToRenderBoundsTransform),f.boxUvToRenderBoundsScale=M.getScale(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsScale),f.boxUvToRenderBoundsTranslate=M.getTranslation(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsTranslate)}if(g){d.BOX_HAS_SHAPE_BOUNDS=!0;let A=t,x=n;f.boxUvToShapeUvScale=h.fromElements(2/(A.x===x.x?1:x.x-A.x),2/(A.y===x.y?1:x.y-A.y),2/(A.z===x.z?1:x.z-A.z),f.boxUvToShapeUvScale),f.boxUvToShapeUvTranslate=h.fromElements(-f.boxUvToShapeUvScale.x*(A.x*.5+.5),-f.boxUvToShapeUvScale.y*(A.y*.5+.5),-f.boxUvToShapeUvScale.z*(A.z*.5+.5),f.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=m,!0};var aht=new h,cht=new h;Pl.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){let r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),c=h.fromElements(P.lerp(r.x,s.x,a*t),P.lerp(r.y,s.y,a*n),P.lerp(r.z,s.z,a*i),aht),l=h.fromElements(P.lerp(r.x,s.x,a*(t+1)),P.lerp(r.y,s.y,a*(n+1)),P.lerp(r.z,s.z,a*(i+1)),cht);return u0e(c,l,this.shapeTransform,o)};Pl.prototype.computeApproximateStepSize=function(e){return 1/h.maximumComponent(e)};Pl.DefaultMinBounds=Object.freeze(new h(-1,-1,-1));Pl.DefaultMaxBounds=Object.freeze(new h(1,1,1));function u0e(e,t,n,i){let o=Pl.DefaultMinBounds,r=Pl.DefaultMaxBounds;if(h.equals(e,o)&&h.equals(t,r))i.center=M.getTranslation(n,i.center),i.halfAxes=M.getMatrix3(n,i.halfAxes);else{let a=M.getScale(n,Fq),c=h.midpoint(e,t,Xdt);i.center=M.multiplyByPoint(n,c,i.center),a=h.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),Fq);let l=M.getRotation(n,Kdt);i.halfAxes=Z.setScale(l,a,i.halfAxes)}return i}var Cm=Pl;function f0e(e,t,n,i){this._resource=e,this._metadataTable=void 0;let o;u(t)?o={json:t,binary:void 0}:o=fht(n),this._readyPromise=lht(this,o.json,o.binary,i)}Object.defineProperties(f0e.prototype,{readyPromise:{get:function(){return this._readyPromise}},metadataTable:{get:function(){return this._metadataTable}}});function lht(e,t,n,i){return uht(e,t,n).then(function(o){let r={},s=t.bufferViews.length;for(let l=0;l<s;++l){let f=t.bufferViews[l],d=f.byteOffset,p=d+f.byteLength,m=o[f.buffer].subarray(d,p);r[l]=m}let a=t.voxelTable,c=t.propertyTables[a];return e._metadataTable=new fl({count:c.count,properties:c.properties,class:i.classes[c.class],bufferViews:r}),e})}function uht(e,t,n){let i=t.buffers.length,o=new Array(i);for(let r=0;r<i;r++){let s=t.buffers[r];if(u(s.uri)){let c=e._resource.getDerivedResource({url:s.uri});o[r]=c.fetchArrayBuffer().then(function(l){return new Uint8Array(l)})}else o[r]=Promise.resolve(n)}return Promise.all(o)}function fht(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=Oo(e,i,o);i+=o;let a=e.subarray(i,i+r);return{json:s,binary:a}}var gF=f0e;function Wr(){this.orientedBoundingBox=new Rn,this.boundingSphere=new se,this.boundTransform=new M,this.shapeTransform=new M,this._minimumRadius=Wr.DefaultMinBounds.x,this._maximumRadius=Wr.DefaultMaxBounds.x,this._minimumHeight=Wr.DefaultMinBounds.y,this._maximumHeight=Wr.DefaultMaxBounds.y,this._minimumAngle=Wr.DefaultMinBounds.z,this._maximumAngle=Wr.DefaultMaxBounds.z,this.shaderUniforms={cylinderUvToRenderBoundsScale:new h,cylinderUvToRenderBoundsTranslate:new h,cylinderUvToRenderRadiusMin:0,cylinderRenderAngleMinMax:new H,cylinderUvToShapeUvRadius:new H,cylinderUvToShapeUvHeight:new H,cylinderUvToShapeUvAngle:new H,cylinderShapeUvAngleMinMax:new H,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_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_EQUAL_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO: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 h0e=new h,dht=new h,hht=new h,mht=new Z,pht=new M,_ht=new M,ght=M.fromRotationTranslation(Z.fromUniformScale(2,new Z),new h(-1,-1,-1),new M);Wr.prototype.update=function(e,t,n,i,o){i=y(i,Wr.DefaultMinBounds),o=y(o,Wr.DefaultMaxBounds);let r=Wr.DefaultMinBounds.x,s=Wr.DefaultMaxBounds.x,a=Wr.DefaultMinBounds.y,c=Wr.DefaultMaxBounds.y,l=Wr.DefaultMinBounds.z,f=Wr.DefaultMaxBounds.z,d=f-l,p=.5*d,g=P.EPSILON10,m=P.EPSILON3,A=P.EPSILON10,x=P.clamp(t.x,r,s),C=P.clamp(n.x,r,s),T=P.clamp(i.x,r,s),E=P.clamp(o.x,r,s),S=Math.max(x,T),D=Math.min(C,E),w=P.clamp(t.y,a,c),R=P.clamp(n.y,a,c),O=P.clamp(i.y,a,c),L=P.clamp(o.y,a,c),N=Math.max(w,O),_=Math.min(R,L),b=P.negativePiToPi(t.z),v=P.negativePiToPi(n.z),I=P.negativePiToPi(i.z),B=P.negativePiToPi(o.z),F=Math.max(b,I),k=Math.min(v,B),U=M.getScale(e,h0e);if(D===0||S>D||N>_||P.equalsEpsilon(U.x,0,void 0,g)||P.equalsEpsilon(U.y,0,void 0,g)||P.equalsEpsilon(U.z,0,void 0,g))return!1;this._minimumRadius=x,this._maximumRadius=C,this._minimumHeight=w,this._maximumHeight=R,this._minimumAngle=b,this._maximumAngle=v,this.shapeTransform=M.clone(e,this.shapeTransform),this.orientedBoundingBox=Uq(S,D,N,_,F,k,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=M.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let X=x===r&&C===s,j=w===a&&R===c,Q=v<b,W=v-b+Q*d,K=W>p+A&&W<d-A,J=W>A&&W<p-A,_e=W>=p-A&&W<=p+A,xe=W<=A,re=K||J||_e||xe,ye=P.equalsEpsilon(b,l,void 0,m),fe=P.equalsEpsilon(v,f,void 0,m),Se=D===s,we=S===r,Ve=N===a&&_===c,qe=k<F,mt=k-F+qe*d,Ht=mt>p+A&&mt<d-A,fn=mt>A&&mt<p-A,dt=mt>=p-A&&mt<=p+A,Tn=mt<=A,Jn=Ht||fn||dt||Tn,Gt=this.shaderUniforms,Je=this.shaderDefines;for(let me in Je)Je.hasOwnProperty(me)&&(Je[me]=void 0);let pe=0;if(Je.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=pe,pe+=1,we||(Je.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,Je.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=pe,pe+=1,Gt.cylinderUvToRenderRadiusMin=D/S),Se||(Je.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX=!0),S===D&&(Je.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),Ve||(Je.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT=!0),N===_&&(Je.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),w===R&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0),x===C&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT=!0),!X){Je.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;let me=1/(C-x),be=x/(x-C);Gt.cylinderUvToShapeUvRadius=H.fromElements(me,be,Gt.cylinderUvToShapeUvRadius)}if(!j){Je.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;let me=2/(R-w),be=(w+1)/(w-R);Gt.cylinderUvToShapeUvHeight=H.fromElements(me,be,Gt.cylinderUvToShapeUvHeight)}if(!Se||!Ve){let me=.5*(_-N),be=h.fromElements(1/D,1/D,1/(me===0?1:me),hht),St=h.fromElements(0,0,-be.z*.5*(N+_),dht),qt=M.fromRotationTranslation(Z.fromScale(be,mht),St,pht),Kn=M.multiplyTransformation(qt,ght,_ht);Gt.cylinderUvToRenderBoundsScale=M.getScale(Kn,Gt.cylinderUvToRenderBoundsScale),Gt.cylinderUvToRenderBoundsTranslate=M.getTranslation(Kn,Gt.cylinderUvToRenderBoundsTranslate)}if(Q&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),Jn&&(Je.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,Je.CYLINDER_INTERSECTION_INDEX_ANGLE=pe,Ht?(Je.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,pe+=1):fn?(Je.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,pe+=2):dt?(Je.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF=!0,pe+=1):Tn&&(Je.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,pe+=2),Gt.cylinderRenderAngleMinMax=H.fromElements(F,k,Gt.cylinderAngleMinMax)),re){Je.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,xe&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0),ye&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),fe&&(Je.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);let me=(b-l)/d,be=(v-l)/d,St=1-W/d;Gt.cylinderShapeUvAngleMinMax=H.fromElements(me,be,Gt.cylinderShapeUvAngleMinMax),Gt.cylinderShapeUvAngleRangeZeroMid=(be+.5*St)%1;let qt=d/W,Kn=-(b-l)/W;Gt.cylinderUvToShapeUvAngle=H.fromElements(qt,Kn,Gt.cylinderUvToShapeUvAngle)}return this.shaderMaximumIntersectionsLength=pe,!0};Wr.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){let r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,c=this._maximumHeight,l=this._minimumAngle,f=this._maximumAngle,d=1/Math.pow(2,e),p=P.lerp(r,s,t*d),g=P.lerp(r,s,(t+1)*d),m=P.lerp(a,c,n*d),A=P.lerp(a,c,(n+1)*d),x=P.lerp(l,f,i*d),C=P.lerp(l,f,(i+1)*d);return Uq(p,g,m,A,x,C,this.shapeTransform,o)};var yht=new Rn,Aht=new h,xht=new h,Cht=new h;Wr.prototype.computeApproximateStepSize=function(e){let t=this.shapeTransform,n=this._minimumRadius,i=this._maximumRadius,o=this._minimumHeight,r=this._maximumHeight,s=this._minimumAngle,a=this._maximumAngle,c=1-1/e.x,l=1-1/e.y,f=1-1/e.z,d=P.lerp(n,i,c),p=P.lerp(o,r,l),g=P.lerp(s,a,f),C=Uq(d,i,p,r,g,a,t,yht),T=Z.getScale(C.halfAxes,Aht),E=M.getScale(t,xht),S=h.divideComponents(T,E,Cht);return h.minimumComponent(S)};Wr.DefaultMinBounds=Object.freeze(new h(0,-1,-P.PI));Wr.DefaultMaxBounds=Object.freeze(new h(1,1,+P.PI));var Tht=5,Eht=new Array(Tht),bht=new h,Sht=new Z,Dht=new M,vht=new M,wht=new M,Vq=new M,Iht=new h,Pht=new h,Oht=new h,m0e=new Array(8);for(let e=0;e<8;e++)m0e[e]=new h;function d0e(e,t,n){return Math.abs(oe.dot(e,t))<n}function Rht(e){let t=M.getColumn(e,0,Iht),n=M.getColumn(e,1,Pht),i=M.getColumn(e,2,Oht),o=P.EPSILON4;return d0e(t,n,o)&&d0e(n,i,o)}function Bht(e,t){let n=m0e;h.fromElements(-.5,-.5,-.5,n[0]),h.fromElements(-.5,-.5,.5,n[1]),h.fromElements(-.5,.5,-.5,n[2]),h.fromElements(-.5,.5,.5,n[3]),h.fromElements(.5,-.5,-.5,n[4]),h.fromElements(.5,-.5,.5,n[5]),h.fromElements(.5,.5,-.5,n[6]),h.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)M.multiplyByPoint(e,n[i],n[i]);return Rn.fromPoints(n,t)}function Uq(e,t,n,i,o,r,s,a){let c=Wr.DefaultMinBounds,l=Wr.DefaultMaxBounds,f=c.x,d=l.x,p=c.y,g=l.y,m=c.z,A=l.z;if(e===f&&t===d&&n===p&&i===g&&o===m&&r===A)return a.center=M.getTranslation(s,a.center),a.halfAxes=M.getMatrix3(s,a.halfAxes),a;r<o&&(r+=P.TWO_PI);let C=r-o,T=o+C*.5,E=Eht,S=0;E[S++]=o,E[S++]=r,E[S++]=T,C>P.PI&&(E[S++]=T-P.PI_OVER_TWO,E[S++]=T+P.PI_OVER_TWO);let D=1,w=1,R=-1,O=-1;for(let Q=0;Q<S;++Q){let W=E[Q]-T,K=Math.cos(W),J=Math.sin(W),_e=K*e,xe=J*e,re=K*t,ye=J*t;D=Math.min(D,_e),w=Math.min(w,xe),D=Math.min(D,re),w=Math.min(w,ye),R=Math.max(R,_e),O=Math.max(O,xe),R=Math.max(R,re),O=Math.max(O,ye)}let L=R-D,N=O-w,_=i-n,b=(D+R)*.5,v=(w+O)*.5,I=(n+i)*.5,B=h.fromElements(b,v,I,bht),F=Z.fromRotationZ(T,Sht),k=h.fromElements(L,N,_,h0e),U=M.fromScale(k,wht),G=M.fromRotation(F,vht),V=M.fromTranslation(B,Dht),X=M.multiplyTransformation(G,M.multiplyTransformation(V,U,Vq),Vq),j=M.multiplyTransformation(s,X,Vq);return Rht(j)?Rn.fromTransformation(j,a):Bht(j,a)}var Tm=Wr;function Ol(){this.orientedBoundingBox=new Rn,this.boundingSphere=new se,this.boundTransform=new M,this.shapeTransform=new M,this._rectangle=new ce,this._minimumHeight=Ol.DefaultMinBounds.z,this._maximumHeight=Ol.DefaultMaxBounds.z,this._ellipsoid=new ie,this._translation=new h,this._rotation=new Z,this.shaderUniforms={ellipsoidRadiiUv:new h,ellipsoidInverseRadiiSquaredUv:new h,ellipsoidRenderLongitudeMinMax:new H,ellipsoidShapeUvLongitudeMinMaxMid:new h,ellipsoidUvToShapeUvLongitude:new H,ellipsoidUvToShapeUvLatitude:new H,ellipsoidRenderLatitudeCosSqrHalfMinMax:new H,ellipsoidInverseHeightDifferenceUv:0,ellipseInnerRadiiUv:new H,ellipsoidInverseInnerScaleUv:0,ellipsoidInverseOuterScaleUv:0},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_EQUAL_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_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE: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_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT:void 0,ELLIPSOID_IS_SPHERE: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 Mht=new h,Lht=new Z,p0e=new h,_0e=new h,g0e=new h,y0e=new h,Nht=new ce;Ol.prototype.update=function(e,t,n,i,o){i=y(i,Ol.DefaultMinBounds),o=y(o,Ol.DefaultMaxBounds);let r=Ol.DefaultMinBounds.x,s=Ol.DefaultMaxBounds.x,a=s-r,c=.5*a,l=Ol.DefaultMinBounds.y,f=Ol.DefaultMaxBounds.y,d=f-l,p=P.EPSILON10,g=P.EPSILON3,m=P.EPSILON10,A=P.EPSILON10,x=P.EPSILON3,C=P.clamp(t.x,r,s),T=P.clamp(n.x,r,s),E=P.clamp(i.x,r,s),S=P.clamp(o.x,r,s),D=Math.max(C,E),w=Math.min(T,S),R=P.clamp(t.y,l,f),O=P.clamp(n.y,l,f),L=P.clamp(i.y,l,f),N=P.clamp(o.y,l,f),_=Math.max(R,L),b=Math.min(O,N),v=M.getScale(e,Mht),I=v.x===v.y&&v.y===v.z,B=h.minimumComponent(v),F=Math.max(t.z,-B),k=Math.max(n.z,-B),U=Math.max(i.z,-B),G=Math.max(o.z,-B),V=Math.max(F,U),X=Math.min(k,G),j=h.add(v,h.fromElements(F,F,F,_0e),_0e),Q=h.add(v,h.fromElements(k,k,k,p0e),p0e),W=h.maximumComponent(Q),K=h.add(v,h.fromElements(V,V,V,y0e),y0e),J=h.add(v,h.fromElements(X,X,X,g0e),g0e);if(_>b||_===f||b===l||V>X||P.equalsEpsilon(J,h.ZERO,void 0,p))return!1;this._rectangle=ce.fromRadians(C,R,T,O),this._translation=M.getTranslation(e,this._translation),this._rotation=M.getRotation(e,this._rotation),this._ellipsoid=ie.fromCartesian3(v,this._ellipsoid),this._minimumHeight=F,this._maximumHeight=k;let _e=ce.fromRadians(D,_,w,b,Nht);this.orientedBoundingBox=A0e(_e,V,X,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=M.fromRotationTranslation(Z.setScale(this._rotation,Q,Lht),this._translation,this.shapeTransform),this.boundTransform=M.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);let xe=w<D,re=w-D+xe*a,ye=re<=m,fe=re>c+m&&re<a-m,Se=re>=c-m&&re<=c+m,we=re>m&&re<c-m,Ve=ye||fe||Se||we,qe=T<C,mt=T-C+qe*a,Ht=mt<=m,fn=mt>c+m&&mt<a-m,dt=mt>=c-m&&mt<=c+m,Tn=mt>m&&mt<c-m,Jn=Ht||fn||dt||Tn,Gt=b<-x,Je=b>=-x&&b<=+x,pe=b>+x&&b<f-A,me=Gt||Je||pe,be=_>l+A&&_<-x,St=_>=-x&&_<=+x,qt=_>+x,Kn=be||St||qt,Ro=me||Kn,Uo=O-R,Ao=O<-x,Yr=O>=-x&&O<=+x,Be=O>+x&&O<f-A,it=Ao||Yr||Be,Ke=R>l+A&&R<-x,Ze=R>=-x&&R<=+x,ft=R>+x,En=it||(Ke||Ze||ft),so=!h.equals(K,h.ZERO),So=!h.equals(J,h.ZERO),ns=so||So,Nr=X-V,Hi=!h.equals(j,h.ZERO),Oi=!h.equals(Q,h.ZERO),Ar=Hi||Oi,Mn=this.shaderUniforms,Yn=this.shaderDefines;for(let ti in Yn)Yn.hasOwnProperty(ti)&&(Yn[ti]=void 0);Mn.ellipsoidRadiiUv=h.divideByScalar(Q,W,Mn.ellipsoidRadiiUv),Mn.ellipsoidInverseRadiiSquaredUv=h.divideComponents(h.ONE,h.multiplyComponents(Mn.ellipsoidRadiiUv,Mn.ellipsoidRadiiUv,Mn.ellipsoidInverseRadiiSquaredUv),Mn.ellipsoidInverseRadiiSquaredUv);let Zn=0;if(Yn.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=Zn,Zn+=1,ns&&(Nr===0&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),so&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN=!0,Yn.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=Zn,Zn+=1,Mn.ellipsoidInverseInnerScaleUv=W/(W-(k-V))),So&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX=!0,Mn.ellipsoidInverseOuterScaleUv=W/(W-(k-X)))),Ar){if(Hi){Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN=!0;let ti=(k-F)/W;Mn.ellipsoidInverseHeightDifferenceUv=1/ti,Mn.ellipseInnerRadiiUv=H.fromElements(Mn.ellipsoidRadiiUv.x*(1-ti),Mn.ellipsoidRadiiUv.z*(1-ti),Mn.ellipseInnerRadiiUv)}F===k&&(Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0)}if(Ve&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,Yn.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=Zn,fe?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,Zn+=1):we?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,Zn+=2):Se?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF=!0,Zn+=1):ye&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,Zn+=2),Mn.ellipsoidRenderLongitudeMinMax=H.fromElements(D,w,Mn.ellipsoidRenderLongitudeMinMax)),Jn){Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,T<C&&(Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0);let hc=a/mt,Do=-(C-r)/mt;Mn.ellipsoidUvToShapeUvLongitude=H.fromElements(hc,Do,Mn.ellipsoidUvToShapeUvLongitude)}if(Ve){let ti=P.equalsEpsilon(D,r,void 0,g),hc=P.equalsEpsilon(w,s,void 0,g);ti&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),hc&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);let Do=(C-r)/a,Bo=(T-r)/a,kf=(w-r)/a,er=1-re/a,ba=(kf+.5*er)%1;Mn.ellipsoidShapeUvLongitudeMinMaxMid=h.fromElements(Do,Bo,ba,Mn.ellipsoidShapeUvLongitudeMinMaxMid)}if(Ro){Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE=!0,Kn&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,Yn.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=Zn,be?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,Zn+=1):St?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,Zn+=1):qt&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,Zn+=2)),me&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,Yn.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=Zn,Gt?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,Zn+=2):Je?(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,Zn+=1):pe&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,Zn+=1)),_===b&&(Yn.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);let ti=Math.pow(Math.cos(P.PI_OVER_TWO-Math.abs(_)),2),hc=Math.pow(Math.cos(P.PI_OVER_TWO-Math.abs(b)),2);Mn.ellipsoidRenderLatitudeCosSqrHalfMinMax=H.fromElements(ti,hc,Mn.ellipsoidRenderLatitudeCosSqrHalfMinMax)}if(En){Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,R===O&&(Yn.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);let ti=d/Uo,hc=(l-R)/Uo;Mn.ellipsoidUvToShapeUvLatitude=H.fromElements(ti,hc,Mn.ellipsoidUvToShapeUvLatitude)}return I&&(Yn.ELLIPSOID_IS_SPHERE=!0),this.shaderMaximumIntersectionsLength=Zn,!0};var Fht=new ce;Ol.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){let r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,c=n*r,l=(n+1)*r,f=i*r,d=(i+1)*r,p=ce.subsection(this._rectangle,s,c,a,l,Fht),g=P.lerp(this._minimumHeight,this._maximumHeight,f),m=P.lerp(this._minimumHeight,this._maximumHeight,d);return A0e(p,g,m,this._ellipsoid,this._translation,this._rotation,o)};Ol.prototype.computeApproximateStepSize=function(e){let n=this._ellipsoid.maximumRadius,i=this._minimumHeight,o=this._maximumHeight;return .5*((o-i)/(n+o))/e.z};function A0e(e,t,n,i,o,r,s){return s=Rn.fromRectangle(e,t,n,i,s),s.center=h.add(s.center,o,s.center),s.halfAxes=Z.multiply(s.halfAxes,r,s.halfAxes),s}Ol.DefaultMinBounds=Object.freeze(new h(-P.PI,-P.PI_OVER_TWO,-Number.MAX_VALUE));Ol.DefaultMaxBounds=Object.freeze(new h(+P.PI,+P.PI_OVER_TWO,+Number.MAX_VALUE));var dC=Ol;var Iu={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};Iu.getMinBounds=function(e){switch(e){case Iu.BOX:return Cm.DefaultMinBounds;case Iu.ELLIPSOID:return dC.DefaultMinBounds;case Iu.CYLINDER:return Tm.DefaultMinBounds}};Iu.getMaxBounds=function(e){switch(e){case Iu.BOX:return Cm.DefaultMaxBounds;case Iu.ELLIPSOID:return dC.DefaultMaxBounds;case Iu.CYLINDER:return Tm.DefaultMaxBounds}};Iu.getShapeConstructor=function(e){switch(e){case Iu.BOX:return Cm;case Iu.ELLIPSOID:return dC;case Iu.CYLINDER:return Tm}};var zi=Object.freeze(Iu);function kq(e){e=y(e,y.EMPTY_OBJECT),this.ready=!1,this.shapeTransform=void 0,this.globalTransform=void 0,this.shape=void 0,this.minBounds=void 0,this.maxBounds=void 0,this.dimensions=void 0,this.paddingBefore=void 0,this.paddingAfter=void 0,this.names=void 0,this.types=void 0,this.componentTypes=void 0,this.minimumValues=void 0,this.maximumValues=void 0,this.maximumTileCount=void 0,this._implicitTileset=void 0,this._subtreeCache=new _F;let t=this,n;this._readyPromise=Promise.resolve(e.url).then(function(i){let o=Oe.createIfNeeded(i);return o.fetchJson().then(function(r){return n=r,Uht(n),Wht(n,o).promise}).then(function(r){let s=n.root,a=s.content.extensions["3DTILES_content_voxels"],c=a.class,l=ai(n,"3DTILES_metadata")?n.extensions["3DTILES_metadata"]:n,f=r.schema,d=new ZA({metadataJson:l,schema:f});jht(t,d,c);let p=new QA(o,s,f),{shape:g,minBounds:m,maxBounds:A,shapeTransform:x,globalTransform:C}=kht(s);t.shape=g,t.minBounds=m,t.maxBounds=A,t.dimensions=h.unpack(a.dimensions),t.shapeTransform=x,t.globalTransform=C,t.maximumTileCount=Vht(d);let T,E;return u(a.padding)&&(T=h.unpack(a.padding.before),E=h.unpack(a.padding.after)),t.paddingBefore=T,t.paddingAfter=E,t._implicitTileset=p,Ui.unload(r),t.ready=!0,t})})}Object.defineProperties(kq.prototype,{readyPromise:{get:function(){return this._readyPromise}}});function Vht(e){if(u(e.tileset))return e.tileset.getPropertyBySemantic(AA.TILESET_TILE_COUNT)}function Uht(e){let t=e.root;if(!u(t.content))throw new ue("Root must have content");if(!ai(t.content,"3DTILES_content_voxels"))throw new ue("Root tile content must have 3DTILES_content_voxels extension");if(!ai(t,"3DTILES_implicit_tiling")&&!u(t.implicitTiling))throw new ue("Root tile must have implicit tiling");if(!u(e.schema)&&!u(e.schemaUri)&&!ai(e,"3DTILES_metadata"))throw new ue("Tileset must have a metadata schema")}function kht(e){let t=e.boundingVolume,n;if(u(e.transform)?n=M.unpack(e.transform):n=M.clone(M.IDENTITY),u(t.box))return Hht(t.box,n);if(u(t.region))return zht(t.region);if(ai(t,"3DTILES_bounding_volume_cylinder"))return Ght(t.extensions["3DTILES_bounding_volume_cylinder"].cylinder,n);throw new ue("Only box, region and 3DTILES_bounding_volume_cylinder are supported in Cesium3DTilesVoxelProvider")}function zht(e){let t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],s=e[5],a=M.fromScale(ie.WGS84.radii),c=t,l=i,f=n,d=o,p=r,g=s,m=new h(c,f,p),A=new h(l,d,g);return{shape:zi.ELLIPSOID,minBounds:m,maxBounds:A,shapeTransform:a,globalTransform:M.clone(M.IDENTITY)}}function Hht(e,t){let n=Rn.unpack(e),i=M.fromRotationTranslation(n.halfAxes,n.center);return{shape:zi.BOX,minBounds:h.clone(Cm.DefaultMinBounds),maxBounds:h.clone(Cm.DefaultMaxBounds),shapeTransform:i,globalTransform:t}}function Ght(e,t){let n=Rn.unpack(e),i=M.fromRotationTranslation(n.halfAxes,n.center);return{shape:zi.CYLINDER,minBounds:h.clone(Tm.DefaultMinBounds),maxBounds:h.clone(Tm.DefaultMaxBounds),shapeTransform:i,globalTransform:t}}function Wht(e,t){let{schemaUri:n,schema:i}=e;return u(n)?Ui.loadSchema({resource:t.getDerivedResource({url:n})}):Ui.loadSchema({schema:i})}function jht(e,t,n){let{schema:i,statistics:o}=t,r=o?.classes[n],s=i.classes[n].properties,a=Object.entries(s).map(([d,p])=>{let{type:g,componentType:m}=p,A=r?.properties[d].min,x=r?.properties[d].max,C=zt.getComponentCount(g),T=x0e(A,C),E=x0e(x,C);return{id:d,type:g,componentType:m,minValue:T,maxValue:E}});e.names=a.map(d=>d.id),e.types=a.map(d=>d.type),e.componentTypes=a.map(d=>d.componentType);let c=a.map(d=>d.minValue),l=a.map(d=>d.maxValue),f=c.some(u);e.minimumValues=f?c:void 0,e.maximumValues=f?l:void 0}function x0e(e,t){if(!u(e))return;let n=Array.isArray(e)?e:[e];return Array.from({length:t},(i,o)=>n[o])}function Yht(e,t){let n=e.contentUriTemplates[0].getDerivedResource({templateValues:t.getTemplateValues()}),i=e.baseResource.getDerivedResource({url:n.url});return i.fetchArrayBuffer().then(function(o){let r=Hh(o);return new gF(i,r.jsonPayload,r.binaryPayload,e.metadataSchema).readyPromise})}function qht(e,t){let n=e._implicitTileset,i=e._subtreeCache,o=i.find(t);if(u(o))return o.readyPromise;let r=n.subtreeUriTemplate.getDerivedResource({templateValues:t.getTemplateValues()}),s=n.baseResource.getDerivedResource({url:r.url});return s.fetchArrayBuffer().then(function(a){let c=i.find(t);if(u(c))return c.readyPromise;let l=Hh(a);return c=new yA(s,l.jsonPayload,l.binaryPayload,n,t),i.addSubtree(c),c.readyPromise})}kq.prototype.requestData=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.tileLevel,0),n=y(e.tileX,0),i=y(e.tileY,0),o=y(e.tileZ,0);if(y(e.keyframe,0)!==0)return;let s=this._implicitTileset,a=this.names,c=new $A({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:t,x:n,y:i,z:o}),l=c.isSubtreeRoot()&&c.level>0,f=l?c.getParentSubtreeCoordinates():c.getSubtreeCoordinates();return qht(this,f).then(function(p){return(l?p.childSubtreeIsAvailableAtCoordinates(c):p.tileIsAvailableAtCoordinates(c))?Yht(s,c):Promise.reject("Tile is not available")}).then(function(p){return a.map(function(g){return p.metadataTable.getPropertyTypedArray(g)})})};var zq=kq;function Hq(e){e=y(e,1),this._radius=y(e,1)}Object.defineProperties(Hq.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}});Hq.prototype.emit=function(e){let t=P.randomBetween(0,P.TWO_PI),n=P.randomBetween(0,this._radius),i=n*Math.cos(t),o=n*Math.sin(t),r=0;e.position=h.fromElements(i,o,r,e.position),e.velocity=h.clone(h.UNIT_Z,e.velocity)};var yF=Hq;var Gq={CUMULUS:0};Gq.validate=function(e){return e===Gq.CUMULUS};var gS=Object.freeze(Gq);function rh(e,t){if(e=y(e,y.EMPTY_OBJECT),this._show=y(e.show,!0),this._position=h.clone(y(e.position,h.ZERO)),!u(e.scale)&&u(e.maximumSize))this._maximumSize=h.clone(e.maximumSize),this._scale=new H(this._maximumSize.x,this._maximumSize.y);else{this._scale=H.clone(y(e.scale,new H(20,12)));let n=new h(this._scale.x,this._scale.y,Math.min(this._scale.x,this._scale.y)/1.5);this._maximumSize=h.clone(y(e.maximumSize,n))}this._slice=y(e.slice,-1),this._color=z.clone(y(e.color,z.WHITE)),this._brightness=y(e.brightness,1),this._cloudCollection=t,this._index=-1}var Xht=rh.SHOW_INDEX=0,Kht=rh.POSITION_INDEX=1,Zht=rh.SCALE_INDEX=2,Jht=rh.MAXIMUM_SIZE_INDEX=3,Qht=rh.SLICE_INDEX=4,$ht=rh.BRIGHTNESS_INDEX=5,emt=rh.COLOR_INDEX=6;rh.NUMBER_OF_PROPERTIES=7;function hC(e,t){let n=e._cloudCollection;u(n)&&(n._updateCloud(e,t),e._dirty=!0)}Object.defineProperties(rh.prototype,{show:{get:function(){return this._show},set:function(e){this._show!==e&&(this._show=e,hC(this,Xht))}},position:{get:function(){return this._position},set:function(e){let t=this._position;h.equals(t,e)||(h.clone(e,t),hC(this,Kht))}},scale:{get:function(){return this._scale},set:function(e){let t=this._scale;H.equals(t,e)||(H.clone(e,t),hC(this,Zht))}},maximumSize:{get:function(){return this._maximumSize},set:function(e){let t=this._maximumSize;h.equals(t,e)||(h.clone(e,t),hC(this,Jht))}},color:{get:function(){return this._color},set:function(e){let t=this._color;z.equals(t,e)||(z.clone(e,t),hC(this,emt))}},slice:{get:function(){return this._slice},set:function(e){this._slice!==e&&(this._slice=e,hC(this,Qht))}},brightness:{get:function(){return this._brightness},set:function(e){this._brightness!==e&&(this._brightness=e,hC(this,$ht))}}});rh.prototype._destroy=function(){this._cloudCollection=void 0};var Pu=rh;var Ou,W4=new h,tmt={positionHighAndScaleX:0,positionLowAndScaleY:1,packedAttribute0:2,packedAttribute1:3,color:4},nmt={direction:0,positionHighAndScaleX:1,positionLowAndScaleY:2,packedAttribute0:3,packedAttribute1:4,color:5},imt=Pu.SHOW_INDEX,omt=Pu.POSITION_INDEX,rmt=Pu.SCALE_INDEX,smt=Pu.MAXIMUM_SIZE_INDEX,amt=Pu.SLICE_INDEX,cmt=Pu.BRIGHTNESS_INDEX,lmt=Pu.NUMBER_OF_PROPERTIES,umt=Pu.COLOR_INDEX;function sh(e){e=y(e,y.EMPTY_OBJECT),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(lmt),this._noiseTexture=void 0,this._textureSliceWidth=128,this._noiseTextureRows=4,this.noiseDetail=y(e.noiseDetail,16),this.noiseOffset=h.clone(y(e.noiseOffset,h.ZERO)),this._loading=!1,this._ready=!1;let t=this;this._uniforms={u_noiseTexture:function(){return t._noiseTexture},u_noiseTextureDimensions:C0e(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=y(e.show,!0),this._colorCommands=[],this.debugBillboards=y(e.debugBillboards,!1),this._compiledDebugBillboards=!1,this.debugEllipsoids=y(e.debugEllipsoids,!1),this._compiledDebugEllipsoids=!1}function C0e(e){return function(){return W4.x=e._textureSliceWidth,W4.y=e._noiseTextureRows,W4.z=1/e._noiseTextureRows,W4}}Object.defineProperties(sh.prototype,{length:{get:function(){return jq(this),this._clouds.length}}});function T0e(e){let t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}sh.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.cloudType,gS.CUMULUS),n;return t===gS.CUMULUS&&(n=new Pu(e,this),n._index=this._clouds.length,this._clouds.push(n),this._createVertexArray=!0),n};sh.prototype.remove=function(e){return this.contains(e)?(this._clouds[e._index]=void 0,this._cloudsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};sh.prototype.removeAll=function(){T0e(this._clouds),this._clouds=[],this._cloudsToUpdate=[],this._cloudsToUpdateIndex=0,this._cloudsRemoved=!1,this._createVertexArray=!0};function jq(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];u(s)&&(n._index=r++,t.push(s))}e._clouds=t}}sh.prototype._updateCloud=function(e,t){e._dirty||(this._cloudsToUpdate[this._cloudsToUpdateIndex++]=e),++this._propertiesChanged[t]};sh.prototype.contains=function(e){return u(e)&&e._cloudCollection===this};sh.prototype.get=function(e){return jq(this),this._clouds[e]};var fmt=new Float32Array([-1,-1,1,-1,1,1,-1,1]),dmt=new Uint16Array([0,1,2,0,2,3]);function hmt(e){let t=lt.createVertexBuffer({context:e,typedArray:fmt,usage:Ne.STATIC_DRAW}),n=lt.createIndexBuffer({context:e,typedArray:dmt,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),i=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:q.FLOAT}];return new oi({context:e,attributes:i,indexBuffer:n})}var Yq;function mmt(e){let n=e.cache.cloudCollection_indexBufferBatched;if(u(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=lt.createIndexBuffer({context:e,typedArray:o,usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferBatched=n,n}function pmt(e){let t=e.cache.cloudCollection_indexBufferInstanced;return u(t)||(t=lt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Ne.STATIC_DRAW,indexDatatype:Fe.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_indexBufferInstanced=t),t}function _mt(e){let t=e.cache.cloudCollection_vertexBufferInstanced;return u(t)||(t=lt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:Ne.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.cloudCollection_vertexBufferInstanced=t),t}function gmt(e,t,n){let i=[{index:Ou.positionHighAndScaleX,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:Ne.STATIC_DRAW},{index:Ou.positionLowAndScaleY,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:Ne.STATIC_DRAW},{index:Ou.packedAttribute0,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:Ne.STATIC_DRAW},{index:Ou.packedAttribute1,componentsPerAttribute:4,componentDatatype:q.FLOAT,usage:Ne.STATIC_DRAW},{index:Ou.color,componentsPerAttribute:4,componentDatatype:q.UNSIGNED_BYTE,normalize:!0,usage:Ne.STATIC_DRAW}];n&&i.push({index:Ou.direction,componentsPerAttribute:2,componentDatatype:q.FLOAT,vertexBuffer:_mt(e)});let o=n?t:4*t;return new Wm(e,i,o,n)}var Wq=new Hn;function E0e(e,t,n,i){let o,r=n[Ou.positionHighAndScaleX],s=n[Ou.positionLowAndScaleY],a=i.position;Hn.fromCartesian(a,Wq);let c=i.scale,l=Wq.high,f=Wq.low;e._instanced?(o=i._index,r(o,l.x,l.y,l.z,c.x),s(o,f.x,f.y,f.z,c.y)):(o=i._index*4,r(o+0,l.x,l.y,l.z,c.x),r(o+1,l.x,l.y,l.z,c.x),r(o+2,l.x,l.y,l.z,c.x),r(o+3,l.x,l.y,l.z,c.x),s(o+0,f.x,f.y,f.z,c.y),s(o+1,f.x,f.y,f.z,c.y),s(o+2,f.x,f.y,f.z,c.y),s(o+3,f.x,f.y,f.z,c.y))}function b0e(e,t,n,i){let o,r=n[Ou.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 S0e(e,t,n,i){let o,r=n[Ou.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 D0e(e,t,n,i){let o,r=n[Ou.color],s=i.color,a=z.floatToByte(s.red),c=z.floatToByte(s.green),l=z.floatToByte(s.blue),f=z.floatToByte(s.alpha);e._instanced?(o=i._index,r(o,a,c,l,f)):(o=i._index*4,r(o+0,a,c,l,f),r(o+1,a,c,l,f),r(o+2,a,c,l,f),r(o+3,a,c,l,f))}function ymt(e,t,n,i){E0e(e,t,n,i),b0e(e,t,n,i),S0e(e,t,n,i),D0e(e,t,n,i)}function Amt(e,t,n,i){let o=e,r=o._textureSliceWidth,s=o._noiseTextureRows,a=t.context;o._vaNoise=hmt(a),o._spNoise=Xt.fromCache({context:a,vertexShaderSource:n,fragmentShaderSource:i,attributeLocations:{position:0}});let c=o.noiseDetail,l=o.noiseOffset;o._noiseTexture=new It({context:a,width:r*r/s,height:r*s,pixelDatatype:Xe.UNSIGNED_BYTE,pixelFormat:rt.RGBA,sampler:new ln({wrapS:vn.REPEAT,wrapT:vn.REPEAT,minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST})});let f=new Lu({vertexArray:o._vaNoise,shaderProgram:o._spNoise,outputTexture:o._noiseTexture,uniformMap:{u_noiseTextureDimensions:C0e(o),u_noiseDetail:function(){return c},u_noiseOffset:function(){return l}},persists:!1,owner:e,postExecute:function(d){o._ready=!0,o._loading=!1}});t.commandList.push(f),o._loading=!0}function xmt(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=gmt(i,r,n._instanced);let s=n._vaf.writers,a;for(a=0;a<r;++a){let c=o[a];ymt(e,t,s,c)}n._vaf.commit(Yq(i))}}var Cmt=[];function Tmt(e,t){let n=t.context,i=e,r=i._clouds.length,s=i._cloudsToUpdate,a=i._cloudsToUpdateIndex,c=i._propertiesChanged,l=Cmt;l.length=0,(c[omt]||c[rmt])&&l.push(E0e),(c[imt]||c[cmt])&&l.push(b0e),(c[smt]||c[amt])&&l.push(S0e),c[umt]&&l.push(D0e);let f=l.length,d=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)l[m](e,t,d,g);i._vaf.commit(Yq(n))}else{for(p=0;p<a;++p){for(g=s[p],g._dirty=!1,m=0;m<f;++m)l[m](e,t,d,g);i._instanced?i._vaf.subCommit(g._index,1):i._vaf.subCommit(g._index*4,4)}i._vaf.endSubCommits()}i._cloudsToUpdateIndex=0}function Emt(e,t,n,i){let o=t.context,r=e,s=new ke({defines:[],sources:[n]});r._instanced&&s.defines.push("INSTANCED");let a=new ke({defines:[],sources:[i]});r.debugBillboards&&a.defines.push("DEBUG_BILLBOARDS"),r.debugEllipsoids&&a.defines.push("DEBUG_ELLIPSOIDS"),r._sp=Xt.replaceCache({context:o,shaderProgram:r._sp,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:Ou}),r._rs=Ue.fromCache({depthTest:{enabled:!0,func:ee.LESS},depthMask:!1,blending:un.ALPHA_BLEND}),r._spCreated=!0,r._compiledDebugBillboards=r.debugBillboards,r._compiledDebugEllipsoids=r.debugEllipsoids}function bmt(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,c=a.length;s.length=c;for(let l=0;l<c;l++){let f=s[l];u(f)||(f=s[l]=new tt),f.pass=Ee.TRANSLUCENT,f.owner=e,f.uniformMap=o,f.count=a[l].indicesCount,f.vertexArray=a[l].va,f.shaderProgram=n._sp,f.renderState=n._rs,n._instanced&&(f.count=6,f.instanceCount=n._clouds.length),r.push(f)}}}sh.prototype.update=function(e){if(jq(this),!this.show)return;let t=this.debugBillboards||this.debugEllipsoids;this._ready=t?!0:u(this._noiseTexture),!this._ready&&!this._loading&&!t&&Amt(this,e,LM,MM),this._instanced=e.context.instancedArrays,Ou=this._instanced?nmt:tmt,Yq=this._instanced?pmt:mmt;let i=this._clouds.length,o=this._cloudsToUpdate,r=this._cloudsToUpdateIndex;this._createVertexArray?xmt(this,e):r>0&&Tmt(this,e),r>i*1.5&&(o.length=i),!(!u(this._vaf)||!u(this._vaf.va)||!this._ready&!t)&&((!this._spCreated||this.debugBillboards!==this._compiledDebugBillboards||this.debugEllipsoids!==this._compiledDebugEllipsoids)&&Emt(this,e,BM,RM),bmt(this,e))};sh.prototype.isDestroyed=function(){return!1};sh.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(),T0e(this._clouds),le(this)};var qq=sh;var Smt=P.toRadians(30);function Xq(e){this._angle=y(e,Smt)}Object.defineProperties(Xq.prototype,{angle:{get:function(){return this._angle},set:function(e){this._angle=e}}});Xq.prototype.emit=function(e){let t=Math.tan(this._angle),n=P.randomBetween(0,P.TWO_PI),i=P.randomBetween(0,t),o=i*Math.cos(n),r=i*Math.sin(n),s=1;e.velocity=h.fromElements(o,r,s,e.velocity),h.normalize(e.velocity,e.velocity),e.position=h.clone(h.ZERO,e.position)};var Kq=Xq;function AF(e){e=y(e,y.EMPTY_OBJECT);let t=e.attributeName,n=e.perInstanceAttribute;u(n)||(n=!1);let i=y(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}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=y(e.translucent,!1),this._vertexShaderSource=y(e.vertexShaderSource,s),this._fragmentShaderSource=y(e.fragmentShaderSource,a),this._renderState=$i.getDefaultRenderState(!1,!1,e.renderState),this._closed=y(e.closed,!1),this._attributeName=t,this._glslDatatype=i}Object.defineProperties(AF.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}}});AF.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;AF.prototype.isTranslucent=$i.prototype.isTranslucent;AF.prototype.getRenderState=$i.prototype.getRenderState;var Zq=AF;function j4(e){e=y(e,y.EMPTY_OBJECT),this.length=y(e.length,1e7),this._length=void 0,this.width=y(e.width,2),this._width=void 0,this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._modelMatrix=new M,this.id=e.id,this._id=void 0,this._primitive=void 0}j4.prototype.update=function(e){if(this.show){if(!u(this._primitive)||!M.equals(this._modelMatrix,this.modelMatrix)||this._length!==this.length||this._width!==this.width||this._id!==this.id){this._modelMatrix=M.clone(this.modelMatrix,this._modelMatrix),this._length=this.length,this._width=this.width,this._id=this.id,u(this._primitive)&&this._primitive.destroy(),this.modelMatrix[12]===0&&this.modelMatrix[13]===0&&this.modelMatrix[14]===0&&(this.modelMatrix[14]=.01);let t=new At({geometry:new f_({positions:[h.ZERO,h.UNIT_X],width:this.width,vertexFormat:Vr.VERTEX_FORMAT,colors:[z.RED,z.RED],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this}),n=new At({geometry:new f_({positions:[h.ZERO,h.UNIT_Y],width:this.width,vertexFormat:Vr.VERTEX_FORMAT,colors:[z.GREEN,z.GREEN],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this}),i=new At({geometry:new f_({positions:[h.ZERO,h.UNIT_Z],width:this.width,vertexFormat:Vr.VERTEX_FORMAT,colors:[z.BLUE,z.BLUE],arcType:Kt.NONE}),modelMatrix:M.multiplyByUniformScale(this.modelMatrix,this.length,new M),id:this.id,pickPrimitive:this});this._primitive=new Dn({geometryInstances:[t,n,i],appearance:new Vr,asynchronous:!1})}this._primitive.update(e)}};j4.prototype.isDestroyed=function(){return!1};j4.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),le(this)};var xF=j4;function Dmt(e){this.direction=h.clone(e.direction),this.color=z.clone(y(e.color,z.WHITE)),this.intensity=y(e.intensity,1)}var Jq=Dmt;var CF=`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);

    // Convert tangent space material normal to eye space
    materialInput.normalEC = normalEC;
    materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);

    // Convert view vector to world space
    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 TF=`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;           // position in model coordinates
    v_positionEC = (czm_modelViewRelativeToEye * p).xyz;     // position in eye coordinates
    v_st = st;

    gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
`;function mC(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.translucent,!0),n=y(e.aboveGround,!1);this.material=u(e.material)?e.material:Vi.fromType(Vi.ColorType),this.translucent=y(e.translucent,!0),this._vertexShaderSource=y(e.vertexShaderSource,TF),this._fragmentShaderSource=y(e.fragmentShaderSource,CF),this._renderState=$i.getDefaultRenderState(t,!n,e.renderState),this._closed=!1,this._flat=y(e.flat,!1),this._faceForward=y(e.faceForward,n),this._aboveGround=n}Object.defineProperties(mC.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 mC.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}});mC.VERTEX_FORMAT=Ie.POSITION_AND_ST;mC.prototype.getFragmentShaderSource=$i.prototype.getFragmentShaderSource;mC.prototype.isTranslucent=$i.prototype.isTranslucent;mC.prototype.getRenderState=$i.prototype.getRenderState;var Qq=mC;function Rl(e){this._scene=e.scene,this.samplingWindow=y(e.samplingWindow,Rl.defaultSettings.samplingWindow),this.quietPeriod=y(e.quietPeriod,Rl.defaultSettings.quietPeriod),this.warmupPeriod=y(e.warmupPeriod,Rl.defaultSettings.warmupPeriod),this.minimumFrameRateDuringWarmup=y(e.minimumFrameRateDuringWarmup,Rl.defaultSettings.minimumFrameRateDuringWarmup),this.minimumFrameRateAfterWarmup=y(e.minimumFrameRateAfterWarmup,Rl.defaultSettings.minimumFrameRateAfterWarmup),this._lowFrameRate=new Ae,this._nominalFrameRate=new Ae,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){vmt(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(){wmt(t)}this._visibilityChangeRemoveListener=void 0,u(n)&&(document.addEventListener(n,i,!1),this._visibilityChangeRemoveListener=function(){document.removeEventListener(n,i,!1)})}Rl.defaultSettings={samplingWindow:5,quietPeriod:2,warmupPeriod:5,minimumFrameRateDuringWarmup:4,minimumFrameRateAfterWarmup:8};Rl.fromScene=function(e){return(!u(e._frameRateMonitor)||e._frameRateMonitor.isDestroyed())&&(e._frameRateMonitor=new Rl({scene:e})),e._frameRateMonitor};Object.defineProperties(Rl.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}}});Rl.prototype.pause=function(){++this._pauseCount,this._pauseCount===1&&(this._frameTimes.length=0,this._lastFramesPerSecond=void 0)};Rl.prototype.unpause=function(){--this._pauseCount,this._pauseCount<=0&&(this._pauseCount=0,this._needsQuietPeriod=!0)};Rl.prototype.isDestroyed=function(){return!1};Rl.prototype.destroy=function(){return this._preUpdateRemoveListener(),u(this._visibilityChangeRemoveListener)&&this._visibilityChangeRemoveListener(),le(this)};function vmt(e,t){if(e._pauseCount>0)return;let n=di();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 wmt(e){document[e._hiddenPropertyName]?e.pause():e.unpause()}var EF=Rl;var v0e=vo(bj(),1);function $q(){this._image=new Image}$q.prototype.isReady=function(){return!0};$q.prototype.shouldDiscardImage=function(e){return e===this._image};function bF(e){e=y(e,y.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;if(u(e.metadata))t=e.metadata;else{let r=Oe.createIfNeeded(e.url);t=new Zd(r)}this._metadata=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=new ji({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-P.PI,-P.PI,P.PI,P.PI),ellipsoid:e.ellipsoid});let n=e.credit;typeof n=="string"&&(n=new Zt(n)),this._credit=n,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=23,u(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new $q),this._errorEvent=new Ae,this._ready=!1;let i=this,o;this._readyPromise=t.readyPromise.then(function(r){if(!t.imageryPresent){let s=new ue(`The server ${t.url} doesn't have imagery`);return o=Xn.reportError(o,i,i._errorEvent,s.message,void 0,void 0,void 0,s),Promise.reject(s)}return Xn.reportSuccess(o),i._ready=r,r}).catch(function(r){return o=Xn.reportError(o,i,i._errorEvent,r.message,void 0,void 0,void 0,r),Promise.reject(r)})}Object.defineProperties(bF.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}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!1}}});bF.prototype.getTileCredits=function(e,t,n){let i=this._metadata,o=i.getTileInformation(e,t,n);if(u(o)){let r=i.providers[o.imageryProvider];if(u(r))return[r]}};bF.prototype.requestImage=function(e,t,n,i){let o=this._tileDiscardPolicy._image,r=this._metadata,s=Zd.tileXYToQuadKey(e,t,n),a=r.getTileInformation(e,t,n);if(!u(a)){if(r.isValid(s)){let l=new zo({throttle:i.throttle,throttleByServer:i.throttleByServer,type:i.type,priorityFunction:i.priorityFunction});r.populateSubtree(e,t,n,l);return}return Promise.resolve(o)}if(!a.hasImagery())return Promise.resolve(o);let c=Imt(this,a,e,t,n,i).fetchArrayBuffer();if(u(c))return c.then(function(l){yL(r.key,l);let f=new Uint8Array(l),d,p=r.protoImagery;if((!u(p)||!p)&&(d=Pmt(f)),!u(d)&&(!u(p)||p)){let g=Omt(f);d=g.imageType,f=g.imageData}return!u(d)||!u(f)?o:fA({uint8Array:f,format:d,flipY:!0})})};bF.prototype.pickFeatures=function(e,t,n,i,o){};function Imt(e,t,n,i,o,r){let s=Zd.tileXYToQuadKey(n,i,o),a=t.imageryVersion;return a=u(a)&&a>0?a:1,e._metadata.resource.getDerivedResource({url:`flatfile?f1-0${s}-i.${a.toString()}`,request:r})}function Pmt(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 Omt(e){let t=v0e.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,u(a)||(a=i.copyrightIds=[]),(s&7)===2){let c=t.uint32()+t.pos;for(;t.pos<c;)a.push(t.uint32())}else a.push(t.uint32());break;default:t.skipType(s&7);break}}let o=i.imageType;if(u(o))switch(o){case 0:i.imageType="image/jpeg";break;case 4:i.imageType="image/png";break;default:throw new ue("GoogleEarthEnterpriseImageryProvider: Unsupported image type.")}let r=i.alphaType;return u(r)&&r!==0&&(console.log("GoogleEarthEnterpriseImageryProvider: External alpha not supported."),delete i.alphaType,delete i.imageAlpha),i}var eX=bF;var Rmt=new z(1,1,1,.4),Bmt=new z(0,1,0,.05),Mmt=new z(0,.5,0,.2);function pC(e){e=y(e,y.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=u(e.tilingScheme)?e.tilingScheme:new ji({ellipsoid:e.ellipsoid}),this._cells=y(e.cells,8),this._color=y(e.color,Rmt),this._glowColor=y(e.glowColor,Bmt),this._glowWidth=y(e.glowWidth,6),this._backgroundColor=y(e.backgroundColor,Mmt),this._errorEvent=new Ae,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._canvasSize=y(e.canvasSize,256),this._canvas=this._createGridCanvas(),this._readyPromise=Promise.resolve(!0)}Object.defineProperties(pC.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}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}});pC.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()};pC.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};pC.prototype.getTileCredits=function(e,t,n){};pC.prototype.requestImage=function(e,t,n,i){return Promise.resolve(this._canvas)};pC.prototype.pickFeatures=function(e,t,n,i,o){};var tX=pC;function nX(e,t){this._parent=e,this._dataProvider=e._dataProvider,this._layer=e._layer,u(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(nX.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}}});nX.prototype.load=function(){let e=this;return this._dataProvider._loadJson(this._resource).then(function(t){return e._data=t,t})};var SF=nX;function yS(e,t){this._storageInfo=t,this._parent=e,this._dataProvider=e._dataProvider;let n=`attributes/${t.key}/0`;u(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(yS.prototype,{resource:{get:function(){return this._resource}},header:{get:function(){return this._header}},values:{get:function(){return u(this._values)&&u(this._values.attributeValues)?this._values.attributeValues:[]}},name:{get:function(){return this._storageInfo.name}}});function Lmt(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}yS.prototype.load=function(){let e=this;return this._dataProvider._loadBinary(this._resource).then(function(t){let n=new DataView(t),i=!0;if(n.getUint8(0)==="{".charCodeAt(0)&&new TextDecoder().decode(t).includes("404")&&(i=!1,console.error(`Failed to load: ${e.resource.url}`)),i){e._data=t;let o=e._parseHeader(n),r=Lmt(e._storageInfo.attributeValues.valueType);r>0&&(o=Math.ceil(o/r)*r),e._parseBody(n,o)}})};yS.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}};yS.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};yS.prototype._parseBody=function(e,t){this._values={};for(let n=0;n<this._storageInfo.ordering.length;n++){let i=this._storageInfo.ordering[n],o=this._storageInfo[i];if(u(o)){this._values[i]=[];for(let r=0;r<this._header.count;++r)if(o.valueType!=="String"){let s=this._parseValue(e,o.valueType,t);this._values[i].push(s.value),t=s.offset}else{let s=this._values.attributeByteCounts[r],a="";for(let c=0;c<s;++c){let l=this._parseValue(e,o.valueType,t);l.value.charCodeAt(0)!==0&&(a+=l.value),t=l.offset}this._values[i].push(a)}}}};var DF=yS;function vF(e,t){let n=e._dataProvider,i=e._layer,o;u(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(vF.prototype,{resource:{get:function(){return this._resource}},data:{get:function(){return this._data}},customAttributes:{get:function(){return this._customAttributes}}});vF.prototype.load=function(){let e=this;return this._dataProvider._loadBinary(this._resource).then(function(t){return e._data=t,t})};var Nmt=new h,Fmt=new h,Vmt=new h,Umt=new h,kmt=new h;function iX(e,t,n,i){let o=h.subtract(i,n,Nmt),r=h.cross(o,h.subtract(e,n,Fmt),Umt),s=h.cross(o,h.subtract(t,n,Vmt),kmt);return h.dot(r,s)>=0}var zmt=new h,Hmt=new h,Gmt=new h,Wmt=new h,jmt=new h,Ymt=new h,qmt=new h,Xmt=new h,Kmt=new h,Zmt=new h;vF.prototype.getClosestPointIndexOnTriangle=function(e,t,n){if(u(this._customAttributes)&&u(this._customAttributes.positions)){let i=new h(e,t,n);i.x-=this._customAttributes.cartesianCenter.x,i.y-=this._customAttributes.cartesianCenter.y,i.z-=this._customAttributes.cartesianCenter.z,Z.multiplyByVector(this._customAttributes.parentRotation,i,i);let o=Number.MAX_VALUE,r,s,a,c,l=this._customAttributes.positions,f=this._customAttributes.indices,d;u(f)?d=f.length:d=l.length/3;for(let p=0;p<d;p++){let g,m,A;u(f)?(g=f[p],m=f[p+1],A=f[p+2]):(g=p*3,m=p*3+1,A=p*3+2);let x=h.fromElements(l[g*3],l[g*3+1],l[g*3+2],zmt),C=h.fromElements(l[m*3],l[m*3+1],l[m*3+2],Hmt),T=new h(l[A*3],l[A*3+1],l[A*3+2],Gmt);if(!iX(i,x,C,T)||!iX(i,C,x,T)||!iX(i,T,x,C))continue;let E=h.subtract(C,x,Wmt),S=h.subtract(T,x,jmt),D=h.cross(E,S,Ymt);if(h.magnitude(D)===0)continue;let w=h.normalize(D,qmt),R=h.subtract(i,x,Xmt),O=Math.abs(h.dot(R,w));if(O<o){o=O,r=p;let L=h.magnitudeSquared(h.subtract(i,x,R)),N=h.magnitudeSquared(h.subtract(i,C,Kmt)),_=h.magnitudeSquared(h.subtract(i,T,Zmt));L<N&&L<_?(a=g,c=x,s=L):N<_?(a=m,c=C,s=N):(a=A,c=T,s=_)}}if(u(r))return{index:a,distanceSquared:s,distance:Math.sqrt(s),queriedPosition:i,closestPosition:h.clone(c)}}return{index:-1,distanceSquared:Number.Infinity,distance:Number.Infinity}};vF.prototype._generateGltf=function(e,t,n,i,o,r){let s={pbrMetallicRoughness:{metallicFactor:0},doubleSided:!0,name:"Material"},a=!1,c,l="";if(u(this._parent._data.mesh)&&u(this._layer._data.materialDefinitions)){let A=this._parent._data.mesh.material.definition;if(A>=0&&A<this._layer._data.materialDefinitions.length&&(c=this._layer._data.materialDefinitions[A],s=c,u(s.pbrMetallicRoughness)&&u(s.pbrMetallicRoughness.baseColorTexture))){a=!0,s.pbrMetallicRoughness.baseColorTexture.index=0;let x="0";if(u(this._layer._data.textureSetDefinitions))for(let C=0;C<this._layer._data.textureSetDefinitions.length;C++){let T=this._layer._data.textureSetDefinitions[C];for(let E=0;E<T.formats.length;E++){let S=T.formats[E];if(S.format==="jpg"){x=S.name;break}}}u(this._parent._data.mesh)&&this._parent._data.mesh.material.resource>=0&&(l=this._layer.resource.getDerivedResource({url:`nodes/${this._parent._data.mesh.material.resource}/textures/${x}`}).url)}}else u(this._parent._data.textureData)&&(a=!0,l=this._parent.resource.getDerivedResource({url:`${this._parent._data.textureData[0].href}`}).url,s.pbrMetallicRoughness.baseColorTexture={index:0});let f=[],d=[],p=[];return a&&(f=[{sampler:0,source:0}],d=[{uri:l}],p=[{magFilter:9729,minFilter:9986,wrapS:10497,wrapT:10497}]),{scene:0,scenes:[{nodes:e}],nodes:t,meshes:n,buffers:i,bufferViews:o,accessors:r,materials:[s],textures:f,images:d,samplers:p,asset:{version:"2.0"}}};var AS=vF;function Bl(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._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}Object.defineProperties(Bl.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}}});Bl.prototype.load=function(){let e=this;function t(){if(!e._isRoot){let n=e._create3DTileDefinition();e._tile=new eu(e._layer._tileset,e._dataProvider.resource,n,e._parent._tile),e._tile._i3sNode=e}}return u(this._nodeIndex)?this._layer._getNodeInNodePages(this._nodeIndex).then(function(n){e._data=n;let i;e._isRoot?i="nodes/root/":u(n.mesh)&&(i=`../${n.mesh.geometry.resource}/`),u(i)&&(e._resource=e._parent.resource.getDerivedResource({url:i})),t()}):this._dataProvider._loadJson(this._resource).then(function(n){e._data=n,t()})};Bl.prototype.loadFields=function(){let e=this._layer._data.attributeStorageInfo,t=this;function n(o,r){let s=new DF(t,o[r]);return t._fields[s._storageInfo.name]=s,s.load()}let i=[];if(u(e))for(let o=0;o<e.length;o++)i.push(n(e,o));return Promise.all(i)};Bl.prototype.getFieldsForPickedPosition=function(e){let t=this.geometryData[0];if(!u(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)};Bl.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};Bl.prototype._loadChildren=function(){let e=this;if(u(this._childrenReadyPromise))return this._childrenReadyPromise;let t=[];if(u(e._data.children))for(let n=0;n<e._data.children.length;n++){let i=e._data.children[n],o=new Bl(e,y(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};Bl.prototype._loadGeometryData=function(){let e=[];if(u(this._data.geometryData))for(let t=0;t<this._data.geometryData.length;t++){let n=new AS(this,this._data.geometryData[t].href);this._geometryData.push(n),e.push(n.load())}else if(u(this._data.mesh)){let t=this._layer._findBestGeometryBuffers(this._data.mesh.geometry.definition,["position","uv0"]),n=`./geometries/${t.bufferIndex}/`,i=new AS(this,n);i._geometryDefinitions=t.definition,i._geometryBufferInfo=t.geometryBufferInfo,this._geometryData.push(i),e.push(i.load())}return Promise.all(e)};Bl.prototype._loadFeatureData=function(){let e=[];if(u(this._data.featureData))for(let t=0;t<this._data.featureData.length;t++){let n=new SF(this,this._data.featureData[t].href);this._featureData.push(n),e.push(n.load())}return Promise.all(e)};Bl.prototype._clearGeometryData=function(){this._geometryData=[]};Bl.prototype._create3DTileDefinition=function(){let e=this._data.obb,t=this._data.mbs;if(!u(e)&&!u(t)){console.error("Failed to load I3S node. Bounding volume is required.");return}let n;if(u(e)?n=he.fromDegrees(e.center[0],e.center[1],e.center[2]):n=he.fromDegrees(t[0],t[1],t[2]),u(this._dataProvider._geoidDataList)&&u(n))for(let C=0;C<this._dataProvider._geoidDataList.length;C++){let T=this._dataProvider._geoidDataList[C],E=T.projection.project(n);if(E.x>T.nativeExtent.west&&E.x<T.nativeExtent.east&&E.y>T.nativeExtent.south&&E.y<T.nativeExtent.north){n.height+=Qmt(E.x,E.y,T);break}}let i={},o,r=0;u(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(u(this._data.lodThreshold))if(this._layer._data.nodePages.lodSelectionMetricType==="maxScreenThresholdSQ"){let C=Math.sqrt(this._data.lodThreshold/(Math.PI*.25));s=r/C}else if(this._layer._data.nodePages.lodSelectionMetricType==="maxScreenThreshold"){let C=this._data.lodThreshold;s=r/C}else console.error("Invalid lodSelectionMetricType in Layer");else if(u(this._data.lodSelection))for(let C=0;C<this._data.lodSelection.length;C++)this._data.lodSelection[C].metricType==="maxScreenThreshold"&&(s=r/this._data.lodSelection[C].maxError);s===1/0&&(s=1e5);let a=s*16,c=new Ba(0,0,0),l=Ot.headingPitchRollQuaternion(o,c);u(this._data.obb)&&(l=new Le(this._data.obb.quaternion[0],this._data.obb.quaternion[1],this._data.obb.quaternion[2],this._data.obb.quaternion[3]));let f=Z.fromQuaternion(l),d=Z.inverse(f,new Z),p=new M(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=M.inverse(p,new M),m=M.clone(p);u(this._parent._globalTransform)&&M.multiply(p,this._parent._inverseGlobalTransform,m),this._globalTransform=p,this._inverseGlobalTransform=g,this._inverseRotationMatrix=d;let A=[];for(let C=0;C<this._children.length;C++)A.push(this._children[C]._create3DTileDefinition());return{children:A,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:u(this._resource)?this._resource.url:void 0},geometricError:a}};Bl.prototype._createI3SDecoderTask=function(e,t){let n=t.geometryData._parent._data,i=t.geometryData._parent._inverseRotationMatrix,o=0,r=0,s=0;u(n.obb)?(o=n.obb.center[0],r=n.obb.center[1],s=n.obb.center[2]):u(n.mbs)&&(o=n.mbs[0],r=n.mbs[1],s=n.mbs[2]);let a=Z.fromRotationX(-P.PI_OVER_TWO),c=new Z;Z.multiply(a,i,c);let l=he.fromDegrees(o,r,s),f=ie.WGS84.cartographicToCartesian(l),d={binaryData:t.geometryData._data,featureData:u(t.featureData)&&u(t.featureData[0])?t.featureData[0].data:void 0,schema:t.defaultGeometrySchema,bufferInfo:t.geometryData._geometryBufferInfo,ellipsoidRadiiSquare:ie.WGS84.radiiSquared,url:t.url,geoidDataList:t.geometryData._dataProvider._geoidDataList,cartographicCenter:l,cartesianCenter:f,parentRotation:c},p=e._getDecoderTaskProcessor(),g=[];return e._taskProcessorReadyPromise.then(function(){return p.scheduleTask(d,g)})};Bl.prototype._createContentURL=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()];this._dataProvider.legacyVersion16&&t.push(this._loadFeatureData());let n=this;return Promise.all(t).then(function(){let i=Promise.resolve();if(u(n._geometryData)&&n._geometryData.length>0){let o={geometryData:n._geometryData[0],featureData:n._featureData,defaultGeometrySchema:n._layer._data.store.defaultGeometrySchema,url:n._geometryData[0].resource.url,tile:n._tile},r=n._createI3SDecoderTask(n._dataProvider,o);if(!u(r))return;i=r.then(function(s){e=o.geometryData._generateGltf(s.meshData.nodesInScene,s.meshData.nodes,s.meshData.meshes,s.meshData.buffers,s.meshData.bufferViews,s.meshData.accessors),n._geometryData[0]._customAttributes=s.meshData._customAttributes})}return i.then(function(){let o=n._dataProvider._binarizeGltf(e),r=new Blob([o],{type:"application/binary"});n._glbURL=URL.createObjectURL(r)})})};eu.prototype._hookedRequestContent=eu.prototype.requestContent;eu.prototype._resolveHookedObject=function(){let e=this;this._hookedRequestContent(),this._contentReadyToProcessPromise.then(function(){e._contentReadyToProcessDefer.resolve()}),this._contentReadyPromise.then(function(t){e._isLoading=!1,e._contentReadyDefer.resolve(t)})};eu.prototype.requestContent=function(){let e=this;return this.tileset._isI3STileSet?this._isLoading?1:(this._isLoading=!0,this._contentReadyToProcessDefer=Jr(),this._contentReadyDefer=Jr(),this._contentReadyToProcessPromise=this._contentReadyToProcessDefer.promise,this._contentReadyPromise=this._contentReadyDefer.promise,this._i3sNode._createContentURL().then(function(){e._contentResource=new Oe({url:e._i3sNode._glbURL}),e._resolveHookedObject()}),0):this._hookedRequestContent()};function Jmt(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 Y4(e,t,n,i){let o=e+t*n;return i[o]}function Qmt(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 c=s<n.width?s+1:s,l=a<n.height?a+1:a;a=n.height-1-a,l=n.height-1-l;let f=Y4(s,a,n.width,n.buffer),d=Y4(c,a,n.width,n.buffer),p=Y4(s,l,n.width,n.buffer),g=Y4(c,l,n.width,n.buffer),m=Jmt(o,r,f,d,p,g);return m=m*n.scale+n.offset,m}Object.defineProperties(eu.prototype,{i3sNode:{get:function(){return this._i3sNode}}});var xS=Bl;function Nf(e,t,n){this._dataProvider=e,u(t.href)||(t.href=`./layers/${n}`);let i=this._dataProvider.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 Oe({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._computeGeometryDefinitions(!0),this._computeExtent()}Object.defineProperties(Nf.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(u(this.version))return this.majorVersion<1||this.majorVersion===1&&this.minorVersion<=6}}});Nf.prototype.load=function(){let e=this;return this._data.spatialReference.wkid!==4326?(console.log(`Unsupported spatial reference: ${this._data.spatialReference.wkid}`),Promise.reject()):this._dataProvider._geoidDataIsReadyPromise.then(function(){return e._loadRootNode().then(function(){return e._create3DTileset(),e._tileset.readyPromise.then(function(){if(e._rootNode._tile=e._tileset._root,e._tileset._root._i3sNode=e._rootNode,e.legacyVersion16)return e._rootNode._loadChildren()})})})};Nf.prototype._computeGeometryDefinitions=function(e){if(this._geometryDefinitions=[],u(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(u(r.compressedAttributes)&&e){a=!0;let c=r.compressedAttributes.attributes;for(let l=0;l<c.length;l++)s.push(c[l])}else for(let c in r)c!=="offset"&&s.push(c);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)}};Nf.prototype._findBestGeometryBuffers=function(e,t){let n=this._geometryDefinitions[e];if(u(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}}return 0};Nf.prototype._loadRootNode=function(){if(u(this._data.nodePages)){let e=0;u(this._data.nodePages.rootIndex)&&(e=this._data.nodePages.rootIndex),this._rootNode=new xS(this,e,!0)}else this._rootNode=new xS(this,this._data.store.rootNode,!0);return this._rootNode.load()};Nf.prototype._getNodeInNodePages=function(e){let t=Math.floor(e/this._data.nodePages.nodesPerPage),n=e%this._data.nodePages.nodesPerPage,i=this;return this._loadNodePage(t).then(function(){return i._nodePages[t][n]})};Nf._fetchJson=function(e){return e.fetchJson()};Nf.prototype._loadNodePage=function(e){let t=this;if(!u(this._nodePageFetches[e])){let n=this.resource.getDerivedResource({url:`nodepages/${e}/`}),i=Nf._fetchJson(n).then(function(o){return u(o.error)&&o.error.code!==200?Promise.reject(o.error):(t._nodePages[e]=o.nodes,o)});this._nodePageFetches[e]=i}return this._nodePageFetches[e]};Nf.prototype._computeExtent=function(){u(this._data.fullExtent)?this._extent=ce.fromDegrees(this._data.fullExtent.xmin,this._data.fullExtent.ymin,this._data.fullExtent.xmax,this._data.fullExtent.ymax):u(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]))};Nf.prototype._create3DTileset=function(){let e={asset:{version:"1.0"},geometricError:Number.MAX_VALUE,root:this._rootNode._create3DTileDefinition()},t=new Blob([JSON.stringify(e)],{type:"application/json"}),n=URL.createObjectURL(t),i={};if(u(this._dataProvider._cesium3dTilesetOptions))for(let r in this._dataProvider._cesium3dTilesetOptions)this._dataProvider._cesium3dTilesetOptions.hasOwnProperty(r)&&(i[r]=this._dataProvider._cesium3dTilesetOptions[r]);i.url=n,i.show=this._dataProvider.show,this._tileset=new Rc(i),this._tileset._isI3STileSet=!0;let o=this;this._tileset.readyPromise.then(function(){o._tileset.tileUnload.addEventListener(function(r){r._i3sNode._clearGeometryData(),URL.revokeObjectURL(r._contentResource._url),r._contentResource=r._i3sNode.resource}),o._tileset.tileVisible.addEventListener(function(r){u(r._i3sNode)&&r._i3sNode._loadChildren()})})};var CS=Nf;var I0e=vo(w0e(),1);function Ta(e){e=y(e,y.EMPTY_OBJECT),this._resource=Oe.createIfNeeded(e.url),this._name=e.name,this._show=y(e.show,!0),this._geoidTiledTerrainProvider=e.geoidTiledTerrainProvider,this._traceFetches=y(e.traceFetches,!1),this._cesium3dTilesetOptions=y(e.cesium3dTilesetOptions,y.EMPTY_OBJECT),this._layers=[],this._data=void 0,this._extent=void 0,this._geoidDataIsReadyPromise=void 0,this._geoidDataList=void 0,this._decoderTaskProcessor=void 0,this._readyPromise=void 0,this._ready=!1,this._load()}Object.defineProperties(Ta.prototype,{name:{get:function(){return this._name}},show:{get:function(){return this._show},set:function(e){this._show=e;for(let t=0;t<this._layers.length;t++)u(this._layers[t]._tileset)&&(this._layers[t]._tileset.show=this._show)}},traceFetches:{get:function(){return this._traceFetches},set:function(e){this._traceFetches=e}},geoidTiledTerrainProvider:{get:function(){return this._geoidTiledTerrainProvider}},layers:{get:function(){return this._layers}},data:{get:function(){return this._data}},extent:{get:function(){return this._extent}},readyPromise:{get:function(){return this._readyPromise}},ready:{get:function(){return this._ready}},resource:{get:function(){return this._resource}}});Ta.prototype.destroy=function(){for(let e=0;e<this._layers.length;e++)u(this._layers[e]._tileset)&&this._layers[e]._tileset.destroy();return le(this)};Ta.prototype.isDestroyed=function(){return!1};Ta.prototype.update=function(e){for(let t=0;t<this._layers.length;t++)u(this._layers[t]._tileset)&&this._layers[t]._tileset.ready&&this._layers[t]._tileset.update(e)};Ta.prototype.prePassesUpdate=function(e){for(let t=0;t<this._layers.length;t++)u(this._layers[t]._tileset)&&this._layers[t]._tileset.ready&&this._layers[t]._tileset.prePassesUpdate(e)};Ta.prototype.postPassesUpdate=function(e){for(let t=0;t<this._layers.length;t++)u(this._layers[t]._tileset)&&this._layers[t]._tileset.ready&&this._layers[t]._tileset.postPassesUpdate(e)};Ta.prototype.updateForPass=function(e,t){for(let n=0;n<this._layers.length;n++)u(this._layers[n]._tileset)&&this._layers[n]._tileset.ready&&this._layers[n]._tileset.updateForPass(e,t)};Ta.prototype._load=function(){let e=this;return this._readyPromise=this._loadJson(this._resource).then(function(t){if(e._data=t,u(e._data.layers))for(let i=0;i<e._data.layers.length;i++){let o=new CS(e,e._data.layers[i],i);e._layers.push(o)}else{let i=new CS(e,e._data,e._data.id);e._layers.push(i)}e._computeExtent(),e._loadGeoidData();let n=[];for(let i=0;i<e._layers.length;i++)n.push(e._layers[i].load());return Promise.all(n).then(function(){return e._ready=!0,e})}),this._readyPromise};Ta._fetchJson=function(e){return e.fetchJson()};Ta.prototype._loadJson=function(e){return this._traceFetches&&console.log("I3S FETCH:",e.url),Ta._fetchJson(e).then(function(t){if(u(t.error)){if(console.error("Failed to fetch I3S ",e.url),u(t.error.message)&&console.error(t.error.message),u(t.error.details))for(let n=0;n<t.error.details.length;n++)console.log(t.error.details[n]);return Promise.reject(t.error)}return t})};Ta.prototype._loadBinary=function(e){return this._traceFetches&&console.log("I3S FETCH:",e.url),e.fetchArrayBuffer()};Ta.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]="g".charCodeAt(),o.magic[1]="l".charCodeAt(),o.magic[2]="T".charCodeAt(),o.magic[3]="F".charCodeAt(),o.version[0]=2,o.length[0]=i.byteLength,o.chunkLength[0]=n.byteLength,o.chunkType[0]=1313821514,o.chunkData.set(n),i};Ta.prototype._getDecoderTaskProcessor=function(){if(!u(this._decoderTaskProcessor)){let e=new pi("decodeI3S");this._taskProcessorReadyPromise=e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}),this._decoderTaskProcessor=e}return this._decoderTaskProcessor};function $mt(e,t){return e.readyPromise.then(function(){return tpt(e,t)})}var ept=new H;function tpt(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),c=n.positionToTileXY(s,r),l=n.positionToTileXY(a,r);for(let d=c.x;d<=l.x;d++)for(let p=c.y;p<=l.y;p++){let g=H.fromElements(d,p,ept),m=g.toString();if(!o.hasOwnProperty(m)){let A={x:g.x,y:g.y,level:r,tilingScheme:n,terrainProvider:e,positions:[]};o[m]=A,i.push(A)}}let f=[];for(let d=0;d<i.length;++d){let p=i[d],g=p.terrainProvider.requestTileGeometry(p.x,p.y,p.level);f.push(g)}return Promise.all(f).then(function(d){let p=[];for(let g=0;g<d.length;g++){let m={tilingScheme:n,x:i[g].x,y:i[g].y,level:i[g].level},A=d[g],x="Geographic";n._projection instanceof Si&&(x="WebMercator");let C={projectionType:x,projection:n._projection,nativeExtent:n.tileXYToNativeRectangle(m.x,m.y,m.level),height:A._height,width:A._width,scale:A._structure.heightScale,offset:A._structure.heightOffset};if(A._encoding===bf.LERC){let T=I0e.default.decode(A._buffer);C.buffer=T.pixels[0]}else C.buffer=A._buffer;p.push(C)}return p})}Ta.prototype._loadGeoidData=function(){let e=this,t=this._geoidTiledTerrainProvider;return u(t)?(this._geoidDataIsReadyPromise=t.readyPromise.then(function(){return $mt(t,e._extent).then(function(i){e._geoidDataList=i})}),this._geoidDataIsReadyPromise):(console.log("No Geoid Terrain service provided - no geoid conversion will be performed."),this._geoidDataIsReadyPromise=Promise.resolve(),this._geoidDataIsReadyPromise)};Ta.prototype._computeExtent=function(){let e;for(let t=0;t<this._layers.length;t++)if(u(this._layers[t]._extent)){let n=this._layers[t]._extent;u(e)?ce.union(e,n,e):e=ce.clone(n)}this._extent=e};var oX=Ta;var P0e=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function X4(e,t){this.spatialNode=e,this.keyframe=t,this.state=P0e.UNLOADED,this.metadatas=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}X4.priorityComparator=function(e,t){return e.priority-t.priority};X4.searchComparator=function(e,t){return e.keyframe-t.keyframe};X4.LoadState=P0e;var Ki=X4;function O0e(){}Object.defineProperties(O0e.prototype,{color:{get:de.throwInstantiationError},intensity:{get:de.throwInstantiationError}});var rX=O0e;var npt=/\/$/,R0e=new Zt('&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 TS(e){e=y(e,y.EMPTY_OBJECT);let t=e.styleId,n=e.accessToken;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=Oe.createIfNeeded(y(e.url,"https://api.mapbox.com/styles/v1/"));this._styleId=t,this._accessToken=n;let o=y(e.tilesize,512);this._tilesize=o;let r=y(e.username,"mapbox");this._username=r;let s=u(e.scaleFactor)?"@2x":"",a=i.getUrlComponent();npt.test(a)||(a+="/"),a+=`${this._username}/${t}/tiles/${this._tilesize}/{z}/{x}/{y}${s}`,i.url=a,i.setQueryParameters({access_token:n});let c;u(e.credit)?(c=e.credit,typeof c=="string"&&(c=new Zt(c))):c=R0e,this._resource=i,this._imageryProvider=new ya({url:i,credit:c,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(TS.prototype,{url:{get:function(){return this._imageryProvider.url}},ready:{get:function(){return this._imageryProvider.ready}},readyPromise:{get:function(){return this._imageryProvider.readyPromise}},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}}});TS.prototype.getTileCredits=function(e,t,n){};TS.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};TS.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};TS._defaultCredit=R0e;var sX=TS;function Zy(e,t,n,i,o){i===tn.UNSIGNED_SHORT&&(i=tn.FLOAT32);let r=e.floatingPointTexture;if(i===tn.FLOAT32&&!r)throw new ue("Floating point texture not supported");let s;i===tn.FLOAT32||i===tn.FLOAT64?s=Xe.FLOAT:i===tn.UINT8&&(s=Xe.UNSIGNED_BYTE);let a;n===1?a=e.webgl2?rt.RED:rt.LUMINANCE:n===2?a=e.webgl2?rt.RG:rt.LUMINANCE_ALPHA:n===3?a=rt.RGB:n===4&&(a=rt.RGBA);let c=512*1024*1024,l=128*1024*1024;o=Math.min(y(o,l),c);let f=Ft.maximumTextureSize,d=tn.getSizeInBytes(i),p=Math.floor(o/(n*d)),g=Math.min(f,P.previousPowerOfTwo(Math.floor(Math.sqrt(p)))),m=Math.ceil(Math.sqrt(t.x)),A=Math.ceil(t.z/m),x=m*t.x,C=A*t.y,T=Math.floor(g/x),E=Math.floor(g/C);if(T===0||E===0)throw new ue("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=h.clone(t,new h),this.maximumTileCount=T*E,this.regionCountPerMegatexture=new H(T,E),this.voxelCountPerRegion=new H(x,C),this.sliceCountPerRegion=new H(m,A),this.voxelSizeUv=new H(1/g,1/g),this.sliceSizeUv=new H(t.x/g,t.y/g),this.regionSizeUv=new H(x/g,C/g),this.texture=new It({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.LINEAR,magnificationFilter:yi.LINEAR})});let S=tn.toComponentDatatype(i);this.tileVoxelDataTemp=q.createTypedArray(S,x*C*n),this.nodes=new Array(this.maximumTileCount);for(let D=0;D<this.maximumTileCount;D++)this.nodes[D]=new ipt(D);for(let D=0;D<this.maximumTileCount;D++){let w=this.nodes[D];w.previousNode=D>0?this.nodes[D-1]:void 0,w.nextNode=D<this.maximumTileCount-1?this.nodes[D+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function ipt(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}Zy.prototype.add=function(e){if(this.isFull())throw new de("Trying to add when there are no empty spots");let t=this.emptyList;this.emptyList=this.emptyList.nextNode,u(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,u(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;let n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};Zy.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new de("Megatexture index out of bounds");let t=this.nodes[e];u(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),u(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,u(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};Zy.prototype.isFull=function(){return this.emptyList===void 0};Zy.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===tn.UNSIGNED_SHORT&&(i=tn.FLOAT32);let o=tn.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.z)),a=Math.ceil(t.z/s),c=s*t.x,l=a*t.y,f=P.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){let p=Math.floor(f/c),g=Math.floor(f/l);if(p*g>=e)break;f*=2}return f*f*n*o};Zy.prototype.writeDataToTexture=function(e,t){let n=t.constructor===Uint16Array?new Float32Array(t):t,i=this.voxelCountPerTile,o=this.sliceCountPerRegion,r=this.voxelCountPerRegion,s=this.channelCount,a=this.tileVoxelDataTemp;for(let A=0;A<i.z;A++){let x=A%o.x*i.x,C=Math.floor(A/o.x)*i.y;for(let T=0;T<i.y;T++)for(let E=0;E<i.x;E++){let S=A*i.y*i.x+T*i.x+E,D=(C+T)*r.x+(x+E);for(let w=0;w<s;w++)a[D*s+w]=n[S*s+w]}}let c=this.regionCountPerMegatexture,l=r.x,f=r.y,d=e%c.x*r.x,p=Math.floor(e/c.x)*r.y,m={source:{arrayBufferView:a,width:l,height:f},xOffset:d,yOffset:p};this.texture.copyFrom(m)};Zy.prototype.isDestroyed=function(){return!1};Zy.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),le(this)};var ES=Zy;function aX(e){}aX.prototype.isReady=function(){return!0};aX.prototype.shouldDiscardImage=function(e){return!1};var cX=aX;var opt=new Zt("MapQuest, Open Street Map and contributors, CC-BY-SA");function K4(e){e=y(e,y.EMPTY_OBJECT);let t=Oe.createIfNeeded(y(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}.${y(e.fileExtension,"png")}`;let n=new Gr({ellipsoid:e.ellipsoid}),i=256,o=256,r=y(e.minimumLevel,0),s=e.maximumLevel,a=y(e.rectangle,n.rectangle),c=n.positionToTileXY(ce.southwest(a),r),l=n.positionToTileXY(ce.northeast(a),r),f=(Math.abs(l.x-c.x)+1)*(Math.abs(l.y-c.y)+1),d=y(e.credit,opt);typeof d=="string"&&(d=new Zt(d)),ya.call(this,{url:t,credit:d,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}u(Object.create)&&(K4.prototype=Object.create(ya.prototype),K4.prototype.constructor=K4);var _C=K4;var rpt=new H(1,1);function lX(e){e=y(e,y.EMPTY_OBJECT),this.mass=y(e.mass,1),this.position=h.clone(y(e.position,h.ZERO)),this.velocity=h.clone(y(e.velocity,h.ZERO)),this.life=y(e.life,Number.MAX_VALUE),this.image=e.image,this.startColor=z.clone(y(e.startColor,z.WHITE)),this.endColor=z.clone(y(e.endColor,z.WHITE)),this.startScale=y(e.startScale,1),this.endScale=y(e.endScale,1),this.imageSize=H.clone(y(e.imageSize,rpt)),this._age=0,this._normalizedAge=0,this._billboard=void 0}Object.defineProperties(lX.prototype,{age:{get:function(){return this._age}},normalizedAge:{get:function(){return this._normalizedAge}}});var B0e=new h;lX.prototype.update=function(e,t){return h.multiplyByScalar(this.velocity,e,B0e),h.add(this.position,B0e,this.position),u(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 bS=lX;function M0e(e){e=y(e,y.EMPTY_OBJECT),this.time=y(e.time,0),this.minimum=y(e.minimum,0),this.maximum=y(e.maximum,50),this._complete=!1}Object.defineProperties(M0e.prototype,{complete:{get:function(){return this._complete}}});var uX=M0e;function L0e(e){}L0e.prototype.emit=function(e){de.throwInstantiationError()};var fX=L0e;var N0e=new H(1,1);function wF(e){e=y(e,y.EMPTY_OBJECT),this.show=y(e.show,!0),this.updateCallback=e.updateCallback,this.loop=y(e.loop,!0),this.image=y(e.image,void 0);let t=e.emitter;u(t)||(t=new yF(.5)),this._emitter=t,this._bursts=e.bursts,this._modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._emitterModelMatrix=M.clone(y(e.emitterModelMatrix,M.IDENTITY)),this._matrixDirty=!0,this._combinedMatrix=new M,this._startColor=z.clone(y(e.color,y(e.startColor,z.WHITE))),this._endColor=z.clone(y(e.color,y(e.endColor,z.WHITE))),this._startScale=y(e.scale,y(e.startScale,1)),this._endScale=y(e.scale,y(e.endScale,1)),this._emissionRate=y(e.emissionRate,5),this._minimumSpeed=y(e.speed,y(e.minimumSpeed,1)),this._maximumSpeed=y(e.speed,y(e.maximumSpeed,1)),this._minimumParticleLife=y(e.particleLife,y(e.minimumParticleLife,5)),this._maximumParticleLife=y(e.particleLife,y(e.maximumParticleLife,5)),this._minimumMass=y(e.mass,y(e.minimumMass,1)),this._maximumMass=y(e.mass,y(e.maximumMass,1)),this._minimumImageSize=H.clone(y(e.imageSize,y(e.minimumImageSize,N0e))),this._maximumImageSize=H.clone(y(e.imageSize,y(e.maximumImageSize,N0e))),this._sizeInMeters=y(e.sizeInMeters,!1),this._lifetime=y(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 Ae,this._isComplete=!1,this._updateParticlePool=!0,this._particleEstimate=0}Object.defineProperties(wF.prototype,{emitter:{get:function(){return this._emitter},set:function(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){this._matrixDirty=this._matrixDirty||!M.equals(this._modelMatrix,e),M.clone(e,this._modelMatrix)}},emitterModelMatrix:{get:function(){return this._emitterModelMatrix},set:function(e){this._matrixDirty=this._matrixDirty||!M.equals(this._emitterModelMatrix,e),M.clone(e,this._emitterModelMatrix)}},startColor:{get:function(){return this._startColor},set:function(e){z.clone(e,this._startColor)}},endColor:{get:function(){return this._endColor},set:function(e){z.clone(e,this._endColor)}},startScale:{get:function(){return this._startScale},set:function(e){this._startScale=e}},endScale:{get:function(){return this._endScale},set:function(e){this._endScale=e}},emissionRate:{get:function(){return this._emissionRate},set:function(e){this._emissionRate=e,this._updateParticlePool=!0}},minimumSpeed:{get:function(){return this._minimumSpeed},set:function(e){this._minimumSpeed=e}},maximumSpeed:{get:function(){return this._maximumSpeed},set:function(e){this._maximumSpeed=e}},minimumParticleLife:{get:function(){return this._minimumParticleLife},set:function(e){this._minimumParticleLife=e}},maximumParticleLife:{get:function(){return this._maximumParticleLife},set:function(e){this._maximumParticleLife=e,this._updateParticlePool=!0}},minimumMass:{get:function(){return this._minimumMass},set:function(e){this._minimumMass=e}},maximumMass:{get:function(){return this._maximumMass},set:function(e){this._maximumMass=e}},minimumImageSize:{get:function(){return this._minimumImageSize},set:function(e){this._minimumImageSize=e}},maximumImageSize:{get:function(){return this._maximumImageSize},set:function(e){this._maximumImageSize=e}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){this._sizeInMeters=e}},lifetime:{get:function(){return this._lifetime},set:function(e){this._lifetime=e}},complete:{get:function(){return this._complete}},isComplete:{get:function(){return this._isComplete}}});function spt(e){let t=e._emissionRate,n=e._maximumParticleLife,i=0,o=e._bursts;if(u(o)){let d=o.length;for(let p=0;p<d;++p)i+=o[p].maximum}let r=e._billboardCollection,s=e.image,a=Math.ceil(t*n+i),c=e._particles,l=e._particlePool,f=Math.max(a-c.length-l.length,0);for(let d=0;d<f;++d){let p=new bS;p._billboard=r.add({image:s}),l.push(p)}e._particleEstimate=a}function apt(e){let t=e._particlePool.pop();return u(t)||(t=new bS),t}function cpt(e,t){e._particlePool.push(t)}function lpt(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 c=a;c<r;++c){let l=n[c];i.remove(l._billboard)}n.length=a}function upt(e){u(e._billboard)&&(e._billboard.show=!1)}function F0e(e,t){let n=t._billboard;u(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=P.lerp(t.startColor.red,t.endColor.red,t.normalizedAge),o=P.lerp(t.startColor.green,t.endColor.green,t.normalizedAge),r=P.lerp(t.startColor.blue,t.endColor.blue,t.normalizedAge),s=P.lerp(t.startColor.alpha,t.endColor.alpha,t.normalizedAge);n.color=new z(i,o,r,s),n.scale=P.lerp(t.startScale,t.endScale,t.normalizedAge)}function fpt(e,t){t.startColor=z.clone(e._startColor,t.startColor),t.endColor=z.clone(e._endColor,t.endColor),t.startScale=e._startScale,t.endScale=e._endScale,t.image=e.image,t.life=P.randomBetween(e._minimumParticleLife,e._maximumParticleLife),t.mass=P.randomBetween(e._minimumMass,e._maximumMass),t.imageSize.x=P.randomBetween(e._minimumImageSize.x,e._maximumImageSize.x),t.imageSize.y=P.randomBetween(e._minimumImageSize.y,e._maximumImageSize.y),t._normalizedAge=0,t._age=0;let n=P.randomBetween(e._minimumSpeed,e._maximumSpeed);h.multiplyByScalar(t.velocity,n,t.velocity),e._particles.push(t)}function dpt(e,t){if(e._isComplete)return 0;t=P.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),u(e.bursts)){let o=e.bursts.length;for(let r=0;r<o;r++){let s=e.bursts[r],a=e._currentTime;u(s)&&!s._complete&&a>s.time&&(i+=P.randomBetween(s.minimum,s.maximum),s._complete=!0)}}return i}var Z4=new h;wF.prototype.update=function(e){if(!this.show)return;u(this._billboardCollection)||(this._billboardCollection=new Jl),this._updateParticlePool&&(spt(this),this._updateParticlePool=!1);let t=0;this._previousTime&&(t=$.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)?F0e(this,s):(upt(s),cpt(this,s),n[r]=n[a-1],--r,--a);n.length=a;let c=dpt(this,t);if(c>0&&u(i)){this._matrixDirty&&(this._combinedMatrix=M.multiply(this.modelMatrix,this.emitterModelMatrix,this._combinedMatrix),this._matrixDirty=!1);let l=this._combinedMatrix;for(r=0;r<c;r++)s=apt(this),this._emitter.emit(s),h.add(s.position,s.velocity,Z4),M.multiplyByPoint(l,Z4,Z4),s.position=M.multiplyByPoint(l,s.position,s.position),h.subtract(Z4,s.position,s.velocity),h.normalize(s.velocity,s.velocity),fpt(this,s),F0e(this,s)}if(this._billboardCollection.update(e),this._previousTime=$.clone(e.time,this._previousTime),this._currentTime+=t,this._lifetime!==Number.MAX_VALUE&&this._currentTime>this._lifetime)if(this.loop){if(this._currentTime=P.mod(this._currentTime,this._lifetime),this.bursts){let l=this.bursts.length;for(r=0;r<l;r++)this.bursts[r]._complete=!1}}else this._isComplete=!0,this._complete.raiseEvent(this);e.frameNumber%120===0&&lpt(this)};wF.prototype.isDestroyed=function(){return!1};wF.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),le(this)};var dX=wF;var k0e=vo(i3(),1);function hpt(e,t,n){return`    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 IF=hpt;var mpt={modifyFragmentShader:function(t){return t=ke.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}}},SS=mpt;var gC={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function PF(e){this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=z.clone(z.DARKGRAY),this._highlightColor=z.clone(z.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=gC.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=y(e.opaquePass,Ee.OPAQUE),this._cull=y(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=M.clone(M.IDENTITY),this._modelMatrix=M.clone(M.IDENTITY),this.time=0,this.shadows=gn.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=y(e.splitDirection,Pc.NONE),this._splittingEnabled=!1,this._resolveReadyPromise=void 0,this._rejectReadyPromise=void 0,this._readyPromise=ppt(this,e)}Object.defineProperties(PF.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},color:{get:function(){return z.clone(this._highlightColor)},set:function(e){this._highlightColor=z.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(u(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=se.clone(e,this._boundingSphere)}}});function ppt(e,t){let n=PA.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&&u(n.batchTableBinary)&&(n.styleableProperties=ap.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),u(n.draco)){let a=n.draco;e._decodingState=gC.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}let i=n.positions;u(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);let o=n.normals;u(o)&&(e._isOctEncoded16P=o.octEncoded);let r=n.colors;u(r)&&(u(r.constantColor)&&(e._constantColor=z.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);let s=n.batchIds;return u(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,new Promise(function(a,c){e._resolveReadyPromise=function(){e._ready=!0,a(e)},e._rejectReadyPromise=c})}var _pt=new h,gpt=new h,ypt=new h,V0e,J4;function Apt(e){if(!u(J4)){V0e=new k0e.default(0),J4=new Array(e);for(let t=0;t<e;++t)J4[t]=V0e.random()}return J4}function xpt(e){let n=e.length/3,i=Math.min(n,20),o=Apt(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=h.fromElements(r,r,r,_pt),c=h.fromElements(s,s,s,gpt);for(let f=0;f<i;++f){let d=Math.floor(o[f]*n),p=h.unpack(e,d*3,ypt);h.minimumByComponent(a,p,a),h.maximumByComponent(c,p,c)}let l=se.fromCornerPoints(a,c);return l.radius+=P.EPSILON2,l}function U0e(e,t){let n=q.fromTypedArray(e);return n===q.INT||n===q.UNSIGNED_INT||n===q.DOUBLE?(wt("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 Cpt=new oe,Tpt=new oe,Ept=new z,z0e=0,Q4=1,gX=2,H0e=3,bpt=4,hX=new M,Spt=new M;function Dpt(e,t){let n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,c=i.batchIds,l=i.styleableProperties,f=u(l),d=e._isQuantized,p=e._isQuantizedDraco,g=e._isOctEncoded16P,m=e._isOctEncodedDraco,A=e._quantizedRange,x=e._octEncodedRange,C=e._isRGB565,T=e._isTranslucent,E=e._hasColors,S=e._hasNormals,D=e._hasBatchIds,w,R,O=[],L={};if(e._styleableShaderAttributes=L,f){let U=bpt;for(let G in l)if(l.hasOwnProperty(G)){let V=l[G],X=U0e(V.typedArray,G);w=V.componentCount,R=q.fromTypedArray(X);let j=lt.createVertexBuffer({context:n,typedArray:X,usage:Ne.STATIC_DRAW});e._geometryByteLength+=j.sizeInBytes;let Q={index:U,vertexBuffer:j,componentsPerAttribute:w,componentDatatype:R,normalize:!1,offsetInBytes:0,strideInBytes:0};O.push(Q),L[G]={location:U,componentCount:w},++U}}let N=lt.createVertexBuffer({context:n,typedArray:r.typedArray,usage:Ne.STATIC_DRAW});e._geometryByteLength+=N.sizeInBytes;let _;E&&(_=lt.createVertexBuffer({context:n,typedArray:s.typedArray,usage:Ne.STATIC_DRAW}),e._geometryByteLength+=_.sizeInBytes);let b;S&&(b=lt.createVertexBuffer({context:n,typedArray:a.typedArray,usage:Ne.STATIC_DRAW}),e._geometryByteLength+=b.sizeInBytes);let v;D&&(c.typedArray=U0e(c.typedArray,"batchIds"),v=lt.createVertexBuffer({context:n,typedArray:c.typedArray,usage:Ne.STATIC_DRAW}),e._geometryByteLength+=v.sizeInBytes);let I=[];if(d?R=q.UNSIGNED_SHORT:p?R=A<=255?q.UNSIGNED_BYTE:q.UNSIGNED_SHORT:R=q.FLOAT,I.push({index:z0e,vertexBuffer:N,componentsPerAttribute:3,componentDatatype:R,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(d||p?e._boundingSphere=se.fromCornerPoints(h.ZERO,e._quantizedVolumeScale):e._boundingSphere=xpt(r.typedArray)),E)if(C)I.push({index:Q4,vertexBuffer:_,componentsPerAttribute:1,componentDatatype:q.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{let U=T?4:3;I.push({index:Q4,vertexBuffer:_,componentsPerAttribute:U,componentDatatype:q.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}S&&(g?(w=2,R=q.UNSIGNED_BYTE):m?(w=2,R=x<=255?q.UNSIGNED_BYTE:q.UNSIGNED_SHORT):(w=3,R=q.FLOAT),I.push({index:gX,vertexBuffer:b,componentsPerAttribute:w,componentDatatype:R,normalize:!1,offsetInBytes:0,strideInBytes:0})),D&&I.push({index:H0e,vertexBuffer:v,componentsPerAttribute:1,componentDatatype:q.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),f&&(I=I.concat(O));let B=new oi({context:n,attributes:I}),F={depthTest:{enabled:!0}},k={depthTest:{enabled:!0},depthMask:!1,blending:un.ALPHA_BLEND};e._opaquePass===Ee.CESIUM_3D_TILE&&(F.stencilTest=Bt.setCesium3DTileBit(),F.stencilMask=Bt.CESIUM_3D_TILE_MASK,k.stencilTest=Bt.setCesium3DTileBit(),k.stencilMask=Bt.CESIUM_3D_TILE_MASK),e._opaqueRenderState=Ue.fromCache(F),e._translucentRenderState=Ue.fromCache(k),e._drawCommand=new tt({boundingVolume:new se,cull:e._cull,modelMatrix:new M,primitiveType:Me.POINTS,vertexArray:B,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:T?e._translucentRenderState:e._opaqueRenderState,pass:T?Ee.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function vpt(e,t){let n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco,s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){let a=Cpt;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){let c=t.camera.frustum,l;t.mode===te.SCENE2D||c instanceof en?l=Number.POSITIVE_INFINITY:l=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=l}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(!u(a))return z.TRANSPARENT;let c=z.clone(a.edgeColor,Ept);return c.alpha=a.edgeWidth,c},u_clippingPlanesMatrix:function(){let a=e.clippingPlanes;if(!u(a))return M.IDENTITY;let c=y(e.clippingPlanesOriginMatrix,e._modelMatrix);M.multiply(n.uniformState.view3D,c,hX);let l=M.multiply(hX,a.modelMatrix,hX);return M.inverseTranspose(l,Spt)}};SS.addUniforms(e,s),(i||o||r)&&(s=_t(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){let a=Tpt;if(u(e._quantizedVolumeScale)){let c=h.clone(e._quantizedVolumeScale,a);h.divideByScalar(c,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),u(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function mX(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 pX(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 _X(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 wpt={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 Ipt(e,t,n){let i,o,r,s=t.context,a=u(n),c=e._isQuantized,l=e._isQuantizedDraco,f=e._isOctEncoded16P,d=e._isOctEncodedDraco,p=e._isRGB565,g=e._isTranslucent,m=e._hasColors,A=e._hasNormals,x=e._hasBatchIds,C=e._backFaceCulling,T=e._normalShading,E=e._drawCommand.vertexArray,S=e.clippingPlanes,D=e._attenuation,w,R,O,L=g,N=Ge(wpt),_={},b=e._styleableShaderAttributes;for(o in b)b.hasOwnProperty(o)&&(r=b[o],N[o]=`czm_3dtiles_property_${r.location}`,_[r.location]=r);if(a){let re={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)";w=n.getColorShaderFunction(`getColorFromStyle${ye}`,N,re),R=n.getShowShaderFunction(`getShowFromStyle${ye}`,N,re),O=n.getPointSizeShaderFunction(`getPointSizeFromStyle${ye}`,N,re),u(w)&&re.translucent&&(L=!0)}e._styleTranslucent=L;let v=u(w),I=u(R),B=u(O),F=e.isClipped,k=[],U=[];v&&(mX(w,k),pX(w,U)),I&&(mX(R,k),pX(R,U)),B&&(mX(O,k),pX(O,U));let G=U.indexOf("COLOR")>=0,V=U.indexOf("NORMAL")>=0;if(V&&!A)throw new ue("Style references the NORMAL semantic but the point cloud does not have normals");for(o in b)if(b.hasOwnProperty(o)){r=b[o];let re=k.indexOf(r.location)>=0,ye=_X(E,r.location);ye.enabled=re}let X=m&&(!v||G);if(m){let re=_X(E,Q4);re.enabled=X}let j=A&&(T||C||V);if(A){let re=_X(E,gX);re.enabled=j}let Q={a_position:z0e};X&&(Q.a_color=Q4),j&&(Q.a_normal=gX),x&&(Q.a_batchId=H0e);let W="",K=k.length;for(i=0;i<K;++i){let re=k[i];r=_[re];let ye=r.componentCount,fe=`czm_3dtiles_property_${re}`,Se;ye===1?Se="float":Se=`vec${ye}`,W+=`in ${Se} ${fe}; 
`,Q[fe]=r.location}vpt(e,t);let J=`in vec3 a_position; 
out vec4 v_color; 
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; 
uniform vec4 u_constantColor; 
uniform vec4 u_highlightColor; 
`;J+=`float u_pointSize; 
float tiles3d_tileset_time; 
`,D&&(J+=`float u_geometricError; 
float u_depthMultiplier; 
`),J+=W,X&&(g?J+=`in vec4 a_color; 
`:p?J+=`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; 
`:J+=`in vec3 a_color; 
`),j&&(f||d?J+=`in vec2 a_normal; 
`:J+=`in vec3 a_normal; 
`),x&&(J+=`in float a_batchId; 
`),(c||l||d)&&(J+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; 
`),v&&(J+=w),I&&(J+=R),B&&(J+=O),J+=`void main() 
{ 
    u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; 
    tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; 
`,D&&(J+=`    u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; 
    u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; 
`),X?g?J+=`    vec4 color = a_color; 
`:p?J+=`    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); 
`:J+=`    vec4 color = vec4(a_color, 1.0); 
`:J+=`    vec4 color = u_constantColor; 
`,c||l?J+=`    vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; 
`:J+=`    vec3 position = a_position; 
`,J+=`    vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); 
`,j?(f?J+=`    vec3 normal = czm_octDecode(a_normal); 
`:d?J+=`    vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; 
`:J+=`    vec3 normal = a_normal; 
`,J+=`    vec3 normalEC = czm_normal * normal; 
`):J+=`    vec3 normal = vec3(1.0); 
`,v&&(J+=`    color = getColorFromStyle(position, position_absolute, color, normal); 
`),I&&(J+=`    float show = float(getShowFromStyle(position, position_absolute, color, normal)); 
`),B?J+=`    gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; 
`:D?J+=`    vec4 positionEC = czm_modelView * vec4(position, 1.0); 
    float depth = -positionEC.z; 
    gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); 
`:J+=`    gl_PointSize = u_pointSize; 
`,J+=`    color = color * u_highlightColor; 
`,j&&T&&(J+=`    float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); 
    diffuseStrength = max(diffuseStrength, 0.4); 
    color.xyz *= diffuseStrength * czm_lightColor; 
`),J+=`    v_color = color; 
    gl_Position = czm_modelViewProjection * vec4(position, 1.0); 
`,j&&C&&(J+=`    float visible = step(-normalEC.z, 0.0); 
    gl_Position *= visible; 
    gl_PointSize *= visible; 
`),I&&(J+=`    gl_Position.w *= float(show); 
    gl_PointSize *= float(show); 
`),J+=`} 
`;let _e=`in vec4 v_color; 
`;F&&(_e+=`uniform highp sampler2D u_clippingPlanes; 
uniform mat4 u_clippingPlanesMatrix; 
uniform vec4 u_clippingPlanesEdgeStyle; 
`,_e+=`
`,_e+=v_(S,s),_e+=`
`),_e+=`void main() 
{ 
    out_FragColor = czm_gammaCorrect(v_color); 
`,F&&(_e+=IF("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),_e+=`} 
`,e.splitDirection!==Pc.NONE&&(_e=SS.modifyFragmentShader(_e)),u(e._vertexShaderLoaded)&&(J=e._vertexShaderLoaded(J)),u(e._fragmentShaderLoaded)&&(_e=e._fragmentShaderLoaded(_e));let xe=e._drawCommand;u(xe.shaderProgram)&&xe.shaderProgram.destroy(),xe.shaderProgram=Xt.fromCache({context:s,vertexShaderSource:J,fragmentShaderSource:_e,attributeLocations:Q});try{xe.shaderProgram._bind()}catch{throw new ue("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function Ppt(e,t){if(e._decodingState===gC.READY)return!1;if(e._decodingState===gC.NEEDS_DECODE){let n=e._parsedContent,i=n.draco,o=pp.decodePointCloud(i,t);u(o)&&(e._decodingState=gC.DECODING,o.then(function(r){e._decodingState=gC.READY;let s=u(r.POSITION)?r.POSITION.array:void 0,a=u(r.RGB)?r.RGB.array:void 0,c=u(r.RGBA)?r.RGBA.array:void 0,l=u(r.NORMAL)?r.NORMAL.array:void 0,f=u(r.BATCH_ID)?r.BATCH_ID.array:void 0,d=u(s)&&u(r.POSITION.data.quantization),p=u(l)&&u(r.NORMAL.data.quantization);if(d){let x=r.POSITION.data.quantization,C=x.range;e._quantizedVolumeScale=h.fromElements(C,C,C),e._quantizedVolumeOffset=h.unpack(x.minValues),e._quantizedRange=(1<<x.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 x in m)if(m.hasOwnProperty(x)){let C=r[x];u(g)||(g={}),g[x]={typedArray:C.array,componentCount:C.data.componentsPerAttribute}}u(s)&&(n.positions={typedArray:s});let A=y(c,a);u(A)&&(n.colors={typedArray:A}),u(l)&&(n.normals={typedArray:l}),u(f)&&(n.batchIds={typedArray:f}),n.styleableProperties=g}).catch(function(r){e._decodingState=gC.FAILED,e._rejectReadyPromise(r)}))}return!0}var Opt=new oe,Rpt=new h;PF.prototype.update=function(e){let t=e.context;if(Ppt(this,t))return;let i=!1,o=!M.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),u(this._drawCommand)||(Dpt(this,e),o=!0,i=!0,this._resolveReadyPromise(),this._parsedContent=void 0),o){M.clone(this.modelMatrix,this._modelMatrix);let l=this._drawCommand.modelMatrix;if(M.clone(this._modelMatrix,l),u(this._rtcCenter)&&M.multiplyByTranslation(l,this._rtcCenter,l),u(this._quantizedVolumeOffset)&&M.multiplyByTranslation(l,this._quantizedVolumeOffset,l),e.mode!==te.SCENE3D){let d=e.mapProjection,p=M.getColumn(l,3,Opt);oe.equals(p,oe.UNIT_W)||Ot.basisTo2D(d,l,l)}let f=this._drawCommand.boundingVolume;if(se.clone(this._boundingSphere,f),this._cull){let d=f.center;M.multiplyByPoint(l,d,d);let p=M.getScale(l,Rpt);f.radius*=h.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!==Pc.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&Ipt(this,e,this._style),this._drawCommand.castShadows=gn.castShadows(this.shadows),this._drawCommand.receiveShadows=gn.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?Ee.TRANSLUCENT:this._opaquePass;let a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)};PF.prototype.isDestroyed=function(){return!1};PF.prototype.destroy=function(){let e=this._drawCommand;return u(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),le(this)};var OF=PF;function Ru(){de.throwInstantiationError()}Ru.computeDefaultLevelZeroMaximumGeometricError=function(e){return e.ellipsoid.maximumRadius*2*Math.PI*.25/(65*e.getNumberOfXTilesAtLevel(0))};Object.defineProperties(Ru.prototype,{quadtree:{get:de.throwInstantiationError,set:de.throwInstantiationError},ready:{get:de.throwInstantiationError},tilingScheme:{get:de.throwInstantiationError},errorEvent:{get:de.throwInstantiationError}});Ru.prototype.update=de.throwInstantiationError;Ru.prototype.beginUpdate=de.throwInstantiationError;Ru.prototype.endUpdate=de.throwInstantiationError;Ru.prototype.getLevelMaximumGeometricError=de.throwInstantiationError;Ru.prototype.loadTile=de.throwInstantiationError;Ru.prototype.computeTileVisibility=de.throwInstantiationError;Ru.prototype.showTileThisFrame=de.throwInstantiationError;Ru.prototype.computeDistanceToTile=de.throwInstantiationError;Ru.prototype.isDestroyed=de.throwInstantiationError;Ru.prototype.destroy=de.throwInstantiationError;var yX=Ru;function ah(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.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new Rn,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r,s)}ah.spatialComparator=function(e,t){return t.screenSpaceError-e.screenSpaceError};var Bpt=new h;ah.prototype.computeBoundingVolumes=function(e,t){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);let n=Z.getScale(this.orientedBoundingBox.halfAxes,Bpt),i=2*h.maximumComponent(n);this.approximateVoxelSize=i/h.minimumComponent(t)};ah.prototype.visibility=function(e,t){let n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};ah.prototype.computeScreenSpaceError=function(e,t){let n=this.orientedBoundingBox,i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,P.EPSILON7);let o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};var G0e={keyframe:0};function RF(e,t){return G0e.keyframe=e,wo(t,G0e,Ki.searchComparator)}ah.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this,n=t.level,i=Math.floor(e),o=Math.ceil(e),r,s,a=+Number.MAX_VALUE,c=+Number.MAX_VALUE;for(;u(t);){let l=t.renderableKeyframeNodes;if(l.length>=1){let f=RF(i,l);f<0&&(f=P.clamp(~f-1,0,l.length-1));let d=l[f],p=d.keyframe,g;if(o===i||i<p)g=d;else{let R=Math.min(f+1,l.length-1);g=l[R]}let m=g.keyframe,A=i-p,x=m-o,C=n-t.level,T=Math.exp(C*4),E=1,S=200,D=C*T+(A>=0?A*E:-A*S),w=C*T+(x>=0?x*E:-x*S);if(D<a&&(a=D,r=d),w<c&&(c=w,s=g),A===0&&x===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,u(r)&&u(s)){let l=r.keyframe,f=s.keyframe;this.renderableKeyframeNodeLerp=l===f?0:P.clamp((e-l)/(f-l),0,1)}};ah.prototype.isVisited=function(e){return this.visitedFrameNumber===e};ah.prototype.createKeyframeNode=function(e){let t=RF(e,this.keyframeNodes);if(t<0){t=~t;let n=new Ki(this,e);this.keyframeNodes.splice(t,0,n)}};ah.prototype.destroyKeyframeNode=function(e,t){let n=e.keyframe,i=RF(n,this.keyframeNodes);if(i<0)throw new de("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=RF(n,this.renderableKeyframeNodes);if(o<0)throw new de("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.spatialNode=void 0,e.state=Ki.LoadState.UNLOADED,e.metadatas={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};ah.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==Ki.LoadState.RECEIVED||e.megatextureIndex!==-1||e.metadatas.length!==t.length)throw new de("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){let r=t[o];e.megatextureIndex=r.add(e.metadatas[o]),e.metadatas[o]=void 0}e.state=Ki.LoadState.LOADED;let n=this.renderableKeyframeNodes,i=RF(e.keyframe,n);if(i>=0)throw new de("Keyframe already renderable");i=~i,n.splice(i,0,e)};ah.prototype.isRenderable=function(e){let t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return u(t)&&u(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};var DS=ah;function AX(e){e=y(e,1),this._radius=y(e,1)}Object.defineProperties(AX.prototype,{radius:{get:function(){return this._radius},set:function(e){this._radius=e}}});AX.prototype.emit=function(e){let t=P.randomBetween(0,P.TWO_PI),n=P.randomBetween(0,P.PI),i=P.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=h.fromElements(o,r,s,e.position),e.velocity=h.normalize(e.position,e.velocity)};var xX=AX;function BF(){}BF.prototype.evaluate=function(e,t){de.throwInstantiationError()};BF.prototype.evaluateColor=function(e,t){de.throwInstantiationError()};BF.prototype.getShaderFunction=function(e,t,n,i){de.throwInstantiationError()};BF.prototype.getVariables=function(){de.throwInstantiationError()};var CX=BF;function vS(){}vS.prototype.boundingVolume=void 0;vS.prototype.boundingSphere=void 0;vS.prototype.distanceToCamera=function(e){de.throwInstantiationError()};vS.prototype.intersectPlane=function(e){de.throwInstantiationError()};vS.prototype.createDebugVolume=function(e){de.throwInstantiationError()};var TX=vS;function MF(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=u(e.tilingScheme)?e.tilingScheme:new ji({ellipsoid:e.ellipsoid}),this._color=y(e.color,z.YELLOW),this._errorEvent=new Ae,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._readyPromise=Promise.resolve(!0),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(MF.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}},ready:{get:function(){return!0}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){}},hasAlphaChannel:{get:function(){return!0}}});MF.prototype.getTileCredits=function(e,t,n){};MF.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)};MF.prototype.pickFeatures=function(e,t,n,i,o){};var LF=MF;function EX(e){de.throwInstantiationError()}EX.prototype.isReady=de.throwInstantiationError;EX.prototype.shouldDiscardImage=de.throwInstantiationError;var bX=EX;var Mpt={START:0,LOADING:1,READY:2,UPSAMPLED_ONLY:3},SX=Object.freeze(Mpt);function AC(e){e=y(e,y.EMPTY_OBJECT),this.show=y(e.show,!0),this.modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this.shadows=y(e.shadows,gn.ENABLED),this.maximumMemoryUsage=y(e.maximumMemoryUsage,256),this.shading=new Oh(e.shading),this.style=e.style,this.frameFailed=new Ae,this.frameChanged=new Ae,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new Tp,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._resolveReadyPromise=void 0;let t=this;this._readyPromise=new Promise(function(n){t._resolveReadyPromise=n}),this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}Object.defineProperties(AC.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ss.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(u(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}},readyPromise:{get:function(){return this._readyPromise}}});function Lpt(e){return`uniform vec4 czm_pickColor;
${e}`}function Npt(e){return function(t){return _t(t,{czm_pickColor:function(){return e._pickId.color}})}}function Fpt(){return"czm_pickColor"}AC.prototype.makeStyleDirty=function(){this._styleDirty=!0};AC.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};var Vpt=new $;function vX(e){let t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function yC(e,t){return e._intervals.indexOf(t.start)}function Upt(e,t){let n=e._intervals,i=e._clock,o=vX(e);if(o===0)return;let r=e._getAverageLoadTime(),s=$.addSeconds(i.currentTime,r*o,Vpt),a=n.indexOf(s),c=yC(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function kpt(e){let t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function zpt(e,t,n){let i=vX(e),o=yC(e,t),r=yC(e,n);return i>=0?o>=r:o<=r}function Hpt(e,t){return function(n){let i=u(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 Gpt(e,t,n){let i=yC(e,t),o=e._frames,r=o[i];if(!u(r)){let s=t.data.transform,a=u(s)?M.fromArray(s):void 0,c=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:di(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,Oe.fetchArrayBuffer({url:c}).then(function(l){return r.pointCloud=new OF({arrayBuffer:l,cull:!0,fragmentShaderLoaded:Lpt,uniformMapLoaded:Npt(e),pickIdLoaded:Fpt}),r.pointCloud.readyPromise}).catch(Hpt(e,c))}return r}function Wpt(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 jpt(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);let o=t.pointCloud;if(u(o)&&!t.ready){let r=i.commandList,s=r.length;if(j0e(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){let a=(di()-t.timestamp)/1e3;Wpt(e,a)}}t.touchedFrameNumber=i.frameNumber}var Ypt=new M;function qpt(e,t){let n=e.shading;return u(n)&&u(n.baseResolution)?n.baseResolution:u(t.boundingSphere)?P.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function Xpt(e){let t=e.shading;return u(t)&&u(t.maximumAttenuation)?t.maximumAttenuation:10}var Kpt=new Oh;function j0e(e,t,n,i){let o=y(e.shading,Kpt),r=t.pointCloud,s=y(t.transform,M.IDENTITY);r.modelMatrix=M.multiplyTransformation(e.modelMatrix,s,Ypt),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=qpt(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=Xpt(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function DX(e,t,n,i){let o=Gpt(e,t,i);jpt(e,o,n,i)}function Zpt(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function Y0e(e,t){let n=e._frames,i=n.length;for(let o=0;o<i;++o){let r=n[o];if(u(r)&&(!u(t)||t(r))){let s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),u(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function Jpt(e,t){let n=yC(e,t),i=e._frames[n];if(u(i)&&i.ready)return i}function W0e(e,t,n,i,o){return u(n)?n.ready?!0:(DX(e,t,i,o),n.ready):!1}function Qpt(e,t,n,i,o){let r,s,a,c=e._intervals,l=e._frames,f=yC(e,n),d=yC(e,t);if(f>=d){for(r=f;r>=d;--r)if(s=c.get(r),a=l[r],W0e(e,s,a,i,o))return s}else for(r=f;r<=d;++r)if(s=c.get(r),a=l[r],W0e(e,s,a,i,o))return s;return t}function $pt(e,t,n){let i=e._frames,o=i.length;for(let r=0;r<o;++r){let s=i[r];u(s)&&u(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}var wS={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};AC.prototype.update=function(e){if(e.mode===te.MORPHING||!this.show)return;u(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),u(this._loadTimestamp)||(this._loadTimestamp=$.clone(e.time));let t=Math.max($.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes,i=0,o=!1,r=u(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)&&$pt(this,o,s),wS.timeSinceLoad=t,wS.isClipped=r;let a=this.shading,c=this._pointCloudEyeDomeLighting,l=e.commandList,f=l.length,d=this._previousInterval,p=this._nextInterval,g=kpt(this);if(!u(g))return;let m=!1,A=vX(this),x=A===0;A!==this._clockMultiplier&&(m=!0,this._clockMultiplier=A),(!u(d)||x)&&(d=g),(!u(p)||m||zpt(this,g,p))&&(p=Upt(this,g)),d=Qpt(this,d,g,wS,e);let C=Jpt(this,d);u(C)||(DX(this,d,wS,e),C=this._lastRenderedFrame),u(C)&&j0e(this,C,wS,e),u(p)&&DX(this,p,wS,e);let T=this;u(C)&&!u(this._lastRenderedFrame)&&e.afterRender.push(function(){return T._resolveReadyPromise(T),!0}),u(C)&&C!==this._lastRenderedFrame&&T.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return T.frameChanged.raiseEvent(T),!0}),this._previousInterval=d,this._nextInterval=p,this._lastRenderedFrame=C;let E=this._totalMemoryUsageInBytes,S=this.maximumMemoryUsage*1024*1024;E>S&&Y0e(this,Zpt(e));let w=l.length-f;u(a)&&a.attenuation&&a.eyeDomeLighting&&w>0&&c.update(e,f,a,this.boundingSphere)};AC.prototype.isDestroyed=function(){return!1};AC.prototype.destroy=function(){return Y0e(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),le(this)};var IS=AC;function $4(e,t){this.show=!0,u(e)||(e=new Ye),this.rectangle=Ye.clone(e),u(t)||(t=Vi.fromType(Vi.ColorType,{color:new z(1,1,1,1)})),this.material=t,this._material=void 0,this._overlayCommand=void 0,this._rs=void 0}$4.prototype.update=function(e){if(!this.show)return;let t=this._rs;if((!u(t)||!Ye.equals(t.viewport,this.rectangle))&&(this._rs=Ue.fromCache({blending:un.ALPHA_BLEND,viewport:this.rectangle})),e.passes.render){let i=e.context;if(this._material!==this.material||!u(this._overlayCommand)){this._material=this.material,u(this._overlayCommand)&&this._overlayCommand.shaderProgram.destroy();let o=new ke({sources:[this._material.shaderSource,QM]});this._overlayCommand=i.createViewportQuadCommand(o,{renderState:this._rs,uniformMap:this._material._uniforms,owner:this}),this._overlayCommand.pass=Ee.OVERLAY}this._material.update(i),this._overlayCommand.renderState=this._rs,this._overlayCommand.uniformMap=this._material._uniforms,e.commandList.push(this._overlayCommand)}};$4.prototype.isDestroyed=function(){return!1};$4.prototype.destroy=function(){return u(this._overlayCommand)&&(this._overlayCommand.shaderProgram=this._overlayCommand.shaderProgram&&this._overlayCommand.shaderProgram.destroy()),le(this)};var wX=$4;var NF=`// See Intersection.glsl for the definition of intersectScene
// See IntersectionUtils.glsl for the definition of nextIntersection
// See convertUvToBox.glsl, convertUvToCylinder.glsl, or convertUvToEllipsoid.glsl
// for the definition of convertUvToShapeUvSpace. The appropriate function is 
// selected based on the VoxelPrimitive shape type, and added to the shader in
// Scene/VoxelRenderResources.js.
// See Octree.glsl for the definitions of TraversalData, SampleData,
// traverseOctreeFromBeginning, and traverseOctreeFromExisting
// See Megatexture.glsl for the definition of accumulatePropertiesFromMegatexture

#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops
#define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0

uniform mat3 u_transformDirectionViewToLocal;
uniform vec3 u_cameraPositionUv;

#if defined(PICKING)
    uniform vec4 u_pickColor;
#endif

#if defined(JITTER)
float hash(vec2 p)
{
    vec3 p3 = fract(vec3(p.xyx) * 50.0); // magic number = hashscale
    p3 += dot(p3, p3.yzx + 19.19);
    return fract((p3.x + p3.y) * p3.z);
}
#endif

void main()
{
    vec4 fragCoord = gl_FragCoord;
    vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw; // [0,1]
    vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);
    vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection); // normalize again just in case
    vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection); // normalize again just in case
    vec3 viewPosUv = u_cameraPositionUv;

    Intersections ix;
    vec2 entryExitT = intersectScene(screenCoord, viewPosUv, viewDirUv, ix);

    // Exit early if the scene was completely missed.
    if (entryExitT.x == NO_HIT) {
        discard;
    }

    float currT = entryExitT.x;
    float endT = entryExitT.y;
    vec3 positionUv = viewPosUv + currT * viewDirUv;
    // TODO: is it possible for this to be out of bounds, and does it matter?
    vec3 positionUvShapeSpace = convertUvToShapeUvSpace(positionUv);

    // Traverse the tree from the start position
    TraversalData traversalData;
    SampleData sampleDatas[SAMPLE_COUNT];
    traverseOctreeFromBeginning(positionUvShapeSpace, traversalData, sampleDatas);

    // TODO:
    //  - jitter doesn't affect the first traversal?
    //  - jitter is always > 0?
    //  - jitter is only applied at one step?
    #if defined(JITTER)
        float noise = hash(screenCoord); // [0,1]
        currT += noise * traversalData.stepT;
        positionUv += noise * traversalData.stepT * 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) {
        // Read properties from the megatexture based on the traversal state
        Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);

        // Prepare the custom shader inputs
        copyPropertiesToMetadata(properties, fragmentInput.metadata);
        fragmentInput.voxel.positionUv = positionUv;
        fragmentInput.voxel.positionShapeUv = positionUvShapeSpace;
        fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;
        fragmentInput.voxel.viewDirUv = viewDirUv;
        fragmentInput.voxel.viewDirWorld = viewDirWorld;
        fragmentInput.voxel.travelDistance = traversalData.stepT;

        // Run the custom shader
        czm_modelMaterial materialOutput;
        fragmentMain(fragmentInput, materialOutput);

        // Sanitize the custom shader output
        vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);
        color.rgb = max(color.rgb, vec3(0.0));
        color.a = clamp(color.a, 0.0, 1.0);

        // Pre-multiplied alpha blend
        colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);

        // Stop traversing if the alpha has been fully saturated
        if (colorAccum.a > ALPHA_ACCUM_MAX) {
            colorAccum.a = ALPHA_ACCUM_MAX;
            break;
        }

        if (traversalData.stepT == 0.0) {
            // Shape is infinitely thin, no need to traverse further
            break;
        }

        // Keep raymarching
        currT += traversalData.stepT;
        positionUv += traversalData.stepT * viewDirUv;

        // Check if there's more intersections.
        if (currT > endT) {
            #if (INTERSECTION_COUNT == 1)
                break;
            #else
                vec2 entryExitT = nextIntersection(ix);
                if (entryExitT.x == NO_HIT) {
                    break;
                } else {
                    // Found another intersection. Resume raymarching there
                    currT = entryExitT.x;
                    endT = entryExitT.y;
                    positionUv = viewPosUv + currT * viewDirUv;
                }
            #endif
        }

        // Traverse the tree from the current ray position.
        // This is similar to traverseOctree but is faster when the ray is in the same tile as the previous step.
        positionUvShapeSpace = convertUvToShapeUvSpace(positionUv);
        traverseOctreeFromExisting(positionUvShapeSpace, traversalData, sampleDatas);
    }

    // Convert the alpha from [0,ALPHA_ACCUM_MAX] to [0,1]
    colorAccum.a /= ALPHA_ACCUM_MAX;

    #if defined(PICKING)
        // If alpha is 0.0 there is nothing to pick
        if (colorAccum.a == 0.0) {
            discard;
        }
        out_FragColor = u_pickColor;
    #else
        out_FragColor = colorAccum;
    #endif
}
`;var FF=`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 VF=`/* Intersection defines
#define INTERSECTION_COUNT ###
*/

#define NO_HIT (-czm_infinity)
#define INF_HIT (czm_infinity * 0.5)

struct Ray {
    vec3 pos;
    vec3 dir;
};

struct Intersections {
    // Don't access these member variables directly - call the functions instead.

    #if (INTERSECTION_COUNT > 1)
        // Store an array of intersections. Each intersection is composed of:
        //  x for the T value
        //  y for the shape type - which encodes positive vs negative and entering vs exiting
        // For example:
        //  y = 0: positive shape entry
        //  y = 1: positive shape exit
        //  y = 2: negative shape entry
        //  y = 3: negative shape exit
        vec2 intersections[INTERSECTION_COUNT * 2];

        // Maintain state for future nextIntersection calls
        int index;
        int surroundCount;
        bool surroundIsPositive;
    #else
        // When there's only one positive shape intersection none of the extra stuff is needed.
        float intersections[2];
    #endif
};

// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
#if (INTERSECTION_COUNT > 1)
    #define getIntersection(/*inout Intersections*/ ix, /*int*/ index) (ix).intersections[(index)].x
#else
    #define getIntersection(/*inout Intersections*/ ix, /*int*/ index) (ix).intersections[(index)]
#endif

// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
#define getIntersectionPair(/*inout Intersections*/ ix, /*int*/ index) vec2(getIntersection((ix), (index) * 2 + 0), getIntersection((ix), (index) * 2 + 1))

// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
#if (INTERSECTION_COUNT > 1)
    #define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*enter*/ enter) (ix).intersections[(index)] = vec2((t), float(!positive) * 2.0 + float(!enter))
#else
    #define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*enter*/ enter) (ix).intersections[(index)] = (t)
#endif

// Using a define instead of a real function because WebGL1 cannot access array with non-constant index.
#if (INTERSECTION_COUNT > 1)
    #define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec2((entryExit).x, float((index) > 0) * 2.0 + 0.0); (ix).intersections[(index) * 2 + 1] = vec2((entryExit).y, float((index) > 0) * 2.0 + 1.0)
#else
    #define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = (entryExit).x; (ix).intersections[(index) * 2 + 1] = (entryExit).y
#endif

#if (INTERSECTION_COUNT > 1)
void initializeIntersections(inout Intersections ix) {
    // Sort the intersections from min T to max T with bubble sort.
    // Note: If this sorting function changes, some of the intersection test may
    // need to be updated. Search for "bubble sort" to find those areas.
    const int sortPasses = INTERSECTION_COUNT * 2 - 1;
    for (int n = sortPasses; n > 0; --n) {
        for (int i = 0; i < sortPasses; ++i) {
            // The loop should be: for (i = 0; i < n; ++i) {...} but WebGL1 cannot
            // loop with non-constant condition, so it has to break early instead
            if (i >= n) { break; }

            vec2 intersect0 = ix.intersections[i + 0];
            vec2 intersect1 = ix.intersections[i + 1];

            float t0 = intersect0.x;
            float t1 = intersect1.x;
            float b0 = intersect0.y;
            float b1 = intersect1.y;

            float tmin = min(t0, t1);
            float tmax = max(t0, t1);
            float bmin = tmin == t0 ? b0 : b1;
            float bmax = tmin == t0 ? b1 : b0;

            ix.intersections[i + 0] = vec2(tmin, bmin);
            ix.intersections[i + 1] = vec2(tmax, bmax);
        }
    }

    // Prepare initial state for nextIntersection
    ix.index = 0;
    ix.surroundCount = 0;
    ix.surroundIsPositive = false;
}
#endif

#if (INTERSECTION_COUNT > 1)
vec2 nextIntersection(inout Intersections ix) {
    vec2 entryExitT = vec2(NO_HIT);

    const int passCount = INTERSECTION_COUNT * 2;

    if (ix.index == passCount) {
        return entryExitT;
    }

    for (int i = 0; i < passCount; ++i) {
        // The loop should be: for (i = ix.index; i < passCount; ++i) {...} but WebGL1 cannot
        // loop with non-constant condition, so it has to continue instead.
        if (i < ix.index) {
            continue;
        }

        ix.index = i + 1;

        vec2 intersect = ix.intersections[i];
        float t = intersect.x;
        bool currShapeIsPositive = intersect.y < 2.0;
        bool enter = mod(intersect.y, 2.0) == 0.0;

        ix.surroundCount += enter ? +1 : -1;
        ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;

        // entering positive or exiting negative
        if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {
            entryExitT.x = t;
        }

        // exiting positive or entering negative after being inside positive
        // TODO: Can this be simplified?
        bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;
        bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;
        if (exitPositive || enterNegativeFromPositive) {
            entryExitT.y = t;

            // entry and exit have been found, so the loop can stop
            if (exitPositive) {
                // After exiting positive shape there is nothing left to intersect, so jump to the end index.
                ix.index = passCount;
            }
            break;
        }
    }

    return entryExitT;
}
#endif

// NOTE: initializeIntersections, nextIntersection aren't even declared unless INTERSECTION_COUNT > 1
// export { NO_HIT, INF_HIT, Ray, Intersections, getIntersectionPair, setIntersectionPair, initializeIntersections, nextIntersection };
`;var UF=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections,
// setIntersectionPair, INF_HIT, NO_HIT

/* intersectDepth defines (set in Scene/VoxelRenderResources.js)
#define DEPTH_INTERSECTION_INDEX ###
*/

uniform mat4 u_transformPositionViewToUv;

void intersectDepth(vec2 screenCoord, Ray ray, inout Intersections ix) {
    float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));
    if (logDepthOrDepth != 0.0) {
        // Calculate how far the ray must travel before it hits the depth buffer.
        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 {
        // There's no depth at this location.
        setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));
    }
}
`;var kF=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections, INF_HIT,
// NO_HIT, setIntersectionPair

/* Clipping plane defines (set in Scene/VoxelRenderResources.js)
#define CLIPPING_PLANES_UNION
#define CLIPPING_PLANES_COUNT
#define CLIPPING_PLANES_INTERSECTION_INDEX
*/

uniform sampler2D u_clippingPlanesTexture;
uniform mat4 u_clippingPlanesMatrix;

// Plane is in Hessian Normal Form
vec2 intersectPlane(Ray ray, vec4 plane) {
    vec3 o = ray.pos;
    vec3 d = ray.dir;
    vec3 n = plane.xyz; // normal
    float w = plane.w; // -dot(pointOnPlane, normal)

    float a = dot(o, n);
    float b = dot(d, n);
    float t = -(w + a) / b;

    if (dot(d, n) > 0.0) {
        return vec2(t, +INF_HIT);
    } else {
        return vec2(-INF_HIT, t);
    }
}

void intersectClippingPlanes(Ray ray, inout Intersections ix) {
    #if (CLIPPING_PLANES_COUNT == 1)
        // Union and intersection are the same when there's one clipping plane, and the code
        // is more simplified.
        vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);
        vec2 intersection = intersectPlane(ray, planeUv);
        setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, intersection);
    #elif defined(CLIPPING_PLANES_UNION)
        float minPositiveT = +INF_HIT;
        float maxNegativeT = -INF_HIT;
        for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
            vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
            vec2 intersection = intersectPlane(ray, planeUv);
            if (intersection.y == +INF_HIT) {
                minPositiveT = min(minPositiveT, intersection.x);
            } else {
                maxNegativeT = max(maxNegativeT, intersection.y);
            }
        }
        setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, vec2(-INF_HIT, maxNegativeT));
        setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, vec2(minPositiveT, +INF_HIT));
    #else // intersection
        float maxPositiveT = -INF_HIT;
        float minNegativeT = +INF_HIT;
        for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
            vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
            vec2 intersection = intersectPlane(ray, planeUv);
            if (intersection.y == +INF_HIT) {
                maxPositiveT = max(maxPositiveT, intersection.x);
            } else {
                minNegativeT = min(minNegativeT, intersection.y);
            }
        }
        if (maxPositiveT < minNegativeT) {
            setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, vec2(maxPositiveT, minNegativeT));
        } else {
            setIntersectionPair(ix, CLIPPING_PLANES_INTERSECTION_INDEX, vec2(NO_HIT));
        }
    #endif
}
`;var zF=`// See IntersectionUtils.glsl for the definitions of Ray and NO_HIT

/* Box defines (set in Scene/VoxelBoxShape.js)
#define BOX_INTERSECTION_INDEX ### // always 0
#define BOX_HAS_RENDER_BOUNDS
#define BOX_IS_2D
*/

#if defined(BOX_HAS_RENDER_BOUNDS)
    #if defined(BOX_IS_2D)
        // This matrix bakes in an axis conversion so that the math works for XY plane.
        uniform mat4 u_boxUvToRenderBoundsTransform;
    #else
        // Similar to u_boxTransformUvToBounds but fewer instructions needed.
        uniform vec3 u_boxUvToRenderBoundsScale;
        uniform vec3 u_boxUvToRenderBoundsTranslate;
    #endif
#endif

vec2 intersectUnitCube(Ray ray) // Unit cube from [-1, +1]
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    vec3 dInv = 1.0 / d;
    vec3 od = -o * dInv;
    vec3 t0 = od - dInv;
    vec3 t1 = od + dInv;
    vec3 m0 = min(t0, t1);
    vec3 m1 = max(t0, t1);
    float tMin = max(max(m0.x, m0.y), m0.z);
    float tMax = min(min(m1.x, m1.y), m1.z);

    if (tMin >= tMax) {
        return vec2(NO_HIT);
    }

    return vec2(tMin, tMax);
}

vec2 intersectUnitSquare(Ray ray) // Unit square from [-1, +1]
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float t = -o.z / d.z;
    vec2 planePos = o.xy + d.xy * t;
    if (any(greaterThan(abs(planePos), vec2(1.0)))) {
        return vec2(NO_HIT);
    }

    return vec2(t, t);
}

void intersectShape(Ray ray, inout Intersections ix)
{
    #if defined(BOX_HAS_RENDER_BOUNDS)
        #if defined(BOX_IS_2D)
            // Transform the ray into unit square space on Z plane
            // This matrix bakes in an axis conversion so that the math works for XY plane.
            ray.pos = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.pos, 1.0));
            ray.dir = vec3(u_boxUvToRenderBoundsTransform * vec4(ray.dir, 0.0));
            vec2 entryExit = intersectUnitSquare(ray);
        #else
            // Transform the ray into unit cube space
            ray.pos = ray.pos * u_boxUvToRenderBoundsScale + u_boxUvToRenderBoundsTranslate;
            ray.dir *= u_boxUvToRenderBoundsScale;
            vec2 entryExit = intersectUnitCube(ray);
        #endif
    #else
        // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
        // Direction is scaled as well to be in sync with position.
        ray.pos = ray.pos * 2.0 - 1.0;
        ray.dir = ray.dir * 2.0;
        vec2 entryExit = intersectUnitCube(ray);
    #endif

    setIntersectionPair(ix, BOX_INTERSECTION_INDEX, entryExit);
}
`;var HF=`// See IntersectionUtils.glsl for the definitions of Ray, setIntersection,
// setIntersectionPair

/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO

#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED

#define CYLINDER_INTERSECTION_INDEX_RADIUS_MAX
#define CYLINDER_INTERSECTION_INDEX_RADIUS_MIN
#define CYLINDER_INTERSECTION_INDEX_ANGLE
*/

// Cylinder uniforms
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT)
    uniform vec3 u_cylinderUvToRenderBoundsScale;
    uniform vec3 u_cylinderUvToRenderBoundsTranslate;
#endif
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN) && !defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
    uniform float u_cylinderUvToRenderRadiusMin;
#endif
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
    uniform vec2 u_cylinderRenderAngleMinMax;
#endif

vec4 intersectHalfPlane(Ray ray, float angle) {
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 planeDirection = vec2(cos(angle), sin(angle));
    vec2 planeNormal = vec2(planeDirection.y, -planeDirection.x);

    float a = dot(o, planeNormal);
    float b = dot(d, planeNormal);
    float t = -a / b;

    vec2 p = o + t * d;
    bool outside = dot(p, planeDirection) < 0.0;
    if (outside) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);

    return vec4(-INF_HIT, t, t, +INF_HIT);
}

#define POSITIVE_HIT vec2(t, +INF_HIT);
#define NEGATIVE_HIT vec2(-INF_HIT, t);

vec2 intersectHalfSpace(Ray ray, float angle)
{
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 n = vec2(sin(angle), -cos(angle));

    float a = dot(o, n);
    float b = dot(d, n);
    float t = -a / b;
    float s = sign(a);

    // Half space cuts right through the camera, pick the side to intersect
    if (a == 0.0) {
        if (b >= 0.0) {
            return POSITIVE_HIT;
        } else {
            return NEGATIVE_HIT;
        }
    }

    if (t >= 0.0 != s >= 0.0) {
        return POSITIVE_HIT;
    } else {
        return NEGATIVE_HIT;
    }
}

vec2 intersectRegularWedge(Ray ray, float minAngle, float maxAngle)
{
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 n1 = vec2(sin(minAngle), -cos(minAngle));
    vec2 n2 = vec2(-sin(maxAngle), cos(maxAngle));

    float a1 = dot(o, n1);
    float a2 = dot(o, n2);
    float b1 = dot(d, n1);
    float b2 = dot(d, n2);

    float t1 = -a1 / b1;
    float t2 = -a2 / b2;
    float s1 = sign(a1);
    float s2 = sign(a2);

    float tmin = min(t1, t2);
    float tmax = max(t1, t2);
    float smin = tmin == t1 ? s1 : s2;
    float smax = tmin == t1 ? s2 : s1;

    bool e = tmin >= 0.0;
    bool f = tmax >= 0.0;
    bool g = smin >= 0.0;
    bool h = smax >= 0.0;

    if (e != g && f == h) return vec2(tmin, tmax);
    else if (e == g && f == h) return vec2(-INF_HIT, tmin);
    else if (e != g && f != h) return vec2(tmax, +INF_HIT);
    else return vec2(NO_HIT);
}

vec4 intersectFlippedWedge(Ray ray, float minAngle, float maxAngle)
{
    vec2 planeIntersectMin = intersectHalfSpace(ray, minAngle);
    vec2 planeIntersectMax = intersectHalfSpace(ray, maxAngle + czm_pi);
    return vec4(planeIntersectMin, planeIntersectMax);
}

vec2 intersectUnitCylinder(Ray ray)
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float a = dot(d.xy, d.xy);
    float b = dot(o.xy, d.xy);
    float c = dot(o.xy, o.xy) - 1.0;
    float det = b * b - a * c;

    if (det < 0.0) {
        return vec2(NO_HIT);
    }

    det = sqrt(det);
    float ta = (-b - det) / a;
    float tb = (-b + det) / a;
    float t1 = min(ta, tb);
    float t2 = max(ta, tb);

    float z1 = o.z + t1 * d.z;
    float z2 = o.z + t2 * d.z;

    if (abs(z1) >= 1.0)
    {
        float tCap = (sign(z1) - o.z) / d.z;
        t1 = abs(b + a * tCap) < det ? tCap : NO_HIT;
    }

    if (abs(z2) >= 1.0)
    {
        float tCap = (sign(z2) - o.z) / d.z;
        t2 = abs(b + a * tCap) < det ? tCap : NO_HIT;
    }

    return vec2(t1, t2);
}

vec2 intersectUnitCircle(Ray ray) {
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float t = -o.z / d.z;
    vec2 zPlanePos = o.xy + d.xy * t;
    float distSqr = dot(zPlanePos, zPlanePos);

    if (distSqr > 1.0) {
        return vec2(NO_HIT);
    }

    return vec2(t, t);
}

vec2 intersectInfiniteUnitCylinder(Ray ray)
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float a = dot(d.xy, d.xy);
    float b = dot(o.xy, d.xy);
    float c = dot(o.xy, o.xy) - 1.0;
    float det = b * b - a * c;

    if (det < 0.0) {
        return vec2(NO_HIT);
    }

    det = sqrt(det);
    float t1 = (-b - det) / a;
    float t2 = (-b + det) / a;
    float tmin = min(t1, t2);
    float tmax = max(t1, t2);

    return vec2(tmin, tmax);
}

void intersectShape(Ray ray, inout Intersections ix)
{
    #if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT)
        ray.pos = ray.pos * u_cylinderUvToRenderBoundsScale + u_cylinderUvToRenderBoundsTranslate;
        ray.dir *= u_cylinderUvToRenderBoundsScale;
    #else
        // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
        // Direction is scaled as well to be in sync with position.
        ray.pos = ray.pos * 2.0 - 1.0;
        ray.dir *= 2.0;
    #endif

    #if defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
        vec2 outerIntersect = intersectUnitCircle(ray);
    #else
        vec2 outerIntersect = intersectUnitCylinder(ray);
    #endif

    setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);

    if (outerIntersect.x == NO_HIT) {
        return;
    }

    #if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
        // When the cylinder is perfectly thin it's necessary to sandwich the
        // inner cylinder intersection inside the outer cylinder intersection.

        // Without this special case,
        // [outerMin, outerMax, innerMin, innerMax] will bubble sort to
        // [outerMin, innerMin, outerMax, innerMax] which will cause the back
        // side of the cylinder to be invisible because it will think the ray
        // is still inside the inner (negative) cylinder after exiting the
        // outer (positive) cylinder.

        // With this special case,
        // [outerMin, innerMin, innerMax, outerMax] will bubble sort to
        // [outerMin, innerMin, innerMax, outerMax] which will work correctly.

        // Note: If initializeIntersections() changes its sorting function
        // from bubble sort to something else, this code may need to change.
        vec2 innerIntersect = intersectInfiniteUnitCylinder(ray);
        setIntersection(ix, 0, outerIntersect.x, true, true);   // positive, enter
        setIntersection(ix, 1, innerIntersect.x, false, true);  // negative, enter
        setIntersection(ix, 2, innerIntersect.y, false, false); // negative, exit
        setIntersection(ix, 3, outerIntersect.y, true, false);  // positive, exit
    #elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)
        Ray innerRay = Ray(ray.pos * u_cylinderUvToRenderRadiusMin, ray.dir * u_cylinderUvToRenderRadiusMin);
        vec2 innerIntersect = intersectInfiniteUnitCylinder(innerRay);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);
    #endif

    #if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)
        vec2 wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax.x, u_cylinderRenderAngleMinMax.y);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
    #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)
        vec4 wedgeIntersect = intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax.x, u_cylinderRenderAngleMinMax.y);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersect.xy);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersect.zw);
    #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF)
        vec2 wedgeIntersect = intersectHalfSpace(ray, u_cylinderRenderAngleMinMax.x);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
    #elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
        vec4 wedgeIntersect = intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersect.xy);
        setIntersectionPair(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersect.zw);
    #endif
}
`;var GF=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections,
// setIntersection, setIntersectionPair, INF_HIT, NO_HIT

/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT
#define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN
*/

#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
    uniform vec2 u_ellipsoidRenderLongitudeMinMax;
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
    uniform vec2 u_ellipsoidRenderLatitudeCosSqrHalfMinMax;
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX)
    uniform float u_ellipsoidInverseOuterScaleUv;
#endif
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
    uniform float u_ellipsoidInverseInnerScaleUv;
#endif

vec2 intersectZPlane(Ray ray)
{
    float o = ray.pos.z;
    float d = ray.dir.z;
    float t = -o / d;
    float s = sign(o);

    if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
    else return vec2(-INF_HIT, t);
}

vec4 intersectHalfPlane(Ray ray, float angle) {
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 planeDirection = vec2(cos(angle), sin(angle));
    vec2 planeNormal = vec2(planeDirection.y, -planeDirection.x);

    float a = dot(o, planeNormal);
    float b = dot(d, planeNormal);
    float t = -a / b;

    vec2 p = o + t * d;
    bool outside = dot(p, planeDirection) < 0.0;
    if (outside) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);

    return vec4(-INF_HIT, t, t, +INF_HIT);
}

vec2 intersectHalfSpace(Ray ray, float angle)
{
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 n = vec2(sin(angle), -cos(angle));

    float a = dot(o, n);
    float b = dot(d, n);
    float t = -a / b;
    float s = sign(a);

    if (t >= 0.0 != s >= 0.0) return vec2(t, +INF_HIT);
    else return vec2(-INF_HIT, t);
}

vec2 intersectRegularWedge(Ray ray, float minAngle, float maxAngle)
{
    vec2 o = ray.pos.xy;
    vec2 d = ray.dir.xy;
    vec2 n1 = vec2(sin(minAngle), -cos(minAngle));
    vec2 n2 = vec2(-sin(maxAngle), cos(maxAngle));

    float a1 = dot(o, n1);
    float a2 = dot(o, n2);
    float b1 = dot(d, n1);
    float b2 = dot(d, n2);

    float t1 = -a1 / b1;
    float t2 = -a2 / b2;
    float s1 = sign(a1);
    float s2 = sign(a2);

    float tmin = min(t1, t2);
    float tmax = max(t1, t2);
    float smin = tmin == t1 ? s1 : s2;
    float smax = tmin == t1 ? s2 : s1;

    bool e = tmin >= 0.0;
    bool f = tmax >= 0.0;
    bool g = smin >= 0.0;
    bool h = smax >= 0.0;

    if (e != g && f == h) return vec2(tmin, tmax);
    else if (e == g && f == h) return vec2(-INF_HIT, tmin);
    else if (e != g && f != h) return vec2(tmax, +INF_HIT);
    else return vec2(NO_HIT);
}

vec4 intersectFlippedWedge(Ray ray, float minAngle, float maxAngle)
{
    vec2 planeIntersectMin = intersectHalfSpace(ray, minAngle);
    vec2 planeIntersectMax = intersectHalfSpace(ray, maxAngle + czm_pi);
    return vec4(planeIntersectMin, planeIntersectMax);
}

vec2 intersectUnitSphere(Ray ray)
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float b = dot(d, o);
    float c = dot(o, o) - 1.0;
    float det = b * b - c;

    if (det < 0.0) {
        return vec2(NO_HIT);
    }

    det = sqrt(det);
    float t1 = -b - det;
    float t2 = -b + det;
    float tmin = min(t1, t2);
    float tmax = max(t1, t2);

    return vec2(tmin, tmax);
}

vec2 intersectUnitSphereUnnormalizedDirection(Ray ray)
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;

    float a = dot(d, d);
    float b = dot(d, o);
    float c = dot(o, o) - 1.0;
    float det = b * b - a * c;

    if (det < 0.0) {
        return vec2(NO_HIT);
    }

    det = sqrt(det);
    float t1 = (-b - det) / a;
    float t2 = (-b + det) / a;
    float tmin = min(t1, t2);
    float tmax = max(t1, t2);

    return vec2(tmin, tmax);
}

vec2 intersectDoubleEndedCone(Ray ray, float cosSqrHalfAngle)
{
    vec3 o = ray.pos;
    vec3 d = ray.dir;
    float a = d.z * d.z - dot(d, d) * cosSqrHalfAngle;
    float b = d.z * o.z - dot(o, d) * cosSqrHalfAngle;
    float c = o.z * o.z - dot(o, o) * cosSqrHalfAngle;
    float det = b * b - a * c;

    if (det < 0.0) {
        return vec2(NO_HIT);
    }

    det = sqrt(det);
    float t1 = (-b - det) / a;
    float t2 = (-b + det) / a;
    float tmin = min(t1, t2);
    float tmax = max(t1, t2);
    return vec2(tmin, tmax);
}

vec4 intersectFlippedCone(Ray ray, float cosSqrHalfAngle) {
    vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);

    if (intersect.x == NO_HIT) {
        return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
    }

    vec3 o = ray.pos;
    vec3 d = ray.dir;
    float tmin = intersect.x;
    float tmax = intersect.y;
    float zmin = o.z + tmin * d.z;
    float zmax = o.z + tmax * d.z;

    // One interval
    if (zmin < 0.0 && zmax < 0.0) return vec4(-INF_HIT, +INF_HIT, NO_HIT, NO_HIT);
    else if (zmin < 0.0) return vec4(-INF_HIT, tmax, NO_HIT, NO_HIT);
    else if (zmax < 0.0) return vec4(tmin, +INF_HIT, NO_HIT, NO_HIT);
    // Two intervals
    else return vec4(-INF_HIT, tmin, tmax, +INF_HIT);
}

vec2 intersectRegularCone(Ray ray, float cosSqrHalfAngle) {
    vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);

    if (intersect.x == NO_HIT) {
        return vec2(NO_HIT);
    }

    vec3 o = ray.pos;
    vec3 d = ray.dir;
    float tmin = intersect.x;
    float tmax = intersect.y;
    float zmin = o.z + tmin * d.z;
    float zmax = o.z + tmax * d.z;

    if (zmin < 0.0 && zmax < 0.0) return vec2(NO_HIT);
    else if (zmin < 0.0) return vec2(tmax, +INF_HIT);
    else if (zmax < 0.0) return vec2(-INF_HIT, tmin);
    else return vec2(tmin, tmax);
}

void intersectShape(in Ray ray, inout Intersections ix) {
    // Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
    // Direction is scaled as well to be in sync with position.
    ray.pos = ray.pos * 2.0 - 1.0;
    ray.dir *= 2.0;

    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MAX)
        Ray outerRay = Ray(ray.pos * u_ellipsoidInverseOuterScaleUv, ray.dir * u_ellipsoidInverseOuterScaleUv);
    #else
        Ray outerRay = ray;
    #endif

    // Outer ellipsoid
    vec2 outerIntersect = intersectUnitSphereUnnormalizedDirection(outerRay);
    setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);

    // Exit early if the outer ellipsoid was missed.
    if (outerIntersect.x == NO_HIT) {
        return;
    }

    // Inner ellipsoid
    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
        // When the ellipsoid is perfectly thin it's necessary to sandwich the
        // inner ellipsoid intersection inside the outer ellipsoid intersection.

        // Without this special case,
        // [outerMin, outerMax, innerMin, innerMax] will bubble sort to
        // [outerMin, innerMin, outerMax, innerMax] which will cause the back
        // side of the ellipsoid to be invisible because it will think the ray
        // is still inside the inner (negative) ellipsoid after exiting the
        // outer (positive) ellipsoid.

        // With this special case,
        // [outerMin, innerMin, innerMax, outerMax] will bubble sort to
        // [outerMin, innerMin, innerMax, outerMax] which will work correctly.

        // Note: If initializeIntersections() changes its sorting function
        // from bubble sort to something else, this code may need to change.
        setIntersection(ix, 0, outerIntersect.x, true, true);   // positive, enter
        setIntersection(ix, 1, outerIntersect.x, false, true);  // negative, enter
        setIntersection(ix, 2, outerIntersect.y, false, false); // negative, exit
        setIntersection(ix, 3, outerIntersect.y, true, false);  // positive, exit
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN)
        Ray innerRay = Ray(ray.pos * u_ellipsoidInverseInnerScaleUv, ray.dir * u_ellipsoidInverseInnerScaleUv);
        vec2 innerIntersect = intersectUnitSphereUnnormalizedDirection(innerRay);

        if (innerIntersect == vec2(NO_HIT)) {
            setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
        } else {
            // When the ellipsoid is very large and thin it's possible for floating
            // point math to cause the ray to intersect the inner ellipsoid before
            // the outer ellipsoid. To prevent this from happening, clamp innerIntersect
            // to outerIntersect and sandwhich the intersections like described above.
            //
            // In theory a similar fix is needed for cylinders, however it's more
            // complicated to implement because the inner shape is allowed to be
            // intersected first.
            innerIntersect.x = max(innerIntersect.x, outerIntersect.x);
            innerIntersect.y = min(innerIntersect.y, outerIntersect.y);
            setIntersection(ix, 0, outerIntersect.x, true, true);   // positive, enter
            setIntersection(ix, 1, innerIntersect.x, false, true);  // negative, enter
            setIntersection(ix, 2, innerIntersect.y, false, false); // negative, exit
            setIntersection(ix, 3, outerIntersect.y, true, false);  // positive, exit
        }
    #endif

    // Flip the ray because the intersection function expects a cone growing towards +Z.
    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
        Ray flippedRay = outerRay;
        flippedRay.dir.z *= -1.0;
        flippedRay.pos.z *= -1.0;
    #endif

    // Bottom cone
    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
        vec2 bottomConeIntersection = intersectRegularCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
        vec2 bottomConeIntersection = intersectZPlane(flippedRay);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
        vec4 bottomConeIntersection = intersectFlippedCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.x);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersection.xy);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersection.zw);
    #endif

    // Top cone
    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
        vec4 topConeIntersection = intersectFlippedCone(flippedRay, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersection.xy);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersection.zw);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
        vec2 topConeIntersection = intersectZPlane(ray);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
        vec2 topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeCosSqrHalfMinMax.y);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
    #endif

    // Wedge
    #if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
        vec4 wedgeIntersect = intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
        vec2 wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF)
        vec2 wedgeIntersect = intersectHalfSpace(ray, u_ellipsoidRenderLongitudeMinMax.x);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
    #elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
        vec4 wedgeIntersect = intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax.x, u_ellipsoidRenderLongitudeMinMax.y);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersect.xy);
        setIntersectionPair(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersect.zw);
    #endif
}
`;var xC=`// Main intersection function for Voxel scenes.
// See IntersectBox.glsl, IntersectCylinder.glsl, or IntersectEllipsoid.glsl
// for the definition of intersectShape. The appropriate function is selected
// based on the VoxelPrimitive shape type, and added to the shader in
// Scene/VoxelRenderResources.js.
// See also IntersectClippingPlane.glsl and IntersectDepth.glsl.
// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT,
// getIntersectionPair, initializeIntersections, nextIntersection.

/* Intersection defines (set in Scene/VoxelRenderResources.js)
#define INTERSECTION_COUNT ###
*/

vec2 intersectScene(vec2 screenCoord, vec3 positionUv, vec3 directionUv, out Intersections ix) {
    Ray ray = Ray(positionUv, directionUv);

    // Do a ray-shape intersection to find the exact starting and ending points.
    intersectShape(ray, ix);

    // Exit early if the positive shape was completely missed or behind the ray.
    vec2 entryExitT = getIntersectionPair(ix, 0);
    if (entryExitT.x == NO_HIT) {
        // Positive shape was completely missed - so exit early.
        return vec2(NO_HIT);
    }

    // Clipping planes
    #if defined(CLIPPING_PLANES)
        intersectClippingPlanes(ray, ix);
    #endif

    // Depth
    #if defined(DEPTH_TEST)
        intersectDepth(screenCoord, ray, ix);
    #endif

    // Find the first intersection that's in front of the ray
    #if (INTERSECTION_COUNT > 1)
        initializeIntersections(ix);
        for (int i = 0; i < INTERSECTION_COUNT; ++i) {
            entryExitT = nextIntersection(ix);
            if (entryExitT.y > 0.0) {
                // Set start to 0.0 when ray is inside the shape.
                entryExitT.x = max(entryExitT.x, 0.0);
                break;
            }
        }
    #else
        // Set start to 0.0 when ray is inside the shape.
        entryExitT.x = max(entryExitT.x, 0.0);
    #endif

    return entryExitT;
}
`;var WF=`/* Box defines (set in Scene/VoxelBoxShape.js)
#define BOX_HAS_SHAPE_BOUNDS
*/

#if defined(BOX_HAS_SHAPE_BOUNDS)
    uniform vec3 u_boxUvToShapeUvScale;
    uniform vec3 u_boxUvToShapeUvTranslate;
#endif

vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
    #if defined(BOX_HAS_SHAPE_BOUNDS)
        return positionUv * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;
    #else
        return positionUv;
    #endif
}
`;var jF=`/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED
*/

#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
    uniform vec2 u_cylinderUvToShapeUvRadius; // x = scale, y = offset
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
    uniform vec2 u_cylinderUvToShapeUvHeight; // x = scale, y = offset
#endif
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
    uniform vec2 u_cylinderUvToShapeUvAngle; // x = scale, y = offset
#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

vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
    vec3 positionLocal = positionUv * 2.0 - 1.0; // [-1,+1]

    // Compute radius
    #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT)
        float radius = 1.0;
    #else
        float radius = length(positionLocal.xy); // [0,1]
        #if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
            radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y; // x = scale, y = offset
        #endif
    #endif

    // Compute height
    #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT)
        float height = 1.0;
    #else
        float height = positionUv.z; // [0,1]
        #if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
            height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y; // x = scale, y = offset
        #endif
    #endif

    // Compute angle
    #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
        float angle = 1.0;
    #else
        float angle = (atan(positionLocal.y, positionLocal.x) + czm_pi) / czm_twoPi; // [0,1]
        #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
            #if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
                // Comparing against u_cylinderShapeUvAngleMinMax has precision problems. u_cylinderShapeUvAngleRangeZeroMid is more conservative.
                angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);
            #endif

            // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
            #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; // x = scale, y = offset
        #endif
    #endif

    return vec3(radius, height, angle);
}
`;var YF=`/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO
#define ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN
#define ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT
#define ELLIPSOID_IS_SPHERE
*/

uniform vec3 u_ellipsoidRadiiUv; // [0,1]
#if !defined(ELLIPSOID_IS_SPHERE)
    uniform vec3 u_ellipsoidInverseRadiiSquaredUv;
#endif
#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; // x = scale, y = offset
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
    uniform vec2 u_ellipsoidUvToShapeUvLatitude; // x = scale, y = offset
#endif
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN) && !defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT)
    uniform float u_ellipsoidInverseHeightDifferenceUv;
    uniform vec2 u_ellipseInnerRadiiUv; // [0,1]
#endif

// robust iterative solution without trig functions
// https://github.com/0xfaded/ellipse_demo/issues/1
// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse
// Pro: Good when radii.x ~= radii.y
// Con: Breaks at pos.x ~= 0.0, especially inside the ellipse
// Con: Inaccurate with exterior points and thin ellipses
float ellipseDistanceIterative (vec2 pos, vec2 radii) {
    vec2 p = abs(pos);
    vec2 invRadii = 1.0 / radii;
    vec2 a = vec2(1.0, -1.0) * (radii.x * radii.x - radii.y * radii.y) * invRadii;
    vec2 t = vec2(0.70710678118); // sqrt(2) / 2
    vec2 v = radii * t;

    const int iterations = 3;
    for (int i = 0; i < iterations; ++i) {
        vec2 e = a * pow(t, vec2(3.0));
        vec2 q = normalize(p - e) * length(v - e);
        t = normalize((q + e) * invRadii);
        v = radii * t;
    }
    return length(v * sign(pos) - pos) * sign(p.y - v.y);
}

vec3 convertUvToShapeUvSpace(in vec3 positionUv) {
    // Compute position and normal.
    // Convert positionUv [0,1] to local space [-1,+1] to "normalized" cartesian space [-a,+a] where a = (radii + height) / (max(radii) + height).
    // A point on the largest ellipsoid axis would be [-1,+1] and everything else would be smaller.
    vec3 positionLocal = positionUv * 2.0 - 1.0;
    #if defined(ELLIPSOID_IS_SPHERE)
        vec3 posEllipsoid = positionLocal * u_ellipsoidRadiiUv.x;
        vec3 normal = normalize(posEllipsoid);
    #else
        vec3 posEllipsoid = positionLocal * u_ellipsoidRadiiUv;
        vec3 normal = normalize(posEllipsoid * u_ellipsoidInverseRadiiSquaredUv); // geodetic surface normal
    #endif

    // Compute longitude
    #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
        float longitude = 1.0;
    #else
        float longitude = (atan(normal.y, normal.x) + czm_pi) / czm_twoPi;

        // Correct the angle when max < min
        // Technically this should compare against min longitude - but it has precision problems so compare against the middle of empty space.
        #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
            longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);
        #endif

        // Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
        #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
    #endif

    // Compute latitude
    #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO)
        float latitude = 1.0;
    #else
        float latitude = (asin(normal.z) + czm_piOverTwo) / czm_pi;
        #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
            latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;
        #endif
    #endif

    // Compute height
    #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT)
        // TODO: This breaks down when minBounds == maxBounds. To fix it, this
        // function would have to know if ray is intersecting the front or back of the shape
        // and set the shape space position to 1 (front) or 0 (back) accordingly.
        float height = 1.0;
    #else
        #if defined(ELLIPSOID_IS_SPHERE)
            #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN)
                float height = (length(posEllipsoid) - u_ellipseInnerRadiiUv.x) * u_ellipsoidInverseHeightDifferenceUv;
            #else
                float height = length(posEllipsoid);
            #endif
        #else
            #if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN)
                // Convert the 3D position to a 2D position relative to the ellipse (radii.x, radii.z) (assuming radii.x == radii.y which is true for WGS84).
                // This is an optimization so that math can be done with ellipses instead of ellipsoids.
                vec2 posEllipse = vec2(length(posEllipsoid.xy), posEllipsoid.z);
                float height = ellipseDistanceIterative(posEllipse, u_ellipseInnerRadiiUv) * u_ellipsoidInverseHeightDifferenceUv;
            #else
                // TODO: this is probably not correct
                float height = length(posEllipsoid);
            #endif
        #endif
    #endif

    return vec3(longitude, latitude, height);
}
`;var qF=`// These octree flags must be in sync with GpuOctreeFlag in VoxelTraversal.js
#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;
uniform sampler2D u_octreeLeafNodeTexture;
uniform vec2 u_octreeLeafNodeTexelSizeUv;
uniform int u_octreeLeafNodeTilesPerRow;

uniform float u_stepSize;

struct OctreeNodeData {
    int data;
    int flag;
};

struct TraversalData {
    float stepT;
    ivec4 octreeCoords;
    int parentOctreeIndex;
};

struct SampleData {
    int megatextureIndex;
    bool usingParentMegatextureIndex;
    vec3 tileUv;
    #if (SAMPLE_COUNT > 1)
        float weight;
    #endif
};

// Integer mod: For WebGL1 only
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;
}

/**
* Convert a position in the uv-space of the tileset bounding shape
* into the uv-space of a tile within the tileset
*/
vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
	// TODO: use bit-shifting (only in WebGL2)
    float dimAtLevel = pow(2.0, float(octreeCoords.w));
    return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);
}

void setSampleUv(in vec3 shapePosition, in ivec4 octreeCoords, inout SampleData sampleData) {
    ivec4 sampleCoords = sampleData.usingParentMegatextureIndex
        ? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
        : octreeCoords;
    sampleData.tileUv = getTileUv(shapePosition, sampleCoords);
}

void getOctreeLeafSampleData(in OctreeNodeData data, out SampleData sampleData) {
    sampleData.megatextureIndex = data.data;
    sampleData.usingParentMegatextureIndex = data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT;
}

#if (SAMPLE_COUNT > 1)
void getOctreeLeafSampleDatas(in OctreeNodeData data, out SampleData sampleData0, out SampleData sampleData1) {
    int leafIndex = data.data;
    int leafNodeTexelCount = 2;
    // Adding 0.5 moves to the center of the texel
    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);
    vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);
    vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0);
    vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1);

    float lerp = normU8x2_toFloat(leafData0.xy);

    sampleData0.megatextureIndex = normU8x2_toInt(leafData1.xy);
    sampleData1.megatextureIndex = normU8x2_toInt(leafData1.zw);
    // TODO: this looks wrong? Should be comparing to OCTREE_FLAG_PACKED_LEAF_FROM_PARENT
    sampleData0.usingParentMegatextureIndex = normU8_toInt(leafData0.z) == 1;
    sampleData1.usingParentMegatextureIndex = normU8_toInt(leafData0.w) == 1;
    sampleData0.weight = 1.0 - lerp;
    sampleData1.weight = lerp;
}
#endif

void traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
    float sizeAtLevel = 1.0 / pow(2.0, float(traversalData.octreeCoords.w));
    vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;
    vec3 end = start + vec3(sizeAtLevel);

    for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
        // Find out which octree child contains the position
        // 0 if before center, 1 if after
        vec3 center = 0.5 * (start + end);
        vec3 childCoord = step(center, shapePosition);

        OctreeNodeData childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));

        // Get octree coords for the next level down
        ivec4 octreeCoords = traversalData.octreeCoords;
        traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);

        if (childData.flag == OCTREE_FLAG_INTERNAL) {
            // interior tile - keep going deeper
            start = mix(start, center, childCoord);
            end = mix(center, end, childCoord);
            traversalData.parentOctreeIndex = childData.data;
        } else {
            // leaf tile - stop traversing
            float dimAtLevel = pow(2.0, float(traversalData.octreeCoords.w));
            traversalData.stepT = u_stepSize / dimAtLevel;
            #if (SAMPLE_COUNT == 1)
                getOctreeLeafSampleData(childData, sampleDatas[0]);
                setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
            #else
                getOctreeLeafSampleDatas(childData, sampleDatas[0], sampleDatas[1]);
                setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
                setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[1]);
            #endif
            return;
        }
    }
}

/**
* Transform a given position to an octree tile coordinate and a position within that tile,
* and find the corresponding megatexture index and texture coordinates
*/
void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
    traversalData.octreeCoords = ivec4(0);
    traversalData.parentOctreeIndex = 0;

    OctreeNodeData rootData = getOctreeNodeData(vec2(0.0));
    if (rootData.flag == OCTREE_FLAG_LEAF) {
        // No child data, only the root tile has data
        traversalData.stepT = u_stepSize;
        #if (SAMPLE_COUNT == 1)
            getOctreeLeafSampleData(rootData, sampleDatas[0]);
            setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
        #else
            getOctreeLeafSampleDatas(rootData, sampleDatas[0], sampleDatas[1]);
            setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[0]);
            setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[1]);
        #endif
    } else {
        traverseOctreeDownwards(shapePosition, traversalData, sampleDatas);
    }
}

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));
	// Assume (!) the position is always inside the root tile.
	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++) {
            setSampleUv(shapePosition, traversalData.octreeCoords, sampleDatas[i]);
        }
    } else {
        // Go up tree
        for (int i = 0; i < OCTREE_MAX_LEVELS; ++i)
        {
            traversalData.octreeCoords.xyz /= 2;
            traversalData.octreeCoords.w -= 1;

            if (!insideTile(shapePosition, traversalData.octreeCoords)) {
                traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);
            } else {
                break;
            }
        }

        // Go down tree
        traverseOctreeDownwards(shapePosition, traversalData, sampleDatas);
    }
}
`;var XF=`// See Octree.glsl for the definitions of SampleData and intMod

/* Megatexture defines (set in Scene/VoxelRenderResources.js)
#define SAMPLE_COUNT ###
#define NEAREST_SAMPLING
#define PADDING
*/

uniform ivec2 u_megatextureSliceDimensions; // number of slices per tile, in two dimensions
uniform ivec2 u_megatextureTileDimensions; // number of tiles per megatexture, in two dimensions
uniform vec2 u_megatextureVoxelSizeUv;
uniform vec2 u_megatextureSliceSizeUv;
uniform vec2 u_megatextureTileSizeUv;

uniform ivec3 u_dimensions; // does not include padding
#if defined(PADDING)
    uniform ivec3 u_paddingBefore;
    uniform ivec3 u_paddingAfter;
#endif

// Integer min, max, clamp: For WebGL1 only
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;
}

/*
    How is 3D data stored in a 2D megatexture?

    In this example there is only one loaded tile and it has 2x2x2 voxels (8 voxels total).
    The data is sliced by Z. The data at Z = 0 is placed in texels (0,0), (0,1), (1,0), (1,1) and
    the data at Z = 1 is placed in texels (2,0), (2,1), (3,0), (3,1).
    Note that there could be empty space in the megatexture because it's a power of two.

      0   1   2   3
    +---+---+---+---+
    |   |   |   |   | 3
    +---+---+---+---+
    |   |   |   |   | 2
    +-------+-------+
    |010|110|011|111| 1
    |--- ---|--- ---|
    |000|100|001|101| 0
    +-------+-------+

    When doing linear interpolation the megatexture needs to be sampled twice: once for
    the Z slice above the voxel coordinate and once for the slice below. The two slices
    are interpolated with fract(coord.z - 0.5). For example, a Z coordinate of 1.0 is
    halfway between two Z slices so the interpolation factor is 0.5. Below is a side view
    of the 3D voxel grid with voxel coordinates on the left side.

    2 +---+
      |001|
    1 +-z-+
      |000|
    0 +---+

    When doing nearest neighbor the megatexture only needs to be sampled once at the closest Z slice.
*/

Properties getPropertiesFromMegatexture(in SampleData sampleData) {
    vec3 tileUv = clamp(sampleData.tileUv, vec3(0.0), vec3(1.0)); // TODO is the clamp necessary?
    int tileIndex = sampleData.megatextureIndex;
    vec3 voxelCoord = tileUv * vec3(u_dimensions);
    ivec3 voxelDimensions = u_dimensions;

    #if defined(PADDING)
        voxelDimensions += u_paddingBefore + u_paddingAfter;
        voxelCoord += vec3(u_paddingBefore);
    #endif

    #if defined(NEAREST_SAMPLING)
        // Round to the center of the nearest voxel
        voxelCoord = floor(voxelCoord) + vec3(0.5);
    #endif

    // Tile location
    vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);

    // Slice location
    float slice = voxelCoord.z - 0.5;
    int sliceIndex = int(floor(slice));
    int sliceIndex0 = intClamp(sliceIndex, 0, voxelDimensions.z - 1);
    vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);

    // Voxel location
    vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(voxelDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;

    // Final location in the megatexture
    vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;

    #if defined(NEAREST_SAMPLING)
        return getPropertiesFromMegatextureAtUv(uv0);
    #else
        float sliceLerp = fract(slice);
        int sliceIndex1 = intMin(sliceIndex + 1, voxelDimensions.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
}

// Convert an array of sample datas to a final weighted properties.
Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {
    #if (SAMPLE_COUNT == 1)
        return getPropertiesFromMegatexture(sampleDatas[0]);
    #else
        // When more than one sample is taken the accumulator needs to start at 0
        Properties properties = clearProperties();
        for (int i = 0; i < SAMPLE_COUNT; ++i) {
            float weight = sampleDatas[i].weight;

            // Avoid reading the megatexture when the weight is 0 as it can be costly.
            if (weight > 0.0) {
                Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);
                tempProperties = scaleProperties(tempProperties, weight);
                properties = sumProperties(properties, tempProperties);
            }
        }
        return properties;
    #endif
}
`;function e_t(e){let t=new S0;this.shaderBuilder=t;let n=e._customShader,i=_t(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,Te.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",Te.FRAGMENT),this.uniformMap=i;let r=e._clippingPlanes,s=u(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([FF]),t.addFragmentLines([n.fragmentShaderText,"#line 0",VF]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,Te.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,Te.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,Te.FRAGMENT),t.addFragmentLines([kF])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,Te.FRAGMENT),t.addFragmentLines([UF]));let a=e._provider.shape;a==="BOX"?t.addFragmentLines([zF,xC,WF]):a==="CYLINDER"?t.addFragmentLines([HF,xC,jF]):a==="ELLIPSOID"&&t.addFragmentLines([GF,xC,YF]),t.addFragmentLines([qF,XF,NF]);let c=e._shape,l=c.shaderDefines;for(let p in l)if(l.hasOwnProperty(p)){let g=l[p];u(g)&&(g=g===!0?void 0:g,t.addDefine(p,g,Te.FRAGMENT))}let f=c.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",f,Te.FRAGMENT),s===1?f+=1:r.unionClippingRegions?f+=2:f+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",f,Te.FRAGMENT),f+=1),t.addDefine("INTERSECTION_COUNT",f,Te.FRAGMENT),(!h.equals(e.paddingBefore,h.ZERO)||!h.equals(e.paddingAfter,h.ZERO))&&t.addDefine("PADDING",void 0,Te.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,Te.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,Te.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,Te.FRAGMENT);let d=e._traversal;t.addDefine("SAMPLE_COUNT",`${d._sampleCount}`,Te.FRAGMENT)}var KF=e_t;function t_t(e,t){let{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,c=o.length,l=u(s)&&u(a);n.addDefine("METADATA_COUNT",c,Te.FRAGMENT),l&&n.addDefine("STATISTICS",void 0,Te.FRAGMENT);for(let O=0;O<c;O++){let L=i[O],N=o[O],_=`PropertyStatistics_${L}`,b=`PropertyStatistics_${L}`;n.addStruct(_,b,Te.FRAGMENT);let v=eH(N);n.addStructField(_,v,"min"),n.addStructField(_,v,"max")}let f="Statistics",d="Statistics",p="statistics";n.addStruct(f,d,Te.FRAGMENT);for(let O=0;O<c;O++){let L=i[O],N=`PropertyStatistics_${L}`,_=L;n.addStructField(f,N,_)}let g="Metadata",m="Metadata",A="metadata";n.addStruct(g,m,Te.FRAGMENT),n.addStructField(g,d,p);for(let O=0;O<c;O++){let L=i[O],N=o[O],_=eH(N);n.addStructField(g,_,L)}for(let O=0;O<c;O++){let L=i[O],N=o[O],_=i_t(N),b=`VoxelProperty_${L}`,v=`VoxelProperty_${L}`;n.addStruct(b,v,Te.FRAGMENT),n.addStructField(b,_,"partialDerivativeLocal"),n.addStructField(b,_,"partialDerivativeWorld"),n.addStructField(b,_,"partialDerivativeView"),n.addStructField(b,_,"partialDerivativeValid")}let x="Voxel",C="Voxel",T="voxel";n.addStruct(x,C,Te.FRAGMENT);for(let O=0;O<c;O++){let L=i[O],N=`VoxelProperty_${L}`;n.addStructField(x,N,L)}n.addStructField(x,"vec3","positionEC"),n.addStructField(x,"vec3","positionUv"),n.addStructField(x,"vec3","positionShapeUv"),n.addStructField(x,"vec3","positionUvLocal"),n.addStructField(x,"vec3","viewDirUv"),n.addStructField(x,"vec3","viewDirWorld"),n.addStructField(x,"float","travelDistance");let E="FragmentInput",S="FragmentInput";n.addStruct(E,S,Te.FRAGMENT),n.addStructField(E,m,A),n.addStructField(E,C,T);let D="Properties",w="Properties",R="properties";n.addStruct(D,w,Te.FRAGMENT);for(let O=0;O<c;O++){let L=i[O],N=o[O],_=eH(N);n.addStructField(D,_,L)}{let O="clearProperties";n.addFunction(O,`${w} clearProperties()`,Te.FRAGMENT),n.addFunctionLines(O,[`${w} ${R};`]);for(let L=0;L<c;L++){let N=i[L],_=o[L],b=r[L],v=eH(_,b);n.addFunctionLines(O,[`${R}.${N} = ${v}(0.0);`])}n.addFunctionLines(O,[`return ${R};`])}{let O="sumProperties";n.addFunction(O,`${w} sumProperties(${w} propertiesA, ${w} propertiesB)`,Te.FRAGMENT),n.addFunctionLines(O,[`${w} ${R};`]);for(let L=0;L<c;L++){let N=i[L];n.addFunctionLines(O,[`${R}.${N} = propertiesA.${N} + propertiesB.${N};`])}n.addFunctionLines(O,[`return ${R};`])}{let O="scaleProperties";n.addFunction(O,`${w} scaleProperties(${w} ${R}, float scale)`,Te.FRAGMENT),n.addFunctionLines(O,[`${w} scaledProperties = ${R};`]);for(let L=0;L<c;L++){let N=i[L];n.addFunctionLines(O,[`scaledProperties.${N} *= scale;`])}n.addFunctionLines(O,["return scaledProperties;"])}{let O="mixProperties";n.addFunction(O,`${w} mixProperties(${w} propertiesA, ${w} propertiesB, float mixFactor)`,Te.FRAGMENT),n.addFunctionLines(O,[`${w} ${R};`]);for(let L=0;L<c;L++){let N=i[L];n.addFunctionLines(O,[`${R}.${N} = mix(propertiesA.${N}, propertiesB.${N}, mixFactor);`])}n.addFunctionLines(O,[`return ${R};`])}{let O="copyPropertiesToMetadata";n.addFunction(O,`void copyPropertiesToMetadata(in ${w} ${R}, inout ${m} ${A})`,Te.FRAGMENT);for(let L=0;L<c;L++){let N=i[L];n.addFunctionLines(O,[`${A}.${N} = ${R}.${N};`])}}if(l){let O="setStatistics";n.addFunction(O,`void setStatistics(inout ${d} ${p})`,Te.FRAGMENT);for(let L=0;L<c;L++){let N=i[L],_=o[L],b=zt.getComponentCount(_);for(let v=0;v<b;v++){let I=o_t(_,v),B=s[L][v],F=a[L][v];n.addFunctionLines(O,[`${p}.${N}.min${I} = ${q0e(B)};`,`${p}.${N}.max${I} = ${q0e(F)};`])}}}{let O="getPropertiesFromMegatextureAtUv";n.addFunction(O,`${w} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,Te.FRAGMENT),n.addFunctionLines(O,[`${w} ${R};`]);for(let L=0;L<c;L++){let N=i[L],_=o[L],b=r[L],v=n_t(_,b);n.addFunctionLines(O,[`properties.${N} = texture(u_megatextureTextures[${L}], texcoord)${v};`])}n.addFunctionLines(O,[`return ${R};`])}}function eH(e){if(e===zt.SCALAR)return"float";if(e===zt.VEC2)return"vec2";if(e===zt.VEC3)return"vec3";if(e===zt.VEC4)return"vec4"}function n_t(e){if(e===zt.SCALAR)return".r";if(e===zt.VEC2)return".ra";if(e===zt.VEC3)return".rgb";if(e===zt.VEC4)return""}function i_t(e){if(e===zt.SCALAR)return"vec3";if(e===zt.VEC2)return"mat2";if(e===zt.VEC3)return"mat3";if(e===zt.VEC4)return"mat4"}function q0e(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function o_t(e,t){return e===zt.SCALAR?"":`[${t}]`}var ZF=t_t;function r_t(e,t){let n=new KF(e);ZF(n,e);let{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){let m="getClippingPlane",A=v_(o,t),x=0,C=A.indexOf(")")+1,T=A.indexOf("{",C)+1,E=A.indexOf("}",T),S=A.slice(x,C),D=A.slice(T,E);i.addFunction(m,S,Te.FRAGMENT),i.addFunctionLines(m,[D])}let s=i.clone();s.addDefine("PICKING",void 0,Te.FRAGMENT);let a=i.buildShaderProgram(t),c=s.buildShaderProgram(t),l=Ue.fromCache({cull:{enabled:!0,face:gi.BACK},depthTest:{enabled:!1},depthMask:!1,blending:un.PRE_MULTIPLIED_ALPHA_BLEND}),f=t.getViewportQuadVertexArray(),d=e._depthTest,p=new tt({vertexArray:f,primitiveType:Me.TRIANGLES,renderState:l,shaderProgram:a,uniformMap:n.uniformMap,pass:Ee.VOXELS,executeInClosestFrustum:!0,owner:this,cull:d,occlude:d}),g=tt.shallowClone(p,new tt);if(g.shaderProgram=c,g.pickOnly=!0,u(e._drawCommand)){let m=e._drawCommand;m.shaderProgram=m.shaderProgram&&m.shaderProgram.destroy()}if(u(e._drawCommandPick)){let m=e._drawCommandPick;m.shaderProgram=m.shaderProgram&&m.shaderProgram.destroy()}e._drawCommand=p,e._drawCommandPick=g}var JF=r_t;function Jy(e,t,n,i,o,r,s){this._primitive=e;let a=i.length;this.megatextures=new Array(a);for(let D=0;D<a;D++){let w=i[D],R=zt.getComponentCount(w),O=o[D];this.megatextures[D]=new ES(t,n,R,O,s)}let c=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;let l=e._shape,f=0,d=0,p=0,g=0,m=void 0;this.rootNode=new DS(f,d,p,g,m,l,n),this._priorityQueue=new Nx({maximumLength:c,comparator:Ki.priorityComparator}),this._highPriorityKeyframeNodes=new Array(c),this._keyframeNodesInMegatexture=new Array(c),this._keyframeCount=r,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(r);function A(D,w,R,O){if(w>R)return;let L=Math.floor((w+R)/2);D[L]=O,A(D,w,L-1,O+1),A(D,L+1,R,O+1)}let x=this._binaryTreeKeyframeWeighting;x[0]=0,x[r-1]=0,A(x,1,r-2,0);let C=9,T=2048,E=Math.floor(T/C),S=Math.ceil(c/E);this.internalNodeTexture=new It({context:t,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,flipY:!1,width:T,height:S,sampler:new ln({minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST})}),this.internalNodeTilesPerRow=E,this.internalNodeTexelSizeUv=new H(1/T,1/S),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new H}Jy.simultaneousRequestCountMaximum=50;Jy.prototype.update=function(e,t,n,i){let o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,c=o._levelBlendFactor,l=c>0,f=a>1,d=(l?2:1)*(f?2:1);this._sampleCount=d;let p=d>=2;if(p&&!u(this.leafNodeTexture)){let T=Math.floor(512),E=Math.ceil(s/T);this.leafNodeTexture=new It({context:r,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,flipY:!1,width:1024,height:E,sampler:new ln({minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST})}),this.leafNodeTexelSizeUv=H.fromElements(1/1024,1/E,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=T}else!p&&u(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=P.clamp(t,0,a-1),n&&X0e(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;let g=di();c_t(this,e);let m=di();f_t(this,d,c);let A=di();if(this._debugPrint){let x=m-g,C=A-m,T=A-g;u_t(this,x,C,T)}};Jy.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};Jy.prototype.isDestroyed=function(){return!1};Jy.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.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),le(this)};function X0e(e,t){let n=e._primitive,i=n._shape,o=n._provider.dimensions;if(t.computeBoundingVolumes(i,o),u(t.children))for(let r=0;r<8;r++){let s=t.children[r];X0e(e,s)}}function s_t(e,t){if(e._simultaneousRequestCount>=Jy.simultaneousRequestCountMaximum)return;let n=e._primitive,i=n._provider,o=t.keyframe,r=t.spatialNode,s=r.level,a=r.x,c=r.y,l=r.z;function f(g){e._simultaneousRequestCount--;let m=n._provider.types.length;if(!u(g))t.state=Ki.LoadState.UNAVAILABLE;else if(g===Ki.LoadState.FAILED)t.state=Ki.LoadState.FAILED;else if(!Array.isArray(g)||g.length!==m)t.state=Ki.LoadState.FAILED;else{let A=e.megatextures;for(let x=0;x<m;x++){let{voxelCountPerTile:C,channelCount:T}=A[x],{x:E,y:S,z:D}=C,w=E*S*D,R=g[x],O=w*T;if(R.length===O)t.metadatas[x]=R,t.state=Ki.LoadState.RECEIVED;else{t.state=Ki.LoadState.FAILED;break}}}}function d(){e._simultaneousRequestCount--,t.state=Ki.LoadState.FAILED}let p=i.requestData({tileLevel:s,tileX:a,tileY:c,tileZ:l,keyframe:o});u(p)?(e._simultaneousRequestCount++,t.state=Ki.LoadState.RECEIVING,p.then(f).catch(d)):t.state=Ki.LoadState.FAILED}function a_t(e){return e/(1+e)}function c_t(e,t){let n=e._frameNumber,i=e._primitive,o=i._shape,r=i._provider.dimensions,s=i._screenSpaceError,a=e._priorityQueue,c=e._keyframeLocation,l=e._keyframeCount,f=e.rootNode,d=t.camera.positionWC,p=t.camera.frustum.sseDenominator,m=t.context.drawingBufferHeight/t.pixelRatio/p;function A(O,L){if(O.computeScreenSpaceError(d,m),L=O.visibility(t,L),L===$r.MASK_OUTSIDE)return;O.visitedFrameNumber=n;let N=P.clamp(Math.floor(c),0,l-2),_=N+1;if(l===1)O.createKeyframeNode(0);else if(O.keyframeNodes.length!==l)for(let F=0;F<l;F++)O.createKeyframeNode(F);let b=a_t(O.screenSpaceError),v=!1,I=O.keyframeNodes;for(let F=0;F<I.length;F++){let k=I[F],U=k.keyframe,G=Math.min(Math.abs(U-N),Math.abs(U-_)),V=Math.max(N,l-_-1,1),X=Math.pow(1-G/V,4),j=Math.exp(-e._binaryTreeKeyframeWeighting[U]);k.priority=10*b,k.priority+=P.lerp(j,X,.15+.85*X),k.state!==Ki.LoadState.UNAVAILABLE&&k.state!==Ki.LoadState.FAILED&&k.priority!==-Number.MAX_VALUE&&a.insert(k),k.state===Ki.LoadState.LOADED&&(v=!0)}if(O.screenSpaceError<s||!v){O.children=void 0;return}if(!u(O.children)){let F=l_t(O),k=O.level+1;O.children=F.map(([U,G,V])=>new DS(k,U,G,V,O,o,r))}for(let F=0;F<8;F++){let k=O.children[F];A(k,L)}}a.reset(),A(f,$r.MASK_INDETERMINATE);let x=e._highPriorityKeyframeNodes,C=0,T;for(;a.length>0;)T=a.removeMaximum(),T.highPriorityFrameNumber=n,x[C]=T,C++;let E=e._keyframeNodesInMegatexture,S=e.megatextures[0],D=S.occupiedCount;E.length=D,E.sort(function(O,L){return O.highPriorityFrameNumber===L.highPriorityFrameNumber?L.priority-O.priority:L.highPriorityFrameNumber-O.highPriorityFrameNumber});let w=0,R=0;for(let O=0;O<C;O++)if(T=x[O],!(T.state===Ki.LoadState.LOADED||T.spatialNode===void 0)&&(T.state===Ki.LoadState.UNLOADED&&s_t(e,T),T.state===Ki.LoadState.RECEIVED)){let L=0;if(S.isFull()){L=D-1-w,w++;let N=E[L];N.spatialNode.destroyKeyframeNode(N,e.megatextures)}else L=D+R,R++;T.spatialNode.addKeyframeNodeToMegatextures(T,e.megatextures),E[L]=T}}function l_t(e){let{x:t,y:n,z:i}=e,o=t*2,r=n*2,s=i*2,a=r+1,c=o+1,l=s+1;return[[o,r,s],[c,r,s],[o,a,s],[c,a,s],[o,r,l],[c,r,l],[o,a,l],[c,a,l]]}function u_t(e,t,n,i){let o=e._keyframeCount,r=e.rootNode,s=Object.keys(Ki.LoadState).length,a=new Array(s),c=new Array(s),l=0;for(let C=0;C<s;C++){let T=new Array(o);a[C]=T;for(let E=0;E<o;E++)T[E]=0;c[C]=0}function f(C){let T=C.keyframeNodes;for(let E=0;E<T.length;E++){let S=T[E],D=S.keyframe,w=S.state;a[w][D]+=1,c[w]+=1,l++}if(u(C.children))for(let E=0;E<8;E++){let S=C.children[E];f(S)}}f(r);let d=`KEYFRAMES: ${a[Ki.LoadState.LOADED]}`,p=`UNLOADED: ${c[Ki.LoadState.UNLOADED]} | RECEIVING: ${c[Ki.LoadState.RECEIVING]} | RECEIVED: ${c[Ki.LoadState.RECEIVED]} | LOADED: ${c[Ki.LoadState.LOADED]} | FAILED: ${c[Ki.LoadState.FAILED]} | UNAVAILABLE: ${c[Ki.LoadState.UNAVAILABLE]} | TOTAL: ${l}`,g=Math.round(t*100)/100,m=Math.round(n*100)/100,A=Math.round(i*100)/100,x=`LOAD: ${g} | OCT: ${m} | ALL: ${A}`;console.log(`${d} || ${p} || ${x}`)}var tH={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function f_t(e,t,n){let i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2,a=0,c=0,l=[],f=[];function d(g,m,A,x,C){let T=!1;if(u(g.children))for(let E=0;E<8;E++){let S=g.children[E];S.computeSurroundingRenderableKeyframeNodes(o),S.isRenderable(r)&&(T=!0)}if(T){l[C]=tH.INTERNAL<<16|m,l[A]=x,a++,x=m,C=x*9+1;for(let E=0;E<8;E++){let S=g.children[E];m=a,A=m*9+0,d(S,m,A,x,C+E)}}else{if(s){let E=c*5,S=g.renderableKeyframeNodePrevious,D=g.level-S.spatialNode.level,w=S.spatialNode.parent,R=u(w)?w.renderableKeyframeNodePrevious:S,O=d_t(g,i,n),L=D,N=1,_=S.megatextureIndex,b=R.megatextureIndex;f[E+0]=O,f[E+1]=L,f[E+2]=N,f[E+3]=_,f[E+4]=b,l[C]=tH.LEAF<<16|c}else{let E=g.renderableKeyframeNodePrevious,D=g.level-E.spatialNode.level===0?tH.LEAF:tH.PACKED_LEAF_FROM_PARENT;l[C]=D<<16|E.megatextureIndex}c++}}let p=e.rootNode;p.computeSurroundingRenderableKeyframeNodes(o),p.isRenderable(r)&&d(p,0,0,0,0),h_t(l,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&m_t(f,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function d_t(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 P.clamp(s,0,1)}function h_t(e,t,n,i){let o=rt.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)),c=new Uint8Array(s*a*o);for(let d=0;d<e.length;d++){let p=e[d],g=d*o;for(let m=0;m<o;m++)c[g+m]=p>>>m*8&255}let f={source:{arrayBufferView:c,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(f)}function m_t(e,t,n,i){let o=rt.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),c=Math.max(1,Math.ceil(s/n)),l=new Uint8Array(a*c*o);for(let p=0;p<s;p++){let g=e[p*r+0],m=e[p*r+1],A=e[p*r+2],x=e[p*r+3],C=e[p*r+4],T=P.clamp(Math.floor(65536*g),0,65535);l[p*8+0]=T>>>0&255,l[p*8+1]=T>>>8&255,l[p*8+2]=m&255,l[p*8+3]=A&255,l[p*8+4]=x>>>0&255,l[p*8+5]=x>>>8&255,l[p*8+6]=C>>>0&255,l[p*8+7]=C>>>8&255}let d={source:{arrayBufferView:l,width:a,height:c},xOffset:0,yOffset:0};i.copyFrom(d)}Jy.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0,r=n.length;for(let s=0;s<r;s++){let a=n[s],c=i[s],l=zt.getComponentCount(a);o+=ES.getApproximateTextureMemoryByteLength(e,t,l,c)}return o};var PS=Jy;var p_t={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:"mat2",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},OS=Object.freeze(p_t);function RS(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}RS.prototype.getTexture=function(e){return this._textures[e]};function __t(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];u(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}RS.prototype.loadTexture2D=function(e,t){u(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):__t(this,e,t)};function g_t(e,t,n){let{id:i,textureUniform:o,image:r}=t,s=n.webgl2?nH(o,r,n):y_t(o,r,n),a=e._textures[i];u(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function nH(e,t,n){let{typedArray:i,sampler:o}=e,r=u(i)?Z0e(e,n):new It({context:n,source:t,sampler:o});return K0e(o)&&r.generateMipmap(),r}function y_t(e,t,n){let{typedArray:i,sampler:o}=e,r=K0e(o),s=o.wrapS===vn.REPEAT||o.wrapS===vn.MIRRORED_REPEAT||o.wrapT===vn.REPEAT||o.wrapT===vn.MIRRORED_REPEAT,{width:a,height:c}=u(i)?e:t,l=[a,c].every(P.isPowerOfTwo);if((r||s)&&!l)if(u(i)){if(e.pixelDatatype===Xe.UNSIGNED_BYTE){let d=AL(i,a,c),p=Cg(d);return nH({sampler:o},p,n)}}else{let d=Cg(t);return nH(e,d,n)}else return nH(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."),Z0e(e,n)}function K0e(e){return[an.NEAREST_MIPMAP_NEAREST,an.NEAREST_MIPMAP_LINEAR,an.LINEAR_MIPMAP_NEAREST,an.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function Z0e(e,t){let{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new It({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}RS.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];g_t(this,o,t)}n.length=0};RS.prototype.isDestroyed=function(){return!1};RS.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 le(this)};var QF=RS;function $F(e){e=y(e,y.EMPTY_OBJECT),this.mode=y(e.mode,Ip.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=y(e.uniforms,y.EMPTY_OBJECT),this.varyings=y(e.varyings,y.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=y(e.translucencyMode,Bg.INHERIT),this._textureManager=new QF,this._defaultTexture=void 0,this.uniformMap=A_t(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},T_t(this),E_t(this)}function A_t(e){let t=e.uniforms,n={};for(let i in t)if(t.hasOwnProperty(i)){let o=t[i];o.type===OS.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=x_t(e,i)):n[i]=C_t(e,i)}return n}function x_t(e,t){return function(){return y(e._textureManager.getTexture(t),e._defaultTexture)}}function C_t(e,t){return function(){return e.uniforms[t].value}}function CC(e,t,n){let i;for(;(i=t.exec(e))!==null;){let o=i[1];n[o]=!0}}function T_t(e){let t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g,o,r=e.vertexShaderText;u(r)&&(o=e.usedVariablesVertex.attributeSet,CC(r,t,o),o=e.usedVariablesVertex.featureIdSet,CC(r,n,o),o=e.usedVariablesVertex.metadataSet,CC(r,i,o));let s=e.fragmentShaderText;if(u(s)){o=e.usedVariablesFragment.attributeSet,CC(s,t,o),o=e.usedVariablesFragment.featureIdSet,CC(s,n,o),o=e.usedVariablesFragment.metadataSet,CC(s,i,o);let a=/material\.(\w+)/g,c=e.usedVariablesFragment.materialSet;CC(s,a,c)}}function J0e(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 dc(e,t,n,i){if(e.hasOwnProperty(t)){let o=`${J0e(t)} is not available in the ${i} shader. Did you mean ${J0e(n)} instead?`;throw new de(o)}}function E_t(e){let t=e.usedVariablesVertex.attributeSet;dc(t,"position","positionMC","vertex"),dc(t,"normal","normalMC","vertex"),dc(t,"tangent","tangentMC","vertex"),dc(t,"bitangent","bitangentMC","vertex"),dc(t,"positionWC","positionMC","vertex"),dc(t,"positionEC","positionMC","vertex"),dc(t,"normalEC","normalMC","vertex"),dc(t,"tangentEC","tangentMC","vertex"),dc(t,"bitangentEC","bitangentMC","vertex");let n=e.usedVariablesFragment.attributeSet;dc(n,"position","positionEC","fragment"),dc(n,"normal","normalEC","fragment"),dc(n,"tangent","tangentEC","fragment"),dc(n,"bitangent","bitangentEC","fragment"),dc(n,"normalMC","normalEC","fragment"),dc(n,"tangentMC","tangentEC","fragment"),dc(n,"bitangentMC","bitangentEC","fragment")}$F.prototype.setUniform=function(e,t){let n=this.uniforms[e];n.type===OS.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):u(t.clone)?n.value=t.clone(n.value):n.value=t};$F.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};$F.prototype.isDestroyed=function(){return!1};$F.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),le(this)};var TC=$F;function Em(e){e=y(e,y.EMPTY_OBJECT),this._ready=!1,this._provider=y(e.provider,Em.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new h,this._paddingAfter=new h,this._minBounds=new h,this._minBoundsOld=new h,this._maxBounds=new h,this._maxBoundsOld=new h,this._minClippingBounds=new h,this._minClippingBoundsOld=new h,this._maxClippingBounds=new h,this._maxClippingBoundsOld=new h,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=M.clone(y(e.modelMatrix,M.IDENTITY)),this._compoundModelMatrix=new M,this._compoundModelMatrixOld=new M,this._customShader=y(e.customShader,Em.DefaultCustomShader),this._customShaderCompilationEvent=new Ae,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new M,this._transformPositionUvToWorld=new M,this._transformDirectionWorldToLocal=new Z,this._transformNormalLocalToWorld=new Z,this._stepSizeUv=1,this._jitter=!0,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new gd,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 h,paddingBefore:new h,paddingAfter:new h,transformPositionViewToUv:new M,transformPositionUvToView:new M,transformDirectionViewToLocal:new Z,transformNormalLocalToWorld:new Z,cameraPositionUv:new h,ndcSpaceAxisAlignedBoundingBox:new oe,clippingPlanesTexture:void 0,clippingPlanesMatrix:new M,stepSize:0,pickColor:new z},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]}}let i=this._provider;this._completeLoad=function(o,r){},this._readyPromise=b_t(this,i)}function b_t(e,t){let n=new Promise(function(i){e._completeLoad=function(o,r){r.afterRender.push(function(){return o._ready=!0,i(o),!0})}});return t.readyPromise.then(function(){return n})}Object.defineProperties(Em.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},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){this._modelMatrix=M.clone(e,this._modelMatrix)}},shape:{get:function(){return this._provider.shape}},dimensions:{get:function(){return this._provider.dimensions}},minimumValues:{get:function(){return this._provider.minimumValues}},maximumValues:{get:function(){return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){this._levelBlendFactor=P.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){this._minBounds=h.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){this._maxBounds=h.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){this._minClippingBounds=h.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){this._maxClippingBounds=h.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){ss.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];u(e)?this._customShader=e:this._customShader=Em.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});var S_t=new h,D_t=new oe,v_t=new oe,w_t=new h,I_t=new h,P_t=new Z,O_t=new Z,R_t=new M,B_t=new M,M_t=new M,L_t=M.fromRotationTranslation(Z.fromUniformScale(.5,new Z),new h(.5,.5,.5),new M),N_t=M.fromRotationTranslation(Z.fromUniformScale(2,new Z),new h(-1,-1,-1),new M);Em.prototype.update=function(e){let t=this._provider;if(this._customShader.update(e),!this._ready&&!t.ready)return;let n=e.context;if(!this._ready){F_t(this,t,n),this._completeLoad(this,e);return}let i=$0e(this,t),o=this._shape;if(i&&(this._shapeVisible=eAe(this,o,t),k_t(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;let r=z_t(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&&K_t(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),H_t(this,e)&&(this._shaderDirty=!0);let l=s.leafNodeTexture,f=this._uniforms;u(l)&&(f.octreeLeafNodeTexture=s.leafNodeTexture,f.octreeLeafNodeTexelSizeUv=H.clone(s.leafNodeTexelSizeUv,f.octreeLeafNodeTexelSizeUv),f.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(JF(this,n),this._shaderDirty=!1);let d=n.uniformState.viewProjection,p=o.orientedBoundingBox,g=j_t(p,d,v_t);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;f.ndcSpaceAxisAlignedBoundingBox=oe.clone(g,f.ndcSpaceAxisAlignedBoundingBox);let A=n.uniformState.inverseView;f.transformPositionViewToUv=M.multiplyTransformation(this._transformPositionWorldToUv,A,f.transformPositionViewToUv);let x=n.uniformState.view;f.transformPositionUvToView=M.multiplyTransformation(x,this._transformPositionUvToWorld,f.transformPositionUvToView);let C=n.uniformState.inverseViewRotation;f.transformDirectionViewToLocal=Z.multiply(this._transformDirectionWorldToLocal,C,f.transformDirectionViewToLocal),f.transformNormalLocalToWorld=Z.clone(this._transformNormalLocalToWorld,f.transformNormalLocalToWorld);let T=e.camera.positionWC;f.cameraPositionUv=M.multiplyByPoint(this._transformPositionWorldToUv,T,f.cameraPositionUv),f.stepSize=this._stepSizeUv*this._stepSizeMultiplier;let E=e.passes.pick?this._drawCommandPick:this._drawCommand;E.boundingVolume=o.boundingSphere,e.commandList.push(E)};function F_t(e,t,n){let i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=z.clone(e._pickId.color,i.pickColor);let{shape:o,minBounds:r=zi.getMinBounds(o),maxBounds:s=zi.getMaxBounds(o)}=t;e.minBounds=r,e.maxBounds=s,e.minClippingBounds=zi.getMinBounds(o),e.maxClippingBounds=zi.getMaxBounds(o),$0e(e,t);let a=zi.getShapeConstructor(o);e._shape=new a,e._shapeVisible=eAe(e,e._shape,t);let{shaderDefines:c,shaderUniforms:l}=e._shape;e._shapeDefinesOld=Ge(c,!0);let f=e._uniformMap;for(let d in l)if(l.hasOwnProperty(d)){let p=`u_${d}`;f[p]=function(){return l[d]}}i.dimensions=h.clone(t.dimensions,i.dimensions),e._paddingBefore=h.clone(y(t.paddingBefore,h.ZERO),e._paddingBefore),i.paddingBefore=h.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=h.clone(y(t.paddingAfter,h.ZERO),e._paddingBefore),i.paddingAfter=h.clone(e._paddingAfter,i.paddingAfter),e._traversal=V_t(e,t,n),U_t(e._traversal,i)}function $0e(e,t){let n=y(t.shapeTransform,M.IDENTITY),i=y(t.globalTransform,M.IDENTITY);return M.multiplyTransformation(i,e._modelMatrix,e._compoundModelMatrix),M.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),e2(e,"_compoundModelMatrix","_compoundModelMatrixOld")+e2(e,"_minBounds","_minBoundsOld")+e2(e,"_maxBounds","_maxBoundsOld")+e2(e,"_minClippingBounds","_minClippingBoundsOld")+e2(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function e2(e,t,n){let i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function eAe(e,t,n){if(!t.update(e._compoundModelMatrix,e.minBounds,e.maxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;let o=t.shapeTransform,r=M.inverse(o,R_t),s=M.getRotation(o,P_t),a=M.getScale(o,w_t),c=h.maximumComponent(a),l=h.divideByScalar(a,c,I_t),f=Z.multiplyByScale(s,l,O_t),d=n.dimensions;return e._stepSizeUv=t.computeApproximateStepSize(d),e._transformPositionWorldToUv=M.multiplyTransformation(L_t,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=M.multiplyTransformation(o,N_t,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=M.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=Z.inverseTranspose(f,e._transformNormalLocalToWorld),!0}function V_t(e,t,n){let i=h.clone(t.dimensions,S_t);h.add(i,e._paddingBefore,i),h.add(i,e._paddingAfter,i);let o=t.maximumTileCount,r=u(o)?PS.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=y(t.keyframeCount,1);return new PS(e,n,i,t.types,t.componentTypes,s,r)}function U_t(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 k_t(e,t){let n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=Ge(n,!0)),i}function z_t(e,t){if(!u(e)||!u(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=$.secondsDifference(i.stop,i.start),a=$.secondsDifference(n,i.start)/r;return o+a}function H_t(e,t){let n=e.clippingPlanes;if(!u(n))return!1;n.update(t);let{clippingPlanesState:i,enabled:o}=n;if(o){let r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=M.transpose(M.multiplyTransformation(M.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)}Em.prototype.isDestroyed=function(){return!1};Em.prototype.destroy=function(){let e=this._drawCommand;u(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());let t=this._drawCommandPick;return u(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),le(this)};var Q0e=new Array(new oe(-1,-1,-1,1),new oe(1,-1,-1,1),new oe(-1,1,-1,1),new oe(1,1,-1,1),new oe(-1,-1,1,1),new oe(1,-1,1,1),new oe(-1,1,1,1),new oe(1,1,1,1)),G_t=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),W_t=new Array(new oe,new oe,new oe,new oe,new oe,new oe,new oe,new oe);function j_t(e,t,n){let i=M.fromRotationTranslation(e.halfAxes,e.center,B_t),o=M.multiply(t,i,M_t),r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,c=-Number.MAX_VALUE,l,f=W_t,d=Q0e.length;for(l=0;l<d;l++)M.multiplyByVector(o,Q0e[l],f[l]);for(l=0;l<d;l++){let p=f[l];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),c=Math.max(c,m)}else for(let g=0;g<3;g++){let m=G_t[l*3+g],A=f[m];if(A.z>=-A.w){let x=p.z+p.w,C=A.z+A.w,T=x/(x-C),E=oe.lerp(p,A,T,D_t),S=E.x/E.w,D=E.y/E.w;r=Math.min(r,S),s=Math.max(s,S),a=Math.min(a,D),c=Math.max(c,D)}}}return r=P.clamp(r,-1,1),a=P.clamp(a,-1,1),s=P.clamp(s,-1,1),c=P.clamp(c,-1,1),n=oe.fromElements(r,a,s,c,n),n}var IX=3e7,Y_t=new h(IX,0,0),q_t=new h(0,IX,0),X_t=new h(0,0,IX);function K_t(e,t){let n=e._traversal,i=e._debugPolylines;i.removeAll();function o(c,l,f,d){i.add({positions:[c,l],width:d,material:Vi.fromType("Color",{color:f})})}function r(c,l,f){let d=c.computeCorners();o(d[0],d[1],l,f),o(d[2],d[3],l,f),o(d[4],d[5],l,f),o(d[6],d[7],l,f),o(d[0],d[2],l,f),o(d[4],d[6],l,f),o(d[1],d[3],l,f),o(d[5],d[7],l,f),o(d[0],d[4],l,f),o(d[2],d[6],l,f),o(d[1],d[5],l,f),o(d[3],d[7],l,f)}function s(c){if(!n.isRenderable(c))return;let l=c.level,d=Math.max(1,5/Math.pow(2,l)),g=[z.RED,z.LIME,z.BLUE][l%3];if(r(c.orientedBoundingBox,g,d),u(c.children))for(let m=0;m<8;m++)s(c.children[m])}r(e._shape.orientedBoundingBox,z.WHITE,5),s(n.rootNode);let a=10;o(h.ZERO,Y_t,z.RED,a),o(h.ZERO,q_t,z.LIME,a),o(h.ZERO,X_t,z.BLUE,a),i.update(t)}Em.DefaultCustomShader=new TC({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
    material.diffuse = vec3(1.0);
    material.alpha = 1.0;
}`});function tAe(){this.ready=!0,this.readyPromise=Promise.resolve(this),this.shape=zi.BOX,this.dimensions=new h(1,1,1),this.names=["data"],this.types=[zt.SCALAR],this.componentTypes=[tn.FLOAT32],this.maximumTileCount=1}tAe.prototype.requestData=function(e){if(!((u(e)?y(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};Em.DefaultProvider=new tAe;var BS=Em;function PX(){de.throwInstantiationError()}Object.defineProperties(PX.prototype,{ready:{get:de.throwInstantiationError},readyPromise:{get:de.throwInstantiationError},globalTransform:{get:de.throwInstantiationError},shapeTransform:{get:de.throwInstantiationError},shape:{get:de.throwInstantiationError},minBounds:{get:de.throwInstantiationError},maxBounds:{get:de.throwInstantiationError},dimensions:{get:de.throwInstantiationError},paddingBefore:{get:de.throwInstantiationError},paddingAfter:{get:de.throwInstantiationError},names:{get:de.throwInstantiationError},types:{get:de.throwInstantiationError},componentTypes:{get:de.throwInstantiationError},minimumValues:{get:de.throwInstantiationError},maximumValues:{get:de.throwInstantiationError},maximumTileCount:{get:de.throwInstantiationError},keyframeCount:{get:de.throwInstantiationError},timeIntervalCollection:{get:de.throwInstantiationError}});PX.prototype.requestData=de.throwInstantiationError;var OX=PX;function EC(){de.throwInstantiationError()}Object.defineProperties(EC.prototype,{orientedBoundingBox:{get:de.throwInstantiationError},boundingSphere:{get:de.throwInstantiationError},boundTransform:{get:de.throwInstantiationError},shapeTransform:{get:de.throwInstantiationError},shaderUniforms:{get:de.throwInstantiationError},shaderDefines:{get:de.throwInstantiationError},shaderMaximumIntersectionsLength:{get:de.throwInstantiationError}});EC.prototype.update=de.throwInstantiationError;EC.prototype.computeOrientedBoundingBoxForTile=de.throwInstantiationError;EC.prototype.computeApproximateStepSize=de.throwInstantiationError;EC.DefaultMinBounds=de.throwInstantiationError;EC.DefaultMaxBounds=de.throwInstantiationError;var RX=EC;function BX(e,t){let n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid,r,s=t.camera.getRectangleCameraCoordinates(e);return t.mode===te.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),u(n)?n.readyPromise.then(function(){let a=n.availability;if(!u(a)||t.mode===te.SCENE2D)return r;let c=[ce.center(e),ce.southeast(e),ce.southwest(e),ce.northeast(e),ce.northwest(e)];return BX._sampleTerrainMostDetailed(n,c).then(function(l){let f=!1,d=l.reduce(function(g,m){return u(m.height)?(f=!0,Math.max(m.height,g)):g},-Number.MAX_VALUE),p=r;return f&&(p.height+=d),p})}):Promise.resolve(r)}BX._sampleTerrainMostDetailed=u_;var bC=BX;var Z_t=new z,J_t=new z,Q_t=new z,$_t=new z,nAe=new oe,t2=new Uint8Array(4);function iAe(e,t,n,i){let o=t.height===n.height?0:(e-t.height)/(n.height-t.height);return z.lerp(t.color,n.color,o,i)}function iH(e,t){return{height:e,color:z.clone(t)}}function oAe(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?z.equals(t.color,i[n-1].color):!1,a=r?z.equals(t.color,i[n+1].color):!1;return!s||!a}),e=e.filter(function(t,n,i){let o=n>0,r=o?z.equals(t.color,i[n-1].color):!1,s=o?t.height===i[n-1].height:!0;return!r||!s}),e}function egt(e){let t,n,i=[],o=e.length;for(t=0;t<o;t++){let r=e[t],s=r.entries,a=s.length,c=[];for(n=0;n<a;n++){let g=s[n],m=P.clamp(g.height,Ml._minimumHeight,Ml._maximumHeight),A=z.clone(g.color,Z_t);A.red*=A.alpha,A.green*=A.alpha,A.blue*=A.alpha,c.push(iH(m,A))}let l=!0,f=!0;for(n=0;n<a-1;n++){let g=c[n+0],m=c[n+1];l=l&&g.height<=m.height,f=f&&g.height>=m.height}f?c=c.reverse():l||C_(c,function(g,m){return P.sign(g.height-m.height)});let d=y(r.extendDownwards,!1),p=y(r.extendUpwards,!1);c.length===1&&!d&&!p&&(d=!0,p=!0),d&&c.splice(0,0,iH(Ml._minimumHeight,c[0].color)),p&&c.splice(c.length,0,iH(Ml._maximumHeight,c[c.length-1].color)),c=oAe(c),i.push(c)}return i}function tgt(e){let t=egt(e),n=[],i=[],o;function r(l,f){n.push(iH(l,f))}function s(l,f,d){let p=z.multiplyByScalar(d,1-f.alpha,$_t);p=z.add(p,f,p),r(l,p)}let a=t.length;for(o=0;o<a;o++){let l=t[o],f=0,d=0;i=n,n=[];let p=l.length,g=i.length;for(;f<p||d<g;){let m=f<p?l[f]:void 0,A=f>0?l[f-1]:void 0,x=f<p-1?l[f+1]:void 0,C=d<g?i[d]:void 0,T=d>0?i[d-1]:void 0,E=d<g-1?i[d+1]:void 0;if(u(m)&&u(C)&&m.height===C.height){let S=u(E)&&C.height===E.height,D=!u(T),w=!u(E),R=u(x)&&m.height===x.height,O=!u(A),L=!u(x);S?R?(s(m.height,m.color,C.color),s(m.height,x.color,E.color)):O?(r(m.height,C.color),s(m.height,m.color,E.color)):L?(s(m.height,m.color,C.color),r(m.height,E.color)):(s(m.height,m.color,C.color),s(m.height,m.color,E.color)):D?R?(r(m.height,m.color),s(m.height,x.color,C.color)):L?(r(m.height,m.color),r(m.height,C.color)):(O||r(m.height,m.color),s(m.height,m.color,C.color)):w?R?(s(m.height,m.color,C.color),r(m.height,x.color)):O?(r(m.height,C.color),r(m.height,m.color)):L?s(m.height,m.color,C.color):(s(m.height,m.color,C.color),r(m.height,m.color)):R?(s(m.height,m.color,C.color),s(m.height,x.color,C.color)):O?(r(m.height,C.color),s(m.height,m.color,C.color)):L?(s(m.height,m.color,C.color),r(m.height,C.color)):s(m.height,m.color,C.color),f+=R?2:1,d+=S?2:1}else if(u(m)&&u(C)&&u(T)&&m.height<C.height){let S=iAe(m.height,T,C,Q_t);u(A)?u(x)?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(u(C)&&u(m)&&u(A)&&C.height<m.height){let S=iAe(C.height,A,m,J_t);u(T)?u(E)?s(C.height,S,C.color):(s(C.height,S,C.color),r(C.height,S)):(r(C.height,S),s(C.height,S,C.color)),d++}else u(m)&&(!u(C)||m.height<C.height)?(u(C)&&!u(T)&&!u(x)?(r(m.height,m.color),r(m.height,Ml._emptyColor),r(C.height,Ml._emptyColor)):(!u(C)&&u(T)&&!u(A)&&(r(T.height,Ml._emptyColor),r(m.height,Ml._emptyColor)),r(m.height,m.color)),f++):u(C)&&(!u(m)||C.height<m.height)&&(r(C.height,C.color),d++)}}return oAe(n)}function Ml(e){let{scene:t,layers:n}=y(e,y.EMPTY_OBJECT),{context:i}=t,o=tgt(n),r=o.length,s,a,c;if(!Ml._useFloatTexture(i)){a=Xe.UNSIGNED_BYTE,c=rt.RGBA,s=new Uint8Array(r*4);for(let g=0;g<r;g++)oe.packFloat(o[g].height,nAe),oe.pack(nAe,s,g*4)}else{a=Xe.FLOAT,c=i.webgl2?rt.RED:rt.LUMINANCE,s=new Float32Array(r);for(let g=0;g<r;g++)s[g]=o[g].height}let f=It.create({context:i,pixelFormat:c,pixelDatatype:a,source:{arrayBufferView:s,width:r,height:1},sampler:new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.NEAREST,magnificationFilter:yi.NEAREST})}),d=new Uint8Array(r*4);for(let g=0;g<r;g++)o[g].color.toBytes(t2),d[g*4+0]=t2[0],d[g*4+1]=t2[1],d[g*4+2]=t2[2],d[g*4+3]=t2[3];let p=It.create({context:i,pixelFormat:rt.RGBA,pixelDatatype:Xe.UNSIGNED_BYTE,source:{arrayBufferView:d,width:r,height:1},sampler:new ln({wrapS:vn.CLAMP_TO_EDGE,wrapT:vn.CLAMP_TO_EDGE,minificationFilter:an.LINEAR,magnificationFilter:yi.LINEAR})});return Vi.fromType("ElevationBand",{heights:f,colors:p})}Ml._useFloatTexture=function(e){return e.floatingPointTexture};Ml._maximumHeight=5906376425472;Ml._minimumHeight=-5906376425472;Ml._emptyColor=new z(0,0,0,0);var MX=Ml;function ngt(e){e=_t(e,{url:Qd.fromAssetId(96188)});let t=new Rc(e),n=e.style;if(!u(n)){let i=y(e.defaultColor,z.WHITE).toCssColorString();n=new fC({color:`Boolean(\${feature['cesium#color']}) ? color(\${feature['cesium#color']}) : ${i}`})}return t.style=n,t}var LX=ngt;function igt(e){e=y(e,y.EMPTY_OBJECT);let t=[],n=e.geometry;(!u(n.attributes)||!u(n.primitiveType))&&(n=n.constructor.createGeometry(n));let i=n.attributes,o=M.clone(y(e.modelMatrix,M.IDENTITY)),r=y(e.length,1e4);if(u(i.normal)&&t.push(new At({geometry:Ln.createLineSegmentsForVectors(n,"normal",r),attributes:{color:new Nt(1,0,0,1)},modelMatrix:o})),u(i.tangent)&&t.push(new At({geometry:Ln.createLineSegmentsForVectors(n,"tangent",r),attributes:{color:new Nt(0,1,0,1)},modelMatrix:o})),u(i.bitangent)&&t.push(new At({geometry:Ln.createLineSegmentsForVectors(n,"bitangent",r),attributes:{color:new Nt(0,0,1,1)},modelMatrix:o})),t.length>0)return new Dn({asynchronous:!1,geometryInstances:t,appearance:new on({flat:!0,translucent:!1})})}var NX=igt;var FX=`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 ogt(e){e=y(e,y.EMPTY_OBJECT),this.typedArray=e.typedArray,this.width=e.width,this.height=e.height,this.pixelFormat=y(e.pixelFormat,rt.RGBA),this.pixelDatatype=y(e.pixelDatatype,Xe.UNSIGNED_BYTE);let t=e.url;typeof t=="string"&&(t=Oe.createIfNeeded(t)),this.resource=t;let i=y(e.repeat,!0)?vn.REPEAT:vn.CLAMP_TO_EDGE;this.sampler=new ln({wrapS:i,wrapT:i,minificationFilter:e.minificationFilter,magnificationFilter:e.magnificationFilter,maximumAnisotropy:e.maximumAnisotropy})}var VX=ogt;var rgt={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",MAT2:"mat2",MAT3:"mat2",MAT4:"mat4"},UX=Object.freeze(rgt);function sgt(e,t,n){let i;try{return i=e(t,n),i}catch(o){return Promise.reject(o)}}function agt(e){let t;return function(n){let i=n.data,o=[],r={id:i.id,result:void 0,error:void 0};return Promise.resolve(sgt(e,i.parameters,o)).then(function(s){r.result=s}).catch(function(s){s instanceof Error?r.error={name:s.name,message:s.message,stack:s.stack}:r.error=s}).finally(function(){u(t)||(t=y(self.webkitPostMessage,self.postMessage)),i.canTransferArrayBuffer||(o.length=0);try{t(r,o)}catch(s){r.result=void 0,r.error=`postMessage failed with error: ${cm(s)}
  with responseMessage: ${JSON.stringify(r)}`,t(r)}})}}var kX=agt;var n2;typeof ko<"u"&&(n2=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 c(_,b){return _===null||typeof _ in A?_===b:!1}function l(_,b){var v;return function(){v||(v=m.a.setTimeout(function(){v=e,_()},b))}}function f(_,b){var v;return function(){clearTimeout(v),v=m.a.setTimeout(_,b)}}function d(_,b){b&&b!=="change"?b==="beforeChange"?this.pc(_):this.gb(_,b):this.qc(_)}function p(_,b){b!==null&&b.s&&b.s()}function g(_,b){var v=this.qd,I=v[S];I.ra||(this.Qb&&this.mb[b]?(v.uc(b,_,this.mb[b]),this.mb[b]=null,--this.Qb):I.I[b]||v.uc(b,_,I.J?{da:_}:v.$c(_)),_.Ja&&_.gd())}var m=typeof s<"u"?s:{};m.b=function(_,b){for(var v=_.split("."),I=m,B=0;B<v.length-1;B++)I=I[v[B]];I[v[v.length-1]]=b},m.L=function(_,b,v){_[b]=v},m.version="3.5.1",m.b("version",m.version),m.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},m.a=function(){function _(W,K){for(var J in W)B.call(W,J)&&K(J,W[J])}function b(W,K){if(K)for(var J in K)B.call(K,J)&&(W[J]=K[J]);return W}function v(W,K){return W.__proto__=K,W}function I(W,K,J,_e){var xe=W[K].match(j)||[];m.a.D(J.match(j),function(re){m.a.Na(xe,re,_e)}),W[K]=xe.join(" ")}var B=Object.prototype.hasOwnProperty,F={__proto__:[]}instanceof Array,k=typeof Symbol=="function",U={},G={};U[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],U.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),_(U,function(W,K){if(K.length)for(var J=0,_e=K.length;J<_e;J++)G[K[J]]=W});var V={propertychange:!0},X=n&&function(){for(var W=3,K=n.createElement("div"),J=K.getElementsByTagName("i");K.innerHTML="<!--[if gt IE "+ ++W+"]><i></i><![endif]-->",J[0];);return 4<W?W:e}(),j=/\S+/g,Q;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(W,K,J){for(var _e=0,xe=W.length;_e<xe;_e++)K.call(J,W[_e],_e,W)},A:typeof Array.prototype.indexOf=="function"?function(W,K){return Array.prototype.indexOf.call(W,K)}:function(W,K){for(var J=0,_e=W.length;J<_e;J++)if(W[J]===K)return J;return-1},Lb:function(W,K,J){for(var _e=0,xe=W.length;_e<xe;_e++)if(K.call(J,W[_e],_e,W))return W[_e];return e},Pa:function(W,K){var J=m.a.A(W,K);0<J?W.splice(J,1):J===0&&W.shift()},wc:function(W){var K=[];return W&&m.a.D(W,function(J){0>m.a.A(K,J)&&K.push(J)}),K},Mb:function(W,K,J){var _e=[];if(W)for(var xe=0,re=W.length;xe<re;xe++)_e.push(K.call(J,W[xe],xe));return _e},jb:function(W,K,J){var _e=[];if(W)for(var xe=0,re=W.length;xe<re;xe++)K.call(J,W[xe],xe)&&_e.push(W[xe]);return _e},Nb:function(W,K){if(K instanceof Array)W.push.apply(W,K);else for(var J=0,_e=K.length;J<_e;J++)W.push(K[J]);return W},Na:function(W,K,J){var _e=m.a.A(m.a.bc(W),K);0>_e?J&&W.push(K):J||W.splice(_e,1)},Ba:F,extend:b,setPrototypeOf:v,Ab:F?v:b,P:_,Ga:function(W,K,J){if(!W)return W;var _e={},xe;for(xe in W)B.call(W,xe)&&(_e[xe]=K.call(J,W[xe],xe,W));return _e},Tb:function(W){for(;W.firstChild;)m.removeNode(W.firstChild)},Yb:function(W){W=m.a.la(W);for(var K=(W[0]&&W[0].ownerDocument||n).createElement("div"),J=0,_e=W.length;J<_e;J++)K.appendChild(m.oa(W[J]));return K},Ca:function(W,K){for(var J=0,_e=W.length,xe=[];J<_e;J++){var re=W[J].cloneNode(!0);xe.push(K?m.oa(re):re)}return xe},va:function(W,K){if(m.a.Tb(W),K)for(var J=0,_e=K.length;J<_e;J++)W.appendChild(K[J])},Xc:function(W,K){var J=W.nodeType?[W]:W;if(0<J.length){for(var _e=J[0],xe=_e.parentNode,re=0,ye=K.length;re<ye;re++)xe.insertBefore(K[re],_e);for(re=0,ye=J.length;re<ye;re++)m.removeNode(J[re])}},Ua:function(W,K){if(W.length){for(K=K.nodeType===8&&K.parentNode||K;W.length&&W[0].parentNode!==K;)W.splice(0,1);for(;1<W.length&&W[W.length-1].parentNode!==K;)W.length--;if(1<W.length){var J=W[0],_e=W[W.length-1];for(W.length=0;J!==_e;)W.push(J),J=J.nextSibling;W.push(_e)}}return W},Zc:function(W,K){7>X?W.setAttribute("selected",K):W.selected=K},Db:function(W){return W===null||W===e?"":W.trim?W.trim():W.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(W,K){return W=W||"",K.length>W.length?!1:W.substring(0,K.length)===K},vd:function(W,K){if(W===K)return!0;if(W.nodeType===11)return!1;if(K.contains)return K.contains(W.nodeType!==1?W.parentNode:W);if(K.compareDocumentPosition)return(K.compareDocumentPosition(W)&16)==16;for(;W&&W!=K;)W=W.parentNode;return!!W},Sb:function(W){return m.a.vd(W,W.ownerDocument.documentElement)},kd:function(W){return!!m.a.Lb(W,m.a.Sb)},R:function(W){return W&&W.tagName&&W.tagName.toLowerCase()},Ac:function(W){return m.onError?function(){try{return W.apply(this,arguments)}catch(K){throw m.onError&&m.onError(K),K}}:W},setTimeout:function(W,K){return setTimeout(m.a.Ac(W),K)},Gc:function(W){setTimeout(function(){throw m.onError&&m.onError(W),W},0)},B:function(W,K,J){var _e=m.a.Ac(J);if(J=V[K],m.options.useOnlyNativeEvents||J||!o)if(J||typeof W.addEventListener!="function")if(typeof W.attachEvent<"u"){var xe=function(ye){_e.call(W,ye)},re="on"+K;W.attachEvent(re,xe),m.a.K.za(W,function(){W.detachEvent(re,xe)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else W.addEventListener(K,_e,!1);else Q||(Q=typeof o(W).on=="function"?"on":"bind"),o(W)[Q](K,_e)},Fb:function(W,K){if(!W||!W.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var J;if(m.a.R(W)==="input"&&W.type&&K.toLowerCase()=="click"?(J=W.type,J=J=="checkbox"||J=="radio"):J=!1,m.options.useOnlyNativeEvents||!o||J)if(typeof n.createEvent=="function")if(typeof W.dispatchEvent=="function")J=n.createEvent(G[K]||"HTMLEvents"),J.initEvent(K,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,W),W.dispatchEvent(J);else throw Error("The supplied element doesn't support dispatchEvent");else if(J&&W.click)W.click();else if(typeof W.fireEvent<"u")W.fireEvent("on"+K);else throw Error("Browser doesn't support triggering events");else o(W).trigger(K)},f:function(W){return m.O(W)?W():W},bc:function(W){return m.O(W)?W.v():W},Eb:function(W,K,J){var _e;K&&(typeof W.classList=="object"?(_e=W.classList[J?"add":"remove"],m.a.D(K.match(j),function(xe){_e.call(W.classList,xe)})):typeof W.className.baseVal=="string"?I(W.className,"baseVal",K,J):I(W,"className",K,J))},Bb:function(W,K){var J=m.a.f(K);(J===null||J===e)&&(J="");var _e=m.h.firstChild(W);!_e||_e.nodeType!=3||m.h.nextSibling(_e)?m.h.va(W,[W.ownerDocument.createTextNode(J)]):_e.data=J,m.a.Ad(W)},Yc:function(W,K){if(W.name=K,7>=X)try{var J=W.name.replace(/[&<>'"]/g,function(_e){return"&#"+_e.charCodeAt(0)+";"});W.mergeAttributes(n.createElement("<input name='"+J+"'/>"),!1)}catch{}},Ad:function(W){9<=X&&(W=W.nodeType==1?W:W.parentNode,W.style&&(W.style.zoom=W.style.zoom))},wd:function(W){if(X){var K=W.style.width;W.style.width=0,W.style.width=K}},Pd:function(W,K){W=m.a.f(W),K=m.a.f(K);for(var J=[],_e=W;_e<=K;_e++)J.push(_e);return J},la:function(W){for(var K=[],J=0,_e=W.length;J<_e;J++)K.push(W[J]);return K},Da:function(W){return k?Symbol(W):W},Zd:X===6,$d:X===7,W:X,Lc:function(W,K){for(var J=m.a.la(W.getElementsByTagName("input")).concat(m.a.la(W.getElementsByTagName("textarea"))),_e=typeof K=="string"?function(ye){return ye.name===K}:function(ye){return K.test(ye.name)},xe=[],re=J.length-1;0<=re;re--)_e(J[re])&&xe.push(J[re]);return xe},Nd:function(W){return typeof W=="string"&&(W=m.a.Db(W))?r&&r.parse?r.parse(W):new Function("return "+W)():null},hc:function(W,K,J){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(W),K,J)},Od:function(W,K,J){J=J||{};var _e=J.params||{},xe=J.includeFields||this.Jc,re=W;if(typeof W=="object"&&m.a.R(W)==="form")for(var re=W.action,ye=xe.length-1;0<=ye;ye--)for(var fe=m.a.Lc(W,xe[ye]),Se=fe.length-1;0<=Se;Se--)_e[fe[Se].name]=fe[Se].value;K=m.a.f(K);var we=n.createElement("form");we.style.display="none",we.action=re,we.method="post";for(var Ve in K)W=n.createElement("input"),W.type="hidden",W.name=Ve,W.value=m.a.hc(m.a.f(K[Ve])),we.appendChild(W);_(_e,function(qe,mt){var Ht=n.createElement("input");Ht.type="hidden",Ht.name=qe,Ht.value=mt,we.appendChild(Ht)}),n.body.appendChild(we),J.submitter?J.submitter(we):we.submit(),setTimeout(function(){we.parentNode.removeChild(we)},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 b=this;if(arguments.length===1)return function(){return b.apply(_,arguments)};var v=Array.prototype.slice.call(arguments,1);return function(){var I=v.slice(0);return I.push.apply(I,arguments),b.apply(_,I)}}),m.a.g=new function(){var _=0,b="__ko__"+new Date().getTime(),v={},I,B;return m.a.W?(I=function(F,k){var U=F[b];if(!U||U==="null"||!v[U]){if(!k)return e;U=F[b]="ko"+_++,v[U]={}}return v[U]},B=function(F){var k=F[b];return k?(delete v[k],F[b]=null,!0):!1}):(I=function(F,k){var U=F[b];return!U&&k&&(U=F[b]={}),U},B=function(F){return F[b]?(delete F[b],!0):!1}),{get:function(F,k){var U=I(F,!1);return U&&U[k]},set:function(F,k,U){(F=I(F,U!==e))&&(F[k]=U)},Ub:function(F,k,U){return F=I(F,!0),F[k]||(F[k]=U)},clear:B,Z:function(){return _+++b}}},m.b("utils.domData",m.a.g),m.b("utils.domData.clear",m.a.g.clear),m.a.K=new function(){function _(k,U){var G=m.a.g.get(k,I);return G===e&&U&&(G=[],m.a.g.set(k,I,G)),G}function b(k){var U=_(k,!1);if(U)for(var U=U.slice(0),G=0;G<U.length;G++)U[G](k);m.a.g.clear(k),m.a.K.cleanExternalData(k),F[k.nodeType]&&v(k.childNodes,!0)}function v(k,U){for(var G=[],V,X=0;X<k.length;X++)if((!U||k[X].nodeType===8)&&(b(G[G.length]=V=k[X]),k[X]!==V))for(;X--&&m.a.A(G,k[X])==-1;);}var I=m.a.g.Z(),B={1:!0,8:!0,9:!0},F={1:!0,9:!0};return{za:function(k,U){if(typeof U!="function")throw Error("Callback must be a function");_(k,!0).push(U)},yb:function(k,U){var G=_(k,!1);G&&(m.a.Pa(G,U),G.length==0&&m.a.g.set(k,I,e))},oa:function(k){return m.u.G(function(){B[k.nodeType]&&(b(k),F[k.nodeType]&&v(k.getElementsByTagName("*")))}),k},removeNode:function(k){m.oa(k),k.parentNode&&k.parentNode.removeChild(k)},cleanExternalData:function(k){o&&typeof o.cleanData=="function"&&o.cleanData([k])}}},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,"",""],b=[1,"<table>","</table>"],v=[3,"<table><tbody><tr>","</tr></tbody></table>"],I=[1,"<select multiple='multiple'>","</select>"],B={thead:b,tbody:b,tfoot:b,tr:[2,"<table><tbody>","</tbody></table>"],td:v,th:v,option:I,optgroup:I},F=8>=m.a.W;m.a.ua=function(k,U){var G;if(o){if(o.parseHTML)G=o.parseHTML(k,U)||[];else if((G=o.clean([k],U))&&G[0]){for(var V=G[0];V.parentNode&&V.parentNode.nodeType!==11;)V=V.parentNode;V.parentNode&&V.parentNode.removeChild(V)}}else{(G=U)||(G=n);var V=G.parentWindow||G.defaultView||t,X=m.a.Db(k).toLowerCase(),j=G.createElement("div"),Q;for(Q=(X=X.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&B[X[1]]||_,X=Q[0],Q="ignored<div>"+Q[1]+k+Q[2]+"</div>",typeof V.innerShiv=="function"?j.appendChild(V.innerShiv(Q)):(F&&G.body.appendChild(j),j.innerHTML=Q,F&&j.parentNode.removeChild(j));X--;)j=j.lastChild;G=m.a.la(j.lastChild.childNodes)}return G},m.a.Md=function(k,U){var G=m.a.ua(k,U);return G.length&&G[0].parentElement||m.a.Yb(G)},m.a.fc=function(k,U){if(m.a.Tb(k),U=m.a.f(U),U!==null&&U!==e)if(typeof U!="string"&&(U=U.toString()),o)o(k).html(U);else for(var G=m.a.ua(U,k.ownerDocument),V=0;V<G.length;V++)k.appendChild(G[V])}}(),m.b("utils.parseHtmlFragment",m.a.ua),m.b("utils.setHtml",m.a.fc),m.aa=function(){function _(v,I){if(v){if(v.nodeType==8){var B=m.aa.Uc(v.nodeValue);B!=null&&I.push({ud:v,Kd:B})}else if(v.nodeType==1)for(var B=0,F=v.childNodes,k=F.length;B<k;B++)_(F[B],I)}}var b={};return{Xb:function(v){if(typeof v!="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 b[I]=v,"<!--[ko_memo:"+I+"]-->"},bd:function(v,I){var B=b[v];if(B===e)throw Error("Couldn't find any memo with ID "+v+". Perhaps it's already been unmemoized.");try{return B.apply(null,I||[]),!0}finally{delete b[v]}},cd:function(v,I){var B=[];_(v,B);for(var F=0,k=B.length;F<k;F++){var U=B[F].ud,G=[U];I&&m.a.Nb(G,I),m.aa.bd(B[F].Kd,G),U.nodeValue="",U.parentNode&&U.parentNode.removeChild(U)}},Uc:function(v){return(v=v.match(/^\[ko_memo\:(.*?)\]$/))?v[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(B){for(var U=B,G=0,V;k<B;)if(V=I[k++]){if(k>U){if(5e3<=++G){k=B,m.a.Gc(Error("'Too much recursion' after processing "+G+" task groups."));break}U=B}try{V()}catch(X){m.a.Gc(X)}}}}function b(){_(),k=B=I.length=0}var v,I=[],B=0,F=1,k=0;return t.MutationObserver?v=function(U){var G=n.createElement("div");return new MutationObserver(U).observe(G,{attributes:!0}),function(){G.classList.toggle("foo")}}(b):v=n&&"onreadystatechange"in n.createElement("script")?function(U){var G=n.createElement("script");G.onreadystatechange=function(){G.onreadystatechange=null,n.documentElement.removeChild(G),G=null,U()},n.documentElement.appendChild(G)}:function(U){setTimeout(U,0)},{scheduler:v,zb:function(U){return B||m.na.scheduler(b),I[B++]=U,F++},cancel:function(U){U=U-(F-B),U>=k&&U<B&&(I[U]=null)},resetForTesting:function(){var U=B-k;return k=B=I.length=0,U},Sd:_}}(),m.b("tasks",m.na),m.b("tasks.schedule",m.na.zb),m.b("tasks.runEarly",m.na.Sd),m.Ta={throttle:function(_,b){_.throttleEvaluation=b;var v=null;return m.$({read:_,write:function(I){clearTimeout(v),v=m.a.setTimeout(function(){_(I)},b)}})},rateLimit:function(_,b){var v,I,B;typeof b=="number"?v=b:(v=b.timeout,I=b.method),_.Hb=!1,B=typeof I=="function"?I:I=="notifyWhenChangesStop"?f:l,_.ub(function(F){return B(F,v,b)})},deferred:function(_,b){if(b!==!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(v){var I,B=!1;return function(){if(!B){m.na.cancel(I),I=m.na.zb(v);try{B=!0,_.notifySubscribers(e,"dirty")}finally{B=!1}}}}))},notify:function(_,b){_.equalityComparer=b=="always"?null:c}};var A={undefined:1,boolean:1,number:1,string:1};m.b("extenders",m.Ta),m.ic=function(_,b,v){this.da=_,this.lc=b,this.mc=v,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,x),x.qb(this)};var x={qb:function(_){_.U={change:[]},_.sc=1},subscribe:function(_,b,v){var I=this;v=v||"change";var B=new m.ic(I,b?_.bind(b):_,function(){m.a.Pa(I.U[v],B),I.hb&&I.hb(v)});return I.Qa&&I.Qa(v),I.U[v]||(I.U[v]=[]),I.U[v].push(B),B},notifySubscribers:function(_,b){if(b=b||"change",b==="change"&&this.Gb(),this.Wa(b)){var v=b==="change"&&this.ed||this.U[b].slice(0);try{m.u.xc();for(var I=0,B;B=v[I];++I)B.Ib||B.lc(_)}finally{m.u.end()}}},ob:function(){return this.sc},Dd:function(_){return this.ob()!==_},Gb:function(){++this.sc},ub:function(_){var b=this,v=m.O(b),I,B,F,k,U;b.gb||(b.gb=b.notifySubscribers,b.notifySubscribers=d);var G=_(function(){b.Ja=!1,v&&k===b&&(k=b.nc?b.nc():b());var V=B||U&&b.sb(F,k);U=B=I=!1,V&&b.gb(F=k)});b.qc=function(V,X){X&&b.Ja||(U=!X),b.ed=b.U.change.slice(0),b.Ja=I=!0,k=V,G()},b.pc=function(V){I||(F=V,b.gb(V,"beforeChange"))},b.rc=function(){U=!0},b.gd=function(){b.sb(F,b.v(!0))&&(B=!0)}},Wa:function(_){return this.U[_]&&this.U[_].length},Bd:function(_){if(_)return this.U[_]&&this.U[_].length||0;var b=0;return m.a.P(this.U,function(v,I){v!=="dirty"&&(b+=I.length)}),b},sb:function(_,b){return!this.equalityComparer||!this.equalityComparer(_,b)},toString:function(){return"[object Object]"},extend:function(_){var b=this;return _&&m.a.P(_,function(v,I){var B=m.Ta[v];typeof B=="function"&&(b=B(b,I)||b)}),b}};m.L(x,"init",x.qb),m.L(x,"subscribe",x.subscribe),m.L(x,"extend",x.extend),m.L(x,"getSubscriptionsCount",x.Bd),m.a.Ba&&m.a.setPrototypeOf(x,Function.prototype),m.T.fn=x,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 _(F){v.push(I),I=F}function b(){I=v.pop()}var v=[],I,B=0;return{xc:_,end:b,cc:function(F){if(I){if(!m.Qc(F))throw Error("Only subscribable things can act as dependencies");I.od.call(I.pd,F,F.fd||(F.fd=++B))}},G:function(F,k,U){try{return _(),F.apply(k,U||[])}finally{b()}},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 C=m.a.Da("_latestValue");m.ta=function(_){function b(){return 0<arguments.length?(b.sb(b[C],arguments[0])&&(b.ya(),b[C]=arguments[0],b.xa()),this):(m.u.cc(b),b[C])}return b[C]=_,m.a.Ba||m.a.extend(b,m.T.fn),m.T.fn.qb(b),m.a.Ab(b,T),m.options.deferUpdates&&m.Ta.deferred(b,!0),b};var T={equalityComparer:c,v:function(){return this[C]},xa:function(){this.notifySubscribers(this[C],"spectate"),this.notifySubscribers(this[C])},ya:function(){this.notifySubscribers(this[C],"beforeChange")}};m.a.Ba&&m.a.setPrototypeOf(T,m.T.fn);var E=m.ta.Ma="__ko_proto__";T[E]=m.ta,m.O=function(_){if((_=typeof _=="function"&&_[E])&&_!==T[E]&&_!==m.o.fn[E])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!_},m.Za=function(_){return typeof _=="function"&&(_[E]===T[E]||_[E]===m.o.fn[E]&&_.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",T),m.L(T,"peek",T.v),m.L(T,"valueHasMutated",T.xa),m.L(T,"valueWillMutate",T.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 b=this.v(),v=[],I=typeof _!="function"||m.O(_)?function(k){return k===_}:_,B=0;B<b.length;B++){var F=b[B];if(I(F)){if(v.length===0&&this.ya(),b[B]!==F)throw Error("Array modified during remove; cannot remove item");v.push(F),b.splice(B,1),B--}}return v.length&&this.xa(),v},removeAll:function(_){if(_===e){var b=this.v(),v=b.slice(0);return this.ya(),b.splice(0,b.length),this.xa(),v}return _?this.remove(function(I){return 0<=m.a.A(_,I)}):[]},destroy:function(_){var b=this.v(),v=typeof _!="function"||m.O(_)?function(F){return F===_}:_;this.ya();for(var I=b.length-1;0<=I;I--){var B=b[I];v(B)&&(B._destroy=!0)}this.xa()},destroyAll:function(_){return _===e?this.destroy(function(){return!0}):_?this.destroy(function(b){return 0<=m.a.A(_,b)}):[]},indexOf:function(_){var b=this();return m.a.A(b,_)},replace:function(_,b){var v=this.indexOf(_);0<=v&&(this.ya(),this.v()[v]=b,this.xa())},sorted:function(_){var b=this().slice(0);return _?b.sort(_):b.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 b=this.v();this.ya(),this.zc(b,_,arguments);var v=b[_].apply(b,arguments);return this.xa(),v===b?this:v}}),m.a.D(["slice"],function(_){m.Ha.fn[_]=function(){var b=this();return b[_].apply(b,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(_,b){function v(){function j(){if(U){var Q=[].concat(_.v()||[]),W;_.Wa("arrayChange")&&((!B||1<U)&&(B=m.a.Pb(G,Q,_.Ob)),W=B),G=Q,B=null,U=0,W&&W.length&&_.notifySubscribers(W,"arrayChange")}}I?j():(I=!0,k=_.subscribe(function(){++U},null,"spectate"),G=[].concat(_.v()||[]),B=null,F=_.subscribe(j))}if(_.Ob={},b&&typeof b=="object"&&m.a.extend(_.Ob,b),_.Ob.sparse=!0,!_.zc){var I=!1,B=null,F,k,U=0,G,V=_.Qa,X=_.hb;_.Qa=function(j){V&&V.call(_,j),j==="arrayChange"&&v()},_.hb=function(j){X&&X.call(_,j),j!=="arrayChange"||_.Wa("arrayChange")||(F&&F.s(),k&&k.s(),k=F=null,I=!1,G=e)},_.zc=function(j,Q,W){function K(we,Ve,qe){return J[J.length]={status:we,value:Ve,index:qe}}if(I&&!U){var J=[],_e=j.length,xe=W.length,re=0;switch(Q){case"push":re=_e;case"unshift":for(Q=0;Q<xe;Q++)K("added",W[Q],re+Q);break;case"pop":re=_e-1;case"shift":_e&&K("deleted",j[re],re);break;case"splice":Q=Math.min(Math.max(0,0>W[0]?_e+W[0]:W[0]),_e);for(var _e=xe===1?_e:Math.min(Q+(W[1]||0),_e),xe=Q+xe-2,re=Math.max(_e,xe),ye=[],fe=[],Se=2;Q<re;++Q,++Se)Q<_e&&fe.push(K("deleted",j[Q],Q)),Q<xe&&ye.push(K("added",W[Se],Q));m.a.Kc(fe,ye);break;default:return}B=J}}}};var S=m.a.Da("_state");m.o=m.$=function(_,b,v){function I(){if(0<arguments.length){if(typeof B=="function")B.apply(F.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 F.ra||m.u.cc(I),(F.ka||F.J&&I.Xa())&&I.ha(),F.X}if(typeof _=="object"?v=_:(v=v||{},_&&(v.read=_)),typeof v.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var B=v.write,F={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:v.read,nb:b||v.owner,l:v.disposeWhenNodeIsRemoved||v.l||null,Sa:v.disposeWhen||v.Sa,Rb:null,I:{},V:0,Ic:null};return I[S]=F,I.Nc=typeof B=="function",m.a.Ba||m.a.extend(I,m.T.fn),m.T.fn.qb(I),m.a.Ab(I,D),v.pure?(F.wb=!0,F.J=!0,m.a.extend(I,w)):v.deferEvaluation&&m.a.extend(I,R),m.options.deferUpdates&&m.Ta.deferred(I,!0),F.l&&(F.jc=!0,F.l.nodeType||(F.l=null)),F.J||v.deferEvaluation||I.ha(),F.l&&I.ja()&&m.a.K.za(F.l,F.Rb=function(){I.s()}),I};var D={equalityComparer:c,qa:function(){return this[S].V},Va:function(){var _=[];return m.a.P(this[S].I,function(b,v){_[v.Ka]=v.da}),_},Vb:function(_){if(!this[S].V)return!1;var b=this.Va();return m.a.A(b,_)!==-1?!0:!!m.a.Lb(b,function(v){return v.Vb&&v.Vb(_)})},uc:function(_,b,v){if(this[S].wb&&b===this)throw Error("A 'pure' computed must not be called recursively");this[S].I[_]=v,v.Ka=this[S].V++,v.La=b.ob()},Xa:function(){var _,b,v=this[S].I;for(_ in v)if(Object.prototype.hasOwnProperty.call(v,_)&&(b=v[_],this.Ia&&b.da.Ja||b.da.Dd(b.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 b=_.subscribe(this.Jd,this,"dirty"),v=_.subscribe(this.Rd,this);return{da:_,s:function(){b.s(),v.s()}}}return _.subscribe(this.Hc,this)},Hc:function(){var _=this,b=_.throttleEvaluation;b&&0<=b?(clearTimeout(this[S].Ic),this[S].Ic=m.a.setTimeout(function(){_.ha(!0)},b)):_.Ia?_.Ia(!0):_.ha(!0)},ha:function(_){var b=this[S],v=b.Sa,I=!1;if(!b.rb&&!b.ra){if(b.l&&!m.a.Sb(b.l)||v&&v()){if(!b.jc){this.s();return}}else b.jc=!1;b.rb=!0;try{I=this.zd(_)}finally{b.rb=!1}return I}},zd:function(_){var b=this[S],I=!1,v=b.wb?e:!b.V,I={qd:this,mb:b.I,Qb:b.V};m.u.xc({pd:I,od:g,o:this,Ya:v}),b.I={},b.V=0;var B=this.yd(b,I);return b.V?I=this.sb(b.X,B):(this.s(),I=!0),I&&(b.J?this.Gb():this.notifySubscribers(b.X,"beforeChange"),b.X=B,this.notifySubscribers(b.X,"spectate"),!b.J&&_&&this.notifySubscribers(b.X),this.rc&&this.rc()),v&&this.notifySubscribers(b.X,"awake"),I},yd:function(_,b){try{var v=_.Wc;return _.nb?v.call(_.nb):v()}finally{m.u.end(),b.Qb&&!_.J&&m.a.P(b.mb,p),_.sa=_.ka=!1}},v:function(_){var b=this[S];return(b.ka&&(_||!b.V)||b.J&&this.Xa())&&this.ha(),b.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(b){this.pc(this[S].X),this[S].ka=!0,b&&(this[S].sa=!0),this.qc(this,!b)}},s:function(){var _=this[S];!_.J&&_.I&&m.a.P(_.I,function(b,v){v.s&&v.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)}},w={Qa:function(_){var b=this,v=b[S];if(!v.ra&&v.J&&_=="change"){if(v.J=!1,v.sa||b.Xa())v.I=null,v.V=0,b.ha()&&b.Gb();else{var I=[];m.a.P(v.I,function(B,F){I[F.Ka]=B}),m.a.D(I,function(B,F){var k=v.I[B],U=b.$c(k.da);U.Ka=F,U.La=k.La,v.I[B]=U}),b.Xa()&&b.ha()&&b.Gb()}v.ra||b.notifySubscribers(v.X,"awake")}},hb:function(_){var b=this[S];b.ra||_!="change"||this.Wa("change")||(m.a.P(b.I,function(v,I){I.s&&(b.I[v]={da:I.da,Ka:I.Ka,La:I.La},I.s())}),b.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var _=this[S];return _.J&&(_.sa||this.Xa())&&this.ha(),m.T.fn.ob.call(this)}},R={Qa:function(_){_!="change"&&_!="beforeChange"||this.v()}};m.a.Ba&&m.a.setPrototypeOf(D,m.T.fn);var O=m.ta.Ma;D[O]=m.o,m.Oc=function(_){return typeof _=="function"&&_[O]===D[O]},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",D),m.L(D,"peek",D.v),m.L(D,"dispose",D.s),m.L(D,"isActive",D.ja),m.L(D,"getDependenciesCount",D.qa),m.L(D,"getDependencies",D.Va),m.xb=function(_,b){return typeof _=="function"?m.o(_,b,{pure:!0}):(_=m.a.extend({},_),_.pure=!0,m.o(_,b))},m.b("pureComputed",m.xb),function(){function _(I,B,F){if(F=F||new v,I=B(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 k=I instanceof Array?[]:{};return F.save(I,k),b(I,function(U){var G=B(I[U]);switch(typeof G){case"boolean":case"number":case"string":case"function":k[U]=G;break;case"object":case"undefined":var V=F.get(G);k[U]=V!==e?V:_(G,B,F)}}),k}function b(I,B){if(I instanceof Array){for(var F=0;F<I.length;F++)B(F);typeof I.toJSON=="function"&&B("toJSON")}else for(F in I)B(F)}function v(){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(B){for(var F=0;m.O(B)&&10>F;F++)B=B();return B})},m.toJSON=function(I,B,F){return I=m.ad(I),m.a.hc(I,B,F)},v.prototype={constructor:v,save:function(I,B){var F=m.a.A(this.keys,I);0<=F?this.values[F]=B:(this.keys.push(I),this.values.push(B))},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(_,b,v){function I(B){var F=m.xb(_,v).extend({ma:"always"}),k=F.subscribe(function(U){U&&(k.s(),B(U))});return F.notifySubscribers(F.v()),k}return typeof Promise!="function"||b?I(b.bind(v)):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(_,b,v){switch(m.a.R(_)){case"option":typeof b=="string"?(m.a.g.set(_,m.c.options.$b,e),"__ko__hasDomDataOptionValue__"in _&&delete _.__ko__hasDomDataOptionValue__,_.value=b):(m.a.g.set(_,m.c.options.$b,b),_.__ko__hasDomDataOptionValue__=!0,_.value=typeof b=="number"?b:"");break;case"select":(b===""||b===null)&&(b=e);for(var I=-1,B=0,F=_.options.length,k;B<F;++B)if(k=m.w.M(_.options[B]),k==b||k===""&&b===e){I=B;break}(v||0<=I||b===e&&1<_.size)&&(_.selectedIndex=I,m.a.W===6&&m.a.setTimeout(function(){_.selectedIndex=I},0));break;default:(b===null||b===e)&&(b=""),_.value=b}}}}(),m.b("selectExtensions",m.w),m.b("selectExtensions.readValue",m.w.M),m.b("selectExtensions.writeValue",m.w.cb),m.m=function(){function _(U){U=m.a.Db(U),U.charCodeAt(0)===123&&(U=U.slice(1,-1)),U+=`
,`;var G=[],V=U.match(I),X,j=[],Q=0;if(1<V.length){for(var W=0,K;K=V[W];++W){var J=K.charCodeAt(0);if(J===44){if(0>=Q){G.push(X&&j.length?{key:X,value:j.join("")}:{unknown:X||j.join("")}),X=Q=0,j=[];continue}}else if(J===58){if(!Q&&!X&&j.length===1){X=j.pop();continue}}else{if(J===47&&1<K.length&&(K.charCodeAt(1)===47||K.charCodeAt(1)===42))continue;J===47&&W&&1<K.length?(J=V[W-1].match(B))&&!F[J[0]]&&(U=U.substr(U.indexOf(K)+1),V=U.match(I),W=-1,K="/"):J===40||J===123||J===91?++Q:J===41||J===125||J===93?--Q:X||j.length||J!==34&&J!==39||(K=K.slice(1,-1))}j.push(K)}if(0<Q)throw Error("Unbalanced parentheses, braces, or brackets")}return G}var b=["true","false","null","undefined"],v=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,I=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),B=/[\])"'A-Za-z0-9_$]+$/,F={in:1,return:1,typeof:1},k={};return{Ra:[],wa:k,ac:_,vb:function(U,G){function V(J,_e){var xe;if(!W){var re=m.getBindingHandler(J);if(re&&re.preprocess&&!(_e=re.preprocess(_e,J,V)))return;(re=k[J])&&(xe=_e,0<=m.a.A(b,xe)?xe=!1:(re=xe.match(v),xe=re===null?!1:re[1]?"Object("+re[1]+")"+re[2]:xe),re=xe),re&&j.push("'"+(typeof k[J]=="string"?k[J]:J)+"':function(_z){"+xe+"=_z}")}Q&&(_e="function(){return "+_e+" }"),X.push("'"+J+"':"+_e)}G=G||{};var X=[],j=[],Q=G.valueAccessors,W=G.bindingParams,K=typeof U=="string"?_(U):U;return m.a.D(K,function(J){V(J.key||J.unknown,J.value)}),j.length&&V("_ko_property_writers","{"+j.join(",")+" }"),X.join(",")},Id:function(U,G){for(var V=0;V<U.length;V++)if(U[V].key==G)return!0;return!1},eb:function(U,G,V,X,j){U&&m.O(U)?!m.Za(U)||j&&U.v()===X||U(X):(U=G.get("_ko_property_writers"))&&U[V]&&U[V](X)}}}(),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 _(V){return V.nodeType==8&&F.test(B?V.text:V.nodeValue)}function b(V){return V.nodeType==8&&k.test(B?V.text:V.nodeValue)}function v(V,X){for(var j=V,Q=1,W=[];j=j.nextSibling;){if(b(j)&&(m.a.g.set(j,G,!0),Q--,Q===0))return W;W.push(j),_(j)&&Q++}if(!X)throw Error("Cannot find closing comment tag to match: "+V.nodeValue);return null}function I(V,X){var j=v(V,X);return j?0<j.length?j[j.length-1].nextSibling:V.nextSibling:null}var B=n&&n.createComment("test").text==="<!--test-->",F=B?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=B?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,U={ul:!0,ol:!0},G="__ko_matchedEndComment__";m.h={ea:{},childNodes:function(V){return _(V)?v(V):V.childNodes},Ea:function(V){if(_(V)){V=m.h.childNodes(V);for(var X=0,j=V.length;X<j;X++)m.removeNode(V[X])}else m.a.Tb(V)},va:function(V,X){if(_(V)){m.h.Ea(V);for(var j=V.nextSibling,Q=0,W=X.length;Q<W;Q++)j.parentNode.insertBefore(X[Q],j)}else m.a.va(V,X)},Vc:function(V,X){var j;_(V)?(j=V.nextSibling,V=V.parentNode):j=V.firstChild,j?X!==j&&V.insertBefore(X,j):V.appendChild(X)},Wb:function(V,X,j){j?(j=j.nextSibling,_(V)&&(V=V.parentNode),j?X!==j&&V.insertBefore(X,j):V.appendChild(X)):m.h.Vc(V,X)},firstChild:function(V){if(_(V))return!V.nextSibling||b(V.nextSibling)?null:V.nextSibling;if(V.firstChild&&b(V.firstChild))throw Error("Found invalid end comment, as the first child of "+V);return V.firstChild},nextSibling:function(V){if(_(V)&&(V=I(V)),V.nextSibling&&b(V.nextSibling)){var X=V.nextSibling;if(b(X)&&!m.a.g.get(X,G))throw Error("Found end comment without a matching opening comment, as child of "+V);return null}return V.nextSibling},Cd:_,Vd:function(V){return(V=(B?V.text:V.nodeValue).match(F))?V[1]:null},Sc:function(V){if(U[m.a.R(V)]){var X=V.firstChild;if(X)do if(X.nodeType===1){var j;j=X.firstChild;var Q=null;if(j)do if(Q)Q.push(j);else if(_(j)){var W=I(j,!0);W?j=W:Q=[j]}else b(j)&&(Q=[j]);while(j=j.nextSibling);if(j=Q)for(Q=X.nextSibling,W=0;W<j.length;W++)Q?V.insertBefore(j[W],Q):V.appendChild(j[W])}while(X=X.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(_,b){var v=this.getBindingsString(_,b),v=v?this.parseBindingsString(v,b,_):null;return m.j.tc(v,_,b,!1)},getBindingAccessors:function(_,b){var v=this.getBindingsString(_,b),v=v?this.parseBindingsString(v,b,_,{valueAccessors:!0}):null;return m.j.tc(v,_,b,!0)},getBindingsString:function(_){switch(_.nodeType){case 1:return _.getAttribute("data-bind");case 8:return m.h.Vd(_);default:return null}},parseBindingsString:function(_,b,v,I){try{var B=this.nd,F=_+(I&&I.valueAccessors||""),k;if(!(k=B[F])){var U,G="with($context){with($data||{}){return{"+m.m.vb(_,I)+"}}}";U=new Function("$context","$element",G),k=B[F]=U}return k(b,v)}catch(V){throw V.message=`Unable to parse bindings.
Bindings value: `+_+`
Message: `+V.message,V}}}),m.ga.instance=new m.ga}(),m.b("bindingProvider",m.ga),function(){function _(re){var ye=(re=m.a.g.get(re,xe))&&re.N;ye&&(re.N=null,ye.Tc())}function b(re,ye,fe){this.node=re,this.yc=ye,this.kb=[],this.H=!1,ye.N||m.a.K.za(re,_),fe&&fe.N&&(fe.N.kb.push(re),this.Kb=fe)}function v(re){return function(){return re}}function I(re){return re()}function B(re){return m.a.Ga(m.u.G(re),function(ye,fe){return function(){return re()[fe]}})}function F(re,ye,fe){return typeof re=="function"?B(re.bind(null,ye,fe)):m.a.Ga(re,v)}function k(re,ye){return B(this.getBindings.bind(this,re,ye))}function U(re,ye){var fe=m.h.firstChild(ye);if(fe){var Se,we=m.ga.instance,Ve=we.preprocessNode;if(Ve){for(;Se=fe;)fe=m.h.nextSibling(Se),Ve.call(we,Se);fe=m.h.firstChild(ye)}for(;Se=fe;)fe=m.h.nextSibling(Se),G(re,Se)}m.i.ma(ye,m.i.H)}function G(re,ye){var fe=re,Se=ye.nodeType===1;Se&&m.h.Sc(ye),(Se||m.ga.instance.nodeHasBindings(ye))&&(fe=X(ye,null,re).bindingContextForDescendants),fe&&!J[m.a.R(ye)]&&U(fe,ye)}function V(re){var ye=[],fe={},Se=[];return m.a.P(re,function we(Ve){if(!fe[Ve]){var qe=m.getBindingHandler(Ve);qe&&(qe.after&&(Se.push(Ve),m.a.D(qe.after,function(mt){if(re[mt]){if(m.a.A(Se,mt)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Se.join(", "));we(mt)}}),Se.length--),ye.push({key:Ve,Mc:qe})),fe[Ve]=!0}}),ye}function X(re,ye,fe){var Se=m.a.g.Ub(re,xe,{}),we=Se.hd;if(!ye){if(we)throw Error("You cannot apply bindings multiple times to the same element.");Se.hd=!0}we||(Se.context=fe),Se.Zb||(Se.Zb={});var Ve;if(ye&&typeof ye!="function")Ve=ye;else{var qe=m.ga.instance,mt=qe.getBindingAccessors||k,Ht=m.$(function(){return(Ve=ye?ye(fe,re):mt.call(qe,re,fe))&&(fe[Q]&&fe[Q](),fe[K]&&fe[K]()),Ve},null,{l:re});Ve&&Ht.ja()||(Ht=null)}var fn=fe,dt;if(Ve){var Tn=function(){return m.a.Ga(Ht?Ht():Ve,I)},Jn=Ht?function(Gt){return function(){return I(Ht()[Gt])}}:function(Gt){return Ve[Gt]};Tn.get=function(Gt){return Ve[Gt]&&I(Jn(Gt))},Tn.has=function(Gt){return Gt in Ve},m.i.H in Ve&&m.i.subscribe(re,m.i.H,function(){var Gt=(0,Ve[m.i.H])();if(Gt){var Je=m.h.childNodes(re);Je.length&&Gt(Je,m.Ec(Je[0]))}}),m.i.pa in Ve&&(fn=m.i.Cb(re,fe),m.i.subscribe(re,m.i.pa,function(){var Gt=(0,Ve[m.i.pa])();Gt&&m.h.firstChild(re)&&Gt(re)})),Se=V(Ve),m.a.D(Se,function(Gt){var Je=Gt.Mc.init,pe=Gt.Mc.update,me=Gt.key;if(re.nodeType===8&&!m.h.ea[me])throw Error("The binding '"+me+"' cannot be used with virtual elements");try{typeof Je=="function"&&m.u.G(function(){var be=Je(re,Jn(me),Tn,fn.$data,fn);if(be&&be.controlsDescendantBindings){if(dt!==e)throw Error("Multiple bindings ("+dt+" and "+me+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");dt=me}}),typeof pe=="function"&&m.$(function(){pe(re,Jn(me),Tn,fn.$data,fn)},null,{l:re})}catch(be){throw be.message='Unable to process binding "'+me+": "+Ve[me]+`"
Message: `+be.message,be}})}return Se=dt===e,{shouldBindDescendants:Se,bindingContextForDescendants:Se&&fn}}function j(re,ye){return re&&re instanceof m.fa?re:new m.fa(re,e,e,ye)}var Q=m.a.Da("_subscribable"),W=m.a.Da("_ancestorBindingInfo"),K=m.a.Da("_dataDependency");m.c={};var J={script:!0,textarea:!0,template:!0};m.getBindingHandler=function(re){return m.c[re]};var _e={};m.fa=function(re,ye,fe,Se,we){function Ve(){var Jn=fn?Ht():Ht,Gt=m.a.f(Jn);return ye?(m.a.extend(qe,ye),W in ye&&(qe[W]=ye[W])):(qe.$parents=[],qe.$root=Gt,qe.ko=m),qe[Q]=dt,mt?Gt=qe.$data:(qe.$rawData=Jn,qe.$data=Gt),fe&&(qe[fe]=Gt),Se&&Se(qe,ye,Gt),ye&&ye[Q]&&!m.S.o().Vb(ye[Q])&&ye[Q](),Tn&&(qe[K]=Tn),qe.$data}var qe=this,mt=re===_e,Ht=mt?e:re,fn=typeof Ht=="function"&&!m.O(Ht),dt,Tn=we&&we.dataDependency;we&&we.exportDependencies?Ve():(dt=m.xb(Ve),dt.v(),dt.ja()?dt.equalityComparer=null:qe[Q]=e)},m.fa.prototype.createChildContext=function(re,ye,fe,Se){if(!Se&&ye&&typeof ye=="object"&&(Se=ye,ye=Se.as,fe=Se.extend),ye&&Se&&Se.noChildContext){var we=typeof re=="function"&&!m.O(re);return new m.fa(_e,this,null,function(Ve){fe&&fe(Ve),Ve[ye]=we?re():re},Se)}return new m.fa(re,this,ye,function(Ve,qe){Ve.$parentContext=qe,Ve.$parent=qe.$data,Ve.$parents=(qe.$parents||[]).slice(0),Ve.$parents.unshift(Ve.$parent),fe&&fe(Ve)},Se)},m.fa.prototype.extend=function(re,ye){return new m.fa(_e,this,null,function(fe){m.a.extend(fe,typeof re=="function"?re(fe):re)},ye)};var xe=m.a.g.Z();b.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},b.prototype.sd=function(re){m.a.Pa(this.kb,re),!this.kb.length&&this.H&&this.Cc()},b.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(re,ye,fe,Se,we){var Ve=m.a.g.Ub(re,xe,{});return Ve.Fa||(Ve.Fa=new m.T),we&&we.notifyImmediately&&Ve.Zb[ye]&&m.u.G(fe,Se,[re]),Ve.Fa.subscribe(fe,Se,ye)},ma:function(re,ye){var fe=m.a.g.get(re,xe);if(fe&&(fe.Zb[ye]=!0,fe.Fa&&fe.Fa.notifySubscribers(re,ye),ye==m.i.H)){if(fe.N)fe.N.Cc();else if(fe.N===e&&fe.Fa&&fe.Fa.Wa(m.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(re,ye){var fe=m.a.g.Ub(re,xe,{});return fe.N||(fe.N=new b(re,fe,ye[W])),ye[W]==fe?ye:ye.extend(function(Se){Se[W]=fe})}},m.Td=function(re){return(re=m.a.g.get(re,xe))&&re.context},m.ib=function(re,ye,fe){return re.nodeType===1&&m.h.Sc(re),X(re,ye,j(fe))},m.ld=function(re,ye,fe){return fe=j(fe),m.ib(re,F(ye,fe,re),fe)},m.Oa=function(re,ye){ye.nodeType!==1&&ye.nodeType!==8||U(j(re),ye)},m.vc=function(re,ye,fe){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");G(j(re,fe),ye)},m.Dc=function(re){return!re||re.nodeType!==1&&re.nodeType!==8?e:m.Td(re)},m.Ec=function(re){return(re=m.Dc(re))?re.$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 b(k,U){var G=Object.prototype.hasOwnProperty.call(B,k)?B[k]:_,V;G?G.subscribe(U):(G=B[k]=new m.T,G.subscribe(U),v(k,function(X,j){var Q=!(!j||!j.synchronous);F[k]={definition:X,Gd:Q},delete B[k],V||Q?G.notifySubscribers(X):m.na.zb(function(){G.notifySubscribers(X)})}),V=!0)}function v(k,U){I("getConfig",[k],function(G){G?I("loadComponent",[k,G],function(V){U(V,G)}):U(null,null)})}function I(k,U,G,V){V||(V=m.j.loaders.slice(0));var X=V.shift();if(X){var j=X[k];if(j){var Q=!1;if(j.apply(X,U.concat(function(W){Q?G(null):W!==null?G(W):I(k,U,G,V)}))!==_&&(Q=!0,!X.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else I(k,U,G,V)}else G(null)}var B={},F={};m.j={get:function(k,U){var G=Object.prototype.hasOwnProperty.call(F,k)?F[k]:_;G?G.Gd?m.u.G(function(){U(G.definition)}):m.na.zb(function(){U(G.definition)}):b(k,U)},Bc:function(k){delete F[k]},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 _(G,V,X,j){function Q(){--K===0&&j(W)}var W={},K=2,J=X.template;X=X.viewModel,J?B(V,J,function(_e){m.j.oc("loadTemplate",[G,_e],function(xe){W.template=xe,Q()})}):Q(),X?B(V,X,function(_e){m.j.oc("loadViewModel",[G,_e],function(xe){W[U]=xe,Q()})}):Q()}function b(G,V,X){if(typeof V=="function")X(function(Q){return new V(Q)});else if(typeof V[U]=="function")X(V[U]);else if("instance"in V){var j=V.instance;X(function(){return j})}else"viewModel"in V?b(G,V.viewModel,X):G("Unknown viewModel value: "+V)}function v(G){switch(m.a.R(G)){case"script":return m.a.ua(G.text);case"textarea":return m.a.ua(G.value);case"template":if(I(G.content))return m.a.Ca(G.content.childNodes)}return m.a.Ca(G.childNodes)}function I(G){return t.DocumentFragment?G instanceof DocumentFragment:G&&G.nodeType===11}function B(G,V,X){typeof V.require=="string"?a||t.require?(a||t.require)([V.require],function(j){j&&typeof j=="object"&&j.Xd&&j.default&&(j=j.default),X(j)}):G("Uses require, but no AMD loader is present"):X(V)}function F(G){return function(V){throw Error("Component '"+G+"': "+V)}}var k={};m.j.register=function(G,V){if(!V)throw Error("Invalid configuration for "+G);if(m.j.tb(G))throw Error("Component "+G+" is already registered");k[G]=V},m.j.tb=function(G){return Object.prototype.hasOwnProperty.call(k,G)},m.j.unregister=function(G){delete k[G],m.j.Bc(G)},m.j.Fc={getConfig:function(G,V){V(m.j.tb(G)?k[G]:null)},loadComponent:function(G,V,X){var j=F(G);B(j,V,function(Q){_(G,j,Q,X)})},loadTemplate:function(G,V,X){if(G=F(G),typeof V=="string")X(m.a.ua(V));else if(V instanceof Array)X(V);else if(I(V))X(m.a.la(V.childNodes));else if(V.element)if(V=V.element,t.HTMLElement?V instanceof HTMLElement:V&&V.tagName&&V.nodeType===1)X(v(V));else if(typeof V=="string"){var j=n.getElementById(V);j?X(v(j)):G("Cannot find element with ID "+V)}else G("Unknown element type: "+V);else G("Unknown template value: "+V)},loadViewModel:function(G,V,X){b(F(G),V,X)}};var U="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=k}(),function(){function _(v,I){var B=v.getAttribute("params");if(B){var B=b.parseBindingsString(B,I,v,{valueAccessors:!0,bindingParams:!0}),B=m.a.Ga(B,function(U){return m.o(U,null,{l:v})}),F=m.a.Ga(B,function(U){var G=U.v();return U.ja()?m.o({read:function(){return m.a.f(U())},write:m.Za(G)&&function(V){U()(V)},l:v}):G});return Object.prototype.hasOwnProperty.call(F,"$raw")||(F.$raw=B),F}return{$raw:{}}}m.j.getComponentNameForNode=function(v){var I=m.a.R(v);if(m.j.tb(I)&&(I.indexOf("-")!=-1||""+v=="[object HTMLUnknownElement]"||8>=m.a.W&&v.tagName===I))return I},m.j.tc=function(v,I,B,F){if(I.nodeType===1){var k=m.j.getComponentNameForNode(I);if(k){if(v=v||{},v.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var U={name:k,params:_(I,B)};v.component=F?function(){return U}:U}}return v};var b=new m.ga;9>m.a.W&&(m.j.register=function(v){return function(I){return v.apply(this,arguments)}}(m.j.register),n.createDocumentFragment=function(v){return function(){var I=v(),B=m.j.dd,F;for(F in B);return I}}(n.createDocumentFragment))}(),function(){function _(I,B,F){if(B=B.template,!B)throw Error("Component '"+I+"' has no template");I=m.a.Ca(B),m.h.va(F,I)}function b(I,B,F){var k=I.createViewModel;return k?k.call(I,B,F):B}var v=0;m.c.component={init:function(I,B,F,k,U){function G(){var W=V&&V.dispose;typeof W=="function"&&W.call(V),j&&j.s(),X=V=j=null}var V,X,j,Q=m.a.la(m.h.childNodes(I));return m.h.Ea(I),m.a.K.za(I,G),m.o(function(){var W=m.a.f(B()),K,J;if(typeof W=="string"?K=W:(K=m.a.f(W.name),J=m.a.f(W.params)),!K)throw Error("No component name specified");var _e=m.i.Cb(I,U),xe=X=++v;m.j.get(K,function(re){if(X===xe){if(G(),!re)throw Error("Unknown component '"+K+"'");_(K,re,I);var ye=b(re,J,{element:I,templateNodes:Q});re=_e.createChildContext(ye,{extend:function(fe){fe.$component=ye,fe.$componentTemplateNodes=Q}}),ye&&ye.koDescendantsComplete&&(j=m.i.subscribe(I,m.i.pa,ye.koDescendantsComplete,ye)),V=ye,m.Oa(re,I)}})},null,{l:I}),{controlsDescendantBindings:!0}}},m.h.ea.component=!0}();var L={class:"className",for:"htmlFor"};m.c.attr={update:function(_,b){var v=m.a.f(b())||{};m.a.P(v,function(I,B){B=m.a.f(B);var F=I.indexOf(":"),F="lookupNamespaceURI"in _&&0<F&&_.lookupNamespaceURI(I.substr(0,F)),k=B===!1||B===null||B===e;k?F?_.removeAttributeNS(F,I):_.removeAttribute(I):B=B.toString(),8>=m.a.W&&I in L?(I=L[I],k?_.removeAttribute(I):_[I]=B):k||(F?_.setAttributeNS(F,I,B):_.setAttribute(I,B)),I==="name"&&m.a.Yc(_,k?"":B)})}},function(){m.c.checked={after:["value","attr"],init:function(_,b,v){function I(){var W=_.checked,K=F();if(!m.S.Ya()&&(W||!U&&!m.S.qa())){var J=m.u.G(b);if(V){var _e=X?J.v():J,xe=Q;Q=K,xe!==K?W&&(m.a.Na(_e,K,!0),m.a.Na(_e,xe,!1)):m.a.Na(_e,K,W),X&&m.Za(J)&&J(_e)}else k&&(K===e?K=W:W||(K=e)),m.m.eb(J,v,"checked",K,!0)}}function B(){var W=m.a.f(b()),K=F();V?(_.checked=0<=m.a.A(W,K),Q=K):_.checked=k&&K===e?!!W:F()===W}var F=m.xb(function(){if(v.has("checkedValue"))return m.a.f(v.get("checkedValue"));if(j)return v.has("value")?m.a.f(v.get("value")):_.value}),k=_.type=="checkbox",U=_.type=="radio";if(k||U){var G=b(),V=k&&m.a.f(G)instanceof Array,X=!(V&&G.push&&G.splice),j=U||V,Q=V?F():e;U&&!_.name&&m.c.uniqueName.init(_,function(){return!0}),m.o(I,null,{l:_}),m.a.B(_,"click",I),m.o(B,null,{l:_}),G=e}}},m.m.wa.checked=!0,m.c.checkedValue={update:function(_,b){_.value=m.a.f(b())}}}(),m.c.class={update:function(_,b){var v=m.a.Db(m.a.f(b()));m.a.Eb(_,_.__ko__cssValue,!1),_.__ko__cssValue=v,m.a.Eb(_,v,!0)}},m.c.css={update:function(_,b){var v=m.a.f(b());v!==null&&typeof v=="object"?m.a.P(v,function(I,B){B=m.a.f(B),m.a.Eb(_,I,B)}):m.c.class.update(_,b)}},m.c.enable={update:function(_,b){var v=m.a.f(b());v&&_.disabled?_.removeAttribute("disabled"):v||_.disabled||(_.disabled=!0)}},m.c.disable={update:function(_,b){m.c.enable.update(_,function(){return!m.a.f(b())})}},m.c.event={init:function(_,b,v,I,B){var F=b()||{};m.a.P(F,function(k){typeof k=="string"&&m.a.B(_,k,function(U){var G,V=b()[k];if(V){try{var X=m.a.la(arguments);I=B.$data,X.unshift(I),G=V.apply(I,X)}finally{G!==!0&&(U.preventDefault?U.preventDefault():U.returnValue=!1)}v.get(k+"Bubble")===!1&&(U.cancelBubble=!0,U.stopPropagation&&U.stopPropagation())}})})}},m.c.foreach={Rc:function(_){return function(){var b=_(),v=m.a.bc(b);return!v||typeof v.length=="number"?{foreach:b,templateEngine:m.ba.Ma}:(m.a.f(b),{foreach:v.data,as:v.as,noChildContext:v.noChildContext,includeDestroyed:v.includeDestroyed,afterAdd:v.afterAdd,beforeRemove:v.beforeRemove,afterRender:v.afterRender,beforeMove:v.beforeMove,afterMove:v.afterMove,templateEngine:m.ba.Ma})}},init:function(_,b){return m.c.template.init(_,m.c.foreach.Rc(b))},update:function(_,b,v,I,B){return m.c.template.update(_,m.c.foreach.Rc(b),v,I,B)}},m.m.Ra.foreach=!1,m.h.ea.foreach=!0,m.c.hasfocus={init:function(_,b,v){function I(k){_.__ko_hasfocusUpdating=!0;var U=_.ownerDocument;if("activeElement"in U){var G;try{G=U.activeElement}catch{G=U.body}k=G===_}U=b(),m.m.eb(U,v,"hasfocus",k,!0),_.__ko_hasfocusLastValue=k,_.__ko_hasfocusUpdating=!1}var B=I.bind(null,!0),F=I.bind(null,!1);m.a.B(_,"focus",B),m.a.B(_,"focusin",B),m.a.B(_,"blur",F),m.a.B(_,"focusout",F),_.__ko_hasfocusLastValue=!1},update:function(_,b){var v=!!m.a.f(b());_.__ko_hasfocusUpdating||_.__ko_hasfocusLastValue===v||(v?_.focus():_.blur(),!v&&_.__ko_hasfocusLastValue&&_.ownerDocument.body.focus(),m.u.G(m.a.Fb,null,[_,v?"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(_,b){m.a.fc(_,b())}},function(){function _(b,v,I){m.c[b]={init:function(B,F,k,U,G){var V,X,j={},Q,W,K;if(v){U=k.get("as");var J=k.get("noChildContext");K=!(U&&J),j={as:U,noChildContext:J,exportDependencies:K}}return W=(Q=k.get("completeOn")=="render")||k.has(m.i.pa),m.o(function(){var _e=m.a.f(F()),xe=!I!=!_e,re=!X,ye;(K||xe!==V)&&(W&&(G=m.i.Cb(B,G)),xe&&((!v||K)&&(j.dataDependency=m.S.o()),ye=v?G.createChildContext(typeof _e=="function"?_e:F,j):m.S.qa()?G.extend(null,j):G),re&&m.S.qa()&&(X=m.a.Ca(m.h.childNodes(B),!0)),xe?(re||m.h.va(B,m.a.Ca(X)),m.Oa(ye,B)):(m.h.Ea(B),Q||m.i.ma(B,m.i.H)),V=xe)},null,{l:B}),{controlsDescendantBindings:!0}}},m.m.Ra[b]=!1,m.h.ea[b]=!0}_("if"),_("ifnot",!1,!0),_("with",!0)}(),m.c.let={init:function(_,b,v,I,B){return b=B.extend(b),m.Oa(b,_),{controlsDescendantBindings:!0}}},m.h.ea.let=!0;var N={};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(_,b,v){function I(){return m.a.jb(_.options,function(J){return J.selected})}function B(J,_e,xe){var re=typeof _e;return re=="function"?_e(J):re=="string"?J[_e]:xe}function F(J,_e){if(W&&V)m.i.ma(_,m.i.H);else if(Q.length){var xe=0<=m.a.A(Q,m.w.M(_e[0]));m.a.Zc(_e[0],xe),W&&!xe&&m.u.G(m.a.Fb,null,[_,"change"])}}var k=_.multiple,U=_.length!=0&&k?_.scrollTop:null,G=m.a.f(b()),V=v.get("valueAllowUnset")&&v.has("value"),X=v.get("optionsIncludeDestroyed");b={};var j,Q=[];V||(k?Q=m.a.Mb(I(),m.w.M):0<=_.selectedIndex&&Q.push(m.w.M(_.options[_.selectedIndex]))),G&&(typeof G.length>"u"&&(G=[G]),j=m.a.jb(G,function(J){return X||J===e||J===null||!m.a.f(J._destroy)}),v.has("optionsCaption")&&(G=m.a.f(v.get("optionsCaption")),G!==null&&G!==e&&j.unshift(N)));var W=!1;if(b.beforeRemove=function(J){_.removeChild(J)},G=F,v.has("optionsAfterRender")&&typeof v.get("optionsAfterRender")=="function"&&(G=function(J,_e){F(0,_e),m.u.G(v.get("optionsAfterRender"),null,[_e[0],J!==N?J:e])}),m.a.ec(_,j,function(J,_e,xe){return xe.length&&(Q=!V&&xe[0].selected?[m.w.M(xe[0])]:[],W=!0),_e=_.ownerDocument.createElement("option"),J===N?(m.a.Bb(_e,v.get("optionsCaption")),m.w.cb(_e,e)):(xe=B(J,v.get("optionsValue"),J),m.w.cb(_e,m.a.f(xe)),J=B(J,v.get("optionsText"),xe),m.a.Bb(_e,J)),[_e]},b,G),!V){var K;k?K=Q.length&&I().length<Q.length:K=Q.length&&0<=_.selectedIndex?m.w.M(_.options[_.selectedIndex])!==Q[0]:Q.length||0<=_.selectedIndex,K&&m.u.G(m.a.Fb,null,[_,"change"])}(V||m.S.Ya())&&m.i.ma(_,m.i.H),m.a.wd(_),U&&20<Math.abs(U-_.scrollTop)&&(_.scrollTop=U)}},m.c.options.$b=m.a.g.Z(),m.c.selectedOptions={init:function(_,b,v){function I(){var k=b(),U=[];m.a.D(_.getElementsByTagName("option"),function(G){G.selected&&U.push(m.w.M(G))}),m.m.eb(k,v,"selectedOptions",U)}function B(){var k=m.a.f(b()),U=_.scrollTop;k&&typeof k.length=="number"&&m.a.D(_.getElementsByTagName("option"),function(G){var V=0<=m.a.A(k,m.w.M(G));G.selected!=V&&m.a.Zc(G,V)}),_.scrollTop=U}if(m.a.R(_)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var F;m.i.subscribe(_,m.i.H,function(){F?I():(m.a.B(_,"change",I),F=m.o(B,null,{l:_}))},null,{notifyImmediately:!0})},update:function(){}},m.m.wa.selectedOptions=!0,m.c.style={update:function(_,b){var v=m.a.f(b()||{});m.a.P(v,function(I,B){if(B=m.a.f(B),(B===null||B===e||B===!1)&&(B=""),o)o(_).css(I,B);else if(/^--/.test(I))_.style.setProperty(I,B);else{I=I.replace(/-(\w)/g,function(k,U){return U.toUpperCase()});var F=_.style[I];_.style[I]=B,B===F||_.style[I]!=F||isNaN(B)||(_.style[I]=B+"px")}})}},m.c.submit={init:function(_,b,v,I,B){if(typeof b()!="function")throw Error("The value for a submit binding must be a function");m.a.B(_,"submit",function(F){var k,U=b();try{k=U.call(B.$data,_)}finally{k!==!0&&(F.preventDefault?F.preventDefault():F.returnValue=!1)}})}},m.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(_,b){m.a.Bb(_,b())}},m.h.ea.text=!0,function(){if(t&&t.navigator){var _=function(j){if(j)return parseFloat(j[1])},b=t.navigator.userAgent,v,I,B,F,k;(v=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(k=_(b.match(/Edge\/([^ ]+)$/)))||_(b.match(/Chrome\/([^ ]+)/))||(I=_(b.match(/Version\/([^ ]+) Safari/)))||(B=_(b.match(/Firefox\/([^ ]+)/)))||(F=m.a.W||_(b.match(/MSIE ([^ ]+)/)))||(F=_(b.match(/rv:([^ )]+)/)))}if(8<=F&&10>F)var U=m.a.g.Z(),G=m.a.g.Z(),V=function(j){var Q=this.activeElement;(Q=Q&&m.a.g.get(Q,G))&&Q(j)},X=function(j,Q){var W=j.ownerDocument;m.a.g.get(W,U)||(m.a.g.set(W,U,!0),m.a.B(W,"selectionchange",V)),m.a.g.set(j,G,Q)};m.c.textInput={init:function(j,Q,W){function K(Ve,qe){m.a.B(j,Ve,qe)}function J(){var Ve=m.a.f(Q());(Ve===null||Ve===e)&&(Ve=""),fe!==e&&Ve===fe?m.a.setTimeout(J,4):j.value!==Ve&&(we=!0,j.value=Ve,we=!1,re=j.value)}function _e(){ye||(fe=j.value,ye=m.a.setTimeout(xe,4))}function xe(){clearTimeout(ye),fe=ye=e;var Ve=j.value;re!==Ve&&(re=Ve,m.m.eb(Q(),W,"textInput",Ve))}var re=j.value,ye,fe,Se=m.a.W==9?_e:xe,we=!1;F&&K("keypress",xe),11>F&&K("propertychange",function(Ve){we||Ve.propertyName!=="value"||Se(Ve)}),F==8&&(K("keyup",xe),K("keydown",xe)),X&&(X(j,Se),K("dragend",_e)),(!F||9<=F)&&K("input",Se),5>I&&m.a.R(j)==="textarea"?(K("keydown",_e),K("paste",_e),K("cut",_e)):11>v?K("keydown",_e):4>B?(K("DOMAutoComplete",xe),K("dragdrop",xe),K("drop",xe)):k&&j.type==="number"&&K("keydown",_e),K("change",xe),K("blur",xe),m.o(J,null,{l:j})}},m.m.wa.textInput=!0,m.c.textinput={preprocess:function(j,Q,W){W("textInput",j)}}}(),m.c.uniqueName={init:function(_,b){if(b()){var v="ko_unique_"+ ++m.c.uniqueName.rd;m.a.Yc(_,v)}}},m.c.uniqueName.rd=0,m.c.using={init:function(_,b,v,I,B){var F;return v.has("as")&&(F={as:v.get("as"),noChildContext:v.get("noChildContext")}),b=B.createChildContext(b,F),m.Oa(b,_),{controlsDescendantBindings:!0}}},m.h.ea.using=!0,m.c.value={init:function(_,b,v){var I=m.a.R(_),B=I=="input";if(!B||_.type!="checkbox"&&_.type!="radio"){var F=[],k=v.get("valueUpdate"),U=!1,G=null;k&&(typeof k=="string"?F=[k]:F=m.a.wc(k),m.a.Pa(F,"change"));var V=function(){G=null,U=!1;var Q=b(),W=m.w.M(_);m.m.eb(Q,v,"value",W)};!m.a.W||!B||_.type!="text"||_.autocomplete=="off"||_.form&&_.form.autocomplete=="off"||m.a.A(F,"propertychange")!=-1||(m.a.B(_,"propertychange",function(){U=!0}),m.a.B(_,"focus",function(){U=!1}),m.a.B(_,"blur",function(){U&&V()})),m.a.D(F,function(Q){var W=V;m.a.Ud(Q,"after")&&(W=function(){G=m.w.M(_),m.a.setTimeout(V,0)},Q=Q.substring(5)),m.a.B(_,Q,W)});var X;if(X=B&&_.type=="file"?function(){var Q=m.a.f(b());Q===null||Q===e||Q===""?_.value="":m.u.G(V)}:function(){var Q=m.a.f(b()),W=m.w.M(_);G!==null&&Q===G?m.a.setTimeout(X,0):(Q!==W||W===e)&&(I==="select"?(W=v.get("valueAllowUnset"),m.w.cb(_,Q,W),W||Q===m.w.M(_)||m.u.G(V)):m.w.cb(_,Q))},I==="select"){var j;m.i.subscribe(_,m.i.H,function(){j?v.get("valueAllowUnset")?X():V():(m.a.B(_,"change",V),j=m.o(X,null,{l:_}))},null,{notifyImmediately:!0})}else m.a.B(_,"change",V),m.o(X,null,{l:_})}else m.ib(_,{checkedValue:b})},update:function(){}},m.m.wa.value=!0,m.c.visible={update:function(_,b){var v=m.a.f(b()),I=_.style.display!="none";v&&!I?_.style.display="":!v&&I&&(_.style.display="none")}},m.c.hidden={update:function(_,b){m.c.visible.update(_,function(){return!m.a.f(b())})}},function(_){m.c[_]={init:function(b,v,I,B,F){return m.c.event.init.call(this,b,function(){var k={};return k[_]=v(),k},I,B,F)}}}("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(_,b){if(typeof _=="string"){b=b||n;var v=b.getElementById(_);if(!v)throw Error("Cannot find template with ID "+_);return new m.C.F(v)}if(_.nodeType==1||_.nodeType==8)return new m.C.ia(_);throw Error("Unknown template type: "+_)},m.ca.prototype.renderTemplate=function(_,b,v,I){return _=this.makeTemplateSource(_,I),this.renderTemplateSource(_,b,v,I)},m.ca.prototype.isTemplateRewritten=function(_,b){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(_,b).data("isRewritten")},m.ca.prototype.rewriteTemplate=function(_,b,v){_=this.makeTemplateSource(_,v),b=b(_.text()),_.text(b),_.data("isRewritten",!0)},m.b("templateEngine",m.ca),m.kc=function(){function _(I,B,F,k){I=m.m.ac(I);for(var U=m.m.Ra,G=0;G<I.length;G++){var V=I[G].key;if(Object.prototype.hasOwnProperty.call(U,V)){var X=U[V];if(typeof X=="function"){if(V=X(I[G].value))throw Error(V)}else if(!X)throw Error("This template engine does not support the '"+V+"' binding within its templates")}}return F="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+m.m.vb(I,{valueAccessors:!0})+" } })()},'"+F.toLowerCase()+"')",k.createJavaScriptEvaluatorBlock(F)+B}var b=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,v=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(I,B,F){B.isTemplateRewritten(I,F)||B.rewriteTemplate(I,function(k){return m.kc.Ld(k,B)},F)},Ld:function(I,B){return I.replace(b,function(F,k,U,G,V){return _(V,k,U,B)}).replace(v,function(F,k){return _(k,"<!-- ko -->","#comment",B)})},md:function(I,B){return m.aa.Xb(function(F,k){var U=F.nextSibling;U&&U.nodeName.toLowerCase()===B&&m.ib(U,I,k)})}}}(),m.b("__tr_ambtns",m.kc.md),function(){m.C={},m.C.F=function(v){if(this.F=v){var I=m.a.R(v);this.ab=I==="script"?1:I==="textarea"?2:I=="template"&&v.content&&v.content.nodeType===11?3:4}},m.C.F.prototype.text=function(){var v=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[v];var I=arguments[0];v==="innerHTML"?m.a.fc(this.F,I):this.F[v]=I};var _=m.a.g.Z()+"_";m.C.F.prototype.data=function(v){if(arguments.length===1)return m.a.g.get(this.F,_+v);m.a.g.set(this.F,_+v,arguments[1])};var b=m.a.g.Z();m.C.F.prototype.nodes=function(){var v=this.F;if(arguments.length==0){var I=m.a.g.get(v,b)||{},B=I.lb||(this.ab===3?v.content:this.ab===4?v:e);if(!B||I.jd){var F=this.text();F&&F!==I.bb&&(B=m.a.Md(F,v.ownerDocument),m.a.g.set(v,b,{lb:B,bb:F,jd:!0}))}return B}I=arguments[0],this.ab!==e&&this.text(""),m.a.g.set(v,b,{lb:I})},m.C.ia=function(v){this.F=v},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 v=m.a.g.get(this.F,b)||{};return v.bb===e&&v.lb&&(v.bb=v.lb.innerHTML),v.bb}m.a.g.set(this.F,b,{bb:arguments[0]})},m.b("templateSources",m.C),m.b("templateSources.domElement",m.C.F),m.b("templateSources.anonymousTemplate",m.C.ia)}(),function(){function _(G,V,X){var j;for(V=m.h.nextSibling(V);G&&(j=G)!==V;)G=m.h.nextSibling(j),X(j,G)}function b(G,V){if(G.length){var X=G[0],j=G[G.length-1],Q=X.parentNode,W=m.ga.instance,K=W.preprocessNode;if(K){if(_(X,j,function(J,_e){var xe=J.previousSibling,re=K.call(W,J);re&&(J===X&&(X=re[0]||_e),J===j&&(j=re[re.length-1]||xe))}),G.length=0,!X)return;X===j?G.push(X):(G.push(X,j),m.a.Ua(G,Q))}_(X,j,function(J){J.nodeType!==1&&J.nodeType!==8||m.vc(V,J)}),_(X,j,function(J){J.nodeType!==1&&J.nodeType!==8||m.aa.cd(J,[V])}),m.a.Ua(G,Q)}}function v(G){return G.nodeType?G:0<G.length?G[0]:null}function I(G,V,X,j,Q){Q=Q||{};var W=(G&&v(G)||X||{}).ownerDocument,K=Q.templateEngine||F;if(m.kc.xd(X,K,W),X=K.renderTemplate(X,j,Q,W),typeof X.length!="number"||0<X.length&&typeof X[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(W=!1,V){case"replaceChildren":m.h.va(G,X),W=!0;break;case"replaceNode":m.a.Xc(G,X),W=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+V)}return W&&(b(X,j),Q.afterRender&&m.u.G(Q.afterRender,null,[X,j[Q.as||"$data"]]),V=="replaceChildren"&&m.i.ma(G,m.i.H)),X}function B(G,V,X){return m.O(G)?G():typeof G=="function"?G(V,X):G}var F;m.gc=function(G){if(G!=e&&!(G instanceof m.ca))throw Error("templateEngine must inherit from ko.templateEngine");F=G},m.dc=function(G,V,X,j,Q){if(X=X||{},(X.templateEngine||F)==e)throw Error("Set a template engine before calling renderTemplate");if(Q=Q||"replaceChildren",j){var W=v(j);return m.$(function(){var J=V&&V instanceof m.fa?V:new m.fa(V,null,null,null,{exportDependencies:!0}),K=B(G,J.$data,J),J=I(j,Q,K,J,X);Q=="replaceNode"&&(j=J,W=v(j))},null,{Sa:function(){return!W||!m.a.Sb(W)},l:W&&Q=="replaceNode"?W.parentNode:W})}return m.aa.Xb(function(K){m.dc(G,V,X,K,"replaceNode")})},m.Qd=function(G,V,X,j,Q){function W(fe,Se){m.u.G(m.a.ec,null,[j,fe,J,X,K,Se]),m.i.ma(j,m.i.H)}function K(fe,Se){b(Se,_e),X.afterRender&&X.afterRender(Se,fe),_e=null}function J(fe,Se){_e=Q.createChildContext(fe,{as:xe,noChildContext:X.noChildContext,extend:function(Ve){Ve.$index=Se,xe&&(Ve[xe+"Index"]=Se)}});var we=B(G,fe,_e);return I(j,"ignoreTargetNode",we,_e,X)}var _e,xe=X.as,re=X.includeDestroyed===!1||m.options.foreachHidesDestroyed&&!X.includeDestroyed;if(re||X.beforeRemove||!m.Pc(V))return m.$(function(){var fe=m.a.f(V)||[];typeof fe.length>"u"&&(fe=[fe]),re&&(fe=m.a.jb(fe,function(Se){return Se===e||Se===null||!m.a.f(Se._destroy)})),W(fe)},null,{l:j});W(V.v());var ye=V.subscribe(function(fe){W(V(),fe)},null,"arrayChange");return ye.l(j),ye};var k=m.a.g.Z(),U=m.a.g.Z();m.c.template={init:function(G,V){var X=m.a.f(V());if(typeof X=="string"||"name"in X)m.h.Ea(G);else if("nodes"in X){if(X=X.nodes||[],m.O(X))throw Error('The "nodes" option must be a plain, non-observable array.');var j=X[0]&&X[0].parentNode;j&&m.a.g.get(j,U)||(j=m.a.Yb(X),m.a.g.set(j,U,!0)),new m.C.ia(G).nodes(j)}else if(X=m.h.childNodes(G),0<X.length)j=m.a.Yb(X),new m.C.ia(G).nodes(j);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(G,V,X,j,Q){var W=V();V=m.a.f(W),X=!0,j=null,typeof V=="string"?V={}:(W="name"in V?V.name:G,"if"in V&&(X=m.a.f(V.if)),X&&"ifnot"in V&&(X=!m.a.f(V.ifnot)),X&&!W&&(X=!1)),"foreach"in V?j=m.Qd(W,X&&V.foreach||[],V,G,Q):X?(X=Q,"data"in V&&(X=Q.createChildContext(V.data,{as:V.as,noChildContext:V.noChildContext,exportDependencies:!0})),j=m.dc(W,X,V,G)):m.h.Ea(G),Q=j,(V=m.a.g.get(G,k))&&typeof V.s=="function"&&V.s(),m.a.g.set(G,k,!Q||Q.ja&&!Q.ja()?e:Q)}},m.m.Ra.template=function(G){return G=m.m.ac(G),G.length==1&&G[0].unknown||m.m.Id(G,"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(_,b,v){if(_.length&&b.length){var I,B,F,k,U;for(I=B=0;(!v||I<v)&&(k=_[B]);++B){for(F=0;U=b[F];++F)if(k.value===U.value){k.moved=U.index,U.moved=k.index,b.splice(F,1),I=F=0;break}I+=F}}},m.a.Pb=function(){function _(b,v,I,B,F){var k=Math.min,U=Math.max,G=[],V,X=b.length,j,Q=v.length,W=Q-X||1,K=X+Q+1,J,_e,xe;for(V=0;V<=X;V++)for(_e=J,G.push(J=[]),xe=k(Q,V+W),j=U(0,V-1);j<=xe;j++)J[j]=j?V?b[V-1]===v[j-1]?_e[j-1]:k(_e[j]||K,J[j-1]||K)+1:j+1:V+1;for(k=[],U=[],W=[],V=X,j=Q;V||j;)Q=G[V][j]-1,j&&Q===G[V][j-1]?U.push(k[k.length]={status:I,value:v[--j],index:j}):V&&Q===G[V-1][j]?W.push(k[k.length]={status:B,value:b[--V],index:V}):(--j,--V,F.sparse||k.push({status:"retained",value:v[j]}));return m.a.Kc(W,U,!F.dontLimitMoves&&10*X),k.reverse()}return function(b,v,I){return I=typeof I=="boolean"?{dontLimitMoves:I}:I||{},b=b||[],v=v||[],b.length<v.length?_(b,v,"added","deleted",I):_(v,b,"deleted","added",I)}}(),m.b("utils.compareArrays",m.a.Pb),function(){function _(I,B,F,k,U){var G=[],V=m.$(function(){var X=B(F,U,m.a.Ua(G,I))||[];0<G.length&&(m.a.Xc(G,X),k&&m.u.G(k,null,[F,X,U])),G.length=0,m.a.Nb(G,X)},null,{l:I,Sa:function(){return!m.a.kd(G)}});return{Y:G,$:V.ja()?V:e}}var b=m.a.g.Z(),v=m.a.g.Z();m.a.ec=function(I,B,F,k,U,G){function V(Gt){we={Aa:Gt,pb:m.ta(_e++)},K.push(we),W||Se.push(we)}function X(Gt){we=Q[Gt],_e!==we.pb.v()&&fe.push(we),we.pb(_e++),m.a.Ua(we.Y,I),K.push(we)}function j(Gt,Je){if(Gt)for(var pe=0,me=Je.length;pe<me;pe++)m.a.D(Je[pe].Y,function(be){Gt(be,pe,Je[pe].Aa)})}B=B||[],typeof B.length>"u"&&(B=[B]),k=k||{};var Q=m.a.g.get(I,b),W=!Q,K=[],J=0,_e=0,xe=[],re=[],ye=[],fe=[],Se=[],we,Ve=0;if(W)m.a.D(B,V);else{if(!G||Q&&Q._countWaitingForRemove){var qe=m.a.Mb(Q,function(Gt){return Gt.Aa});G=m.a.Pb(qe,B,{dontLimitMoves:k.dontLimitMoves,sparse:!0})}for(var qe=0,mt,Ht,fn;mt=G[qe];qe++)switch(Ht=mt.moved,fn=mt.index,mt.status){case"deleted":for(;J<fn;)X(J++);Ht===e&&(we=Q[J],we.$&&(we.$.s(),we.$=e),m.a.Ua(we.Y,I).length&&(k.beforeRemove&&(K.push(we),Ve++,we.Aa===v?we=null:ye.push(we)),we&&xe.push.apply(xe,we.Y))),J++;break;case"added":for(;_e<fn;)X(J++);Ht!==e?(re.push(K.length),X(Ht)):V(mt.value)}for(;_e<B.length;)X(J++);K._countWaitingForRemove=Ve}m.a.g.set(I,b,K),j(k.beforeMove,fe),m.a.D(xe,k.beforeRemove?m.oa:m.removeNode);var dt,Tn,Jn;try{Jn=I.ownerDocument.activeElement}catch{}if(re.length)for(;(qe=re.shift())!=e;){for(we=K[qe],dt=e;qe;)if((Tn=K[--qe].Y)&&Tn.length){dt=Tn[Tn.length-1];break}for(B=0;J=we.Y[B];dt=J,B++)m.h.Wb(I,J,dt)}for(qe=0;we=K[qe];qe++){for(we.Y||m.a.extend(we,_(I,F,we.Aa,U,we.pb)),B=0;J=we.Y[B];dt=J,B++)m.h.Wb(I,J,dt);!we.Ed&&U&&(U(we.Aa,we.Y,we.pb),we.Ed=!0,dt=we.Y[we.Y.length-1])}for(Jn&&I.ownerDocument.activeElement!=Jn&&Jn.focus(),j(k.beforeRemove,ye),qe=0;qe<ye.length;++qe)ye[qe].Aa=v;j(k.afterMove,fe),j(k.afterAdd,Se)}}(),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(_,b,v,I){return(b=!(9>m.a.W)&&_.nodes?_.nodes():null)?m.a.la(b.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 b=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(v,I,B,F){if(F=F||n,B=B||{},2>b)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var k=v.data("precompiled");return k||(k=v.text()||"",k=o.template(null,"{{ko_with $item.koBindingContext}}"+k+"{{/ko_with}}"),v.data("precompiled",k)),v=[I.$data],I=o.extend({koBindingContext:I},B.templateOptions),I=o.tmpl(k,v,I),I.appendTo(F.createElement("div")),o.fragments={},I},this.createJavaScriptEvaluatorBlock=function(v){return"{{ko_code ((function() { return "+v+" })()) }}"},this.addTemplate=function(v,I){n.write("<script type='text/html' id='"+v+"'>"+I+"<\/script>")},0<b&&(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 cgt=ko;typeof window<"u"?(ko=window.ko,typeof n2<"u"?window.ko=n2:delete window.ko):(ko=global.ko,typeof n2<"u"?global.ko=n2:delete global.ko);var SC=cgt;/**
 * @license
 * Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
 * Copyright (c) Steve Sanderson
 * MIT license
 */var zX="__knockoutObservables",HX="__knockoutSubscribable";function rAe(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=sAe(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===zX||o===HX)&&!(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&&ugt(n,a)}}),e}function sAe(e,t){var n=e[zX];return!n&&t&&(n={},Object.defineProperty(e,zX,{value:n})),n}function lgt(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),rAe.call(i,e,[t]),e}function ugt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=fgt(e,t,i))})}function fgt(e,t,n){var i=dgt(e,n);return i.subscribe(t)}function dgt(e,t){var n=t[HX];if(!n){n=new e.subscribable,Object.defineProperty(t,HX,{value:n});var i={};hgt(t,n,i),mgt(e,t,n,i)}return n}function hgt(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 mgt(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 aAe(e,t){if(!e)return null;var n=sAe(e,!1);return n&&n[t]||null}function pgt(e,t){var n=aAe(e,t);n&&n.valueHasMutated()}function _gt(e){e.track=rAe,e.getObservable=aAe,e.valueHasMutated=pgt,e.defineProperty=lgt}var i2={attachToKo:_gt};var cAe="http://www.w3.org/2000/svg",lAe="cesium-svgPath-svg",ggt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){let i=document.createElementNS(cAe,"svg:svg");i.setAttribute("class",lAe);let o=document.createElementNS(cAe,"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",`${lAe} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},o2=ggt;i2.attachToKo(SC);o2.register(SC);var Ce=SC;function r2(e){u(e)||(e=new vd),this._clock=e,this._eventHelper=new wr,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=Ce.observable($.now()),this.systemTime.equalityComparer=$.equals,this.startTime=Ce.observable(e.startTime),this.startTime.equalityComparer=$.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=Ce.observable(e.stopTime),this.stopTime.equalityComparer=$.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=Ce.observable(e.currentTime),this.currentTime.equalityComparer=$.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=Ce.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=Ce.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=Ce.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=Ce.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=Ce.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),Ce.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(r2.prototype,{clock:{get:function(){return this._clock}}});r2.prototype.synchronize=function(){let e=this._clock;this.systemTime=$.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};r2.prototype.isDestroyed=function(){return!1};r2.prototype.destroy=function(){this._eventHelper.removeAll(),le(this)};var s2=r2;function ygt(){this.canExecute=void 0,this.beforeExecute=void 0,this.afterExecute=void 0,de.throwInstantiationError()}var GX=ygt;var a2={};a2.createCheckbox=function(e,t,n){let i=document.createElement("div"),o=document.createElement("label"),r=document.createElement("input");r.type="checkbox";let s=`checked: ${t}`;return u(n)&&(s+=`, enable: ${n}`),r.setAttribute("data-bind",s),o.appendChild(r),o.appendChild(document.createTextNode(e)),i.appendChild(o),i};a2.createSection=function(e,t,n,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};a2.createRangeInput=function(e,t,n,i,o,r){r=y(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=y(o,"any"),a.setAttribute("data-bind",`valueUpdate: "input", value: ${t}`);let c=document.createElement("div");c.appendChild(a);let l=document.createElement("div");return l.className="cesium-cesiumInspector-slider",l.appendChild(document.createTextNode(e)),l.appendChild(s),l.appendChild(c),l};a2.createButton=function(e,t,n){let i=document.createElement("button");i.type="button",i.textContent=e,i.className="cesium-cesiumInspector-pickButton";let o=`click: ${t}`;return u(n)&&(o+=`, css: {"cesium-cesiumInspector-pickButtonHighlight" : ${n}}`),i.setAttribute("data-bind",o),i};var Ea=a2;function uAe(e,t){this._command=e,t=y(t,y.EMPTY_OBJECT),this.toggled=y(t.toggled,!1),this.tooltip=y(t.tooltip,""),Ce.track(this,["toggled","tooltip"])}Object.defineProperties(uAe.prototype,{command:{get:function(){return this._command}}});var Qy=uAe;function Agt(e,t){t=y(t,!0);let n=new Ae,i=new Ae;function o(){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,Ce.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}var Cn=Agt;function xgt(e,t,n,i,o){return n.call(i,e[t]),Ce.getObservable(e,t).subscribe(n,i,o)}var ta=xgt;var DC="http://www.w3.org/2000/svg",hAe="http://www.w3.org/1999/xlink",oH,c2=z.fromCssColorString("rgba(247,250,255,0.384)"),rH=z.fromCssColorString("rgba(143,191,255,0.216)"),WX=z.fromCssColorString("rgba(153,197,255,0.098)"),sH=z.fromCssColorString("rgba(255,255,255,0.086)"),Cgt=z.fromCssColorString("rgba(255,255,255,0.267)"),Tgt=z.fromCssColorString("rgba(255,255,255,0)"),fAe=z.fromCssColorString("rgba(66,67,68,0.3)"),dAe=z.fromCssColorString("rgba(0,0,0,0.5)");function $y(e){return z.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}var l2={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 ch(e){let t=document.createElementNS(DC,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(ch(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(hAe,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function jX(e,t,n){let i=document.createElementNS(DC,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");let o=document.createElementNS(DC,"tspan");return o.textContent=n,i.appendChild(o),i}function Egt(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}var aH=new z;function jr(e,t){let n=t.alpha,i=1-n;return aH.red=e.red*i+t.red*n,aH.green=e.green*i+t.green*n,aH.blue=e.blue*i+t.blue*n,aH.toCssColorString()}function YX(e,t,n){let i=l2[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 ch(o)}function bgt(e,t,n){let i=l2[n],o=l2.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 ch(r)}function Sgt(e,t){let n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&oH!==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(),c,l;if(t.type==="touchstart"||t.type==="touchmove"?(c=t.touches[0].clientX,l=t.touches[0].clientY):(c=t.clientX,l=t.clientY),!i&&(c>a.right||c<a.left||l<a.top||l>a.bottom))return;let f=e._shuttleRingPointer.getBoundingClientRect(),d=c-o-a.left,p=l-r-a.top,g=Math.atan2(p,d)*180/Math.PI+90;g>180&&(g-=360);let m=n.shuttleRingAngle;i||c<f.right&&c>f.left&&l>f.top&&l<f.bottom?(oH=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<m?n.slower():g>m&&n.faster(),t.preventDefault()}else e===oH&&(oH=void 0),n.shuttleRingDragging=!1}function F_(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=[ta(t,"toggled",this.setToggled,this),ta(t,"tooltip",this.setTooltip,this),ta(t.command,"canExecute",this.setEnabled,this)]}F_.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();le(this)};F_.prototype.isDestroyed=function(){return!1};F_.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")}};F_.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")))};F_.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function MS(e,t){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(DC,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",hAe);let s=document.createElementNS(DC,"g");this._topG=s,this._realtimeSVG=new F_(bgt(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new F_(YX(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new F_(YX(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new F_(YX(84,99,"animation_pathPause"),t.pauseViewModel);let a=document.createElementNS(DC,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);let c=ch({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;let l=l2.animation_pathSwooshFX,f=l2.animation_pathPointer,d=ch({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:l.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:l.d},{tagName:l.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:l.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=d,this._shuttleRingPointer=ch({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:f.tagName,d:f.d});let p=ch({tagName:"g",transform:"translate(100,100)"});this._knobOuter=ch({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});let g=61,m=ch({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=jX(0,-24,""),this._knobTime=jX(0,-7,""),this._knobStatus=jX(0,-41,"");let A=ch({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),x=document.createElementNS(DC,"g");x.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(x),s.appendChild(p),s.appendChild(a),x.appendChild(c),x.appendChild(d),x.appendChild(this._shuttleRingPointer),p.appendChild(this._knobOuter),p.appendChild(m),p.appendChild(this._knobDate),p.appendChild(this._knobTime),p.appendChild(this._knobStatus),p.appendChild(A),r.appendChild(s),e.appendChild(r);let C=this;function T(R){Sgt(C,R)}this._mouseCallback=T,c.addEventListener("mousedown",T,!0),c.addEventListener("touchstart",T,!0),d.addEventListener("mousedown",T,!0),d.addEventListener("touchstart",T,!0),n.addEventListener("mousemove",T,!0),n.addEventListener("touchmove",T,!0),n.addEventListener("mouseup",T,!0),n.addEventListener("touchend",T,!0),n.addEventListener("touchcancel",T,!0),this._shuttleRingPointer.addEventListener("mousedown",T,!0),this._shuttleRingPointer.addEventListener("touchstart",T,!0),this._knobOuter.addEventListener("mousedown",T,!0),this._knobOuter.addEventListener("touchstart",T,!0);let E=this._knobTime.childNodes[0],S=this._knobDate.childNodes[0],D=this._knobStatus.childNodes[0],w;this._subscriptions=[ta(t.pauseViewModel,"toggled",function(R){w!==R&&(w=R,w?C._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):C._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),ta(t,"shuttleRingAngle",function(R){Egt(C._shuttleRingPointer,C._knobOuter,R)}),ta(t,"dateLabel",function(R){S.textContent!==R&&(S.textContent=R)}),ta(t,"timeLabel",function(R){E.textContent!==R&&(E.textContent=R)}),ta(t,"multiplierLabel",function(R){D.textContent!==R&&(D.textContent=R)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(MS.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});MS.prototype.isDestroyed=function(){return!1};MS.prototype.destroy=function(){u(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 le(this)};MS.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,c=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},${c})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*c),this._lastHeight=e,this._lastWidth=t};MS.prototype.applyThemeChanges=function(){let e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(u(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=$y(this._themeNormal),n=$y(this._themeHover),i=$y(this._themeSelect),o=$y(this._themeDisabled),r=$y(this._themeKnob),s=$y(this._themePointer),a=$y(this._themeSwoosh),c=$y(this._themeSwooshHover),l=ch({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":jr(t,c2)},{tagName:"stop",offset:"12%","stop-color":jr(t,rH)},{tagName:"stop",offset:"46%","stop-color":jr(t,WX)},{tagName:"stop",offset:"81%","stop-color":jr(t,sH)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":jr(n,c2)},{tagName:"stop",offset:"12%","stop-color":jr(n,rH)},{tagName:"stop",offset:"46%","stop-color":jr(n,WX)},{tagName:"stop",offset:"81%","stop-color":jr(n,sH)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":jr(i,c2)},{tagName:"stop",offset:"12%","stop-color":jr(i,rH)},{tagName:"stop",offset:"46%","stop-color":jr(i,WX)},{tagName:"stop",offset:"81%","stop-color":jr(i,sH)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":jr(o,Cgt)},{tagName:"stop",offset:"75%","stop-color":jr(o,Tgt)}]},{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":c.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":c.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":c.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":jr(s,dAe)},{tagName:"stop",offset:"100%","stop-color":jr(s,dAe)}]},{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":jr(r,c2)},{tagName:"stop",offset:"60%","stop-color":jr(r,fAe)},{tagName:"stop",offset:"85%","stop-color":jr(r,rH)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":jr(r,fAe)},{tagName:"stop",offset:"60%","stop-color":jr(r,c2)},{tagName:"stop",offset:"85%","stop-color":jr(r,sH)}]}]});u(this._defsElement)?this._svgNode.replaceChild(l,this._defsElement):this._svgNode.appendChild(l),this._defsElement=l};var u2=MS;var Dgt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e0=15,LS=105;function mAe(e,t){return e-t}function qX(e,t){let n=wo(t,e,mAe);return n<0?~n:n}function vgt(e,t){if(Math.abs(e)<=e0)return e/e0;let n=e0,i=LS,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 wgt(e,t,n){if(n.clockStep===uo.SYSTEM_CLOCK)return e0;if(Math.abs(e)<=1)return e*e0;let i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);let o=e0,r=LS,s,a=0,c;return e>0?(s=Math.log(i),c=(s-a)/(r-o),(Math.log(e)-a)/c+o):(s=Math.log(-t[0]),c=(s-a)/(r-o),-((Math.log(Math.abs(e))-a)/c+o))}function Ff(e){let t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=Ff.defaultDateFormatter,this._timeFormatter=Ff.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,Ce.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(Ff.defaultTicks),this.timeLabel=void 0,Ce.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,Ce.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,Ce.defineProperty(this,"multiplierLabel",function(){let s=t._clockViewModel;if(s.clockStep===uo.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,Ce.defineProperty(this,"shuttleRingAngle",{get:function(){return wgt(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,LS),-LS);let a=t._allShuttleRingTicks,c=t._clockViewModel;if(c.clockStep=uo.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===LS){c.multiplier=s>0?a[a.length-1]:a[0];return}let l=vgt(s,a);if(t.snapToTicks)l=a[qX(l,a)];else if(l!==0){let f=Math.abs(l);if(f>100){let d=f.toFixed(0).length-2,p=Math.pow(10,d);l=Math.round(l/p)*p|0}else f>e0?l=Math.round(l):f>1?l=+l.toFixed(1):f>0&&(l=+l.toFixed(2))}c.multiplier=l}}),this._canAnimate=void 0,Ce.defineProperty(this,"_canAnimate",function(){let s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===Br.UNBOUNDED)return!0;let c=s.multiplier,l=s.currentTime,f=s.startTime,d=!1;if(a===Br.LOOP_STOP)d=$.greaterThan(l,f)||l.equals(f)&&c>0;else{let p=s.stopTime;d=$.greaterThan(l,f)&&$.lessThan(l,p)||l.equals(f)&&c>0||l.equals(p)&&c<0}return d||(s.shouldAnimate=!1),d}),this._isSystemTimeAvailable=void 0,Ce.defineProperty(this,"_isSystemTimeAvailable",function(){let s=t._clockViewModel;if(s.clockRange===Br.UNBOUNDED)return!0;let c=s.systemTime;return $.greaterThanOrEquals(c,s.startTime)&&$.lessThanOrEquals(c,s.stopTime)}),this._isAnimating=void 0,Ce.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});let n=Cn(function(){let s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Qy(n,{toggled:Ce.computed(function(){return!t._isAnimating}),tooltip:"Pause"});let i=Cn(function(){let s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Qy(i,{toggled:Ce.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});let o=Cn(function(){let s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Qy(o,{toggled:Ce.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==uo.SYSTEM_CLOCK}),tooltip:"Play Forward"});let r=Cn(function(){t._clockViewModel.clockStep=uo.SYSTEM_CLOCK},Ce.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Qy(r,{toggled:Ce.computed(function(){return e.clockStep===uo.SYSTEM_CLOCK}),tooltip:Ce.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=Cn(function(){let s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,l=qX(c,a)-1;l>=0&&(s.multiplier=a[l])}),this._faster=Cn(function(){let s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,l=qX(c,a)+1;l<a.length&&(s.multiplier=a[l])})}Ff.defaultDateFormatter=function(e,t){let n=$.toGregorianDate(e);return`${Dgt[n.month-1]} ${n.day} ${n.year}`};Ff.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];Ff.defaultTimeFormatter=function(e,t){let n=$.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`};Ff.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};Ff.prototype.setShuttleRingTicks=function(e){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(mAe);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(Ff.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){this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){this._timeFormatter=e}}});Ff._maxShuttleRingAngle=LS;Ff._realtimeShuttleRingAngle=e0;var f2=Ff;function pAe(e){e=y(e,y.EMPTY_OBJECT);let t=e.globe,n=y(e.imageryProviderViewModels,[]),i=y(e.terrainProviderViewModels,[]);this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,Ce.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);let o=Ce.getObservable(this,"imageryProviderViewModels"),r=Ce.pureComputed(function(){let d=o(),p={},g;for(g=0;g<d.length;g++){let x=d[g],C=x.category;u(p[C])?p[C].push(x):p[C]=[x]}let m=Object.keys(p),A=[];for(g=0;g<m.length;g++){let x=m[g];A.push({name:x,providers:p[x]})}return A});this._imageryProviders=r;let s=Ce.getObservable(this,"terrainProviderViewModels"),a=Ce.pureComputed(function(){let d=s(),p={},g;for(g=0;g<d.length;g++){let x=d[g],C=x.category;u(p[C])?p[C].push(x):p[C]=[x]}let m=Object.keys(p),A=[];for(g=0;g<m.length;g++){let x=m[g];A.push({name:x,providers:p[x]})}return A});this._terrainProviders=a,this.buttonTooltip=void 0,Ce.defineProperty(this,"buttonTooltip",function(){let d=this.selectedImagery,p=this.selectedTerrain,g=u(d)?d.name:void 0,m=u(p)?p.name:void 0;return u(g)&&u(m)?`${g}
${m}`:u(g)?g:m}),this.buttonImageUrl=void 0,Ce.defineProperty(this,"buttonImageUrl",function(){let d=this.selectedImagery;if(u(d))return d.iconUrl}),this.selectedImagery=void 0;let c=Ce.observable();this._currentImageryProviders=[],Ce.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(d){if(c()===d){this.dropDownVisible=!1;return}let p,g=this._currentImageryProviders,m=g.length,A=this._globe.imageryLayers,x=!1;for(p=0;p<m;p++){let C=A.length;for(let T=0;T<C;T++){let E=A.get(T);if(E.imageryProvider===g[p]){A.remove(E),x=!0;break}}}if(u(d)){let C=d.creationCommand();if(Array.isArray(C)){let T=C.length;for(p=T-1;p>=0;p--)A.addImageryProvider(C[p],0);this._currentImageryProviders=C.slice(0)}else if(this._currentImageryProviders=[C],x)A.addImageryProvider(C,0);else{let T=A.get(0);u(T)&&A.remove(T),A.addImageryProvider(C,0)}}c(d),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;let l=Ce.observable();Ce.defineProperty(this,"selectedTerrain",{get:function(){return l()},set:function(d){if(l()===d){this.dropDownVisible=!1;return}let p;u(d)&&(p=d.creationCommand()),this._globe.depthTestAgainstTerrain=!(p instanceof A_),this._globe.terrainProvider=p,l(d),this.dropDownVisible=!1}});let f=this;this._toggleDropDown=Cn(function(){f.dropDownVisible=!f.dropDownVisible}),this.selectedImagery=y(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=y(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(pAe.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});var d2=pAe;function cH(e,t){e=In(e);let n=new d2(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 c=document.createElement("div");c.className="cesium-baseLayerPicker-category",a.appendChild(c);let l=document.createElement("div");l.className="cesium-baseLayerPicker-categoryTitle",l.setAttribute("data-bind","text: name"),c.appendChild(l);let f=document.createElement("div");f.className="cesium-baseLayerPicker-choices",f.setAttribute("data-bind","foreach: providers"),c.appendChild(f);let d=document.createElement("div");d.className="cesium-baseLayerPicker-item",d.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(d);let p=document.createElement("img");p.className="cesium-baseLayerPicker-itemIcon",p.setAttribute("data-bind","attr: { src: iconUrl }"),p.setAttribute("draggable","false"),d.appendChild(p);let g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),d.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 A=document.createElement("div");A.className="cesium-baseLayerPicker-section",A.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(A);let x=document.createElement("div");x.className="cesium-baseLayerPicker-category",A.appendChild(x);let C=document.createElement("div");C.className="cesium-baseLayerPicker-categoryTitle",C.setAttribute("data-bind","text: name"),x.appendChild(C);let T=document.createElement("div");T.className="cesium-baseLayerPicker-choices",T.setAttribute("data-bind","foreach: providers"),x.appendChild(T);let E=document.createElement("div");E.className="cesium-baseLayerPicker-item",E.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),T.appendChild(E);let S=document.createElement("img");S.className="cesium-baseLayerPicker-itemIcon",S.setAttribute("data-bind","attr: { src: iconUrl }"),S.setAttribute("draggable","false"),E.appendChild(S);let D=document.createElement("div");D.className="cesium-baseLayerPicker-itemLabel",D.setAttribute("data-bind","text: name"),E.appendChild(D),Ce.applyBindings(n,i),Ce.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(w){i.contains(w.target)||r.contains(w.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(cH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});cH.prototype.isDestroyed=function(){return!1};cH.prototype.destroy=function(){return Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),Ce.cleanNode(this._element),Ce.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),le(this)};var h2=cH;function _Ae(e){let t=e.creationFunction;u(t.canExecute)||(t=Cn(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=y(e.category,""),Ce.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(_Ae.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});var ps=_Ae;function Igt(){let e=[];return e.push(new ps({name:"Bing Maps Aerial",iconUrl:$t("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return D_({style:S_.AERIAL})}})),e.push(new ps({name:"Bing Maps Aerial with Labels",iconUrl:$t("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return D_({style:S_.AERIAL_WITH_LABELS})}})),e.push(new ps({name:"Bing Maps Roads",iconUrl:$t("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return D_({style:S_.ROAD})}})),e.push(new ps({name:"ESRI World Imagery",iconUrl:$t("Widgets/Images/ImageryProviders/esriWorldImagery.png"),tooltip:`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 NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal.  Additionally, imagery at different resolutions has been contributed by the GIS User Community.
http://www.esri.com`,category:"Other",creationFunction:function(){return new T_({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new ps({name:"ESRI World Street Map",iconUrl:$t("Widgets/Images/ImageryProviders/esriWorldStreetMap.png"),tooltip:`This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.
http://www.esri.com`,category:"Other",creationFunction:function(){return new T_({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new ps({name:"ESRI National Geographic",iconUrl:$t("Widgets/Images/ImageryProviders/esriNationalGeographic.png"),tooltip:`This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.
http://www.esri.com`,category:"Other",creationFunction:function(){return new T_({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new ps({name:"Open\xADStreet\xADMap",iconUrl:$t("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 _C({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new ps({name:"Stamen Watercolor",iconUrl:$t("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new _C({url:"https://stamen-tiles.a.ssl.fastly.net/watercolor/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ps({name:"Stamen Toner",iconUrl:$t("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`A high contrast black and white map.
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new _C({url:"https://stamen-tiles.a.ssl.fastly.net/toner/",credit:"Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."})}})),e.push(new ps({name:"Sentinel-2",iconUrl:$t("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 new b_({assetId:3954})}})),e.push(new ps({name:"Blue Marble",iconUrl:$t("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new b_({assetId:3845})}})),e.push(new ps({name:"Earth at night",iconUrl:$t("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 new b_({assetId:3812})}})),e.push(new ps({name:"Natural Earth\xA0II",iconUrl:$t("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return new Fy({url:$t("Assets/Textures/NaturalEarthII")})}})),e}var m2=Igt;function Pgt(){let e=[];return e.push(new ps({name:"WGS84 Ellipsoid",iconUrl:$t("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new A_}})),e.push(new ps({name:"Cesium World Terrain",iconUrl:$t("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 gL({requestWaterMask:!0,requestVertexNormals:!0})}})),e}var p2=Pgt;function Ogt(e){return function(t){let n=e._scene.pick(t.position);u(n)&&n.primitive instanceof Rc&&(e.tileset=n.primitive),e.pickActive=!1}}function yAe(e,t){t?e._eventHandler.setInputAction(function(n){let i=e._scene.pick(n.endPosition);u(i)&&i.primitive instanceof Rc&&(e.tileset=i.primitive)},yn.MOUSE_MOVE):(e._eventHandler.removeInputAction(yn.MOUSE_MOVE),e.picking=e.picking)}var Rgt={maximumFractionDigits:3};function _2(e){let t=e/1048576;return t<1?t.toLocaleString(void 0,Rgt):Math.round(t).toLocaleString()}function g2(e,t){if(!u(e))return"";let n=t?e._statisticsPerPass[qo.PICK]:e._statisticsPerPass[qo.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>${_2(n.geometryByteLength)}</li><li><strong>Texture Memory (MB): </strong>${_2(n.texturesByteLength)}</li><li><strong>Batch Table Memory (MB): </strong>${_2(n.batchTableByteLength)}</li>`,i+="</ul>"),i}function AAe(){let e=Ui.statistics;return`
  <ul class="cesium-cesiumInspector-statistics">
    <li><strong>Geometry Memory (MB): </strong>${_2(e.geometryByteLength)}</li>
    <li><strong>Texture Memory (MB): </strong>${_2(e.texturesByteLength)}</li>
  </ul>
  `}var Bgt=[{text:"Highlight",value:ul.HIGHLIGHT},{text:"Replace",value:ul.REPLACE},{text:"Mix",value:ul.MIX}],gAe=new z(1,1,0,.4),Mgt=new z,lH=new z;function na(e,t){let n=this,i=e.canvas;this._eventHandler=new Tu(i),this._scene=e,this._performanceContainer=t,this._canvas=i,this._performanceDisplay=new P_({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,Ce.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=Ce.observable({}),this.properties=[],Ce.defineProperty(this,"properties",function(){let V=[],X=n._properties();for(let j in X)X.hasOwnProperty(j)&&V.push(j);return V});let o=Ce.observable();Ce.defineProperty(this,"dynamicScreenSpaceError",{get:function(){return o()},set:function(V){o(V),u(n._tileset)&&(n._tileset.dynamicScreenSpaceError=V)}}),this.dynamicScreenSpaceError=!1;let r=Ce.observable();Ce.defineProperty(this,"colorBlendMode",{get:function(){return r()},set:function(V){r(V),u(n._tileset)&&(n._tileset.colorBlendMode=V,n._scene.requestRender())}}),this.colorBlendMode=ul.HIGHLIGHT;let s=Ce.observable(),a=Ce.observable();Ce.defineProperty(this,"picking",{get:function(){return a()},set:function(V){a(V),V?n._eventHandler.setInputAction(function(X){let j=e.pick(X.endPosition);if(j instanceof xs?(n.feature=j,n.tile=j.content.tile):u(j)&&u(j.content)?(n.feature=void 0,n.tile=j.content.tile):(n.feature=void 0,n.tile=void 0),!!u(n._tileset)){if(s&&u(j)&&u(j.content)){let Q;e.pickPositionSupported&&(Q=e.pickPosition(X.endPosition),u(Q)&&(n._tileset.debugPickPosition=Q)),n._tileset.debugPickedTile=j.content.tile}else n._tileset.debugPickedTile=void 0;n._scene.requestRender()}},yn.MOUSE_MOVE):(n.feature=void 0,n.tile=void 0,n._eventHandler.removeInputAction(yn.MOUSE_MOVE))}}),this.picking=!0;let c=Ce.observable();Ce.defineProperty(this,"colorize",{get:function(){return c()},set:function(V){c(V),u(n._tileset)&&(n._tileset.debugColorizeTiles=V,n._scene.requestRender())}}),this.colorize=!1;let l=Ce.observable();Ce.defineProperty(this,"wireframe",{get:function(){return l()},set:function(V){l(V),u(n._tileset)&&(n._tileset.debugWireframe=V,n._scene.requestRender())}}),this.wireframe=!1;let f=Ce.observable();Ce.defineProperty(this,"showBoundingVolumes",{get:function(){return f()},set:function(V){f(V),u(n._tileset)&&(n._tileset.debugShowBoundingVolume=V,n._scene.requestRender())}}),this.showBoundingVolumes=!1;let d=Ce.observable();Ce.defineProperty(this,"showContentBoundingVolumes",{get:function(){return d()},set:function(V){d(V),u(n._tileset)&&(n._tileset.debugShowContentBoundingVolume=V,n._scene.requestRender())}}),this.showContentBoundingVolumes=!1;let p=Ce.observable();Ce.defineProperty(this,"showRequestVolumes",{get:function(){return p()},set:function(V){p(V),u(n._tileset)&&(n._tileset.debugShowViewerRequestVolume=V,n._scene.requestRender())}}),this.showRequestVolumes=!1;let g=Ce.observable();Ce.defineProperty(this,"freezeFrame",{get:function(){return g()},set:function(V){g(V),u(n._tileset)&&(n._tileset.debugFreezeFrame=V,n._scene.debugShowFrustumPlanes=V,n._scene.requestRender())}}),this.freezeFrame=!1,Ce.defineProperty(this,"showOnlyPickedTileDebugLabel",{get:function(){return s()},set:function(V){s(V),u(n._tileset)&&(n._tileset.debugPickedTileLabelOnly=V,n._scene.requestRender())}}),this.showOnlyPickedTileDebugLabel=!1;let m=Ce.observable();Ce.defineProperty(this,"showGeometricError",{get:function(){return m()},set:function(V){m(V),u(n._tileset)&&(n._tileset.debugShowGeometricError=V,n._scene.requestRender())}}),this.showGeometricError=!1;let A=Ce.observable();Ce.defineProperty(this,"showRenderingStatistics",{get:function(){return A()},set:function(V){A(V),u(n._tileset)&&(n._tileset.debugShowRenderingStatistics=V,n._scene.requestRender())}}),this.showRenderingStatistics=!1;let x=Ce.observable();Ce.defineProperty(this,"showMemoryUsage",{get:function(){return x()},set:function(V){x(V),u(n._tileset)&&(n._tileset.debugShowMemoryUsage=V,n._scene.requestRender())}}),this.showMemoryUsage=!1;let C=Ce.observable();Ce.defineProperty(this,"showUrl",{get:function(){return C()},set:function(V){C(V),u(n._tileset)&&(n._tileset.debugShowUrl=V,n._scene.requestRender())}}),this.showUrl=!1;let T=Ce.observable();Ce.defineProperty(this,"maximumScreenSpaceError",{get:function(){return T()},set:function(V){V=Number(V),isNaN(V)||(T(V),u(n._tileset)&&(n._tileset.maximumScreenSpaceError=V))}}),this.maximumScreenSpaceError=16;let E=Ce.observable();Ce.defineProperty(this,"dynamicScreenSpaceErrorDensity",{get:function(){return E()},set:function(V){V=Number(V),isNaN(V)||(E(V),u(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorDensity=V))}}),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorDensitySliderValue=void 0,Ce.defineProperty(this,"dynamicScreenSpaceErrorDensitySliderValue",{get:function(){return Math.pow(E(),1/6)},set:function(V){E(Math.pow(V,6))}});let S=Ce.observable();Ce.defineProperty(this,"dynamicScreenSpaceErrorFactor",{get:function(){return S()},set:function(V){V=Number(V),isNaN(V)||(S(V),u(n._tileset)&&(n._tileset.dynamicScreenSpaceErrorFactor=V))}}),this.dynamicScreenSpaceErrorFactor=4;let D=Ogt(this),w=Ce.observable();Ce.defineProperty(this,"pickActive",{get:function(){return w()},set:function(V){w(V),V?n._eventHandler.setInputAction(D,yn.LEFT_CLICK):n._eventHandler.removeInputAction(yn.LEFT_CLICK)}});let R=Ce.observable();Ce.defineProperty(this,"pointCloudShading",{get:function(){return R()},set:function(V){R(V),u(n._tileset)&&(n._tileset.pointCloudShading.attenuation=V)}}),this.pointCloudShading=!1;let O=Ce.observable();Ce.defineProperty(this,"geometricErrorScale",{get:function(){return O()},set:function(V){V=Number(V),isNaN(V)||(O(V),u(n._tileset)&&(n._tileset.pointCloudShading.geometricErrorScale=V))}}),this.geometricErrorScale=1;let L=Ce.observable();Ce.defineProperty(this,"maximumAttenuation",{get:function(){return L()},set:function(V){V=Number(V),isNaN(V)||(L(V),u(n._tileset)&&(n._tileset.pointCloudShading.maximumAttenuation=V===0?void 0:V))}}),this.maximumAttenuation=0;let N=Ce.observable();Ce.defineProperty(this,"baseResolution",{get:function(){return N()},set:function(V){V=Number(V),isNaN(V)||(N(V),u(n._tileset)&&(n._tileset.pointCloudShading.baseResolution=V===0?void 0:V))}}),this.baseResolution=0;let _=Ce.observable();Ce.defineProperty(this,"eyeDomeLighting",{get:function(){return _()},set:function(V){_(V),u(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLighting=V)}}),this.eyeDomeLighting=!1;let b=Ce.observable();Ce.defineProperty(this,"eyeDomeLightingStrength",{get:function(){return b()},set:function(V){V=Number(V),isNaN(V)||(b(V),u(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingStrength=V))}}),this.eyeDomeLightingStrength=1;let v=Ce.observable();Ce.defineProperty(this,"eyeDomeLightingRadius",{get:function(){return v()},set:function(V){V=Number(V),isNaN(V)||(v(V),u(n._tileset)&&(n._tileset.pointCloudShading.eyeDomeLightingRadius=V))}}),this.eyeDomeLightingRadius=1,this.pickActive=!1;let I=Ce.observable();Ce.defineProperty(this,"skipLevelOfDetail",{get:function(){return I()},set:function(V){I(V),u(n._tileset)&&(n._tileset.skipLevelOfDetail=V)}}),this.skipLevelOfDetail=!0;let B=Ce.observable();Ce.defineProperty(this,"skipScreenSpaceErrorFactor",{get:function(){return B()},set:function(V){V=Number(V),isNaN(V)||(B(V),u(n._tileset)&&(n._tileset.skipScreenSpaceErrorFactor=V))}}),this.skipScreenSpaceErrorFactor=16;let F=Ce.observable();Ce.defineProperty(this,"baseScreenSpaceError",{get:function(){return F()},set:function(V){V=Number(V),isNaN(V)||(F(V),u(n._tileset)&&(n._tileset.baseScreenSpaceError=V))}}),this.baseScreenSpaceError=1024;let k=Ce.observable();Ce.defineProperty(this,"skipLevels",{get:function(){return k()},set:function(V){V=Number(V),isNaN(V)||(k(V),u(n._tileset)&&(n._tileset.skipLevels=V))}}),this.skipLevels=1;let U=Ce.observable();Ce.defineProperty(this,"immediatelyLoadDesiredLevelOfDetail",{get:function(){return U()},set:function(V){U(V),u(n._tileset)&&(n._tileset.immediatelyLoadDesiredLevelOfDetail=V)}}),this.immediatelyLoadDesiredLevelOfDetail=!1;let G=Ce.observable();Ce.defineProperty(this,"loadSiblings",{get:function(){return G()},set:function(V){G(V),u(n._tileset)&&(n._tileset.loadSiblings=V)}}),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()}),u(this._tileset)||yAe(this,!0)}Object.defineProperties(na.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 Bgt}},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,u(e)){let t=this;e.readyPromise.then(function(r){t.isDestroyed()||t._properties(r.properties)});let n=["colorize","wireframe","showBoundingVolumes","showContentBoundingVolumes","showRequestVolumes","freezeFrame","showOnlyPickedTileDebugLabel","showGeometricError","showRenderingStatistics","showMemoryUsage","showUrl"],i=n.length;for(let r=0;r<i;++r){let s=n[r];this[s]=this[s]}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 o=e.pointCloudShading;this.pointCloudShading=o.attenuation,this.geometricErrorScale=o.geometricErrorScale,this.maximumAttenuation=o.maximumAttenuation?o.maximumAttenuation:0,this.baseResolution=o.baseResolution?o.baseResolution:0,this.eyeDomeLighting=o.eyeDomeLighting,this.eyeDomeLightingStrength=o.eyeDomeLightingStrength,this.eyeDomeLightingRadius=o.eyeDomeLightingRadius,this._scene.requestRender()}else this._properties({});this._statisticsText=g2(e,!1),this._pickStatisticsText=g2(e,!0),this._resourceCacheStatisticsText=AAe(),yAe(this,!1)}},feature:{get:function(){return this._feature},set:function(e){if(this._feature===e)return;let t=this._feature;u(t)&&!t.content.isDestroyed()&&(!this.colorize&&u(this._style)?t.color=u(this._style.color)?this._style.color.evaluateColor(t,Mgt):z.WHITE:t.color=lH,this._scene.requestRender()),u(e)&&(z.clone(e.color,lH),e.color=gAe,this._scene.requestRender()),this._feature=e}},tile:{get:function(){return this._tile},set:function(e){if(this._tile===e)return;let t=this._tile;u(t)&&!t.isDestroyed()&&!XX(t.content)&&(t.color=lH,this._scene.requestRender()),u(e)&&!XX(e.content)&&(z.clone(e.color,lH),e.color=gAe,this._scene.requestRender()),this._tile=e}}});function XX(e){if(!u(e))return!1;if(e.featuresLength>0)return!0;let t=e.innerContents;if(u(t)){let n=t.length;for(let i=0;i<n;++i)if(!XX(t[i]))return!1;return!0}return!1}na.prototype.togglePickTileset=function(){this.pickActive=!this.pickActive};na.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible};na.prototype.toggleTileset=function(){this.tilesetVisible=!this.tilesetVisible};na.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible};na.prototype.toggleUpdate=function(){this.updateVisible=!this.updateVisible};na.prototype.toggleLogging=function(){this.loggingVisible=!this.loggingVisible};na.prototype.toggleStyle=function(){this.styleVisible=!this.styleVisible};na.prototype.toggleTileDebugLabels=function(){this.tileDebugLabelsVisible=!this.tileDebugLabelsVisible};na.prototype.toggleOptimization=function(){this.optimizationVisible=!this.optimizationVisible};na.prototype.trimTilesCache=function(){u(this._tileset)&&this._tileset.trimLoadedTiles()};na.prototype.compileStyle=function(){let e=this._tileset;if(!(!u(e)||this.styleString===JSON.stringify(e.style))){this._editorError="";try{this.styleString.length===0&&(this.styleString="{}"),this._style=new fC(JSON.parse(this.styleString)),this._shouldStyle=!0,this._scene.requestRender()}catch(t){this._editorError=t.toString()}this.feature=this._feature,this.tile=this._tile}};na.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(`
`),c=a.length,l;if(t.shiftKey)for(l=0;l<c;++l)a[l][0]===" "&&(a[l][1]===" "?(a[l]=a[l].substr(2),r-=2):(a[l]=a[l].substr(1),r-=1));else for(l=0;l<c;++l)a[l]=`  ${a[l]}`,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};na.prototype._update=function(){let e=this._tileset;if(this.performance&&this._performanceDisplay.update(),u(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=g2(e,!1),this._pickStatisticsText=g2(e,!0),this._resourceCacheStatisticsText=AAe())};na.prototype.isDestroyed=function(){return!1};na.prototype.destroy=function(){this._eventHandler.destroy(),this._removePostRenderEvent();let e=this;return this._definedProperties.forEach(function(t){Ce.getObservable(e,t).dispose()}),le(this)};na.getStatistics=g2;var y2=na;function uH(e,t){e=In(e);let n=document.createElement("div"),i=document.createElement("div");i.setAttribute("data-bind","visible: performance");let o=new y2(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=Ea.createSection,c=Ea.createCheckbox,l=Ea.createRangeInput,f=Ea.createButton,d=a(s,"Tileset","tilesetVisible","toggleTileset"),p=a(s,"Display","displayVisible","toggleDisplay"),g=a(s,"Update","updateVisible","toggleUpdate"),m=a(s,"Logging","loggingVisible","toggleLogging"),A=a(s,"Tile Debug Labels","tileDebugLabelsVisible","toggleTileDebugLabels"),x=a(s,"Style","styleVisible","toggleStyle"),C=a(s,"Optimization","optimizationVisible","toggleOptimization"),T=document.createElement("div");T.className="field-group";let E=document.createElement("label");E.className="field-label",E.appendChild(document.createTextNode("Properties: "));let S=document.createElement("div");S.setAttribute("data-bind","text: properties"),T.appendChild(E),T.appendChild(S),d.appendChild(T),d.appendChild(f("Pick Tileset","togglePickTileset","pickActive")),d.appendChild(f("Trim Tiles Cache","trimTilesCache")),d.appendChild(c("Enable Picking","picking")),p.appendChild(c("Colorize","colorize"));let D=p.appendChild(c("Wireframe","wireframe","_tileset === undefined || hasEnabledWireframe")),w=document.createElement("p");w.setAttribute("data-bind","visible: _tileset !== undefined && !hasEnabledWireframe"),w.setAttribute("class","cesium-3DTilesInspector-disabledElementsInfo"),w.innerText="Set enableDebugWireframe to true in the tileset constructor to enable this option.",D.appendChild(w),p.appendChild(c("Bounding Volumes","showBoundingVolumes")),p.appendChild(c("Content Volumes","showContentBoundingVolumes")),p.appendChild(c("Request Volumes","showRequestVolumes")),p.appendChild(c("Point Cloud Shading","pointCloudShading"));let R=document.createElement("div");R.setAttribute("data-bind","visible: pointCloudShading"),R.appendChild(l("Geometric Error Scale","geometricErrorScale",0,2,.01)),R.appendChild(l("Maximum Attenuation","maximumAttenuation",0,32,1)),R.appendChild(l("Base Resolution","baseResolution",0,1,.01)),R.appendChild(c("Eye Dome Lighting (EDL)","eyeDomeLighting")),p.appendChild(R);let O=document.createElement("div");O.setAttribute("data-bind","visible: eyeDomeLighting"),O.appendChild(l("EDL Strength","eyeDomeLightingStrength",0,2,.1)),O.appendChild(l("EDL Radius","eyeDomeLightingRadius",0,4,.1)),R.appendChild(O),g.appendChild(c("Freeze Frame","freezeFrame")),g.appendChild(c("Dynamic Screen Space Error","dynamicScreenSpaceError"));let L=document.createElement("div");L.appendChild(l("Maximum Screen Space Error","maximumScreenSpaceError",0,128,1)),g.appendChild(L);let N=document.createElement("div");N.setAttribute("data-bind","visible: dynamicScreenSpaceError"),N.appendChild(l("Screen Space Error Density","dynamicScreenSpaceErrorDensitySliderValue",0,1,.005,"dynamicScreenSpaceErrorDensity")),N.appendChild(l("Screen Space Error Factor","dynamicScreenSpaceErrorFactor",1,10,.1)),g.appendChild(N),m.appendChild(c("Performance","performance")),m.appendChild(i),m.appendChild(c("Statistics","showStatistics"));let _=document.createElement("div");_.className="cesium-3dTilesInspector-statistics",_.setAttribute("data-bind","html: statisticsText, visible: showStatistics"),m.appendChild(_),m.appendChild(c("Pick Statistics","showPickStatistics"));let b=document.createElement("div");b.className="cesium-3dTilesInspector-statistics",b.setAttribute("data-bind","html: pickStatisticsText, visible: showPickStatistics"),m.appendChild(b),m.appendChild(c("Resource Cache Statistics","showResourceCacheStatistics"));let v=document.createElement("div");v.className="cesium-3dTilesInspector-statistics",v.setAttribute("data-bind","html: resourceCacheStatisticsText, visible: showResourceCacheStatistics"),m.appendChild(v);let I=document.createElement("div");x.appendChild(I),I.appendChild(document.createTextNode("Color Blend Mode: "));let B=document.createElement("select");B.setAttribute("data-bind",'options: colorBlendModes, optionsText: "text", optionsValue: "value", value: colorBlendMode'),I.appendChild(B);let F=document.createElement("textarea");F.setAttribute("data-bind","textInput: styleString, event: { keydown: styleEditorKeyPress }"),I.className="cesium-cesiumInspector-styleEditor",I.appendChild(F);let k=f("Compile (Ctrl+Enter)","compileStyle");I.appendChild(k);let U=document.createElement("div");U.className="cesium-cesiumInspector-error",U.setAttribute("data-bind","text: editorError"),I.appendChild(U),A.appendChild(c("Show Picked Only","showOnlyPickedTileDebugLabel")),A.appendChild(c("Geometric Error","showGeometricError")),A.appendChild(c("Rendering Statistics","showRenderingStatistics")),A.appendChild(c("Memory Usage (MB)","showMemoryUsage")),A.appendChild(c("Url","showUrl")),C.appendChild(c("Skip Tile LODs","skipLevelOfDetail"));let G=document.createElement("div");G.appendChild(l("Skip SSE Factor","skipScreenSpaceErrorFactor",1,50,1)),C.appendChild(G);let V=document.createElement("div");V.appendChild(l("SSE before skipping LOD","baseScreenSpaceError",0,4096,1)),C.appendChild(V);let X=document.createElement("div");X.appendChild(l("Min. levels to skip","skipLevels",0,10,1)),C.appendChild(X),C.appendChild(c("Load only tiles that meet the max SSE.","immediatelyLoadDesiredLevelOfDetail")),C.appendChild(c("Load siblings of visible tiles","loadSiblings")),Ce.applyBindings(o,n)}Object.defineProperties(uH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});uH.prototype.isDestroyed=function(){return!1};uH.prototype.destroy=function(){return Ce.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),le(this)};var A2=uH;function Lgt(e){let t;if(u(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 c=Math.pow(2,a);o>=c&&(s.push(a+1),o-=c)}r=s.reverse().join(" and ")}t+=`<br>&nbsp;&nbsp;&nbsp;&nbsp;${n[i]} in frustum ${r}`}t+=`<br>Total: ${e.totalCommands}`}return t}function KX(e,t,n){let i=Math.min(n,t);return i=Math.max(i,e),i}var Ngt=new wn,Fgt=new h;function x2(e,t){let n=this,i=e.canvas,o=new Tu(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="",Ce.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=Cn(function(){n.dropDownVisible=!n.dropDownVisible}),this._toggleGeneral=Cn(function(){n.generalVisible=!n.generalVisible}),this._togglePrimitives=Cn(function(){n.primitivesVisible=!n.primitivesVisible}),this._toggleTerrain=Cn(function(){n.terrainVisible=!n.terrainVisible}),this._frustumsSubscription=Ce.getObservable(this,"frustums").subscribe(function(l){n._scene.debugShowFrustums=l,n._scene.requestRender()}),this._frustumPlanesSubscription=Ce.getObservable(this,"frustumPlanes").subscribe(function(l){n._scene.debugShowFrustumPlanes=l,n._scene.requestRender()}),this._performanceSubscription=Ce.getObservable(this,"performance").subscribe(function(l){l?n._performanceDisplay=new P_({container:n._performanceContainer}):n._performanceContainer.innerHTML=""}),this._showPrimitiveBoundingSphere=Cn(function(){return n._primitive.debugShowBoundingVolume=n.primitiveBoundingSphere,n._scene.requestRender(),!0}),this._primitiveBoundingSphereSubscription=Ce.getObservable(this,"primitiveBoundingSphere").subscribe(function(){n._showPrimitiveBoundingSphere()}),this._showPrimitiveReferenceFrame=Cn(function(){if(n.primitiveReferenceFrame){let l=n._primitive.modelMatrix;n._modelMatrixPrimitive=new xF({modelMatrix:l}),n._scene.primitives.add(n._modelMatrixPrimitive)}else u(n._modelMatrixPrimitive)&&(n._scene.primitives.remove(n._modelMatrixPrimitive),n._modelMatrixPrimitive=void 0);return n._scene.requestRender(),!0}),this._primitiveReferenceFrameSubscription=Ce.getObservable(this,"primitiveReferenceFrame").subscribe(function(){n._showPrimitiveReferenceFrame()}),this._doFilterPrimitive=Cn(function(){return n.filterPrimitive?n._scene.debugCommandFilter=function(l){return u(n._modelMatrixPrimitive)&&l.owner===n._modelMatrixPrimitive._primitive?!0:u(n._primitive)?l.owner===n._primitive||l.owner===n._primitive._billboardCollection||l.owner.primitive===n._primitive:!1}:n._scene.debugCommandFilter=void 0,!0}),this._filterPrimitiveSubscription=Ce.getObservable(this,"filterPrimitive").subscribe(function(){n._doFilterPrimitive(),n._scene.requestRender()}),this._wireframeSubscription=Ce.getObservable(this,"wireframe").subscribe(function(l){r._surface.tileProvider._debug.wireframe=l,n._scene.requestRender()}),this._depthFrustumSubscription=Ce.getObservable(this,"depthFrustum").subscribe(function(l){n._scene.debugShowDepthFrustum=l,n._scene.requestRender()}),this._incrementDepthFrustum=Cn(function(){let l=n.depthFrustum+1;return n.depthFrustum=KX(1,n._numberOfFrustums,l),n._scene.requestRender(),!0}),this._decrementDepthFrustum=Cn(function(){let l=n.depthFrustum-1;return n.depthFrustum=KX(1,n._numberOfFrustums,l),n._scene.requestRender(),!0}),this._suspendUpdatesSubscription=Ce.getObservable(this,"suspendUpdates").subscribe(function(l){r._surface._debug.suspendLodUpdate=l,l||(n.filterTile=!1)});let s;this._showTileCoordinates=Cn(function(){return n.tileCoordinates&&!u(s)?s=e.imageryLayers.addImageryProvider(new LF({tilingScheme:e.terrainProvider.tilingScheme})):!n.tileCoordinates&&u(s)&&(e.imageryLayers.remove(s),s=void 0),!0}),this._tileCoordinatesSubscription=Ce.getObservable(this,"tileCoordinates").subscribe(function(){n._showTileCoordinates(),n._scene.requestRender()}),this._tileBoundingSphereSubscription=Ce.getObservable(this,"tileBoundingSphere").subscribe(function(){n._showTileBoundingSphere(),n._scene.requestRender()}),this._showTileBoundingSphere=Cn(function(){return n.tileBoundingSphere?r._surface.tileProvider._debug.boundingSphereTile=n._tile:r._surface.tileProvider._debug.boundingSphereTile=void 0,n._scene.requestRender(),!0}),this._doFilterTile=Cn(function(){return n.filterTile?(n.suspendUpdates=!0,r._surface._tilesToRender=[],u(n._tile)&&n._tile.renderable&&r._surface._tilesToRender.push(n._tile)):n.suspendUpdates=!1,!0}),this._filterTileSubscription=Ce.getObservable(this,"filterTile").subscribe(function(){n.doFilterTile(),n._scene.requestRender()});function a(l){let f=n._scene.pick({x:l.position.x,y:l.position.y});u(f)&&(n.primitive=u(f.collection)?f.collection:f.primitive),n._scene.requestRender(),n.pickPrimitiveActive=!1}this._pickPrimitive=Cn(function(){n.pickPrimitiveActive=!n.pickPrimitiveActive}),this._pickPrimitiveActiveSubscription=Ce.getObservable(this,"pickPrimitiveActive").subscribe(function(l){l?o.setInputAction(a,yn.LEFT_CLICK):o.removeInputAction(yn.LEFT_CLICK)});function c(l){let f,d=r.ellipsoid,p=n._scene.camera.getPickRay(l.position,Ngt),g=r.pick(p,n._scene,Fgt);if(u(g)){let m=d.cartesianToCartographic(g),A=r._surface.tileProvider._tilesToRenderByTextureCount;for(let x=0;!f&&x<A.length;++x){let C=A[x];if(u(C))for(let T=0;!f&&T<C.length;++T){let E=C[T];ce.contains(E.rectangle,m)&&(f=E)}}}n.tile=f,n.pickTileActive=!1}this._pickTile=Cn(function(){n.pickTileActive=!n.pickTileActive}),this._pickTileActiveSubscription=Ce.getObservable(this,"pickTileActive").subscribe(function(l){l?o.setInputAction(c,yn.LEFT_CLICK):o.removeInputAction(yn.LEFT_CLICK)}),this._removePostRenderEvent=e.postRender.addEventListener(function(){n._update()})}Object.defineProperties(x2.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 Cn(function(){e.tile=e.tile.parent})}},selectNW:{get:function(){let e=this;return Cn(function(){e.tile=e.tile.northwestChild})}},selectNE:{get:function(){let e=this;return Cn(function(){e.tile=e.tile.northeastChild})}},selectSW:{get:function(){let e=this;return Cn(function(){e.tile=e.tile.southwestChild})}},selectSE:{get:function(){let e=this;return Cn(function(){e.tile=e.tile.southeastChild})}},primitive:{get:function(){return this._primitive},set:function(e){let t=this._primitive;e!==t&&(this.hasPickedPrimitive=!0,u(t)&&(t.debugShowBoundingVolume=!1),this._scene.debugCommandFilter=void 0,u(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(u(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;u(n)&&u(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}}});x2.prototype._update=function(){this.frustums&&(this.frustumStatisticText=Lgt(this._scene.debugFrustumStatistics));let e=this._scene.numberOfFrustums;this._numberOfFrustums=e,this.depthFrustum=KX(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}`};x2.prototype.isDestroyed=function(){return!1};x2.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(),le(this)};var C2=x2;function fH(e,t){e=In(e);let n=document.createElement("div"),i=new C2(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=Ea.createSection,c=Ea.createCheckbox,l=a(s,"General","generalVisible","toggleGeneral"),f=c("Show Frustums","frustums"),d=document.createElement("div");d.className="cesium-cesiumInspector-frustumStatistics",d.setAttribute("data-bind","visible: frustums, html: frustumStatisticText"),f.appendChild(d),l.appendChild(f),l.appendChild(c("Show Frustum Planes","frustumPlanes")),l.appendChild(c("Performance Display","performance")),n.className="cesium-cesiumInspector-performanceDisplay",l.appendChild(n);let p=document.createElement("div");p.className="cesium-cesiumInspector-shaderCache",p.setAttribute("data-bind","html: shaderCacheText"),l.appendChild(p);let g=document.createElement("div");l.appendChild(g);let m=document.createElement("span");m.setAttribute("data-bind",'html: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frustum:"'),g.appendChild(m);let A=document.createElement("span");A.setAttribute("data-bind","text: depthFrustumText"),g.appendChild(A);let x=document.createElement("input");x.type="button",x.value="-",x.className="cesium-cesiumInspector-pickButton",x.setAttribute("data-bind","click: decrementDepthFrustum"),g.appendChild(x);let C=document.createElement("input");C.type="button",C.value="+",C.className="cesium-cesiumInspector-pickButton",C.setAttribute("data-bind","click: incrementDepthFrustum"),g.appendChild(C);let T=a(s,"Primitives","primitivesVisible","togglePrimitives"),E=document.createElement("div");E.className="cesium-cesiumInspector-pickSection",T.appendChild(E);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 D=document.createElement("div");D.className="cesium-cesiumInspector-center",D.appendChild(S),E.appendChild(D),E.appendChild(c("Show bounding sphere","primitiveBoundingSphere","hasPickedPrimitive")),E.appendChild(c("Show reference frame","primitiveReferenceFrame","hasPickedPrimitive")),this._primitiveOnly=c("Show only selected","filterPrimitive","hasPickedPrimitive"),E.appendChild(this._primitiveOnly);let w=a(s,"Terrain","terrainVisible","toggleTerrain"),R=document.createElement("div");R.className="cesium-cesiumInspector-pickSection",w.appendChild(R);let O=document.createElement("input");O.type="button",O.value="Pick a tile",O.className="cesium-cesiumInspector-pickButton",O.setAttribute("data-bind",'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'),D=document.createElement("div"),D.appendChild(O),D.className="cesium-cesiumInspector-center",R.appendChild(D);let L=document.createElement("div");R.appendChild(L);let N=document.createElement("input");N.type="button",N.value="Parent",N.className="cesium-cesiumInspector-pickButton",N.setAttribute("data-bind","click: selectParent");let _=document.createElement("input");_.type="button",_.value="NW",_.className="cesium-cesiumInspector-pickButton",_.setAttribute("data-bind","click: selectNW");let b=document.createElement("input");b.type="button",b.value="NE",b.className="cesium-cesiumInspector-pickButton",b.setAttribute("data-bind","click: selectNE");let v=document.createElement("input");v.type="button",v.value="SW",v.className="cesium-cesiumInspector-pickButton",v.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 B=document.createElement("div");B.className="cesium-cesiumInspector-tileText",L.className="cesium-cesiumInspector-frustumStatistics",L.appendChild(B),L.setAttribute("data-bind","visible: hasPickedTile"),B.setAttribute("data-bind","html: tileText");let F=document.createElement("div");F.className="cesium-cesiumInspector-relativeText",F.textContent="Select relative:",L.appendChild(F);let k=document.createElement("table"),U=document.createElement("tr"),G=document.createElement("tr"),V=document.createElement("td");V.appendChild(N);let X=document.createElement("td");X.appendChild(_);let j=document.createElement("td");j.appendChild(b),U.appendChild(V),U.appendChild(X),U.appendChild(j);let Q=document.createElement("td"),W=document.createElement("td");W.appendChild(v);let K=document.createElement("td");K.appendChild(I),G.appendChild(Q),G.appendChild(W),G.appendChild(K),k.appendChild(U),k.appendChild(G),L.appendChild(k),R.appendChild(c("Show bounding volume","tileBoundingSphere","hasPickedTile")),R.appendChild(c("Show only selected","filterTile","hasPickedTile")),w.appendChild(c("Wireframe","wireframe")),w.appendChild(c("Suspend LOD update","suspendUpdates")),w.appendChild(c("Show tile coordinates","tileCoordinates")),Ce.applyBindings(i,this._element)}Object.defineProperties(fH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});fH.prototype.isDestroyed=function(){return!1};fH.prototype.destroy=function(){return Ce.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),le(this)};var T2=fH;var xAe=1e3;function bm(e){u(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new tL,new hL({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._geocodePromise=void 0,this._complete=new Ae,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=TAe,this._handleArrowUp=CAe;let t=this;this._suggestionsVisible=Ce.pureComputed(function(){let o=Ce.getObservable(t,"_suggestions")().length>0,r=Ce.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=Cn(function(i){if(i=y(i,By.SEARCH),t._focusTextbox=!1,u(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;t.hideSuggestions(),t.isSearchInProgress?Ggt(t):zgt(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?CAe(t):r?TAe(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;let o=i.destination;bAe(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=y(e.autocomplete,!0),this.destinationFound=y(e.destinationFound,bm.flyToDestination),this._focusTextbox=!1,Ce.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);let n=Ce.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){bm._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,Ce.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,Ce.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){this._searchText=i}}),this.flightDuration=void 0,Ce.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){this._flightDuration=i}})}Object.defineProperties(bm.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}}});bm.prototype.destroy=function(){this._suggestionSubscription.dispose()};function CAe(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],bm._adjustSuggestionsScroll(e,n)}function TAe(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],bm._adjustSuggestionsScroll(e,i)}function Vgt(e,t){let n=u(t)?t.availability:void 0;return u(n)?u_(t,[e]).then(function(i){return e=i[0],e.height+=xAe,e}):(e.height+=xAe,Promise.resolve(e))}function Ugt(e,t){let n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider,a=t,c;return t instanceof ce?P.equalsEpsilon(t.south,t.north,P.EPSILON7)&&P.equalsEpsilon(t.east,t.west,P.EPSILON7)?t=ce.center(t):c=bC(t,n):t=o.cartesianToCartographic(t),u(c)||(c=Vgt(t,s)),c.then(function(l){a=o.cartographicToCartesian(l)}).finally(function(){r.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:M.IDENTITY})})}function kgt(e,t,n,i){return e.then(function(o){return u(o)&&o.state==="fulfilled"&&o.value.length>0?o:t.geocode(n,i).then(function(s){return{state:"fulfilled",value:s}}).catch(function(s){return{state:"rejected",reason:s}})})}function zgt(e,t,n){let i=e._searchText;if(EAe(i)){e.showSuggestions();return}e._isSearchInProgress=!0;let o=Promise.resolve();for(let r=0;r<t.length;r++)o=kgt(o,t[r],i,n);e._geocodePromise=o,o.then(function(r){if(o.cancel)return;e._isSearchInProgress=!1;let s=r.value;if(r.state==="fulfilled"&&u(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);return}e._searchText=`${i} (not found)`})}function Hgt(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 Ggt(e){e._isSearchInProgress=!1,u(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function EAe(e){return/^\s*$/.test(e)}function bAe(e){Ce.getObservable(e,"_suggestions").removeAll()}function Wgt(e){if(!e.autoComplete)return;let t=e._searchText;if(bAe(e),EAe(t))return;let n=Promise.resolve([]);return e._geocoderServices.forEach(function(i){n=n.then(function(o){return o.length>=5?o:i.geocode(t,By.AUTOCOMPLETE).then(function(r){return o=o.concat(r),o})})}),n.then(function(i){let o=e._suggestions;for(let r=0;r<i.length;r++)o.push(i[r])})}bm.flyToDestination=Ugt;bm._updateSearchSuggestions=Wgt;bm._adjustSuggestionsScroll=Hgt;var E2=bm;var jgt="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",Ygt="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 dH(e){let t=In(e.container),n=new E2(e);n._startSearchPath=jgt,n._stopSearchPath=Ygt;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 c=document.createElement("li");a.appendChild(c),c.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),Ce.applyBindings(n,i),Ce.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(l){let f=l.target;typeof l.composedPath=="function"&&(f=l.composedPath()[0]),t.contains(f)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(l){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(dH.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});dH.prototype.isDestroyed=function(){return!1};dH.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(),Ce.cleanNode(this._form),Ce.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),le(this)};var b2=dH;function SAe(e,t){this._scene=e,this._duration=t;let n=this;this._command=Cn(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",Ce.track(this,["tooltip"])}Object.defineProperties(SAe.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){this._duration=e}}});var S2=SAe;function hH(e,t,n){e=In(e);let i=new S2(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),Ce.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(hH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});hH.prototype.isDestroyed=function(){return!1};hH.prototype.destroy=function(){return Ce.cleanNode(this._element),this._container.removeChild(this._element),le(this)};var D2=hH;function mH(e,t){u(t)||(t=document.body),t=In(t);let n=this,i=Ce.observable(fr.fullscreen),o=Ce.observable(fr.enabled),r=t.ownerDocument;this.isFullscreen=void 0,Ce.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,Ce.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&fr.enabled)}}),this.tooltip=void 0,Ce.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=Cn(function(){fr.fullscreen?fr.exitFullscreen():fr.requestFullscreen(n._fullscreenElement)},Ce.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=y(In(e),r.body),this._callback=function(){i(fr.fullscreen)},r.addEventListener(fr.changeEventName,this._callback)}Object.defineProperties(mH.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){this._fullscreenElement=e}},command:{get:function(){return this._command}}});mH.prototype.isDestroyed=function(){return!1};mH.prototype.destroy=function(){document.removeEventListener(fr.changeEventName,this._callback),le(this)};var v2=mH;var qgt="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",Xgt="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 pH(e,t){e=In(e);let n=new v2(t,e);n._exitFullScreenPath=Xgt,n._enterFullScreenPath=qgt;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),Ce.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(pH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});pH.prototype.isDestroyed=function(){return!1};pH.prototype.destroy=function(){return this._viewModel.destroy(),Ce.cleanNode(this._element),this._container.removeChild(this._element),le(this)};var w2=pH;var Kgt="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",Zgt="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 ZX(){this._cameraClicked=new Ae,this._closeClicked=new Ae,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",Ce.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,Ce.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?Zgt:Kgt}}),Ce.defineProperty(this,"_bodyless",{get:function(){return!u(this.description)||this.description.length===0}})}ZX.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(ZX.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});var I2=ZX;function _H(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 I2;Ce.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 c=r.contentDocument,l=c.createElement("link");l.href=$t("Widgets/InfoBox/InfoBoxDescription.css"),l.rel="stylesheet",l.type="text/css";let f=c.createElement("div");f.className="cesium-infoBox-description",c.head.appendChild(l),c.body.appendChild(f),a._descriptionSubscription=ta(s,"description",function(d){r.style.height="5px",f.innerHTML=d;let p=null,g=f.firstElementChild;if(g!==null&&f.childNodes.length===1){let A=window.getComputedStyle(g);if(A!==null){let x=A["background-color"],C=z.fromCssColorString(x);u(C)&&C.alpha!==0&&(p=A["background-color"])}}t.style["background-color"]=p;let m=f.getBoundingClientRect().height;r.style.height=`${m}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(_H.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});_H.prototype.isDestroyed=function(){return!1};_H.prototype.destroy=function(){let e=this._container;return Ce.cleanNode(this._element),e.removeChild(this._element),u(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),le(this)};var P2=_H;function DAe(){this.showInstructions=!1;let e=this;this._command=Cn(function(){e.showInstructions=!e.showInstructions}),this._showClick=Cn(function(){e._touch=!1}),this._showTouch=Cn(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",Ce.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(DAe.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});var O2=DAe;function gH(e){let t=In(e.container),n=new O2,i=y(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 c=document.createElement("img");c.src=$t("Widgets/Images/NavigationHelp/Mouse.svg"),c.className="cesium-navigation-button-icon",c.style.width="25px",c.style.height="25px",a.appendChild(c),a.appendChild(document.createTextNode("Mouse"));let l=document.createElement("button");l.type="button",l.className="cesium-navigation-button cesium-navigation-button-right",l.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');let f=document.createElement("img");f.src=$t("Widgets/Images/NavigationHelp/Touch.svg"),f.className="cesium-navigation-button-icon",f.style.width="25px",f.style.height="25px",l.appendChild(f),l.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(l);let d=document.createElement("div");d.className="cesium-click-navigation-help cesium-navigation-help-instructions",d.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),d.innerHTML=`            <table>                <tr>                    <td><img src="${$t("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="${$t("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="${$t("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(d);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="${$t("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="${$t("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="${$t("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="${$t("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),Ce.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(gH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});gH.prototype.isDestroyed=function(){return!1};gH.prototype.destroy=function(){return Vt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),Ce.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),le(this)};var R2=gH;function JX(e){this._scene=e.scene,this.lowFrameRateMessage=y(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,Ce.track(this,["lowFrameRateMessage","lowFrameRateMessageDismissed","showingLowFrameRateMessage"]);let t=this;this._dismissMessage=Cn(function(){t.showingLowFrameRateMessage=!1,t.lowFrameRateMessageDismissed=!0});let n=EF.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(JX.prototype,{scene:{get:function(){return this._scene}},dismissMessage:{get:function(){return this._dismissMessage}}});JX.prototype.destroy=function(){return this._unsubscribeLowFrameRate(),this._unsubscribeNominalFrameRate(),le(this)};var B2=JX;function yH(e){let t=In(e.container),n=new B2(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),Ce.applyBindings(n,i),this._container=t,this._viewModel=n,this._element=i}Object.defineProperties(yH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});yH.prototype.isDestroyed=function(){return!1};yH.prototype.destroy=function(){return this._viewModel.destroy(),Ce.cleanNode(this._element),this._container.removeChild(this._element),le(this)};var M2=yH;function AH(e){this._scene=e,this._orthographic=e.camera.frustum instanceof en,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,Ce.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);let t=this;Ce.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=Cn(function(){t.sceneMode===te.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new wr,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===te.SCENE2D||t._scene.camera.frustum instanceof en}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=u(e.camera._currentFlight)}),this._switchToPerspective=Cn(function(){t.sceneMode!==te.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=Cn(function(){t.sceneMode!==te.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=te}Object.defineProperties(AH.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}}});AH.prototype.isDestroyed=function(){return!1};AH.prototype.destroy=function(){this._eventHelper.removeAll(),le(this)};var L2=AH;var Jgt="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",Qgt="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 xH(e,t){e=In(e);let n=new L2(t);n._perspectivePath=Jgt,n._orthographicPath=Qgt;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),Ce.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(xH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});xH.prototype.isDestroyed=function(){return!1};xH.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)),Ce.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),le(this)};var N2=xH;function CH(e,t){this._scene=e;let n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new wr,this._eventHelper.add(e.morphStart,i),this._duration=y(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",Ce.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,Ce.defineProperty(this,"selectedTooltip",function(){let o=n.sceneMode;return o===te.SCENE2D?n.tooltip2D:o===te.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=Cn(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=Cn(function(){e.morphTo2D(n._duration)}),this._morphTo3D=Cn(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=Cn(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=te}Object.defineProperties(CH.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){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}}});CH.prototype.isDestroyed=function(){return!1};CH.prototype.destroy=function(){this._eventHelper.removeAll(),le(this)};var F2=CH;var $gt="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",eyt="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",tyt="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 TH(e,t,n){e=In(e);let i=new F2(t,n);i._globePath=$gt,i._flatMapPath=eyt,i._columbusViewPath=tyt;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 c=document.createElement("button");c.type="button",c.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",c.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(c),Ce.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(l){o.contains(l.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(TH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});TH.prototype.isDestroyed=function(){return!1};TH.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)),Ce.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),le(this)};var V2=TH;var nyt=new H,EH="-1000px";function U2(e,t,n){this._scene=e,this._screenPositionX=EH,this._screenPositionY=EH,this._tweens=e.tweens,this._container=y(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,Ce.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,Ce.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&u(this.position)}}),Ce.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return qi.wgs84ToWindowCoordinates(e,i,o)}}U2.prototype.update=function(){if(this.showSelection&&u(this.position)){let e=this.computeScreenSpacePosition(this.position,nyt);if(!u(e))this._screenPositionX=EH,this._screenPositionY=EH;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`}}};U2.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:Mr.EXPONENTIAL_OUT})};U2.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:Mr.EXPONENTIAL_OUT})};Object.defineProperties(U2.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});var k2=U2;function bH(e,t){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 c=new k2(t,this._element,this._container);this._viewModel=c,Ce.applyBindings(this._viewModel,this._element)}Object.defineProperties(bH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});bH.prototype.isDestroyed=function(){return!1};bH.prototype.destroy=function(){let e=this._container;return Ce.cleanNode(this._element),e.removeChild(this._element),le(this)};var z2=bH;function vC(e,t,n){this._color=e,this._height=t,this._base=y(n,0)}vC.prototype.getHeight=function(){return this._height};vC.prototype.getBase=function(){return this._base};vC.prototype.getStartTime=function(){return this._start};vC.prototype.getStopTime=function(){return this._stop};vC.prototype.setRange=function(e,t){this._start=e,this._stop=t};vC.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){let n=$.secondsDifference(this._start,e.epochJulian),i=Math.round(e.timeBarWidth*e.getAlpha(n)),o=$.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 H2=vC;function vAe(e,t,n,i){this.interval=e,this.height=t,this.color=n||new z(.5,.5,.5,1),this.backgroundColor=i||new z(0,0,0,0)}vAe.prototype.render=function(e,t){let n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=$.addSeconds(t.startJulian,t.duration,new $);if($.lessThan(n,o)&&$.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if($.lessThanOrEquals(n,r)&&$.greaterThanOrEquals(i,o)){let s,a,c;for(s=0;s<t.timeBarWidth;++s){let l=$.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new $);!u(a)&&$.greaterThanOrEquals(l,n)?a=s:!u(c)&&$.greaterThanOrEquals(l,i)&&(c=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),u(a)&&(u(c)||(c=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(c-a,1),this.height))}};var G2=vAe;var QX=1e12,Vf={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},Xc={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},t0=[.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],iyt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Kc(e,t){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=Vf.none,this._touchMode=Xc.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=oyt(this),this._onMouseUp=ryt(this),this._onMouseMove=syt(this),this._onMouseWheel=ayt(this),this._onTouchStart=cyt(this),this._onTouchMove=uyt(this),this._onTouchEnd=lyt(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()}Kc.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};Kc.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};Kc.prototype.isDestroyed=function(){return!1};Kc.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),le(this)};Kc.prototype.addHighlightRange=function(e,t,n){let i=new H2(e,t,n);return this._highlightRanges.push(i),this.resize(),i};Kc.prototype.addTrack=function(e,t,n,i){let o=new G2(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};Kc.prototype.zoomTo=function(e,t){if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=$.secondsDifference(t,e),this._clock&&this._clock.clockRange!==Br.UNBOUNDED){let i=this._clock.startTime,o=this._clock.stopTime,r=$.secondsDifference(o,i),s=$.secondsDifference(i,this._startJulian),a=$.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=$.addSeconds(this._endJulian,s,new $),this._startJulian=i,this._timeBarSecondsSpan=$.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=$.addSeconds(this._startJulian,a,new $),this._endJulian=o,this._timeBarSecondsSpan=$.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)};Kc.prototype.zoomFrom=function(e){let t=$.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($.addSeconds(this._startJulian,t-t*e,new $),$.addSeconds(this._endJulian,n*e-n,new $))};function $X(e){return e<10?`0${e.toString()}`:e.toString()}Kc.prototype.makeLabel=function(e){let t=$.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`${iyt[t.month-1]} ${t.day} ${t.year} ${$X(t.hour)}:${$X(t.minute)}:${$X(t.second)}${i}`};Kc.prototype.smallestTicInPixels=7;Kc.prototype._makeTics=function(){let e=this._timeBarEle,t=$.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,c=31536e6,l=1e-10,f=0,d=this._timeBarSecondsSpan;d<a?(d=a,this._timeBarSecondsSpan=a,this._endJulian=$.addSeconds(this._startJulian,a,new $)):d>c&&(d=c,this._timeBarSecondsSpan=c,this._endJulian=$.addSeconds(this._startJulian,c,new $));let p=this._timeBarEle.clientWidth;p<10&&(p=10);let g=this._startJulian,m=Math.min(d/p*1e-5,.4),A,x=$.toGregorianDate(g);d>31536e4?A=$.fromDate(new Date(Date.UTC(Math.floor(x.year/100)*100,0))):d>31536e3?A=$.fromDate(new Date(Date.UTC(Math.floor(x.year/10)*10,0))):d>86400?A=$.fromDate(new Date(Date.UTC(x.year,0))):A=$.fromDate(new Date(Date.UTC(x.year,x.month,x.day)));let C=$.secondsDifference(this._startJulian,$.addSeconds(A,m,new $)),T=C+d;this._epochJulian=A;function E(V){return Math.floor(C/V)*V}function S(V,X){return Math.ceil(V/X+.5)*X}function D(V){return(V-C)/d}function w(V,X){return V-X*Math.round(V/X)}this._rulerEle.innerHTML=this.makeLabel($.addSeconds(this._endJulian,-a,new $));let R=this._rulerEle.offsetWidth+20;R<30&&(R=180);let O=f;f-=l;let L={startTime:C,startJulian:g,epochJulian:A,duration:d,timeBarWidth:p,getAlpha:D};this._highlightRanges.forEach(function(V){s+=V.render(L)});let N=0,_=0,b=0,v=R/p;v>1&&(v=1),v*=this._timeBarSecondsSpan;let I=-1,B=-1,F=t0.length,k;for(k=0;k<F;++k){let V=t0[k];if(++I,N=V,V>v&&V>f)break;B<0&&p*(V/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(B=I)}if(I>0){for(;I>0;)if(--I,Math.abs(w(N,t0[I]))<1e-5){t0[I]>=f&&(_=t0[I]);break}if(B>=0)for(;B<I;){if(Math.abs(w(_,t0[B]))<1e-5&&t0[B]>=f){b=t0[B];break}++B}}f=O,f>l&&b<1e-5&&Math.abs(f-N)>l&&(b=f,f<=N+l&&(_=0));let U=-999999,G;if(p*(b/this._timeBarSecondsSpan)>=3)for(o=E(b);o<=T;o=S(o,b))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(p*D(o)).toString()}px;"></span>`;if(p*(_/this._timeBarSecondsSpan)>=3)for(o=E(_);o<=T;o=S(o,_))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(p*D(o)).toString()}px;"></span>`;if(p*(N/this._timeBarSecondsSpan)>=2){this._mainTicSpan=N,T+=N,o=E(N);let V=$.computeTaiMinusUtc(A);for(;o<=T;){let X=$.addSeconds(g,o-C,new $);if(N>2.1){let K=$.computeTaiMinusUtc(X);Math.abs(K-V)>.1&&(o+=K-V,X=$.addSeconds(g,o-C,new $))}let j=Math.round(p*D(o)),Q=this.makeLabel(X);this._rulerEle.innerHTML=Q,G=this._rulerEle.offsetWidth,G<10&&(G=R);let W=j-(G/2-1);W>U?(U=W+G+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${j.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${W.toString()}px;">${Q}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${j.toString()}px;"></span>`,o=S(o,N)}}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(V){V.render(r._context,L),L.y+=V.height})};Kc.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;let e=this._scrubElement;if(u(this._scrubElement)){let t=$.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`)}u(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo($.addSeconds(this._startJulian,this._timelineDrag,new $),$.addSeconds(this._endJulian,this._timelineDrag,new $)))};Kc.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=$.addSeconds(this._startJulian,t,new $),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 oyt(e){return function(t){e._mouseMode!==Vf.touchOnly&&(t.button===0?(e._mouseMode=Vf.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=Vf.zoom:e._mouseMode=Vf.slide)),t.preventDefault()}}function ryt(e){return function(t){e._mouseMode=Vf.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function syt(e){return function(t){let n;if(e._mouseMode===Vf.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===Vf.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){let i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo($.addSeconds(e._startJulian,i,new $),$.addSeconds(e._endJulian,i,new $))}}else e._mouseMode===Vf.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function ayt(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;QX=Math.max(Math.min(Math.abs(n),QX),1),n/=QX,e.zoomFrom(Math.pow(1.05,-n))}}function cyt(e){return function(t){let n=t.touches.length,i,o,r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=Vf.touchOnly,n===1?(i=$.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=Xc.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=Xc.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=Xc.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=Xc.ignore}}function lyt(e){return function(t){let n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===Xc.singleTap?(e._touchMode=Xc.scrub,e._onTouchMove(t)):e._touchMode===Xc.scrub&&e._onTouchMove(t),e._mouseMode=Vf.touchOnly,n!==1?e._touchMode=n>0?Xc.ignore:Xc.none:e._touchMode===Xc.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function uyt(e){return function(t){let n,i,o,r,s,a,c=1,l=e._topDiv.getBoundingClientRect().left;e._touchMode===Xc.singleTap&&(e._touchMode=Xc.slideZoom),e._mouseMode=Vf.touchOnly,e._touchMode===Xc.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-l,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===Xc.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-l,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-l,s=0),u(r)&&(s>0&&e._touchState.spanX>0?(c=e._touchState.spanX/s,a=$.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new $)):(n=e._touchState.centerX-r,a=$.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new $)),e.zoomTo(a,$.addSeconds(a,e._timeBarSecondsSpan*c,new $)),e._touchState.centerX=r,e._touchState.spanX=s))}}Kc.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 W2=Kc;var RAe=vo(OAe(),1);function hyt(e){let t=!1,n=window.screen;return u(n)&&(u(n.lockOrientation)?t=n.lockOrientation(e):u(n.mozLockOrientation)?t=n.mozLockOrientation(e):u(n.msLockOrientation)?t=n.msLockOrientation(e):u(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function BAe(){let e=window.screen;u(e)&&(u(e.unlockOrientation)?e.unlockOrientation():u(e.mozUnlockOrientation)?e.mozUnlockOrientation():u(e.msUnlockOrientation)?e.msUnlockOrientation():u(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function myt(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(BAe(),e._locked=!1),e._noSleep.disable(),fr.exitFullscreen(),n(!1)):(fr.fullscreen||fr.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=hyt("landscape")),t.useWebVR=!0,n(!0)))}function SH(e,t){let n=this,i=Ce.observable(fr.enabled),o=Ce.observable(!1);this.isVRMode=void 0,Ce.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,Ce.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&fr.enabled)}}),this.tooltip=void 0,Ce.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});let r=Ce.observable(!1);this._isOrthographic=void 0,Ce.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new wr,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof en)}),this._locked=!1,this._noSleep=new RAe.default,this._command=Cn(function(){myt(n,e,o,r)},Ce.getObservable(this,"isVREnabled")),this._vrElement=y(In(t),document.body),this._callback=function(){!fr.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(BAe(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(fr.changeEventName,this._callback)}Object.defineProperties(SH.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){this._vrElement=e}},command:{get:function(){return this._command}}});SH.prototype.isDestroyed=function(){return!1};SH.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(fr.changeEventName,this._callback),le(this)};var j2=SH;var pyt="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",_yt="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 DH(e,t,n){e=In(e);let i=new j2(t,n);i._exitVRPath=_yt,i._enterVRPath=pyt;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),Ce.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(DH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});DH.prototype.isDestroyed=function(){return!1};DH.prototype.destroy=function(){return this._viewModel.destroy(),Ce.cleanNode(this._element),this._container.removeChild(this._element),le(this)};var Y2=DH;var n0=new se;function NAe(e){let t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function gyt(e){let t=e.getPropertyIds(),n="";return t.forEach(function(i){let o=e.getProperty(i);u(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 yyt(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(u(r)&&r!=="")return r}return"Unnamed Feature"}function MAe(e,t){let n=e.scene.pick(t.position);if(u(n)){let i=y(n.id,n.primitive.id);if(i instanceof jo)return i;if(n instanceof xs)return new jo({name:yyt(n),description:gyt(n),feature:n})}if(u(e.scene.globe))return Cyt(e,t.position)}var Ayt=new $;function FAe(e,t,n){if(u(n)){let i=n.clock;if(u(i)&&(i.getValue(t),u(e))){let o=i.startTime,r=i.stopTime;$.equals(o,r)&&(r=$.addSeconds(o,P.EPSILON2,Ayt)),e.updateFromClock(),e.zoomTo(o,r)}}}var xyt=new h;function Cyt(e,t){let n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!u(o))return;let r=new jo({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!u(s)||s.length===0){e.selectedEntity=LAe();return}let a=s[0],c=new jo({id:a.name,description:a.description});if(u(a.position)){let l=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,xyt);c.position=new Sc(l)}e.selectedEntity=c},function(){e.selectedEntity===r&&(e.selectedEntity=LAe())}),r}function LAe(){return new jo({id:"None",description:"No features found."})}function Tyt(e,t){let n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,c=e._timeline,l=e._fullscreenButton,f=e._infoBox,d=e._selectionIndicator,p=t?"hidden":"visible";if(u(n)&&(n.container.style.visibility=p),u(i)&&(i.container.style.visibility=p),u(o)&&(o.container.style.visibility=p),u(r)&&(r.container.style.visibility=p),u(s)&&(s.container.style.visibility=p),u(a)&&(a.container.style.visibility=p),u(c)&&(c.container.style.visibility=p),u(l)&&l.viewModel.isFullscreenEnabled&&(l.container.style.visibility=p),u(f)&&(f.container.style.visibility=p),u(d)&&(d.container.style.visibility=p),e._container){let g=t||!u(l)?0:l.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function Pi(e,t){e=In(e),t=y(t,y.EMPTY_OBJECT);let n=(!u(t.globe)||t.globe!==!1)&&(!u(t.baseLayerPicker)||t.baseLayerPicker!==!1),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=y(t.scene3DOnly,!1),c,l,f=!1;u(t.clockViewModel)?(l=t.clockViewModel,c=l.clock):(c=new vd,l=new s2(c),f=!0),u(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);let d=new hF(r,{imageryProvider:n||u(t.imageryProvider)?!1:void 0,clock:c,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,useBrowserRecommendedResolution:t.useBrowserRecommendedResolution,creditContainer:u(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,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=t.dataSources,g=!1;u(p)||(p=new _B,g=!0);let m=d.scene,A=new nM({scene:m,dataSourceCollection:p}),x=new wr;x.add(c.onTick,Pi.prototype._onTick,this),x.add(m.morphStart,Pi.prototype._clearTrackedObject,this);let C;if(!u(t.selectionIndicator)||t.selectionIndicator!==!1){let j=document.createElement("div");j.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(j),C=new z2(j,m)}let T;if(!u(t.infoBox)||t.infoBox!==!1){let j=document.createElement("div");j.className="cesium-viewer-infoBoxContainer",o.appendChild(j),T=new P2(j);let Q=T.viewModel;x.add(Q.cameraClicked,Pi.prototype._onInfoBoxCameraClicked,this),x.add(Q.closeClicked,Pi.prototype._onInfoBoxClockClicked,this)}let E=document.createElement("div");E.className="cesium-viewer-toolbar",o.appendChild(E);let S;if(!u(t.geocoder)||t.geocoder!==!1){let j=document.createElement("div");j.className="cesium-viewer-geocoderContainer",E.appendChild(j);let Q;u(t.geocoder)&&typeof t.geocoder!="boolean"&&(Q=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),S=new b2({container:j,geocoderServices:Q,scene:m}),x.add(S.viewModel.search.beforeExecute,Pi.prototype._clearObjects,this)}let D;(!u(t.homeButton)||t.homeButton!==!1)&&(D=new D2(E,m),u(S)&&x.add(D.viewModel.command.afterExecute,function(){let j=S.viewModel;j.searchText="",j.isSearchInProgress&&j.search()}),x.add(D.viewModel.command.beforeExecute,Pi.prototype._clearTrackedObject,this));let w;!a&&(!u(t.sceneModePicker)||t.sceneModePicker!==!1)&&(w=new V2(E,m));let R;t.projectionPicker&&(R=new N2(E,m));let O,L;if(n){let j=y(t.imageryProviderViewModels,m2()),Q=y(t.terrainProviderViewModels,p2());O=new h2(E,{globe:m.globe,imageryProviderViewModels:j,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:Q,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),L=E.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}u(t.imageryProvider)&&t.imageryProvider!==!1&&(n&&(O.viewModel.selectedImagery=void 0),m.imageryLayers.removeAll(),m.imageryLayers.addImageryProvider(t.imageryProvider)),u(t.terrainProvider)&&(n&&(O.viewModel.selectedTerrain=void 0),m.terrainProvider=t.terrainProvider);let N;if(!u(t.navigationHelpButton)||t.navigationHelpButton!==!1){let j=!0;try{if(u(window.localStorage)){let Q=window.localStorage.getItem("cesium-hasSeenNavHelp");u(Q)&&Boolean(Q)?j=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}N=new R2({container:E,instructionsInitiallyVisible:y(t.navigationInstructionsInitiallyVisible,j)})}let _;if(!u(t.animation)||t.animation!==!1){let j=document.createElement("div");j.className="cesium-viewer-animationContainer",o.appendChild(j),_=new u2(j,new f2(l))}let b;if(!u(t.timeline)||t.timeline!==!1){let j=document.createElement("div");j.className="cesium-viewer-timelineContainer",o.appendChild(j),b=new W2(j,c),b.addEventListener("settime",NAe,!1),b.zoomTo(c.startTime,c.stopTime)}let v,I,B;(!u(t.fullscreenButton)||t.fullscreenButton!==!1)&&(B=document.createElement("div"),B.className="cesium-viewer-fullscreenContainer",o.appendChild(B),v=new w2(B,t.fullscreenElement),I=ta(v.viewModel,"isFullscreenEnabled",function(j){B.style.display=j?"block":"none",u(b)&&(b.container.style.right=`${B.clientWidth}px`,b.resize())}));let F,k,U;if(t.vrButton){let j=document.createElement("div");j.className="cesium-viewer-vrContainer",o.appendChild(j),F=new Y2(j,m,t.fullScreenElement),k=ta(F.viewModel,"isVREnabled",function(Q){j.style.display=Q?"block":"none",u(v)&&(j.style.right=`${B.clientWidth}px`),u(b)&&(b.container.style.right=`${j.clientWidth}px`,b.resize())}),U=ta(F.viewModel,"isVRMode",function(Q){Tyt(i,Q)})}this._baseLayerPickerDropDown=L,this._fullscreenSubscription=I,this._vrSubscription=k,this._vrModeSubscription=U,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=y(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=d,this._selectionIndicator=C,this._infoBox=T,this._dataSourceCollection=p,this._destroyDataSourceCollection=g,this._dataSourceDisplay=A,this._clockViewModel=l,this._destroyClockViewModel=f,this._toolbar=E,this._homeButton=D,this._sceneModePicker=w,this._projectionPicker=R,this._baseLayerPicker=O,this._navigationHelpButton=N,this._animation=_,this._timeline=b,this._fullscreenButton=v,this._vrButton=F,this._geocoder=S,this._eventHelper=x,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=u(T)||u(C),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new Ae,this._trackedEntityChanged=new Ae,Ce.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),x.add(p.dataSourceAdded,Pi.prototype._onDataSourceAdded,this),x.add(p.dataSourceRemoved,Pi.prototype._onDataSourceRemoved,this),x.add(m.postUpdate,Pi.prototype.resize,this),x.add(m.postRender,Pi.prototype._postRender,this);let G=p.length;for(let j=0;j<G;j++)this._dataSourceAdded(p,p.get(j));this._dataSourceAdded(void 0,A.defaultDataSource),x.add(p.dataSourceAdded,Pi.prototype._dataSourceAdded,this),x.add(p.dataSourceRemoved,Pi.prototype._dataSourceRemoved,this);function V(j){let Q=MAe(i,j);u(Q)?Y.getValueOrUndefined(Q.position,i.clock.currentTime)?i.trackedEntity=Q:i.zoomTo(Q):u(i.trackedEntity)&&(i.trackedEntity=void 0)}function X(j){i.selectedEntity=MAe(i,j)}d.screenSpaceEventHandler.setInputAction(X,yn.LEFT_CLICK),d.screenSpaceEventHandler.setInputAction(V,yn.LEFT_DOUBLE_CLICK)}Object.defineProperties(Pi.prototype,{container:{get:function(){return this._container}},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._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},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}},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._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,vH(this);let t=this.scene,n=t.mode;!u(e)||!u(e.position)?(this._needTrackedEntityUpdate=!1,(n===te.COLUMBUS_VIEW||n===te.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===te.COLUMBUS_VIEW||n===te.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(M.IDENTITY)):this._needTrackedEntityUpdate=!0,this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;let t=u(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;u(e)?u(t)&&t.animateAppear():u(t)&&t.animateDepart(),this._selectedEntityChanged.raiseEvent(e)}}},selectedEntityChanged:{get:function(){return this._selectedEntityChanged}},trackedEntityChanged:{get:function(){return this._trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,FAe(this._timeline,this.clock,e))}}});Pi.prototype.extend=function(e,t){e(this,t)};Pi.prototype.resize=function(){let e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=u(this._animation),r=u(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;let s=i-125,a=this._baseLayerPickerDropDown;if(u(a)&&(a.style.maxHeight=`${s}px`),u(this._geocoder)){let g=this._geocoder.searchSuggestionsContainer;g.style.maxHeight=`${s}px`}u(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);let c=this._timeline,l,f=0,d=0,p=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){let g=this._lastWidth;l=this._animation.container,n>900?(f=169,g<=900&&(l.style.width="169px",l.style.height="112px",this._animation.resize())):n>=600?(f=136,(g<600||g>900)&&(l.style.width="136px",l.style.height="90px",this._animation.resize())):(f=106,(g>600||g===0)&&(l.style.width="106px",l.style.height="70px",this._animation.resize())),d=f+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){let g=this._fullscreenButton,m=this._vrButton,A=c.container,x=A.style;p=A.clientHeight+3,x.left=`${f}px`;let C=0;u(g)&&(C+=g.container.clientWidth),u(m)&&(C+=m.container.clientWidth),x.right=`${C}px`,c.resize()}this._bottomContainer.style.left=`${d}px`,this._bottomContainer.style.bottom=`${p}px`,this._lastWidth=n,this._lastHeight=i};Pi.prototype.forceResize=function(){this._lastWidth=0,this.resize()};Pi.prototype.render=function(){this._cesiumWidget.render()};Pi.prototype.isDestroyed=function(){return!1};Pi.prototype.destroy=function(){let e;this.screenSpaceEventHandler.removeInputAction(yn.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(yn.LEFT_DOUBLE_CLICK);let t=this.dataSources,n=t.length;for(e=0;e<n;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),u(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),u(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),u(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),u(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),u(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),u(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),u(this._timeline)&&(this._timeline.removeEventListener("settime",NAe,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),u(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),u(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),u(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),u(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._destroyClockViewModel&&(this._clockViewModel=this._clockViewModel.destroy()),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),this._cesiumWidget=this._cesiumWidget.destroy(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),le(this)};Pi.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(Pi.prototype._onEntityCollectionChanged,this)};Pi.prototype._dataSourceRemoved=function(e,t){let n=t.entities;n.collectionChanged.removeEventListener(Pi.prototype._onEntityCollectionChanged,this),u(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),u(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};Pi.prototype._onTick=function(e){let t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);let i=this._entityView;if(u(i)){let f=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(f,!1,n0)===at.DONE&&i.update(t,n0)}let o,r=!1,s=this.selectedEntity,a=u(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,n0)!==at.FAILED?o=n0.center:u(s.position)&&(o=s.position.getValue(t,o)),r=u(o));let c=u(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;u(c)&&(c.position=h.clone(o,c.position),c.showSelection=a&&r,c.update());let l=u(this._infoBox)?this._infoBox.viewModel:void 0;u(l)&&(l.showInfo=a,l.enableCamera=r,l.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(l.titleText=y(s.name,s.id),l.description=Y.getValueOrDefault(s.description,t,"")):(l.titleText="",l.description=""))};Pi.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),this.selectedEntity===r&&(this.selectedEntity=void 0)}};Pi.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{let n=this.selectedEntity.position;u(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};Pi.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};Pi.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};Pi.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};Pi.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&FAe(this.timeline,this.clock,e)};Pi.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);let n=t.entities.id,i=this._eventHelper.add(t.changedEvent,Pi.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};Pi.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}};Pi.prototype.zoomTo=function(e,t){return VAe(this,e,{offset:t},!1)};Pi.prototype.flyTo=function(e,t){return VAe(this,e,t,!0)};function VAe(e,t,n,i){vH(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 bu){r.getViewableRectangle().then(function(s){return bC(s,e.scene)}).then(function(s){e._zoomPromise===o&&(e._zoomTarget=s)});return}if(r instanceof Rc||r instanceof IS||r instanceof BS){e._zoomTarget=r;return}if(r.isLoading&&u(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=y(r.values,r),u(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function NS(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function vH(e){let t=e._zoomPromise;u(t)&&(NS(e),e._completeZoom(!1))}Pi.prototype._postRender=function(){Eyt(this),byt(this)};function Eyt(e){let t=e._zoomTarget;if(!u(t)||e.scene.mode===te.MORPHING)return;let n=e.scene,i=n.camera,o=y(e._zoomOptions,{}),r;if(t instanceof Rc||t instanceof BS)return t.readyPromise.then(function(){let l=t.boundingSphere;u(o.offset)||(o.offset=new uu(0,-.5,l.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(l,o.offset),i.lookAtTransform(M.IDENTITY),e._completeZoom(!0)),NS(e)}).catch(()=>{vH(e)});if(t instanceof IS)return t.readyPromise.then(function(){let l=t.boundingSphere;u(o.offset)||(o.offset=new uu(0,-.5,l.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(l,r):(i.viewBoundingSphere(l,o.offset),i.lookAtTransform(M.IDENTITY),e._completeZoom(!0)),NS(e)});if(t instanceof he){r={destination:n.mapProjection.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)),NS(e);return}let s=t,a=[];for(let l=0,f=s.length;l<f;l++){let d=e._dataSourceDisplay.getBoundingSphere(s[l],!1,n0);if(d===at.PENDING)return;d!==at.FAILED&&a.push(se.clone(n0))}if(a.length===0){vH(e);return}e.trackedEntity=void 0;let c=se.fromBoundingSpheres(a);e._zoomIsFlight?(NS(e),i.flyToBoundingSphere(c,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(c,o.offset),i.lookAtTransform(M.IDENTITY),NS(e),e._completeZoom(!0))}function byt(e){if(!e._needTrackedEntityUpdate)return;let t=e._trackedEntity,n=e.clock.currentTime,i=Y.getValueOrUndefined(t.position,n);if(!u(i))return;let o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,n0);if(r===at.PENDING)return;let s=o.mode;(s===te.COLUMBUS_VIEW||s===te.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===te.COLUMBUS_VIEW||s===te.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);let a=r!==at.FAILED?n0:void 0;e._entityView=new oM(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}var iK=Pi;function Syt(e){let t=document.createElement("div");t.className="cesium-viewer-cesium3DTilesInspectorContainer",e.container.appendChild(t);let n=new A2(t,e.scene);Object.defineProperties(e,{cesium3DTilesInspector:{get:function(){return n}}})}var oK=Syt;function Dyt(e){let t=document.createElement("div");t.className="cesium-viewer-cesiumInspectorContainer",e.container.appendChild(t);let n=new T2(t,e.scene);Object.defineProperties(e,{cesiumInspector:{get:function(){return n}}})}var rK=Dyt;function vyt(e,t){t=y(t,y.EMPTY_OBJECT);let n=!0,i=y(t.flyToOnDrop,!0),o=new Ae,r=y(t.clearOnDrop,!0),s=y(t.dropTarget,e.container),a=y(t.clampToGround,!0),c=t.proxy;s=In(s),Object.defineProperties(e,{dropTarget:{get:function(){return s},set:function(f){UAe(s,l),s=f,sK(s,l)}},dropEnabled:{get:function(){return n},set:function(f){f!==n&&(f?sK(s,l):UAe(s,l),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 c},set:function(f){c=f}},clampToGround:{get:function(){return a},set:function(f){a=f}}});function l(f){wC(f),r&&(e.entities.removeAll(),e.dataSources.removeAll());let d=f.dataTransfer.files,p=d.length;for(let g=0;g<p;g++){let m=d[g],A=new FileReader;A.onload=wyt(e,m,c,a),A.onerror=Iyt(e,m),A.readAsText(m)}}sK(s,l),e.destroy=xL(e,e.destroy,function(){e.dropEnabled=!1}),e._handleDrop=l}function wC(e){e.stopPropagation(),e.preventDefault()}function UAe(e,t){let n=e;u(n)&&(n.removeEventListener("drop",t,!1),n.removeEventListener("dragenter",wC,!1),n.removeEventListener("dragover",wC,!1),n.removeEventListener("dragexit",wC,!1))}function sK(e,t){e.addEventListener("drop",t,!1),e.addEventListener("dragenter",wC,!1),e.addEventListener("dragover",wC,!1),e.addEventListener("dragexit",wC,!1)}function wyt(e,t,n,i){let o=e.scene;return function(r){let s=t.name;try{let a;if(/\.czml$/i.test(s))a=pB.load(JSON.parse(r.target.result),{sourceUri:s});else if(/\.geojson$/i.test(s)||/\.json$/i.test(s)||/\.topojson$/i.test(s))a=aM.load(JSON.parse(r.target.result),{sourceUri:s,clampToGround:i});else if(/\.(kml|kmz)$/i.test(s))a=IM.load(t,{sourceUri:s,proxy:n,camera:o.camera,canvas:o.canvas,clampToGround:i,screenOverlayContainer:e.container});else if(/\.gpx$/i.test(s))a=fM.load(t,{sourceUri:s,proxy:n});else{e.dropError.raiseEvent(e,s,`Unrecognized file: ${s}`);return}u(a)&&e.dataSources.add(a).then(function(c){e.flyToOnDrop&&e.flyTo(c)}).catch(function(c){e.dropError.raiseEvent(e,s,c)})}catch(a){e.dropError.raiseEvent(e,s,a)}}}function Iyt(e,t){return function(n){e.dropError.raiseEvent(e,t.name,n.target.error)}}var aK=vyt;function Pyt(e,t){t=y(t,y.EMPTY_OBJECT);let n=new M2({scene:e.scene,container:e.bottomContainer,lowFrameRateMessage:t.lowFrameRateMessage});Object.defineProperties(e,{performanceWatchdog:{get:function(){return n}}})}var cK=Pyt;function kAe(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 c=t[a];c.match(o)[0].length>=s&&(c=c.slice(s)),i+=`${c}
`}return i}function Uf(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 c=o.getPrimitiveFunction;c===!0&&(c=function(){t[r]=t._voxelPrimitive[r]}),u(c)&&t._getPrimitiveFunctions.push(c);let l=Ce.observable();return Ce.defineProperty(t,r,{get:function(){return l()},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),l(f),u(a)&&u(t._voxelPrimitive)&&(a(f),e.requestRender())}}),t[r]=s,l}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=kAe(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===zi.BOX}}),n({name:"shapeIsEllipsoid",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsEllipsoid=o===zi.ELLIPSOID}}),n({name:"shapeIsCylinder",getPrimitiveFunction:function(){let o=t._voxelPrimitive.shape;t.shapeIsCylinder=o===zi.CYLINDER}}),n({name:"boundsBoxMaxX",initialValue:0,setPrimitiveFunction:i("maxBounds","x"),getPrimitiveFunction:function(){t.boundsBoxMaxX=t._voxelPrimitive.maxBounds.x}}),n({name:"boundsBoxMinX",initialValue:0,setPrimitiveFunction:i("minBounds","x"),getPrimitiveFunction:function(){t.boundsBoxMinX=t._voxelPrimitive.minBounds.x}}),n({name:"boundsBoxMaxY",initialValue:0,setPrimitiveFunction:i("maxBounds","y"),getPrimitiveFunction:function(){t.boundsBoxMaxY=t._voxelPrimitive.maxBounds.y}}),n({name:"boundsBoxMinY",initialValue:0,setPrimitiveFunction:i("minBounds","y"),getPrimitiveFunction:function(){t.boundsBoxMinY=t._voxelPrimitive.minBounds.y}}),n({name:"boundsBoxMaxZ",initialValue:0,setPrimitiveFunction:i("maxBounds","z"),getPrimitiveFunction:function(){t.boundsBoxMaxZ=t._voxelPrimitive.maxBounds.z}}),n({name:"boundsBoxMinZ",initialValue:0,setPrimitiveFunction:i("minBounds","z"),getPrimitiveFunction:function(){t.boundsBoxMinZ=t._voxelPrimitive.minBounds.z}}),n({name:"boundsEllipsoidMaxLongitude",initialValue:0,setPrimitiveFunction:i("maxBounds","x"),getPrimitiveFunction:function(){t.boundsEllipsoidMaxLongitude=t._voxelPrimitive.maxBounds.x}}),n({name:"boundsEllipsoidMinLongitude",initialValue:0,setPrimitiveFunction:i("minBounds","x"),getPrimitiveFunction:function(){t.boundsEllipsoidMinLongitude=t._voxelPrimitive.minBounds.x}}),n({name:"boundsEllipsoidMaxLatitude",initialValue:0,setPrimitiveFunction:i("maxBounds","y"),getPrimitiveFunction:function(){t.boundsEllipsoidMaxLatitude=t._voxelPrimitive.maxBounds.y}}),n({name:"boundsEllipsoidMinLatitude",initialValue:0,setPrimitiveFunction:i("minBounds","y"),getPrimitiveFunction:function(){t.boundsEllipsoidMinLatitude=t._voxelPrimitive.minBounds.y}}),n({name:"boundsEllipsoidMaxHeight",initialValue:0,setPrimitiveFunction:i("maxBounds","z"),getPrimitiveFunction:function(){t.boundsEllipsoidMaxHeight=t._voxelPrimitive.maxBounds.z}}),n({name:"boundsEllipsoidMinHeight",initialValue:0,setPrimitiveFunction:i("minBounds","z"),getPrimitiveFunction:function(){t.boundsEllipsoidMinHeight=t._voxelPrimitive.minBounds.z}}),n({name:"boundsCylinderMaxRadius",initialValue:0,setPrimitiveFunction:i("maxBounds","x"),getPrimitiveFunction:function(){t.boundsCylinderMaxRadius=t._voxelPrimitive.maxBounds.x}}),n({name:"boundsCylinderMinRadius",initialValue:0,setPrimitiveFunction:i("minBounds","x"),getPrimitiveFunction:function(){t.boundsCylinderMinRadius=t._voxelPrimitive.minBounds.x}}),n({name:"boundsCylinderMaxHeight",initialValue:0,setPrimitiveFunction:i("maxBounds","y"),getPrimitiveFunction:function(){t.boundsCylinderMaxHeight=t._voxelPrimitive.maxBounds.y}}),n({name:"boundsCylinderMinHeight",initialValue:0,setPrimitiveFunction:i("minBounds","y"),getPrimitiveFunction:function(){t.boundsCylinderMinHeight=t._voxelPrimitive.minBounds.y}}),n({name:"boundsCylinderMaxAngle",initialValue:0,setPrimitiveFunction:i("maxBounds","z"),getPrimitiveFunction:function(){t.boundsCylinderMaxAngle=t._voxelPrimitive.maxBounds.z}}),n({name:"boundsCylinderMinAngle",initialValue:0,setPrimitiveFunction:i("minBounds","z"),getPrimitiveFunction:function(){t.boundsCylinderMinAngle=t._voxelPrimitive.minBounds.z}}),n({name:"clippingBoxMaxX",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMaxX=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingBoxMinX",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingBoxMinX=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingBoxMaxY",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingBoxMaxY=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingBoxMinY",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingBoxMinY=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingBoxMaxZ",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingBoxMaxZ=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingBoxMinZ",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingBoxMinZ=t._voxelPrimitive.minClippingBounds.z}}),n({name:"clippingEllipsoidMaxLongitude",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxLongitude=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingEllipsoidMinLongitude",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingEllipsoidMinLongitude=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingEllipsoidMaxLatitude",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxLatitude=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingEllipsoidMinLatitude",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingEllipsoidMinLatitude=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingEllipsoidMaxHeight",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingEllipsoidMaxHeight=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingEllipsoidMinHeight",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingEllipsoidMinHeight=t._voxelPrimitive.minClippingBounds.z}}),n({name:"clippingCylinderMaxRadius",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","x"),getPrimitiveFunction:function(){t.clippingCylinderMaxRadius=t._voxelPrimitive.maxClippingBounds.x}}),n({name:"clippingCylinderMinRadius",initialValue:0,setPrimitiveFunction:i("minClippingBounds","x"),getPrimitiveFunction:function(){t.clippingCylinderMinRadius=t._voxelPrimitive.minClippingBounds.x}}),n({name:"clippingCylinderMaxHeight",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","y"),getPrimitiveFunction:function(){t.clippingCylinderMaxHeight=t._voxelPrimitive.maxClippingBounds.y}}),n({name:"clippingCylinderMinHeight",initialValue:0,setPrimitiveFunction:i("minClippingBounds","y"),getPrimitiveFunction:function(){t.clippingCylinderMinHeight=t._voxelPrimitive.minClippingBounds.y}}),n({name:"clippingCylinderMaxAngle",initialValue:0,setPrimitiveFunction:i("maxClippingBounds","z"),getPrimitiveFunction:function(){t.clippingCylinderMaxAngle=t._voxelPrimitive.maxClippingBounds.z}}),n({name:"clippingCylinderMinAngle",initialValue:0,setPrimitiveFunction:i("minClippingBounds","z"),getPrimitiveFunction:function(){t.clippingCylinderMinAngle=t._voxelPrimitive.minClippingBounds.z}}),n({name:"translationX",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.translationX=M.getTranslation(t._voxelPrimitive.modelMatrix,new h).x}}),n({name:"translationY",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.translationY=M.getTranslation(t._voxelPrimitive.modelMatrix,new h).y}}),n({name:"translationZ",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.translationZ=M.getTranslation(t._voxelPrimitive.modelMatrix,new h).z}}),n({name:"scaleX",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.scaleX=M.getScale(t._voxelPrimitive.modelMatrix,new h).x}}),n({name:"scaleY",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.scaleY=M.getScale(t._voxelPrimitive.modelMatrix,new h).y}}),n({name:"scaleZ",initialValue:1,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)},getPrimitiveFunction:function(){t.scaleZ=M.getScale(t._voxelPrimitive.modelMatrix,new h).z}}),n({name:"angleX",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)}}),n({name:"angleY",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)}}),n({name:"angleZ",initialValue:0,setPrimitiveFunction:function(){t._modelMatrixReady&&Sm(t)}})}var Oyt=new h,Ryt=new h,Byt=new Ba,Myt=new Z;function Sm(e){let t=h.fromElements(e.translationX,e.translationY,e.translationZ,Oyt),n=h.fromElements(e.scaleX,e.scaleY,e.scaleZ,Ryt),i=Byt;i.heading=e.angleX,i.pitch=e.angleY,i.roll=e.angleZ;let o=Z.fromHeadingPitchRoll(i,Myt),r=Z.multiplyByScale(o,n,o);e._voxelPrimitive.modelMatrix=M.fromRotationTranslation(r,t,e._voxelPrimitive.modelMatrix)}Object.defineProperties(Uf.prototype,{scene:{get:function(){return this._scene}},voxelPrimitive:{get:function(){return this._voxelPrimitive},set:function(e){if(u(this._customShaderCompilationRemoveCallback)&&this._customShaderCompilationRemoveCallback(),u(e)){this._voxelPrimitive=e;let t=this;t._voxelPrimitive.readyPromise.then(function(){t._customShaderCompilationRemoveCallback=t._voxelPrimitive.customShaderCompilationEvent.addEventListener(function(n){let i=t._voxelPrimitive.customShader.fragmentShaderText;t.shaderString=kAe(i),u(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,Sm(t)})}}}});Uf.prototype.toggleInspector=function(){this.inspectorVisible=!this.inspectorVisible};Uf.prototype.toggleDisplay=function(){this.displayVisible=!this.displayVisible};Uf.prototype.toggleTransform=function(){this.transformVisible=!this.transformVisible};Uf.prototype.toggleBounds=function(){this.boundsVisible=!this.boundsVisible};Uf.prototype.toggleClipping=function(){this.clippingVisible=!this.clippingVisible};Uf.prototype.toggleShader=function(){this.shaderVisible=!this.shaderVisible};Uf.prototype.compileShader=function(){u(this._voxelPrimitive)&&(this._voxelPrimitive.customShader=new TC({fragmentShaderText:this.shaderString,uniforms:this._voxelPrimitive.customShader.uniforms}))};Uf.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(`
`),c=a.length,l;if(t.shiftKey)for(l=0;l<c;++l)a[l][0]===" "&&(a[l][1]===" "?(a[l]=a[l].substr(2),r-=2):(a[l]=a[l].substr(1),r-=1));else for(l=0;l<c;++l)a[l]=`  ${a[l]}`,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};Uf.prototype.isDestroyed=function(){return!1};Uf.prototype.destroy=function(){let e=this;return this._definedProperties.forEach(function(t){Ce.getObservable(e,t).dispose()}),le(this)};var q2=Uf;function wH(e,t){e=In(e);let n=document.createElement("div"),i=new q2(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 s=Ea.createSection,a=Ea.createCheckbox,c=Ea.createRangeInput,l=Ea.createButton,f=s(r,"Display","displayVisible","toggleDisplay"),d=s(r,"Transform","transformVisible","toggleTransform"),p=s(r,"Bounds","boundsVisible","toggleBounds"),g=s(r,"Clipping","clippingVisible","toggleClipping"),m=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(c("Screen Space Error","screenSpaceError",0,128)),f.appendChild(c("Step Size","stepSize",0,2));let A=10,x=10,C=P.PI;d.appendChild(c("Translation X","translationX",-A,+A)),d.appendChild(c("Translation Y","translationY",-A,+A)),d.appendChild(c("Translation Z","translationZ",-A,+A)),d.appendChild(c("Scale X","scaleX",0,+x)),d.appendChild(c("Scale Y","scaleY",0,+x)),d.appendChild(c("Scale Z","scaleZ",0,+x)),d.appendChild(c("Heading","angleX",-C,+C)),d.appendChild(c("Pitch","angleY",-C,+C)),d.appendChild(c("Roll","angleZ",-C,+C));let T=zi.getMinBounds(zi.BOX),E=zi.getMaxBounds(zi.BOX),S=h.fromElements(zi.getMinBounds(zi.ELLIPSOID).x,zi.getMinBounds(zi.ELLIPSOID).y,-ie.WGS84.maximumRadius,new h),D=h.fromElements(zi.getMaxBounds(zi.ELLIPSOID).x,zi.getMaxBounds(zi.ELLIPSOID).y,1e7,new h),w=zi.getMinBounds(zi.CYLINDER),R=zi.getMaxBounds(zi.CYLINDER);FS("Max X","Min X","Max Y","Min Y","Max Z","Min Z","boundsBoxMaxX","boundsBoxMinX","boundsBoxMaxY","boundsBoxMinY","boundsBoxMaxZ","boundsBoxMinZ",T,E,"shapeIsBox",p),FS("Max Longitude","Min Longitude","Max Latitude","Min Latitude","Max Height","Min Height","boundsEllipsoidMaxLongitude","boundsEllipsoidMinLongitude","boundsEllipsoidMaxLatitude","boundsEllipsoidMinLatitude","boundsEllipsoidMaxHeight","boundsEllipsoidMinHeight",S,D,"shapeIsEllipsoid",p),FS("Max Radius","Min Radius","Max Height","Min Height","Max Angle","Min Angle","boundsCylinderMaxRadius","boundsCylinderMinRadius","boundsCylinderMaxHeight","boundsCylinderMinHeight","boundsCylinderMaxAngle","boundsCylinderMinAngle",w,R,"shapeIsCylinder",p),FS("Max X","Min X","Max Y","Min Y","Max Z","Min Z","clippingBoxMaxX","clippingBoxMinX","clippingBoxMaxY","clippingBoxMinY","clippingBoxMaxZ","clippingBoxMinZ",T,E,"shapeIsBox",g),FS("Max Longitude","Min Longitude","Max Latitude","Min Latitude","Max Height","Min Height","clippingEllipsoidMaxLongitude","clippingEllipsoidMinLongitude","clippingEllipsoidMaxLatitude","clippingEllipsoidMinLatitude","clippingEllipsoidMaxHeight","clippingEllipsoidMinHeight",S,D,"shapeIsEllipsoid",g),FS("Max Radius","Min Radius","Max Height","Min Height","Max Angle","Min Angle","clippingCylinderMaxRadius","clippingCylinderMinRadius","clippingCylinderMaxHeight","clippingCylinderMinHeight","clippingCylinderMaxAngle","clippingCylinderMinAngle",w,R,"shapeIsCylinder",g);let O=document.createElement("div");m.appendChild(O);let L=document.createElement("textarea");L.setAttribute("data-bind","textInput: shaderString, event: { keydown: shaderEditorKeyPress }"),O.className="cesium-cesiumInspector-styleEditor",O.appendChild(L);let N=l("Compile (Ctrl+Enter)","compileShader");O.appendChild(N);let _=document.createElement("label");_.style.display="block",_.setAttribute("data-bind","text: shaderCompilationMessage, style: {color: shaderCompilationSuccess ? 'green' : 'red'}"),O.appendChild(_),Ce.applyBindings(i,n)}Object.defineProperties(wH.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});wH.prototype.isDestroyed=function(){return!1};wH.prototype.destroy=function(){return Ce.cleanNode(this._element),this._container.removeChild(this._element),this.viewModel.destroy(),le(this)};function FS(e,t,n,i,o,r,s,a,c,l,f,d,p,g,m,A){let x=Ea.createRangeInput,C=p,T=g,E=A.appendChild(document.createElement("div"));E.setAttribute("data-bind",`if: ${m}`),E.appendChild(x(e,s,C.x,T.x)),E.appendChild(x(t,a,C.x,T.x)),E.appendChild(x(n,c,C.y,T.y)),E.appendChild(x(i,l,C.y,T.y)),E.appendChild(x(o,f,C.z,T.z)),E.appendChild(x(r,d,C.z,T.z))}var X2=wH;function Lyt(e){let t=document.createElement("div");t.className="cesium-viewer-voxelInspectorContainer",e.container.appendChild(t);let n=new X2(t,e.scene);Object.defineProperties(e,{voxelInspector:{get:function(){return n}}})}var lK=Lyt;var Nyt="1.102";return nxe(Fyt);})();
